First of all – in order to enable collaboration between separate state machines it must be possible that state machines can reference other state machines. To establish such a reference two steps are required:
import: "xyz.sct"in the statecharts declaration area. Specify relative paths if the statecharts are not located in the same directory.
var otherMachine : SomeMachineType
For our example statechart TwoWayTrafficControl the declarations look like this:
import: "TrafficLight.sct" interface: var trafficLightA : TrafficLight var trafficLightB : TrafficLight
According to the steps described above the statechart TrafficLight.sct is imported. As two instances of this referenced statechart are required, two variables are defined. So if you want to implement a three or four way traffic control you can simply define as many variables for state machine references as you require.