How do I use the Speed Measurement block in the C28x Digital Motor Control library available with Embedded Target for TI C2000 DSP 2.1 (R2006b)?
조회 수: 2(최근 30일)
I would like to know how to use the Speed Measurement block in the C28x Digital Motor Control (DMC) library available with Embedded Target for TI C2000 DSP 2.1 (R2006b). I do not understand the parameters and inputs of the block and the documentation is not enough to explain.
This bug has been fixed in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
The documentation for the Speed Measurement block in Embedded Target for TI C2000 DSP 2.1 (R2006b) is incomplete. Here is additional information about the block inputs and parameters.
1. Understanding the Theta Input to the Block
To indicate the rotational position of your motor, the block expects a 32-bit, fixed-point value that varies from 0 to 1. Block input theta is defined by the following relations.
theta signal equal 0 --> 0 degrees
theta signal equal 1 --> 360 degrees (one full rotation)
When the motor spins at a constant speed, theta (in counts) from your position sensor (encoder) should increase linearly from 0 to 1 and then abruptly return to 0, like a saw-shaped signal. Adjust the theta output signal range from your encoder to get the correct input signal range for the Speed Measurement block. And then convert your encoder signal to 32-bit fixed-point Q format that meets your resolution needs.
For example, suppose you are using a position sensor that generates 8000 counts for one full revolution of the motor, or 0.0450 degrees per count. You need to reset your counter to 0 after your counter reaches 8000. Each time you read your encoder position, you need to convert the position to a 32-bit, fixed-point Q format value knowing that 8000 will be represented as a 1.0. In this example your format could be Q31.
2. Setting the Base Speed
Base speed is the maximum motor rotation rate you need to measure.
The Speed Measurement block calculates motor speed from two successive theta readings of the motor position, thetanew and thetaold; the base speed of the motor; and the time between readings. The maximum speed the block can calculate occurs when the difference between two successive samples [abs(thetanew-thetaold)] is 1.0--one full motor revolution occurs between theta samples.
Therefore, the value you provide for the Base speed (rpm) parameter is the speed, in revolutions per minute, at which your motor position signal reports one full revolution during one sample time. While the motor may spin faster than the base speed, the block cannot calculate the rotation rate unambiguously. If the motor completes more than one revolution in one sample time, the calculated speed may be wrong. The block does not know that between samples thetanew and thetaold, theta wrapped from 1 back to 0 and started counting up again.
The time difference between the two theta readings is the sample time. The Speed Measurement block inherits the sample time from the upstream block in your model. You set the sample time in the upstream block and then the Speed Measurement block uses that sample time to calculate the rotation rate of the motor.
3. Calculating the Sample Time
Motor speed measurements depend on the sample time you set in the model. Your sample time must be short enough to measure the full speed of the motor.
Two parameters drive your sample time--motor base speed and encoder counts per revolution. To be able to measure the maximum rotation rate, you must take at least one sample for each revolution. For a motor with base speed equal to 1000 RPM, which is 16.67 RPS, you need to sample at 1/16.67 s, which is 0.06 s/sample. This sample rate of 16.67 samples per second is the maximum sample time (lowest sample rate) that assures you can measure the full speed of the motor.
Using the same sample rate assumption, the minimum speed the block can measure depends on the encoder counts per revolution. At the minimum measurable motor speed, the encoder generates one count per sample period--16.67 counts per second. For an encoder that generates 8000 counts per revolution, this results in being able to measure a speed of [(16.67 counts/s) * (0.045 degrees/count)] = 0.752 degrees per second, or about 45 degrees per minute--one-eighth RPM.
4. Setting the Differentiator Constant
The differentiator constant is a scalar applied to the block output. For example, setting it to 1 produces no effect on the output. Setting the constant to 1/4 multiplies the freq and RPM outputs by 0.25. This can be handy when your motor has multiple pole pairs, and one electrical revolution is not equal to one mechanical revolution. The constant lets you account for the difference between electrical and mechanical rotation rates.
5. Setting the Low-Pass Filter Constant
This block includes filtering capability if your position signal is noisy. Setting the filter constant to 0 will disable the filter. Setting the filter constant to 1 filters out the entire signal and gives a block output of 0.
Use a simulation to determine the best filter constant for your system. Your goal is to filter enough to remove the noise on your signal but not so much that the speed measurements cannot react to abrupt speed changes.
6. Setting the Speed Measurement Block to Measure Motor Speed
Here is the process for setting up the Speed Measurement block in a model.
a)Add the block to a model.
b)Open the block dialog box to view the block parameters.
c)Set the Base Speed parameter to the maximum speed to measure, in RPM.
d)Set values for the Differentiator and Low-Pass Filter Constant parameters.
e)Click OK to close the dialog box.
7. Setting the Sample Time for Measuring the Motor Speed
Here is the process for setting the sample time for measuring the motor speed.
a)Open the block dialog box for the upstream block before the Speed Measurement block.
b)Set the Sample time parameter in the upstream block according to the sample time you calculate in Calculating the Sample Time above.
c)Click OK to close the dialog box.
Refer to the attached model (for use with R2006b) to study the operation of the Speed Measurement block following the above guidelines.
더 많은 답변 보기: Power Electronics Community