Friday, 9 October 2020

IBM Engineering Rhapsody Tip #85 - Using change events with SysML proxy ports (Advanced)

Ok, I'm back into more regular update videos. This again, is a slightly more advanced topic, although it also explains a little about what SysML proxy ports and Interface Blocks are and one of the ways they differ from standard UML ports and interfaces. This IBM Engineering tips and tricks video follows on from video #85 and shows how to get flow properties and change events to simulate with SysML proxy ports. The key thing is that in addition to using the change event and the auto-generated setter, you need to set both ports as behaviour ports. This is actually picked up by the Rhapsody model checker as a warning, as this short (and caption-driven, i.e. silent) video illustrates.


Here's some transcript (for those who want the gist):

Change events were originally developed to work with SysML flow ports. However they also work with SysML newer proxy ports. This video explains how to get them working for both.

In summary, change events are based on a ch followed by the name of attribute (with first letter capitalised). They require that the publisher of the change uses the setter. So, how do we get them to work for proxy ports?

Well, I proxy port is the newer type of port for SysML, and they work with Interface Blocks. Interface Blocks like UML Interfaces are designed to aggregate or group elements in a desired contract, i.e. they are not designed for single elements.
  
To flow data in an InterfaceBlock we would introduce an owned element called a flow property. Flow properties have a direction tag associated with them. This needs to be explicitly set to the direction the flow is occurring.

Proxy Ports can then be added which specify the use of the interface block.
 
 As the interface block is carrying flow properties, Rhapsody is showing direction inferred by their direction tags. The corresponding receiving proxy port is typed by the same interface block but is set to conjugated.

This is notated on the diagram by presence of the tilde symbol (~).
 
The ports can then be connected. This is almost ready to work. However, if I run now then you’ll see that the flow and change event are not occurring. A clue for the reason is actually picked up by the Check Model as a Warning.
 
If we want change events and flows to work for proxy Ports then we need to check the behavior attribute on the General tab for the port. If we only do this for the subscribing port then the simulation will still now work. This needs to be done not just for the subscribing port (with the reception for the change event) but also the publishing port.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.