LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature Control using State Machines

Hi,

 

I am very new to labview and I am trying to build a VI using state machines to control temperature, I need it to have an automatic mode and a manual mode. I have a random number generator creating the temp and I am trying to get it so that if its above a certain temp it goes to one state or if its below a certain temp it goes to another state, is anybody able to help with getting something like this wired up?

0 Kudos
Message 1 of 11
(700 Views)

I would start with the learning resources listed at the top of the forum for the basics, then see how far you get. If you get stuck, post what you have and we will point you in the right direction. You can also search the forum for examples and solutions.

 

A "temperature control" is always automatic and the user only sets the desired temperature. Can you describe what you mean by "manual mode"? (e.g. just turn the heater on or off irrespective of temperature?)

 

A temperature typically varies slowly over time. How are you planning to simulate it?

0 Kudos
Message 2 of 11
(681 Views)

Hey, thanks for the reply.

 

Yeah the manual mode would be if the user pressed a button to bring it to manual and then it let them either turn on a heater to bring the temperature up or a cooler to bring it down.

0 Kudos
Message 3 of 11
(652 Views)

I don't seem to have access to the learning resources as my licence is through my university so I have been using youtube but can't find solutions to what I need.

0 Kudos
Message 4 of 11
(609 Views)

https://learn.ni.com/learn/article/labview-tutorial

Try this link. It will provide you with the basics to make an attempt at your homework project.

0 Kudos
Message 5 of 11
(593 Views)

When you share your VI and as far as you have gotten, you will receive help and guidance. 

You said you had no access to the resources. I've linked you to the free resources.

I look forward to seeing your VI. 

0 Kudos
Message 6 of 11
(578 Views)

This is my current VI, I have it working automatically, I just need to add the manual mode now.

0 Kudos
Message 7 of 11
(558 Views)

I suggest you to create a separate VI for the manual mode. 

Usually I start on the manual mode, because you can use it to add all functionalities of your system in one panel. 

The way to implement the manual mode, can be one big while loop with all the controls / indicators in it. But depends on how your heater/coller works. I will assume that using boolean controls you turn them on/ off. Turn it into a Subvi and call it from the main vi using a simple case structure. 

 

 

 

0 Kudos
Message 8 of 11
(551 Views)

Hi ccassidy,

 


@ccassidy85 wrote:

This is my current VI, I have it working automatically, I just need to add the manual mode now.


You need to do a lot more than "just add something"…

 

You need to:

  • use less/no local variables, use the terminals instead!
  • Don't use while loops inside the cases! You already have one while loop around the case structure and that is all you need for a state machine!
  • There should be a wait inside the parallel while loop…
  • There should be a wait inside your statemachine loop…
  • Typedefine your enum and use the same typedef for all instances!

 

Example for one state:

No inner loop, no local variable. (Wait function still missing.)

 

On your "manual mode": the use should be able to switch the heater on/off, so you just need a button. And there should be a button to be able to switch to automatic mode…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(521 Views)

Hi ccassidy,

 

I made most of the stuff mentioned in my previous message myself.

You need to implement your "manual" conditions on your own…

 

More suggestions:

  • I keep statemachine data in several shift registers: usually I would use a (typedefined) cluster to hold all this data in a single shift register…
  • For gauges/sliders/charts you can enable a digital display, so you don't need an additional indicator to show the very same data! (Already done…)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(523 Views)