07-11-2024 09:11 PM - edited 07-11-2024 09:12 PM
I am overhauling a very clunky and haphazard LabVIEW program for controlling pressure inside a pressure vessel and temperature of a thermal chamber enclosing the pressure vessel. I am controlling pressure indirectly via flow rate: I have an electronically controlled air-driven pump to drive fluid into the vessel and increase the pressure, and an electronically controlled precision valve to bleed fluid out of the vessel and reduce the pressure. There are also electronically controlled on-off valves to divert fluid flow in different ways. Chamber temperature is controlled by an external PID controller; the LabVIEW program only sends/receives a temperature setpoint via serial comms for that external controller.
I have a "Profile Creator" subVI which is a GUI that generates (or loads from file) a sequenced test profile, which is a 1D array of clusters where each cluster is a set of parameters corresponding to a discrete test operation (increase pressure, decrease pressure, increase temp, decrease temp, hold). For example, the first operation might be "Increase pressure to 5000psi at a rate of 500psi/min," and the cluster has a bunch of settings to configure all the equipment for that operation. A basic test sequence might look something like:
1) Increase chamber temperature to 150deg and wait for pressure vessel temp to reach 145deg
2) Increase pressure to 15500psi at a rate of 500psi/min
3) Hold at 15500psi for 60min with failure below 15010psi
4) Decrease pressure to atmosphere at a rate of 500psi/min
5) Decrease chamber temperature to 68deg and wait for pressure vessel temp to reach 75deg
I am a self taught but experienced LabVIEW user and am very familiar with the design patterns (aside from actor framework...), but I'm having trouble deciding which pattern or combination of patterns makes the most sense for this application. I have done similar projects using a QMH architecture but ended up with 7 or 8 parallel loops for all the different tasks which became difficult to scale or maintain. I need the main program to be able to do the following, which again seems like it will become a mess of parallel QMH loops all trying to talk to each other (or themselves):
0) Event handler loop for HMI buttons
1) Continuously acquire and display pressure and temperature, calculate and display pressure rate of change
3) Manually control the pump, bleed valve, and temp chamber setpoint using buttons on the screen
4) Automatically control the pump, bleed valve, and chamber setpoint to run sequences of operations from the Profile Creator
5) Log data to file during an automated test
6) Continuously monitor for alarm conditions (overpressure, overtemp, etc) and abort test sequence/vent pressure/lock out components, etc.
7) Load/save various hardware/software settings from/to file on the fly
😎 Continuously write errors/operations to a system log
In particular I don't know how to best handle the pressure DAQ/control as I need both to run continuously and in sync but do different things depending on test/system conditions (manual vs idle vs a specific test operation etc). My first thought is a single timed loop state machine that continuously reads the sensors and test state and uses that data to drive the PID behavior, if that makes sense.
Any advice you guys have about how to best think about structuring this this would be greatly appreciated!