Model process debugging method, device and storage medium

By obtaining tentative error code lines in the Modelica language model and gradually backtracking the associated variables, the problem of insufficient breakpoints in the Modelica language debugging is solved, and fast and automatic code problem discovery is achieved, reducing debugging difficulty and time.

CN113934626BActive Publication Date: 2024-12-20CHINA AUTOMOTIVE TECH & RES CENT CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111126406.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-26
Publication Date
2024-12-20
Estimated Expiration
2041-09-26

AI Technical Summary

Technical Problem

The Modelica language cannot form debugging breakpoints during the program running, resulting in slow and difficult debugging of model code, affecting software learning and model verification.

Method used

By obtaining the tentative error code line in the target model, determining the target variable and adding information output code to its up and down lines, gradually backtracking the associated variable until the error code line is determined, and the variable information is automatically output.

Benefits of technology

Quickly discover code problems, reduce the debugging work intensity of engineering and technicians, and improve the debugging efficiency of Modelica language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934626B_ABST
    Figure CN113934626B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a model process debugging method, device and medium, and relates to the field of model debugging technology. The method includes: obtaining a tentative error code line in a target model; determining a target variable in the tentative error code line, and adding a target variable information output code to the previous and next lines of the code line where the target variable appears; debugging the target model after the addition operation, and outputting the information of the target variable; determining an associated variable of the target variable; using the associated variable as a new target variable, and returning to the operation of adding the target variable information output code to the previous and next lines of the code line where the target variable appears. This embodiment can quickly realize code problem discovery and output, and reduce the workload of engineering and technical personnel in code debugging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to model debugging technology, and in particular to a model process debugging method, device and storage medium. Background Art

[0002] Modelica is an open, object-oriented, equation-based computer language that can easily model complex physical systems across different fields.

[0003] Since the Modelica language is mainly for object-oriented modeling and equation solving, it is not possible to form debugging breakpoints during program execution and perform line-by-line code debugging, which makes debugging the calculation process inconvenient and unable to accurately provide the cause of the error during the calculation process. As a result, the model code debugging process is relatively slow and difficult, affecting various aspects such as software learning, model building, and model verification. Summary of the invention

[0004] The embodiments of the present invention provide a model process debugging method, device and storage medium.

[0005] In a first aspect, an embodiment of the present invention provides a model process debugging method, comprising:

[0006] Get the tentative error code line in the target model;

[0007] Determine the target variable in the tentative error code line, and add the target variable information output code in the previous line and the next line of the code line where the target variable appears;

[0008] Debugging the target model after the adding operation, and outputting information of the target variable;

[0009] If the information of the target variable is wrong and the code line where the target variable appears is correct, determine the associated variable of the target variable;

[0010] The associated variable is used as a new target variable, and the operation of adding the target variable information output code in the previous line and the next line of the code line where the target variable appears is returned until it is determined that the code line where the new target variable appears is wrong.

[0011] In a second aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0012] one or more processors;

[0013] a memory for storing one or more programs,

[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement the model process debugging method described in any embodiment.

[0015] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the model process debugging method described in any embodiment is implemented.

[0016] In a fourth aspect, an embodiment of the present invention further provides a model process debugging method, comprising:

[0017] Obtaining a tentative error code line in the target model;

[0018] Determine a target variable in the tentative error code line, and an associated variable of the target variable;

[0019] Add target variable information output code in the previous line and the next line of the code line where the target variable appears, and add associated variable information output code in the previous line and the next line of the code line where the associated variable appears;

[0020] Debug the target model after the adding operation, and output the information of the target variable and the associated variables.

[0021] The embodiment of the present invention provides an efficient problem debugging solution based on the characteristics of the Modelica language, which automatically outputs the information of the target variable during the debugging of the target model by determining the target variable that may have errors and adding the target variable information output code; determines the associated variable of the target variable by determining that the information of the target variable is wrong and the line of code where the target variable appears is correct, and further obtains the information of the associated variable by adding code, thereby gradually backtracking each variable that may have errors until the line of code where the new target variable appears is determined to be wrong. This embodiment can quickly realize code problem discovery and output, and reduce the workload of engineering and technical personnel in code debugging. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 is a flow chart of a model process debugging method provided by an embodiment of the present invention;

[0024] Figure 2 is a flow chart of another model process debugging method provided by an embodiment of the present invention;

[0025] Figure 3It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0027] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0028] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0029] In order to facilitate the description of the method provided by the present invention, an example is first introduced to describe the traditional process debugging method. The model to be debugged is written in Modelica language as follows:

