LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do this on/off program?

Solved!
Go to solution

Hello,

 

I need to turn on a ventilator when the temperature gets to 65°C, and then only turn it off when the temperature gets to 55°C. Basically I need to turn it on with a higher value, and turn it off when it gets to a smaller value. I tried everything that I could, and none made this happen. 

The image shows what I have right now. I have a PT100 that convert the temperature to voltage, and then I have to multiply the voltage to a specific number (60,1403.. in this case - linear coefficient) to know the temperature in Labview (minus the offset of each PT100). Then I put two exits in the module c-daq 9178. If the temperature is greater than 65°C, it turns one port of the module on, and if its smaller than 55°C it turns another port on. But i don't want it like this, because between 55°C and 65°C both ports are off, and i can't do anything with that. So, everything is wrong. I hope you can help me.

0 Kudos
Message 1 of 10
(3,546 Views)

I would use shift registers to get information about the pervious state of the system. That will let you turn on the vent when the value is greater than 65 and the previous value is less than 65 and turn it off when the current value is less than 55 and the previous value was greater than 55. If neither of those two conditions are met, simply use the previous state of the boolean.

 

http://www.ni.com/getting-started/labview-basics/shift-registers

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 10
(3,537 Views)

I did this and it didn't work.

0 Kudos
Message 3 of 10
(3,499 Views)

Can you attach your code?

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 10
(3,493 Views)

There is it. I haven't found a way to put the 55 code in it. How would I do it?

0 Kudos
Message 5 of 10
(3,486 Views)
Solution
Accepted by topic author vsmundim1234

Hi 1234,

 

seems very easy to me:

check.png

Did you ever tried to create your algorithm on a sheet of paper?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 10
(3,466 Views)
Solution
Accepted by topic author vsmundim1234

You don't have a "binary" (two-choice) situation, you have a "ternary" (three-choice) one -- do one thing when temperature is below 55, do another thing when temperature is above 65, and "keep doing the same thing" otherwise.

 

You have a "binary" action, namely the Ventilator is either On or Off.  One easy way to handle ternary situations is to use a Shift Register to hold the current Action (On or Off).  You now need two tests -- if the Temperature is <55, change the value on the Shift Register to Off, else (if the Temperature is >65, change the value on the Shift Register to On, else leave it alone).

 

Can you construct such a code?  You'll need a Loop (to hold the Shift Register) and two Case Statements with appropriate "comparitors".

 

If it works, you're done.  If it doesn't work, feel free to come back and attach your VI (do not attach a PNG picture of the Block Diagram -- we want to be able to edit your VI and to run it ...).

 

Bob Schor

 

Message 7 of 10
(3,464 Views)

Hi GerdW,

 

I'm sure it's simple for people that have the necessary knowledge of that. I don't understand automation as such, and i was just needing help. I'm sure I will need much more help for "simple things" like this one. 

 

Thank you.

0 Kudos
Message 8 of 10
(3,447 Views)

Hi Bob Schor,

 

Thank you so much for your explanation. As I said, i don't understand automation properly, but i'm learning slowly. You are very attentive and aren't ignorant with people that are new in this big world of automation.

 

Thank you so much.

0 Kudos
Message 9 of 10
(3,445 Views)

Hi 1234,

 

I don't understand automation as such

That's not related to such an understanding at all.

To start programming doesn't mean to start coding (in LabVIEW) - it means to think about the problem, to analyze the problem, to break up the problem in subproblems and then create an algorithm on a sheet of paper. When you have an idea of your algorithm you can start to create it in LabVIEW.

If you would have done it in this way you should have come up with a solution similar to mine…

(Having some understanding of or experience in "automation" might be helpful too as you requested a "simple control with hysteresis behaviour".)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(3,425 Views)