CN115618659A - System and method for simulating driver code by simulating servo motor - Google Patents
System and method for simulating driver code by simulating servo motor Download PDFInfo
- Publication number
- CN115618659A CN115618659A CN202211620655.XA CN202211620655A CN115618659A CN 115618659 A CN115618659 A CN 115618659A CN 202211620655 A CN202211620655 A CN 202211620655A CN 115618659 A CN115618659 A CN 115618659A
- Authority
- CN
- China
- Prior art keywords
- simulation
- algorithm
- module
- embedded
- motor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
-
- H—ELECTRICITY
- H02—GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
- H02P—CONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
- H02P21/00—Arrangements or methods for the control of electric machines by vector control, e.g. by control of field orientation
-
- H—ELECTRICITY
- H02—GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
- H02P—CONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
- H02P6/00—Arrangements for controlling synchronous motors or other dynamo-electric motors using electronic commutation dependent on the rotor position; Electronic commutators therefor
- H02P6/34—Modelling or simulation for control purposes
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Power Engineering (AREA)
- Computer Hardware Design (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention relates to the technical field of algorithm simulation, and particularly discloses a system and a method for simulating a servo motor to simulate a driver code, wherein the system comprises a visualization system, an embedded algorithm system and an algorithm simulation system; a visualization system; setting simulation algorithm parameters and an embedded algorithm module used for simulation by applying Qt C + + programming desktop application, and displaying a simulation result; an embedded algorithm system: programming by using the C code, and storing embedded algorithm module data; an algorithm simulation system: and C + + code programming is applied to realize the resolving of the simulation algorithm and the simulation flow control through the information interaction with the visual system and the embedded algorithm system, and the simulation algorithm comprises a virtual motor module and a solver module. The scheme solves the problem that the driver control algorithm needs to be written again from simulation to actual use, so that simulation codes can be loaded into the driver to run with minimum change, and the workload and the time cost are reduced.
Description
Technical Field
The invention relates to the technical field of algorithm simulation, in particular to a system and a method for simulating a servo motor to simulate driver codes.
Background
The servo driver is an important component of modern motion control, and is widely applied to automation equipment such as industrial robots and numerical control machining centers. With the development and progress of industrial technology, the control precision requirement of the industrial control system on the servo driver is increased, which means that more complex control algorithm support is required.
The traditional motor simulation algorithm design is generally realized by using a visual simulation tool Simulink. On one hand, simulink carries out the construction of an algorithm model based on visual primitives, which brings great limitation, and most obviously, the data structure cannot be well designed, and the memory management and the like cannot be carried out. Because these characteristics are often provided at the programming language level, simulink graphical model building is at a higher application level and does not support such characteristics of the underlying programming language. In the actual algorithm design, the design of the data structure and the memory management are very important parts, and the execution efficiency and the space occupation of the whole algorithm are concerned. The algorithm is built based on the graphics primitives, so that the process of realizing the complex algorithm is relatively complicated. On the other hand, the Simulink engineering can only be used in Matlab, the algorithm design is based on a unique programming language, while the mainstream embedded device is mostly programmed by using C language, and in order to convert the verified algorithm into the embedded C code, the designer needs to write the code again according to the implementation thought, which leads to the fact that the code writing work needs to be performed again from the simulation of the algorithm to the actual application, and the workload and the time cost are undoubtedly increased.
Therefore, in the design and verification work of the servo driver motor control algorithm, the simulation algorithm built in some way cannot be directly used in an embedded mode, manual translation optimization is needed, namely two sets of algorithms based on different platforms and different languages are needed to be designed, and the workload and the time cost are increased.
Disclosure of Invention
The invention aims to overcome the problems in the prior art, and provides a system and a method for simulating a servo motor to simulate driver codes, which solve the problem that a driver control algorithm needs to be rewritten from simulation to actual use, so that simulation codes can be installed in a driver to run with minimum change, thereby reducing the workload and time cost.
In order to achieve the above object, a first aspect of the present invention provides a system for simulating a servo motor to perform driver code simulation, including a visualization system, an embedded algorithm system, and an algorithm simulation system;
the visualization system; setting simulation algorithm parameters and an embedded algorithm module used for simulation by applying Qt C + + programming desktop application, and displaying a simulation result;
the embedded algorithm system comprises the following steps: programming by using the C code, and storing the embedded algorithm module data;
the algorithm simulation system comprises: and C + + code programming is applied to realize the resolving of the simulation algorithm and the simulation flow control through the information interaction with the visual system and the embedded algorithm system, and the simulation algorithm comprises a virtual motor module and a solver module.
Preferably, the embedded algorithm module comprises a curve planning module, a position loop module, a speed loop module, a current loop module, a weak magnetic module and an SVPWM module.
Preferably, the information interaction between the algorithm simulation system and the visualization system is specifically as follows:
the algorithm simulation system reads the algorithm parameters set by the visual system and the embedded algorithm module for simulation, and
and the algorithm simulation system feeds back the simulation calculation result to the visualization system for display.
Preferably, the information interaction between the algorithm simulation system and the embedded algorithm system specifically includes:
in the simulation initialization stage, the algorithm simulation system copies the embedded algorithm module data used by the simulation from the embedded algorithm system, and establishes the dependency relationship among the embedded algorithm module data used by each simulation.
Preferably, the solver module: the embedded algorithm module is used for resolving the embedded algorithm module used by the simulation according to the dependency relationship, and a resolving result is used as input data of the virtual motor module;
the virtual motor module: the algorithm simulation system is used for simulating a real motor driving scene and carrying out simulation calculation by the algorithm simulation system.
Preferably, the virtual motor module formula is as follows:
wherein u is d Represents the direct axis voltage; u. of q Represents quadrature axis voltage; i.e. i d Represents the direct axis current; r represents a stator resistance; i.e. i q Represents quadrature axis current; l is d Represents a direct axis inductance; l is q Representing quadrature axis inductance; omega e Representing the electrical angular velocity of the motor; omega m Representing the mechanical angular velocity of the motor; p is a radical of n Representing the number of pole pairs of the motor; b represents a damping coefficient; t is a unit of e Represents an electromagnetic torque; t is L Representing the load torque; Ψ f Represents a permanent magnet flux linkage; j represents moment of inertia; t represents time.
Preferably, the simulation flow includes the following steps:
s1, generating a calculation task according to the setting of a visualization system, copying an embedded algorithm module used for simulation from an embedded algorithm system in an initialization process, and forming a temporary copy for the calculation task;
s2, establishing a dependency relationship among embedded algorithm modules used by each simulation, and performing calculation according to the dependency relationship;
s3, inputting the calculated result into the virtual motor module for simulation operation to obtain relevant physical parameters of the motor;
s4, feeding back all the simulation data to a visualization system for display;
and S5, increasing the simulation step length to perform iterative operation, judging whether the set simulation finishing time is reached, finishing the simulation process after the set simulation finishing time is reached, and returning to the step S2 to continue the iterative operation if the set simulation finishing time is not reached.
The second aspect of the present invention provides a method for simulating a servo motor to perform driver code simulation, which comprises the following steps:
the visual system sets simulation algorithm parameters and an embedded algorithm module used for simulation;
the algorithm simulation system generates a calculation task according to the setting of the visualization system, and copies an embedded algorithm module used for simulation from the embedded algorithm system in the initialization process to form a temporary copy for the calculation task;
the algorithm simulation system establishes a dependency relationship among embedded algorithm modules used by each simulation, performs calculation according to the dependency relationship, and inputs the calculated result into the virtual motor module to perform simulation operation to obtain relevant physical parameters of the motor;
and the algorithm simulation system increases the simulation step length to carry out iterative operation, judges whether the set simulation ending time is reached, ends the simulation process after the set simulation ending time is reached, and returns to the previous step to continue the iterative operation.
Preferably, the method further comprises the steps of counting all simulation data, writing the data into a corresponding memory and feeding the data back to the visualization system for display.
Preferably, the iterative operation method includes a fixed-step euler method with higher efficiency and higher error, a fixed-step fourth-order Runge Kutta method with medium efficiency and medium error, and a variable-step fifth-order Runge Kutta method with lower efficiency and lower error.
According to the technical scheme, the motor is coded on the basis of a mathematical model of the motor, a simulation object of the motor is built, the whole system framework is developed on the basis of C + +, due to the good compatibility of C + + to C language, the C + + and the C language can be mixed and programmed, the embedded algorithm system part can be written in a mode similar to a servo driver real-mounted code, and the simulated code can be transplanted to an embedded chip of the servo driver in a small change, so that the repeated utilization rate of the code is increased, the secondary writing cost is reduced, and the working efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of a system for simulating a servo motor for driver code simulation according to the present invention;
FIG. 2 is a flow chart of a method for simulating a servo motor to perform driver code simulation according to the present invention;
FIG. 3 is a variation curve of the current operating point of the motor during the simulation process according to the embodiment of the present invention;
FIG. 4 is a plot of the planning velocity calculated by the curve planning module according to an embodiment of the present invention;
FIG. 5 is a velocity profile to which the final motor model of an embodiment of the present invention responds;
in the figure, 1, a visualization system; 2. an embedded algorithm system; 3. and (4) an algorithm simulation system.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a system for simulating a servo motor to simulate driver codes, which comprises a visualization system 1, an embedded algorithm system 2 and an algorithm simulation system 3, as shown in fig. 1;
the visualization system 1; setting simulation algorithm parameters and an embedded algorithm module used for simulation by applying Qt C + + programming desktop application, and displaying a simulation result;
the embedded algorithm system 2: programming by using the C code, and storing embedded algorithm module data;
the algorithm simulation system 3: and C + + code programming is applied to realize the resolving of the simulation algorithm and the simulation flow control through information interaction with the visual system 1 and the embedded algorithm system 2, and the simulation algorithm comprises a virtual motor module and a solver module.
The visualization system 1 is preferably a visualization UI, and the visualization UI includes a function interface module, a data chart module and a system setting module:
the functional interface module is used for displaying and comprises various calculation modules, including a calculation setting module, a drawing setting module, a curve planning module, a position loop module, a speed loop module, a current loop module, a weak magnetic module, an SVPWM module, an MTPA module and a PMSM module; the current loop module comprises a direct-axis current loop and a quadrature-axis current loop; and the calculation setting module is used for setting the type and parameters of the solver in the solver module, and comprises an initial step length, tolerance errors and the like.
The data chart module is used for drawing and displaying a chart according to the simulation result;
the system setting module is used for setting some non-core algorithm parameters and setting a software layer through a visual UI, and the setting comprises loading and saving of parameter files, starting and stopping of a simulation process and the like.
The motor simulation algorithm runs in a servo driver, is an embedded platform and does not have the functions of complex human-computer interaction and data visualization. Therefore, the algorithm simulation is usually executed in a computer, and through the powerful visualization interaction and the computing capability, the actual algorithm operating environment is simulated, and the algorithm computing process and related data are displayed, so that whether the design achieves the expectation is verified.
One role of the visualization UI is to perform presentation of simulation data. Because the algorithm simulation system is realized based on C + +, the Qt C + + programming is adopted in the aspect of visual UI design, and Qt is a C + + based application program development framework, so that the relevant data of the embedded algorithm can be conveniently interacted with a visual UI interface.
The visual UI has another function of conveniently controlling algorithm parameters, simulation processes and the like. Aiming at different embedded algorithm modules and virtual motor modules in the embedded algorithm system 2, respective control interfaces are respectively designed, and interface operation and module data are bound, so that a developer can quickly and conveniently adjust parameters of the algorithm modules or modify algorithm flows. Preferably, the visualization UI can be implemented in other frameworks besides Qt, such as MFC.
The embedded algorithm system 2 comprises an embedded algorithm module and data thereof. At present, a mainstream servo motor driving algorithm basically adopts a magnetic field orientation control algorithm, and generally, the servo motor driving algorithm mainly comprises the following six parts: the device comprises a curve planning module, a position loop module, a speed loop module, a current loop module, a weak magnetic module and an SVPWM (space vector pulse width modulation) module. By embedding the modules in the embedded algorithm system 2 framework, the algorithm designer can perform the simulation verification work of the algorithm only by adjusting the modules.
The algorithm simulation system 3 mainly comprises a virtual motor module and a solver module, and mainly realizes two functions: and the algorithm module solves and simulates the flow control.
The virtual motor module: the algorithm simulation system 3 is used for simulating a real motor driving scene and carrying out simulation calculation.
The motor simulation algorithm finally controls the input of the motor, namely three-phase power, and needs to construct a motor model to furthest restore the response of the physical motor in order to verify the feasibility and the performance of the algorithm on the premise of lacking the physical motor, so that the invention establishes a virtual motor module by using C + + codes based on the mathematical model of the motor and combining knowledge such as numerical solution of a differential equation and the like so as to complete the simulation work of the algorithm.
Taking a mathematical model of a three-phase permanent magnet synchronous motor as an example, a voltage equation of the motor is as follows:
electromagnetic torque equation of the motor:
mechanical equation of motion of the motor:
wherein the meaning of the individual physical quantities is as follows: u. of d Represents the direct axis voltage; u. of q Represents quadrature axis voltage; i all right angle d Represents the direct axis current; r represents a stator resistance; i.e. i q Represents the quadrature axis current; l is a radical of an alcohol d Represents a direct axis inductance; l is q Representing quadrature axis inductance; omega e Representing the electrical angular velocity of the motor; omega m Representing the mechanical angular velocity of the motor; p is a radical of n Representing the number of pole pairs of the motor; b represents a damping coefficient; t is a unit of e Represents an electromagnetic torque; t is L Representing the load torque; Ψ f Represents a permanent magnet flux linkage; j represents moment of inertia; t represents time.
The motor input is three-phase U abc Converted to the d-q coordinate system by Park transformation and Clark transformation to be u dq By combining the motor mathematical model, parameter data such as torque, rotating speed, current and the like of the motor under given voltage can be theoretically calculated. Because the motor mathematical model is a differential equation set, the equation needs to be discretized by using computer simulation, and the numerical solution of the differential equation set is carried out by adopting a small-step-length multi-calculation mode. Firstly, differential terms are moved to the left side of an equation, non-differential terms are moved to the right side of the equation, and the above equation system is simplified to obtain the model of the virtual motor:
and after the input and output division is carried out on the virtual motor module formula and the virtual motor module formula is converted into a code form, the input and output of the function are the input and output of the corresponding formula, and the execution content of the function is the operation carried out according to the formula. And finishing the establishment of the operation function of the motor model.
The solver module: and the embedded algorithm module is used for calculating the embedded algorithm module used by the simulation according to the dependency relationship, and the calculation result is used as the input data of the virtual motor module.
The whole set of algorithm simulation system 3 framework containing the virtual motor module designed by the invention is developed based on C + +, and because of the good compatibility of C + + to C language, the C + + and the C language can realize mixed programming, when a servo driver FOC (magnetic field orientation control) simulation algorithm is added into the algorithm simulation system framework for simulation, the embedded algorithm is generally based on C language, and the simulation operation framework of the algorithm is based on C + + language. Therefore, part of the motor simulation algorithm can be written in a mode of approximating a servo driver real-mounted code, which means that the code simulated by the method can be transplanted into an embedded chip of the servo driver with small change, thereby increasing the repeated utilization rate of the code, reducing the cost of secondary writing and improving the working efficiency.
In addition, simulink carries out the construction of an algorithm model based on visual primitives, which brings great limitation, and most obviously, the data structure cannot be well designed, and the memory management cannot be carried out. Because these characteristics are often provided at the programming language level, simulink graphical model building is at a higher application level and does not support such characteristics of the underlying programming language. In the actual algorithm design, the design of the data structure and the memory management are very important parts, and the execution efficiency and the space occupation of the whole algorithm are concerned. The invention provides a framework for realizing and simulating the algorithm by using C or C + +, and can highly master the details of the implementation of the algorithm based on the characteristics of the bottom layer language.
An example of C + + and C language hybrid programming is given below:
taking the curve planning module as an example here, assume that the header file of the module is "curveplan.h", and the implementation file is "curveplan.c". The calling of the module by the framework of the algorithm simulation system 3 only needs to include the content in the 'CurvePlan.h' by using the extern 'C' { }. After adding an extern "C", it is equivalent to telling the C + + compiler that all statements or definitions that are modified using the link specification should be handled in the C language.
Further preferably, the simulation flow includes the following steps:
s1, firstly, a user sets an embedded algorithm module and simulation parameters for simulation through a visual UI. After the simulation is started, generating a calculation task according to the setting of the visual UI, copying an embedded algorithm module used for the simulation from the embedded algorithm system 2 in the initialization process, and forming a temporary copy for the calculation task; the copy is used for ensuring that the parameter change in the calculation process does not pollute the parameters in the original embedded algorithm module;
s2, the algorithm simulation system 3 establishes a dependency relationship among embedded algorithm modules used by each simulation, so that modules depending on parameters of other modules can normally run, and the algorithm simulation system 3 performs calculation according to the dependency relationship, such as calculating all module outputs from curve planning to SVPWM in sequence;
s3, inputting the calculated result (such as given voltage) into the virtual motor module to perform simulation operation of the motor model to obtain relevant physical parameters of the motor, wherein the relevant physical parameters comprise voltage, current, electrical angular velocity of the motor and the like;
s4, counting all simulation data in the steps S1-S3, writing the data into a corresponding memory and feeding the data back to a visual UI interface for displaying; before the step is executed, data needing to be counted and displayed needs to be set on a visual UI interface;
and S5, increasing the simulation step length to carry out iterative operation, judging whether the set simulation finishing time is reached, finishing the simulation process after the set simulation finishing time is reached, and returning to the step S2 to continue the iterative operation.
The whole simulation process is iterated step by step on the basis of the step length, and each iterative process solver can solve each algorithm module to obtain the algorithm module output at the current iterative moment. Different solving methods differ in computational efficiency and accuracy. The invention designs three iterative solution methods, namely a fixed-step Euler method with higher efficiency and higher error, a fixed-step four-order Runge Kutta method with medium efficiency and medium error and a variable-step five-order Runge Kutta method with lower efficiency and lower error. The user can select a proper resolving method according to the characteristics and requirements of the algorithm. Preferably, the iterative solution method may be various, such as Bogacki-Shampine, adams, heun, etc.
Because the motor vector control algorithm comprises a plurality of embedded algorithm modules, the embedded algorithm modules have mutual dependency relationship and a sequential execution sequence. In order to avoid influencing the original data in each module, the computing task carries out embedded algorithm modules and data copying thereof during initialization to form copies of the embedded algorithm modules used for simulation, then establishes the dependency relationship among the embedded algorithm modules used for simulation, and finally carries out calculation in sequence according to the execution sequence of the embedded algorithm modules used for simulation.
As shown in FIG. 3, FIG. 3 is a variation curve of the current operating point of the motor in the simulation process, and the horizontal axis represents the direct-axis current i d Unit ampere (A), vertical axis is quadrature axis current i q In ampere (A), the algorithm simulation system 3 reads algorithm parameters set by the visual UI and an embedded algorithm module used for simulation, corresponding simulation operation is carried out, a simulation calculation result is fed back to the visual UI, the data chart module is used for drawing a chart according to the simulation result to be displayed, and the current change condition under the limitation of voltage, current, rotating speed and torque can be analyzed according to a displayed curve chart. The data chart module shows the projected speed calculated by the curve planning module (as shown in figure 4) and the speed to which the final motor model responds (as shown in figure 5). The effect of the motor simulation algorithm can be analyzed by comparing the planning curve with the actual response curve. For example, if the response curve is completely matched with the planning curve, the algorithm is proved to have good control effect; if the motor response is divergent, the algorithm is proved to have defects, and the motor cannot achieve the expected operation effect.
The system provided by the invention is used for realizing the code implementation of the motor model on the basis of the mathematical model of the alternating current permanent magnet synchronous motor and building a simulation object of the motor. And (3) building an algorithm simulation system 3 framework by using a C + + language. A set of visual UI interfaces is designed based on Qt software and used for setting system parameters and displaying simulation data. Based on the system for simulating the servo motor to simulate the driver codes, an algorithm designer can verify and simulate the control algorithm of the servo driver without depending on a physical motor. Meanwhile, the complete set of algorithm simulation system 3 framework realized by the invention is based on the C + + language, and the C + + language is used as the superset of the C language, so that the compatibility of the C language from the source code level can be ensured by using correct interactive operation, the verified algorithm has good portability, and can be written into a servo driver for physical drive test only by changing a little.
The second aspect of the present invention provides a method for simulating a servo motor to perform driver code simulation, and the implementation of the method is a system for performing driver code simulation based on the above simulated servo motor, as shown in fig. 2, including the following steps:
the visualization system 1 sets simulation algorithm parameters and an embedded algorithm module used for simulation;
the algorithm simulation system 3 generates a calculation task according to the setting of the visualization system 1, and copies an embedded algorithm module used for simulation from the embedded algorithm system 2 in the initialization process to form a temporary copy for the calculation task;
the algorithm simulation system 3 establishes a dependency relationship among embedded algorithm modules used by each simulation, performs calculation according to the dependency relationship, and inputs the calculated result into the virtual motor module for simulation operation to obtain related physical parameters of the motor;
counting all simulation data, writing the data into a corresponding memory and feeding the data back to the visualization system 1 for display;
the algorithm simulation system 3 increases the simulation step length to carry out iterative operation, judges whether the set simulation ending time is reached, ends the simulation process after the set simulation ending time is reached, and returns to the previous step to continue the iterative operation; the iterative operation method comprises a fixed-step Euler method with high efficiency and high error, a fixed-step four-order Runge Kutta method with medium efficiency and medium error, and a variable-step five-order Runge Kutta method with low efficiency and low error.
In conclusion, the traditional third-party simulation software is abandoned, and the purpose of motor simulation algorithm simulation is realized by directly using C + + and C mixed programming through the scheme of the invention, so that the secondary programming process from algorithm simulation to actual installation is simplified, and the working efficiency is improved. A user needs to use C or C + + language when building a simulation model, and embedded programming generally adopts C or C + + language, which means that compared with a Simulink primitive model building mode, the simulation algorithm has better portability and can be applied to an actual driver after a small amount of change. A simulation model of an actual physical motor is constructed by utilizing a mathematical model of the alternating current permanent magnet synchronous motor and combining a differential equation solving method. A plurality of iterative solution methods are provided, so that a user can control the efficiency and accuracy of algorithm simulation according to requirements. The visual UI is provided, the algorithm module data and the virtual motor module data can be modified conveniently, the simulation result is displayed, and evaluation and analysis of the design indexes of the algorithm are facilitated.
The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited thereto. Within the scope of the technical idea of the invention, numerous simple modifications can be made to the technical solution of the invention, including combinations of the individual specific technical features in any suitable way. The invention is not described in detail in order to avoid unnecessary repetition. Such simple modifications and combinations should be considered within the scope of the present disclosure as well.
Claims (10)
1. A system for simulating a servo motor to simulate driver codes is characterized by comprising a visualization system (1), an embedded algorithm system (2) and an algorithm simulation system (3);
the visualization system (1); setting simulation algorithm parameters and an embedded algorithm module used for simulation by applying Qt C + + programming desktop application, and displaying a simulation result;
the embedded algorithm system (2): programming by using the C code, and storing the embedded algorithm module data;
the algorithm simulation system (3): c + + code programming is applied to realize the resolving of the simulation algorithm and the control of the simulation flow by information interaction with the visual system (1) and the embedded algorithm system (2), and the simulation algorithm comprises a virtual motor module and a resolver module.
2. The system of claim 1, wherein the embedded algorithm modules comprise a curve planning module, a position loop module, a speed loop module, a current loop module, a flux weakening module, and an SVPWM module.
3. The system according to claim 1, characterized in that the information interaction of the algorithm simulation system (3) and the visualization system (1) is specifically:
the algorithm simulation system (3) reads the algorithm parameters set by the visualization system (1) and the embedded algorithm module used for simulation, and
and the algorithm simulation system (3) feeds back the simulation calculation result to the visualization system (1) for display.
4. The system according to claim 3, wherein the information interaction between the algorithm simulation system (3) and the embedded algorithm system (2) is specifically:
in the simulation initialization stage, the algorithm simulation system (3) copies the embedded algorithm module data used by the simulation from the embedded algorithm system (2), and establishes the dependency relationship among the embedded algorithm module data used by each simulation.
5. The system of claim 4,
the solver module: the embedded algorithm module is used for resolving the embedded algorithm module used by the simulation according to the dependency relationship, and a resolving result is used as input data of the virtual motor module;
the virtual motor module: the algorithm simulation system (3) is used for simulating a real motor driving scene and carrying out simulation calculation.
6. The system of any of claims 1-5, wherein the virtual machine module formula is as follows:
wherein u is d Represents the direct axis voltage; u. of q Represents quadrature axis voltage; i.e. i d Represents the direct axis current; r represents a stator resistance; i all right angle q Represents quadrature axis current; l is a radical of an alcohol d To representA direct axis inductor; l is q Representing quadrature axis inductance; omega e Representing the electrical angular velocity of the motor; omega m Representing the mechanical angular velocity of the motor; p is a radical of formula n Representing the number of pole pairs of the motor; b represents a damping coefficient; t is e Represents an electromagnetic torque; t is L Representing the load torque; psi f Represents a permanent magnet flux linkage; j represents moment of inertia; t represents time.
7. The system of claim 6, wherein the simulation process comprises the steps of:
s1, generating a calculation task according to the setting of a visualization system (1), copying an embedded algorithm module used for simulation from an embedded algorithm system (2) in an initialization process, and forming a temporary copy for the calculation task;
s2, establishing a dependency relationship among embedded algorithm modules used by each simulation, and performing calculation according to the dependency relationship;
s3, inputting the solved result into the virtual motor module for simulation operation to obtain relevant physical parameters of the motor;
s4, feeding back all simulation data to the visualization system (1) for display;
and S5, increasing the simulation step length to carry out iterative operation, judging whether the set simulation finishing time is reached, finishing the simulation process after the set simulation finishing time is reached, and returning to the step S2 to continue the iterative operation.
8. A method for simulating a servo motor to perform driver code simulation is characterized by comprising the following steps:
the visualization system (1) sets simulation algorithm parameters and an embedded algorithm module used for simulation;
the algorithm simulation system (3) generates a calculation task according to the setting of the visualization system (1), and an embedded algorithm module used for simulation is copied from the embedded algorithm system (2) in the initialization process to form a temporary copy for the calculation task;
the algorithm simulation system (3) establishes a dependency relationship among embedded algorithm modules used for each simulation, carries out calculation according to the dependency relationship, and inputs the calculated result into the virtual motor module for simulation operation to obtain related physical parameters of the motor;
and the algorithm simulation system (3) increases the simulation step length to carry out iterative operation, judges whether the set simulation ending time is reached, ends the simulation process after the set simulation ending time is reached, and returns to the previous step to continue the iterative operation.
9. The method according to claim 8, further comprising counting all simulation data, writing the data into a corresponding memory and feeding the data back to the visualization system (1) for display.
10. The method according to claim 8 or 9, wherein the iterative operation method comprises a fixed-step euler method with higher efficiency and higher error, a fixed-step fourth-order Runge Kutta method with medium efficiency and medium error, and a variable-step fifth-order Runge Kutta method with lower efficiency and lower error.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211620655.XA CN115618659A (en) | 2022-12-16 | 2022-12-16 | System and method for simulating driver code by simulating servo motor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211620655.XA CN115618659A (en) | 2022-12-16 | 2022-12-16 | System and method for simulating driver code by simulating servo motor |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115618659A true CN115618659A (en) | 2023-01-17 |
Family
ID=84880660
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211620655.XA Pending CN115618659A (en) | 2022-12-16 | 2022-12-16 | System and method for simulating driver code by simulating servo motor |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115618659A (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112036023A (en) * | 2020-08-26 | 2020-12-04 | 南京国电南自维美德自动化有限公司 | Software integrated generation system for generator transformer bank protection device |
-
2022
- 2022-12-16 CN CN202211620655.XA patent/CN115618659A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112036023A (en) * | 2020-08-26 | 2020-12-04 | 南京国电南自维美德自动化有限公司 | Software integrated generation system for generator transformer bank protection device |
Non-Patent Citations (1)
Title |
---|
安健: "永磁同步电机参数辨识与自整定算法的半实物仿真平台研究" * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7865350B1 (en) | Partitioning a model in modeling environments | |
CN102650966B (en) | A kind of embedded software test method of Reuse-Oriented and test macro thereof | |
US20120197617A1 (en) | Co-Simulation with Peer Negotiated Time Steps | |
CN104391791A (en) | Method and device for testing embedded control algorithm | |
CN109493430A (en) | A kind of nuclear power main control room Virtual design system and method | |
CN104375421A (en) | Aircraft engine part modeling method based on control system development platform | |
CN102012673A (en) | Design method of complex reaction type system controller | |
Kumar et al. | Unified meta-modeling framework using bond graph grammars for conceptual modeling | |
KR19990057840A (en) | Chip verification method by comparing internal state trajectories | |
CN111159951A (en) | ABAQUS finite element and boundary element-based coupling method | |
Shen et al. | Full system simulation with QEMU: An approach to multi-view 3D GPU design | |
CN107832485A (en) | A kind of optimization method of simulation model control parameter | |
CN115618659A (en) | System and method for simulating driver code by simulating servo motor | |
CN101609614A (en) | A kind of emulation platform of semi-matter simulating system reaches the method for goal systems being carried out online accent ginseng | |
US7246056B1 (en) | Runtime parameter mapping for system simulation | |
Saadawi et al. | Verification of real-time DEVS models | |
CN114019824B (en) | Modelica-based planet car movement process simulation system and construction method | |
CN113885426A (en) | Automatic generation method, test method and visual test system for PLC (programmable logic controller) codes of excavator control program | |
CN109101424A (en) | A kind of method and device for realizing data stimuli | |
CN100361074C (en) | Visualized three-dimensional graphic control programming method | |
SHARAH et al. | Streamlining the Modelling to Virtual Reality Process | |
CN201607733U (en) | xPC-based real-time simulation equipment for hydroelectric generating set | |
CN111258573A (en) | Automatic code generation method and device for phase-shift PWM algorithm based on model design | |
Jewell | Embedded reachability for autonomous racecar | |
Bormanis | Development of energy consumption model for virtual commissioning software |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |