SlideShare a Scribd company logo
%% Modeling a Distributed Traffic Control System Using Messages
%
% This example models an intersection of two 1-way roads controlled using a
% distributed control system. In order to coordinate the traffic light
% state between the two charts, the two charts communicate with each other
% via messages. The two charts can thus be completely identical.
% Copyright 2006-2015 The MathWorks, Inc.
%%
%
mdlName = 'sf_msg_traffic_light';
open_system(mdlName);
fig = figure(1);
set(fig, 'Visible', 'off');
%%
% A simple GUI to control the traffic signals has been created using
% MATLAB(R). The user can press the pedestrian request button under the
% pedestrian light to request a pedestrian crossing.
%
% <>
%
% The controller for each road is represented by a traffic light controller
% subsystem. In this example, these are represented using the "Traffic
% Light 1" and "Traffic Light 2" subsystems.
%
subsysName = [mdlName '/Traffic Light 1'];
open_system(subsysName);
%%
% The main logic in each subsystem is represented by a "Controller" chart
% which describes the various states of the traffic signal.
open_system([subsysName '/Controller']);
%%
% Messages are a convenient way to model such systems because of various
% semantic features of messages:
%
% * Messages are not discarded if they are not acted upon immediately. This
% allows us to model things like a pedestrian request naturally where the
% request is queued up till the traffic light turns red.
% * You can set up message "loops" between different components without
% needing to worry about algebraic loops.
% * Normally, input messages are destroyed at the end of the time step in
% which they are evaluated. However, you can preserve these input messages
% for use at a later time by temporarily forwarding them to a "holding"
% queue. This is demonstrated in the controller chart. In the outer
% transition flowgraph of the "Go" state, when you get a message from the
% other controller that a pedestrian request has been made on the other
% road, you temporarily store that request on a local queue
% "pedRequestLocal". You can then check for that message at a future point.
% In this case, you check for the presence of that message in the outer
% transition flowgraph of the "PrepareToStop" state.
close_system(mdlName);
close_system([mdlName '_lib']);

More Related Content

Similar to Sim matlab

Methods of Track Circuit Fault Diagnosis Based on Hmm
Methods of Track Circuit Fault Diagnosis Based on HmmMethods of Track Circuit Fault Diagnosis Based on Hmm
Methods of Track Circuit Fault Diagnosis Based on Hmm
IJRESJOURNAL
 
An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...
An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...
An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...
IOSR Journals
 
Fuzzy Model Presentation
Fuzzy Model Presentation Fuzzy Model Presentation
Fuzzy Model Presentation
NurudeenIshaq1
 
Review of Fuzzy Model
Review of Fuzzy Model Review of Fuzzy Model
Review of Fuzzy Model
NurudeenIshaq1
 
Modeling business management systems transportation
Modeling business management systems transportationModeling business management systems transportation
Modeling business management systems transportation
Sherin El-Rashied
 
Traffic assignment
Traffic assignmentTraffic assignment
Traffic assignment
MNIT,JAIPUR
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication Project
Assignmentpedia
 
RE 07 - art.02
RE  07 - art.02RE  07 - art.02
RE 07 - art.02
Francesco Flammini
 
Eryk_Kulikowski_a4
Eryk_Kulikowski_a4Eryk_Kulikowski_a4
Eryk_Kulikowski_a4
Eryk Kulikowski
 
Pdp12
Pdp12Pdp12
Adaptive Traffic Sampling and Management Platform
Adaptive Traffic Sampling and Management PlatformAdaptive Traffic Sampling and Management Platform
Adaptive Traffic Sampling and Management Platform
Amir Krifa
 
Aimaf
AimafAimaf
Aimaf
Saad RGUIG
 
CELLULAR AUTOMATA TRAFFIC FLOW MODEL
CELLULAR AUTOMATA TRAFFIC FLOW MODELCELLULAR AUTOMATA TRAFFIC FLOW MODEL
CELLULAR AUTOMATA TRAFFIC FLOW MODEL
Engr Abdurrashid Dada MNSE
 
Armour R&D Final Report_CYJong-Du
Armour R&D Final Report_CYJong-DuArmour R&D Final Report_CYJong-Du
Armour R&D Final Report_CYJong-Du
Chee Yie Jong
 
Traffic management
Traffic managementTraffic management
Traffic management
Nikil S Raaju
 
50620130101005
5062013010100550620130101005
50620130101005
IAEME Publication
 
Using Genetic Algorithm for Shortest Path Selection with Real Time Traffic Flow
Using Genetic Algorithm for Shortest Path Selection with Real Time Traffic FlowUsing Genetic Algorithm for Shortest Path Selection with Real Time Traffic Flow
Using Genetic Algorithm for Shortest Path Selection with Real Time Traffic Flow
IJCSIS Research Publications
 
