LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine if a user clicked a boolean or if a variable changed it

Solved!
Go to solution

Hello,

 

I am trying to set up a system to mimic behavior of a system we are replacing. The system has 3 different temperature controllers, the previous program had it such that each temp controller can be activated individually or there is a separate button that could shut all off or turn all on. I have been able to get it to turn on the all temp button when any of the 3 individual ones are hit, and turn off if the stop all is pressed, but because the start all is triggered it automatically turns the rest on. The old program is not labview.

 

TimHennesy_0-1717524438575.png

 

TimHennesy_1-1717524460871.png

 

TimHennesy_2-1717524478953.png

 

the code that has issues

 

TimHennesy_3-1717524523041.png

 

0 Kudos
Message 1 of 10
(729 Views)
Solution
Accepted by TimHennesy

I think i got it, this diagram below where all the not shown cases are just straight pass through wires.

 

TimHennesy_0-1717525946653.png

 

0 Kudos
Message 2 of 10
(724 Views)

@TimHennesy wrote:

Hello,

 

I am trying to set up a system to mimic behavior of a system we are replacing. The system has 3 different temperature controllers, the previous program had it such that each temp controller can be activated individually or there is a separate button that could shut all off or turn all on. I have been able to get it to turn on the all temp button when any of the 3 individual ones are hit, and turn off if the stop all is pressed, but because the start all is triggered it automatically turns the rest on. The old program is not labview.



Tim,

 

Based on what you've described, I think you should look into a state machine. I feel like it would be a great candidate for that and has the flexibility that you want.

 

Eric

0 Kudos
Message 3 of 10
(684 Views)

Hi, I'm pretty familiar with them, the program this is part of is structured as one, but I don't really see how that alone would get the behavior I was looking for, would you please elaborate on how you would do it differently?

0 Kudos
Message 4 of 10
(680 Views)

Take a step back and REALLY think about what events happen in the program that you already have and the one you are trying to mimic. You already have a Initialize (Start) and Quit (End) states and you probably didn't realize that. There's two right off the bat.

 

You state in your initial message that you have "a separate button that could shut all off or turn all on". Right there could be two button press events. It looks like you have three check boxes in the screen captures you provided, do those do something? If so, there's three more.

 

I already have seven cases and I haven't even written any code yet:

  • Initialize
  • Apply All Temp
  • Stop All Temp
  • Checkbox1
  • Checkbox2
  • Checkbox3 (whatever the check mark boxes do)
  • any other events?
  • End (Quit)

 

Each event could do something (or multiple somethings). That's the beauty of state machines. They are flexible and get you into some intermediate to lightly advanced programming techniques. I'd use the Event Driven State Machine - look for the State Machine Fundementals.vi in the Example Finder and study that.

 

Come back to us if you get stuck. All of us are here to help. Also, make sure you load your VI. That way, we can see what you have done and offer suggestions.

 

 

0 Kudos
Message 5 of 10
(665 Views)

So originally I looked at doing this as a state machine but I had not previously used event structures, those are actually pretty neat now that I have messed with one. It appears to be able to ignore variables changing on their own and appears to only wait for user input to change them.

 

But, I'm not sold on it being the better way for this, yes it is possible but takes alot more code in my opinion.

 

Attached are the 2 to get the same functionality in the button behavior. If I had more to do with each button it would probably be better. 

 

That said, this is running on a rio and they apparently hate event structures, and i think a state machine not using the event structure would be way more to make work as that was the path i initially traveled down, so probably just sticking to my boolean shift registers for this. 

 

If you have any way to do this same thing with no event structure and as a state machine i would be very interested in hearing about it.

 

Download All
0 Kudos
Message 6 of 10
(626 Views)

@TimHennesy wrote:

But, I'm not sold on it being the better way for this, yes it is possible but takes alot more code in my opinion.

I can not open your VIs because I have an older LabVIEW version. 

I attach my try on your code from message 2 with an event structure, in my opinion with almost no code.

I can not comment on an event structure on a rio target.

 

0 Kudos
Message 7 of 10
(571 Views)

I did not know you were using a CRIO for this. That might change things. I have never used a CRIO before so I do not know if you can use a state machine with that. I would have to defer to other forum members.

0 Kudos
Message 8 of 10
(521 Views)

Also, convert your VIs down to likely version 18 (LabVIEW 2018).

 

If memory serves, go to File - Save For Previous Version, choose 18.0, and repost. It should look similiar to my screen capture (I'm using LabVIEW 2021).

 

Eric1977_0-1717682955966.png

 

0 Kudos
Message 9 of 10
(517 Views)

I would recommend to use a cluster of controls. Makes life easier:

 

altenbach_0-1717701715933.png

 

Message 10 of 10
(501 Views)