SlideShare a Scribd company logo
Traffic Rules and Road
Safety
Jaskamal Singh
XI Ramanujam
09
2
Plan for today
Modeling Traffic Light Controller in SMV
Properties to Check
Four different SMV models for traffic
light controller
3
N
S
W
Scenario
4
N
S
W
No turning
5
N
S
W
Binary
traffic
lights
6
N
S
W
Safety
Property
This should not
happen
7
N
S
W
Safety
Property
This should not
happen
8
N
S
W
Liveness
Property
When will the
stupid light
become
green again
9
N
S
W
Liveness
Property
Thank God!
Traffic in each
direction must
be served
10
N
S
W
SMV
variables N-go=0
S-go=0 W-go=1
Three Boolean
variables track the
status of lights
11
N
S
W
SMV variables
Three Boolean
variables sense
the traffic in each
direction
N-sense =1
S-sense =1
W-sense =0
These variables are
called N, Sy, W in the
code I will show you
12
Properties we would like to check
Mutual exclusion
 SPEC AG !(W-Go & (N-Go | S-Go))
Liveness in North direction
SPEC AG(N-sense & !N-Go -> AF N-Go)
Similar liveness properties for south and west
13
Properties we would like to check
No strict sequencing
We don’t want the traffic lights to give turns to each other
(if there is no need for it)
For example, if there is no traffic on west lane, we do not
want W-go becoming 1 periodically
We can specify such properties atleast partially
 AG(W-Go -> A[W-Go U (!W-Go & A[!W-Go U (N-Go | S-Go)])])
See code other such properties
We want these properties to FAIL
14
N
S
W
SMV
modules
North module
will control
South module
will control
West module
will control
Main module will
-Initialize variables
-Start north, south,
west modules
15
N
S
W
What if north light
is always green
and there is always
traffic in north
direction
16
Fairness Constraints
 What if north light is always green and there is
always traffic in north direction
 We will avoid such scenarios by means of fairness
constraints
 FAIRNESS running & !(N-Go & N-sense)
 On an infinite execution, there are infinite number of
states where either north light is not green or there is
no traffic in north direction
 Similar, fairness constraints for south and west
directions
17
Now we look at some concrete
implementations
18
Some more variables
To ensure mutual exclusion
We will have two Boolean variables
NS-Lock: denotes locking of north/south lane
EW-Lock: denotes locking of west lane
To remember that there is traffic on a lane
Boolean variables: N-Req, S-Req, W-Req
If N-sense becomes 1, then N-Req is set to true
Similarly, for others….
19
Traffic1.smvMODULE main
VAR
N : boolean; --senses traffic going along north
Sy : boolean; --senses traffic going along south
W : boolean; --senses traffic going westward
N-Req : boolean; --rememebers that there is traffic along north that needs to go
S-Req : boolean; --rememebers that there is traffic along south that needs to go
W-Req : boolean; --rememebers that there is traffic along west that needs to go
N-Go : boolean; --north direction green light on
S-Go : boolean; --south direction green light on
W-Go : boolean; --west direction green light on
NS-Lock : boolean; --north/south lane locked
EW-Lock : boolean; --east/west lane locked
north : process north1(NS-Lock, EW-Lock, N-Req, N-Go,N,S-Go);
south : process south1(NS-Lock,EW-Lock,S-Req,S-Go,Sy,N-Go);
west : process west1(NS-Lock,EW-Lock,W-Req,W-Go,W);
ASSIGN
init(NS-Lock) := 0; init(Sy) := 0;
init(W) := 0;
init(W-Req) := 0; …………………..OTHER INITIALIZATIONS
20
Model checking traffic2.smv
Mutual exclusion property is satisfied
Liveness property for North direction fails
 AG ((N & !N-Go) -> AF N-Go) is false
