|
|
Convert Flow Ports to Proxy Ports |
This helper converts:
· Flow ports to proxy ports.
· Flow specifications to interface blocks.
|
Applicable To |
Package,
Project,Class |
|
Menu
Entry |
Power
Pack Conversion Tools Flow Ports
to Proxy Ports |
|
Demonstration |
The helper starts by building a list of applicable flow ports:
· Any flow port under the currently selected element (recursively) is checked.
· Read-only flow ports are omitted.
· Any stereotypes on that port are checked to ensure that they can also be applied to proxy ports – if not then that flow port is omitted from consideration.
Once the list of applicable flow ports is compiled, conversion begins:
The underlying metaclasses of proxy ports and flow ports are incompatible (Rhapsody will not allow a flow port to be changed to a proxy port) and so the helper must create new proxy ports to replace the flow ports. For each valid flow port found the helper:
1. Converts / creates an interface block:
· If the flow port is atomic then a new interface block is created in the same package as the owner of the flow port. The interface block is given the same name as the flow port with a prefix of “I_[portownername]_” . A new flow property is added to the interface block with the same name and type as the flow port. Its direction is set to the same direction as the flow port.
· If the flow port is typed by a flow specification, then that flow specification is changed to an interface block (these metaclasses are compatible).
· If the flow port has an implicit type then behind the scenes Rhapsody stores this as an invisible flow specification. That flow specification is cloned and renamed to I_[portownername]_FlowPortName and then changed to an interface block.
2. Creates a proxy port:
· The flow port is renamed with a prefix of “old_” so that its original name may be used as the name for the new proxy port.
· A new proxy port is added. The name is given a prefix of p_ to avoid code generation / simulation errors later (having a port with the same name as a value property will cause compilation to fail)
· The proxy port is made behavioral.
· The interface block from step 1 is used as the contract for the new proxy port.
· If the original flow port was reversed, then the new proxy port is set to reversed.
· Features of the flow port are copied to the proxy port (see below)
Þ The description of the flow port is copied to the proxy port.
Þ Any stereotypes applied to the flow port (except the SysML “flowPort” stereotype) are also applied to the proxy port.
Þ Any tags on the original flow port are copied to the proxy port (except any tags that start with “Simulink”)
After port conversion has completed, the helper checks the entire model for any links between the flow ports. Rhapsody does not allow links to be re-targeted and so for any links found, new links are created between the corresponding proxy ports. New links are created in the same place as the originals. Each old link is then checked for diagrams on which it appears. New graphical elements are added to the diagram for the proxy ports and the new link using the Rhapsody completeRelations functionality (therefore the original layout cannot be guaranteed).
Finally old flow ports are deleted from the model.