Project: railway-crossing
The control system contains three types of state machines: CrossingSignal, TrainPosition and Flash. CrossingSignal performs the direct control of the Red light and enable/disables "Flash" sending it commands: Cmd_Flash_Enable and Cmd_Flash_Disable. TrainPosition transforms the sequences of sensor changes into states which represent train positions. Flash carries out only auxilary function: it generates the flash cycle.

VFSM type: CMD(predefined vfsm)
Object name: Flash:Cmd

Properties
NameValue
TypeFlash

VFSM type: TI(predefined vfsm)
Object name: Flash:Ti:Timer1

Properties
NameValue
Const10
Clock100ms

Object name: Flash:Ti:Timer2

Properties
NameValue
Const10
Clock100ms

Object name: TrainPos:0:Left:Ti:Delay

Properties
NameValue
Const1
Clock100ms

Object name: TrainPos:0:Left:Ti:Timer

Properties
NameValue
ConstTrainPos:Par:Timeout
Clocksec

Object name: TrainPos:0:Right:Ti:Delay

Properties
NameValue
Const1
Clock100ms

Object name: TrainPos:0:Right:Ti:Timer

Properties
NameValue
ConstTrainPos:Par:Timeout
Clocksec

Object name: TrainPos:1:Left:Ti:Delay

Properties
NameValue
Const1
Clock100ms

Object name: TrainPos:1:Left:Ti:Timer

Properties
NameValue
ConstTrainPos:Par:Timeout
Clocksec

Object name: TrainPos:1:Right:Ti:Delay

Properties
NameValue
Const1
Clock100ms

Object name: TrainPos:1:Right:Ti:Timer

Properties
NameValue
ConstTrainPos:Par:Timeout
Clocksec

VFSM type: AL(predefined vfsm)
Object name: TrainPos:0:Al:ActiveSensor

Properties
NameValue
Category2
TextRail:0 There are still active sensors

Object name: TrainPos:0:Al:MissingSensor

Properties
NameValue
Category1
TextRail:0 Missing sensor signal during 1 minute

Object name: TrainPos:0:Al:UnexpectedSensor

Properties
NameValue
Category1
TextRail:0 Received unexpected sensor signal

Object name: TrainPos:1:Al:ActiveSensor

Properties
NameValue
Category2
TextRail:1 There are still active sensors

Object name: TrainPos:1:Al:MissingSensor

Properties
NameValue
Category1
TextRail:1 Missing sensor signal during 1 minute

Object name: TrainPos:1:Al:UnexpectedSensor

Properties
NameValue
Category1
TextRail:1 Received unexpected sensor signal

VFSM type: DI(predefined vfsm)
Object name: CrossingSignal:Di:Light
Object name: TrainPos:0:Di:L
Object name: TrainPos:0:Di:M
Object name: TrainPos:0:Di:R
Object name: TrainPos:1:Di:L
Object name: TrainPos:1:Di:M
Object name: TrainPos:1:Di:R
Object name: TrainPos:Di:Reset

VFSM type: DO(predefined vfsm)
Object name: CrossingSignal:Do:Light
Object name: Flash:Do:Light

VFSM type: PAR(predefined vfsm)
Object name: TrainPos:Par:Timeout

Properties
NameValue
CategoryPP
Formatushort
Unitsec
LimitLow0
LimitHigh100
InitValue20

VFSM type: Flash(user vfsm)
FLASH generates a cycling Do signal that is used to drive a flashing (yellow) crossing light. FLUSH oscilates between two states. The oscilation are enabled/disabled by the command Enable or the digital input Enable. The oscilation period is determined by the Timer.

Prefix: FLA

Object name: Flash
It is the first and only instantiation of the Flash state machine.

Properties
NameValue
MyCmdFlash:Cmd
Timer1Flash:Ti:Timer1
Timer2Flash:Ti:Timer2
LightFlash:Do:Light

IOid name: MyCmd (type: CMD-IN)
-->Virtual Input: Cmd_Disable (2)
-->Virtual Input: Cmd_Enable (1)

IOid name: Timer1 (type: TI)
-->Virtual Input: Timer1_OVER (OVER)
-->Virtual Output: Timer1_ResetStart (ResetStart)
-->Virtual Output: Timer1_Stop (Stop)

