Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [4diac-dev] Support for OPC UA events

Hi Matthias,

 

> I used the SUBSCRIBE_1 FB

 

I’d leave SUBSCRIBE_x (where x>=1) for data subscription as it is used in 4diac right now. Events do not carry any data per se. So I still propose to reserve SUBSCRIBE/PUBLISH_0 for them.

 

> OPC UA statemachines are notifying there transitions with an EventType called TransitionEventType (or subtype, for example the ProgramTransitionEventType, of it)

 

According to OPC UA specs, both BasicEventType and TransitionEventType are abstract. My understanding is that you can not have their instances in your OPC UA server address spaceWhat you have to do is to create your own transition types, modelled for your state machine(s), which inherit from TransitionEventType (and TransitionEventType is a BasicEventType, by definition). ProgramTransitionEventType is also abstract. OPC UA Programs spec that uses them for Programs State Machine define 9 Transition types that extend ProgramTransitionEventType. That’s why I think, as written in the previous mail, that you have to subscribe to a particular event type and have a separate SUBSCRIBE FB for every transition type, without a need to “demuxing” them.

 

> So the EventType for all transitionEvents is the same (i=2311 or subType of it), to distinguish which transition has happened, you have to take a look on the Transition ID.

 

Here is what OPC UA spec says about EventId and EventType:

 

EventId is generated by the Server to uniquely identify a particular Event Notification. The Server is responsible to ensure that each Event has its unique EventId. It may do this, for example, by putting GUIDs into the ByteString. Clients can use the EventId to assist in minimizing or eliminating gaps and overlaps that may occur during a redundancy failover. The EventId shall always be returned as value and the Server is not allowed to return a StatusCode for the EventId indicating an error.

EventType describes the specific type of Event. The EventType shall always be returned as value and the Server is not allowed to return a StatusCode for the EventType indicating an error.

 

I’d say, we need to look into the type, not Id.

 

> opc_ua[SUBSCRIBE_TRANSITIONEVENT;<uri>;<object>;<eventType>;<TransitionId>]

 

I believe we can get rid of Id, then it’ll be exactly the syntax I’d propose for an Event and it’ll be quite generic for all OPC UA Events.

 

> opc_ua[SUBSCRIBE_EVENT;<uri>;<object>;<eventType>;<browsePathToMember1>;<browsePathToMember2>;...]

 

What will be the browsePathToMemberX in this case?

 

> We could also setup a call the upcoming week, the event model of opc ua is quite complex.

 

I’d be definitely interested in taking part.

 

> It would be interesting if such an "proxy statemachine FB" could be generated out of opc ua model of the statemachine. From my point of view there is every information there which is need. But this is another story ;)

 

Absolutely agree on literally every sentence here.

 

Regards,

Kirill

 

From: 4diac-dev-bounces@xxxxxxxxxxx <4diac-dev-bounces@xxxxxxxxxxx> On Behalf Of Matthias Konnerth
Sent: Sunday, April 19, 2020 6:23
To: 4diac developer discussions <4diac-dev@xxxxxxxxxxx>
Subject: Re: [4diac-dev] Support for OPC UA events

 

Hi Kirill,

thanks for the detailled feedback. Sry for confusing you, I was wrong, I used the SUBSCRIBE_1 FB, here's a image how it looks like at the moment:

Object: /Objects/1:OpMode

EventType: i=2311 (TransitionEventType)

TransitionIds: i=5015 and i=5019

The transition Ids are mapped to to RD_1

 

if Eventype ==2311 and TransitionId i=5015 then RD_1=0, if EventType ==2311 and TransitionId=5019 RD_1=1, otherwise the event is skipped.

 

image.png

I agree with you, that there should not be a fb for a statemachine.

 

Now it gets interesting:

OPC UA statemachines are notifying there transitions with an EventType called TransitionEventType (or subtype, for example the ProgramTransitionEventType, of it):

image.png

So the EventType for all transitionEvents is the same (i=2311 or subType of it), to distinguish which transition has happened, you have to take a look on the Transition ID.

You can get this Transition ID when build subscribe for the event data when you explicitly specify that you want this data.

 

So I think, the interface for subscribing to TransitionEvents could look like this:

opc_ua[SUBSCRIBE_TRANSITIONEVENT;<uri>;<object>;<eventType>;<TransitionId>]

 

That means it's no generic event implementation. The interface for a generic event implementation would like:

 

