09-30-2014 11:49 PM
I have a puzzle on the execution of two parallel event structures. See attached snapshot and vi.
The two two parallel event structures sit in two individual while loops. When event "mouse down" happens on numeric1, it will take 10s waiting in that case. Meawhile, if event "mouse down" happens on numeric2, there is no response until the first event structure "mouse down" case finishes.
This mechanism seems against the parallet running mechanism since the two while-even loops has no relationship.
Thanks.
WT
Solved! Go to Solution.
10-01-2014 12:16 AM - edited 10-01-2014 12:18 AM
@weitong wrote:
I have a puzzle on the execution of two parallel event structures. See attached snapshot and vi.
The two two parallel event structures sit in two individual while loops. When event "mouse down" happens on numeric1, it will take 10s waiting in that case. Meawhile, if event "mouse down" happens on numeric2, there is no response until the first event structure "mouse down" case finishes.
This mechanism seems against the parallet running mechanism since the two while-even loops has no relationship.
Thanks.
WT
What happening is perfecty correct as per the configuration. If you want to get what you expect, go to the 1st event structure "Edit Event" and uncheck the "Lock front panel" option.
10-01-2014 12:53 AM
While Anand is of course correct, you need to redesign your code from scratch. It is generally a bad idea to trap event structures with code that takes a long time to finish (long wait, intereactive while loop, etc). Just handle the event immediately and keep track of time if you want to discard certain events for a certain time interval. What good is an event structure if you tie it down with other stuff so it cannot react to events?
It also does not make sense to have a local variable in the upper loop. In fact you should combine the timeout and mouse down event, because they have the same code, right? No need for local variables. remove the internal wait. You should also use only a single stop button. Place a stop event case insode both event structure so both loop stop whren it is pressed.
10-01-2014 01:51 AM - edited 10-01-2014 01:52 AM
Thanks to both of you.
The vi is only a demo of the question.
Actually, for the first event stucture, I wish to track Liquid Helium level in a cryostat per 30 mins regularly at the timeout case. The mouse down event is only for the purpose that one wish to know the current LHe level immediately.
The second event structure is to do some physical measurement (resistance, temperature) task with user's interaction.
WT
10-01-2014 07:08 AM
@weitong wrote:
Actually, for the first event stucture, I wish to track Liquid Helium level in a cryostat per 30 mins regularly at the timeout case. The mouse down event is only for the purpose that one wish to know the current LHe level immediately.
Be very careful with that setup. If an event happens, your timeout is reset. So you can't really depend on the timeout case to consistantly time something.
10-01-2014 08:34 AM
Thanks, I got the idea.
WT
10-01-2014 11:03 AM - edited 10-01-2014 11:16 AM
But measuring the helium is a quick operation, right. It does not take as long as your demo events seem to imply.
If you want to keep the original timing of the timeout event, even if other events occur, you can manipulate the timeout so it maintains it's approximate phase. My old example from 2005 is described here.