IOid name: Timer2 (type: TI)
-->Virtual Input: Timer2_OVER (OVER)
-->Virtual Output: Timer2_ResetStart (ResetStart)
-->Virtual Output: Timer2_Stop (Stop)

IOid name: Light (type: DO)
-->Virtual Output: Light_Off (Low)
-->Virtual Output: Light_On (High)

State transition table, state ' Init ':
Init
EntryAction:
ExitAction:
Light_Off
always

State transition table, state ' Light_Off ':
Di

Light_Off
EntryAction:
Light_Off
Timer1_ResetStart
ExitAction:
Timer1_Stop
Light_On
Timer1_OVER and Cmd_Enable

State transition table, state ' Light_On ':
Light_On
EntryAction:
Light_On
Timer2_ResetStart
ExitAction:
Timer2_Stop
Light_Off
Timer2_OVER
Total number of states: 3

VFSM type: CrossingSignal(user vfsm)
The state machine switches on/off the (red) lamp and enables/disables the (yellow) flash lamp. It does it by knowing the states of the state machines TrainPosition.

Prefix: CRO

Object name: CrossingSignal

Properties
NameValue
MyCmd
TrainPosLeft_1TrainPosition:0:Left
TrainPosLeft_2TrainPosition:1:Left
TrainPosRight_1TrainPosition:0:Right
TrainPosRight_2TrainPosition:1:Right
FlashFlash:Cmd
Di_LightCrossingSignal:Di:Light
Do_LightCrossingSignal:Do:Light

IOid name: MyCmd (type: CMD-IN)
-->Virtual Output: MyCmd_Clear (0)

IOid name: TrainPosLeft_1 (type: VFSM)
trainposition

-->Virtual Input: TrainPosLeft_1_AllPresent ( AllPresent )
-->Virtual Input: TrainPosLeft_1_ApprPresent ( ApprPresent )
-->Virtual Input: TrainPosLeft_1_Approaching ( Approaching )
-->Virtual Input: TrainPosLeft_1_Coming ( Coming )
-->Virtual Input: TrainPosLeft_1_DelayStart ( DelayStart )
-->Virtual Input: TrainPosLeft_1_Disabled ( Disabled )
-->Virtual Input: TrainPosLeft_1_Going ( Going )
-->Virtual Input: TrainPosLeft_1_Init ( Init )
-->Virtual Input: TrainPosLeft_1_LeavPresent ( LeavPresent )
-->Virtual Input: TrainPosLeft_1_Leaving ( Leaving )
-->Virtual Input: TrainPosLeft_1_Missing ( Missing )
-->Virtual Input: TrainPosLeft_1_NoTrain ( NoTrain )
-->Virtual Input: TrainPosLeft_1_Present ( Present )
-->Virtual Input: TrainPosLeft_1_Start ( Start )
-->Virtual Input: TrainPosLeft_1_Unexpected ( Unexpected )

IOid name: TrainPosLeft_2 (type: VFSM)
trainposition

-->Virtual Input: TrainPosLeft_2_AllPresent ( AllPresent )
-->Virtual Input: TrainPosLeft_2_ApprPresent ( ApprPresent )
-->Virtual Input: TrainPosLeft_2_Approaching ( Approaching )
-->Virtual Input: TrainPosLeft_2_Coming ( Coming )
-->Virtual Input: TrainPosLeft_2_DelayStart ( DelayStart )
-->Virtual Input: TrainPosLeft_2_Disabled ( Disabled )
-->Virtual Input: TrainPosLeft_2_Going ( Going )
-->Virtual Input: TrainPosLeft_2_Init ( Init )
-->Virtual Input: TrainPosLeft_2_LeavPresent ( LeavPresent )
-->Virtual Input: TrainPosLeft_2_Leaving ( Leaving )
-->Virtual Input: TrainPosLeft_2_Missing ( Missing )
-->Virtual Input: TrainPosLeft_2_NoTrain ( NoTrain )
-->Virtual Input: TrainPosLeft_2_Present ( Present )
-->Virtual Input: TrainPosLeft_2_Start ( Start )
-->Virtual Input: TrainPosLeft_2_Unexpected ( Unexpected )

IOid name: TrainPosRight_1 (type: VFSM)
trainposition