[0030] Table 1 Model written in Modelica language

[0031] 1 model Model17 2 Real x(start=1); 3 Real timeX; 4 Real y; 5 Real z; 6 algorithm 7 timeX:=x+time; 8 z:=sqrt(timeX); 9 equation 10 z-der(y)=1; 11 x = sqrt(z-10*time); 12 end Model17;

[0032] Use the existing Modelica commercial software to start debugging the model. This software cannot locate the specific location of calculation errors, and only gives the general form of the equation, and a few will give the specific location line. The error content of the above model is:

[0033] Error:sqrt(z+(-2)*time)=sqrt(-0.135081857131789)

[0034] Error:sqrt(z+(-2)*time)=sqrt(-0.135081848943282)

[0035] After analysis, it is believed that the data in the sqrt brackets should be positive, and it is believed that the error occurs in line 11. The R&D personnel can only find the cause of the error in the model building process by themselves, which makes it impossible to quickly find the cause of the problem. The embodiment of the present invention provides a model process debugging method, and its flow chart is as follows Figure 1 As shown, it is applicable to the process debugging of the model written in Modelica language. This embodiment is executed by an electronic device as an auxiliary tool of Modelica commercial software and runs during the model process debugging process. Figure 1 , the method provided in this embodiment specifically includes:

[0036] S110: Obtain a provisional error code line in the target model.

[0037] The target model is a model written in Modelica language and is a model to be debugged. The tentative error code line may be a code including an algorithm or an equation that may be erroneous. Preferably, the model is debugged using the currently available Modelica commercial software. The Modelica commercial software will output the error code line in the window as the tentative error code line; or, if the Modelica commercial software only outputs calculation errors, the user determines the tentative error code line, for example, selects the code line, line 11 in Table 1.

[0038] S111. Determine the target variable in the tentative error code line.

[0039] S120, adding target variable information output code to the line above and the line below the code line where the target variable appears.

[0040] Any variable in the tentative error code line may be wrong, but the time variable is only related to the system operation and generally will not be wrong, so the non-time variable in the tentative error code line is determined as the target variable. Alternatively, the user can select a variable according to his own analysis, and in response to the user's variable selection operation, the variable selected by the user is used as the target variable.

[0041] When the number of target variables in this step is more than two, one of the target variables will be selected to add the target variable information output code. Optionally, in response to the user's setting trigger operation, the target variable information output code is generated according to the target variable and automatically added to the previous and next lines of the code line where the target variable appears; wherein the setting trigger operation includes: a trigger operation on a keyboard shortcut, a trigger operation on a mouse code debugging button, or a gesture trigger operation on a touch panel; the variable information includes the value and running time of the variable.

[0042] In a specific implementation, when the target variable is a common single variable, the target variable information output code format is as follows:

[0043] Modelica.Utilities.Streams.print(String(time)+"before the error position"+""+"variable name"+"="+String(variable name));

[0044] Modelica.Utilities.Streams.print(String(time)+"error position"+""+"variable name"+"="+String(variable name));

[0045] When the target variable is an array type variable, the target variable information output code format is as follows:

[0046] Modelica.Utilities.Streams.print(String(time)+"before the error position"+""+"variable name"+"["+"variable name position"+"]"+"="+String(variable name[variable name position]));

[0047] Modelica.Utilities.Streams.print(String(time)+"after the error position"+""+"variable name"+"["+"variable name position"+"]"+"="+String(variable name[variable name position]));

[0048] The output form of String(time)+"after the error position"+""+"variable name"+"["+"variable name position"+"]"+"="+String(variable name[variable name position]) can change the output code template according to the specific variable properties.

[0049] Therefore, after determining the target variable, it is only necessary to add the target variable to the template and generate the target variable information output code in combination with the output code at runtime.

[0050] The code line where the target variable appears should be selected as the temporary error code line, so that the error location can be directly found and the cause of the error can be found as soon as possible; if the user needs to know the historical data, the code line where the target variable first appears in the target model can be selected. The target model after adding the operation is shown in Table 2:

[0051] Table 2 Target model after adding operation

[0052]

[0053]

[0054] S130, debugging the target model after the adding operation, and outputting the information of the target variable.

