LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature Control using labview

Hi there! Need some help here!

So im really quite new to labview and currently im involved in a project that requires me to control the temperature in a chamber using a power source to a heater and a DAQ to a thermocouple. If the temperature of the chamber rise above the set point, I would require the power source to switch off. When it drops below, the power source switch on again. Right now im trying to use a case structure to activate/deactivate my power source, however

1) Im not so sure how to settle the false part (true part as well actually) and

2) How to link my DAQ readings to the temperature comparison part.

3) Also, would the method of using a relay be better?

Attached is my VI. Thank you very much!

0 Kudos
Message 1 of 27
(14,529 Views)

Hi Shalalas,

 

I would require the power source to switch off.

How do you switch this power supply on/off?

All you do in your VI is setting some voltage/current levels on two "channels"…

What are these "channels"?

 

1) Im not so sure how to settle the false part (true part as well actually)

Why do you need this case structure? Isn't it possible to set certain voltage/current levels as needed for the heater?

 

2) How to link my DAQ readings to the temperature comparison part.

I don't know. Do you need to "link" DAQ readings with temp readings?

 

3) Also, would the method of using a relay be better?

Depends on your hardware. Unfortunately you don't tell so much about the hardware…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 27
(14,501 Views)

It seems to me that I've seen numerous "Exercises" for DAQmx devices or "Getting Started with LabVIEW" that involve temperature controllers.  That must be why it is such a popular homework assignment.  Talk to your classmates.

 

Bob Schor

0 Kudos
Message 3 of 27
(14,491 Views)

To do thermal control properly, you probably need to look into implementing a PID controller.  LabVIEW has good PID tools, search the examples..

 

http://zone.ni.com/reference/en-XX/help/371361L-01/lvpid/pid_vi/

 

 

0 Kudos
Message 4 of 27
(14,473 Views)

Thank you for the reply!

 

-I was actually thinking of switching it off by using the true/false case structure, so ill set the voltage of the power source to zero when it is false. The channels are the channels of my power source GPS3303S. 

-I needed it as I thought when the temperature rises above a certain temperature it will enter the false case and set the voltage to 0.

-Im using GPS-3303S for power and Measuring Computing DAQ for temperature reading.

 

Actually I tried an alternative method of building a state machine which many say its a better way, and I am having some troubles.

I tried to integrate 4 thermocouples together to get the mean value at each timing, and im not very sure what i have done is correct. I want to use the mean value to compare with the maximum temperature that i set.

As for the off heater option, I am thinking of switching only channel 1 off with 2 still running continuously, is the use of local variable correct?

 

Thank you!

0 Kudos
Message 5 of 27
(14,438 Views)

Here's the VI

0 Kudos
Message 6 of 27
(14,436 Views)

Hi Shalalas,

 

I tried to integrate 4 thermocouples together to get the mean value at each timing, and im not very sure what i have done is correct. I want to use the mean value to compare with the maximum temperature that i set.

So you read an array of waveforms,, where each waveform contains samples of just one thermocouple.

Then you convert this array to a 1D array of DBL using this evil FromDDT function: which kind of data do you expect after the conversion?

Why use waveform datatype at all? Why not use waveform functions to read the samples and do the averaging afterwards?

 

As for the off heater option, I am thinking of switching only channel 1 off with 2 still running continuously, is the use of local variable correct?

No. You just set the locals, but never output their value to your device. Did you try simple debugging using the highlight execution mode?

 

On your VI:

- Using while loops inside the states looks wrong to me. Why not repeat the state until the user presses the stop button? ("IF (error OR stop) THEN next state ELSE current state")

- why do you need to initialize and de-init resources each time you go into state "measurement" and "heater on"? Why not do this once in an "init" state and clear all resources in the "exit" state"?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 27
(14,430 Views)

hmm to answer the second question, I would actually like the VI to auto run, i was hoping for the DAQ to run continuously and for the power source to respond along the way so i can keep collecting data of my temperature. Is having a state machine a bad idea?

0 Kudos
Message 8 of 27
(14,421 Views)

@Shalalas wrote:

Is having a state machine a bad idea?


No, State Machines are very useful.  But a general rule is that states should not have continuously running loops in them.  If you need a task to repeat, you just keep calling the same state.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 27
(14,412 Views)

State machines are extremely useful, but may be an over-complication for a simple temperature threshold evaluation.  Unless you are planning to add more complex functionality, something like this may work:

 

Thermostat.png

Message 10 of 27
(14,368 Views)