A motor control core and control method based on RISC-V

By curing motor control-related devices in the RISC-V core and using the Custom instruction group for instruction expansion, the existing motor controllers have solved the problems of limited control frequency and high ARM architecture expansion cost in high-speed servo occasions, achieving high efficiency, Low cost motor control.

CN114204861BActive Publication Date: 2025-02-07SOUTH CHINA UNIV OF TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111569081.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2025-02-07
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The existing motor controllers have limited control frequency in high-speed servo occasions, and the ARM architecture is expensive to expand and difficult to design.

Method used

Using a motor control core based on RISC-V, the current loop controller, coordinate converter, space vector modulator and sliding mode observer are cured in the RISC-V core, and the instruction expansion is achieved using the Custom instruction group to achieve efficient motor control.

Benefits of technology

It improves the frequency and efficiency of motor control, reduces production costs and design difficulties, and avoids the complexity caused by module changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114204861B_ABST
    Figure CN114204861B_ABST
Patent Text Reader

Abstract

The present invention discloses a motor control kernel and control method based on RISC-V, including a RISC-V kernel, wherein a current loop controller, an iPark coordinate converter, a Park coordinate converter, a Clarke coordinate converter, an SVPWM space vector modulator, a sliding mode observer and a phase-locked loop are arranged in the RISC-V kernel; a main processor CPU, a three-phase inverter and a motor are arranged outside the RISC-V kernel, and the main processor CPU includes a position loop controller and a speed loop controller. The motor-specific kernel using the RISC-V architecture can not only solve the problem of limited frequency of the existing motor software control algorithm, but also avoid the problems of high expansion cost and complex design existing in other kernel architectures, making the motor control more specialized and convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of motor control technology, and in particular to a motor control kernel and a control method based on RISC-V. Background Art

[0002] Motor control technology involves various home appliances, robots and other industries. In recent years, with the rapid development of these industries, the demand for motor control technology has also increased. The vigorous development of the motor industry has promoted competition among similar products, and production costs and the efficiency and stability of control systems have become increasingly important. At present, motor control chips based on ARM cores are the mainstream. The ARM core is powerful and covers a wide range of instructions, but the structure is complex.

[0003] The existing motor control has the following problems:

[0004] High-speed servo applications require higher and higher control frequencies for controllers, and existing controller frequencies are severely limited.

[0005] ARM architecture expansion is limited by cost;

[0006] The ARM architecture motor control kernel extension instructions are complex, which increases the difficulty of design. Summary of the invention

[0007] In order to overcome the problems of limited motor control frequency, high expansion cost and great design difficulty in the prior art, the present invention provides a motor control kernel and control method based on RISC-V.

[0008] The present invention adopts the following technical solution:

[0009] A motor control kernel based on RISC-V comprises a RISC-V kernel, wherein a current loop controller, an iPark coordinate converter, a Park coordinate converter, a Clarke coordinate converter, an SVPWM space vector modulator, a sliding mode observer and a phase-locked loop are arranged inside the RISC-V kernel; a main processor CPU, a three-phase inverter and a motor are arranged outside the RISC-V kernel; the main processor CPU comprises a position loop controller and a speed loop controller.

[0010] Furthermore, the Clarke coordinate transformer includes two multipliers and one adder, which is implemented by a specified parameter instruction SETUP, a multiplication operation instruction MUL and an addition operation instruction ADD, and the three instructions are defined in the same Custom instruction group.

[0011] Furthermore, the Park coordinate transformer includes an adder, a subtractor, six trigonometric function operators and a matrix multiplier, which are implemented by specifying parameter instructions SETUP, addition operation instructions ADD, subtraction operation instructions SUB, trigonometric function instructions SIN, COS and matrix multiplication instructions TRMUL, and the six instructions are defined in the same Custom instruction group.

[0012] Furthermore, the current loop controller includes two subtractors, a multiplier and an adder, which are implemented by a specified parameter instruction SETUP, a subtraction instruction SUB, a multiplication instruction MUL, an integration instruction INTE and an addition instruction ADD, and the five instructions are defined in the same Custom instruction group.

[0013] Furthermore, the iPark coordinate converter includes two trigonometric function operators and a matrix multiplier, which are implemented by the specified parameter instruction SETUP, the trigonometric function instructions SIN, COS and the matrix multiplication instruction TRMUL, and the four instructions are defined in the same Custom instruction group.

[0014] Furthermore, the SVPWM space vector modulator includes three subtractors, a sign operator, a matrix multiplier, a multiplier and an adder, and is implemented by a specified parameter instruction SETUP, a subtractor instruction SUB, a sign operation instruction SIGN, a matrix multiplication instruction TRMUL, a multiplication instruction MUL, an addition instruction ADD and a conditional assignment statement CASE, and the seven instructions are defined in the same Custom instruction group.

