CN114912282A - Simulation calculation method, device, equipment and storage medium - Google Patents

Simulation calculation method, device, equipment and storage medium Download PDF

Info

Publication number
CN114912282A
CN114912282A CN202210565145.0A CN202210565145A CN114912282A CN 114912282 A CN114912282 A CN 114912282A CN 202210565145 A CN202210565145 A CN 202210565145A CN 114912282 A CN114912282 A CN 114912282A
Authority
CN
China
Prior art keywords
simulation
subsystem
subsystems
whole
result data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210565145.0A
Other languages
Chinese (zh)
Inventor
金留欢
孙忠潇
杨浩
周凡利
陈立平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Tongyuan Software & Control Technology Co ltd
Original Assignee
Suzhou Tongyuan Software & Control Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Tongyuan Software & Control Technology Co ltd filed Critical Suzhou Tongyuan Software & Control Technology Co ltd
Priority to CN202210565145.0A priority Critical patent/CN114912282A/en
Publication of CN114912282A publication Critical patent/CN114912282A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/18Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Algebra (AREA)
  • Probability & Statistics with Applications (AREA)
  • Operations Research (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention discloses a simulation calculation method, a simulation calculation device, simulation calculation equipment and a storage medium. A method of simulation computation, comprising: before simulation begins, dividing the whole simulation system into N groups of subsystems according to a simulation period; acquiring a system sampling period T of the whole simulation system and a sampling period Ti of each subsystem in the N groups of subsystems; when the whole system runs in a simulation mode, when the simulation time reaches the simulation step number n, for the ith group of subsystems, the simulation times of the subsystems in the current simulation step of the whole simulation system are determined according to the simulation step number n, the system sampling period and the subsystem sampling period Ti; and determining simulation calculation result data of the subsystem according to the simulation times. According to the method, the sampling period of the system is not limited by the greatest common divisor of the simulation periods of all the groups of subsystems, and a large amount of invalid simulation calculation performed by a simulator is reduced as much as possible, so that the problem of system resource waste caused by too small sampling period is avoided as much as possible.

Description

Simulation calculation method, device, equipment and storage medium
Technical Field
The invention relates to the technical field of electronic circuits, in particular to a simulation calculation method, a simulation calculation device, simulation calculation equipment and a storage medium.
Background
In the prior art, when a plurality of subsystems with different sampling periods exist in a simulation model established by a user, a simulation step length used in simulation generally adopts the greatest common divisor of the sampling periods of all groups of subsystems, for example, if the period of the subsystem 1 is 0.5; the sampling period of the subsystem 2 is 0.75, and the greatest common divisor is 0.25; the sampling period of the total system should be, for example, 0.05, 0.125, 0.0625, 0.01; that is, the greatest common divisor is an integer multiple of the sampling period. Especially, when the number of subsystems is large, the greatest common divisor is small, so that the sampling period of the total system is small, the simulator is caused to perform a large amount of invalid simulation calculations, and the calculation resources of the system are wasted.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a simulation calculation method, apparatus, device and storage medium, so as to solve the above problems.
In order to achieve the above object, an embodiment of the present invention provides a simulation calculation method, including:
before simulation begins, dividing the whole simulation system into N groups of subsystems according to a simulation cycle, wherein N is more than or equal to 1;
acquiring a system sampling period T of the whole simulation system and a sampling period Ti of each subsystem in the N groups of subsystems; i is more than or equal to 1 and less than or equal to N;
when the whole simulation system is in simulation operation, when the simulation time reaches the step number n of the simulation,
for the ith group of subsystems, determining the simulation times of the subsystems in the current simulation step of the whole simulation system according to the simulation step number n, the system sampling period T and the sampling period Ti of the subsystems;
and determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times.
In one embodiment, determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times comprises:
if the simulation times are more than or equal to 1, sequentially carrying out simulation calculation of corresponding times on the subsystems;
acquiring simulation calculation result data of the last simulation calculation;
taking the simulation calculation result data of the last simulation calculation as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system; or,
if the simulation times are equal to 0, acquiring historical simulation calculation result data of the subsystem closest to the current time;
and taking the historical simulation calculation result data as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
In one embodiment, the sub-systems are sequentially subjected to a plurality of times of simulation calculation; acquiring simulation calculation result data of the last simulation calculation, wherein the data comprises the following steps:
calculating the system simulation Time Time (n x Tz) corresponding to the current simulation step number n of the whole simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the ith group of subsystems ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
judging whether the difference value C is greater than or equal to the sampling period Ti of the subsystem or not;
if yes, performing simulation calculation on the subsystem, and increasing ni by 1;
circularly calculating until the difference value C is smaller than the sampling period Ti of the subsystem;
and acquiring simulation calculation result data of the last simulation calculation.
In one embodiment, the sub-systems are sequentially subjected to a plurality of times of simulation calculation; acquiring simulation calculation result data of the last simulation calculation, wherein the data comprises the following steps:
determining the simulation times of the subsystem in the current simulation step of the whole simulation system;
performing simulation calculation on the subsystem for multiple times according to the simulation times;
and acquiring simulation calculation result data of the last simulation calculation.
In one embodiment, determining the number of simulations of the subsystem in a current simulation step of the entire simulation system comprises:
calculating the system simulation Time Time (n x Tz) corresponding to the current simulation step number n of the whole simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the current historical calculation times of the i-th group of subsystems;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
calculating the quotient of the difference C and the sampling period Ti of the subsystem:
V=C/Ti;
and carrying out rounding operation on the V to obtain simulation times:
B=[V]。
in one embodiment, before the simulation starts, the whole simulation system is divided into N groups of subsystems according to the simulation cycle, including:
acquiring a simulation period of each simulation module in the system;
determining a plurality of simulation modules corresponding to each simulation period;
and dividing the plurality of simulation modules into the same group of subsystems.
In a second aspect, the present application provides an emulated computing device, comprising:
the system comprises a dividing module, a simulation module and a control module, wherein the dividing module is used for dividing the whole simulation system into N groups of subsystems according to a simulation period before simulation starts, wherein N is more than or equal to 1;
the acquisition module is used for acquiring a system sampling period T of the whole simulation system and a sampling period Ti of each subsystem in the N groups of subsystems; i is more than or equal to 1 and less than or equal to N;
the first simulation calculation module is used for determining the simulation times of the subsystems in the current simulation step of the whole simulation system according to the simulation step number n, the system sampling period T and the sampling period Ti of the subsystems for the ith group of subsystems when the simulation time reaches the simulation step number n during the simulation operation of the whole simulation system;
determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times;
and the second simulation calculation module is used for simulating the whole simulation system according to the simulation calculation result data of each group of subsystems.
In an embodiment, the first simulation calculation module is further configured to, if the simulation times are greater than or equal to 1, sequentially perform simulation calculation for corresponding times on the subsystems;
acquiring simulation calculation result data of the last simulation calculation;
taking the simulation calculation result data of the last simulation calculation as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system; or,
if the simulation times are equal to 0, acquiring historical simulation calculation result data of the subsystem closest to the current time;
and taking the historical simulation calculation result data as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
In one embodiment, the sub-systems are sequentially subjected to a plurality of times of simulation calculation; acquiring simulation calculation result data of the last simulation calculation, wherein the data comprises the following steps:
calculating system simulation Time (Time) corresponding to the current simulation step number n of the whole simulation system to be n multiplied by Tz;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the i-th group of subsystems from the ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
judging whether the difference value C is greater than or equal to the sampling period Ti of the subsystem or not;
if yes, performing simulation calculation on the subsystem, and increasing ni by 1;
circularly calculating until the difference value C is smaller than the sampling period Ti of the subsystem;
and acquiring simulation calculation result data of the last simulation calculation.
In one embodiment, the sub-system is subjected to simulation calculation for a plurality of times in sequence; acquiring simulation calculation result data of the last simulation calculation, wherein the data comprises the following steps:
determining the simulation times of the subsystem in the current simulation step of the whole simulation system;
performing simulation calculation on the subsystem for multiple times according to the simulation times;
and acquiring simulation calculation result data of the last simulation calculation.
In one embodiment, determining the number of simulations of the subsystem in a current simulation step of the entire simulation system comprises:
calculating the system simulation Time Time (n x Tz) corresponding to the current simulation step number n of the whole simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the i-th group of subsystems from the ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
calculating the quotient of the difference C and the sampling period Ti of the subsystem:
V=C/Ti;
and carrying out rounding operation on the V to obtain simulation times:
B=[V]。
in one embodiment, the dividing module is further configured to obtain a simulation cycle of each simulation module in the system; determining a plurality of simulation modules corresponding to each simulation period; and dividing the plurality of simulation modules into the same group of subsystems.
In order to achieve the above object, according to a third aspect of the present application, there is provided an electronic apparatus; comprising at least one processor and at least one memory; the memory is to store one or more program instructions; the processor is configured to execute one or more program instructions to perform any of the above steps.
According to a fourth aspect of the present application, there is provided a computer readable storage medium having one or more program instructions embodied therein for performing the steps of any one of the above.
According to the technical scheme, when the whole system runs in a simulation mode, when the simulation time reaches the simulation step number n, for any ith group of subsystems, the simulation times of the subsystems in the current simulation step of the whole simulation system are determined according to the simulation step number n, the system sampling period and the sampling period Ti of the subsystems; determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times; the system sampling period can be larger than, smaller than or equal to the greatest common divisor of the simulation periods of the subsystems. The system sampling period is not limited by the greatest common divisor, the limitation that the greatest common divisor of the simulation period of each group of subsystems is integral multiple of the simulation period in the prior art is avoided, and the setting range is expanded. Especially, when the number of subsystems is large, the greatest common divisor is small, and the system simulation period is set to be smaller, so that a large amount of invalid calculation is caused, and system resources are wasted.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It should be apparent that the drawings in the following description are merely exemplary, and that other embodiments can be derived from the drawings provided by those of ordinary skill in the art without inventive effort.
The structures, ratios, sizes, and the like shown in the present specification are only used for matching with the contents disclosed in the specification, so as to be understood and read by those skilled in the art, and are not used to limit the conditions that the present invention can be implemented, so that the present invention has no technical significance, and any structural modifications, changes in the ratio relationship, or adjustments of the sizes, without affecting the effects and the achievable by the present invention, should still fall within the range that the technical contents disclosed in the present invention can cover.
Fig. 1A is a schematic structural diagram of a simulation system according to an embodiment of the present invention;
fig. 1B is a multi-period simulation sampling timing distribution diagram according to an embodiment of the present invention;
FIG. 2 is a flow chart of a simulation method according to an embodiment of the present invention;
FIG. 3 is a flow chart of another simulation method provided by the embodiment of the invention;
fig. 4 is a schematic structural diagram of a simulation apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a simulation device according to an embodiment of the present invention.
Detailed Description
The present invention is described in terms of particular embodiments, other advantages and features of the invention will become apparent to those skilled in the art from the following disclosure, and it is to be understood that the described embodiments are merely exemplary of the invention and that it is not intended to limit the invention to the particular embodiments disclosed. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
In the prior art, when modules/subsystems with different sampling periods exist in a simulation model established by a user, in actual simulation, the greatest common divisor of each sampling period is an integral multiple of a simulation step length used by a total system. The setting is to ensure that the total system can sample each group of subsystems on time when the sampling period of each group of subsystems arrives, but the workload of the total system is increased, which causes a great deal of waste of computing resources.
See fig. 1A for a diagram of a simulation system. The system is a motor system, wherein the M part in the model represents a motor (motor), the C part represents a controller (controller), and the S part represents a rotating speed sensor (sensor). For the part C, the control period range which can be reached when the computing power of a chip used in engineering runs a controller code is considered, so that the sampling period of the part C is set according to the control period range; and for S, the sampling period is set according to the communication frequency between the sensor and the chip used in the engineering. This results in the simulation step length determined by the whole model according to the basic sampling period, which is different from the control period of C and the communication period S of the sensor, and thus deviates from the actual engineering.
Referring to fig. 1B, the user sets the sampling periods of the two modules to be 0.5s and 0.75s, respectively, and the base sampling period is 0.25 s. The simulator can execute one simulation calculation on each basic sampling period, and at 0.25 second, even if no module performs sampling, the system simulator still performs one simulation calculation, which causes waste of calculation resources.
Based on this, the present application proposes a simulation method, see the flow chart of a simulation method shown in fig. 2; the method comprises the following steps:
step S202, before the simulation begins, the whole simulation system is divided into N groups of subsystems according to the simulation period, wherein N is more than or equal to 1.
For example, referring to fig. 1, the sampling period of the controller Tc is set to 10ms according to the computing capability of the micro central controller MCU, the sampling period of the controlled object M is set to 3ms, and the sampling period of the sensor S is set to 5ms according to the model of the sensor used and the communication parameters.
The controlled object M is set as a first sub-system, the sensor S is set as a second sub-system, and the controller C is set as a third sub-system.
Step S204, acquiring a system sampling period T of the whole simulation system and a sampling period Ti of each subsystem in the N groups of subsystems; i is more than or equal to 1 and less than or equal to N.
And S206, when the whole simulation system runs in a simulation mode and the simulation time reaches the simulation step number n, for the ith group of subsystems, determining the simulation times of the subsystems in the current simulation step of the whole simulation system according to the simulation step number n, the system sampling period T and the sampling period Ti of the subsystems.
And S208, determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times.
And step S210, simulating the whole simulation system according to the simulation calculation result data of each group of subsystems.
According to the method, the sampling period of the whole simulation system does not need to be restricted to the greatest common divisor of each group of subsystems, the value range is expanded, the sampling period of the whole simulation system can be larger than, smaller than or equal to the greatest common divisor of the simulation period of each group of subsystems, the limitation that the greatest common divisor of the simulation period of each group of subsystems is an integral multiple of the simulation period of the whole simulation system is removed, the sampling period of the whole simulation system can be set to be a larger value, and therefore the problem of hardware resource waste caused by too small sampling period of the system is avoided.
In one embodiment, step S208 determines simulation calculation result data of the subsystem in the current simulation step of the entire simulation system according to the simulation times, and the following two ways are adopted;
one way is as follows:
if the simulation times are more than or equal to 1, sequentially carrying out simulation calculation of corresponding times on the subsystems;
acquiring simulation calculation result data of the last simulation calculation;
and taking the simulation calculation result data of the last simulation calculation as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
Specifically, this embodiment is divided into the following two embodiments,
in one embodiment, see the flow chart of another simulation calculation method shown in fig. 3;
s301, calculating a system simulation Time, which is corresponding to the current simulation step number n, of the entire simulation system, where the Time is n × Tz;
s302, calculating simulation time Timei of the subsystem to be ni multiplied by Ti; wherein ni is the historical calculation times of the i-th group of subsystems from the ending to the current time;
s303, calculating the difference value between the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
s304, judging whether the difference value C is larger than or equal to the sampling period Ti of the subsystem or not;
if yes, go to step S305;
step S305, the subsystem executes a simulation calculation, and increases ni by 1;
returning to the execution of the step S301,
if not, executing step S306;
and step S306, ending.
And taking the simulation data obtained by the last calculation as a result numerical value.
Exemplary, system description: the system sampling period is T-0.4 s;
the number of subsystems included in the system is as follows: 2;
the sampling period of the 1 st subsystem is: 0.5 s;
the sampling period of the 2 nd subsystem is: 0.75 s;
the system simulation step number is 3.
And (0) system simulation step:
step 0, simulation, all subsystems and the whole system execute simulation calculation process
Calculating the (1) th subsystem and acquiring a calculation result;
n1 is given an initial value: n1 ═ 0;
calculating the (2) th subsystem and obtaining a calculation result;
n2 is given an initial value: n2 ═ 0;
performing simulation calculation of the (0) th step of the whole system according to the calculation results of all subsystems
The (1) system simulation step:
deciding the simulation behavior of the (1) th subsystem in the current simulation step of the system and acquiring a simulation numerical value:
decision 1:
the time difference value does not satisfy the scenario of being greater than or equal to: (n × T-n1 × T1 ═ 1 × 0.400000-0 × 0.500000 ═ 0.400000< 0.500000);
deciding the simulation behavior of the (2) th subsystem in the current simulation step of the system and acquiring a simulation numerical value;
decision 1:
the time difference value does not satisfy the scenario of being greater than or equal to: (n × T-n2 × T2 ═ 1 × 0.400000-0 × 0.750000 ═ 0.400000< 0.750000);
and (3) carrying out simulation calculation in the step (1) of the whole system according to the calculation results of the subsystems.
And (2) system simulation step:
deciding the simulation behavior of the (1) th subsystem in the current simulation step of the system and obtaining the simulation value
Decision 1:
the time difference satisfies the scenario of being greater than or equal to: (n.times.T-n 1. times.T 1 ≧ 2X 0.400000-0X 0.500000 ≧ 0.800000 ≧ 0.500000)
Calculating the (1) th subsystem and acquiring a calculation result;
after an increase of 1 for n 1: n1 ═ 1;
decision 2:
the time difference value does not satisfy the scenario of being greater than or equal to: (n × T-n1 × T1 ═ 2 × 0.400000-1 × 0.500000 ═ 0.300000< 0.500000);
deciding the simulation behavior of the (2) th subsystem in the current simulation step of the system and obtaining the simulation value
Decision 1:
the time difference satisfies the scenario of being greater than or equal to: (n.times.T-n 2. times.T 2 ≧ 2X 0.400000-0X 0.750000 ≧ 0.800000 ≧ 0.750000)
Calculating the (2) th subsystem and acquiring a calculation result;
after an increase of 1 for n 2: n2 ═ 1;
decision 2:
the time difference value does not satisfy the scenario of being greater than or equal to: (n × T-n2 × T2 ═ 2 × 0.400000-1 × 0.750000 ═ 0.050000< 0.750000);
carrying out simulation calculation of the step (2) of the whole system according to the calculation results of all the subsystems;
and (3) system simulation step:
deciding the simulation behavior of the (1) th subsystem in the current simulation step of the system and obtaining the simulation value
Decision 1:
the time difference satisfies the scenario of being greater than or equal to: (n × T-n1 × T1 ≧ 3 × 0.400000-1 × 0.500000 ≧ 0.700000 ≧ 0.500000);
calculating the (1) th subsystem and obtaining a calculation result;
after an increase of 1 in n 1: n1 ═ 2;
decision 2:
the time difference value does not satisfy the scenario of being greater than or equal to: (n × T-n1 × T1 ═ 3 × 0.400000-2 × 0.500000 ═ 0.200000< 0.500000);
deciding the simulation behavior of the (2) th subsystem in the current simulation step of the system and acquiring a simulation numerical value;
decision 1:
the time difference value does not satisfy the scenario of being greater than or equal to: (n × T-n2 × T2 ═ 3 × 0.400000-1 × 0.750000 ═ 0.450000< 0.750000);
carrying out the simulation calculation of the step (3) of the whole system according to the calculation result of each subsystem;
the other implementation mode is that the simulation times of the subsystem in the current simulation step of the whole simulation system are directly calculated;
carrying out simulation calculation on the subsystem for multiple times according to the simulation times;
and acquiring the calculation result data of the last simulation calculation.
The following steps are adopted for determining the simulation times of the subsystem in the current simulation step of the whole simulation system:
calculating the system simulation Time Time (n x Tz) corresponding to the current simulation step number n of the whole simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the i-th group of subsystems from the ending to the current time;
wherein Ti is the sampling period of the ith group of subsystems;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
simulation calculation times are as follows:
V=C/Ti;
and carrying out rounding operation on the V to obtain simulation times:
B=[V]。
exemplarily, the system sampling period is T ═ 1.3 s;
the number of subsystems included in the system is as follows: 2;
the sampling period of the 1 st subsystem is: 0.5 s;
the sampling period of the 2 nd subsystem is: 0.75 s;
the system simulation step number is 3;
and (0) system simulation step:
step 0, simulation, wherein all subsystems and the whole system execute a simulation calculation process;
calculating the (1) th subsystem and acquiring a calculation result;
n1 is given an initial value: n1 ═ 0;
calculating the (2) th subsystem and acquiring a calculation result;
n2 is given an initial value: n2 ═ 0;
carrying out simulation calculation of the (0) th step of the whole system according to the calculation results of all the subsystems;
the (1) system simulation step:
deciding the simulation behavior of the (1) th subsystem in the current simulation step of the system and acquiring a simulation numerical value;
the time difference satisfies a scenario of greater than or equal to: (n × T-n1 × T1 ≧ 1 × 1.300000-0 × 0.500000 ≧ 1.300000 ≧ 0.500000);
the difference is 2.600000 times of T1, and the integral multiple is 2;
performing (2) times of calculation on the (1) th subsystem and obtaining the last calculation result;
after an increase of 2 for n 1: n1 ═ 2;
deciding the simulation behavior of the (2) th subsystem in the current simulation step of the system and acquiring a simulation numerical value;
the time difference satisfies the scenario of being greater than or equal to: (n × T-n2 × T2 ≧ 1 × 1.300000-0 × 0.750000 ≧ 1.300000 ≧ 0.750000);
the difference is 1.733333 times of T2, and the integral multiple is 1;
performing (1) calculation on the (2) th subsystem and obtaining the last calculation result;
after an increase of 1 in n 2: n2 ═ 1;
carrying out simulation calculation of the step (1) of the whole system according to the calculation results of all the subsystems;
and (2) system simulation step:
deciding the simulation behavior of the (1) th subsystem in the current simulation step of the system and acquiring a simulation numerical value;
the time difference satisfies the scenario of being greater than or equal to: (n × T-n1 × T1 ≧ 2 × 1.300000-2 × 0.500000 ≧ 1.600000 ≧ 0.500000);
the difference is 3.200000 times of T1, and the integral multiple is 3;
performing (3) times of calculation on the (1) th subsystem and obtaining the last calculation result;
after an increase of 3 for n 1: n1 ═ 5;
deciding the simulation behavior of the (2) th subsystem in the current simulation step of the system and acquiring a simulation numerical value;
the time difference satisfies the scenario of being greater than or equal to: (n × T-n2 × T2 ≧ 2 × 1.300000-1 × 0.750000 ≧ 1.850000 ≧ 0.750000);
the difference is 2.466667 times of T2, and the integral multiple is 2;
performing (2) times of calculation on the (2) th subsystem and obtaining the last calculation result;
after an increase of 2 for n 2: n2 ═ 3;
and (3) performing simulation calculation of the step (2) of the whole system according to the calculation result of each subsystem.
The other mode is as follows: if the simulation times are equal to 0, acquiring historical simulation calculation result data of the subsystem closest to the current time;
and taking the historical simulation calculation result data as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
In one embodiment, in step S102, a simulation cycle of each simulation module in the system is obtained; acquiring a simulation period of each simulation module in the system; determining a plurality of simulation modules corresponding to each simulation period; and dividing the plurality of simulation modules into the same group of subsystems.
Illustratively, if there are 4 sub-modules in the system, the simulation period of sub-module 1 is 1 ms; the simulation period of the sub-module 2 is 2 ms; the simulation period of the sub-module 3 is 1 ms; the simulation period of the sub-module 4 is 3 ms; the sub-modules with the simulation period of 1ms are a sub-module 1 and a sub-module 3; the sub-module with the simulation period of 2ms is a sub-module 2; a sub-module 4 with the simulation period of 3 ms; the sub-module 1 and the sub-module 3 are divided into a same group of sub-systems, namely a sub-system 1; dividing the sub-module 2 into subsystems 2; the sub-modules 4 are divided into sub-systems 3.
Another simulation method is described below with reference to fig. 1, and the method includes the following steps:
firstly, partitioning the model according to a sampling period before the simulation starts, wherein the input signal and the controller C are used as a first subsystem, the sampling period Tc is 10ms, the controlled object M and the sensor S are used as a second subsystem, and the sampling period is equal to Tm and is 5 ms.
And secondly, calculating the results of the controller C, the controlled object M and the sensor S in sequence at the 0 th moment after the solution starts.
Thirdly, calculating the simulation time corresponding to the current simulation step: TIME is n × T, where n is the serial number of the simulation step and the starting value is 0.
Fourthly, calculating the last simulation time of each group of subsystems in the model, which is closest to the simulation time: TIME1 ═ Tc × n1 and TIME2 ═ Tm × n2, where n1 and n2 are the number of calculations corresponding to the first subsystem and the second subsystem, respectively, and the initial value is 0.
Fifthly, calculating the difference value between the current simulation time and the last simulation time of each subsystem, and if the difference value is more than or equal to N times of the sampling period of the corresponding subsystem, performing simulation calculation on the subsystem for N times and increasing N to the corresponding count value; wherein N is greater than or equal to 1; otherwise, no calculation is performed on the subsystem, and the calculated simulation data of the subsystem uses the historical value closest to the current simulation time.
For example, taking the first subsystem as an example, if (TIME-TIME1) ≧ nxtc, this simulation step calculates the input and controller C, and performs an addition operation on N1, then recalculates the difference between TIME and TIME-TIME, if the difference is greater than the sampling period Ti of the subsystem, continues to calculate the input and controller C, and performs an addition operation on N1, and so on for N TIMEs until the difference is less than Ti, and takes the simulation data obtained by the last calculation as a result value.
The method can configure any sampling period for different modules without influencing the solving step length of the whole system, so that the simulation is more consistent with the engineering application scene. A mechanism for comparing the current simulation time with the time of each subsystem to decide whether to perform simulation calculation on the current subsystem in the current simulation step is provided. The problem of too small simulation steps caused by mixing of different sampling periods is solved, simulation resources are saved, and simulation efficiency is improved. The simulation step length of the simulation model is not influenced by the sampling period of each module in the model, so that the sampling period of each module in the simulation model can be consistent with the corresponding actual equipment.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
In a second aspect, the present application provides a simulation computing device, referring to the schematic structural diagram of a simulation computing device shown in fig. 4; the device includes:
a dividing module 41, configured to divide the entire simulation system into N groups of subsystems according to a simulation cycle before simulation starts, where N is greater than or equal to 1;
an obtaining module 42, configured to obtain a system sampling period T of the entire simulation system and a sampling period Ti of each of the N groups of subsystems; i is more than or equal to 1 and less than or equal to N;
the first simulation calculation module 43 is configured to, when the simulation time reaches the simulation step number n during the simulation operation of the entire simulation system, determine, for the i-th group of subsystems, the simulation times of the subsystems in the current simulation step of the entire simulation system according to the simulation step number n, the system sampling period T, and the sampling period Ti of the subsystems;
determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times;
and the second simulation calculation module 44 is used for performing simulation of the whole simulation system according to the simulation calculation result data of each group of subsystems.
In an embodiment, the first simulation calculating module 43 is further configured to, if the simulation times are greater than or equal to 1, sequentially perform simulation calculation for corresponding times on the subsystems;
acquiring simulation calculation result data of the last simulation calculation;
taking the simulation calculation result data of the last simulation calculation as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system; or,
if the simulation times are equal to 0, acquiring historical simulation calculation result data of the subsystem closest to the current time;
and taking the historical simulation calculation result data as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
In one embodiment, the first simulation calculating module 43 is further configured to calculate a system simulation Time, which is corresponding to the current simulation step number n, of the entire simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the ith group of subsystems ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
judging whether the difference value C is greater than or equal to the sampling period Ti of the subsystem or not;
if yes, performing simulation calculation on the subsystem, and increasing ni by 1;
circularly calculating until the difference value C is less than the sampling period Ti of the subsystem;
and acquiring simulation calculation result data of the last simulation calculation.
In one embodiment, the first simulation calculating module 43 is further configured to determine the simulation times of the subsystem in the current simulation step of the whole simulation system;
performing simulation calculation on the subsystem for multiple times according to the simulation times;
and acquiring simulation calculation result data of the last simulation calculation.
In one embodiment, the first simulation calculating module 43 is further configured to calculate a system simulation Time, which is corresponding to the current simulation step number n, of the entire simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the i-th group of subsystems from the ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
calculating the quotient of the difference C and the sampling period Ti of the subsystem:
V=C/Ti;
and carrying out rounding operation on the V to obtain simulation times:
B=[V]。
in one embodiment, the dividing module 41 is further configured to obtain a simulation cycle of each simulation module in the system; determining a plurality of simulation modules corresponding to each simulation period; and dividing the plurality of simulation modules into the same group of subsystems.
According to a third aspect of the present application, there is provided an electronic device, see the schematic structural diagram of the electronic device shown in fig. 5; comprises at least one processor 51 and at least one memory 52; the memory 52 is used to store one or more program instructions; the processor 51 is configured to execute one or more program instructions to perform any of the methods described above.
In a fourth aspect, the present application also proposes a computer-readable storage medium having one or more program instructions embodied therein for performing the method of any one of the above.
The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The processor reads the information in the storage medium and completes the steps of the method in combination with the hardware.
The storage medium may be a memory, for example, which may be volatile memory or nonvolatile memory, or which may include both volatile and nonvolatile memory.
The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory.
The volatile Memory may be a Random Access Memory (RAM) which serves as an external cache. By way of example and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), SLDRAM (SLDRAM), and Direct Rambus RAM (DRRAM).
The storage media described in connection with the embodiments of the invention are intended to comprise, without being limited to, these and any other suitable types of memory.
Those skilled in the art will appreciate that the functionality described in the present invention may be implemented in a combination of hardware and software in one or more of the examples described above. When software is applied, the corresponding functionality may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
Although the invention has been described in detail above with reference to a general description and specific examples, it will be apparent to one skilled in the art that modifications or improvements may be made thereto based on the invention. Accordingly, such modifications and improvements are intended to be within the scope of the invention as claimed.

