Algorithm synchronization method of motor control rapid prototyping platform and verification method thereof
By using the EtherCAT protocol and interrupt triggering mechanism to achieve clock synchronization between the target machine and the algorithm application platform, the algorithm synchronization problem of the rapid prototyping platform for motor control is solved, development costs are reduced, and the timing consistency between simulation and actual application is ensured. It also supports high data refresh rate and hardware circuit interference simulation.
Patent Information
- Application Number
- CN202310741450.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2043-06-21
AI Technical Summary
Traditional rapid prototyping platforms for motor control suffer from high costs due to expensive I/O boards, inability to simulate the effects of real hardware circuits, difficulties in algorithm synchronization, and issues with real-time communication and execution timing. This results in high development costs and inconsistencies between algorithm simulation and actual application timing.
The EtherCAT protocol is used to achieve clock synchronization between the target machine and the algorithm application platform. By alternating the triggering of timer interrupts and synchronization management interrupts, combined with pulse width modulation counters and timer interrupt counters, the consistency of the algorithm execution cycle is ensured, and real-time data refresh is achieved through EtherCAT communication frequency adjustment.
It reduces the development cost of motor control algorithms, ensures the timing consistency between algorithm simulation and actual application, supports high data refresh rate and hardware circuit interference simulation, and improves the efficiency of algorithm optimization and upgrade.
Smart Images

