0% found this document useful (0 votes)
27 views3 pages

Assignment 3

This document contains an assignment with 3 questions about modeling state machines and writing temporal logic properties. Question 1 involves modeling a cruise control system with states like active, deactivated, etc. Question 2 involves modeling a lighting system with states like occupied, unoccupied, illuminated, etc. Question 3 asks to write temporal logic expressions corresponding to 6 properties of the state machine models from questions 1 and 2. The assignment is due on October 13, 2010 and is worth 5% of the course grade.

Uploaded by

quang140788
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

Assignment 3

This document contains an assignment with 3 questions about modeling state machines and writing temporal logic properties. Question 1 involves modeling a cruise control system with states like active, deactivated, etc. Question 2 involves modeling a lighting system with states like occupied, unoccupied, illuminated, etc. Question 3 asks to write temporal logic expressions corresponding to 6 properties of the state machine models from questions 1 and 2. The assignment is due on October 13, 2010 and is worth 5% of the course grade.

Uploaded by

quang140788
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment 3

Due Date: Wednesday October 13, 2010 at class

State Machine Models and Temporal Logic Properties

This assignment is worth 5% of your course mark.

Question 1: State Machine Model #1

You are to write a state-machine model for an automobile cruise control system. When
active, the cruise control system keeps a car travelling steadily at a driver-specified speed,
without the driver having to keep his foot on the accelerator pedal. The cruise control
system can be activated only if the car is travelling at least 60 km/hr and if the brake is
not being pressed. An active cruise control system is automatically deactivated if the
driver engages the brake (presumably to react to road or traffic conditions). The driver
can resume a deactivated cruise control system. The cruise control system terminates
when the car’s ignition is turned off.

The driver interacts with the cruise control system via buttons on the steering wheel.
There are four input (button) events:
• activate - used to activate cruise control. The speed-to-be-maintained is initially the
current speed of the vehicle when cruise control is activated.
• inc - used, when cruise control is active, to increment the speed-to-be-maintained
• dec - used, when cruise control is active, to decrement the speed-to-be-maintained
• resume - used to resume cruise control, if the system is deactivated. When cruise
control is resumed, the speed-to-be-maintained will be whatever value it was when the
cruise control system was last active. The command to resume cruise control will succeed
only if the vehicle’s current speed is within 10 km/hr of the speed-to-be-maintained and if
the brake pedal is not being pressed.

In addition to the cruise control buttons, other inputs to the system are
• speed(value) - an event that communicates (via parameter value) the car’s current
speed
• brake pressed - an event that indicates that the driver has pressed the brake pedal
• brake released - an event indicating that the driver has stopped pressing the brake
pedal
• ignition off - an event that indicates that the car’s ignition has been turned off

The system’s outputs are commands to the car’s throttle, to accelerate or decelerate the
vehicle:
• accelerate - an output event to the throttle, to try to accelerate the car
• decelerate - an output event to the throttle, to try to decelerate the car
Draw a State Machine model of the described cruise control system. You may use any
state machine modelling construct presented in lecture. You are restricted to using only
the above input and output events. You do not need to declare these events. Do declare
any constants, variables, and functions that you use.

Question 2: State Machine Model #2

You are to write a state-machine model for a new safe and efficient system for lighting a
room. The new system avoids waste by automatically turning lights off when a room is
unoccupied.

The room is equipped with


• A collection of ceiling lights that are controlled as a group.
• A motion detector that senses the room every T seconds and determines whether
the room is occupied
• A dimmer dial that a user can use to set the brightness of the ceiling lights. The
dimmer's values range from 10% to 100% illumination

The requirements of the system are:


• The room is initially not illuminated.
• If a person occupies the room, there must be at least safe illumination in the room.
• If a user has set the light level in the room, the system should maintain that light
level as long as the room is occupied (assuming that the set-light level is at least as bright
as safe illumination)
• The lights should be off if the room as been unoccupied for T1 seconds
• If the room is reoccupied within T2 seconds since the last person left the room, then
the most recent set light level must be restored.
• If the room is reoccupied after more than T2 seconds since the last person left the
room, then the default light setting must be established. The default light setting is
brighter than safe illumination.

Draw a State Machine model of the described lighting system. You may use any state
machine modelling construct presented in lecture. Declare any constants, events,
variables and functions that you use.

Question 3: Temporal Logic

The following are properties of the above state machine models. For each of these
properties, write an equivalent temporal logic expression. Your formulae must be
expressions over your State Machines' events, states, and variables.

• When cruise control is active, pressing the inc button will cause the speed-to-be-
maintained to increase by 1.
• The brake is never depressed while cruise control is active.
• When cruise control is active and accelerating the car, it will continue to
accelerate until the car speed equals the speed-to-be-maintained or until cruise
control becomes inactive.
• The room is initially not illuminated.
• If the room is unoccupied, then if the room is not reoccupied, the lights will
eventually be turned off.
• When the room is occupied, it is illuminated and remains illuminated until the
room is unoccupied for T1 seconds.

You might also like