LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structures

I have a PXI Chassis/DAQ/DMM and relay card running LABVIEW 2013.  The user has requested a mode where he/she can push buttons ( gui front panel booleans)  to cause certain things to happen on the UUT.  One of those things is to open/close an Orifice.  I have the code working indiviually to open ( close relay#1) and close ( close relay#2) the orifice.  When relay 1 is closed the dmm monitors the voltage ( increases) on the Orifice ( which is just a pot) and reports that value to display on the GUI.  When relay 2 is closed same thing only voltage decreases.  Relay 1 and 2 boolean buttons have to be held individually  in order for this to work.  Mech action is momentary.  Is there a way to use an event structure to get both the button to work and monitor the dmm?

So the scenario is user wants to open the orifice to a certain voltage.  They hold relay front panel gui button #1 down while watching the dmm until it gets to "v1".  They let the button go.  Now they want to close it.  They hold button #2 down and the voltage goes to "v2".  They let go. 

Do I/ can I use "mouse down"?  "mouse up"? 'value change"?  How do I only have one front panel voltage display for 2 different events? local variable?  Can I even use event structure?

Thanks.

0 Kudos
Message 1 of 5
(3,031 Views)

I would just use a seperate loop for reading the DMM.  Have a wait of something like 100ms inside of that loop.  This way you constantly get measurements from your every 100ms.

 

You then have another loop with your event structure that just look for the value change events of your buttons.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(3,010 Views)

@Clint1000 wrote:

I have a PXI Chassis/DAQ/DMM and relay card running LABVIEW 2013.  The user has requested a mode where he/she can push buttons ( gui front panel booleans)  to cause certain things to happen on the UUT.  One of those things is to open/close an Orifice.  I have the code working indiviually to open ( close relay#1) and close ( close relay#2) the orifice.  When relay 1 is closed the dmm monitors the voltage ( increases) on the Orifice ( which is just a pot) and reports that value to display on the GUI.  When relay 2 is closed same thing only voltage decreases.  Relay 1 and 2 boolean buttons have to be held individually  in order for this to work.  Mech action is momentary.  Is there a way to use an event structure to get both the button to work and monitor the dmm?

So the scenario is user wants to open the orifice to a certain voltage.  They hold relay front panel gui button #1 down while watching the dmm until it gets to "v1".  They let the button go.  Now they want to close it.  They hold button #2 down and the voltage goes to "v2".  They let go. 

Do I/ can I use "mouse down"?  "mouse up"? 'value change"?  How do I only have one front panel voltage display for 2 different events? local variable?  Can I even use event structure?

Thanks.


Might I (politely) suggest that this is a poor design?  What happens if the User is distracted and doesn't notice that the DMM has gone way past V1?  What happens if the User pushes both Button #1 and Button #2?

 

It seems (naively) to me that you have the following scenario:  (a) A control ("Orifice") that is monitored and produces a voltage corresponding to Open and Closed states, (b) a DMM that measures the voltage reading from the Orifice, (c) a settable (or "known") voltage V1 that corresponds to the Open state, (d) a settable voltage V2 that corresponds to the Closed state, (e) a Relay Button #1 that you push to open, and (f) a Relay Button #2 that you push to close.

 

As you describe it, the Operator has to manually "drive" the Orifice by pushing and holding Button 1 (to open) or Button 2 (to close) until the DMM reaches V1 (for opening) or V2 (for closing).  Note I'm assuming that V2 > V1.  There is nothing preventing the Operator from pushing the wrong button, i.e. pushing V2 when the Orifice is fully closed (with unspecified consequences).

 

A much safer design, it seems to me, would be to add two "Set Point" controls, "Open Voltage" and "Close Voltage" representing V1 and V2.  Design your VI so that Relay Button 1 and Relay Button 2 are "Latch when Released" that respectively increase (open) or decrease (close) the Voltage, keeping it in the range [V1 .. V2].  Thus if the Orifice is Closed (and the Voltage is at V1), pushing Button #2 will "do nothing" because the Voltage is already at the "fully closed" position.

 

This kind of code is, I submit, simpler to write than your earlier description.  In a Producer/Consumer (Event) Design, the Consumer can be a simple State Machine with states Idle, Opening, and Closing.  You could easily add a "Panic Stop" button that could "interrupt" the motion of the Orifice ...

 

Bob Schor

0 Kudos
Message 3 of 5
(2,996 Views)

I would say, buttons with switch untill released action. Event structure with value change events that fire relays open/close commands. Obviously you need to check if these commands are valid before acting on relays.

A few notes

If you already have the control software, best solution for this new feature depends on it structure. 

Necessary safety software features in program depend on hardware capabilities. In general case you need to have safe voltage range and switch relays off if voltage gets to limits, safe state, emergency off button, etc. 

 

Best implementation of this feature depends on how users operate with the system.

Is it better to have user look at DMM and release button when orifice is open?

Yes, if voltage levels always change, orifice needs to be half-open, operator makes decision, based on another parameter, not available in software.

 

Or is it better to have command "Open!" and "Close!", when software controls relays depending on current voltage and automatically stops orifice.

It demands less from operator, more from the software.

0 Kudos
Message 4 of 5
(2,969 Views)

Agree whole heartedly w a poor design.  No excuse but it was one I inherited and they are set in their ways and refuse to chg it.  I've already seen the pot go all the way to one stop or the other and the user has to manually rotate it to free it up.  There is more to the circuit than I described here.  I thought w a high level explaination I could get a yes or no on using event structures to do what I wanted.

Over the holiday break I was able to resolve the problem on my own...Thanks everyone..

0 Kudos
Message 5 of 5
(2,844 Views)