21
Counterexample for liveness
property contains a loop
North.state=entering
S-sense=1,
W-sense=1
EW-lock=1
west.state = critical
W-Go=1
NS-lock=1
south.state = critical
S-Go=1
22
Counterexample for liveness
property contains a loop
North.state=entering
S-sense=1,
W-sense=1
EW-lock=1
west.state = critical
W-Go=1
NS-lock=1
south.state = critical
S-Go=1
North module given a chance to
execute here. But it is of no use 
23
Ensuring liveness requires more work
This is in traffic3.smv
Introduce a Boolean variable called turn
Give turn to others (if I have just exited the
critical section)
turn = {nst, ewt}
24
Model check again
Mutual exclusion holds
What about liveness properties
In north direction?
In south direction?
In west direction?
25
Model check again
Mutual exclusion holds
What about liveness properties
In north direction? HOLDS
In south direction? HOLDS
In west direction? FAILS 
26
Traffic4.smv 
Two more variables to distinguish between
north and south completion
ndone and sdone
When north module exits critical section
ndone is set to 1
Similarly for south module and sdone
When west module exits both sdone and
ndone are set to 0
27
Think about
How to allow north, south, east, west traffic
How to model turns
Instead of writing code for four modules have a
generic module
Instantitate it with four times. Once for each direction
Ensure properties without changing fairness
constraints
We will make the SMV code and slides available
Thanks and Avoid Rough
Driving to Save Your Life with
Others Life.
28

More Related Content

What's hot

Digital logic circuit
Digital logic circuitDigital logic circuit
Digital logic circuit
Abdul Mutal
 
М.Г.Гоман (2000 final) – Численный анализ нелинейной динамики систем
М.Г.Гоман (2000 final) – Численный анализ нелинейной динамики системМ.Г.Гоман (2000 final) – Численный анализ нелинейной динамики систем
М.Г.Гоман (2000 final) – Численный анализ нелинейной динамики систем
Project KRIT
 
Lc Electricity Mind Map
Lc Electricity Mind MapLc Electricity Mind Map
Lc Electricity Mind Map
ccss2008
 
Nyquist plot
Nyquist plotNyquist plot
Nyquist plot
Mrunal Deshkar
 
Polar Plot
Polar PlotPolar Plot
Polar Plot
Hussain K
 
Matlab robotics toolbox
Matlab robotics toolboxMatlab robotics toolbox
Matlab robotics toolbox
Rajesh Raveendran
 
Moudling of sensitivityof transfer function
Moudling of sensitivityof transfer functionMoudling of sensitivityof transfer function
Moudling of sensitivityof transfer function
pradeep kumar
 
Finite automata
Finite automataFinite automata
Finite automata
ManishTadhiyal
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
Aneeq Malik
 
Graph-based SLAM
Graph-based SLAMGraph-based SLAM
Graph-based SLAM
Pranav Srinivas Kumar
 
Nyquist Stability Criterion
Nyquist  Stability CriterionNyquist  Stability Criterion
Nyquist Stability Criterion
Hussain K
 
COMBINATIONAL CIRCUITS & FLIP FLOPS
COMBINATIONAL CIRCUITS & FLIP FLOPSCOMBINATIONAL CIRCUITS & FLIP FLOPS
COMBINATIONAL CIRCUITS & FLIP FLOPS
Starlee Lathong
 
Lect09 handout
Lect09 handoutLect09 handout
Lect09 handout
oyunbileg06
 
Robot kinematics
Robot kinematicsRobot kinematics
Robot kinematics
Varinder Singh
 
state diagrams of flip flops
 state diagrams of flip flops state diagrams of flip flops
state diagrams of flip flops
Unsa Shakir
 
Kirchhoff’s laws
Kirchhoff’s lawsKirchhoff’s laws
Kirchhoff’s laws
amckaytghs
 
Rs flipflop or SR flipFlop
Rs flipflop or SR flipFlop Rs flipflop or SR flipFlop
Rs flipflop or SR flipFlop
Easy n Inspire L
 
Travelling Salesman Problem, Robotics & Inverse Kinematics
Travelling Salesman Problem, Robotics & Inverse KinematicsTravelling Salesman Problem, Robotics & Inverse Kinematics
Travelling Salesman Problem, Robotics & Inverse Kinematics
mcoond
 
Trts d flip flop1
Trts d flip flop1Trts d flip flop1
Trts d flip flop1
abdullah254el
 
D flip flop in Digital electronics
D flip flop in Digital electronicsD flip flop in Digital electronics
D flip flop in Digital electronics
Easy n Inspire L
 

What's hot (20)

Digital logic circuit
Digital logic circuitDigital logic circuit
Digital logic circuit
 