-->Virtual Input: TrainPosRight_1_AllPresent ( AllPresent )
-->Virtual Input: TrainPosRight_1_ApprPresent ( ApprPresent )
-->Virtual Input: TrainPosRight_1_Approaching ( Approaching )
-->Virtual Input: TrainPosRight_1_Coming ( Coming )
-->Virtual Input: TrainPosRight_1_DelayStart ( DelayStart )
-->Virtual Input: TrainPosRight_1_Disabled ( Disabled )
-->Virtual Input: TrainPosRight_1_Going ( Going )
-->Virtual Input: TrainPosRight_1_Init ( Init )
-->Virtual Input: TrainPosRight_1_LeavPresent ( LeavPresent )
-->Virtual Input: TrainPosRight_1_Leaving ( Leaving )
-->Virtual Input: TrainPosRight_1_Missing ( Missing )
-->Virtual Input: TrainPosRight_1_NoTrain ( NoTrain )
-->Virtual Input: TrainPosRight_1_Present ( Present )
-->Virtual Input: TrainPosRight_1_Start ( Start )
-->Virtual Input: TrainPosRight_1_Unexpected ( Unexpected )

IOid name: TrainPosRight_2 (type: VFSM)
trainposition

-->Virtual Input: TrainPosRight_2_AllPresent ( AllPresent )
-->Virtual Input: TrainPosRight_2_ApprPresent ( ApprPresent )
-->Virtual Input: TrainPosRight_2_Approaching ( Approaching )
-->Virtual Input: TrainPosRight_2_Coming ( Coming )
-->Virtual Input: TrainPosRight_2_DelayStart ( DelayStart )
-->Virtual Input: TrainPosRight_2_Disabled ( Disabled )
-->Virtual Input: TrainPosRight_2_Going ( Going )
-->Virtual Input: TrainPosRight_2_Init ( Init )
-->Virtual Input: TrainPosRight_2_LeavPresent ( LeavPresent )
-->Virtual Input: TrainPosRight_2_Leaving ( Leaving )
-->Virtual Input: TrainPosRight_2_Missing ( Missing )
-->Virtual Input: TrainPosRight_2_NoTrain ( NoTrain )
-->Virtual Input: TrainPosRight_2_Present ( Present )
-->Virtual Input: TrainPosRight_2_Start ( Start )
-->Virtual Input: TrainPosRight_2_Unexpected ( Unexpected )

IOid name: Flash (type: CMD-OUT)
flash

-->Virtual Output: Flash_Disable (2)
-->Virtual Output: Flash_Enable (1)

IOid name: Di_Light (type: DI)
-->Virtual Input: Di_Light_HIGH (HIGH)
-->Virtual Input: Di_Light_LOW (LOW)
-->Virtual Input: Di_Light_UNKNOWN (UNKNOWN)

IOid name: Do_Light (type: DO)
-->Virtual Output: Do_Light_High (High)
-->Virtual Output: Do_Light_Low (Low)

State transition table, state ' Init ':
Init
EntryAction:
ExitAction:
Undefined
TrainPosLeft_1_Start or TrainPosLeft_2_Start or TrainPosRight_1_Start or TrainPosRight_2_Start

State transition table, state ' Off ':
On entering the state the (red) lamp is switched off but the (yellow) flash lamp is enabled. There are two imaginable situations: - if any TrainPosition state machine goes into the state Coming the CrossingSignal goes to the state On, - if any TrainPosition state machine goes to the state Unexpected the CrossingSignal goes to the state Undefined. Note that the transition of the TrainPosition state machine to the state Disabled is ignored by the CrossingSignal (it is an intern blocking mechanism between two TrainPosition state machines that control train movements on a single rail).

Off
EntryAction:
Do_Light_Low
Flash_Enable
ExitAction:
On
TrainPosLeft_1_Coming or TrainPosLeft_2_Coming or TrainPosRight_1_Coming or TrainPosRight_2_Coming
Undefined
TrainPosLeft_1_Unexpected or TrainPosLeft_2_Unexpected or TrainPosRight_1_Unexpected or TrainPosRight_2_Unexpected

