LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating events in producer-consumer loops

I have a Producer-Consumer design for my program with an Event structure inside the producer loop.  Everything works fine.  The program reacts to events on the front panel and processes code in the timeout case of the event struture when waiting.  However, I'm having troubling figuring out how to create an event for a temperature sensor.  I can monitor and display the value of the temperature sensor in the timeout case of the event structure; however, once the temperature reaches a certain value I want to create an event.  I know how to use the Property node for a variable (i.e. Value (signalling)), but I cannot figure where to do this.  I cannot put it inside the consumer loop because this loop only processes the Queue.  The producer loop holds the event structure.  The only option that I can think of is to put it in the Timeout case; however, I don't think you can create an event from with an event structure.  Any feedback or thoughts would be appreciated.

0 Kudos
Message 1 of 3
(3,206 Views)

First, there's nothing wrong in having code in the Event Time-out loop check the Temperature, see that it is Too High, and setting the "Too High" boolean using Value-Signalling.  This will trigger a "Too High Value Changed" Event, which is what I think you want to do.

 

On the other hand, it may also make sense to remove almost all of the code from your Time-Out loop and to create multiple "mini-Producer" loops, all running independently, all clocked independently.  Some controls you may want to check once/second, some 5 times a second, etc.  They can all do whatever they need to do, including raising Event flags.  It allows you to "functionally segregate" your program, reserving the Event Loop (mostly) for Front Panel interactions and having independent loops doing independent tasks simultaneously.

 

[I'm struck by the sheer size of your Time-Out code.  I didn't take a close look at it, but surely you don't need all those independent wires.  Maybe some additional thought to your Front Panel functionality ...].

 

Bob Schor

0 Kudos
Message 2 of 3
(3,202 Views)

Thanks Bob. I'll look at creating parallel producer loops. As for the size of the Timeout event, I have 40 power supplies to display. I've used a tab structure to show the readings for each supply depending on which zone their in. I suppo

0 Kudos
Message 3 of 3
(3,196 Views)