opc_ua[SUBSCRIBE_EVENT;<uri>;<object>;<eventType>;<browsePathToMember1>;<browsePathToMember2>;...]

 

and then map the eventData from the field browsePathMember1 to RD_x. But this get's quite complex, for example the Type of the TransitionId is a NodeId, you would have to find a way to represent a NodeId in forte.

So I would vote for the SUBSCRIBE_TRANSITIONEVENT.

 

We could also setup a call the upcoming week, the event model of opc ua is quite complex.

 

PS:

It would be interesting if such an "proxy statemachine FB" could be generated out of opc ua model of the statemachine. From my point of view there is every information there which is need. But this is another story ;)

 

 

 

 

 

Am So., 19. Apr. 2020 um 00:29 Uhr schrieb Kirill Dorofeev <dorofeev@xxxxxxxxxxx>:

Hi Matthias,

 

it sounds very interesting. We were also thinking in the same direction. I know, there was some ongoing work on implementing OPC UA Events in forte [1], but I don't know its current status.

 

I would propose to use SUBSCRIBE_0 (and PUBLISH_0 on the server side) for handling OPC UA events. I don't think there should be a generic FB for state machines as I can imagine those will be quite different in each particular case. But if we have methods and events support, one can already create a subapp to control a state machine.

 

One other thing that is missing in forte but might be useful for controlling an OPC UA state machine is references support. Events can carry some data. In OPC UA it is realized by a reference from the Event instance to an object, which client should check for updates, whenever an Event is triggered. For doing that, 4diac should be able to browse the OPC UA namespace and find out these kind of "bindings" and then create a subscription to this data (or simply read it after Event notification occurs). But one can also add this manually on the first step, I see references as more like “nice-to-have”, not desperately needed.

 

Here, for example, how I'd see an implementation for controlling an OPC UA Programs State Machine in 4diac

 

Each Transition Event gets a Subcribe_0 with an ID

opc_ua[SUBSCRIBE_EVENT;<endpoint_address>#;<browse_path_to_object>;ReadyToRunning]

 

Each control method gets a Client FB with an ID

opc_ua[CALL_METHOD;<endpoint_address>#;<browse_path_to_ method>]

 

To sum up: I think, you’re on the right way of implementing it. Just subscribe to a particular event type -- as each of your StateMachine transitions will have its own type – and it should work. Something like ReadyToRunning in case of OPC UA Programs. So you just specify the particular type in your SUBSCRIBE ID, and you’ll have one SUBSCRIBE FB per each transition (see my example above). Btw, you don’t have any RD_x in SUBSCRIBE_0, so I was a bit confused when you describe that you will have some flags for each RD.

 

This will be a generic implementation of OPC UA Events in forte without any state machines specifics.

 

Hope it makes sense and helps somehow.

 

Cheers,

Kirill

 

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=553521  

 

-----Original Message-----
From: 4diac-dev-bounces@xxxxxxxxxxx <4diac-dev-bounces@xxxxxxxxxxx> On Behalf Of Matthias Konnerth
Sent: Saturday, April 18, 2020 12:44
To: 4diac-dev@xxxxxxxxxxx
Subject: [4diac-dev] Support for OPC UA events

 

Hi,

we want forte connect to a opc ua statemachine and gather the transition events of it. To interact with opc ua statemachines the mechanisms of method calls (supported by forte) and events (currently not supported by forte) are needed.

 

I've done a little prototype implementation and now able to get notified when a event is triggered on an opc ua object. (I don't filter the event type or any other member of the event type).

 

Now I'm thinking about the interface, how it could be used in the 4diac ide.

 

Currently I'm using a SUBSCRIBE_0 FB with ID:

 

opc_ua[SUBSCRIBE_STATEMACHINE;<endpointurl>;<browsePath to Object I want to monitor>;<NodeId of EventType I'm interested in>]

 

Next step would be to map the opc ua TransitionIds to the RD_1 ...RD_n outputs as boolean flags for signaling which transitionEvent has been fired.

 

You see, the interface is quite narrowed for supporting statemachines.

 

Do you think, this can be done in a more generic way?

 

Best regards,

Matthias.

_______________________________________________

4diac-dev mailing list

4diac-dev@xxxxxxxxxxx

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/4diac-dev

_______________________________________________
4diac-dev mailing list
4diac-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/4diac-dev


 

--

Matthias Konnerth

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Back to the top