Answered step by step
Verified Expert Solution
Link Copied!

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 3possible 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 3-light 3-state trafficlight system (see illustration below) to a 4-light 5-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 5 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 4 lights in the new system are as follows:
1. Red
2. Amber
3. Green
4. Advance left turn(Green to Amber)
The sequence of a 4-light 5-state system is shown in the above illustration. Below are the 5-states including the time duration for each state:
1. Solid Green + Advanced Left Green Arrow [15 seconds]
2. Solid Green + Advanced Left Amber Arrow [5 seconds]
3. Solid Green + Advanced Left Arrow (off)[45 seconds]
4. Solid Amber [10 seconds]
5. Solid Red [?? seconds YOU FIGURE THIS OUT ]
Additional Features
Request-To-Walk 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 red-light state. This request will reduce the remainingwait time of the red-light state to 10 seconds.
Car Sensor
There is a sensor mounted on the light fixtures that monitors the number of waiting cars whenin a red-light state. When the number of cars waiting reaches 5 or more, the sensor will triggerthe system to reduce the remaining wait time of the red-light state to 10 seconds.
Interrupt
The defined system should take in to account an interrupt. This is something that can occurat any time and will take over/supersede 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 (4-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 3 :Define a red-light 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=50 sec., Amber=20 sec. give me a pseudocode of this logic

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions

Question

Population

Answered: 1 week ago