[0055] Use the existing Modelica commercial software to debug the target model shown in Table 2. Output the value and running time of the target variable in the window of the Modelica commercial software. Some can also output the location (code line) of the target variable. In Table 2, the variables of the four statements 11, 12, 14 and 15 are output. The output form is as follows:

[0056] 0.002 time after error reporting = 0.002

[0057] 0.002 time before error reporting = 0.002

[0058] 0.002 error position before z=0.994593

[0059] 0.002 error position after z = 0.994593

[0060] 0.004 error position after time = 0.004

[0061] 0.004 time before error reporting = 0.004

[0062] 0.004 error position before z=0.989031

[0063] 0.004 error position after z = 0.989031

[0064] 0.006 time after error reporting = 0.006

[0065] 0.006 time before error reporting = 0.006

[0066] 0.006 error position before z=0.983304

[0067] 0.006 error position after z = 0.983304

[0068] The data in the window is the result of running the code, and the readability is relatively poor. Optionally, by calling the script, the values ​​of the target variables are sorted in the order of running time, such as drawing a curve or table, so as to find the change pattern of the target variable. For example, it is sorted into Table 3.

[0069] Table 3 Data list of target variable z

[0070]

[0071] S140, determine whether the target variable information and the code line where the target variable appears are correct. If the target variable information is incorrect and the code line where the target variable appears is correct, execute S150; if the target variable information is correct and the code line where the target variable appears is correct, execute S160. If the code line where the target variable appears is incorrect, execute S170.

[0072] The code line where the target variable appears includes an equation or an algorithm, and a user determines whether it is correct. If it is correct, a set operation can be performed, such as pressing ALT+P on the keyboard, to determine that the code line where the target variable appears is correct; if it is wrong, press ALT+L on the keyboard.

[0073] Whether the target variable information is correct can be automatically completed. Specifically, according to the value of the target variable and the running time, the change law of the value of the target variable over time, such as the first-order change rate or the second-order change rate, is calculated. If the change law is inconsistent with the physical change law of the equation or algorithm in the code line where the target variable appears, the target variable information is wrong; if the change law is consistent with the physical change law of the equation or algorithm in the code line where the target variable appears, the target variable information is correct.

[0074] Among them, the physical change law of the equation or algorithm is: the physical change law of the target variable reflected in the equation or algorithm. This change law is reflected by the mathematical conditions of the equation or algorithm itself. For example, in x=sqrt(z-10*time), z-10*time cannot be 0, that is, the physical change law of z is always greater than 10*time. However, according to the data in Table 3, z and time are plotted, and it is found that z is a decreasing function and time is an increasing function. After a certain period of time, z will be less than 10*time, resulting in a calculation error of negative square root of sqrt. Since time is immutable, it means that the information of z variable is wrong. On the contrary, if according to the data in Table 3, z is always greater than 10*time, then the information of z variable is correct.

[0075] S150: Determine the associated variable of the target variable.

[0076] The associated variable is a variable that has an operational relationship with the target variable. For an algorithm or equation, the target variable is located at the end to be assigned a value, and the associated variable is located at the end to be assigned a value. Therefore, the associated variable is the reason for the target variable. Therefore, above the code line where the target variable appears, determine the algorithm or equation where the target variable appears; use the variables in the algorithm or equation other than the target variable as associated variables; and the number of associated variables is at least one.

[0077] Continuing with the above example, if the information of the z variable is wrong, the equation related to z is searched and analyzed to find that z:=sqrt(timeX), and the associated variable is timeX.

[0078] S151. Use the associated variable as a new target variable, and return to S120.

[0079] The code line where the new target variable appears here is preferably above the code line where the historical target variable appears, and the code line where the algorithm or equation where the historical target variable appears is determined, and the probability of problems in this code line is relatively high. Referring to the description at S120, the timeX variable information output code is added to the line above and the line below z:=sqrt(timeX), which will not be repeated here.

[0080] Optionally, the target variable information output code added historically may be deleted before S151 to keep the output information non-redundant; of course, all added target variable information output codes may be deleted at once after finally determining the code line error that appears in the new target variable.

[0081] S160, determine another variable in the provisional error code line, and update the other variable to the target variable. Return to the operation of adding the target variable information output code in the previous line and the next line of the code line where the target variable appears, that is, S120.

[0082] If the information of the target variable is correct and the code line where the target variable appears is correct, it means that there is no error in the currently selected target variable, and then another variable in the tentatively erroneous code line is selected.

[0083] S170, end this operation.

