Circuit design method compatible with Runge-kutta method and Adams method

By designing a circuit design method compatible with the Runge-kutta method and the Adams method, the cooperation between the main state machine and the secondary state machine is used to achieve seamless switching between single-step method and multi-step method, solving the problem of insufficient flexibility and parallelism in the existing technology, and achieving compatibility and efficient calculations for multiple algorithms and application scenarios.

CN119990004AActive Publication Date: 2025-05-13HEFEI UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510071037.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-05-13
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

The prior art lacks flexibility and parallelism in application scenarios with high real-time requirements and large-scale initial value solutions, and lacks circuit designs compatible with multiple algorithms and application scenarios.

Method used

A circuit design method compatible with the Runge-kutta method and the Adams method is designed. Through the collaboration between the main state machine and the secondary state machine, the seamless switching between single-step method and multi-step method is achieved, and the dynamic reconstruction of the algorithm iteration module and the variable cache module are supported, supporting a variety of algorithms and application scenarios.

Benefits of technology

It improves the flexibility and computing efficiency of algorithm switching, meets the needs of high-precision computing, and significantly improves the computing efficiency, achieving compatibility with multiple algorithms and application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119990004A_ABST
    Figure CN119990004A_ABST
Patent Text Reader

Abstract

The invention discloses a circuit design method compatible with a Runge-kutta method and an Adams method, relates to the technical field of digital signal processing, and realizes efficient solving of an initial value problem of an ordinary differential equation through a modular circuit architecture. According to the method, a state control module, a variable cache module, an algorithm iteration module, an ordinary differential equation calculation module and a data path control module are designed, and flexible switching between a single-step method and a multi-step method is achieved through cooperation of a main state machine and an auxiliary state machine; when the one-step method is selected, the system only executes calculation of the Runge-Kutta method; when the multi-step method is selected, the system firstly executes calculation of the Runge-Kutta method, calculates an initial value for the multi-step method, and then executes iterative calculation of the Adams method; the method is suitable for ordinary differential equations with different complexities, meets the requirements of high precision and real-time performance by dynamically adjusting the use of hardware resources, and is particularly suitable for the field of engineering application in which the ordinary differential equations need to be rapidly solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital signal processing, and in particular to a circuit design method compatible with the Runge-Kutta method and the Adams method. Background Art

[0002] Initial value problems of ordinary differential equations are widely used in fields such as physics, engineering, and biology. In the field of classical mechanics, initial value conditions can be used to predict the position and speed of an object at a future moment. In the field of control systems and signal processing, the relationship between current and voltage in a circuit can be modeled by differential equations, and initial value conditions help determine the initial state of the system. In ecological models, by setting the initial population size, the future trend of the population can be analyzed.

[0003] In the prior art, the above application scenarios are generally modeled in software. Although this method can quickly study the object model, it lacks corresponding flexibility in application scenarios with high real-time requirements and when it comes to the evaluation of the accuracy of multiple algorithms. At the same time, it lacks sufficient parallelism when it comes to large-scale initial value solutions. The requirements of parallelism and real-time performance can be met through hardware circuits, but there is a lack of compatible circuits for multiple algorithms and multiple application scenarios.

[0004] Therefore, it is urgent to propose a circuit design method that is compatible with multiple algorithms and can meet multiple application scenarios by reconstructing some modules. Summary of the invention

[0005] The purpose of the present invention is to provide a circuit design method compatible with the Runge-Kutta method and the Adams method, which realizes compatibility with multiple algorithms and multiple application scenarios through a set of circuits, while meeting the needs of fast and large-scale solutions.

[0006] The technical solution of the present invention is to provide a circuit design method compatible with the Runge-Kutta method and the Adams method, the method comprising:

[0007] Initialize the ordinary differential equation problem: receive the initial value of the ordinary differential equation and related configuration data input by the user, and adjust the configuration of each module in the circuit design according to the selected algorithm, which includes the Runge-Kutta method and the Adams method;