CP Handout#6
CP Handout#6CP Handout#6
CP Handout#6
trupti1976
 
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
ijpla
 
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
ijpla
 

Similar to Sim matlab (20)

Methods of Track Circuit Fault Diagnosis Based on Hmm
Methods of Track Circuit Fault Diagnosis Based on HmmMethods of Track Circuit Fault Diagnosis Based on Hmm
Methods of Track Circuit Fault Diagnosis Based on Hmm
 
An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...
An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...
An Improvement on Route Recovery by Using Triangular Fuzzy Numbers on Route E...
 
Fuzzy Model Presentation
Fuzzy Model Presentation Fuzzy Model Presentation
Fuzzy Model Presentation
 
Review of Fuzzy Model
Review of Fuzzy Model Review of Fuzzy Model
Review of Fuzzy Model
 
Modeling business management systems transportation
Modeling business management systems transportationModeling business management systems transportation
Modeling business management systems transportation
 
Traffic assignment
Traffic assignmentTraffic assignment
Traffic assignment
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication Project
 
RE 07 - art.02
RE  07 - art.02RE  07 - art.02
RE 07 - art.02
 
Eryk_Kulikowski_a4
Eryk_Kulikowski_a4Eryk_Kulikowski_a4
Eryk_Kulikowski_a4
 
Pdp12
Pdp12Pdp12
Pdp12
 
Adaptive Traffic Sampling and Management Platform
Adaptive Traffic Sampling and Management PlatformAdaptive Traffic Sampling and Management Platform
Adaptive Traffic Sampling and Management Platform
 
Aimaf
AimafAimaf
Aimaf
 
CELLULAR AUTOMATA TRAFFIC FLOW MODEL
CELLULAR AUTOMATA TRAFFIC FLOW MODELCELLULAR AUTOMATA TRAFFIC FLOW MODEL
CELLULAR AUTOMATA TRAFFIC FLOW MODEL
 
Armour R&D Final Report_CYJong-Du
Armour R&D Final Report_CYJong-DuArmour R&D Final Report_CYJong-Du
Armour R&D Final Report_CYJong-Du
 
Traffic management
Traffic managementTraffic management
Traffic management
 
50620130101005
5062013010100550620130101005
50620130101005
 
Using Genetic Algorithm for Shortest Path Selection with Real Time Traffic Flow
Using Genetic Algorithm for Shortest Path Selection with Real Time Traffic FlowUsing Genetic Algorithm for Shortest Path Selection with Real Time Traffic Flow
Using Genetic Algorithm for Shortest Path Selection with Real Time Traffic Flow
 
CP Handout#6
CP Handout#6CP Handout#6
CP Handout#6
 
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
 
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
A SYSTEM FOR REMOTE MONITORING AND CONTROLLING OF DAMS
 

Recently uploaded

Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
IJECEIAES
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 

Recently uploaded (20)

Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 

Sim matlab

  • 1. %% Modeling a Distributed Traffic Control System Using Messages % % This example models an intersection of two 1-way roads controlled using a % distributed control system. In order to coordinate the traffic light % state between the two charts, the two charts communicate with each other % via messages. The two charts can thus be completely identical. % Copyright 2006-2015 The MathWorks, Inc. %% % mdlName = 'sf_msg_traffic_light'; open_system(mdlName); fig = figure(1); set(fig, 'Visible', 'off'); %% % A simple GUI to control the traffic signals has been created using % MATLAB(R). The user can press the pedestrian request button under the % pedestrian light to request a pedestrian crossing. % % <> % % The controller for each road is represented by a traffic light controller % subsystem. In this example, these are represented using the "Traffic % Light 1" and "Traffic Light 2" subsystems. % subsysName = [mdlName '/Traffic Light 1']; open_system(subsysName); %% % The main logic in each subsystem is represented by a "Controller" chart % which describes the various states of the traffic signal. open_system([subsysName '/Controller']); %% % Messages are a convenient way to model such systems because of various % semantic features of messages: % % * Messages are not discarded if they are not acted upon immediately. This % allows us to model things like a pedestrian request naturally where the % request is queued up till the traffic light turns red. % * You can set up message "loops" between different components without % needing to worry about algebraic loops. % * Normally, input messages are destroyed at the end of the time step in % which they are evaluated. However, you can preserve these input messages % for use at a later time by temporarily forwarding them to a "holding" % queue. This is demonstrated in the controller chart. In the outer % transition flowgraph of the "Go" state, when you get a message from the % other controller that a pedestrian request has been made on the other % road, you temporarily store that request on a local queue % "pedRequestLocal". You can then check for that message at a future point. % In this case, you check for the presence of that message in the outer % transition flowgraph of the "PrepareToStop" state. close_system(mdlName); close_system([mdlName '_lib']);