Skip to content

Latest commit

 

History

History
195 lines (175 loc) · 1.96 KB

traffic-light.adoc

File metadata and controls

195 lines (175 loc) · 1.96 KB

TrafficLightFSM State Chart

TrafficLightFSM State Map

Start Event[Guard] Target Action

[start]

OFF

OFF

ON

RED

{
logger.info{"OFF:ON_OFF:$name"}
switchRed(true)
}

RED

GO

GREEN

{
logger.info{"RED:GO:$name"}
switchRed(false)
switchGreen(true)
}

RED

STOP

RED

{
logger.info{"RED:STOP:$name"}
switchGreen(false)
switchAmber(false)
switchRed(true)
}

RED

OFF

OFF

{
logger.info{"RED:ON_OFF:$name"}
switchGreen(false)
switchAmber(false)
switchRed(false)
}

RED

FLASH

FLASHING_ON

{
logger.info{"RED:FLASH:$name"}
}

AMBER

<<timeout = {amberTimeout}>>

RED

{
logger.info{"AMBER:timeout:$name"}
switchRed(true)
switchAmber(false)
setStopped()
}

AMBER

STOP

AMBER

{
logger.info{"AMBER:STOP:$name"}
}

AMBER

OFF

OFF

{
logger.info{"AMBER:ON_OFF:$name"}
switchGreen(false)
switchAmber(false)
switchRed(false)
}

GREEN

STOP

AMBER

{
logger.info{"GREEN:STOP:$name"}
switchGreen(false)
switchAmber(true)
}

GREEN

OFF

OFF

{
logger.info{"GREEN:OFF:$name"}
switchGreen(false)
switchAmber(false)
switchRed(false)
}

FLASHING_ON

<<timeout = {flashingOnTimeout}>>

FLASHING_OFF

{
switchRed(false)
}

FLASHING_ON

OFF

OFF

{
logger.info{"FLASHING_ON:OFF:$name"}
switchGreen(false)
switchAmber(false)
switchRed(false)
}

FLASHING_ON

STOP

RED

{
}

FLASHING_OFF

<<timeout = {flashingOffTimeout}>>

FLASHING_ON

{
switchRed(true)
}

FLASHING_OFF

OFF

OFF

{
logger.info{"FLASHING_OFF:OFF:$name"}
}

FLASHING_OFF

STOP

RED

{
switchRed(true)
}