Jump to content

Private events vs Public events


Recommended Posts

Hello,

Im getting started with the SMO framework and I would like to know when its appropriate to create a Public event vs a Private event. I created both and I see both added to the API folder of the SMO. I can send a message using the public event function as expected but I can do the same thing with the private API function from the same external VI.

So my question is, whats the difference? How should I use the private one?

Thanks.

Link to post
Share on other sites
  • 2 months later...

In the SMO Editor Tool, there is a "Create New Event" button with a satellite icon (top right).

The official description for a Public Event states the following:

Quote

Use this to make the SMO publish an event to which external components can register (i.e. new temperature value)

For Private Events:

Quote

Use this to communicate internally whitin the SMO class

For Public Methods:

Quote

Use this to communicate into the SMO process from an external source

 

Public methods are for the SMO to broadcast some sort of data or some sort of event. Example; data from a voltage reading in the double datatype could be continuously read and broadcasted (You physically route the data wire into the Public Method which generates a user event). An external SMO can subscribe to the user event in their own user event handler and do something with the data. The event isn't limited to just values. Maybe the pressure for a boiler trips a threshold. In this case, an "over-pressure event" can be triggered by sending the corresponding Public Event, and you don't really need to send any value (it defaults to a Boolean control). You could make use of it though by having the threshold trigger the event and send a True. And when it comes back down it triggers a False. But note, in this case the event is not broadcasted continuously.

I haven't used Private Events as much as Public Events and Public Methods. But in theory the Private Event would be able to change the internal state of the state machine from within itself. From what I've read, it is best practice to prevent external VIs from modifying the state of a state machine directly, maybe this mechanism allows for that. I am more used to Queued Message Handler structure, so what I would do to modify the state machine internally is by modifying the string queue itself.

 

Would be nice for someone from JKI to explain Private Events and the intention :]

Edited by davidcli
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.