Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Workshop Overview Finite state machines are around us everywhere. State machines put simply, are logical unitsthat are limited to being in only one state at
Workshop Overview
Finite state machines are around us everywhere. State machines put simply, are logical unitsthat are limited to being in only one state at any given time. A finite state machine is one thatis limited to a defined set of states there are defined limits to the number of possible states itcan be in
Traffic lights are a good example of finite state machines. In a typical traffic light, there are possible states: Green go Amber dont begin to cross the intersection because the red lightis about to trigger and Red stop Each state is strictly timed can be different in duration foreach state and synchronized with the opposing set of lights.
Workshop Details
A busy intersection in downtown Toronto needs to upgrade the current light state trafficlight system see illustration below to a light state system to address an increasingly heavydemand for left turns. A computer simulation needs to be developed as a proof of concept.
Looking at the light that is red, we see the cars are stopped, waiting for the light to turn green.If of more cars line up the car sensor will signal the light to turn green sooner, as describedbelow. The pedestrian who wants to go in the same direction as the cars stopped on the redlight is also stopped. If the pedestrian presses the walk button on the light pole, this will alsodecrease the wait time for the red light as described below.The lights in the new system are as follows:
Red
Amber
Green
Advance left turnGreen to Amber
The sequence of a light state system is shown in the above illustration. Below are the states including the time duration for each state:
Solid Green Advanced Left Green Arrow seconds
Solid Green Advanced Left Amber Arrow seconds
Solid Green Advanced Left Arrow off seconds
Solid Amber seconds
Solid Red seconds YOU FIGURE THIS OUT
Additional Features
RequestToWalk Button
A button is provided for pedestrians to press to alert the system a person needs to cross. This isonly effective when the lights are in a redlight state. This request will reduce the remainingwait time of the redlight state to seconds.
Car Sensor
There is a sensor mounted on the light fixtures that monitors the number of waiting cars whenin a redlight state. When the number of cars waiting reaches or more, the sensor will triggerthe system to reduce the remaining wait time of the redlight state to seconds.
Interrupt
The defined system should take in to account an interrupt This is something that can occurat any time and will take oversupersede the active state. Examples of this type of interruptioncan be the traffic controllers setting all lights to flash amber for caution or to flash red waystop etc... You dont need to specify what the interrupt should do only account for it bychecking if there is an interrupt to the normal process flow and how the system shouldresume when the interrupt has completed.
Logic :Define a redlight waiting sequence do not include the other light states with arequest to walk button and a car sensor Determine the red light duration if the followingdurations are applied to the other light states: Green sec Amber sec give me a pseudocode of this logic
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started