State transition table, state ' On ':
On entering the state the (red) lamp is switched on and the (yellow) flash lamp is disabled. There are two imaginable situations: - if any TrainPosition state machine goes to the state Leaving or Going, CrossingSignal goes to the state Going - if any state machine TrainPosition goes to the state Unexpected or Missing, CrossingSignal goes to the state Undefined

On
EntryAction:
Do_Light_High
Flash_Disable
ExitAction:
Going
TrainPosLeft_1_Leaving or TrainPosLeft_1_Going or TrainPosLeft_2_Leaving or TrainPosLeft_2_Going or TrainPosRight_1_Leaving or TrainPosRight_1_Going or TrainPosRight_2_Leaving or TrainPosRight_2_Going
Undefined
TrainPosLeft_1_Unexpected or TrainPosLeft_2_Unexpected or TrainPosRight_1_Unexpected or TrainPosRight_2_Unexpected or TrainPosLeft_1_Missing or TrainPosLeft_2_Missing or TrainPosRight_1_Missing or TrainPosRight_2_Missing

State transition table, state ' Undefined ':
All state machines TrainPosition work and are in the state Start but the there is no distinct information about the trains positions. Therefore on entering the state the state machine switches on the (red) lamp and enables the (yellow) flash lamp. This is the responsibility of an operator to reset the system. Resetting the system the operator acknowledges that there are no trains in the supervised area. The reset signal goes directly to all state machines TrainPosition that go to the state NoTrain. At that moment the CrossingSignal system takes control over of the crossing signals going to the state Off.

Undefined
EntryAction:
Do_Light_High
Flash_Enable
ExitAction:
Off
TrainPosLeft_1_NoTrain and TrainPosLeft_2_NoTrain and TrainPosRight_1_NoTrain and TrainPosRight_2_NoTrain

State transition table, state ' Going ':
On entering the state the (red) lamp is switched off and the (yellow) flash lamp is enabled. There are two imaginable situations: - if all TrainPosition state machines are in the state NoTrain, CrossingSignal goes to the state Off - if any TrainPosition state machine goes to the state Unexpected or Missing, CrossingSignal goes to the state Undefined

Going
EntryAction:
Do_Light_Low
Flash_Enable
ExitAction:
Off
TrainPosLeft_1_NoTrain and TrainPosLeft_2_NoTrain and TrainPosRight_1_NoTrain and TrainPosRight_2_NoTrain
Undefined
TrainPosLeft_1_Unexpected or TrainPosLeft_2_Unexpected or TrainPosRight_1_Unexpected or TrainPosRight_2_Unexpected or TrainPosLeft_1_Missing or TrainPosLeft_2_Missing or TrainPosRight_1_Missing or TrainPosRight_2_Missing
Total number of states: 5

VFSM type: TrainPosition(user vfsm)
TrainPosition state machine is a part of a systems that controls crossing signals on a train/road crossing. TrainPosition does not perform any direct control function; it just translates the sensor changes into states that represent the train position. The train movements is detected by Sensors L, M, R (check boxes Left, Middle, Right on the picture). By the specification the Sensors L and R are numbered as 1 and 2 (for one direction 1->L and 2->R, for the other direction it is vice-versa). Sensor 1 is the sensor which signals that a train has entered the controlled zone. Sensor 2 is the sensor which signals that a train is leaving the controlled zone. In the system configuration (see project) the proper sensors are then used for each direction. We assume that a train may come from both directions but only one train can enter the sensor zone. The crossing signals may be in the following states: - both lights gray if the control system is not working, - yellow light flashing if there is no train between sensors 1 and 2 or a train just passed the sensor M and is still between sensors M and 1 moving towards 2, i.e. leaving the sensors zone, - red light on if there is a train between sensor 1 and M moving towards M, i.e. aproaching the road, - red light on and yellow light flashing if the situation is not well defined: after a system start, when received an unexpected sensor signal and when the expected sensor signal has not come after a certain time. These situations are considered as unsafe ones and can be resolved only by a manual control: if the situation is cleared the operator may Reset the system. The time needed by the train to pass the distance beetween two sensors is measured by a timer. By entering most states the timer is started. When the timer elapses the situation is considered as an unsafe one and TrainPosition enters the Missing state (train disappeared?).

Prefix: TRA