[0015] Furthermore, the sliding mode observer and phase-locked loop include two subtractors, two multipliers, an adder, two matrix multipliers, a modulo, two trigonometric function operators, a PI controller module, an accumulator, a divider and an integrator, and are implemented by specifying parameter instructions SETUP, subtraction instructions SUB, multiplication instructions MUL, addition instructions ADD, matrix multiplication instructions TRMUL, modulo instructions AMP, trigonometric function operation instructions SIN and COS, PI controller modules (reference current loop PI controllers), accumulator instructions MADD, division instructions DIV and integration instructions INTE, and the twelve instructions are defined in the same Custom instruction group.

[0016] A control method for a motor control core, comprising:

[0017] The three-phase current of the motor is input into the Clarke coordinate converter and the Park coordinate converter through ADC sampling and current reconstruction to realize the conversion between three-phase current and two-phase current;

[0018] The two-phase currents Iα and Iβ are used as the input of the sliding film observer & phase-locked loop, and the output currents Id and Iq of the Park coordinate converter are used as the feedback input of the current loop controller; the speed and angle output by the sliding film observer & phase-locked loop are used as the feedback input of the speed loop controller and the position loop controller;

[0019] The output of the speed loop controller is given to the current loop controller; the output of the current loop controller and the output of the sliding film observer & phase-locked loop are used as the input of the iPark coordinate converter;

[0020] The two-phase voltage output by the iPark coordinate converter is used as the input of the sliding mode observer & phase-locked loop and the SVPWM space vector modulator. The switching signal output by the SVPWM space vector modulator is used to drive the three-phase inverter.

[0021] Beneficial effects of the present invention:

[0022] Solidifying the device into the RISC-V core can not only avoid the complexity caused by module changes, but also increase the operating speed and reduce costs.

[0023] The Custom instruction group reserved in the 32-bit instructions of the RISC-V architecture is used to expand the instructions. Compared with the original software operations, the operations at the instruction level are more time-saving and occupy less area of ​​chip resources.

[0024] Compared with the ARM core, the RISC-V core has more flexible algorithm expansion and does not require royalties, thus reducing production costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is a schematic diagram of the structure of the present invention;

[0026] Figure 2 It is a diagram of the implementation steps of the present invention

[0027] Figure 3 It is a schematic diagram of the structure of the Clarke coordinate transformer of the present invention;

[0028] Figure 4 It is a structural schematic diagram of the Park coordinate converter of the present invention;

[0029] Figure 5 It is a structural schematic diagram of the current loop controller of the present invention;

[0030] Figure 6 It is a structural schematic diagram of iPark coordinate transformation of the present invention;

[0031] Figure 7 It is a structural schematic diagram of the SVPWM space vector modulator of the present invention;

[0032] Figure 8 It is a structural schematic diagram of the synovial membrane observer & phase-locked loop of the present invention. DETAILED DESCRIPTION

[0033] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0034] Example

[0035] like Figure 1 As shown, a motor control kernel based on RISC-V is characterized in that it includes a RISC-V kernel, and the RISC-V kernel uses an extensible Custom instruction group to define instructions to form a current loop controller, an iPark coordinate converter, a Park coordinate converter, a Clarke coordinate converter, an SVPWM space vector modulator, a sliding mode observer, and a phase-locked loop; the above devices are solidified into a dedicated RISC-V kernel, which can avoid the inflexibility caused by module changes, and can also increase the operating rate and reduce costs. A main processor CPU, a three-phase inverter, and a motor are arranged outside the RISC-V kernel, and the main processor CPU includes a position loop controller and a speed loop controller.

[0036] The specific working process is as follows:

[0037] The three-phase current of the motor is input into the Clarke coordinate converter and the Park coordinate converter through ADC sampling and current reconstruction to realize the conversion between three-phase current and two-phase current;

[0038] The two-phase currents Iα and Iβ are used as the input of the sliding film observer and the phase-locked loop, and the output currents Id and Iq of the Park coordinate converter are used as the feedback input of the current loop controller; the speed and angle output by the sliding film observer and the phase-locked loop are used as the feedback input of the speed loop controller and the position loop controller;

[0039] The output of the speed loop controller is given to the current loop controller; the output of the current loop controller and the output of the sliding film observer & phase-locked loop are used as the input of the iPark coordinate converter;

