next up previous contents index
Next: 2.2.7 Ports and Connections Up: 2.2 Overview of Abstract Previous: 2.2.5 Transition Priorities   Contents   Index

2.2.6 Importation

Importation allows reusing a model in another by placing all its states and transitions in a state of the importing model. That state of the importing model is called importation state. An importation state is not allowed to have substates prior to importation (and is thus a leaf state). After importation is done, that state becomes a non-importation state.

After importation, some of the importing model's elements must be changed to reflect the new model with more states and transitions. For example, the GUIDs of the states in the imported model are modified so that the new GUIDs still uniquely identify those states after importation. An implementation of DCharts could choose a prefix and add it to the head of all the original GUIDs in the imported model. The $C$ (children) function must be changed, since all the states of the imported model become substates of the importation state (and the top-level states become its children). The transitions in the imported model are added to the $T$ set of the importing model, with the GUIDs of their $SRC$ and $DES$ properties accordingly changed. Other GUIDs in the imported model must be modified in a similar way.

Importation is a dynamic operation. It is done at run-time when the imported model is needed. This allows recursive importation, where a model explicitly or implicitly imports itself. A theoretically infinite state hierarchy can be created in this way.

The imported model is forbidden to transition to the states of the importing model. This breaks the modularity of the imported model. To interact with the importing model, the imported model should send (i.e., broadcast) events that trigger transitions in the importing model. After the imported model is merged with the importing model, there is no distinction between transitions in the importing model and the imported model any more. An event may be handled by any transition in the combined transition set.

The concept of leaf states becomes relative when importation is considered. Leaf state $s$ may import another model. Since the importation is done dynamically, it is possible that $s$ is a leaf state before a transition is fired, while it becomes non-leaf after that because of an importation. It is assumed that notation $Leaf(s,t)$ or simply $Leaf(s)$ returns whether or not $s$ is leaf at a certain point in time ($t$).

At any time in a simulation or execution, an importation state is always a leaf state. (Be reminded that after a submodel is imported into it, it is no longer called importation state.)


next up previous contents index
Next: 2.2.7 Ports and Connections Up: 2.2 Overview of Abstract Previous: 2.2.5 Transition Priorities   Contents   Index
Thomas Huining Feng 2004-04-28