Starting from:
$30

$24

ECE Assignment 4 Solution

This question asks you to provide the Petri Net (PN) model of the traffic light system that was elicited during the laboratories and which is shown on the right.

Your solution should include:
    1. (4 pts) A graph representing your model, i.e., a screenshot showing the initial marking that represents the Default state included in the PDF AND the model as xml file submitted on eClass before the deadline. The xml file must be created with PIPE 4.3.0 that can be downloaded from

https://sourceforge.net/projects/pipe2/files/PIPEv4/PIPEv4.3.0/ Try to make your model as neat as possible.
    2. (4 pts) A description of all transitions used in the graph

        1. List all transitions and describe what each of them does
    3. (2 pts) The answer to the following three questions

        1. Is your model conservative? Explain why.
        2. Can we have a deadlock in your model?
        3. Can we have a starvation in your model? If yes then show an example corresponding cycle and list the transitions that will starve. Discuss if this starvation could happen in the actual live traffic lights system, and if yes, explain in words how to prevent it.

Your system will use the following definition of states to derive the PN model:

Inputs
1
2
3
G1
G3
P1
P2
P3
M
C
T1
T2
B3*
S2**
Valid states for given
G,
G,
G,
On,
On,
G,
G,
G,
On,
D,
On,
On,
On,
On,
input
R,
R,
R,


R,
R,
R,










Off
Off



Off
N
Off
Off
Off
Off
System states
Off
FR
FR


Off
Off
Off





















Default
G
R
R
Off
Off
R
G
R
Off
D
On
Off
Off
Off
DefaultB3
G
R
R
Off
Off
R
G
R
Off
D
On
Off
On
Off
DefaultS2
G
R
R
Off
Off
R
G
R
Off
D
On
Off
Off
On
DefaultB3S2
G
R
R
Off
Off
R
G
R
Off
D
On
Off
On
On
GreenP3
G
R
R
Off
Off
R
G
G
Off
D
Off
On
On
Off
GreenP3S2
G
R
R
Off
Off
R
G
G
Off
D
Off
On
On
On
GreenG1
R
R
R
On
Off
G
R
R
Off
D
Off
On
Off
Off
GreenG1S2
R
R
R
On
Off
G
R
R
Off
D
Off
On
Off
On
Green3
R
R
G
Off
On
R
R
R
Off
D
Off
On
Off
Off
Green3S2
R
R
G
Off
On
R
R
R
Off
D
Off
On
Off
On
Green2and3
R
G
G
Off
Off
R
R
R
Off
D
Off
On
Off
Off
Emergency
Off
FR
FR
Off
Off
Off
Off
Off
On
D/N
Off
Off
Off
Off
Night
Off
FR
FR
Off
Off
Off
Off
Off
Off
N
Off
Off
Off
Off


M denotes malfunction flag; C clock (day vs. night); T1 and T2 are timers

    • “B3 = On” only if B3 was pressed before leaving the Default state ** “S2 = On” only if S2 was active before leaving the Default state
The transitions between the states are described by the following transition function table:


System
TimerT1fires
B3pressed
S2activated
TimerT2fires
ClockCindicatesDaytime
ClockCindicatesNighttime
MalfunctionMoccurs
ResetbuttonRispressedandnomalfunctionMandClockCindicatesDaytime
ResetbuttonRispressedandnomalfunctionMandClockCindicatesNighttime
inputs



















States









Default
GreenG1
DefaultB3
DefaultS2


Night
Emergency


DefaultB3
GreenP3

DefaultB3S2


Night
Emergency


DefaultS2
GreenG1S2
DefaultB3S2



Night
Emergency


DefaultB3S2
GreenP3S2




Night
Emergency


GreenP3



GreenG1


Emergency


GreenP3S2



GreenG1S2


Emergency


GreenG1



Green3


Emergency


GreenG1S2



Green3S2


Emergency


Green3



Default


Emergency


Green3S2



Green2and3


Emergency


Green2and3



Default


Emergency


Emergency






Emergency
Default
Night
Night




Default

