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
VFSM type: TI(predefined vfsm)
Object name: Flash:Ti:Timer1
Object name: Flash:Ti:Timer2
Object name: TrainPos:0:Left:Ti:Delay
Object name: TrainPos:0:Left:Ti:Timer
Object name: TrainPos:0:Right:Ti:Delay
Object name: TrainPos:0:Right:Ti:Timer
Object name: TrainPos:1:Left:Ti:Delay
Object name: TrainPos:1:Left:Ti:Timer
Object name: TrainPos:1:Right:Ti:Delay
Object name: TrainPos:1:Right:Ti:Timer
VFSM type: AL(predefined vfsm)
Object name: TrainPos:0:Al:ActiveSensor
Object name: TrainPos:0:Al:MissingSensor
Object name: TrainPos:0:Al:UnexpectedSensor
Object name: TrainPos:1:Al:ActiveSensor
Object name: TrainPos:1:Al:MissingSensor
Object name: TrainPos:1:Al:UnexpectedSensor
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
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
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
':
State transition table, state '
Light_Off
':
State transition table, state '
Light_On
':
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
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
':
State transition table, state '
Off
':
State transition table, state '
On
':
State transition table, state '
Undefined
':
State transition table, state '
Going
':
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
Object name: TrainPosition:0:Right
Object name: TrainPosition:1:Left
Object name: TrainPosition:1:Right
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
':
State transition table, state '
DelayStart
':
State transition table, state '
Start
':
State transition table, state '
Disabled
':
State transition table, state '
NoTrain
':
State transition table, state '
Coming
':
State transition table, state '
Approaching
':
State transition table, state '
ApprPresent
':
State transition table, state '
Present
':
State transition table, state '
AllPresent
':
State transition table, state '
LeavPresent
':
State transition table, state '
Leaving
':
State transition table, state '
Going
':
State transition table, state '
Unexpected
':
State transition table, state '
Missing
':
Total number of states: 15
VFSM type: DO8(unit)
Prefix: DOU
Object name: DO8:Unit3
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
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)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||