Claims (10)

1. A method of simulation computation, comprising:
before simulation begins, dividing the whole simulation system into N groups of subsystems according to a simulation cycle, wherein N is more than or equal to 1;
acquiring a system sampling period T of the whole simulation system and a sampling period Ti of each subsystem in the N groups of subsystems; i is more than or equal to 1 and less than or equal to N;
when the whole simulation system is in simulation operation, when the simulation time reaches the step number n of the simulation,
for the ith group of subsystems, determining the simulation times of the subsystems in the current simulation step of the whole simulation system according to the simulation step number n, the system sampling period T and the sampling period Ti of the subsystems;
determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times;
and simulating according to the simulation calculation result data of each group of subsystems.
2. The simulation calculation method according to claim 1, wherein determining simulation calculation result data of the subsystem in the current simulation step of the entire simulation system according to the simulation times comprises:
if the simulation times are more than or equal to 1, sequentially carrying out simulation calculation of corresponding times on the subsystems;
acquiring simulation calculation result data of the last simulation calculation;
taking the simulation calculation result data of the last simulation calculation as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system; or,
if the simulation times are equal to 0, acquiring historical simulation calculation result data of the subsystem closest to the current time;
and taking the historical simulation calculation result data as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
3. The method of simulated computation of claim 2,
sequentially carrying out multiple times of simulation calculation on the subsystems; acquiring simulation calculation result data of the last simulation calculation, wherein the data comprises the following steps:
calculating the system simulation Time Time (n x Tz) corresponding to the current simulation step number n of the whole simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the ith group of subsystems ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
judging whether the difference value C is greater than or equal to the sampling period Ti of the subsystem or not;
if yes, performing simulation calculation on the subsystem, and increasing ni by 1;
circularly calculating until the difference value C is smaller than the sampling period Ti of the subsystem;
and acquiring simulation calculation result data of the last simulation calculation.
4. The simulation calculation method of claim 2, wherein the simulation calculation is performed a plurality of times in sequence for the subsystem; acquiring simulation calculation result data of the last simulation calculation, wherein the data comprises the following steps:
determining the simulation times of the subsystem in the current simulation step of the whole simulation system;
performing simulation calculation on the subsystem for multiple times according to the simulation times;
and acquiring simulation calculation result data of the last simulation calculation.
5. The simulation calculation method of claim 4, wherein determining the number of simulations of the subsystem in a current simulation step of the entire simulation system comprises:
calculating the system simulation Time Time (n x Tz) corresponding to the current simulation step number n of the whole simulation system;
calculating the simulation time Timei of the subsystem as ni multiplied by Ti; wherein ni is the historical calculation times of the i-th group of subsystems from the ending to the current time;
calculating the difference value of the system simulation Time Time and the simulation Time Timei of the subsystem;
C=Time-Timei;
calculating the quotient of the difference C and the sampling period Ti of the subsystem:
V=C/Ti;
and carrying out rounding operation on the V to obtain simulation times:
B=[V]。
6. the simulation calculation method of claim 1, wherein before the simulation begins, the entire simulation system is divided into N groups of subsystems according to the simulation cycle, including:
acquiring a simulation period of each simulation module in the system;
determining a plurality of simulation modules corresponding to each simulation period;
and dividing the plurality of simulation modules into the same group of subsystems.
7. An emulated computing device, comprising:
the system comprises a dividing module, a simulation module and a control module, wherein the dividing module is used for dividing the whole simulation system into N groups of subsystems according to a simulation period before simulation starts, wherein N is more than or equal to 1;
the acquisition module is used for acquiring a system sampling period T of the whole simulation system and a sampling period Ti of each subsystem in the N groups of subsystems; i is more than or equal to 1 and less than or equal to N;
the first simulation calculation module is used for determining the simulation times of the subsystems in the current simulation step of the whole simulation system according to the simulation step number n, the system sampling period T and the sampling period Ti of the subsystems for the ith group of subsystems when the simulation time reaches the simulation step number n during the simulation operation of the whole simulation system;
determining simulation calculation result data of the subsystem in the current simulation step of the whole simulation system according to the simulation times;
and the second simulation calculation module is used for simulating the whole simulation system according to the simulation calculation result data of each group of subsystems.
8. The emulated computing device of claim 7,
the first simulation calculation module is also used for sequentially carrying out simulation calculation on the subsystems for corresponding times if the simulation times are more than or equal to 1;
acquiring simulation calculation result data of the last simulation calculation;
taking the simulation calculation result data of the last simulation calculation as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system; or,
if the simulation times are equal to 0, acquiring historical simulation calculation result data of the subsystem closest to the current time;
and taking the historical simulation calculation result data as the simulation calculation result data of the subsystem in the current simulation step of the whole simulation system.
9. An electronic device, comprising: at least one processor and at least one memory; the memory is to store one or more program instructions; the processor operable to execute one or more program instructions to perform the method of any of claims 1-6.
10. A computer-readable storage medium having one or more program instructions embodied therein for performing the method of any of claims 1-6.
CN202210565145.0A 2022-05-23 2022-05-23 Simulation calculation method, device, equipment and storage medium Pending CN114912282A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210565145.0A CN114912282A (en) 2022-05-23 2022-05-23 Simulation calculation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210565145.0A CN114912282A (en) 2022-05-23 2022-05-23 Simulation calculation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114912282A true CN114912282A (en) 2022-08-16

