LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID control of heating element feedback

Solved!
Go to solution

I developed a .VI that is successfully controlling the temperature of up to 8 components on a device I have built but the solution feels messy and I'm looking for feedback.

 

Equipment I am using

  • USB-TC DAQ board for temperature input and relay control (using digital out). - Link
  • Type K thermocouples
  • Crydom solid state relays to switch power. - Link
  • 120 V Cartridge Heater

I have included a .VI of an example of a single input.  I start by configuring one of the USB-TCs output bits so that I can control the SSR.  Then, once every ten loops I sample a DAQ board channel for a temperature.  I do this because I'm using a second DAQ board for non-temperature measurements and that board reads in this time.  The sampled temperature goes to the process variable of the PID .vi.  The output range of the PID .vi is from 0 to 100 % because I want a duty cycle output.   This is where it gets really "messy".  I use the PID output to generate a waveform, then convert that to a digital waveform, and then convert the digital waveform into a boolean array.  I found the [1,1] index of that array works and I use this to turn the digital output channel either high or low.  I have this output wired to the SSR which when high allows current to flow to the cartridge heater.

 

I feel like there is a cleaner way to do this.

 

Thanks for all input.

Hunter

 

0 Kudos
Message 1 of 31
(14,824 Views)

hi

for similar purposes, I am using the pid toolkit and the output of this pid module is expressed as 0 to 100%. I am using SSR with a 100 Hz switch on/off (if the output of the pid is say 50%, then one every two cycles is ON..). the load is resistive and small power (a peltier module) and it s working ok. for higher power I am not sure how it s going to work (transient currents, etc..)

N

0 Kudos
Message 2 of 31
(14,798 Views)

You might consider creating another PWM vi that uses a timed loop as a PWM timebase.  This vi could have an array of 'time %' for each heater channel.  This PWM VI is constantly running within the timed loop and outputing to your SSR's.  The PID process then updates the PWN vi with the current output %.

Message 3 of 31
(14,777 Views)

You don't need most of that code.  You could get a similar result by simply checking if the output from the PID is greater than some amount (say, 0.5).  That will give you a boolean that you can wire directly to your digital output.  You might go a step further and simply compare the feedback temperature to the setpoint.  If you're under the setpoint, turn on the heater; if over, turn it off.

 

Add a graph and look at the temperature, the setpoint, and the state of the output.  I suspect you'll see that the output switches whenever the temperature crosses the setpoint, with perhaps a small amount of hysteresis.  PID is designed for a system with a variable output, such as an analog output or a variable duty cycle.  In your loop there's no variable duty cycle.  You just turn the output on or off at the same frequency as your PID runs, so the PID isn't improving your control.

 

You also aren't gaining anything by running the PID once every 10 cycles, since the empty loop cycles execute almost instantaneously.  It's a bad idea to put a loop in LabVIEW that has no wait or timing structure inside it, because LabVIEW will then run that loop as fast as possible, preventing other code from executing and making your user interface unresponsive.  It would be better to put a wait inside the loop and skip the case structure.

Message 4 of 31
(14,763 Views)

 sachsm - I'm sorry I don't quite understand what you mean, can you please explain?

 

Nathand - You're suggesting a bang-bang control which I tried initially.  The problem was the thermal mass of the system caused a HUGE overshoot of the set point.  I added a waveform chart, theoretical set point, and process variable to my VI (see attachment) to prove that this method does produce a varying duty cycle based on set point, process variable, and PID gains.  You will see it change if you run it.

 

I did make the change regarding the loop timing you suggested and put this as a control in the new VI.

 

I'm still looking for a cleaner way to achieve PWM from the PID vi.  Any suggestions?

0 Kudos
Message 5 of 31
(14,737 Views)
Solution
Accepted by hwright

Sorry, I didn't look carefully enough at your VI the first time through to fully understand what you did.  Is this the sort of simplification you're looking for?  If you don't want to track the time input yourself, you could use the similar "Square Wave.vi" (instead of the Point-by-Point version I used here).

HeaterPID_RunThis_modified.png

Message 6 of 31
(14,723 Views)

Thank you nathand.

0 Kudos
Message 7 of 31
(14,650 Views)

One further simplification - my version works exactly the same way if you wire the timer output directly to the division, no need to subtract the starting time.

0 Kudos
Message 8 of 31
(14,642 Views)

I have also problem about feedback and PID control.

 

Lakeshore 336 temperature controller

K182 nanovoltmeter

2 K type thermocouples

2 25ohms heaters

 

I am not good at Labview, but i need to write this software. So, I am attaching my vi, please help me about this.

 

heaters will go to specific temp. and then measurement will be done, then the heaters will go to next temperature set point as can be seen in vi I attached.

In auro PID option, temperature raises and passes the set point temperature point?

also I write what I need in vi.

 

thanks in advance....

Download All
0 Kudos
Message 9 of 31
(14,598 Views)

Hi

 

As I told you in your previous thread, you do not need to keep two temperatures constant : actually you can't ! you will heat one end of the sample to make your gradient and, depending upon the thermal conductivity of the sample, the other will heat or not... both sides of the sample may heat and so on.

What you need to do is to create a gradient by applying a power on one side and measure dT and dV to get the Seebeck. You can not determine the Seebeck only by dV/dT because there are many offsets, but you can calculate it from the slope of the dv vs dT line. Look carefully in this recent paper :

J. D’Angelo, A. Downey and T. Hogan, “Temperature dependent thermoelectric material power factor measurement system”, Review of Scientific Instruments 81, 075107 (2010).

It is not the Labview software that is going to solve the problem, it is also the careful design of the experiment.

regards

N

 

0 Kudos
Message 10 of 31
(14,593 Views)