[0008] According to the selected algorithm, the main state machine in the state control module enters different states; the main state machine first enters the data uplink and downlink state, transfers the initial value data to the variable cache module, and dynamically allocates the storage unit in the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step state or the multi-step state;

[0009] When executing the single-step method calculation, the main state machine enters the single-step method state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method; if the termination condition is met, the main state machine returns to the data uplink and downlink state; if the termination condition is not met, the first sub-state machine continues to cyclically execute the calculations of RK1 to RK4 until the termination condition is met;

[0010] When executing multi-step calculation, the main state machine first enters the single-step state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method and provide initial values ​​for the multi-step calculation. The main state machine jumps to the multi-step state, and the second sub-state machine executes the calculation of Adams1 and Adams2 until the termination condition is met or all calculations are completed.

[0011] After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

[0012] In any of the above technical solutions, further, the circuit designed by the method includes the following modules:

[0013] A state control module is used to control the overall working state of the circuit; the state control module includes a main state machine, a first sub-state machine, and a second sub-state machine; the main state machine is used to control the switching of the working state of the circuit; the first sub-state machine is used to control the circuit to perform the second to fourth order calculations in the Runge-Kutta method; the second sub-state machine is used to control the circuit to perform the calculations of the fourth order explicit Adams method, the fourth order implicit Adams method, and the fourth order Adams prediction-correction system;

[0014] The variable cache module dynamically allocates storage units according to the form of the ordinary differential equation and the selected algorithm to store the input variables, intermediate variables and operation results of the ordinary differential equation; the variable cache module is composed of several storage units; if the user inputs a differential equation group, the storage units are increased or decreased according to the number of differential variables;

[0015] The algorithm iteration module includes a group of logic operation units. The state control module sends different instructions to the algorithm iteration module according to the selected algorithm. The algorithm iteration module adjusts the configuration of the logic operation unit according to the instructions and performs iterative calculations. The logic operation unit includes multiple adders and multipliers. For the fourth-order algorithm, the operation of each variable requires three adders and six multipliers.

[0016] The ordinary differential equation calculation module calculates numerical solutions through a unified interface, supports users to customize differential equation calculation units according to actual problems, and reconstructs the calculation pipeline according to the given ordinary differential equation form. The pipeline is organized in the form of a pipeline.

[0017] The data path control module is composed of a decoder and several control signals and selection signals. The data path control module is used to realize dynamic scheduling of data flow between modules to meet the demand for calculation paths when switching between different algorithms.

[0018] In any of the above technical solutions, further, in the multi-step calculation, after the state control module completes three rounds of Runge-Kutta method calculation, if the termination condition is still not met, the iteration is stopped and the results of the first three rounds of calculation are used as the initial values ​​of the multi-step calculation, and the second sub-state machine continues to execute the Adams method calculation.

[0019] In any of the above technical solutions, further, the ordinary differential equation input by the user is a first-order ordinary differential equation system, and the initial value problem of the equation system is as follows:

[0020]

[0021] where a <t≤b;

[0022] Reconstruct the variable cache module and ordinary differential equation calculation module. The variable cache module requires two sets of variable cache units and an intermediate variable storage module in the operation process to store the result values ​​calculated by the ordinary differential equation corresponding to each iteration; the ordinary differential equation calculation module is reorganized into the form of calculating f(t,y,z) and g(t,y,z);

[0023] The fourth-order Adams prediction-correction algorithm in the linear multi-step method is selected. A group of variable cache units in the variable cache module is divided into four independent variable storage sub-units, and each unit stores the numerical solution of one-step iteration;

[0024] The main state machine performs multi-step calculations. The main state machine first enters the single-step state, and the algorithm iteration module is reconstructed to satisfy the following fourth-order classic Runge-Kutta method:

[0025]