Object name: TrainPosition:0:Left
It is the first instantiation of the TrainPosition state machine: reflecting the position of trains coming on the rail 0 from the left side.

Properties
NameValue
My-Cmd
OppositeDirectionTrainPosition:0:Right
DelayTrainPos:0:Left:Ti:Delay
TimerTrainPos:0:Left:Ti:Timer
Al_ActiveSensorTrainPos:0:Al:ActiveSensor
Al_MissingSensorTrainPos:0:Al:MissingSensor
Al_UnexpectedSensorTrainPos:0:Al:UnexpectedSensor
ResetTrainPos:Di:Reset
Sensor_1TrainPos:0:Di:L
Sensor_2TrainPos:0:Di:R
Sensor_MTrainPos:0:Di:M

Object name: TrainPosition:0:Right
It is the second instantiation of the TrainPosition state machine: reflecting the position of trains coming on the rail 0 from the right side.

Properties
NameValue
My-Cmd
OppositeDirectionTrainPosition:0:Left
DelayTrainPos:0:Left:Ti:Delay
TimerTrainPos:0:Left:Ti:Timer
Al_ActiveSensorTrainPos:0:Al:ActiveSensor
Al_MissingSensorTrainPos:0:Al:MissingSensor
Al_UnexpectedSensorTrainPos:0:Al:UnexpectedSensor
ResetTrainPos:Di:Reset
Sensor_1TrainPos:0:Di:R
Sensor_2TrainPos:0:Di:L
Sensor_MTrainPos:0:Di:M

Object name: TrainPosition:1:Left
It is the third instantiation of the TrainPosition state machine: reflecting the position of trains coming on the rail 1 from the left side.

Properties
NameValue
My-Cmd
OppositeDirectionTrainPosition:1:Right
DelayTrainPos:1:Left:Ti:Delay
TimerTrainPos:1:Left:Ti:Timer
Al_ActiveSensorTrainPos:1:Al:ActiveSensor
Al_MissingSensorTrainPos:1:Al:MissingSensor
Al_UnexpectedSensorTrainPos:1:Al:UnexpectedSensor
ResetTrainPos:Di:Reset
Sensor_1TrainPos:1:Di:L
Sensor_2TrainPos:1:Di:R
Sensor_MTrainPos:1:Di:M

Object name: TrainPosition:1:Right
It is the fourth instantiation of the TrainPosition state machine: reflecting the position of trains coming on the rail 1 from the right side.

Properties
NameValue
My-Cmd
OppositeDirectionTrainPosition:1:Left
DelayTrainPos:1:Left:Ti:Delay
TimerTrainPos:1:Left:Ti:Timer
Al_ActiveSensorTrainPos:1:Al:ActiveSensor
Al_MissingSensorTrainPos:1:Al:MissingSensor
Al_UnexpectedSensorTrainPos:1:Al:UnexpectedSensor
ResetTrainPos:Di:Reset
Sensor_1TrainPos:1:Di:L
Sensor_2TrainPos:1:Di:R
Sensor_MTrainPos:1:Di:M

IOid name: My-Cmd (type: CMD-IN)

IOid name: OppositeDirection (type: VFSM)
trainposition

-->Virtual Input: OppositeDirection_Coming ( Coming )
-->Virtual Input: OppositeDirection_NoTrain ( NoTrain )

IOid name: Delay (type: TI)
-->Virtual Input: Delay_OVER (OVER)
-->Virtual Output: Delay_ResetStart (ResetStart)
-->Virtual Output: Delay_Stop (Stop)

IOid name: Timer (type: TI)
-->Virtual Input: Timer_OVER (OVER)
-->Virtual Output: Timer_ResetStart (ResetStart)
-->Virtual Output: Timer_Stop (Stop)

IOid name: Al_ActiveSensor (type: AL)
-->Virtual Output: Al_ActiveSensor_Com (Coming)
-->Virtual Output: Al_ActiveSensor_Go (Going)

IOid name: Al_MissingSensor (type: AL)
-->Virtual Output: Al_MissingSensor (Staying)

IOid name: Al_UnexpectedSensor (type: AL)
-->Virtual Output: Al_UnexpectedSensor (Staying)

IOid name: Reset (type: DI)
-->Virtual Input: Reset_Button (HIGH)

