VFSM: Intersection

VFSM type: Intersection(user vfsm)
The state machine Intersection realizes a standard traffic light algorithmus changing periodically green - yellow - red lights for crossing roads. This standard algorithm is in force if the sensor detects a vehicle on the Farm road, otherwise the Highway has the green light all the time. The names of the states correspond to the light state, for instance: HGreen_FRed means the Highway has a green light and the Farm road has a red light.

Prefix: INT

IOid name: MyCmd (type: CMD-IN)

IOid name: Ti_BothRed (type: TI)
-->Virtual Input: Ti_BothRed_OVER (OVER)
-->Virtual Output: Ti_BothRed_ResetStart (ResetStart)
-->Virtual Output: Ti_BothRed_Stop (Stop)

IOid name: Ti_Green (type: TI)
-->Virtual Input: Ti_Green_OVER (OVER)
-->Virtual Output: Ti_Green_ResetStart (ResetStart)
-->Virtual Output: Ti_Green_Stop (Stop)

IOid name: Ti_Init (type: TI)
-->Virtual Input: Ti_Init_OVER (OVER)
-->Virtual Output: Ti_Init_ResetStart (ResetStart)
-->Virtual Output: Ti_Init_Stop (Stop)

IOid name: Ti_Yellow (type: TI)
-->Virtual Input: Ti_Yellow_OVER (OVER)
-->Virtual Output: Ti_Yellow_ResetStart (ResetStart)
-->Virtual Output: Ti_Yellow_Stop (Stop)

IOid name: Di_Detector (type: DI)
-->Virtual Input: Vehicle_DETECTED (HIGH)

IOid name: Do_FarmroadGreen (type: DO)
-->Virtual Output: FarmroadGreen_Off (Low)
-->Virtual Output: FarmroadGreen_On (High)

IOid name: Do_FarmroadRed (type: DO)
-->Virtual Output: FarmroadRed_Off (Low)
-->Virtual Output: FarmroadRed_On (High)

IOid name: Do_FarmroadYellow (type: DO)
-->Virtual Output: FarmroadYellow_Off (Low)
-->Virtual Output: FarmroadYellow_On (High)

IOid name: Do_HighwayGreen (type: DO)
-->Virtual Output: HighwayGreen_Off (Low)
-->Virtual Output: HighwayGreen_On (High)

IOid name: Do_HighwayRed (type: DO)
-->Virtual Output: HighwayRed_Off (Low)
-->Virtual Output: HighwayRed_On (High)

IOid name: Do_HighwayYellow (type: DO)
-->Virtual Output: HighwayYellow_Off (Low)
-->Virtual Output: HighwayYellow_On (High)

State transition table, state ' Init ':
On startup FSM goes always to the to the state HYellow_FRed_Init.

Init
EntryAction:
ExitAction:
HYellow_FRed_Init
always

State transition table, state ' HYellow_FRed_Init ':
The Highway yellow light and the Farm road red light are switched on for a while: the duration being defined by the Ti_Yellow timer.

HYellow_FRed_Init
EntryAction:
HighwayYellow_On
FarmroadRed_On
Ti_Yellow_ResetStart
ExitAction:
Ti_Yellow_Stop
HGreen_FRed
Ti_Yellow_OVER

State transition table, state ' HGreen_FRed ':
The Highway has a free way: the Highway green light is on and the yellow is off. This situation stays stable until a vehicle is detected on the Farm road. The minimum duration of this phase is determined by the Ti_Green timer.

HGreen_FRed
EntryAction:
HighwayGreen_On
HighwayYellow_Off
Ti_Green_ResetStart
ExitAction:
Ti_Green_Stop
HYellow_FRed
Vehicle_DETECTED and Ti_Green_OVER

State transition table, state ' HYellow_FRed ':
The state determines the yellow phase for the Highway: the Highway green light is switched off and the yellow light is switched on but the Farm road red light does not change - it stays still on.

HYellow_FRed
EntryAction:
HighwayGreen_Off
HighwayYellow_On
Ti_Yellow_ResetStart
ExitAction:
Ti_Yellow_Stop
HRed_FRed1
Ti_Yellow_OVER

State transition table, state ' HRed_FRed1 ':
Both roads see the red light.

HRed_FRed1
EntryAction:
HighwayYellow_Off
HighwayRed_On
Ti_BothRed_ResetStart
ExitAction:
Ti_BothRed_Stop
HRed_FYellow1
Ti_BothRed_OVER

State transition table, state ' HRed_FYellow1 ':
The Farm road has the yellow phase, the Highway sees already the red lights.

HRed_FYellow1
EntryAction:
FarmroadRed_Off
FarmroadYellow_On
Ti_Yellow_ResetStart
ExitAction:
Ti_Yellow_Stop
HRed_FGreen
Ti_Yellow_OVER

State transition table, state ' HRed_FGreen ':
The Farm road has a free way: the Highway red light and the Farm road green light are on. The duration of this phase is determined by the Ti_Green timer.

HRed_FGreen
EntryAction:
FarmroadYellow_Off
FarmroadGreen_On
Ti_Green_ResetStart
ExitAction:
Ti_Green_Stop
HRed_FYellow2
Ti_Green_OVER

State transition table, state ' HRed_FYellow2 ':
The state determines the yellow phase for the Farm road: the Farm road green light is switched off and the yellow light is switched on but the Highway red light does not change - it stays still on.

HRed_FYellow2
EntryAction:
FarmroadGreen_Off
FarmroadYellow_On
Ti_Yellow_ResetStart
ExitAction:
Ti_Yellow_Stop
HRed_FRed2
Ti_Yellow_OVER

State transition table, state ' HRed_FRed2 ':
Both roads see the red light.

HRed_FRed2
EntryAction:
FarmroadYellow_Off
FarmroadRed_On
Ti_BothRed_ResetStart
ExitAction:
Ti_BothRed_Stop
HYellow_FRed2
Ti_BothRed_OVER

State transition table, state ' HYellow_FRed2 ':
The Highway has the yellow phase, the Farm road sees already the red lights.

HYellow_FRed2
EntryAction:
HighwayRed_Off
HighwayYellow_On
Ti_Yellow_ResetStart
ExitAction:
Ti_Yellow_Stop
HGreen_FRed
Ti_Yellow_OVER
Total number of states: 10