Deduction method and device for multi-time scale control
By setting execution time information for different processes in the model and reasonably adjusting the execution frequency, the problem of excessive calculation amount or insufficient accuracy in the existing deduction technology is solved, and efficient and accurate deduction effect is achieved.
Patent Information
- Application Number
- CN202510504020.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-07-18
AI Technical Summary
When existing deduction techniques deal with complex scenarios, the calculation amount is too large or the calculation accuracy is insufficient, making it difficult to take into account both efficiency and accuracy.
The multi-time scale control deduction method is adopted, by setting different execution time information for different processes in the model, and the execution frequency is reasonably adjusted according to the process's attribute information and deduction parameters to ensure the consistent process execution accuracy.
It reduces unnecessary calculations, reduces the demand for computing resources, ensures accurate calculation of key processes, and improves overall deduction efficiency and accuracy.
Smart Images

Figure CN120337577A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of model-driven deduction analysis, and particularly to a deduction method and device with multi-time scale control. Background Art
[0002] Deduction technology is a method of predicting system behavior, solving problems, or optimizing decisions by constructing and analyzing models. The time in the deduction world is discrete, and the deduction software calculates the state of the deduction object at the end of each step with the deduction step length as the unit.
[0003] In the existing deduction technology, a single time scale or a simple time setting method is usually adopted for calculation and simulation. However, the change speeds of different deduction objects in complex scenarios may vary greatly, which leads to either excessive calculation amount, consuming a large amount of computing resources and time when dealing with complex processes, or inaccurate reflection of the state changes of deduction objects due to insufficient calculation accuracy. Summary of the Invention
[0004] The purpose of the present invention is to provide a deduction method and device with multi-time scale control to balance deduction efficiency and accuracy.
[0005] In a first aspect, the present invention provides a deduction method with multi-time scale control, including:
[0006] When starting the deduction, obtain model data and deduction parameters; wherein, the model data includes a runnable model and the attribute information of each process in the model, the attribute information includes time category, process execution accuracy, and process duration, and the time category includes either related to time or unrelated to time; the deduction parameters include the global simulation step length;
[0007] According to the attribute information of each process in the model and the deduction parameters, determine the execution time information of each process in the model; wherein, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process;
[0008] Deduce the model according to the execution time information of each process in the model.
[0009] In an optional embodiment, determining the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters includes:
[0010] In the time slot of the global simulation step length, obtain the target process in the model that meets the running conditions;
[0011] Judge whether the time category of the target process is related to time;
[0012] If the time category of the target process is time-independent, determine that the execution time information of the target process is to perform calculations and end the process within a time slot;
[0013] If the time category of the target process is time-dependent, determine the execution time information of the target process according to the process execution accuracy and process duration of the target process, as well as the global simulation step size.
[0014] In an alternative embodiment, within a time slot of the global simulation step size, obtain the target processes in the model that meet the running conditions, including:
[0015] In each time slot of the global simulation step size, obtain the currently occurring target trigger events;
[0016] Filter out the candidate processes corresponding to the target trigger events from the processes in the model;
[0017] Determine whether the candidate processes meet the preconditions for running;
[0018] If they meet the conditions, determine the candidate processes as the target processes.
[0019] In an alternative embodiment, the target processes include the processes in the model that meet the running conditions and have not been run; according to the process execution accuracy and process duration of the target processes, as well as the global simulation step size, determine the execution time information of the target processes, including:
[0020] According to the process execution accuracy of the target process and the global simulation step size, calculate the execution frequency of the target process, and according to the execution frequency of the target process and the current global cumulative step size, determine the global calculation step size information of the target process, where the global calculation step size information includes all the time step sizes that need to perform calculations;
[0021] According to the process duration of the target process and the global simulation step size, calculate the duration step size of the target process, and according to the duration step size of the target process and the current global cumulative step size, determine the global end step size information of the target process, where the global end step size information includes the time step size corresponding to ending the process;
[0022] Take the global calculation step size information and global end step size information of the target process as the execution time information of the target process.
[0023] In an alternative embodiment, the target processes include the processes in the model that are in operation and the processes that meet the running conditions and have not been run; according to the process execution accuracy and process duration of the target processes, as well as the global simulation step size, determine the execution time information of the target processes, including:
[0024] Based on the execution frequency of the target process, determine whether the target process performs calculations in the next time step to obtain the next calculation step information of the target process; wherein, the execution frequency of the target process is obtained based on the process execution accuracy of the target process and the global simulation step size;
[0025] Based on the continuous step size of the target process, determine whether the target process ends in the next time step to obtain the next end step information of the target process; wherein, the continuous step size of the target process is obtained based on the process duration of the target process and the global simulation step size;
[0026] Use the next calculation step information and the next end step information of the target process as the execution time information of the target process.
[0027] In an alternative embodiment, the execution frequency of the target process is the integer value of the ratio of the process execution accuracy of the target process to the global simulation step size;
[0028] The continuous step size of the target process is the integer value of the ratio of the process duration of the target process to the global simulation step size.
[0029] In an alternative embodiment, based on the execution frequency of the target process, determine whether the target process performs calculations in the next time step to obtain the next calculation step information of the target process, including:
[0030] Determine whether the difference between the global cumulative step size corresponding to the next time step and the global cumulative step size at the last calculation of the target process is equal to the execution frequency of the target process;
[0031] If it is equal to the execution frequency of the target process, determine that the next calculation step information of the target process is to perform calculations;
[0032] If it is not equal to the execution frequency of the target process, determine that the next calculation step information of the target process is not to perform calculations;
[0033] Based on the continuous step size of the target process, determine whether the target process ends in the next time step to obtain the next end step information of the target process, including:
[0034] Determine whether the difference between the global cumulative step size corresponding to the next time step and the global cumulative step size when the target process starts to execute is equal to the continuous step size of the target process;
[0035] If it is equal to the continuous step size of the target process, determine that the next end step information of the target process is to end;
[0036] If it is not equal to the continuous step size of the target process, determine that the next end step information of the target process is not to end.
[0037] In a second aspect, the present invention provides a deduction device for multi-time scale control, comprising:
[0038] An acquisition module, configured to acquire model data and deduction parameters when starting deduction; wherein, the model data includes a runnable model and attribute information of each process in the model, the attribute information includes a time category, a process execution accuracy, and a process duration, and the time category includes one of related to time and unrelated to time; the deduction parameters include a global simulation step size;
[0039] A determination module, configured to determine the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters; wherein, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process;
[0040] A deduction module, configured to deduce the model according to the execution time information of each process in the model.
[0041] In a third aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein a computer program executable on the processor is stored in the memory, and when the processor executes the computer program, the deduction method for multi-time scale control according to any one of the foregoing embodiments is implemented.
[0042] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, the deduction method for multi-time scale control according to any one of the foregoing embodiments is executed.
[0043] The deduction method and device for multi-time scale control provided by the present invention, when starting deduction, acquire model data and deduction parameters; wherein, the model data includes a runnable model and attribute information of each process in the model, the attribute information includes a time category, a process execution accuracy, and a process duration, and the time category includes one of related to time and unrelated to time; the deduction parameters include a global simulation step size; determine the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters; wherein, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process; deduce the model according to the execution time information of each process in the model. In this way, by setting corresponding execution time information for processes with different attribute information in the model, the deduction of multi-time scale control is realized. By reasonably adjusting the execution frequency, unnecessary calculation amount is reduced, and the demand for computing resources is greatly reduced. It not only ensures the accurate calculation of key processes, but also improves the deduction efficiency as a whole, thus taking into account both deduction efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the accompanying drawings required for the description of the specific embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0045] Figure 1 A flowchart showing the process of a multi-time-scale control deduction method provided by an embodiment of the present invention;
[0046] Figure 2 A flowchart showing the process of another multi-time-scale control deduction method provided by an embodiment of the present invention;
[0047] Figure 3 A structural schematic diagram of a multi-time-scale control deduction device provided by an embodiment of the present invention;
[0048] Figure 4 A structural schematic diagram of an electronic device provided by an embodiment of the present invention. Specific embodiments
[0049] The following will clearly and completely describe the technical solutions of the present invention in combination with the embodiments. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0050] In the existing deduction technologies, a single time scale or a simple time setting method is usually used for calculation and simulation. This results in either an excessive amount of calculation, consuming a large amount of computing resources and time when dealing with complex processes; or due to insufficient calculation accuracy, the state changes of the deduction object cannot be accurately reflected. For example, in the simulation of an ecosystem, for processes such as plant growth, if a fixed short time step is used for calculation, for processes with a long growth cycle, a large amount of unnecessary calculations will be generated; while if a longer time step is used, it is difficult to capture some short-term key changes. Another example is in the simulation of industrial production processes, where the duration and accuracy requirements of different production links vary greatly. The existing deduction methods are difficult to balance efficiency and accuracy, severely restricting the application and development of deduction technologies in complex scenarios. Based on this, a multi-time-scale control deduction method and device provided by an embodiment of the present invention can set different process execution accuracies for different processes in the model, reducing the calculation frequency, lowering the calculation cost, and improving the deduction efficiency while ensuring the expected results are obtained during the deduction process.
[0051] For ease of understanding this embodiment, a deduction method for multi-time scale control disclosed in the embodiments of the present invention will be introduced in detail first.
[0052] The embodiments of the present invention provide a deduction method for multi-time scale control, and this method can be executed by an electronic device with data processing capabilities. Refer to Figure 1 the flowchart of a deduction method for multi-time scale control shown in the figure. This method mainly includes the following steps S110 to step S130:
[0053] Step S110, when starting the deduction, obtain model data and deduction parameters.
[0054] Among them, the model data includes a runnable model and the attribute information of each process in the model. The attribute information includes time category, process execution accuracy, and process duration. The time category includes either time-related or time-unrelated; the deduction parameters include the global simulation step size.
[0055] The model to be deduced above can be any model with processes and can be run, such as an ecosystem model, an industrial production model, or a project schedule model, etc. The processes are divided into two types: time-related and time-unrelated. The time-unrelated processes can be processes such as measurement and reasoning, which are processes that should not occupy the deduction world time during the deduction process. The process execution accuracy refers to how often a process performs a calculation. For example, when deducing the growth of a tree, the process of the result sub gives data every 10 days, and the growth process gives data every 1 year. Then the process execution accuracy of the result sub process is 10 days, and the process execution accuracy of the growth process is 1 year. The process duration refers to the duration between the start and end of a process execution. The process execution accuracy of each process is less than its process duration. Among them, for time-unrelated processes, their process duration is 0, and there is no process execution accuracy.
[0056] The deduction parameters may include the global simulation step size, and may also include one or more of initial conditions, boundary conditions, control variables, random factors, algorithm parameters, and input data. The global simulation step size refers to the time step of the global deduction world, which is used to control the time advancement at the system level and determines the accuracy of the overall simulation time of the system. All processes will advance the simulation according to this step size. Here, the system refers to the system that executes the deduction method of this multi-time scale control. In other words, the global simulation step size refers to how often the deduction world performs calculations and gives the state of the deduction object. The global simulation step size is the basic unit for controlling the time advancement in the system simulation process. The global simulation step size does not exceed the minimum process execution accuracy set in the model. The initial conditions refer to the state of the system at the start of operation or the beginning of the simulation. The boundary conditions define the behavior or state of the system at its edges. The control variable is a variable that is deliberately changed during the simulation to observe its impact on the results. Many processes in the real world contain a certain degree of uncertainty or randomness. Introducing random factors into the model can help more accurately reflect the actual situation. Algorithm parameters: Different mathematical algorithms and numerical methods have their own parameter settings, such as the number of iterations, convergence criteria, etc., which will all affect the deduction results of the model. The input data provides the necessary information basis for the model.
[0057] Step S120, according to the attribute information of each process in the model and the deduction parameters, determine the execution time information of each process in the model; among them, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process.
[0058] Considering processes that are independent of time and do not occupy the time of the deduction process, the execution time information of processes independent of time can be set to perform calculations and end the process in a time slot. Based on this, in some possible embodiments, the above step S120 may include the following sub-steps S121 to sub-step S124:
[0059] Sub-step S121, in the time slot of the global simulation step size, obtain the target process in the model that meets the running conditions.
[0060] The operating conditions of different processes can be different. The specific operating conditions can be set according to actual requirements and are not limited here. Optionally, the operating conditions may include that the corresponding trigger event occurs and the preconditions for operation are met. Based on this, in each time slot of the global simulation step, the target trigger event occurring currently can be obtained; the candidate processes corresponding to the target trigger event are filtered out from the processes of the model; it is judged whether the candidate processes meet the preconditions for operation; if so, the candidate processes are determined as the target processes. Here, the trigger event occurring currently is called the target trigger event. The target trigger event can be one or more. First, the processes corresponding to the target trigger event can be filtered out, which are called candidate processes here, and then the candidate processes that meet the preconditions for operation are used as the target processes. Among them, the candidate processes can be one or more, and the preconditions for operation corresponding to different candidate processes can be different. The finally determined target processes can be one or more. For example, the processes in the model include Process 1, Process 2, Process 3, etc., the target trigger events include Trigger Event 1 and Trigger Event 3, Trigger Event 1 corresponds to Process 1, and Trigger Event 3 corresponds to Process 3. Then the candidate processes are Process 1 and Process 3; if Process 1 meets its preconditions for operation and Process 3 does not meet its preconditions for operation, the target process is Process 1.
[0061] Sub-step S122: Judge whether the time category of the target process is related to time. If not, execute sub-step S123; if so, execute sub-step S124.
[0062] Sub-step S123: Determine that the execution time information of the target process is to perform calculations and end the process in the time slot.
[0063] Sub-step S124: Determine the execution time information of the target process according to the process execution accuracy and process duration of the target process, and the global simulation step.
[0064] This embodiment provides two ways to determine the execution time information of the target process, which are as follows:
[0065] Method 1:
[0066] The target process includes the processes in the model that meet the running conditions and are not running. The execution time information of the target process is determined as follows: According to the process execution accuracy of the target process and the global simulation step size, calculate the execution frequency of the target process, and based on the execution frequency of the target process and the current global cumulative step size, determine the global calculation step size information of the target process. The global calculation step size information includes all the time step sizes that require calculation; According to the process duration of the target process and the global simulation step size, calculate the duration step size of the target process, and based on the duration step size of the target process and the current global cumulative step size, determine the global end step size information of the target process. The global end step size information includes the time step size corresponding to the end process; Use the global calculation step size information and the global end step size information of the target process as the execution time information of the target process.
[0067] In Method 1, all the time step sizes that require calculation of the target process and the time step size corresponding to the end process can be obtained.
[0068] Method 2:
[0069] The target process includes the processes in the model that are running and the processes that meet the running conditions and are not running. The execution time information of the target process is determined as follows: According to the execution frequency of the target process, determine whether the target process performs calculation in the next time step to obtain the next calculation step size information of the target process; Among them, the execution frequency of the target process is obtained based on the process execution accuracy of the target process and the global simulation step size; According to the duration step size of the target process, determine whether the target process ends in the next time step to obtain the next end step size information of the target process; Among them, the duration step size of the target process is obtained based on the process duration of the target process and the global simulation step size; Use the next calculation step size information and the next end step size information of the target process as the execution time information of the target process.
[0070] In Method 2, the execution time information on whether the target process performs calculation and whether it ends in the next time step can be obtained.
[0071] In a possible implementation, the execution frequency of the above target process is the ratio of the process execution accuracy of the target process to the global simulation step size and is rounded; the duration step size of the target process is the ratio of the process duration of the target process to the global simulation step size and is rounded. Among them, the rounding can be rounding up or rounding down.
[0072] For the above-mentioned second method, the next calculation step information of the target process can be obtained through the following process: Determine whether the difference between the global cumulative step corresponding to the next time step and the global cumulative step at the last calculation of the target process is equal to the execution frequency of the target process; if it is equal to the execution frequency of the target process, determine that the next calculation step information of the target process is to execute the calculation; if it is not equal to the execution frequency of the target process, determine that the next calculation step information of the target process is not to execute the calculation.
[0073] Moreover, the next ending step information of the target process can be obtained through the following process: Determine whether the difference between the global cumulative step corresponding to the next time step and the global cumulative step at the start of the execution of the target process is equal to the duration step of the target process; if it is equal to the duration step of the target process, determine that the next ending step information of the target process is to end; if it is not equal to the duration step of the target process, determine that the next ending step information of the target process is not to end.
[0074] It should be noted that different processes are independent of each other. One or more of the same process can run at the same time. For example, assuming that the global simulation step is 1 s and the process duration of process A is 5 s, and process A meets the running conditions at times t and t + 2 s, then one process A starts running at times t + 1 s and t + 3 s respectively. In this way, two processes A will be running simultaneously at time t + 3 s, and these two processes A are independent of each other.
[0075] Step S130, deduce the model according to the execution time information of each process in the model.
[0076] When deducing the model, a process that is independent of time will execute calculations and end the process in a time slot, thus not occupying the simulation deduction time. A process that is related to time will only execute calculations at the time steps when calculations need to be executed and end the process at the time step corresponding to the end of the process.
[0077] The deduction method with multi-time-scale control provided by the embodiments of the present invention, when starting the deduction, obtains model data and deduction parameters; wherein, the model data includes a runnable model and the attribute information of each process in the model, and the attribute information includes a time category, a process execution accuracy, and a process duration, and the time category includes one of related to time and unrelated to time; the deduction parameters include a global simulation step size; according to the attribute information of each process in the model and the deduction parameters, determine the execution time information of each process in the model; wherein, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process; according to the execution time information of each process in the model, deduce the model. In this way, by setting the corresponding execution time information for the processes with different attribute information in the model, the deduction with multi-time-scale control is realized. By reasonably adjusting the execution frequency, unnecessary calculation amounts are reduced, and the demand for computing resources is greatly reduced. It not only ensures the accurate calculation of key processes but also improves the deduction efficiency as a whole, thus taking into account both the deduction efficiency and accuracy.
[0078] For the sake of easy understanding, taking the above-mentioned method two as an example, the following Figure 2 introduces the above-mentioned deduction method with multi-time-scale control in detail.
[0079] The overall scheme principle is as follows: During the deduction, according to the ratio of the process execution accuracy of different processes to the global simulation step size, selectively perform accurate calculations on each process. As the deduction progresses, judge whether each process ends according to the ratio of the process duration to the global simulation step size, so as to simulate the entire deduction scenario completely and efficiently.
[0080] As Figure 2 shown, the method includes the following steps:
[0081] Step S210, set time parameters.
[0082] 1) Process time parameters of multi-time scale:
[0083] In the model establishment stage, according to prior knowledge, classify the processes into processes related to time and processes unrelated to time. Among them, for the processes unrelated to time, their process duration is 0, they do not occupy the time of the deduction process, and there is no process execution accuracy; for the processes related to time, the process execution accuracy and the process duration are clearly given, and the process execution accuracy should be less than the process duration.
[0084] 2) Deduction time parameters:
[0085] Before the deduction starts, set the global simulation step size of the deduction world, and the global simulation step size should not exceed the minimum process execution accuracy set in the model.
[0086] Step S220, start the deduction execution and data acquisition.
[0087] When the deduction is started, the model data and deduction parameters will be automatically pushed to the simulation deduction service. The simulation deduction service will judge whether the process meets the running conditions during the time slot of the global simulation step length (that is, when the previous step ends and the next step has not started).
[0088] Step S230, perform the calculation process.
[0089] When the simulation deduction service determines that the process meets the running conditions and can run:
[0090] 1) For processes independent of time, calculations will be performed during the time slot, thus not occupying the simulation deduction time.
[0091] 2) For processes related to time, it will be judged whether the process performs calculations in the next time step according to the execution frequency. If the next time step does not meet the execution frequency, no calculation will be performed. If the next time step meets the execution frequency (that is, the global cumulative step of the next time step - the global cumulative step when the process was last calculated = the execution frequency), calculations will be performed.
[0092] Among them, the execution frequency is equal to the ratio of the process execution accuracy and the global simulation step length, and the result is rounded up or down. For example, if the time accuracy of a certain chemical reaction process is 5 minutes and the global simulation step length is set to 1 minute, then the ratio is 5, and it remains 5 after rounding up. After the chemical reaction process starts running, the system will run the process according to this ratio, that is, for every 5 deduction calculations, a detailed calculation will be performed for this chemical reaction process, thus effectively reducing the unnecessary calculation frequency of some processes and saving computing resources.
[0093] Step S240, end the process.
[0094] 1) For processes independent of time, the process will end during the time slot, thus not occupying the simulation deduction time.
[0095] 2) For processes related to time, if the next time step meets the continuous step length of the process (that is, the global cumulative step of the next time step - the global cumulative step when the process starts to execute = the continuous step length), then it is determined that the process ends in the next time step.
[0096] Among them, the continuous step length is equal to the ratio of the process duration and the global simulation step length, and it is also rounded up or down. For example, in the project progress deduction, a project is expected to last for 30 days, the global simulation step length is 1 day, the ratio is 30, and it is 30 after rounding up. After the project process starts running, the system ends the process according to this ratio to ensure that the end state of the process is accurately determined at the appropriate time node.
[0097] In the embodiments of the present invention, by reasonably adjusting the execution frequency, unnecessary computational amount is reduced, and the demand for computing resources is greatly reduced. This not only ensures the accurate calculation of key processes but also improves the deduction efficiency as a whole.
[0098] Corresponding to the above-described deduction method for multi-time scale control, the embodiments of the present invention further provide a deduction device for multi-time scale control. Refer to Figure 3 the structural schematic diagram of a deduction device for multi-time scale control shown in
[0099] An acquisition module 301, configured to acquire model data and deduction parameters when starting a deduction; wherein, the model data includes a runnable model and attribute information of each process in the model, the attribute information includes a time category, a process execution accuracy, and a process duration, the time category includes either time-related or time-unrelated; the deduction parameters include a global simulation step size;
[0100] A determination module 302, configured to determine the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters; wherein, the execution frequency corresponding to the execution time information of a process is consistent with the process execution accuracy of the process;
[0101] A deduction module 303, configured to perform a deduction on the model according to the execution time information of each process in the model.
[0102] The deduction device for multi-time scale control provided by the embodiments of the present invention, when starting a deduction, acquires model data and deduction parameters; wherein, the model data includes a runnable model and attribute information of each process in the model, the attribute information includes a time category, a process execution accuracy, and a process duration, the time category includes either time-related or time-unrelated; the deduction parameters include a global simulation step size; determines the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters; wherein, the execution frequency corresponding to the execution time information of a process is consistent with the process execution accuracy of the process; and performs a deduction on the model according to the execution time information of each process in the model. In this way, by setting corresponding execution time information for processes with different attribute information in the model, the deduction of multi-time scale control is realized. By reasonably adjusting the execution frequency, unnecessary computational amount is reduced, and the demand for computing resources is greatly reduced. This not only ensures the accurate calculation of key processes but also improves the deduction efficiency as a whole, thus taking into account both the deduction efficiency and accuracy.
[0103] Further, the above-mentioned determination module 302 is specifically configured to: in a time slot of the global simulation step length, obtain a target process in the model that meets the running conditions; determine whether the time category of the target process is related to time; if the time category of the target process is not related to time, determine that the execution time information of the target process is to perform calculations in the time slot and end the process; if the time category of the target process is related to time, determine the execution time information of the target process according to the process execution accuracy and process duration of the target process, and the global simulation step length.
[0104] Further, the above-mentioned determination module 302 is further configured to: in each time slot of the global simulation step length, obtain a target trigger event that occurs currently; screen out candidate processes corresponding to the target trigger event from the processes in the model; determine whether the candidate processes meet the preconditions for running; if they meet, determine the candidate processes as the target processes.
[0105] Further, the above-mentioned target processes include processes in the model that meet the running conditions and have not been run; the determination module 302 is further configured to: calculate the execution frequency of the target process according to the process execution accuracy of the target process and the global simulation step length, and determine the global calculation step length information of the target process according to the execution frequency of the target process and the current global cumulative step length, where the global calculation step length information includes all time step lengths that need to perform calculations; calculate the continuous step length of the target process according to the process duration of the target process and the global simulation step length, and determine the global end step length information of the target process according to the continuous step length of the target process and the current global cumulative step length, where the global end step length information includes the time step length corresponding to the end process; use the global calculation step length information and the global end step length information of the target process as the execution time information of the target process.
[0106] Further, the above-mentioned target processes include processes that are in operation and processes that meet the running conditions and have not been run in the model; the determination module 302 is further configured to: determine whether the target process performs calculations in the next time step according to the execution frequency of the target process, and obtain the next calculation step length information of the target process; where the execution frequency of the target process is obtained based on the process execution accuracy of the target process and the global simulation step length; determine whether the target process ends in the next time step according to the continuous step length of the target process, and obtain the next end step length information of the target process; where the continuous step length of the target process is obtained based on the process duration of the target process and the global simulation step length; use the next calculation step length information and the next end step length information of the target process as the execution time information of the target process.
[0107] Further, the execution frequency of the above-mentioned target process is the ratio of the process execution accuracy of the target process to the global simulation step length and is rounded up;
[0108] The continuous step length of the target process is the integer value obtained by taking the ratio of the process duration of the target process to the global simulation step length.
[0109] Further, when the determining module 302 executes to determine whether to perform a calculation for the target process at the next time step according to the execution frequency of the target process, and obtains the next calculation step length information of the target process, it is further used for: determining whether the difference between the global cumulative step length corresponding to the next time step and the global cumulative step length when the target process was last calculated is equal to the execution frequency of the target process; if it is equal to the execution frequency of the target process, determining that the next calculation step length information of the target process is to perform a calculation; if it is not equal to the execution frequency of the target process, determining that the next calculation step length information of the target process is not to perform a calculation.
[0110] When the determining module 302 executes to determine whether the target process ends at the next time step according to the continuous step length of the target process, and obtains the next end step length information of the target process, it is further used for: determining whether the difference between the global cumulative step length corresponding to the next time step and the global cumulative step length when the target process starts to execute is equal to the continuous step length of the target process; if it is equal to the continuous step length of the target process, determining that the next end step length information of the target process is to end; if it is not equal to the continuous step length of the target process, determining that the next end step length information of the target process is not to end.
[0111] The principle of implementation and the technical effects produced by the multi-time-scale control deduction device provided in this embodiment are the same as those in the foregoing multi-time-scale control deduction method embodiment. For a brief description, for the parts not mentioned in the multi-time-scale control deduction device embodiment, reference may be made to the corresponding content in the foregoing multi-time-scale control deduction method embodiment.
[0112] As Figure 4 shown, an electronic device 400 provided in an embodiment of the present invention includes: a processor 401, a memory 402, and a bus. The memory 402 stores a computer program that can run on the processor 401. When the electronic device 400 runs, communication is carried out between the processor 401 and the memory 402 through the bus, and the processor 401 executes the computer program to implement the foregoing multi-time-scale control deduction method.
[0113] Specifically, the foregoing memory 402 and processor 401 can be general-purpose memory and processor, and no specific limitation is made here.
[0114] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the deduction method of multi-time scale control in the foregoing method embodiment. The computer-readable storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), RAMs, magnetic disks, or optical discs.
[0115] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" in this article represents any one of multiple types or any combination of at least two of multiple types. For example, including at least one of A, B, and C may represent selecting any one or more elements from the set composed of A, B, and C.
[0116] In all the examples shown and described here, any specific value should be interpreted as merely exemplary and not as a limitation. Therefore, other examples of the exemplary embodiments may have different values.
[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0118] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods. For another example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of devices or modules can be in electrical, mechanical or other forms.
[0119] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules, that is, they can be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0120] In addition, in each embodiment of the present invention, the functional modules can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module.
[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features. And these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A deduction method for multi-time-scale control, characterized in that Including: When starting the deduction, obtain model data and deduction parameters; wherein, the model data includes a runnable model and attribute information of each process in the model, the attribute information includes a time category, a process execution accuracy, and a process duration, and the time category includes one of related to time and unrelated to time; the deduction parameters include a global simulation step size; According to the attribute information of each process in the model and the deduction parameters, determine the execution time information of each process in the model; wherein, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process; Deduce the model according to the execution time information of each process in the model.
2. The method according to claim 1, wherein The determining the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters includes: In a time slot of the global simulation step size, obtain a target process in the model that meets the running conditions; Judge whether the time category of the target process is related to time; If the time category of the target process is unrelated to time, determine the execution time information of the target process as performing calculations and ending the process in the time slot; If the time category of the target process is related to time, determine the execution time information of the target process according to the process execution accuracy and process duration of the target process, and the global simulation step size.
3. The method according to claim 2, wherein The obtaining a target process in the model that meets the running conditions in a time slot of the global simulation step size includes: In each time slot of the global simulation step size, obtain a target trigger event that occurs currently; Screen out candidate processes corresponding to the target trigger event from the processes of the model; Judge whether the candidate process meets the preconditions for running; If it meets, determine the candidate process as the target process.
4. The method according to claim 2, characterized in that The target process includes processes in the model that meet the running conditions and have not been run; The determining the execution time information of the target process according to the process execution accuracy and process duration of the target process, and the global simulation step size includes: According to the process execution accuracy of the target process and the global simulation step size, calculate the execution frequency of the target process, and according to the execution frequency of the target process and the current global cumulative step size, determine the global calculation step size information of the target process, and the global calculation step size information includes all time step sizes that need to perform calculations; According to the process duration of the target process and the global simulation step size, calculate the duration step size of the target process, and according to the duration step size of the target process and the current global cumulative step size, determine the global end step size information of the target process, and the global end step size information includes the time step size corresponding to ending the process; Use the global calculation step size information and global end step size information of the target process as the execution time information of the target process.
5. The method according to claim 2, characterized in that, The target process includes processes in the model that are in operation and processes that meet the running conditions and have not been run; Determining the execution time information of the target process according to the process execution accuracy and process duration of the target process, and the global simulation step length, includes: Judging whether the target process performs calculation in the next time step according to the execution frequency of the target process, to obtain the next calculation step information of the target process; wherein, the execution frequency of the target process is obtained based on the process execution accuracy of the target process and the global simulation step length; Judging whether the target process ends in the next time step according to the continuous step length of the target process, to obtain the next ending step information of the target process; wherein, the continuous step length of the target process is obtained based on the process duration of the target process and the global simulation step length; Taking the next calculation step information and the next ending step information of the target process as the execution time information of the target process.
6. The method according to claim 4 or 5, characterized in that The execution frequency of the target process is the integer value obtained by taking the ratio of the process execution accuracy of the target process to the global simulation step length; The continuous step length of the target process is the integer value obtained by taking the ratio of the process duration of the target process to the global simulation step length.
7. The method according to claim 5, characterized in that, The judging whether the target process performs calculation in the next time step according to the execution frequency of the target process, to obtain the next calculation step information of the target process, includes: Judging whether the difference between the global cumulative step corresponding to the next time step and the global cumulative step at the time when the target process last performed calculation is equal to the execution frequency of the target process; If it is equal to the execution frequency of the target process, determining that the next calculation step information of the target process is to perform calculation; If it is not equal to the execution frequency of the target process, determining that the next calculation step information of the target process is not to perform calculation; The judging whether the target process ends in the next time step according to the continuous step length of the target process, to obtain the next ending step information of the target process, includes: Judging whether the difference between the global cumulative step corresponding to the next time step and the global cumulative step at the time when the target process starts to execute is equal to the continuous step length of the target process; If it is equal to the continuous step length of the target process, determining that the next ending step information of the target process is to end; If it is not equal to the continuous step length of the target process, determining that the next ending step information of the target process is not to end.
8. A deduction device for multi-time-scale control, characterized in that Includes: An acquisition module, configured to acquire model data and deduction parameters when starting the deduction; wherein, the model data includes a model that can be run and the attribute information of each process in the model, the attribute information includes a time category, a process execution accuracy, and a process duration, and the time category includes one of related to time and unrelated to time; the deduction parameters include a global simulation step length; A determination module, configured to determine the execution time information of each process in the model according to the attribute information of each process in the model and the deduction parameters; wherein, the execution frequency corresponding to the execution time information of the process is consistent with the process execution accuracy of the process. A deduction module, configured to deduce the model according to the execution time information of each process in the model.
9. An electronic device, comprising a memory and a processor, wherein a computer program that can run on the processor is stored in the memory, characterized in that, When the processor executes the computer program, it implements the deduction method for multi-time scale control according to any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that, When the computer program runs on the processor, it executes the deduction method for multi-time scale control according to any one of claims 1-7.