[0026] The first sub-state machine performs three rounds of operations from RK1 to RK4 to generate the initial value variables required to start the linear multi-step method. The main state machine enters the multi-step method state, the first sub-state machine jumps back to the idle state, and the second sub-state machine jumps to Adams1. At the same time, the algorithm iteration module is reconstructed into the form that satisfies the following fourth-order Adams prediction-correction system:

[0027] predict:

[0028]

[0029] Correction:

[0030]

[0031] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts to calculate and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the Adams1 state in the second sub-state machine, and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the second sub-state machine is controlled to enter Adams2 from Adams1.

[0032] Repeat the above data flow loop. After all variables are calculated, if the iteration termination condition is not met, control the second state machine to enter Adams1 from Adams2. Repeat the above second state machine loop until the iteration termination condition is met.

[0033] When the iteration termination condition is met, the second sub-state machine jumps back to the idle state from Adams2, and the main state machine jumps back to the data uplink and downlink state from the multi-step method state. At this point, the initial value problem of the above ordinary differential equation is solved.

[0034] In any of the above technical solutions, further, the specific process of the first sub-state machine executing three rounds of operations RK1 to RK4 includes:

[0035] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts to calculate and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the RK1 state in the first sub-state machine, and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the first sub-state machine is controlled to enter RK2 from RK1.

[0036] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the differential variable value from the equation variable cache module. Then the ordinary differential equation calculation module starts to calculate and outputs the differential variable result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the RK2 state and outputs the result to the variable cache module; after all the variables are calculated, the first sub-state machine is controlled to enter RK3 from RK2;

[0037] Repeat the above data flow loop, and after all variables are calculated, control the first state machine to enter RK4 from RK3; repeat again to make RK4 enter RK1, and continue to repeat until three rounds of RK4 calculations are completed to generate the initial value variables required to start the linear multi-step method.

[0038] In any of the above technical solutions, further, the method also includes: for a group of ordinary differential equations in piecewise form, each time entering a new segment, the system will re-enable the single-step method to calculate the initial value and provide the initial value for the subsequent multi-step method.

[0039] In any of the above technical solutions, further, the method also includes: for high-order ordinary differential equations, the high-order differential equations are converted into a group of first-order ordinary differential equations and input into the circuit for calculation.

[0040] The beneficial effects of the present invention are:

[0041] The technical solution in the present invention realizes seamless switching between single-step method and multi-step method through the collaboration of main state machine and sub-state machine. When executing multi-step method, the system first calculates the initial value in the single-step state, and then automatically jumps to the multi-step state for iterative calculation. This design improves the flexibility of algorithm switching and can efficiently schedule calculation tasks according to actual needs.

[0042] The algorithm iteration module adapts to the needs of different algorithms through dynamic reconstruction. For the fourth-order algorithm, the optimal adder and multiplier configuration is adopted to reduce the consumption of hardware resources. At the same time, the dynamic storage allocation method and pipeline calculation structure of the variable cache module maximize the utilization of hardware resources, meet the requirements of high-precision calculation, and significantly improve the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The advantages of the above and additional aspects of the present invention will become apparent and easily understood in the description of the embodiments in conjunction with the following drawings, in which:

[0044] Figure 1 is a schematic flow chart of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0045] Figure 2 is a schematic block diagram of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0046] Figure 3 It is a schematic diagram of the main state machine jump of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0047] Figure 4 It is a first state machine jump schematic diagram of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0048] Figure 5 is a second state machine jump schematic diagram of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0049] Figure 6 It is a structural schematic diagram of a single data cycle process of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0050] Figure 7 It is a schematic diagram of a data path reconstruction scheme of the first step variable operation of the fourth-order classical Runge-Kutta method of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0051] Figure 8 It is a schematic diagram of a data path reconstruction scheme for the second step variable operation of the fourth-order classical Runge-Kutta method of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0052] Fig. 9 It is a schematic diagram of a data path reconstruction scheme of the third step variable operation of the fourth-order classical Runge-Kutta method of the circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0053] Fig.10 It is a schematic diagram of a data path reconstruction scheme of the fourth step variable operation of the fourth-order classical Runge-Kutta method of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0054] Fig.11It is a schematic diagram of a data path reconstruction scheme for predictor variable calculation of a fourth-order Adams prediction-correction system of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0055] Fig.12 It is a schematic diagram of a data path reconstruction scheme for correction variable calculation of a fourth-order Adams prediction-correction system of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0058] like Figure 1 As shown, this embodiment provides a circuit design method compatible with the Runge-Kutta method and the Adams method, and builds Figure 2 The circuit design model shown in FIG. 1 includes:

