47
Simulation-Based Engineering of Complex Systems 1 Dr. John R. Clymer, INCOSE Fellow University of Waterloo October 6-7, 2010 Module 2: Modeling Language for Complex Adaptive Systems (CAS)

Clymer_2

Embed Size (px)

DESCRIPTION

John Clymer Course/Lecture

Citation preview

Simulation-Based Engineering of Complex Systems

1

Dr. John R. Clymer, INCOSE Fellow

University of WaterlooOctober 6-7, 2010

Module 2: Modeling Language for Complex Adaptive

Systems (CAS)

Module 2 2

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 3

• 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

Minimum Requirements for Successful Modeling Languages

Module 2 4

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 5

Petri Nets

• 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.

1

0

1

0

5

0

1

Producer_starts

Producer_works

Data_ready

Empty_buffers

Consumer_waits

Data_read

Data_in_bufferReading_data

Consumer_works

Semaphore

Module 2 6

IDEF0 Diagrams

• 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.

Inputs Outputs

Control

Resources

Module 2 7

Basic ExtendSim7 Queuing Model

• ExtendSim7 queuing model (ExtendSim7 DES library) does not have blocks to model concurrent process interactions.

Explicit SynchronizationCommunication and AdaptationData and Control Flow

Module 2 8

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 9

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 210

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 11

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 12

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 13

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 14

ExtendSim7 Environment Overview: Start ExtendSim7 and Open OpEMCSS7 Library

1. Highlight library

2. Hit Open

Module 2 15

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 16

ExtendSim7 Environment Overview: Select OpEMCSS Library Block for Model

Here is how it looks running the tool…

Always Add These Two

Blocks to AnyModel

PIck Block To Add

Click on Block and Drag Where You Want It

Module 2 17

ExtendSim7 Environment Overview: Connect Blocks and Remove Incorrect Connection

Here is how it looks running the tool…

• 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

Global Reset Flag

Global Reset Flag

Connect Blocks

Remove Connection

Module 2 18

ExtendSim7 Environment Overview: Setup Block a Dialog

Dialogs allows definition and manipulation of attributes that describe system operation and structure.

Double click on Icon to open

dialog.

Setup dialog to increment local attribute count.

Module 2 19

ExtendSim7 Dialog Window:Read Help and Set Up 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.”

Add block labelClick to openHelp Window

Module 2 20

ExtendSim7 Environment Overview: Save Model

• Click on “File” Menu• Select “Save Model as …”• Type in model file name• Click on “Save”

Module 2 21

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 22

Edit simulation time and iterations to execute

Run It!

ExtendSim7 Environment Overview:Run Model

Here is how it looks running the tool…

Module 2 23

ExtendSim7 Environment Overview: Study Trace Results

Here is how it looks running the tool…

Trace shows the results of each block executed, including the

attribute values

Block trace for Begin Event Block

State trace shows current time, item

number, process ID, and local attribute

values

Module 2 24

Overview Of OpEM Model Blocks• Block Familiarization Exercises:

1. Begin, End, Reaction Time Event Blocks2. Split & Assemble for Parallel Action Blocks3. Wait Until Event Block and Global Reaction

Time block• Introduce Message Block, Context-Sensitive

Event Action Block, and Event Action Blocks.

Module 2 25

Begin & 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.

Begin Model

End Model

Module 2 26

Reaction Time Event Block

• 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.

Gamma Distribution Parameters: Mean, Degrees of Freedom, Minimum, Maximum.

Module 2 27

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 28

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 29

Overview Of OpEM Model Blocks• Block Familiarization Exercises:

1. Begin, End, Reaction Time Event Blocks2. Split & Assemble for Parallel Action Blocks3. Wait Until Event Block and Global Reaction

Time block• Introduce Message Block, Context-Sensitive

Event Action Block, and Event Action Blocks.

Module 2 30

Split & Assemble Parallel Actions

• 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

Assemble EventSplit Action

Module 2 31

Exercise 2: Split & Assemble for Parallel Action Blocks

• Setup Split and Assemble Block Dialogs

Module 2 32

Global Reaction Time Event Block

• 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.

Use either the built in Gamma distribution

(GammaDelay) or any other

ExtendSim7 defined distribution

Module 2 33

Exercise 2: Split & Assemble for Parallel Action Blocks

• Setup of Begin Event, Reaction Time Event, and Global Reaction Time Event blocks

Module 2 34

Exercise 2: Split & Assemble for Parallel Action Blocks

• Study Event-State Traces.

Recall that Global Attributes Average

and Sigma are inputs to the

Gaussian Distribution used in

task B

Module 2 35

Overview Of OpEM Model Blocks• Block Familiarization Exercises

1. Begin, End, Reaction Time Event Blocks2. Split & Assemble for Parallel Action Blocks3. Wait Until Event Block and Global Reaction

Time block• Introduce Message Block, Context-Sensitive

Event Action Block, and Event Action Blocks.

Module 2 36

Exercise 3: Resource Contention Model, Begin and End Blocks

• 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.

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 (0-busy, 1-available)

Module 2 37

Wait Until Event Block Models Indefinite Wait Time

• 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.

If <logical condition> LOGIC=TRUE; else

LOGIC=false;

Increment Global Attribute

Attributes Used in

Logic Equation Must Be Declared

Here

Module 2 38

Exercise 3: Wait Until Event and Global Reaction Time Block Dialogs

• 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.

• In the Global Reaction Time block, when task B is completes, the resource attribute ResR is incremented to make the resource available again.

Set Up of Upper Wait and

ReactionTime blocks Similar to

Lower Blocks Shown

Module 2 39

Exercise 3: Local Event Action Block Computes Process Latency

Module 2 40

Exercise 3: Resource Contention Model, Event-State Trace

• Study Event-State Traces.

Module 2 41

Overview Of OpEM Model Blocks• Block Familiarization Exercises

1. Begin, End, Reaction Time Event Blocks2. Split & Assemble for Parallel Action Blocks3. Wait Until Event Block and Global Reaction

Time Block• Introduce Message Block, Context-Sensitive

Event Action Block, and Event Action Blocks.

Module 2 42

Message Event Action Block

• 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.

Process Identifier

Filter

Logic Equation Selects Process

Threads Left by Filter to Receive Messages

Module 3 43

Context-Sensitive Event Action block

• 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

Process Identifier

Filter

Logic Equation Selects Process Threads Left by

Filter to be Used in the Attribute Calculation

Module 2 44

Event Action block

• Event Action block lets us compute local attributes, increment global attributes, and instantiate new processes.

Set Up Process Identifier for New

Process Thread

Module 2 45

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 46

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 47

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.