LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using an event structure with no user input

Hi all,
 
Please check out this sub-vi. My company builds ovens and this is a piece of code that uses GPIB to monitor a power meter. current > 2 amps means the heating element is on, current < 2 amps means the element is off. I need to continuously monitor Watt-hours and temperature and grab those values at certain times during the on/off cycling of the element.
 
My frustration is coming from not being able to grab those Wh and Temp. values right when I need them. I have to grab the values at the beginning and the end of the ON cycle before the oven center reaches ambient+130°C, then again for the first ON cycle after the oven center has reached ambient+130°C.
 
I thought using the event structure would work, but the code won't trigger the events for some reason. Can I use an event structure to trigger events when the trigger is not from the front panel?
 
Thanks - Paul
0 Kudos
Message 1 of 7
(3,779 Views)

The only way to trigger a front panel event from the block diagram is with the Value(Signaling) property of the control.  So any place you're currently writing to a control in your code via its terminal or a local variable, you'll need to replace with the Value(Signaling) property for that control if you want an event to fire whenever that control value changes.

I didn't have a chance to look at your VI, so I can't offer any other suggestions as to how you would implement your desired behavior.

-D

0 Kudos
Message 2 of 7
(3,769 Views)
Sorry, Paul, I can't open it (using LV7.1)

There is a property for controls named VALUE(SIGNALING), the last one, that when set, triggers a value change of that control that can be caught by the Event Structure.
Aitortxo.
0 Kudos
Message 3 of 7
(3,767 Views)
I guess my problem is that it is not a control that I want to trigger the events. It is just a boolean True that is generated when the GPIB sees current greater or less than 2 amps from a power meter. I thought it would work because, on the block diagram, it is just a value change from false to true. I'm slowly learning about event structures - looks like I need to re-think this...
0 Kudos
Message 4 of 7
(3,765 Views)

Hi Paul,

You can use User Events to generate an event programmatically whenever your triggers go true.  These too get captured by the Events Structure.  Lookup "User Events" in the Online Help. 

Alternatively, you may want to consider using Notifiers or Queues.  You basically would Queue-up your triggers in the main loop and then take care of them in the other loop. 

Now, after looking at your VI, I am wondering why would you even need the second loop.  As it stands, it appears you are using this second loop (with the Event structure) only to display the values.  And since you're using local variables anyways, you can display these values from the main loop itself -- from inside the True/False Case structure.  Unless of course you're planning other things to do in this second loop. 

In any case, take a look at Queues, and the examples on Queues.  I feel they're a better solution to your situation.

Hope this helps.

Regards,

-Khalid

0 Kudos
Message 5 of 7
(3,756 Views)
Thanks Kahlid - I'll look into User Events.
 
My problem is that I have to capture the data you see in the case structures in the second loop, but I never know when those triggers will happen (This testing will be run on different size ovens with different size heating elements so a 'time based' sceneraio won't work because they will all heat up at different rates.) I'm using the local variables inside the case structures because I have to capture the accumalated values (Watt-hours and Temperature) when, and only when, the values change from False to True. That's why I thought of event structures. Queing might be a better solution. I'll need to do some reading.
 
 - Paul
0 Kudos
Message 6 of 7
(3,752 Views)

Hi Paul,

As a personal exercise, I modified your VI to accomplish the task, without the need for User Events or even the second loop.  As you will see in the attached VI, I have used Shift-registers to accomplish this.  Just another way of skinning the cat, I guess. 

Hope this gives you more ideas. 

Regards,

-Khalid

Message Edited by Khalid on 03-17-2006 02:17 AM

Message 7 of 7
(3,736 Views)