[0040] The two-phase voltage output by the iPark coordinate converter is used as the input of the sliding mode observer, the phase-locked loop and the SVPWM space vector modulator. The switching signal output by the SVPWM space vector modulator is used to drive the three-phase inverter.

[0041] The specific steps of this embodiment are as follows:

[0042] S1 Figure 2 As shown, the ADC sampled bus current value and the reconstructed phase current value are obtained from the main CPU, and the outputs of the speed loop controller and the position loop controller are obtained.

[0043] S2 performs Clarke transformation on the acquired phase current value. At the same time, it obtains the angle value output by the sliding mode observer and the current value output by the Clarke transformation and performs Park transformation. The trigonometric function operations and matrix multiplication operations in the coordinate transformation are defined as coprocessor instructions by using the custom instruction set of the RISC-V core.

[0044] like Figure 3 As shown in FIG. 1 , the Clarke coordinate converter includes two multipliers and one adder, which is specifically implemented as follows: SETUP, MUL and ADD instructions are defined in the same Custom instruction group, which respectively represent the address, multiplication and addition operations of the determined parameters. First, the SETUP instruction is used to specify the parameters and fixed coefficients that need to be Clarke transformed, that is, any two of ia, ib, ic and Take one of the currents ADD as iα; then use two MUL instructions to calculate the first current and The second current is the product of The product of , and finally use the ADD instruction to add the results of the MUL calculation to get iβ, and store iα and iβ in the register buffer.

[0045] like Figure 4 As shown, the Park coordinate converter includes an adder, a subtractor, six trigonometric function operators and a matrix multiplier. The following instructions can be defined in the same Custom instruction group: parameter specification instruction SETUP, addition instruction ADD, subtraction instruction SUB, trigonometric function instructions SIN, COS and matrix multiplication instruction TRMUL. First, use the SETUP instruction to specify the angle parameter θ, currents iα and iβ, then use the addition operation ADD to calculate θ+2π / 3, use the SUB instruction to perform a subtraction operation to calculate θ-2π / 3, and then use the trigonometric function instructions SIN and COS to transform the parameters θ, θ+2π / 3, and θ-2π / 3 to obtain SIN(θ), COS(θ), and It is stored as a matrix element in a buffer, and then multiple TRMUL instructions are used to calculate the product of the matrix and the currents iα and iβ, and finally the result is stored in the output register buffer.

[0046] S3 uses the output of the current and speed loop controller after coordinate transformation as the input of the id and iq current loop controllers PI. Similarly, the RISC-V core can define the proportional and integral operation instructions in the current loop controller PI.

[0047] like Figure 5As shown, the current loop controller includes two subtractors, a multiplier and an adder. The following instructions can be defined in the same Custom instruction group: specify parameter instruction SETUP, subtraction instruction SUB, multiplication instruction MUL, integration instruction INTE and addition instruction ADD. First, use the SETUP instruction to specify the parameters of the input controller: feedback current id_frq, iq_frq and given current id_set, iq_set; then use two SUB instructions to calculate the difference between the feedback current and the given current respectively, obtain delta_id and delta_iq and store them in the buffer, which stores the P parameter and I parameter of the PI controller; use two MUL instructions to perform multiplication operation of P parameter with delta_id and delta_iq on the data in the buffer, use two INTE instructions to perform integration operation of I parameter with delta_id and delta_iq, and use ADD addition instruction to add the results of multiplication and integration operation, store them in the output buffer, and wait for the next link.

[0048] S4 performs iPark coordinate transformation on the output of the id and iq current loops. The trigonometric function operations and matrix operations involved in the iPark transformation can also be implemented using RISC-V core instructions;

[0049] like Figure 6 As shown, the iPark coordinate converter includes two trigonometric function operators and a matrix multiplier. The following instructions can be defined in the same Custom instruction group: specify the parameter address SETUP, trigonometric function instructions SIN, COS and matrix multiplication instruction TRMUL. First, use the SETUP instruction to specify the angle parameter θ, voltage Ud and voltage Uq, use the trigonometric function instructions SIN and COS to transform the parameter θ to obtain SIN(θ) and COS(θ), which are stored in the buffer as column matrix elements, and then use multiple matrix operation instructions TRMUL to calculate the product of the column matrix and the voltages Ud and Uq, and finally store the result in the register buffer.

[0050] S5 inputs the current loop controller output after iPark transformation into the SVPWM space vector modulator for vector modulation. The addition, subtraction and multiplication operations involved can also be implemented with the RISC-V core to implement instruction encoding. This module outputs six switch signals for driving the three-phase inverter.