[0059] Initialize the ordinary differential equation problem: The user needs to input the initial value of the ordinary differential equation and related configuration data, and determine the algorithm to be used. The system will adjust the configuration of the state control module, variable cache module, algorithm iteration module and ordinary differential equation calculation module according to the selected algorithm.

[0060] Configure the state control module: According to the selected algorithm, the main state machine in the state control module will enter different states; the main state machine first enters the data uplink and downlink state, and passes the initial value data to the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step method state (state 1) or the multi-step method state (state 2); the single-step method is suitable for simple problems, and each step is calculated independently, while the multi-step method is suitable for complex problems, and the previous results are used to reduce the amount of calculation.

[0061] Configure the variable cache module: The variable cache module dynamically allocates storage units according to the form of the ordinary differential equation. If the ordinary differential equation is given in the form of a first-order differential equation system, it is necessary to increase the storage units corresponding to the number of differential variables. If it is a high-order differential equation system, the storage units are increased or decreased according to the number of high-order differential variables. This process ensures that all initial values, iterative variables and intermediate results can be effectively stored.

[0062] Configure the algorithm iteration module: The algorithm iteration module is dynamically reconstructed through the instructions of the state control module according to the selected algorithm. For the fourth-order algorithm, this module is equipped with three adders and six multipliers, which can efficiently perform the corresponding mathematical operations to ensure that the algorithm's computational requirements are met.

[0063] Configure the ordinary differential equation calculation module: The ordinary differential equation calculation module calculates the numerical solution of the ordinary differential equation through a unified interface. The calculation unit of this module is also customized according to the form of the ordinary differential equation, and adopts a pipeline calculation structure to improve the calculation efficiency.

[0064] The data path control module is used to implement dynamic scheduling of data flows between modules and support the reconstruction of internal paths of modules to meet the needs of different algorithms and application scenarios.

[0065] After receiving the ordinary differential equation and its initial value problem input by the user and selecting the algorithm, the main state machine in the state control module enters the data uplink and downlink state, and passes the initial value data to the variable cache module. Then the main state machine switches to the single-step method state (state 1) or the multi-step method state (state 2) according to the algorithm selection; the variable cache module dynamically allocates storage units according to the number of equation variables to store initial values, iterative variables and intermediate results; the algorithm iteration module dynamically reconstructs the logical operation unit according to the specific steps of the algorithm; the ordinary differential equation calculation module calculates the numerical solution of the target equation through a unified interface.

[0066] like Figure 4 As shown, the calculation process of the single-step method (Runge-Kutta method) is as follows:

[0067] 1) The main state machine enters the single-step state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence. (RK1 indicates the first step of the Runge-Kutta method, and so on.)

[0068] 2) In the RK1 stage, the state machine controls the reading of the initial variable values ​​from the variable cache module, and the ordinary differential equation calculation module starts the first step of operation; the calculation results are output to the algorithm iteration module, the algorithm iteration module performs the algorithm operation according to the transmitted results, and returns the results to the ordinary differential equation calculation module.

[0069] 3) In the RK2 stage, the data reading and calculation process is repeated to generate the operation results of the second step; if the second-order Runge-Kutta method is selected, the result is directly output to the variable cache module, otherwise continue to the next stage.

[0070] 4) In the RK3 and RK4 stages, continue to execute the same process and complete the calculations of the third and fourth steps in sequence; after the fourth-order Runge-Kutta method completes all calculations, determine whether it meets the termination condition. If not, return to RK1 for iteration until the final result meets the termination condition, and return the calculation result to the main state machine.

