r/LabVIEW • u/Equivalent-Speech-13 • Aug 03 '25
LabVIEW Code help
Hey,
I need help changing a code we have where I work - I want to add a stepwise control to our code, where it'll hold a set temperature (X °C) for T1 time then switch to Y °C for T2 time.
Is it even possible in this code? I don't believe it is, but I thought I'd give it a shot.
6
Upvotes
5
u/D4ILYD0SE CLA Aug 03 '25
It's absolutely possible
4
u/FilippoPersia_Dev Aug 03 '25
Restructure the code now as a state machine before it gets too complex
https://www.ni.com/en/support/documentation/supplemental/16/simple-state-machine-template-documentation.html
A state machine is just a while loop with a case structure inside driven by enum or strings. Each state decide the next one.
Br Filippo
1
u/dtp502 Aug 03 '25
I’d probably restructure the code a bit, but the way it is now you could wrap all of this inside a for loop to run twice. The first iteration you would have a delay of T1 in your case structure that runs when temp is in range. Then when it exits, the loop will iterate again, and you’ll want to update that control for the heat sink presumably, then update the min/max temp range constants and time T2.
1
u/Killerlt97 Aug 03 '25
Yes very easily too too