10-04-2018 11:21 AM
Hi all,
I just had a question in regards to the test sequencing for an application I have built and wanted to see what ideas you had for modifying the program. Basically, I have an application that runs several Vi's that monitor and control a compressor unit that is inside of a thermal chamber. I am recording Amperage, RPMs, Temperature, run-time, and backpressure of these 6 units, and the program has 19 steps per cycle so that every time the 19th step completes, the program jumps back to the 1st step, and adds 1 to the cycles. (Sorry I know this is a bit ambiguous without screenshots). Anyway, I am having issues with the synchronization between my test sequencing and my thermal chamber as the chamber often varies in how long it takes to fully saturate to a set temperature. I was curious if anyone had an idea as to how I could have each test sequence suspend until the chamber reached a certain temperature, then proceed, or continue on a certain sequence until the chamber reaches the desired temperature, then proceed. Would this be executed using an event structure, or is that for the front panel only? Any thoughts or suggestions would be helpful, just trying to brainstorm here and see what various options I have.
Solved! Go to Solution.
10-04-2018 11:23 AM
Event structures are for user interactions. All you need is a state machine that changes states based on measured conditions and a way to communicate states between your various processes.
10-04-2018 11:28 AM
+1
I would personally suggest the JKI State Machine template. Get it on VIPM.
10-04-2018 11:35 AM - edited 10-04-2018 11:37 AM
Of course I can't see how your program is written, but you should be thinking in terms of "N" steps, not 19 steps.
A state machine would suit you well. This is usually just a case structure inside a while loop with a string or enum input. You could have cases like
set temperature --> check temperature --> start test
You would loop on the check temperature with some wait time (100ms for example) and wait until it reaches your set temperature or close to it. It could also be useful to loop between a check temperature and check interrupt state so you could cancel or change the test if needed.
Event structures do handle user interactions, but could also be software triggered. These are called User/Dynamic Events, and can be quite useful, but I don't think you want them for this application.
10-04-2018 12:02 PM
Good thinking. I believe I can edit this in or around my pre-existing state machine for test sequencing. I am going to give this a shot.
10-04-2018 02:00 PM
I would recommend using a State Machine and a Queue to push the sequence into the state machine, this way you can run any state as 'sequenced' by the que. Additionally, the que can contain the state and the parameter, so for example: SET::TEMP=120 would be the queue 'command' and call the TEMP state and provide the control temperature.