[0051] like Figure 7As shown, the SVPWM space vector modulator includes three subtractors, a sign operator, a matrix multiplier, a multiplier and an adder. The following instructions can be defined in the same Custom instruction group: specifying parameter address SETUP, subtractor instruction SUB, sign operation instruction SIGN, matrix multiplication instruction TRMUL, multiplication instruction MUL, addition instruction ADD and conditional assignment statement CASE.

[0052] First, use the SETUP instruction to specify the data u that needs to be calculated α 、u β , then call the SUB instruction to calculate the intermediate value u1=u of the sector judgment β , u2=u α -u β , u3=-u α -u β , and then stored in the reserved register buffer. According to the formula N=sign(u1)+sign(u2)*2+sign(u3)*4, the matrix multiplication instruction TRMUL is used to calculate the sector N and the partition assignment is performed through the CASE instruction; after the assignment in each partition is completed, the MUL multiplication instruction is used to calculate the specific time of the comparison value, the SUB subtraction instruction and the ADD addition instruction are used to calculate the three-phase comparison value, and stored in the register. Using the three-phase comparison value and the triangle wave, six-way PWM drive signals can be output.

[0053] S6 inputs the currents iα, iβ after Clarke transformation and Uα, Uβ output after iPark transformation into the sliding mode observer and phase-locked loop PLL to estimate the angle and speed of the motor. The division and trigonometric function operations involved in this module can also be implemented using RISC-V instructions.

[0054] like Figure 8 As shown, the sliding film observer and phase-locked loop PLL include two subtractors, two multipliers, an adder, two matrix multipliers, a modulo, two trigonometric function operators, a PI controller module, an accumulator, a divider and an integrator. The following instructions can be defined in the same Custom instruction group: specify the parameter address SETUP, subtraction instruction SUB, multiplication instruction MUL, addition instruction ADD, matrix multiplication instruction TRMUL, modulo instruction AMP, trigonometric function operation instructions SIN and COS, PI controller module (refer to current loop PI controller), accumulator instruction MADD, division instruction DIV and integration instruction INTE. First, use the SETUP instruction to specify the input data to be calculated in the parameter address and Fixed parameters K1, K2, K3, K4. Calculated using the subtraction instruction SUB The value DATA1 is then multiplied by the TRMUL method to calculate the multiplication of DATA1 and the fixed coefficient K1. The multiplication of the fixed coefficient K2 is then performed using the ADD instruction to add the two multiplication values ​​to obtain the new matrix element. Calculate using the subtraction instruction SUB Get the error e, multiply the error e and the coefficient K3 using matrix multiplication TRMUL, and if it does not exceed the set limit value, get the new And update it to the address of the original parameter. Use the instruction AMP to calculate The feedback angle θ is transformed using the trigonometric function instructions SIN and COS; then the angle error is calculated: using the formula Use TRMUL matrix multiplication instruction to get the angle error The error is sent to the PI controller module to obtain the angle difference output DELTAθ. The angle is accumulated through the MADD cumulative addition instruction and then divided by the control cycle and the cumulative number of times through the division instruction to output the motor speed W. The angle difference is accumulated and integrated to obtain the motor angle θ.

[0055] S7 inputs the calculated angle and speed as feedback values ​​into the position loop and speed loop controller of the main CPU.