Family

ID=82769609

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210565145.0A Pending CN114912282A (en) 2022-05-23 2022-05-23 Simulation calculation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114912282A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116776793A (en) * 2023-08-22 2023-09-19 成都翌创微电子有限公司 Multi-period path constraint verification method combining static time sequence analysis and pre-simulation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116776793A (en) * 2023-08-22 2023-09-19 成都翌创微电子有限公司 Multi-period path constraint verification method combining static time sequence analysis and pre-simulation
CN116776793B (en) * 2023-08-22 2023-11-03 成都翌创微电子有限公司 Multi-period path constraint verification method combining static time sequence analysis and pre-simulation

Similar Documents

Publication Publication Date Title
CN110245366B (en) Dynamic power consumption estimation method, device and system
RU2007116053A (en) METHOD FOR COMPUTERIZED TRAINING ONE OR MORE NEURAL NETWORKS
CN110058882B (en) OPU instruction set definition method for CNN acceleration
CN112541310B (en) Logic comprehensive control method and device
CN114912282A (en) Simulation calculation method, device, equipment and storage medium
CN116644804B (en) Distributed training system, neural network model training method, device and medium
CN107644063A (en) Time series analysis method and system based on data parallel
CN111859835A (en) Order reduction method, order reduction device and order reduction equipment of circuit interconnection network model
CN111240746A (en) Floating point data inverse quantization and quantization method and equipment
CN110600020B (en) Gradient transmission method and device
CN112001491A (en) Search method and device for determining neural network architecture for processor
CN116681127B (en) Neural network model training method and device, electronic equipment and storage medium
CN109784484A (en) Neural network accelerated method, device, neural network accelerate chip and storage medium
CN112347733A (en) Integrated circuit layout initialization and optimization method, device, storage medium and equipment
CN110765594B (en) Method and device for controlling internal interaction interface of wind power plant real-time simulator
CN110245756A (en) Method for handling the programming device of data group and handling data group
US11062071B2 (en) Method for simulating a dynamic system
CN114037054A (en) Data processing method, device, chip, equipment and medium
CN111025178B (en) Stability test method for main-standby switching of power supply module and related components
CN113111013B (en) Flash memory data block binding method, device and medium
CN115309502A (en) Container scheduling method and device
CN114358253A (en) Time estimation method of neural network model and related product
CN109308327A (en) Figure calculation method device medium apparatus based on the compatible dot center&#39;s model of subgraph model
CN113221501A (en) Method for balancing number of interconnections between different partitions of circuit and readable storage medium
CN112860597A (en) System, method and device for neural network operation and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination