06-04-2024 01:10 PM
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.
the code that has issues
Solved! Go to Solution.
06-04-2024 01:33 PM
I think i got it, this diagram below where all the not shown cases are just straight pass through wires.
06-04-2024 02:41 PM
@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
06-04-2024 02:45 PM
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?
06-04-2024 03:02 PM - edited 06-04-2024 03:06 PM
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:
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.
06-04-2024 05:31 PM
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.
06-05-2024 01:56 AM - edited 06-05-2024 01:57 AM
@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.
06-06-2024 09:05 AM
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.
06-06-2024 09:09 AM
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).
06-06-2024 02:22 PM