Hello Everyone. I'm relatively new to LabVIEW and this forum has been of great help. So thank you all.
To make things short, I'm trying to make an extremely simple VI in which I use a Button to Start and stop the PID control of a Laser. This is, because I only need to control the laser until it reaches the setpoint, the Laser then uses an already implemented external feedback control to lock on to the current level 1.5s after the last register update and remains stable. The laser only works with current level % as input, but I want the user to input the desired Power, thus why I added a PID to reach the SP.
The controller and gains are now optimized and everything works as it should when implementing it through the main while loop, with a case structure and an ON button. However, I added an extra while loop because I want to implement a simple state machine and want to move to the next state when the while loop ends. For some reason, (which will seem rather obvious to most of you) the second while loop implementation doesn't seem to work.
I'm attaching the current working implementation with a simple case structure, the non working VI with two while loops, and a modified General PID Simulator VI to demonstrate what I want to achieve (also working as intended). If the second while loop as an end condition to switch states in a state machine design is not a good idea, please also let me know an alternative. Furthermore, If you spot any mistake, please also let me know.
Solved! Go to Solution.
Furthermore, If you spot any mistake, please also let me know.
Why do you need an inner loop to implement a state machine when you already have an outer loop?
Hi Gerd, thank you for your reply. You are absolutely right. I just assumed it was the case because the controller didn't seem to update, so I figured the state was only running once and not updating the exit condition, but it was rather a communication issue. I made a new state specifically for the control loop and it was more than enough.
I will leave the post up in case it helps anyone with the same goofy mistake.