[0071] like Figure 3 As shown, the state control module enters the data uplink and downlink state after receiving the ordinary differential equation and its initial value problem input by the user. When the selected algorithm enters the single-step method state, the system is operated according to the above single-step method calculation process. When the selected algorithm enters the multi-step method state, it is still necessary to first perform the above single-step method calculation process to calculate the initial value required for the multi-step method. Different from the above method, if the termination condition is still not met after three rounds of iteration, the iteration is stopped and the calculation results of the first three rounds are used as the initial value. The main state machine jumps from state 1 to state 2, and the following remaining calculation process is performed:

[0072] like Figure 5 As shown, the remaining calculation process of the multi-step method (Adams method) is as follows:

[0073] 1) The main state machine switches to the multi-step state, and the second sub-state machine enters the Adams1 stage.

[0074] 2) In the Adams1 stage, the variable cache module provides the calculation results of the previous steps, the ordinary differential equation calculation module completes the prediction operation and outputs it to the algorithm iteration module.

[0075] 3) In the Adams2 stage, the ordinary differential equation calculation module performs correction operations and makes adjustments based on the predicted results and actual calculation results; when the iteration termination condition is met, it returns to the main state machine; if it is not met, the iteration process of Adams1 and Adams2 is repeated.

[0076] For a piecewise ODE system, the system re-enables the single-step method at the beginning of each segment to calculate the initial values ​​required for the multi-step method.

[0077] When solving high-order differential equations, the system will convert the high-order differential equations into a set of first-order ordinary differential equations and perform calculations according to the above process.

[0078] After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

[0079] In the execution circuit of the above method, the state control module consists of a main state machine and two sub-state machines, which are used to control the working state of the circuit; the main state machine is responsible for switching the overall process, including idle state, data uplink and downlink state, single-step state and multi-step state; the first sub-state machine is used to control the operation flow of the second to fourth-order Runge-Kutta methods in the single-step method, and the second sub-state machine is used to control the operation flow of the fourth-order explicit Adams method, implicit Adams method and prediction-correction system in the multi-step method.

[0080] The variable cache module is used to store the input variables, intermediate variables and calculation results of the equation. The module adopts a dynamic cache structure and can increase or decrease storage units, such as register groups, RAM or DDR memory, according to the complexity of the ordinary differential equation.

[0081] The algorithm iteration module contains a set of logic operation units, which can be reconstructed through the state control module to adapt to different algorithm requirements. In the fourth-order algorithm, this module includes three adders and six multipliers, which can efficiently complete the required mathematical operations.

[0082] The ordinary differential equation calculation module provides a unified calculation interface, supports users to customize the differential equation calculation unit according to actual problems, and adopts a pipeline structure to achieve efficient calculation.

[0083] In another embodiment of the present invention, assuming that the target ordinary differential equation is a first-order ordinary differential equation system, the initial value problem of the equation system is as follows:

[0084]

[0085] where a <t≤b。

[0086] After receiving the given initial value problem of the ordinary differential equation, the variable cache module and the ordinary differential equation calculation module are reconstructed according to the characteristics of the equation. The variable cache module requires two sets of variable cache units and an intermediate variable storage module during the operation process to store the result values ​​calculated by the corresponding ordinary differential equation at each iteration step. At the same time, the ordinary differential equation calculation module is reorganized into the form of calculating f(t,y,z) and g(t,y,z).

[0087] By default, the equation group can meet the iteration step requirements of the linear multi-step method. The fourth-order Adams prediction-correction algorithm in the linear multi-step method is selected. A group of variable cache units in the variable cache module is divided into four independent variable storage sub-units, and each unit stores the numerical solution of one-step iteration.