[0084] It is found that the code line where the target variable appears may contain equation writing errors, condition judgment errors, equation condition missing errors, etc. The user should determine the cause of the error and modify it by himself.

[0085] The embodiment of the present invention provides an efficient problem debugging solution based on the characteristics of the Modelica language, which automatically outputs the information of the target variable during the debugging of the target model by determining the target variable that may have errors and adding the target variable information output code; determines the associated variable of the target variable by determining that the information of the target variable is wrong and the line of code where the target variable appears is correct, and further obtains the information of the associated variable by adding code, thereby gradually backtracking each variable that may have errors until the line of code where the new target variable appears is determined to be wrong. This embodiment can quickly realize code problem discovery and output, and reduce the workload of engineering and technical personnel in code debugging.

[0086] Figure 2 This is a flowchart of another model process debugging method provided by an embodiment of the present invention, which can be applied to the process debugging of a model written in Modelica language. This embodiment is executed by an electronic device as an auxiliary tool of Modelica commercial software and runs during the model process debugging process. Figure 1 , the method provided in this embodiment specifically includes:

[0087] S210: Obtain target code lines in the target model.

[0088] The target code line may be a provisional error code line that may have an error in the above embodiment, or may be any code line, that is, this embodiment is applicable to both variable analysis of a model that runs normally without errors and variable analysis of a model that reports errors.

[0089] S220: Determine a target variable in the target code line, and an associated variable of the target variable.

[0090] For the description of the target variable and the associated variable, please refer to the above embodiment.

[0091] S230, adding a target variable information output code in the previous line and the next line of the code line where the target variable appears, and adding an associated variable information output code in the previous line and the next line of the code line where the associated variable appears.

[0092] S240, debugging the target model after the adding operation, and outputting information of the target variable and associated variables.

[0093] This embodiment and Figure 1 The main difference of the embodiment shown is that the target variable output code and the associated variable (and the associated variable of the associated variable and so on) output code are added at one time, without Figure 1 Generally, they are added separately during multiple debugging processes, so that after debugging the target model after the adding operation, the information of the target variable and the associated variable can be obtained at one time.

[0094] In actual application scenarios, you can perform code addition operations on the class where the target variable is located (excluding external codes introduced by extern and connect) and the associated variables in the same equation or algorithm as the target variable, and mark the number of code lines corresponding to this output value to form a data list for data analysis. This allows you to observe the changing forms and relationships of all related variables at one time.

[0095] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the device includes a processor 40, a memory 41, an input device 42 and an output device 43; the number of processors 40 in the device can be one or more. Figure 3 A processor 40 is taken as an example; the processor 40, memory 41, input device 42 and output device 43 in the device can be connected by a bus or other means. Figure 3 The example of connecting through bus is taken in the following.

[0096] The memory 41, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the model process debugging method in the embodiment of the present invention. The processor 40 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 41, that is, implements the above-mentioned model process debugging method.

[0097] The memory 41 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 41 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 41 may further include a memory remotely arranged relative to the processor 40, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0098] The input device 42 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 43 may include a display device such as a display screen.

[0099] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the model process debugging method of any embodiment is implemented.

[0100] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.

[0101] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0102] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0103] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.

Claims

1. A model process debugging method, characterized in that: include: Obtaining a tentative error code line in a target model; wherein the target model is a model written based on the Modelica language; Determine the target variable in the provisional error code line, and add the target variable information output code in the previous line and the next line of the code line where the target variable appears; the provisional error code line may be an error code including an algorithm or equation; When the target variable is a common single variable, the target variable information output code format is as follows: Modelica.Utilities.Streams.print(String(time)+"before the error position"+ ""+"variable name"+"= "+String(variable name)); Modelica.Utilities.Streams.print(String(time)+"error position"+ ""+"variable name"+"= "+String(variable name)); When the target variable is an array type variable, the target variable information output code format is as follows: Modelica.Utilities.Streams.print(String(time)+"before the error position"+ ""+"variable name"+"["+"variable name position"+"]"+" = "+String(variable name[variable name position])); Modelica.Utilities.Streams.print(String(time)+"after the error position"+ ""+"variable name"+"["+"variable name position"+"]"+" = "+String(variable name[variable name position])); Debugging the target model after the adding operation, and outputting information of the target variable, including the value and running time of the target variable; A user setting operation for determining whether a line of code is correct is pre-set, and in response to the user setting operation, it is determined that the line of code in which the target variable appears is correct; According to the value of the target variable and the running time, calculating the change rule of the value of the target variable over time; If the change law is inconsistent with the physical change law of the equation or algorithm in the code line where the target variable appears, the information of the target variable is wrong; wherein the physical change law of the equation or algorithm is: the physical change law reflected by the target variable in the equation or algorithm; If the change rule is consistent with the physical change rule of the equation or algorithm in the code line where the target variable appears, the information of the target variable is correct; If the information of the target variable is wrong and the code line where the target variable appears is correct, determine the associated variable of the target variable; The associated variable is used as a new target variable, and the operation of adding the target variable information output code to the previous line and the next line of the code line where the target variable appears is returned until it is determined that the code line where the new target variable appears is wrong; If the information of the target variable is correct and the code line where the target variable appears is correct, determine another variable in the tentative error code line, and update the other variable to the target variable; Returns the operation of adding target variable information output code to the line above and below the line of code where the target variable appears.