IOid name: Sensor_1 (type: DI)
-->Virtual Input: Sensor_1 (HIGH)
-->Virtual Input: Sensor_1_NOT (LOW)

IOid name: Sensor_2 (type: DI)
-->Virtual Input: Sensor_2 (HIGH)
-->Virtual Input: Sensor_2_NOT (LOW)

IOid name: Sensor_M (type: DI)
-->Virtual Input: Sensor_M (HIGH)
-->Virtual Input: Sensor_M_NOT (LOW)

State transition table, state ' Init ':
The system goes always into the Start state.

Init
EntryAction:
ExitAction:
DelayStart
always

State transition table, state ' DelayStart ':
Without the state DelayStart the state machine TrainPosition enters immediately the state Start and the state machine CrossingSignal does not get the event. In effect the outputs Do_Light are not initialized (see the state machine CrossingSignal).

DelayStart
EntryAction:
Delay_ResetStart
ExitAction:
Delay_Stop
Start
Delay_OVER

State transition table, state ' Start ':
The functioning of the state machine is started by the Reset button which causes TrainPosition to go into the state NoTrain.

Start
EntryAction:
ExitAction:
NoTrain
Reset_Button

State transition table, state ' Disabled ':
TrainPosition waits in this state until a "partner" state machine which controls the other direction returns into the state NoTrain. The Delay timer delays the return to the state NoTrain which ensures that the Sensor_1 is there already inactive.

Disabled
EntryAction:
ExitAction:
Delay_Stop
OppositeDirection_NoTrain
Delay_ResetStart
NoTrain
OppositeDirection_NoTrain and Delay_OVER

State transition table, state ' NoTrain ':
The timer is halted. TrainPosition waits for a sensor signal. Receiving an active signal from Sensor_1 (a train enters the sensor zone) TrainPosition goes to a state Coming. An active signal from Sensor_M means that something is wrong with the system and TrainPosition goes to the Unexpected state.

NoTrain
EntryAction:
Timer_Stop
ExitAction:
Disabled
OppositeDirection_Coming
Coming
Sensor_1
Unexpected
Sensor_M

State transition table, state ' Coming ':
The train is over the Sensor 1 entering the controlled zone. The expected changes are: the Sensor 1 becomes inactive (short train) or the Sensor M becomes active (long train) which leads to transitions correspondingly to states Approaching or ApprPresent. The erroneous changes like an active signal from the Sensor 2 forces TrainPosition to go to the Unexpected state.

Coming
EntryAction:
Timer_ResetStart
ExitAction:
Approaching
Sensor_1_NOT
ApprPresent
Sensor_M
Unexpected
Sensor_2
Missing
Timer_OVER

State transition table, state ' Approaching ':
The train is between Sensors 1 and M moving towards M. If the Sensor M becomes active (the train crosses the road) TrainPosition goes to the Present state. The unexpected active signal from the Sensor 1 (the train has changed its movement direction or another train has entered the controlled zone?) or 2 (the train has missed the Sensor M or another train entered the controlled zone?) forces TrainPosition to go to the Unexpected state.

Approaching
EntryAction:
Timer_ResetStart
ExitAction:
Present
Sensor_M
Unexpected
Sensor_1 or Sensor_2
Missing
Timer_OVER

State transition table, state ' ApprPresent ':
There is a long train over both Sensors 1 and M moving towards M. If the Sensor 1 becomes inactive TrainPosition goes to the Present state. If the Sensor 2 becomes active TrainPosition goes to the state AllPresent. Disappearence of the Signal M is considered as an error.

ApprPresent
EntryAction:
Timer_ResetStart
ExitAction:
Present
Sensor_1_NOT
AllPresent
Sensor_2
Unexpected
Sensor_M_NOT
Missing
Timer_OVER

State transition table, state ' Present ':
The train is over the Sensor M. If the expected sensor changes occur: Sensor M becomes inactive or Sensor 2 becomes active TrainPosition goes correspondigly to the states: Leaving or LeavPresent. If Sensor 1 becomes active it is an error.

Present
EntryAction:
Timer_ResetStart
ExitAction:
Leaving
Sensor_M_NOT
LeavPresent
Sensor_2
Unexpected
Sensor_1
Missing
Timer_OVER

