06-08-2016 05:32 PM
@rkmadse wrote:
Do you know of any examples of using "user-events" to update the gui with data? Or using "user-events" when errors are encountered so that the producer can determine how to handle the error?
There is a framework called the Delacor Queued Message Handler (DQMH) that is available as a free download on the LabVIEW Tools Network here.
This framework builds on the NI QMH project template, but makes extensive use of user events for inter-loop communication. There are DQMH tutorial documents and videos here.
06-09-2016 04:04 PM
@rkmadse wrote:Ok, I like the direction you are heading, but I'm still missing a piece I think to fully understand the logic/how-to. Do you know of any examples of using "user-events" to update the gui with data? Or using "user-events" when errors are encountered so that the producer can determine how to handle the error?
I'm using a c-DAQ-9178 with a 9205 module to sample the pressure transducers. I believe the sampling rate on those is 250 kS/s.
I have attached the error handler VIs I used in my last project. The "generate error event" would be dropped in line with each one of the loops that would send the error on. The error handler fgv (more an action engine in this case but whatever) then checks to see if the error is the same as the last one. If not it logs and prompts, as well as stores a screenshot of what the caller looked like for troubleshooting purposes.
06-09-2016 04:34 PM
Nice idea about taking a screenshot and saving that as well.
Question:
Should your error handler FGV be set for re-entrant preallocate clones on its execution page?
You said you'd drop that in several locations in your code, which makes sense. But if called from multiple places, the idea of using the shift register to determine if the error is the same as before or not falls apart because the different instances will be battling being no errors and/or different errors each time the FGV is called.
06-09-2016 04:55 PM
06-09-2016 06:37 PM
Got you. I understand better now. That makes sense.
06-29-2016 04:48 PM
So I'm have been studying QMHs and how to use them, and using user events (I still don't know how to send data within a user event). However I think my architecture isn't correct for what I am trying to do. Let me explain a little better:
My main confusion is this... If I want to always display the pressure transducer values continuously, how do I then grab data occasionally from the state machine loop when I need to check pressures for opening and closing valves? Is that the power of the action engine? That I can initialize the cDAQ AE in Loop 3 and always take measurements within Loop 3, but when I need to access a transducer value I can call get data from Loop 2?
Loop 1 (Main Producer, Event Handler Structure) - Handle events selected by the user from the GUI (start the test, load a sequence, grab inputs from user for testing, etc)
Loop 2 (Consumer, State Machine for Testing) - Recieve the start command from the user along with parameters to run the test)
Loop 3 (Secondary Producer, Read Data from Pressure Transducers Continually) - Reads the data from the analog inputs and passes the data to Loop 4 to be logged. If readings go out of range for certain transducers, throw an error or enter a safety case.
Loop 4 (Secondary Consumer, Data Logger) - Logs the data to a TDMS file.
I think I'm just missing a few minor details that will really take me into the next level of development and I don't have anyone to work with that I can simply ask to explain these things so I appreciate any help I can get.
Thanks so much.
Kellen
06-29-2016 04:53 PM - edited 06-29-2016 04:59 PM
Take a look at the Continuous Measurement and Logging sample project that ships with LabVIEW 2012 and later. I think it will give you some insight into how you can use the Queued Message Handler architecture to address some of the issues you're having. Go to File > Create Project and choose 'Continuous Measurement and Logging' and browse the project and included documentation.
06-29-2016 05:01 PM - edited 06-29-2016 05:03 PM
I don't have answer but I would like to compliment your UI design.
Mine always look like crap because I use the default Silver or Modern (or a combination of the two) elements.
I am not an artist and even the old "classic" UI elements look better than anything I can make.
07-18-2016 04:28 PM
Darren,
I am trying to implement the Continuous Measurement template, and it has the following.
1) Producer Event Case for GUI
2) Consumer for GUI to handle work.
3) A loop for data acquisition.
4) A loop for data logging
5) A look for Updating the GUI with data.
I need to implement a state machine that handles the opening and closing of valves after the person tells the test to run, should I try and combine Loop 1&2 and then have a new loop 2 handle all of the state machine work needed to run the test?
My main confusion comes from wanting to consinuously sample with one loop while only wanting to check the values that are being sampled periodically to determine whether or not valves need to open and close.
07-18-2016 04:36 PM
@rkmadse wrote:
I need to implement a state machine that handles the opening and closing of valves after the person tells the test to run, should I try and combine Loop 1&2 and then have a new loop 2 handle all of the state machine work needed to run the test?
I would make a new loop for the valve state machine. You can have it initialize in the 'Wait for Event' state, and use a User Event to tell the Helper Loop to start doing the valve stuff whenever the person tells the test to run. Once the state machine is done with valve stuff, have it go back to Wait for Event so it can wait to be messaged via the user event to go again.