SlideShare a Scribd company logo
1 of 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']);

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 HmmIJRESJOURNAL
 
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
 
Review of Fuzzy Model
Review of Fuzzy Model Review of Fuzzy Model
Review of Fuzzy Model NurudeenIshaq1
 
Fuzzy Model Presentation
Fuzzy Model Presentation Fuzzy Model Presentation
Fuzzy Model Presentation NurudeenIshaq1
 
Modeling business management systems transportation
Modeling business management systems transportationModeling business management systems transportation
Modeling business management systems transportationSherin El-Rashied
 
Traffic assignment
Traffic assignmentTraffic assignment
Traffic assignmentMNIT,JAIPUR
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication ProjectAssignmentpedia
 
Adaptive Traffic Sampling and Management Platform
Adaptive Traffic Sampling and Management PlatformAdaptive Traffic Sampling and Management Platform
Adaptive Traffic Sampling and Management PlatformAmir Krifa
 
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-DuChee Yie Jong
 
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 FlowIJCSIS Research Publications
 
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...
 
Review of Fuzzy Model
Review of Fuzzy Model Review of Fuzzy Model
Review of Fuzzy Model
 
Fuzzy Model Presentation
Fuzzy Model Presentation Fuzzy Model Presentation
Fuzzy Model Presentation
 
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

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 

Recently uploaded (20)

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 

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']);