LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset one or more boolean switches based on another boolean switch.

Solved!
Go to solution

I am a newbie to Labview and am currently in the learning-by-doing phase. I have a very large project which I am building in smaller blocks (subvi's). 

 

I have a high pressure, high temperature reactor which has various gas lines as inputs. Each gase is controlled with a magnetic valve and then a flow controller. Each valve is turned on with a boolean switch which also activates the select case and further control. In the case that I have thermal runaway, certain valves need to be turned off, but not all of them.

 

A boolean indicator shows me the status of a flare. If this is false, certain switches must be turned off and others on. I have set the default setting for all to off. I have also seen the possibility to invoke a node and select reinitialise to default which would do exactly what I need but I cannot see how to wire this.

 

Sorry I have no code, as I am just testing this buidling block with a few boolean switches at present.

ANY help would be great. Many thanks.

 

Update: The attatched file shows what I mean, I hope.

0 Kudos
Message 1 of 11
(212 Views)
Highlighted

Hi vtiu,

 


@vtiu wrote:

I am a newbie to Labview and am currently in the learning-by-doing phase. I have a very large project which I am building in smaller blocks (subvi's).


I hope you are just new to LabVIEW, but not to programming in general…

(Doing a larger project in smaller stapes is perfectly fine!)

 


@vtiu wrote:

Each gase is controlled with a magnetic valve and then a flow controller. Each valve is turned on with a boolean switch which also activates the select case and further control. In the case that I have thermal runaway, certain valves need to be turned off, but not all of them.

 

A boolean indicator shows me the status of a flare. If this is false, certain switches must be turned off and others on. I have set the default setting for all to off.


You describe several states, with actions of each state. There are probably even more states to be considered with your reactor setup.

So when you hear about "states" and "conditions" then you should automatically think of "state machines"!

LabVIEW comes with ready-to-use example projects, one of them being a simple state machine…

 

On this image:

  • Don't use locals, when the wire/terminal is available next to it.
  • You don't want to "ReInit to default" while running some states inside your state machine VI…
  • Learn about boolean operations to handle things like "IF lockdown is TRUE THEN Heater1/2=FALSE". This basically ends up in a "HeaterOutput:= heater AND NOT(lockdown)" operation…
  • Your block diagram should not span more than one computer screen, so their terminals should not be "far apart" on the block diagram!
Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 11
(183 Views)
Highlighted

Thank you for your reply.

 

I am not new to programming but come from a Lookout background. We are forced to upgrade to Labview due to the use of Windows 10.

 


@GerdW wrote:

 

  • Don't use locals, when the wire/terminal is available next to it.

I understand but this is just a test vi to find the correct method to do what I want. In my real VI, the wire is not in the near.

 


 

  • Learn about boolean operations to handle things like "IF lockdown is TRUE THEN Heater1/2=FALSE". This basically ends up in a "HeaterOutput:= heater AND NOT(lockdown)" operation…
  • Your block diagram should not span more than one computer screen, so their terminals should not be "far apart" on the block diagram!

The point of the Lockdown "Flag" is to turn off/reset but return user control after that. If I bind the "Flag" to the Heater Start/Stop, I will not be able to turn it on again until Lockdown is false. Example: Reactor is at temperature - Lockdown activates - Heater is turned off - User can turn on after cooling a little so as not to damage the content in the reactor. Hopefully clear.

 

As I said, I am building the VI and then moving parts to SubVI's when they are working, which also answers the second comment.

 

My whole project consists of two VI's, one for data display/logging (working) and the second for control.

 


You don't want to "ReInit to default" while running some states inside your state machine VI…

Okay but why not if I don't use state machine? Sorry I don't understand.

 

Best Regards

Mark

0 Kudos
Message 3 of 11
(176 Views)
Highlighted

Hi vtiu,

 


@vtiu wrote:

The point of the Lockdown "Flag" is to turn off/reset but return user control after that. If I bind the "Flag" to the Heater Start/Stop, I will not be able to turn it on again until Lockdown is false. Example: Reactor is at temperature - Lockdown activates - Heater is turned off - User can turn on after cooling a little so as not to damage the content in the reactor.


That "Lockdown flag" is bound to some conditions, like "flare" is TRUE/FALSE.

You set "Lockdown" to TRUE, when the reactor has reached its temperature setpoint. When the temperature falls below the setpoint, will the "Lockdown" be FALSE again?

 

My point is: there are some user controls, like "Heater ON/OFF". And there are some other conditions, like "reactor is hot", which result in "Heater == OFF". In the end you need to combine user controls with your safety conditions: this will be boolean operations as all your inputs (user and other conditions) are boolean data. Your user may try to switch ON the heaters as often as they want, but your safety conditions will override their input when needed…

 

Why don't you want to use a state machine approach? Which kind of algorithm/program design is more suitable to you to handle safety conditions along with user inputs?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 11
(170 Views)
Highlighted

Hi,

 

You are right. I am still a long way from working out all the safety conditions. I am just trying to work slowly through Labview and understand logically what I am doing.

 

Sometimes it just helps talking to someone who knows what I am on about.

 

I have a solution which is maybe not the best but it seems to work - for me at least. I can turn off and disable a switch based on the Lockdown "Flag". Later I can wire direct and not use a global variable.

 

The false option just enables Test Switch.

 

This will at least enable me to continue but I will keep the state machine in mind when I am creating the final control panel. How all the building blocks fit together will be my problem in the coming weeks.

 

 

0 Kudos
Message 5 of 11
(160 Views)
Highlighted

Hi vtiu,

 


@vtiu wrote:

I have a solution which is maybe not the best but it seems to work - for me at least. I can turn off and disable a switch based on the Lockdown "Flag". Later I can wire direct and not use a global variable.


Please try to follow the StyleGuide (found in LabVIEW help) right from beginning: straight wires, not hidden under other structures…

 

You use a SharedVariable in this image, not a global variable: why do you even need this?

Please keep this in mind: in LabVIEW the wire is the variable! (Read up on "Think DATAFLOW" in the LabVIEW help.)

 

Other items:

  • Use descriptive control labels. Right now the control "Flare simulator" is commented as "Flare Simulator=ON when flare is out/off" which is quite irritating (because of inverted logic). Why not label that control as "Flare problem" (or similar)?
  • Using a "Value (signalling)" property might have side effects once you use Event structure. Keep that in mind!
  • Right now there is a race condition between this very property node and the terminal of the button: The user might switch that button, and the property node sets a new value. Which value will be read from the terminal? Please read about race conditions in the LabVIEW help!
Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 6 of 11
(156 Views)
Highlighted

@vtiu wrote:

Sometimes it just helps talking to someone who knows what I am on about.

 


It's called rubber duck debugging. Just the process of trying to explain the problem to us can sometimes help you clarify your thoughts. 😉

 


@vtiu wrote:

I have a solution which is maybe not the best but it seems to work - for me at least. I can turn off and disable a switch based on the Lockdown "Flag". Later I can wire direct and not use a global variable.

 


As a first step, stop attaching truncated images and attach the Vi directly!

 

(What's in the other case? (you're setting properties in the true case, where are they reset?) Where's the toplevel loop (or are you using "continuous run")? Do you know that you can combine your property nodes into one? What's the point of a network shared variable? As has been said, a signaling value property only has purpose if there is an event structure somewhere. Where is it? Why is nothing connected to the test switch? Glaring race conditions!  So. Many. Questions!)

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 11
(128 Views)
Highlighted

It's called rubber duck debugging. Just the process of trying to explain the problem to us can sometimes help you clarify your thoughts. 😉

 



Thats a new term for me, never heard of that before.

 


As a first step, stop attaching truncated images and attach the Vi directly!


Ok, sorry, point taken. I will remember this for future posts.

 


(What's in the other case? (you're setting properties in the true case, where are they reset?) Where's the toplevel loop (or are you using "continuous run")? Do you know that you can combine your property nodes into one? What's the point of a network shared variable? As has been said, a signaling value property only has purpose if there is an event structure somewhere. Where is it? Why is nothing connected to the test switch? Glaring race conditions!  So. Many. Questions!)

 

 


The properties are reset in the False case. Property nodes I have now grouped - thank you.

This is a building block and therefore has no toplevel loop - "continuous run" to test.

Shared variable is now gone - wired directly.

There is an event structure in my "master" VI but here I am only dealing with "my Problem" with the switch. As I solve one part of the control, I can implement it in my master VI.

 

So. Many. Questions!  Yes I know, from my side as well but I will keep trying.🙂

 

I really appreciate the help but I am only just taking my first steps in Labview and have a very complicated system to control. This will definately not be my last post looking for help.

 

Best regards

Mark

0 Kudos
Message 8 of 11
(102 Views)
Highlighted

After making all the changes, this shows the functionality which I require. The principle I can implement in my master VI.

 

Best Regards

Mark

0 Kudos
Message 9 of 11
(98 Views)
Highlighted
Solution
Accepted by topic author vtiu

You still don't have a top level loop. Are you using continuous run?

You still don't have an event structure, so a signaling value property seems incorrect. Just use a local.

The disabled property is in both cases, so a single instance belongs outside the case.

 

Here's how it could look like.

 

altenbach_0-1605869202125.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 10 of 11
(86 Views)