LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 200290 when running a pulse count and pwm program together.

Purely based on what you wrote, it would seem that if you can't get more than 1700 rpm without increasing the power supply voltage, then you've reached the limit of what the motor can do with the amount of power you're supplying. I don't know if that's actually the case, though. How fast does the motor run if you manually set the duty cycle at 0.99? Do you know that it can go faster than 1700 rpm at the voltage you're using?

 

When you wrote "no matter what values i put in," which values are you referring to? The PID gains, the frequency, the lower limit of the duty cycle, something else? What range of PID gains did you try?

 

More importantly, do you understand what the Proportional gain means? Your output range is 0.5-0.99. What is the minimum error that would cause you to get the maximum output, with a proportional gain of 0.1? 0.99 / 0.1 = 9.9 RPM. Any time the error is more than 10 RPM you're driving the motor full on (and of course it's even worse with a proportional gain of 4 like in the "screen shot 3"). That's why the output is constantly switching between 0.5 and 0.99 with no values in the middle.

 

Instead of using a much smaller gain, you could do the PID calculations in percent, and then divide by 100 afterward. Of course from a math point of view the results should be identical, but it will help avoid rounding errors and makes the values easier to look at.

0 Kudos
Message 31 of 33
(678 Views)
Spoiler
 

Hi nathand ,

On the daqmx i have set the duty cycle at .99 and the frequencey at 1000 and the frequencey at the daqmx write at 1000. The motor supply is 10v dc and the motor runs at 2400 rpm.what are the pid output ranges to be set at 0-100 ,0-5,what am i setting them against.What is the range dependant on.The proportional is the difference between the set point and the process reading, which can be refered to as the error signal.If i move the output out side the values set i get the error as before on the daqmx write.The pid output value are set at max.99 and min0.09.When i run the program the motor starts 1000rpm thereabouts, when i increase  Kp to 0.001 it goes at the max rpm at 10v whicis 2400.What am i doing wrong?

 

Regards Anthony

Download All
0 Kudos
Message 32 of 33
(670 Views)

This is not that hard, if you took a moment to understand what you're doing. Also, your writing will be clearer if you take the time to use proper capitalization and punctuation.

 

The PID output range needs to match the duty cycle range. I think that much is obvious. It should be equally clear that duty cycle must be between 0 and 1 (0 and 100%). If that isn't clear, then you don't understand the meaning of duty cycle. In this case the range is actually slightly smaller than that since the hardware won't let you set a duty cycle of 0 (and maybe not of 1 either). You can do the PID math as a fraction, or do it as a percentage and then divide by 100, it doesn't matter so long as in the end you're writing a value between 0 and 1 to the counter output.

 

The proportional output is the error multiplied by the proportional gain. When the I and D values are 0, the PID output is, of course, the proportional output. You can easily calculate what the output will be for any given error. Let's look at what's happening in the screenshot. Initially the motor is at 2400 RPM, the setpoint is at 2500 RPM, and the P gain is 0.001. (2500 - 2400) * 0.001 = 0.1. And, not surprisingly, you can see that the PID output is 0.1. Of course, with the duty cycle at 0.1, the motor doesn't spin as fast and the RPM drops. A second later, the RPM has dropped to about 1600. Now the PID output is (2500-1600) * 0.001 = 0.8, again exactly as shown in your screenshot (the last full peak in the PID output graph). Then the cycle repeats - at a duty cycle of 0.8, the RPM goes back to 2400, the PID output drops again, etc. Does this make sense to you? If not, why not?

 

The control should improve if you update the output more frequently. However, if you don't take enough samples, the RPM measurement won't be accurate, so you will need to experiment to see what works. How many pulses do you need to get a good RPM reading? What is the longest period of time it would take to get that number of pulses? I would start from there. You could maintain a buffer of previous readings so that you could acquire fewer samples per loop cycle and use the entire buffer for the RPM calculation, but don't do that unless you find out that it's necessary.

0 Kudos
Message 33 of 33
(661 Views)