From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create my *own* events?

Hey everybody!
Even after reading up a lot on events I'm at a complete loss. I still *think* events are the way to go for what I'm trying to achieve: a computer is to monitor certain slowly-varying observables (e.g. backing pressure, pump temperature) and take certain measures (e.g. shut down pumps) when some observable increases beyond a limit. As some of these measures are rather complex and time-consuming (like shut down pump 1, wait for 5 minutes, shut down pump 2), I thought I'd register an event when my apparatus enters a serious condition and use a case structure to catch the event.

Is this in any way feasible? I've read about notifyers (which I didn't like for their overwriting one another), but still think events are best.

The next thing is: I *can* catch events fired by some ui object, but I couldn't find out how to define my own events, e.g.: when pressure 1 rises beyond 1 mbar, create event "pressure_1_too_high". Can anybody point me in the right direction as to how to create my own event?

Kindest regards,
Severin
0 Kudos
Message 1 of 4
(2,414 Views)

You can raise custom events to be handled by the event structure. Have a look at the shipped example Dynamically Register For Events.

David

0 Kudos
Message 2 of 4
(2,398 Views)
Thanks for you answer, I finally managed to create and catch events. I attached my results so far. Next step is to memorize about the critical condition. This is what I used the boolean global "Global 1" for (sorry for the ugly nesting); still this seems to me to be something as forcing a text-based concept onto LabView - shouldn't there be a more elegant way?
0 Kudos
Message 3 of 4
(2,387 Views)

Hi Severin

Had you searched for Application Design Patterns on the ni site. One of the links is this http://zone.ni.com/devzone/learningcenter.nsf/webmain/338EE44CB1C3450986256C2B007CF8C5. There are other links that come up on the search that are worth browsing.

In the beginning I found this a great way to learn how to choose a design template which would be the most appropriate for my application. Labview provides these as templates if you got File then New ... you find them there. And there are examples.

In my opinion you should look at a State Machine for your application.

There are a number of ways to keep track of your variables such as using shift-registers, indicator propery nodes, LV2 Globals etc. Keep thinking data flow and always keep an eye on race conditions.

Hope this helps

David

0 Kudos
Message 4 of 4
(2,370 Views)