[0088] After all modules are ready, the external unit transmits the initial value data to the state control module, and the main state machine enters the data uplink and downlink state from the idle state to control the data distribution to the corresponding variable cache module. After the data distribution is completed, if the ordinary differential equation does not need to solve the intermediate variables at the beginning of the operation, the main state machine is controlled to enter state 1, at which time the single-step method iteration begins to calculate the initial value required by the linear multi-step method.

[0089] At this time, the state 1 jumps from the idle state to the RK1 state, and a data flow loop starts in this state. The direction of the data flow in a data flow loop is as follows Figure 6 As shown, the algorithm iteration module is reconstructed into the form that satisfies the following fourth-order classic Runge-Kutta method:

[0090]

[0091] The algorithm iteration module after reconstruction is as follows Figure 7 As shown, in this data flow loop, the data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module, and then the ordinary differential equation calculation module starts to calculate and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the RK1 state in the first sub-state machine, and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the first sub-state machine is controlled to enter RK2 from RK1. At the same time, the algorithm iteration module is reconstructed as follows Figure 8 The structure shown.

[0092] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the differential variable values ​​from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the differential variable results to the algorithm iteration module, and outputs the intermediate variable results to the intermediate variable storage unit in the variable cache module. After receiving the transmitted results, the algorithm iteration module performs the algorithm operation corresponding to the RK2 state. If the second-order Runge-kutta method is selected, the result is output to the variable cache module. At this time, a second-order Runge-kutta method iteration is completed. If not, the result is output to the ordinary differential equation calculation module. After all variables are calculated, the first sub-state machine is controlled to enter RK3 from RK2. At the same time, the algorithm iteration module is reconstructed as follows Fig. 9 The structure shown.

[0093] Repeat the above data flow loop, and after all variables are calculated, control the first state machine to enter RK4 from RK3. At the same time, restructure the algorithm iteration module as follows Fig.10 The structure shown.

[0094] Repeat the above data flow loop, and after all variables are calculated, the first state machine enters RK1 from RK4. At the same time, the algorithm iteration module is restructured as follows Figure 7 The structure is shown. Repeat the above algorithm twice until the initial value variables required for the linear multi-step method startup are generated. At this time, the main state machine is controlled to enter state 2 from state 1, jump back to the idle state from RK4 from state 1, and jump from the idle state to Adams1 from state 2. Fig.11 As shown, the algorithm iteration module is reconstructed into a form that satisfies the following fourth-order Adams prediction-correction system:

[0095] predict:

[0096]

[0097] Correction:

[0098]

[0099] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the Adams1 state in the second sub-state machine, and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the second sub-state machine is controlled to enter Adams2 from Adams1. At the same time, the algorithm iteration module is reconstructed as follows Fig.12 The structure shown.

[0100] Repeat the above data flow loop. After all variables are calculated, if the iteration termination condition is not met, control the second state machine to enter Adams1 from Adams2. At the same time, restructure the algorithm iteration module as follows Fig.11 The structure shown in FIG. Repeat the loop of the second state machine until the iteration termination condition is met.

[0101] When the iteration termination condition is met, the second state machine can be controlled to jump back to the idle state from Adams2, and the main state machine can jump back to the data uplink and downlink state from state 2. In this state, the variable value is read from the variable cache module and passed to other user-defined units. At this point, the initial value problem of the ordinary differential equation mentioned above has been solved.

[0102] In summary, the present invention proposes a circuit design method compatible with the Runge-Kutta method and the Adams method, comprising:

[0103] Initialize the ordinary differential equation problem: receive the initial value of the ordinary differential equation and related configuration data input by the user, and adjust the configuration of each module in the circuit design according to the selected algorithm, which includes the Runge-Kutta method and the Adams method.

[0104] According to the selected algorithm, the main state machine in the state control module enters different states; the main state machine first enters the data uplink and downlink state, passes the initial value data to the variable cache module, and dynamically allocates the storage units in the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step state or the multi-step state.

[0105] When executing the single-step method calculation, the main state machine enters the single-step method state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method; if the termination condition is met, the main state machine returns to the data uplink and downlink state; if the termination condition is not met, the first sub-state machine continues to loop the calculation of RK1 to RK4 until the termination condition is met.