State transition table, state ' AllPresent ':
There is a very long train over all three Sensors 1, M and 2. The only expected change is Sensor 1 becoming inactive. Other sensor changes are errors.

AllPresent
EntryAction:
Timer_ResetStart
ExitAction:
LeavPresent
Sensor_1_NOT
Unexpected
Sensor_M_NOT or Sensor_2_NOT
Missing
Timer_OVER

State transition table, state ' LeavPresent ':
The train is over the Sensor M and 2 moving towards 2. The only expected change is Sensor M becoming inactive. Other sensor changes are errors.

LeavPresent
EntryAction:
Timer_ResetStart
ExitAction:
Going
Sensor_M_NOT
Unexpected
Sensor_1 or Sensor_2_NOT
Missing
Timer_OVER

State transition table, state ' Leaving ':
The train left the sensor M and is between M and 2. The only expected change is Sensor 2 becoming active. Other sensor changes are errors.

Leaving
EntryAction:
Timer_ResetStart
ExitAction:
Going
Sensor_2
Unexpected
Sensor_1 or Sensor_M
Missing
Timer_OVER

State transition table, state ' Going ':
The train is over the Sensor 2 leaving the controlled zone. The only expected change is Sensor 2 becoming inactive. Other sensor changes are errors.

Going
EntryAction:
Timer_ResetStart
ExitAction:
Unexpected
Sensor_1 or Sensor_M
Missing
Timer_OVER
NoTrain
Sensor_2_NOT

State transition table, state ' Unexpected ':
By entering the state the alarm UnexpectedSensor is generated and the Timer is stopped. TrainPosition can leave this state if the Reset button is activated and all sensors are inactive. In such a case it goes to the NoTrain state. The active Reset button while at least one sensor is still active generate an alarm info about this situation.

Unexpected
EntryAction:
Timer_Stop
Al_UnexpectedSensor
ExitAction:
Al_ActiveSensor_Go
Reset_Button and ( Sensor_1 or Sensor_M or Sensor_2 )
Al_ActiveSensor_Com
NoTrain
Reset_Button and Sensor_1_NOT and Sensor_M_NOT and Sensor_2_NOT

State transition table, state ' Missing ':
By entering the state the alarm MissingSensor is generated and the Timer is stopped. TrainPosition can leave this state if the Reset button is activated and all sensors are inactive. In such a case it goes to the NoTrain state. The active Reset button while at least one sensor is still active generate an alarm info about this situation.

Missing
EntryAction:
Timer_Stop
Al_MissingSensor
ExitAction:
Al_ActiveSensor_Go
Reset_Button and ( Sensor_1 or Sensor_M or Sensor_2 )
Al_ActiveSensor_Com
NoTrain
Reset_Button and Sensor_1_NOT and Sensor_M_NOT and Sensor_2_NOT
Total number of states: 15

VFSM type: DO8(unit)
Prefix: DOU

Object name: DO8:Unit3

Properties
NameValue
CommPort0
PhysAddr3
Do0Flash:Do:Light
Do1CrossingSignal:Do:Light
Do2
Do3
Do4
Do5
Do6
Do7

IOid name: Do0 (type: DO)

IOid name: Do1 (type: DO)

IOid name: Do2 (type: DO)

IOid name: Do3 (type: DO)

IOid name: Do4 (type: DO)

IOid name: Do5 (type: DO)

IOid name: Do6 (type: DO)

IOid name: Do7 (type: DO)

VFSM type: DI8(unit)
Prefix: DIU

Object name: DI8:Unit1

Properties
NameValue
CommPort0
PhysAddr1
Di0TrainPos:0:Di:L
Di1TrainPos:0:Di:M
Di2TrainPos:0:Di:R
Di3TrainPos:1:Di:L
Di4TrainPos:1:Di:M
Di5TrainPos:1:Di:R
Di6CrossingSignal:Di:Light
Di7TrainPos:Di:Reset

IOid name: Di0 (type: DI)

IOid name: Di1 (type: DI)

IOid name: Di2 (type: DI)

IOid name: Di3 (type: DI)

IOid name: Di4 (type: DI)

IOid name: Di5 (type: DI)

IOid name: Di6 (type: DI)

IOid name: Di7 (type: DI)