Main Content

准备目标硬件

Follow these steps to prepare the target hardware before you deploy the control algorithm developed using Motor Control Blockset™ to it.

Note

You needEmbedded Coder®Support Package for Texas Instruments™ C2000™ Processorsto run these steps.

We recommend that you see these references before following this procedure:

此外,请首先使用开环控制运行电机Run 3-Phase AC Motors in Open-Loop Control and Calibrate ADC Offsetexample.

验证电机的旋转方向

目标硬件中的电动机连接的相位序列决定了电动机的旋转方向。电动机控制块集示例模型将位置升降期间的旋转方向视为正方向和相应的测量速度为正。建议您在开环控制中运行电机,使用位置斜坡0to1and ensure that the position feedback is positive. The example models in Motor Control Blockset use this convention for the motor's direction of rotation.

对于支持的硬件,金宝app该算法在示例中PMSM电机的正交编码器偏移校准, runs the motor and finds the offset between thed- 转子的轴和编码器索引脉冲(当转子对齐时d- 定子的轴)。当旋转方向相反,此示例的主机模型中的红色LED打开。发生这种情况时,应改变电机接线的相位序列(交换任何两个电机线)。

看这个例子PMSM电机的霍尔胶印校准to identify the direction of rotation of a motor that uses Hall sensors.

Note

When you use a Hall sensor, ensure that the Hall sequence updated in theHall Speed and PositionandHall Validityblocks matches the sequence of the actual Hall signals. If you update an incorrect Hall sequence, the direction read by the target hardware is the opposite of the actual direction.

Calibrate Current Sensor

The signal conditioning circuits for the current sensor introduces a voltage offset in the analog to digital converter (ADC) input when measuring both the positive and negative current. For example, an ADC with a voltage reference of3.3V can have an offset of1.65V when using the Texas Instruments BOOSTXL-DRV8305 hardware. This offset varies due to tolerances of the passive components available in the signal conditioning circuit. It is recommended that you measure the ADC offset of the hardware during initialization.

The hardware initialization subsystem, which is used in the majority of Motor Control Blockset example models, computes the average current sensor ADC values and uses them as ADC offset values for measuring the current. The subsystem represents the ADC offset values in ADC counts.

看这个例子Run 3-Phase AC Motors in Open-Loop Control and Calibrate ADC Offset要手动校准ADC偏移并更新模型初始化脚本文件中的计算偏移值。

See theHardware Initsubsystem available in the exampleField-Oriented Control of PMSM Using Quadrature Encoder要了解示例模型在启动闭环电机控制之前执行示例模型的ADC偏移量计算。

Calibrate Position Sensor

For a PMSM, the position used in the current control algorithm should align with thed-axis position of the rotor. By default, the quadrature encoder position sensor reads the mechanical position of the rotor with reference to its index pulse. The position offset is the position read by the quadrature encoder whend-axis of the rotor aligns with phasea. To obtain an accurate motor position, use this position offset value to correct the position read by the quadrature encoder sensor. Then provide the corrected motor position value as an input to the current control algorithm.

A mismatch between the actual rotor position and the position provided to the current controller affects the motor functionality and performance.

For more details, see the examplesPMSM电机的正交编码器偏移校准andPMSM电机的霍尔胶印校准.