LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID and DAQmx

I have writtem a temperature regulation vi based on the "PID" vi (not the autotune version)from LABVIEW. The PID output is used to update the number of "HIGH Ticks" and "LOW Ticks" using the "Counter Ticks 1Chan 1Samp" vi from LABVIEW. I am using an oscilloscope to verify the width of the PWM signal being fed to the mosfet powering my heater.

The temperature regulation seems to work fine except for the fact that the PWM pulses on my oscilloscope never become 0 in spite of the fact that I am updating the counter with "HIGH Ticks = 0" and "LOW Ticks = 100". There is always a residual PWM signal being fed to the mosfet when it should be completely turned off. The duty cycle of this "unwanted PWM" varies from say about 5% to sometimes 25%. I am suspecting that the counter parameters are not being correctly updated. How can I verify this? By the way the PID parameters have not been optimized yet.

I am attaching my VI for anybody who would be interested to comment.

Thanks
0 Kudos
Message 1 of 2
(2,781 Views)
I don't presently have access to a LV PC so I can't comment directly on the code you posted. However, there is a longstanding restriction on the minimum # of ticks allowed for a counter's high or low time. That value is 2 ticks. When you ask for 0, it probably actually uses 2 rather than give you an error. This can probably be found in the docs/manuals somewhere, but as I recall, it doesn't leap out at you.

Still, a temperature regulation system is very unlikely to have a bandwidth in the msec range. So in practice, you should be able to run you PWM at perhaps 50 Hz and your control loop at 2 Hz (or whatever). If you set up PWM for 2 ticks ON time and (20 msec worth of ticks - 2) OFF time, you can get an exceedingly small (but non-zero) PWM duty cycle. In practice, it's as good as 0%.

There have been a few other threads here about PWM where you can stop a counter to get a true 0% then restart it to get a non-zero duty cycle. I doubt you'll need it for a temperature control system, but thought I'd mention it in case you're curious.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 2
(2,773 Views)