02-22-2011 11:44 AM
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
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
Solved! Go to Solution.
02-22-2011 06:21 PM
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
02-23-2011 09:23 AM
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 %.
02-23-2011 11:52 AM
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.
02-23-2011 06:27 PM
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?
02-23-2011 10:42 PM
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).
03-03-2011 10:48 AM
Thank you nathand.
03-03-2011 10:57 AM
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.
03-09-2011 01:03 PM
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....
03-09-2011 01:13 PM
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