Figure CN116755353B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of motor control technology. Background Technology
[0002] In recent years, rapid prototyping technology for motor control has been widely applied in the field of motor control algorithm development due to its advantages of high efficiency and short iteration cycles. Traditional rapid prototyping platforms for motor control typically consist of a host machine, a target machine, PCI-based I / O boards, input / output auxiliary circuits (such as sampling circuits and power converters), and the controlled motor. However, I / O boards and commercial rapid prototyping platforms such as dSPACE and RT-LAB are expensive, increasing the cost of motor control algorithm development. Furthermore, traditional platforms rely on I / O boards for signal acquisition and analog / digital signal generation during rapid prototyping, failing to simulate the impact of real-world application platform hardware circuitry on control. Therefore, replacing I / O boards and input / output auxiliary circuits with the application platform for which the control algorithm is to be developed (such as a general-purpose frequency converter) to form a new, low-cost rapid prototyping platform is a feasible solution. However, due to the specific characteristics of motor control algorithms, rapid prototyping platforms consisting of a host machine, a target machine, an algorithm application platform, and the controlled motor require careful attention to the algorithm synchronization issue between the target machine and the algorithm application platform.
[0003] During the simulation and verification of the control algorithm, the algorithm to be developed runs on the target machine, and signal acquisition and analog / digital signal generation are implemented by the algorithm application platform; however, after the control algorithm is deployed to the actual application platform, all tasks are implemented by the controller. To ensure that the algorithm execution timing is exactly the same in both the simulation verification and the actual application, the following issues need to be addressed:
[0004] (1) Clock synchronization problem
[0005] The target machine and the algorithm application platform obtain clock signals through different clock circuits. However, due to slight differences in materials or the influence of ambient temperature, these clock circuits will inevitably have different operating frequencies. Therefore, algorithm synchronization must first address the clock synchronization issue between the target machine and the application platform to ensure that the algorithm execution cycles in both hardware components are completely consistent.
[0006] (2) Communication real-time issues
[0007] During the simulation and verification of the control algorithm, the sampled signal from the algorithm application platform is first uploaded to the target machine, then processed by the target machine to obtain the signal to be output. Finally, the target machine sends the signal to be output back to the algorithm application platform. That is, two data communications need to be completed within one control cycle. Depending on the power level of the application platform, the operating frequency of the motor control algorithm is typically between 2kHz and 10kHz. Therefore, the communication frequency between the target machine and the algorithm application platform needs to be adjustable within the frequency range of 4kHz to 20kHz. This places high demands on the real-time performance and data refresh rate of the communication method between the target machine and the algorithm application platform.
[0008] (3) Algorithm execution timing problem
[0009] In each control cycle, the motor control algorithm needs to sequentially complete the main tasks such as analog / digital signal acquisition and conversion, output calculation, and analog / digital signal output. Therefore, while ensuring that the algorithm execution cycles are completely consistent, it is also necessary to adjust the relative positions of the execution time periods of each algorithm to ensure the correct execution order of each motor control algorithm.
[0010] In summary, in order to meet the algorithm development requirements of the rapid prototyping platform for motor control, a suitable communication method and corresponding working mode are needed to achieve algorithm synchronization between the target machine and the algorithm application platform. Summary of the Invention
[0011] This invention aims to achieve algorithm synchronization between the target machine and the algorithm application platform during motor control. It provides an algorithm synchronization method and verification method for a rapid prototyping platform for motor control.
[0012] A method for synchronizing algorithms in a rapid prototyping platform for motor control, the rapid prototyping platform for motor control includes a host machine, a target machine, and an algorithm application platform. The host machine is used to generate control algorithms and load them into the target machine. The target machine is used to run the control algorithms and generate control signals based on real-time operating status data. The algorithm application platform is used to control the controlled motor using the control signals. The real-time operating status data includes the three-phase current and rotor angle position of the controlled motor, as well as the input and output status of the controller inside the algorithm application platform. The control signals include a first control signal and a second control signal.
[0013] The target machine and the algorithm application platform communicate via the EtherCAT protocol. The EtherCAT protocol is a DC (distributed clock) synchronization mode, and the communication frequency is 2f, where f is the control frequency of the control algorithm. The algorithm application platform is configured with a pulse width modulation counter and a timer interrupt counter. The counting period of the pulse width modulation counter is 1 / f, and the counting period of the timer interrupt counter is 1 / 2f.
[0014] The algorithm synchronization method is as follows:
[0015] A timer interrupt is triggered at each 1-match time of the timer interrupt counter. The timer interrupt includes an alternately triggered first timer interrupt PIT1 and second timer interrupt PIT2. A synchronization management interrupt is triggered at the end time of each EtherCAT communication. The synchronization management interrupt includes an alternately triggered first synchronization management interrupt SM1 and second synchronization management interrupt SM2. A first synchronization interrupt SYNC1 is triggered between the first timer interrupt PIT1 and the first synchronization management interrupt SM1, and a second synchronization interrupt SYNC2 is triggered between the second timer interrupt PIT2 and the second synchronization management interrupt SM2.
[0016] During the first timer interrupt PIT1, the algorithm application platform reads the input and output status of its internal controller and the rotor angle position of the controlled motor.
[0017] During the first synchronous interrupt SYNC1 process, the algorithm application platform reads the three-phase current of the controlled motor and updates the data in the application terminal EtherCAT transmission register with the read real-time operating status data;
[0018] During the first synchronization management interrupt SM1, the algorithm application platform reads the first control signal sent by the target machine;
[0019] During the second timer interrupt PIT2 process, the algorithm application platform updates the digital-to-analog conversion signal and input / output status of its internal controller according to the first control signal;
[0020] During the second synchronous interrupt SYNC2, the algorithm application platform updates the data in the application-side EtherCAT send register with the updated input / output status during the second timer interrupt PIT2.
[0021] During the second synchronization management interrupt SM2 process, the algorithm application platform reads the second control signal sent by the target machine and updates the comparison value of the pulse width modulation counter according to the second control signal;
[0022] Both the pulse width modulation counter and the timer interrupt counter begin counting at the moment the rising edge of the first synchronous interrupt SYNC1 arrives.
[0023] Furthermore, the control process of the aforementioned rapid prototyping platform for motor control is as follows:
[0024] The host machine generates the control algorithm and loads it into the target machine.
[0025] The algorithm application platform collects real-time operating status data and uses this data to update the data in the EtherCAT transmission register on the application side.
[0026] The data in the application's EtherCAT transmit register is uploaded to the target machine during EtherCAT communication.
[0027] The target machine executes a control algorithm based on the received real-time operating status data to obtain a control signal, and uses this control signal to update the data in the EtherCAT transmission register on the target machine side.
[0028] The data in the target machine's EtherCAT transmit register is sent to the algorithm application platform during EtherCAT communication.
[0029] The algorithm application platform updates the analog-to-digital conversion signal, the comparison value of the pulse width modulation counter, and the input / output instructions in its internal controller based on the received control signal, thereby controlling the controlled motor.
[0030] Furthermore, within a complete motor control cycle, the first timer interrupt PIT1 is triggered earlier than the second timer interrupt PIT2, and the first synchronization management interrupt SM1 is triggered earlier than the second synchronization management interrupt SM2.
[0031] Furthermore, the host machine is equipped with a Simulink simulation model, and the simulation step size of the Simulink simulation model is 1 / 2f.
[0032] The first verification method for the algorithm synchronization method of the aforementioned rapid prototyping platform for motor control is as follows:
[0033] Arbitrarily select three input / output ports of the algorithm application platform, and set the output signals of the three input / output ports to represent the execution status of timer interrupt, synchronization interrupt, and synchronization management interrupt, respectively. When any interrupt is being executed, the three input / output ports output a high-level signal; otherwise, the input / output ports output a low-level signal.
[0034] By observing the level status of the output signals of the three input / output ports with an oscilloscope, it is determined whether the output signal waveforms of the three input / output ports appear in the order of timer interrupt, synchronization management interrupt, and synchronization interrupt, and whether the execution time of each interrupt does not overlap. If so, the target machine and the algorithm application platform are synchronized; otherwise, they are not synchronized.
[0035] The second verification method for the algorithm synchronization method of the aforementioned rapid prototyping platform for motor control is as follows:
[0036] Under normal operation of the motor control algorithm, the flag SFlag is set to 1, 2, and 3 at the end of the synchronization management interrupt, timer interrupt, and synchronization interrupt, respectively. The verification method is as follows within a complete motor control cycle:
[0037] At the trigger time of the timer interrupt, check whether the flag bit SFlag is 1. If it is, the previous interrupt of the current timer interrupt is a synchronization management interrupt and the execution time of the current timer interrupt and the previous synchronization management interrupt do not overlap. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized.
[0038] At the moment the synchronization interrupt is triggered, check whether the flag bit SFlag is 2. If it is, the previous interrupt of the current synchronization interrupt is a timer interrupt and the current synchronization interrupt and the previous timer interrupt do not overlap in execution time. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized.
[0039] At the trigger time of the synchronization management interrupt, check whether the flag bit SFlag is 3. If it is, the previous interrupt of the current synchronization management interrupt is a synchronization interrupt and the running time of the current synchronization management interrupt and the previous synchronization interrupt do not overlap. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized.
[0040] Furthermore, in the two verification methods mentioned above, when the algorithm of the target machine and the algorithm application platform are not synchronized, the initial value of the timer interrupt counter at the start of counting is adjusted so that the triggering time of the timer interrupt is adjusted; at the same time, the EtherCAT communication time is adjusted so that the triggering time of the synchronization management interrupt is adjusted, and finally the algorithm of the target machine and the algorithm application platform is synchronized.
[0041] To meet the algorithm development requirements of a rapid prototyping platform for motor control, and to address the clock synchronization, real-time communication, and algorithm execution timing issues between the target machine and the algorithm application platform, this invention provides an algorithm synchronization method for a rapid prototyping platform for motor control based on the EtherCAT protocol. This method allows the algorithm application platform to be directly integrated into the rapid prototyping platform, thereby reducing the development cost of motor control algorithms. Furthermore, it incorporates the influence of hardware circuitry and environmental interference under actual operating conditions during algorithm development, which is beneficial for further algorithm optimization and upgrades. In addition, this invention uses the EtherCAT protocol as the communication protocol between the target machine and the inverter, enabling clock synchronization between them. Moreover, since the EtherCAT communication frequency can reach up to 20kHz, it can meet the high data refresh rate requirements of rapid prototyping of motor control algorithms with control frequencies up to 10kHz, thus ensuring that the algorithm execution timing is completely identical in simulation verification and actual application. Attached Figure Description
[0042] Figure 1 This is a structural diagram of a rapid prototyping platform for motor control.
[0043] Figure 2 A flowchart of the algorithm synchronization method for a rapid prototyping platform for motor control;
[0044] Figure 3 The signal timing diagram for the algorithm synchronization method of the rapid prototyping platform for motor control;
[0045] Figure 4 The simulation model structure diagram of the algorithm synchronization method for the rapid prototyping platform for motor control is shown.
[0046] Figure 5 This is a schematic diagram illustrating the principle of the verification method described in Specific Implementation Method 3. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0048] Specific implementation method one: Refer to Figures 1 to 4 This embodiment is described in detail. In this embodiment, the motor control rapid prototyping platform includes: a host machine, a target machine, and an algorithm application platform.
[0049] The host machine can be any desktop computer, laptop, or industrial computer pre-installed with MATLAB and host computer software and equipped with a network port. The host machine contains a Simulink simulation model with a simulation step size of 1 / 2f. Figure 4As shown, the Simulink simulation model consists of two parts: an EtherCAT master station and a motor control algorithm. EtherCAT includes an initialization module, a receiving module, and a transmitting module. The motor control algorithm includes coordinate transformation, speed loop, current loop, and SVPMW (Space Vector Pulse Width Modulation). The target machine is any desktop computer, laptop, or industrial PC with two network ports. One of the two network ports supports the EtherCAT protocol, and the other supports the TCP / IP protocol. The algorithm application platform is a motor controller of any power level with EtherCAT communication peripherals. The controlled motor can be any type and structure of motor, such as a DC motor, synchronous motor, or asynchronous motor. Data transmission and reception between the host and target machines are achieved via a network cable using the TCP / IP protocol. The motor control algorithm developed based on the model in MATLAB / Simulink is compiled into executable code using MATLAB's RTW tool and downloaded to the target machine. Data during code execution is uploaded to the host machine for real-time monitoring. The target machine communicates with the algorithm application platform via the EtherCAT protocol, which is in DC (Distributed Clock) synchronization mode.
[0050] The host machine is used to generate a control algorithm and load it into the target machine. The target machine is used to run the control algorithm and generate control signals based on real-time operating status data. The algorithm application platform is used to control the controlled motor using the control signals. The real-time operating status data includes the three-phase current and rotor angle position of the controlled motor, as well as the input and output status of the controller inside the algorithm application platform. The control signals include a first control signal and a second control signal.
[0051] The control process of the motor control rapid prototyping platform is as follows:
[0052] The host machine generates the control algorithm and loads it into the target machine.
[0053] The algorithm application platform collects real-time operating status data and uses this data to update the data in the EtherCAT transmission register on the application side.
[0054] The data in the application's EtherCAT transmit register is uploaded to the target machine during EtherCAT communication.
[0055] The target machine executes a control algorithm based on the received real-time operating status data to obtain a control signal, and uses this control signal to update the data in the EtherCAT transmission register on the target machine side.
[0056] The data in the target machine's EtherCAT transmit register is sent to the algorithm application platform during EtherCAT communication.
[0057] The algorithm application platform updates the analog-to-digital conversion signal, the comparison value of the pulse width modulation counter, and the input / output instructions in its internal controller based on the received control signal, thereby controlling the controlled motor.
[0058] In this embodiment, the algorithm synchronization method of the motor control rapid prototyping platform is as follows:
[0059] 1. Configure EtherCAT communication (Ethernet control automation technology)
[0060] The target machine is configured as the EtherCAT communication master, and the controller within the algorithm application platform is configured as the EtherCAT communication slave. Since the EtherCAT protocol uses DC synchronization mode, all device clocks are synchronized to the clock of the first EtherCAT slave with DC functionality, ensuring clock synchronization between the target machine and the algorithm application platform. The EtherCAT communication frequency is configured as 2f, where f is the control frequency of the control algorithm, and 2kHz. <f<10kHz。
[0061] 2. Configure the controller within the algorithm application platform.
[0062] Two counters are configured in the controller within the algorithm application platform: a pulse width modulation counter and a timer interrupt counter. For example... Figure 3 The period matching and 1 matching of the pulse width modulation counter shown are aligned with the 1 matching of the timer interrupt counter. The pulse width modulation counter is used to generate a pulse width modulated carrier signal, and its counting period is 1 / f. The timer interrupt counter is used to generate a timer interrupt, and its counting period is 1 / 2f.
[0063] To ensure that the execution timing of the motor control algorithm is exactly the same on the rapid prototyping platform and when it runs independently on the algorithm application platform, the different stages of the algorithm execution need to be allocated to different interrupts on the target machine and the algorithm application platform for execution.
[0064] Combination Figure 3 The algorithm / program executed by the controller in different interrupts is as follows:
[0065] During the first timer interrupt PIT1, the algorithm application platform reads the input and output status of its internal controller and the rotor angle position of the controlled motor.
[0066] During the first synchronous interrupt SYNC1 process, the algorithm application platform reads the three-phase current of the controlled motor and updates the data in the application terminal EtherCAT transmission register with the read real-time operating status data;
[0067] During the first synchronization management interrupt SM1, the algorithm application platform reads the first control signal sent by the target machine;
[0068] During the second timer interrupt PIT2 process, the algorithm application platform updates the digital-to-analog conversion signal and input / output status of its internal controller according to the first control signal;
[0069] During the second synchronous interrupt SYNC2, the algorithm application platform updates the data in the application-side EtherCAT send register with the updated input / output status during the second timer interrupt PIT2.
[0070] During the second synchronization management interrupt SM2 process, the algorithm application platform reads the second control signal sent by the target machine and updates the comparison value of the pulse width modulation counter according to the second control signal.
[0071] 3. Configure the counter
[0072] A timer interrupt is triggered at each 1-match of the timer interrupt counter. The timer interrupt includes a first timer interrupt PIT1 and a second timer interrupt PIT2 that are triggered alternately.
[0073] A synchronization management interrupt is triggered at the end of each EtherCAT communication. The synchronization management interrupt includes a first synchronization management interrupt SM1 and a second synchronization management interrupt SM2 that are triggered alternately.
[0074] The first synchronization interrupt SYNC1 is triggered between the first timer interrupt PIT1 and the first synchronization management interrupt SM1, and the second synchronization interrupt SYNC2 is triggered between the second timer interrupt PIT2 and the second synchronization management interrupt SM2.
[0075] Both the pulse width modulation counter and the timer interrupt counter begin counting at the rising edge of the first synchronization interrupt SYNC1. Within a complete motor control cycle, the first timer interrupt PIT1 is triggered before the second timer interrupt PIT2, and the first synchronization management interrupt SM1 is triggered before the second synchronization management interrupt SM2.
[0076] In each communication cycle, it is necessary to ensure that the timer interrupt, synchronization interrupt, and synchronization management interrupt occur in sequence to guarantee the correct timing of algorithm execution. Assuming the target machine and the algorithm application platform are clock-synchronized, the three interrupts have the same frequency, and the synchronization interrupt and synchronization management interrupt related to EtherCAT have a definite time sequence. Therefore, the interrupt triggering order can be adjusted by changing the trigger time of the timer interrupt. In this embodiment, two counters are configured with trigger modes. Counting is enabled by the synchronization interrupt trigger signal, and both counters start counting simultaneously when the synchronization interrupt arrives. Then, the initial value of the timer interrupt counter is adjusted so that the timer interrupt is triggered between the synchronization management interrupt and the synchronization interrupt.
[0077] In this embodiment, since the Simulink simulation model has a simulation step size of 1 / 2f, the motor control algorithm is executed only within one cycle. Combined with... Figure 4 The motor control algorithm model is triggered to run by the rising edge of the SimFlag signal. Combined with... Figure 3 SimFlag has two states, 0 and 1. The toggle between these states is triggered by EtherCAT communication frames, meaning a toggle occurs at the beginning of each Simulink simulation cycle. To ensure that the SimFlag toggle from 1 to 0 occurs during the upward counting phase of counter 1, and the SimFlag to reverse from 0 to 1 occurs during the downward counting phase of counter 1, this can be determined by reading the data received from EtherCAT. If the current data frame contains I / O status data, the SimFlag toggle from 1 to 0 is executed; otherwise, a toggle from 0 to 1 is executed.
[0078] Specific Implementation Method Two: Verification Method for the Algorithm Synchronization Method of the Motor Control Rapid Prototyping Platform described in this Implementation Method.
[0079] Arbitrarily select three input / output ports of the algorithm application platform, and set the output signals of the three input / output ports to represent the execution status of timer interrupt, synchronization interrupt, and synchronization management interrupt, respectively. When any interrupt is being executed, the three input / output ports output a high-level signal; otherwise, the input / output ports output a low-level signal.
[0080] By observing the level status of the output signals of the three input / output ports with an oscilloscope, it is determined whether the output signal waveforms of the three input / output ports appear in the order of timer interrupt, synchronization management interrupt, and synchronization interrupt, and whether the execution time of each interrupt does not overlap. If so, the target machine and the algorithm application platform are synchronized; otherwise, they are not synchronized.
[0081] When the target machine and the algorithm application platform are not synchronized, the initial value of the timer interrupt counter is adjusted at the start of counting, so that the triggering time of the timer interrupt is adjusted; at the same time, the EtherCAT communication time is adjusted, so that the triggering time of the synchronization management interrupt is adjusted, and finally the algorithm synchronization between the target machine and the algorithm application platform is achieved.
[0082] Specific Implementation Method Three: Refer to Figure 5 This embodiment specifically describes the verification method for the algorithm synchronization method of the rapid prototyping platform for motor control. In this embodiment, under the normal operating state of the motor control algorithm, the flag bit SFlag is set to 1, 2, and 3 at the end times of synchronization management interrupt, timer interrupt, and synchronization interrupt, respectively. The verification method is as follows within a complete motor control cycle:
[0083] At the trigger time of the timer interrupt, check if the flag bit SFlag is 1. If it is, the previous interrupt of the current timer interrupt was a synchronization management interrupt, and the execution time of the current timer interrupt and the previous synchronization management interrupt do not overlap. Otherwise, it means that the synchronization management interrupt failed to trigger normally. Alternatively, since the current timer interrupt has a higher priority than the synchronization management interrupt, the current timer interrupt interrupts the execution of the synchronization management interrupt. In this case, it cannot be guaranteed that the data obtained in the current timer interrupt is the latest data sent by the target machine. Therefore, the algorithm of the target machine and the algorithm application platform are not synchronized.
[0084] Similarly, at the trigger time of the synchronization interrupt, check whether the flag bit SFlag is 2. If it is, the previous interrupt of the current synchronization interrupt is a timer interrupt and the current synchronization interrupt and the previous timer interrupt do not overlap in execution time. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized.
[0085] At the trigger time of the synchronization management interrupt, check whether the flag bit SFlag is 3. If it is, the previous interrupt of the current synchronization management interrupt is a synchronization interrupt and the running time of the current synchronization management interrupt and the previous synchronization interrupt do not overlap. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized.
[0086] When the target machine and the algorithm application platform are not synchronized, the initial value of the timer interrupt counter is adjusted at the start of counting, so that the triggering time of the timer interrupt is adjusted; at the same time, the EtherCAT communication time is adjusted, so that the triggering time of the synchronization management interrupt is adjusted, and finally the algorithm synchronization between the target machine and the algorithm application platform is achieved.
[0087] When an algorithm synchronization failure is detected, an error warning can be issued via a status light or a buzzer.
[0088] While the invention has been described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the invention. Therefore, it should be understood that many modifications can be made to the exemplary embodiments, and other arrangements can be designed without departing from the spirit and scope of the invention as defined by the appended claims. It should be understood that different dependent claims and features described herein can be combined in ways different from those described in the original claims. It is also understood that features described in conjunction with individual embodiments can be used in other described embodiments.
Claims
1. An algorithm synchronization method for a rapid prototyping platform for motor control, wherein the rapid prototyping platform for motor control includes a host machine, a target machine, and an algorithm application platform, wherein the host machine is used to generate a control algorithm and load it into the target machine, the target machine is used to run the control algorithm and generate control signals based on real-time operating status data, and the algorithm application platform is used to control the controlled motor using the control signals, wherein the real-time operating status data includes the three-phase current and rotor angle position of the controlled motor, as well as the input and output status of the controller inside the algorithm application platform, and the control signals include a first control signal and a second control signal; Its features are, The target machine and the algorithm application platform communicate via the EtherCAT protocol, which is a distributed clock synchronization mode, and the communication frequency is [missing information]. ,in To control the algorithm's control frequency, a pulse width modulation (PWM) counter and a timer interrupt counter are configured in the algorithm application platform. The counting period of the PWM counter is... The counting period of the timer interrupt counter is ; The algorithm synchronization method is as follows: A timer interrupt is triggered at each 1-match time of the timer interrupt counter. The timer interrupt includes an alternately triggered first timer interrupt PIT1 and second timer interrupt PIT2. A synchronization management interrupt is triggered at the end time of each EtherCAT communication. The synchronization management interrupt includes an alternately triggered first synchronization management interrupt SM1 and second synchronization management interrupt SM2. A first synchronization interrupt SYNC1 is triggered between the first timer interrupt PIT1 and the first synchronization management interrupt SM1, and a second synchronization interrupt SYNC2 is triggered between the second timer interrupt PIT2 and the second synchronization management interrupt SM2. During the first timer interrupt PIT1, the algorithm application platform reads the input and output status of its internal controller and the rotor angle position of the controlled motor. During the first synchronous interrupt SYNC1 process, the algorithm application platform reads the three-phase current of the controlled motor and updates the data in the application terminal EtherCAT transmission register with the read real-time operating status data; During the first synchronization management interrupt SM1, the algorithm application platform reads the first control signal sent by the target machine; During the second timer interrupt PIT2 process, the algorithm application platform updates the digital-to-analog conversion signal and input / output status of its internal controller according to the first control signal; During the second synchronous interrupt SYNC2, the algorithm application platform updates the data in the application-side EtherCAT send register with the updated input / output status during the second timer interrupt PIT2. During the second synchronization management interrupt SM2 process, the algorithm application platform reads the second control signal sent by the target machine and updates the comparison value of the pulse width modulation counter according to the second control signal; Both the pulse width modulation counter and the timer interrupt counter begin counting at the moment the rising edge of the first synchronous interrupt SYNC1 arrives.
2. The algorithm synchronization method for the rapid prototyping platform for motor control according to claim 1, characterized in that, The control process of the motor control rapid prototyping platform is as follows: The host machine generates the control algorithm and loads it into the target machine. The algorithm application platform collects real-time operating status data and uses this data to update the data in the EtherCAT transmission register on the application side. The data in the application's EtherCAT transmit register is uploaded to the target machine during EtherCAT communication. The target machine executes a control algorithm based on the received real-time operating status data to obtain a control signal, and uses this control signal to update the data in the target machine's EtherCAT transmission register. The data in the target machine's EtherCAT transmit register is sent to the algorithm application platform during EtherCAT communication. The algorithm application platform updates the analog-to-digital conversion signal, the comparison value of the pulse width modulation counter, and the input / output instructions in its internal controller based on the received control signal, thereby controlling the controlled motor.
3. The algorithm synchronization method for the rapid prototyping platform for motor control according to claim 1, characterized in that, Within a complete motor control cycle, the first timer interrupt PIT1 is triggered before the second timer interrupt PIT2, and the first synchronization management interrupt SM1 is triggered before the second synchronization management interrupt SM2.
4. The algorithm synchronization method for the rapid prototyping platform for motor control according to claim 2, characterized in that, The host machine is equipped with a Simulink simulation model, and the simulation step size of the Simulink simulation model is... .
5. A verification method for the algorithm synchronization method of a rapid prototyping platform for motor control as described in any one of claims 1 to 4, characterized in that, Arbitrarily select three input / output ports of the algorithm application platform, and set the output signals of the three input / output ports to represent the execution status of timer interrupt, synchronization interrupt, and synchronization management interrupt, respectively. When any interrupt is being executed, the three input / output ports output a high-level signal; otherwise, the input / output ports output a low-level signal. By observing the level status of the output signals of the three input / output ports with an oscilloscope, it is determined whether the output signal waveforms of the three input / output ports appear in the order of timer interrupt, synchronization management interrupt, and synchronization interrupt, and whether the execution time of each interrupt does not overlap. If so, the target machine and the algorithm application platform are synchronized; otherwise, they are not synchronized.
6. The verification method for the algorithm synchronization method of the rapid prototyping platform for motor control according to claim 5, characterized in that, When the target machine and the algorithm application platform are not synchronized, the initial value of the timer interrupt counter is adjusted at the start of counting, so that the triggering time of the timer interrupt is adjusted; at the same time, the EtherCAT communication time is adjusted, so that the triggering time of the synchronization management interrupt is adjusted, and finally the algorithm synchronization between the target machine and the algorithm application platform is achieved.
7. A verification method for the algorithm synchronization method of a rapid prototyping platform for motor control as described in any one of claims 1 to 4, characterized in that, Under normal operation of the motor control algorithm, the flag SFlag is set to 1, 2, and 3 at the end of the synchronization management interrupt, timer interrupt, and synchronization interrupt, respectively. The verification method is as follows within a complete motor control cycle: At the trigger time of the timer interrupt, check whether the flag bit SFlag is 1. If it is, the previous interrupt of the current timer interrupt is a synchronization management interrupt and the execution time of the current timer interrupt and the previous synchronization management interrupt do not overlap. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized. At the moment the synchronization interrupt is triggered, check whether the flag bit SFlag is 2. If it is, the previous interrupt of the current synchronization interrupt is a timer interrupt and the current synchronization interrupt and the previous timer interrupt do not overlap in execution time. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized. At the trigger time of the synchronization management interrupt, check whether the flag bit SFlag is 3. If it is, the previous interrupt of the current synchronization management interrupt is a synchronization interrupt and the running time of the current synchronization management interrupt and the previous synchronization interrupt do not overlap. Otherwise, the algorithm of the target machine and the algorithm application platform are not synchronized.
8. The verification method for the algorithm synchronization method of the rapid prototyping platform for motor control according to claim 7, characterized in that, When the target machine and the algorithm application platform are not synchronized, the initial value of the timer interrupt counter is adjusted at the start of counting, so that the triggering time of the timer interrupt is adjusted; at the same time, the EtherCAT communication time is adjusted, so that the triggering time of the synchronization management interrupt is adjusted, and finally the algorithm synchronization between the target machine and the algorithm application platform is achieved.
Citation Information
Patent Citations
Accurate commutation control method for position-sensing-free brushless direct current motor
CN115173752A
Servo motor synchronous control system and method based on multi-axis servo driver
CN116073705A