[0056] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A motor control core based on RISC-V, characterized in that: It includes a RISC-V core, in which a current loop controller, an iPark coordinate converter, a Park coordinate converter, a Clarke coordinate converter, an SVPWM space vector modulator, an SMO&PLL sliding mode observer and a phase-locked loop are arranged; a main processor CPU, a three-phase inverter and a motor are arranged outside the RISC-V core; The connection method is: The three-phase current of the motor is input into the Clarke coordinate converter and the Park coordinate converter through ADC sampling and current reconstruction to realize the conversion between three-phase current and two-phase current; The two-phase current is used as the input of the SMO&PLL sliding film observer and the phase-locked loop, and the output current of the Park coordinate converter is used as the feedback input of the current loop controller; the speed and angle output by the SMO&PLL sliding film observer and the phase-locked loop are used as the feedback input of the speed loop controller and the position loop controller; The output of the speed loop controller is given to the current loop controller; the output of the current loop controller and the output of the SMO & PLL sliding film observer and the phase-locked loop are used as the input of the iPark coordinate converter; The two-phase voltage output by the iPark coordinate converter is used as the input of the SMO&PLL sliding mode observer, phase-locked loop and SVPWM space vector modulator. The switching signal output by the SVPWM space vector modulator is used to drive the three-phase inverter. The SVPWM space vector modulator includes three subtractors, a sign operator, a matrix multiplier, a multiplier and an adder. The data of the two subtractors are output to the sign operator. The output of the sign operator is connected to the matrix multiplier. The output of the matrix multiplier is connected to the multiplier, the subtractor and the adder in sequence. It is implemented by a specified parameter instruction SETUP, a subtractor instruction SUB, a symbolic operation instruction SIGN, a matrix multiplication instruction TRMUL, a multiplication instruction MUL, an addition instruction ADD and a conditional assignment statement CASE, wherein the specified parameter instruction SETUP, the subtractor instruction SUB, the symbolic operation instruction SIGN, the matrix multiplication instruction TRMUL, the multiplication instruction MUL, the addition instruction ADD and the conditional assignment statement CASE are defined in the same Custom instruction group; The SMO&PLL sliding mode observer and phase-locked loop include two subtractors, two multipliers, an adder, two matrix multipliers, a modulo, two trigonometric function operators, a PI controller module, an accumulator, a divider and an integrator; the specific connection is: A subtractor is followed by two multipliers and an adder. The current update value I output by the adder is * The actual current is subtracted from the actual current through another subtractor and then input into a matrix multiplier. The motor speed data ω is calculated through a modulo, another matrix multiplier, a PI controller, an accumulator, and a divider. The motor angle is calculated through an integrator, and the motor angle is input into a trigonometric function operator as feedback. It is implemented by specifying parameter instructions SETUP, subtraction instructions SUB, multiplication instructions MUL, addition instructions ADD, matrix multiplication instructions TRMUL, modulo instructions AMP, trigonometric function operation instructions SIN and COS, PI controller module, accumulator instructions MADD, division instructions DIV and integration instructions INTE, and the specified parameter instructions SETUP, subtraction instructions SUB, multiplication instructions MUL, addition instructions ADD, matrix multiplication instructions TRMUL, modulo instructions AMP, trigonometric function operation instructions SIN and COS, PI controller module, accumulator instructions MADD, division instructions DIV and integration instructions INTE are defined in the same Custom instruction group.

2. The motor control kernel according to claim 1, characterized in that: The Clarke coordinate converter includes two multipliers and an adder. The two-phase current signals ia and ib and the corresponding coefficients are multiplied by the multipliers respectively. The output of the multipliers is connected to the adder, and finally the calculation result is stored in the output buffer. It is implemented by a specified parameter instruction SETUP, a multiplication instruction MUL and an addition instruction ADD, wherein the specified parameter instruction SETUP, the multiplication instruction MUL and the addition instruction ADD are defined in the same Custom instruction group.

3. The motor control kernel according to claim 1, characterized in that: The Park coordinate transformer includes an adder, a subtractor, six trigonometric function operators and a matrix multiplier. The motor angle is calculated by the adder and subtractor respectively and then output to the trigonometric operator. The calculation result is stored in the matrix element buffer and then combined with the two-phase current through the matrix multiplier and finally stored in the output buffer. It is implemented by specifying parameter instruction SETUP, addition operation instruction ADD, subtraction operation instruction SUB, trigonometric function instructions SIN, COS and matrix multiplication instruction TRMUL, and the specified parameter instruction SETUP, addition operation instruction ADD, subtraction operation instruction SUB, trigonometric function instructions SIN, COS and matrix multiplication instruction TRMUL are defined in the same Custom instruction group.

4. The motor control kernel according to claim 1, characterized in that: The current loop controller includes two subtractors, a multiplier and an adder; The output currents id and iq of the Park coordinate converter are connected to the multiplier and integrator respectively after passing through the subtractor. The multiplier and integrator are connected to the adder, and the final calculation result is stored in the output buffer. It is implemented by specifying parameter instruction SETUP, subtraction instruction SUB, multiplication instruction MUL, integration instruction INTE and addition instruction ADD, and the specified parameter instruction SETUP, subtraction instruction SUB, multiplication instruction MUL, integration instruction INTE and addition instruction ADD are defined in the same Custom instruction group.

5. The motor control kernel according to claim 1, characterized in that: The iPark coordinate converter includes two trigonometric function operators and a matrix multiplier; The motor angle passes through the trigonometric operator and matrix multiplier in turn, and the final calculation result is stored in the output buffer; It is implemented by specifying parameter instruction SETUP, trigonometric function instructions SIN, COS and matrix multiplication instruction TRMUL, and the specified parameter instruction SETUP, trigonometric function instructions SIN, COS and matrix multiplication instruction TRMUL are defined in the same Custom instruction group.

6. A control method based on the motor control core according to any one of claims 1 to 5, characterized in that: These include: The position loop controller adopts a vector control method.

Citation Information

Patent Citations

  • Motor control kernel based on RISC-V

    CN217428025U