М.Г.Гоман (2000 final) – Численный анализ нелинейной динамики систем
М.Г.Гоман (2000 final) – Численный анализ нелинейной динамики системМ.Г.Гоман (2000 final) – Численный анализ нелинейной динамики систем
М.Г.Гоман (2000 final) – Численный анализ нелинейной динамики систем
 
Lc Electricity Mind Map
Lc Electricity Mind MapLc Electricity Mind Map
Lc Electricity Mind Map
 
Nyquist plot
Nyquist plotNyquist plot
Nyquist plot
 
Polar Plot
Polar PlotPolar Plot
Polar Plot
 
Matlab robotics toolbox
Matlab robotics toolboxMatlab robotics toolbox
Matlab robotics toolbox
 
Moudling of sensitivityof transfer function
Moudling of sensitivityof transfer functionMoudling of sensitivityof transfer function
Moudling of sensitivityof transfer function
 
Finite automata
Finite automataFinite automata
Finite automata
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Graph-based SLAM
Graph-based SLAMGraph-based SLAM
Graph-based SLAM
 
Nyquist Stability Criterion
Nyquist  Stability CriterionNyquist  Stability Criterion
Nyquist Stability Criterion
 
COMBINATIONAL CIRCUITS & FLIP FLOPS
COMBINATIONAL CIRCUITS & FLIP FLOPSCOMBINATIONAL CIRCUITS & FLIP FLOPS
COMBINATIONAL CIRCUITS & FLIP FLOPS
 
Lect09 handout
Lect09 handoutLect09 handout
Lect09 handout
 
Robot kinematics
Robot kinematicsRobot kinematics
Robot kinematics
 
state diagrams of flip flops
 state diagrams of flip flops state diagrams of flip flops
state diagrams of flip flops
 
Kirchhoff’s laws
Kirchhoff’s lawsKirchhoff’s laws
Kirchhoff’s laws
 
Rs flipflop or SR flipFlop
Rs flipflop or SR flipFlop Rs flipflop or SR flipFlop
Rs flipflop or SR flipFlop
 
Travelling Salesman Problem, Robotics & Inverse Kinematics
Travelling Salesman Problem, Robotics & Inverse KinematicsTravelling Salesman Problem, Robotics & Inverse Kinematics
Travelling Salesman Problem, Robotics & Inverse Kinematics
 
Trts d flip flop1
Trts d flip flop1Trts d flip flop1
Trts d flip flop1
 
D flip flop in Digital electronics
D flip flop in Digital electronicsD flip flop in Digital electronics
D flip flop in Digital electronics
 

Viewers also liked

The 5 rules of road safety
The 5 rules of road safetyThe 5 rules of road safety
The 5 rules of road safety
vassiliki delibalta
 
Road safety rules
Road safety rulesRoad safety rules
Road safety rules
pefstathiou
 
Rna christmas d1
Rna christmas d1Rna christmas d1
Rna christmas d1
pefstathiou
 
Traffic safety
Traffic safetyTraffic safety
Traffic safety
Then Murugeshwari
 
Awareness of traffic rules
Awareness of traffic rulesAwareness of traffic rules
Awareness of traffic rules
Aastha_Dhingra
 
ΜΙΝΙΟΝΣ Γ1 ΟΛΑ
ΜΙΝΙΟΝΣ Γ1 ΟΛΑΜΙΝΙΟΝΣ Γ1 ΟΛΑ
ΜΙΝΙΟΝΣ Γ1 ΟΛΑ
pefstathiou
 

Viewers also liked (6)

The 5 rules of road safety
The 5 rules of road safetyThe 5 rules of road safety
The 5 rules of road safety
 
Road safety rules
Road safety rulesRoad safety rules
Road safety rules
 
Rna christmas d1
Rna christmas d1Rna christmas d1
Rna christmas d1
 
Traffic safety
Traffic safetyTraffic safety
Traffic safety
 
Awareness of traffic rules
Awareness of traffic rulesAwareness of traffic rules
Awareness of traffic rules
 
ΜΙΝΙΟΝΣ Γ1 ΟΛΑ
ΜΙΝΙΟΝΣ Γ1 ΟΛΑΜΙΝΙΟΝΣ Γ1 ΟΛΑ
ΜΙΝΙΟΝΣ Γ1 ΟΛΑ
 

Similar to Traffic

Traffic
TrafficTraffic
Traffic
Kuldeep Chand
 
Lecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential LogicLecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential Logic
James Evangelos
 
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-FlopsFYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
Arti Parab Academics
 
The inGraph project and incremental evaluation of Cypher queries
The inGraph project and incremental evaluation of Cypher queriesThe inGraph project and incremental evaluation of Cypher queries
The inGraph project and incremental evaluation of Cypher queries
openCypher
 
Digital design slides for engineering
Digital  design   slides for engineeringDigital  design   slides for engineering
Digital design slides for engineering
kasheen2803
 
ingraph: Live Queries on Graphs
ingraph: Live Queries on Graphs ingraph: Live Queries on Graphs
ingraph: Live Queries on Graphs
Neo4j
 
B sc3 unit 5 sequencial lc
B sc3 unit 5 sequencial lcB sc3 unit 5 sequencial lc
B sc3 unit 5 sequencial lc
MahiboobAliMulla
 
Flip Flops DLD
Flip Flops DLDFlip Flops DLD
Flip Flops DLD
Assad Shehbaz
 
SVM Simulation for three level inverter
SVM Simulation for three level inverterSVM Simulation for three level inverter
SVM Simulation for three level inverter
ZunAib Ali
 
Introduction to Sequential DevicesChapter 66.1 M.docx
Introduction to Sequential DevicesChapter 66.1 M.docxIntroduction to Sequential DevicesChapter 66.1 M.docx
Introduction to Sequential DevicesChapter 66.1 M.docx
bagotjesusa
 
Digital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptxDigital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptx
Thapar Institute
 
flip-flop1.ppt
flip-flop1.pptflip-flop1.ppt
flip-flop1.ppt
profabhishekranjan
 

Similar to Traffic (12)

Traffic
TrafficTraffic
Traffic
 
Lecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential LogicLecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential Logic
 
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-FlopsFYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
 
The inGraph project and incremental evaluation of Cypher queries
The inGraph project and incremental evaluation of Cypher queriesThe inGraph project and incremental evaluation of Cypher queries
The inGraph project and incremental evaluation of Cypher queries
 
Digital design slides for engineering
Digital  design   slides for engineeringDigital  design   slides for engineering
Digital design slides for engineering
 
ingraph: Live Queries on Graphs
ingraph: Live Queries on Graphs ingraph: Live Queries on Graphs
ingraph: Live Queries on Graphs
 
B sc3 unit 5 sequencial lc
B sc3 unit 5 sequencial lcB sc3 unit 5 sequencial lc
B sc3 unit 5 sequencial lc
 
Flip Flops DLD
Flip Flops DLDFlip Flops DLD
Flip Flops DLD
 
SVM Simulation for three level inverter
SVM Simulation for three level inverterSVM Simulation for three level inverter
SVM Simulation for three level inverter
 
Introduction to Sequential DevicesChapter 66.1 M.docx
Introduction to Sequential DevicesChapter 66.1 M.docxIntroduction to Sequential DevicesChapter 66.1 M.docx
Introduction to Sequential DevicesChapter 66.1 M.docx
 
Digital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptxDigital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptx
 
flip-flop1.ppt
flip-flop1.pptflip-flop1.ppt
flip-flop1.ppt
 

Recently uploaded

IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
Claudio Gallicchio
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
Frederic Leger
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
RIDHIMAGARG21
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptxThe remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
JiteshKumarChoudhary2
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
OECD Directorate for Financial and Enterprise Affairs
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
artemacademy2
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
gpww3sf4
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
samililja
 
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Rosie Wells
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
OECD Directorate for Financial and Enterprise Affairs
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
Robin Haunschild
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
kainatfatyma9
 
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
OECD Directorate for Financial and Enterprise Affairs
 
Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
gharris9
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 

Recently uploaded (20)

IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
 
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptxThe remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
 
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
 
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
 
Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 

