Simulation-Based Engineering of Complex Systems Dr. John R. Clymer, INCOSE Fellow Module 2: Modeling Language for Complex Adaptive Systems (CAS)
University of Waterloo October 6-7, 2010
1
Module 2 • Minimum requirements for successful modeling languages • Modeling languages survey – Petri Nets – IDEF0 – ExtendSim7 Queuing Model • Operational Evaluation Modeling (OpEM) Language • OpEMCSS Graphical Simulation Library Familiarization Exercises – How to set up ExtendSim7 + OpEMCSS on your PC – ExtendSim7 Environment Overview – Block Familiarization Exercises • Overview of Message, Context-Sensitive Event Action, and Event Action Blocks Module 2
2
Minimum Requirements for Successful Modeling Languages • Visually shows important concepts such as process state-transitions, synchronization, resource contention, and communication and adaptation. • Allows variable instantiations of process threads using same modeling diagrams • Provides data structures to represent process instance state variables and shared global memory • Capable of developing a model using a hierarchical top-down structure
Module 2
3
Module 2 • Minimum requirements for successful modeling languages • Modeling languages survey – Petri Nets – IDEF0 – ExtendSim7 Queuing Model • Operational Evaluation Modeling (OpEM) Language • OpEMCSS Graphical Simulation Library Familiarization Exercises – How to set up ExtendSim7 + OpEMCSS on your PC – ExtendSim7 Environment Overview – Block Familiarization Exercises • Overview of Message, Context-Sensitive Event Action, and Event Action Blocks
Module 2
4
Petri Nets 1
Producer_starts
5
Empty_buffers
1 Consumer_waits
Producer_works
1 Semaphore
Data_ready
0
0 0
Data_read Reading_data
Data_in_buffer
Consumer_works
• Petri Nets explicitly show some concurrent process interactions such as in the Producer-Consumer process above. • Petri Nets can not easily handle multiple process instances; indeed, each process thread must be explicitly diagramed. • Petri Nets can not handle continuous state variables e.g. position and velocity in the environmental entities. Module 2
5
IDEF0 Diagrams Control Inputs
Outputs
Resources
• A network of IDEF0 functional flow blocks is often used to represent system behavior. –The inputs enter the block on the left and outputs exit the block on the right, defining the order of function execution. –The control values enter from the top of the block and define the conditions that allow the function to be executed. –Resource values enter from the bottom to define the material required to execute the function.
• An IDEF0 functional flow diagram is non-executable and must be expanded into a CSS model to do MBSE. Module 2
6
Basic ExtendSim7 Queuing Model • ExtendSim7 queuing model (ExtendSim7 DES library) does not have blocks to model concurrent process interactions. Explicit Synchronization Communication and Adaptation Data and Control Flow
Module 2
7
Modeling languages survey Summary • State diagrams like Petri Nets lack any capability to describe variable instantiation and continuous state variables • IDEF0 Diagrams lack synchronization, resource contention, communication and adaptation that are required for analysis of complex systems • Entity Relationship (E-R) Diagrams lack required modeling capabilities • Queuing modeling approaches such as with the ExtendSim7 DES library do not allow general concurrent process interactions to be modeled Module 2
8
Module 2 • Minimum requirements for successful modeling languages • Modeling languages survey – Petri Nets – IDEF0 – ExtendSim7 Queuing Model • Operational Evaluation Modeling (OpEM) Language • OpEMCSS Graphical Simulation Library Familiarization Exercises – How to set up ExtendSim7 + OpEMCSS on your PC – ExtendSim7 Environment Overview – Block Familiarization Exercises • Overview of Message, Context-Sensitive Event Action, and Event Action Blocks
Module 2
9
Operational Evaluation Modeling (OpEM) Graphical Simulation Language • OpEM is based on parallel processing language concepts, modeling concurrent process interactions and multiple instantiation of parallel threads. • Successfully used for 30+ years in industry, government and academe, to perform operational modeling of complex systems. – Modeling a system in its operational context to assess effects of external demands on the system and the operational performance of the system – Modeling the structure of the system by mapping system processes to system components and then modeling the component interfaces in order to optimize performance, reliability, and cost-effectiveness of the system.
Module 2 10
Module 2 • Minimum requirements for successful modeling languages • Modeling languages survey – Petri Nets – IDEF0 – ExtendSim7 Queuing Model • Operational Evaluation Modeling (OpEM) Language • OpEMCSS Graphical Simulation Library Familiarization Exercises – How to set up ExtendSim7 + OpEMCSS on your PC – ExtendSim7 Environment Overview – Block Familiarization Exercises • Overview of Message, Context-Sensitive Event Action, and Event Action Blocks
Module 2
11
How to set up ExtendSim7 DEMO + OpEMCSS on your PC • • •
Step 1. Download ExtendSim7 DEMO from the ImagineThatInc website and place icon on desktop. Step 2. Execute ExtendSim7 DEMO icon from desktop to install the ExtendSim7 DEMO. Step 3. Load OpEMCSS libraries and models from Clymer website. – –
•
Load libraries into C:/ExtendSimDEMO/Libraries Create folder C:/ExtendSimDEMO/Models7 and load models into folder
Alternative Method: Execute setup for CD at end of book to do steps 1 to 3.
Module 2
12
ExtendSim7 Environment Overview • Start ExtendSim7 – Observe that a blank model window appears
• Menus – File, edit, library, model, text, define, run
• Open the OpEMCSS library • How to Select library blocks – Select a block and move to the model window
• How to Connect library blocks – Click mouse on output connector and drag to input connector The OpEMCSS Tool has an extensive online tutorial via help button in dialogs: following is a summary. Module 2
13
ExtendSim7 Environment Overview: Start ExtendSim7 and Open OpEMCSS7 Library
1. Highlight library
2. Hit Open
Module 2
14
ExtendSim7 Environment Overview
• Start ExtendSim7
– Observe that a blank model window appears
• Menus – File, edit, library, model, text, define, run
• Open the OpEMCSS library • How to Select library blocks – Select a block and move to the model window
• How to Connect library blocks – Click mouse on output connector and drag to input connector
Module 2
15
ExtendSim7 Environment Overview: Select OpEMCSS Library Block for Model Click on Block and Drag Where You Want It
Always Add These Two Blocks to Any Model
PIck Block To Add
Here is how it looks running the tool‌ Module 2
16
ExtendSim7 Environment Overview: Connect Blocks and Remove Incorrect Connection Global Reset Flag
Connect Blocks
Global Reset Flag
Remove Connection
• Add a connection by clicking on output connector and dragging
to input connector of another block (ItemOut to ItemIn) • Delete a connection by clicking on connection which highlights it, then hitting delete key
Here is how it looks running the tool… Module 2
17
ExtendSim7 Environment Overview: Setup Block a Dialog Double click on Icon to open dialog.
Setup dialog to increment local attribute count.
Dialogs allows definition and manipulation of attributes that describe system operation and structure. Module 2
18
ExtendSim7 Dialog Window: Read Help and Set Up Block Label
Click to open Help Window
• •
Add block label
The help button opens the help window that documents the block. The block label allows a block to have a symbolic name. For the Reaction Time Event block shown, the name is “Task.”
Module 2
19
ExtendSim7 Environment Overview: Save Model
• • • • Module 2
Click on “File” Menu Select “Save Model as …” Type in model file name Click on “Save” 20
ExtendSim7 Environment Overview: Setup Event-State Trace • Click on “Run” menu • Select “Debugging” and then “Generate Trace” • Select “Debugging” again and then “Add All to Trace”
Module 2
21
ExtendSim7 Environment Overview: Run Model
Run It!
Edit simulation time and iterations to execute Here is how it looks running the tool‌ Module 2
22
ExtendSim7 Environment Overview: Study Trace Results Block trace for Begin Event Block
Trace shows the results of each block executed, including the attribute values
State trace shows current time, item number, process ID, and local attribute values
Here is how it looks running the tool‌
Module 2
23
Overview Of OpEM Model Blocks •
Block Familiarization Exercises: 1. Begin, End, Reaction Time Event Blocks 2. Split & Assemble for Parallel Action Blocks 3. Wait Until Event Block and Global Reaction Time block
•
Introduce Message Block, Context-Sensitive Event Action Block, and Event Action Blocks.
Module 2
24
Begin & End Model
Begin Model
End Model
• Begin lets us start the model. It sets all initial states and contexts. • End lets us stop the model. It also collects any statistics from the model’s execution.
Module 2
25
Reaction Time Event Block Gamma Distribution Parameters: Mean, Degrees of Freedom, Minimum, Maximum.
•
The Reaction Time Event lets us simulate a process that needs a definite time to execute. Gamma distribution models reaction time of state. Gamma values shown specify constant one unit of time.
Module 2
26
Gamma Delay • Gama Distribution is used for random distribution of reaction times • If “K” = 0 you get a constant delay = M, and min and max do not matter • If “K” = 1 or more, you get an exponential distribution, and min and max are used to truncate it
Module 2
27
Exercise1: Begin, End, Reaction Time Event Blocks •Select and Connect Blocks •Setup Dialogs •Save Model •Setup Event-State Trace •Run Model •Study Event-State Trace
Module 2
28
•
Overview Of OpEM Model Blocks Block Familiarization Exercises: 1. Begin, End, Reaction Time Event Blocks 2. Split & Assemble for Parallel Action Blocks 3. Wait Until Event Block and Global Reaction Time block
• Introduce Message Block, Context-Sensitive Event Action Block, and Event Action Blocks.
Module 2
29
Split & Assemble Parallel Actions
Split Action
Assemble Event
• Split into Parallel Actions lets us run multiple process instances in parallel. • Assemble Event waits until a specified combination of parallel processes have completed. – Defined by logic – All specified process instances are deleted and a new one created
Module 2
30
Exercise 2: Split & Assemble for Parallel Action Blocks
• Setup Split and Assemble Block Dialogs Module 2
31
Global Reaction Time Event Block Use either the built in Gamma distribution (GammaDelay) or any other ExtendSim7 defined distribution
•
The Global Reaction Time Event block lets us simulate a process that needs a definite time to execute. Reaction time is computed using an equation.
Module 2
32
Exercise 2: Split & Assemble for Parallel Action Blocks
• Setup of Begin Event, Reaction Time Event, and Global Reaction Time Event blocks Module 2
33
Exercise 2: Split & Assemble for Parallel Action Blocks Recall that Global Attributes Average and Sigma are inputs to the Gaussian Distribution used in task B
• Study Event-State Traces. Module 2
34
•
Overview Of OpEM Model Blocks
Block Familiarization Exercises
1. Begin, End, Reaction Time Event Blocks 2. Split & Assemble for Parallel Action Blocks 3. Wait Until Event Block and Global Reaction Time block
•
Introduce Message Block, ContextSensitive Event Action Block, and Event Action Blocks.
Module 2
35
Exercise 3: Resource Contention Model, Begin and End Blocks 1. Count is set to zero and incremented “AttributeOut = Count + Random(2);” in the Reaction Time Event block. 2. Average and Sigma are initialized and then used to compute the reaction time in the Global Reaction Time block. 3. ResR is set to one and globally indicates whether resource R is available (0busy, 1-available)
• Begin Event block initializes attributes Count, Average, Sigma, and ResR. • End Event block receives Count from the Reaction Time Event block and Latency computed by the Local Event Action block.
Module 2
36
Wait Until Event Block Models Indefinite Wait Time Increment Global Attribute
Attributes Used in Logic Equation Must Be Declared Here
If <logical condition> LOGIC=TRUE; else LOGIC=false;
•
The Wait Until Event block lets us model context dependencies. – Wait time is indefinite and depends on logic being satisfied. – Logic depends on messages from other concurrent processes or resources being available indicated by resource attributes.
Module 2
37
Exercise 3: Wait Until Event and Global Reaction Time Block Dialogs Set Up of Upper Wait and ReactionTime blocks Similar to Lower Blocks Shown
â&#x20AC;˘ In the Wait Until Event block, If resource attribute ResR is not zero then the logic is true, ResR is decremented, and the resource is allocated to task B; else it waits. â&#x20AC;˘ In the Global Reaction Time block, when task B is completes, the resource attribute ResR is incremented to make the resource available again. Module 2
38
Exercise 3: Local Event Action Block Computes Process Latency
Module 2
39
Exercise 3: Resource Contention Model, Event-State Trace
â&#x20AC;˘ Study Event-State Traces. Module 2
40
•
Overview Of OpEM Model Blocks
Block Familiarization Exercises
1. Begin, End, Reaction Time Event Blocks 2. Split & Assemble for Parallel Action Blocks 3. Wait Until Event Block and Global Reaction Time Block
•
Introduce Message Block, ContextSensitive Event Action Block, and Event Action Blocks.
Module 2
41
Message Event Action Block Process Identifier Filter
Logic Equation Selects Process Threads Left by Filter to Receive Messages â&#x20AC;˘ â&#x20AC;˘
In General: Setup process identifier filter, and local and global logic equation attributes used to specify threads of interest. Message Event Action: Setup one to four local attributes to send to specified process threads.
Module 2
42
Context-Sensitive Event Action block Process Identifier Filter
Logic Equation Selects Process Threads Left by Filter to be Used in the Attribute Calculation â&#x20AC;˘ â&#x20AC;˘
In General: Setup process identifier filter, and local and global logic equation attributes used to specify threads of interest. Context-Sensitive Event Action: Specify whether min, max, or first process thread considered returns the output value
Module 3
43
Event Action block
Set Up Process Identifier for New Process Thread
â&#x20AC;˘ Event Action block lets us compute local attributes, increment global attributes, and instantiate new processes. Module 2
44
OpEMCSS Blocks Discussed in Module 2 • Begin and End Blocks – Starts and ends a simulation run or replication
• Split and Assemble Blocks – Allows explicit synchronization of parallel processes
• Wait Until and Reaction Time Blocks – Models an indefinite and definite period of time; respectively
• Search process instance context and compute attribute • Send message attributes to other processes
Module 2
45
Other OpEMCSS Blocks Discussed in Following Modules • Event action type blocks perform various actions required in simulation – Local and Global attribute calculation – Select Alternate action paths for a process – Create and control entity motion and animation – Apply rules to make intelligent decisions
Module 2
46
Summary of Module 2 • Reviewed the minimum requirements for successful modeling languages • Surveyed Modeling languages • Introduced the Operational Evaluation Modeling (OpEM) Language operating in the ExtendSim7 simulation environment How ExtendSim7 has been modified to implement the OpEM language and how to model a system problem using OpEMCSS is discussed in Module 4. Module 2
47