2. The method according to claim 1, characterized in that The step of determining the target variable in the tentative error code line comprises: determining the non-time variable in the tentative error code line as the target variable; or, In response to a variable selection operation by a user, the variable selected by the user is used as the target variable.

3. The method according to claim 1, characterized in that The step of adding target variable information output code to the line above and the line below the line of code where the target variable appears includes: In response to a user's set trigger operation, a target variable information output code is generated according to the target variable, and is automatically added to the previous and next lines of the code line where the target variable appears; The setting trigger operation includes: a trigger operation on a keyboard shortcut key, a trigger operation on a mouse code debugging key, or a gesture trigger operation on a touch panel; The variable information includes the value and running time of the variable.

4. The method according to claim 1, characterized in that: The determining of the associated variable of the target variable includes: Above the line of code where the target variable appears, determine the algorithm or equation where the target variable appears; Using variables other than the target variable in the algorithm or equation as associated variables; The operation of returning the target variable information output code to the previous line and the next line of the code line where the target variable appears includes: Returns the operation of adding target variable information output code to the line above and below the line of code where the algorithm or equation is located.

5. The method according to any one of claims 1 to 4, characterized in that: After the code line error of determining the new target variable, the method further includes: Delete all target variable information output codes that were added.

6. A model process debugging method, characterized in that: include: Obtaining a tentative error code line in a target model; wherein the target model is a model written based on the Modelica language; Determine a target variable in the provisional error code line, and an associated variable of the target variable; the provisional error code line is a code including an algorithm or an equation that may be erroneous; Add target variable information output code in the previous line and the next line of the code line where the target variable appears, and add associated variable information output code in the previous line and the next line of the code line where the associated variable appears; When the target variable is a common single variable, the target variable information output code format is as follows: Modelica.Utilities.Streams.print(String(time)+"before the error position"+ ""+"variable name"+"= "+String(variable name)); Modelica.Utilities.Streams.print(String(time)+"error position"+ ""+"variable name"+"= "+String(variable name)); When the target variable is an array type variable, the target variable information output code format is as follows: Modelica.Utilities.Streams.print(String(time)+"before the error position"+ ""+"variable name"+"["+"variable name position"+"]"+" = "+String(variable name[variable name position])); Modelica.Utilities.Streams.print(String(time)+"after the error position"+ ""+"variable name"+"["+"variable name position"+"]"+" = "+String(variable name[variable name position])); Debugging the target model after the adding operation, outputting the information of the target variable and the associated variable; the information of the target variable includes the value and the running time of the target variable; A user setting operation for determining whether a line of code is correct is pre-set, and in response to the user setting operation, it is determined that the line of code in which the target variable appears is correct; According to the value of the target variable and the running time, calculating the change rule of the value of the target variable over time; If the change law is inconsistent with the physical change law of the equation or algorithm in the code line where the target variable appears, the information of the target variable is wrong; wherein the physical change law of the equation or algorithm is: the physical change law reflected by the target variable in the equation or algorithm; If the change rule is consistent with the physical change rule of the equation or algorithm in the code line where the target variable appears, the information of the target variable is correct; If the information of the target variable is correct and the code line where the target variable appears is correct, determine another variable in the tentative error code line, and update the other variable to the target variable; Returns the operation of adding target variable information output code to the line above and below the line of code where the target variable appears.

7. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the model process debugging method as described in any one of claims 1-6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the model process debugging method as described in any one of claims 1 to 6 is implemented.