Traffic

  • 1. Traffic Rules and Road Safety Jaskamal Singh XI Ramanujam 09
  • 2. 2 Plan for today Modeling Traffic Light Controller in SMV Properties to Check Four different SMV models for traffic light controller
  • 9. 9 N S W Liveness Property Thank God! Traffic in each direction must be served
  • 10. 10 N S W SMV variables N-go=0 S-go=0 W-go=1 Three Boolean variables track the status of lights
  • 11. 11 N S W SMV variables Three Boolean variables sense the traffic in each direction N-sense =1 S-sense =1 W-sense =0 These variables are called N, Sy, W in the code I will show you
  • 12. 12 Properties we would like to check Mutual exclusion  SPEC AG !(W-Go & (N-Go | S-Go)) Liveness in North direction SPEC AG(N-sense & !N-Go -> AF N-Go) Similar liveness properties for south and west
  • 13. 13 Properties we would like to check No strict sequencing We don’t want the traffic lights to give turns to each other (if there is no need for it) For example, if there is no traffic on west lane, we do not want W-go becoming 1 periodically We can specify such properties atleast partially  AG(W-Go -> A[W-Go U (!W-Go & A[!W-Go U (N-Go | S-Go)])]) See code other such properties We want these properties to FAIL
  • 14. 14 N S W SMV modules North module will control South module will control West module will control Main module will -Initialize variables -Start north, south, west modules
  • 15. 15 N S W What if north light is always green and there is always traffic in north direction
  • 16. 16 Fairness Constraints  What if north light is always green and there is always traffic in north direction  We will avoid such scenarios by means of fairness constraints  FAIRNESS running & !(N-Go & N-sense)  On an infinite execution, there are infinite number of states where either north light is not green or there is no traffic in north direction  Similar, fairness constraints for south and west directions
  • 17. 17 Now we look at some concrete implementations
  • 18. 18 Some more variables To ensure mutual exclusion We will have two Boolean variables NS-Lock: denotes locking of north/south lane EW-Lock: denotes locking of west lane To remember that there is traffic on a lane Boolean variables: N-Req, S-Req, W-Req If N-sense becomes 1, then N-Req is set to true Similarly, for others….
  • 19. 19 Traffic1.smvMODULE main VAR N : boolean; --senses traffic going along north Sy : boolean; --senses traffic going along south W : boolean; --senses traffic going westward N-Req : boolean; --rememebers that there is traffic along north that needs to go S-Req : boolean; --rememebers that there is traffic along south that needs to go W-Req : boolean; --rememebers that there is traffic along west that needs to go N-Go : boolean; --north direction green light on S-Go : boolean; --south direction green light on W-Go : boolean; --west direction green light on NS-Lock : boolean; --north/south lane locked EW-Lock : boolean; --east/west lane locked north : process north1(NS-Lock, EW-Lock, N-Req, N-Go,N,S-Go); south : process south1(NS-Lock,EW-Lock,S-Req,S-Go,Sy,N-Go); west : process west1(NS-Lock,EW-Lock,W-Req,W-Go,W); ASSIGN init(NS-Lock) := 0; init(Sy) := 0; init(W) := 0; init(W-Req) := 0; …………………..OTHER INITIALIZATIONS
  • 20. 20 Model checking traffic2.smv Mutual exclusion property is satisfied Liveness property for North direction fails  AG ((N & !N-Go) -> AF N-Go) is false
  • 21. 21 Counterexample for liveness property contains a loop North.state=entering S-sense=1, W-sense=1 EW-lock=1 west.state = critical W-Go=1 NS-lock=1 south.state = critical S-Go=1
  • 22. 22 Counterexample for liveness property contains a loop North.state=entering S-sense=1, W-sense=1 EW-lock=1 west.state = critical W-Go=1 NS-lock=1 south.state = critical S-Go=1 North module given a chance to execute here. But it is of no use 
  • 23. 23 Ensuring liveness requires more work This is in traffic3.smv Introduce a Boolean variable called turn Give turn to others (if I have just exited the critical section) turn = {nst, ewt}
  • 24. 24 Model check again Mutual exclusion holds What about liveness properties In north direction? In south direction? In west direction?
  • 25. 25 Model check again Mutual exclusion holds What about liveness properties In north direction? HOLDS In south direction? HOLDS In west direction? FAILS 
  • 26. 26 Traffic4.smv  Two more variables to distinguish between north and south completion ndone and sdone When north module exits critical section ndone is set to 1 Similarly for south module and sdone When west module exits both sdone and ndone are set to 0
  • 27. 27 Think about How to allow north, south, east, west traffic How to model turns Instead of writing code for four modules have a generic module Instantitate it with four times. Once for each direction Ensure properties without changing fairness constraints We will make the SMV code and slides available
  • 28. Thanks and Avoid Rough Driving to Save Your Life with Others Life. 28