Importation is specified in model descriptions in two steps:
The following is a model (import1_a.des) that imports a component into its two leaf states (so that the two states have exactly the same internal structure):
IMPORTATION: b = import1_b.des STATECHART: A [DS] [b] B [b] TRANSITION: S: A N: B E: e
The following is the component (import1_b.des) to be imported by the above model:
STATECHART: COMP_A [DS] COMP_B [FS] TRANSITION: S: COMP_A N: COMP_B E: f
The submodel, import1_b.des is a model in its own right. It is possible to simulate it in SVM with command:
svm -t import1_b.des
When it is imported into import1_a.des, it is regarded as a component. All its states and transitions will be copied to the importation states at run-time. To simulate import1_a.des, run the following command instead:
svm -t import1_a.des
The simulation result is as following:
WARNING: Imported model has final states. They are automatically converted to ordinary states. ['A.COMP_A'] > f ['A.COMP_B'] > e WARNING: Imported model has final states. They are automatically converted to ordinary states. ['B.COMP_A'] > f ['B.COMP_B'] > exit
Two warning messages are produced by SVM in this simulation, but the user can safely ignore them. When the simulation is started, the model is in its default state A. Because A has a property [b] and b is the GUID of component import1_b.des, SVM looks for import1_.des and import it into A to find the concrete current state of the model. When SVM detects a final state is defined in the imported component, it produces a warning telling the user that the final state is converted into an ordinary state. This is necessary because a component should not have the ability to terminate the simulation (for modularity).
When the user sends the f event, which is handled by the component, the current state of the model changes from A.COMP_A to A.COMP_B. After that, event e causes the model to leave state A and enter state B. (The component imported in state A is not deleted and can be reused later.) Because B is also an importation state, SVM dynamically loads the required component (import1_b,des) in it, and the second warning is produced. Event f received after this changes the model from state B.COMP_A to B.COMP_B.