Liquid rocket engine simulation optimization method based on Python control
By using Python scripts and intelligent algorithms in liquid rocket engine simulation, the Amesim model parameters are automatically controlled, which solves the problem of manual parameters adjustment in the existing technology, and improves the simulation optimization efficiency and accuracy.
Patent Information
- Application Number
- CN202510343517.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-03-21
AI Technical Summary
The existing liquid rocket engine simulation platform relies on manual adjustment of simulation parameters, which is difficult to deal with complex multivariate design problems, low optimization efficiency, and Amesim's Python API function calls are complex and cannot modify parameters.
By creating Python scripts to control the Amesim model, real-time modification and optimization of model parameters are realized, and automated simulation optimization is combined with intelligent algorithms.
It realizes automated control and parameter optimization of the simulation process of liquid rocket engines, improving design efficiency and performance optimization accuracy.
Smart Images

Figure CN120278006A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of liquid rocket engines, and in particular, to a simulation optimization method for liquid rocket engines based on Python control. Background Art
[0002] Liquid rocket engines are key components of aerospace propulsion systems, and their performance directly affects the thrust, combustion efficiency, and reliability of rockets. In traditional design processes, simulation technology has been widely used in the performance analysis and optimization of liquid rocket engines. However, most existing simulation platforms rely on manual adjustment of simulation parameters, making it difficult to handle complex multi-variable design problems and resulting in low optimization efficiency. Currently, there are numerous simulation platforms for liquid rocket engine modeling, and various methods for calling simulation platforms are different. As a common simulation platform for liquid rocket engines, Amesim has complex Python API function calls and cannot modify parameters. Therefore, there is an urgent need to design a simulation optimization method for liquid rocket engines based on Python control that can simply and clearly call simulation software and can modify simulation model parameters in real time during the simulation process. Summary of the Invention
[0003] In order to solve the above problems, the purpose of the present invention is to provide a simulation optimization method for liquid rocket engines based on Python control, which solves the technical problems in the prior art that mostly rely on manual adjustment of simulation parameters, making it difficult to handle complex multi-variable design problems and having low optimization efficiency, and designs a method that can simply and clearly call simulation software and can modify simulation model parameters in real time during the simulation process.
[0004] In order to achieve the above purpose, the technical solution of the present invention is as follows:
[0005] The present invention provides a simulation optimization method for liquid rocket engines based on Python control, including the following steps:
[0006] S1. Create a Python script for controlling the simulation.
[0007] S2. Establish master and slave communication components in the Amesim model.
[0008] S3. Create a Python script for modifying parameters in the Amesim model.
[0009] S4. Input the parameters output by Amesim into an intelligent algorithm, and then perform parameter optimization.
[0010] As a simulation optimization method for liquid rocket engines based on Python control of the present invention, S1 includes the following steps:
[0011] S11. By using the Python API library in Amesim, write the file name of the already created liquid rocket engine model rocket_simulation.ame into the Python script, and call the model through the "AMELoad" function;
[0012] S12. Use the "amegetvarnamefromui" function to obtain the model parameters, and use the "amegetsimopt" function to set the simulation time and simulation step size;
[0013] S13. Use the "amerunsingle" function to control the start of the simulation.
[0014] As a Python-controlled simulation optimization method for liquid rocket engines according to the present invention, in S12, the "amegetsimopt" function sets the total simulation time and simulation step size through "finalTime" and "printInterval" respectively.
[0015] As a Python-controlled simulation optimization method for liquid rocket engines according to the present invention, S2 includes the following steps:
[0016] S21. Select the component "DYNCOSIMSHM01" in Amesim as the interface for information transfer between the simulation model and the Python script, and set them as "master" and "slave" respectively;
[0017] S22. Replace "master" and "slave" with Python code, but it is necessary to ensure that the dimension of the output parameter of master is consistent with the dimension of the input parameter of slave and the dimension of the output parameter of slave is consistent with the dimension of the input parameter of master.
[0018] As a Python-controlled simulation optimization method for liquid rocket engines according to the present invention, the sampling times of "master" and "slave" in S21 are less than the simulation step size set by the "amegetsimopt" function in step S12.
[0019] As a Python-controlled simulation optimization method for liquid rocket engines according to the present invention, S3 includes the following steps:
[0020] S31. Based on the VSCode platform, create a new Python script that can modify the parameters in the Amesim simulation model;
[0021] S32. Obtain the variables in the simulation model through the function "amegetvarnamefromui" of the Python API in Amesim, and modify the model parameters through the function "aneputp".
[0022] S33. Obtain the output results through the function "ameloadvarst".
[0023] As a simulation optimization method for liquid rocket engines based on Python control of the present invention, S4 includes the following steps:
[0024] S41. Create a Python script containing an intelligent algorithm, and input the parameters output by Amesim into the intelligent algorithm.
[0025] S42. Through the calculation of the intelligent algorithm, obtain the optimized model parameters, and then input the optimized model parameters back into the new Python script in S31 to achieve parameter optimization.
[0026] Adopting the above technical solution, the present invention has the following advantages:
[0027] The present invention provides a simulation optimization method for liquid rocket engines based on Python control. Aiming at the problem that parameters need to be manually adjusted in the existing simulation parameter optimization process of liquid rocket engines, the simulation is controlled by creating a script that controls the Python API functions in Amesim, and then the communication between the model and Python is realized through memory. The parameters of the model and the results obtained from the simulation are output to the intelligent algorithm in real time. Finally, through the calculation of the intelligent algorithm, the optimized parameters are obtained and input back into the simulation model to achieve parameter optimization. The method of the present invention combines the Python script with the Amesim software, automatically controls the simulation process, and can embed the intelligent algorithm to realize the real-time optimization of the simulation parameters. The simulation optimization method for liquid rocket engines based on Python control of the present invention can greatly improve the design efficiency and the accuracy of performance optimization, and provides an efficient and intelligent method for the research and development and performance optimization of liquid rocket engines. Brief Description of the Drawings
[0028] Figure 1 It is the overall flowchart of the simulation optimization method for liquid rocket engines based on Python control of the present invention;
[0029] Figure 2 It is the relationship transfer diagram between different Python scripts and Amesim files of the present invention;
[0030] Figure 3 It is the Amesim model diagram of the present invention;
[0031] Figure 4 This is the optimization result diagram of the simulation model of the present invention. Specific embodiments
[0032] The technical solution of the present invention will be specifically described below in conjunction with the accompanying drawings of the specification. It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device.
[0033] A liquid rocket engine simulation optimization method based on Python control includes the following specific steps as Figure 1 shown:
[0034] S1. Create a Python script for controlling the simulation.
[0035] Among them, S1 includes the following specific steps:
[0036] S11. By using the Python API library in Amesim, write the file name of the already created liquid rocket engine model rocket_simulation.ame into the Python script, and call the model through the "AMELoad" function.
[0037] S12. Use the "amegetvarnamefromui" function to obtain the model parameters, and use the "amegetsimopt" function to set the simulation time and simulation step size. The "amegetsimopt" function sets the total simulation time and simulation step size through "finalTime" and "printInterval" respectively.
[0038] S13. Use the "amerunsingle" function to control the start of the simulation.
[0039] In a specific embodiment, based on the VSCode platform, Python code is created to control the simulation of a liquid rocket engine model in the Amesim platform. By using the Python API library in Amesim, the name of the already created model rocket_simulation.ame file is written into the Python script. The model is called through the "AMELoad" function, and then the "amegetvarnamefromui" function is used to obtain the model parameters. In the "amegetsimopt" function, "finalTime" and "printInterval" are set to 5.0 and 0.04 respectively, indicating that the total simulation time is 5 s and the simulation step size is 0.04 s. Then, the "amerunsingle" function is used to start the simulation. The information transfer between different Python scripts and.ame files is as Figure 2 shown. They are two.ame files with master and slave respectively. Then, Python scripts are used to control the two.ame files respectively. Then, another Python script is used to transfer the real-time output results of the.ame file with the intelligent control algorithm, and then the parameter modification instruction is returned to the.ame file.
[0040] S2. Establish master-slave communication components in the Amesim model;
[0041] Among them, S2 includes the following specific steps:
[0042] S21. Select the component "DYNCOSIMSHM01" in Amesim as the interface for information transfer between the simulation model and the Python script, and set them as "master" and "slave" respectively;
[0043] S22. Replace "master" and "slave" with Python code, but it is necessary to ensure that the dimension of the output parameters of master is consistent with the dimension of the input parameters of slave and the dimension of the output parameters of slave is consistent with the dimension of the input parameters of master. In addition, the sampling time of "master" and "slave" should be less than the simulation step size set by the "amegetsimopt" function in step S12.
[0044] In a specific embodiment, in the rocker_simulation.ame file, add the DYNCOSIMSHM01 component, set it as "master", set the sampling time to 0.04 s, name the shared memory as shm_0, with 3-dimensional input parameters and 11-dimensional output parameters. Then, in the Python file responsible for the exchange, set the class of "slave" so that its input parameters are 11-dimensional and the output parameters are 3-dimensional. The established Amesim model is specifically as Figure 3 shown.
[0045] S3. Create a Python script to modify the parameters in the Amesim model;
[0046] Among them, S3 includes the following steps:
[0047] S31. Based on the VSCode platform, create a new Python script that can modify the parameters in the Amesim simulation model;
[0048] S32. Through the functions of the Python API in Amesim, use the "amegetvarnamefromui" function to obtain the variables in the simulation model, and use the "aneputp" function to modify the model parameters;
[0049] S33. Use the "ameloadvarst" function to obtain the output results.
[0050] In a specific embodiment, based on the VSCode platform, create a Python script that can modify the parameters in the Amesim simulation model. Receive the parameters from the intelligent algorithm program, and use the "ameputp" function of the Python API to modify the parameters in the Amesim model in real time. The main parameters modified in this embodiment are the three-dimensional parameters input in "master".
[0051] S4. Input the parameters output by Amesim into the intelligent algorithm, and then perform parameter optimization.
[0052] Among them, S4 includes the following specific steps:
[0053] S41. Create a Python script containing the intelligent algorithm, and input the parameters output by Amesim into the intelligent algorithm;
[0054] S42. Through the calculation of the intelligent algorithm, obtain the optimized model parameters, and input the optimized model parameters back into the new Python script in S31 to achieve parameter optimization.
[0055] In a specific embodiment, the optimization of the liquid rocket engine valve parameters is achieved by using the particle swarm optimization algorithm. The parameters output by Amesim are input into the particle swarm optimization algorithm. Through the calculation of the particle swarm optimization algorithm, the optimized model parameters are obtained. The optimized model parameters are then input back into a new Python script that can modify the parameters in the Amesim simulation model to achieve parameter optimization, enabling the thrust of the liquid rocket engine to be stabilized as soon as possible after startup. The specific result diagram of the optimized simulation model is as shown in Figure 4 shown. The ordinate in the simulation model is the thrust of the rocket engine valve, and the abscissa is time.
[0056] Finally, it should be noted that although the present invention has been described with reference to the current specific embodiments, those of ordinary skill in the art in this technical field should recognize that the above embodiments are only used to illustrate the present invention and are not intended to limit the present invention. Various equivalent changes or substitutions can be made without departing from the inventive concept of the present invention. Therefore, as long as the changes and modifications to the above embodiments are within the scope of the spirit of the present invention, they will fall within the scope of the claims of the present invention.
Claims
1. A simulation optimization method for liquid rocket engines based on Python control, characterized in that, It includes the following steps: S1. Create a Python script for controlling the simulation to proceed; S2. Establish master and slave communication components in the Amesim model; S3. Create a Python script for modifying parameters in the Amesim model; S4. Input the parameters output by Amesim into the intelligent algorithm, and then perform parameter optimization.
2. The liquid rocket engine simulation optimization method based on Python control according to claim 1, wherein, The S1 includes the following steps: S11. By using the Python API library in Amesim, write the file name of the already created liquid rocket engine model rocket_simulation.ame into the Python script, and call the model through the "AMELoad" function; S12. Use the "amegetvarnamefromui" function to obtain model parameters, and use the "amegetsimopt" function to set the simulation time and simulation step size; S13. Use the "amerunsingle" function to control the start of the simulation.
3. The liquid rocket engine simulation optimization method based on Python control according to claim 2, wherein, In the S12, the "amegetsimopt" function sets the total simulation time and simulation step size through "finalTime" and "printInterval" respectively.
4. A method for simulating and optimizing a liquid rocket engine based on Python control according to claim 3, characterized in that The S2 includes the following steps: S21. In Amesim, select the component "DYNCOSIMSHM01" as the interface for information transfer between the simulation model and the Python script, and set them as "master" and "slave" respectively; S22. Replace "master" and "slave" with Python code, but it is necessary to ensure that the dimension of the output parameters of the master is consistent with the dimension of the input parameters of the slave and the dimension of the output parameters of the slave is consistent with the dimension of the input parameters of the master.
5. A method for simulating and optimizing a liquid rocket engine based on Python control according to claim 4, characterized in that The sampling time of "master" and "slave" in the S21 is less than the simulation step size set by the "amegetsimopt" function in the step S12.
6. A method for simulating and optimizing a liquid rocket engine based on Python control according to claim 5, characterized in that, The S3 includes the following steps: S31. Based on the VSCode platform, create a new Python script for modifying parameters in the Amesim simulation model; S32. Through the functions of the PythonAPI in Amesim, use the "amegetvarnamefromui" function to obtain variables in the simulation model, and use the "aneputp" function to modify model parameters; S33. Use the "ameloadvarst" function to obtain the output result.
7. A method for simulating and optimizing a liquid rocket engine based on Python control according to claim 6, characterized in that, The S4 includes the following steps: S41. Create a Python script containing the intelligent algorithm, and input the parameters output by Amesim into the intelligent algorithm; S42. Through the calculation of the intelligent algorithm, obtain the optimized model parameters, and input the optimized model parameters back into the new Python script in the S31 to achieve parameter optimization.
Citation Information
Patent Citations
Geometric parameter optimization method for ball-end milling cutter based on co-simulation
CN108920844A
Method for optimizing dynamic performance of armored vehicle by adopting multi-language hybrid programming
CN115688445A
Comprehensive energy intelligent algorithm service operation effect simulation evaluation method and device
CN117574626A
Liquid rocket engine starting process control method and system
CN119163528A
System, method, program and storage medium storing the program for generating emulation model and generating and displaying information on uncertainty of target variable of the generated emulation model
JP2019096237A