Question: A traffic light has a green, a green_soon, a yellow, and a red light. Lights can be on and off. A green_soon is red and

  • A traffic light has a green, a green_soon, a yellow, and a red light.
    • Lights can be on and off.
    • A green_soon is red and yellow together on
  • The traffic light has a normal mode of operation
    • At first, green is on.
    • After 5 seconds, green is off and yellow is on.
    • After 3 seconds, yellow is off and red is on.
    • After 7 seconds, red is off and green_soon is on.
    • After 1 second, green_soon is off and green is on.
    • Go back to "green is on state" above and repeat (I AM HERE)
  • Traffic lights red light can be interrupted by a pedestrian by using a button
    • In this case, it will directly go to green_soon mode without waiting 5 seconds in red.
  • A police officer can switch the traffic light into and out of emergency mode
    • In emergency mode, the yellow blinks every 0.5 seconds
    • When exiting emergency mode, the traffic light goes back to its normal operation
  • The traffic light can be completely turned off and turned on again
    • When turned back on, it resumes the previous mode of operation
  • The traffic light has a party mode.
    • In party mode, it will randomly turn on lamps for some random amount of time among [0.5, 1, 1.5, 2, 2.5] and turn off in cycles until party mode is done.
    • When exiting party mode, the traffic light goes back to its starting state

When designing the statechart, put underscores for the transitions, that can't be fired manually. (like tick, it should be _tick)

Don't put scripts inside transitions. Executable content should be inside states. (Even though the following bulb example has scripts inside transitions, you must not!)

Submission will be one single scxml file designed in scxml-gui.jar I just need a bit of help with the parts after the normal mode of operation. Any and all help would be greatly appreciated.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!