LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a switch to turn on/off when it hits a certain value?

Solved!
Go to solution

Hi, I cannot seem to find how to create a switch that will let me perform one operation (heat) once a thermocouple hits 20C, and then heat through to 132C.  As soon as the thermocouple hits 132C I need to switch to the other operation (cool), and cool down to 20C again, completing the cycle. While between 20C and 132C it needs to heat/cool depending on if it has just switched to heating or cooling.

 

I made my own, but I only managed to heat to 132C, and as soon as the value fell below 132C, it started heating again, which is where I need it to cool down.

 

Thanks for your help!

 

Andrew

 

P.S. I'm running Labiew 6.1, so I would prefer to have an explanation of what to do b/c some vi's may not work due to it being an early version. I'm also doing this for my internship, and am still in the early learning stages of using Labview. Thanks!

0 Kudos
Message 1 of 11
(8,882 Views)

Here is the code in a subVI I called Deadband.vi.  It was written in LV2009, so it uses the globally initialized feedback node.  But you could replace this with a while loop with a True wired to the stop terminal and use an uninitialized shift register.

 

This was written for a radiator cooling application, so for a heating application, you'd just have to reverse the turn on, turn off logic.  The subVI remembers its current state of the output.  If the current value is below the lower limit, it turns off the radiator fan.  If it is above the upper limit, it turns it on.  If neither, the current status of Off or On passes through.

 

Message 2 of 11
(8,867 Views)

adintern,

 

I'm trying to figure out what you really want to do so I can provide some ideas.

 

Do you want an automatic cycle that turns on heating or cooling depending on the temperature reading ?

 

Or do you actually want a manual switch that allows you to turn on heating or cooling (up to the temperature limits) ?

 

 

0 Kudos
Message 3 of 11
(8,865 Views)

There are a couple of things that are not clear from you description.

 

Should the switch be operated by the user? (e.g. a control to switch"heat on/off" in one state or "cool on/off" in the other state) or should it be an indicator operated automatically (cycling between heating and cooling, switching mode at each end).

 

No matter what, you need to keep a "state" in a shift register having two states (heat or cool) (a boolean as in Ravens code is sufficient if there are only two states, however you cannot copy it directly because LabVIEW 6.1 did not have feedback nodes, thus you need a shift register). Typically the code is easier to read and understand if you e.g. use an enum typedef for the state.

 

See how far you get. 🙂

0 Kudos
Message 4 of 11
(8,842 Views)

I am trying to get the vi to do it automatically. i understood most of Raven's, but the bottom icon that has a green arrow to the left has stumped me. as for the enum, what does that do/where do i find it? also how do i get a shift register?

 

Raven's also doesnt have 2 outputs that i can tell (I need one for it to heat, and one for it to cool, which are already set up). I've added an attachment showing what I could implement of Raven's w/ my knowledge so far.

 

I won't be able to implement anything until monday b/c i dont have labview on my computer.

 

Thanks for all the help! I really appreciate it!

 

still a labview newbie Smiley Tongue

 

 

0 Kudos
Message 5 of 11
(8,834 Views)

The arrow thingy is a feedback node and not available in 6.1. You can do the same functionality with a shift register, but you need an outer loop (which you most likely have). The enums are in the palette. Check the online help.

0 Kudos
Message 6 of 11
(8,830 Views)
Solution
Accepted by adintern

You create a shift register by right-clicking on the border of a loop.

 

Try something like this:

 

 

(some things will look differently in 6.1, e.g. the boolean diagram constants). See how far you get.

Message 7 of 11
(8,827 Views)
Thanks for your help all! Altenbach: that vi setup worked great! Thanks so much for your help! I'm finally able to run the experiment in a different way now :) Andrew
0 Kudos
Message 8 of 11
(8,726 Views)

Note that a simple boolean would have been sufficient to keep the state, since there are only two.

 

I still used an enum for the following reasons:

 

 

  • The code is better self-documenting. If the states are named logically, extra diagram comments can be avoided.
  • Most likely you would want to add a few more states later (e.g. "Pause", etc.). Having an enum makes the code scalable and it will be easy to add new states. (Make sure to save the enum as typedef so all instances will upgrade if you change the items in it)

 

0 Kudos
Message 9 of 11
(8,708 Views)

Hi,

I read your previous posts so i think you are the right person to ask my question.

 

Is there any way that i can make the shift register stop updating the value when i press a stop button or when the value reaches certain threshold?

 

In my vi, i want the the shift register on the right to stop updating new values or remain with the current values when i press a stop button . Could you please take a look on it? Thank you.

 

Sachet

0 Kudos
Message 10 of 11
(6,967 Views)