Uploaded by Mich25educ

ES Assignment

advertisement
UNIVERSITE DE BAMENDA
REPUBLIC OF CAMEROON
Peace –Work –Fatherland
ECOLE NATIONALE SUPERIEURE
THE UNIVERSITY OF BAMENDA
-------------------
POLYTECHNIQUE
(N.A.H.P.I) BAMBILI BAMENDA
(ENSPB)
P.O BOX, 39 BAMBILI
NATIONAL HIGHER POLYTECHNIC INSTITUTE OF THE
UNIVERSITY OF BAMENDA
DEPARTMENT: COMPUTER ENGINEERING
ASSIGNMENT
COURSE CODE: COME3103
COURSE TITLE: INTRODUCTION TO EMBEDDED SYSTEMS
PRESENTED
By
NDJOCK MICHEL JUNIOR
UBa17E0002
LECTURER:
DR. MPAME TETCHEWO T. GUILENE
March 10 th 2019
1
Introduction
We are going to sketch the FSM of a traffic lights control system which contains two traffic light units one
in direction1 and the other in direction 2 as shown bellow.
Direction2
Direction1

We assume that the traffic light system is based only on a timer, with a fixed amount of time
between each transition of states.
FSM Diagram

We have four (4) possible states in our traffic system, and at each point in time the system must
be in one of the four states.

We will consider the following notation to denote the states of the system:
Green (G) which means cars can move.
Yellow(Y) which means car should prepare to stop.
Red(R) which means cars should stop.
G1: The light is green in direction 1
G2: The light is green in direction 2
2
R1: The light is red in direction 1
3
R2: The light is red in direction 2
Y1: The light is yellow in direction1
Y2: The light is yellow in direction2
The States of the System:
Our system can be in the four following states only:
-
G1R2 (45 seconds)
Y1R2 (5 seconds)
R1G2 (45 seconds)
R1Y2 (5 seconds)
A Sketch of the FSM diagram for these states is shown bellow:
G1R2
Do: wait for
45s
R1Y2
Y1R2
Do: wait for 5s
Do: Wait for 5s
R1G2
Do: Wait for 5 s
4
Time Frame with Rate Scheduling Algorithm
We have four tasks corresponding to the four states of the traffic lights system to be scheduled.
The tasks will be represented as follows:
(C, T) where C is the Critical execution time and T is the Period
The four tasks will all have a period of 100s hence they will have the same priority.
G1R2 :(45,100)
Y1R2: (5,100)
R1G2: (45,100)
R1Y2: (5,100)
Task
C (in seconds)
T (in seconds)
G1R2
Y1R2
R1G2
R1Y2
45
5
45
5
100
100
100
100
Since all tasks have the same priority (all periods are the same) we assume G1R1 is first
executed.
The time frame is as below:
First Cycle
G1R2
0
Y1R2
Second Cycle
R1G2
R1Y2
95 100
45 50
5
G1R2
145
time/s
Download