11-10-2015 05:10 AM - edited 11-10-2015 05:24 AM
Hi,
I am trying to add more than one event specifiers in a event case with the event of Value Change. But I see that when there is a value change in one of the event specifiers the case is activated. But I need to have both conditions true, only then my execution structure should be activated. What should I do in this case?
Should I add a nested event structure or any other ideas?
Any suggestions?
Thanks!
11-10-2015 05:27 AM
Events are handled one at a time by definition, so they can't be ANDed. If there is more than one event at the same time, they are placed in a queue and handled sequentially.
You didn't say what you actually want to do, but if you want one event to depend on the other, my suggestion would be to raise a flag when event A happens and to look at the value of that flag when event B happens. This can simply be a value in a shift register. For example, if you want to detect mouse movement when the mouse button is pressed, you can use Mouse Down/Up to set the flag and then check the flag in the Mouse Move event.
Nested event structures are a terrible idea because of the way LV registers and handles events and how the structures interact with each other. It is possible in principle to make them work if you know exactly what you're doing, but I never had a case that needed this.
11-10-2015 05:46 AM
ok, to be more specific, there is a syringe pump which is activated when there is a change in volume and flow rate. It should either withdraw or dispense liquid only after the change in both parameters, volume and /or flow.
11-10-2015 06:15 AM
Is it AND or is it OR you want?
11-10-2015 06:17 AM
having both AND/OR is my requirement
11-10-2015 06:42 AM
If you want to perform an action only when both values were changed, then keep two boolean flags (this can be a 1D boolean array). When one of them changes, you set the relevant boolean to T. When both booleans are T, you do your action and set both booleans to F.
If this still doesn't help you, you will need to include more details and actual code for what you want.
11-10-2015 07:31 AM
Hi,
Am not able to catch your idea. I attached my vi, in which I have only 2 parameters for now. But going forward I need to include more than 10 of those!
I need to activate my pump 1 or 2 based on choosing parameter and then I need to do check for latest volume value inside the executing case structure. With this I need to check Flow, if >0 then Aspirate, else dispense.
kindly find my vi attached!
Thanks
11-10-2015 08:46 AM
I do not understand what you want to do. Here is my (partial) understanding, with questions:
What is not clear is the timing of the pumping action. One possibility would be the following:
Is this what you want to do? If not, please clarify further.
Bob Schor
11-10-2015 12:14 PM
Like Bob said, you definitely need to define better how you want the system to behave, because maybe it's clear to you, but it certainly isn't clear to me. I would also suggest you go through some tutorials and exercises, as you will need that.
Some comments on your code:
Again, go through the tutorials and examples. Look at different architectures. You're only dealing with the UI here, but if you have actual pumps, you will probably also need to communicate to them, which will make the code more complicated.