Emergency



    • The Petri Net model has to follow the below assumptions
        ◦ Places represent the objects, not the states of the entire system (in contrast to the Finite State Machine model), e.g. you will have a place for traffic lights 1, traffic lights 2, etc. See below for the list of places that are in the model.
        ◦ Each transition is enabled based on its input places

            ▪ You may need to define multiple (duplicate) transitions that will model the same physical input that changes system state, e.g. for the timer in the default state, but which will be enabled in different states
        ◦ Inputs from the two sensors (B3 and S2) are considered/acknowledged only in the Default state; columns B3 and S2 represent the state of the inputs as read in the Default state. If they were not triggered in Default but became triggered in a subsequent state, then they are not going to be acted upon until after the Default states. It is possible that both inputs, one of the inputs, or none of the inputs are triggered. They are activated (set to On) one at the time, i.e., never at the same time. At the time when Timer1 (T1) expires, the possible configurations are that both inputs, one of the inputs, or none of the inputs are triggered.

        ◦ The switch to the Night state is possible only in the “Default” states (including Default, DefaultB3, DefaultS2 and DefaultB3S2). Your model has to reset the values in the B3 and S2 columns (set them to Off) when you transition out of the Default state, i.e., when the Night time input is read.
    • To simplify the model, the Emergency state is disregarded (shadowed cells in the tables above should be ignored). Other than that, the Petri Net model must represent the complete behavior of the system
    • It is not allowed to modify the above physical representation of the system states (colors of the lights, setup of the timers, malfunction input, etc.)
    • Remember to list any additional assumptions about your model, if you make any
    • Use the input and input state abbreviations, as defined in the above table, in your model. Renaming will result in deductions.
    • Use PIPE 4.3.0
    • Remember that Petri Nets are nondeterministic

        ◦ They fire one of the enabled transitions non-deterministically
        ◦ You do not have the control of which one
        ◦ One of the enabled transitions is selected randomly, which means that you need to simulate and verify all possibilities

Due Dates and Notes


Please submit one PDF file and one XML file.

HINT: LIST OF STATES

To make the task a bit simpler, the list of all states (21 in total) with their meanings is listed below.

Please use the same names in your model.
    • 1 and 1_OFF – status of lights 1
        ◦ 0 tokens in 1 & 1 token in 1 OFF – 1 is turned off
        ◦ 1 token in 1 & 0 tokens in 1 OFF – Green
        ◦ 0 tokens in 1 & 0 tokens in 1 OFF – Red
    • 2 and 2_FR – status of lights 2
        ◦ 0 tokens in 2 & 1 token in 2 FR – Flashing Red
        ◦ 1 token in 2 & 0 tokens in 2 FR – Green
        ◦ 0 tokens in 2 & 0 tokens in 2 FR – Red
    • 3 and 3_FR – status of lights 3
        ◦ 0 tokens in 3 & 1 token in 3 FR – Flashing Yellow
        ◦ 1 token in 3 & 0 tokens in 3 FR – Green
        ◦ 0 tokens in 3 & 0 tokens in 3 FR – Red
    • G1 – status of arrow G1
        ◦ 0 tokens – Off
        ◦ 1 token – On
    • G3 – status of arrow G3
        ◦ 0 tokens – Off
        ◦ 1 token – On
    • P1 and P1_OFF – status of pedestrian lights P1
        ◦ 0 tokens in P1 & 1 token in P1 OFF – Off
        ◦ 1 token in P1 & 0 tokens in P1 OFF – Green
        ◦ 0 tokens in P1 & 0 tokens in P1 OFF – Red
    • P2 and P2_OFF – status of pedestrian lights P2
        ◦ 0 tokens in P2 & 1 token in P2 OFF – Off
        ◦ 1 token in P2 & 0 tokens in P2 OFF – Green
        ◦ 0 tokens in P2 & 0 tokens in P2 OFF – Red
    • P3 and P3_OFF – status of pedestrian lights P3
        ◦ 0 tokens in P3 & 1 token in P3 OFF – Off
        ◦ 1 token in P3 & 0 tokens in P3 OFF – Green
        ◦ 0 tokens in P3 & 0 tokens in P3 OFF – Red
    • T1 – status of Timer1
        ◦ 0 tokens in T1 – Timer1 Off
        ◦ 1 token in T1 – Timer1 On
    • T2 – status of Timer2
        ◦ 0 tokens in T2 – Timer2 Off
        ◦ 1 token in T2 – Timer2 On
    • S2_ON and S2_OFF – status of sensor S2 as read in default state
        ◦ 0 tokens in S2 ON & 1 token in S2 OFF – S2 is Off
        ◦ 1 tokens in S2 ON & 0 tokens in S2 OFF – S2 is On
    • B3_ON and B3_OFF – status of pedestrian button B3 as read in default state

        ◦ 0 tokens in B3 ON & 1 token in B3 OFF – B3 is Off
        ◦ 1 tokens in B3 ON & 0 tokens in B3 OFF – B3 is On
    • Clock – status of Clock
        ◦ 0 tokens in Clock – Clock indicates Day time
        ◦ 1 token in Clock – Clock indicates Night time

More products