[0106] When executing multi-step calculations, the main state machine first enters the single-step state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method and provide initial values ​​for the multi-step calculations. The main state machine jumps to the multi-step state, and the second sub-state machine executes the calculations of Adams1 and Adams2 until the termination conditions are met or all calculations are completed.

[0107] After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

[0108] The steps in the present invention can be adjusted in order, combined or deleted according to actual needs.

[0109] The units in the device of the present invention can be combined, divided and deleted according to actual needs.

[0110] Although the present invention is disclosed in detail with reference to the accompanying drawings, it should be understood that these descriptions are merely exemplary and are not intended to limit the application of the present invention. The scope of protection of the present invention is defined by the appended claims and may include various modifications, alterations and equivalents made to the invention without departing from the scope and spirit of the present invention.

Claims

1. A circuit design method compatible with the Runge-Kutta method and the Adams method, characterized in that: The method comprises: Initialize the ordinary differential equation problem: receive the initial value of the ordinary differential equation and related configuration data input by the user, and adjust the configuration of each module in the circuit design according to the selected algorithm, which includes the Runge-Kutta method and the Adams method; According to the selected algorithm, the main state machine in the state control module enters different states; the main state machine first enters the data uplink and downlink state, transfers the initial value data to the variable cache module, and dynamically allocates the storage unit in the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step state or the multi-step state; When executing the single-step method calculation, the main state machine enters the single-step method state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method; if the termination condition is met, the main state machine returns to the data uplink and downlink state; if the termination condition is not met, the first sub-state machine continues to cyclically execute the calculations of RK1 to RK4 until the termination condition is met; When executing multi-step calculation, the main state machine first enters the single-step state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method and provide initial values ​​for the multi-step calculation. The main state machine jumps to the multi-step state, and the second sub-state machine executes the calculation of Adams1 and Adams2 until the termination condition is met or all calculations are completed. After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

2. The circuit design method compatible with the Runge-Kutta method and the Adams method as claimed in claim 1, characterized in that: The circuit designed by the method comprises the following modules: The state control module is used to control the overall working state of the circuit; the state control module includes a main state machine, a first sub-state machine, and a second sub-state machine; the main state machine is used to control the switching of the working state of the circuit; The first state machine is used to control the circuit to perform the second to fourth order calculations in the Runge-Kutta method; the second state machine is used to control the circuit to perform the calculations of the fourth order explicit Adams method, the fourth order implicit Adams method and the fourth order Adams prediction-correction system; The variable cache module dynamically allocates storage units according to the form of the ordinary differential equation and the selected algorithm to store the input variables, intermediate variables and operation results of the ordinary differential equation; the variable cache module is composed of several storage units; if the user inputs a differential equation group, the storage units are increased or decreased according to the number of differential variables; The algorithm iteration module includes a group of logic operation units. The state control module sends different instructions to the algorithm iteration module according to the selected algorithm. The algorithm iteration module adjusts the configuration of the logic operation unit according to the instructions and performs iterative calculations. The logic operation unit includes multiple adders and multipliers. For the fourth-order algorithm, the operation of each variable requires three adders and six multipliers. The ordinary differential equation calculation module calculates numerical solutions through a unified interface, supports users to customize differential equation calculation units according to actual problems, and reconstructs the calculation pipeline according to the given ordinary differential equation form. The pipeline is organized in the form of a pipeline. The data path control module is composed of a decoder and several control signals and selection signals. The data path control module is used to realize dynamic scheduling of data flow between modules to meet the demand for calculation paths when switching between different algorithms.

3. The circuit design method compatible with the Runge-Kutta method and the Adams method as claimed in claim 1, characterized in that: In the multi-step calculation, after completing three rounds of Runge-Kutta method calculation, if the termination condition is still not met, the state control module stops iterating and uses the results of the first three rounds of calculation as the initial values ​​of the multi-step calculation, and the second sub-state machine continues to perform the Adams method calculation.

4. The circuit design method compatible with the Runge-Kutta method and the Adams method according to any one of claims 1 to 3, characterized in that: The ordinary differential equation input by the user is a first-order ordinary differential equation system, and the initial value problem of the equation system is in the following form: where a <t≤b; Reconstruct the variable cache module and the ordinary differential equation calculation module. The variable cache module requires two sets of variable cache units and an intermediate variable storage module in the operation process to store the result values ​​calculated by the ordinary differential equation corresponding to each iteration; the ordinary differential equation calculation module is reorganized into the form of calculating f(t, y, z) and g(t, y, z); The fourth-order Adams prediction-correction algorithm in the linear multi-step method is selected. A group of variable cache units in the variable cache module is divided into four independent variable storage sub-units, and each unit stores the numerical solution of one-step iteration; The main state machine performs multi-step calculations. The main state machine first enters the single-step state, and the algorithm iteration module is reconstructed to satisfy the following fourth-order classic Runge-Kutta method: The first sub-state machine performs three rounds of operations from RK1 to RK4 to generate the initial value variables required to start the linear multi-step method. The main state machine enters the multi-step method state, the first sub-state machine jumps back to the idle state, and the second sub-state machine jumps to Adams1. At the same time, the algorithm iteration module is reconstructed into the form that satisfies the following fourth-order Adams prediction-correction system: predict: Correction: The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module, and then the ordinary differential equation calculation module starts to calculate and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the Adams1 state in the second sub-state machine, and outputs the result to the ordinary differential equation calculation module; After all variables are calculated, a data flow loop is completed, and the second state machine is controlled to enter Adams2 from Adams1; Repeat the above data flow loop. After all variables are calculated, if the iteration termination condition is not met, control the second state machine to enter Adams1 from Adams2. Repeat the above second state machine loop until the iteration termination condition is met. When the iteration termination condition is met, the second sub-state machine jumps back to the idle state from Adams2, and the main state machine jumps back to the data uplink and downlink state from the multi-step method state. At this point, the initial value problem of the above ordinary differential equation is solved.

5. The circuit design method compatible with the Runge-Kutta method and the Adams method as claimed in claim 4, characterized in that: The specific process of the first state machine performing three rounds of operations RK1 to RK4 includes: The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts to calculate and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the RK1 state in the first sub-state machine, and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the first sub-state machine is controlled to enter RK2 from RK1. The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the differential variable value from the equation variable cache module. Then the ordinary differential equation calculation module starts to calculate and outputs the differential variable result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transmitted result, the algorithm iteration module performs the algorithm operation corresponding to the RK2 state and outputs the result to the variable cache module; after all the variables are calculated, the first sub-state machine is controlled to enter RK3 from RK2; Repeat the above data flow loop, and after all variables are calculated, control the first state machine to enter RK4 from RK3; repeat again to make RK4 enter RK1, and continue to repeat until three rounds of RK4 calculations are completed to generate the initial value variables required to start the linear multi-step method.

6. The circuit design method compatible with the Runge-Kutta method and the Adams method as claimed in claim 1, characterized in that: The method also includes: for a group of ordinary differential equations in piecewise form, each time a new segment is entered, the system will re-enable the single-step method to calculate the initial value and provide the initial value for the subsequent multi-step method.

7. The circuit design method compatible with the Runge-Kutta method and the Adams method as claimed in claim 1, characterized in that: The method further comprises: for a high-order ordinary differential equation, converting the high-order differential equation into a group of first-order ordinary differential equations and inputting them into the circuit for calculation.

Citation Information

Patent Citations

  • Hardware acceleration device and acceleration method for solving differential equations

    CN106527999A

  • Non-linear ordinary differential equation recognition method based on machine learning

    CN115408932A

  • Differential equation solving method and device, medium and electronic device

    CN116738127A

  • Methods for solving differential equations with algebraic constraints

    EP1143347A1