Professional Documents
Culture Documents
ISBN: 978-0-9825040-4-8
Copyright 2013 by Imagine That Inc. All rights reserved. Printed in the United States of America.
You may not copy, transmit, or translate all or any part of this document in any form or by any means,
electronic or mechanical, including photocopying, recording, or information storage and retrieval systems, for any purpose other than your personal use without the prior and express written permission of
Imagine That Inc.
License, Software Copyright, Trademark, and Other Information
The software described in this manual is furnished under a separate license and warranty agreement. The
software may be used or copied only in accordance with the terms of that agreement. Please note the
following:
ExtendSim blocks (including icons, dialogs, and block code) are copyright by Imagine
That Inc. and/or its Licensors. ExtendSim blocks contain proprietary and/or trademark information. If you build blocks, and you use all or any portion of the blocks from the BPR,
Discrete Event, Flow, Item, Mfg, Rate, or Quick Blocks library in your blocks, or you include those ExtendSim blocks (or any of the code from those blocks) in your libraries, your
right to sell, give away, or otherwise distribute your blocks and libraries is limited. In that
case, you may only sell, give, or distribute such a block or library if the recipient has a legal
license for the ExtendSim product from which you have derived your block(s) or block
code. For more information, contact Imagine That Inc.
Imagine That!, the Imagine That logo, ExtendSim, Extend, and ModL are either registered trademarks
or trademarks of Imagine That Incorporated in the United States and/or other countries. Mac OS is a
registered trademark of Apple Computer, Inc. Microsoft is a registered trademark and Windows is a
trademark of Microsoft Corporation. GarageGames, Inc. is the copyright owner of the Torque Game
Engine (TGE), and the copyright for Stat::Fit is owned by Geer Mountain Software. All other product
names used in this manual are the trademarks of their respective owners. TGE and Stat::Fit are licensed
to Imagine That, Inc. for distribution with ExtendSim. All other ExtendSim products and portions of
products are copyright by Imagine That Inc. All right, title and interest, including, without limitation,
all copyrights in the Software shall at all times remain the property of Imagine That Inc. or its Licensors.
Extend was created in 1987 by Bob Diamond; it was rebranded as ExtendSim in 2007.
Chief architects for ExtendSim 9:
Bob Diamond, Steve Lamperti, Dave Krahl, Anthony Nastasi, Cecile Pieper
Graphics, documentation, and production for ExtendSim 9:
Carla Sackett, Pat Diamond, and Kathi Hansen
Imagine That Inc 6830 Via Del Oro, Suite 230 San Jose, CA 95119 USA
408.365.0305 fax 408.629.1251 info@extendsim.com
www.extendsim.com
Table of Contents
USER GUIDE
TABLE OF CONTENTS
ABOUT EXTENDSIM
Preface.................................................................................................................. 1
Introduction......................................................................................................... 3
Why simulation is important ..................................................................................................4
Simulation with ExtendSim ....................................................................................................4
What ExtendSim can do .........................................................................................................4
Modeling capabilities ......................................................................................................................4
Simulation architecture ...................................................................................................................5
TUTORIAL
Running a Model ................................................................................................. 13
Opening the Reservoir model..................................................................................................14
Model basics............................................................................................................................15
Blocks .............................................................................................................................................15
Connections....................................................................................................................................16
Cloning...................................................................................................................................38
Other modifications ................................................................................................................39
Next steps................................................................................................................................40
Modeling methodologies.........................................................................................................43
Comparison of main modeling methodologies ................................................................................44
Comparison table............................................................................................................................45
Table of continuous, discrete event, and discrete rate differences .....................................................45
CONTINUOUS MODELING
Introduction......................................................................................................... 59
How the Continuous module is organized ..............................................................................60
Blocks for building continuous models....................................................................................60
Using the ExtendSim blocks............................................................................................................60
Building custom continuous blocks.................................................................................................60
Third-party libraries ........................................................................................................................61
Tutorial ................................................................................................................ 63
Removing overflow from the Holding Tank ............................................................................64
Setting the maximum capacity ........................................................................................................64
Determining if there is too much water...........................................................................................65
Areas of Application............................................................................................. 73
Scientific .................................................................................................................................74
Predator/Prey.................................................................................................................................. 74
Drug Ingestion ............................................................................................................................... 75
Engineering.............................................................................................................................77
Noisy FM system............................................................................................................................ 77
Business ..................................................................................................................................78
Inventory Management .................................................................................................................. 78
Integration ..............................................................................................................................87
Simulation order .....................................................................................................................88
Flow order ...................................................................................................................................... 88
Left to right order ........................................................................................................................... 88
Custom order ................................................................................................................................. 88
Item properties........................................................................................................................119
Item attributes.................................................................................................................................119
Priority............................................................................................................................................126
Quantities .......................................................................................................................................128
Other item properties......................................................................................................................130
Queueing.............................................................................................................. 131
Blocks of interest .....................................................................................................................132
Queueing disciplines ...............................................................................................................132
Queue/server systems ..............................................................................................................133
M/M/1 queues ................................................................................................................................134
Priority queues ................................................................................................................................134
Multitasking............................................................................................................................190
Simulate Multitasking Activity model .............................................................................................191
Unbatching .............................................................................................................................207
Simple unbatching ..........................................................................................................................208
Variable batching and unbatching ...................................................................................................209
Properties when items are unbatched...............................................................................................210
Modeling resources..................................................................................................................215
How to model resources ..................................................................................................................215
Resource Pool method.....................................................................................................................216
Resource Item method ....................................................................................................................219
Other methods for modeling resources............................................................................................221
Tutorial ...................................................................................................................................230
Phase I: Adding ARM to a model............................................................................................231
Add the Resource Manager block.................................................................................................... 231
Resource Pool ................................................................................................................................. 232
Queue ............................................................................................................................................ 233
Resource Pool Release ..................................................................................................................... 234
Save and run................................................................................................................................... 234
Cycle timing............................................................................................................................298
Using the Timing attribute feature ..................................................................................................298
Using a Set or Equation(I) and Information blocks .........................................................................299
Indicators ................................................................................................................................337
Setting indicators............................................................................................................................ 338
Getting information about levels .................................................................................................... 338
Capacity..................................................................................................................................347
Full and not-full ............................................................................................................................. 347
Tank blocks capacity ...................................................................................................................... 347
Interchange blocks capacity ............................................................................................................ 348
Convey Flow blocks capacity.......................................................................................................... 348
Flow rules................................................................................................................................360
Critical and relational constraints ....................................................................................................361
Comprehensive example..........................................................................................................369
Rate sections ...................................................................................................................................369
Critical constraints ..........................................................................................................................369
Relational constraint .......................................................................................................................369
Simulations impact on the effective rates.........................................................................................369
Miscellaneous....................................................................................................... 417
Precision..................................................................................................................................418
Biasing flow.............................................................................................................................418
Bias order ....................................................................................................................................... 419
Bias block ....................................................................................................................................... 419
Merge and Diverge blocks .............................................................................................................. 420
3D ANIMATION
Introduction to E3D ............................................................................................ 447
What this chapter covers .........................................................................................................448
Blocks and objects for 3D animation.......................................................................................448
Item library blocks ..........................................................................................................................448
Animation library............................................................................................................................449
Custom 3D objects and blocks........................................................................................................449
Overview.................................................................................................................................449
Features...........................................................................................................................................449
Controlling the E3D environment ..................................................................................................451
Prerequisites ............................................................................................................................451
Software and hardware ....................................................................................................................451
Preparation......................................................................................................................................452
3D animation modes...............................................................................................................458
Mode descriptions...........................................................................................................................458
QuickView versus Concurrent or Buffered ......................................................................................458
Next step.................................................................................................................................461
3D Objects........................................................................................................... 499
3D objects...............................................................................................................................500
Types of objects .............................................................................................................................. 501
Object properties ............................................................................................................................ 501
Actions ........................................................................................................................................... 501
WayPoints ...............................................................................................................................518
Creating a waypoint ........................................................................................................................518
Choosing a waypoint as a destination..............................................................................................519
Creating paths.........................................................................................................................525
Terrains ...................................................................................................................................528
Modifying the terrain ......................................................................................................................529
HOW TO
Libraries and Blocks ............................................................................................ 545
The ExtendSim libraries ..........................................................................................................546
Animation 2D-3D library............................................................................................................... 546
Electronics library........................................................................................................................... 546
Item library (not available in ExtendSim CP) ................................................................................. 546
Plotter library ................................................................................................................................. 547
Rate library (not available in ExtendSim CP or ExtendSim OR)..................................................... 547
Utilities library................................................................................................................................ 547
Value library ................................................................................................................................... 547
Example Libraries folder ................................................................................................................. 547
Legacy folder .................................................................................................................................. 547
Hierarchical blocks..................................................................................................................560
Managing blocks .....................................................................................................................560
Copying blocks............................................................................................................................... 560
Changing a blocks name ................................................................................................................ 560
Removing blocks ............................................................................................................................ 560
Corrupted blocks............................................................................................................................ 560
Notebooks...............................................................................................................................566
Controls ..................................................................................................................................567
Slider .............................................................................................................................................. 567
Switch .............................................................................................................................................568
Meter ..............................................................................................................................................568
Timing ....................................................................................................................................584
Continuous simulation timing ........................................................................................................584
Discrete event simulation timing.....................................................................................................584
Other Units.............................................................................................................................587
Flow units .......................................................................................................................................587
Length ............................................................................................................................................587
Navigator ................................................................................................................................597
Hierarchy ................................................................................................................................598
Uses for hierarchy ........................................................................................................................... 598
Hierarchical blocks ......................................................................................................................... 598
Making a selection into a hierarchical block.................................................................................... 600
Building a new hierarchical block ................................................................................................... 601
Saving hierarchical blocks ............................................................................................................... 605
Modifying hierarchical blocks ......................................................................................................... 606
Animation...............................................................................................................................609
Blocks with built-in animation ....................................................................................................... 609
Blocks for customized animation .................................................................................................... 611
Animation functions....................................................................................................................... 614
Animation pictures ......................................................................................................................... 614
Displaying messages on a blocks icon ............................................................................................. 615
Analysis................................................................................................................ 623
Blocks that calculate statistics ..................................................................................................624
Statistics ......................................................................................................................................... 624
Clear Statistics ................................................................................................................................ 626
Mean & Variance............................................................................................................................ 626
Information .................................................................................................................................... 627
Cost Stats ....................................................................................................................................... 627
Confidence intervals................................................................................................................627
Sensitivity analysis ...................................................................................................................628
Overview ........................................................................................................................................ 628
Steps for using sensitivity analysis ................................................................................................... 628
Specifying the sensitivity method.................................................................................................... 630
Turning sensitivity on and off ......................................................................................................... 630
Reporting the results....................................................................................................................... 631
Multi-dimensional scenarios ........................................................................................................... 631
Scenario analysis......................................................................................................................632
How the Scenario Manager works .................................................................................................. 633
Tutorial I (dialog parameters).......................................................................................................... 633
Tutorial II (database variables) ........................................................................................................ 640
DOE methods ................................................................................................................................ 646
Optimization ..........................................................................................................................647
Plotters....................................................................................................................................663
Plot and data panes .........................................................................................................................663
Plotter tools.....................................................................................................................................664
Plotter dialogs .................................................................................................................................667
Types of plotters..............................................................................................................................668
Copying plotted information ..........................................................................................................671
Clearing plotted information...........................................................................................................671
Reports....................................................................................................................................671
Types of reports...............................................................................................................................671
Generating reports ..........................................................................................................................672
Steps for reporting...........................................................................................................................672
Reporting example ..........................................................................................................................672
Equation-based blocks.............................................................................................................677
Overview.........................................................................................................................................678
Equation components .....................................................................................................................678
Input variables.................................................................................................................................678
Output variables..............................................................................................................................680
Equation Editor ..............................................................................................................................683
Include files for equations ...............................................................................................................683
Random numbers....................................................................................................................684
Random number generators ............................................................................................................684
Random seeds .................................................................................................................................685
Resetting random numbers for consecutive runs .............................................................................685
Notebook ................................................................................................................................706
Stepping through the simulation .............................................................................................706
Show Simulation Order command ..........................................................................................707
Slow simulation speed .............................................................................................................707
Model reporting ......................................................................................................................707
Model tracing..........................................................................................................................707
Generating traces ............................................................................................................................ 708
Tracing example.............................................................................................................................. 708
Miscellaneous....................................................................................................... 769
Navigator ................................................................................................................................770
Opening the Navigator ...................................................................................................................770
Model Navigator mode ...................................................................................................................771
Database List mode .........................................................................................................................771
Library Window mode....................................................................................................................771
Printing...................................................................................................................................772
Selecting what to print ....................................................................................................................772
The Print command........................................................................................................................772
Printing and Print Setup hints.........................................................................................................774
Tool tips..................................................................................................................................776
Changing parameters dynamically...........................................................................................776
Methods..........................................................................................................................................776
APPENDIX
Menu Commands and Toolbars ........................................................................... 781
ExtendSim menu (Mac OS only) ............................................................................................782
File menu ................................................................................................................................782
New Model .....................................................................................................................................782
New Text File..................................................................................................................................782
Open...............................................................................................................................................782
Close...............................................................................................................................................782
Revert Model/Revert Text File.........................................................................................................783
Save Model and Save Model As .......................................................................................................783
Save Text File and Save Text File As.................................................................................................783
Model menu............................................................................................................................802
Make Selection Hierarchical ........................................................................................................... 802
New Hierarchical Block.................................................................................................................. 802
Open Hierarchical Block Structure ................................................................................................. 802
Connection Lines ........................................................................................................................... 802
Show Named Connections ............................................................................................................. 802
Hide Connections .......................................................................................................................... 802
Hide Connectors ............................................................................................................................ 802
Controls ......................................................................................................................................... 803
Align ...............................................................................................................................................803
Rotate Shape ...................................................................................................................................803
Flip Horizontally/Flip Vertically......................................................................................................803
Border Thickness ............................................................................................................................803
Shape Fill/Border ............................................................................................................................803
Change Model Style ........................................................................................................................803
Lock Model.....................................................................................................................................803
Use Grid .........................................................................................................................................803
Show Block Labels ..........................................................................................................................803
Show Block Numbers......................................................................................................................804
Show Simulation Order...................................................................................................................804
Set Simulation Order.......................................................................................................................804
Database menu........................................................................................................................804
New Database .................................................................................................................................804
Import New Database .....................................................................................................................804
Export Database..............................................................................................................................805
Rename Database............................................................................................................................805
New Table.......................................................................................................................................805
Import Tables..................................................................................................................................805
Export Selected Tables.....................................................................................................................805
Rename Table .................................................................................................................................805
Edit Table Properties .......................................................................................................................806
New Tab .........................................................................................................................................806
Rename or Delete Database Tab......................................................................................................806
Clone Selected Tables to Tab...........................................................................................................806
Append New Field ..........................................................................................................................807
Insert New Field..............................................................................................................................807
Edit Table Properties .......................................................................................................................807
Append New Records......................................................................................................................807
Insert New Records .........................................................................................................................808
Read/Write Index Checking ............................................................................................................808
Develop menu.........................................................................................................................808
New Block ......................................................................................................................................808
Open Block Structure .....................................................................................................................809
Rename Block .................................................................................................................................809
Set Block Category... .......................................................................................................................809
Compile Block ................................................................................................................................809
New Dialog Item.............................................................................................................................810
New Tab .........................................................................................................................................810
Rename or Delete Tab.....................................................................................................................810
Move Selected Items to Tab.............................................................................................................810
New Include File.............................................................................................................................810
Open Include File ...........................................................................................................................810
Delete Include File ..........................................................................................................................811
Shift Selected Code Left ..................................................................................................................811
Shift Selected Code Right................................................................................................................811
Go To Line .....................................................................................................................................811
Go To Function/Message Handler ..................................................................................................811
Match Braces...................................................................................................................................811
Match IFDEF/ENDIF....................................................................................................................811
Set Breakpoints ...............................................................................................................................811
Open Breakpoints Window.............................................................................................................811
Open Debugger Window................................................................................................................811
Continue.........................................................................................................................................812
Step Over ........................................................................................................................................812
Help menu..............................................................................................................................818
ExtendSim Help ............................................................................................................................. 818
Support Resource Center ................................................................................................................ 818
Downloads and Updates ................................................................................................................. 818
User Forum .................................................................................................................................... 818
Whats New .................................................................................................................................... 818
ExtendSim Product Line................................................................................................................. 818
Imagine That Inc. Online............................................................................................................... 818
About ExtendSim (Windows only) ................................................................................................. 819
Toolbar buttons.......................................................................................................................819
ExtendSim database tool bars ..................................................................................................819
Statistics ..................................................................................................................................827
INDEX
About ExtendSim
Preface
ExtendSims architect
talks about simulation
ExtendSim
Preface
Bob Diamond
President
You see? Thats why scientists persist in their investigations, why we struggle so desperately
for every bit of knowledge, stay up nights seeking the answer to a problem, climb the steepest obstacles to the
next fragment of understanding, to finally reach that joyous moment of the kick in the discovery,
which is part of the pleasure of finding things out. attributed to Richard P. Feynman
About ExtendSim
Introduction
Learn about ExtendSims capabilities
and how to get started using them
ExtendSim
Introduction
Why simulation is important
ExtendSim is a powerful, leading edge simulation tool. Using ExtendSim, you can develop
dynamic models of real-life processes in a wide variety of fields. Use ExtendSim to create models
from building blocks, explore the processes involved, and see how they relate. Then change
assumptions to arrive at an optimum solution. ExtendSim and your imagination are all you need
to create professional models that meet your business, industrial, and academic needs.
Modeling capabilities
With ExtendSim, you get powerful modeling constructs, including:
A full set of building blocks that allow you to build models rapidly
A customizable graphical interface that depicts the relationships in the modeled system
Unlimited hierarchical decomposition for organizing model sections, making enterprise-wide
models easy to build and understand
Dialogs and notebooks for changing model values, so you can quickly try out assumptions and
dynamically interface with your model
An internal relational database feature for storing, managing, and reporting model data as well as
for interfacing with external data applications
5
Whats new in this release
A full-featured authoring environment for creating user-friendly front end interfaces that simplify model interaction and enhance communication
The ability to adjust settings while the simulation is running
An equation editor for creating compiled custom logic
The ability to create new blocks, with custom behavior, that are fully integrated with ExtendSim
Complete scalability since model size is limited only by the limits of your system
Evolutionary optimization, Monte Carlo, batch-mode, and scenario analysis
Customizable reports and plotters for presentation and in-depth analysis
Activity-based costing capabilities for analyzing cost contributors
Full connectivity and interactivity with other programs and platforms
Simulation architecture
A robust architecture adds advanced features to make it the most scalable simulation system available:
Multi-purpose simulation. ExtendSim is a multi-domain environment so you can dynamically
model continuous, discrete event, discrete rate, agent-based, linear, non-linear, and mixed-mode
systems.
Integrated compiled programming language and dialog editor, optimized for simulation.
Modify ExtendSims blocks or build your own for specialized applications.
Library based. The blocks you build can be saved in libraries and easily reused in other models.
Scripting support. Build and run models remotely, either from an ExtendSim block or from an
outside application.
Integrated support for other programming languages. Use ExtendSims built-in APIs to
access code created in Delphi, C++ Builder, Visual Basic, Visual C++, etc.
Over 1000 functions. Directly access functions for integration, statistics, queueing, animation,
IEEE math, matrix, sounds, arrays, FFT, debugging, DLLs, string and bit manipulation, I/O,
and so on; you can also define your own functions.
Message sending. Blocks can send messages to other blocks interactively for subprocessing.
Sophisticated data-passing capabilities. Pass values, arrays, or structures composed of arrays.
Full support for a wide range of data types and structures. Arrays, linked-lists, and integers,
real, and string data types are built in.
Integrated data linking. Connect block dialog data to internal and external databases.
Levels of use
You can use ExtendSim on many levels:
ExtendSim
Customizable 2D and realistic 3D animation for model debugging and enhanced presentation
ExtendSim
Introduction
About this User Guide
Run pre-assembled models and explore alternatives by changing the data. If you work in a group
environment, one or more authors can create models for others to run for experimentation. The
author can also build a custom front end to facilitate user interaction with the model. The LT
version of ExtendSim allows non-modelers to run pre-assembled models, change data, and
obtain results. For more information, see The ExtendSim LT version on page 778.
Create your own models from the blocks that come with ExtendSim. ExtendSim includes libraries of blocks to handle most modeling needs. To build a model, pull blocks from libraries and
link connectors on the blocks. You can also use pre-built templates (Templates library) or assemble your own hierarchical blocks of subsystems and save them in libraries. This saves starting
from scratch when youre building a model of a process that has elements in common with a previous model.
Use the integrated development environment to create new blocks that conform to the ExtendSim modeling architecture. The development environment is optimized for simulation and
allows you to create blocks with custom code, dialogs, and icons and use them in your models
just as you would other ExtendSim blocks. You can also modify the blocks that come with
ExtendSim to work with your specific needs.
Develop your own modeling architecture, conventions, and features. With the ExtendSim
development environment, you can create a custom set of blocks with unique interfaces, communication protocols, and behaviors. This new architecture can be continuous, discrete event,
discrete rate, agent-based, or an entirely new type of simulation.
Automate your model building using the scripting functions to build wizards, or by using
ActiveX/COM. You can use ActiveX/COM or block-based wizards to cause models to be automatically created or modified. Models can be also be programmatically created from a user input
form or data file. This allows the modeling environment to be utilized indirectly by end-users
who have little or no simulation experience.
An ExtendSim ASP license is required to distribute the functionality of ExtendSim to other users
or to provide internet or intranet access to ExtendSim or to its functionality. Contact Imagine
That, Inc. for more information.
A separate Developer Reference is also available for modelers who use the equation-based blocks
and programmers who want to create custom blocks for specific purposes.
7
Additional resources
Imagine That Inc. provides several resources to support your simulation experience.
1) Getting Started. The Quick Start interface (Getting Started model) opens when you launch
ExtendSim. Use this interface to explore sample models and to view tutorials on building and
running models.
2) Online help.
Access the electronic User Guide and Developer Reference by giving the command Help >
ExtendSim Help or press F1 on your keyboard.
Use tool tips to identify interface elements.
Get complete definition of how a block works, including descriptions of its dialog items
and connectors, by clicking a blocks Help button.
3) Web advice. FAQs are available at www.ExtendSim.com/support/advice/faq.html.
4) Networking. Links for ExtendSim user forums, networks, and blogs are at www.ExtendSim.com/support/advice/forum.html. For example, the ExtendSim E-Xchange is a user forum
for sharing ideas, insights, and modeling techniques with other ExtendSim users. Use this
forum to post issues and solutions, share blocks and models, and to talk directly to other people developing simulations. You must register to join, but access is free and available to all
ExtendSim modelers.
5) Complimentary support. Get technical assistance for installation issues, basic usage questions, and troubleshooting for up to 60 days after purchasing a new product or upgrade. For
continuing support beyond the complimentary period, purchase either an annual Maintenance
Plan or Per-Incident Support.
Contacting Imagine That Inc. Technical Support
You must be a registered customer to receive technical support from our support staff. Register
online when you install ExtendSim (Windows only), register online after installation using the
Register.exe file in the ExtendSim9\Online Registration folder (Windows only), or email your
serial number and contact information to info@ExtendSim.com (Macintosh only).
Technical support is complimentary for the first 60 days after purchase. After that,, you must either
subscribe to the ExtendSim Maintenance Plan or purchase per-incident support.
When you contact our support representatives, please provide the following information:
1) ExtendSim serial number, product name, and release number:
Windows: Located in the Help > About ExtendSim menu command, on the title
page of the User Guide, or on the tear-off remainder of your registration card.
Mac OS: Located in the ExtendSim > About ExtendSim menu command, on the
title page of the User Guide, or the tear-off remainder of your registration card.
2) Name and contact information (telephone, email, and/or fax), so we can reply.
3) Type of computer.
4) Operating system and version.
Be sure you are using the most current version of ExtendSim; updates are available at our web site
(www.extendsim.com)
ExtendSim
Additional resources
Santee River Basin Model (SRM), developed by the National Heritage Institute, et al
This continuous hydrologic model predicts how operational alternatives will affect hydropower generation, lake levels, in-stream
flow, and water uses. It analyzes how dam operations can be altered to improve stream flow in over 300 river miles and helps assess
the effects on lake levels and power generation. A series of hierarchical blocks with nested submodels keep details in layers below the
models realistic top level. For instance, the Catawba-Wateree hierarchical block contains 9 additional hierarchical blocks, some of
which contain even more layers.
ExtendSim
8
Introduction
Model illustrations
Model illustrations
The tutorials used throughout this guide are specifically simplified so that you can easily learn how
to use ExtendSim. In contrast, simulation is more typically used to model complex processes, like
the ones shown on the following pages.
9
Model illustrations
ExtendSim
ExtendSim
10
Introduction
Model illustrations
ExtendSim
Standing Joint Force Headquarters (SJFHQ) model by the Naval Postgraduate School and The Boeing Company
This discrete event model simulates the planning processes performed by SJFHQ members, analyzes time-critical information systems, and performs
trade studies to obtain system measures of performance. It captures all processes, sub-processes, information flows, and personnel task assignments. The
simulation takes approximately three seconds to run through one full cycle of processes, simulating 260 hours of operational work time and 6000 individual task assignments. The database allows the modeler to use a set of rules to drive the model architecture and simulation parameters.
Reference: Modeling and Simulation Support for the Standing Joint Force Headquarters Concept by Susan G. Hutchins et al. Published in the 10th
International Command and Control Research and Technology Symposium.
Model illustrations
11
ExtendSim
12
Introduction
Model illustrations
Tutorial
Running a Model
Learn how to run an ExtendSim model
and investigate its components
14
Running a Model
Opening the Reservoir model
The first two chapters of this User Guide provide a tutorial that will help you learn the basics of
working with ExtendSim models. This chapter covers:
Opening a model
Blocks, including their icons, connectors, and dialogs
Tutorial
Running a Model
Model basics
15
Model basics
Blocks
Each block in ExtendSim represents a portion of
the process or system that is being modeled. Blocks
have names, such as Math or Queue, that signify the
function they perform. A Queue block, for example, will have the same functional behavior in every
Parts of a model
model you build. You can also add your own label
to a block to indicate what it represents in your specific model, such as a Queue block labeled Waiting Line.
Blocks are stored in Libraries. You will learn more about libraries and how to access blocks from
them at About libraries on page 26.
Place your cursor over a blocks icon to see a Tool Tip with its number (a unique identifier based on
when the block was placed in the model), block name, and the library it comes from. To also display a description of the block, go to Edit > Options and check Include additional block
information in the Model tab.
Connectors
Most blocks in ExtendSim have input and output connectors (the small squares attached to the
block). As you might expect, information flows into a block at input connectors and out of the
block at output connectors.
A block can have many input and/or output connectors; some blocks have none. For instance, the
Holding Tank block labeled Reservoir has an input connector on the left for values to enter. The
output connector on the right reports the results of the block's computations; in the tank it reports
the contents at each time step. Additional inputs on the bottom are for controlling specific tank
behavior.
The function of a connector is specific to the block; you can get information about a connectors
function by clicking the Help button in the bottom left-hand corner of the dialog, as discussed in
Dialogs, below. Since connectors are more important when you build a model (as compared to
when you run it), they are discussed in more detail in Connecting blocks on page 27.
Place your cursor over a connector to see its name and current value. You may also see additional
information depending on how the block is programmed.
Tutorial
16
Running a Model
Model basics
Tutorial
Dialogs
Most blocks have a dialog associated with them. Dialogs are used to enter values and settings
before running simulations and to see results as the simulation runs.
To open a blocks dialog, double-click the blocks icon,
or right-click the icon and select Open Dialog. For
example, if you double-click the Holding Tank icon,
the dialog at right opens.
At the top of the dialog is the blocks global block number, its name, and, in braces, the library it resides in.
Global block numbers are unique identifiers assigned
sequentially to blocks as they are placed in a model.
At the bottom of every dialog is a Help button. The
blocks Help provides information about the block,
such as its purpose and use, connector usage, descriptions of each dialog item, and so on. Beside the Help
Holding Tank dialog
button is a text box where you can enter a label for the
block, up to 31 characters. The View popup is for
changing the icons orientation or appearance when you build modelsfor example, the Holding
Tank offers a choice of Default View and Default View Reverse.
Some dialogs also calculate and display values that are generated as the model runs, so if you leave
a dialog open during the simulation, you can watch the impact on different variables. This interactive simulation capability means you can even change some of the settings in a dialog during a
simulation run, such as choosing different buttons or typing new values.
When you click a button while the simulation is running, the block gets that changed value on the
next step. However, if you type text or enter numbers into a parameter field, the model pauses
while you are typing in order to get your entire input.
Connections
Connections are the lines that are used to join blocks together. They represent the flow of information from block to block through the model. The simulation itself is a series of calculations and
actions which proceed along the path of the connections repetitively. Each repetition is called a step
for continuous models or event for discrete event and discrete rate models.
In the Reservoir model, the blocks calculate in an order determined by the connections, starting at
the left and going to the right.
Running a Model
Blocks used in the Reservoir model
17
Holding Tank
Tutorial
Random
Number
Math
Plotter I/O
Block Function
Lookup Table
(Rainfall)
Represents rainfall entering the reservoir each month. The amount of rainfall is based on historical averages and
varies with the month.
Random Number
(Stream)
Math
Performs mathematical functions. The Adds the amounts from the two different water sources and transfers them
same Math block can be used for a
wide variety of purposes by selecting to the Reservoir.
the desired function from a popup box
in the dialog.
Holding Tank
(Reservoir)
Accumulates the total of the input values. It also allows you to request an
amount to be removed and outputs
that requested amount, if available.
Plotter I/O
18
Running a Model
Running the Reservoir model
There is nothing fundamentally different about the structure of these different blocks. Any block
may create, modify, or present information, and many blocks perform more than one of these
functions. You can, of course, have multiple instances of the same block within a model.
Tutorial
Select Run > Run Simulation or click the Run Simulation button
in the toolbar.
As the simulation runs, progress information will be displayed in the status bar at the bottom left
of the model window. (For a simple model like Reservoir that is completed very quickly, the messages may go by too quickly to be read.)
You can learn more about commands for running, stopping, and pausing models in Running a
model on page 580.
ExtendSim plotters remember the pictures (but not the data) of the last four plots. You can see the
previous plots by clicking on the small turned-up page symbol
part of the plot window.
Running a Model
Notebooks
19
Notebooks
ExtendSim features like the Notebook give you capabilities that go beyond the basics of building
and running models. A Notebook is a window you can customize to help organize and manage the
data in a model.
in the toolbar.
The Notebook for the Reservoir model opens. As you can see, the important parameters and
tables you saw in the dialogs of the Reservoir model have been placed in its Notebook.
Run the simulation again. Note that the results shown on the Plotter and the results shown in
the Notebook are the same (the results will change slightly from one simulation run to the next
because the Stream source uses a random distribution).
Reservoir 1 model with Notebook containing clones of dialog items from the Lookup
Table, Random Number, and Plotter I/O blocks.
Notebooks are easy to create and are especially useful for documenting models and to view the
impact of inputs on results. For more information, see Notebooks on page 566.
Tutorial
You can use a Notebook as a front-end to the model - to control model parameters, report simulation results, and document your model. Each model has its own Notebook which can contain
plots, text, pictures, drawing items, and cloned duplicates of dialog and plotter items.
20
Running a Model
Making changes to the model
You can change a model by adding or removing blocks or by changing parameter values in a blocks
dialog.
Tutorial
Running a Model
Other modifications
21
Tutorial
ExtendSim lets you choose from dozens of probability distributions or create your own. Learn more in Probability
distributions on page 686.
Math block
The Math block can be used to perform any
mathematical function. In this model, it is used
to add the amounts of water coming in from the
rainfall and the stream.
Other modifications
As you have seen, ExtendSim offers many options to
change the way a model runs so that you can explore
Holding Tank block dialog
different scenarios. The Reservoir model can be
expanded upon in other ways that will be explored later since they involve more advanced techniques. For example, you can:
Add more real-life contingencies by adding blocks to the model. For example, add more water
sources, then use a Notify block (Utilities library) to monitor the simulation and sound an alarm
if the water level goes above a certain value. For more information, see Notify block on
page 569.
Add blocks and connect them to the Holding Tank to remove some of the water from the Reservoir. The blocks can cause the water to be removed randomly or based on a table of expected
outputs. The Reservoir models in Tutorial on page 63 demonstrate some ways of doing this.
22
Running a Model
Other modifications
Tutorial
View the status of blocks by connecting their outputs to the Plotter, by leaving their dialogs
open while running the simulation, or by taking some of their dialog items and putting them in
the model window, which is referred to as cloning. Youll learn more about cloning in Creating
a dashboard interface on page 564.
Perform analysis such as Scenario Analysis or Optimization and have ExtendSim find the best
set of parameters. See the chapter Analysis on page 623.
Build a user interface for the model by putting sections of the model in layers (hierarchy), building custom reports (Notebook and reporting features), or creating a dashboard front-end (using
buttons and cloned dialog parameters to run the model). These features are discussed in Creating a Custom User Interface on page 561.
Now that you understand how easy it is to run an ExtendSim model, the next chapter will show
you how to build a model from scratch. When you are finished with that chapter, you will see how
easy it was to create the Reservoir model and the ease with which you can create your own models.
Tutorial
Building a Model
How to build an ExtendSim model
and use the model window features
24
Building a Model
Steps to create the Reservoir model
This chapter continues the Tutorial by describing the steps required to create the Reservoir model
that you ran in Chapter 1. As stated earlier, this model uses continuous simulation, but the concepts described in this chapter also apply to other types of modeling.
Other modules in this guide describe specific discrete event and discrete rate concepts and show
Tutorial
you how to build those types of models, but they assume that you have already completed this
Tutorial.
The topics covered in this chapter include:
Opening a new model window
Simulation setup and run options
Opening a library of blocks
Adding blocks to the model
Connecting blocks using different methods
Using dialogs to set parameters
Making adjustments to the Plotter graph
Hierarchy - top down
Navigating the model
Cloning duplicates of dialog and plotter items
For your reference, the final version of the Reservoir 1 model is located in the ExtendSim9\Exam-
ples\Tutorials folder and is shown on page 36. However, you will learn more about ExtendSim and
modeling if you build the model yourself.
Building a Model
Opening a new model worksheet
25
The Simulation Setup command opens a dialog for setting a variety of simulation and 3D animation parameters, such as how long and how many times
the simulation will run, when the random number seed gets reset, the mode of interaction between
the simulation and the 3D window, and so forth. The dialog has tabs for Setup, Continuous, Random Numbers, 3D Animation, and Comments.
The most common simulation settings you will need to enter in the Simulation Setup window
(and often the only ones) are the End time and Global time units parameters located on the
Setup tab. For most purposes, you want the simulation to start at the beginning, so you would
use the default start time of 0.
Customize the Setup tab by entering the following parameters:
End time: 36
Start time: 0 (Default)
Runs: 1 (Default)
Global time units: Months
Click OK
When it runs, the model will simulate 36 months
of time, performing calculations once each
month.
Setup tab of Simulation Setup window
Each time you run a simulation, ExtendSim uses
the same values entered in the Simulation Setup
window. Thus, you will usually only configure the settings once per model. The Simulation Setup
command is discussed fully in Simulation setup on page 574.
Basic steps
The basic steps for building a model are:
Tutorial
26
Building a Model
Building the model
1) Open the relevant libraries, if necessary. (Most ExtendSim libraries are automatically opened
when you launch ExtendSim.)
2) Add the blocks to the model.
Tutorial
About libraries
Blocks used in a model are stored in repositories called libraries. The entire definition for a block
(its program, icon, dialog, and so on) is stored in the library. When you include a block in a model,
the block itself is not copied to the model. Instead, a reference to the block is included in and
stored with the model. Any data you enter in the blocks dialog is also stored within the model.
There are many advantages to this method of using references to libraries instead of actual blocks
in models. If you change the definition of a block in a library, all models that use that block are
automatically updated. Also, block definitions are quite large, so storing just a reference to the
library saves memory and reduces processing time.
When you save a model, ExtendSim saves the names of the blocks as well as the locations of the
libraries that store the blocks. The next time you open the model, ExtendSim automatically opens
the libraries the model uses. You can also set a preference in the Options window to have up to
seven libraries load automatically whenever ExtendSim is launched (seeOptions on page 792).
Opening the relevant libraries
To add a block to a model, the library in which that block resides must be open. By default, the
major libraries that are shipped with ExtendSim automatically open when you launch the application. The instruction below are for situations where you have closed a library or when you want to
open a custom library.
The Reservoir model needs blocks from the Value and Plotter libraries. To open these libraries:
Choose Library > Open Library. ExtendSim takes you to the Libraries folder.
Select the Value library.
Click Open.
Repeat the above steps to open the Plotter library.
Open libraries are listed in alphabetical order at the bottom of the Library menu.
Building a Model
Building the model
27
Tutorial
If you click at a location on the model window before you pick a block from the
menu, the block will appear at the point
where you clicked.
Choose File > Save Model As and name the file My Reservoir.
Connecting blocks
As mentioned in Chapter 1, connections pass information from one block to another. Blocks are
usually connected together by drawing connections from one blocks output connector to another
blocks input connector.
28
Building a Model
Building the model
For a quick one-step method to add and connect a new Item or Rate block in a model, or to insert
Tutorial
a new Item or Rate block between two already-connected blocks, see Smart connections on
page 618.
Connectors
In ExtendSim, the behavior of most connectors is predefined for each specific block. For example,
when you set a Math block to use a function (add, subtract, divide, etc.) it knows what to do with
the values that are input into the block. This makes model building easy since you can connect
blocks and run simulations without having to write equations to define what each block should do
with the inputs or outputs.
There are several types of connectors in ExtendSim. Continuous models,
such as Reservoir, only use value input and output connectors to pass information from one block to another. Other types of connectors will be discussed in later chapters.
Each input connector can only have one source of information. Therefore,
Input
Output
Value connectors
blocks that need to have many sources of input require a separate input
connector for each piece of information.
Types of connections
There are two types of connections in ExtendSim: line connections and named connections. Line
connections join the output of one block to the input of another using connection lines; named
connections use text labels as outputs and inputs, causing data to jump from the output to the
input without using connection lines.
Connection lines can be drawn using three different styles: right-angle, straight, and multi-segment.
The default style is right-angle, which you will use in the following example.
The other styles of line connections, as well as named connections, will be discussed at Additional
ways to connect blocks on page 33.
Connecting the Lookup Table block to the Math blocks variable connector
In the Reservoir model, the two water sources need to be connected to the Math block so that the
amounts of water entering the reservoir from rainfall and from the stream can be added together.
The first step is to connect the Lookup Table block to the Math block.
As mentioned earlier, blocks that need to have more than one source of input require a separate
input connector for each piece of information. ExtendSim provides for this by putting variable
connectors on blocks that might need them. This is usually indicated by a black arrow beneath the
connector that can be dragged to display additional connectors.
The Math block, for example, has a variable input connector as indicated by the black arrow below
its input. However, since the Math block displays two inputs by default, you do not need to
expand the variable connector. For more information about using variable connectors, see Variable connectors on page 556.
To connect the Lookup Table block to the Math block:
Building a Model
Working with block dialogs
29
Tutorial
30
Building a Model
Working with block dialogs
Rainfall source
The amount of rainfall entering the reservoir is determined by a Lookup Table block that contains
each months expected rainfall. In a real-life situation, for example, these numbers may have been
determined by annual recorded averages.
Tutorial
Customize the dialogs Table tab by setting the behavior of the block to look up simulation time
each month:
Click OK
Enter data into the table as shown in the screenshot at
right.
If you click Enter after each value, the cursor will automatically move to the next cell.
In the label entry box beside the Help button, type in Rainfall.
Labels can have a maximum of 31 characters, including spaces.
On the Options tab, enter the following text in the column labels
box to give more meaningful headings to the table (be sure to include the semi-colon):
Month;Rainfall (inches)
Return to the Table tab
Building a Model
Working with block dialogs
31
The tables left column now specifies the month and the right column specifies the amount of
expected rainfall in inches. At each step, ExtendSim will check the blocks table for a time in the
first column that is less than or equal to the current simulation time and output the corresponding
value (inches of rainfall) to its right. For instance, for the fourth month the block will output 1.9.
Although you dont need to for this model, the Math block
function can be changed directly in its dialog or by rightclicking a special area on its icon. For the Math, Decision,
and Simulation Variable blocks (Value library), the icons
lower right corner has a sensitized area that looks like a parMath dialog settings
tially turned page. You can right-click that area to change dialog settings.
Tutorial
Stream source
32
Building a Model
Working with block dialogs
Tutorial
Click OK.
than sum, its inputs. This will output the value at time
1 that has been calculated for the period from time 0 to
1. These continuous simulation concepts are discussed
more thoroughly in Integration vs. summation in the
Holding Tank block on page 690.
Click the text label Value in the upper left corner of the Plotters graph to select its text box.
Type Inches in the text box and click the Tab, Return or Enter key.
Using that same process, change other Plotter labels in the graph pane as follows:
Change Plotter I/O (located at the top of the graph) to Reservoir Model.
Change Time (located below the graph) to Month.
Close the plotter window
Save the model.
When you save a model, ExtendSim creates a backup, ModelName.bak, of your previously saved
model. To open a backup file, add the extension .mox after the .bak so that the file reads ModelName.bak.mox. Then Open the backup file from the File menu.
Building a Model
Running the simulation
33
Select Run > Run Simulation or click the Run Simulation button in the toolbar.
Select Model > Connection Lines and select the straight line option (second item).
Changing the setting in the Model menu will only affect subsequent connections in this model.
You can change the default setting for all models by choosing Edit > Options > Model tab and
unchecking Default connection line style is right angle.
Draw a line from the output connector on the Lookup Table block to the second input connector on the Plotter.
Both the straight line and right-angle line connections have the disadvantage of running directly
over other blocks and connections, making the model more difficult to read.
Delete the straight line connection by selecting it and pressing Delete or the Backspace key.
Multi-segment line connection
This style has the advantage of letting you draw the lines so that they go around blocks rather than
over them.
With the straight line option still selected, click the Lookup Tables output connector and drag
your cursor until it is above the space between the Holding Tank and the Plotter blocks.
Tutorial
34
Building a Model
Additional ways to connect blocks
Tutorial
Multi-segment connection
Although this connection no longer crosses over any other elements of the model, you can see how
a larger, more complex model could become very cluttered with so many line segments in the window.
Delete the multi-segment connection by double-clicking a segment until the entire connection
line thickens, then press Delete or the Backspace key. (To delete just one segment of the line,
you would click the segment once and press the Delete key.)
Named connection
Named connections are text labels that are used to represent one output at many locations in your
model. If you have two labels with the exact same text, you can use these to have the flow of data
jump from one part of the model to another. Named connections are often used when you do not
want to clutter up your model with many lines. You can place the names near the blocks to which
they connect and leave much of the area of your model free from connection lines. Named connections are discussed in detail at Named connections on page 618.
Named connections are not case sensitive and spaces and returns are ignored, but you must use
identical spelling in the text names.
Creating a named connection between the Lookup Table and the Plotter
To add a text label for the named connection:
Choose Model > Connection Lines and select either the right-angle or
straight line style.
Double-click in the model window, slightly above and to the right of the
Lookup Table blocks output connector. This opens a text box.
Building a Model
Plotting against multiple axes
35
Click the Rainfall text to select it, then choose Edit > Duplicate.
Drag the duplicate text to a spot slightly below and to the left of
the Plotter and release the mouse.
Draw a line between this text and the second input connector on
the Plotter. Note that both the connection lines are now solid.
Create a Stream text label and place it near the output of the Random Number block.
Connect from the Random Number blocks output connector to the text label.
Duplicate the text label and drag it to a spot below and to the left of the Plotter.
Connect from the text label to the third input connector on the Plotter.
To display the actual connection lines between blocks, choose Model > Show Named Connections.
Plotting against multiple axes
Click the Run Simulation button on the toolbar.
The Plotter that appears now has three lines on it: the
blue one displays the amount of water in the reservoir
over time, the red one displays the amount entering the
reservoir from the rainfall, and the green line displays
the water entering from the stream.
At the end of the simulation run, the Plotter automatically scales its axis to be able to display all values for both
columns of data. However, because the total amount of
water in the reservoir has a much greater range than the
amount entering it each month, the lines representing
the rainfall and stream amounts can barely be seen. They
simply look like horizontal lines across the bottom of the graph.
To solve this problem, you can add a separate axis (Y2) on the right-hand side of the graph and set
the Plotter to display the rainfall and stream values against that axis.
If its not already open, double-click the Plotter to open its plotter window.
Click the Trace properties button
, which is the left-most button in the toolbar at the top of
the plot window.
The Tools dialog opens.
In the third row, labeled Stream, click the Y1/Y2 button, causing
the stream to also be plotted against the Y2 axis.
Tutorial
36
Building a Model
The final Reservoir model
Tutorial
The graph now displays the Rainfall and Stream lines using the right-hand axis.
My Reservoir model
Additional enhancements
Now that you know how to create a model, you can explore some other features, such as hierarchy
and cloning, that are easy to do and will greatly enhance your models.
Introduction to hierarchy
The Reservoir model displays one block per function performed, i.e. the Lookup Table block outputs the amount of water coming from rainfall, the Random Number block outputs the water
coming from a stream, etc. For such a simple model, this works fine. However, models created for
real-life simulations can involve thousands of blocks. Building, organizing, and presenting a complex model with all the blocks on one layer of the worksheet would be very difficult.
Building a Model
Additional enhancements
37
To help simplify and clarify models, ExtendSim lets you create hierarchical blocks (H-blocks) that
group several blocks together into one block while still allowing you to drill down into the lower
levels to access the individual blocks.
Creating a hierarchical block from existing blocks
In the Reservoir model, you can group the blocks that represent sources of water together into one
hierarchical block. This process is extremely easy.
Do not select the text labels (Rainfall and Stream) of the named connections!
Hierarchical block
Double-click the hierarchical block to see the submodel, or individual components, inside it.
Tutorial
Group-select (shift-click) the Lookup Table, Random Number, and Math blocks.
38
Building a Model
Cloning
Tutorial
Select Window > Navigator or click the Open Navigator tool in the Toolbar.
By default, the Navigator opens in Model Navigator mode,
with the word Model selected in the leftmost popup menu.
The name of the active model is listed at the top of the window and below the Navigators leftmost popup menu, and
each blocks icon and information (name, label, and global
block number) is displayed.
Cloning
In Running a Model on page 13 you saw how Notebooks help organize, monitor, and interact
with data during simulations. ExtendSim lets you add dialog and plotter items to your Notebook
using a technique called cloning. Clones are exact replicas of dialog items, behaving exactly like the
original. When a cloned value changes, the original dialog item or plot graph also changes.
To clone a plot from the Plotter block to the Notebook:
Select Window > Notebook or select the Open Notebook tool in the toolbar.
An empty Notebook window opens.
Building a Model
Other modifications
39
from the toolbar, click the plot (graph portion) of the plotter
and drag it to the Notebook window.
Tutorial
Other modifications
Since it is so easy to add and modify elements in ExtendSim models, there are many ways you can
enhance them. Here are just a few examples.
Add blocks to represent more sources of water entering the reservoir.
Add an additional Plotter to see the various lines on different plots--for example if the scales of
the results are very different and you do not want to plot against the Y2 axis. There are four ways
to create a second instance of a Plotter:
Insert another Plotter block from the Library menu, as you did earlier in this chapter.
Insert another Plotter block from the Plotter librarys library window, as discussed at
Library Window mode on page 771.
Copy and paste the existing Plotter.
Select the Plotter, choose Edit > Duplicate, and move the duplicate Plotter to the desired
location.
You can use these same techniques to duplicate any block in the model. Note that if you copy or
duplicate a models existing block, any dialog settings for that block will also be copied.
Configure the Holding Tank block so that it outputs water over time. For an example of this, go
to Tutorial on page 63.
Run the model with Show 2D animation enabled to display the water level in the Holding Tank
block. Learn more, see Blocks with built-in animation on page 609.
40
Building a Model
Next steps
Set delta time to a value less than 1, as discussed onpage 85. This calculates output values
between the steps, so you can see finer resolution of the model results.
Next steps
Tutorial
You have learned the basic techniques for running and building models and some additional techniques for enhancing your models. The following are some suggestions on which sections of the
manual to explore next, depending on what your own simulation requirements are.
The Tutorial modules Simulation Concepts chapter discusses more general simulation and
modeling concepts and how ExtendSim can be used for all types of modeling. It describes the
three main modeling methodologies (continuous, discrete event, and discrete rate) as well as
modeling approaches such as Monte Carlo, Agent Based, and State/Action.
If you already know the type of modeling you want to do, the specific modules are:
Continuous Modeling starting on page 59.
Discrete Event Modeling starting on page 91.
Discrete Rate Modeling starting on page 309.
3D Animation starting on page 447.
The How To module starting on page 546 has several chapters that show how to use ExtendSim to do common modeling tasks (such as creating a user interface, analyzing model results,
etc.).
Tutorial
Simulation Concepts
Learn about systems, simulation,
and modeling methodologies
42
Simulation Concepts
Systems, models, and simulation
The first two chapters of the Tutorial showed how to build and run simulation models in ExtendSim. Since you have seen some of what can be accomplished with ExtendSim, now is a good time
to explore some modeling and simulation concepts. The following discussion is meant to familiarize you with modeling and simulation terminology and concepts used throughout this guide. This
chapter:
Tutorial
If you are already familiar with the concepts to be presented in this chapter, skip it and proceed to
one of the other modules, as discussed in About this User Guide on page 6.
Systems
The real world can be viewed as being composed of systems. A system is a set of related components or entities that interact with each other based on the rules or operating policies of the system:
Entities are the internal components of the system. Entities are involved in processesactivities
in which they interact with each other.
Operating policiesthe types of controls and availability of resourcesare the external inputs
to the system. They govern how the system operates and thus how the entities interact.
Over time, the activities and interactions of entities cause changes to the state of the system; this is
called system behavior or dynamics. Systems can be mathematically straightforward, such as a
flower growing in the soil and turning towards the sun to maximize photosynthesis. Or they can be
more complex, such as supply chain operations composed of planning, selling, distribution, production, and sourcing subsystems.
Models
A model is an abstracted and simplified representation of a system at one point in time. Models are
an abstraction because they attempt to capture the realism of the system. They are a simplification
because, for efficiency, reliability, and ease of analysis, a model should capture only the most
important aspects of the real system.
Most models can be classified into four basic types:
A scaled representation of a physical object, such as a 1:18 diecast model of a Ferrari, a clay
model of a proposed packaging bottle, or a scale model of the solar system.
Simulation Concepts
Modeling methodologies
43
A graphical or symbolic visualization, such as a flow chart of office procedures, the board game
Monopoly (which represents the hotels and facilities of Atlantic City), or an architects plans for
a building.
A mathematical description that incorporates data and assumptions to logically describe the
behavior of a system. This type of model is typically dynamicit has a time component and
shows how the system evolves over time. ExtendSim products are tools for building mathematically-based, dynamic models of systems.
Dynamic modeling is the foundation for computer modeling. Thus, for purposes of this manual,
the word model will be used to mean a description of the dynamic behavior of a system or process.
ExtendSim models typically have a time component and can show cause and effect and the flow of
entities throughout a system (you can also create ExtendSim animations that show spatial relationships.)
Simulation
The Merriam-Webster OnLine Dictionary defines simulation as the imitative representation of
the functioning of one system or process by the functioning of another. This means that to determine how an actual system functions, you would build a model of the system and see how the
model functions.
Simulations run in simulation time, an abstraction of real time. As the simulation clock advances,
the model determines if there have been changes, recalculates its values, and outputs the results. If
the model is valid, the outputs of the simulation will be reflective of the performance or behavior
of the real system.
Simulation with ExtendSim means that instead of interacting with a real system you create a logical model that corresponds to the real system in certain aspects. You simulate the operations or
dynamics of the system, then analyze one or more areas of interest. You do this in order to reduce
risk and uncertainty so that you can make informed, timely decisions.
Modeling methodologies
The formalism you use to specify a system is termed a modeling methodology. The three main
modeling methodologies are:
Continuous
Discrete event
Discrete rate
These methodologies are described, compared, and contrasted in the later topics in this chapter.
In addition to the main modeling methodologies listed above, other modeling approaches are useful and will be discussed in this chapter. These approaches are usually based on one of the three
main methods and include:
Monte Carlo
Tutorial
An analytical or mathematical formula that yields a static, quantitative solution. For instance, an
analytic model might consist of several independent sample observations that have been transformed according to the rules of the model. Common examples of analytic models are spreadsheet models or linear programming models.
44
Simulation Concepts
Modeling methodologies
Agent-based
State/Action
Tutorial
The types of models that can be built depend on the ExtendSim product that was purchased.
Comparison of main modeling methodologies
The three main modeling methodologies are continuous, discrete event, and discrete rate. Continuous modeling (sometimes known as process modeling) is used to describe a flow of values. Discrete event models track unique entities. Discrete rate models share some aspects of both
continuous and discrete event modeling.
In all three types of simulations, what is of concern is the granularity of what is being modeled and
what causes the state of the model to change.
In continuous models, the time step is fixed at the
beginning of the simulation, time advances in
equal increments, and values change based directly
0
1
2
3
4
on changes in time. In this type of model, values
reflect the state of the modeled system at any par- Time line for continuous simulation
ticular time, and simulated time advances evenly
from one time step to the next. For example, an airplane flying on autopilot represents a continuous system since its state (such as position or velocity) changes continuously with respect to
time. Continuous simulations are analogous to a constant stream of fluid passing through a
pipe. The volume may increase or decrease at each time step, but the flow is continuous.
In discrete event models, the system changes
state as events occur and only when those events
occur; the mere passing of time has no direct
0
2.3 2.7
4
effect on the model. Unlike a continuous model,
Time line for discrete event simulation
simulated time advances from one event to the
next and it is unlikely that the time between
events will be equal. A factory that assembles parts is a good example of a discrete event system.
The individual entities (parts) are assembled based on events (receipt or anticipation of orders).
Using the pipe analogy for discrete event simulations, the pipe could be empty or have any number of separate buckets of water traveling through it. Rather than a continuous flow, buckets of
water would come out of the pipe at random intervals.
Simulation Concepts
Modeling methodologies
In some branches of engineering, the term discrete is used to describe a system with periodic or
constant time steps. Discrete, when it refers to time steps, indicates a continuous model; it does
not have the same meaning as discrete event or discrete rate. Continuous models in ExtendSim are
stepped using constant time intervals; discrete event and discrete rate models are not.
Comparison table
The three main modeling methodologies are summarized in the table below.
Modeling method
ExtendSim library
What is modeled
Examples
Continuous time
Value library
Processes
Individual items
Electronics library
Discrete event
Item library
Rate library
Flows of stuff
Continuous
Discrete Event
Discrete Rate
What is modeled
Distinct entities
(items or things).
A time change
An event
An event
Tutorial
Discrete rate simulations are a hybrid type, combining aspects of continuous and discrete event
modeling. Like continuous models they simulate
0
2.3 2.7
4
the flow of stuff rather than items; like discrete
Time line for discrete rate simulation
event models they recalculate rates and values
whenever events occur. Using the pipe analogy
for a discrete rate simulation, there is a constant stream of fluid passing through the pipe. But
the rates of flow and the routing can change when an event occurs.
45
Tutorial
46
Simulation Concepts
Modeling methodologies
Factor
Continuous
Discrete Event
Discrete Rate
Time steps
Characteristics of what
is modeled
Track characteristics in
a database or assume
the flow is homogeneous.
Track characteristics in
a database or assume
the flow is homogeneous.
Ordering
FIFO
FIFO
Routing
Values need to be
explicitly routed by
being turned off at one
branch and turned on
at the other (values can
go to multiple places at
the same time.).
Statistical detail
In addition to general
General statistics about In addition to general
the system: amount,
statistics, each item can statistics, effective rates,
efficiency, etc.
be individually tracked: cumulative amount.
count, utilization, cycle
time.
Typical uses
Scientific (biology,
chemistry, physics),
engineering (electronics, control systems),
finance and economics,
System Dynamics.
Manufacturing, service
industries, business
operations, networks,
systems engineering.
Some systems, especially when a portion of the flow has a delay or wait time, can be modeled using
any of the three styles. In this case, you would generally choose how to model the system based on
the level of detail required. Discrete event models provide much more detail about the workings of
these types of systems than continuous models. Continuous and discrete rate models, on the other
hand, usually run faster than discrete event models.
Remember that you may combine blocks from different libraries within the same model. For
example, it is quite common to use continuous blocks from the Value library when creating a discrete event model. However, the discrete event blocks in the Item library and the discrete rate
blocks in the Rate library can only be used in event-driven (non-continuous) models. If you use
any discrete event or discrete rate blocks in a model, the timing will change to event driven (time
steps will not be periodic) and it will not be a continuous model.
Simulation Concepts
Other modeling approaches
47
Tutorial
Because of their specialized use, three specific modeling approaches (Monte Carlo, State/Action,
and Agent Based) are described below.
48
Simulation Concepts
Other modeling approaches
Tutorial
For scenario experimentation purposes, the inputs and outputs for this model are stored in an
ExtendSim database.
The Queue Statistics model is located in the folder \Examples\Discrete Event\Statistics. It is not
available with ExtendSim CP.
Simulation Concepts
Other modeling approaches
49
State/Action models
With state/action modeling a system is modeled as a collection of discrete states. Sometimes
known as a state chart, a state/action model represents a system that responds to an event by transitioning to another state. The model is composed of a series of states where each state depends on
a previous state. A state has an associated action and an event that will cause that state to change to
another. The transition from one state to the next is not sequential; each state can lead to any other
state.
All states accept events.
One or more states may create an event as a result of a transition by another state or group of
states.
A group of states can be set to transition conditionally, for instance to only change if another
state or group of states achieve a specific stage. These are known as guard conditions.
State/action models are independent of any of the three modeling methodologies (continuous, discrete event, or discrete rate.) They are useful for specification and verification in many areas, from
computer programs to business processes.
In ExtendSim, the most common ways of creating state/action models are:
Define one or more discrete event items as objects with behavior that is determined by their
states. The information about each state and its next state is stored in a Lookup Table block
(Value library) or an ExtendSim database table. This uses ExtendSims internal event queue and
scheduling capabilities to signal and manage events for the item/objects within the system. This
method can only be used with discrete event models and is illustrated in the State Action model,
described later in this section.
Store each state, action, event, and next state for the system in rows in an ExtendSim database
table. This maps the states for the entire model into one block and works with any type of
model. This method can be used with continuous, discrete event, and discrete rate models and is
shown in the Markov Chain Weather model, described later in this section.
Create new blocks that store their current state in a static variable and send messages to other
blocks at appropriate state change events. To do this, use ExtendSim functions and its simulation modeling environment to create a custom block. For more information about creating new
blocks, see the Developer Reference.
State Action model
In the State Action model, items are created with attributes that determine the items state. The
items are then routed to one of three operations depending on their state. After processing, the
Tutorial
There are rules that govern the communication and transition between the states:
50
Simulation Concepts
Other modeling approaches
Tutorial
items state is changed based on entries in a Lookup Table block (Value library). The item continues to be routed to various processes until it reaches state 4, at which point it leaves the simulation.
Initially, each item has a CurrentState attribute with a value of 1. The Lookup Table block causes
each item with CurrentState 1 to be changed to CurrentState 3 after processing, then to CurrentState 2, and finally to CurrentState 4. The operations are represented by Workstation blocks,
which can hold and process the items. After each operation, the item is examined and its state is
transitioned accordingly.
Running the simulation with animation on shows the items changing from state 1 (green), to state
3 (red), then state 2 (yellow), and finally state 4 (blue).
The State Action model is located in the folder \Examples\Discrete Event\Routing, It is not available with ExtendSim CP.
Simulation Concepts
Other modeling approaches
51
mated on the icon of the Weather Forecast block. It does this by showing different icon views,
depending on the state. (For information about icon views, see page 554.)
Tutorial
Agent-based models
Most of the models discussed in this User Guide represent a system where the behavior of the components of the system are known or can be estimated in advance. With agent-based modeling you
usually do not know model dynamics in advance; instead, you obtain that information from the
interaction of the agents in the model.
Agent-based models share the following characteristics:
The identification of individual entities within the model
A set of rules that govern individual behavior
The premise that local entities affect each others behavior
Agent-based modeling is concerned with individual entities (called agents) that interact with
other agents within their specified locality. All the agents have a set of rules to follow but they also
have a degree of autonomy such that model dynamics cannot be predefined. This is because agents
can have intelligence, memory, social interaction, contextual and spatial awareness, and the ability
to learn.
Programming for agent-based models
The agents used in agent-based modeling are programmed as ExtendSim blocks. Blocks and their
enclosed data have unique searchable identities and locations within the model. ExtendSim functions can find and send messages to blocks that have specific characteristics, locations, and values.
This makes it easy to create intelligent behavior, facilitate block-to-block interaction, and cause
blocks to be moved in, added to, or removed from, a model.
The Developers Reference includes several categories of functions that are helpful when creating
agents for agent-based modeling:
Scripting functions are used to build a new model or to add or remove blocks from an existing
model. They do this by creating, placing, and connecting blocks, then populating the blocks
with specific data. These functions can be called from an ExtendSim block within the model or
from an external application.
Block and inter-block communication functions query the status of a block its type, label,
data, location, size, and connectivity with the rest of the model. They also get information about
block dialog values and data table settings.
52
Simulation Concepts
Other modeling approaches
Message sending functions can use the results of inter-block communications to send messages
globally to unconnected blocks or blocks that are connected in specific ways.
Tutorial
Animation functions provide a visual indication of block-to-block interaction, such as the influence of one block on another.
For example, in constructing an agent-based model of the robotic clean up of a chemical spill, you
could use the inter-block communication functions in a Controller block to locate all of the
Robotic Clean Up blocks in the model. The Controller could send messages to the robots asking
them to move towards a spill and clean it up. The robots could send messages back to the Controller stating whether they were available or were currently being recharged, and whether they were
too far from a chemical spill or close enough to be useful. The scripting and animation functions
would show the robot blocks physically moving around within the model and the spill being
removed.
The Game of Life
The Game of Life was devised by British mathematician John Conway in 1970 and published as
an article in Scientific American. It is the most well known example of cellular automata (CA), a
type of modeling studied in computability theory, mathematics, theoretical biology, and other
fields.
A CA model represents a regular grid of finite state automata (cells) that sit in positional relationships to one another, with each cell exchanging information with the eight other cells to which it is
horizontally, vertically or diagonally adjacent. A cell can be in one of a finite number of states and
the state of a cell at time t is a function of the states of its neighboring cells at time t-1. Every cell
has the same rule for updating; each time the rules are applied to the whole grid a new generation
of cells is produced.
You interact with the Game of Life by specifying an initial configuration of effects and observing
how the CA universe evolves. At each step in time, the following happens:
A cell is born if it has a specified number of neighbors who act as parents.
Loneliness causes any live cell with fewer than a specified number of neighbors to die.
Overcrowding causes any live cell with more than a specified number of neighbors to die.
The initial pattern constitutes the first generation of the system. The second generation is created
by applying the above rules simultaneously to every cell in the first generation. In other words,
births and deaths happen simultaneously. The rules continue to be applied repeatedly to create further generations.
Life has a number of recognized patterns that emerge from particular starting positions, including
static patterns (still lifes such as block and boat), repeating patterns (oscillators such as blinker
and toad), and patterns that translate themselves across the board (spaceships such as gliders).
The Life model
The one-block Life model was created using the Life block (Custom Blocks library) that was specifically developed for this model. The code of the block contains the algorithm for Conway's
Simulation Concepts
Other modeling approaches
53
Game of Life. The block's dialog has fields for specifying initial settings and rules; the dialog items
have been cloned to the model worksheet for convenience.
Tutorial
Life model
The concept for this model is that each cell of the grid is defined as living or empty. On each generation, a given cell can give birth to a new life, survive, die, or remain empty. Using the default
settings in the Life block, the model adheres to the following rules:
Count the number of neighbors a given cell has (the maximum possible is 8).
If an empty cell has 3 neighbors, it will produce a new life (birth).
If a full cell has less then 1 or zero (loneliness), or 4 or more neighbors (overcrowding), it will
die.
Changing the default rule values causes some interesting affects on the population.
There are two ways to set the starting population for the model:
Define an initial number of cells (1000 is a reasonable starting population for the size of this
block.) The cells will be populated randomly.
Use the Custom Start grid to select up to 16 initially populated cells in specific locations. This is
a quick way to begin with a recognized pattern, such as a glider or a blinker.
One feature of the Life block that is not specified in Conway's algorithm is that the color of the
cells varies with the age of the cell - new cells are green and older cells vary from light gray to black
as they age.
Variations
The Life block is open source so you have complete access to the dialog editor and block code. To
see the underlying structure of the block, select it on the model worksheet and give the command
Develop > Open Block Structure. The procedures that define cell birth, death, or survival are listed
at the top of the block's structure window.
The Life model is located in the folder \Examples\Agent Based. The Life block is located in the
Custom Blocks library.
54
Simulation Concepts
The modeling process
Boids
The Boids model is based on an artificial life program, developed by Craig Reynolds in 1986, that
simulated the flocking behavior of birds. It can also be applied to schools of fish, herds of animals,
or any other type of flocking behavior.
The Boids model requires 3D animation; it requires ExtendSim Suite to run. The model is located
Tutorial
In the model, each bird is an individual agent that interacts with other local agents based on a set
of rules:
Separation birds steer to avoid crowding their local flock mates.
Alignment each bird steers towards the average heading of its local flock mates.
Cohesion birds steer toward the average position of their local flock mates.
Other agent-based models
Additional agent-based models, including Sheep and Wolves and Breakout are located in the
folder \Examples\Agent Based.
Goals of modeling
The Introduction chapter gave several examples of what you can do with simulation. As stated in
Modeling Tools for Environmental Engineers and Scientists (N. Nirmalakhandan, CRC Press), the
...goals and objectives of modeling are two-fold: research oriented and management oriented.
Specific goals of modeling efforts can be one or more of the following: to interpret the system, analyze its behavior, manage, operate or control it to achieve desired outcomes; to design methods to
improve or modify it, to test hypotheses about the system, or to forecast its response under varying
conditions.
Simulation Concepts
The modeling process
55
3) Build and test the model. Build the system with ExtendSims blocks. Start small, test as you
build, and enhance as needed.
4) Acquire data. Identify, specify, and collect the data you need for the model. This is usually the
most time-consuming step. It includes finding not only numerical data values but also mathematical formulas such as distributions for random events.
5) Run the model. Determine how long you want to simulate and the granularity of results, then
run your model.
6) Verify the simulation results. Compare the model results to what you intended or expected.
7) Validate the model. Compare the model to the real system, if available. Or have system experts
evaluate the model and its results.
8) Analyze your results. Draw inferences from the models results and make recommendations on
how the system can change.
9) Conduct experiments. Implement and test recommended changes in the model.
10) Document. State the models purpose, assumptions, techniques, modeling approaches, data
requirements, and results.
11) Implement your decisions. Use the results in the real world.
Tutorial
2) Describe the flow of information. Determine where information flows from one part of the
model to the next and which parts need information simultaneously.
56
Simulation Concepts
The modeling process
tional data requirements may surface once the model building process has begun. Your model
may, for example, lead you to explore alternatives that had not been considered before.
Tutorial
How shall the model be conceptualized? Before even running ExtendSim, think about what the
various components of the system represent. Roughly determine the time delays, resource constraints, flows through the system, and any logical actions that occur in the model. This will
help you determine how to build the model.
What alternatives will be investigated? Although the model may lead you into new, unexpected
directions, try to think ahead so that the model can be easily changed from one alternative to the
next.
It is common to use a constant or a uniform (integer or real) distribution in the early stages of
model building so that modeling problems and variations can be more easily detected. After the
model is verified, you can easily change the distributions to correspond to real-world processes.
Refining models
It is important to remember that models may not give you a single correct answer. Instead, they
make you more aware of gaps in your thought process. These problems may involve over-simplification in the model, false assumptions on your part when creating the model, or missing connections between parts of a model. Refining your model step by step helps eliminate these and other
pitfalls.
Every model can be made more complex by adding assumptions and interconnections. The
model-building process commonly begins with the creation of a simple model. After analyzing the
simple model, complexity is added, followed by further analysis, the addition of more complexity,
and so on. The complexity takes one of two forms:
Taking one block (a process) and turning it into many blocks (a more complex process)
Adding a connection between two previously unrelated blocks, usually through a mathematical
operation (finding an interconnection between two processes)
At each step, look at your results and make sure they make sense relative to the data. If you can,
verify the results in the real world. If one result is way off, check the output from each step to
determine where the process went awry.
Model verification
The process of debugging a model to ensure that every portion operates as expected is called model
verification. In the tutorial, you performed part of this verification process by building the model
in stages and with minimal detail, then running it at each stage to observe the results. A common
verification technique could be termed reductio-adabsurdum (reducing to the absurd), which means reducing a complex model to an aggressively simple case so that you can easily predict what the outcome will be. Some examples of reducing to the
absurd are:
Remove all variability from the model, making it deterministic
Run the deterministic model twice to make sure you get the same results
Output detailed reports or traces to see if the results meet your expectations
Run a schedule of only one product line as opposed to several
Reduce the number of workers to 1 or 0 to see what happens
Simulation Concepts
Additional modeling terminology
57
Uncouple parts of the model that interact to see how they run on their own
Run very few or very many items through the model to determine if the model responds properly.
Model validation
Once the model is verified you need to validate it to determine that it accurately represents the real
system. Notice that this does not mean that the model should conform to the real system in every
respect. Instead, a valid model is a reasonably accurate representation based on the models
intended purpose. When validating, it is important to make sure that you know what to compare
to and that you verify that measures are calculated in the same manner.
For validation, your model should accurately represent the data that was gathered and the assumptions that were made regarding how the system operates. In addition, the underlying structure of
the model should correspond to the actual system and the output statistics should appear reasonable. While you would normally compare critical performance measures, it is also sometimes helpful to compare nonessential results that may be symptomatic and therefore show the character of
the system.
One of the best validation measures is Does the model make sense? Other methods involve
obtaining approval of the results by those familiar with the actual process and comparing simulation results with historical data. For example, when validating model performance compared to
historical data, try to simulate the past. If you have sufficient historical data, break the actual system performance into various windows of time, where all of the input conditions correspond to
the input conditions for multiple runs of your model.
For more information, see Debugging Tools on page 693.
Tutorial
Other methods for verifying models include making sure that you can account for all the items in
a model, animating the model or portions of the model, or using diagnostic blocks from ExtendSims libraries. For more information, see Debugging Tools on page 693.
58
Simulation Concepts
Additional modeling terminology
Tutorial
Deterministic models contain only non-random, fixed components. No matter how many
times a deterministic model is run, unless some parameter is changed there is no uncertainty and
the output will be exactly the same. Thus the behavior of the model is determined once the
inputs have been defined.
The advantage of a deterministic model is that only one run is necessary, since it produces an
exact measurement of the model's performance. It is also helpful in when initially building a
model since you can be assured that changes in results will be due to changes made to the model
and not to randomness. The disadvantage is that these types of models can only accurately be
used to model a few types of processes, since real-world systems typically contain some element
of randomness.
Adding randomness to one or more inputs to a deterministic model changes it to a stochastic or
Monte Carlo model. Stochastic models are run repeatedly and then analyzed statistically to
determine a likely outcome. Notice that the occurrence of randomness does not mean that the
behavior of a process is undefinable or even that it is unpredictable. Random variables vary statistically as defined by a distribution. This means that their range and possibility of values is predictable.
While stochastic models can be applied to very complex systems, a disadvantage is that the output is itself randomthe average of the simulation runs provides only an estimate of the
model's true behavior.
ExtendSim provides several methods for including randomness in models. For instance, as you saw
in the chapter Building a Model, the Random Number block (Value library) allows you to select
a random distribution or enter a table of values which specifies an empirical distribution of probabilities. For more detailed information about ExtendSims random number capabilities, seeRandom numbers on page 684.
Continuous Modeling
Introduction
Some things to know before you begin
modeling continuous systems
60
Introduction
How the Continuous module is organized
The Continuous Modeling module is focused on building models where time advances in equal
steps and model values are recalculated at each time step. It is also a helpful reference if you use
continuous blocks in discrete event and discrete rate models.
Continuous
Tutorial
Application areas and examples
Continuous concepts, tips, and techniques
You can use continuous blocks and the ExtendSim database to build State/Action models, as discussed in State/Action models on page 49.
See Value Library Blocks on page 821 for a listing and brief description
of the blocks in the Value library.
If your model becomes too cluttered with blocks, you can encapsulate portions of it into a hierarchical block, then double-click the hierarchical block Value library window
to see the submodel. Hierarchical blocks are created using simple menu
commands and can be stored in libraries for reuse in other models. They are discussed in Hierarchy on page 598.
Introduction
Application areas
61
Sim products include a development environment for creating custom blocks. You can create your
own blockseven your own libraries of blocksand use them to build models. Because you have
the source code for the blocks that are packaged with ExtendSim, you can adapt an existing block
to your needs or create an entirely new block from scratch.
ExtendSim has an integrated, compiled development environment, so it is easy to build blocks
with custom dialogs and behavior. And because the development environment is optimized for
simulation and user-interface design, you can build blocks with less effort and more flexibility than
by using a traditional programming language. ExtendSim's development environment has the
functionality you need to create blocks that can:
Process data, perform calculations, and show results in numerical, graphical, and animated form
Interact with the user
By programming your own blocks you can:
Obtain specific behaviors not available in the blocks included with ExtendSim
Combine the functionality of several ExtendSim blocks into one custom block for increased calculation speed and convenience. (Note that this is different than using hierarchy to encapsulate
several distinct blocks as a submodel within one block.)
Develop a library of blocks for a specific discipline, such as for control systems or paper-making
processes
Design your own modeling architecture
Blocks you create can be saved in libraries and used throughout your models just as you would use
any of the standard ExtendSim libraries. And the blocks that are packaged with ExtendSim, such
as the Value library, are designed to work well as supplements to any custom blocks you may
develop.
The ExtendSim Developer Reference has all the information you need to program your own
blocks.
Third-party libraries
Third-party developers use the ExtendSim environment to create libraries of blocks customized for
specific fields. For more information about third-party libraries, please go to www.extendsim.com/
prtnrs_developers.html.
Discrete event or discrete rate blocks built by third parties will not run with the ExtendSim CP
product.
Application areas
Computer simulation is indispensable for understanding, analyzing, and predicting the behavior
of complex and large-scale systems. It is used to gain an understanding of the functioning of existing systems and to help design new systems by predicting their behavior before they are actually
Continuous
62
Introduction
Next steps
Continuous
built. The following table gives some of the most common areas where continuous modeling is
used.
Discipline
Fields
Applications
Science
Engineering
Business
Social Sciences
Next steps
The next chapter in the Continuous Modeling module provides a tutorial that expands upon the
Reservoir 1 model used in the guides Tutorial module. Chapter 3 describes typical industries and
applications for continuous simulation such as scientific, engineering and business; it uses models
provided with ExtendSim as illustrations.The final chapter of the Continuous Modeling module
discusses concepts specific to continuous simulations and give additional tips when building models.
The How To module that starts on page 546 includes chapters on topics relevant to all types of
modeling, including creating a custom user interface, using mathematical and statistical functions,
and statistically analyzing models.
Continuous Modeling
Tutorial
Building a more complex
continuous model
64
Tutorial
Removing overflow from the Holding Tank
The Tutorial module showed how to build the Reservoir model. This chapter illustrates some
additional modeling techniques to enhance that model:
Removing content from a Holding Tank block if it exceeds a specified limit
Using the Equation block to replace the functionality of several blocks
Adjusting delta time (dt) for more accurate simulation results
If you havent already done so, it is recommended that you go through the chapters in the Tutorial
module (starting on page 13) to familiarize yourself with the basic techniques for building models
and running simulations.
Continuous
Example models for comparison to the Overflow model you will build in this chapter are located in
the ExtendSim9\Examples\Tutorials\Continuous folder. Reservoir 2 shows a series of blocks that
calculate and remove the overflow and Reservoir 3 is the same model using an Equation block to
perform the calculations.
Tutorial
Removing overflow from the Holding Tank
65
In the dialog, set the Constant value to 50 and enter Res depth as the blocks label.
Continuous
Add a Decision block (Value library) below the Constant block and to
its right.
In the Decision blocks dialog, choose A > B (the default setting) from
the popup menu. Label the block If too high...
Adding a Decision block
Connect from the Constant blocks output to the B input of the Decision block.
When the model runs, the Constant will set the B value to 50.
During the simulation run, the Decision block will evaluate whether or not
the value of the Contents (A) is greater than the value of the maximum
Reservoir Depth allowed (B). If yes, it will assign a value of 1 to the Y output connector. If no, it will assign a value of 0 to the N output connector.
Decision connected
66
Tutorial
Removing overflow from the Holding Tank
Add a Math block to the right of the Constant block, set its function to Subtract, and label the
block Subtract excess.
In addition to selecting functions directly in the Math blocks dialog, you can choose settings by
right-clicking near the sensitized area (looks like a partially turned page) on the lower right of the
blocks icon.
Continuous
Add a Contents named connection to the top input of the Subtract block.
Connect the output of the Constant block to the bottom input of the Subtract block.
Validating intermediate results
When building a model, it is good practice to frequently test if the model is working correctly.
Even though this model isnt yet finished, validate that model elements are calculating as you
would expect them to.
Subtraction results
The Decision blocks Y connector outputs 1 (one) if the tanks contents exceeds the limit, but outputs 0 (zero) if it doesnt. This information can be used in a calculation.
Add another Math block to the model, set its function to Multiply, and label the block Then
overflow.
Tutorial
Removing overflow from the Holding Tank
67
Connect from the output of the Math block labeled Subtract excess to the top input of the Math block labeled
Then overflow.
You do not need to connect the Decision blocks N connector to anything since, if the reservoirs
Removing the overflow
When the contents of the Reservoir/Holding Tank are greater than its capacity, water needs to be
removed.
Connect the output of the Multiply block to the w (want) input connector on the bottom left
of the Holding Tank.
The Holding Tanks want input connector is used to request an amount to be removed. If the tank
has that amount, it will be reported at its get output connector. If the tank does not have that
amount, and Tank contents can be negative is not checked. only the amount available will be at
the get connector. Since this model is only concerned with overflow, the amount requested and
the amount available will be the same.
Overflow connection
Continuous
68
Tutorial
Simplifying the model
Continuous
Simulation results
Scroll through the Plotters table of data to see the point where the reservoir is beginning to reach
its capacity. Column 4 (Overflow) shows the amount of water that overflows. Because the inflows
continue even while the excess is being removed, and because there is a calculation delay, it is
unlikely that the reservoir will be at exactly 50.
Tutorial
Simplifying the model
69
Comments, which are preceded by //, are optional but helpful for documentation.
Continuous
70
Tutorial
Improving the accuracy of the model
Continuous
In the Lookup Table block (labeled Rainfall), change Output is: to Interpolated. This setting
smooths the change between rows in the table.
Tutorial
Next steps
71
Next steps
Continuous
Continuous
72
Tutorial
Next steps
Continuous Modeling
Areas of Application
Some of the many ways continuous modeling is used
(Science is)...the separation of the true from the false by experiment or experience.
Richard P. Feynman
74
Areas of Application
Scientific
ExtendSim is used to build continuous models in the fields of physical science, social science, engineering, and business. The first four sections of this chapter describe models created using the
ExtendSim Value and Engineering libraries. The last section shows two models built with custom
blocks: a physics model called Planet Dance and a Fish Pond simulation that examines predator/
prey interactions.
Continuous
Continuous modeling is very broad and diverse field. While it is possible to create almost any continuous model using the standard blocks (such as the Value library) packaged with ExtendSim, it is
more common to use a combination of standard blocks and custom-built blocks. For example,
ExtendSim customers have created libraries for proprietary and commercial use in the fields of
analytical chemistry, environmental decision making, chemical process control, pulp and paper
making processes, and so forth.
Scientific
Common areas where simulation is helpful in science include biology, chemistry, physics, and ecology. This section describes two models, a classic predator/prey model and a simulation of some factors that affect drug absorption in the human body.
Predator/Prey
This model shows a small ecosystem composed of hare and lynx. Each population has a direct
effect on the other: the lynx feed on hare so the hare population declines, the diminishing food
supply results in a decrease in the number of lynx so the hare population grows again and so forth.
Model assumptions
The model particulars and assumptions are:
The 100-hectare ecosystem initially
contains 6000 hare and 125 lynx.
Each hare produces 1.25 offspring
per year and each lynx produces
0.25 offspring.
Hare always have sufficient food
supply; their only cause of death is
being eaten by a lynx.
The lynx hunting range is 1 hectare,
their only food source is the hare,
and each lynx can consume every
hare in its area.
Predator_Prey model
Areas of Application
Scientific
75
Model details
This model illustrates some interesting continuous modeling concepts:
Because the model has feedback, the Holding Tank blocks are set to Inputs are: integrated (no
delay). For more information, see Integration vs. summation in the Holding Tank block on
page 690.
The Holding Tank block has a want input connector that is used to tell the block how much of
the contents you want removed. The amount wanted and the amount that is actually removed
(indicated at the get connector) may differ, as discussed below.
Dividing the hare population by the area of the ecosystem (100 hectares) determines how many
hares there are per hectare. The lynx can eat every hare in each hectare, but if they eat too many
and the hare population decreases, the lynx mortality rate increases. This contributes to the
cycles seen in the model.
Notice that, at each point in time, the result in the Hares Killed block is higher than the hare
population shown on the plotter. This occurs because hares are constantly being born and the
lynx kill not just the previous steps population but also some of the new births.
The Lookup Table block is set to Output is: interpolated, which means that intermediate values
can be used. For example, an input value of 65 (which is halfway between the Hares Eaten values of 60 and 70) will cause the block to output 0.175 (which is halfway between the Lynx
Death Rate of 0.2 and 0.15).
Further exploration
If you review the initial assumptions for this model, you can probably see several enhancements
that could be made.
The birth rates for both the hare and the lynx could vary based on model conditions or on outside factors. For instance, the birth rate might be dependent on the health of the parents, the
level of crowding, or the amount of pollution in the ecosystem.
You might add a predator or an additional food source for the lynx.
The model assumes an unlimited food supply for the hare. To a food source, the hare would be
considered the predator, so modeling a food source would follow the same logic as adding the
lynx predators.
Hares could have predators other than lynx.
You could factor in outside conditions, such as the time of year and expected weather conditions. Then examine the effects of those conditions on mortality rates.
Drug Ingestion
There really can be too much of a good thing. For some drugs, such as blood thinners, it is important that the patient get enough of a dose to cause the desired outcome, but not so much as could
Continuous
By default, the Holding Tank block is set to not allow its contents to become negative. This
means that the population of hare cannot be reduced below the available amount, no matter
what is requested through the want connector. The amount that is actually removed is reported
at the get output connector. If the tank were allowed to become negative, the amount at the
want connector and the amount at the get connector would be the same. Since it cant go negative in this model, the amount at want could be higher than the amount actually removed and
reported at get.
76
Areas of Application
Scientific
be harmful. One method is to monitor the concentration of the drug in the patient's bloodstream
to determine if it is at effective, but safe, level. Many factors influence drug absorption - the
amount ingested, the rate of absorption, the patient's diet, and so forth - and simulation is the best
method to explore the effect of those factors.
The Drug Ingestion model is located in the folder \Examples\Continuous\Standard Block Models.
This model uses blocks from the Value and Plotter libraries.
Model assumptions
Constant blocks specify the dosage amount (1500 mg) and frequency (3 doses/day)
The stomachs volume is 500ml and the absorption percentage is 0.693
Continuous
Areas of Application
Engineering
77
Variations
Try changing the dosage amount and the frequency of application using the cloned dialog parameters on the left side of the model. Then observe the changes in the concentration of the drug in the
bloodstream. Or, to illustrate the affects of different drugs, vary the metabolism and absorption
constants.
Engineering
Simulation is extensively used for modeling electronic, signal processing, control, and mechanical
systems, as well as neural networks and other engineering systems. The following electronic signal
processing example investigates the performance of a receiver in a digital FM system.
Noisy FM system
The Noisy FM System model is located in the folder Examples\Continuous\Standard Block Models. The model uses blocks from the Electronics and Plotter libraries.
Model assumptions
FM center frequency is 91.6khz
Antenna tuner uses an elliptical filter
Demodulator is a passive RC phase locked loop using an exclusive OR comparator
Model details
This model shows the performance
of a receiver in a digital FM transceiver system, within a noisy environment. The Transmitter is a
hierarchical block with a submodel
containing a bitstream generator and
an FM carrier generator. The bitstream generator is comprised of two
Voltage Controlled Oscillator blocks
(VCOs) and two Clipper blocks:
The first VCO outputs a square
wave that varies between -1 and
+1 volt output.
Noisy FM model
The first Clipper limits the square wave signal to 0 and +1 volt, so that it can modulate the second VCO and produce the periodic bitstream for testing.
A second Clipper limits this square wave output for the Frequency Modulation (FM) generator.
The Clippers can be eliminated, but limiting the VCO input voltage to between 0 and +1 volt
makes it easier to enter frequency modulation range parameters.
The Filter-Bandpass block (labeled Antenna tuner) is set to elliptical because of its economy (fewer
poles & zeroes yield the fewest components). The Comparator block after the antenna acts as a
limiter and detector of the FM signal. The Phase Locked Loop (PLL) block demodulates (separates) the input signal from the FM carrier signal. The output from the loop has a lot of pulses on
Continuous
When designing receivers and demodulators, engineers need to balance quality and cost. Simulation helps illustrate the trade-off, for example when the objective is to filter noise without reducing
the quality of the reception. Fewer components can result in a product that is cheaper to produce
and maintain, but a product with more components might have a better sound.
78
Areas of Application
Business
it, so it is filtered slightly by a simple Butterworth filter. The low-pass filter after the PLL smooths
out the switching transients always present in PLL outputs.
Continuous
Variations
Because elliptical filters have very large group delays at their edges, a Chebyschev might be better.
Try setting the noise to 1.0 volts and running the simulation with the elliptical filter. Then try setting the filter type to Butterworth, Chebyschev, click Recalculate poles... and rerun the simulation. The Chebyschev option works better than the elliptical filter, but notice how many poles are
generated and how complex (costly) the filter will become.
The PLL's parameters can be easily changed for experimentation. For example, enter different
bandwidths, damping, loop types, and phase comparators, and running the simulation again.
Playing with the amount of noise on the signal can give interesting results. For example, increasing
the amplitude in the Noise Generator block will quickly destroy the signal.
Business
Finance, economics, inventory management, and marketplace competition all lend themselves to
analysis through simulation. The following example explores how to minimize costs while still
being able to provide products based on customer demand.
Inventory Management
A company holding inventory incurs both ordering costs and holding costs:
Ordering costs include order processing, labor transportation, inspection, and so forth. They are
generally stated as a fixed cost per order.
Holding cost includes such expenses as warehousing, insurance, taxes, obsolescence, and management. They are generally stated as an amount per item per time period or as a percent of unit
cost per time period.
These costs are involved in a classic trade-off because as the number of orders per time period
increases, ordering cost increases and holding cost decreases. The objective of inventory management is to minimize the sum of the two costs.
Areas of Application
Social sciences
Social sciences
Simulations in the fields of psychology, social dynamics are common. The example that follows
investigates the effect of available office space on new business growth in a small city.
City Planning
Cities and other governmental agencies forecast tax revenues, infrastructure needs, and operational
expenses when setting their annual budgets. Whether predicting population changes, business
usage, or housing needs, growth projection models help provide realistic estimates for budgeting
Continuous
Model details
This model shows inventory stocking/depletion
cycles. Its purpose is to
stabilize the inventory
level so that over- or
under-stocking is
avoided. The model
examines the effect on
inventory levels of a 25%
increase in product
demand. It also uses SenInventory Management model
sitivity Analysis to
explore the effect of
changing the lead times for stock delivery. The MultiSim plotter displays the difference in inventory from one run to the next.
79
80
Areas of Application
Social sciences
purposes. They are also helpful when developing policies such as environmental protections and
residential growth ordinances.
The City Planning model is located at \Examples\Continuous\Standard Block Models. The model
uses blocks from the Value and Plotter libraries.
Model assumptions
The City Planning model represents office occupancy in a city with a limited amount of offices. A
projection provides the number of new businesses that will require office space each month over
the next 240 months. There is also an estimate of the number of businesses that will fail.
Continuous
Growth projections (see the Lookup Table block labeled Demand) are derived from a study estimating growth over a 20 year time period.
For clarity, this model is separated into sections:
Office Bank: The Holding Tank represents the number of offices available. The initial amount
of 4000 is reduced as businesses occupy offices and is increased as businesses fail. Multiplying
the demand for offices by the expected number of offices required per business (5) gives the
amount that will be withdrawn from the office bank. If there are not enough offices available,
businesses cannot relocate to this city. These lost businesses are also calculated.
Businesses Occupying: The number of offices occupied each month is divided by the number of
offices required per business (5) to determine the number of businesses that occupy offices per
month. This amount is accumulated to get the total number of businesses occupying offices, so
that the number of business failures can be calculated.
Business Failures: There is a 6-month delay, then 2% of the businesses fail and move out of their
offices each month.
Notice that the number of failures is based on the net total number of businesses, not just on the
total number of new businesses occupying offices. The failure amount is removed from the Businesses Occupying Holding Tank, so that failures are calculated on a net number. The number of
Areas of Application
Custom blocks
81
offices recovered due to businesses failing is returned to the Office Bank, making more office space
available.
Variations
Vary the available office space, office space usage per business, or growth projections to explore
alternatives.
Custom blocks
Planet Dance
The Planet Dance model demonstrates the inverse square law of gravity. It uses the Planet and
Planet Plotter blocks from the Custom Blocks library. Both blocks were created specifically for this
model.
Each Planet block in the model contains the definition of one planetary object whose mass will
Planet Dance model
affect, and will in turn be affected by, each of the
other objects in the model. The dialogs of the
Planet blocks contain parameters that define the mass, position, density, and initial velocity of a
particular planet. The blocks code contains the math for calculating the gravitational attractions of
the objects to each other.
When this model runs the planets display the slingshot effect. As one object approaches another,
the attraction between them increases, leading to the less massive object being accelerated to a high
speed. Scientists sometimes use the slingshot effect to accelerate vehicles on their trips to explore
the outer planets in our solar system.
Note that the units of the various parameters are not defined in this model. The numbers entered
in the dialogs are just used relative to the other objects in the model.
Variations
This model provides lots of room to experiment with the physics of objects:
Small changes in initial positions or velocities of the objects can cause big changes in model
behavior.
You can either add or remove an object, resulting in a four-body or two-body problem. In each
case, make sure that each object has one, and only one, connection to each of the other objects
on the worksheet; otherwise the math will get confused.
Continuous
82
Areas of Application
Custom blocks
One interesting problem, which demonstrates the complexities of the physics involved, is to try
to modify the parameters of the objects in the three body problem to produce a system of stable
orbits like the sun, earth and moon. (Before you get too frustrated trying to set this up, please
note that no one has yet been able to get those parameters right.)
Notice that even light objects will have an effect on the location and velocity of heavy objects.
To replicate a relationship like that of the earth and the sun, increase the mass and density of one
of the objects. No matter how much you do this, however, the heavy objects will be affected by
the position of the light object.
Continuous
Fish Pond
As opposed to the Predator/Prey model shown earlier that uses blocks from the Value library, the
Fish Pond model uses a custom-built Fish block to represent both predator and prey.
The Fish Pond model is located in the folder \Examples\Continuous\Custom Block Models. It uses
a Plotter I/O block from the Plotter library and the Fish block from the Custom Blocks library.
The Fish block was specifically created for this model.
About the model
This is a small pond with two types of fish: a predator and a prey. The goal is to balance the pond by
reducing the number of predators. The model uses a
Fish block from the Custom Blocks library and a
Plotter I/O from the Plotter library.
This two creature ecosystem shows how a single
block design can model many types of creatures. By
Fish Pond model
entering different parameters and connecting the
blocks differently, a more complex ecosystem can be
created. The Fish block is used to model two different species: a carrion-eating fish and a natural
predator. At the left of the model, carrion-eating fish eat other fish that have died in the pond. The
block to the right (a piranha) eats the carrion-eaters. Run the simulation and look at the graph; the
Piranha periodically decimate the carrion-eating fish population.
Variations
Each Fish block added to the model represents another species. You can add another predator to
the right of the second block and, based on the default parameters, it will control the piranha population. Try adding a controlling predator to reduce the Piranha population. To do this:
Add a Fish block and position it to the right of the Piranha block.
Connect the Pot. food in connector on the new block to the Pot. food out connector on the
block to the left.
Continuous Modeling
84
This chapter discusses some concepts specific to continuous modeling and provides tips to keep in
mind when building continuous models. The areas discussed are:
Simulation timing
Setting delta time to determine the granularity of calculations
Feedback and delays in continuous models
Choosing between integration and summation
Determining the order in which blocks execute
Mixing libraries within a model
Continuous
Concepts applicable to all types of models, such as deciding whether a model should have random
elements, are discussed in the chapter Simulation Concepts that starts on page 41. The following
topics are specific to continuous modeling.
Simulation timing
Most simulations run for a specified time. ExtendSim determines the duration of a simulation run
based on the values entered in the Run > Simulation Setup > Setup tab; the duration is the period
from the start time to the end time.
In continuous simulations, the duration is divided into intervals or steps of equal length, where
start time is the first step and end time is the last step. The length of time, in time units, for each
step is known as delta time or dt. The delta time setting determines how frequently model data is
recalculated.
As the simulation runs, simulation time advances from start time to end time at delta time per
step, calculating model data at each step. At the first step, ExtendSim calculates what the status of
the model is initially. Then it calculates the changes that take place over the next time step and
determines a new set of data points. Model data is generated as a string of successive points corresponding to the steps in time. Notice that, for each step, data is calculated for the entire period
from that step up to, but not including, the next step.
Continuous simulations require that either the number of steps or the time per step be specified.
As discussed below, in most cases a delta time of 1 is adequate. However, for model accuracy it may
be necessary to set a different delta time.
Delta time
Delta time (dt or t) literally means the change in time. It is defined as the length of the time
interval between the present time and one time interval later. When you select a delta time, you are
selecting how finely the total simulation time will be sliced up, i.e. how short the intervals between
calculations will be and thus how frequently the computations will take place. Delta time is set in
the Run > Simulation Setup > Continuous tab.
For the simulation results to be correct, the delta time for a continuous model needs to be small
enough to accurately reflect changes that occur in different parts of the model. In many cases, the
default delta time of 1 is adequate. However, for simulation speed or model accuracy it may be
necessary to set a delta time other than 1.
85
Signal processing models need to have their specific time per step (dt) either entered in the Simulation Setup dialog, or have it calculated by blocks in the model. For example, the Filter blocks
calculate the stepsize based on their entered parameters.
Differential equation models (models with integrators in feedback loops) may need to have a
time per step (dt) or number of steps other than 1.
If you are building custom blocks in process control models, you might set up the blocks so that
they have a Stepsize message handler that can calculate the value for the DeltaTime variable,
automating this process. See the Electronics library for some examples of blocks that do this.
If a model contains the Holding Tank block (Value library) and delta time is not exactly 1, you
may need to change the Holding Tank to integrate its inputs, as discussed in Integration vs. summation in the Holding Tank block on page 690.
Continuous
If delta time is not 1, it is most common that it would be less than 1. There are many reasons why
delta time would need to be less than 1. Feedback loops and stiff equations in the blocks can
require a smaller delta time to ensure that all calculations are reflected in the graph. Simulations
that are run with too large of a delta time often show values jumping from very high to very low.
This is known as instability or artificial chaos. Examples of models where a delta time of less than
1 may be required are:
86
time unit long. A default value for delta time is automatically calculated based on the number of
steps you enter; it is computed as (EndTime-StartTime)/(NumSteps - 1). You can see this by
choosing the Time per step (dt) radio button after changing the Number of steps.
Continuous
87
Feedback
Integration
Integration is a method of estimating the present value by estimating the past and/or future values
of the inputs, calculations, and outputs in a model. It is another way of summing or accumulating
values when the input is a rate (expressed as units per time). The advantage of integration over just
summing values is that integration will accumulate correctly when delta time is not exactly 1.0,
making it especially useful in feedback models that need a smaller delta time to work well. A simple form of integration (Euler) just multiplies the input rates by delta time and accumulates the
result.
The Holding Tank and Integrate blocks in the Value library have integration capabilities. You can
also use ModL functions to add integration to blocks you create. The Holding Tank block accumulates and, if wanted, releases values. Its dialog gives the option to either sum or integrate the
inputs. (Whichever option you choose will have an impact on the accuracy of continuous simulations. To learn more, see Integration vs. summation in the Holding Tank block on page 690.)
The Integrate block is used to perform the mathematical function of integration in models.
There is no feedback in the My Reservoir model you built in the ExtendSim Tutorial on page 23
and it uses a delta time of 1. For that model, the Holding Tank could be set to either sum its inputs
or integrate them (but the end time would need to be adjusted). The Overflow model, described in
the Tutorial on page 63, has feedback and uses a smaller delta time, so the inputs to the Holding
Tank must be integrated.
Continuous
88
Simulation order
The Run > Simulation Setup > Continuous tab allows you to choose the order in which ExtendSim executes block data for continuous models. (Simulation order is also used by a discrete rate
system to determine initial bias order settings for Merge and Diverge blocks.)
The choices are Flow order (the default), Left to right, and Custom. To see the order in which
blocks are executing, select the command Model > Show Simulation Order before the model is
run.
It would be unusual to change the simulation order from the default choice, Flow order.
Continuous
Flow order
During a simulation, the blocks that compose an ExtendSim model perform calculations that generally depend on their inputs. After doing their calculations, the blocks set their output connectors
to the results of that calculation so that other blocks may use their results.
In this type of system, there has to be a first block: a block that calculates before all of the others
that depend on its results. After the first block calculates, the other blocks should calculate in the
order and direction of their connections. This order is repeated for every time step of the simulation. To see this order, choose Model > Show Simulation Order.
The following are the rules that ExtendSim uses to derive the order of the block calculations in
continuous models:
Blocks that generate inputs to the simulation go first. For example, Lookup Table or Constant
blocks with only their outputs connected to inputs of other blocks would be put first.
Next, ExtendSim executes blocks that are connected to those first blocks, in the order and direction of their connections.
Unconnected blocks and bi-directional network blocks (that have only inputs connected to
inputs) are executed in left-to-right order.
The Feedback block (Utilities library) is useful when there are flow-order issues due to feedback in
a continuous model.
Custom order
Use caution when changing from Flow order.
In continuous modeling, there are some situations with multiple feedback loops that do not automatically settle into the desired flow order solution. This occurs because there are multiple solutions that solve the DAG (Directed Acyclic Graph) ordering problem, and it is possible for the less
desired solution to be picked.
89
To solve this ordering problem, start with the model set to Flow order and then change the order
for a few selected blocks using the Model > Set Simulation Order command.
To use the Custom order option effectively, the Model > Show Simulation Order command should
be checked so that the user can see which blocks need a changed order.
Also, note that the Set Simulation Order command is not enabled unless Custom order is selected
and a block is selected.
In the Set Simulation Order dialog, you can
enter a new order number for the selected
block and it will be moved into that position
in the simulation order.
The types of modeling you can perform depend on your ExtendSim package.
To learn more about what types of connectors can be connected to each other, see Connector
types on page 555.
As discussed inEvent scheduling on page 302, the connections work differently in discrete event models.
For aesthetic reasons, you may want to only have one connection coming from the output connector, for example
when the blocks are far away from each other. Instead of four
connections, connect to one of the input connectors, then
connect the input connectors together (sometimes called
daisy-chaining) in the image at bottom right. (Note that
this method may be confusing to others trying to understand
the model.)
The blocks in the Plotter library can store every point that was plotted in the table at the bottom of
the plotter. After running a simulation, you can easily access all those points.
Continuous
90
Continuous
There are some instances where you may want to use the plotter data as input for another ExtendSim model. For example, if you have a larger model divided up into many smaller models in different files, you may want to use this technique. To quickly pass data from one continuous model to
another, use the Plotter I/O block (Plotter library). That block has four output connectors that
correspond to the four input connectors. To get data out of the plotter into another model, simply
select the block, copy it to the Clipboard with the Edit > Copy command, select the second model,
paste the plotter at the beginning of the second model, and hook the plotters outputs to the places
where you need the data.
If you want to use the data in the plotter in another computer application, open the plotter, click
the columns of data that you want, copy to the Clipboard with the Edit > Copy command, move
to the other application, and paste the data there. If you want less than a full column, select the
desired cells by clicking and dragging.
Uncluttering models
You can use a block to mathematically combine the output of one block with the output of other
blocks. You can also use a block to feed the output of blocks into the inputs of several other blocks.
However, using individual blocks to represent each function, step, or portion of a complex model
can quickly cause models to become too busy. If your models end up being cluttered, combine the
functioning of many blocks into a single block. To do this:
Combine groups of blocks into a hierarchical block. See Hierarchy on page 598.
Use an Equation block (Value library) to replace the calculations of several blocks. See Equation-based blocks on page 677.
Create custom blocks that combine the functionality of many blocks as discussed above. See the
ExtendSim Developer Reference.
Introduction
Read this before you start
modeling discrete event systems
92
Introduction
About the Discrete Event module
The goal of every company, government agency, and educational institution should be to develop
an extremely strong competitive organization. Cost reduction and quality improvement alone are
not sufficient to achieve market share. Organizations must also be able to quickly develop and provide innovative new products and services. Invention, innovation, quality, productivity, and speed
are the keys to making companies competitive.
One way to maximize competitiveness is to improve operational systems and processes by:
Eliminating nonessential, non value-adding steps and operations
Implementing and inserting technology where appropriate
Managing the deployment and utilization of critical resources
Discrete Event
Introduction
Discrete event systems and processes
93
Discrete Event
94
Introduction
Blocks for building discrete event models
Industrial and commercial processes therefore represent the utilization and underactivity of elements and resources driven by events.
Item library
Blocks in the Item library correspond to typical activities, operations, and
resources in many environments. These blocks are connected in an activity or
data flow diagram that represents a system. The complexities of generating and
posting events are handled within the blocks, alleviating the need to do any
programming in the ModL language.
Discrete Event
Item library blocks are optimized for modeling service, manufacturing, material handling, transportation, and other discrete systems. They incorporate
high-level modeling concepts such as variable batching, conditional routing,
and preemptive operations as well as blocks that represent machines, labor,
conveyors, and so forth. Built-in performance calculations and statistical
reports allow you to predict the value, effectiveness, and cost of implementing
changes before committing resources.
These blocks have been specifically designed to meet most discrete event modeling needs, allowing you to quickly and easily perform complex modeling
tasks. For instance, you can use a popup menu in a Queue block to specify that
stored items are sorted in first-in-first-out order, last-in-first-out order, or in a
custom order based on their assigned priorities or attributes.
Activity
Batch
Catch Item
Convey Item
Cost By Item
Cost Stats
Create
Equation (I)
Executive
Exit
Gate
Get
History
Information
Queue
Queue
Equation
As mentioned in the Tutorial, blocks from the Value library are frequently used Item library blocks
for data management and model-specific tasks in discrete event models. Using
Value library blocks with Item library blocks does not change the fundamental architecture of discrete event models; they will still be event-based rather than use the time-based architecture of
continuous models.
See Item Library Blocks on page 829 and Value Library Blocks on page 821 for a listing and
brief description of the blocks in those libraries.
Third-party libraries
Third-party developers use the ExtendSim environment to create libraries of blocks customized for
specific fields, such as semiconductor manufacturing or multi-stage manufacturing systems. For
more information about products that can be purchased from third party vendors, please go to
www.extendsim.com/prtnrs_developers.html.
Introduction
Terminology and architecture
95
before modifying discrete event blocks so you have a better understanding of how those blocks
work internally.
It is this value information which is plotted and displayed in a discrete event model, not the items
themselves.
Often the object of the simulation is to determine where there are bottlenecks in the process and to
see which parts of the process might be improved. Each branch of the flow diagram should either
feed into another block or end in an Exit block.
A model can combine continuous blocks, typically those in the Value library, with discrete event
blocks from the Item library. If you use any discrete event blocks in a model, the model will
become discrete event and will require the Executive block (Item library).
Executive block
The Executive block controls and does event scheduling for discrete event and discrete rate models.
An Executive block must be placed to the left of all other blocks in a discrete event or discrete rate
model. Its use in a model changes the timing so that simulation time advances from one event to
the next, rather than at uniform intervals.
For more information, see Executive block on page 299.
Most of the Executives options are for advanced users. Unless you use string attributes, it is rare
that you would need to make any changes in the Executives dialog.
Discrete Event
The main source of discrete event blocks is the Item library. Most of the blocks in the Item library
have item connectors and value connectors. An item connector passes an item and all the information associated with it to the next item connector. Value connectors and dialog parameters provide
specific information about the item and its properties (attributes, timing, and so on) as well as
information about the effects that the item has in the model (such as queue length and wait).
96
Introduction
Terminology and architecture
change state (physically move, are delayed, or have their properties altered) when events occur,
such as a part being assembled, a customer arriving, and so on. In manufacturing models, items
may be parts on an assembly line; in network models, an item would be a packet of information; in
business models, items may be invoices or people. Items are passed from block to block through
item connectors. The Create block can generate items with a random distribution, at a constant
rate of arrival, at a fixed schedule, or on demand. The Resource Item block provides a finite pool of
items.
Items can have properties different pieces of information attached to an item that make the
item unique. Item properties include attributes, priorities, and quantities, as discussed in Item
properties on page 96.
Discrete Event
Values provide information about items and about model conditions. Values tell you the number
of customers in queue, how many parts have been shipped, and how frequently telephone calls
occur. Values also report processing time, utilization, and cycle time. These informational values
are passed through value connectors. When you use a plotter in a discrete event model you are
plotting information about items, not the items themselves. For example, when the top output of
an Exit block (total exited) is connected to a plotter, it displays the time that each item left the
model and the number of items that have exited.
Item properties
A property is a characteristic of an item that stays with the item as it moves through the simulation. Item properties include attributes, priorities, and quantities.
Attributes
Attributes are an important part of a discrete event simulation because they provide information
about items. Each attribute consists of a name that characterizes the item and a value that indicates
some dimension of the named characteristic. For example, an items attribute name might be
color and its value could be 1 (for red). Or the attribute name might be ProcessTime and
its value 4.76. Attributes are often used for routing instructions, operation times, or part quality
in statistical process control; they are discussed fully on page 119.
Priorities
Priorities allow you to specify the importance of an item. For instance, there might be a step in a
manufacturing process where a worker looks at all the pending job orders and chooses the one that
is most urgent. Each item can only have one priority. The top priority has the lowest value, including negative values (that is, an item with a priority of -1 has a higher priority than an item with a
priority of 2). Priorities are discussed fully on page 126.
Quantities
Each item can be a single entity or a group of duplicates. If the quantity of an item is 1, it represents one item; if it is greater than 1, it represents a group. By default, items have a quantity of 1.
The quantity can be changed by a block like the Set block. For more information, see Quantities
on page 128.
Events
ExtendSim moves items in a discrete event model only when an event happens. Events are occurrences such as receipt of an order, a telephone call, or a customer arriving. They are managed by
the Executive block (discussed on page 299) and only occur when particular blocks specify that
they should.
Introduction
Terminology and architecture
97
Blocks that depend on time cause events to happen at the appropriate time. For instance, an Activity block holding an item until a particular time will cause an event to be posted to the ExtendSim
internal event calendar. When the time is reached, the event occurs and the model recalculates its
data.
Blocks that do not generate events allow the blocks after them to pull items during a single event.
Thus a single event can cause an item to pass through many blocks if those blocks do not stop
them. For instance, a Set block could set the items attribute and pass the item to the next block in
the same event.
For more information, see Event scheduling on page 302.
Activities
Activities are undertaken to achieve a specified outcome, typically either a product or a service.
They have a duration and usually involve the use of process elements and resources. An activity
could involve processing, moving, transporting, or otherwise manipulating an item. For more
information, see the chapter Processing on page 169.
Resources are the means by which process activities and operations are performed. Typical
resources include equipment, personnel, space, energy, time, and money. Resources can be available in unlimited quantities but are most often limited or constrained. They can be consumed in
the process or kept for reuse.
In ExtendSim, a resource that is required for a process or activity to take place can be modeled
either as an item or as a unit in a pool:
Item resources get batched with the items that require them (Resource Item method).
A resource pool contains a count of the resources that are available to the model. The count can
be a number in a Resource Pool block (Resource Pool method) or the number of records in an
internal ExtendSim database (Advanced Resource Management method).
See Resources and Shifts on page 213 for complete information.
Connectors
Most of the discrete event blocks pass an item index through item connectors at each event. Each
passed index contains a set of information about the item its attributes, priority, quantity, and so
on. This is different from value connectors which only pass values.
Blocks in the Item library can contain value connectors as well as item connectors. When combining discrete event blocks with blocks from other libraries, you will only be able to connect compatible connectors. Item connectors can only connect to item or universal connectors; they cannot
connect with value input or output connectors. Likewise, value connectors can only connect with
value or universal connectors; they cannot connect with the item input or output connectors. For
more information about connector types, see Connector types on page 555.
Discrete Event
Resources
98
Introduction
Application areas
for further use. For example, assume a technician (the resource) is required to assemble parts of a
television. While the technician is assembling the parts, he/she will be busy and will not be available to perform work elsewhere. In a closed system, the technician will return to the technician
pool after assembling the parts and will become available for other assignments.
In a partially closed system, only a portion of the resources are returned to the resource block for
re-use. For example, consider a case were there are different shifts of laborers (the resource). Suppose three laborers are assigned to a task. Upon completion, the shift for one of the laborers is finished and he does not return to the labor pool to be assigned to a new task.
Open systems
Resource blocks may also be part of open systems when the blocks resources are not recycled. In an
open system, resources at the end of the line are not passed back to the Resource block. The most
common example of an open system is stock. Normally, stock passes out of the model at the end of
the line. Another example of an open system is a consumable resource such as a disposable fixture
that makes only one pass through the manufacturing process.
Discrete Event
Application areas
Simulation is indispensable for understanding, analyzing, and predicting the behavior of complex
and large-scale systems. It is used to gain an understanding of the functioning of existing systems
and to help design new systems by predicting their behavior before they are actually built. The following table gives some of the most common areas where discrete event modeling is used.
Discipline
Fields
Applications
Manufacturing
Service Industries
Introduction
Next steps
Discipline
Fields
Communications/Networks
Transportation/Material Handling
Airlines, Railroads, Freight and Emergency planning, schedulMail, Moving and Cargo, Ware- ing, service level, Six Sigma/
housing, Logistics
Lean initiatives.
99
Applications
Next steps
The next chapter is a tutorial showing how to use the Item library to build a discrete event model.
Other chapters in the Discrete Event module provide some tips you may find useful when building
models and illustrate specific discrete event concepts, such as item generation, assigning properties
to items, and activity-based costing.
Discrete Event
The How To module that starts on page 546 includes chapters on topics relevant to all types of
modeling, including creating a custom user interface, using mathematical and statistical functions,
and employing different types of analysis for your models.
Discrete Event
100
Introduction
Next steps
Tutorial
Building a discrete event model
102
Tutorial
A basic discrete event model
The key to discrete event modeling is the construction of a flow diagram using blocks to represent
the problems operations and resources. The Item library is designed for building discrete event
models of commercial and industrial processes. It is often used with other ExtendSim libraries,
especially the Value and Plotter libraries.
The following example shows how to build a discrete event model of a car wash; it will use most of
the important blocks in the Item library. Starting with a simple model, then adding complexity
and features, this chapter will show how to:
Model a single waiting line with a single server
Add a second server
Animate the model in 2D
Route items through the model
Discrete Event
Use attributes to characterize items so they can make decisions about which route to take
This tutorial assumes you have completed the chapters in the Tutorial module that starts on
page 14 and that you have read the introductory discrete event chapter that starts on page 92.
Tutorial
A basic discrete event model
103
The Executive block does event scheduling and manages discrete event simulations. It must be
present in every discrete event model.
Start small
In building any simulation model, it is easiest to start with a simple subset of the process and add
detail until you arrive at a completed model that approximates the system thats being modeled.
This allows you to test at various stages while making the model building process more manageable.
The first step is to model the car wash with one bay that just washes cars. Since there is only one
line into the car wash, each car must wait in line for the preceding car to move through the wash
before it can enter. When finished with this portion of the tutorial, your model should look like
the one shown below.
Discrete Event
Block Function
Routing:Create
(Dirty Cars)
Generates items or values, either ran- Generates cars that arrive randomly,
domly or on schedule. If used to gen- approximately every 4 minutes.
erate items, it pushes them into the
simulation and should be followed by
a queue-type block.
Queues:Queue
(Entry Line)
Acts as a sorted queue or as a resource Holds the cars and, when the wash bay
pool queue. As a sorted queue, holds is available, releases cars one by one in
items in FIFO or LIFO order, or sorts first-in, first-out order.
items based on their attribute or priority.
104
Tutorial
A basic discrete event model
Category:Name
(Label)
Activities:Activity
(Wash Bay)
Routing:Exit
(Exit)
Block Function
Discrete Event
Plotter,
Discrete Event
Starting at the right of the Executive block, place the blocks on the model worksheet in a line
from left to right, based on their order in the table. The model should look like the one shown
on page 103.
An easy method for placing blocks on a model worksheet is to access an open library using the
Navigator, as discussed in Library Window mode on page 771.
In the Create blocks dialog, the default setting is that items are created randomly using an exponential distribution. Since this is exactly what you want, just enter Mean: 4. With this setting,
one car will arrive approximately every 4 minutes.
By default, the Queue block is specified as a sorted queue, with items stored and released in
first-in, first-out order. Since this is what the model specifies, do not make any changes to the
Queue.
The assumptions indicate that cars are washed one at a time and that it takes the same amount
of time to wash each car. In the Activity blocks dialog, the default settings are that the capacity
is 1 and the delay is a constant amount of time. Since those settings are what you want, just
enter Delay (D): 6, indicating that it takes 6 minutes to wash each car.
The Exit block automatically counts and passes items out of the simulation and the Plotter will
graph results as the simulation runs. There are no settings to enter for those two blocks.
Making connections and running the simulation
To indicate the flow of items, connect the blocks item connectors as follows:
From the Create blocks item output to the Queues item input
From the Queues output to the Activitys input
Tutorial
Adding complexity
105
Adding complexity
Now that you understand how to build the basic model, you can add more details and features.
Discrete Event
106
Tutorial
Adding complexity
To increase the number of cars that the wash bay can process at a time, you would simply change
the capacity setting in the Activitys dialog. For instance, allowing a maximum of 2 items in the
Activity would simulate a wash bay that could wash two cars at a time.
Since the assumptions state that the final model has two bays, instead of increasing the Activitys
capacity you will add a second bay:
Discrete Event
Connect Wash Bay 2s item output to the Exit blocks second item input.
Save and run the simulation.
With the second wash bay, the entry line length stays near 0 most of the time, as shown in the
plotter and the Queue blocks Results tab.
Explicit routing
In the model so far, the number exiting from one wash bay is probably larger than the number
exiting from the other. (You can see this in the Exit blocks dialog.) Since you have not specified
any rules concerning how the cars are routed to a wash bay, a car will go to the first available bay.
However, if both bays are free, the car will go to the bay that was first connected in the model. This
implicit routing is not obvious and is rarely what you want.
Unless it is completely unimportant in the model, you should always explicitly state the routing of
items using the Select Item In and Select Item Out blocks. Otherwise, the order in which their
connections were made will dictate the routing, as discussed in Implicit routing on page 156.
To explicitly specify the order in which items go to free inputs, use the Select Item Out block.
Tutorial
Adding complexity
107
The preceding examples have two wash bays and purposefully dont take into consideration the
model assumption that 25% of the cars want wax in addition to a wash. You could specify the second bay as also providing waxing, and use the option Select output based on: random in the
Select Item Out block to route 25% of the cars to that bay. But this tutorial will explore a more
powerful method for accomplishing this in the section Item attributes on page 108.
Requiring resources
As a count of resources that are made available to the model as a whole and released when no
longer required.
As items that are joined with other items and flow through the model with them until separated.
In both situations, items cannot continue traveling through the model unless the required resource
is available.
Add a Resource Pool block (Item library) to the model and place it in any convenient place.
Label the block Attendant Resource. In its dialog, enter Resource Pool name: Attendants,
and enter Initial number: 1 (the default).
Delete the connections from the Activity blocks to the Exit block.
Add a Resource Pool Release block (Item library) after each of the two Activity blocks, and connect from the Resource Pool Release blocks to the Exit block.
In each Resource Pool Release block, select to Release by: name and choose that the name of
the resource pool is Attendants.
Discrete Event
Up to this point, the Car Wash model assumes that you drive the car through the wash. However,
many car washes require that an attendant do this. This situation can be easily modeled as a number of resources (the attendants) which are required by and made available to the model. As is discussed in Modeling resources on page 215, there are two methods to model resources:
108
Tutorial
Adding complexity
Item attributes
Discrete Event
Most car washes allow cars to have wax applied after the wash. Attributes are a very powerful feature that give items unique properties and characteristics. You can use attributes in this model to
indicate that specific cars should or should not be waxed. This is accomplished by adding an attribute to the cars coming from the Create block, then checking for the value of that attribute as the
car gets washed.
As discussed in Item attribute types on page 120, ExtendSim supports both string and value
attributes for items. The following example uses a string attribute type.
Creating a string attribute
In the table for entering string values for an attribute, enter the
strings Wash Only and Wash and Wax as shown in the screen shot
to the right.
Tutorial
Adding complexity
109
Connecting to a Set block causes the Random Number blocks empirical table to be aware of attributes. In this case, connecting the Random Number block to the Set blocks first value input
causes the empirical table to be populated with popup menus that relate to the first attribute (Preference) in the Set blocks properties table.
In the first row of the empirical table, select Wash Only from the popup menu and enter a
Probability of 0.75.
In the second row of the empirical table, select Wash and Wax from the popup menu and
enter a Probability of 0.25.
Since the bottom bay will now be used for cars that also need waxing:
Change the label of the bottom bay to Wash/Wax Bay.
Enter Delay: 8 in that bays dialog, to indicate that waxing and washing takes longer than
washing alone.
Each item generated by the Create block will now have a Preference attribute. In 75% of the cases
the car will be characterized as Wash Only; 25% of the time the cars will be designated as Wash
and Wax.
The next step is to have the model determine which car is which.
Checking the attribute
In the dialog of the Select Item Out block:
This causes the Preference attribute to be listed in the tables header and puts popup menus for
that attributes strings in the table.
The Select Item Out block routes items to its outputs based on the selection conditions and internal rules. When attributes are used to select the outputs, the blocks top output is referenced as
number 0, the second output as 1, and so forth.
To cause cars that dont need waxing to be routed to the top output:
In the tables first row, select Wash Only from the Preference popup menu.
Enter 0 in the Select Output column for the Wash Only row. That setting will route the Wash
Only cars to the top output.
To cause cars that need waxing to be routed to the second output:
Discrete Event
So that there will be sufficient attendants to drive all the cars that are generated, in the dialog of
110
Tutorial
Further exploration
In the tables second row, select Wash and Wax from the Preference popup menu.
Enter 1 in the Select Output column for the Wash and Wax string. That setting will route the
Wash and Wax cars to the second output.
Close the dialog, save the model, and run the simulation.
Discrete Event
You may notice that fewer cars pass through this car wash than in the example without attributes
or attendants. This is due to the problem of a car with a particular attribute following another car
with the same attribute. There is only one entrance to the bays, and the bays now have designated
purpose. This means that the second car must wait for the first one to finish even if the other bay
is free. Note, however, that every time you run the model, the numbers for the two lines in the Exit
block indicate that the cars have been processed in roughly the same proportion as specified in the
Random Number block.
Final model
For your reference, the completed
model, titled Final Car Wash, is
located in the folder \Examples\Tutorials\Discrete Event\Car
Wash. This model also has buttons
for running the model and turning
animation on and off. For information about adding buttons to
models, see Creating a dashboard
interface on page 564.
Further exploration
There are many other ways to modify the model shown in this section. Some possible variations
are:
Have the wash or wash/wax times be dynamic rather than static. There are several ways to do
this:
Specify that the delay in the Activity block is from a distribution. This would cause the
processing times to be random, rather than fixed as shown in Random processing time
on page 175.
Use a Lookup Table block to schedule the wash or wash/wax times to be dependent on the
time of day, as seen in Scheduled processing time on page 174.
Have an Equation block (Value library) calculate a wash time based on model conditions.
Then connect the Equations output to the Activity blocks D input.
Assign attributes to the cars to represent the expected time to process it, with each type of
car requiring a different processing time. This is especially useful in a manufacturing environment where there are several types of products that require different process times.
Add more wash or wax bays, then use the Select Item Out block to give preference to specific
bays rather than just letting cars randomly go to any available bay.
Have arriving cars look at the waiting line and not enter the car wash if the line is too long (balking) or leave the line after arrival if the wait time reaches a certain point (reneging). These concepts are discussed more in Queueing considerations on page 135.
Tutorial
Further exploration
111
Model other aspects of the car wash, such as the limited capacity of a parking lot to hold cars
after the wash process. To do this, use the Resource Pool block to represent the total number of
parking spaces available. Then set the Queue block as a Resource Pool queue to hold cars waiting for a parking space. The Resource Pool Release block would release parking spaces as the cars
pass through it.
Consider using a hierarchical block from the Templates library to replace some of the functionality in this model. For example, the Create - Arrivals Vary by Time template would be helpful
if you had a historical record of car arrivals.
Discrete Event
Discrete Event
112
Tutorial
Further exploration
114
As discussed in Items and informational values on page 95, items are what flow through the
model, properties contain information about items, and values provide information about model
conditions. This chapter discusses items and their properties and how information about them is
reported as values. It will cover:
Generating items randomly and by schedule
The Create blocks Start connector
Blocks of interest
The following blocks will be the main focus of this chapter. The blocks library and category
appear in parentheses after the block name.
Discrete Event
Item properties
Get (Item > Properties)
Displays the value of user-assigned and system level item properties: attributes, priorities,
quantity, and item index.
Set (Item > Properties)
Attaches user-assigned properties (attribute, priority, and quantity) to items passing
through.
Equation(I) (Item > Properties)
Can be used to set, modify, or check attributes on existing items. Calculates the equation
when the item arrives.
Executive
Its Item Attributes tab is used for attribute management, such as renaming or deleting attributes or locating where they are used in a model. It is also where string/value equivalents
are declared for string attributes.
115
Property-aware blocks
Item properties include attributes, priorities, and quantities. In addition to the blocks listed above,
the following blocks in the Item library provide an interface for viewing, selecting, or modifying
existing item properties or for adding new ones:
Queue Matching
Batch
Read(I)
Cost By Item
Resource Item
Equation(I)
History
Shutdown
Information
Throw
Query Equation(I)
Unbatch
Queue
Workstation
Queue Equation
Write(I)
Item generation
Items for a model are usually generated using the Create block. While it can also generate values,
the Create block can create items:
Randomly. A random distribution causes items to be generated with a random or constant
interarrival time. The distribution determines the time between item arrivals; a smaller interarrival time indicates that items will arrive more frequently. See the examples below.
By schedule. Creating items by schedule causes an item to be generated at a specific arrival
time. The schedule defines when the item will arrive and the time between arrivals is fixed. See
the examples in Generating items according to a schedule on page 118.
Infinitely. This provides an infinite supply of items that are available on demand. For instance,
connecting a Create block with this behavior to a Gate block would provide an item to the Gate
block each time it opens.
A Create block is set to Create items infinitely should never be connected to an infinite capacity
queue, since generating an infinite supply of items would overwhelm the system.
In a model, each item can represent an individual entity or a collection of individual entities. For
instance, 50 items coming into a model could represent 50 people or it could represent 50 bus
loads of people. How you characterize items is completely up to you.
Discrete Event
Activity
116
Discrete Event
You may want the parameters in a random distribution to change as a function of time or model
status during the simulation run. The arguments for a given distribution can be controlled dynamically through the Create block's value input connectors.
Random Intervals model
In the Random Intervals model, time dependent arrival rates are modeled by connecting the
Lookup Table block (Value library) to the Create blocks value input connectors. A table in the
Lookup Table block provides the mean values for an exponential distribution that has been set in
the Create block. This causes the timing of item arrivals to be based on the time of day.
117
Discrete Event
118
Discrete Event
In the example model, the dialog of the Create block is set to Create items by schedule. The
schedule of arrival times, which is cloned onto the model worksheet, indicates that one item will
be generated at Create Time 1, another item at Create Time 2, and so forth up to time 5. With this
schedule, the model has five arrival events.
The items proceed to a Queue to wait for processing by the Activity, which takes three minutes to
process each item. Since the simulation runs for ten minutes, only three items exit; one item is left
in the Queue and one item is still being processed in the Activity.
This method is especially useful when the time between item arrivals is known but not regular. For
instance, the first item could be generated at Create Time 1, the second item at Create Time 3, and
the third item at Create Time 3.5.
Notice that the Item Quantity column has a default value of 1 for each item generated. This means
that each item generated represents 1 item. Item quantities are described fully in Quantities on
page 128.
An alternative method would be to use a Create block set to Create items randomly, and select a
Constant distribution with a value of 1 in its dialog. Then in the blocks Options tab, select Maximum items generated: 5. This method is less flexible than the earlier method, since each item
would have to have the same interval between arrivals.
The Start connector
When the Create block is set to Create items by schedule it has a start value input connector that
can be used to control when the schedule is executed. The timing in the Create block depends on
whether or not the start input is connected:
If the start connector is not connected, the schedule's item creation times are synchronized with
the simulation run's absolute time. For example, if the schedule's first create time is at time 2
and the simulation's start time begins at time 0, an item would be created when simulation time
119
reaches 2. However, if the starting time entered in the Simulation Setup dialog is 4, the item
scheduled at time 2 is never created.
If the start connector is connected, such as to a Decision block (Value library), the schedule's
item creation times are relative to when the connector is activated. For instance, assume simulation starting time is 0 and the first item is scheduled for creation at time 11. If the start connector gets activated at simulation time 5, then the first item will be created at time 16 (5 plus 11).
Starts are activated whenever the connector receives a message with a True value (defined as greater
than or equal to 0.5).
The Create blocks Options tab provides choices for how the start connector should behave, as discussed below:
Follows schedule. This is the default option and should be used for most situations. Once the
start connector is activated, the entire schedule will be executed. Any new activation signals
arriving before the current schedule has completed are ignored.
Generates one item per event. This is an advanced option for special situations. With this
choice, the schedule is restricted to one row. Each time the start connector is activated, a zerotime event is scheduled. Once the Create block gets the zero-time event message, it will execute
the schedule.
Item properties
A property is a quality or characteristic that stays with an item as it moves through the model.
Some properties can be assigned to items by the model builder; others are automatically assigned
by the system.
An items properties include:
User-assigned attributes. These are discussed in the next section.
Priority. See page 126.
Quantity. See page 128.
System-assigned attributes. See page 130.
Item attributes
Because they allow items to be distinguished from each other, item attributes play a very important
role in a discrete event simulation. They are especially useful for telling an activity-type block how
long the item should be processed, or for determining where the item should be routed before or
after processing. The following sections describe how to create, use, and manage attributes.
Flow attributes provide a similar functionality for the flow in Rate library blocks in ExtendSim AT
and Suite. For more information, see Flow attributes on page 339.
Attribute names and values
Each item attribute is composed of a name and a numeric value:
Discrete Event
Generates one item per message. This is an advanced choice for special situations. It is most
often used when a custom-created block is connected to the start connector and you want an
item to be instantaneously generated for every message. With this choice, the schedule is
restricted to one row. Each time the start connector is activated, the row is executed.
120
An attributes name identifies some general characteristic of the item such as size, route,
CarType or tank capacity. Attribute names are limited to 15 characters.
An attributes value indicates one dimension of the named characteristic. For instance, an item s
size attribute could have a value of 8 or a value of 12, while an attribute named CarType
could have a value of 1 (for Ford), 2 (for Toyota), or 3 (for Volvo). An attribute value is
not just a number; it can also be the address of data in a database.
Attributes are meant to be unique; if you attempt to add a new attribute with exactly the same
name as an existing one, ExtendSim warns you that the name already exists. While attribute names
are not case sensitive (Type is equal to type), spaces are significant and should be avoided.
Discrete Event
Attribute names and values are stored in a pair of dynamic, global arrays, described in Attribute
arrays on page 125.
The Car Wash model for the tutorial on page 108 used string attributes. Models with string attributes use text to represent the corresponding attribute value. However, the underlying architecture
is that attribute values are still numbers. For more information, see Item attribute types.
Number of item attributes in a model
In a model, each item can contain up to 500 attributes that uniquely describe the item. Every
item contains the full set of attributes that have been defined in the model. The Executive blocks
Item Attributes tab displays all of the models attributes.
Each attribute contains a value that can represent either:
A number that can be used for routing, timing, and so forth.
The address of data in a database or global array. The data pointed to can contain a single number or an unlimited amount of additional data that describes the item, its route, its properties,
and so forth.
If you use attributes efficiently, there is almost no limit to what can be represented. If you do
approach the 500 attribute limit, consider using DB address attributes (discussed below) to reference information in the ExtendSim database.
Item attribute types
ExtendSim supports three types of attributes for items:
A value attribute holds a real number as its attribute value.
The value of a string attribute is still a number, but it is represented in the model by a string.
With string attributes you enter a descriptive text label (string) for each potential attribute value
in a lookup table in the Executive blocks Item Attributes tab. The string can then be used in the
model in place of the corresponding number. For example, a string attribute named CarType
might have three possible values: 1, 2, and 3. Once the lookup table for this attribute has been
properly configured, the blocks referencing the CarType attribute will display the strings Ford,
Toyota, or Volvo instead of the numbers 1, 2, and 3.
The value of a DB address attribute contains a single value that represents a location or address
in a database. This address is composed of four separate numbers, where each number is an
index for an ExtendSim database, table, field, and record. Taken together, the numbers target a
specific location in the database. (Incomplete DB addresses are allowed. For example, an item
may have a DB address attribute with only the database and table indexes defined.)
121
In addition to item attributes, the Rate library blocks of ExtendSim AT and Suite have two types
of flow attributes. These are discussed starting on page 339.
The value of a DB address attribute cannot be used directly. It must be decoded using a Get.
Resource Item
Sort and release items from queues based on attributes Queue (when it sorts by attribute value),
Queue Matching
Sort items based on attribute values and conditionally Queue Equation
release them based on an equation
Pull in items and batch them based on attribute values Batch (when Match items into a single
item is the selected behavior)
Use attribute values to specify a delay or processing
time
Define the value/string correspondence for item string Executive (Item Attributes tab in Declare
attributes
string attribute values mode)
Find which block uses an attribute
Discrete Event
To Do This:
122
Discrete Event
To create a new value item attribute, click the Property Name popup menu, choose New Value
Attribute, type the name of the new attribute in the dialog that appears, and click OK. For
example, a value attribute might be named size.
To define a new string item attribute, select New String Attribute from the popup menu in the
Property Name column, enter a name, and click OK. This automatically opens the Executive
blocks Item Attributes tab. The table in this tab is where the attribute values (and the corresponding strings) for string attributes are declared. An example of this is shown in Creating a
string attribute on page 108. An example of a string attribute could be CarType and the corresponding string/value combinations might be Ford/1, Toyota/2, and Volvo/3.
Creating a new DB address attribute requires an existing ExtendSim database. In the Set dialog,
select an ExtendSim database from the popup list that appears. To create the DB address attribute, click the popup menu in the Property Name column, choose New DB Address Attribute,
type the name of the new attribute in the dialog that appears, and click OK. For example, a DB
address attribute could be named ProcessTime.
With the three different types of attributes, the Set dialog could look like:
After attributes have been created, they must be attached to items in the model and they must have
unique values assigned to them.
Selecting attributes and attaching them to items
To allow an attribute to be used, define the attribute and assign a value to it. This is done using
one of the attribute-handling blocks, such as Set or Create.
123
The most common method for assigning attributes to an item is to select an attribute in the dialog
of a Set block, then pass the items through the block. The value of the attribute can be defined in
the Sets dialog or through its value input connectors.
Another commonly used block is the Create block when it is in Create items by schedule mode.
This is a convenient way to initialize new items with a set of attributes as they are introduced into
the model. In the Creates schedule table, you can select an attribute from a popup menu in one of
the columns, then enter a value for that attribute for each Create Time row in the table. An item
generated at the specified times will have the attribute name and value indicated in the table.
Other blocks, like the Resource Item block, can also be used to attach attributes to items.
The information that follows assumes that you are using the Set block to assign an attribute to an
item and that you have already created the attribute using a method described on page 122.
String attribute
To set a string item attribute, select an existing attribute
(listed below the New String Attribute divider) from the
popup menu in the Property Name column. Then click
the cell in the Value column to bring up a popup menu
containing all the string values that have been defined for
the attribute. In the example at right, the selected string
attribute is CarType and the Value popup menu contains the strings Ford, Toyota, and Volvo. If
Toyota is selected, the corresponding value that gets stored on the item for the CarType attribute
will be the number 2.
Connecting a Random Number block (Value library) that uses an Empirical table to a Set block
that accesses a string attribute will cause the strings for that attribute to appear as a popup list in
the empirical tables Value column. This is shown in Checking the attribute on page 109.
DB address attribute
Each Set block only points to one ExtendSim database, which becomes one element of the DB
address. To set a DB address attribute in a Set dialog:
Discrete Event
Value attribute
To set a value item attribute, select an attribute in the Property
Name columns popup menu. (Existing value attributes are listed
below the New Value Attribute divider.) Then enter a number in
the Value column. In the screenshot at right, the Size attribute
has been selected and 14 has been entered as the value.
124
You dont need to select every element for a DB address attribute. For example, you may only want
to specify the database, table and field indexes and ignore the record index.
Discrete Event
For a DB address attribute, the Value column displays the database address, as determined by the
indexes of the settings in the Table, Field, and Record columns. In the screenshot above, the Value
notation is 2:1:1:2, where 2 is the index of the Process database, 1 is the table index for Processing
Time, 1 is the field index for Times, and 2 is the index for the selected record, which has a value of
5.04.
Once the attribute has been set, the attribute information indicated in the Set blocks dialog will be
assigned to each item as it arrives to the block. Attribute values may also be defined dynamically
using the Set blocks value input connectors to override values set in the dialog.
Every model has an internal list of all the attribute names that have been created for use by items in
that model. However, not all items in the model will make use of every attribute name. For an item
to use an attribute name, the value of the attribute must be explicitly set using an attribute modifying block (such as a Set block).
Getting attribute values and reporting changes
In order to manipulate an item based on the attribute, usually to route it or process it, you need to
get the item's attribute value. The most common method for getting attributes is to select the attribute by name from the list in the attribute popup menu in an attribute-reading block, such as the
Activity or Get block.
Activity or Workstation blocks
In the dialog of an Activity or Workstation block, you can specify that an item's attribute value be
used as its processing time, as shown below.
Get block
When items pass through the Get block, it accesses information about the attributes that have
been specified in the table in its dialog. It then reports the information in the table and on its value
output connectors. What the Get block reports and where, depends on the type of attribute:
Value attributes. The value for the attribute is posted in the Value column of the attribute table
and on the value output connector that corresponds to the attribute.
String attributes. The string text is displayed in the Value column of the attribute table and the
number that corresponds to the string is posted on the appropriate value output connector.
125
Connecting a Lookup Table block (Value library) that is set to Lookup the: input value to a Get
block that accesses a string attribute will cause the strings for that attribute to appear as a popup
list in the Lookup Table blocks left most column.
DB Address attributes. You can get either an individual element of a database address or its
entire address. To do this, from the popup menu in the tables DB attrib reports column, select
which of the 5 components will be retrieved (db index, table index, field index, record index, or
db address). The first 4 choices provide individual elements of the address; the db address
choice provides the entire address. The information will be reported in the Value column and on
the value output connector for that attribute.
To access all five elements of a DB address attribute, add five rows to the table. Each row should
have the same DB address attribute listed in the Property Name column, but different selections
for the DB attrib reports column. This comes in handy when the Get block is working in conjunction with the Read or Write blocks (Value library). It allows the read or write location to vary
based on what information is traveling on the item.
Discrete Event
In addition to value outputs for reporting an attributes value, the Get block has a (delta) connector for reporting when an attributes value changes. The connector outputs a 1 when an
item's attribute value (for the first attribute specified in the dialog) differs from the previous item's
attribute value. Otherwise it outputs 0. This is useful for determining when there is a new type of
item or when an attribute value used for processing time has changed. For example, you can have
an attribute called Type with values that specify the type of item. When the value of Type
changes, indicating a new type of item, the connector outputs 1. This is shown in Adding setup
time on page 178.
126
As new attribute names are added to the model, new cells (array elements) are appended to the
Names array and new columns are appended to the Values arrays, up to a maximum of 500.
Discrete Event
As new items are created during the simulation run, new rows are added to the Values array. The
number of rows in the Values array is unlimited and will be the same as the number of items in the
model. As shown in the above picture, item A has an attribute named type that has an attribute
value of 2 and item B has an attribute named size with a value of 6.01.
Note that each attribute named in the model causes a cell to be reserved in the Values array for
every item. However, not every item uses every attribute. To allow an item to use an attribute, you
must assign a value to the attribute using one of the attribute-handling blocks (such as the Set
block). If there is no value assigned, the attribute is not used by that item. This is shown in the figure above, where item B has no assigned value for the attribute name color and item C does not
have a value for the attribute size.
Priority
Like attributes, a priority is a
type of item property that
can be assigned to an item.
Priorities signify the importance of items. Using the
_Item priority property, you
can assign priorities to items
and manipulate them based
on their priorities.
Priorities are particularly
useful when you want to
examine a population of
Setting an items priority
waiting items and determine their processing order.
For example, you might have
a step in a manufacturing
process where a worker examines the pending job orders and chooses the one that is the most
urgent.
Items can only have one priority. If you need multiple levels of priorities, use attribute values
instead.
127
When a new priority is added to an item that already has a priority, the new priority prevails.
When items are batched, the highest priority of the items prevails in the resulting batched item.
The lowest value (including negative values) represents the top priority.
Setting, getting, and using priorities
The following table lists some common priority-based modeling activities and the blocks that are
usually used to facilitate them. All blocks are from the Item library.
Use Block(s)
Resource Item
Queue Equation
Get, History
Allocate resource pool units to the highest ranked item Resource Pool
first
The Select Item Out block does not assign or use items priorities. Instead its output connectors
can be prioritized so that an item will be routed to the first available connector that has the highest
priority. As shown in Explicit ordering on page 159, the Select Item Out block prioritizes the
path an item will take rather than the item itself.
Priorities model
In the example, a Random Number block (Value library) outputs values to a Set block, as follows:
10% of the time it outputs a 1
40% it outputs a 2
For the remaining 50% it outputs a 3.
Priorities model
Discrete Event
To Do This:
128
The table in the dialog of the Set block indicates it will assign priorities to incoming items. Connecting from the Random Number blocks output to the Set blocks ItemPriority value input connector causes the priorities to be set according to the values from the Random Number block.
Since the lowest number is the highest priority, 10% of the time items will be assigned the highest
priority.
The Queue block is set to sort by priority. This means that the highest priority items held in the
block will be made available to the Activity block before other items. A History block, added to the
model by right-clicking on the Queues output connector, shows that only top priority items are
processed; the Activity cannot keep up with the demand.
The section Interrupting processing on page 183 shows how priority values are used to determine if one item should preempt another.
Discrete Event
For an item to be ranked by priority, there must be other items in the group at the same time. For
example, items will only be sorted by priority in a Queue block if they have to wait there with
other items.
Quantities
Quantity is another type of property that can be assigned to items. Each item can be a single entity
or a group of duplicates. As is true for priority, an item can only have one quantity assigned to it at
a time; the default quantity is 1. If the quantity property for an item is 1, it represents one item. If
the quantity is other than 1, it represents a group. Item quantities are typically set in the Create
and Set blocks.
An items quantity can be any number, including a negative number. An item with a quantity of 0
or less disappears when it reaches a queue.
For most purposes you would not want to change the quantity of an item from its default value of
1. However, to model a change of shift consisting of five workers going off duty at the same time,
to simulate the delivery of a box of 300 pieces of mail to a mail room, or for similar situations, set
the quantity of the item to be other than 1.
How blocks treat items with quantities other than 1
Items with quantities other then 1 are treated differently depending on the nature of the block processing them. They will travel together as a unit, being processed essentially as one item, until they
reach an Exit, a Queue, a Batch, or a Resource Item block, or are sent into a universal connector
(such as Change, Demand, Select, or Start.)
When an item with a quantity other then 1 reaches an Exit, Queue, Batch, or Resource Item
block, it is decomposed into separate identical items. For example, when it enters a Queue, an
item with a quantity of 10 will become 10 distinct items, each with a quantity of 1 and each
with the same properties (attributes, priority, and so on) of the original item. An item with a
quantity of 0 will disappear when it reaches a Queue.
When items with quantities other than 1 are sent into a universal connector (such as demand or
select), they are treated as one item, but the quantity of the item may be used by the block as
control information. See below for more information on how universal connectors deal with the
incoming items that have quantities other than 1.
All the other blocks deal with items that have quantities other than 1 as a single item, ignoring the
quantity associated with it.
129
The Activity block accepts an item with a quantity greater than 1 as a single item and process it as
one unit. To have the items be processed separately, precede the Activity block with a queue, since
queues decompose items with quantities greater than 1.
Setting an items quantity
A quantity can be assigned to an item in the Create, Set, or Equation(I) blocks.
Set block
In the table in the Set blocks dialog, select _Item quantity in the Property Name column and
enter the quantity in the Property Value column or input a value to the Blocks _Item Quantity
value input connector. Each item that passes through the Set block will be assigned that quantity.
Create block
The default setting in the Create block is that one item is input to the model at each arrival event;
this is the most common case when building models. How you specify that a multiple number of
items be released at each event depends on which behavior is selected for the Create block:
Create block is set to Create items by schedule. Enter values in the tables Item Quantity column for each Create Time field that has arrival times.
For example, assume you want to show that one item arrives randomly approximately every 4 minutes. To do this, use the same settings as in the Car Wash model from the discrete event tutorial: in
the Create block select the Exponential distribution and enter Mean: 4; in its Options tab leave
Item quantity (Q): 1. To show that 2 car/items arrive every 4 minutes, keep the settings at Exponential with a mean of 4, but enter Item quantity (Q): 2. The block will now output one item
with a quantity of 2 approximately every 4 minutes.
As discussed in How blocks treat items with quantities other than 1 on page 128, the blocks that
follow the Create block determine how an item with a quantity greater than 1 is treated. For
instance, if an item with a quantity of 2 goes directly into a Queue or Resource Item block, it will
be split into two items each with a quantity of 1. However, if the item goes directly into an Activity
block, it will be treated as a single item with a quantity of 2. In most cases, you will want to follow
the Create block with a Queue, which will decompose the item into two separate items.
In most cases, you probably will not want to generate more than one item at each event. For example, rather than inputting 2 items every 4 minutes as discussed above, you would probably want to
generate 1 item every 2 minutes. This is because, unless they are inside a container of some sort, it
is not common to see two items arrive at exactly the same time; items are more likely to arrive at
slightly different times.
Quantities model
For example, assume you will receive 500 items a week, but that almost all of them are received on
Wednesday. In this case, there are five arrival events (one event each on days 1 through 5), each
with an item quantity of either 50 or 300.
This Quantities model is similar to the Scheduled Intervals model from page 118, except each
item the Create block generates has a quantity greater than 1 and the Activity processes 5 items at
a time.
Discrete Event
Create block is set to Create items randomly. Change Item quantity (Q) in the Options to an
integer number other than 1. Or input a value to the Create blocks ItemQuantity (Q) value
input connector.
130
The dialog of the Create block is set to Create items by schedule. The arrival times (Create
Time) and the number of items arriving at the scheduled time (Item Quantity) are entered in the
table, which has been cloned onto the model worksheet.
The table indicates that on the third day (Wednesday) 300 items arrive but that 50 items arrive on
each of the other days.
Discrete Event
Quantities model
The Create block outputs an item with a quantity greater than 1 as if it were a group of items all
arriving at the same time. When the item goes to a Queue block, it becomes multiple copies of
itself. In this example, as each item is sent from the Create block to the Queue block, it will
become either 50 or 300 units, depending on its quantity.
Running the model shows that the Create block creates 5 items, but that 500 items have arrived to
the Queue.
Queueing
Storing items in buffers or waiting lines
132
Queueing
Blocks of interest
A queue provides a buffer or waiting line to store items awaiting further processing. Queues can
have simple behavior, such as holding items in first in. first out (FIFO) order, or more complex
behavior, such that items are held and released in groups based on their attributes. You can also set
an option in the Queue blocks dialog to specify how long an item will wait until it reneges, or prematurely leaves.
This chapter covers:
Queueing disciplines: LIFO, FIFO, Priority, Attribute, and User-Defined
Queue/server systems
Blocking, balking, and reneging
Sorting items using the Queue Equation block
Least dynamic slack, minimizing setup, and maximizing service levels
Using the Queue Matching block to match items into groups based on their attributes
Discrete Event
In this chapter the focus is on using a Queue block to represent a sorted queue. For information
about using the Queue block as a resource pool queue see Resource pool blocks on page 214.
Queueing disciplines
ExtendSim supports several scheduling algorithms, also known as queueing disciplines, through the
queue blocks.
Queueing
Queue/server systems
133
FIFO. When set to be a sorted queue, the Queue block can represent a first in, first out (FIFO)
queue, also known as a first come, first served queue. When set as a resource pool queue, the
Queue block represents a FIFO queue for resource pool units. The MM1 model on page 134
is an example of a FIFO queue and most of the models in the Discrete Event module use a
Queue block in FIFO mode. For more information about resource pools and how the Queue is
used as a resource pool queue, see Resource pool blocks on page 214.
LIFO. When set to be a sorted queue, the Queue block can represent a last in, first out queue.
As is true when the Queue is set to FIFO mode, the Queue block automatically takes care of
LIFO sorting.
Priority. As a sorted queue, the Queue block can read priorities and pass items with the highest
priority (lowest number) out first. For this to happen, the arriving items must have a priority.
Items that have not been assigned a priority in the model have a default priority with a Blank
value; they get relegated to the end of the waiting line. To see a Queue sorting items based on
priorities, see Priority queues on page 134 or Animating queue contents on page 145.
User-Defined. The Queue Equation block allows a user-defined equation to decide the sorting
order for items it holds. This can be used to specify any user-defined criteria for sorting, including Least Dynamic Slack, Minimize Setup, Maximize Service Level, and any other combination
of sorting rules. A discussion of these ranking rules and example models start on page 137.
It is important to remember that, except for a FIFO queue, there must be other items in a queue at
the same time to allow the queueing disciplines to work appropriately and affect the order of the
items. For example, if you set a Queue block to sort by priority, and there is never more than one
item in the block at a time, the effect of queueing based on priority is negated.
Queue/server systems
Queue/server systems involve the creation of items which then wait in a queue until they can be
processed by one or more servers. The following blocks in the Item library are used to represent
queue/server systems:
The Create block is used to provide items at exponential interarrival times (and many other
interarrival times as well).
A Queue block, set to sort in FIFO, LIFO, or some other order, holds the items and releases
them in the designated order. It can have a maximum queue length specified in its dialog.
The Activity block represents servers: you can specify an exponential or other distributional service time within its dialog or by connecting a Random Number block (Value library) to its D
(delay) connector.
Discrete Event
Attribute. As a sorted queue, the Queue block can use attribute values to sort items in the
queue. In addition, the Queue Matching block allows you to define custom scheduling algorithms based on item attributes. It groups items based on certain attributes and releases them as
a group once requirements are met. For this sorting rule, items must have attributes assigned to
them before entering the Queue. Items that have not been assigned an attribute in the model
have a default attribute with a Blank value; they get routed to the end of the waiting line. The
process for having a Queue sort items based on attributes is similar to the process for sorting
using priorities.
134
Queueing
Queue/server systems
M/M/1 queues
A standard notation often seen in queueing theory is M/M/1. This is a basic construct, representing a single server queue. The notation translates to: exponential interarrival times/ exponential service times/ single server. It is also common to see the designation M/M/1/, where the translates to
unlimited queue length, or the designation
M/M/1: //FIFO, which translates to exponential interarrival times/ exponential service times/ single server: unlimited queue length/ infinite population/ first in, first out service.
Discrete Event
MM1 model
A typical M/M/1 system expressed using ExtendSim blocks, with the addition of a plotter and an
Exit block, would look like the screenshot below.
MM1 model
Priority queues
As is true when any other sorting rule is used, a Queue block that sorts by priority will hold items
until there is downstream capacity. Once the downstream block can accept an item, the Queue
searches through the contents of the queue and releases the item with the highest priority. For the
Queue to work properly in this mode, items that enter should already have their priority set; items
without a priority are assigned a default Blank priority and get sent to the end of the waiting line.
Priority model
In the Priority example, items enter the
model and immediately have their priority
set to 2. They then
enter a Queue block set
to Sort by: priority.
After the machining
processes, each item is
inspected for flaws. If
the item does not pass Priority model
inspection, its priority
is re-set to 1 and it is sent back to the Queue block where it waits to be re-machined. When the
machine can accept a new item, the Queue block will release the item with the highest priority. In
this case, any item waiting to be re-machined will be released first.
Run the model with animation turned on to watch the items with a priority of 1 (red circles)
bypass items with a priority of 2 (green circles) while waiting in the Queue.
Queueing
Queueing considerations
135
Queueing considerations
Once items are generated for the model, it is common that they will be held in a queue, typically a
Queue block. In addition to the queueing disciplines discussed above, queues and the items in
them can exhibit other behaviors.
Blocking
Blocking occurs when an item is prevented from leaving a block because there is a downstream
capacity constraint. Blocking is common in serial operations where there are several activities in a
row without queues in between; each activity has the potential for blocking arriving items. It also
occurs when activities are preceded by queues with finite capacity, causing backups in the preceding activity. Blocking increases the waiting time for items in queues and is added to the calculation
of their utilization.
The examples in the sections Processing in series on page 171, Sequential ordering on
page 158, and Machines that can only process certain types of items on page 166 illustrate
potential blocking situations.
Sometimes customers enter a facility, look at the long line, and immediately leave. This is an example of balking. In the Balking model. balking is easily represented by setting a maximum queue
length and then using a Select Item Out block to prioritize sending items to that queue. If the
queue is full, the Select will send the items to another part of the model; in this case, an Exit
block..
Balking can also be represented by having a Decision block (Value library) look at a queues length
or wait time. If the line meets certain conditions (is too long, takes too long to move, etc.), a Select
Item Out block routes the item out of the model before it enters the queue.
Reneging
Reneging occurs when an item, having entered a queue, leaves before it reaches the output. An
example of this is telephone callers who, after being put on hold, will hang up without getting help
if they feel they have waited too long for assistance.
To simulate reneging, select an option in a Queue blocks Options tab. The choices are:
Renege items after a specified number of time units. The number of time units can be set in the
blocks dialog or through its R (renege) connector.
Renege items immediately when the R (renege) connector gets a true value (0.5 or greater).
Discrete Event
Balking
136
Queueing
Queueing considerations
When either of these choices is checked, an alternate item output appears on the right of the
Queue block. Items that renege leave through that Renege output. They can be routed back to the
original line (as in the example below), routed elsewhere in the model, or they can exit the model.
Discrete Event
Reneging model
In the Reneging model, parts wait in the first buffering queue until they can be heated by a furnace, then wait for processing in a second buffer. If too much time passes before a part is processed
(such that it cools down), the part is sent back to the first buffer to wait for reheating.
Reneging model
The Options tab of the Queue that represents Buffer 2 specifies that a part will wait 5 minutes
before it must be returned for reheating. The relevant information has been cloned onto the model
worksheet. As seen in its Results tab, the Queue block automatically counts and reports how many
items have reneged.
Jockeying
Jockeying is when items move from one waiting line to another in an attempt to gain some advantage. To see a good example of jockeying, go to any supermarket and watch as people leave the end
of a slow moving cashiers line to try and get onto a faster line.
The reneging feature on the Options tab of a Queue block is useful for building a model of this
type of behavior. Normally, items renege if they have spent too much time in a queue. But the
Queue block has a connector that can force reneging of the last item in the line. The Jockey.mox
model is a good example of this.
Queueing
Sorting items using the Queue Equation block
137
Jockey model
In this model customers arrive from the Create block and are routed through the Select Item Out
block to the shortest of three possible queues.
As customers wait in the queues it is possible for the lines to move at different speeds. The last customer in each queue has the option to move to another queue if a shorter line opens up.
At least one QEQ item rank output variable must be defined for this block to function properly.
Discrete Event
Jockey model
138
Queueing
Sorting items using the Queue Equation block
Once each item has been assigned a ranking, the items are released from the queue according to
the ranking rule selected in the Options tabs Release popup; the ranking rules are listed on
page 139. The block's internal data structure keeps track of the ranking assigned to each item.
Giving an item a Blank ranking makes it an ineligible candidate for leaving the queue for that particular query cycle
Variables
The Queue Equation block has several types of input and output variables. The tables below
(input variables and output variables) describe the common set of variables shared by all equationbased blocks. The following variables are unique to the Queue Equation block.
To modify the number of rows used in the variable tables:
Discrete Event
Change the number of rows in the table by clicking the green +/- resize button in the tables bottom right corner and entering the number of rows desired.
Delete rows by first selecting the rows you wish to delete, clicking the green +/- resize button,
and then selecting the option to "delete selected rows."
Duplicate any rows by first selecting the row you wish to duplicate, clicking the green +/- resize
button, and then selecting the option to "copy selected row."
Input variables
.
Input Variable
Uses
The best (highest or lowest) item rank result for the current calculation cycle
Provides the chosen attribute value of the last item to exit the
block
AR requirement is avail
The AR variables are only shown in the Queue Equation block if Enable Advanced Resources (AR)
is checked in the blocks Options tab and the model contains a Resource Manager block (Item
library of ExtendSim AT and ExtendSim Suite).
Queueing
Sorting items using the Queue Equation block
139
Output variables
Output Variable
Uses
If set to True, this variable will prematurely halt the current calculation cycle.
AR allocate requirement
If set to True, the current items advanced resource (AR) requirement will be allocated to it. See note above.
As mentioned earlier, while you can specify other equation results, one of the output variables has
to be of the type QEQ item rank. Furthermore:
Only the results for the item ranked best will be output.
These variables are only available for the item that is currently being released.
Ranking rules
The Release popup on the Options tab provides the following selections to determine which item
should be released first:
Highest ranked item. Each items rank value is calculated by the equation and the item with the
highest ranking is allowed to exit.
Lowest ranked item. Each items rank value is calculated by the equation and the item with the
lowest ranking is allowed to exit.
The first True ranked item. The equation will be calculated once for each item until either an
item receives a True ranking or there are no items left to evaluate.
All True ranked items. All items receiving a True ranking are moved to an internal departures
list where they are immediately and permanently available to be moved downstream.
The results are saved for each item in the departures list. These results are used (or broadcast) at the time the item exits the queue.
Items in the departures list are no longer evaluated by the equation. This can reduce the
number of times an item is evaluated, reducing run times.
Items are released in FIFO order.
Discrete Event
You can use more than one QEQ item rank variable; the secondary ranking variable will be used
to arbitrate in the case of tied ranking.
140
Queueing
Sorting items using the Queue Equation block
Discrete Event
The two models are identical, except the top model uses Queue Equation blocks with least
dynamic slack calculations and the bottom model uses Queue blocks and typical FIFO ordering.
In the model, the equations in the Queue Equation blocks calculate the dynamic slack for each
item. The item with the smallest dynamic slack (least amount of time before being late) will be
selected first. As seen on the plot which has been cloned onto the model worksheet, on-time performance is higher using least dynamic slack (top line) compared to FIFO (bottom line).
Minimizing setup
In some systems, setup time (the changeover from one product to another) can add significant
delay to the processing of items. If this is the case, it may be useful to process the same item type
until there is no longer any of that item type in the queue. Only when a particular type of item has
been exhausted will another type of item be processed. Giving priority ranking in a queue to the
same type of product that has just exited the queue reduces the number of setups or changeovers
between products. Like least dynamic slack, minimizing setup time is another type of queue ranking rule.
Minimize Setup model
The model Minimize Setup compares the Product attribute for each item in the Queue Equation
block to the Product attribute on the last item to leave the queue. The first item with its Product
attribute value equal to the item that has just exited is released first. If no item in the queue can be
found with an attribute value that matches the last exited item, the first item in the queue is
selected. The plot shows the effects of this rule: the queue builds up initially until it can combine
enough batches together to gain an efficiency from minimizing the setup time. (The example
Queueing
Sorting items using the Queue Equation block
141
includes a second model, with a FIFO queue instead of a Queue Equation block, for comparison
purposes.)
Discrete Event
142
Queueing
Matching items using the Queue Matching block
Discrete Event
is a dramatic improvement if the sorting rule is used. However, the second plotter makes it equally
as obvious that some customers have a much longer wait when the service level is maximized.
Combined rules
Because of its tie-breaking capabilities, the Queue Equation block can be used to model situations
where two items are considered equal using the primary sorting rule but a secondary rule is used to
determine the item with the higher priority.
Combined Rule model
The Combined Rule model uses the least dynamic slack as the primary rule. However, if the least
dynamic slack is within 2 time units, the rank (order of the items in the queue) is used.
Queueing
Advanced queue topics
143
This block is especially useful for making sure that items have a particular characteristic at a specific time. For instance, you would use this queue to reassemble parts in the correct order or to
insure that subassemblies are correctly matched with each other.
For more detail, please see the Queue Matching online help by clicking the Help button in the
lower left of the blocks dialog.
The Information block counts each electronic system as it arrives and outputs the total number
that have passed through the block. The Set block uses this value to set a Serial Number attribute
for each electronic system. After refurbishment, the system is reassembled using its original parts.
Discrete Event
144
Queueing
Advanced queue topics
Manipulating a queue
Discrete Event
Initializing a queue
Sometimes it is useful to introduce items into the model at the start of the simulation run. The
Options tab in a Queue Tools block (Utilities library) can be used to preload a queue with items at
start time. Situations where queues might be initialized with items include:
Reducing start-up bias. By placing items in queues at the start of a simulation, the model begins
in a state that is closer to steady-state.
Importing current system status in a scheduling model. When using simulation to model a
detailed schedule, it is necessary to start the simulated system with the same work-in-progress as
the real system.
To use this block, connect from the L (length) output on a queue to the value input connector on
a Queue Tools block. The blocks Options tab has three choices:
No queue initialization: Items are not added to the queue at the start of the simulation.
Initialize queue: The queue is initialized with the number of items entered in the number field
and property values as specified in the Properties table.
Initialize from global array: The number of items and property values are read in from a specified global array. Because global arrays can themselves be initialized from a number of sources
including Excel, a database, or the Internet, this is a very useful way to import the contents of a
queue from an external source.
Queueing
Animating queue contents
145
Encapsulate a Queue inside a hierarchical block (right-click the Queue block and select Make
Hierarchical.)
Open the hierarchical block's structure (right-click the hierarchical block and select Open
Structure) and add a number of identically sized animation objects from the icon tools in the
toolbar.
On the Item Animation tab of the Queue block, enter the first and last animation object numbers in the Animate H-block objects fields.
Discrete Event
In this model, ten items are added to the queue at time 0. As seen in the Properties table in the
Queue Toolss Options tab, these initial items have their item priority set to 1, their item quantity
set to 1, their Type attribute set to 1, and their Arrival attribute set to 0. The tab also indicates that
those items are represented by a cyan circle for animation. After the initial 10 items, items from the
four processes are animated as circles with the same color as the arrows.
146
Queueing
Animating queue contents
Discrete Event
Items with a lower number for their priority (a higher priority) will move to the front of the queue.
The animation shows this happening as new items with lower priorities will pass other items.
In this model, there are four rows and six animation objects per row on the icon of the hierarchical
block to the right of the arrows. The Item Animation tab of the Queue block inside that hierarchical block is set to Animate H-block objects: 1 to 24. This causes all 24 objects on the hierarchical
blocks icon to be animated, based on what is happening in the Queue.
For more detailed information about animating hierarchical blocks, see Animating a hierarchical
blocks icon on page 612.
Routing
Handling items from several sources;
sending items to multiple destinations
148
Routing
Commonly used blocks
When building models, you will frequently encounter situations where you want to manipulate
items coming from several sources or send items to several possible destinations. Depending on the
purpose, there are several methods for accomplishing this. This chapter will cover:
Items arriving from multiple sources
Merging items from several streams into one stream
Balancing waiting line lengths
Using the Throw Item and Catch Item blocks
Items going to several destinations
Simple routing to one of several streams
Scrap generation
Successive, explicit, and conditional ordering of routes
Discrete Event
Routing
Items from several sources
149
To merge streams of items from one hierarchical layer into one stream at a different hierarchical
layer, you can add connectors to the hierarchical block or use the Throw Item and Catch Item
blocks, at shown on page 152.
Discrete Event
To merge streams of items from several sources into one stream, where each item remains separate and retains its unique identity, use the Select Item In or Throw Item and Catch Item blocks.
You then typically direct the single stream into a queue. For example, you can use this to represent traffic merging into one lane or people accessing one hallway from several offices. A Select
Item In block is used to:
150
Routing
Items from several sources
Discrete Event
Item priority. Selects the input connector that has an available item with the highest priority
(the lowest numerical value for its priority.) For example, you could use this option to select
from a group of queues to a single activity. The queue with the item that has the highest priority
will be selected. This option always starts and restarts its selection search at the top input.
Random. The inputs are selected randomly based on probabilities entered in the blocks selection table. Enter probabilities in decimal format. For example, enter 0.75 for 75%. If the
entered numbers do not equal 1.00, the actual sum will appear in red in the bar below the Probability column. If Select from: all inputs is chosen, an input will be randomly selected whether
or not an item is available at that input. This situation can potentially cause starving, as discussed below. If Select from: only inputs with available items is chosen, the block will only
select from inputs with available items.
Select connector. The value received at the select connector determines which input is chosen.
The blocks dialog has an option for setting which value chooses the top input; the default is 0.
The lower connectors will be numbered sequentially after the top connector. That is, if the top
input is chosen by a select value of 1, the second input will be numbered 2, the next lower input
would be numbered 3, and so forth. In that case, a value of 3 at select would cause the item from
the third connector from the top to be selected. Note that, even if items are available at the other
inputs, the block will wait for an item at input 3, potentially causing starving as discussed below.
See Item library blocks on page 299 for some precautions when using this option with a Get
block.
Sequential. Selects the inputs in strict sequential order starting at the top; this is also known as a
round robin selection. This option could cause starving (discussed below), since the block will
wait for an item to become available at each selected input.
Merge. Items are taken as they become available through any input. Generally, this option is
used to combine the flows of items where there is no blocking of items arriving at the Select
Item In block. Inputs are selected in a round robin fashion starting from the top; once a selection has been made the selection search will resume at the next lower input.
Residence blocks such as the Activity have variable item input connectors. This works the same as
using the Select Item In block in Merge mode to merge multiple item streams.
Starving conditions
If an item is not available from the selected input of a Select Item In block, the following options
will cause a starving condition:
Random (if Select from: all inputs is chosen)
Select
Sequential
Routing
Items from several sources
151
An alternative is to use the variable item input connectors on an Activity or other residence block.
Merging Inputs model
In the Merging Inputs example model, the Select Item In block will accept items from any of the
three inputs. Its dialog is set to Select input based on: merge. If the Select Item Ins output is
blocked, the block will force items to wait in the Queues (labeled Buffers 1-3). When the Select
Item In becomes unblocked, it will check each input in turn to try to pull an item through for processing by the Activity. As you can see in the table that has been cloned from the Select Item In
block, when it is ready to process items, the Activity gets whichever item is available. This can
cause some queues to have longer waiting lines than others, as you can tell from their Results tabs.
Discrete Event
152
Routing
Items from several sources
Discrete Event
On the Max & Min block, the con output connector tells which of the inputs has the largest value,
in this case it indicates the longest queue. This tells the Select Item In block which queue to
retrieve the next item from. In the dialog of the Select Item In block, Select input based on: select
connector and Top input is chosen by Select value: 1 have been selected. As you can see from the
cloned Throughput table, items are drawn in a balanced manner from each line, and the queue
lengths are almost equal, as opposed to what happened in the Merging Inputs model, earlier.
Throw Item and Catch Item blocks for merging item streams
The previous examples discussed routing items using connections to blocks that are nearby and at
the same level of hierarchy. Sometimes, especially in large models, it is necessary to send an item to
a different hierarchical layer. The Throw Item and Catch Item blocks are especially useful when
there are items from various locations in a model (even from various hierarchical levels) that need
to be sent to one place. Note that these blocks are used as an adjunct to routing, not a replacement
for the methods described previously.
Throw Item and Catch Item blocks pass items without connections and can even be used deep
within nested hierarchical blocks to send items to other hierarchical blocks. For that reason, they
are sometimes used instead of the Select Item In and Select Item Out blocks.
Throw and Catch blocks should only be used when named connections will not be sufficient. For
instance, to pass items through different levels of hierarchy or to use the routing features on the
Throw and Catch blocks.
Throw & Catch model
The Throw Item and Catch Item blocks can also be used to merge several item flows into one
stream. In the following example, three Throw Item blocks route items to Shipping, which is a
Routing
Items going to several paths
153
hierarchical block containing two blocks, a Catch Item and an Exit. The Catch Item block is
labeled To Shipping and is designated as belonging to Catch group 1.
You must enter text in the label field at the lower left corner of each Catch Item blocks dialog.
Only labeled Catch Item blocks will appear in a Throw Item blocks popup menu.
Catch Item groups
If you are working with a large number
of Catch Item blocks, you may want to
organize them into groups. To do this,
Catch Item group popup menu
select or create a group name using the
Catch Item group popup menu in the
Catch Item block, shown at right. Then use the Catch Item group popup menu in a Throw Item
block to select the desired group. Once a group is selected in the Throw Item block, the blocks
Specify Catch Item by: Label popup menu will only contain the labels for the Catch Item blocks
in the selected group.
Discrete Event
154
Routing
Items going to several paths
Machine 3). Different methods of routing items to parallel processes are described in detail
throughout this chapter. See also Processing in parallel on page 172.
For situations where one item is unbatched or separated into its component items, use the
Unbatch blocks. For example, you might receive a shipment of furniture consisting of 8 desks,
20 chairs, and 7 typewriter returns, or a mail cart with 1000 pieces of mail. You use an Unbatch
block to disassemble that item into its individual components, then route the items to appropriate destinations, as described in Unbatching on page 207.
Discrete Event
To select the path an item should go on, use the Select Item Out or Throw Item blocks. The
Select Item Out block is useful for routing a stream of items to several paths based on some decision. For instance, you can send all the parts that need rework to a rework station, and ship the
remaining parts. Or direct patients requiring immunizations to the Injection Clinic. The use of
these blocks is described in Sequential ordering on page 158, Explicit ordering on page 159,
Routing decisions based on Item properties on page 160, and Select Item Out dialog below.
Note that this is different from assigning a priority to an item and selecting the output based on the
items priority, as can be done with the blocks Property option. With the Connector priority
option, the Select Item Out block essentially prioritizes the output path, not the item.
Random. Outputs are selected randomly based on settings in the blocks probability table. Enter
probabilities in decimal format. For example, enter 0.75 for 75%. If the entered numbers do not
equal 1.00, the actual sum will appear in red in the bar below the Probability column. When the
option If output is blocked: item will try unblocked outputs is chosen, the block will randomly
try to find an output that can accept the item. When If output is blocked: item will wait for
blocked output is used, the block will select an output and the item will wait until that output is
able to accept the item; this can cause blocking.
Select connector. The value received at the select connector determines which output is chosen.
The blocks dialog has an option for setting which value chooses the top output; the default is 0.
Routing
Items going to several paths
155
The lower connectors will be numbered sequentially after the top connector. That is, if the top
output is chosen by a select value of 1, the second output will be numbered 2, the next lower
one would be numbered 3, and so forth. In that case, a value of 3 at select would cause the item
to go to the third connector from the top. Since the block will hold the item until there is capacity downstream from connector 3, this option can cause blocking.
See Item library blocks on page 299 for some precautions when using this option with a Get
block.
Sequential. Outputs are selected one after the other in sequential order starting from the top;
this is also known as a round robin selection. When the option If output is blocked: item will
try unblocked outputs is chosen, the block will try the next connectors sequentially. When If
output is blocked: item will wait for blocked output is used, the block will select an output and
the item will wait until that output is able to accept the item; this can cause blocking.
The Select Item Out block expects integer values for comparison and will truncate non-integer values. For example, if select connector is chosen as the selection condition, the numbers 0.001 and
0.999 received at the SelectIn input would both be truncated to a 0.
Property
Random (when If output is blocked: item will wait for unblocked output is chosen)
Select
Sequential (when If output is blocked: item will wait for unblocked output is chosen)
For the random and sequential selection conditions, the ability to choose what happens if the output is blocked is useful for certain modeling problems. For instance, in the Simple Routing model
shown below, if the top Queue block is designated to get the item, but it is blocked, the Select Item
Out block will route the item to an unblocked Queue.
Predicting the path of the item before it enters the block
As mentioned above, an item can be pulled into a Select Item Out block but not be able to proceed
because the downstream path is blocked. An alternative to this situation is to cause the item to wait
in an upstream queue, rather than in the Select Item Out block. This is accomplished by checking
Predict the path of the item before it enters this block. When this is enabled, the Select Item Out
block will query upstream to determine the properties of the next item to arrive. It then checks to
see if the appropriate downstream path is clear. Only if the item can be sent out the desired output
will the item be pulled in. This guarantees that the item will not get stuck in the Select Item Out
block.
This setting requires that any properties used to make the selection have to be set before the item
begins to move into the Select Item Out block. For example, a Queue is necessary between a Set
block and a Select Item Out block.
Discrete Event
Blocking conditions
The Select Item Out block is a decision-type of block; its default is to pull in the item and then
determine the path that the item will take. In some situations, the selected output path may be
blocked and the selected item will have to wait to leave. Some selection conditions can cause the
items behind a selected item to be blocked:
156
Routing
Items going to several paths
Implicit routing
The simplest, but not necessarily the best, way to route items is by creating connections between
the output of the collection point and the inputs of each activity-type block. This causes ExtendSim to pass items to the first available activity.
Discrete Event
However, if more than one activity-type block is free when an item is ready, it is not obvious which
block will get the item. For instance, a Queue that holds items for three Activity blocks would look
like the model below.
If two or more machines are free when an item comes out of the queue, the machine that was first
connected will get the item. With these types of simple parallel connections, even just disconnecting and then reconnecting a connection line could change the order of activities getting items.
This implied routing may not be reflective of the actual system and is usually not want you would
want.
Unless it is completely unimportant in the model, you should always use the Select Item In and
Select Item Out blocks to explicitly state how items should be routed.Otherwise, the order in
which their connections were made will dictate the routing.
Simple routing
It is most common to route a random number of items to one section of the model, while the rest
are routed to another. An example of this is an intersection where a number of cars will turn to the
left, some will go straight, and some will turn right.
Simple Routing model
In this model, items are routed randomly to one of three machines, as indicated by the setting
Select output based on: random. The probability table in the dialog of the Select Item Out block
Routing
Items going to several paths
157
indicates that 0.50 (50%) of the items will go to the top Queue while the remainder will be distributed equally between the remaining two Queues.
The previous model routed items based on probabilities. To distribute an input item to any available output, in the Select Item Out dialog choose Select output based on: sequential and If
output is blocked: item will try unblocked outputs.
As seen in the model, even though 50% of the items should be going to the top machine, item distribution is almost even. Because all the machines process items for the same amount of time, the
top machine is often busy and, rather than cause the system to be blocked, its intended item is
routed to a different machine.
Discrete Event
Notice that there are queues in front of the machines. If you omitted the queues, there is a possibility that items arriving from the Create block could be blocked. For example, if the second item
were destined for the top machine, but that machine was still processing the first item, the other
machines would have to wait for items until the top machine finished processing and pulled in its
item.
158
Routing
Items going to several paths
Scrap generation
An important aspect of some systems is modeling the generation of scrap or simulating a yield rate.
For instance, many manufacturing processes create an expected but irregular quantity of waste or
bad items. This can be accomplished in ExtendSim by randomly routing some items out of the
normal processing stream.
Discrete Event
As an alternative, you can also set and check attributes to represent items that need to be scrapped.
This will be shown later in this chapter.
Sequential ordering
To hand items to operations in successive order regardless of whether another operation is free, use
the Select Item Out block set to Select output based on: sequential.
Routing
Items going to several paths
159
To distribute an input item to any available output, choose Select output based on: sequential
and set the block to If output is blocked: item will try unblocked outputs.
Explicit ordering
If there are several operations, and you prefer certain ones to be active more than others, you can
explicitly state which operations have a higher priority for items. This is common when you want
to avoid using an operation because it is not as efficient (such as an older piece of equipment) or
because it is an uneconomical use of a resource (having a supervisor wait on customers.)
Choosing the selection condition connector priority in its dialog allows the Select Item Out block
to be used to specify the priority of each output.
Note that this is different from assigning a priority to an item, since the Select Item Out block
essentially prioritizes the output path, not the item.
Discrete Event
The first two activities are set to process for 1 time unit while the third activity takes only 0.5 time
units. For this model, even if the third activity is the first one ready to accept an item, it will only
get an item after the first and second activities have pulled in an item. Also note that an item is
only pulled from the Queue block when an activity has finished processing, potentially causing
blocking in the system. The example Balancing multiple output lines on page 163 shows a solution for this.
160
Routing
Items going to several paths
Discrete Event
The dialog of the Select Item Out block is set to Select output based on: connector priority. In the
table, the highest priorities (which are the lowest numbers) are assigned to the top and bottom outputs, and the next lowest priority is assigned to the middle output. In this case, Activity 1 has first
priority on items. If Activity 1 is busy, Activity 3 will get the item. Only if Activity 1 and 3 are busy
will Activity 2 get the item.
As seen in this model, multiple outputs can have the same priority. However, the item will go to
the topmost output that has the highest priority and is free. If that output is not free, the next
lower output with the same priority will be checked to see if it is free, and so forth. If this is not
what you want, set the priority values explicitly. For instance, you could set the output priorities to
1, 2, and 3 rather than to 1, 2, and 1 as was done in the example model.
Routing
Items going to several paths
161
This method is especially useful if the checking process takes more than one step. For instance, you
may need to transport the item to the checking station using transportation blocks, but only if
checking is needed. All those steps would be between the Select Item Out block and the Select
Item In block.
With this model, an item that needs to be checked can be pulled into the Select Item Out block
but not be able to advance because there is already an item in the Activity. To prevent this, you can
cause the block to predict the path of an item before it enters, as discussed page 155.
An item that requires checking that is blocked in the Select Item Out block will also block other
items that arrive after it, even if they do not need to be checked. If this is not how your process
works, insert a Queue before the Activity to hold items that need checking.
The example Machines that can only process certain types of items on page 166 is another
instance of using attributes to route items. For a very different approach, the DB Job Shop model
located in the folder Examples\Discrete Event\Routing uses information from the ExtendSim
database to route items.
Throw and Catch Attributes model
As described in Throw Item and Catch Item blocks for merging item streams on page 152, the
Throw Item block can be used to route items to a specific Catch Item block that is identified by its
label. Throw Item blocks can also be used to route items to different Catch Item blocks depending
on the value of an items attribute or priority. A modification of the Attributes for Routing exam-
Discrete Event
The Empirical distribution in the Random Number block specifies that 75% of the items do not
require checking (0 value for the CheckItem attribute) and 25% do (1 for attribute value). The
Select Item Out block, set to Select output based on: property, reads the attribute value to determine which of two routes the item will take, one through the checking line (value = 1) and the
other around it (value = 0). The Select Item In block is used to combine both lines into one
stream, exiting the simulation.
162
Routing
Items going to several paths
ple, built using Throw Item and Catch Item blocks rather than the Select Item Out block, is
shown below.
Discrete Event
In this example, The Throw Item block is set to Specify Catch block by: Property: Machine Type,
where Machine Type is a value attribute. The Throw Item block reads the Machine Type attribute
and routes the items to the appropriate Catch Item block according to the table in the throwing
blocks dialog, which is cloned onto the model worksheet.
To cause an attribute or priority value to be associated with a specific Catch Item block, type the
value into the Property Value column and select the appropriate Catch Item block using the
popup menu in the [Catch Block] column.
State Action model
Another routing example is the State Action model where items are routed to operations depending on their state. For complete information, see State/Action models on page 49.
Conditional routing
Sometimes you will want to route items based on the current conditions of the model. For example, monitoring queue lengths to determine whether or not an activity will be brought on-line or
balancing the use of parallel waiting lines.
Bringing a system on-line
Most of the examples in this manual show items being passed to operations where all the operations are on-line and running. In many situations, particular operations are only started when they
are needed. You can bring another system on-line based on the time of day (such as in Scheduling
activities on page 179) or based on some other factor such as the backlog of work.
Routing
Items going to several paths
163
You can also model this situation in the opposite manner, by having all the operation blocks process items and then shut one or more of them down under certain conditions. If you do this, items
may be trapped in the shutdown operation until processing resumes.
When you bring a system on line, it may cycle on and off too frequently. See Bringing an activity
on-line on page 179 for some methods for avoiding this.
Balancing multiple output lines
Operations are often preceded by queues before each operation, such as a staging area for each
machine (as compared to the single staging area for all machines as in the Explicit Ordering
model on page 160.) The location and ordering of placement of queues in a model can affect how
the model performs.
Discrete Event
In the model, the dialog of the Decision block specifies that the Y connector outputs a true value
(1) when the value at the A input is greater than 5. This activates the Gate blocks demand connector so that it lets items through to the third machine (until then, it will not accept items). When
the Queue holds 5 or fewer items, the Gate closes.
164
Routing
Items going to several paths
Discrete Event
In the model, the queues have a maximum queue length of 30 each. The first queue that was connected will receive all the items until that queue reaches its maximum, then the next queue will
start to fill (unless the first machine kept up with the flow of items, in which case the next queue
will never receive any items). In the Buffering Operations model, for example, most of the items
go to the top queue and get processed by Machine 1 and none of the items go to the bottom queue
to be processed by Machine 3. This is rarely what you want.
To even out the use of the machines, use a Select Item Out block set to select machines sequentially, as shown in the Sequential Ordering model on page 159, and place a queue before each
machine. Note however, that if the machines work at different speeds, this will cause the queue of
the slowest machine to fill more rapidly than the other queues.
A green bar across its top indicates that a Queue is set to something other than infinite capacity.
For instance, the Queues in this model are set to hold a maximum of 30 items and therefore have
green bars across their tops.
Output Line Balancing model
A better method than the Buffering Operations example would be to check the length of the waiting line in each queue and give the next item to the queue that is shortest, causing the queue lines
Routing
Items going to several paths
165
to be balanced. The Max & Min block (Value library) connected to a Select Item Out block is
excellent for this.
Compared to the Buffering Operations model shown earlier, in this model the number of items in
the queues tend to be more balanced. However, the system is not as efficient as it could be since an
item often goes to the queue for Machine 1 even though Machine 3 is idle. This happens because
if all the queue lengths are equal, the Max & Min block will report the first connector as having
the shortest queue length. In this case, Queue 1 has first priority for items and the Max & Min
block is just looking at the queue lengths and is not considering whether or not the Activity is
occupied.
Line Balance with Activities model
The previous model showed how to balance the queues. A more useful model would be to include
information about the items being processed when selecting the shortest queue. You can do this by
adding the value of an Activitys F (full) connector to the queue length. The full connector is 1
when the activity is at capacity and 0 otherwise. The resulting model, Line Balance with Activities,
Discrete Event
In the model, the Max & Min block tells the Select Item Out block which queue line is shortest
and thus which queue to hand the next item to. The Min & Max block is set to Output the: minimum value and Top input connector # is: 1. With these settings the blocks top input (L1) is
number 1 and the con output reports which of the inputs (L1, L2, or L3) has the lowest value,
indicating the shortest queue. The dialog of the Select Item Out block is set to Select output based
on: select connector and Top output is selected by select value: 1.
166
Routing
Items going to several paths
prevents items from going to a queue followed by an occupied activity when other activities are
idle.
Discrete Event
As in the previous model, the queue lines tend to be more balanced than the Buffering Operations
model; but this method makes more efficient use of the Machines.
Yet another option would be to use a Workstation block to replace the Queue and Activity blocks.
The Workstation can report all of the items in its internal queue and activity through its Length
connector.
Routing
Items going to several paths
167
only work on types 1 and 2, and the other machine can only work on type 3. The model is shown
below:
Named connections are used to simplify the look of this model. Without these, there would be a
spaghetti of connection lines connecting the Queue blocks to the Select Item In blocks. Another
option for organizing the model would be to use Throw Item and Catch Item blocks to route the
items to the appropriate machines.
Discrete Event
A Set block assigns a Type attribute to each item. The empirical table in the Random Number
block (Value library) indicates that there is a 50% probability that the item will be Type 2, and
25% probability that it will be either Type 1 or 3.
Discrete Event
168
Routing
Items going to several paths
Processing
Using activity-type blocks to cause and control processing
170
Processing
Commonly used blocks
This chapter will discuss different ways to use activity-type blocks and how to control processing
time and the availability of items and resources. It will cover:
Processing in series and in parallel
Setting the processing time
Bringing an activity on-line
Interrupting processes: preemption and shutdowns
Multitasking
Kanban systems
Material handling and transportation blocks
The models discussed in this chapter can be found in the folder Examples\ Discrete Event\Processing. That folder also contains some subfolders, as indicated in the relevant sections of this chapter.
Discrete Event
Processing
Processing in series
Process
Event
Item(s)
Activity
Decisions
Planning meetings
A prototype
Sales fulfillment
Telephone call
Claim
Emergency room
admitting
Accident
Assess incoming
patients (triage)
Regulating traffic
Cars, pedestrians
Computer network
Packet is transmitted
Packet of data
Communication
Material handling
Arrival of AGV
Parts, AGVs
Hiring employees
Report
Proposal
Approving a loan
Application
Customer submits
application
The following discussions most often refer to the Activity block for processing. However, the
Workstation block can often be used instead of a Queue and an Activity, and the Convey Item and
Transport blocks are also useful for simulating processing.
Processing in series
Serial processing occurs when items flow from one activity to another, where each activity performs one required task on the item, out of a series of required tasks. This is most common in
manufacturing activities, order entry, or service-intensive situations. A simple example of serial
Discrete Event
Manufacturing a product
171
172
Processing
Processing in parallel
processing is an assembly line, where several processes are performed on one part prior to shipment.
Discrete Event
Since there are many machines in series without buffering queues between them, it is possible that
items will be not be able to leave one machine because the next machine will still be busy; this is
known as blocking (as discussed in Blocking on page 135. Serial processes can cause the entire
operation to be slowed to the speed of the slowest activity. This will cause utilization to increase by
the amount of time that the item is blocked. If this doesnt accurately represent your process, put a
queue in front of each machine to represent a holding area, as shown in Select Item Out dialog
on page 154.
Processing in parallel
It is common in industrial and commercial systems for there to be multiple activities working in
parallel, each representing the same task being performed. For example, you might have five
machines that can each process parts arriving from the stockroom. Or three bank tellers who are
available to wait on customers. With the blocks in the Item library, there are many ways to route
items to parallel activities.
Remember that, unless items are purposefully duplicated in the model, they can only follow one
path at a time.
Processing
Setting the processing time
173
will get the item. For instance, a Queue that holds items for three Activity blocks would look like
the model below.
If two machines are free when an item comes out of the queue, the machine that was first con-
Unless it is completely unimportant in the model, you should always explicitly state the ordering
for parallel activities using the Select Item In and Select Item Out blocks. See Items going to several paths on page 153 for examples of how to control the flow of items to parallel processes.
The models discussed in this section can be found in the Examples\Discrete Event\Processing\Time folder.
Discrete Event
nected will get the item. With simple parallel connections, even just disconnecting and then reconnecting a connection could change the order of activities getting items.
174
Processing
Setting the processing time
From a lookup table. This choice allows you to use an attribute value to specify the parameters
of a random distribution. With this option, two popup menus and a table appear. The first
popup is for choosing a distribution; the second is for selecting an attribute. The table is where
the processing time for each type of item is characterized. with each row containing a different
set of arguments for the selected distribution. As each item enters the block, its attribute value
identifies which row in the table the item is associated with, and thus what its processing time is
based on. This option is illustrated in the Simulate Multitasking Activity model on page 191.
Discrete Event
Processing
Setting the processing time
175
Discrete Event
The Lookup Table block is set to Lookup the: time. Data that represents the workers day is
entered in the Hours column; the time to perform the task is entered in the Task Time column. As
indicated in the Lookup Tables dialog, a portion of which is cloned onto the model worksheet, the
time to perform the task changes at hour 6.
176
Processing
Setting the processing time
cessing time will then be normally distributed and the Activity block will process each item for
approximately 2 time units.
For more information, see Constant values and random variables on page 57, Random numbers on page 684, and Probability distributions on page 686.
Discrete Event
All items then go through the checking step, easily represented by an Activity block. In its dialog,
this block indicates that the Delay is: an items attribute value and the attribute is CheckTime.
Although items with a CheckTime value of 0 will not be processed by the Activity block, they may
be delayed in the Queue (which is set to FIFO order) while a preceding item undergoes checking.
Processing
Setting the processing time
177
If the Metric distance units preference is selected in the Edit > Options dialog, length units in
these blocks are set by default to meters. Otherwise, their length units are in feet.
You can do this using an activity block, building the model such that the attribute value is
decreased by the amount of processing time. In this situation, each activity subtracts its processing
time from the attribute value, so that the value represents the remaining processing time. Use a Get
block after each activity to determine if the item was fully processed or not, and therefore whether
it should proceed to the next activity or be routed out of the line.
Time sharing occurs when an activity processes an item, sends it back to a queue for a short period,
then processes it again until the required processing time is completed. This is common for computer networks and telephone communication systems. In these systems, time is specified in small
fractions of a second, there are a lot of jobs that must be processed at the same time, and there are
only a limited number of processors to do the work. In time sharing, instead of each job being processed sequentially, all jobs are processed at what appears to be the same time. However, each job is
processed a small bit at a time, and a given job may have periods in between where nothing is happening to it. Since the time units are so small, the periods when there is no processing of a specific
job are typically not noticed, and each job appears to be processed continuously.
Discrete Event
The prior section discussed setting an items attribute to the time required by a specific activity.
You can also set its attribute value to the total processing time required, then route the item to a
series of activities, each of which performs one part of the processing, until the attribute value is
reduced to zero and the item is fully processed. This is common when there are several stations
with different processing times, any of which can process the item. Or when there is one machine
that processes each item for a specified time, then passes the item to another section for further
processing, and the item must be returned to the original machine for finishing.
178
Processing
Setting the processing time
Discrete Event
In the model, items (jobs) are generated randomly and the Set block attaches a RemainingTime
attribute to each job generated. The Random Number block determines the initial value of that
attribute, 1, 2 or 3 milliseconds, which represents the total processing time required for each job.
The Activity block processes the job for a fixed time (1 millisecond). An Equation(I) block then
subtracts the amount of time spent processing (Process Time, or PT) from the RemainingTime
attribute.
Once the remaining processing time has been
calculated, the decision to route the item back to
the Queue or to the Exit is made in the Select
Item Out block. Jobs with a RemainingTime of Table in Select Item Out block
0 are routed through the top output and exit the
simulation; items that have 1 or more millisecond of processing time left are routed back to the Queue for further processing. Notice that the
table in the Select Item Out block (shown above) only indicates explicitly what happens if the
remaining time is 0 or 1. However, the blocks dialog is set to Invalid Select value: chooses bottom
output. With these settings, an item with a RemainingTime value of 0 will exit the top output. If
the value is 1 the item will exit the bottom output. And any value other than 0 or 1 will also exit
from the bottom output.
The time units for this model are integers representing milliseconds, because the Select blocks
expect integer values for comparison and will truncate non-integer values. (For example, the value
0.003 would be truncated to a zero.) When using non-integer values for the processing time, convert the attribute values to integers before they go to the Select Item Out block. You can do this
with a Lookup Table block (Value library).
Setup time can add significant delay to the processing of items. For an example showing how to
minimize setup time, see Minimizing setup on page 140.
Processing
Bringing an activity on-line
179
The delta) connector outputs 0 (for False) as long as the value of the Process attribute stays the
same and outputs 1 (for True) when the attribute value changes, indicating the arrival of a new
type of item. The Constant block (Value library) specifies a setup time of 3 minutes. As long as the
attribute value does not change, the Constant block is multiplied by 0, adding nothing to the normal processing time. When the attribute value changes, the Constant value is multiplied by 1, and
the 3 minute setup time is added to the value of the Process attribute to determine the processing
time for that new item. You can see this if you run the simulation the processing time is cloned
onto the worksheet and will be 1, 3, or 5 minutes for most items but 4, 6, or 8 minutes for the first
item that is of a new type.
Notice that each item still has its original attribute value. You do not change the attribute value in
this model, it is only used to determine whether the item type has changed and thus whether the
item requires a setup time. The processing time (whether equal to the attribute value or equal to
the attribute value plus the setup time) is input at the D connector. The Activity block processes
based on the value at the D connector, not directly based on the attribute value.
While the model above shows the mathematics explicitly, the Equation block (Value library) can
also be used to specify the setup time. This is illustrated in the model Setup Time 2.
The models discussed in this section can be found in the Examples\Discrete Event\Process-
ing\Bring On-Line folder. The Shift block is discussed starting on page 224 and models using the
Shift block are located in the folder Examples\Discrete Event\Resources.
Scheduling activities
Activities dont always occur randomly; they can be scheduled. This is common when you bring an
activity on-line based on the time of day. This could be represented by a schedule in the Create
Discrete Event
180
Processing
Bringing an activity on-line
(Item library) or Lookup Table (Value library) block connected to and controlling a Gate block
(Item library), by using a Create block to schedule the capacity of an Activity, or by using a Shift
block to control an Activity. As seen below, the Scheduling Activities 1 model uses a Gate block
and the Scheduling Activities 2 model schedules an Activitys capacity. Shift blocks are discussed in
The Shift block on page 224.
So that you can compare both the Scheduling Activities 1 and Scheduling Activities 2 models, they
have the same random seed, as seen in their Run > Simulation Setup > Random Number tabs.
Discrete Event
Customer arrivals
Opening the second dining section is accomplished by connecting a Create block to a Gate block,
allowing customers access only during certain hours.
The Gate block is set to set to Mode: conditional gating with values, so that it only allows items
through when its demand connector is activated by a value. This is accomplished by connecting a
value connector, such as the one on the Create block when it is in Create values by schedule mode,
to the demand connector. As long as the value connector is true (outputs 1), the Gate stays open;
when the value is 0, for false, it closes. Running the model with animation on shows that, even
though the queue length is increasing, the Gate shuts down after three hours.
Processing
Controlling the flow of items to an activity
181
You can view and report the item contents of Activity blocks at any time. Please see Item Contents
of queues and activities on page 698.
Discrete Event
Each dining section has the capacity to serve five customers at once. By doubling the capacity of
one Activity block during the period between 11 AM and 2 PM you can model both dining sections being open. This is accomplished by connecting the value output of a Create block, set to
Create values by schedule, to the C input on the Activity. In the model, the portion of the Create
block that controls the capacity of the Activity is cloned onto the model worksheet.
182
Processing
Controlling the flow of items to an activity
Discrete Event
Since the Create blocks start connector is connected, and since the block is in Create items by
schedule mode, the blocks schedule runs in relative simulation time (begins its schedule relative
to when start is activated), as explained in the section The Start connector on page 118. Once
start is activated (gets an value 0.5) it causes the entire schedule to happen; messages from the
Decision block to the start connector are ignored until the schedule is complete. The second line
of the schedule means that the Create block will also ignore any start messages for 5 time units
after the schedule has been completed. This provides hysteresis and allows the machine to process items (and hopefully reduce the buffer length) before the sequence is activated again. If the
schedule did not include this pause, the Activity block could be activated constantly.
The demand connector is activated when it gets an item, causing the Gate to open and allow
items through. The number of items allowed through before the Gate closes is determined by
Processing
Interrupting processing
183
the quantity of the item at demand. For instance, each item with a quantity of 10 creates a
demand for 10 items before the Gate will close.
Discrete Event
Interrupting processing
In discrete processes, it is common for interruptions to occur. This could happen for any number
of reasons, such as the arrival of an item that has a higher priority for processing, random machine
failures, planned shutdowns, the occurrence of a higher priority event, and so forth. Interruptions
are of two kinds, preemption and shutdown.
Preemption occurs when an Activity block is told to prematurely end one or more items processing. When this occurs, the Activity immediately sends the preempted items out of the block
through an alternate item output connector.
184
Processing
Interrupting processing
Shutdown occurs when processing is suspended for one or more items currently in an Activity
block. Items that have been shut down may or may not have their processing completed when
the shutdown ends. In any case, they are either discarded or leave through the normal item output connector.
The Activity block has a Preempt tab for specifying what to do when there is preemption and a
Shutdown tab for controlling what happens when the block gets a message to shutdown. The
Convey Item block can be shutdown by reducing its speed to zero. The Shutdown block is most
commonly used for shutting down an activity.
Preemption and shutdown are discussed in the following two sections. The models for those sections are located in Examples\Discrete Event\Processing\Preemption and Shutdown folder.
Preemption
Discrete Event
Preemption occurs when a signal is received at an Activity block's PE (preempt) input, prematurely
ending an item's processing by forcing it to leave through an alternate output.
In the Preempt tab you can specify that preemption occurs only if the block is already processing
its maximum number of items and that the preempted item's remaining processing time be stored
as an attribute for subsequent processing. Once preempted, the items processing can be finished
by another Activity, finished later by the original block, or never finished at all, depending on how
the item is routed in the model.
PE input connector
Once preemption is enabled in the Preempt tab, the PE (preempt) universal input connector and
an alternate item output connector appear on the Activitys icon. The connection to the PE connector can either be a value input or an item input, depending on what is selected in the Preempt
tab. The type of connection to the PE input determines how preemption is controlled:
Value connection. Based on which of the first four preemption options (discussed below) is chosen, the selected item or items will be preempted whenever a true (0.5 or greater) value is
received at the PE input.
Item connection. When a preemption item arrives at the PE connector, the Activity looks up
the specified attribute value on the preemption item. The Activity then searches all items currently in processing, and any of those items with an attribute value equal to the one on the preemption item will be required to leave the block. In addition, the Activity block has an option to
transfer attributes from the preemption item to the preempted items.
Preemption options
As discussed above, preemption occurs when a signal is received at an Activity blocks PE (preempt) input. Settings in the blocks Preempt tab determine which item or items must leave.
Depending on whether the preempt signal is sent by a value or an item connector, the preemption
options are:
The item that is closest to finishing
The item that is furthest from finishing
The item with the lowest priority
All items currently being processed
Only items with a particular attribute value
Processing
Interrupting processing
185
The first four options are only available when a value connection is made to PE; the last option is
only available, and is the only choice, if an item output is connected to PE.
Preempting model
For instance, an Activity and Queue (set to Sort by: priority) can be used in conjunction with a
Decision block (Value library) in such a way that lower priority items being processed may be preempted to make room for higher priority items as they arrive at the Queue. Note that it is not
guaranteed that a lower priority item will be preempted. If Preempt only if block is full is
checked, items will be preempted only if the Activity block is full.
In the Preempting model, the Queue reports the priority of the item that is about to leave and the
Activity reports its lowest priority item; this information is sent to the Decision block. If it is determined that there is a higher priority item in the Queue than is being processed by the Activity, a
True signal (a value greater than 0.5) is sent to the Activitys PE input. Notice that the Activitys
dialog is set to When signal is received at PE input, preempt... the item with the lowest priority
and to Preempt only if block is full.
Discrete Event
Preempting model
Unless they are preempted, items arriving to the Activity block are processed for the time indicated
in the blocks dialog. In blocks Preempt tab, Store remaining time in attribute: remainingTime
is selected. If an item is preempted, the Activity attaches the remaining processing time to the item
as an attribute named remainingTime. Since the Activity also has Use this attribute as delay
checked, when the preempted item returns to the Activity block it will process only for the time
indicated by the remainingTime attribute.
Shutting down
Employee breaks, equipment maintenance, inventory-taking closings, and tool failures all involve
interruptions in activities for a period of time called downtime. If interruptions are significant,
models should include provisions for shutting down activities to avoid overly optimistic predictions.
Shutdowns involve a temporary or permanent halting to the processing of items currently in the
Activity block. The blocks Shutdown tab has settings to determine which items should have their
processing shut down, how long to interrupt the processing, and what to do with the items in an
Activity when the shutdown occurs.
You can shut down activities at a scheduled time, such as for vacations or machine maintenance, or
it can be a random occurrence, such as for equipment failures or emergency leaves. Activities can
also be shut down based on some factor in the model, for instance when a downstream Queue is
full. Like shutdown occurrences, the duration of the downtime can be a constant value or a ran-
186
Processing
Interrupting processing
dom number. A shutdown can also be used to block the entry of additional items while the shutdown is in effect.
SD input connector
Once shutdown is enabled in the Shutdown tab, the SD universal input connector appears on the
Activitys icon. It is common to connect from a Create or Shutdown block to the SD input but
connections can be made from other blocks as well. The input to the SD connector can either be a
value connection or an item connection, depending on what is selected in the Shutdown tab. The
type of connection to the SD input determines both which items are shut down and for how long:
Discrete Event
Value connection. This acts like an on/off signal. The entire block will be shutdown whenever a
true (0.5 or greater) value is received at the SD input. This suspends the processing of all items
in the block and stops new items from entering it. The Activity will stay shut down until the SD
input gets a false (less than 0.5) value.
Item connection. When a shutdown item arrives at the SD connector, the Activity will shut
down the item or items currently being processed, as specified by the shutdown options discussed below. The duration of the shutdown is determined by an items attribute or quantity as
specified in the Shutdown tab; the value of that property on the shutdown item determines how
long the shutdown will be in effect.
The Create block is used to schedule the shutdown for the Scheduled Shutdown model on
page 187; the Shutdown block provides random shutdowns for random durations for the Random Shutdown model on page 189.
Shutdown options
As discussed above, shutdown occurs when a signal is received at an Activity blocks SD (shutdown) input. Settings in the blocks Shutdown tab determine which items currently in processing
will be shut down. Depending on whether the shutdown signal is sent by a value or an item connector, the shutdown options are:
All items currently in processing
A randomly chosen item
Items whose attribute matches the attribute at SD
Entire block
The first three choices are only available if an item connector is connected to SD; Entire block is
only available, and is the only option, if a value output is connected to SD. If Items whose attribute matches the attribute at SD is selected, the Activity looks up the specified attribute value on
the shutdown item. The Activity then searches all items currently in processing, and any of those
items with an attribute value equal to the one on the shutdown item will be shutdown.
Item options
Once a shutdown is in affect, the shutdown items are handled in one of four ways, as specified in
the Shutdown tab of the Activitys dialog:
The item can be discarded, such as when food is spoiled by the machine going down.
The Activity can resume processing the item after the shutdown ends.
An Activity can restart processing the item after the shutdown ends.
The Activity can finish processing the item prior to shutting down, such as when the shutdown
is part of scheduled maintenance and can wait until the item is finished.
Processing
Interrupting processing
187
Items that are not discarded leave through the Activitys normal item output.
SD output connector
The Activity blocks variable output connection contains an SD connector that can be used to relay
shutdown status. Depending on how the Activity has been configured, this connector either outputs a 1 (one) while the Activity is down and a 0 (zero) when it is up, or it outputs the number of
items that are currently shutdown. If a value connection has been made to the SD input, the SD
output connector is set to 1 or 0; if an item connection has been made to the SD input, the SD
output connector reports the number of items currently shutdown.
Scheduled Shutdown model
The Create block is often used to schedule an Activity to shut down. For example, the Scheduled
Shutdown model schedules downtime for a machine by connecting a Create blocks item output to
the SD input on an Activity.
Discrete Event
The Shutdown Schedule from the Create blocks Shutdown tab is cloned onto
the model worksheet and shown at right.
It indicates that two items will be created,
Schedule in Create block
one at time 2 and one at time 7. Each
item has a downTime attribute as seen at
the top of the fourth column; the attributes value is 2.5 for the first item and 1 for the second
item. In the Create blocks dialog, this maintenance schedule has been set to repeat every 10 time
units.
The Activity block is set to
process one item at a time. Its
Shutdown tab, shown at
right, indicates that all items
currently in processing will be
shutdown when a shutdown
item is received at SD,
downTime is the name of the
attribute that determines the
duration of the shutdown
event, and the block will keep
188
Processing
Interrupting processing
With this information and the settings in the Activitys Shutdown tab, processing will shut down
for any item that is already in the Activity at time 2 and that item will not resume processing until
time 4.5. Likewise, any item in the Activity at time 7 will be shut down and not resume processing
until time 8, and so forth.
When shutdown is triggered by an item connection to SD, the selected items being processed by
the Activity block will be shut down at the time and for the duration specified. However, because
the block supports parallel processing, if items arrive to the block after the shutdown has been triggered, those items will be processed normally. For complete shutdown of the block, use a value
connection instead of an item connection.
When the model is run, the plotter will show both the number of items processed (obtained from
the Exit block) and the timing and duration of the shutdowns (obtained from the SD output on
the Activity.) The SD output gives a value of 1 while an item is shutdown and a value of 0 while it
is not.
Discrete Event
For more detail, click the Help button in the lower left of the Shutdown blocks dialog.
Processing
Interrupting processing
189
Discrete Event
190
Processing
Multitasking
Discrete Event
For this model the Queues limit is specified in its dialog; whenever the Queue is full, the F connector outputs 1. The Activitys Shutdown tab indicates that the SD (shutdown) is: value input
connection and that therefore the Activity stays down until SD value < 0.5. This causes the
Activity to stay shut down for as long as the Queue is full.
This is an example of how to have downstream factors affect upstream activities. If you examine
the model closely, you see that the last machine is processing so slowly that Queue 3 quickly
reaches its limit of 5 items. Since a Queue cannot take in any more items while it is full, the middle
Activity is blocked (cannot process a new item until an item is removed from Queue 3). However,
the first Activity continues to process items, filling Queue 2. By explicitly shutting down the first
Activity, you affect where items are stockpiled and which Activities are shut down when one of
them is blocked.
Please also see The Shift block on page 224 for examples of activity and resource allocation that
are tied together and scheduled as Shifts.
Multitasking
The Activity block has a checkbox in its Process tab that
allows the block to simulate multitasking. Choosing
this option means that the blocks available time to process items (its Delay time) must be divided between
each of the items in the block. This causes each item to
take longer to finish processing and leave. Examples of
multitasking include computer processors or a person
who is working on multiple tasks at the same time.
With multitasking, if only one item is in the block the actual processing time will be exactly the
same as the original delay time specified by the block. If two items are in the block, each item will
take twice as long as the original specified processing time. If three items are in the block, their
processing times will be multiplied by three, and so forth. This is equivalent to situations where a
single server or operator has to divide their available time between multiple customers or tasks.
The changes to the processing time occur dynamically as items enter and leave the block. When
new items enter the Activity, the remaining delay times for all of the items in the block will become
progressively longer. As processed items leave the block, the delays for the remaining items will
become shorter.
Processing
Kanban system
191
Discrete Event
The Simulating Multitasking Activity creates a random number of each type of job (small medium
and large), as determined by probabilities entered in the Random Number block (Value library).
Each job has a Job Size attribute with the string value small, medium, or large. The jobs processing
time is defined by a distribution and entries in a table in the dialog of the Activity block, which is
set to Delay is: from a lookup table. (For a description of this setting, see Processing time for an
Activity on page 173.)
Running the model shows that the moving average processing time increases as the number of
items in the Activity increases.
Changing the capacity of the Activity changes the number of items allowed in the block, but it
does not change the calculation for the delay time. Thus, if Simulate multitasking activity is
enabled, increasing the capacity will not necessarily increase the throughput rate of the Activity
block.
Kanban system
A kanban just-in-time (JIT) inventory system limits the amount of inventory between processing
stations with a controlling kanban card. In this type of system, a station is only authorized for
processing if a kanban for that part is available. When processing is complete, the kanban moves
with the part to the next station. As the next station consumes parts, it returns the kanbans to the
previous station to authorize additional processing.
192
Processing
Transportation and material handling
Discrete Event
Kanban model
A Kanban system is modeled in ExtendSim by monitoring the queues between machines and having that information regulate processing. To do this, set the Queue block capacity to the number
of kanbans and connect the F (full) output from the block back to the preceding Activitys SD
(shutdown) output connector. When the queue has remaining capacity, its F connector will output
0 (zero) and the preceding Activity block will be authorized to produce parts. If the Queue block is
full, its F connector will output 1 and the preceding machine will be shut down until the queue
length is reduced.
Kanban model
If you run this model with animation on, the Activity blocks will be struck through in red while
they are shut down.
The models discussed in this section can be found in the Examples\Discrete Event\Processing\Material Handling and Transportation folder.
Travel time
In a discrete event model, items move from block to block as dictated by the connections. These
connections indicate the direction of movement, but they dont provide any delay for the items. If
travel time is significant, it is common to either:
Increase the delay time of destination blocks to compensate for the travel time.
Specify a minimum wait time in a Queue blocks Options tab to simulate travel time.
Set an explicit travel time in a Convey Item or Transport block, as shown below.
Processing
Transportation and material handling
193
Transport blocks
Transport blocks (Item library) move items from the
start of a path to the end based on distance and
speed information. When the model is animated,
these blocks can display multiple items travelling a
certain distance simultaneously. There is also an
option to specify that items cannot pass each other.
Speed and distance. How fast the item is traveling, and how far the item must travel to reach its
destination, are entered in the fields in the Behavior tab or received at input connectors. The calculated move time is displayed in the dialog. This option is most often used if the transportation
pathway is centered around the block.
Speed and calculated distance. The items speed is entered in the Item speed field or received at
an input connector. The distance is determined from information entered in the frame labeled
Select From and To locations for calculated distance, as discussed below. This travel time
option is most commonly used for 3D animation when you want the location of the transportation pathway to be independent from the block.
If Speed and calculated distance is selected, the starting and ending locations (which determine the distance) must be defined in the tab.
Calculated distance
If Speed and calculated
distance has been selected
as the travel time, a frame
appears at the bottom of
the dialog for entering the
distance information. If
the from and/or to locations are set to anything
other than Entered X and
Y location, the relative
positions of the blocks in Frame for entering information to be used to determine the distance
the model, and their connections, determine the distance.
The factors considered in the calculation are: the from location, the to location, how the distance is calculated, and the distance ratio.
Discrete Event
Move time. Each item will take the amount of simulation time that is entered in the Move time
field or received at the D input connector. This acts just like a delay in an Activity block; length
and speed are ignored.
194
Processing
Transportation and material handling
To location options
Next non-passing block (the default)
Entered X and Y location
Block location
Enclosing hierarchical block for next block
Discrete Event
Next block
Note: In the Item library non-passing blocks are either residence or decision types of blocks, as
described in Types of item handling blocks on page 98. If Entered X and Y location is
selected, the numbers can either be entered in the dialog or defined by the location of block in
the model; remember that the 3D coordinates are expressed in meters. The block location
option means the current block; this choice is especially helpful when the from location is a previous block (non-passing or not).
If the selected from and/or to locations are blocks, the distance starts at the from blocks output
connector and ends at the to blocks input connector.
Calculate distance options
The popup menu provides two methods for calculating the distance from the
start to the end of the path:
Along the connections between the from and the to locations
In a straight line between the from and the to locations
More options are available if the E3D window is open and you
have created custom paths for 3D animation. In this case, the
Button on Transport Animation tab
paths will appear at the bottom of the popup menu as shown.
The blocks Transport Animation tab has a button, shown at
right, that will calculate the length of the currently selected custom 3D path. It then puts that
length into the distance parameter field on the blocks Behavior tab.
Notice that the shape of the conveyor will not visually change with these choices, but the information is included in the calculation of the conveyors length. For instance, if there is a series of rightangle connections between the from and the to locations, the conveyors length will be longer than
if the straight line option had been selected.
Distance ratio option
This popup menu is for specifying the ratio between pixels in the 2D model and meters in the
E3D window. It will control how the distances defined in the Behavior tab affect 2D or 3D animation. The choices are:
Processing
Transportation and material handling
195
These options are explained more in the comprehensive example discussed in How the length is
calculated on page 196.
Discrete Event
196
Processing
Transportation and material handling
Discrete Event
By default, the length is calculated in a straight line between the from location and the to location. (The alternative is to calculate the distance along the connections.) The shape of the
blocks object will not visually change with either choice, but the choice affects the determination of the paths distance. For instance, if there were a series of right-angle connections between
the from and the to locations, and along connections was selected, the distance would be longer
than if the straight line option had been selected.
The Distance ratio (pixels per meter) is based on the 3D
distance ratio set in the command Run > Simulation
Setup > 3D Animation tab. The default is 20 pixels per
meter, as shown at right.
In addition, the blocks Block Animation tab is set by default
to stretch the object to the conveyors length. This will cause
the Conveyor object in the E3D window to automatically
resize to reflect the calculated length.
If the from and/or to locations are blocks, the determination of the length starts at one blocks
output connector and ends at the other blocks input connector.
Moving this Convey Item block along the connection line between the from and the to blocks will
not have any affect on the conveyor length. This is because the distance between the from and to
locations stays the same. However, moving the from block away from the Convey Item will change
the length of the conveyor. This is because the Next non-passing block is now further away from
the Previous non-passing block.
Processing
Transportation and material handling
197
For information about how these blocks are used for 3D animation, see Adding 3D behavior to an
existing model on page 464 and Animating a bank line on page 474.
Transportation models
The following models use Convey Item, Resource Item, and Transport blocks to simulate item
movement along fixed paths and material handling using AGVs.
Transportation 1 model
To model vehicles such as AGVs in ExtendSim, use a Resource Item block to provide items that
represent the vehicles, a Batch block to attach the vehicle with whatever it is transporting, one or
more Transport blocks to provide the transportation delay, and an Unbatch block to separate the
vehicle from its load at the end of the route.
Discrete Event
Transportation 1 model
The Transportation 1 model shows how two parts are assembled, inserted into a computer, then
moved to a loading dock. Part A is moved by a Convey Item block to the assembly machine while
Part B is moved there by a Transport block. The two parts are joined by a Batch block for processing. After assembly, they move by a Transport block to the machine that will put them into the
computer. Since the computer is heavy, it is moved to the final assembly machine by a Transport
block that represents a small crane.
To simulate movement, AGVs from a Resource Item block are batched to the parts/items and then
moved via the Transport block. If the AGV is released at the end of each route, as it is in the model
above, the part is left behind where it can then be processed before moving on to another section
of the model. To model a situation where the Resource Item transports the item to an activity, then
waits there to continue transporting the item again, dont release the Resource Item until the last
stop in the route.
Transportation 2 model
In the Transportation 1 model there is no time associated with the return of the AGVs to the Resource Item
block. To model how long the return path takes, insert
Transport blocks after the Unbatch blocks and enter a
distance and speed for the AGV return trip. This is
shown in the model segment shown at right.
Adding time for AGVs to return
Discrete Event
198
Processing
Transportation and material handling
200
In a discrete event model, items pass through the system and something is done to or with them.
The process often involves temporarily or permanently joining, or batching, resources or other
items with the original item. For instance, in a manufacturing plant, precursors of the final products come into the process as raw materials, subassemblies, and packaging that are joined in various combinations. During the manufacturing process they are often batched with other precursors
and require additional resources such as pallets and workers for processing. These batched items
move through the process together.
These same concepts apply to other discrete processes. For example, in an emergency room model,
doctors are temporarily batched with their patients during medical diagnosis. In the same model, a
technician, a diagnostic machine, and a patient would be batched for the duration of x-ray treatment. In a communication system, multiple packets might be batched together to create a single
message. For a retail store model, customers could be shown arriving and selecting merchandise,
then be temporarily batched with a sales person to make the purchase.
This chapter discusses:
Discrete Event
Blocks of interest
The following blocks will be the main focus of this chapter. The blocks library and category
appear in parentheses after the block name.
Batch (Item > Batching)
Joins multiple items into a single item for use in the model. This causes the original input
items to be destroyed and replaced by one output item. A batched item may be unbatched
at a later point in the model, but that is not required.
Unbatch (Item > Batching)
Outputs multiple items for each input item. Depending on selections in the dialog, this
block can separate items that were previously batched or make duplicates of items that were
never batched.
Batching
Batching allows multiple items from different sources to be joined as one new item for simulation
purposes (processing, routing, and so on). The Batch block accumulates items from each source up
to a specified count, then releases a single item that represents the batch. In this process, the original input items are destroyed and replaced by one new output item.
Items may have properties, such as attributes, before they are batched. To specify what will happen
to the properties of items that have been replaced by a new batch item, see Properties when items
are unbatched on page 210.
201
The number of items required for a batch is called the batch size. In some situations you know in
advance how many of each item is required to make one item; in other situations the number of
items batched depends on model factors and changes dynamically.
Items can be permanently batched together as one new item that flows through and exits the
model, or they can be temporarily joined for some specific purpose and unbatched at a later point
in the process. For example, two manuals could be batched with three promotional pieces and one
CD to make a software package that is shipped as one product. Or a ship attempting to dock
might be temporarily batched with two tugboats resources to guide it through the docking process,
after which the tugboats and the ship are sent on separate paths.
Batch dialog
Batch tab
The top of the Batch blocks Batch tab has a
popup menu with two options that determine
how the block behaves. These are summarized
below and illustrated in models later in this
chapter.
Batch items into a single item creates a batch
Batch tab in Batch block
using items on a first-in, first-used basis as
they arrive at the item input connectors. The
quantity of items required from each input is entered in a table or (if this choice is selected on
the Options tab) determined by the value at a BatchQuantityIn connector.
Match items into a single item creates a batch of items that have a common attribute value. For
instance this could represent a process where items were combined together based on a serial or
order number. For this choice, it doesnt matter which input connector the items arrive from.
The table in the Batch dialog is for entering the number of items from each input that are required
to make a batched item; the size of the batch can also be set using value input connectors as discussed later in this chapter. The first column shows the block label or name the input is connected
to. The Quantity column is for specifying the number of items required from the input and the
next column reports the number of items available. Checking the fourth column determines if
Delay Kit is activated; as discussed on Delaying kits on page 207, this causes the specified item
or items to not be pulled into the block until certain conditions are met.
Options tab
Among other choices, this tab has options for setting the size of a batch through value input connectors and determining when to start a batch.
BatchQuantityIn connectors
Checking Use quantity input connectors on the Batch blocks Options tab enables the
BatchQuantityIn variable connector. Each BatchQuantityIn value input connector corresponds to
an item input connector and controls the batch size for that item connector. If a value input con-
Discrete Event
202
nector has been connected, it will set the number of items required at its adjacent item input connector. If a value input connector is not connected, the number of items for the adjacent item
connector will be set by the value in the Batch dialog.
When Use quantity input connectors is checked, there are two options that affect the batch size.
With either option, the initial size of the batch is the value at the BatchQuantityIn connector
when the first item on its corresponding item input connector arrives to the Batch block. The
options determine what happens if the input value changes:
Dynamically as batch is created. If the value at a BatchQuantityIn connector changes before
that item connectors batch is released, the number of items required for that batch will change
as well. This enables the size of a batch to be changed dynamically.
The number of items to be batched from each input connector can never be less than the number
Discrete Event
of items that have already arrived to the block from that input. That is, if 10 items have already
been pulled in through an item input connector, and the BatchQuantityIn connector changes to 8,
the batch size for that item input connector will be set to 10, not 8.
By first item at each connector. The size of the batch does not change after the first item for
the batch has arrived, even if the value of the BatchQuantityIn connector changes. Once that
batch is released, a new batch size can be set.
Simple batching
The simplest batching method is to cause multiple items to be joined as one new item, replacing
the original items in the model. The batched item may or may not be unbatched at a later point,
depending on model requirements.
203
Discrete Event
attribute the items must match and a different attribute that determines the batch size. With this
option, each batch will be composed of items whose matching attribute value is the same; the
batch size attribute of the first item in the batch determines how many items are in the batch.
With this option, it does not matter which input connector the items arrive at. As items arrive to
the Batch block they are segregated based on their matching attribute value until the total number
of items in that group equals the batch size attribute. When this occurs a batch is created and the
item representing the batch leaves the block.
204
single item, Match on attribute: Serial Number, and Get batch size from attribute: Components.
Discrete Event
For a similar model that uses the Queue Matching block to match items based on an attribute
value, see Matching items using the Queue Matching block on page 142.
For additional examples of dynamically setting batch size, see also the Batch and Unbatch Variable
model on page 209 and the advanced batching models Equation(I) Controls Batch and Queue
Eqn Controls Batch that are located in the folder \Examples\Discrete Event\Batching.
The BatchQuantityIn connectors will not be visible on the Batch blocks icon unless Use quantity input connectors has been checked in the blocks Options tab.
205
The information about when items arrive and the size of the batch is recorded by the History
block and displayed in its cloned table.
By default the History block clears its information each time the model is saved. A choice on the
blocks dialog allows you to Save item history with model, but that option can cause the model
to become quite large.
Discrete Event
With these settings and connections, the Batch block will create a batch every 5 seconds, the size of
the batch is dependent on how many items are available to the Batch block when it creates the
batch, and items will be allowed into the block only when demand is triggered.
206
Property options
A table in the Batch blocks Properties tab allows
you to define what happens to item attributes
and priorities. The tables first column lists every
property for the items in the model. The second
column, Action, gives potential options that can
be taken for that propertys values. This allows
you to select how properties get transferred from
the original items to the batched item.
The Properties tab for the Batch block in the
Matching Items model looks like the screenshot
at right. It shows two user-defined attributes
(Components and Serial Number) and the item
properties _Animation and _Item Priority.
Discrete Event
207
Delaying kits
You might not want to begin forming a batch until some or all of the items required for each part
of the batch are available. This is most common when you do not want a resource item from the
Resource Item block to flow into the Batch block until all the items requiring that resource are
available. A good example is a manager who does not want to wait for everyone else to arrive at a
meeting.
The Batch blocks Delay Kit feature restricts specified items from entering the block until all of the
other input connectors have the items they need. Delay Kit is enabled through checkboxes in the
fourth column of the table in the Batch dialog. Each item input for which Delay Kit is checked
will have its items wait outside until all required items for the unselected inputs are in the block.
Delay Kit is only available when the Batch blocks behavior is set to Batch items into a single
item.
Unbatching
Unbatching can be used to separate items that
were previously batched or to duplicate items
that have not been batched. Some examples
of when you would use unbatching are:
Returning an item resource to the Resource
Item block
Ungrouping items that had been temporarily grouped so that they could be processed
at the same time
Creating items based on a single seed
item
Creating a logical item to trigger some
action in the model while allowing an item
that represents the physical part to continue processing
Unbatch dialog
If items were previously batched with Preserve uniqueness enabled in the Batch blocks Options tab, the Unbatch block can be used to
restore the items that formed the batch with their original properties. This is accomplished if Preserve uniqueness is also checked in the Unbatch blocks dialog. For information about this feature,
see Preserving the items used to create a batch on page 210.
Be careful when using any property-setting blocks in the path between a Batch and an Unbatch
block. Those property modifications could be lost, depending on selections in the Unbatch blocks
Properties tab, as discussed on page 210.
Discrete Event
208
The top section of the Unbatch tab in the Unbatch block has two options that determine how the
block behaves when costing is involved. Each option causes the block to output a number of items,
specified in the dialog, for each item that is input. The options are:
Create multiple items. This is the default choice. If the model has costing, costing attribute values are distributed to the output items as specified by settings in the table in the Unbatch blocks
Properties tab. The section Simple unbatching on page 208 shows how to use the block to
separate batched items.
Discrete Event
Release cost resources. Resources can have a cost associated with them. If an item is batched with
a resource, cost information is maintained with it. If the model has costing and the Release cost
resources option is selected, the block releases the resources out of the same connector that they
were originally batched and updates costing information for the items accordingly. For more
information, seeCombining resources with cost accumulators on page 278.
The Unbatch block will not behave differently when either of these two options are selected unless
the model calculates costs.
The Unbatch tab also has a table for specifying the number of items that will be sent through each
output connector. The first column displays which blocks the Batchs output connectors are connected to. The Quantity column is for entering the number of items that will be output for each
input item the Batch block gets, while the next column displays the number of items present.
When preserving items that have been batched or when releasing cost resources, it is important to
physically match where items enter a Batch block with where they leave an Unbatch block. For
instance, items that arrived to the Batch block on the top input should be released from the top
output of an Unbatch block.
Simple unbatching
The Batching and Unbatching model is an extension of the example Simple batching on
page 202, with the addition of laborers and unbatching. Since there is no costing in this model,
the Unbatch dialog is set to Create multiple items (the default option).
In this model, the packaging process must be performed by a laborer. There are 10 laborers available and each is represented by an item in the Resource Item block. Each worker item is temporarily batched with the bottles and cartons to represent the requirements of the packaging process.
209
Binding a worker
The previous model showed how to batch and unbatch a fixed number of items from each input.
This example shows how to batch a variable number of items and unbatch that same number of
items.
To keep track of the number of items a batch is composed of, select an attribute in the Batch
blocks Properties tab to store the number of items in the batch. When the batch is created this
attribute's value will be the number of items that arrived to create the batch.
As discussed later in this chapter, if both the Batch and Unbatch blocks are set to preserve the
uniqueness of items, batch size does not need to be saved in an attribute. Instead, just check Use
In this model, the Batch blocks Options tab indicates that the size of each batch is stored on an
attribute named batchsize, which is accessed by a Get block. Attaching the Get blocks value output to the Unbatch blocks UnbatchQuantityIn connector sends information about the size of the
batch to the Unbatch block, causing each batch to separate into its original number of items.
Since the Batch block is set to Set batch size by first item at each connector:, the size of the
batch is locked when the first item for that batch arrives in the Batch block.
Discrete Event
210
Discrete Event
For those properties that you want to retain, select the Preserved Value action in the Properties tab
of the Unbatch block, as discussed in Properties when items are unbatched on page 210.
Do not select Preserve uniqueness unless the items have unique information attached to them,
the items are not just temporarily batched, and you need to restore the items and their properties
at a later point. Preserving uniqueness requires a lot more memory and slows processing time.
211
If the Preserve uniqueness option is not checked, the items used to make up the batch are
destroyed when the batch is created. The batch, represented by a new item, is permanent and
the original items cannot be restored. Examples include batching items together into a box for
final shipping, or batching an order with the required inventory.
If a Batch block is set to preserve uniqueness, the unique identity of the items will only be restored
upon unbatching. While batched, the attributes of the unique items will be combined into one set
of attributes, as specified by settings in the Batch blocks Properties dialog.
If Preserve uniqueness is not selected in the Batch block but is selected in the Unbatch block, it
is the same as if preserve uniqueness is not checked at all. Because the original information about
the batched items was lost when they were batched, the Unbatch block will unbatch identical
copies of the items that arrive to it.
Neither of these conditions is typically desirable.
Additional models
The folder located at \Examples\Discrete Event\Batching contains additional batching models not
discussed in this chapter:
Equation(I) Controls Batch
Queue Eqn Controls Batch
Both models show advanced concepts for dynamically changing the size of batches.
Discrete Event
If Preserve uniqueness is selected in the Batch block but not in the Unbatch block, the behavior
of the Unbatch blockdepends on whether or not Duplicate preserved items is selected. If
Duplicate preserved items is not selected, the preserved items travel with the first item that
leaves the Unbatch blocks top output connector. All the other items leaving the Unbatch block
will be identical and not contain any information about the preserved items. If Duplicate preserved items is selected, each item leaving the Unbatch block will have a duplicate copy of the
preserved items. In this case, the Unbatch block copies the set of preserved items and attaches
them to each unbatched item.
Discrete Event
212
214
Items will sometimes require resources before they can proceed to the next step in a process. For
example, a car might need an attendant to drive it through the car wash, a vendors invoice could
require a receiving report before payment is made, or parts might need to be assembled by a
worker. Resources provide a service to the items in a model; their availability or lack thereof can
cause constraints on the flow of items.
One of the main reasons to model a process is to analyze resource availability and utilization and to
determine the impact of resource constraints on the systems capacity. This tells how efficiently
current resources are being used and what happens if they will not be available or when there is a
wait for them to become available. Often the objective is to try to improve resource utilization
without causing overly long waiting lines or to determine how to reduce waiting lines without adding more resources.
This chapter discusses:
Modeling resources with the Resource Pool block
Modeling resources using the Resource Item block
Discrete Event
Blocks of interest
The following blocks are the main focus of this chapter. Each blocks library and category appears
in parentheses after its name.
215
Discrete Event
Modeling resources
Resources are the means by which process activities and operations are performed. Different parts
of a model can share the same resource, just not at the same time. While a particular resource is
being used in one place in a model, it is not available for any other part of the model. Thus the
availability or lack of availability of resources causes constraints in a model.
216
Implicit methods
In addition to the explicit methods listed above, ExtendSim provides additional ways to model
resources, as discussed in the Other methods for modeling resources section of the User Guide.
Resource-type blocks should only be used in a model if their presence is required for the system.
Otherwise, use an implicit method.
Discrete Event
The resource pool blocks in the Item library (Resource Pool, Queue, and Resource Pool Release)
cause restraints to be placed on the flow of items in the model based on the availability or lack of
resources. The Resource Pool block maintains a count of the number of resources that are currently available for use. When an item enters a Queue block that is in resource pool queue mode,
the Queue will query the resource pools to determine if the required number of specified resources
are available. If so, the number of resources currently available will be decremented in the appropriate Resource Pool block, and the item that requires the resource will be released from the
Queue. If the required number of resources are not available, the item will wait in the Queue until
resources become available.
In a closed system, the resources are returned to the Resource Pool block by passing the
resourced item through a Resource Pool Release block. In an open system, such as for a consumed resource, the resource is not returned to the pool but is removed from the system when the
item exits. Closed and open systems are discussed on page 222.
Since resources are not returned to the originating block in an open system, statistical calculations
such as utilization cannot be accurately determined.
Advantages and disadvantages of using resource pools
Advantages
The Resource Pool block does not require any connections to other blocks in a model. Because
of this, using resource pools to model resources (as opposed to using the resource item/batching
method that will be described later) is more flexible when the same resource can be used in many
different places or when an item can use any one of a group of resources.
The resource pool method does not require complex routing of resource items because the
resources are not actual items but merely constraints on the flow of items through the model.
When items wait for resource pool units, they can be ranked by priority or FIFO order. The
Resource Pool block is able to globally allocate the resource pool unit to the highest ranked item.
Disadvantages
The resource pool method does not allow the use of attributes to track information about the
individual resources. To use attributes, you must use resource items; this is shown in Resource
Item method on page 219.
It is more difficult to control the complex scheduling of competing resources across a number of
different queues using resource pools.
After learning about resource pools, see Advanced Resource Management on page 223 for a
more rigorous method of creating resource requirements, scheduling, and tracking resources.
217
So that the focus is on the constraining effect of labor resources, the Activity block is set to infinite
capacity. This causes the availability of labor, but not the processing of material, to affect the flow
of items in the model.
Resources required from different pools
In the Multiple Pools example, there are three Resource Pool blocks, each with their own labor
resource. Items require either Labor 1, Labor 2, or Labor 3.
Discrete Event
218
Discrete Event
219
See Items, Properties, and Values on page 113 for a complete explanation of attributes and other
item properties.
Some limitations of using resource items are:
The Resource Item block must be connected in the model and the connection must be such that
the resources it outputs can be batched with the items that require them.
The resource item cannot see the items waiting for it. You must use routing blocks to direct
the resource item to the correct Batch or Unbatch block.
After learning about resources, see Advanced Resource Management on page 223 for a more rigorous method of creating resource requirements, scheduling, and tracking resources.
Discrete Event
220
flight time, it is sent for maintenance and the accumulated hours are reset to 0. The model looks
like:
Discrete Event
The Create block generates orders which are batched with an airplane from a Resource Item block.
While the airplane is batched with a flight order, it is not available for other flight orders; the order
will wait in the Queue (set to type: sorted queue, and Sort by: first in, first out) until the plane
becomes available.
The Resource Item block attaches an Hours attribute to the airplane. Settings in the Batch blocks Properties tab, shown at right,
cause the airplanes Hours attribute (the first attribute from the
item arriving at the second connector) to be attached to the
batched item.
on page 119.
An Activity block (labelled Flight) uses a random distribution to determine how long each flight
will take, then outputs the flight time to its Process Time (PT) connector. The Equation block gets
the airplanes flight time and adds it to the planes Hours attribute.
After the flight, the airplane is unbatched from the order; the airplane returns to the Resource Item
block for reuse and the order exits the simulation. The Get block reads the value of the airplanes
Hours attribute and the Decision block determines if the accumulated flight time is greater than
50 hours. If it is, the airplane will be routed to the maintenance group for processing. After maintenance the Set block re-initializes the Hours attribute to zero. If accumulated time is not greater
than 50, the airplane is returned to the Resource Item block where it will wait for another flight
order.
When the simulation is run, a clone of the output from the Equation blocks dialog shows the
value of the airplanes Hours attribute. With animation on, it is easy to see that once the airplane
has an Hours value greater than 50, it routed to the maintenance group.
For this model it is essential to be able to track information about the airplanes flight time. Therefore the ability to assign attributes to the airplane resource is critical.
Stripping attributes from resource items
As described in Properties when items are unbatched on page 210, an item returning to a
Resource Item block after batching may have many attributes that are irrelevant to the returning
item. The Resource Item block provides the option of stripping attributes or keeping them with
221
resources that are recycled; the default is to strip them. When tracking resource information using
attributes (as in the above model), you will not want to strip the attributes, so the block is
unchecked. However, in cases where you are not concerned with attribute values after the item has
been recycled, you may want to strip the attributes so that the item will be clean when it comes
out of the Resource Item block again.
The Queue Matching block (Item library) holds different types of items until the requirements for
each type have been met. This can be useful when modeling the release of resources and items into
a Batch block. For more information, see Matching items using the Queue Matching block on
page 142.
For instance, the Simple Resource Pool model on page 217 illustrates how to model resources
using the resource pool blocks. A simpler method would be to use the Activity block to represent a
limited resource, without using explicit resource blocks. In this case, you would remove the
Resource Pool and Resource Pool Release blocks from the model, set the Queue as a FIFO sorted
queue, and set the maximum items in the Activity block to three. The Activitys capacity limitation
would have the same constraining effect as the Resource Pool block in the original Simple
Resource Pool model.
Another advantage of modeling resources implicitly is that the Activity block can be shutdown and
brought back online using the Shutdown block, as shown in Shutting down on page 185. This is
common when modeling random failure.
Conceptual resources
The concept of what is a resource is not limited to the explicit (resource pool and resource item) or
implicit (capacity-constrained) methods of representing resources. Theoretically, a resource is anything where its availability can restrict items flowing from point A to point B. Some examples are:
Any item can conceptually represent a resource. For example, batching a bus item with people items, where the bus is required before the batched bus/people item can be released from a
Queue (see Delaying kits on page 207). Note that the bus is created as any other item, not as a
resource item from the Resource Item block.
Using the ExtendSim database or global arrays to track resource availability, limiting the flow of
items in a model. For example, item availability would be regulated by how data in the database
changes during the course of a run.
Using block combinations to control item movement as model status changes over time, such as
a Queue followed by a Gate that is connected to a Read block.
Your cleverness and knowledge of ExtendSim can probably lead to even more ideas.
Discrete Event
Implicit resources
A resource can be implied in a model by restricting or scheduling the capacity of residence type
blocks like the Activity and Queue. These blocks are useful for implicitly modeling resources.
222
Discrete Event
The following model uses three Resource Item blocks to illustrate a closed system (Technicians), an
open system (Stock), and a partially closed system (Fixtures).
The model assumes that about one third of the fixtures are consumed in the process; they are
restocked at periodic intervals by the Create block.
Scheduling resources
To accurately characterize the impact of resources in a simulation model it is common to model
resource scheduling logic, both in terms of where and when a resource should be assigned. For
example, if one resource item is required in multiple places, such as an item that could be routed to
two or more Batch blocks, then scheduling logic needs to be added to the model.
There are several ways resources can be scheduled. Some methods apply to using either resource
pools or resource items and some apply only to scheduling resource items.
223
The value at the TR connector determines how many resources the block has and can result in an
increase or a decrease in resource availability. For example, if the initial number in a Resource Item
block is 10, and the block gets a value of 3 at its TR input connector, the block will eliminate 7
resources from its availability list. If the block doesn't have enough resources to dispose at the time
of the change, it will dispose of them as they return.
Scheduling Resources model
It is common to schedule the availability of resources based on some
factor in the model, typically time.
For example, in the model discussed
in Scheduling activities on
page 179, you could have scheduled
workers in the diner depending on
the time of day using the Resource
Item and Create blocks.
Discrete Event
224
2) A Resource Item followed by a Select Item Out block controls where resource items are routed.
3) A combination of the Gate and Select Item Out blocks can be used to control both where and
when items are scheduled.
4) The Queue Equation block is useful for controlling both where and when items are scheduled
for use when the scheduling logic is more complex. With this block, ModL logic statements
can intelligently control the scheduling of items based on their properties, information in the
ExtendSim database, or even the status of other sections of the model. For more information,
see Sorting items using the Queue Equation block on page 137.
Discrete Event
The Shift block is used to schedule both the magnitude and availability of capacity in other blocks
in a model. This is useful for simulating situations where a systems resources follow a pattern of
coming on and off line over time. For example, the Shift block could be used to model workers in
a factory following a repeated daily pattern of reporting to work in the morning, taking a break for
lunch and going home at some point in the evening.
Each Shift block represents a named shift and its schedule that can be referenced by other Item
library blocks. The Shift controls the capacity of the blocks that reference it, based on the schedule
that is defined in its dialog table. If a shift schedule is changed, all blocks using that named shift
will receive the same modified shift pattern. In addition, shifts may be repeated at regular intervals
if the Repeat schedule every checkbox is selected. This is useful for modeling repeated shift patterns, e.g., an eight-hour workday each day of the week or breaks that occur every four hours.
It would be quite easy to define a complex shift schedule that includes all breaks, holidays, weekends, and so forth. However, before adding such complexity to a model, carefully consider whether
such detail adds to the validity of the model. If, for example, nothing at all happens during the
weekend, a better solution would be to simply assume one week is 5 days long (or specify that in
the Simulation Setup dialog) rather than adding a Shift block to model the weekends. Shifts
should only be used when they will make a significant difference in the results of the simulation.
225
The following table shows which Item library blocks can be controlled by a Shift block, which
types of shifts those blocks support, and what aspect of a block, if any, the Number type of shift
controls:
Shift Type: On/
Off or Number
Activity
Both
Convey Items
On/Off
N/A
Create
On/Off
N/A
Gate
Both
Resource Item
Both
Resource Pool
Both
Transport
Both
Block capacity.
Workstation
Both
In the Rate library, the Convey Flow, Interchange, Tanker, and Valve blocks can use a Shift set to
On/Off type. See the Rate module for more information about using the Rate library.
If a Shift block is used in a model, statistics in the Queue blocks will probably not accurately reflect
utilization, etc.
Status connectors
The Shift blocks value input connector (StatusIn) can be used to override the shift schedule. If the
input connector is less than 0.5, the Shift is considered off shift; this will override any value found
in the Shift blocks dialog table. If the input connector is greater than 0.5, the shift schedule from
the dialog table is used.
The Shifts value output connector (StatusOut) reports the current shift status (ON = 1 or OFF =
0 for On/Off type Shifts, or the number for Number type Shifts).
Shift models
The following models show how to use the Shift block in typical modeling situations. They also
illustrate how the two types of Shift, On/Off and Number, are used in simulations.
The models are located in the \Examples\Discrete Event\Resources and Shifts folder.
Discrete Event
226
Discrete Event
227
Resources model
The next example also
uses a Number type of
shift. It illustrates a Shift
block controlling
Resource Pool availability so that workers start
their shift, work 4 hours,
take a lunch break, work
4 more hours, and then
leave for the day.
When workers are not
available, the backlog
starts building up in the
Queue.
Discrete Event
Complex patterns
Shift blocks may be con- Resources model
figured serially, controlled
by other blocks, or used
in other patterns to create more complex shift patterns.
Discrete Event
228
229
In the ARM system, resources are records that are stored in the Resources table of the Advanced
Resources database.
The ARM system can co-exist with the other resource modeling systems (items as resources and
non-ARM resource pools). Thus models can use a mixture of resource modeling methods.
The primary ARM transactions are illustrated and described in more detail starting on page 261.
Discrete Event
In addition to the database, several blocks (listed on page 260) form integral parts of ARM. The
Resource Manager is the central component of the system. It provides a dialog-based interface for
creating and managing resources, requirements, policies, and release rules. Other blocks (Queue,
Queue Equation, Resource Pool, Resource Pool Release, Shift, and Statistics) control or report various
aspects of resources. Together with the ExtendSim database feature, these blocks comprise the
ExtendSim Advanced Resource Management system.
230
Definitions
The following definitions and abbreviations are used regarding the ARM system. Italicized words
are defined in the table.
Term
Definition
Discrete Event
Advanced resource (AR) A resource that is part of the Advanced Resource Management (ARM) system.
Filtering condition
(FC)
A specified condition of a resource or group property that gets saved. A filtering condition becomes a component of a quantity expression. It is thus the
smallest (atomic) component of a resource requirement. When applied during
the simulation run, the filtering condition limits the collection of resources
to those that meet the condition.
Group
Properties
A method for distinguishing one resource, group, pool, or item from the others.
Quantity expression
(QE)
Resource
The means by which process activities and operations are performed. Typical resources include equipment, personnel, space, energy, time, and money.
Resource order
Resource Order ID
The location (record index) of a resource order in the Orders database table.
Resource pool
A means for organizing resources. Pools can be used to control which types
of resources are allocated to and released from items, as well as to capture
statistics. A resource can only belong to one pool but it can be a member of
many groups.
Resource requirement
(RR)
A named rule that specifies how many of what types of resources to allocate
to an item. The rule could be simple (1 washer/waxer is required per car) or
it could be a complex expression involving several resources, groups, and so
forth. A resource requirement can be composed using one or more quantity
expressions.
Tutorial
The purpose of the following tutorial is to highlight some of the advantages of advanced resources
and illustrate ARM capabilities that could not easily be accomplished using the Resource Item or
231
Resource Pool methods. To do this, the tutorial focuses on the problem of worker training strategies. In particular, the Final Car Wash model is modified and experimented with to determine how
many people to hire and what mix of skills (only washing cars, only waxing cars, or cross-trained to
do both) the workers should be trained on.
The tutorial is divided into three phases, described below.
Phase I: Adding ARM to a model
This phase just adds advanced resource capability to the Final Car Wash model, without changing
any underlying assumptions. It starts on page 231.
1) Adding a Resource Manager block to the model
2) Changing the dialogs of the models Resource Pool, Queue, and Resource Pool Release blocks
to supply, require, and release advanced resources, respectively
Phase II: Create more complex requirements and specialized resource types
Starting on page 235, Phase II shows how to create complex resources and resource requirements.
2) Using the Resource Manager to create two complex resource requirements
3) Creating a new string attribute that links to the table of resource requirements and changing
blocks to accommodate it
Phase III: Using the Resource Manager to create pools and requirements
The final phase shows how to use the Resource Manager block to create pools, resources, and
resource requirements. It starts onpage 241.
1) Creating a pool and resources using the Resource Manager block
2) Defining a new resource requirement
To understand the ARM system, it is important to go through the tutorial. For comparison to your
work, example models that correspond to the tutorial are located at Examples\Tutorials\Discrete
Event\Advanced Resources. Also see the Auto Club Emergency Service model located at Examples\Discrete Event\Resources and Shifts\Advanced Resources.
The following tutorial assumes that you have completed the Discrete Event Tutorial (Car Wash)
and that you are comfortable working with string attributes and the ExtendSim database. These
topics are covered in the User Guide.
Discrete Event
232
In the dialog of the Resource Manager block, notice that, other than the Resources tab, the tabs are
disabled. The tabs in this block are meant to be used sequentially. Until the model has advanced
resources, the other tabs will remain disabled.
Resource Pool
The next step is to create an advanced resource pool and some resources. This is done by changing
the settings in the Resource Pool block that is already in the model.
Because using them automates many of the steps, Resource Pool blocks provide a quick and efficient entry to using the ARM system.
Discrete Event
233
2 resources
In the list selection popup, be sure that RR_Washer/Waxer is selected, as shown above.
Click OK to close the dialog
This tells the Queue that it must hold each car until the resource(s) specified by RR_Washer/
Waxer are available. Requiring one Washer/Waxer per car is the default resource requirement.
What happened
When a Resource Pool block is used to create a pool, the ARM system automatically creates an
associated default resource requirement. The default is that one resource is required from the associated pool in order for the item to be released from the Queue. And the default requirement is
given the same name as the resource pool, preceded by RR_. Thus the default resource requirement is named RR_Washer/Waxer and, again by default, each car requires one Washer/Waxer. (If a
more complex resource requirement is needed, it must first be defined on the Resource Managers
Requirements tab, as discussed in Phase II of this tutorial.)
If a pool has been created using a Resource Pool block, the ARM system automatically specifies a
default resource requirement, with a quantity of 1 resource, as being required for each item. If the
pool is instead created using the Resource Manager block, this automated process is optional. For
more information, see Default resource requirements on page 258.
Look at the Resource Manager: Requirements tab
It is helpful to see how the Resource Manager handles resource requirements.
Discrete Event
The Queue is where item/cars wait until the required types of resources, in the specified quantities,
are available.
234
Discrete Event
In the dialogs of both of the Resource Pool Release blocks (Release Attendants):
Run the simulation (it will run a lot faster if you turn off animation).
The new model is now fully converted to run using advanced resources but retains the information
of the original model. If the same random seed value is entered in the Run > Simulation Setup >
Random Numbers tab, the converted model will produce identical results to the original model.
For extra assurance, compare the results of this phase of the tutorial to the Final Car Wash RM1
model located at Examples\Tutorials\Discrete Event\Advanced Resources.
In order for the new pool and its resources to be saved, the model must be saved. This action also
saves the Advanced Resources database, which contains all the information about the pools and
their resources.
What happened
As each car gets to a Resource Pool Release block, its release rule causes all resources (in this case, 1
Washer/Waxer) to be released. The Washer/Waxer resource then becomes idle and is made available for the next item waiting in the Queue.
Look at the Resource Manager: Release Rules tab
The Resource Pool Release blocks have three mechanisms for releasing advanced resources. The
options are to release:
All resources
All resources from a specific resource order
Resources using a custom rule
235
While not needed for this example, the Policies tab provides additional flexibility when building
advanced resource models. For more information, see Policies on page 251.
While not necessary for this tutorial example, resources from different pools can be organized into
groups with rankings and skill levels. This is discussed in Groups on page 246.
Discrete Event
The default setting is that items are sorted first by the ranking of the resources that they require
and secondarily by their arrival time to the queue. (Since the default resource requirement rank is
1, and absent any other conditions the advanced resource queue behaves as if items are released in
first-in, first-out order, the sorting order has no effect on the cars waiting in this model.)
236
ify item requirements cars that require either one Washer or one Washer/Waxer and cars that
require either one Washer/Waxer or both a Washer and a Waxer.
Resource Pools
Three pools are required for this phase of the tutorial: Washer/Waxer, Washer, and Waxer. Each
pool will have one type of resource (washer/waxer, washer, or waxer) available for the model.
This tutorial uses three Resource Pool blocks to represent the three pools. However, Resource Pool
blocks are optional in the ARM system and pools can also be created using the Resource Manager,
as shown in Phase III.
Discrete Event
Open (or continue using) the Final Car Wash RM model you created in Phase I
In the dialog of that models Resource Pool block (labeled Attendant Resource):
Change the initial number to 1
Change the label of the block to Washer/Waxer
Click OK to close the dialog
A dialog appears with a message that this action will change the properties in the pool Washer/
Waxer. Click Yes to acknowledge and accept the change.
Add two additional pools
The next step is to add resources that are specialized:
Add a second Resource Pool block to the model. (The easiest way to do this is to Edit>Duplicate the existing Resource Pool block, which you labeled Washer/Waxer.)
Enter Initial number: 1 but leave the rest of the settings at the default
Add a third Resource Pool to the model and repeat the above process, except:
Name the third advanced resource pool Waxer
Change the label of the block to Waxer
Save your Final Car Wash RM model
237
The ARM system created default resource requirements as well as the default building blocks (the
filtering condition and quantity expression) that compose that resource requirement.
Select Choose resource requirement: New resource requirement. The popup changes to
unsaved resource requirement a reminder that the requirement must be saved to be usable.
Discrete Event
238
Discrete Event
An alternative method would be to use a Lookup table as is done in the Auto Club Emergency Service model located at \Examples\Discrete Event\Resources and Shifts\Advanced Resources
When the string attribute is changed, settings in the following blocks must also be changed to use
the new attribute:
239
Set
Random Number
Queue
Select Item Out
These changes are only necessary because the attribute needs to be changed. If the model had been
originally constructed to use the ARM system, there would be no reason to make these changes.
Set block
In this model, the attribute is set in the Set block (Set Attribute). In the blocks dialog:
In the Property Name column, select the Preference cell to open the popup menu
From the list of properties, select New String Attribute
Name the new attribute Requirements and click OK. This opens the Executive blocks Item
Attributes tab. The string values table on the right is now named Requirements.
Close the Executives dialog. Notice that in the Set blocks dia-
In row 1, select Wash/Wax Requirement from the popup. That requirement will be
selected 25% of the time.
Discrete Event
In the string values table (Requirements), click the Link button to open the Link dialog
Choose Link To: Database Table
Select the database named Advanced Resources and click OK
Choose Table Name: Resource Requirements. This displays a table listing all the resource
240
For the selection condition, choose Select output based on: property (it should already be
Discrete Event
selected)
For extra assurance, compare your model to the Final Car Wash RM2 model located at Examples\Tutorials\Discrete Event\Advanced Resources.
Results
Go to the Results tab of the Resource Manager block
In the resource results frame, examine the results displayed in the table
Notice that Washer/Waxer_1 and Washer_1 are much more heavily utilized than Waxer_1. This is
because:
Waxer_1 can only wax cars and cars that need to be waxed represent only 25% of the cars coming into the car wash.
Washer/Waxer_1 and Washer_1 can both be used when cars only need washing as well as when
they need washing and waxing. Thus the remaining workload is distributed evenly between
Washer/Waxer_1 and Washer_1.
How the resource requirement expression is composed impacts which resources get selected.
Since the ARM system attempts to satisfy resource requirement expressions in left to right order,
and the model contains resource requirements that use OR logic, changing the way the statement
for the requirements is written impacts the behavior of the system.
For example, there are three possible ways the Wash Requirement could have been written:
241
The Resource Managers Results tab contains individual and pool level statistics for advanced
resources in the model. These statistics apply to the current simulation run and include utilization, the number of resource orders serviced, and so forth. The same information will be displayed if a Statistics block (Value library) is added to the model before the simulation runs.
The Results tab of Resource Pool blocks provide statistics on the total number of resources in the
pool, how many are in use or are available, and their average utilization.
If the Resource Managers Event Logging tab is enabled when the simulation is run, it records
specified information about the resource transactions that occurred. The type of transaction is
user-selected in the dialog. To view the results, click View Database, then select and open the
Resource Transaction Log table.
Discrete Event
The ARM system provides extensive data for analysis and there are a number of ways to observe
and analyze results for this model:
242
Click No. (It doesnt matter if you accidentally click Yes; the default resource requirement
can be ignored or deleted).
In the Resources tab dialog, notice the following:
The option to Make names distinct is checked by default
The default name for the pools resources is the same as the pools name; this is the root
name of individual resources created for the pool
Discrete Event
243
Once resources have been created, changes to their properties are automatically and immediately
saved to the database. (The model file must still be saved.)
2) The second step is to define and save a quantity expression. Quantity expressions are logical
statements consisting of the desired number of resources and one or more filtering conditions,
such as 2 resources from a particular pool.
3) The goal is to arrive at a resource requirement. In the simplest case, the resource requirement
could be the same as the quantity expression. It could also be a complex expression that selects
resources with specific properties from several pools and/or groups.
This section of the tutorial gives a quick overview. For more information about creating resource
requirements, see Resource requirements on page 252.
Discrete Event
1) The first step is to create and save a filtering condition. A filtering condition is a specified
aspect of a resource or group property. For instance, a filtering condition could be that the
resource comes from a particular pool. Think of creating filtering conditions as a way to make
collections of resources. When used in a quantity expression, filtering conditions limit the collection to a selected list of resources that meet the specific conditions.
244
Click Test. This opens the Viewer, displaying which resources the filtering condition would
select at this time. (New resources might be added, or existing ones deleted, before the filtering
condition actually gets applied.)
Discrete Event
Enter Quantity = 2
Click SELECT
This places the expression in the expression area. The expression indicates that two resources will
be selected. Since there is no limit on the type of resources, any two resources from the Resources
table could be chosen.
To limit the resources to those specified by a filtering condition:
In the dialog, choose No. (If you instead chose Yes, the resulting resource requirement can be
ignored or deleted.)
245
Click Test. This opens the Viewer, displaying which resources might be selected. As indicated in
the table, without any other conditions being present the system will choose the first two
resources in the list.
Requirement
Click Test. The Viewer indicates which resources will be selected to fulfill the requirement. All
other things being equal, one washer will be selected or the first two resources in My New Pool
will be selected.
For more detailed information about creating resource requirements, see Resource requirements
on page 252.
The purpose of Phase III was just to show how to create pools, resources, and resource require-
ments using the Resource Manager block. Since the new resource requirement is not used in the
model, it has no affect on model behavior.
Even if a model has no Resource Pool blocks, it should probably have Resource Pool Release
blocks. Use of Resource Pool Release blocks is optional only if the resources are considered to be
consumed and the accumulation of excess records for the non-disposed resources does not cause
concerns for model size and memory usage.
Dont lose your work
The new resource requirement is automatically saved in the Advanced Resources database. However, for the database to be saved:
You can compare your model to the Final Car Wash RM3 model located at Examples\Tutorials\Discrete Event\Advanced Resources.
Additional information
The following areas were not covered, or not completely covered, in the tutorial; they are discussed
below.
Groups
Discrete Event
246
Resource orders
Status and transitions
Properties of resources, pools, groups, and items
More information about creating a resource requirement
Release rules
Policies
Groups
Groups provide a means for organizing resources from different pools or from the same pool. If
included as part of a filtering condition, groups can be used to control which resources are selected
for a resource requirement.
Although a resource can only belong to one pool, it can be a member of many different groups.
Discrete Event
In the Select resources to group frame, check the Select box for each resource you want to include
in the group
Click the arrow button. The button, shown at right, is located between the Select
resources for groups and the Create/modify groups frames. Clicking the button causes the
selected resources to become members of the group.
Assigning properties to groups
As discussed on page 250, each member of a group can be
assigned a Skill Level and/or a Resource Rank. These group
properties are used to prioritize which resource to select first
from the group, when a group requirement is executed.
Any number, including 0 (zero) and decimals, can be assigned to a group member as its Skill Level
or Resource Rank.
Deleting groups or their members
247
Deleting a group and its members, or removing individual members from a group, does not delete
the resources.
Resource orders
A resource order is the association of a particular item with a specific resource requirement; it is represented by a unique Resource Order ID (discussed on Item properties on page 250). Resources
are allocated to orders and each item can have multiple resource orders.
When an item gets to a Queue, the Queue makes a request to the Resource Manager for the
resources specified by the items resource requirement. The Resource Manager then:
Converts that request into a resource order
Creates a corresponding record in the Resource Orders table that refers to the resource request
and identifies which Queue the order came from, when it was ordered, and so forth
Assigns a Resource Order ID to the item
Attempts to satisfy the items resource requirement
When a resource is successfully assigned to an item, the Resource Order ID field in the
Resources table is updated. That information is used to track the resources last allocation.
This architecture allows the ARM system to track data and calculate statistical information such as
when a resource was requested and the average length of time it took to satisfy.
For more detailed information, see Primary transactions for ARM on page 261.
Discrete Event
If each item could only have one resource requirement, and if each resource requirement could
only be selected by one item, statistical information could be obtained just from the resource
requirements usage. Instead, the ARM system allows each item to have multiple resource requirements and even the same resource requirement multiple times but at different Queues. Additionally, several different items can each have the same resource requirement. To track data and
calculate statistical information, the ARM system uses resource orders.
248
Idle or Disabled can be set as the initial status when the resource is created or edited. Busy is a function of the resources use in the model. Off Shift and Down are controlled by the Shift and Shutdown blocks (Item library), respectively. The Resource Managers Results tab gives information
about the amount of time each selected resource was busy, idle, and so forth.
Except that a resource cannot transition from disabled to down, each status can transition to any of
the others. This gives a total of nineteen status transitions. To track status transactions, check
Resource status transition in the transaction type table on the Resource Managers Event Logging
tab.
Properties
Discrete Event
Individual resources, pools, groups, and items each have their own properties. Properties provide a
means to distinguish between them and characterize their behavior. As the simulation runs, information about properties is displayed in the Resource Managers Results tab.
Resource properties
The Resources table of the Advanced Resources database stores each resource as a distinct record,
sorted by Resource ID. The fields of this table represent resource properties, which can be static or
dynamic.
The ARM system has a list of pre-defined static and dynamic resource properties. Custom resource
properties can also be added, as discussed below.
Static properties
Static properties are specified when the resources are created, either in the Resource Pool block or
on the Resources tab of the Resource Manager. Their values remain fixed during the simulation
run.
The Resource ID property is automatically defined by the system. It uniquely identifies the resource
and is not modifiable by the modeler. Other static properties are definable by the modeler:
Resource name. The name does not have to be unique unless Make names unique (Resources tab
of Resource Manager block) is checked when the resource is created.
Pool. The pool name must be unique.
Initial status: idle or disabled.
Shift, if the Shift block (Item library) is present in the model.
Groups. If a resource is a member of more than one group, the Groups column of the Select
resources to group table (Resources tab, Manage groups mode) will display a popup menu listing
the groups.
Cost per unit of time.
The time unit used for costing.
Cost per use.
These static properties are also part of the filtering conditions used to create or modify resource
requirements.
Dynamic properties
As the simulation runs, the ARM system tracks status information and calculates resource statistics. This data is stored as dynamic resource properties, which include:
Status and status start time
249
Choose whether column heading selections should apply only to the selected rows or to all
rows
If selected rows is chosen, check the Select boxes for the resources to be changed
Use the popup menu in the column heading to choose the new setting. For example to
change all of the displayed resources to the disabled state, choose that setting in the Initial
Status column.
The fields in the Groups column are only for information; they cannot be changed.
Pool properties
A pool can have an ID, a Name, and a Parent ID. The Name and Parent ID are user-modifiable.
The Name must be unique. Pools can be structured hierarchically; if one pool is part of another
pool, the Parent ID identifies the next highest pool in that hierarchy.
Discrete Event
250
The Pools table of the Advanced Resources database lists all the pools in the model as well as a
summary of the results from the simulation run (total idle time, total utilization, and so forth) for
each pool.
Group properties
Group properties are stored in the Group Resources table of the Advanced Resources database.
The group properties are Name, Skill Level, and Resource Rank, all of which are user-modifiable.
While they are considered group properties, the Skill Level and Resource Rank are assigned to the
individual members (resources) of the group.
Group properties are useful when creating or modifying filtering conditions. Both the Skill Level
and the Resource Rank are used to prioritize which resource to select first from the group, when a
group requirement is executed. The Skill Level or Resource Rank can be any number, including 0
(zero) and decimals.
Discrete Event
The Groups table of the Advanced Resources database lists all of the models groups. The Group
Resources table displays all of the groups in the model as well as the properties and Resource ID of
each of their members. (Remember, a resource can be included in more than one group.)
For information on creating and managing groups, see Groups on page 246.
While the principle is the same, a groups Resource Rank is not the same as a resources Resource
Requirement Rank.
Item properties
In addition to the item properties discussed in the User Guide, every item at an advanced resource
queue has a unique Resource Order ID assigned to it. The ID is automatically stored in a special
item property and refers to a record index in the Resource Orders table of the Advanced Resources
database. (See Resource orders on page 247.)
While not an item property, resource requirements have a resource requirement rank that controls
the order in which idle resources search for waiting items to service. A resource requirement with a
better rank will have first choice of any available items that require that resource. For more information, see Resource allocation policy on page 251.
Release rules
A Resource Pool Release block has three choices for controlling which resources to release when
items enter the block. The options are:
Release all resources
Release all resources from a specific resource order
Release resources using a custom rule
Custom Resource release rules provide a user-definable mechanism for controlling which resources
to release. They are designed to control the release of resources at the quantity specification level of
a resource requirement. Consequently, each resource release rule is associated with a specific
resource requirement.
To create or modify a release rule:
251
Item priority the lowest number, including negative values, is the highest priority
Value attribute
DB Address attribute
Queue arrival time
Resource requirement rank. When a resource requirement is created, it gets a ranking value that
is set in the Requirements tabs Resource requirement rank field. And before a waiting item can be
released from an advanced resource queue, it must be associated with a resource requirement.
Since each item has one or more resource requirements where each has a rank, the resource
requirement rank can be used to sort waiting items. A resource requirement rank must be 0;
the default resource requirement rank is 1. (Also see Overriding the resource requirement rank
on page 252.)
Items can be sorted by any one of these properties, in ascending or descending order. A secondary
sorting order is also allowed.
The default is to sort items by the ranking of their resource requirements and then by the time the
item arrived to the queue.
Allocation
There are two possibilities for item selection:
By default, the resource picks the first item in the sorted list whose entire resource requirement
can be met by available resources. If the first item doesnt qualify, the next items qualification is
assessed, and so forth. If none of the items qualify, the resource waits until a qualifying item
appears in the Queue.
If Only try the top sorted item is selected, the resource will only look at the first item in the sorted
list. If its entire resource requirement can be met, it is picked. If not, the resource waits until a
qualifying item appears at the top of the sorted list of waiting items.
Discrete Event
Sorting criteria
Item properties are used to control the order in which waiting items are sorted. The properties are:
252
Discrete Event
Overriding is accomplished by changing the values in the RR Rank column in the Override
resource requirement rankings table.
The original ranking values are displayed in square brackets in the RR Rank column.
Resource requirements
A resource requirement is a named rule that specifies how many of what types of resources to allocate to an item. An advanced resource queue will only release an item if the resources required by
the item are available. Resource requirements are created:
Manually, as discussed below
By default, as discussed starting on page 258
253
2) Use the results of the process above to determine how many quantity expressions are needed. A
quantity expression will be required for each distinct resource collection from which a quantity
will be selected.
3) Once the quantity expressions have been identified, determine how many different criteria are
needed to represent all of the distinct resource collections referred to in step 1. Each criterion is
expressed as a condition on the values of a resource or group property and is referred to as a filtering condition. Filtering conditions are used in quantity expressions to generate the collection of resources from which the specified quantity is selected.
Discrete Event
Filtering conditions
254
Discrete Event
Testing
Once the property and condition selections have been made, use the Test button to apply the
selections to the models resources. This opens a table displaying all the resources that match the
selected filtering condition. For a group filtering condition, every resource that has the specified
group property will be displayed, no matter what group it is in.
For the definition of a filtering condition, select it in the Choose filtering condition popup menu of
the Resource Managers Requirements tab. The settings will be for the selected filtering condition.
Saving
A new or modified filtering condition wont be available for use until the Save or Save As button
has been clicked. Until the filtering condition is saved, its name will be displayed in red.
Saving the filtering condition saves it to a database. To save the database, save the model.
Quantity expressions
Defining quantity expressions is the second step towards creating a resource requirement. A quantity expression is a logical statement that is used to select a certain quantity of resources from an
identified collection of resources. The collection of resources is limited by the combination of filtering conditions that is entered in the expression, which can be quite complicated. However, for
255
each quantity expression only the specified quantity of qualifying resources will be drawn from the
entire identified collection.
Each quantity expression consists of three clauses:
1) A Quantity clause that specifies how many resources to select from a resource collection.
2) A WHERE clause that generates the resource collection. The WHERE clause contains the criteria that resources must satisfy in order to be selected. The criteria are specified using one or
more filtering conditions.
3) An optional Order By clause that is used to sort the collection of resources generated by the
WHERE clause. The collection of resources is sorted based on the values (in ascending or
descending order) of a selected resource property.
When the simulation is run, the quantity expression will be applied as shown below:
Discrete Event
How a quantity expression gets applied during the simulation run (Order By is optional)
256
First determine if the expression should start with all the resources from the Resources table or
only a specified number of those resources (see Choices for the Quantity clause, above).
Also decide if the resources should be sorted by a property (see Choices for the Order By
Discrete Event
clause on page 256). Resources at the top of the list will be chosen first.
Then click the SELECT button to place the quantity in the expression area.
At this point, the quantity expression requires a specified quantity (all or a number) of resources.
However, the collection of resources is all the resources in the Resources table of the Advanced
Resources database. In complex models, that could mean a very large number of resources.
In models with large numbers of resources, it will speed simulation run times if the first part of the
expression uses a filtering condition that limits the search area to a pool or group.
To narrow the search area, click the WHERE operator. Then insert a filtering condition; typically
this would be a resource filtering condition that references a Pool or Group (for example, Property:
Pool = Pool 2).
To use additional filtering conditions, use the AND/OR operators in conjunction with grouping
parentheses. The result is displayed in the expression area.
Example
The quantity expression named Pool2_IdleResources is shown in the screen shot below. It was created using a quantity of 3 and two of the filtering conditions (FC#1 and FC#2) that were shown in
Examples of filtering conditions on page 254.
The quantity expression states that 3
resources will be
required and that each
resource must come
from Pool 2 (FC#1 is
True) and have a total
idle time > 10 (FC#2 is True).
Using group filtering conditions
When creating a quantity expression, group filtering conditions must be used in conjunction with
a resource filtering condition that specifies a particular group. This is accomplished by choosing
Group as the property for the resource filtering condition.
257
For example, assume the members of Group A and Group B all have Skill Level = 2. If the quantity
expression includes a condition that filters on the group property (Skill Level = 2), it must also
include a second condition that filters on a resource property that is the Group (either Group =
Group A or Group = Group B).
When creating a quantity expression, group filtering conditions must be used in conjunction with
a resource filtering condition that specifies a particular group. And the resource filtering condition
must be specified before the group filtering condition can be added to the expression.
Testing
The application of a quantity expression selects a specified quantity of specified resources. It is then
used to create the resource requirement. To determine if the expression selects the resource that is
wanted, use the Test button.
Saving
A new or modified quantity expression wont be available for use until the Save or Save As button
has been clicked. Until the quantity expression is saved, its name will be displayed in red.
Saving the quantity expression saves it to a database. To save the database, save the model.
Resource requirements
The final step is to create the actual resource requirement what the Queue requires so that it can
let its items leave and continue traveling through the model. Resource requirements are logical
expressions consisting of one or more quantity expressions combined using AND/OR operators in
conjunction with grouping parentheses.
The Create/modify resource requirements
frame (Resource Managers Requirements tab) is for specifying what
resources are required for items to leave
the Queue. The result is saved as a resource requirement.
Resource requirement rank
When it is created, each resource requirement gets a resource requirement rank. The resource
requirement rank must be 0; the default rank is 1. This ranking is used for sorting items that are
waiting for resources, as discussed in Resource allocation policy on page 251. It can be overridden for a particular resource, as discussed in Overriding the resource requirement rank on
page 252.
Creating a resource requirement
On the Requirements tab, enble the Create/modify resource requirements frame. Then either choose
an existing resource requirement from the popup menu and modify it or create a new one.
Discrete Event
258
To create a resource requirement, either choose a quantity expression from the popup menu or
start with a grouping operator. Use the AND and OR operators between quantity expressions; use
the grouping operators to group quantity expressions. The resource requirement rank can be
changed from the default of 1.
Example
The tutorial on page 245 showed how to create a resource requirement. To determine if the expression selects the resources that are wanted, use the Test button.
Saving
A new or modified resource requirement wont be available for use until the Save or Save As button
has been clicked. Until the resource requirement is saved, its name will be displayed in red.
Saving the resource requirement saves it to a database. To save the database, save the model.
Default resource requirements
Discrete Event
Under certain circumstances the ARM system creates a default resource requirement. In some cases
this is done automatically and in other cases it is optional.
The circumstances when a default resource requirement could be created are:
Every time a new pool is created using a Resource Pool block
Optionally when a new pool is created using a Resource Manager block
Optionally when a new group is created using a Resource Manager block
Optionally when a new quantity expression is created using a Resource Manager block
When a new pool or group is created
When a default resource requirement is created for a new pool or group, 3 components are created:
1) A filtering condition named FC_[name of pool or group], with the condition that:
For a new pool, the resource must come from the new pool (Filter using properties of
resources, where the property = [the new pool]).
For a new group, the resource must come from the new group (Filter using properties of
resources, where the property = [the new group]).
2) A quantity expression named 1 from [name of pool or group], indicating that the requirement is for exactly 1 resource from the pool or group.
3) A resource requirement named RR_[name of pool or group]. (When a resource requirement
is automatically created for a new pool or group, it is the same as the quantity expression.)
Because the default filtering condition is the newly created pool or group and the default quantity
expression is 1 resource from that pool or group, the default resource requirement is that 1 resource
is required from the new pool or group.
The default resource requirement for a new pool or group is that one resource will be required.
259
Advanced Resource
Management
Requirements
Specification
Advantages
Discrete Event
Resource
Resources are represented
Representation by items that are created
and reside in Resource
Item blocks. The Resource
Item block maintains statistics. Attributes can be
used to store properties
and statistics for individual
resources.
260
Advanced Resource
Management
2. It is more difficult to
control the complex sched2. A resource item cannot uling of competing
see the items waiting for resources across a number
it. Routing blocks must be of different queues using
used to direct the resource resource pools.
item to the correct Batch
or Unbatch block.
2. Advanced Resource
Management is only available with the ExtendSim
AT and ExtendSim Suite
packages.
Technique
Discrete Event
Description
Pools
Resources
Block
(Library)
Resource Manager
(Item AT & Suite)
Provides the interface for managing advanced resources, resource requirements (allocation rules), release rules, and transaction logs. Use it to:
261
Create, edit, and delete resources, pools, groups, and their properties
Create resource requirements
Define release rules
Define policies for allocating idle resources to items
Enable event logging
View statistical results
Queue Equation
(Item)
Resource Pool
(Item)
Statistics
(Value)
Shift
(Item)
Notifies the Resource Manager block when there is a change to a shift being
used by one or more advanced resources.
In the explanations, the Database Tables Used column has the following abbreviations: RO
(Resource Orders), RTL (Resource Transaction Log), and RR (Resource Requirements).
Discrete Event
Queue
(Item)
262
INTERNALDATABASE
, 7 , 11
Discrete Event
RESOURCEMANAGER
,6
10
5
QUEUE
RESOURCEPOOLRELEASE
Description
MessageSending Block
MessageDatabase Tables
Receiving Block
Used
Queue
RO, RTL
RO, Resources,
RR, RTL
Queue
Resource
Manager
Queue
Description
MessageSending Block
263
MessageDatabase Tables
Receiving Block
Used
Resource
Manager
Resource Pool
Release
10
Resource
Manager
11
RO, Resources,
RTL
RO, Resources,
RTL
Queue
RO, Resources,
RTL
Discrete Event
RO, Resources,
Resource Release
Rules, RTL
264
INTERNALDATABASE
RESOURCEPOOL
1
3
2
,7
Discrete Event
RESOURCEMANAGER
6
5
QUEUE
Description
MessageSending Block
MessageDatabase Tables
Receiving Block
Used
Resource Pool
Resource
Manager
Resources, RTL
RO, Resources,
RR, RTL
MessageSending Block
Description
Resource
Manager
MessageDatabase Tables
Receiving Block
Used
Queue
Resource
Manager
RO, Resources,
RTL
RO, Resources,
RTL
Queue
Discrete Event
Shift
When advanced resources use a Shift block, the transactions are as follows.
INTERNALDATABASE
SHIFT
1
3
,7
RESOURCEMANAGER
6
5
QUEUE
265
266
Discrete Event
Description
MessageSending Block
MessageDatabase Tables
Receiving Block
Used
Shift
The Resource Manager changes the status of all resources that use the Shift.
Resources, RTL
RO, Resources,
RR, RTL
Shift
Resource
Manager
Resource
Manager
Queue
Resource
Manager
RO, Resources,
RTL
RO, Resources,
RTL
Queue
Activity-Based Costing
Identifying and tracking fixed and variable costs
to determine operating costs
268
Activity-Based Costing
Blocks of interest
Activity-based costing (ABC) is a method of identifying and tracking the operating costs directly
associated with processing items. It is the practice of focusing on some unit of output, such as a
purchase order or an assembled automobile, and attempting to determine as precisely as possible
its total cost based on the fixed and variable costs of the inputs. ABC helps identify, quantify, and
analyze the various cost drivers (such as labor, materials, administrative overhead, rework, etc.) and
determine which ones are candidates for reduction.
Discrete Event
Once a model has been built, the discrete outputs of the system, as well as
the processes and resources that are
involved in creating those outputs,
have already been identified. To add
ABC to models, you enter costing
information into dialogs of blocks in
the model. Blocks that generate items
or provide resources, and blocks that
process items, have fields and Cost tabs
for specifying costing data. Enter vari- Cost tab of Activity block
able cost rates per time unit and fixed
costs per item or use. After the cost
information has been defined, costs will automatically be tracked as the items in the model change
state.
This chapter covers:
Identifying cost accumulators and resources
Defining fixed and variable costs
Blocks of interest
The following blocks are the main focus of this chapter. Each blocks library and category appears
in parentheses after its name.
Cost by Item (Item > Information)
Calculates the cost of every item in the model, as well as the average and total cost of the
process.
Cost Stats (Item > Information)
Records the input costs and total cost generated in each costing-based block. Determines
total model cost based on a specified confidence interval.
In addition to the two Cost blocks, many of the Item library blocks have cost fields or a
Cost tab for entering and reporting cost information, or have cost-handling capabilities, as shown
in the table below:
Blocks with Cost tabs or fields
Activity
Batch
Convey Item
Get
Activity-Based Costing
Modeling with activity-based costing
Create
Equation(I)
Queue
Set
Resource Item
Unbatch
269
Resource Pool
Transport
Workstation
The Interchange block (Rate library) can also define costing information for items in discrete rate
models.
Item types
For purposes of costing, every item in a model can be categorized as either a cost accumulator or a
resource. Understanding the difference between cost accumulators and resources is important,
because ExtendSim treats them differently, as you will see in Combining multiple cost accumulators on page 280.
As is true of items that are resources, non-item resources from the Resource Pool block do not
accumulate their own costs.
Cost accumulators
You perform ABC to determine the costs associated with storing or processing an item. The item
being stored or processed is called the cost accumulator and will accumulate costs as it waits, gets
processed, or uses resources. Cost accumulating items can be introduced into a model using the
Create and Resource Item blocks, as you will see in Costs for cost accumulators on page 271.
The following example shows how costs are assigned to cost accumulating items.
Discrete Event
To include activity-based costing in models, you need to know how to define cost rates, how to
properly combine cost resources with items, and how to gather and work with cost information.
Although an understanding of ABC is important, most of the work will be done by the ExtendSim
architecture.
270
Activity-Based Costing
Modeling with activity-based costing
Discrete Event
Assume you want to determine the cost associated with receiving crated inventory at a warehouse.
There is a one-time docking fee of $3.00 for every shipment that is received, and it costs $0.15 an
hour any time the crate waits for processing (such as in the receiving area.)
As each shipment arrives, a labor resource takes an average of 30 minutes to unpack the crate and
stock the contents on the appropriate shelves. In this case, the crate is being processed and is therefore the cost accumulator. The half-hour processing time and the hourly wage of the laborer is
used to automatically calculate the cost of unpacking and shelving. That cost is then added to the
accumulated cost being tracked with the crate. As the crate progresses through the steps of being
received and unpacked, ExtendSim will add the cost incurred at each step to the accumulated cost.
Resources
As discussed in Modeling resources on page 215, resources can be modeled using resource pool
blocks or by batching resources from a Resource Item block with other items. In the resource pool
method, resource units act as constraints on the flow of items throughout the model. In the batching method, resource items are required to be batched with other items before the items can proceed to the next process.
Whether resource pool units or resource items, resources provide a service for the items in a model;
they do not accumulate their own costs. Whenever a cost accumulator uses a resource, the
resources cost rates are used to calculate costs which are then added to the total cost of the cost
accumulator. (Cost rates are discussed on page 272.) For instance, in the Receive Inventory model
described above, the laborer is a resource item that is batched with the crate. Since the laborer is a
resource, it will not accumulate its own cost. Rather, the cost rate of the laborer (the hourly wage),
and the time it takes the laborer to unload the crate, is used to automatically calculate the cost of
unpacking the crate.
The default is that the Resource Item block outputs resource items. However, you can select in the
blocks Cost tab to output items as cost accumulators. This is discussed at Resource Item block
on page 272.
Activity-Based Costing
Modeling with activity-based costing
271
The variable cost rate, entered in block dialogs as the waiting cost/time unit or processing cost/
time unit.
You do not need to define all cost information in order to perform ABC. However, if even one cost
field is defined as a positive, non-zero number, ExtendSim will automatically track costs when the
simulation is run.
Cost accumulating items have their own fixed costs and variable cost rates. As they use resources,
wait for processing, and are processed, they acquire additional costs from resources, queues, and
activities.
The following information describes how and where to define costs.
Costs for cost accumulators
You specify costing information for a cost accumulator in the cost section or tab of the block that
originates the item. Each cost accumulator can have a fixed cost per item, such as its direct materials cost, and a variable waiting or processing cost rate, which causes it to accumulate costs as it is
stored or waits for processing.
Create block
Costing information is entered differently in the Create block depending on whether the block is
set to Create items randomly or to Create items by schedule.
In the Receive Inventory
model described on
page 270 the Create
block generates crates
randomly. The Waiting
cost/hour and the Cost
per item for each crate
are defined in the cost
Cost section of Options tab; block set to Create items randomly
section of the blocks
Options tab, as shown above.
When the Create block generates items by schedule, you must explicitly set _cost and _rate system attributes (discussed in Working with cost data on page 275) for each cost accumulating
item. The value of the _cost attribute should be set to the cost accumulator's fixed cost. The
Discrete Event
Cost accumulators are usually generated by the Create block. They can also be provided by a
Resource Item block, depending on a setting in its Cost tab.
272
Activity-Based Costing
Modeling with activity-based costing
value of the _rate attribute should be set to the cost accumulator's variable cost rate (waiting cost
per time unit), as shown below.
Discrete Event
The _rate attribute must be defined using the same time unit as the models default global time
unit. In the example, the time unit is hours, so the _rate attribute is the hourly rate.
Resource Item block
Cost accumulators can
also be provided for a
model using the
Resource Item block.
To do this, you must
choose that the block
Activity-Based Costing
Modeling with activity-based costing
For the Resource Item block to provide resources, the Cost tab must be set to Items are:
resources, the default choice. Otherwise the items will be cost accumulators, as discussed earlier.
The processing cost per time unit is used to calculate the time-based processing cost of each item
that passes through the block.
The cost per item is a fixed cost added to every item that passes through the block.
The Activity block has a PC (Processing Cost) input for targeting different processing costs on different items as well as a CPI (Cost per Item) input to attach a unique CPI to each item.
A maximum of two separate types of resource items can be combined with a cost accumulator at a
time. For instance, one or more worker resources from a Resource Item block and one or more cart
resources from a different Resource Item block.
To unbatch a resource and remove its cost rate information from the cost accumulator, you must
select Release cost resources as the Unbatch blocks behavior. This choice tells the block to modify
the information stored with the cost accumulator to indicate that the resource has been released.
If the Unbatch blocks behavior is set to Create multiple items, the items released by the block
will be identical to the item which entered the block. In other words, there would be multiple copies of the cost accumulator, and each copy would still be joined with the resource.
Discrete Event
Activities
You can also define cost information in activity-type blocks; those costs are accumulated by each
item the block processes. The activity-type blocks are the Activity, Convey Item, Transport, and
Workstation. Within the Cost tab of these blocks, enter a cost per time unit and a cost per item:
273
274
Activity-Based Costing
Modeling with activity-based costing
Discrete Event
In the example model, the cost accumulator is initially batched with 2 of Resource A and 2 of
Resource C. When multiple resources are batched with a cost accumulator, they may be released all
at once (as with Resource A), released incrementally (as with Resource C), or remain with the cost
accumulator. Whenever a resource is batched or released, the cost array of the cost accumulator is
updated to reflect the current number of resources in use. (The cost array is described in Combining resources with cost accumulators on page 278.)
There are three things to remember when batching resource items with cost accumulators:
1) A resource will be released from the output connector that corresponds to the input connector
originally used to batch it to the cost accumulator. For example, if the resource entered the
Batch block through the ItemsIn(2) connector, it will be released through the Unbatch
blocks ItemsOut(2) connector.
As in the Multiple Resources model, this could mean that one or more of the Unbatch blocks outputs will be unconnected and you will need to define that there will be zero items output through
that connector.
2) If an item is simultaneously batched with different types of resources, you must use different
connectors for each resource type when creating the batch. In the Multiple Resources model
above, Resource A uses connector ItemsIn and Resource C uses connector ItemsIn(2).
3) When performing ABC, you are limited to two different types of resource items batched with a
cost accumulator item at one time. This limitation is not true, however, when modeling
resources using the resource pool blocks, as you will see below.
Cost accumulators and the resource pool blocks
As described in Resource Pool method on page 216, as cost accumulating items pass through a
Queue block in Resource Pool mode, resources are allocated to the items. When this happens, the
cost rate of the resource pool unit is automatically stored with the cost accumulator and used in
any subsequent cost calculations.
When a resource pool unit is released using the Resource Pool Release block, the information
stored with the cost accumulator is modified to indicate that the resource has been released.
Activity-Based Costing
Modeling with activity-based costing
275
Unlike what happens where resource items are batched with other items, there is no limit to the
number of different types of resources a cost accumulator can use when using the resource pool
blocks. Furthermore, the two methods of modeling resources (batching resource items and
resource pools) may be used in conjunction with each other.
The information that is stored in these attributes depends on whether the item is a cost accumulator or a resource, as described in the following table:
Discrete Event
Preserved value. This option causes the cost accumulators to retrieve their preserved value, if
preserve uniqueness is turned on. In this case, the $9.00 is discarded.
276
Activity-Based Costing
Modeling with activity-based costing
Item type
_cost attribute
_rate attribute
Cost accumulator
Resource
Discrete Event
The attribute handling blocks in the Item library (Get, Set, and Equation(I)) can be used to read,
set, or manipulate these attributes. In addition, two statistics blocks in the Item library (Cost By
Item and Costs Stats) can be used to gather cost data.
Viewing Cost Data
You can use a Get block to read the _cost and _rate attributes of any item, then plot the data or use
the attribute value to perform additional calculations. For example, you can use a Get block to
read the _cost attribute of cost accumulators and connect the Get blocks _cost output connector
to a Plotter Discrete Event to plot the accumulated cost of each item that passes through. This is
shown in the model discussed in the following section.
Changing Cost Data
In most cases, it is sufficient to define the cost rates of the various cost drivers in a model and allow
ExtendSim to automatically calculate and track costs. However, there may be times when you need
to manipulate the cost values generated. The attribute handling blocks in the Item library (Get,
Set, and Equation(I)) can be used to accomplish this.
Change Rate model
For example, suppose the cost rates of a resource vary throughout the day. During peak times the
demand for the resource is high and the cost per time unit increases. This can be modeled using
Activity-Based Costing
Modeling with activity-based costing
277
the Set block (Item library) and the Lookup Table block (Value library) to explicitly set the _rate
attribute of the resource as it exits a Resource Item block, as shown in the model below:
The table in the Lookup Table block has a different rates for the period between hour 4 and hour
6.
A change in the rate will only affect resources as they exit the Resource Item block. Resources currently in use will not be affected until they are recycled back through the Resource Item and Set
blocks.
In the above model, a Get block reads the _cost attribute before the items exit the model. The
accumulated cost of each cost accumulator is then plotted. The plot (cloned onto the worksheet),
shows that the cost of the items increases during the period of time that the resources cost rates are
higher.
Gathering and Analyzing Cost Data
The Create, Resource Item, and Resource Pool blocks, as well as queue and activity-type blocks,
are capable of generating costs that get tracked with cost accumulating items. Additionally, each
cost-generating block displays the total cost it generated in its Total Cost dialog item.
You can also use the Cost By Item and Cost Stats blocks (both in the Item library) to gather summarized cost information. The Cost By Item block reads and stores the _cost and _rate attributes
of all the cost accumulating items that pass through it. The Cost Stats block collects and displays
the total cost for each cost-generating block in a model.
Cost By Item block
Depending on selections in its dialog, the Cost By Item block lists the accumulated cost of each
item that passes through it, the time the item passed through the block, and the total and average
cost of all the items that have passed through. This block can also be used to list the cost of the
items sorted by type.
In the Sort By Type model (shown below) three different item types are generated by randomly
assigning a Type attribute of 1, 2, or 3. It costs $5.00 per hour to run the machine. The machines
processing time for, and therefore the cost of, each item varies by type. The Cost By Item block
Discrete Event
278
Activity-Based Costing
How ExtendSim tracks costs
lists the costs of the items sorted by the Type attribute. As an item passes through the block, the
row corresponding to the value of the Type attribute (1, 2, or 3) is updated.
Discrete Event
The previous sections discussed how to perform ABC in ExtendSim. This section provides a more
detailed look at how ExtendSim tracks costs and is included mainly for informational purposes.
Activity-Based Costing
How ExtendSim tracks costs
279
When a resource is released by an Unbatch or Resource Pool Release block, the information stored
in the cost array is updated to indicate that the resource is no longer combined with the cost accumulator.
Calculating costs
As previously mentioned, the Create block and activity, queue, and resource-type blocks are all
capable of generating costs. As these blocks process cost accumulators, they will automatically calculate the cost and add it to the items _cost attribute. In addition, each cost-generating block will
update its Total Cost information. This dialog item displays the total cost contributed by that particular block only. The following sections briefly discuss how these calculations are performed.
In the Create block
When a cost accumulator is generated, ExtendSim will add the fixed cost (Cost per use) of the Create block to the cost accumulators _cost attribute.
For each cost accumulator generated, ExtendSim also will add the fixed cost of the Create block to
its Total cost dialog item.
For each cost accumulator that passes through the block, ExtendSim also will add the fixed and
variable cost contributed by that activity-type block (not including costs contributed by any
resources combined with the cost accumulator) to that blocks Total cost dialog.
In queue-type blocks
Queue-type blocks have a checkbox labelled Calculate waiting costs. If that checkbox is selected
when a cost accumulator enters a queue-type block, ExtendSim will calculate the time-based cost.
This is composed of the waiting or storage cost of the cost accumulator as calculated from the cost
accumulators _rate attribute and the variable cost of any resources currently combined with cost
accumulator. The time-based cost is added to the _cost attribute of the cost accumulator.
For each cost accumulator that passes through a queue-type block, ExtendSim also will add the
waiting cost calculated from the cost accumulators _rate attribute (not including costs contributed
by any resources combined with the cost accumulator) to that blocks Total cost dialog item.
In resource-type blocks
The Resource Item block is capable of providing items that are either cost accumulators or
resources, depending on selections in its Cost
tab, as shown at right.
If the block is providing cost accumulators, it
will generate costs similar to a queue-type
block.
Discrete Event
In activity-type blocks
When a cost accumulator enters an activity-type block, ExtendSim will add the activitys fixed cost
(cost per item) to the cost accumulators _cost attribute. In addition, it will calculate the variable
time-based cost (the processing or transportation cost of the activity and the waiting cost of any
resources currently combined with the cost accumulator), and add it to the _cost attribute of the
cost accumulator.
280
Activity-Based Costing
How ExtendSim tracks costs
Discrete Event
When the two cost accumulators, the CPU and the monitor, are batched together, two things will
happen:
The _cost and _rate attributes of the input items are added together. The resulting cost accumulator will have an accumulated cost equal to the combined accumulated cost of the input items
and a waiting cost rate equal to the combined waiting cost rates of the input items.
Any resources, whether from batching or from a resource pool, that are combined with the input
cost accumulators will be combined with the cost accumulator that is output from the batching
block. Note that any rules or limitations associated with batching resources with items will apply
to the resulting cost accumulator (see Batching and unbatching resources with cost accumulators on page 273).
282
Remember that, by itself, simulation does not provide exact answers or optimize a system. Instead,
a well-built model will capture important data and report statistical results. These metrics should
provide the information needed for the analysis and decision-making process.
This chapter discusses specific methods for statistically analyzing discrete event models, such as:
Gathering statistics for specific types of blocks
Clearing statistical accumulators after a warm-up period
Using the History block to get item information
Tracking change-of-state information about items
Using attributes to accumulate information about items
Determining cycle time by timing the flow of items
When to use time weighted statistics
For a more generalized discussions of statistical analysis, see also the following chapters:
Discrete Event
283
Gathering statistics
The Statistics block (Value library) accumulates data and calculates statistics for a particular type of
block using a specified statistical method. In addition to the block number, block name, and the
time the information was observed, this block displays metrics that are specific to the block type,
such as utilization or average wait time for activity-type blocks or the mean, variance, and standard
deviation of all the Mean & Variance blocks in the model.
The Queue Statistics model, located in the folder \Examples\Discrete Event\Statistics, uses the Statistics block to gather information about queues.
Since the Statistics block is used to gather information in continuous, discrete event, and discrete
rate models, it is discussed fully in Statistics on page 624.
Clearing statistics
At the start of a simulation run the queues are often empty and operations have nothing to process.
After the model has been running for a while, it gets to the point where it is functioning more like
the real system at normal operating levels. The interval from when the model starts to when it is
functioning in a steady or normal state is called the warm-up period.
In the Clearing Statistics model, statistics are cleared after 40 seconds, removing the warm-up
period for the model. This is seen by the utilization of 1 for Activity B when the model is run.
Unchecking the Clear activity statistics checkbox on the model worksheet causes the utilization of
Activity B to approach, but never actually reach, 1. This is due to the effect of the initial idleness of
the Activity B block at the start of the simulation run.
Discrete Event
The Clear Statistics block (Value library) is used to reset statistical accumulators for the blocks
specified in its dialog, eliminating the statistical bias of the warm-up period. For more information
about this block, see Clear Statistics on page 626.
284
Connect it in series by dragging a History block from the Item library and connecting it
between other blocks so that items pass through it.
Connect it in parallel by right-clicking an item output connector and selecting Add History
block. This automatically connects a History block to the original blocks item output connector. If a History block is added in this manner, only its input connector is used. (Caution: Be
sure there is an Item library block connected to the original blocks item output connector, otherwise its item will have no place to go.)
Each item that passes through the block (if it is connected in series) or is viewed by the block (if it
is connected in parallel) is allocated a row in the History blocks table. The tables first column displays the items arrival time. Popup menus at the top of the other columns are for selecting additional information to display, such as the value of an attribute, an items property, and so forth. You
can choose to save item history with the model, show string attributes, and display Calendar dates.
Discrete Event
Since the History block can use a lot of memory, put it in the model during testing, then remove it
when you have verified that the section is working as expected. To automatically remove all of the
blocks that have been added by right-clicking, right click one of them and select Delete all autocreated History blocks.
History model
The History model shows two
History blocks: one has been
physically placed in series between
a Queue and an Activity and one
has been auto-created and placed
in parallel to the Queue block.
Both blocks report the same information (the items arrival time and
the value of an attribute called
Item arrival), as shown in the
cloned table in the model window.
History model
285
Accumulating data
There are various methods you can use to accumulate data. Attributes can be used to hold cumulative values, such as the total weight of an assembly or the number of parts in a box. And the Holding Tank block (Value library) can accumulate total processing time to determine equipment
refurbishment schedules. Data can be accumulated at any step in the model, even when the item is
not being processed.
It is important to not make the error of assuming that you can combine attribute values and then
accumulate them. See Using the Holding Tank block to accumulate values on page 296 for more
information.
Non-Processing model
In the Non-Processing model, one part from Stock and another from Manufacturing are combined into an assembly. The stock part weighs 10 pounds and the manufactured part weighs
between 1 and 3 pounds. The model uses an attribute called Weight to track the weights of the
separate parts.
Non-Processing Model
Discrete Event
See the Air Freight with Item Log model for an example of using item logging. Also see the help
of the Item Log Manager block for a detailed example showing how it works.
286
The Properties tab of the Batch block is set to sum the values of the Weight attribute for the completed assembly. After the parts are batched, an Equation(I) block increments the Weight attribute
by 0.5 pounds. At the loading dock, the weight of the current item is displayed as it leaves.
Processing model
Discrete Event
If the data to be accumulated is dependent on processing, you can accumulate values using a Holding Tank block (Value library) connected to the PT (process time) connector on an Activity block.
For example, to accumulate the total amount of processing time parts required, as an indication of
when the processing equipment needs to be refurbished.
Processing model
In this model, each time an item leaves the Activity, its processing time will be added to the value
in the Holding Tank.
287
Comparing the weighted and un-weighted approaches to the average queue length reported in the
Queue blocks Results tab, it is clear that not using time weighted statistics would give an incorrect
answer for this model.
Discrete Event
Discrete Event
288
290
This chapter provides some tips, techniques, and information you may find helpful when building
discrete event models. The chapter covers:
Moving items through a simulation
How items move: holding and pushing. viewing and pulling
Implications of connecting to multiple item inputs
An items travel time
Using scaling for a large number of items
Preprocessing
Restricting items in a system
Connecting to the select connector
Issues for continuous blocks in discrete event models
Setting time-based parameters using a Random Number or Lookup Table block
Discrete Event
291
Unwise:
Wise:
Of course, if the Activity has an infinite capacity, it is not necessary to place a queue after the Create block.
A Create block set to Create items infinitely should never be connected to an infinite capacity
queue, since generating an infinite supply of items would overwhelm the system.
Pulling and viewing
There are two ways a blocks item input connector can have access to an item: it can pull an item
from the preceding block (as most connectors do), or it can simply view an item that is waiting at
the item output of the preceding block. If an item input connector pulls an item in, it has access to
the item for processing. However, if an item input connector only views items, it does not have
direct access to them, it can only sense their presence at the preceding output connector.
The particular connectors that only view items (not pull them) are:
The Gate blocks sensor connector when it is set to Type: area gating or its demand connector
when the block is set to Type: conditional gating with items.
The item input connector on the History block, if the block has been added in parallel to
another block. This is shown below and described in Using the History block to get item information on page 283.
Discrete Event
292
Error:
OK:
Discrete Event
293
While scaling can sometimes be a useful approach, the Rate library is specifically designed to
model high volume and/or high speed systems. In most cases, using the Rate library is superior to
item scaling. The Rate library is available with the ExtendSim AT and Suite products.
Preprocessing
Preprocessing
If there are many items in the Resource Item block, the status bar may show the phrase Initializing Data. As soon as the preprocessing is done, the timer will settle into a more useful number.
Discrete Event
You sometimes want to have all the items available at the beginning of a simulation instead of generating them as the simulation proceeds. For instance, if you need some random orders presented
to the model in sorted order, you might want to sort them before the simulation starts. This is difficult under normal circumstances since the first order would begin traveling through the simulation as the second one was being created. There is an easy method that will cause ExtendSim to
create lots of items, store them in a queue, and release them.
294
Another, more flexible, approach is to use a Resource Pool block to restrict items in a section of the
model. This is useful when you need to track statistics on utilization, or if you have multiple flows
of items accessing the same physical space.
Discrete Event
295
Some Value library blocks, such as the Clear Statistics and the Lookup Table, do generate events in
a discrete event model because they need to perform a specific action at a scheduled time.
To prevent modeling errors, it is helpful to understand this relationship between Item and Value
library blocks. Common situations where this is important include:
1) Setting time-based parameters using connections from a Random Number or Lookup table
block. This is described on page 295.
2) Varying an argument for a Create blocks distribution with a Lookup Table where there is the
possibility of a message being ignored. This can cause a lot fewer items to be created than
expected, as discussed on page 296.
3) Using a Holding Tank block to accumulate the result of a calculation performed on two or
more values coming from Item library blocks. If not modeled properly, the Holding Tank can
get duplicate messages and will have incorrect results. This is described on page 296.
For a detailed discussion about messaging between discrete event and continuous blocks, see
Value input and output connector messages on page 305.
Some time-based parameters can be set using a connector value. In these situations, the value sent
to the input connector must be defined in the time unit specified in the receiving block. The following examples illustrate issues you should be aware of.
Random Number block
Assume you want the delay for an Activity block to be approximately 30 minutes and you connect
a Random Number block to the Activitys D input connector. If the local unit of time for the
Activity is minutes, you would set the Random Number block to generate numbers with a mean of
30. However, if the Activity block used hours as its local time unit, the Random Number block
should be set to generate numbers with a mean of 0.5.
It is a modeling error to expect the Random Number block to create random values at each event
in a discrete event model. The only time this Value library block will be activated to output a new
value is when it receives a message on one of its connectors. In the above example, the Random
Number block will get a message each time an item arrives to the Activity block, so each item will
get a random delay time. For more information, see Value input and output connector messages
on page 305.
Lookup Table block
It is possible that the numbers in one column of a block are based on the time unit for that block,
and the numbers in another of its columns are based on the time unit for a second block. An
example of this is described in Choosing time units for the columns on page 117.
Discrete Event
296
between releasing items, the Create block will not react to changes in the input parameters. If the
inputs change drastically, this can cause unexpected results as shown in the following example.
Lookup Table example
Assume you connect a Lookup Table block to the mean
input connector of a Create bock, varying the interarrival
mean according to the schedule in the table at right.
Discrete Event
297
blocks. Since the values of attribute A and attribute B are both 1, the accumulated total displayed
on the Display Value block should only be twice the value displayed in the Exit block; clearly this
is not the case in this model.
The Attributes Error model includes four examples: the problem and the three solutions discussed
below.
Solution #1: two Holding Tank blocks
One way to solve this problem is to accumulate the
attributes values separately using two Holding Tank
blocks. The contents of the Holding Tanks are then
added together. This prevents the double counting
of the previous example, because each Holding Tank
block receives only one message and value per item
that passes through the Get block it is attached to.
Solution #2: the Equation(I) block
Another solutions is to perform the calculation in the Equation(I)
block (Item library). The Equation(I) sums up and accumulates the
attributes in one step, so it avoids the double messaging problem altogether. The equation entered is:
Accumulate = Accumulate + a + b;
Result = Accumulate;
where accumulate is a static variable and a and b are the two attribute values from the item entering
the Equation(I) block. The equation adds the two attribute values to the accumulated value, then
sets the output to the accumulated value.
As an alternative, instead of both summing the attributes and accumulating, the Equation(I) could
just sum the attributes and output that value to a connected Holding Tank.
Discrete Event
The reason for the modeling problem shown above involves the message passing system in discrete
event models. Individual items travel through the Get blocks sequentially. As an item passes
through the first Get block, the block sends a message and the value of the attribute to the Math
block (Value library). The Math block then recalculates and sends a message and the value to the
Holding Tank block (Value library). When the item moves to the second Get block, it will send a
message to the Math block again. This causes the Holding Tank block to get two messages and two
values for each item that passes through the system. This kind of problem will occur in any discrete
event system where there are multiple connections to a Holding Tank block (either directly, or
indirectly as shown above) or if one Get block was used with two outputs.
298
Discrete Event
Cycle timing
The amount of time one block takes to process an item is known as the delay or processing time.
Cycle time is the time an item takes to travel through a group of blocks. If there is no blocking in a
model (that is, if all items leave their blocks exactly at the end of their delay time), the cycle time is
the sum of the delay times for the section being measured. In most situations, this would rarely
occur, and cycle time is usually more than the sum of the processing times. For instance, it is common that an item cannot leave a block because the next block is still processing its item.
To track an items cycle time, use either the Timing attribute feature (if the item is being tracked
from its origin) or a Set or Equation(I) block with an Information block (if the item is being
tracked from some place other than its origin).
These methods are discussed below. In each case,
the Information block reads the attribute and calculates the difference between when the item
started the cycle and when it ended. The dialog of
the Information block displays the current, average, minimum, and maximum cycle time for all
items with the specified attribute. Its output con- Cycle time portion of Information dialog
nectors report the count of items, the time
between items, their cycle time, and the throughput rate.
299
from when items were first created to when they finish being primed. This includes the time items
wait in the Queue.
Cycle Time 2
Discrete Event
300
A table in the Flow Attributes tab is used to enter a descriptive text label (string) for each
potential attribute value for a selected string layer attribute. For more information, see
Flow attributes on page 339.
Other tables in the Flow Attributes tab allow you to select a flow layer attribute for renaming or deleting, and display blocks that use the selected attribute.
Manage flow units and select global and advanced options for discrete rate models. For more
information, see Global and advanced options in the Executive on page 422.
Set information for the LP solver used in discrete rate models. For more information, see LP
technology on page 434.
Unless you use string attributes, it is rare that you would need to make any changes in the Executives dialog. Most of its options are for advanced users.
Templates
Discrete Event
The Item Templates library contains templatessubmodels within hierarchical blocks for common modeling situations such as emptying a queue at intervals or selecting the shortest queue.
Block types
As discussed on Item connector messages on page 307, Item library blocks pass messages
through item connectors. There are three types of item-based blocks that determine how the item
connector messages are handled:
Residence-type blocks are able to contain or hold items for some duration of simulation time.
Some residence blocks post events and some do not.
Passing-type blocks pass item through without holding them for any length of simulation time.
These blocks implement modeling operations that are not time-based; they usually do not post
future events.
Decision-type blocks route the items through the model. These blocks choose a route based on
an item property, a random value, a sequence, or an input from a connector. Depending on
what options are selected in the block, a decision-type block may or may not be able to hold
onto items.
Why block types matter
Knowing these categories of blocks and how they relate to the processing of items will help you to
build better models. For example an item will not enter a passing block before it has been determined that there is space in the next downstream residence block. And when you debug models it
is useful to understand where the items can reside for any amount of time, as well as the time
required for an item to move from one residence block in the model to another. In addition, some
of the options in the blocks refer to specific block types. An example of this is the Transport block
where you can specify that the distance to the next block is from the Transport block to the next
non-passing (residence or decision) type block.
301
Block
Type
Activity
Residence
Queue Matching
Residence
Batch
Residence
Read(I)
Passing
Catch Item
Passing
Resource Item
Residence
Convey Item
Residence
Resource Pool
N/A
Cost By Item
Passing
Passing
Cost Stats
N/A
Select Item In
Decision
Create
Residence
Decision/Residence*
Equation(I)
Passing
Set
Passing
Executive
N/A
Shift
N/A
Exit
Residence
Shutdown
Residence
Gate
Decision
Throw Item
Passing
Get
Passing
Transport
Residence
History
Passing
Unbatch
Residence
Information
Passing
Workstation
Residence
Queue
Residence
Write(I)
Passing
Queue Equation
Residence
* If an item is allowed into the Select Item Out block before the decision is made (see the dialog
check box), then it is a residence-type block. If the decision is made before the item enters the
block, then it is a decision-type block.
Meaning
Delta
Count
AD
AS
Activity status
BT
Blocked time
Discrete Event
Block
Discrete Event
302
Connector
Meaning
CI
Confidence interval
CT
Cycle time
Delay (Activity)
DB
ExtendSim database
DT
DV
F
LO
MG
NB
P
Number blocked
PE
Preempt
PT
Process time
Quantity
RS
Reset
SD
Shut down
Priority
TBF
TP
TTR
U
UV
W
Utilization
Up value (Shutdown)
Wait time for items leaving the queue
Event scheduling
ExtendSim moves items in a discrete event model only when an event happens. Events are controlled by the Executive block and only occur when particular blocks specify that they should.
Blocks that depend on time cause events to happen at the appropriate time. For instance, an Activ-
303
ity block holding an item until a particular time will cause an event to be posted to the ExtendSim
internal event calendar. When the time is reached, the event occurs and the model recalculates its
data.
Blocks that do not generate events allow the blocks after them to pull items during a single event.
Thus a single event can cause an item to pass through many blocks if those blocks do not stop
them. For instance, a Set block could set the items attribute and pass the item to the next block in
the same event.
Discrete event and discrete rate simulations use the same method for updating the simulation
clock. Simulation models of this type are driven forward by event and the state of the model
changes only at event times.
At each event, blocks that have posted an event to the event calendar for the current time receive a
message notifying them that the time has arrived. Once all of the blocks have received their messages, the time for the next event is determined. Through this event scheduling mechanism the
simulation clock jumps from one event to the next.
Event calendars
This two-stage event calendar is very efficient and flexible. Unlike single stage event calendars, relatively little time is spent by the Executive in maintaining and searching the event list.
The Executive
The Executive block maintains a list of all event times for the model in its event calendar. At the
beginning of each simulation event, the Executive locates the next future event and sends a message to each of the blocks in sequence that posted an event for that time. Once a block has completed processing its event, it will post its next event time to the Executive. If the block does not
have a future event time, it will post a very large value as its next event time, effectively removing it
from the list of pending events.
Blocks may have two or more entries on the Executives event calendar. This is because they have
different types of events that need to be processed. For example the Convey Item block has an
event that occurs when an item is able to enter the block and an event for when the item leaves the
block.
For more information about the Executive block, see page 299.
Internal event calendars
Each block that has a time delay associated with it (for example the Create, Activity, Pulse, and
Shutdown blocks in the Item library) maintains its own, independent next event time.
Blocks such as the Activity, Convey, or Shutdown block can have multiple future events (one event
for each item in the block) ongoing simultaneously. In this case, the blocks maintain their own
internal event calendar, posting only the earliest of these events to the Executive's event calendar.
Discrete Event
ExtendSim utilizes a two-stage event calendaring method the Executive block maintains a list of
all events for the model and time-delay blocks maintain their own event calendars.
304
A prime example of this is the Queue block. When an item arrives to a Queue, a zero time event is
posted so that the Queue can return control to the upstream block that sent the item. The Queue
receives another message before the clock advances so that an attempt can be made to send the
item to the next downstream block. This feature enhances the efficiency and predictability of discrete event models.
Discrete Event
The Create block posts an event for the creation of each item. The time between item arrivals is
0.6.
The Activity 1 block posts an event for the earliest completion time of an item in the block. The
duration of this activity is 1.0.
The Activity 2 block posts an event for the earliest completion time of an item in the block. The
duration of this activity is 0.5
As the simulation progresses through time, the event calendar in the Executive might look like this:
Time
0.0
0.0
Infinity
Infinity
Item #1 is created
0.0
0.6
1.0
Infinity
0.6
1.2
1.0
Infinity
Item #2 is created
1.0
1.2
2.0
1.5
1.2
1.8
2.0
1.5
Item #3 is created
1.5
1.8
2.0
Infinity
1.8
2.4
2.0
Infinity
Item #4 is created
2.0
2.4
3.0
2.5
2.4
3.0
3.0
2.5
Item #5 is created
Notice how the next event time is always the lowest of all of the event times for all the blocks; this
is how a discrete event simulation works. Also, the table illustrates the concept of event scheduling
but does not show all of the detail of what is happening as the items move through the blocks. For
example, the Queue schedules a zero time current event as it moves the item through, but this is
not shown in the table.
305
Block messages
Discrete event blocks have a sophisticated messaging structure for communicating with each other
and with blocks in the Value and Rate libraries. These messages can be categorized as:
Event
Value connector
Item connector
Block-to-block
A future event message occurs when the simulation clock reaches a time posted by a block. For
example, when an item enters an activity, the activity will post a future event to the Executive
corresponding to the items finished time. Once the simulation clock has advanced to this
future event, the Executive sends an event message to the activity, alerting it that the item has
finished processing.
A current event message occurs when a block wants to be activated before the simulation clock
advances, but after it has completed its response to another message. For example, a queue will
post a current event message to the Executive as it is pulling in items. After all the items have
arrived to the queue, the Executive sends a current event message to the queue. This signals the
queue to try and push all the items out of the block.
The only blocks in the Value library that post future events are the ones that provide values or perform actions at specific times. Examples are the Clear Statistics block that resets the simulation statistics at a scheduled time and the Lookup Table block that provides values at scheduled times.
Other Value library blocks lie dormant during a discrete event simulation unless they receive an
activating message (either directly or indirectly through another block) from an Item library block.
Value input and output connector messages
Blocks in a discrete event model send value connector messages either because a new number is
needed by an input connector or because the value of an output connector has changed. These
messages either request updated information for the input connectors or notify connected blocks
that the output value has changed.
When a message is sent from an input value connector, the sending block requests an updated
connector value from the receiving blocks. Messages sent out the input connectors go only to
the outputs of the directly connected blocks.
Discrete Event
Event messages
Event messages communicate between the Executive block and Item library blocks in a model. In a
discrete event model the simulation clock advances from one event to another. Each time the clock
advances, the Executive block sends event messages to the Item library blocks that have associated
themselves with that event. There are two types of events: future and current.
306
Whenever an output connector changes, messages are sent to all of the inputs of the directly
connected blocks. In this case, the sending block alerts the receiving blocks of a connector value
change. Blocks that receive messages at their input connectors may, if appropriate, propagate
messages:
Out other input connectors to make sure that all input values are current
To their output connectors to notify other blocks of the change in value
Discrete Event
Through this mechanism, a single value change may cause any number of connected blocks to
recalculate, ensuring that any system dependencies are automatically evaluated. For example, if the
value of an input connector on an equation-type block changes, messages are first sent out the
other input value connectors if they are connected (ensuring the equation will have up-to-date
inputs prior to calculation.) Then, with updated inputs, the block recalculates its equation and
posts the new results on its output value connectors. Once the new results have been posted, messages are sent out the output connectors, alerting any connected blocks that the results have
changed.
Example of value connector messaging
The sample model shown below illustrates how value connector messages work. In this example,
items arrive, an attribute is set to a random number, and the items are then processed at two work
areas (Queue and Activity blocks) in series. Three Value library blocks (Random Number, Math,
and Display Value) provide a random number for the attribute value, add the two queue lengths,
and display the sum of the lengths, respectively.
When an item arrives to the Set block a message is sent out its value input
connector. The Random Number block responds by providing a new random
number each time it receives a message. This simple messaging example is
shown at the right.
In a discrete event or discrete rate model, the only time most Value library
blocks (such as the Random Number block) are alerted to do something is
when they receive a message on one of their value connectors. For instance, do
not expect the Random Number block to continuously output a stream of
random numbers in discrete event or discrete rate models.
In the more complex messaging case that
is shown to the right, when an item
arrives at the first queue its length will
increase by 1. Since this changes the
blocks L (length) output connector,
Queue 1 sends a message to all inputs
connected to L (in this case the Math
block). When the Math block receives
this message, it sends a message to the L
307
connector at Queue 2, ensuring that both inputs are up-to-date before any calculation is made.
The values of the two length connectors are then added together and a third message is sent to the
Display Value block, which then updates its animation and dialog.
Item connector messages
Item connector messages (primarily wants, needs, and rejects) propel items through the model.
These messages use a conversation of messages to move items from one block to another. This
mechanism allows for items to be both pushed and pulled from one block to the next. How these
messages are handled depends on whether the block is a passing, residence, or decision block (see
Cycle timing on page 298.)
Pushing items
In the case of pushing, the upstream block first sends a wants message.
If the downstream block is a passing block, it forwards the message to the next downstream
block through its output connector.
If the downstream block is a decision block, it determines the status of the decision and any
downstream blocks. It often does this by sending additional item or value messages and then
responding with a needs or rejects.
Create sends
w ants to
downstream block
No
Passing Block
Do I need an
item?
Need Item
Yes
Reject Item
Send wants to
next downstr eam
block
Pulling items
To pull an item, a residence block sends the wants message upstream. This wants message is passed
through the passing and decision blocks until it reaches a residence block. If the residence block
has an item that is ready to leave, then a needs message is returned. If no item is available, then the
residence block rejects the wants message.
Discrete Event
If the downstream block is a residence block, it responds with either a needs message (if it can
accept an item) or a rejects message (if it is unable to accept an item based on its status).
308
Passing or
decision block
No
Do I have an
item?
Item needs to
be taken
Yes
No item,
reject wants
Send wants to
next upstream
block
Discrete Event
This is only the first step in the process of moving an item. A number of messages follow that propel the item through the network of blocks. More details about those messages can be found in the
Developer Reference.
Block-to-block messages
Block-to-block messages update the status of other blocks in the model. Sometimes a block needs
to communicate with another block in the model, but there is no direct connection between them.
For example, if a change in the shift status occurs, a Shift block needs to notify all of the blocks
that reference that shift. These messages are sent through the air to the blocks. In most cases, you
will not even be aware that these messages are being passed back and forth. The actual operation
and context of the message depends on the blocks involved in the conversation.
Introduction
Some things to know before you start
modeling discrete rate systems
310
Introduction
What this chapter covers
Discrete rate modeling is based on rates of flow that change when events occur. In a discrete rate
system, quantities of flow (material, product, data, etc.) are located in one or more parts of the
model. During the simulation run, the flow moves from one location to another at a certain speed,
called the effective rate. The movement between blocks that hold or route the flow follows paths,
rules, and constraints that are set in the model.
Discrete Rate
As discussed in Modeling methodologies on page 43, the primary modeling approaches are continuous, discrete event, and discrete rate. In some situations (listed later in this chapter), simulating a system using discrete rate modeling is a more natural fit compared to using continuous or
discrete event modeling. Processes that are event driven, rather than time driven, do not lend
themselves to continuous simulation. Systems where there is no item that can be identified, or
when there are so many items that identification is meaningless, can be more naturally represented
using a rate-based approach rather than discrete event modeling. Furthermore, rate-based models
run faster than discrete event models and are applicable to thinking in terms of flows, tanks, rates,
and so forth.
Any system or process that involves a quantity of something that is stored at one place, then moves
to another place at a rate per time unit, can be simulated using discrete rate modeling.
Like continuous and discrete event modeling, rate-based modeling can help you perfect processes
and products. It is useful for planning resource capacity by determining the rate at which products
are being processed or sold. It is helpful for testing various schedules to maximize process efficiency. And it can be used to analyze the effect of processes on the internal and external environment.
For information about discrete rate modeling in general, including how it differs from continuous
and discrete event modeling, see Modeling methodologies on page 43.
Introduction
Simulating discrete rate systems
311
Mining
Water Treatment
Pharmaceutical
Metallurgy
Electric power transmissions
Any other industry that processes commodities in bulk or batches
To model things that are so numerous that it would be inconvenient or overwhelming to
model them individually:
Food and beverages (tea bags, cereals, soda cans, cheese)
Drugs, cosmetics, and biotech (pills, bottles of lotion)
Milling (carpet and paper)
Data storage and manipulation (samples, messages, packets)
Any other industry that mixes, fills, or packages products on high-volume or high-speed
lines
As will be seen in the Discrete Rate Tutorial, it is common for discrete rate models to also include
portions that are discrete event processes.
Discrete Rate
Thus discrete rate models simulate flows that are either homogeneous (identical goods that are the
same throughout and do not vary in essential characteristics) or heterogeneous (numerous items
that are clearly distinct, but cannot be easily sorted or separated).
312
Introduction
Simulating discrete rate systems
neously from one point in the model to another; this is never correct. For this reason, flow
movement must be constrained by rates and conditions that are built into the model, and a lack
of appropriate constraints is a modeling error that will stop the simulation run.
Discrete Rate
The discrete rate architecture maximizes the movement of flow. Unless limited in some manner,
flow would approach infinity and overwhelm the system. Because the discrete rate architecture
maximizes the movement of flow, every model must contain one or more constraints (typically a
Valve) to limit the rate of flow to something less than infinity. Some examples of constraints
include the presence or absence of flow in a Tank, the maximum flow rate defined by a Valve
block, and the rule chosen to distribute flow in a Diverge block.
While constraints determine the maximum rate that flow can move, the effective rate is the
actual rate of movement. The effective rate for each section of the model is determined using
linear programming (LP), given the set of constraints that has been defined by the model's structure. The models set of effective rates define how fast flow actually moves from one section of
the model to another. As the simulation clock advances from one event to the next, the quantity
of flow which has moved is updated.
The state of a discrete rate model changes only when an event occurs. An event might be a Tank
that becomes empty or full, a maximum rate that changes during the run, a block that changes
its output proportions, and so forth. Each time an event occurs, ExtendSim makes a calculation
to determine, at that moment, what the effective rates are in each part of the model. Any portion
of the model that can potentially be impacted by the new event has its effective rates recalculated. This takes into consideration the constraints put on the rates, the location of the flow, and
storage capacity in the system.
Each discrete rate model is conceptually divided into unit groups, rate sections, and LP areas.
These divisions are handled automatically and internally, and are determined by the type of
blocks used in a model, how the blocks are connected, the settings in the blocks, and so forth.
Unit groups are introduced on page 315, rate sections are described on page 357, and LP areas
are discussed on page 360.
A connection between two rate-based blocks can thus be viewed as an infinitely small pipe that is
always full of something at a constant pressure as soon as the effective rate is more than 0, the
pipes contents move at the highest rate possible based on all the constraints given by the system.
When the effective rate is 0, the pipe is still full but the flow instantly stops.
Introduction
Blocks for building discrete rate models
313
While the ExtendSim discrete rate architecture preserves mass balance in the system, no explicit
consideration is given to pressure, energy, momentum, or temperature, since these are beyond its
scope.
Rate library
The Rate library allows you to simulate a wide range of flow systems by
connecting blocks together and entering parameters. The complexity of calculating the effective flow rate and the generation of events that dictate a
new rate calculation are handled within the blocks, alleviating the need to
do any programming in the ModL language.
The blocks in the Rate library can be categorized as follows:
Some blocks hold and provide flow
Other blocks impact the effective rate of the flow
The remaining blocks are for routing flow
As mentioned in the Tutorial module, discrete rate models can use continuRate library blocks
ous blocks from the Value library for data management and model-specific
tasks. Using Value blocks with Rate library blocks does not change the fundamental architecture of discrete rate models; they will still be event-based rather than use the
time-based architecture of continuous models. Discrete event blocks from the Item library can also
be used in discrete rate models; they are helpful for representing entities such as tankers, airplanes,
people, and so forth that interface with flow.
See Rate Library Blocks on page 837, Item Library Blocks on page 829, and Value Library
Blocks on page 821 for a listing and brief description of the blocks in those libraries.
Discrete Rate
These blocks are optimized for modeling anything flowing through a system. They incorporate concepts like constraints, goals, flow prioritization,
mixing, batching, unbatching, level indicators, and so forth. The blocks
have been designed to meet most rate-based flow needs so you can quickly
and easily perform complex high-volume/high-speed modeling tasks.
314
Introduction
Terminology and architecture
LP technology
To provide global oversight to calculate the effective rates in a discrete rate model, ExtendSim uses
linear programming (LP) technology. The purpose of the LP calculation is to determine the maximum effective flow rates in the system given the constraints defined by block settings and the
structure of the model. After all the rules for storage capacity and movement have been declared in
the model, ExtendSim uses the LP calculation to cause as much flow as possible to move through
the system. This calculation is handled automatically and internally. For more information, see the
advanced topic LP technology on page 434.
Since ExtendSim will always try to maximize the flow, causing the rate of flow to approach infinity
in the absence of any constraints, it is important to place upper limits on the flow at strategic locations throughout the model. Otherwise, the flow would move instantaneously from one part of the
model to another; this would be a modeling error.
Executive block
Discrete Rate
The Executive block (Item library) does event scheduling and makes the LP calculation for rate-based models. It must be present in every discrete rate model and it must
be placed to the left of all the other blocks in the model.
In addition to the information discussed on page 299, the Executive plays a special
Executive
role in discrete rate simulations. The blocks Discrete Rate tab allows you to set global
options for discrete rate models, manage quantity units, and select advanced options
for specific Merge and Diverge modes. Its LP Solver tab has information about the linear program
(LP) that provides global oversight for discrete rate models.
The settings in the Discrete Rate tab are explained fully on page 422.
For most purposes you will not need to change the settings in the Executive block.
Line type
Introduction
Terminology and architecture
315
In a discrete rate model, flow connectors report the effective rate of the flow at each event. The
flow moves in one direction, from one blocks flow output (outflow) connector to another
blocks flow input (inflow) connector.
Value connectors provide information about the quantity of flow and a blocks capacity, as well
as information about the effects that the flow has in the model.
The item connectors on the Interchange block provide an interface between portions of the
model that are discrete rate and portions that are discrete event.
When combining discrete rate blocks with blocks from other libraries, you will only be able to
connect compatible connectors. To represent the flow from one block to another, an outflow connector has to be connected to an inflow connector. Each flow connector can have one and only one
flow connection. However, it is possible to connect an outflow connector to both an inflow and a
value input connector. In this case the value connector reads the effective rate from the connection.
A flow connection cannot be made with an item connector. For more information, see Connector
types on page 555.
Time units define how time is measured as the model run progresses. Like other ExtendSim
blocks, blocks in the Rate library can use the default global time unit or a local time unit. Hours,
minutes, and seconds are all examples of time units.
Calendar dates are not available if months or years have been selected as the specific global time
unit for a discrete rate model. Furthermore, if Calendar dates has been selected, Rate library blocks
will not be able to select Months or Years as their local time unit.
Length units specify how long something is; they are usually entered as feet, meters, and so
forth. The Convey Flow block has a length unit.
Block units are an internal unit of volume specific to the Tank and Interchange blocks. If you
select a block unit that differs from the flow units that come into and out of a block, you must
enter a conversion factor. The conversion factor represents the ratio of the block unit to the flow
unit.
A unit group is a collection of blocks connected together
through flow connections and sharing one flow unit. To see
the unit group, click the grey square to the right of a blocks
flow units popup menu. All the blocks in that blocks unit
group will be highlighted on the model worksheet.
For more information, see Units and unit groups on page 349.
Discrete Rate
316
Introduction
How the Discrete Rate module is organized
Rates
One of the most important aspects of a discrete rate model is the rate of flow. A rate is the ratio of
the flow units to the models time units. This is displayed in block dialogs as units/time, gallons/
minute, transactions/second, boxes/hour, and so forth.
Several different types of rates are considered during the model building process:
Maximum rate the upper limit of the rate of flow, as described on page 357.
Effective rate the actual rate of flow. See page 357 for more information.
Upstream supply and downstream demand potential rates. See page 440.
Infinite rate any value equal to or greater than a large specified number. See page 358 for more
information.
Discrete Rate
Chapters that discuss specific discrete rate modeling concepts and techniques:
Flow sources and properties
Flow storage
Flow movement: rates and constraints
Routing flow directly and remotely
Delaying flow using goals, hysteresis, and the Convey Flow block
Mixing flow and items
Bias, animation, and other miscellaneous concepts and features
Advanced topics such as LP technology, upstream supply and downstream demand, and messaging in discrete rate models.
It is important that you complete the chapters in the main ExtendSim Tutorial module that starts
on page 14 before you proceed to the Discrete Rate Tutorial. If you will use any item-based blocks
in your discrete rate models, it is also suggested that you complete the Discrete Event Tutorial that
starts on page 102.
318
The key to discrete rate modeling is constructing a flow diagram using blocks from the Rate library
to represent flows through the system. The Rate library is designed specifically for building discrete
rate models. Blocks from other ExtendSim libraries, especially the Item, Plotter, and Value libraries, are often used with the Rate library to create discrete rate models.
The example in this chapter shows how to build a discrete rate model of a yogurt process; it will
use many of the blocks from the Rate library. Starting with a simple model, then adding complexity and features, this chapter will show how to:
Build a model of a simple rate-based process
Add a maximum flow rate that varies with the time of day
Add a second supply of product that is occasionally shut down for maintenance
Mix the two supplies according to a proportion
Create a filling operation that puts the liquid yogurt into containers
Add a conveyor to simulate a cooling process
Package the containers into cartons
Create a palletization area where the cartons are stored
Add a second palletization area in parallel to the first
Discrete Rate
While this example model simulates a mixing, filling, and packaging process, the Rate library is
useful for simulating many diverse concepts and processes.
This tutorial assumes you have completed the chapters in the main Tutorial module that starts on
page 14 and that you have read the Discrete Rate Introduction that starts on page 310. It is also
suggested that you complete the Discrete Event Tutorial that starts on page 102.
319
The final Yogurt Production model, and the models that illustrate the steps described in this chapter, are located in the folder \Examples\Tutorials\Discrete Rate. To get the maximum benefit of
this tutorial, it is recommended that you build the models yourself.
As mentioned in the Introduction to this module, the Executive block does event scheduling and
manages discrete rate and discrete event simulations. It must be present in every discrete rate and
discrete event model.
Start small
In building any simulation model, it is easiest to start
with a simplified subset of the process and add detail
until you arrive at a completed representation of the
system that's being modeled. This allows you to test at
various stages while making the model building process more manageable.
The first step is to model a single line of production,
Basic yogurt production line
where one Tank holds product that moves to another
Tank at a constant rate. When you have finished this
portion of the tutorial, your model should look like the one shown above.
Discrete Rate
320
Purpose in Model
Tank
(Liquid Supply)
Acts as a source, intermediate storage, Contains an unlimited amount of liqor sink for the stuff of the model.
uids that can be processed into yogurt.
Valve
(Yogurt Process)
Acts as a constraint on flow. Controls, Regulates the flow of liquid at 100 galmonitors, and transfers the flow at a
lons per minute. (A constraint is
specified rate.
required; otherwise, the flow would
approach infinity!)
Tank
(Yogurt)
Discrete Rate
Block Function
Plotter,
Discrete Event
(Plotter)
Starting at the right of the Executive block, place the blocks on the model worksheet in a line
from left to right, based on their order in the above table.
An easy method for placing blocks on a model worksheet is to access an open library using the
Navigator as discussed in Library Window mode on page 771.
Making connections
To indicate the flow of product, connect the blocks flow connectors as follows:
Connect from the outflow connector on the first Tank (labeled Liquid Supply) to the Valves
inflow connector.
Connect from the Valves outflow connector to the second Tank (labeled Yogurt).
To gather information about the amount of yogurt processed:
Connect from the Yogurt tanks inflow connector to the top input on the plotter.
Connect from the Yogurt tanks LE (level of contents) value output connector to the plotters
second input.
When you are finished, the model should look like the one shown on page 319.
321
In the dialog of the Valve block, enter Maximum rate: 100 gallons/minute.
There are no entries to make for the Yogurt tank. Its default settings indicate that it has no initial contents and its maximum capacity is infinite, which is what you want.
Discrete Rate
In this model, the plotter will display the Valves maximum rate on its top input and the number of
gallons of yogurt processed on the second input. Since the scaling for these numbers is so different,
the plotters graph needs to be adjusted. To do this:
322
Verifying results
This is a good opportunity to verify the
results. There is never any change to the
rate of flow, so there is no need for the
model to recalculate the effective rate. This
means that the simulation is finished in two
events: the start event and the end event.
The plotter indicates that the effective rate
is 100 and a total of 48,000 gallons of
product (shown on the Y2 axis) have been
produced in the process. This makes sense
because the assumptions were that 100 gallons of yogurt would be produced per minute and the simulation time is 480 minutes.
Plot of simulation
Discrete Rate
323
The Lookup Table block will actively output values at each specified time, based on entries in the
table in its dialog, and does not need to be prompted for output. This is discussed in Polling constraints on page 363.
Delete the connection from the Valve to the Yogurt tank and move the tank to the right.
Below the Lookup Table block of the yogurt processing line, add another Tank block to the
model.
In the blocks Tank tab, check the checkbox in the field labeled Initial contents, causing
the initial contents to be infinite.
because it is connected to the Tank. (If you had not first connected the Tank to the Valve, you
could select gallons as the units in the Options tab.)
In the Merge tab of the blocks dialog, select Converge mode: proportional from the
popup menu.
In the Proportion column of the Merge blocks dialog table, enter 9 for the Yogurt Process
and 1 for the Fruit Process.
Discrete Rate
324
When you run the model, the mixing process should output 80 gallons per minute and the entire
process will yield about 37,600 gallons of yogurt. This is an interesting model to run with animation on. (Be sure to have animation set to the slowest speed.) When you do this, the rate displayed
at the top of the Yogurt Process icon is sometimes displayed as the fraction 72/100. This is the
ratio of the effective rate to the Valves maximum rate. In this model, there is sometimes not
enough fruit and the entire process becomes constrained, so the effective rate can be less than the
specified maximum rate.
In validating the model, notice that the effective rate for the yogurt part of the process can never be
higher than 72. Since the maximum output of the fruit process is 8 gallons per minute, and the
mixing process requires a ratio of 9 portions of plain yogurt to 1 portion of fruit, the maximum
amount of plain yogurt that can be required is 72 (8*9) gallons per minute.
A complete description of the animation information shown on the icons for Rate library blocks is
given on Animation on page 428.
Add maintenance
A common situation is for a process to have a slow production rate when some of the equipment is
down for maintenance and a faster rate the rest of the time.
Discrete Rate
The fruit process has a slow rate of 2 gallons per minute during equipment maintenance and a
normal rate of 8 gallons per minute. Maintenance occurs approximately every 60 minutes with a
random duration of a minimum of 5 minutes, a maximum of 20 minutes, and a mostly likely time
of 15 minutes. To reflect this:
Add a Shutdown block (Item library) to the model. There are two
ways to do this:
Click the Add Shutdown button in the Valves dialog. This automatically connects a Shutdown block to the Valves R (maximum
rate) input connector and opens the Shutdowns dialog.
Place the Shutdown block on the worksheet from the Rate library.
If you do this, connect the output of the Shutdown block to the
Fruit Process Valves R (maximum rate) value input connector.
Like the Lookup Table block, the Shutdown block outputs its information without being
prompted. Thus the Valve does not need to ask it for data and it should not be set to poll constraints. Polling constraints is discussed more on page 363.
When you run the model with animation on, notice that the Valve is partially shut down for maintenance a random amount of time and that its maximum rate is reduced to 2 gallons/minute during maintenance. Also notice that fewer gallons of yogurt are produced during the process than
before the Shutdown block was added.
325
So that each gallon will result in 12 containers, enter Conversion factor: 12 containers/
gallons. (Be sure to select containers/gallons from the popup menu.)
If you check the box for Show unit change on icon in the Change Units dialog, the area
above the icon will display the text gallons=>containers.
After the settings have been entered, the dialog of the Change Units block should look like the following:
When the model is run, the number of yogurt containers produced each minute, and thus the
total number of containers processed, will vary depending on the Valves maximum rate and the
flow restrictions caused when there is not enough fruit for the mix. Although it may vary from the
example model, the plotter should indicate that approximately 370,000 containers of yogurt were
produced. This makes sense because, as the Results tab in the Merge block shows, the process produced about 30,000 gallons of yogurt.
At the end of the simulation run, holding the cursor over each outflow connector will show the
final rate at that connector. For example, when the Yogurt Process has an effective rate of 72 gallons per minute, the Fruit Process will have a rate of 8 gallons per minute, the Mixing block will
Discrete Rate
326
indicate that 80 gallons of mix were produced that minute, and the Change Units blocks output
will show that 960 (80 * 12) containers of yogurt were packaged.
This model assumes that the process of pouring yogurt into containers occurs at the same rate as
the process of mixing the plain yogurt with the fruit. In this case, the packaging process does not
slow down the rest of the process. To model a packaging process that would have an impact on the
rest of the process, connect a Valve between the Merge and Change Units blocks and enter the
appropriate packaging rate.
Delete the flow connection from the Change Units block to the Yogurt tank.
Add a Convey Flow block to the model and connect it between the Change Units block and the
Yogurt tank.
Notice that if you make these connections first, the correct flow unit (containers) is automatically selected in the new blocks Options tab.
327
When you run this model, notice that there is no product flowing into the Yogurt tank for the first
20 minutes. This happens because it takes that long for the first containers to leave the refrigeration unit represented by the Convey Flow block. This causes starving in the downstream portion
of the model that follows the Convey Flow block. Because it takes longer to get the finished product, fewer containers get produced than in the previous model.
Although it doesnt happen in this model, if the Convey Flow block were full, it could slow down
the upstream processes that feed into it. This is known as blocking.
While the use of the Convey Flow block is appropriate for this model, be careful about placing too
many Convey Flow blocks in a model as they are computationally intensive. The Convey Flow
block should only be used if the system requires precise tracking of flow movement. A Valve and a
Tank can often be used instead, with less impact on simulation speed. For more information, see
When to avoid using the Convey Flow block on page 403.
Delete the flow connection between the Cooling Cycle and the Yogurt tank.
Add a second Change Units block to the model;
Connect it between the block labeled Cooling Cycle and the block labeled Yogurt.
In the blocks
units from:
containers).
In the popup
Discrete Rate
dialog, do
not change
the first setting (Change
for the second unit setting (to: containers), select New Unit and name the new flow unit cartons.
So that each carton will hold 48 containers, enter Conversion factor: 48 containers/cartons.
If you check the box for Show unit change on icon, the area above the icon will display
the text containers=>cartons.
Label the new block Change Unit 2.
328
If you clone the plot pane onto the model worksheet, your model should be similar to the following:
Discrete Rate
Although the amounts will vary depending on the yogurt processs constraint rate and the potential
unavailability of fruit due to maintenance, when you run the model it should result in approximately 8,000 cartons. (Each carton holds 48 containers and the process should have produced
about 390,000 containers of yogurt.)
The Interchange block is discussed more fully in Using the Interchange block to mix items with
flow on page 410.
Adding a palletizing area to the model
Delete the Yogurt tank.
329
In its dialog, set the behavior of the Create block to Create items randomly, choose the Constant distribution, and enter constant: 2. This causes one item/pallet to be available every 2
minutes.
There are no changes required for the Queue block. It is already set to hold items in a first in,
first out manner.
In the Item/Flow tab of the Interchange block, define item behavior (Item is Tank) by making
the following entries:
On arrival, Item/Tank capacity is: a constant 24 cartons. (Be sure to enter the number
Release item: when tank contents Level (load process).
Define Level: full.
With these settings, the Interchange block has a capacity of 24 cartons each time it gets a new
item, which represents an empty pallet. Once 24 cartons of yogurt have arrived through its flow
connector, the blocks Level will be full and the item (now representing a full pallet with 24 cartons) will be released. The Interchange block will then try to access another empty pallet; the
yogurt process will stop until an empty pallet is available.
Discrete Rate
24.)
330
When you are finished with this section, the model should look like:
Discrete Rate
When you run this model, you should see an almost solid block of color on the plotters plot pane.
This is caused by the plot line being repeatedly redrawn as the effective rate goes from a high of
about 52 cartons per minute to 0 and back again. To see this, stretch the plot wider until you can
see some white areas between the colored areas. These white areas occur when the effective rate is
0. In this model, pallets arent arriving quickly enough and the process is slowed from what it could
be and frequently stops. One way to solve this would be to have two palletizing areas.
Select the 4 blocks in the palletizing area and give the Edit > Duplicate command. This creates
a second set of blocks.
Move the 4 blocks that comprise the second palletizing area below the first area.
Label the new blocks Create 2, Queue 2, Interchange 2, and Exit 2.
Add a Diverge block to the right of the Change Unit 2 block:
Connect from the Change Unit 2 block to the Diverge.
Connect from the Diverge blocks top outflow connector to the inflow connector on the
Interchange 1 block
Connect from the Diverges second outflow connector to the inflow connector on the
Interchange 2 block.
In the dialog of the Diverge, notice that by default the block is set to Diverge mode: priority of outputs and that a priority of 1 is assigned to the top Interchange block and a priority
of 2 to the bottom Interchange block. Do not change these settings, since this is what you
want.
331
In this model, the top palletizing area has first priority for the cartons and the lower palletizing area
only receives product if the top area is busy. Unlike the previous model, the plotter indicates that
the effective rate of the process is hardly ever 0 cartons per minute.
The final model, named Yogurt Production, and the models for all the intermediate steps, are
located in the folder Examples\Tutorial\Discrete Rate.
Further exploration
Additional ways to enhance and explore this model include:
A Shift block could be added to the Convey Flow block, stopping the process at the end of the
day and causing the Convey Flow block to be emptied of product.
The palletization areas could include the time it takes to unload a full pallet and load an empty
pallet. Adding this type of changeover is shown in the Yogurt Changeover model on page 413.
The filling processes could be enhanced by adding delays for the filling, cleaning the equipment
and other maintenance.
Instead of assuming a generic fruit being added to the yogurt, use flow attributes to represent
different fruits. Flow attributes are discussed starting on page 339. The Yogurt Production with
Flavors model is located at Examples\Tutorials\Discrete Rate. The Yogurt Production with Flavors Plus model goes a step further and uses flow attributes and the item/flow attribute mapping
capability of the Interchange block to preempt items, avoiding mixed pallets of flavored yogurt.
Discrete Rate
Verify that the model is working as you expected by running it with animation on or by adding
a Pause Sim block (Utilities library) to the model and pausing each step. (Animating a discrete
rate model is described in Animation on page 428. The Pause Sim block is discussed in
Blocks that control or monitor simulation runs on page 583.) The final Yogurt Production
model located at Examples\Tutorials\Discrete Rate is animated and includes a Pause Sim block
so you can step through each event.
Discrete Rate
332
Creating Flow
Creating flow and giving it properties
334
Creating Flow
Blocks of interest
This chapter discusses creating and characterizing flow in a discrete rate model. It will cover:
Creating flow in the model
Using indicators to monitor the level of flow
Working with flow attributes
Blocks of interest
The following blocks from the Rate library will be the main focus of this chapter.
Discrete Rate
Tank
Acts as a source, intermediate storage, or final storage (sink). The block has a capacity and
can provide an initial quantity of flow for the simulation.
Creating flow
Flow is what is stored in and moves through a discrete rate system. It can be almost anything: oils
and chemicals, manufactured product, transactions, electricity, and so forth.
The Convey Flow, Interchange, and Tank blocks are residence-type blocks; they hold flow and can
serve as sources of flow for the model. There are two ways flow can be introduced into a discrete
rate model:
Creating Flow
Creating flow
335
1) By setting an initial contents for a Convey Flow, Interchange, or Tank block. These three residence blocks can be preloaded with initial amounts of flow, either a finite amount or, in the
case of the Tank and Interchange blocks, an infinite amount. Depending on the block and
options that are selected, the initial amount is:
Created by entering a constant number, or selecting infinite, in the blocks dialog
Entered in a table for each segment (Convey Flow block)
The attribute values for any number of initial layers (Tank block)
The value of an item attribute (Interchange block)
Getting the value from a ICO valuein connector (Interchange block)
2) Once an initial contents has been set, under certain conditions the contents of the Tank or
Interchange block can be changed during the simulation run. An example is the Interchange
block when it is set to Tank only exists while item is in it. In this case, you can choose to have
each arriving item reestablish the initial contents.
When a Tank or Interchange block changes state between empty and not empty, ExtendSim will
calculate a new set of effective rates. For more information about rates, see Rates, rate sections,
and the LP area on page 357.
The Convey Flow block has a different mechanism for calculating a change of state between empty
and not-empty. For more information, see the Delaying Flow chapter.
Tank initialization
A Tanks initial contents can be:
Entered in the dialog as:
0 (the default)
A number
Infinite
Specified by flow attribute values and be either finite or infinite. (Flow attributes are discussed
starting on page 339.)
To simply cause the Tank to have an infinite amount of initial contents, select the Initial contents
option, then check the (infinite) check box. For example, in the Yogurt Production model from
the Discrete Rate Tutorial, the Tank blocks that represented Liquid Supply and Fruit Supply had
infinite initial contents, while the Tank that stored the Yogurt product had no initial contents.
If the option for Finite initial contents with flow attribute values is selected, a check box causes the
initialization to be repeated whenever the Tank becomes empty.
Discrete Rate
If the block is empty, it cannot provide more flow than what it concurrently receives. In this
case, the effective outflow rate has to be less than or equal to the effective inflow rate.
336
Creating Flow
Creating flow
If a Tank has no inflow connections, by definition it is being used as a source. If at some point the
source reaches the empty state, the effective outflow rate will remain at zero for the remainder of
the simulation run.
Discrete Rate
Tank only exists while item is in it. This behavior is analogous to a truck (an item) that arrives at a
loading dock (a tank) where the loading or unloading of product can take place at a certain rate.
The truck arrives with a capacity and perhaps some quantity of product already in it. As long as
the truck is in the dock, loading or unloading is possible and occurs at the specified rate. When
the truck leaves, the docks ability to load and unload product disappears (the inflow and outflow effective rates are set to zero).
Tank is separate from item. This behavior is similar to a truck (an item) that brings product to a
holding area (a tank) that may nor may not contain product. The truck empties its load and perhaps takes some of the holding areas product with it when it leaves. This process occurs instantaneously. Whether the truck is at the holding area or not, both the truck and the holding area
can have product. The holding area can receive or deliver flow to the system even if there is no
truck (the inflow and outflow effective rates can be greater than zero).
For more details about these two modes, see Interchange modes on page 412.
Depending on the option selected, the Interchange has different choices for setting an initial contents.
Initialization of contents when Tank only exists while item is in it
This choice allows the block to
have an initial contents only
when an item arrives. To set an
initial contents for this block,
choose one of the options from Interchange initial contents, default behavior
the dialogs popup menu,
shown here:
A constant. Enter a number in the field; the default is 0. To cause the initial contents to be infinite, check the fields (infinite) check box or set the field to blank.
Value at ICO. The value at this connector will control the initial contents.
Value of item attribute. Select an items attribute in the dialog. When an item arrives, the initial
contents will equal that attributes value.
In the Yogurt Production model from the Discrete Rate tutorial, the Interchange blocks were set to
Tank only exists when item is in it and Initial contents (on item arrival): 0.
Creating Flow
Indicators
337
In this example, the sections between 0 and 25 feet and between 50 and 75 feet do not hold any
product.
Indicators
As the simulation runs, the level of flow in the residence blocks (Convey Flow, Interchange, and
Tank) will vary over time.
You might want an indication when a blocks flow level is within a certain range of values. This is
common when monitoring a block to determine if its contents are approaching or have reached
one or more important benchmarks. For instance, some emergency procedures might need to take
place if a Tanks level reaches the high range; they can be discontinued when the contents return
to a normal range.
For residence blocks, indicators are a method of reporting what category or range the current level
of flow falls into. With this feature, each range is assigned a name, a lower limit, and an upper
limit. When the level of flow reaches a value that falls within a different range, the block reports
the change on its I (indicator) value output connector and alerts any connected blocks to the
change in status.
While the Tank and Interchange blocks report information about the current level of flow from
their I (indicator) connectors, the Convey Flow block reports how far (the accumulation
length) the accumulation point is from the end of the conveyor. (When the amount of product
ready to leave exceeds the amount that can be received downstream, flow begins to accumulate
from the end of the conveyor. For more information, see Distribution of flow on page 401.
Discrete Rate
The Initialize tab has a Show Example button that places example settings in the table. These are
helpful for understanding how to make the entries you want; they can also be used as a starting
point for entries. Shown above is the example setting for a 100 foot long accumulating-density
conveyor that transports containers. The table indicates that the block would have an initial density of 10 containers per foot for the segment from 75 to 100 feet (a total of 250 containers) and 5
containers per foot for the segment from 25 to 50 feet (a total of 125 containers).
338
Creating Flow
Indicators
Setting indicators
The Indicators tabs on all
three residence blocks have
similar interfaces. Each
Indicators tab has a table
(shown on the right with
example settings) for specifying an indicator name for
Example indicators in Tank block
each range of values, entering the low limits, and
defining values (an ID number for each indicator) to output when the block's flow level falls
within a particular range.
To create indicators, enter your own information or click the Show Example button to populate
the table with some example indicator names and settings. In either case, ExtendSim will calculate
the High Limit values based on the Low Limit entries.
The top row has to have the highest range; the bottom row must have the lowest range.
To add or delete table rows, use the +/- button in the table's lower right corner. For instance, to
Discrete Rate
The screen shot above shows a Tanks names, limits, and ID values to output after the Show Example button has been clicked. Each indicator name corresponds to a range of flow contents defined
by the Low and High Limits for that row. (The High Limit column is presented for clarity only,
since those numbers are calculated using the values entered for the Low Limits.)
Unless the block has infinite capacity, the indicator limits can be expressed in absolute numbers
(shown above) or as percentages.
See Bucket Elevator 2 model on page 415 for an example of how indicators are used in an Interchange block to control a Valves effective rate.
If the block has infinite capacity, the limits must be expressed as absolute numbers. If the block's
initial contents are set to infinity, the indicators are disabled.
When the level is decreasing and the blocks contents reach the next indicators High Limit.
In each case, the new output ID is used to update the I value output connector, and any connected
blocks are alerted to the change.
Using the above table as an example, if the level in the Tank increases from 120,000 to 175,000
containers, the block will compare that level to the Low Limit and send the value 3 to its I (indicator) output connector. However, if the level of the Tank instead decreases from 230,000 to
175,000 containers, the block will compare that value to its High Limit and output the value 2.
Creating Flow
Flow attributes
339
The value that is output at the I (indicator) connector depends on whether the level of flow is
increasing or decreasing, and where in the range the new indicator level falls. The Tank block has a
S (status direction) output connector that reports if the level is going up or down when the event
occurs.
Tank Flow Units model
The Yogurt tank in the Tank Flow Units model (Examples\Discrete Rate\Sources and Storage)
outputs values that indicate the level of flow in the Tank; those values are displayed on the third
line on the plotter.
For more information about the Convey Flow block, including the use of sensors, see the discrete
rate chapter on Delaying Flow.
Flow attributes
A flow attribute is a quality or characteristic of flow that stays with it as it moves through the
model. Flow attributes provide information about the flow and allow you to organize quantities or
volumes of flow into layers.
The entire set of attribute values assigned to a particular layer is what distinguishes it from other
layers. In other words, all the units of flow in a layer possess the same set of flow attribute values.
While not all Rate models require the use of flow attributes, some uses for flow attributes include:
1) The flow held in a Tank can be organized into individual, distinct layers. This allows you to
control where incoming flow is deposited and which type of outgoing flow next exits.
3) Flow can be routed through the Merge and Diverge blocks based on flow attribute values.
Attributes are assigned to the flow by the model builder. They become linked to sections of flow
that pass through the blocks, according to settings in the blocks dialogs.
Discrete Rate
2) Flow rates through the Valve block can be calculated based on flow attribute values.
340
Creating Flow
Flow attributes
Discrete Rate
With string attributes you choose a descriptive text label (string) for each potential value of the
flow attribute; the information is entered in a lookup table in the Executive block's Flow Attributes
tab. The string can then be used in the model in place of the corresponding number. For example,
a string layer attribute named Flavor might have three possible values: 1, 2, and 3. Once the
lookup table for this attribute has been properly configured, the blocks referencing the Flavor attribute will display the strings Vanilla, Berries, or Caramel instead of the numbers 1, 2, and 3. For
instance, see the string layer attribute Flavor in the Executive, below.
Creating Flow
Flow attributes
341
the values of flow attributes are location specific. This means that the value of a flow attribute is
unique at any time in each section of the model. (For information on sections. see Rates, rate sections, and the LP area on page 357.)
Flow layers in residence blocks
As mentioned earlier, flow attributes are used to organize quantities or volumes of flow into layers,
where each layer represents an amount of flow that has specific and unique characteristics. By definition, the attribute values for every unit of flow in a particular layer must be the same.
Flow layers are stored, tracked, and distributed by the Tank, Interchange, and Convey Flow blocks
in the following ways:
Tank. The Tank has the ability to
store incoming layers of flow by placing them on top or on bottom, or by
adding the incoming flow to a preexisting matching layer. Outgoing
flow can be taken from the top, the
bottom or from anywhere in between,
as shown on the right. This flexibility
allows the Tank to mimic LIFO,
FIFO, and priority behavior.
Convey Flow. The Convey flow will always receive and distribute flow layers in a FIFO fashion.
For example, a layer in a Tank could be a quantity of yogurt with the Flavor attribute value
Vanilla and the Nuts attribute value No Nuts. Vanilla yogurt with nuts would be in a different
layer, as would Berry yogurt without nuts.
ExtendSim handles the organization of layers within the residence blocks according to options set
in the blocks dialogs.
Propagation of attribute values outside of residence blocks
All Rate blocks get attribute values from inflow connectors and set attribute values on outflow connectors. For instance, a Merge block will receive attribute values from each of its upstream
branches and, depending on these values and the rules set in the block, it will set the attribute values for the downstream flow.
If the upstream flow has the potential to satisfy downstream demand, the connectors in between
will reflect the attribute values of the upstream flow even if the effective rate is zero. On the other
hand, if there is no upstream flow available to potentially satisfy downstream demand, the attribute values on the connectors in between will be a Blank.For example, if the demand is for Vanilla
yogurt and the Tank has Vanilla yogurt but the effective rate is currently zero, the attribute value
will be Vanilla. However, if the effective rate is zero and the demand is for Berry yogurt, which
isnt currently present in the Tank, the flow attribute value will be a Blank.
Discrete Rate
Interchange. The Interchange block can use layers to manage the filling and releasing of items.
For example, theres an option to release an item as soon as an attribute on incoming flow
changes to a different value. This allows you to fill items with flow that contains a uniform attribute value.
342
Creating Flow
Flow attributes
Discrete Rate
The Flow Attributes tab of the Executive block (shown below) is for managing flow attributes
deleting, renaming, and changing their initial values. It is also where the strings for string layer
attributes are defined and where you can search for blocks that use a specific flow attribute.
Unlike an item attribute, which is assigned to individual items, flow attributes are assigned to the
flow in a section of a model. Flow attribute values can thus be read at any time and from any
model location. Each Rate block that holds or provides flow has a Contents tab showing the attribute values of its flow by volume. The Get(R) block can be used to retrieve the values of flow attributes elsewhere in the model.
In order to manipulate flow based on
the attribute, usually to route it or process it, you need to get the flows attribute value. The most common method
for getting attributes is to select the
attribute by name from the list in the
attribute popup menu in the Get(R)
block, as shown on right. When flow
passes through the Get(R) block, the
block accesses information about the
attributes that have been specified in
the table in its dialog. It then reports
the information in the table and on its
value output connectors. What the
Get(R) block reports and where,
depends on the type of attribute:
Layer attributes. The value for the attribute is posted in the Value column of the attribute table
and on the value output connector that corresponds to the attribute.
Creating Flow
Flow attributes
343
String layer attributes. The string text is displayed in the Value column of the attribute table
and the number that corresponds to the string is posted on the appropriate value output connector.
In addition to the Time Changed column in its dialog, the Get(R) block has a (delta) connector
for reporting when a flow attributes value changes. The connector outputs a 1 when the value of
the first flow attribute specified in the dialog changes. Otherwise it outputs 0.
Example models
Two models that use flow attributes are located in the Examples\Tutorial\Discrete Rate folder:
Yogurt Production with Flavors
Yogurt Production with Flavors Plus
Both models are a continuation of the Yogurt Production model discussed in the tutorial that starts
on page 318. They use attributes to simulate the production of five different flavors of yogurt. The
model named Yogurt Production with Flavors Plus uses the item/flow attribute mapping capability
of the Interchange block to preempt items, avoiding mixed pallets of flavored yogurt.
Discrete Rate
Discrete Rate
344
Creating Flow
Flow attributes
346
As discussed in Simulating discrete rate systems on page 311, quantities of flow are located in
one or more parts of a discrete rate model. During the simulation run, the flow moves from one
location to another at the effective rate. In order for the flow to move, one or more of the models
blocks need to have the capacity to hold flow as time advances.
The Convey Flow, Interchange, and Tank blocks are residence type blocks they have capacity
and can hold defined amounts of flow.
Flow units describe what is flowing from one Rate library block to another. Blocks that are connected together through flow connections and share the same flow unit are part of the same unit
group. The Change Units block is used to create a new unit group. This causes the blocks downstream of the Change Units block to be in a unit group different from its upstream blocks.
This chapter discusses providing and storing flow and the use of flow units in a discrete rate model.
It will cover:
Defining a blocks flow capacity
Indicators that provide information about a blocks level of flow
Defining and selecting time, flow, and length units
Using the Change Units blocks to create a different flow unit group
This chapter focuses on setting capacity for the Convey Flow, Interchange, and Tank blocks. Other
aspects of those blocks are covered in different chapters:
Discrete Rate
The Convey Flow block is most often used for delaying flow and will be discussed more fully on
page page 399.
The Interchange block is mainly used for interacting with items from discrete event portions of
the model and will be discussed more completely starting on page 410.
Setting maximum inflow and outflow rates for the Tank and Interchange blocks is described in
page 364.
The Tank Flow Unit model is located in the folder \Examples\Discrete Rate\Sources and Storage.
The Yogurt Production model is located at \Examples\Tutorials\Discrete Rate.
Blocks of interest
The following blocks from the Rate library will be the main focus of this chapter.
347
Tank
Acts as a source, intermediate storage, or final storage (sink). The block has a capacity and
can have an initial quantity of flow for the simulation.
Capacity
The Tank, Interchange, and Convey Flow blocks are considered residence blocks. This means that
they have capacity and can hold defined amounts of flow as time advances.
A residence block's maximum capacity can be a specific number or, in the case of the Tank or
Interchange blocks, it can be set to infinite.
Any time a residence block with a finite capacity changes state between full and not-full, ExtendSim will calculate a new set of effective rates.
A residence block with infinite capacity can never be full during the simulation run. In this situa-
tion, it is similar to a residence block with finite capacity that is not full; its effective inflow rate can
be greater than its effective outflow rate.
By default, the Tank has an infinite capacity to hold flow, as indicated by the Maximum capacity:
infinite setting in its dialog. In this state it will never be full.
A Tanks maximum capacity can be changed in the blocks dialog by entering an amount in the
Maximum capacity field (which unselects the checkbox). It can also be changed dynamically
through the blocks C (capacity) value input connector. If the C connector is used, it overrides
any entries made in the dialog. With a non-zero finite capacity, the Tank can be in either the full
or not-full state at any point in time.
Discrete Rate
If a residence block with finite capacity is full, the flow level is not permitted to rise; the effective
inflow rate will be less than or equal to the effective outflow rate.
348
If a Tank's capacity is set to zero, flow can still move through the block but the flow will not stay
in the block for any length of time. In this case, the Tank is neither full nor not-full, and the
effective inflow rate will equal the effective outflow rate.
If a Tank has no outflow connection, by definition it is being used as a sink. If at some point the
sink reaches the full state, its effective inflow rate will be set to zero for the remainder of the simulation run.
Discrete Rate
The blocks capacity is fixed at the moment the item enters the block; it remains fixed until the
item leaves. When the item leaves, the Interchange's capacity automatically goes back to zero.
Therefore, at the time of item departure any flow currently in the block is loaded onto the item.
The timing of when the item leaves the Interchange depends on logic set in the Interchange block.
For more information, see Item release conditions on page 411.
To define the capacity for an
Interchange block when it is set
to this behavior, choose one of
the options from the dialogs
popup menu, shown at right.
349
1) The blocks length and maximum density determine the maximized capacity. By default, ExtendSim calculates a maximized capacity for the
Convey Flow block by multiplying its length by
Maximized capacity
its maximum density. This is indicated in the
Capacity field by the maximized capacity
checkbox shown above. In this case, the blocks maximum capacity will equal its maximized
capacity.
2) A number in the Capacity field in the Options tab can reduce the capacity below the maximized amount. In some cases, it may be necessary to define a capacity smaller than the maximized capacity determined by the length*density calculation. For instance, the Convey Flow
block could have structural properties limiting how much weight it can safely support. To do
this, uncheck the checkbox in the Capacity field of the Options tab and enter the desired number. In this case, the blocks maximum capacity will be less than or equal to its maximized
capacity.
A Convey Flow blocks maximum capacity can never exceed its maximized capacity, no matter
what number is entered in the Capacity field.
Definitions
The following sections discuss flow, block, time, and length units. A unit group is two or more
blocks connected together through flow connections and sharing one flow unit.
Units and unit groups were introduced on page 315; they are described fully below.
Flow units
The flow unit indicates what is flowing from one Rate library block to
another. As is true for ExtendSim time
units, flow units can be unspecified
generic units (in which case the block Generic flow and time units in a Valve
dialog will just display the word
units) or they can be specifically
defined in the model. For instance, a defined flow unit could be a packet, gallon, transaction, box,
liter, and so forth. Existing flow units can be selected, and new units can be defined, in the
Options tabs of Rate library blocks. In addition, the Discrete Rate tab of an Executive block (Item
library) has a section for managing flow units. This provides a central location where units can be
added, deleted, or renamed.
Discrete Rate
For example, if the Convey Flow blocks length is 100 and maximum density is 10, the blocks
maximized capacity will be 1,000. To reduce the capacity to something less than 1,000, enter a
number (for instance 300), in the Capacity field. The block will then only be able to contain 300
units of flow, even though its calculated maximized capacity was 1,000.
350
Block units
The Tank and Interchange blocks can have
an internal block unit
that is different than the
flow unit. This is an
internal representation
of volume that is specific
to the Tank or InterFlow and block units in the Tank
change block, and does
not affect the flow unit
for the unit group. If you select a block unit that differs from the flow units that come into and out
of a block, you must enter a conversion factor. The conversion factor represents the ratio of the
block unit to the flow unit. Block units are discussed fully in Defining block units on page 351.
Using block units is optional; the default block unit is the flow unit.
Discrete Rate
Time units
Time units can be generic, in which case the block will just say time or can
be specific. Each model can define specific time units, which become the
default for the model. You can change a discrete rate blocks time unit from the
model default time unit to any local time unit using a popup menu in the
blocks Options tab.
If a local time unit is selected in a discrete rate block, that local time applies to the entire block but
only to that block. Changing to a local time unit does not change the global time unit for the flow
group or for any blocks in the rest of the model. For complete information, see Time units on
page 584.
Calendar dates are not available if months or years have been selected as the specific global time
unit for a discrete rate model. Furthermore, if Calendar dates has been selected, Rate library blocks
will not be able to select Months or Years as their local time unit.
Length units
For convenience, the Convey Flow block allows you to name a length unit. This is used internally
by the block with other settings to determine the blocks speed. You can use the default generic
unit length unit or declare a specific unit of length such as feet or meters.
Unit groups
A unit group is two or more blocks connected together through flow connections and sharing one
flow unit. Connecting the first blocks outflow connector to the second blocks inflow connector
creates a unit group. Unless the unit group is explicitly changed, all the blocks that are connected
through flow connectors use the same flow unit and are in the same unit group. If a flow unit is
changed in one of the blocks in a unit group, the unit group does not change but all the other
blocks in that group are updated automatically to the new flow unit.
To see the unit group, click the grey square to the right of a
blocks flow units popup menu, shown above. All the blocks
in that blocks unit group will be highlighted on the model
worksheet.
351
You can define multiple unit groups, which use different flow units, in portions of a discrete rate
model. For instance, one part of the model could be expressed in bottles and another could represent boxes of bottles. The Change Units block can create a different unit group.
Discrete Rate
352
To define a block unit, in the Options tab of the Tank or Interchange block, select Define a flow
unit for the group and a block unit for the block. In addition to providing fields for declaring a flow
unit, this option displays a field for entering an internal block unit. It also has a field for entering
the factor to convert between the flow unit and the block unit.
Tank Flow Units model
The Tank Flow Units
model is the same as the
model described on
page 324. However, the
newer model has pints,
rather than gallons, as
the block units in the
Yogurt Tank, causing
Defining a block unit in the Tank
the processs output to
be displayed in the plotter as pints. Clicking the unit group selector button in its Options tab shows that this Tank is still
part of the unit group that uses the flow unit gallons.
Time units
Discrete Rate
A popup menu in the Options tab allows a blocks time unit to be changed from the model default
time unit to any local time unit.
If a local time unit is selected in a discrete rate block, that local time applies to the entire block but
only to that block. Changing to a local time unit affects every parameter in the block, but it does
not change the models global time unit or the time units used in any other block in the model. For
more information, see Time units on page 584.
353
Discrete Rate
Discrete Rate
354
356
As discussed in the Introduction to this module, the movement of flow in a discrete rate model
must take some time. It is a modeling error if the flow moves instantaneously throughout a model.
ExtendSim's discrete rate system attempts to move flow through the model as fast as possible. In
the absence of any constraints, the effective rate of flow would approach infinity and the flow
would move instantaneously throughout the model; this is never correct. For this reason, flow
movement must be constrained by rates and conditions that are built into the model, and a lack of
appropriate constraints is a modeling error that will stop the simulation run
In order to restrict flow rates:
Discrete rate blocks are required to define their own sets of constraining flow rules
Each area of a model must have one or more critical constraint mechanisms
Critical constraint flow rules, such as a blocks maximum rate, place an upper bound on the rate of
flow, limiting it to a number less than infinite. The blocks aggregated set of flow rules ultimately
defines how fast flow is permitted to move over time throughout the model.
This chapter discusses rates, the blocks that constrain flow, and how model conditions impact the
rate of flow. It will cover:
Rates, rate sections, and the LP area
Flow rules for defining how a block permits flow to move through it
Discrete Rate
Blocks of interest
The following blocks from the Rate library will be the main focus of this chapter.
Convey Flow
Delays the movement of flow from one point to another. Can accumulate flow to a maximum density, accumulate flow to fill empty sections, or act as a non-accumulating conveyor.
Interchange
Used to mix flow with items, this block can also limit its maximum rate of inflow and
outflow.
Tank
The block most frequently used to store flow can also limit its maximum rate of inflow
and outflow.
357
Valve
Controls and monitors the flow, limiting the rate of flow passing through. This block
can also be used to set a goal for the duration or quantity of flow.
Types of rates
The following rates are taken into consideration by ExtendSim and by a blocks flow rules. (Flow
rules will be discussed on page 360.)
The maximum rate puts an upper limit on the movement of flow through a block. Six Rate
library blocks have the ability to set a maximum rate. You can set an explicit maximum rate in the
Interchange, Tank, and Valve blocks. The maximum rate for the Convey Flow block is mathematically derived. Maximum rates may also be implicitly specified under certain conditions in the
Merge and Diverge blocks. In each case, the maximum rate is the highest rate of flow those blocks
will allow, and hence the highest potential rate of flow for that part of the model.
An inflow connector for a Convey Flow, Interchange, or Tank block can have one maximum rate
while the blocks outflow connector can have a different maximum rate. The maximum rate for the
Convey Flow blocks inflow is derived from settings in its dialog; the maximum rate for its outflow
is derived from dialog settings and model conditions. The maximum inflow and maximum outflow rates for the Interchange and Tank blocks can be entered directly in their dialogs.
In order to avoid an error condition, each area of a model must have some mechanism in place to
restrict the rate of flow to a number that is less than infinity. If the required minimum set of constraints is not present, ExtendSim stops the simulation and displays an error message.
Effective rate
One of the most important reasons for creating a discrete rate model is to determine the
actual rate of flow movement. The effective
rate is the calculated actual rate of flow
Discrete Rate
Maximum rate
ExtendSim's discrete rate architecture
attempts to move flow through the model as
fast as possible. In the absence of any conDefault maximum rate for Valve
straints, the flow rate would theoretically
approach infinity and flow would move from one part of a model to another instantaneously; this
would be a modeling error.
358
between Rate library blocks during the simulation run. It is the result of an internal calculation
taking into account the maximum rates and all the constraints of the process. In some situations
the effective rate is the same as the maximum rate; in others it is lower. One effective rate is associated with each rate section in a model, as discussed Rate sections on page 359.
In a rate section, the effective rate of flow cannot be higher than the lowest maximum rate for all
the blocks in that section. In fact, it can be lower than the lowest maximum rate, and could even
be zero (0), depending on model conditions.
While each rate section can have only one effective rate, a section can have more than one block
that has a maximum rate. In fact, it is common to have several Valve blocks, each with their own
maximum rate, in a rate section.
Infinite rate
An infinite rate is a theoretical rate that would cause the flow to instantaneously move from one
location in the model to another.
Discrete Rate
You can change the infinite number to be anything that you want. However, because of the 12
digit precision limitation of the effective rates, the number should be set as close as possible to the
highest possible effective rate which would ever reach this limit. (Setting a correct infinite rate is
more critical in the case of potential upstream supply and potential downstream demand calculations, an advanced topic discussed on page 440.)
Infinite effective rate
Since instantaneous movement is not possible in the real world, the Rate library does not support
an infinite effective rate. The infinity number specified in the Executive establishes an upper limit
on the models allowable set of effective rates. If the simulation calculates an effective rate that
equals or exceeds that number, ExtendSim will stop the simulation and generate an error message.
This could happen, for instance, if a source tank is directly connected to a sink tank, without any
intervening constraint.
Infinite maximum rate
The Executives infinity number (by default, 1e10) can be used in a block's rule set when conditions are such that it cannot in any way constrain the movement of flow. For example this would
be accomplished by checking the (infinite)checkbox for a Valves maximum rate. With an infinite maximum rate, the Valve will not limit the speed of flow passing through it.
If you set the Valves maximum rate field to blank or to a number 1e10, the block would also not
limit the speed of flow passing through it.
Upstream supply/downstream demand
This potential rate is considered when using an advanced mode in the Diverge. Merge, and Sensor
blocks. It is described fully in Upstream supply and downstream demand on page 440.
359
Rate sections
A rate section is defined as a network of connected blocks, all possessing the same effective
rate. Each rate section can include a succession of
blocks and connections. A rate section always
starts with an outflow connector and ends somewhere downstream with an inflow connector.
Thus it will always contain at least two blocks
sharing at least one flow connection.
While some blocks always define the boundary between two rate sections, other blocks never
define a new rate section boundary:
Because a residence block (Convey Item, Interchange, or Tank) can hold flow for some period of
time, its effective inflow rate can be different from its effective outflow rate. Since the boundaries between rate sections never change, residence blocks always define the boundary between
two different sections, even if their effective inflow rate is the same as their effective outflow rate.
For example, a Tanks inflow connection ends one rate section and its outflow connection starts
another section.
All residence blocks, and certain passing blocks, always define the boundary between two different
rate sections. These boundaries are established internally by ExtendSim at the beginning of the
simulation run; they do not change.
The table below lists what role each block in the Discrete Rate library plays in defining the boundaries of a rate section:
Block
Always defines a
new rate section?
Bias
No
The inflow effective rate is the same as the outflow effective rate. The block influences the effective rate associated
with the section it is part of.
Catch Flow
No
The outflow effective rate is the same as the catch effective rate.
Change Units
Yes
The outflow effective rate is the inflow effective rate multiplied by the conversion factor.
Convey Flow
Yes
The outflow effective rate can be different than the outflow effective rate because it is a residence block.
Diverge
Yes
The effective rates can be different across all flow connectors the input and all the outputs.
Comments
Discrete Rate
Some passing (non-residence) blocks define a new rate section and others dont. While flow is
not permitted to be held in a passing block for any length of simulation time, some passing
blocks are capable of defining boundaries between sections. For example, a Valve is part of one,
and only one, rate section. On the other hand, the Change Units block's effective inflow rate
will always be different than its outflow rate because it performs a unit conversion. It therefore
defines the boundaries between two rate sections.
360
Block
Always defines a
new rate section?
Comments
Interchange
Yes
Merge
Yes
Sensor
No
Tank
Yes
Throw Flow
No
Valve
No
For an example of rate sections, see the Comprehensive example on page 369.
Rate precision
The mathematical precision for effective rates is limited to 12 digits. This can become an issue if
you separate any two effective rates in an area by more than 12 digits of precision. For more information, see Precision on page 418.
Discrete Rate
LP area
While rate sections dont change after the start of a run, the boundaries of the LP area change
dynamically during the simulation. An LP area is composed of one or more rate sections linked
together by the fact that their effective rates could change during the simulation run. When an
event occurs that causes the effective rate for one rate section to be reevaluated, ExtendSim determines which other rate sections might be impacted. The affected rate sections constitute the LP
area and become part of the LP calculation.
Since the LP area is computed internally, and because it is most important for the LP calculation,
it is discussed fully in The LP area on page 435.
Flow rules
Flow rules completely define how a block permits flow to move through during the simulation
run. When calculating rates of flow, ExtendSim's discrete rate architecture tries to maximize
throughput throughout the system, subject to a set of constraints. In order to restrict flow, discrete
rate blocks are required to define their own sets of flow rules. The aggregated set of these rules ultimately defines how fast flow is permitted to move over time throughout the model.
A blocks particular set of flow rules is derived from four factors:
The blocks fundamental behavior.
How its dialog has been configured, such as setting a Tanks maximum input rate or entering a
conversion factor in the Change Units dialog.
How its value connections have been connected. For instance, the Valve blocks R (maximum
rate) input connector can be used to dynamically modify the blocks maximum flow rate.
How its flow connections have been connected. A Tank is a source if only its outflow connector
is connected; it is a sink if only its inflow connector is connected.
These flow rules completely describe the events or conditions under which a particular block may
constrain the movement of flow through it. However, changes in a blocks constraints during a
simulation cause its effective rates to be reevaluated and can cause a connected blocks effective
361
Relational constraints
Relational constraints define the way the effective rates of different sections are related to each
other, creating dependencies between rate sections. For instance, the relational constraint between
one rate section (effective rate x) and another rate section (effective rate y), could be defined as xy,
x=y, 2x-3=y, or any other expression. Relational constraints get updated when the block reacts to
new parameters or to changes in its state, but they dont affect a blocks critical constraints.
An example of a relational constraint is the
Change Units block, where the use of a conversion factor causes the outflow effective rate
to be different than the inflow effective rate.
The Change Units block defines the boundar- Different inflow and outflow rates
ies between one rate section and another; the
conversion factor specifies the relationship of the two effective rates.
For another example of a relational constraint, see Comprehensive example on page 369. For an
advanced discussion of relational constraints, see The relational constraint calculation on
page 439.
You dont enter relational constraints, they are determined by the behavior of the blocks.
Discrete Rate
ExtendSim's discrete rate system attempts to move flow through the model as fast as possible.
Without any mechanism to impede its progress, the effective rate would theoretically approach
infinity and the flow would move from one part of a model to another instantaneously. In order to
avoid this error condition, each LP area of the model must contain one or more constraints (typically a Valve) to restrict the flow to a number that is below infinity. If the required minimum set of
critical constraints is not present in a model, ExtendSim stops the simulation and displays an error
message.
362
Comparison of constraints
Some blocks can set a critical constraint, some can set a relational constraint, and some can do
both. Even for blocks that can set constraints, the block may in some situations place no constraint
on the flow.
The blocks that can set a critical constraint are the Convey Flow, Diverge, Interchange, Merge,
Tank, and Valve.
Relational constraints can be set by the Change Units, Convey Flow, Diverge, Interchange,
Merge, and Tank blocks.
For example, a Tank where both the Maximum inflow rate and Maximum outflow rate are
checked will set critical constraints for its inflow and outflow.
If neither Maximum inflow rate nor Maximum outflow rate is checked, the Tank will not have
any critical constraints but could have relational constraints. If the Tank has a finite capacity but is
neither full nor empty, it places no constraints on the flow. However, once the Tank reaches the full
state, its inflow rate is required to be less than or equal to its outflow rate; this is a relational constraint.
The effective rate for a rate section cannot be any higher than the lowest critical constraint set for
by any of the blocks in that section. Furthermore, because the aggregated set of flow rules also typically contains relational constraints, the effective rate for the section can vary anywhere between
zero and the smallest critical constraint.
Discrete Rate
For a table that lists the blocks and which constraints they can provide, see Types of information
provided to the Executive on page 437.
363
Valve
The Valve is the block most often used for explicitly setting a critical constraint. You can enter a value in the
maximum rate field in the block's dialog, link the field
to an ExtendSim database or global array, or connect the
blocks R (maximum rate) input connector to some
value output.
The checkboxes for Initial maximum rate and Poll constraint every, discussed below, are only
used when the Valve's maximum rate is configured to change dynamically.
As you saw in Add maintenance on page 324, the Add Shutdown button in the Valves dialog
automatically connects a Shutdown block (Item library) to the Valve's R input connector. This can
be used to stop the flow, or reduce its rate of movement, for a period of time. See also Shutting
down on page 185 for a description of how to use the Shutdown block.
Initializing the maximum rate
When the Valves maximum rate is configured to change dynamically, the Initial maximum rate
checkbox serves an important role. This is because the first effective rate calculations for a simulation occur just before simulation time starts moving forward. If the Valves R connector is connected or if the maximum rate field has been dynamically linked, problems can arise at this stage
because neither the block connected to the R connector nor the linked data source has yet had a
chance to provide an initial value. The Initial maximum rate checkbox resolves this issue by initializing the maximum rate.
The initial value entered in the dialog will be used until the Valve gets a different value from its R
input connector or from the linked data source.
For multiple runs, the Initial maximum rate checkbox prevents the Valve from using the last
maximum rate from the current run as the initial maximum rate for the next run.
Polling constraints
The checkbox to Poll constraint every... can be used when a Valves maximum rate is configured to
change dynamically. This option directs the Valve to request a new maximum rate value at fixed
intervals during the run. This causes the Valve to periodically query the block connected to its R
(maximum rate) input connector or the cell linked to its maximum rate field for the new values.
Any values received between the queries will be ignored.
Discrete Rate
For an example of using the Valves R input connector to cause the maximum rate to change
dynamically, see Add a dynamic constraint on page 322.
364
This checkbox is optional when the maximum rate field is connected to a fixed number in a linked
cell in a data source. It is required if the linked cell contains a random number or if the R input
connector is connected to a passive block like the Random Number (Value library), since a passive
block wont independently generate a new value for the maximum on its own. (The checkbox is
not needed if the R connector is connected to block that actively generates values, such as the
Lookup Table block set to output values at regular time intervals in the discrete rate tutorial.)
Each time the maximum rate in a Valve changes, effective rates must be re-calculated across multiple sections. If you are using the poll constraint feature in several Valves, consider having them
update at the same time. This will dramatically reduce the number of recalculations.
While the polling feature can be handy during the early stages of the model building process, flow
rates in real world systems rarely change at fixed intervals. Use this feature judiciously and with
caution.
Controlling how and when the Valve applies its maximum rate
The Valves Control Flow tab has advanced options that allow you to manage how and when that
block applies its maximum rate. By setting a goal or using hysteresis, you can explicitly control
when the Valves constraining rate will be observed, when it will be ignored, and for how long
either of those will happen. These topics are discussed in the Delaying Flow chapter.
Discrete Rate
You can enter either a maximum inflow rate or a maximum outflow rate, or both of these.
365
The Tank Constraint example shows two flow streams with identical behavior. In the bottom flow
stream, Tank 2 uses the options Maximum inflow rate and Maximum outflow rate to replace
the filling and emptying valves found in the upper flow stream.
Tank Constraint model. Top stream with two Valves to constrain flow; bottom
stream with maximum rates defined in Tank 2.
flow rates in a Tank or Interchange block can be used to satisfy the models requirements for a constraint.
Convey Flow
The Convey Flow block calculates critical constraints for its inflow and outflow connectors separately. The critical constraints are derived from model conditions and settings in the dialog.
The critical constraint for the Convey Flow blocks inflow is calculated by multiplying the
blocks effective speed by its maximum density entry.
The effective speed can be less than or equal to the speed set in the dialog. If the block is non-accumulating, or if it is accumulating but cannot accumulate more, and the blocks ability to deliver
flow exceeds downstream demand, the effective speed will be lower than the entered speed.
The critical constraint for the blocks outflow is the result of the multiplication of the blocks
speed setting by the density of flow present at the outflow end of the block.
Setting the initial contents or capacity for a Convey Flow block is discussed in the chapter Storage
and Units. The Delaying Flow chapter shows how to use the Convey Flow block to delay the
movement of flow in a model.
Discrete Rate
Instead of using a Valve block to constrain flow, setting maximum inflow and/or a maximum out-
366
through all but the selected branch is blocked when the Merge block is in Select mode. In both of
these cases, the maximum rate would be 0 for the affected branches.
The Mode table on page 373 lists each mode for the Merge and Diverge blocks. The column
labeled Parameter values that always block the flow indicates which conditions would always
cause a branch to have an implied constraint of 0.
By definition, residence blocks always delineate the boundary between two rate sections. A general
rule is that there must be at least one critical constraint between every two residence blocks. (The
critical constraints can be provided by the Convey Flow, Diverge, Interchange, Merge, Tank, and
Valve blocks. The residence blocks are the Convey Flow, Interchange, or Tank.) The exceptions to
the general rule include certain situations where a Merge or Diverge block is between two residence blocks.
The following examples illustrate some ways the required critical constraint mechanism can be met
in discrete rate models.
Discrete Rate
Tank or Interchange
Instead of using a Valve to provide the critical constraint between two residence blocks, you can
specify maximum inflow and maximum outflow rates for an intervening Tank or Interchange
block. With these maximum rates, the Tank or Interchange will limit the rate of flow between the
two residence blocks to a number less than infinite. This is shown in the Tank Constraint example
discussed in Tank and Interchange on page 364.
367
For any Merge/Diverge mode, if a critical constraint has been placed on a Merge blocks outflow
branch, no critical constraints are required on its inflow branches. Likewise, a critical constraint on
a Diverge blocks inflow branch means that no critical constraints are required on its outflow
branches. If those constraints have not been placed, the critical constraint requirement depends on
the blocks mode.
The following table provides an overview of each modes requirements for critical constraints when
neither the Merge blocks outflow branch nor the Diverge blocks inflow branch has a critical constraint. (In this table, the word variable branch means an inflow branch for the Merge block or
an outflow branch for a Diverge block.)
Critical constraint requirements if there is no critical constraint on
the non-variable branch
Batch/Unbatch
Distributional
Neutral
Priority
Proportional
Select
Sensing
Note: For the Proportional mode, the variable branch with the critical constraint should not have a
proportion <=0. Otherwise, that branch will be closed and the other variable branches will have
potentially infinite effective rates. This is an error condition.
Merge and Diverge blocks, including their modes, are described fully in the chapter Merging,
Diverging, and Routing Flow.
The two examples that follow use the Minimum Valve model to illustrate some of the tables concepts.
Discrete Rate
Mode
368
Proportional mode
The top section of the Minimum Value model indicates the critical constraint requirement when a Merge
or Diverge block is in Proportional mode. If the block
is located between two residence blocks, only one critical constraint is needed as long as the branch's proportion is neither 0 nor blank. (This lower requirement for
constraints is an exception to the general rule described
on page 366.) The effective rates for the other branches
are deduced from the Valve's maximum rate.
In the Minimum Valve example shown on the right, a
Valve is placed on a Diverge blocks bottom outflow
branch, and that branch does not have a 0 or blank
proportion.
Discrete Rate
Priority mode
The lower section of the Minimum Value model indicates the critical constraint requirements
when a Merge or Diverge block is in Priority mode. In this case, the number of critical constraints
that must be placed on the branches between residence blocks depends on where those constraints
are placed. These situations are shown in the Minimum Valve model.
If a critical constraint is placed between a residence
block and a Diverge blocks inflow branch, you do not
need to place any other critical constraints on the
Diverge blocks outflows. Likewise, if you place a critical
constraint on a Merge blocks outflow branch, you do
not need to place any critical constraints on its inflow
branches. This is shown on the right, where a Valve with
a maximum rate greater than or equal to 0 but less than
1e10 (the infinite rate) is on a Diverge blocks inflow
branch and there are no critical constraints required on
its outflow branches.
If you dont
place a critical constraint on a Diverge blocks inflow
branch, you must place at least one critical constraint
on each outflow branch. Likewise, if you dont place a
critical constraint on a Merge blocks outflow branch,
you must place at least one critical constraint on each
inflow branch.
369
Comprehensive example
The following example illustrates many of the
concepts from this chapter. The top line of the
Tank Constraint model, shown on the right, has
two rate sections, two critical constraints, and one
relational constraint.
Rate sections
Rate sections are determined internally by a communication between Rate library blocks and the
Executive (Item library). The boundaries between rate sections are established at the beginning of
the simulation run; they do not change during the run even if the effective rates change.
At the beginning of the simulation run:
The Filling valve has a maximum rate of 10, gets its inflow from an infinite Source, and sends its
outflow to an empty Storage tank that has a capacity for 100 flow units. The system will thus
calculate an effective inflow and outflow rate of 10 FPT for the Filling valve at the start of the
simulation run. (This will change once the Tank fills.)
The Emptying valve has a maximum rate of 5 FPT and sends its outflow to an infinite Sink. Its
effective inflow and outflow rate is 5 FPT.
At the start of the simulation run, the Storage tanks effective inflow rate is different from its effective outflow rate. Thus the first rate section for the Tank Constraint model starts at the Source
blocks outflow connector and ends at the inflow connector on the Storage tank. The second rate
section starts at the Storage tanks outflow connector and ends at the Sinks inflow connector.
Critical constraints
There are two critical constraints in the top line of the Tank Constraint model. The first critical
constraint is the 10 FPT entered in the Filling valves maximum rate field. The second is the 5
FPT entered in the Emptying valves maximum rate field.
Relational constraint
Relational constraints define the way the effective rates of different sections are related to each
other. At the beginning of the simulation run there are no relational constraints the effective
inflow rate is independent of the effective outflow rate. When the Tank (which has a finite capacity
of 100 flow units) becomes full, it applies one critical constraint: inflow rate must be less than or
equal to outflow rate.
Discrete Rate
The Storage tank has a a capacity for 100 flow units, gets its inflow from a valve with a maximum rate of 10 FPT and sends its outflow to a valve with a maximum rate of 5 FPT. At the
beginning of the simulation run, its effective inflow rate will thus be 10 FPT and its effective
outflow rate will be 5 FPT.
370
Discrete Rate
However, this initial effective rate for the first rate section is only temporary. Since the Storage
tank's capacity is finite and since Rate Section 2's effective rate is only 5 FPT, the Storage tank will
eventually become full. Once this happens, the effective rate of 10 FPT in Rate Section 1 can no
longer be maintained. Consequently, the Storage tank introduces a relational constraint that
requires its inflow effective rate (Rate Section 1) to be less than or equal to its outflow effective rate
(Rate Section 2). Once the Storage tank is full, its relational constraint causes the effective rate
through Rate Section 1 to be reduced to 5 FPT.
372
When building models, you will frequently encounter situations where you want to route the
streams of flow in a model. This is accomplished using the Catch Flow, Diverge, Merge, and
Throw Flow blocks.
The Merge and Diverge blocks have similar interface and capabilities. These two blocks send and
receive flow through a variable number of inflow and outflow connectors. Their dialogs provide
rule-based options to merge or diverge flow in a discrete rate environment.
The Throw Flow and Catch Flow blocks also have similar interfaces. These blocks route flow
remotely from point to point.
This chapter covers:
Blocks for merging, diverging, and routing flow
Merge and Diverge modes
Additional features of the Merge and Diverge blocks
Blocks of interest
Discrete Rate
The following blocks from the Rate library will be the main focus of this chapter.
Catch Flow
Receives flow sent from Throw Flow or Diverge blocks. Allows you to group blocks that
can send the flow into sets, so that the list of possible connections can be filtered.
Diverge
Distributes flow from one inflow branch to one or more outflow branches at a time. The
block has several modes for determining how the flow is distributed through the branches.
Merge
Merges flows from one or more inflow branches at a time into one outflow branch. The
block has several modes for determining how the inflows should be received.
Throw Flow
Sends flow to Catch Flow or Merge blocks. Allows you to group the blocks that can receive
the flow into sets, so that the list of possible connections can be filtered.
373
For the Merge block, each input connector is referred to as an inflow branch. For the Diverge
block, each output connector is referred to as an outflow branch. Collectively they are known as
the variable branches.
Mode table
The following table lists the Merge and Diverge modes in alphabetical order and summarizes their
main similarities and differences.
Mode
See page
Sum of
inputs =
sum of
outputs?
Fixed rule?
Bias order
required?
Parameter value at
each branch that
will always block
the flow
Compatible
with Sensing
mode?
Batch/Unbatch
375
No
Yes
No
None
Yes
Distributional
378
Yes
No
Yes
Blank, <=0
Maybe
Neutral
380
Yes
No
No
None
Maybe
Priority
376
Yes
No
Yes
Blank
Maybe
Proportional
375
Yes
Yes
No
Blank, <=0
Yes
Select
373
Yes
Yes
No
None
Yes
Sensing
379
Yes
No
Yes
Blank, <=0
Yes
Some modes use a fixed flow rule to obtain or distribute the flow no matter what happens in
the rest of the model, the fixed rule will be respected. For other modes, the flow rules express a
preference and are only invoked in specific situations depending on model conditions.
Competing requests for flow amongst Merge and Diverge blocks that have been set to the Distributional, Priority, and Sensing modes require the use of bias ordering. This is discussed in
Biasing flow on page 418.
While other parameter values may block the flow in certain circumstances (for instance, if a
number is out of range), for some modes a Blank or zero (0) will always cause the flow to be
stopped. Values that are out of range will cause an error message; a zero (0) or Blank will not
generate an error message.
As discussed in their respective sections, incompatibilities can arise if an area of the model has
one or more blocks that use the Sensing mode and other blocks that use either the Distributional, Neutral, or Priority mode. These situations should be avoided whenever possible as they
can give inaccurate results.
Select mode
When the Merge or Diverge blocks are in Select mode, only one selected branch at a time is open.
A table in the blocks dialog allows you to assign a unique ID number to each inflow branch (for
the Merge block) or outflow branch (for the Diverge block). The ID connector on the blocks icon
is then used to select which branch to open.
Options in the blocks dialog allow you to specify what happens if the value at the ID connector
doesnt match any of the branch IDs listed in the table:
Discrete Rate
Characteristics
Explanations for the mode characteristics are:
374
The Select mode uses a fixed flow rule to obtain the set of effective rates for each branch and to
Discrete Rate
Try running the model after checking Pause each step (in the upper left corner of the model).
This will cause the simulation to pause so you can more easily see the effect of the Create block
sending values to the Diverge block. Clicking the Pause/Resume button in the toolbar will continue execution to each succeeding event. (There can be more than one event without time
advancing.) For more information, see Stepping through a model on page 580.
Select Mode Merge model
This model is the mirror image of the Select Mode Diverge model discussed above. While the
three source tanks provide an infinite supply of flow, it is the Merge block that controls which tank
flow is drawn from. Since the Merge block is in Select mode, the Create block controls the routing
of flow by providing different values (1, 2, 3, 4 sequentially every 20 minutes) at the Merge blocks
ID connector.
375
In this model, the Merge block is set to Invalid value at ID: choose top connection. This means
that when the ID connector gets a value of 4 from the Create block, it will select the flow from its
top input connector.
Batch/Unbatch mode
The Batch and Unbatch modes are used to cause a different total amount of outflow than what
would be indicated by the total amount of inflow or to change the total amount of inflow into a
different total amount of outflow.
When the Merge block is in Batch mode, each unit of flow from each inflow branch is combined into one outflow unit. The effective rates of each inflow branch and the outflow connector are thus required to be equal. In this mode, the Merge block's behavior is similar to that of
the Batch block (Item library).
When the Diverge block is in Unbatch mode, each unit of flow from its inflow branch is cloned
into one unit of flow for each outflow branch. The effective rates for the inflow connector and
each outflow branch are thus required to be equal. In this mode, the Diverge block's behavior is
similar to that of the Unbatch block (Item library).
The Batch/Unbatch modes are different from all the other modes because the amount of total
inflow is never equal to the amount of total outflow.
Proportional mode
With the Proportional mode, you define in a table what the proportion of flow through each
branch will be. The proportion for each branch is defined in the table relative to each of the other
branches. For instance, a value of 2 for the top outflow branch and 4 for the bottom outflow
branch would indicate that the bottom branch should have twice the amount of flow as the top
Discrete Rate
376
branch. If a particular branch's proportion has been defined to be blank or <= 0, the effective rate
for that branch is set to 0 and the flow is stopped for that branch.
See Merge blocks in Proportional mode on page 425 for options when a Merge block is part of
an empty loop.
This mode uses a fixed flow rule where the effective rate at each branch is required to meet the
proportion defined by the table. Consequently, if the flow through one or more of the branches is
blocked or starved, the effective rates for all branches will be set to zero and all flow through the
block is halted.
Discrete Rate
Priority mode
The Priority mode allows you to attach priorities to the inflow branches of the Merge block and
the outflow branches of the Diverge block. These priorities only impact the effective rates assigned
to the branches when discrepancies arise between the upstream flow supply and the downstream
flow demand; otherwise they are ignored.
In the case of the Diverge block, when the upstream supply is greater than or equal to the downstream demand, the block passes as much flow through each branch as the downstream demand
will allow and the priorities are ignored. However, when the cumulative downstream demand
exceeds upstream supply, the priorities that have been assigned to each branch are used to calculate the appropriate effective rates for the outflow branches.
377
In contrast, the Merge block passes as much flow as possible through each inflow branch when
downstream demand exceeds upstream supply, ignoring the priorities. However, when the
cumulative upstream supply exceeds downstream demand, the priorities assigned to each branch
are used to calculate the appropriate effective rates for the inflow branches.
Special cases apply to the use of the Priority mode in a Merge or Diverge block:
If the priority for a particular branch has been set to blank, the effective rate for that branch will
be zero and the flow will stop for that branch.
If the priorities of two or more branches are equal, the flow will be divided among them in a
distributional manner with equal proportions (see Distributional mode, below.)
The priority entries in a Diverge blocks dialog are not fixed rules but instead are situational; they
are only used to resolve discrepancies when downstream demand exceeds upstream supply. For a
Merge block, the entries are used to resolve discrepancies when upstream supply is greater than
downstream demand.
Merge/Diverge blocks in Priority mode are not always compatible with Merge/Diverge blocks in
Sensing mode. Consequently, an area of the model with some blocks in Sensing mode and others
in Priority mode are prone to error. See Cautions when using potential rates on page 441 for
more information.
However, if a supply scarcity is introduced by changing the constraining rate in Valve 1 from 8 to
4, the Diverge block will calculate a set of effective rates that distributes the now limited supply of
flow according to the defined priorities. Since the priorities have been assigned in descending order
(top outflow branch has highest priority), the Diverge block will do its best to satisfy the downstream demand that has been placed on the top outflow branch first. After that, if supply is still
available, the Diverge block will attempt to service subsequent branches. This pattern is repeated
until every branch has been satisfied or until the upstream supply of flow runs out, whichever
comes first.
Discrete Rate
378
Distributional mode
Similar to the Proportional mode described on page 375, the Distributional mode allows you to
define a desired set of proportions for each branch. However, unlike the Proportional mode (but
similar to the Priority mode discussed on page 376), these proportions serve as the decision rule for
assigning effective rates to the branches only when discrepancies arise between the upstream flow
supply and the downstream flow demand.
Discrete Rate
In the case of the Diverge block, when the upstream supply is greater than or equal to the downstream demand, the block passes as much flow through each branch as the downstream demand
will allow and the proportions are ignored. However, when downstream demand exceeds
upstream supply, the proportions assigned to each branch are used as a guide to determine how
the limited supply should be distributed across the outflow branches.
In contrast, the Merge block passes as much flow as possible through each inflow branch when
downstream demand exceeds upstream supply, ignoring the proportions entered in the dialogs
table. However, when upstream supply exceeds downstream demand, the proportions assigned
to each branch are used as guides to determine how the limited demand should be distributed
across the inflow branches.
The distributional proportions entered in a Merge or Diverge blocks table are significant only in
certain situations; they are ignored otherwise. Proportions do not follow a fixed flow rule; they
only impact the effective rates assigned to the branches when discrepancies arise between the
upstream flow supply and the downstream flow demand.
Merge/Diverge blocks in Distributional mode are not always compatible with Merge/Diverge
blocks in Sensing mode. Consequently, an area of the model with some blocks in Sensing mode
and others in Distributional mode are prone to error. See Cautions when using potential rates on
page 441 for more information.
Distributional Mode Diverge model
In this example, the proportions for the Diverge
blocks two branches are
set to 1:1. The constraining rates in the valves are
defined such that the
upstream supply of 10
flow units per time unit
through Valve 1 equals the
cumulative downstream
demand of 10 set by
Valves 2 and 3. Because a
large enough supply of
Distributional Mode Diverge model
flow exists to satisfy
379
downstream demand, the distributional proportions are ignored and have no impact on the set of
effective rates defined for each outflow branch of the Diverge block.
Two examples highlight what happens when the Diverge block is set to Distributional model and
there is a supply scarcity that causes the upstream supply to be less than the downstream
demand:
If the constraining rate in Valve 1 is changed from 10 to 8, the Diverge block will use the 1:1
proportions that have been defined in its dialog to allocate the now limited supply between the
two downstream demanding branches. In this case, 4 units of flow per time unit will move
through both the top and bottom branches.
If the constraining rate in Valve 1 is set to 9 units of flow per unit of time, the situation is different. According to the 1:1 proportions that have been defined in its dialog, the Diverge block
should allocate 4.5 units of flow to each of the two downstream demanding branches. However,
the constraining rate for Valve 3 is 4 units of flow per time unit and that is all it can accept. The
extra 0.5 units of flow will be routed through the top branch because the downstream demand
for the bottom branch cannot keep up with the upstream supply (4.0 vs. 4.5) and the Distributional mode will always try to push as much flow as possible.
The Diverge block's Proportional mode is used to resolve discrepancies when downstream demand
is greater than upstream supply.
The Merge block's Proportional mode is used to resolve discrepancies when upstream supply is
greater than downstream demand.
Sensing mode
Similar to the Proportional mode discussed on page 375, the Sensing modes use proportions to
calculate the effective rates for the branches. However, unlike the Proportional mode where you
directly enter or control the proportions for each branch, the proportions for the Sensing modes
are derived dynamically from the model as it runs.
In the case of the Diverge block, Demand Sensing proportions for the outflow branches are calculated as a function of the potential downstream demand. For instance, the downstream
demand placed on a particular outflow branch becomes the proportion for that branch.
Similarly, the Merge block uses the potential upstream supply to define the Supply Sensing proportions for each inflow branch.
Potential demand and supply rates are advanced concepts that are discussed in Upstream supply
and downstream demand on page 440.
In the Sensing mode, the block's dialog has a table where you must define the maximum possible
rate of flow through each branch. This upper bound is used as a way to limit throughput so that
the proportions can be determined if the upstream supply or the downstream demand is infinite.
The discussion on page 441 provides reasons why the Sensing mode should be used with extreme
caution and some situations where it should be avoided altogether. Given the potential problems,
Discrete Rate
380
and because similar behavior can be achieved using the Distributional mode, the Sensing mode
should be used only as a last resort.
Demand Sensing Mode Diverge model
In this example, the constraining rates in Valves
2, 3, and 4 define the
demand for flow downstream of the Diverge
block. They therefore
define the proportions
used to distribute the
flow across the Diverge
blocks outflow branches.
Discrete Rate
A maximum possible
rate of 1,000 for each
branch is entered in the
Diverge blocks table.
The blocks Results tab
Demand Sensing Mode Diverge model
(cloned onto the model
worksheet) displays each
branchs actual outflow rate and the amount of total outflow for the simulation run.
Supply Sensing Mode Merge model
In the Supply Sensing Mode Merge example, the constraining rates in Valves 1, 2, and 3 define the
supply upstream of the Merge block. They therefore define the proportions used to distribute flow
across the inflow branches.
Neutral mode
Unlike any of the modes discussed previously, the Neutral mode does not allow you to control the
effective rates for the branches. This is a passive mode where no branch has a throughput advantage; the branch that gets chosen cannot be predicted. It is used when the system does not need to
control how the flow is routed.
In the case of a Diverge block, when the upstream supply is greater than or equal to the downstream demand, the block passes as much flow through each branch as downstream demand will
allow. However, when downstream demand exceeds upstream supply, the distribution of flow
across each branch cannot be predicted.
In contrast, the Merge block passes as much flow as possible through each inflow branch when
downstream demand exceeds upstream supply. However, when upstream supply exceeds downstream demand, the distribution of flow across each branch cannot be predicted.
The Neutral mode should be used carefully but can be handy in certain cases. As a general rule of
thumb, if you don't care exactly which branch has priority, but you do want maximum flow, consider using the neutral mode. The Neutral mode can also be used to resolve conflicting decision
rules. For example, using the Neutral mode in a downstream Merge block would allow an
upstream Diverge block in Proportional mode to control the effective rates of the inflow branches
in the Merge.
381
Merge/Diverge blocks in Neutral mode are not always compatible with Merge/Diverge blocks in
Sensing mode. Consequently, an area of the model with some blocks in Sensing mode and others
in Neutral mode are prone to error. See Cautions when using potential rates on page 441 for
more information.
to Distributional, Priority, or Sensing modes must specify a bias order to resolve conflicts between
competing preferences for flow, as discussed below. For a complete description of the bias concept
and bias order, see Biasing flow on page 418.
Competing Requests for Flow model
This model demonstrates how the priorities in two routing
blocks compete
against each other.
In this example:
The Diverge
blocks outflow
branch priorities
have been specified
in descending
order while the
Merge blocks'
inflow branch pri- Competing Requests for Flow model
orities have been
specified ascending order.
The two blocks share common flow streams.
While the Diverge block in this model will try to satisfy its top outflow branch first, the Merge
block will oppose that by trying to satisfy its bottom inflow branch. To resolve this conflict, the
Discrete Rate
Because certain modes allow flexibility in the way flow is distributed, Merge or Diverge blocks set
382
Diverge block's priorities have been biased over the Merge block. This was accomplished by selecting Each block defines its own bias order in the Discrete Rate tab of the Executive block, then
selecting the Diverge block in the Executives table and entering a bias of 1.
Selecting the option Show bias order on icon in the Discrete Rate tab of the Executive block
causes the bias value to be displayed near block icons as <x>. In the above model, the bias order
is indicated as <1> for the Diverge block and <2> for the Merge block, indicating that the Diverge
block has precedence over the Merge blocks requests.
To see how the Bias block is used instead of Merge/Diverge blocks to resolve competing preferences
for flow, see the Prioritize With Bias Blocks model located in the folder \Examples\Discrete
Rate\Merge and Diverge and discussed on page 418.
Discrete Rate
Whichever option is selected becomes the default option for that type of flow as it passes through
the block. For exceptions to the default, the blocks provide a table for specifying custom behavior
for each attribute.
right) on the Merge or Diverge blocks Options tab. When this checkbox is selected, a set of
value input connectors appear on the blocks icon, with one connector for each branch.
Link the parameter table to an ExtendSim database table or global array. Any changes made to
the table or array while the model runs will have the same effect as using a block to dynamically
change the values.
383
3) By checking Poll new parameters only each: x time units in the blocks Options tab. This
causes a new set of parameters to be updated at fixed intervals. In this case, changes to the
inputs are ignored until the next interval in time arrives. In the example Change Proportions
Periodically, the model picks a new set of proportions every time another 100 units of time is
reached.
The options Update only when a True value is received at the Update connector and
Poll new parameters only each: x time units can be combined together.
Discrete Rate
2) By checking Update only when a True value is received at the GO connector in the blocks
Options tab. This allows the calculation of a new set of effective rates to be controlled explicitly. In this case, changes to the parameters are ignored until a message is received at the GO
input connector. This is shown in the example model Change Proportions with Trigger
which requests a new set of proportions at the beginning of each goal. (A goal represents the
production of 1000 units of flow and is repeated over and over until the end of the simulation.) The values at the inputs change every 10 time units, but because the chosen set of
parameter values remains unchanged for the duration of the goal, effective rates are recalculated only at the beginning of each new goal.
384
The advantage of using a Diverge block to throw flow or a Merge block to catch flow, is that each
outflow or inflow branch can throw or catch a separate stream of flow remotely. The Throw Flow
and Catch flow blocks, on the other hand, are limited to one flow source or destination each.
Discrete Rate
An asterisk to the right of a connector position number in the popup menu indicates that the connector is already being used by some other throw/catch block.
385
Filtering options
Discrete Rate
Group filter
Each block with throw or
catch capabilities can be
added to a throw/catch
group. Groups can be created or selected through
Defining a Group
the group popup menu
found in the sending and
receiving blocks. When this popup is blank, the block does not belong to a group. When a block
has been added to a group, its throw/catch options are limited to the blocks currently in that
group.
386
Discrete Rate
387
for a particular branch of a Merge or Diverge block, the Open button for that branch will appear
in the last column of the table in the blocks Throw or Catch tab.
Discrete Rate
Discrete Rate
388
Delaying Flow
For a certain period of time, either
maintaining flow at a certain speed or blocking it.
390
Delaying Flow
Blocks of interest
The Rates, Constraints, and Movement chapter discussed how to specify critical constraints
(such as a Valves maximum rate) and the factors that determine the actual speed of flow moving
through a model.
Since the concepts of flow rules and critical constraints are central to the discussion of delaying
flow, it is assumed that you have already read the Rates, Constraints, and Movement chapter.
This chapter describes how to use advanced methods to delay flow for a specified period of time
or until a specified condition has been met, either blocking the movement of flow or maintaining
it at a certain speed. It illustrates several methods for delaying flow, including how to:
Control how and when a Valve observes or ignores its maximum rate setting:
Setting a goal for a quantity of flow
Setting a goal for a duration
Using hysteresis to control when the blocks maximum rate will be observed
Use a Shift block (Item library) with a Convey Flow, Interchange, Tank, or Valve to delay flow
movement for a specified period of time
Discrete Rate
Transport flow over a defined distance at a specified speed with a Convey Flow block
Most of the models illustrated in this chapter are located in the folder \Examples\Discrete
Rate\Delaying Flow. The tutorial models mentioned are located at \Examples\Tutorials\Discrete
Rate.
Blocks of interest
The following blocks from the Rate library will be the main focus of this chapter.
Convey Flow
Delays the movement of flow from one point to another. Can accumulate flow to a
maximum density, accumulate flow to fill empty sections, or act as a non-accumulating
conveyor.
Valve
Controls and monitors the flow, limiting the rate of flow passing through. This block
can also be used to set a goal for the duration of flow movement or the amount of flow.
Delaying Flow
Controlling a Valves maximum rate
391
Goal as a quantity
Goal as a duration
If a Valves maximum rate is zero and a quantity goal is On, no flow will go through the block and
the goal will never end.
Options when goal is Off
Dialog options allow you to choose what will happen when the goal switches to Off:
Stop the flow
Ignore maximum rate (do not constrain flow)
Observe maximum rate
What happens when the goal switches to the Off state depends on the Off option selected in the
blocks dialog: stop the flow, do not constrain flow, or observe maximum rate.
To interrupt a goal, send a value to the Valves stop input connector.
Discrete Rate
If its maximum rate is >0, blank, or infinite, the Valve will allow flow to pass through at that rate
while its goal is On. (If the maximum rate is blank, the Valve uses an infinite rate.)
392
Delaying Flow
Controlling a Valves maximum rate
Discrete Rate
Delaying Flow
Controlling a Valves maximum rate
393
library blocks and the bottom line is Item library blocks. A Decision block (Value library) transmits values from a Valve (Rate library) to a Gate (Item library).
In the bottom portion of the model, when the item leaves the Get block it moves into the Queue,
where it is blocked from leaving by a Gate block. The Gate will remain closed until the Production
Gate valve reaches its new goal of 5000 gallons. At that time the goal switches from On to Off, the
flow stops (because that is the option set on the Control Flow tab), and the value at the GS (goal
status) output is set to 3 (indicating that the goal has ended).
As a result, the Gate opens and the item moves into the Changeover Activity block where it is
delayed for the amount of time required to perform a changeover. After the changeover has been
completed, the item cycles back and initiates the next production cycle.
By default, a Valves GS (goal status) output connector reports the following values:
0 when there is no goal
1 when a goal is starting
2 when a goal is in progress
3 when a goal has ended
4 when a goal is interrupted
Discrete Rate
Since its initial goal has been set to none, the goal status is Off and flow through the Production
Gate valve is stopped at the start of the simulation. However, when an item passes through the Get
block (Item library) labeled Start Goal, a message is sent to the Production Gate valves G (goal)
input connector. Once that happens, the valves goal switches from Off to On and the goal quantity is set to the value of the items Quantity attribute (5000 gallons).
394
Delaying Flow
Controlling a Valves maximum rate
Discrete Rate
The following screenshot shows how the Production Gates quantity goal has been configured on
its Flow Control tab:
The value for the Goal quantity is received through the G input connector. (In this model, the
goal is 5000 gallons because each item has a Quantity attribute value of 5000.)
The popup menu option Start run with goal Off has been selected. (This causes the goal to be
in the Off state at the start of the simulation.)
The Valve has been instructed to Stop flow when the goal is Off.
The popup menu option Start run with goal Off has been selected. (This causes the goal to be
in the Off state at the start of the simulation.)
If a new goal is received before the previous one is finished, the new goal will be ignored. (In this
model, a new goal cannot arrive before the previous one is finished.)
An interesting aspect of this model is that the Production Gate valve has been set to have an infinite maximum constraining rate. This means that it will, in and of itself, not limit the rate of the
flow moving through it. However, the blocks effective (actual) rate will be determined by the two
upstream Valves. One of these Valves is connected to a Lookup Table block (Value library) that
changes its maximum rate depending on the time of day. The other upstream Valve is connected to
a Shutdown block (Item library) that causes the movement of flow to be stopped periodically for
specified durations. This sequence causes some interesting effects in the model, and the Production Gates effective rate ranges between 80 and 0 gallons/minute.
Delaying Flow
Controlling a Valves maximum rate
395
This examples uses the G (goal) connector to control the when and how much aspects of the
goal. Alternately, the Control Flow tab allows you to choose to start a new goal when the start
connector receives a message or when the previous goal finishes.
What happens when the goal switches to the Off state depends on the Off option selected in the
blocks dialog: stop the flow, do not constrain flow, or observe maximum rate.
To interrupt a goal, send a value to the Valves stop input connector.
Discrete Rate
396
Delaying Flow
Controlling a Valves maximum rate
tity goal in this model, the changeover is controlled using a second Valve with a duration goal,
rather than by an item.
Discrete Rate
Since its Flow Control tab specifies that it has an initial quantity goal of 5000 gallons, the Production Gate valve starts the simulation by observing its maximum rate setting infinity. However, as
was true for the Changeover Quantity Goal model, the blocks actual effective rate will be
impacted by the Liquid Supply and Fruit Supply valves upstream.
The Production Gate's goal state is communicated to the Changeover Gate through the connection between the first blocks GS (goal status) output connector and the second blocks start input
connector. Because of this connection and because of how the duration goal has been specified in
the Changeover Gate, the duration goal starts in the Off state and will switch to On only after the
Production Gate's quantity goal is completed. After 20 minutes, the Duration Goal is finished and
the Changeover Gate sends a message to the Production Gate to start a new quantity goal.
Unlike the Duration Goal model that allows flow to pass through for a specified amount of time,
the duration goal in this model causes flow to be blocked for a certain period. The Changeover
Gates maximum rate is set to 0 and the goals duration is set to 20 minutes. While the goal is On,
the blocks maximum rate (0) is observed and no flow passes through, allowing for the changeover.
Delaying Flow
Controlling a Valves maximum rate
397
The following screenshot shows how the Changeover Gates duration goal has been configured on
its Flow Control tab:
The goal duration is a constant 20 minutes. The duration could be made variable by instead
choosing Goal durations is: value at G connector.
The 20 minute blocking of flow allows the changeover to occur. The maximum rate on the
Changeover Gates Valve tab is 0. This would cause the flow to be blocked in the absence of any
goal being set for this block. Consequently, if the block has a duration goal and it is On, that
maximum rate of 0 will be observed and flow will be blocked from entering. When the goal
turns Off after 20 minutes, the Changeover Gate doesn't apply any constraining rate on the flow
because it is set to Off: ignore maximum rate.
A new duration goal is started only when the start input connector receives a value of 3. Consequently, a new duration goal begins only when the upstream Production Gate's quantity goal
has finished.
When the changeover has completed and the duration goal switches from On to Off, a signal is
sent from the Changeover Gate to the Production Gate. This results in a new quantity goal
starting in the Production Gate.
Discrete Rate
398
Delaying Flow
Controlling a Valves maximum rate
using model conditions to explicitly control both when a Valves maximum rate is observed and
when it is ignored.
Unlike the quantity and duration goals discussed earlier, where the conditions for applying the
Valves maximum rate were entered in its dialog, hysteresis must always get its control information
from outside the block. The hysteresis option always relies on the Valves start input connector to
control when the Valves maximum rate will be observed and its stop input connector to control
when the maximum rate will be ignored. When the maximum rate is ignored, the Valves dialog
provides a popup menu for choosing if the flow stops or if the Valve does not constrain the flow.
Hysteresis model
In this model, the Filling valve opens
when the Storage tank is empty and
closes when the tank is full. Conversely,
the Emptying valve opens when the Storage tank is full and closes when the tank
is empty. As a result, the model repeatedly cycles through the following stages: Hysteresis model
Emptying valve closes and filling valve
opens
Storage tank starts accumulating flow
Discrete Rate
The Emptying valves hysteresis settings are the opposite of the Filling
valve, as shown at the right. When
this valves start connector gets a 2
from the Storage tanks I output conHysteresis setting for Emptying valve
nector, the valve observes its maximum rate. When its stop input
connector gets a 0, the valve shuts down.
Delaying Flow
Delaying flow with the Shift block
399
Places a Shift block on the model worksheet below the originating block
Enters the Shift name in the originating block's Use Shift field
Opens the Shifts dialog so settings can be entered
To use the Shift, enter the required information in the blocks dialog. (The Shift controls the originating block remotely; it does not need to be connected in the model.) Each Shift block starts with
a default name for its shift. If you subsequently change the name of the shift, the new name will be
reflected in the block that uses that shift.
For more information about using the Shift block, see The Shift block on page 224.
Discrete Rate
The easiest way to add a Shift block to a discrete rate model is to click the Add Shift button found
on the Options tab of a Convey Flow, Tank, Interchange, or Valve block. This automatically does
the following:
400
Delaying Flow
Convey Flow block
A Convey Flow block is computationally intensive, so it should be used only if the system you are
modeling requires very precise tracking of flow movement and position. For instances when the
block should not be used, see page 403.
Dialog settings
Movement of flow across the Convey Flow block is influenced by the dialog settings and parameters.
Determining speed and distance
The Convey Flow block
offers two options: Speed
determines travel time or
Discrete Rate
The parameters for speed or delay can vary dynamically during the simulation; the length and
maximum density parameters remain fixed.
Convey Flow behavior
The Convey Flow block is divided into segments, where the boundaries of each segment are
defined by a change in the density of flow. Depending on the options chosen in the dialog, flow
Delaying Flow
Convey Flow block
401
could accumulate or pile up along the length of the block any time the amount of flow ready to
exit the block exceeds downstream demand.
The Convey Flow block has three options controlling how or if flow is allowed to accumulate:
Accumulate-maximum density. Allows flow to accumulate up to its maximum density setting. If
the conveyor's ability to deliver flow exceeds downstream demand, any flow delayed from exiting will begin piling up at the outflow end of the conveyor up to the maximum density level.
Accumulate- fill empty segments. Allows flow to fill in any empty segments along the conveyor
when the blocks ability to deliver flow exceeds downstream demand. (An empty segment is an
area along the blocks length that has a density of 0.) This differs from the first option in that
one section of flow is not allowed to pile onto another section of flow.
Non-accumulating. This option does not allow flow to accumulate. Therefore, the blocks speed
slows when its ability to deliver flow exceeds downstream demand.
The Compare Convey Flow model compares the behavior of three Convey Flow blocks, each set to
one of these behaviors, under different emptying rates.
Constraining rates
The critical constraint for the Convey Flow blocks inflow is calculated by multiplying the
blocks effective speed by its maximum density entry.
The effective speed can be less than or equal to the speed set in the dialog. If the block is non-accumulating, or if it is accumulating but cannot accumulate more, and the blocks ability to deliver
flow exceeds downstream demand, the effective speed will be lower than the entered speed.
The critical constraint for the blocks outflow is the result of the multiplication of the blocks
speed setting by the density of flow present at the outflow end of the block.
Discrete Rate
Critical constraints define an unconditional maximum upper bound to the rate of flow. As discussed in the chapter Rates, Constraints, and Movement, the Convey Flow block calculates critical constraints for its inflow and outflow connectors separately. The critical constraints are derived
from model conditions and settings in the dialog.
402
Delaying Flow
Convey Flow block
appear. As the simulation runs, the table displays information about the current distribution of the
flow in each segment of its length:
The length of a Convey Flow block is divided into segments, where the boundaries of each segment are defined by a change in the density of flow. The table above indicates that this Convey
Flow block currently has 8 segments along its length.
Accumulation point
If the block is set to be accumulating, any accumulation will start at its outflow and go toward its
inflow. The point beyond which no more flow can accumulate is known as the accumulation
point. This point will probably move between the inflow and the outflow as the simulation runs.
Discrete Rate
The Results tab reports information about the accumulated flow: the distance from the outflow
where the accumulation point is located, the indicator, and the accumulated quantity of flow.
If the command Run > Show 2D Animation is checked while the model runs, and there is accumulation, a vertical red bar will move on the blocks icon during the simulation; this indicates the
location of the accumulation point. The Flow and accumulation point screenshot above shows
the red line of the accumulation point.
The accumulation point is located somewhere along the length of a Convey Flow block that has
been set to accumulate flow.
Sensors
The Convey Flow block has a Sensors tab for specifying the locations and trigger points of sensors
along the length of the conveyor. Each sensor reads and communicates the density of flow over
time at a particular point on the conveyor. This information is displayed in a table in the blocks
dialog and reported by the blocks S (sensor) output connectors one S output for each sensor.
You must specify in the table not
only the number of sensors desired
but also the location of each one.
(Use the +/- button in the tables
lower right corner to specify the
number of sensors.) The example
table shown here indicates that four Sensor tab table
sensors have been placed along a ten
foot section of the conveyor.
The S connectors should be used judiciously. Extra events are used to update them at the proper
time and the calculation is computationally intensive.
Delaying Flow
Convey Flow block
403
Indicators
As discussed in Accumulation point on page 402, the accumulation point indicates the point
beyond which no more flow can accumulate. You might want an indication when the accumulation point is within a particular segment of the Convey Flow block.
The Indicators tab on a Convey Flow block is used to define segments to indicate where the accumulation point is along its length. Each segment is assigned a name, a defined range, and an ID
number. The ID number is used to update the blocks I (indicator) output connector as the accumulation point moves from one segment to the next.
See Indicators on page 337 for complete information about creating and using indicators.
The I connectors should be used judiciously. Extra events are used to update them at the proper
time and the calculation is computationally intensive.
One alternative would be to use a combination of Tank and Valve blocks to mimic a Convey Flow
block. This is far less computationally intensive than the Convey Flow block by itself. While some
configurations may not be as precise, you can use a combination of one Tank followed by one
Valve block in such a way that the behavior is identical or almost identical to the results when
using a Convey Flow block.
Another alternative is shown in the Tank and Valve to Convey model. In this example, the bottom
flow stream behaves almost identically to the upper stream without using a Convey Flow block.
Because Valves A1 and B1 vary their constraining rate, the Convey Flow block (Convey A) will get
and create a lot of messages, slowing down the simulation. But the Convey B1 tank wont create
the extra events. This will be slightly less precise but much more efficient.
Never use a Convey Flow block if the systems behavior can be modeled using a Tank and Valve.
Discrete Rate
The distribution of flow along the Convey Flow block should impact the rest of the model in
some significant way. If the effective inflow rate varies significantly during the simulation and/or
if the speed changes, the product may be unevenly distributed across the length of the conveyor.
This discontinuity impacts the rate at which flow is able to exit the block over time. The greater
this variation in availability, the greater the potential impact on the rest of the model and the
greater the block's use can be justified.
Discrete Rate
404
Delaying Flow
Convey Flow block
406
It is common for systems to exhibit a mixture of behaviors, where items from the discrete event
arena intermingle with discrete rate processes. In these mixed mode cases, a proper understanding of both the Rate and Item libraries and how they can interact with each other is required.
There are two general techniques for integrating discrete event blocks from the Item library with
discrete rate blocks from the Rate library:
1) Sending signals and sharing information via value connections. Value connections can be very
useful for triggering some type of action as the system moves from one state to another. For
example:
Value connections can trigger the generation of an item when the level of flow in a Tank
reaches a certain level.
The value of an attribute on an item passing through some part of a discrete rate model
could trigger a change in the constraining rate in a Valve block.
Discrete Rate
2) Mixing items with flow using the Interchange block, as you saw in the Discrete Rate tutorial
on page 328. The Interchange block (Rate library) provides the ability for items and flow to
interface with each other. For example, an empty tanker truck (an item) might arrive at a refinery and fill with gas (flow) at a continuous rate using an Interchange block. Once full, the
truck might be routed through a series of Item library blocks until it reached its unloading destination. At that point the item would again interface with an Interchange block to discharge
its load.
This chapter focuses on the techniques used when the need for mixed mode models arises. It will
show how to:
Control flow using blocks from the Item library
Control items with blocks from the Rate library
407
Notice that the Reception tank can be full even while the item is still in the Filling Valve 1 activity.
Since the tank cant accept any more flow when it is full, and cant start emptying until the item
moves to the Emptying Valve 2 block, the flow stops before the Filling process has been completed.
The next model shows how the Reception tank can let the item know that it is full.
Discrete Rate
408
Discrete Rate
409
opening and shutting of valve blocks; valves impact the level of flow; and the level of flow controls
the item's location.
Discrete Rate
410
number. Since the cycling item remains in the Stage 1 queue, the model is now in a Stage 1 holding pattern. Consequently, Valve 1 is opened (so the Reception tank starts receiving flow) and
Valves 2 and 3 are closed.
Stage 2: Open Valve 2 and release flow to Processing
Once the Reception Tank reaches the full state, Gate 1 is opened and Gate 2 is closed. This allows
the item to move on to the Stage 2 queue. The result is that Valve 2 opens, Valves 1 and 3 close,
and flow starts moving from the Reception tank into Recycling and Processing. Gate 2 remains
closed while the Reception tank empties.
Stage 3: Process the flow
Once the Reception tank is completely empty, Gate 2 is opened, Gates 1 and 3 are closed, and the
item enters an Activity block labeled Stage 3. While the item remains in Stage 3, all three Valve
blocks remain closed. The Activity block, which has a delay of 2 minutes, is used to keep the flow
in the Processing tank for some period of time so it can be processed.
Discrete Rate
The use of the Interchange block was introduced on page 328 of the Discrete Rate Tutorial, and
the blocks capacity to hold flow is discussed starting on page 348 of the Flow Sources, Storage,
and Units chapter. This chapter will describe how the Interchange block interfaces flow with items.
The Interchange block is where an item can be filled with flow or emptied of flow.
There are a number of occasions where it can be useful to provide items with the ability to store,
transport, and empty flow as they move from one section of a discrete rate model to another. For
example, the attribute capabilities used to distinguish one item from another can also be used to
distinguish one block of flow carried by one item from another block of flow carried by a different
item. This can be an especially useful modeling construct since flow units by themselves are indistinguishable from each other.
Behavioral rules
The Interchange block has two very different modes (Tank only exists while item is in it and
Tank is separate from item) that affect how the block behaves. (These modes were introduced on
page 348 and will be discussed more fully on page 412.) Even so, the Interchange block always follows a fundamental set of rules:
The item input and item output connectors on the Interchange block must both always be connected.
411
At least one of the Interchange block's inflow/outflow connectors must be connected (both may
be connected as well).
The Interchange block's capacity for holding items is permanently fixed at one item.
The Interchange block loads and unloads the item and its flow instantaneously. (Flow present in
the item when it enters the block is instantaneously available to the block; flow leaving the block
with an item is instantaneously removed from the block.)
Scheduled releases
There are 5 options for defining when the item should be
released:
When contents >= Target. This option requires the item
to be filled with a certain amount of flow prior to
release. The Target amount is entered in the dialog.
When contents <= Target. Requires the item's flow level
to empty to a certain point prior to release. The Target
amount is entered in the dialog.
As soon as possible. Releases the item whenever there is downstream item capacity for the item,
irrespective of the current flow level.
Only with preempt connector message. Releases the item when a true value is received at the
blocks PE (preempt) value input connector.
When level reaches indicator. Requires the flow contents to reach a certain level prior to release.
Indicators (segments that indicate the level of contents) must first be entered on the blocks Indicator tab for this option to be used.
Preemption
The scheduled release conditions can be
superseded at any time by using the
Discrete Rate
The release conditions determine when an item is scheduled to leave the Interchange block; they
are the same for both block modes. Releases can also be accomplished at any time using the Preempt connector.
412
preempt connector. Whenever the preempt connector receives a value that corresponds to the preemption options selected in the Item/Flow dialog, seen above, it will trigger a preempt.
To immediately dispose of an item after it releases flow, connect an Exit block (Item library) to the
Interchange blocks item output connector. To instead have an item present all the time, connect a
Create block set to Create items infinitely to the blocks item input connector.
Interchange modes
The Interchange block has two modes:
Tank only exists while item is in it
Tank is separate from item
These are illustrated below.
Tank only exists while item is in it
In this mode, the Interchange's capacity to handle flow is completely dependent upon the presence
of an item. The arriving item can be thought of as a tank with a capacity to hold flow. This item/
tank can move through the item-based blocks just like any other item would. However, once it
enters an Interchange block, the item/tank can release flow directly into the blocks outflow connection and/or accept flow directly from its inflow connection. In the absence of the item/tank,
the Interchange block has no flow capacity.
Discrete Rate
Two very important behaviors result from an item exiting the block when it is set to this mode:
Once the conditions for item release have been met, the exiting item will always take with it any
flow currently residing in the block.
Until a successor item arrives, the Interchanges inflow and outflow will be blocked.
In this mode, the absence of an item eliminates not only the Interchange's capacity to hold flow
but also its capacity to pass flow from an upstream source to a downstream sink. (This differs from
the behavior of a Tank block, which passes flow through even if its capacity has been set to zero.)
Shipping model
A typical example
of how the Interchange block
could be used in
this mode is illustrated by the
Shipping model.
In this example,
an empty ship (an
item) arriving at a
Shipping model
loading port (an
Interchange
block) where it is filled with cargo according to a filling rate. Once full, the ship sails for a period
of time (represented by an Activity block) until reaching the new destination port (another Interchange block). At this point the ships cargo is unloaded according to the unloading rate.
To simulate the loading process, flow is piped from the Interchange block's inflow connector into
the item/ship. Once filled, the item/ship exits the block, taking the flow with it. Conversely, once
413
the item/ship arrives at the second Interchange block, flow is piped from it into the second Interchange block's outflow connector.
The item/ship travels with a Quantity
attribute that has been set to a value of
1000. This attribute sets the ships capacity.
Release options for unloading
For the filling process, the Interchange
releases the ship when it is full, that is, after
1,000 units of flow have been piped in. The second Interchange block releases the ship when it is
empty, that is, after 1,000 units of flow have been piped out. At the end of the simulation run, the
ship has not yet been released from the unloading dock because it still contains 100 units of flow.
Yogurt Production model
The Yogurt Production model, located in the folder
\Examples\Turorial\Discrete Rate and discussed in the
Discrete Rate Tutorial that starts on page 318, is an example of using an Interchange block set to Tank only exists
while item is in it.
Discrete Rate
414
The only difference lies in the Interchange block's ability to pipe flow into and out of items. When
the Interchange block is set to Tank is separate from item, the block can receive and hold flow
that has been provided by its inflow connector or the arrival of an item and it can release flow
through its outflow connector or through the exiting of an item.
Discrete Rate
When the Interchange block is in this mode, an item carrying flow releases its entire load instantaneously upon arrival. However, depending on other settings in the block, the item can also take
flow with it upon exiting. If this is the case, the Interchange block's flow level is decremented
instantaneously when the item leaves. Furthermore, an item whose load of flow exceeds the blocks
capacity will be blocked from entering the Interchange.
Bucket Elevator 1 model
The Bucket Elevator 1 model
simulates a series of buckets
(items) pulling flow out of a
source (an Interchange block)
located at a low elevation, transporting the water in a series of
steps to an infinite sink located
at a higher elevation (another
Interchange block), and then
returning empty through a
series of steps to the source.
Both Interchange blocks are set
to Tank is separate from item.
With this setting, both the
source and the sink have the
capacity to hold water even in
the absence of an item.
This model is similar to a continuous loop of buckets drawing
water from a well, emptying
into a catch basin, and returning to the well. There are ten
bucket/items and each bucket
Bucket Elevator 1 model
has a capacity of 100 gallons;
this is defined in the Resource
Item block by the attribute Capacity. There are also ten slots in this pseudo-conveyor each represented by an Activity block that can hold one item/bucket. The delay at each slot is 1/10 the sum
of all the delays, as determined by the items Speed attribute.
Even if the source has less than 100 gallons, the buckets keep moving and grab as much water as
possible. As each bucket reaches the top, its contents are released instantaneously into the sink, and
the journey back down to the sink immediately starts. Running the simulation with animation on
shows the buckets as they cycle from the well, up to the catch basin, and then back down again.
415
For more information about indicators, see Setting indicators on page 338.
Converting between item and flow attributes
The Interchange blocks Flow Attributes tab provides a matrix for mapping between item and flow
attribute names. The mapping table transfers the values of an items attributes to the specified flow
attributes and vice versa. The blocks dialog provides options for how the mapping should affect
Discrete Rate
416
Discrete Rate
entering and departing items. For an example, see the Interchange block in the Yogurt Production
With Flavors Plus model, located at Examples\Tutorials\Discrete Rate.
Miscellaneous
Concepts that dont easily fit into other chapters
418
Miscellaneous
Precision
Precision
An LP area is made up of one or more rate sections; it encompasses all the rate sections for which
the Executive block has been notified that effective rates might change. The LP area has a linear
program (LP) that is responsible for calculating an effective rate for each section contained within
that area. (The LP area and LP calculations are discussed fully in LP technology on page 434.)
Discrete Rate
The maximum mathematical precision for an LP area is 12 digits. Because one LP can be responsible for calculating multiple effective rates for its rate sections, and because LP precision is limited
to 12 digits, precision can become an issue not only for the individual effective rates but also for
the effective rates calculated for the entire LP area. For example, if an LP area contains two rate
sections where the first rate section's effective rate was 1,000,000 flow units per time unit (FPT),
the effective rate for the second section could be no smaller than 0.0001 FPT.
To preserve adequate precision for all rate sections, dont separate any two effective rates within an
LP area by more than 12 digits of precision.
Biasing flow
The discrete rate architecture includes a feature called bias a method for stating a preference that
flow travel one route rather than another.
Because bias can skew the way flow is distributed, it is taken into consideration by the global LP
calculation and can thus have an effect on effective rates. (For specific information on how bias is
used in the calculation of effective rates, see the advanced topic LP technology on page 434.)
We suggest that you read the chapters Rates, Constraints, and Movement and Merging, Diverging, and Routing Flow before the Bias section.
Miscellaneous
Biasing flow
419
Bias order
If a block in a model has bias, it has a bias order that indicates its ranking compared to all the
other blocks with bias. Each biasing block is listed in order from the top (strongest) bias order to
the lowest (weakest) bias order. The block at the top of the ranking list has a bias order greater than
0. Bias orders lower than the top have numbers higher than the top number; bias numbers that are
Blank or less than or equal to 0 are ignored.
Since the bias order is used during the LP calculation of effective rates, changing the bias order
often results in a different set of effective rates. It is therefore important to understand the concept
of bias order and the influence it has on how effective rates are calculated.
The bias of a Bias block is by definition stronger than the biasing effect of any Merge or Diverge
block. So Bias blocks will always have higher bias orders than Merge and Diverge blocks.
Bias block
The Bias block allows you to specify a preference for where the flow should be directed. Wherever
the Bias block is located in the model, it pulls in as much flow as possible. If a model has multiple
Bias blocks, each has its own bias order.
If the models Merge and Diverge blocks use non-fixed rules to obtain or distribute flow, there is
some leeway in how flow can be biased and the Bias block is useful. If the models Merge and
Diverge blocks all use fixed rules, there is no possibility of biasing the flow with the Bias block.
(Fixed and non-fixed rules are discussed in Merge and Diverge blocks on page 420.)
Discrete Rate
Bias dialog
The dialog table reports information about each Bias block in the model, its bias order, block label
or name, and block number. You can use the tables Bias column to change the bias order for any
of the listed blocks.
Calculation of the effective rate
The preferences for flow defined by Bias blocks has an effect on the calculation of the effective rate.
If there is more than one Bias block in the model, each blocks preference is expressed in turn based
on its bias order. As each Bias block takes its turn, it calculates the maximum effective rate which
could circulate at its location, without taking into consideration the preferences expressed by
420
Miscellaneous
Biasing flow
blocks with a lower bias order. When its maximum effective rate has been determined, that rate
will be fixed for the succeeding calculations involving blocks with lower rankings.
The bias order of Bias blocks can change dynamically during the simulation
If multiple Bias blocks have identical bias orders, the way the flow is distributed between the
effective rates cannot be predicted. The model will use one of the possible solutions.
If a Bias block has a bias order that is Blank or is less than or equal to 0, the block does not
express any preference.
Discrete Rate
Miscellaneous
Biasing flow
421
If the model contains Merge and Diverge blocks that are only set to the Batch/Unbatch, Proportional, or Select modes, bias has no impact on the effective rates.
Non-fixed rule modes
The Distributional, Neutral, Priority, and Sensing modes do not use a fixed rule to obtain or distribute flow. Instead, they provide a certain degree of freedom about where the flow can be
directed.
A Merge or Diverge block in Priority mode, for example, impacts the flow as follows:
Taking into consideration how much flow it can get, the block will do its best to direct as much
flow as possible to its top priority branches.
However, the block just expresses a preference for where to send the flow; model conditions
determine how well those preferences can be achieved and the top priority branches may not
actually get the most flow.
If the model contains any Merge or Diverge blocks set to the Distributional, Priority, or Sensing
modes, the bias order must be specified. (There is no bias order required for the Neutral mode.)
Setting a Merge or Diverge blocks bias order
When set to the Distributional, Priority, or Sensing modes, the Merge and Diverge blocks must
express a bias order. This is accomplished as follows:
2) You can also directly enter a bias order for a biasing Merge or Diverge block. To do this, first
change the Executives default setting from Bias order: defined by Simulation Order to Bias
order: each block defines its own. Then do one of the following:
In the blocks Model Settings tab, use the two array
buttons (<< and >>) to
change the blocks bias
order. This also changes the
blocks position in the tabs
bias order table.
Or, in the Executives Discrete Rate tab, select the
row that contains the
desired block, then use the
<< and >> arrows to change
its position in the table.
Model Settings tab
The bias order changes
when the position of the block in the table changes.
Discrete Rate
1) By default, the Executive is set to Bias order: defined by Simulation Order. With this setting,
the bias order for each Merge and Diverge block is automatically determined based on Simulation Order. Simulation Order is set in the command Run > Simulation Setup > Continuous
tab; the default is Flow order. It would be unusual to change the simulation order from the
default Flow order. (For further information on Flow order, see Simulation order on
page 88.)
422
Miscellaneous
Global and advanced options in the Executive
Discrete Rate
The Executive block (Item library) oversees the global discrete rate system. It is responsible for calculating a models effective rates, centralizing and coordinating the information from Rate library
blocks as discussed in the advanced topic LP technology on page 434.
The Executives Discrete Rate tab is used as a central location for setting options used throughout a
discrete rate model. These options are divided into global and advanced options, as discussed
below.
Global options
The Executives global options are:
Defining the infinite rate
Defining a zero effective rate
Setting options for how often blocks should update their flow status
Choosing that the Valve animate and report blocking and starving information
Managing flow units
The first three options are listed in a global
options frame at the top of the tab (shown
below); the fourth option is located at the bottom of the tab. They are all discussed in the following sections.
Infinite rate
Global options in Executive
The Discrete Rate tab specifies that a rate equal
to or greater than some number is considered
infinite; the default setting is that a rate 1e10 is considered infinite. This information is important when setting critical constraints and for the determination of the effective rate. It is discussed
fully in Infinite rate on page 358.
Miscellaneous
Global and advanced options in the Executive
423
Discrete Rate
Only when necessary. This default setting is computationally the most efficient option because
flow status is updated only when needed by the system. With this setting, the information is
updated:
424
Miscellaneous
Global and advanced options in the Executive
A Valves complete status information is helpful during the early stages of model construction and
for debugging purposes. However, it can slow the simulation, so by default the option is not
checked.
The differentiations are animated on the Valves icon as discussed in Valve on page 429.
Manage flow units for discrete rate models
This section of the Discrete Rate tab provides a central location where flow units can be renamed
or added to or deleted from a model. To delete or rename a flow unit, select it in the table and click
the appropriate button. Flow units are discussed on page 349.
Advanced options
The advanced options in the
Discrete Rate tab only apply
to specific situations:
Merge or Diverge blocks
in the Distributional, Priority, or Sensing modes
Merge blocks in Proportional mode when there is
an empty loop
Discrete Rate
Miscellaneous
Global and advanced options in the Executive
425
Blocks push flow even in empty loops. This choice allows the branches with flow to send it
through. The result is that the branch that is part of the empty loop will then get some flow.
Each branch needs simultaneous inflows to push flow. With this choice, flow is stopped at
all inflow branches if one or more of them cannot get any flow.
Which of the three empty loop options you choose depends on the behavior of the system you are
simulating.
Merge Proportion Setting model
In this model the two flow streams have identical settings except for how the Merge blocks handle
empty loops. So that each block can specify its own behavior, the Executives setting for the section
Merge blocks (Proportional mode and empty loop) is Each block defines how it will push flow.
Discrete Rate
Each block defines how it will push flow. This setting causes an additional popup menu to
appear in the Model Settings tab of any Merge block in Proportional mode. The two choices in
each Merges dialog are:
426
Miscellaneous
Common connectors on discrete rate blocks
Most Rate library blocks have inflow and outflow connectors and value input and output connectors. The Interchange block also has item input and output connectors.
Discrete Rate
Flow connectors pass information about the effective rate from one discrete rate block to another.
Item connectors pass discrete items.
For value connectors, many discrete rate blocks use abbreviations or acronyms to indicate the connectors purpose. Some of these abbreviations represent more than one purpose and are context
sensitive.
The following connector labels appear for value connectors on Rate library blocks:
Connector
In or Out?
Meaning
AL
Output
Accumulation length - for a Convey Flow block, the distance from its
end to the accumulation point.
AQ
Output
Input
Input
Capacity
CO
Output
Contents
Input
Delay
DR
Output
factor
Input
Input
G#
Output
Goal number
GD
Output
Goal duration
Miscellaneous
Common connectors on discrete rate blocks
In or Out?
Meaning
GS
Output
Goal status:
0 - no goal
1 - starting
2 - in progress
3 - ended
4 - interrupted
GQ
Output
Goal quantity
GO
Input
Output
IC
Input
Item capacity
ICO
Input
Item contents
ID
Input
IT
Input
Output
LE
Output
Level of contents
NB
Output
Number blocked: 0 or 1
PE
PT
Input
Preempt item
Output
Process time
Output
Cumulative quantity
Input
Maximum rate (Note that the effective rate is reported by the flow
input and output connectors.)
S (on Convey
Flow)
Output
Status:
0 = empty
1 = intermediate
2 = full
S (on Interchange or
Tank)
Output
S (on Valve)
Output
S (on Sensor
or Valve)
Output
S (0-n)
Output
SP
Input
Speed parameter
SP
Output
Effective speed
SR
Output
Discrete Rate
Connector
427
428
Miscellaneous
Animation
Connector
In or Out?
Meaning
start
Input
Start hysteresis
stop
TL
Input
Stop hysteresis
Output
TU
Output
TLO
Output
TUO
Output
Animation
Rate library blocks can be animated during the simulation if Run > Show 2D Animation has been
selected before a simulation run. For blocks with animation, the following information explains
what each display means.
The models illustrated in this section are located in the folder \Examples\Discrete Rate\Miscellaneous.
Tank
Discrete Rate
Tanks animate information about their levels and information about the direction of flow within
the Tank.
Level information
The table below shows animation of the Tanks level under different conditions.
Finite Capacity
Infinite Capacity
1000
100
Full
10
Specific Behaviors
Empty
Miscellaneous
Animation
429
Direction information
An arrow is animated on the icon to indicate the direction of change in the Tanks level. When
there is no arrow, it means that the Tank has neither an inflow nor an outflow rate.
Interchange
The Interchange block displays the same animation behavior as a Tank, shown above. In addition,
a ball appears in the middle of the blocks icon when an item is present in the block. The ball is red
if the item is ready to leave the block but is blocked downstream. Otherwise, the ball is green. If
the option Tank only exist while Item is in it is chosen and there is no item in the block, the tank
icon animates as white with cross-hatching.
A Valve reports its maximum and effective rates when animation is turned on. If the option Valve
animates and reports blocking and starving information is not selected in the Executive blocks
Discrete Rate tab (the default setting), a Valve will display only its limiting or non-limiting status.
If that option is selected, it will also report its blocking and starving status. (See Valve animates
and reports blocking and starving information on page 423 for full information.)
Displaying limiting and non-limiting status
By default, the Valve only animates information about its limiting or non-limiting status.
Non-Limiting
Limiting
Limiting is when the effective rate equals the maximum rate. In this case, the Valve is what limits
the flow. When a Valve is non-limiting, the effective rate is less than the Valves maximum rate. In
that case, the Valve has no impact on the flow.
Discrete Rate
Valve
430
Miscellaneous
Animation
When the effective rate is not the same as the constraining (maximum) rate, the two numbers
are represented as effective rate/constraining rate above the icon. If the two rates are the same,
only one number appears.
If the Valve is limiting and the effective rate is greater than 0, the interior of the icon is plain
blue. If the Valve is limiting to 0, the interior of the icon is plain red. If the Valve is not limiting,
the interior of the icon is white.
When the effective rate is greater than 0, a blue rectangle appears along the icon, and the rates
are written in blue. When there is no flow, the blue rectangle does not appear on the icon and
the rates are written in red.
Discrete Rate
Blocked
Starved
Limiting
Maximum rate 0
Non-limiting, no flow
Non-limiting, no flow
Non-limiting, no flow
Limiting, no flow
Limiting, no flow
If a Valve is blocked, it means that there are one or more blocks downstream which are limiting the
flow through the Valve. If a Valve is starved, it means there are one or more upstream blocks that
limit the flow to the Valve.
If there is no flow, there will not be a horizontal line through the Valve. If there is flow, and the
Valve is non-limiting, the horizontal line through the Valve is a patterned blue. The horizontal
line is a plain blue color if there is flow.
If a Valve is limiting, the central, vertical part of the Valve is plain blue (if the maximum rate is
>0) or red (if the maximum rate = 0).
Miscellaneous
Animation
431
If the right side of the Valves icon is plain blue, the block is partially blocked by downstream
blocks. If there is a red line on the right side of the icon, the flow is completely blocked downstream.
If the left side of the Valves icon is plain blue, the block is partially starved by upstream blocks.
If there is a red line on the left side of the icon, the flow is completely starved upstream.
Goal and hysteresis animation
A Valve that uses a quantity goal to control its flow has a blue line below its icon. If the Valve controls its flow with a duration goal, the line is green. While the goal is On, a progression bar appears
along the top of the blue or green goal line.
A Valve that uses hysteresis has a purple line at the bottom of its icon. While hysteresis is active, the
purple line is thicker for all or part of its length.
Hysteresis is active
Sensor
The shape and color of the Sensor blocks icon indicates if the flow is being blocked, starved, or
both., and if there is flow or not.
Blocked
Starved
Yes >>>
No >>>
Convey Flow
The animation of the Convey Flow block shows what mode it is in, the distribution of flow along
its length, the position of the accumulation point, and other information.
Mode animation
Accumulate-maximum density
Non-accumulating
For further exploration, the Compare Convey Flow model compares the behavior of three Convey
Flow blocks, each set to one of the possible modes, under different emptying rates. The model is
located in the folder \Examples\Discrete Rate\Delaying Flow.
Distribution of flow and other information
A Convey Flow block animates the distribution of flow as follows:
Discrete Rate
Flow?
432
Miscellaneous
Animation
A blue shape along the top of its icon indicates flow distribution.
A slowing of flow movement causes the blue shape to have a green border.
The complete stopping of flow movement causes the blue shape to have a red border.
If the block has reached its capacity, the shape is a solid blue rather than a dotted blue.
If the block is empty, a black line will appear at the top of its icon, as seen above.
The position of the accumulation point is indicated by a red vertical line that moves along the
length of the icon. This is shown in the first, second, and fourth screenshots below and is discussed on page 402.
Discrete Rate
Distribution of flow
Slowing movement
Stopped
Capacity reached
Advanced Topics
Some additional information
for those of you who want to know more
434
Advanced Topics
What this chapter covers
The earlier chapters in the Discrete Rate module discussed important concepts you need to know
to build discrete rate models. This chapter provides an overview of the way discrete rate calculations are made and describes the underlying functioning of the Rate library. This information is
not necessary to build discrete rate models but will be of interest to advanced users.
It is highly recommended that you read the previous discrete rate chapters before this one, particularly the chapter Rates, Constraints, and Movement.
Discrete Rate
LP technology
Linear programming problems involve the optimization of an objective function subject to a set of
constraints. The purpose of solving a linear programming problem is to maximize or minimize
selected variables in the objective function.
LP technology is the method ExtendSim uses to provide global oversight to maximize the movement of flow throughout a discrete rate system. The discrete rate architecture employs an integrated LP Solver DLL to solve a series of equations to optimize effective rates at each point of the
simulation run.
The purpose of the LP calculation is to determine the maximum effective flow rates in the system
given the constraints defined by block settings and the structure of the model. After all the rules
for storage capacity and movement have been declared in the model, ExtendSim uses the Executive
blocks LP calculations to cause as much flow as possible to move through the system. This calculation is handled automatically and internally.
Overview
In a discrete rate model, the Rate library blocks communicate with each other and with the Executive block. In turn, the Executive communicates with an integrated linear program (LP Solver).
The Rate library blocks are dependent on each other, have an effect on one another, and are part of
a global LP system that evaluates the entire model to calculate its effective flow rates.
A rate section is a network of connected blocks, all possessing the same effective rate. Established
at the beginning of the simulation run, rate sections do not change. (See Rates, rate sections,
and the LP area on page 357 for more information.)
An LP area is made up of one or more rate sections; the actual configuration can change during
the simulation. A change in a blocks constraints during the simulation run initiates a propagation of messages through all the rate sections whose effective rates might change. This propagation defines the LP area at that point in time.
Advanced Topics
LP technology
435
Each rate section within the LP area contributes a part of an LP equation for a recalculation.
The purpose of the recalculation is to determine the maximum effective flow rates in the system,
given the constraints defined by block settings and the structure of the model. The result is the
set of effective rates for each section in the LP area at that point in the simulation. The system is
optimized such that only the rate sections in the LP area are recalculated; all the other effective
rates in the system dont need to recalculate at that moment and wont.
Among other things, the LP calculations take into consideration each blocks:
Critical constraints, which place an upper bound on rate sections connected to that block.
Relational constraints, which define the way rate sections are related to each other.
Bias, which is a blocks preference that flow travel one route rather than another.
The LP area
The LP area is made up of one or more rate sections linked together by the fact that their effective
rates could change at that point in the simulation a change in the effective rates in one section
might impact effective rates in the other sections. The rates, constraints, and biases within the LP
area are used by the LP Solver to calculate the optimal set of effective rates for the rate sections
contained within that area.
The boundaries of the LP area are determined through the propagation of messages between Rate
library blocks. A change in a blocks constraints during the simulation run causes the block to
notify the Executive and send messages which propagate through all the rate sections whose effective rates might change as a result. Whether the block is the originator of the recalculation request
or receives a propagation message:
The block declares which of its connected rate sections are in the LP area. The propagation process then creates a global list of rate sections to include in the current LP area.
If the block provides a relational constraint connection between two or more rate sections, the
effective rates connected to that block are dependent on one another. The block then continues
the message propagation to all the dependent block(s), who propagate the message to their
dependent blocks, and so forth.
The change in the originating block will definitely cause a recalculation of the effective rates for all
directly connected rate sections, and (depending on relational constraints between the sections)
might cause a recalculation of the effective rates for other rate sections.
The boundaries of the LP area will change dynamically during the simulation depending on which
effective rates are involved in the recalculation and which relational constraint dependencies occur
between rate sections.
Discrete Rate
The effective rate of one section can affect the effective rate of another section through relational
constraints. When an event occurs that causes a rate sections effective rate to be reevaluated, blocks
propagate rate block flow messages (see Block messages on page 445) throughout the model to
determine which other rate sections might be impacted by the new event. The affected rate sections constitute the LP area and rate sections outside of the LP area are not included in the recalculation, reducing redundant computations.
436
Advanced Topics
LP technology
tional constraints between the sections) might cause a recalculation of the effective rates for other
rate sections. The sequence is:
1) A blocks constraint changes.
If a blocks status changes it can affect its effective inflow and/or outflow rates. For example, the effective inflow rate for a finite Tank block that is filling up is greater than its effective outflow rate. When the Tank becomes full, it creates an event because its effective
inflow rate can no longer exceed its effective outflow rate.
When a block reacts to new parameters, the effective inflow and/or outflow rates must be
reevaluated. For example, a Merge block in Select mode might choose its top inflow
branch at the start of the simulation. If the block subsequently receives an order to select
its bottom inflow branch, its effective rates have to be recalculated.
2) The block posts a zero-time event requesting a reevaluation of effective rates.
3) The LP area is determined based on the propagation of block messages.
Starting with the originating block. messages are propagated through the model to all the
blocks that might be affected by the change. This propagation of messages defines the
boundaries of the LP area.
The LP area encompasses all the rate sections with effective rates that might change during
the calculation.
Discrete Rate
For a complete description of the LP area and how it is determined, see page 435.
4) As the LP area is determined, the blocks update their status.
Each block that is part of the LP area updates the amount of flow which has passed
through it since the last update.
If the block is a residence block (Convey Flow, Interchange, or Tank), the amount of flow
the block is holding is also updated.
Note: The frequency of status updates outside of an LP calculation is set in the Executive.
See Update flow status on page 423 for information.
5) Blocks report to the Executive how they impact effective rates.
Each block in the LP area declares the flow rules (critical and relational constraints) that it
applies to the rate section it is connected to.
The blocks bias order is stored in a list. Each block declares its bias order (if any) and provides coefficient information to the Executive. The coefficients allow the Executive to
build an objective function that considers the effect of the bias.
See Types of information provided to the Executive on page 437.
6) The Executive determines an objective function.
The objective is to maximize the flow rate for each rate section subject to the constraints
defined by the blocks flow rules.
Each decision variable in the objective function is the effective rate of a section in the LP
area. For instance, the objective could be Maximum effective rate = 1*ER1+ 1*ER2 +
1*ER3, where ERn is the effective rate for a rate section in the LP area.
Advanced Topics
LP technology
437
If there is no bias, or all the intermediate calculations related to bias order have been completed, the coefficient of each variable will be 1. If there is bias, the coefficient could be
other than 1.
7) The Executive communicates with the LP Solver.
The Executive gives the LP Solver the objective function and the information from the
blocks and rate sections within the LP area.
Critical constraints put an upper bound on some of the effective rates (the decision variables). Relational constraints provide a link between the effective rates of different rate sections and must be taken into consideration during the calculation. For instance, if effective
rate X is less than or equal to effective rate Y, the objective function must conform to that
information.
8) The Solver performs a calculation.
The Solver calculates an optimized set of effective rates for the LP area.
The result is an intermediate LP calculation (if there is bias) or the final LP calculation (if
there is no bias).
For full details, see The LP calculation on page 440.
9) Steps 6-8 are repeated, if necessary.
For each recalculation, the list of critical and relational constraints is changed to include
the constraints caused by the particular bias order being considered.
See Bias information on page 438.
10) The rate sections are notified.
The Executive sends Executive block flow messages to the head of the rate sections to
update to the new effective rates.
The blocks receiving this information update according to their dialogs and value connectors. They then post new events if necessary.
Since the purpose of the recalculation is to maximize the entire set of effective rates, some rates will
change while others might not.
Discrete Rate
If the blocks in the LP area have bias, the Executive must determine intermediate objective
functions and the Solver must perform intermediate calculations. The number of recalculations is equal to the number of blocks with bias, plus 1.
438
Advanced Topics
LP technology
Relational constraints describe the dependencies between different rate sections. In some blocks,
relational constraints can vary depending on the state sensitivity of the block; in others they are
permanently active.
An example of a state sensitive relational constraint can be found in a Tank block. (Tanks
are always within two rate sections; the input side and the output side define the sections.)
As long as a Tank is empty, its relational constraint is defined as effective outflow rate is
less than or equal to effective inflow rate. Once the Tank becomes not empty, the relational constraint doesn't apply.
An example of a permanent relational constraint can be found in a Change Units block
where a conversion factor defines the relationship of the inflow effective rate to the outflow
effective rate. If the factor varies over time, the relational constraint may also vary. But the
dependency between the inflow and outflow effective rates is active for each calculation
which includes the two rate sections.
Discrete Rate
Bias information
When the LP area is created, the Executive ranks all Bias blocks and any Merge or Diverge blocks
with a bias order in a list. The Executive considers the top bias from that list as part of the objective
function and instructs the Solver to perform an intermediate LP calculation using that function
and the current critical and relational constraints. Then the Executive takes the next bias order into
consideration, and so forth.
Since bias affects critical and relational constraints, each succeeding bias order means a new objective function will be determined and a new set of critical and relational constraints will be added to
the previous ones. The results from the previous LP are used as inputs to the next LP. This results
in multiple intermediate LP calculations one for each bias order in the list until the final result.
Most blocks with bias order supply:
Flow rules (critical and relational constraints) which apply to all the LP calculations. (This information is not supplied by a Bias block.)
A set of coefficients that the Executive will use to build the objective function corresponding to
this bias order. Depending on the bias information received from the blocks in the LP area, the
intermediate objective function can include coefficients that are other than 1. (A coefficient of 0,
for instance, indicates that a particular effective rate does not need to be maximized; it causes
that effective rate to not be directly affected by the maximization.)
Flow rules for that bias order which use the results of the intermediate calculation. (After the
intermediate calculation, the results of the calculation are used to add new flow rules to the succeeding calculations.)
Some additional situations that enter into the calculation include:
If a Bias block has a bias order that is Blank or is less than or equal to 0, the block does not
express any preference.
If multiple Bias blocks have identical bias orders, the effective rates for these blocks cannot be
predicted. The model will use one of the possible solutions.
Merge and Diverge blocks with bias order are always lower on the bias list than any Bias block.
Advanced Topics
LP technology
439
Relational:
Permanent
Relational:
State Sensitive
Bias
Order
Bias
No
Yes
No
Yes
Catch Flow
No
No
No
No
Change Units
No
Yes
No
No
Convey Flow
Yes
No
Yes
No
Block
Mode
Diverge
Neutral, Proportional,
Select, Unbatch
Depends
Yes
No
No
Diverge
Distributional, Priority,
Supply Sensing
Depends
Yes
No
Yes
Yes
No
Yes
No
Interchange
Batch, Neutral,
Proportional, Select
Depends
Yes
No
No
Merge
Distributional, Demand
Sensing, Priority
Depends
Yes
No
Yes
Sensor
No
No
No
No
Tank
Yes
No
Yes
No
Throw Flow
No
No
No
No
Valve
Yes
No
No
No
Diverge and Merge blocks can imply a critical constraint depending on the branch parameter and
the mode.
Calculation
Change Units
Convey Flow
Discrete Rate
Merge
440
Advanced Topics
Upstream supply and downstream demand
Block
Calculation
Diverge
Select. A permanent relational constraint applies between the inflow effective rate
and the selected outflow effective rate: Xin=Xout selected
Proportional. A set of permanent relational constraints applies to insure the proportions: Xout_i = factor_i*Xin (i: 0=>n-1)
Batch/Unbatch. Permanent relational constraints: Xout_i = Xin (i: 0=>n-1)
Neutral, Priority, Distributional and Supply Sensing. Permanent relational constraint Xin = Xout_1+ Xout_n
Interchange
Merge
Tank
The LP calculation
Discrete Rate
The Executive block maximizes an objective function composed of the set of effective rates for the
LP area. If there is no block with bias order involved in the LP area, the Executive block maximizes
the sum of all the effective rates in the LP area in this case, only one LP calculation is necessary.
If the blocks in the LP area have bias, the Executive must determine multiple intermediate objective functions and the Solver must perform multiple intermediate calculations. The number of
recalculations is equal to the number of blocks with bias plus 1.
When the LP area involves blocks with bias order, the calculations are made in cascading order. For
each bias order, an intermediate calculation is made with an objective function depending on the
type of block that is being evaluated:
Bias block. The function to maximize is the sum of the effective rates attached to the Bias blocks
with an identical bias order. When the calculation is made, the function is used as a new rule for
the succeeding intermediate calculations. The calculation is: sum effective rates within the bias
order>= result of the maximized function.
Merge/Diverge in Priority mode. The function to be maximized contains the effective rates from
the variable inflow and/or outflow branches of the block. The lower the priority of the branch,
the higher the coefficient associated with the effective rate. The calculation is: sum p*Xp (for p:
1=>n with 1 top priority and n lowest priority). When the calculation is finished, the objective
function is used as a new rule for the next intermediate calculations (sum p*Xp >= result of the
maximized function).
Merge/Diverge in Batch/Unbatch, Distributional, Neutral, Proportional, Select, or Sensing
mode. This calculation is beyond the scope of this document.
When all the intermediate LP calculations have been made, the last LP calculation maximizes the
sum of all the effective rates for the LP area.
Advanced Topics
Upstream supply and downstream demand
441
cussed in Sensing mode on page 379) and the Sensor block can be used to report the potential
rates for making model decisions.
This is an advanced topic because the concept is complex and there is an elevated potential for
error, as discussed in the section Cautions when using potential rates, below. Careful model verification and validation, and an advanced knowledge of the ExtendSim LP technology, are required
to avoid unexpected results.
Definition
The potential upstream supply rate is the theoretical rate at which an upstream source could provide flow to the beginning of a rate section if there werent any downstream limitations on flow
movement (downstream capacity is infinite). For instance, for a not-full Tank at the beginning of a
rate section, the upstream supply rate would equal the Tanks effective inflow rate. A not-full Tank
does not limit the inflow rate it can receive. In this case, the effective inflow rate is also the potential upstream supply rate.
The potential downstream demand rate is the theoretical rate at which a downstream section of
the model could receive flow from the end of an upstream rate section if there were an unending
upstream supply of flow (upstream source is infinite). For instance, for a not-empty Tank at the
end of a rate section, the potential downstream demand rate would be equal to the Tanks effective
outflow rate. A not-empty Tank does not limit the outflow rate it can provide. In this case, the
effective outflow rate is also the potential downstream demand rate.
When flow movement is from left to right, the information to calculate the upstream supply rate is
propagated from left to right while downstream demand information is propagated from right to
left.
Discrete Rate
Upstream supply and downstream demand could potentially be infinite. For example, the
upstream supply rate right after a Tank (if the tank doesn't declare any constraint on its outflow
rate) is infinite.
442
Advanced Topics
Upstream supply and downstream demand
In some cases the potential rates as reported by the Sensor block are not accurate. Depending on
how flow is diverged and merged, the potential supply or demand rates could be aggregated even
if they should not be. This is illustrated in the Supply & Demand Warning model described
below.
Merge/Diverge blocks in Distributional, Neutral, and Priority modes are not always compatible
with Merge/Diverge blocks in Sensing mode. Consequently, models with blocks that mix Sensing mode with Distributional, Neutral, or Priority modes are prone to error.
A Merge or Diverge block in Sensing mode has a bias order. Depending on the blocks location
in the Executives list of bias orders:
The effective rates might be different.
The block might not follow the proportions specified by the Sensing mode.
For instance, the effective rates are different in the Combine Priority Sensing model and the
Combine Sensing Priority model, and neither of those models follow the Sensing rule.
Discrete Rate
Evaluating the model from right to left (for the downstream demand rate):
Sensor C reports a demand (Demand C) of 1000 gallons/minute because Valve C limits flow to
1000 gallons/minute. The Sink at the end of the line doesn't limit the inflow rate at all.
Demand B1 is 1000 gallons/minute because the Prioritize 2 block has its top priority at branch
B1. (Verification: If a Tank with flow is present at branch B1, Prioritize 2 and Valve C would
accept 1000 gallons/minute coming from branch B1.)
Demand B2 is 400 gallons/minute because the effective rate on branch B1 is 600 and Demand
C is 1000: Demand B2=Demand C-effective rate B1. (Verification: If a Tank with flow is pres-
Advanced Topics
Upstream supply and downstream demand
443
ent at branch B2, it could provide 400 gallons/minute because the total Prioritize 2 can accept is
1000 and the block already takes 600 from the top priority branch.)
Sensor A reports a demand of 1400 gallons/minute because Demand B1 is 1000 and Demand
B2 is 400. However, this is incorrect. (Verification: If a Tank with flow is placed right before Prioritize 1, the outflow effective rate would be 1000 gallons/minute and not 1400 gallons/minutes. The erroneous result comes from the fact that the association of correct local rules
doesn't guarantee a correct global result.
By understanding flow rules and how they can affect the global result, you can avoid this problem.
The most important step is verifying this model from left to right for the supply and from right to
left for the demand. Two solutions are 1) having the Prioritize 2 block be in Neutral mode, and 2)
placing a Valve with a maximum rate of 1000 between Sensor A and Prioritize 1.
Mixing Merge/Diverge block modes
Situations where Merge or Diverge blocks in Sensing mode are mixed with Diverge or Merge
blocks in Distributional, Neutral, or Priority modes within an LP area should be avoided as they
are prone to give inaccurate results.
Discrete Rate
In these types of mixed-mode situations, the LP area is going to be recalculated multiple times to
provide the effective rates and the upstream supply and downstream demand rates. All the blocks
in the LP area must provide one set of constraints to the Executive so it can solve the effective rates
and a second set of constraints so the Executive can solve the supply and demand rates. This causes
repeated intermediate LP calculations, the results of which are affected by constraints which are
applied for the supply and demand rates. This may yield inaccurate results.
444
Advanced Topics
Messaging in discrete rate models
The supply in branch B1 is 1,000 while the supply in branch B2 is 400. However, the Sensing 2
block doesnt distribute flow following the expected supply proportion.
Because the Prioritize 1 block has the top bias order, the Executive gives priority to that block in
choosing how to distribute the flow between the branches B1 and B2.
At the first intermediate result of the LP calculation, branch B1 gets an effective rate of 600 gallons/minute and branch B2 gets 0 gallons/minute.
Because this decision has been made for branches B1 and B2, the Sensing 2 block with its lower
bias order cannot control the proportion of flow it will get through branches B1 and B2. For
example, if the supply from B1 is 1000 gallons/minute and the supply from B2 is 400 gallons/
minute, the proportion between the effective rates for the Sensing 2 blocks inflow is not 71%
B1 (1000/1400) and 29% B2 (400/1400) but rather 100% B1 and 0% B2.
Discrete Rate
The Sensing 1 block has the top bias order, so the Executive gives priority to that block to
choose how the flow it receives should be distributed between branches B1 and B2.
At this point of the LP calculation, the Prioritize 2 block gets a supply of 1000 gallons/minute
and has not decided how to distribute the flow. With that limited information, the potential
upstream rate is calculated as 1000 gallons/minute for Supply B1 and 1000 gallons/minute for
Supply B2. Therefore, Sensing 1 decides to get 50% of the flow from inflow branch B1 and the
other 50% of the flow from branch B2.
Because the decision has been made for branches B1 and B2, Prioritize 2 with its lower bias
order can no longer control the distribution of flow between branches B1 and B2.
Advanced Topics
Messaging in discrete rate models
445
Block messages
Discrete rate blocks have a sophisticated and complex messaging structure for communicating
with each other and with blocks from the Value and Item libraries. They can be categorized as:
Event
Value connector
Item connector
Flow connector
Rate block flow
Executive block flow
When a block initiates a recalculation of the set of effective rates, a succession of messages and calculations are also initiated. Understanding how block messages work can prevent redundant messages from being created. At the very least redundant messages will cause runtimes to be longer
than need be. At the very worst, redundant rate calculations could introduce bugs into a model
when effective rates are temporarily calculated using one or more out-of-date parameter values. For
instance, see Limiting the number of recalculations on page 383.
By limiting the number of times the set of rates have to be recalculated, the operational efficiency
of the model is maximized. For example, see Limiting the number of recalculations on page 383.
A future event message occurs when the simulation clock reaches a time posted by a block. For
instance, when the level in a Tank increases, it posts a future event to the Executive corresponding to the Tanks full time. Once the simulation clock has advanced to this future event, the
Executive sends an event message to the Tank, alerting it that it is full.
A current event message occurs when a block wants to be activated before the simulation clock
advances, but after it has completed its response to another message. For instance, instead of a
Valve immediately calculating a new effective rate when its constraining rate changes, it will post
a current event to the Executive letting it know that it will have to recalculate at a certain time.
This gives all the other blocks in the model the opportunity to update before the recalculation
occurs.
In discrete rate models, blocks from the Value library typically neither post events to the Executive
nor receive event messages from the Executive. This has important ramifications on the behavior
of continuous blocks in discrete rate models.
Value connector messages
Blocks in a discrete rate model send value connector messages either because a new number is
needed by an input connector or because the value of an output connector has changed. These
messages request updated information for the input connectors or notify connected blocks that the
output value has changed. For example, if a Valve blocks R value input connector is connected and
the Valve receives a new value at R, the constraining rate on the flow changes. This will cause a
recalculation of the set of parameters in the model.
Discrete Rate
Event messages
Event messages communicate between the Executive block and Rate library blocks. In a discrete
rate model, the simulation clock advances from one event to another. Each time the clock
advances, the Executive block sends event messages to the blocks that have associated themselves
with that event. There are two types of events: future and current.
446
Advanced Topics
Messaging in discrete rate models
These messages work the same in discrete rate models as in discrete event models. They are discussed fully at Value input and output connector messages on page 305.
Item connector messages
Discrete rate models often have portions that are item-based, using blocks from the Item library.
The Rate librarys Interchange block also has item connectors; it provides a mechanism for interacting with item-based blocks in a discrete rate model.
Item connector messages (primarily wants, needs, and rejects) use a conversation of messages to
propel items from one item-based block to another through the model. The item connector messages work the same in discrete rate models as in discrete event models. They are discussed fully at
Item connector messages on page 307.
Flow connector messages
Flow connectors provide the value of the effective inflow and outflow rates. Flow connector messages cause the effective inflow/outflow rate to be updated for all connected blocks each time the
LP calculation determines that the effective rates have changed.
Discrete Rate
3D Animation
Introduction to E3D
Some things to know before you run 3D animation
448
Introduction to E3D
What this chapter covers
For communicating a concept, a 3D representation of the spatial location of objects and their
movement over time can be an extremely powerful and effective tool. The ExtendSim Suite package includes a next generation 3D animation capability that is fully integrated with the ExtendSim
simulation environment.
Simulation is concerned with building a logical model of the behavior or performance of a system.
3D animation, on the other hand, involves a model of a physical space. In ExtendSim you can
build a logical model that is separate from the physical model. When 3D animation is desired,
ExtendSim translates the logical model into a 3D representation.
This ability to separate the logical simulation model from the 3D environment is an important
ExtendSim advantage because:
A logical model cannot be directly built in 3D space. If the physical and logical aspects were not
separated, every aspect of your system would have to be created as a physical representation of
the real system. That would be both counter-intuitive and tedious.
You may not need 3D for your purposes, so creating a 3D animation for every model would be
a waste of time.
You can ignore how the model will appear in 3D until the logical model is finished. This
increases productivity since you can concentrate on model behavior and results without being
concerned about layout.
In ExtendSim, 3D animation is available if and when you need it.
E3D
The ExtendSim 3D (E3D) environment is designed to be used both for model presentation and
for model comprehension and debugging. The E3D window provides a fully three-dimensional
representation of the world of the model. The objects modeled in the E3D window maintain
information about their positions in three dimensions as well as their other physical and behavioral
properties. The E3D window is tightly integrated with the rest of the ExtendSim simulation
engine and is open source, so you can control every motion of every object and every aspect of
what is happening in the 3D world.
Introduction to E3D
Overview
449
An Item Animation tab for selecting a 3D object to represent the items that leave the block and,
in some cases, for choosing customizable aspects of their appearance (known as skins).
A Block Animation tab for choosing a 3D object to represent the block in the 3D world. You
can also define its scale, rotation, and location in the 3D window, as well as other properties.
Furthermore, the Item librarys Transport block is useful for representing the movement of an item
from one point to another along a path, while the Convey Item block represents moving items
along a conveyor.
The most common way to use the E3D environment is to build a discrete event model using the
Item library blocks and run the simulation with the E3D window open. This displays the model
and its items, events, and results in the 3D world.
ExtendSim includes an extensive collection of 3D objects to represent items and blocks. You can
also add your own 3D objects.
Animation library
Blocks in the Animation library perform specific 3D functions such as enabling sunlight or placing
scenery objects or text boxes in the E3D window. The Animate 3D block provides a non-programming method to perform a 3D action in response to an items passage. For instance, you can create
or delete an object, mount one object on another, and so forth.
Overview
The ExtendSim 3D (E3D) window is where 3D animation occurs. This is a separate window from
the worksheet where you build and run a simulation model. When you run a discrete event simulation with 3D animation on, 3D-enabled constructs from the model worksheet are represented as
graphical objects within the E3D window. The E3D window contains an editor so you can modify
the 3D representation of the model, add objects, and edit the terrain.
For instance, by default the blocks of a discrete event model are represented in the E3D window by
3D block objects, the items that move through the model are represented by 3D item objects, and
the models connections indicate the path of the 3D item objects.
Features
Since it is common to use the Item library to create discrete event models that are then run with
3D animation, the following features are described in regards to the Item library. Keep in mind,
though, that you can build custom blocks that are also 3D-enabled.
E3D
ModL functions can even be used to perform 3D animations that do not require that the model be
run. For instance, the 3D animation of the Boids model was created using custom-built blocks and
does not require the model to be run. The Boids model is located in the folder \Examples\3D Animation.
450
Introduction to E3D
Overview
Animation modes
Each model has a saved 3D animation mode: QuickView, Concurrent, or Buffered. The selected
mode controls aspects of the interaction between the ExtendSim application, the E3D window,
and the ModL block code.
Blocks appear as objects in the E3D window
In a discrete event model, the blocks occupy a 2D model worksheet. 3D-enabled blocks from that
model, such as those from the Item library, also automatically occupy a position within the E3D
window. By default some of these blocks appear as rectangular objects with the same icon as they
have in the 2D model, while others appear as specific objects. For instance, the default is that
Select Item Out blocks appear as rectangular objects in the E3D window but Activity blocks
appear as machines.
Unless you unlink their 2D and 3D positions, the location of the block objects within the E3D
window (their 3D position) depends on their current position in the 2D model.
The appearance and location of block objects in the E3D window can be changed from the
default. This will be shown in the tutorial chapters.
3D items appear as objects and travel on pathways
By default, pathways in the E3D window are initially related to the connections between Item
library blocks in the 2D model. As you will see in Tutorial III, you can modify the default pathways by unlinking a blocks 2D/3D position and moving the block in the E3D window.
In addition, entirely new pathways can be designated by using the E3D Editor to create a named
path between two arbitrary points in the model. Then when an item takes a specific route in the
model, it uses the corresponding pathway in the E3D environment.
E3D
The position at which an object can be mounted on another object is called a mount point. Most
objects have only one mount point, but some objects, like people and shelves, have several mount
points that are selectable depending on what object will be mounted.
For custom object builders, the Shelf object has multiple mount point behaviors.
E3D environment is modifiable
Using the E3D Editor you can directly modify the E3D window add scenery objects, modify the
terrain, and change lighting, ceiling colors, and other environmental aspects to fit the model.
These changes to the basic 3D view are saved in environment files.
Introduction to E3D
Prerequisites
451
4) The environment files can also be customized using the E3D Editor to define the appearance
of the animation area any permanent pathways and 3D objects as well as specific information
about the terrain, sky, sun, and so forth without affecting the appearance of the 2D model.
5) And finally, ModL functions and message handlers allow you to develop customized 3Denabled blocks and specialized 3D functionality. ModL functions can be accessed through
equation blocks or by programming.
Prerequisites
Software and hardware
E3D animation is only available in the ExtendSim Suite product.
A graphics/video card capable of supporting 3D rendering. At a minimum, you will need at least
64 MB of memory on the card and a 3D accelerator. A faster card with more memory will
improve the performance of the E3D window.
The minimum memory required for E3D animation is twice the minimum for ExtendSim.
E3D
3) Settings in the Simulation Setup and Options dialogs affect both the contents of the E3D window and the relationship between ExtendSim, the model that controls the E3D window, and
the E3D window itself. For example, these settings can enable 3D directional sound effects or
cause the animation to run after the simulation rather than concurrent with it. These dialogs
and commands are described in E3D Editor menu commands on page 543.
452
Introduction to E3D
How the E3D module is organized
If your computer does not have QuickTime installed, the color of the 3D objects in the preview
area of Item Animation and Block Animation tabs for Item library blocks may not display correctly. QuickTime is Apple Inc.s technology for handling video, sound, animation, graphics,
and so forth. It can be downloaded for free onto a Windows or Macintosh computer from the
Apple Inc. web site.
Preparation
This module assumes that you have either read the following or have equivalent experience:
Tutorial module, Chapters 1 and 2, starting on page 13.
If you are building discrete event models, as opposed to creating custom 3D-enabled blocks, you
should complete the Discrete Event module that starts on page 91.
E3D
3D Animation
Tutorial I
Exploring the E3D window
454
Tutorial I
The E3D environment
This chapter focuses on the E3D window and the appearance of a simulation model in that window. The purpose of this chapter is for you to become familiar with the E3D terminology and
environment. This chapter covers:
Exploring the E3D window
Opening the window and learning about its options
Navigating within the window
3D animation modes
Running a simulation and animating it in 3D
The Tutorial II chapter that follows this one will show you how to add 3D features to an existing
2D discrete event model.
The E3D window will not open unless a model worksheet is open. Even if a model is open, the
E3D window will not open if you are not licensed for the ExtendSim Suite product.
Give the command Window > E3D Window or use the toolbars Open E3D Window button.
Depending on the speed of your processor, it may take a little while for the window to open.
E3D
Interface controls
The top left control is a popup menu that
displays the name of the associated model. Only one E3D window can be open at a time, so if
multiple models are open, this popup menu allows you to choose which model will be associated
with the E3D window. The name of the selected model (in this case, Model-1) appears in the
popup and also in the title bar at the top of the window.
Tutorial I
The E3D environment
455
The next control is a popup menu for choosing the specified resolution, or size, of the window.
Clicking this popup displays a list of possible sizes for the E3D window. Selecting a different size
will cause a redraw of the 3D window at the new resolution. Lower resolutions will make the
E3D window smaller; higher resolutions will make the window larger. Resolution information is
stored with the model.
The third and fourth controls are for selecting the speed of the animation, either Slower or
Faster. The selected speed factor (0.25 to 8) is displayed in the title bar in brackets; the default is
a factor of 1. Information about the selected 3D speed setting is stored with the model.
In QuickView mode the speed buttons in the E3D window do not affect the speed of the simulation, only the speed of the 3D animation. In Concurrent and Buffered modes, there is a direct correlation between 3D animation speed and simulation speed.
Title bar
The title bar at the top of the E3D window lists the name of the model associated with the E3D
window, the 3D animation mode enclosed in chevrons (in this case, <QuickView>), the 3D
speed factor displayed in angle brackets (in this case, [1]), and the name of the models environment file (by default, new models use the Extend3D.mis environment file).
Modes are discussed in 3D animation modes on page 458, the speed conversion factor is discussed on page 536, and environment files are described starting on page 490.
The title bar also includes the ExtendSim icon. Clicking the icon (Windows only) reveals the
Move, Editor, and Close commands. The Editor command enables the E3D Editor; editors are
discussed starting on page 491.
MiniMap and camera
The cyan square in the upper right hand corner of the E3D window is the
MiniMap. This is a miniaturized display of the E3D window; it shows the
position of a virtual camera and any local objects as if seen from directly
overhead a location in the E3D window.
E3D
456
Tutorial I
The E3D environment
an empty model worksheet, as you have done in this chapter, the 3D world will be empty. When
the E3D window is associated with a model, it will contain 3D objects that represent the 3Denabled blocks in the model.
You can add scenery and fixtures to the E3D window and use 3D features and settings to modify
the terrain, lighting, ceiling colors, and other environmental aspects to fit the model. And you can
change the 3D objects and their location to enhance the 3D animation. This will be shown in
other chapters.
Selecting and moving
Clicking an object in the animation area of the E3D window selects it and causes it to display with
a cyan frame around it. Clicking again unselects it. If the 3D object is the representation of an
ExtendSim block, double-clicking the object will open the dialog box of the associated block.
By default, selecting and moving a block in the 2D model also moves its
object in the E3D window. For instance, if you place an Activity block
Linked positions
(Item library) in the model, you can click and drag it around the worksheet. When you release the mouse, the Activitys representative 3D object
will correspondingly change location in the E3D window. This is because the 2D position of a
block is linked by default to the 3D position of the object, as shown in the Block Animation tab
and the screenshot to the right, above.
You need to use the E3D Editor to move a 3D object directly in the E3D window. If the objects
position is linked to a block, and you move the object with the Editor, it will also move the block.
The Editor is described in The E3D Editor on page 491.
E3D
To pan the area, change the direction of the camera by right-clicking the mouse (Windows)
while moving the mouse around the window. (On Macintosh, press the control key while
mousing around the window.)
Tutorial I
The E3D environment
457
Use the mouse to change direction and the keys to move, both simultaneously, to navigate
around the 3D world.
Note how the MiniMap changes as you navigate the 3D space.
You can also use the m key as a mouse-look toggle. Clicking the m key once allows you to use the
mouse to change the direction of the camera without having to right-click. To return the mouse to
normal use, click the m key again.
A model must be open for the E3D window to open. Also, it may take some time for the E3D
window to initialize and open.
There is also an option (Windows only) to allow the E3D window to act like an independent
application window. To do this, choose Edit > Options > 3D tab and check the box for 3D window outside application. After restart, the E3D window will float outside the ExtendSim application window. This is especially useful if you have multiple monitors and you want the model
displayed on one monitor and the E3D animation on the other. (This option is not needed for the
Macintosh since this is the E3D windows default Macintosh behavior.)
Changing the window size
The resolution menu discussed in Interface controls on
page 454 allows you to change the size of the E3D window to
make it easier to view.
Closing the window
The E3D window can be closed:
By clicking the close box in its title bar
With the esc (escape) key
E3D
458
Tutorial I
3D animation modes
By selecting Close from the menu that appears when you click the ExtendSim icon in the E3D
windows title bar (Windows only)
All three options leave the model window(s) open and the simulation running (if applicable). The
E3D window automatically closes whenever you exit ExtendSim.
The E3D window does not close when you close the associated model; it stays open so you can use
the leftmost popup menu to select another model to animate. Likewise, the model does not close,
nor does the simulation stop, when the E3D window is closed.
3D animation modes
Each model has a saved 3D animation mode which is selected in the 3D Animation tab of the
Run > Simulation Setup dialog and displayed in the E3D windows title bar. The selected mode
controls aspects of the interaction between the ExtendSim application, the E3D window, and the
ModL block code.
Mode descriptions
There are three 3D animation modes:
QuickView shows a default representation of the movement of items in the E3D window while
the simulation is running. In this mode, only one item object moves at a time.
Concurrent is a more realistic animation than QuickView and shows only the movement that
requires simulation time. The 3D animation displays the movement of multiple item objects
simultaneously and runs during the simulation run.
Buffered is similar to Concurrent except it runs the 3D animation after the simulation has
ended.
These modes are discussed in more detail on page 535.
E3D
Tutorial I
Running a model with 3D animation
459
E3D
460
Tutorial I
Running a model with 3D animation
3D objects have been selected in the Item Animation and Block Animation tabs of Item library
blocks. For instance, each passenger is a Random
person, as shown in the Create blocks Item Animation tab at the right. (You wont be able to see
these selections unless you have the E3D window
open.)
Several Transport blocks have been added to animate real-time delays in item movement. These are placed between other Item library blocks so
the E3D window will know how far the item travels from one block/object to another and how
long it will take the item to get there. So that delays in movement are realistically represented,
this information is used as part of the conversion of simulation time in the 2D model to animation time in the E3D window.
Among other tasks, Animate 3D
blocks (Animation 2D-3D library)
within hierarchical blocks are used to
create pieces of luggage that are then
mounted to each passenger.
E3D
3D Scenery blocks (Animation 2D-3D library) add stationary figures for the various security
stations.
A custom environment file has been created to facilitate the movement of passengers along
paths.
Notice that no programming was required to adapt this model for 3D animation. The only
accommodations were the addition of some animation-specific blocks, the selection of 3D options
in block Item Animation and Block Animation tabs, and modifications to the environment file.
Give the command Window > E3D Window or click the Open E3D Window button in the
toolbar
Verify that the E3D window is associated with the Airline Security model
Position the E3D window in a convenient location
If you have multiple models open, be sure the model associated with the E3D window is Airline Security. The associAssociated model popup menu
ated model is listed in the E3D windows popup menu,
shown at right.
Give the command Run > Run Simulation, or click the Run Simulation button in the toolbar
Tutorial I
Next step
461
Next step
The next step is to add animation-specific features to an existing model. You do this in the Tutorial
II chapter that comes next.
E3D
E3D
462
Tutorial I
Next step
3D Animation
Tutorial II
Adding 3D animation to a model
464
Tutorial II
Adding 3D behavior to an existing model
This chapter is an extension of, and assumes you have read, the preceding chapter. It will show you
how to adapt a model so that it generates a concurrent 3D animation. It covers:
Using Concurrent mode to have items move simultaneously
Animating items as 3D objects
Creating 3D objects to represent blocks
Adding scenery and labels to the E3D window
Using a 3D Controller block to clear items at the end of the simulation
Causing the model to automatically open the E3D window
Enabling 3D animation for this model is fairly simple just set options in block dialogs and add
some specialized blocks to the model worksheet.
The chapter that follows this one will show how to perform more advanced tasks: using the Transport block to simulate travel time, determining the length of the path using block positions,
mounting an object on an item object, and creating custom paths that are unlinked from the position of blocks in the 2D model.
The models for this tutorial are located in the folder \Examples\Tutorials\E3D Animation\Production Line. The examples assume some familiarity with discrete event simulation.
The goal
Before starting, look at the finished model to get an idea of what you will accomplish.
E3D
The command Run > Show 3D Animation has been checked for this model, so opening the
model also opens the E3D window, and running the simulation also runs the 3D animation.
If the E3D window is already opened when this model is opened, be sure the Production Line
Final model is the one associated with the E3D window.
Tutorial II
Adding 3D behavior to an existing model
465
This is a model of a process where crates full of bottles move along conveyors and are processed
by machines. A random number of crates are sent on one or another branches of the line.
Move the camera in the E3D window so you can see the entire model; zoom in and out to see
the detail.
So that the E3D window is always associated with the correct model, close any open models
Open the Production Line Start model
E3D
Model particulars
This model represents a production line consisting of five conveyors and three machines. After the
first conveyor and machine, the line separates into two branches, each of which ends at an exit.
About the model
The production line processes crates full of bottles.
Crates are generated by a Create block, approximately one every 1.1 seconds
They are held in a Queue until pulled into the system
Conveyors are 8 or 10 meters in length, run at 10 meters per second, and have a capacity of 8 or
10 items (depending on the length)
The length of a crate is 1 meter
Depending on the machine, the crates are processed for 1 or 2 seconds
Attendants are posted near each machine
466
Tutorial II
Adding 3D behavior to an existing model
Crates are sent randomly to one of the two branches by a Select Item Out block
All the blocks are from the Item library
The length unit is meters, the time unit is seconds, and the simulation ends after 180 seconds
The 3D animation uses the default Extend3D.mis environment file
Accommodations for 3D modeling
If you are familiar with discrete event modeling, you may notice a difference between this model
and a typical single queue/two server model. In this model, the location argument for the exponential distribution in the Create block is 0.1. In a logical model, the location argument is often
left at zero for expediency. For this model, the location value ensures that the interarrival time can
never be zero there will always be some time between item arrivals.
Other than that, this discrete event model is the same as you would typically build without considering 3D animation.
Running the 3D animation
Use the Open E3D Window button in the toolbar or give the command Window > E3D Window to open the E3D window.
Place the E3D window in a convenient location and, if desired, change the windows resolution
E3D
Run the simulation. Since the E3D window is open, the 3D animation will also run.
As the simulation runs, you can see green balls moving in the E3D window just as they might in
a 2D animation. A difference from the 2D model is that the blocks are represented in the E3D
window by their default 3D objects the Create and Exit blocks are displayed as doors, the
Queue as a bin, the Convey Item blocks as conveyors, and the Activity blocks as machines. The
conveyor belt moves, and when a green ball enters the machine the lights go on and the machine
moves, indicating that a process is taking place.
You can have 2D animation turned on simultaneously with 3D animation, but performance will
be better if only one type of animation is on at a time.
Save a model to explore
So that you have a model to work with during the tutorial:
Tutorial II
Adding 3D behavior to an existing model
467
Select:
3D object: Crate in the third column of the first row
Skin 1: old for the fourth column of the first row
Skin 2: base for the last column of the first row
E3D
468
Tutorial II
Adding 3D behavior to an existing model
The first row of the table should look like the screenshot, above.
For the second row, select 3D object: Crate, Skin 1: base, and Skin 2: base
Save the model
Save your 3D Production Line model. (The tutorial model is named Production Line 2).
Create objects to represent blocks
For this model, most of the default block/object correlations (Activity blocks as machine objects,
Convey Item blocks as conveyor objects, and so forth) are exactly what you want. Other objects
need to be changed.
This section shows how to create objects and waypoints to represent blocks. Creating an object to
represent a block is similar to creating an object to represent items, except the object is selected in
the Block Animation tab.
Objects that represent blocks are created at a size that corresponds in scale to other objects.
3D objects to represent blocks
Some of the blocks should have their default object representations changed. For instance, instead
of a door, the Create block could be represented as a supply room and the Queue block as a table.
In the Create blocks Block Animation
tab:
E3D
Queues, activities, and resources (Item library) have a dialog item so you can limit the
number of items visually represented as a stack in the E3D world. If not overridden,
the default mountStack limit is 10.
Waypoints
Blocks that are superfluous to a 3D animation, such as the Select Item Out block in
this model, should have their appearance in the E3D window minimized. Rather than
being represented by a 3D object, these blocks can be represented by a marked position
in the E3D environment. This minimization of the object is accomplished using waypoints.
In the Block Animation tab of the Select Item Out
block:
Selecting Waypoint
Tutorial II
Enhancing the model
469
When you do this, the object representation of the Select Item Out block (represented as a block
shape in the E3D window) will disappear and be replaced by an invisible waypoint.
Save and run the model
Save your 3D Production Line mode. (The tutorial model is named Production Line 3.)
Add scenery
The model has machines, but no workers. This is easily fixed by adding scenery. Any type of fixed
object that is not already represented by a block in the 2D model can be represented as scenery
people who dont move, furniture, equipment that doesnt perform an activity, walls, trees, and so
forth. There are two ways scenery can be added to a model:
1) Add a 3D Scenery block (Animation 2D/3D library) to the 2D model. This is the simplest
method and is shown below.
2) Use the E3D Editor to add scenery to the E3D window. This has the advantage that it does not
change the 2D model; it is discussed in Using the E3D Editor to create scenery on page 506.
Adding workers
For this tutorial, the workers dont move but are instead part of the scenery.
Place a 3D Scenery block (Animation 2D/3D library) close to each of the three
Activity blocks labeled Machine. By default, the block appears with a minimized
icon.
3D Scenery
E3D
Be sure the E3D window is open so you can select the 3D object
In the dialog of each of the three 3D Scenery blocks:
For Show block in 3D window as. Then choose a Male or Female object and whichever
470
Tutorial II
Some things to notice
3D Controller
Save your 3D Production Line model. (The tutorial model is named Production Line 4.)
Since item objects will automatically be cleared from the E3D window at the start of the next simulation run, the 3D Controller block is not really necessary for clearing items in this model. Note,
however, that the block has several uses for controlling the E3D window, such as turning on/off
the clouds and changing the color of the ceiling/sky.
simulation run
If the E3D window is subsequently closed, it will reopen when the simulation is run.
The final model, with the E3D window opening when the model is launches, is labeled Production Line Final.
Internal animation
E3D
As you saw for the Production Line models, some 3D objects contain internal animation that
shows the status of the object during the simulation. For instance, the Machine object supports
four internal animation states (running, idle, blocked, and down) while the Conveyor animates a
running belt.
If you dont want to see this behavior, unselect Enable animation of 3D object in the Block Animation tab of the activity-type blocks (Activity, Convey Item, Transport, and Workstation).
The default object for a Transport block is a Waypoint so this option is unchecked by default.
Rotation of 3D objects
While you needed to rotate the Kiosk and scenery objects, most objects are oriented correctly for
the flow of items in this model. This is because ExtendSim will try to place objects using the correct rotation for the model.
For example, the machine objects are oriented for a left to right flow of items. Furthermore, you
did not need to change the rotation in the Convey Item blocks. When the E3D window opens, the
rotation parameter for this blocks object automatically adjusts to reflect how the block is connected in the model. For instance, Conveyors 2A and 2B are horizontal in the 2D model but are
displayed at an angle in the E3D window.
Tutorial II
Some things to notice
471
Mounting objects
You may have noticed that the item objects move in the E3D window as you would expect them to
the crates move along the conveyor and the machines process the crates as they arrive. You will
see how to explicitly mount objects in the next chapter. But for this model, there was no need to
explicitly cause one object to be mounted with another object
The movement of items in the Production Line model is due to two E3D features:
Item objects automatically use the from and
to location information in the Transport
Animation tab of the Convey Item block.
The default is that the from location is the
previous non-passing block and the to location is the next non-passing block. This causes the
item object to be displayed as moving along the path represented by the Convey Item blocks
object. (The options on the Transport Animation tab will be discussed further in the next chapter.)
By default the Item Animation tabs of
Activity blocks are set to Mount item
while activity is ongoing. This causes
the item object (the crate) to stay with
the Activitys object (the machine) until it has finished its processing. (As you will see in the next
chapter, you may not always want that behavior.)
For example, moving Conveyor 1 between the Queue and Machine 1 will not change the location
of its conveyor object in the E3D window. However, moving either the Queue or Machine 1 will
result in a change in the conveyors position.
You will not be able to see the change in position until the simulation is run.
Conveyor
The Convey Item block (Item library) moves items along a conveyor, oven, cooling unit, moving
walkway, or any other type of moving path. The items travel from the starting point to the end
along the length of the conveyor.
The block has three options for setting the travel time:
Move time. The item is delayed for the specified time; speed and length are ignored.
E3D
If the 2D and 3D positions are linked, moving most types of blocks in the model will also directly
move their objects in the E3D window. However, the Convey Item block has more complex
behavior. If its Block Animation tab is set to Stretch 3D object to conveyors length (the default
setting), moving the block itself will have no effect on the position of its 3D object. That is because
its displayed length is based on the starting and ending points of the conveyor in the model. If the
from location is the previous non-passing block, and the to location is the next non-passing block
(the default settings), the conveyor will be stretched between those two locations regardless of the
position of the Convey Item block.
472
Tutorial II
Some things to notice
Speed and length. Speed and length are entered in the dialog.
Speed and calculated length. Speed is entered in the dialog; length is determined based on dialog
settings and block positions (the from and to locations).
These options are described fully on page 195. For this model, the conveyors speeds and lengths
are all known and have been entered in their dialogs. In the next chapter, you will see how to use
the speed and calculated length option to cause the block to automatically determine its length.
Item length
The Behavior tab of a Convey Item block has options
Item length setting
for specifying the length of
items. The items length can
be a constant, from an attribute, or based on length and capacity. In the Production Line models,
item length is set at 1 meter for all the Convey Item blocks.
Whichever item length option is selected, the 2D picture or 3D item object does not visually
change. However, the item length does affect calculations for accumulation and capacity, as well as
the timing of when items are pulled onto and released from the block.
If either speed and length or speed and calculated length has been selected as the travel time,
the items length is expressed as either feet or meters. However, if move time has been selected as
the travel time, the items length is expressed in time units. Thus for a move time of 10 time units,
a constant item length would be x time units.
Conveyor capacity
E3D
The capacity for a Convey Item block can be entered in the blocks dialog. However, regardless of
what is entered in the dialog, the blocks actual capacity is the lesser of either the entered capacity
or the length of the conveyor divided by the length of the item.
3D Animation
Tutorial III
Advanced 3D topics
474
Tutorial III
Animating a bank line
This chapter is an extension of, and assumes you have read, the preceding two chapters. It will
show how to:
Use Transport blocks to animate people walking from one location to another
Determine the distance the people need to walk based on block positions
Mount a 3D object on an object that represents an item
Use hierarchical blocks in 3D animation
Unlink an objects position from the corresponding blocks position
Create custom paths that are unlinked from the position of blocks in the 2D model
The goal
Before starting, look at the finished model to get an idea of what you will accomplish.
E3D
This is a model of customers arriving, waiting in a line, being served by one of two tellers, and
then exiting a bank. The command Run > Show 3D Animation has been checked for this model,
so opening the model also opens the E3D window, and running the simulation also runs the 3D
animation.
Tutorial III
Animating a bank line
475
Open the 3D Bank Line Start model. (Unlike the final model, this model is set to open without
opening the E3D window.)
E3D
When a teller becomes available, the first customer in the queue walks to that teller. The walk takes
5 seconds and Transport blocks (labeled Walk to Teller) are used to delay the customer for that
amount of time. Activity blocks (labeled Transaction) represent the time it takes for the transaction
with the teller. The transaction time is specified by a triangular distribution with a minimum of 2,
a maximum of 10, and a mostly likely time of 5. After finishing the transaction, the customer exits
the bank.
476
Tutorial III
Animating a bank line
3) There is a large gap between the Queue (Wait) and the Select Item Out (Choose a Free Teller)
blocks. This just provides space for inserting some blocks without having to move everything.
Unselect the command Run > Show 2D Animation. (For maximum performance, you do not
want 2D animation running concurrently with 3D animation.)
As the model runs, you may notice some interesting behavior. This is discussed below in What
this model needs.
E3D
Two 3D Scenery blocks (Animation 2D-3D library) provide male and female tellers, with different skins, as scenery objects in the E3D window.
A 3D Controller block (Animation 2D-3D library) clears items in the E3D window when the
simulation ends.
Since these modifications were illustrated in the previous chapter, they are not repeated here. This
chapter will instead focus on other ways to enhance the 3D animation.
What this model needs
There are several odd things that you may have noticed about the customers in this model. For
instance, they:
Line up in the doorway, sometimes on top of each other
Didnt bring any paperwork to the bank
Stand on top of the tellers desk while completing their transactions
Jump, rather than walk, into the bank and from the teller to the exit
The following sections show how to solve these problems.
So that the tutorial models arent overwritten, you need to have your own model to work with during this tutorial.
Tutorial III
Unmount the Activity blocks
477
Now the customers will stand in front of the desks, rather than jump onto them.
Save your model. (The equivalent example model is 3D Bank Line 2.)
Either leave the E3D window open or close it if you prefer. (If you close it, you will need to
open it to perform any 3D operation or to run the animation.)
Until a teller is available, the people have no place to go as they wait in line. If customers arrive
at about the same time, or if the tellers cant keep pace with the arrival of customers, the Queue
block will show its contents (the customers) stacking on top of each other.
The 2D model does not move people along a path at a specific velocity. The 3D world needs
Transport blocks to not only represent how long the journey takes but to also show the people
moving along a path during that time.
To have an animation where items dont jump from one block to another or stack on top of each
other as they wait in line, you need to show them moving along a path as they are delayed. This is
accomplished by setting a travel time in a Transport block (Item library). This results in an animation delay that corresponds to the time that the item spends in transit from one location to
another.
E3D
When a model is animated in 3D, the 3D item objects will likewise move from one 3D block
object to the next without any time delay. This is seen in the Bank Line models, where customers
move instantaneously from the Queue to the Activity blocks and from the Activity blocks to the
Exit and can stack one above another. There are two reasons for this:
478
Tutorial III
Add Transport blocks
Two paths to the exit, each represented by a Transport block between the Activity blocks (Transaction) and the Exit
The tutorial also shows how to minimize the icons of the Transport blocks already in the model.
For this part of the tutorial, it is assumed that customers take 5 seconds to reach any destination.
E3D
In the current model, customers walk to the teller desk, finish their transactions, and then disappear. You could just leave the model like that, but it would be more fun to see customers walking
to the exit. Transport blocks between the Activity blocks and the Exit block will show customers
walking out of the bank.
When there is more than one connection line from the output of a block, you should create a
Transport block directly in the model rather than right-clicking to insert it. Otherwise, the Transport block could get inserted onto the wrong connection.
To manually place the Transport blocks:
Delete the connection between each Activity (Transaction) and the Exit.
Insert a Transport block between each Activity and the Exit.
Connect the Transport blocks between the Activity
and Exit as shown here.
Tutorial III
Block positions to determine a paths length
479
Select Left to right (small), as shown at the right. This changes the
blocks appearance in the model so that it uses a smaller icon.
Do the same steps for the Transport block labeled Walk to Teller
2.
If necessary, move the blocks so that the connection lines are straight.
Save your My 3D Bank Line model. (The equivalent example model is 3D Bank Line 3.)
The model so far
If you have followed this tutorial, your model should look similar to the following screenshot:
E3D
480
Tutorial III
Block positions to determine a paths length
Speed and distance. How fast the item is moving, and how far the item must travel to reach its
destination, are entered in the blocks dialog. This is useful if you know the length of the path.
Speed and calculated distance. The items speed is entered in blocks dialog. The distance is
determined from information entered in the frame labeled Select From and To locations for
calculated distance. This is useful when you dont know the length of the path, but you know
its starting and ending points.
The third option, speed and calculated distance, will provide a more natural walking pace for customers in this model, since it considers not only their speed but how far they have to go.
Rather than the constant move time of 5 seconds in the previous section, this part of the tutorial
assumes a natural walking speed of 5 feet per second.
Walking to the front of the line
In the dialog of the leftmost Transport block
(Walk in Line):
E3D
Tutorial III
Mounting objects
481
Save your model. (The equivalent example model is 3D Bank Line 4.)
Mounting objects
You may have noticed that the customers did not bring any paperwork with them. The ExtendSim
mounting feature can be used to indicate that customers have some paperwork (for instance a
check, withdrawal slip, or loan document) as they approach the teller.
In the previous chapter you saw how item objects (crates) are mounted on Activity block objects
(machines) by default. In this chapter, the object must be mounted onto an item object in other
words, paperwork mounted onto the customers.
E3D
482
Tutorial III
Mounting objects
Creating an attribute
As discussed on page 522, every object has an objectID. This is a unique value that the E3D environment uses to identify the object.
E3D
The next step is to mount the paper object onto the items.
For objects that represent items, the value of their ObjectID is stored in their _3D objectID property. This allows you to perform actions on item objects by referencing that property.
Tutorial III
Unlinking objects from blocks
483
As customers reach the front of the line, they bring out their paperwork. However, there are two
unnecessary block objects in the E3D window.
By default, Animate 3D blocks appear in the E3D window as a block object. However, hierarchical
blocks and the blocks within them normally have no representation in the E3D window. See
Hierarchical blocks and 3D animation on page 532 for how to change this.
Your model should now look similar to this:
E3D
The next two sections involve the positioning of objects in the E3D window. It is a good idea to
not make changes to the layout of the 2D model after positioning objects using the E3D Editor.
Otherwise, you may need to reposition those objects.
Although mentioned in this chapter, the E3D Editor is discussed in detail in the next chapter.
484
Tutorial III
Creating custom pathways
Unlinking positions
In the Block Animation tab of the Select Item Out block, unselect the
option Link 2D/3D positions, as shown at right.
Unlinking positions
In the Editor, each object in the E3D window is labeled with a name ending with a number that
corresponds to the blocks global block number. The global block number for the Select Item Out
block is 3. To see a blocks global block number, open the blocks dialog or use the command
Model > Show Block Numbers.
Drag the object to the right so that it is located closer to the teller desks. You can select the
object and drag it or use the Gizmo to move it. (The Gizmo will be discussed on
page 493.) This should put its position on the X axis at about 20 (the screenshot above
shows the position as 20.55). Be sure to only drag the object in the direction of the X axis!
E3D
Although it is mentioned in this chapter, the E3D Editor is discussed in detail in the next chapter.
Custom paths are described more fully in Paths and markers on page 525.
Tutorial III
Creating custom pathways
485
If you instead select a custom path, the calculated travel time may not be appropriate. This is
because the 2D distance is unlikely to be the same as the distance for the custom path.
When using a custom path, you should first change the setting in the Transport blocks Behavior
tab to Travel time: speed and distance. (If you dont do this, ExtendSim will give you a message
and make the change for you.)
In the Behavior tab of the two Transport blocks labeled Walk to Teller 1 and Walk to Teller 2:
Press F11 to leave the E3D Editor and return to the E3D window
Save your model.
My 3D Bank Line.mis will now be listed as the environment file in the Run > Simulation Setup
> 3D Animation tab.
When you create a new environment file, the model must also be saved. This ensures that the
model will be associated with the proper environment file.
E3D
486
Tutorial III
Creating custom pathways
The E3D engine does not allow spaces in the names of markers or objects. If you enter a space in
the name, ExtendSim will warn you.
Expand the Tree pane (the upper pane on the right) so that all the objects are listed
At the bottom of the Tree pane:
Click and drag the marker named Point1 until it reaches and
E3D
Position the other three markers in the E3D window so that they will cause customers to go
around the desk and walk up to the exit. The marker labeled Point4 is the end of the path.
For accurate placement, zoom the camera towards the desk so you can see both the front of the
desk and the exit door.
Tutorial III
Enhancing the model
487
Give the command File > Save Environment As, to save the environment file
Press F11 to exit the Editor
Leave the E3D window open
Select the path
The next step is to use the ExitTeller1 path in the model.
Click the button Get distance from 3D path length. This places the length of the path in the
Distance field of the blocks Behavior tab and ensures that the model behavior will be the same
whether or not the E3D window is active.
Run the animation. Now when customers get to that teller, they will walk around the desk
rather than through it.
Select the path ExitTeller2 in the Transport Animation tab of the Transport block labeled Walk
to Teller 2.
E3D
The equivalent tutorial model is 3D Bank Line Final. Notice that the distance using the custom
path is much longer than the distance that was calculated. This is because the customers now must
walk around the desks to get to the exit, rather than walking through the desks.
E3D
488
Tutorial III
Enhancing the model
3D Animation
490
As you saw in Tutorial II on page 463, you can add blocks to a 2D model to modify aspects of
the E3D windows animation area insert scenery or text labels, turn the sun on or off, and so
forth. And you can enable environmental aspects such as vehicle trails and shadows by going to the
Edit > Options > 3D tab.
The appearance of the animation area can also be modified by using the ExtendSim E3D Editor to
alter the models environment files, without altering the 2D model.
This chapter discusses environment files and the E3D Editor. It will focus on the E3D windows
animation area and the editors that can be used to add pathways, create or manipulate objects in
the E3D window, or modify the terrain.
Additional information about the functioning of the E3D/World Editor can be found by reading
the Torque World Editor documentation at GarageGames.com.
Environment files
The environment file defines the appearance of the animation area in an E3D window. It provides
environmental information lighting, terrain, and so forth as well as the location of paths and
3D objects that are not shown in the model worksheet.
E3D
Defining a custom environment allows you to specify the placement and location of fixed objects
(such as desks, workstations, and interior walls) that you want to have appear by default in the
E3D window, as well as a custom terrain and any custom paths and waypoints the model might
use. This is accomplished by using the E3D Editor, discussed below, to cause changes to the E3D
window that do not impact the 2D model. The information about these modifications is stored in
the environment file for the model.
491
By default, environment files are saved at the same location as the model they are associated with.
Whenever the E3D window is opened, the environment file for the associated model will be used
to populate the E3D window.
The default environment file, Extend3D.mis, can be accessed by every model. Only custom environment files need to be saved in the same location as the model they are associated with.
With the EditorExploring model the active window, open the E3D window.
Activate the E3D Editor using one of the following methods:
Click the F11 key on your keyboard.
Or, click the ExtendSim application icon at the left side of the E3D
E3D
The appearance of this window is defined by the default environment file Extend3D.mis.
492
E3D
The E3D Editor appears by default in its World Editor Inspector (WEI) mode. Editor modes
allow you to alter aspects of the E3D window without affecting the appearance or structure of the
2D model. They are discussed starting on page 493.
Inspecting objects
The WEI mode is useful for inspecting objects and modifying their properties. It allows you to
both see and set the position, rotation, and scale values of objects, as well as other object properties. The list of properties in the Inspector pane varies by object.
To inspect an object, click it once in the windows animation area or select it in the Tree pane.
When an object is selected, the contents of the Inspector
pane change to show the objects properties. The objects
name appears in the panes Name field; if the object is the
representation of a block, the objects name will be followed by the block number. Some properties of the Activity blocks 3D representation are shown in the screenshot
to the right.
493
The Gizmo
Once you have selected an object in the window, it will appear
with a three-axis (XYZ) device drawn through it. This device
(called a Gizmo) is a tool for translation (movement), rotation,
or scaling of the selected object.
Each axis arm has a different colored line: red (X), green (Y),
and blue (Z). If you hover the mouse over one of the axis arms,
it highlights in a yellow color. The object can then be moved in
that direction.
The axes of the Gizmo are expressed in terms of the object, not
necessarily the E3D world. If an object is placed in the E3D window in its default orientation, the
axes will be pointing in the same direction as the compass for the E3D window. However, if you
rotate the object by 90 degrees, for example, the Gizmos axes will be 90 degrees out of sync with
the E3D windows compass.
Modifying object properties
You can change a selected objects properties by editing values the blocks dialog (if the object corresponds to a block in the model), changing property values in the Inspector pane, or by using
ModL code. If you make a change to one of the properties in the Inspector pane, you must click
the Apply button at the upper left corner of the pane to apply the change to the object. You can
also alter some properties (an objects position, rotation, or scale) by physically manipulating the
object using the Gizmo. Changing object properties is described in the chapter 3D Objects starting on page 499.
If the 2D block position is linked to the 3D object position, changing the position of the object in
the E3D window will change the position of the block in the 2D model.
If you select a different mode in the Window menu, the panes on the
right of the E3D window change and sometimes disappear. These
changes are discussed where the respective modes are described.
E3D
The E3D Editor has several editor modes that allow you to alter different aspects of the E3D animation area. You can select a mode by
either choosing it in the Editors Window menu (shown at right) or
by pressing the equivalent function key.
Window menu: Editor modes
Mode categories
There are three categories of modes for the E3D Editor:
1) World. The three World modes (World Editor, World Editor Inspector, and World Editor Creator) are used for inspecting and manipulating objects. They are discussed in World modes
on page 494.
2) Terrain. The two Terrain modes (Terrain Editor and Terrain Texture Painter) are useful for
modifying the contours and textures of the terrain. They described in Terrain modes on
page 496.
494
3) Other. The Editor has some other modes (Mission Area Editor, Terrain Terraform Editor, Terrain Texture Editor, and GUI Editor) which, by default, are disabled and not shown in the
E3D Editors Window menu. These advanced modes, along with some advanced menu commands (such as Import Terraform data) can be enabled by making a change to the EditorGUI.cs file located in the folder \Creator\Editor. These modes are beyond the scope of this
documentation.
The disabled modes and menu commands should be enabled only by very advanced animators and
should be used with extreme caution.
World modes
As described in detail below, there are three World modes:
World Editor
World Editor Inspector
World Editor Creator
Each of the World modes allows you to manipulate an objects properties its position, rotation,
scale, and so forth. By default, the Editor appears in World Editor Inspector (WEI) mode, as seen
earlier. The World Editor Creator mode is most often used to create an object in the E3D window
so that it becomes a default part of a models environment.
Using the World modes to create an object or modify object properties is discussed in the 3D
Objects chapter that starts on page 499.
World Editor
This base mode is intended for moving, scaling, or rotating objects. These operations can also be
performed in the other World editor modes, but this mode gives you the maximum viewing area.
E3D
495
WEI panes
The WEI has two panes that appear on the right hand
side:
The top pane contains the Tree. This is an explorer-type
list of the 3D objects that are present in the E3D window, including environmental components such as the
sky and sun. The location of an objects listing in the
tree can be moved; that change will not have an effect
on the objects position in the E3D window. An
expanded Tree for a model that contains only an Activity block (Item library) is shown on the right.
The lower pane contains the Inspector. This pane shows
the values of properties of the selected object its name
and block number (if any), position, rotation, and scale,
as well as other object properties. The particular information shown depends on the object selected. In the
screenshot on the right, the Activity block has been
selected in the animation area. It is also selected in the
Trees list and its name and properties are listed in the
Inspector pane.
World Editor Creator
This mode is used for creating 3D objects in the E3D
window and establishing custom pathways, among other
tasks. (Causing an object to appear directly in the E3D
window so that it becomes part of the environment is
known as creating the object.)
E3D
496
WEC panes
The WEC has two panes that appear on the right hand
side:
The top pane contains the Tree, as shown to the right.
This is the same as the Tree in the WEI pane, described
earlier.
The lower pane contains the Creator Tree that contains
a list of all the types of objects that are located in the
ExtendSim 3D folders. The objects are divided into
three categories:
Shapes. This category contains most of the functional objects you might want to add to the animation area: Vehicles, Scenery, Blocks,
ExtendItems, and Person. Some shape objects
have functionality (movement or behavior) and
some are static.
Mission Objects. This category includes three
sub-categories: Environment objects (clouds, skyWorld Editor Creator panes
box, sun, and so forth), Mission objects (Paths,
PathMarkers, and so forth), and System objects
(SimGroups). You will not usually need to add Environment objects since the default environment already contains the most-needed ones. Mission objects are quite important and
useful see Paths and Markers Creating paths on page 525 for additional information.
You will not need System objects unless you script the E3D window.
Interiors. These are buildings and other types of structures.
E3D
Terrain modes
As described in detail below, there are two Terrain modes:
Terrain Editor
Terrain Texture Painter
The Terrain modes are used to modify the contour and appearance (texture) of the floor or terrain of the 3D animation area.
For E3D animation, the word terrain means the floor of the 3D animation area and the word
texture means the appearance of the terrain its color, pattern, gridding, and so forth.
The default environment file (Extend3D.mis) does not make much use of the E3D terrain capabilities. In fact, if you build models using the blocks in the Item library, you should not change the
terrain from the default flat floor. This is because the ExtendSim library blocks assume that the terrain will be flat. For certain kinds of custom block models, however, the ability to manipulate the
terrain in the E3D window can be quite useful. And you can always change the terrains texture
without harmful effect.
Using the terrain modes to modify the terrain is discussed in Terrains on page 528.
Terrain Editor
This mode is used for filling and excavating the terrain to add contours such as hills and valleys.
497
Brush. This command is for choosing the shape, consistency, and size of the
brush when performing actions on terrains.
Action menu
See more information about these commands in E3D Editor menu commands on page 543.
If you move the cursor around in the animation viewing area you will see a selection area appearing
under the cursor. This is called the brush and is your primary tool for editing the terrain in the
E3D window with the Action commands.
E3D
498
Texture pane
In addition to the Action and Brush menus discussed above, the Terrain
Texture Painter has a Texture pane on the right side that has six slots
where each slot can display a different terrain texture. Slots can be
changed to a different texture (in the case of an existing texture) and different textures can be added (if the slot is blank). Textures are stored in
the \Extend3D\data\terrains folder. They are accessed by clicking a texture slots Change or Add button.
In the screenshot, the three slots on the left show pre-loaded textures
that can be changed. Those on the right are empty slots where a texture
can be added.
No two slots can have the same texture. When changing or adding a texture, the new texture must be different from those already in any slot.
Otherwise, the new selection will not have any effect. For instance, there
will be no effect if you try to change the Grid texture to the Grass
texture, and there is already a slot with Grass as its texture.
E3D
The menus and commands for the various modes of the E3D Editor are
described starting on page 543.
3D Animation
3D Objects
Creating and manipulating 3D objects
500
3D Objects
3D objects
As mentioned in the Controlling the E3D environment on page 451, there are several ways to
accomplish 3D tasks. With the exception of using an equation-type block or programming with
ModL code (described in the Developer Reference), this chapter shows how to use those methods
to:
Create objects for E3D animation
Use skins to affect the objects appearance
Change object properties such as position, rotation, scale, and visibility
Mount one object on another object
Use waypoints to mark the positions of invisible 3D objects and as movement destinations
Access other object information: collision, gravity, ObjectID
This chapter is focused on objects. Paths, which are a specialized type of object, and the terrain,
which causes the appearance of the floor of the E3D world, are discussed in the next chapter.
This chapter assumes you have read all the Tutorial chapters for the E3D module and the Envi-
ronment Files & E3D Editors chapter. Example models for this chapter are located in the folder
\ExtendSim\Examples\3D Animation.
3D objects
E3D
3D Objects
3D objects
501
Types of objects
3D objects can be divided into the following categories:
Interior objects buildings and other interior structures.
Shapes vehicles, scenery, blocks, ExtendItems, and people. Some shapes have movement and
behavior while others are static.
Mission objects environmental objects such as clouds and sun, as well as paths and markers.
A waypoint is a special type of 3D object that just marks a position, but is invisible, in the E3D
window. Waypoints are useful for keeping non-essential blocks from appearing as objects in the
E3D window or for placing text at specific positions in the window. They are discussed on
page 518.
Object properties
Each object has properties that vary depending on the type of object; all object properties can be
changed. Typical properties include:
Skins. Some objects have just one appearance in the E3D window, but many objects have multiple skin choices that affect how they look.
Position, scale, and rotation. Objects appear in the E3D window in a default X/Y/Z location
with a default size and orientation.
Collidable. With this property, objects will not occupy the same space.
Visible. Some objects, such as paths, are by default invisible and you only see their effects. Paths
can be made visible and normally visible objects can be made invisible.
Actions
The following table lists many of the object actions you might want to perform and describes
which methods can be used to accomplish those tasks.
Create an object
for a block or item
Create a non-block
object
See
Page
502
505
507
Change skin
508
Move an items
object
542
Move a blocks
object
509
510
Move a non-block
object
X
X
E3D
3D Action
Equation
Animation
Creator
Item
Options
Inspector
Block, ModL
Tree
2D-3D
Gizmo
Command
Pane
Code, or
Library
Library
Pane
Torque Script
502
3D Objects
Creating objects
Equation
Animation
Creator
Block, ModL
Item
Options
Inspector
2D-3D
Gizmo
Tree
Code, or
Library
Command
Pane
Library
Pane
Torque Script
3D Action
Rotate a blocks
object
Rotate a non-block
object
Scale a blocks
object
X
X
X
X
Mount/Unmount
Show/Hide
514
515
516
517
521
519
512
Scale a non-block
object
X
X
X
See
Page
E3D
Creating objects
Creating an object causes it to be placed in the E3D window. Objects are created:
3D Objects
Creating objects
503
Creating an object is not the same as defining an object. Creating a 3D object places a copy of the
object in the E3D window. Defining a 3D object is the process of developing a new type of 3D
object, as discussed in the Developer Reference.
Place a Create block (Item library) on the model worksheet. The block will automatically be
In the Create blocks Block Animation tab, use
the popup menu (shown to the right) to create
other objects to represent this block. As you make each selection, notice how the object changes
in the Block Animation tabs preview area and in the E3D window.
If you do not have QuickTime installed, the color of the object in the tabs preview area may not be
the same as the color of the object in the E3D window.
If a Skin popup menu appears to the right of the object popup menu, it can
be used to change the objects appearance. This, along with other settings in
the Block Animation tab, is discussed in Changing object properties on page 508.
So that it can be used for other sections in this chapter and for other chapters:
Select the command Run > Show 3D Animation. This will cause the E3D window to open
whenever the HowToE3D model opens.
Save the model. Since the object has been created by the 2D model, saving the model saves the
object information.
Your HowToE3D model will be used for other sections.
E3D
504
3D Objects
Creating objects
E3D
The Create (Item library) and Animate 3D (Animate 2D-3D) blocks have a 3D object choice in
their Item Animation tabs that other blocks dont offer Random person. If this is selected, the
block will randomly generate male and female people objects with random clothing, face, and
hands to populate the animation.
3D Objects
Creating objects
505
Scenery is the term used to describe any object that is displayed in the E3D window but which is
not a necessary part of the 2D model. You can select any object to be scenery, but some common
choices are bed, chair, desk, door, filing cabinet, machine, shelf, table, tree, and wall. Text, which
can be used to label objects or to stand on its own as a label or sign, is also considered scenery.
There are several ways to create objects for scenery:
With blocks from the Animation 2D-3D library
Using the E3D Editor to place scenery directly in the E3D environment
Using an equation block, or program with ModL code as described in the Developer Reference.
Using an Animation 2D-3D library block
The 3D Text and 3D Scenery blocks (Animation 2D-3D library) are used to create text and other
scenery objects in the E3D window. The following discussion concerns using these blocks to create
objects; the blocks are discussed fully in Animation 2D-3D blocks on page 540.
Using blocks from these libraries requires adding the block to the model but does not require creating a new environment file or making and saving changes to an existing one.
3D Scenery block
A 3D Scenery block in a 2D
model will cause scenery to
be created in the E3D window. The blocks dialog provides a popup menu for selecting a representative 3D object, similar to
the Create block discussed on page 503.
3D Text block
The 3D Text block works similar to the Create block discussed on page 503 in that you can select
an object to represent it in the E3D window. However, this block also allows you to cause text to
be written on the 3D object. If you select the Waypoint object, the text appears at a marked position in the E3D window like a free-standing sign.
To use this block:
Select an object in the blocks object popup menu (the Waypoint choice will cause only the text
to appear in the E3D window)
E3D
When initially placed in the 2D model, this block has a minimized icon. By default, the footprint
of whichever 3D object you choose will be reflected in the model by the blocks icon. If you dont
want this effect, uncheck Show 3D footprint in 2D model in the blocks dialog.
506
3D Objects
Creating objects
Using the E3D Editor to create an object requires creating a new environment file or making and
saving changes to an existing one. But it avoids having to place an extra block in the model.
Accessing the E3D Editor
Click the Barrel object. Depending on the resolution, you may need
E3D
to zoom back to see the object. You can also use the Gizmo to move
the object, if it is not placed where you want.
This will create a Barrel object in the E3D windows animation area without
putting a block in the model worksheet.
When you create an object using the Editor, it will be selected by default.
Clicking elsewhere in the E3D window unselects the object.
Selecting an object
The default drop setting in the E3D window is World > Drop at Screen Center. With this setting
ExtendSim will attempt to place the new item at the center of the camera view, where the terrain is
intersected. If a ray from the center of the camera view doesnt intersect the terrain, the object will
default to being dropped right on the cameras position. Thus if the newly created object isnt
immediately visible on your screen, or if it appears too large, back the camera up with the W key or
the down arrow.
To save the environment file and the model
So that the barrel will be part of the 3D environment whenever the E3D window is opened for this
model, you must create a new environment file or save the changes to an existing one:
Save the environment file. With the E3D Editor as the active window, give the command File >
Save Environment As and save the new environment. You can name the file any name you
want, for example HowToE3ED.mis. The environment file will be saved in the same directory or folder as you saved the model.
3D Objects
Deleting objects
507
Save the model. With the HowToE3D model window as the active window, save the model.
This will also save the name of the new environment file with the model.
Now whenever you open the HowToE3D
model, the E3D window will open using
your environment file with a barrel object.
The associated environment file is listed in the Run > Simulation Setup > 3D Animation tab, as
shown here.
For more information about saving changes, see Saving changes on page 518.
Create an environmental effect
Environment objects are things like clouds, the skybox, and the sun. While these objects are not
obviously apparent in the E3D window, you can see their effects. To cause or disable an environmental effect:
Select options in the Edit > Options > 3D tab
Use a 3D Controller block from the Animation 2D-3D library
Use an equation block, program with ModL code, or use Torque script and the World Editor
Creator, as described in the Developer Reference
Options dialog
In the Edit > Options > 3D tab, some environmental
options can be turned on and off:
Shadows
Sounds
Footprints and vehicle trails
These settings are system-wide and affect the E3D windows for all models.
E3D
3D Controller block
This block has many uses, as fully described in 3D Controller block on page 541.
It is also useful for turning off the sun or cloud effects in the
E3D window or changing the color of the ceiling/sky. These
options are shown at right.
When this block is placed in a model, unchecking the checkboxes disables the sky and/or clouds for the models environment file. If the option for the clouds object is not checked,
you can modify the color of the ceiling using the Slider controls to achieve the desired effect.
These settings are saved with any model that includes the 3D
Controller block.
Deleting objects
The mechanism used to delete objects from the E3D window depends on how the objects were
created.
508
3D Objects
Changing object properties
For objects that correspond to blocks in the model, delete the block from the 2D model. This
will automatically delete the object that corresponds to that block. (If you instead delete the
object using the WEC as described below, the object will reappear when the E3D window is
reloaded and you may get error messages if you then try to delete the block from the model.)
For an object that exists in the E3D environment but is not a direct representation of a 2D
block, delete it in the WEC.
To do this, select the object in the WEC animation area and either:
Press the backspace or delete key
Or choose the command World > Delete Selection
Or choose the command Edit > Cut
The objects that represent items are automatically deleted when the model is re-run or reloaded.
Changing object properties
Once you have created a 3D object, you might want to change its properties. As was discussed in
Object properties on page 501, each object has properties that vary based on the object. The following section describes the most common object properties and tells when you can change them
and how to do it. It covers changing an objects:
Skin
Position
Visibility
Rotation
Scale
E3D
A list of all the potential object properties is beyond the scope of this document. However, the following sections describe using the most important object properties; the Developer Reference has
information about others.
If a 3D object has been created by the 2D model and you modify any of that objects properties,
the information about the property change is saved when the model is saved. If the object has not
been created by the 2D model, any modifications to its properties must be saved in the environment file. This is discussed in Saving changes on page 518.
Changing skins
Skins is the 3D modelers term for the texture files that show the surface details of objects in the
3D world. Each object has a skin property that affects the objects appearance in the E3D window.
While some objects have just one appearance in the E3D window, many objects have a skin type
with multiple choices. For those objects, you can change which skin is showing by:
Selecting a skin from a popup menu in the dialog of the block that creates or changes the object.
Using the Animate 3D block from the Animation 2D-3D library. (This is an advanced method;
see page 542.)
Using an equation block or programming with ModL, as discussed in the Developer Reference.
Skin types
Many of the 3D objects have a single type of skin with multiple choices. For example, desk objects
have one skin type that can be base, oak, or old.
3D Objects
Changing object properties
509
Base skin is what is seen in the preview area of a blocks Item Animation or Block Animation tab.
The Male and Female objects have two skin types:
Skin 1 is for the clothing
Skin 2 is for the face and hands
Move an object
While a simulation is running, the movement of objects that represent items will be taken care of
by the block code and dialog settings. However, you may want to move objects that have been created by the 2D model (such as objects that represent block) or objects that have been created using
the E3D Editor.
There are several ways a 3D object can be directly moved:
If the object represents a block and 2D and 3D positions are linked:
Move the corresponding block in the 2D model
If the object does not represent a block, or if the 2D and 3D positions are not linked:
Change X/Y/Z coordinates in the corresponding blocks Block Animation tab
Change the value of the objects position property in the World editor
Set the objects position using the Animate 3D block. (This is an advanced method; see
page 542.)
Use an equation block or program with ModL functions (discussed in the Developer Reference)
As you will see below, the method you can use depends on the circumstances.
Move a block in the 2D model
By default the Block Animation tabs of Item library blocks are set to Link
2D/3D positions. This means that when one of these blocks is moved in
the model, the position of its representative object will change in the E3D window.
The objects position in the E3D window is displayed in the 3D
position section of the Block Animation tab, shown at right. If
2D/3D linking is enabled, these coordinates are display only
and cannot be edited.
E3D
510
3D Objects
Changing object properties
Moving a block is an easy way to manipulate 3D objects but requires that the locations of the
blocks in the model be changed. Unlinking 2D/3D positions provides more freedom since you can
then move 3D objects around without affecting the 2D model, as shown below.
The positions of the block and the object are both saved when the model is saved.
This action only applies to objects that represent blocks with 2D/3D linking selected.
Change settings in the Block Animation tab
If Link 2D/3D positions is unchecked in a blocks Block Animation tab,
the object can be directly moved by changing the 3D position X/Y/Z coordinates.
For instance, if you change the X coordinate from 7.125 to
9.125 the object would move 2 animation meters (40 pixels) to
the right in the E3D window. (The distance is based on the
conversion ratios specified in the Run > Simulation Setup > 3D
Animation tab, discussed on page 535.)
This method has the advantage of moving the object s position in the E3D window without moving the block in the model. The position of the object in the E3D window is saved when the
model is saved.
This action only applies to objects that represent blocks with 2D/3D linking not checked.
E3D
3D Objects
Changing object properties
511
If the object is the representation of a block, and the blocks Block Animation tab has been set to
Link 2D/3D positions, moving the object will also move the block. Unchecking the linking option
allows the 3D object to be moved in the E3D window without affecting the blocks position in the
model.
Save the position
How the position change is saved depends on the object:
If the object has been created by the 2D model, the information about the objects position is
saved when the model is saved. (For an object that represents a block, the position information
is displayed in the blocks Block Animation tab.)
If the object has not been created by the 2D model, the environment file must be saved in order
to save the objects position. See Saving changes on page 518.
Change object property values
While it is more common that you would change an objects position by one of the previous methods, a selected objects location can also be modified by changing the value of its position property.
Access object properties
Object properties can be changed in the E3D Editor when it is
in Inspector mode. The properties of the selected object are
listed in the Inspector pane, as shown at right.
The steps to change an objects properties are:
E3D
512
3D Objects
Changing object properties
Try changing the position for the barrel or door object in the HowToE3D model from page 506.
Save the position
If the object was created by the 2D model, saving the model saves the objects position.
If the object was not created by the 2D model, save the environment file to save its position.
This is discussed in Saving changes on page 518.
Objects that have been created by blocks should be hidden and shown using dialog options; the
model should then be saved to save those changes. Objects that are not associated with blocks can
be hidden and shown using the E3D Editor; this is a modification to the environment file and
requires that the environment file be saved.
E3D
Hiding an object
It is common that a block performs a function in the 2D model but you want its representative
object hidden in the E3D window. Scenery objects created using the E3D Editor, as well as objects
that represent items or other moveable constructs, can also be hidden.
Objects can be hidden by:
Unchecking a dialog option
Using a waypoint as a representation
Using the E3D Editor
With equation blocks or programming with ModL code, as discussed in the Developer Reference
Hide objects that represent blocks
You might want a particular block to not have a
visible object representation. If the block is from
Making an object invisible
the Item or Animation 2D-3D library, the easiest
way to do this is to uncheck the field Show block
in 3D window as. In the Item library this is located in the Block Animation tab, as shown above
right. This causes the block to have no representation in the E3D window, no matter what object
is selected in the object popup menu.
Another way to hide an object is to create a waypoint object to represent the block. A waypoint is a
3D Objects
Changing object properties
513
special type of 3D object that is invisible and just marks a position in the E3D window; it is discussed on page 518.
Compared to making the object invisible, the advantage of using a waypoint is that the waypoints
location can be used for a particular purpose. For instance, one object could be made to move
toward a waypoint, although the waypoint would be invisible in the E3D window.
Objects that represent items
In a discrete event model, items move from one Item
Making the items invisible
library block to another. By default all items have a 3D
object representation. By unchecking an option in the
Create blocks Item Animation tab, as shown here, you can choose to not create objects in the E3D
window to represent items. Note that the model must be saved to save this change.
Scenery objects
A scenery object that has been created in the E3D window, but which does not correspond to a
block in the model, can also be hidden for a particular model or for a certain purpose.
The process for doing this is the same as for changing a scenery
objects position property, as described in Change object property
Visible property unselected
values on page 511. If the scenery objects visible property is displayed in the Inspector pane, unselecting that property will cause the
object to become invisible. Note that the environment file would need to be saved.
Hiding a group of objects
You might want an entire group of blocks to not create objects in the E3D window. This is particularly true for passing or decision blocks like the Set or Select Item Out blocks in the Item library.
The 3D Controller blocks 3D Options tab has several choices for which category of block should be represented as a waypoint. The categories are
based on divisions for the Item library blocks all blocks (residence, passing, and decision), passing blocks, decision blocks, or only Transport blocks.
Although these options apply mainly to Item library blocks, custom blocks can be designated with
those categories and the 3D Controller block will hide the representative objects.
Objects that represent 3D Scenery blocks
In the Scenery tab of the 3D Controller (Animation
2D-3D library), you can choose to hide all objects that
have been created using the 3D Scenery block (Animation 2D-3D library). This tab also has options for
hiding the icon of the 3D Scenery block in the 2D
model and/or the footprint of the 3D object.
E3D
514
3D Objects
Changing object properties
Showing an object
Since most objects are visible by default, the process for making them visible after they have been
hidden is the reverse of hiding them (see above).
The path object is one of the few that is invisible by default. Causing the path object to be visible
in the E3D window is discussed in To modify path properties (optional) on page 527.
Conditionally showing and hiding
Some common ways of showing and hiding an object in the E3D window are:
With the 3D Text block (Animation 2D-3D library).
Using the Animate 3D block from the Animation 2D-3D. (This is an advanced method; see
page 542.)
With equation blocks or programming with ModL code, as discussed in the Developer Reference.
3D text block
The input connector on a 3D Text block (Animation 2D-3D
library) can create text in the E3D window if certain conditions
occur. To cause the input connector to appear, select 3D object Dialog option for 3D Text block
when input connector is true in the blocks dialog. Then connect to the connector to cause the sequence you want. During the simulation, the text will be
shown in the E3D window if the value of the input connector is >= 0.5; it will be hidden otherwise.
Rotate an object
Depending on the object, there are several ways a 3D object can be rotated:
E3D
3D Objects
Changing object properties
515
For example, using the How To E3D model you created on page 506, try changing the
rotation field in the Block Animation tab of the Create block. Then close the blocks
dialog to see the effect on the door object in the E3D window.
The rotation value is based on a 360 degree range; blank is the same as 0 or 360. For objects that
have a natural front, that front will by default be facing forward (towards the positive Y direction)
for the 0 or default rotation setting.
Rotate the object using the World editor
If an object has been created using the E3D Editor, it can be rotated in the E3D window. To do
this, either:
Rotate the object with the Gizmo in any World mode
Or, change the value of the objects rotation property in the World Editor Inspector
The objects rotation is saved when the environment file is saved.
To access the WEI
Open the E3D window
(Macintosh) while using the mouse to drag one of the Gizmos X/Y/Z arms. The arm will turn
yellow when it is selected.
Save the environment file to save the changes, as discussed in Saving changes on page 518.
This rotates the object around the axis associated with the selected arm. Rotation around the Z
axis is the standard kind of rotation used in the ExtendSim libraries.
Changing rotation property values
The selected objects rotation can be changed by changing
the value of its rotation property. The rotation property is
expressed as four numbers the first three are factors and
the fourth is an angle in degrees. The three multipliers
determine the amount by which the object is rotated
around its axis based on the angle number.
E3D
516
3D Objects
Changing object properties
For example, a value of 0 0 1 90.0 means that the object is rotated 90 degrees around the Z axis.
A value of 1 0 1 45.0 would mean that the object is rotated 45 degrees around both the X and
the Z axes.
The most common form of rotation in the ExtendSim modeling world is around the Z axis, as this
will rotate the front of the object on the flat plane.
To rotate the object using its rotation property:
E3D
Use the World Editor Inspector mode of the E3D Editor to scale the object with the
Gizmo or to change the value of its scale property
Use an equation block or program with ModL functions (discussed in the Developer Reference)
Scenery and other 3D objects created in the E3D window using the E3D Editor can be scaled
using the Editor, but a 3D object created by the 2D model can only be permanently scaled by
changing block dialog settings or by using the Animate 3D block.
Using the Block Animation or Item Animation tab
If an object has been created by the 2D model, its scale can be adjusted in the blocks dialog.
In any blocks Block Animation tab, or (for items) in the Create blocks Item Animation tab:
The scale is relative to 1 and a blank is the same as 1. Thus a scale of 2 would cause the object to be
twice the default size and a scale of 0.5 would cause it to be half the default size.
For example, use the How To E3D model you created on page 506. Change the scale
of the Activity block, then close the blocks dialog to see the effect on the machine
object in the E3D window.
3D Objects
Changing object properties
517
Command (Apple) key and Option key (Macintosh) while using the mouse to drag one of the
arms of the Gizmo.
Save the environment file to save the changes, as discussed in Saving changes on page 518.
With this method, the scaling will be in the direction of the selected axis and will distort the
shape of the object. To scale an object in all three dimensions at the same time, change the values
of the objects scale property in the World Editor Inspector, as described below.
E3D
518
3D Objects
Saving changes
Save the environment file to save the changes, as discussed in Saving changes on page 518.
Saving changes
If you create objects or change their properties, you probably want to save those changes. There are
two issues you should be aware of when saving changes:
Objects that have been created by the 2D model, as well as any changes to the properties of
those objects, are saved when the model is saved. For instance, if you move an object in the E3D
window, and the object is associated with a block in the 2D model, that position change is saved
when the model is saved. Furthermore, saving the model saves the name of the associated environment file; if the environment file has been renamed, the new name will be saved with the
model.
If youve used the E3D Editor to create paths or objects in the 3D window, or you have made
changes to the properties of those objects, you will need to save the environment file to keep
your changes. Either create a new environment file or save changes to an existing one, as
described below.
To save the changes made to object properties using the E3D Editor, you must first Apply the
change, then save the environment file.
E3D
For any other environment file, with the E3D Editor as the active window, use the File > Save
Environment command to save changes.
You can name the file any name you want. It will be saved in the same directory or folder as the
model is located.
If the model uses a new environment file, or a renamed environment file, you must also save the
model. This ensures that the model will be associated with the proper environment file.
You will not be able to save changes to the default Extend3D.mis file; you must use the Save Environment As command instead. Furthermore, the Save commands in the E3D window or E3D
Editor window do not affect any changes made to the 2D model.
WayPoints
A waypoint is a special type of 3D object that marks a position but is invisible in the E3D window.
Waypoints are useful for keeping non-essential blocks from being represented as visible objects in
the E3D window. They are also helpful for marking positions as destinations for object movement
in the E3D window. They can be given labels to act as signage for the animation.
Creating a waypoint
There are several ways to create waypoints:
Select Waypoint as the 3D object for any Item library block
Use the 3D Scenery block (Animation 2D-3D library)
Create a waypoint in the E3D Editor
3D Objects
Mounting objects
519
Waypoints can never be made visible in the E3D window but their labels will be visible.
Create a waypoint object in an Item library block
A waypoint object is created the same way any other object is created, as is shown for the Create
block on Using an Item library block on page 503.
In the E3D Editor
Accessing the E3D Editors World Editor Creator:
Selecting a waypoint
If a block is represented by a waypoint in the E3D window, that waypoint will automatically be chosen as the destination for items traveling to the block. To specifically target a waypoint as a destination for item objects that dont travel through the block, use the
Set Waypoint option in the Animate 3D block (Animation 2D-3D library).
Mounting objects
The process of attaching one 3D object (the rider) to a certain point on another 3D object (the
mount) is known as mounting.
The mounting node is the rider objects location that will be attached to the mount object. For
instance, a Suitcase objects handle is its mounting node. Custom objects have a maximum of 20
nodes.
A mount point is the location on the mount object where the rider object can be attached. In
the case of Male and Female mount objects, you would usually attach the handle of the Suitcase
to their hands (mount point 1), rather than to their heads (mount point 0).
In many cases, mounting is performed automatically by the blocks. For example, the Activity
block will, by default, mount the 3D object that represents the items being processed onto the
blocks 3D object.
Furthermore, mounting causes some automatic actions. For instance, mounting a Box object onto
a Male object automatically attaches the Box to the mount point on the Male object. The Male
object then adjusts its animation to change its hand position, so that it looks as if it is holding the
Box. If the Male is then given a destination, the Box will travel along with the Male object.
An object that represents an item can be mounted on an object that represents a block. Likewise,
any 3D object can be mounted on the objects that represent items. And while it is not a requirement, an object that has been mounted on another object can also be unmounted.
E3D
Each 3D object has one mounting node and at least one mount point.
520
3D Objects
Mounting objects
Item objects are not mounted on the Convey Item or Transport blocks. Instead, item objects use
the from and to location information set in the blocks dialog. This causes the item object to be
displayed as moving along the path represented by the blocks object.
E3D
You may want to mount an object on an object that represents an item. For example, to mount a
piece of paper on a customer in a bank line or to mount a suitcase on a passenger at an airport.
Mounting an object on an item object is usually accomplished using an Animate 3D or 3D Scenery block (Animation 2D-3D library) and is sometimes done within a hierarchical block to minimize the details at the top level.
An example of an object being mounted onto item objects is in the Airline Security model, located
at \Examples\3D Animation.
In the hierarchical block that
looks like a door, two Animate
3D blocks create a Suitcase
object and then mount it onto
the object that represents the
person entering the airport. The mounting
is accomplished by attaching a rider object (Suitcase) onto the mount object, as seen above. The
mount object is referenced by the _3D objectID property of the items that pass through this block;
the value of the property is the value of the objects ObjectID (discussed below). Note that at this
point the Suitcase object is not associated with an item or block in the 2D model.
3D Objects
Other object information
521
Collision
The collidable property defines whether an object that represents an item will respect the physical
boundaries of other objects or if it will be allowed to pass through the other objects. If an objects
collidable property is set to True, the object will stop before moving into the physical space of
other objects in the E3D window. If collidable is set to False, the object will be allowed to move
through other objects in the E3D window.
By default, the collidable property of item objects is set to true in the Item Animation tab of the Create block (Item library). The Block Animation tab in other Item
library blocks has a checkbox for selecting whether the block object is collidable. The collidable
property can also be accessed from the WEI.
To maintain the constant speeds associated with making travel times match simulation times, the
concepts of friction and momentum are not implemented in the objects that travel from location
to location in ExtendSim.
Sound
The E3D window supports objects playing sounds. Sounds can either be associated
with objects in the E3D window or they can be played by ModL function calls.
Use the Edit > Options > 3D tab to globally disable and/or enable sounds in the E3D window;
they are disabled by default. If the object has ambient sound, and if Enable animation of 3D
object has been selected in the blocks Block Animation tab (it is enabled by default), the sound
will be played when the simulation is run.
E3D
Gravity is implemented in ExtendSim for certain types of objects and not for others. People and
vehicles (for instance, the Shapes > Vehicles and Shapes > Person objects of the WEC) will respect
gravity. If created at a height, or made to travel to a Z location higher then 100, these objects will
drop back down to the ground. Other objects, such as the ExtendItem, Blocks, and Scenery
objects in the Shapes category of the WEC, will not be effected by gravity. Instead, they will be
able to travel along at a fixed height, or even travel to a different height, by simply setting a Z location higher then 100. In the Boids example, located at \Examples\3D Animation, Boid objects fly
through the air by just setting 3D destination locations.
522
3D Objects
Other object information
The machine object is an example of an ambient sound. To see this, open any model that has an
Activity block represented in the E3D window by the machine object, such as the Production Line
Final model located at \Examples\Tutorials\E3D Animation\Production Line. Select Sounds in the
Edit > Options > 3D tab and run the simulation. While the machine is running, you will hear an
active machine sound.
Sounds played in the E3D window are represented as 3 dimensional sounds. If you move the camera in the E3D window closer or further from the machine, or turn to the left or right, the volume
and direction of the sound will change accordingly.
Object ID
An ObjectID is a unique value associated with an object that the E3D environment uses to identify the object. Every object has an Object ID, including GUI objects such as the camera, and
objects created by a models blocks, by the E3D Editor, or by programming.
The value of the ObjectID is the main identifier that the E3D window uses to identify the objects
it needs to support. For example the camera object, mentioned in MiniMap and camera on
page 455, has an objectID. Knowing this allows you to call any of the other ModL functions that
take an ObjectID value on the Camera. You could then use this information to dynamically set the
position of the camera while an object is moving, so the camera follows along with the moving
object.
For objects that represent items, the value of their ObjectID is stored in their _3D objectID property. This allows you to perform actions on item objects by referencing that property.
BlockNumber
E3D
The BlockNumber property is defined in the WEI, but is not available through the dialogs of
blocks in the Item Library. This property is used to contain the block number of the block from
the 2D model that created the 3D object. It is used internally by the Item library block code and is
not something that you will ever want to change. However, viewing it can be useful for informational or debugging purposes.
3D Animation
524
This chapter assumes you have read all the Tutorial chapters for the E3D module and the Envi-
ronment Files & E3D Editors chapter. Example models for this chapter are located in the folder
\ExtendSim\Examples\3D Animation.
Traveling time
In a discrete event model, items move from block to block as dictated by the connections. These
connections indicate the direction of movement, but they dont provide any delay for the items. If
travel time is significant, it is common to either:
Increase the delay time of destination blocks to compensate for the travel time
Specify a minimum wait time in a Queue blocks Options tab to simulate travel time
In a logical model, these approaches work well for simulating behavior and result in correct item
travel times. When the model is animated in 2D or 3D, however, item/objects visually jump from
block/object to block/object. This is rarely what you would want to see.
Instead of implying a travel time, it can be explicitly set in a Convey Item or Transport block (both
from the Item library). When the model is then animated, multiple items will move simultaneously at a certain speed from one point to another, rather than jumping from object to object. The
Transport and Convey Item blocks are the primary way to show multiple 3D objects moving at the
same time in the E3D window.
The Behavior and Options tabs of the Convey Item and Transport blocks are discussed in Transportation and material handling on page 192.
E3D
525
Use a Transport or Convey Item block to represent the items travel time.
Check 2D animation
shows simultaneous
item movement in the blocks Item Animation tab.
Unselect the command Run > Add Connection Line Animation. (This command is not compatible with simultaneous item movement.)
For 3D animation, to see the simultaneous movement of items in the E3D window:
Use a Transport or Convey Item block to represent the items travel time.
Give the command Run > Simulation Setup > 3D Animating tab and select either the Concurrent or Buffered modes. These modes force the simulation model to maintain a constant ratio
between simulation time and external clock time.
In 3D animation, the movement will be either along the connections or in a straight line, as specified in the Convey Item or Transport blocks Options tab.
Creating paths
The purpose of a custom path is to set a pre-defined route for objects to travel through the 3D
world. In a 3D animation of a discrete event model, item objects move from one destination to
another, so paths are not required. They are, however, frequently created for situations that involve
intricate traffic patterns or models that use custom-built blocks.
Paths and markers
A path is a route for an item or other entity that has movement. Each path is a collective object
composed of multiple steps, or markers, laid out in a predefined order towards a destination. Paths
are created using the E3D Editor in World Editor Creator mode and become a part of the E3D
environment. They are never visible in the 2D model; by default they are also not visible in the
E3D environment.
With the E3D Editor in World Editor Creator (WEC) mode, as shown in this section.
Using an equation block or programming with ModL functions, as discussed in the Developer
Reference.
Markers
A marker is a point on a path, indicating a step towards the destination. A path can contain as
many markers as you want; it can even contain just a single marker.
Markers have their locations specified in X/Y/Z dimensions. Certain objects in the ExtendItem
category of objects (such as people and vehicles) will ignore the Z dimension by default, but other
objects do not. Because objects in the ExtendItem category are most often used to represent items,
and because objects that dont need the Z dimension will ignore it, the Z locations of markers
should always be set to the correct value.
The default height of the ground in the E3D window is 100 meters and the default height (Z
dimension) of 3D objects is 100.1.
E3D
526
E3D
The E3D window for this model will automatically open when the model opens.
Click and drag Marker A within the Tree pane until it reaches and selects the name of the
desired path in this case, Path 1. The paths name will be highlighted when it is selected.
527
This will both create a folder named Path 1 and store Marker A
within that folder.
In the animation area, use the Gizmo to position the marker at the
appropriate X/Y/Z location
Create additional markers until you have as many as you need for
this path, storing them in the Path 1 folder
E3D
528
Changing the color of a path changes how it displays in the E3D window when it is set to be visible. To cause a visible path to have a color:
In the Tree pane, click and drag the path to within the SimGroup - Paths folder.
Save the environment file.
Paths do not have to be stored in the SimGroup - Paths folder, but it is a good collection point if
you have a lot of paths.
E3D
Using an equation block, or program with ModL code as described in the Developer Reference.
Terrains
By default, the Extend3D.mis environment file has only one texture painted on the entire terrain
floor the Grid texture. Furthermore, the default terrain is a flat surface. However, terrains can be
customized to have contours as well as multiple textures (color and patterns). As introduced on
page 496, terrains are created and modified using the E3D Editor in Terrain mode.
If there is no texture associate with the terrain, or if the texture cannot be located, the terrain will
appear white.
The commands in the Action menu are used in conjunction with the commands in the Brush
menu to modify or create custom terrains. As an example, if you select the Add Dirt command,
move the cursor to the center of the viewing area, and click the left mouse button, you will be
adding dirt to the terrain. This will have the effect of creating a small mound under the brushed
area. How long you hold down the mouse button effects how much dirt is piled up. Each Action
has a different behavior and between them all you have a lot of editing control over the terrain.
To do this, choose the Select command and click the terrain with the left mouse button, selecting
the terrain under the brush. The selection area is indicated by squares (nodes) that are drawn at
each point where the brush touches the terrain, turning from outlined to solid. Clicking again on
other sections of the terrain will add them to the selection. Clicking while holding down the Ctrl
key will remove the nodes under the brush from the selection. After selecting whatever portion of
529
the terrain you wish, select the Adjust Selection menu command to raise and lower that selection.
When this is selected, moving the mouse forward will raise the selected terrain, and moving the
mouse backward will lower it.
The Action and Brush menu commands are described starting on page 544.
Modifying the terrain
For example, to modify the terrain or floor of the E3D window:
With the E3D window the active window, click F11 to access the E3D Editor
In the E3D window, choose the command Window > Terrain Texture Painter
On the right side of the window, the Texture pane appears with six slots for selecting textures.
(The Texture pane is shown on page 498.) Notice that, by default the Grid texture has been
selected. This is the default texture for the default (Extend3D.mis) environment file.
E3D
E3D
530
3D Animation
532
This chapter is has some E3D tips and provides reference for the E3D environment. It covers:
Tips when calling 3D functions from equation blocks
Performance considerations
ExtendSim commands and options for 3D animation
The Animation tabs Animate Item and Animate Block
3D enabled blocks in the Animation 2D-3D library
Tips
Using an Equation block to call E3D functions
E3D functions, such as E3DCreateObject or E3DPostCreateObject, can be called from an equation type block. This adds tremendous flexibility to your 3D modeling capabilities. However, the
E3D animation mode that is currently enabled (QuickView, Concurrent, or Buffered) impacts the
functions that you will want to call, especially when referencing 3D objects that represent items.
(For a description of the three animation modes, see 3D Animation tab of Simulation Setup dialog on page 535.)
E3D
Most E3D functions have a post and non-post version. The difference is that the post version
of a function includes a time argument that allows the E3D engine to synchronize the real time to
the 3D animation time. For example, the two functions E3DCreateObject and
E3DPostCreateObject differ only in that E3DPostCreateObject has a time argument. The time
argument is nearly always set to CurrentTime, the current simulation time.
3D objects that represent items
If the E3D mode is Concurrent or Buffered, then you should use the post type functions when
dealing with 3D objects.
In QuickView mode, where 3D actions happen immediately without a real-time synchronization, you should use the functions that operate on the 3D item object immediately.
3D objects that represent blocks or scenery
When the 3D objects represent blocks or scenery and the E3D mode is Concurrent or Buffered,
use the post functions if you want to change them at a specific point in time. If you are not concerned about time (for example you want to create an object, rotate, or mount an object when the
model opens), you can use the non-post functions.
In general, you should not use the post functions when the simulation is in QuickView mode.
Hierarchical blocks and 3D animation
By default, hierarchical blocks and the blocks within them have no representation in the E3D window. Through dialog settings however, some or all of the enclosed blocks can be represented by 3D
objects.
To cause a block within an H-block to have a 3D object representation, check Link to enclosing Hblock on the blocks Block Animation tab. If 3D representation is chosen for multiple blocks within
the H-block, each 3D object will appear in the E3D window in the same positional relationahsip
that the block has inside the hierarchical block.
533
To change the overall location of the 3D objects, move the home position of the hierarchical block
using the Set button and positional arrows on the Block Animation tab. The arrows cause the
home position to be moved in 0.5 meter increments; the Set button allows for exact parameters.
Performance Considerations
The E3D window is doing a complete textured rendering of a complex 3D environment. The performance of the animation is directly related to the number of objects being rendered and the
capability and sophistication of your computer.
Suggestions for improving performance
There are several things that you can do to improve performance if the E3D window is feeling
sluggish or if the 3D rendering is not able to keep up with the speed of the commands from the
ModL code.
1) The first thing to consider is the capability of your computers graphics card. It is critical to
have a modern, powerful graphics card in your machine for any 3D graphics application. The
3D rendering done by the E3D window is comparable to the rendering done by 3D gaming
software, so buying a card that is recommended for running a modern game is advised.
3) Shadows can be enabled or disabled from the Options dialogs 3D tab. They are cosmetic and
add to the visual impact of the rendering of the 3D world, but are disabled by default since
they will increase the load on the 3D graphics card and processor.
4) The 3D tab of the Options dialog also has a setting that allows you to choose the level of detail
(LOD) of the 3D objects rendered in the 3D window. If you are not having performance
issues, you should probably leave this popup menu on the Very High setting. If you are having
performance issues you can try turning it down to High or Medium. The Low setting is not
recommended unless you are running with very many objects, or on a machine that is not very
capable. On the Lo' setting many objects will not look well defined.
5) The Item Animation or Block Animation tabs show moving previews of 3D objects. Leaving
these tabs open while the animation is running will impact performance.
E3D
2) The number of objects being rendered in the E3D window at one time is one of the key factors
that determine how much work the E3D window is doing. ExtendSim will not impose a limit
on the number of objects you can try to put on the screen at one time, but displaying a large
number of objects in motion can cause the 3D animation to slow down.
534
A model must be open for the E3D window to open. Also, it may take some time for the E3D
window to initialize and open.
E3D
Selecting the command Edit > Options > 3D tab displays the dialog on the right. This tab has several settings that control aspects of the E3D window.
These settings apply to every 3D animation, not just
the one associated with the currently active model.
Shadows. Checking this option causes objects in the
E3D window to cast shadows. By default this option
is not selected since calculating shadows is computationally intensive and can slow the animation.
Sounds. Enables objects with sound capability to make a sound. Some of the 3D objects have
ambient sounds and, if you program, there are ModL functions associated with playing sounds
from the E3D window.
Footprints & vehicle trails. These are cosmetic additions to the displaying of the 3D objects.
The footprints are left after the motion of people objects and the vehicle trails after the motion
of vehicles such as cars or forklifts.
MiniMap. This option toggles the displaying of the MiniMap on the E3D window; it is checked
by default. This map is quite useful for location information when building a model, but may
not be necessary for presentation.
3D window outside application (Windows only). By default, the E3D window behaves like a
child window of the ExtendSim application. In the default behavior, the window resides within
the ExtendSim application window just like any other ExtendSim window. If the option is
checked, the E3D window will act like an independent application window and, after restart,
will float outside the ExtendSim application window. (This option is not needed for the Macin-
535
tosh because the E3D window is always outside of the application window.) This option is useful if you have multiple monitors.
Level of detail. This popup controls the level of detail (LOD): Very High, High, Medium, or
Low) with which 3D objects are displayed in the E3D window. The choice determines the number of polygons that are drawn for each 3D object; it does not affect the background of the E3D
window. In most cases you should just leave this on Very High (the default). You might want to
change this option is if there are many objects on the screen and the display of models in the
E3D animation is slow.
If the LOD is set to one of the higher settings, the detail is automatically adjusted based on the
cameras distance from the object. In that case, the object will be displayed with a low LOD if
viewed from a far distance. If the LOD is set to Low, the object will be displayed at a low LOD
whether the camera is close to it or not.
Select mode. Defines how the E3D window and the simulation interact. There are three modes:
QuickView. This default mode allows a simulation model to display its behavior in the
E3D window almost as is. Most of the models blocks will have a representation in the
E3D window; a blocks location in the 2D model will determine the location of the corresponding 3D object. Similar to the 2D animation of the simulation model, only one
object will move at a time in the E3D window. Furthermore, object movement in the E3D
window is not an accurate reflection of timed item movement in the 2D model there is
no direct correlation between simulation time, animation time, and real time.
Concurrent. This mode is most commonly used for a model that has been designed to specifically support E3D functionality. In this mode, multiple objects can be moving in the
E3D window at one time and the locations of the objects in the E3D window do not have
to correspond to the location of the models blocks. In addition, the timing of 3D object
E3D
Show 3D animation
during simulation run.
This option causes the 3D Animation tab in Simulation Setup dialog
E3D window to open
when the model opens. If the E3D window is subsequently closed, it will reopen during model
initialization when the simulation is run. If this option is not checked, you will need to open the
E3D window manually before a simulation run.
536
movement is directly related to the travel time of items in the 2D model animation time
is based on the ratio of simulation time to real time.
Buffered. Buffered mode is a variation on concurrent mode where the information about
what should happen in the E3D window is stored in an internal buffer and then replayed
later. When the simulation model completes running, the buffered information will be
complete as well and the 3D representation will be stored. At this point, a start button
will appear in the E3D window. When the start button is clicked, the 3D visualization of
the simulation will begin. You have to wait for the simulation to complete before the animation will begin. But because the model is not running while the E3D window is animating, the performance of the 3D animation might be better than for Concurrent mode.
The selected mode is shown in the title bar of the E3D window.
Environment file. Selects a file that specifies the appearance and behavior of the background for
the E3D window. The default is the Extend3D.mis file an empty, unbounded 3D world
with a cloudy sky and a gridded flat floor. This file will also be used if the field is left blank. You
can also create custom environment files as described in greater detail in Saving changes on
page 518.
Define conversion ratios. These ratios specify the relationship for distance and time between the
E3D window and the simulation model. In most cases the default values will not need to be
changed.
E3D
The units of distance in the E3D environment are in meters while distance in the model
worksheet can be stated in pixels. The distance ratio defines how many pixels in the 2D
worksheet represent one meter in the E3D window. The distance ratio defaults to Distance: 20 pixels per meter. For models that use a direct relationship between the two windows, each 20 pixels of distance in the model worksheet will translate to one meter of
distance in the E3D environment.
The time ratio controls the 3D animations display speed for the Concurrent and Buffered
modes; the value of the ratio is reported in the E3D windows title bar. (Since simulation
time equals animation time for the QuickView mode, the time ratio is ignored for that
mode.) For the Concurrent and Buffered modes, animation time in the E3D window is
related to model simulation time by the time ratio. By default the ratio is defined to be
Time: 1 time units per second (one simulation time unit to one second of real time). This
means that if a simulation is set to take 60 time units and the 3D animation is being displayed in Concurrent mode, the display in the E3D window should take 1 minute. The
time ratio value, and the animation speed, changes if you click the Faster or Slower buttons
on the E3D window.
537
tion tabs. The Convey Item and Transport blocks (Item library) also have a Transport Animation
tab.
E3D
Rotation. Sets the rotation in degrees of the 3D item object around the Z axis.
538
the blocks Properties tab. This can be overridden by choosing Change all items to or Change
item animation using property to change the animation object in the Item Animation tab.
Mount objects (preserve uniqueness required; not available in QuickView). The original 3D
objects coming into the batch block are mounted onto a base object. The base object corresponds to the 3D object associated with the first item to arrive at the connector that has been
selected by The base object is the item from the connector.
Activity and Workstation blocks
The Item Animation tabs of Activity and Workstation blocks have these additional 3D options:
Mount item while activity is ongoing. Mounts
the 3D item object on the 3D block object while the activity is running. For instance, this could
be used to show parts being processed by the Machine object.
Unmount [-X, +Y, -Y, +X]. If Mount item while activity is ongoing is enabled, this specifies the
direction that the mounted object will initially move to when it is unmounted.
Distance (m). If Mount item while activity is ongoing is enabled, this specifies the distance that
the mounted object will initially move when it is unmounted. The direction is determined by
the Unmount [-X, +Y, -Y, +X] option.
E3D
Core options
The following options are
common to the Block Animation tabs of Item library
blocks.
Show block in 3D window as. When this
option is checked, a 3D
object will be created to
represent the block. If it
is not checked, no object is created. The popup menu provides a choice of objects to represent
the block. Choosing a waypoint object causes an invisible marker, instead of a visible object, to
be created in the E3D window to represent the block.
Rotation. Sets the rotation in degrees of the 3D item object around the Z axis.
Scale. Sets the scale in the X/Y/Z dimensions of the 3D item object relative to its natural size,
which has a scale of 1.
3D Position (X, Y, Z). If Link 2D/3D is enabled, displays the position in the 3D window of the
3D object for this block. If Link 2D/3D if turned off, the fields can be used to set the position of
the 3D object in the 3D window.
Collidable. Turns on the collidable flag for the 3D object representing this block. When collidable is enabled, other 3D objects will be prevented from occupying the same 3D space as this
object.
539
Z is ground level. Sets the Z coordinate to whatever ground level has been set to. This is useful if
ground level has been changed from the default of 100 meters.
Link 2D/3D positions. Links the locations of the block in the 2D model worksheet with the 3D
object representing the block in the 3D window. If the block is moved on the model worksheet,
the 3D object will move correspondingly.
Link to enclosing H-block. Links the position of the 3D block to the worksheet position of the
hierarchical block containing this block. Generally, you would want to have this checked in only
one of the blocks inside of a hierarchical block.
For activity type blocks
The Block Animation tabs of Activity, Convey Item, Transport, and Workstation blocks have an
additional 3D option:
Enable animation of 3D object. Some 3D objects contain internal animation that shows the status of the object. For instance, the Machine object supports four internal animation states (running, idle, blocked, and down) while the Conveyor supports running.
The Block Animation tab of a Convey Item block has this additional 3D option:
Stretch 3D object to conveyors length. This will cause the associated 3D object to stretch to the
length specified in the blocks Behavior tab.
If either move time or speed and distance is selected as the travel time From location options
in the blocks Behavior tab, you can choose the starting and ending
locations for item movement on the Transport Animation tab. If speed and calculated distance is
selected, the from and to locations are determined by settings on the blocks Behavior tab; the location options on the Transport Animation tab will not be available.
2) 3D animation shows simultaneous item movement. Checking the box allows simultaneous
item movement.
In Concurrent and Buffered modes, 3D animation can display multiple objects moving simultaneously. In QuickView mode, only one object moves at a time even if you choose simultaneous item
movement in the Transport Animation tab.
E3D
1) From and To locations. The choices for the from location are shown
ar the right; the choices for the to location are similar. Although in
this tab they are only used to display movement, not to calculate
distance, these options have the same meaning as those discussed in
Calculated distance on page 193.
540
3) The popup menu to the right of the simultaneous movement checkbox allows you to choose how the movement will be displayed:
Along connections. The objects will follow a path that is equivalent to following connections in the 2D model. The from and to
locations are specified in the blocks Behavior or Transport Animation tabs, depending on the selected travel time option.
In a straight line (the default) starting at the from location and
ending at the to location.
Movement options
Along a pre-defined path. For example, the screenshot above shows four custom PassportControl paths. Paths are created in the E3D Editor, as discussed in Creating paths on
page 525, and the E3D window must be open for the names of available paths to appear in
the popup menu. (Paths are invisible by default; to view a custom path in the E3D window, access the E3D Editor.)
If either move time or speed and distance is selected as the travel time in the blocks Behavior tab,
you can choose in the Transport Animation tab how the item should move. If instead speed and
calculated distance has been selected, item movement along connections or in a straight
line is determined by the settings in the blocks Behavior tab. In this case, you can only choose in
the Transport Animation tab if simultaneous movement should be shown or if a custom path
should be used.
E3D
4) Get distance from 3D path length. Calculates the length of the currently selected path and
puts that length into the distance parameter field on the blocks Behavior tab.
5) Move 3D object immediately to start of movement position (Transport block only). Sometimes it is useful to move the 3D object to a starting point. This is common when the 3D item
object is not close to the start of the path or if there is an obstruction between the current location of the 3D object and the from location. Note that if this option is used, the object will
jump in zero time and then begin its timed movement. It will also jump if there is an obstacle
(such as another 3D object) in its path.
6) Show path. Flashes the path used for a few seconds, when 3D animation shows item movement along connections or on a custom path.
The use of the Transport and Convey Item blocks is discussed in Transportation and material
handling on page 192.
541
3D Controller block
Use this block to set behavior for
the E3D window or to select the
3D options for a range of blocks.
3D Options tab
Clear items in E3D window
when simulation ends. This
removes objects that represent
items at the end of the run, so
that the window looks as it did
before the simulation started.
Represent blocks as waypoints.
You can choose to cause all 3Denabled blocks to appear as waypoints or just a certain type of
3D-enabled block.
Sun in 3D window, clouds in 3D
window, ceiling color. Uncheck3D Controller: 3D Options dialog
ing the checkboxes causes sun
and/or clouds to disappear from
the E3D window. If the option for the clouds object is not checked, you can modify the color of
the ceiling using the Slider controls.
Scenery tab
This tab allows you to:
Hide all objects created by the 3D Scenery block
Hide the 3D footprint for all 3D Scenery blocks in the 2D model
The 3D Scenery block is discussed below.
3D Scenery block
This block represents scenery and other fixed 3D objects in the E3D window. When initially
placed in the 2D model, this block has a minimized icon. By default, the footprint of whichever
3D object you choose will be reflected in the 2D model by the blocks icon.
Except for the following additions, the options in this blocks dialog are the same as options in
Block Animation tabs of Item library blocks, discussed on page 538.
Show 3D footprint in 2D window. This causes the footprint of the 3D object to appear as an
area in the 2D model. This is useful for knowing where to place blocks in the model so that they
are well positioned for the 3D window.
Show 3D objectID. Enables an output connector so other blocks can access the 3D ObjectID.
With the ObjectID, you can manipulate the properties of the object in an equation-type block
or a block that you build.
E3D
542
Show. The blocks input connector can be used to dynamically hide and show the 3D object, or
display the value of the input connector on the object, during the simulation. The choices are to
show:
3DObject when input connector is TRUE
Value of input connector on 3D object
3D Text block
Displays text in the E3D window. The text can be displayed on a visible object or on a waypoint
object. If it is displayed on a waypoint, only the text appears in the E3D window.
This block has many of the same choices as for the Block Animation
tabs of Item library blocks, discussed on page 538. An additional
option is provided by the popup menu shown to the right:
True connector value shows text. Causes the text to be shown or
hidden depending on whether the input connector gets a true
value.
3D Text options
Append connector value to text. Causes the value received at the blocks input connector to be
appended to the text.
Hide connector (text always visible). This is the default option and just shows the entered text.
Animate 3D block
The Animate 3D block is an advanced method for executing an animation action in the E3D window as an item passes through the block. Use this block to augment the standard 3D options built
into the Item library blocks.
E3D
In this blocks Item Animation tab, select one of the 3D actions from the popup menu and enter
the appropriate parameters. These actions correspond directly to functions that can be called from
an equation block or from a custom 3D-enabled block:
Create object
Delete object
Mount object
Set destination
Set position
Set rotation
Set scale
Set target
Set path
Set skin
Set waypoint
Unmount object
The Animate 3D block can be used for almost any 3D action, even one that does not involve the
item that passes through the block. For instance, it can be used to mount one static object onto
another or move an items object from one point to another.
543
Most of the options will only be useful if the Concurrent or Buffered 3D mode is used. In Quick-
View mode, the 3D objects move without simulation time elapsing, so any action that has a simulation delay (or speed) associated with it will not be processed. Also, in the QuickView mode
mounting one moving object on another moving object will not work properly, as only one object
moves at a time and objects are deleted and re-created each time they move. Furthermore, because
QuickView mode does not have a direct relationship between simulation time and real time,
options such as Set destination and Set target will give unexpected results.
The individual actions are described in the blocks Help and many of them are illustrated in the
Animate 3D Block model located at \Examples\3D Animation\Tips. In that model, Animate 3D
blocks are used to create barrels at a fixed location, set intermediate destinations to a random X/Y/
Z position, set their final destination to a fixed location, and then delete the objects. In the model,
Activity blocks (Item library) are used to delay the items for the amount of time the 3D objects
will require to arrive at their destinations.
To access the Terrain editors, give the command Window > Terrain Editor (F6) in the E3D Editors menu.
File
The first four commands in the File menu are associated with creating, opening, and saving environment files. These commands work as you would expect them to.
The Toggle E3D Editor command toggles between the E3D window and the E3D Editor. It is
equivalent to pressing the F11 key.
Because the Extend3D.mis file is protected, you cannot made changes to it. Instead, use the Save
Environment As command to create a new environment file containing the changes youve made
using the E3D Editor.
Edit
This menu has Undo and Copy/Paste commands that work just as you would expect.
Camera
The Camera menu provides control over the speed of the virtual camera, described in MiniMap
and camera on page 455. These commands affect the forward, backward, left, and right motions
of the camera when pressing the W/A/S/D keys or the keyboards direction keys.
E3D
For more information about accessing and using the World modes, see World modes on
page 494; for the Terrain modes see Terrain modes on page 496.
544
Window
The Window menu contains the mode commands, discussed in E3D Editor modes on
page 493.
Lighting Tools
This menu has a Light Editor and lighting commands. The Full Relight command is especially
useful if the lighting seems confused it causes lighting sources and shadows to be recalculated.
World
This menu is specific to the World editor modes. It has commands for hiding and showing the
selection in the E3D window, deleting the object, and dropping the object at specific locations in
the window.
Action
Specific to the Terrain modes, this menu allows you to add dirt, excavate, and otherwise adjust the
contour of the floor in the animation area of the E3D window. These commands are used in conjunction with the commands in the Brush menu.
The Select and Adjust Selection commands are for making a semi-permanent selection of the
terrain. They work together to allow you to choose a section of the terrain and apply the equivalent of the Adjust Height command to it.
The Add Dirt, Excavate, Adjust Height, Flatten, Smooth, and Set Height commands determine
what will happen when you left click an area and move the mouse to brush the area.
The Paint Material command allows you to change the texture or color of the floor. It is the
command used when changing the texture in the Terrain Texture editor.
Brush
Specific to the Terrain modes, this menu is for choosing the shape, consistency, and size of the
brush when performing actions (from the Action menu) on terrains.
E3D
There are three selection sections in this menu and each allows one choice.
Shape. The Box Brush is square and will affect a square grid of nodes on the terrain. The Circle
Brush shape is obviously circular. If you switch between these two shapes you should see the
shape of the brush changing as soon as you move the cursor onto the terrain.
Consistency. This can also be seen in the viewing area of the E3D window. Each of the terrain
nodes that are going to be affected by the brush action will be drawn with a square on it at the
point where the brush touches it. These squares, outlined in the case of the brush and solid in
the case of the selection mode described in the Action menu, are drawn in different colors based
on how hard the brush is. The hardness determines how much the Action will effect the terrain
that the brush touches. If you select a Hard Brush, all the nodes will be drawn in red and the
Action will affect each node equally. If you select a Soft Brush, the central nodes will be drawn in
red and the outer nodes will blend toward green. With a Soft Brush, the Action will affect the
central nodes (red) more then the outer nodes (green).
Size. The brush will affect an area the size of the selected command.
Terrains are discussed on page 528.
How To
546
Working efficiently with libraries and blocks is critical to simulation modeling. This chapter discusses:
The libraries available with ExtendSim products
How to open and use libraries
Creating and managing libraries for block developers
Working with blocks, including using variable connectors
Managing blocks in libraries
Hierarchical blocks
How To
The Animation 2D-3D library lets you add custom animation to models and hierarchical block
icons. The Animate Item and Animate Value blocks in this library are used to add 2D animation
to models and hierarchical blocks, as described in Blocks for customized animation on page 611.
The 3D animation blocks are discussed at Animation 2D-3D blocks on page 540; they are used
with the 3D animation feature of the ExtendSim Suite product.
Electronics library
The blocks in the Electronics library are used to simulate system level design of analog, digital, signal processing, and control systems. Electronics blocks are used in the model Noisy FM system
on page 77.
547
Plotter library
The Plotter library holds all the common types of Plotter blocks used to graph and output data for
models. Some of these are specific to continuous or discrete event models, while others can be used
with any type of model. In addition to the simple plotters you have already seen in the tutorials,
ExtendSim plotters can show scatter plots, moving strip charts, histograms, and so on. All plotters
are described in detail in Plotters on page 663.
Utilities library
The Utilities library contains a collection of helpful blocks for performing various tasks such as
counting the number of blocks in a model, fitting data to a curve, synchronizing the model to real
time, timing the duration of a simulation, adding active buttons to models, and so on. A complete
list and brief description of the blocks in this library starts on page 841.
Value library
The Value library contains blocks that are primarily used for continuous modeling, although they
play a critical role in other types of models as well. You used some of these blocks when building
the Reservoir model in the tutorial at the beginning of this User Guide. Continuous models represent a smooth flow of values that are recalculated at periodic time steps. A complete list and brief
description of the blocks in this library starts on page 822.
Templates library (discrete event blocks are not available in ExtendSim CP)
Contains hierarchical blocks that serve as templates for specific behaviors, such as setting the
arrival time based on the time of day.
Tutorial library
Contains blocks built in conjunction with tutorials in the Developer Reference.
Legacy folder
Several libraries are stored in the \Libraries\Legacy folder. The legacy libraries are furnished for
backwards compatibility, so that you can run models built with previous releases of the software.
Depending on which ExtendSim product you purchased, the Legacy folder will contain some or
all of the following libraries:
How To
548
Animation
BPR
Discrete Event
Flow
Generic
Items (DB)
Mfg (Manufacturing)
Quick Blocks
SDI Tools
The legacy libraries (listed above) have been replaced by the Animation 2D-3D, Item, Item
Templates, Rate, and Value libraries.
The legacy libraries will not be included in future ExtendSim releases. They are no longer supported and are supplied without warranty of any type or for any purpose. Legacy libraries are
included in this release so that you can run models built in previous releases; they should not be
used to create new models.
Using libraries
Opening a library
Whenever you open a model, ExtendSim automatically opens the libraries that are used in the
model.You can also manually open a library or instruct ExtendSim to automatically open some
libraries when it starts.
To open a library manually, for example when you are starting a new model, choose Library >
Open Library. You can also double-click the library file or drop-launch it. You open libraries one
at a time with these methods.
How To
To specify that a specific library, or several libraries, open when ExtendSim launches, go to the
Edit > Options > Libraries tab and enter the names of the libraries you want pre-loaded. See
Options on page 792 for more information.
When a library opens, ExtendSim adds the library name, in alphabetical order, to the bottom of
the Library menu. Select a library name to see a submenu of the different block categories for that
library, which further expand to show the list of blocks for each category.
549
Closing a library
Unless you close ExtendSim, libraries stay open whether they
are used in a model or not. You can close libraries that are not
used in a model by choosing Library > Close Library and selecting the library you want to close. To close multiple libraries,
Shift select the libraries (or use the Ctrl (Windows) or Command key (Mac OS)), then click Close. It is unlikely that you
will need to close libraries often since open libraries do not take
up much memory and it is usually convenient to leave all your
commonly-used libraries open. Once you save the model, the
closed but unneeded libraries will not automatically open when
you open the model again.
ExtendSim will warn you and will not let you close a library that is being used by an open model.
Searching for libraries and blocks
When you open a model, ExtendSim automatically searches for the blocks the model uses.It first
searches for the libraries in which the blocks last resided.
Library searches
The search order ExtendSim uses to locate libraries is:
The Alternate path, if any, specified in the Options dialog
The Libraries subfolder within the ExtendSim folder
The folder containing the model
You can manually stop this search process at any time by pressing Ctrl+period (Windows) or Command+period (Mac OS). You can also force a manual search process by unchecking Automatic
search in the Edit > Options > Libraries tab.
Libraries should be kept in the Libraries folder, in the same folder as the model that uses them, or
in a folder specified as the Alternate path in Edit > Options > Libraries tab. Otherwise, ExtendSim will always ask you for the location of the library.
If ExtendSim cant find a library when the model opens, it will put up a file selection dialog that
asks Where is the library xxx?. Your choices are:
Cancel the library search operation. ExtendSim will then try to find the missing blocks, as
described in Block searches below.
Find and open the library manually. Since ExtendSim only needs to know where the blocks for
the model are, you could also use this choice to substitute a library that has a different name (but
the same named blocks) as the search library. See Substituting one library for another on
page 553 for more information.
How To
If you have renamed, deleted, or moved a library from the expected folder since the model was last
saved, manually stopped the search process, or unchecked Automatic search in the Options dialog, ExtendSim will not be able to find the library.
550
When the model file is subsequently saved, any new library name and/or location will be saved as
well, so searching will not be necessary the next time the model file is loaded. (Although if Automatic search is unchecked, ExtendSim will still ask you to locate the libraries.)
Block searches
As described above, ExtendSim searches for the blocks a model uses by first searching in the libraries that contained those blocks. However, ExtendSim may not be able to find the blocks if you
have renamed the blocks or removed them from the library. Once the library search is finished,
whether successfully or in situations where the search has been cancelled, ExtendSim prompts you
to locate any missing blocks. The dialog offers two choices:
Choose Open to locate and open another
library where the block resides. If ExtendSim
is unable to locate the block in this library, the
Substitute Block dialog will open which will
allow you to substitute an alternative block
from any open library. When the model file is
subsequently saved, any new block name and/
or location will be saved as well, so searching
will not be necessary the next time the model
file is loaded.
How To
Warning message
551
Library windows
The first choice in the blocks list for each library listed in the
Library menu is Open Library Window. This opens a window
that shows all the blocks inside that library in alphabetical
order. You can also open a library window using the Navigator,
as discussed at Library Window mode on page 771.
If you enter libraries in the Edit > Options > Libraries tab to be
pre-loaded when ExtendSim launches, you can also choose
Open library window so that the window for the selected
library will also automatically open.
How To
552
How To
The Develop > Compile Block command compiles the block to machine code without saving or
closing the block. This is useful for testing new code for syntax errors as you are building the
block. This command is only enabled when the blocks structure window is the active window.
The Library > Tools > Compile Open Library Windows command compiles all libraries whose
windows are open and saves the changes. This command is only enabled when at least one
library window is the active window.
The Library > Tools > Compile Selected Blocks command compiles all the blocks that are
selected in a library window and saves changes. This command is only enabled when a library
window is the active window and one or more blocks are selected in the library window.
Compiling a library or block with debugging information allows you to set breakpoints, watch
points, and so forth. Compiling with external source code causes ExtendSim to generate an external file that contains the source code; this is useful for version control.
Blocks with debugging code show in the library window with their names in red and show in a
model window with a red border around their icon. Blocks with external source code will show in
the library window with CM (code management) next to their icons.
For more information about saving and compiling libraries, see the Developer Reference.
553
Simulations run neither faster nor slower when you group your blocks in a single or multiple
libraries. The only performance consideration is that it initially takes more time to open multiple
libraries than it does a single library.
There are typically three classes of libraries you might want to create: general-usage, subject-specific, and model-specific.
General-usage libraries hold blocks that might be used in a wide variety of models.
Subject-specific libraries are for blocks that are only relevant to one subject, such as paper making.
Model-specific libraries hold blocks that are only used in a single model.
How To
Do not add blocks to the libraries that come with ExtendSim or move blocks from those libraries.
If you add blocks to an ExtendSim library, your work will be lost when you update. If you move
blocks from an ExtendSim library to a library you create, the blocks in your library will not be
updated when the ExtendSim library is updated.
554
To protect a hierarchical block's structure and prevent a user from double-clicking the hierarchical
block to see the underlying submodel, use the Model > Lock Model command discussed at Locking the model on page 777.
A protected library can be used in the same way as any other library except that the ModL code
cannot be altered or viewed. This means that someone using the library has all the functionality of
the blocks in that library but no ability to see how the blocks work.
To keep a library from being used to build models, while still allowing it to be used to run simulations, see Convert Library to RunTime Format on page 801.
How To
The blocks in the libraries that come with ExtendSim (such as the Value and Plotter libraries) are
displayed on the screen as icons that depict their function. Once you place a copy of these blocks
in your model, you might want to make its icon more closely indicate its role in your particular
model. However, using programming to change a blocks icon in one model will change it in every
model using that block, since blocks and their internal descriptions reside in libraries, not in models. In addition, since some blocks are animated, it is not easy to change a blocks icon without having to modify its ModL code. For these reasons, you should not change the icon on the blocks in the
libraries that come with ExtendSim.
If you build your own blocks, you can give them any icon you want. However, there are two better
ways to customize blocks in your model without having to directly modify icons:
You can paste pictures on the worksheet to customize the model. Pictures automatically go
behind blocks and text. For example, you can place a map of a region behind your model, or
show the layout of a plant. This is described in more detail in Working with pictures on
page 621.
You can also add a picture to a block without affecting the original one in the library by making
the block hierarchical. This technique is described in more detail in Modifying hierarchical
blocks on page 606.
Icon views
As you saw in Dialogs on page 16, some blocks have multiple icon views. If a block has icon
views, the choice of view will determine how the block looks on the model worksheet.
555
Alternate connector positions, such as an input connector on the right side of the block. This
helps avoid awkward connection line placements when building models.
Alternate icons depending on what the block represents in a model. This is often used for hierarchical blocks that represent a specific process in one part of the model but a different process,
with the same functionality, in a different part of the model. For instance, in the Markov Chain
Weather model discussed on page 50, the hierarchical block Weather Forecast uses views to
indicate the current state for a state/action model.
Blocks without icon views will not have any
choices in the Views popup menu at the bottom of the blocks dialog. If additional views
are present, they can be selected by right-clicking on a block or by using the Views popup
menu. They can also be called by functions.
ExtendSim facilitates the creation of different
icon views while developing or editing a
blocks structure. For more information see the
Developer Reference.
Connectors
Connectors are used to input and output values, items, or flow for each block.
Icon views for Holding Tank block
How To
556
Connector types
Connectors on a block are visually different, depending on how theyre used. This table describes
the different types of connectors that can be seen on or (if you program) added to blocks in
ExtendSim.
Type
Input
Output
Value
Item
Discrete event blocks use item connectors to pass discrete items. Blocks in the Rate library may also use
item connectors for the same purpose.
Flow
Discrete rate blocks use flow connectors to pass information about the effective rate from one block to
another. You can also connect from a flow connector
(input or output) to a value input connector.
Universal
Array
User Defined
How To
Other than some specific instances, you cannot connect from one type of connector to another.
For example, attempting to draw a connection from an Item output connector to a Value input
will result in an error message. The two exceptions are that Value, Item, Flow, and User-Defined
outputs can be connected to Universal inputs, and Value outputs can be connected to Flow inputs.
Variable connectors
Regardless of type, each connector can be single or variable depending on how the block is constructed. Variable connectors act like a row of single connectors, where the row can be expanded or
contracted to provide a required number of connectors. Some blocks have only single connectors,
some have only variable connectors, and some have a mix. Variable connectors are usually designated by a black arrow, as shown below.
557
The Constant block has two single input connectors and one single output connector:
A Math block in Add mode has a variable input connector and a single output connector:
Each block's functionality determines whether or not it has variable connectors, where they are
located, and what each connector represents. For example, a variable connector could have connectors captioned minimum and maximum placed on the bottom of the block for downward expansion.
Variable connectors can be expanded or contracted; they can also be collapsed. You expand or contract a variable connector to provide the desired number of inputs or outputs. You collapse a variable connector to improve model appearance.
Expanding or contracting a variable connector
Wherever possible a block will anticipate its usage and provide the required number of connectors.
For example, the Holding Tank block (Value library) has a variable connector that can be
expanded to provide three inputs: the amount wanted from the tank, a trigger to reset the tank's
settings, and the amount of initial contents. You might use one, two, or all three of those inputs,
but the block won't allow more than three inputs.
Drag the variable connector (as discussed below) until the desired number of connectors is
achieved. An example of this is the Reservoir model in , Building a Model , where you
expanded the variable connector of the Math block (Value library) to two inputs, one each for
rainfall and stream. If instead you had six water sources you could have expanded the variable
connector to accommodate all six.
Change some setting in a dialog, causing an increase or decrease in the number of connectors.
An example of this is the Random Number block (Value library), where you select a distribution
from a popup. Depending on the distribution chosen, the variable connector will provide from
two to four inputs for specifying the distribution's arguments. Since the number of arguments
for each distribution is fixed, you will not be able to expand the number of connectors beyond
How To
For other blocks, the number of connectors you might need depends on choices you make in the
dialog or how you use the block in a model. There are two primary methods for causing a variable
connector to change the number of available connectors:
558
the proper number. You can, however, contract the variable connector as discussed below. Note
that some blocks with variable connectors, such as the Equation blocks, do not allow you to
increase or decrease the number of connectors except through dialog settings.
To increase the number of connectors, hover the cursor over the black arrow on the variable connector until it becomes a dragging cursor (shown at left). Then click and drag in the direction of
the arrow. As you drag, more connectors appear and the number of connectors is displayed.
You will not be able to expand a variable connector beyond what is reasonable for the block, given
its usage and dialog settings. And some blocks, for example the Equation blocks, do not provide a
black arrow for expanding the number of connectors; the number of connectors in those blocks is
only controlled through the dialog.
To decrease the number of connectors, hover the cursor over the black arrow at the end of the last
connector until it becomes a dragging cursor. Then click and drag back towards the variable connector's starting point.
You will not be able to contract a variable connector below what is reasonable for the block, given
its usage and dialog settings. The number and location of connections to the variable connector
will also affect its ability to be contracted. If none of the connectors, or only the first connector, is
connected, you can contract the variable connector back to its unexpanded position by clicking
and dragging, as described above. However, if you have connected to more than one connector,
you can only contract the variable connector to the point of the outermost connection. In this
case, to reduce its size you need to collapse it, as discussed below.
Collapsing a variable connector
As discussed above, if you have made connections to a variable connector you might not be
allowed to contract it back to its unexpanded position. This is a safety mechanism, so that it is
clear what connections have been made. However, to simplify the appearance of the model, you
can collapse a variable connector to an unexpanded state even if it has many connections to it.
To collapse a variable connector, place the cursor over the black arrow until it
becomes a dragging cursor, then double-click. The connector now appears with
a red + sign in place of the black arrow, as shown on the right.
How To
To reverse the process, place the cursor over the red + sign until it becomes a
dragging cursor, then double-click.
559
Dialogs
Most block dialogs let you change or view the settings before, during, and after a simulation run.
Some of the things you can do using a dialog include:
Choose from multiple functions (e.g. the Math block)
Enter initial values
View simulation results
Add comments to help document your models
Set animation criteria
Choose notification options
To open a blocks dialog, double-click or rightclick the blocks icon. For example, if you double-click the Holding Tank icon, the dialog at
right opens.
In the dialogs title bar is the blocks global
block number, its name, and, in braces, the
library it resides in.
As each block is added to a model it is assigned
a unique and sequential global block number
from 0 to n-1. This sequence does not change.
If a block is deleted, its number becomes an
unused slot which is available when another
block or text is added to the model window.
Each block within a hierarchical block has a
second, local, block number that reflects its
relationship to the other blocks in the hierarchical submodel.
At the bottom of every dialog is a Help button that provides more information, such as the blocks
purpose and use, what each connector does, the meaning of each dialog item, and so on. Beside
the button is a text box where you can enter a label for the block, up to 31 characters. The View
popup box lets you change the view of the icon for the selected block, when available.
Some dialogs also calculate and display values that are generated as the model runs, so if you leave
a dialog open during the simulation, you can watch the impact on different variables. You can even
change some of the settings in a dialog as you run the simulation, such as choosing different buttons or typing new values.
When you click a button while the simulation is running, the block gets that changed value on the
next step. However, if you type text or enter numbers into a field, the model pauses while you are
typing in order to get your entire input.
How To
560
Animating blocks
ExtendSim provides built-in animation for many blocks and you can also create custom animation
for any block. To learn more, see Animation on page 609.
Hierarchical blocks
Its not unusual for models to have thousands of blocks in them, which can make it difficult to
understand what is happening in the model. Hierarchy helps solve this problem by grouping several blocks together into one hierarchical block that represents a portion of the process being modeled. A hierarchical block can contain submodels, text, graphics and clones of dialog items and
tables. Hierarchical blocks can even contain other hierarchical blocks, so there are multiple levels
of hierarchy.
The Navigator window in Model Exploring mode is a useful tool for quickly drilling down
through the different levels of hierarchical blocks to find the one youre looking for.
Because hierarchy is mainly used to enhance or simplify model appearance, it is discussed in further detail in Hierarchy on page 598.
Managing blocks
The topics within this section are only for block developers and those who save hierarchical blocks
in libraries.
Copying blocks
To make a copy of a block in the same library, select the block in the library window and choose
Edit > Duplicate. The Duplicate command copies the block into the current library and renames
it with the block name followed by the word Copy. This is common when you want to use the
ModL code in one block as the template for a different block.
To copy a block from one library to another, open the library windows for each of the libraries.
Then drag the block from its library window to the destination library window.
How To
To change the name of a block, select the block in the library window and choose Develop >
Rename Block. Then type in the new name. If you change the name of a block, models that use
that block will not be able to find it because they are expecting the original name. ExtendSim will
then ask you where the block is located and present a dialog box for searching, as discussed in
Block searches on page 550.
Removing blocks
It is rare that you will want to remove a block from a library but, if you do, select the block in the
library window and choose Edit > Clear or press the Delete or Backspace key. ExtendSim will not
let you remove a block that is in use in an open model window. If you remove a block that is used
by a model and later open that model, ExtendSim will present an error message and give you the
opportunity to indicate the location of the missing block; if it can't find the block, it will put a
placeholder in the model window.
Corrupted blocks
On rare occasions, you may get a message as you open a library that indicates that a block has been
corrupted or is bad. The corrupted block will appear in the library window as *BAD*Blockname.
To save the rest of the library, copy the uncorrupted blocks to a new library and discard the old
library. Then copy a backup copy of the block (if you have one) into this new library. This is a
good reason to always back up your work!
How To
562
Every modelers needs are different. ExtendSim offers a variety of methods to customize the applications interface so you can work in the most convenient and effective manner. This chapter discusses several methods you can use to create a user interface, including:
Cloning dialog and plotter items to change model parameters and report results
Centralizing data in a database
Simplifying and organizing models with hierarchy
Creating a dashboard interface
Using the Notebook to document and manage your models
Adding Controls to change and monitor critical parameters on the fly
Interacting with the model user
Using external applications as an interface
Documenting models using text and graphics
Cloning
In most programs, buttons and dialog parameters are found only in dialogs. The advantage of this
is you always know where to find them. However, having all your choices in dialogs can be a disadvantage in large models. For instance, you may want easy access to parameters in blocks that are
scattered in multiple hierarchical layers throughout the model. Or you might want to provide a
more accessible interface for other users of the model. ExtendSim overcomes these problems by
giving you freedom to clone dialog and plotter items and place them in a more convenient location, effectively creating a link with the original dialog item.
How To
Cloning gives you easier access to dialog and plotter items when you want to change settings or
monitor simulation results. Dialog parameter fields, tables, text, buttons, checkboxes, and radio
buttons, as well as graphs and data tables from plotters can all be cloned. Cloned items can be
placed in the model window, Notebook, or a hierarchical blocks worksheet, and text labels can be
used to make the cloned item easy to understand. You can clone multiple items from the same dialog or plotter or clone the same item to more than one location. Every clone acts exactly like the
original: if you change the original or any clone, all instances are updated immediately.
Using cloned dialog items puts you in direct control of your models. Clone the dialog items to a
centralized location so you can easily change parameters. Label the clones so they are well-documented and use them as the simulation runs, such as clicking buttons or entering values in text
entry boxes. For example, clone a Constant blocks Constant value field to change the value
between simulations without having to open the blocks dialog, making it easier to test different
assumptions. Or have an area of the model or its Notebook that lets you monitor several numeric
values at a time, rather than just using the Plotters graph to watch the simulation results.
Clones that display changes will cause the simulation to run slower.
How to clone a dialog item
The same technique is used to clone an item onto the model or hierarchical blocks worksheet or
into a Notebook.
563
Select both the Current level text and its parameter field and drag them onto the model window below the Holding Tank block.
Hold down the Shift key to select multiple items or drag a frame around them. Clones can be
moved, resized, and aligned after they are placed.
If the model runs too quickly to see the change, go to Run > Simulation Setup > Setup tab and
change the end time to something much larger, such as 1000, then run the simulation again.
To move a cloned item, choose the Clone tool from the toolbar, click on the item, and drag it. To
align two or more clones, select them and use the Model > Align command.
To resize a cloned item, choose the Clone tool and click once near
the center of the cloned item so that the resizing handles appear.
Then click and drag a handle to change the size and shape of the
clone.
To remove cloned items from a model, simply select them (using
the Clone tool) and press the Delete key or choose Edit > Clear.
If you delete the block from which you cloned a dialog item, the cloned item is automatically
deleted.
How To
You cannot move a cloned item from one hierarchical block to another unless the target hierarchical block contains the source hierarchical block.
564
To find and open the dialog from which an item was cloned, choose the Clone tool and doubleclick the cloned item.
Unlinked clones
If a blocks structure is modified by deleting a dialog item or changing the tab
order of the dialog items, clones associated with that block may become
unlinked. In this case, the clone will be grayed out and ??? will appear in place
of the cloned dialog item.
Unlinked clone
Choosing the clone tool and double-clicking the unlinked clone will cause an alert message to
appear. Then the dialog of the block from which the clone originally came will open. You may
then select a replacement item to clone, or simply delete the clone if it is no longer needed.
Hierarchy
Hierarchy is useful for customizing a models interface. It reduces the number of blocks visible on
the model worksheet, so models are easier to understand and navigate. It is also used to organize
the model into easily-recognized components, separating the model into process elements that are
more closely tied to reality.
For instance, you could encapsulate portions of a model into hierarchical block then clone dialog
items to the top of the hierarchical block's worksheet for easy access. Or add custom pictures as
icons for groups of hierarchical blocks that all relate to a certain part of the process youre simulating. You could also create a hierarchical Help block for the model user, as discussed at Help
block on page 572.
How To
For more information about working with hierarchy and customizing and animating hierarchical
blocks, see Hierarchy on page 598.
Model window
showing a
custom button,
a custom popup
menu, and a
cloned dialog
item
565
Buttons
The Buttons block (Utilities library) makes it easy
to create buttons that will
activate frequently-used commands. A
number of predefined buttons can be
selected from the popup menu in the
blocks dialog. You can also create a custom button for a specific purpose by
changing the label and/or equation.
The pre-defined buttons are:
Animation On
Animation Off
Open Notebook
Run Simulation
Pause Simulation
Save Model
Open Block
Open H-block
Open Database Table
Open Database
Run Optimization or Scenarios
Select or create the button in the
blocks dialog, then clone the button
from the dialog to the model worksheet, Notebook, or hierarchical block.
The button will execute the command
whenever it is clicked and during the
enabled conditions on its Options tab.
The Animation On and Animation Off buttons in the Buttons block only control 2D animation
during the simulation run; they do not control 3D animation.
How To
Each button requires a separate Buttons block. To store the block, place it
anywhere on the model worksheet or
within a hierarchical block. A common
place is to store the Buttons block
behind its cloned button.
566
Popup menus
The Popups block (Utilities library) lets
you create a popup menu of customized
options that a user can select from to control model behavior. Connect the blocks
output to the input connector of any block that requires
that value. Depending on the option selected, the block
will output a value specified in its dialog table.
To create the popup menu, enter a label for each option
in the second column of the table in the blocks dialog.
Then clone the menu item to a worksheet, hierarchical
block, or Notebook and connect the Popups blocks output to the block you want to control. When the user
selects an option from the menu, the Popups block outputs the corresponding numeric value from the first column in the dialogs table. You can create a popup menu
with as many options as you want.
Popups block dialog
For an example where the Popups block is used, see the
Monte Carlo model, located in the folder \Examples\Continuous\Standard Block Models. The hierarchical block labeled Scenario in the lower
right corner contains a Popups block. That block is used to create the pop- Popups menu
ups menu for the cases.
You can link the table in the Popups dialog to an ExtendSim database table, creating a popup
menu for selecting a database record.
How To
On/Off Switch
The Switch block (Utilities library) can be used like an On/Off switch to control
some aspect of a model. The blocks input connector is used to turn the Switch on
and off; its output connector reports the status. A value of 0 (zero) indicates the
Switch is off and a value of 1 (one) indicates it is on. This block is similar to the
Switch control described in page 568, but it has some additional features: the Switch blocks dialog
has a Switch that can be cloned to the model worksheet, Notebook, and so forth; there is a dialog
item that allows the Switchs status value (1 or 0) to be linked to a database, global array, or Excel
spreadsheet; and in a discrete event model, the Switch block can send a message to a connected
block to notify it of a status change.
Notebooks
As you saw in the tutorial in Chapter 1, a Notebook is a window you can customize to help you
organize and manage the data in a model. Each model has its own Notebook which can contain
clones of dialog and plotter items (see Cloning on page 562), as well as text, pictures, and draw-
567
ing objects (see Text and graphics on page 572. To see an example of cloning a plotters graph to
a Notebook, see Cloning on page 38.
A typical use for Notebooks is for collecting all of the items you might want to watch in one place.
Since you can leave a Notebook open as a simulation runs, use it as a central display for all of the
important values in all the dialogs.
Another common use is as a control panel. Clone all the dialog items that you might want to
change while the simulation is running to the Notebook so you do not need to open the dialogs
from the worksheet in order to make a change.
If a model's Notebook already has data or other contents in it, it will say (has data) beside the
Window > Notebook command.
When you save a model with the Notebook open, the Notebook will automatically open with the
same configuration the next time the file is opened. A Notebook can be many pages long. With the
Notebook as the active window, choose File > Show Page Breaks to show the number of pages and
how they would print.
You can copy the contents of a Notebook as a picture which can be pasted into other applications
such as a word processing document or a presentation. Simply select the items you want, then
choose the Edit > Copy To Picture command to copy the picture into the Clipboard.
Controls
ExtendSim has three special tools in the Model > Controls command that are used to control
blocks and show values directly as the simulation runs.
The controls are the Slider, Switch, and Meter. The Slider and the Switch are used to set values in
your models. The Meter is used to see values as the model is running. The Meter also has a dialog
that you can access by double-clicking it.
The Utilities library has Meter, Slider, and Switch blocks. Those blocks can provide even more
flexibility than the Controls discussed here.
Slider
A Slider control lets you slide an indicator along a scale to change
the value of its output. You set the maximum and minimum values by selecting the numbers at the top and bottom of the Slider
and typing in the desired value.
Maximum
Current
than the maximum, or if you set the value at the top of the Slider
to be less than the minimum, ExtendSim will warn you.
As you slide the indicator, the current value is displayed on the
indicator and is output through the middle connector. There are
also connectors next to the minimum and maximum values that
output those values.
Minimum
Slider
How To
568
Switch
The Switch control looks like a standard LED switch that glows green
when it is on. It has two inputs and one output.
Off
On
Switch showing off
and on states
The input connectors at the bottom of the Switch are used to change the
state of the Switch by setting their side of the Switch to true from within
your model. For example, you might want to set the Switch to off when a
model starts, then change it to on after some period of time. The next
time you run the model, the Switch would be automatically set to off
again when the model begins.
When either of the Switchs inputs gets a true value (defined as 0.5 or
greater), it selects that side of the Switch. If the other input later gets a
true value, the Switch will shift to that side.
If an input receives a true value and that side of the Switch is already selected, no change is made.
How To
Meter
The Meter visually displays how values vary between a known
maximum and minimum. Set the maximum and minimum values through the Meters dialog or by connecting other blocks
(such as Constant blocks) to the top and bottom connectors.
This is a good control to use if you want to see values while the
simulation runs but you dont need to save them to a plotter.
Maximum
Current
Minimum
Meter
569
Notify block
The Notify block (Value library) provides three options for sending messages to the
user: Play a sound, Prompt for output value, and Stop the simulation. For all
three options, the Notify block has an input connector that receives a True or False
value that is used to determine whether or not to play a sound, stop the simulation,
Set to play a
or issue a prompt. When the Prompt option is selected, the block also has an output
sound
connector to output the value the user enters after being prompted.
All three options define True as being 0.5.
Play a sound
This option plays a sound when its input connector gets a True value (alternately, you can choose
to have it play only when the input value is True
and animation is on). To use a sound, choose the
Play a sound option and enter the sound name
in the Notify blocks dialog. You can enter the
name (such as click or crack) for any sound
located in the ExtendSim Extensions folder. To
hear that sound, click the Play Sound button.
How To
570
the new value. The output value can be any number, including 0. If the user clicks the Cancel button in the prompt dialog, the simulation stops.
Stop the simulation
This option is used to stop the simulation and
alert the user if the monitored parameter gets a
True value.
You can customize the block to display any warning message you want, up to 255 characters. You
can also set the message to include the block's
number and the time the event occurred.
Equation blocks
The Equation block (Value library) and Equation(I) block (Item library) provide flexibility and
control for creating user interface elements. Most
Stop option selected in Notify block
ModL functions can be called from an Equation
block, including functions specifically for interacting with the model user. The blocks provide similar functionality, but the Equation block calculates its equation when it gets a value and the Equation(I) block calculates its equation when an
item arrives. Equation blocks are useful when you want a more complex set of rules for the interaction than the Notify block provides.
How To
For example, you could use an Equation block to prompt for a value if a certain condition exists and then change the result based on input from the user, like the
Prompt block. But then add another condition, such as a delay between when the
user is prompted.
571
The equation in the following screenshot causes a message to appear to the model user, asking for
a new processing time if the length of the queue exceeds 50 and at least 10 time units have elapsed
since the last value was requested.
DLLs (Windows) and Shared Libraries (Mac OS) are especially handy where you want to add a
feature or functionality that ExtendSims language (ModL) does not support. For example, you
could use a DLL or Shared Library to display a picture or graphic in a separate window when a
user clicks a button or to create a customized sound resource based on numerical values from the
model. DLLs and Shared Libraries are segments of code written in any language, such as Visual
Basic or C++. ExtendSims DLL and Shared Library functions allow you to call these code segment resources from within a blocks ModL code and perform operations.
Embedded objects can be used to place a document or display from another application, such as
Excel, into an ExtendSim model. Use one of the methods discussed at Embedding an object
(Windows only) on page 746 to transfer information between ExtendSim and the ActiveX
(Windows) control.
How To
Some of the available functions include displaying a message, prompting the user to input a
value, or making a sound. These functions can also be used for debugging ExtendSims ModL
code, although using the Source Code Debugger is the preferred approach.
572
Documenting models
Creating a user interface also involves adding information or graphics to clarify what is happening
in a part of the model or to explain why a particular modeling approach was used. You do this by
putting text, pictures, or draw objects on the worksheet or by creating a hierarchical Help block,
as shown below.
Help block
To create a Help block, choose Model > New Hierarchical Block and name the H-block Help.
Then add explanatory text, pictures and/or draw objects to the hierarchical block's worksheet,
close and save the block, and place it where you want on the model.
How To
For more information about working with hierarchy and customizing hierarchical block icons, see
Hierarchy on page 598.
How To
Model Execution
Tips for running simulations
574
Model Execution
Simulation setup
With ExtendSim, you have several options for controlling simulation runs, including:
Using the Simulation Setup dialog to determine how models will run
Important points when running a model
Information provided in the status bar
Using blocks to control or monitor simulation runs
Saving intermediate results
Setting the timing for your runs
Determining an appropriate simulation order
Choosing time and other units that are most relevant for your models
Determining the length and number of runs
Speeding up and slowing down simulations
Working with multiple models
How ExtendSim passes messages in models
Simulation setup
How To
Before running a simulation, you need to specify how long it will run. Use the Simulation Setup
dialog to set the simulation duration, choose a time unit for the model, have the model run multiple times, or select other simulation and animation options. To access the dialog, choose Run >
Simulation Setup. The dialog has five tabs which are described in detail below.
Model Execution
Simulation setup
575
Setup tab
Description
End time
The time that the simulation will end. See also Simulation timing on
page 84 for continuous models and Moving items through the simulation
on page 290 for discrete event and discrete rate models.
Start time
The current time at the start of the simulation. By default this is set to 0, since
that is the most common starting point. Set it to a different value if the model
uses the time value for some calculations. See also Simulation timing on
page 84 for continuous models and Moving items through the simulation
on page 290 for discrete event and discrete rate models.
Runs
The number of consecutive times to run this simulation. In the status bar, discussed on page 582, the numbering of simulation runs starts at 0.
Time unit for the entire model. Local time units can be defined within the
dialogs of blocks that contain time parameters. See Time units on page 584.
Calendar date
definitions
Non-Calendar
date definitions
How To
Choice
576
Model Execution
Simulation setup
Continuous tab
The Continuous tab is only used for changing the time step, stepsize calculation, or simulation
order for a continuous model.
Choice
Description
How To
End time, Start time, For the convenience of continuous modelers who want to change stepsize,
Runs, Global time
these four settings from the Setup tab are repeated on the Continuous tab.
units
Changing any of these settings on one tab will change them on the other. See
their descriptions in Setup tab on page 575.
Time per step (dt)
Represents delta time (dt), or the length of time per step. This is the default
choice for determining the granularity of the simulation run. For most purposes use the default setting of 1, meaning that each step will be one time unit
long. A value for the number of steps is automatically calculated based on the
dt entered. The value is computed as: floor(((EndTime-StartTime)/DeltaTime) + 1.5). To see this, select the Number of steps option after changing
the Time per step (dt). See also Specifying dt or the number of steps on
page 85.
Number of steps
Another method for determining the granularity of time for the simulation
run. In most cases, this would be a number equal to the duration (length of
the simulation run); the model calculates values once for each step and each
step is one time unit long. A default value for delta time is automatically calculated based on the number of steps you enter. The value is computed as
(EndTime-StartTime)/(NumSteps - 1). To see this, select the Time per step
(dt) option after changing the Number of steps. See also Specifying dt or the
number of steps on page 85.
Stepsize calculations
These are only used in continuous simulations that change the DeltaTime system variable, such as electronics models. Most models should use Autostep
fast. If the blocks that you create change DeltaTime and demand more accuracy, use Autostep slow (which divides the calculated value for DeltaTime by
5). If your custom blocks change DeltaTime but you want to ignore the
changes, select Only use entered steps or dt.
Model Execution
Simulation setup
Choice
Description
Simulation order
Flow order should be used for most models. For more information, see Sim-
577
For the table that follows, consecutive simulation runs means setting the number of simulation
runs in the Setup tab to something greater than 1.
Description
Random seed
The interface for the random number generator. A value of 0 or blank uses a
random seed; any other value causes repeatable sequences of pseudo-random
numbers. Note: Each block that outputs random numbers will generate its
own independent sequence. For more information see Random seeds on
page 685.
When this option is selected from the popup menu, random numbers are initialized at the start of every simulation run. If the global random seed is blank
or 0, a new randomized seed will be generated at the start of every consecutive
simulation run. If the global random seed is a positive integer, the same seed
value will be used for every consecutive run.
Continue sequence of When this option is selected from the popup menu, the sequence of seeds for
random numbers
each consecutive simulation run is continued from the previous run.
How To
Choice
578
Model Execution
Simulation setup
Choice
Description
Use database
table__Seed for
values
When this option is selected from the popup menu, the starting seed for each
consecutive run is read from the __Seed table in the selected ExtendSim database. This option allows you to specify exactly which seeds will be used for
each simulation run. It also is a convenient method for recording a set of seed
values. To specify a set of random seeds, create a table in a database with one
field and a number of records equal to the number of simulation runs. The
model will access sequential records for each consecutive simulation run, and
that records value will be the seed value for the run. If you leave the records
blank or enter zeros, ExtendSim will fill the table with seed values on the first
run. It will then use those seed values for each subsequent set of runs.
At the start of the simulation, all blocks that use random numbers are checked
to make sure that no two blocks are using the same seed values. This option is
not necessary unless the use block seed option is selected in the individual
blocks.
Use recommended
When checked, ExtendSim will use the recommended Minimum Standard
random number gen- random number generator. When unchecked, ExtendSim will use the
erator (default)
optional Schrage random number generator used in previous versions (backwards compatibility). For details about the ExtendSim random number generator see Random number generators on page 684.
How To
Antithetic random
variates (off by
default)
Model Execution
Simulation setup
579
3D Animation tab
3D animation is not available with all products. For complete information about 3D animation
and the following settings, see the E3D module that starts on page 447.
Description
Show 3D animation
during simulation
run
Opens the E3D window when the model opens. If the window is subsequently closed, it will reopen during model initialization when the model is
run. This is the same as selecting the command Run > Show 3D Animation.
Select mode
Defines how the E3D window and the simulation interact. QuickView shows
all of the movement of items in the E3D window while the simulation is running. Concurrent is a more realistic animation than QuickView and shows
only the movement of items that requires simulation time. The 3D animation
runs during the simulation run. Buffered is similar to Concurrent except it
runs the 3D animation after the simulation has ended. The selected mode is
shown at the top of the E3D window.
Environment file
Selects a file that specifies the appearance and behavior of the background for
the E3D window. The default is the Extend3D.mis file; you can also create
custom environment files.
Define conversion
ratios
Specifies the relationship for distance and time between the E3D window and
the simulation. The distance ratio defines how many pixels in the 2D
worksheet window represent one meter in the E3D window. The value
for the time ratio controls the 3D animations display speed and is displayed at
the top of the E3D window. The time ratio value, and the animation speed,
changes if you click the Faster or Slower buttons on the E3D window. In most
cases the default values for these settings will not need to be changed.
Comments tab
Use this tab to enter comments about the simulation run.
How To
Choice
580
Model Execution
Running a model
Running a model
In the ExtendSim Tutorial you learned the basic steps in running a model. Some additional points
are discussed in the following sections.
How To
You should plan on running a simulation at least 3-5 times to estimate the variability in output
whenever a model contains random variables. Then you can use statistical sample-size calculations
(discussed in Determining the length and number of runs on page 589) to determine how many
additional simulation runs are required to obtain an accurate estimate of the models performance.
Some tools in ExtendSim for evaluating multiple simulation runs are:
Histogram blocks (Plotter library) that show the shape and any tendencies in the range of results
Error Bar plotters (Plotter library) that show how a variable is affected by randomness through
the course of the simulation run
MultiSim plotters (Plotter library) that can retain data and show the results of up to four simulation runs
Confidence intervals (reported by the Statistics block in the Value library) that show the probability that a certain range captures the true mean for a simulation model result
Model Execution
Running a model
581
Give the command Run > Pause, or click the Pause/Resume button in the toolbar, as the simulation runs. Then give the command Run > Resume or click the Pause/Resume button again to
continue execution. This method works well for pausing a run one time to observe something of
interest, but is not that useful for stepping through the entire model since it depends on your
dexterity.
Clone the Pause Simulation button from the Buttons block (discussed at Buttons on
page 565). Then give the command Run > Resume or click the Pause/Resume button to continue execution. To use this method, click the Pause Simulation button each time you want the
resumed simulation to pause. This works well if your intention is to pause the simulation once
or twice when you see something of special interest.
Use the Pause Sim block (Utilities library).
This block causes the simulation to pause
when certain conditions are met; the conditions are specified in the blocks dialog
(seen at right). These options give more
flexibility than either of the two previous
methods; they are particularly useful when
stepping through a model. Give the command Run > Resume or click the Pause/
Resume button to continue execution.
Use the Debugging menu commands discussed on Debugging on page 816. This hierarchical
menu lets you modify the way a simulation runs and facilitates finding a modeling problem.
The three Step... commands in the Debugging menu determine how the Step command in
the Run menu performs during a simulation run.
See also Slowing down simulations on page 591.
The ExtendSim application communicate with blocks in a model and the blocks can communicate with each other by sending and receiving messages before, during, and after a simulation
run. This unique communication method allows powerful modeling constructs and results in
models that are visually logical and easily understood. See also How ExtendSim passes messages
in models on page 591.
For more information about running models under different circumstances, see the following sections:
Animation on page 609
Sensitivity analysis on page 628
How To
Windows and dialogs, such as the Notebook, a blocks dialog, or a hierarchical blocks worksheet, can be left open when the model runs. However, you cannot run a simulation with a
blocks structure open and leaving too many windows open (especially if they have parameters
that update constantly) can slow simulation speed.
582
Model Execution
Running a model
Status bar
Once the simulation run begins, ExtendSim shows information in a status bar at the bottom of
your model:
Status Bar
When you start the simulation run, ExtendSim displays some initial status information in the
form of messages that appear momentarily in the status bar area. Depending on the speed of your
computer, you may see the following messages: Wait, Checking Data, or Initializing Data. These
messages inform you of ExtendSims status as it checks and initializes the model prior to starting
the run. On fast computers, the messages may appear too quickly for you to read.
Other messages are displayed in the status bar while the simulation runs:
The number after the hourglass is an estimate of the actual time left in the simulation (expressed
as minutes:seconds) so you can determine how long it will run.
The clock shows the current time of the simulation in simulation time units.
Run shows the number of the simulation run when multiple consecutive simulations are running (the numbering of simulation runs starts at 0).
These values are determined by the entries in the Simulation Setup dialog described in Setup tab
on page 575.
How To
Note that the time remaining shown in the Status Bar is only an estimate. For continuous simulations, it is usually accurate. For discrete event and discrete rate simulations, however, it can be inaccurate, as discussed next.
Timer inconsistencies (event-based models only)
In discrete event and discrete rate models, the value for the timer hourglass sometimes varies from
one moment to the next, especially at the beginning of a run when it is impossible to know when
events are going to happen and thus how long it will take to run a model. The estimated time
remaining may even increase if the simulation starts to run slower because items are being delayed
more or because more events are being generated. The Status Bar will sometimes show the phrase
Initializing Data during the initial steps of a discrete event simulation if there is a great deal of
fast activity (for instance, if you use the preprocessing suggestion shown in Connections to multiple item input connectors on page 292.
Since it is only an estimate, do not be concerned about the value in the Status Bar; the model is
running correctly regardless of the value shown there. However, if the timer hourglass continues to
increase throughout the run and the simulation clock does not advance, it may indicate that there
is an infinite loop in the model. Running the model with 2D animation on may help identify the
cause of this.
Model Execution
Running a model
583
Bring the model window to the front, before all other windows.
While the model is running, select File > Pause and Save/Save As.
How To
584
Model Execution
Timing
Timing
Unless you stop them earlier, all simulations run for a specified period of time. ExtendSim determines the duration of a simulation run based on the values entered in the Run > Simulation Setup
> Setup tab; the duration is the period from the start time to the end time.
Time units
How To
Time is the most common unit of measure in simulation. Each model has its own time unit that is
managed in the Simulation Setup dialog.
Model Execution
Time units
585
time. Once you select a global time unit, all blocks with time-based parameters, including those
subsequently added to the model, use it by default as their local time unit.
Using the generic global time unit
By default, the non-specified Generic time is a new models global time unit. Generic is a conceptual unit of time and has whatever meaning you give it. Generic time is the same for the whole
model and for each block that has time-based parameters.
This option is used by most modelers to quickly create a model without having to select a specific
time unit. It is also commonly used when the models blocks use the same time units as the model.
With the Generic global time unit, time-based blocks do not
have a local time unit. Instead, all blocks that include a timebased parameter will specify generic time units.
Models cannot use Calendar dates or specify a local time unit if the global time unit is set to
Generic.
If you change the global time unit in the Simulation Setup dialog, be sure that the new time unit is
appropriate for all blocks that use the default time unit. For example, if the global time unit was in
hours and you change it to days, a block that used two hours will now use two days if it is set to use
the default time unit.
How To
As discussed in Local time unit on page 585, when the model uses a specific global time unit,
you can change the local time unit to be anything you want.
586
Model Execution
Time units
You can thus choose any unit of time for each time-based
parameter in each block in the model. This means you can
specify the parameters time locally as milliseconds, seconds, minutes, hours, days, weeks, months, or years,
regardless of the global time unit.
In continuous and discrete event models, a local time unit applies only to its associated time-based
parameter. For instance, an Item library block can have two local time units, each associated with a
different parameter. In discrete rate models however, the local time unit applies to the entire block.
There can only be one local time unit for a discrete rate block.
If a local time unit is specified, ExtendSim will automatically convert parameters based on the local
time units relationship to the global time unit. If the model is using Calendar date definitions (see
Calendar dates, below) that conversion will be based on the calendar. For example, the actual
number of days in the month selected. If the model is not using Calendar dates, the conversion
will use the non-calendar definitions entered in the Simulation Setup dialog, as discussed in Time
unit conversions (non-Calendar dates) on page 587.
Selecting a specific global time unit provides consistency when adding new blocks to the model,
since every new block will initially be using the same time unit. However, in some cases you will
not want to keep all parameters in default mode. Explicitly selecting a time unit (even the same
unit of time as the global time unit) for each local parameter in the model is a safer choice. Then,
if you subsequently decide to change the global time unit, you will not accidentally affect the simulation results.
You can select a time unit from the popup that is not the default but which has the same name as
the default global time unit. For instance, you can select hours from the popup, rather than
hours*. You would do that if you do not want the local time unit to change based on a change in
the global time unit.
Calendar dates
How To
Model Execution
Other Units
587
tion.) If 1904 date system is not checked in Excel on the Macintosh, uncheck this option in
ExtendSim.
Selecting Use calendar dates for a model can also affect blocks that deal with time. For example, if
Calendar dates is enabled, you can use the calendar format to create a schedule in the Create block
(Item library). An example of this is the block named Schedule in the Scheduling Resources
model located in the folder \Examples\Discrete Event\Resources and Shifts. (The model is discussed in the section Scheduling resources on page 222.)
The following blocks allow you to select Calendar dates in their dialog:
Create (Item library) when it is set to Create items by schedule or Create values by schedule
History and Shift blocks (Item library)
Lookup Table (Value library) when it is set to Lookup the: time
Plotter blocks such as the Plotter, Discrete Event and Plotter I/O
Do not use Calendar dates if block dialogs are set to use values smaller than 1 second (such as
0.0005 seconds), as it may affect numerical precision.
For example, assume you are using the default constants and
the global time unit for the model is days, but you have selected a local time unit of hours for a
blocks time-based parameter. When the model runs, ExtendSim will cause that parameter to be
divided by 24, converting it into the appropriate value for one day.
Time unit conversions are only applicable if the model uses specific global time units and does not
use Calendar dates.
Other Units
Flow units (gallons of liquid, cartons of cereal, rolls of paper, tons of flour, and so forth) can be
defined in the Rate library blocks. For more information, see Units and unit groups on
page 315.
Length
The Transport and Convey Item blocks (Item library) utilize a unit of distance (feet or meters) to
calculate the delay required to move an item from one point to another. Similarly, the Convey
Flow block (Rate library) uses a user-defined unit of length to calculate a delay for moving units of
flow.
How To
Flow units
588
Model Execution
Length and number of runs
Terminating systems
Some systems obviously lend themselves to a natural determination of end time. For instance,
most service operations have a point at which activities end. In these terminating systems there is
an obvious time when no more useful information will be obtained by running the simulation longer. For example, when modeling one day at a walk-in customer service center that is only open 8
hours each day, you could safely set the simulation end time for 8 hours. Since customers would
not wait overnight in line for service, the service queue would be empty or cleaned out at the end
of the day and further simulation time would be unproductive.
How To
Because terminating systems do not typically reach a continuing steady state, your purpose in
modeling them is usually to look for changes and identify trends, rather than obtain system-wide
statistical averages. For instance, in the customer service center mentioned above, it is more important to determine the peaks and valleys of activity than to calculate overall averages. Basing your
decisions on average utilization in this case could obscure transient problems caused by multiple
periods of understaffing.
Since the initial conditions in terminating systems will have an impact on results, it is important
that they be both realistic and representative of the actual system. Terminating systems are simulated using multiple runs for short periods of time using different random seeds for each run. As
discussed in Confidence intervals on page 627, the more frequently a simulation is run, the more
confidence you can have in the results.
Non-terminating systems
A non-terminating system does not have a natural or obvious end time. Models of non-terminating systems are often called steady-state systems since, if they are run long enough, the results tend to
a steady state. In these situations, simulation runs could go on indefinitely without materially
affecting the outcome. Most manufacturing flow systems and some service situations (for example,
24-hour convenience stores, emergency rooms, and telephone service centers) are non-terminating
systems.
Systems that have off-shift periods, for instance a manufacturing plant that operates only two shifts
a day, may still be considered non-terminating. If the operation does not clear out at the end of the
second shift, but instead the first shift starts up where the second shift ended, the system is considered non-terminating and the off shift period is just ignored for modeling purposes.
Model Execution
Speeding up a simulation
589
The important considerations when modeling non-terminating systems involve eliminating the
initial bias caused by the warm-up period, deciding how to obtain samples for statistical analysis,
and determining the length of the run.
The warm-up period is the period from start-up to when processes operate at their normal or
steady-state level. In simulation models, start-up conditions may be unrealistic or nonrepresentative of the actual system and may bias simulation results. To overcome this, you can either wait
until after the warm-up period to gather statistics, reset statistics as discussed in Clear Statistics
on page 626, or run the simulation for a long period of time to swamp the biasing effect of the
initial conditions.
To obtain multiple samples for statistical analysis, you could perform repeated runs after eliminating or compensating for the warm-up bias or you could do one extremely long run and calculate statistics on results occurring during various windows of time. As with terminating systems,
the greater the number of samples, the higher the confidence in the results.
The run length of a non-terminating system depends on various factors, including how you
obtain samples, your period of interest, and your modeling objectives, as discussed below.
For more information on determining the length and number of simulation runs, please refer to a
simulation or statistics textbook.
Speeding up a simulation
The more complex your model, the more important it is to have it run quickly. Models become
complex as you add more detail to the workings of each part, or as you run it for longer or, for continuous models only, with smaller delta time increments. Although ExtendSim runs models at
extremely high speeds relative to other programs, it can never hurt to think about speed considerations. The following topics discuss some common reasons why a simulation might run slower
than it should and how to speed it up.
How To
The number of simulation runs is determined by statistical sample size calculations and your modeling goals. If your goal is to estimate performance, the number of runs is determined by the
required range in a confidence interval. If your goal is to compare alternatives, the number of runs
is based on acceptable levels of risk.
590
Model Execution
Speeding up a simulation
How To
Model Execution
Slowing down simulations
591
How To
The Prioritize Front Model command causes the frontmost model to have processor preference
592
Model Execution
How ExtendSim passes messages in models
All types of blocks can receive application messages. Continuous blocks neither receive nor send
block messages.
Application messages
Application messages are usually sent to blocks by the ExtendSim application. There are several
types of application messages: Simulation, Model Status, Block Status, Dialog, Connector,
Dynamic Link, OLE, and 3D Animation. They are completely discussed in the Developer Reference.
The major application messages are:
CheckData
StepSize
InitSim
Simulate
FinalCalc
EndSim
The application can send message before, during, and after the simulation run, including:
At the start of the simulation
At each step
When a parameter is changed
When a dialog is opened
If a button is clicked
How To
Model Execution
How ExtendSim passes messages in models
593
Event. Communication between the Executive block and various Rate library blocks.
Value connector. Notifies connected blocks that the value of a output connector has changed or
requests updated input connector information.
Flow connector. Updates the effective rate through the connected blocks.
Rate blocks flow. Defines the LP area that part of the model that could be impacted by a
change in the effective inflow and outflow rates.
Executive flow. Updates all the blocks in an LP area with a new effective rate.
The discrete rate technology has a complex and unique messaging architecture. For optimal performance, it is important to understand discrete rate messaging when building rate-based models. For
more information, see Block messages on page 445.
How To
How To
594
Model Execution
How ExtendSim passes messages in models
How To
Presentation
Organize and enhance models
so they communicate your ideas
596
Presentation
Working with text
Simple models, like the Reservoir shown in the Tutorial, are easy to follow. But as models become
larger and more complex, worksheets can become crowded with thousands of blocks, making it
harder to communicate whats happening. ExtendSim provides several features that let you organize, explore, and enhance models, such as:
Using text and graphics to improve model appearance
Using the Navigator to quickly locate important parts of the model
Organizing the model into logical sections with hierarchy
Adding 2D animation to visually represent the models logic and behavior
Centralizing model inputs and outputs in an ExtendSim database
Changing how connection lines are displayed
Simplifying model appearance by hiding connections and connectors
For additional ideas to enhance a models appearance, see the chapter Creating a Custom User
Interface on page 561.
Entering text
To add text to your model, double-click the worksheet or Notebook
where you want the text to appear and a text box will appear. You can
now type your text. You can use the handles in the corner of the text
box to resize it.
When youve finished entering text, click anywhere else in the window
and the box will disappear. To edit an existing text box, select the
Block/Text layer tool and double-click the text. (You can also use the
Clone layer or All layers tool for this, but using the Draw layer tool will
open a new text box.)
How To
When the text is highlighted, you can use the Copy and Paste commands, then move the new text
where you want it (or click on the window before pasting to position it in that spot). To copy just
portions of the text, double-click to make the text box active, then select the text you want. You
can also use the Edit > Duplicate command or Ctrl+D to copy and paste model elements slightly
offset from the original.
When you paste text onto the model worksheet or into another text box, it remains editable text.
However, if you select and copy an entire text box and paste it to the Notebook, it becomes a picture. To paste editable text into a Notebook, copy the contents of the text box, not the text box
itself.
Presentation
Navigator
597
Formatting text
To type new text with a particular format, select the desired format before you start the text box.
ExtendSim will remember that format every time you start new text.
To format existing text, access the text box, select the text, and then choose a command from the
Text menu, such as Bold or Justify Center. You can also change the color of text using the Color
palette. To do this, select the text in the box then click one of the colored squares in the palette as
described in Patterns and colors on page 620.
If you change the format of text within an existing text box, ExtendSim wont use that format as
the default for the model. To cause a format to be the default, change it before creating a text box.
The Border command adds a border with a drop shadow to the text. This can
be a useful way to distinguish descriptive text from block labels or named connections. The text example on the left has a border.
With the Transparent command checked, text on top of
another object wont show its background color. With the command
unchecked, a white rectangle behind the text will overlap other objects. The
examples are shown at the right.
Navigator
The Navigator is an explorer-like window that can be used for multiple
purposes:
How To
Navigator with
hierarchical block
expanded
598
Presentation
Hierarchy
Since it has multiple uses, the Navigator is discussed fully in the How To: Miscellaneous chapter.
For more information, see Navigator on page 770.
Hierarchy
As you saw in Introduction to hierarchy on page 36, ExtendSims hierarchical capability lets you
combine basic modeling constructs (such as a group of connected blocks) into a single, higherlevel construct, then combine several of those new constructs into an even higher-level construct,
and so forth. This process causes portions of a model, or even the entire model, to be implemented
in layers, where you can drill down from the highest system level to the smallest detail. For example, the Santee River Basin model on page 8 was created using many layers of hierarchy; without
hierarchy the model would be overwhelmingly complex.
The mechanism for creating hierarchical layers in ExtendSim is by building a hierarchical block, a
special type of block that usually has a group of blocks nested inside it. These blocks represent a
portion of the model, a subsystem or submodel. Using hierarchical blocks you can nest subsystems
in an unlimited number of layers for top-down or bottom-up modeling.
Top-down modeling is starting with a new hierarchical block and building a model or a series of
submodels in it. Bottom-up modeling involves selecting a group of blocks within a model and
making them into a hierarchical block. You can create multiple hierarchical layers from the top
down or from the bottom up.
How To
To increase productivity and comprehension, create a hierarchical block that represents a process
element, then use it in several models that have that element in common. By changing the
parameters, each instance of the hierarchical block can be customized for its model.
When developing a new model, go from the simplest assumptions to more complex ones by creating more and more levels of hierarchy. This helps structure your thinking and makes models
easier to follow as they become more complex.
Although hierarchical blocks usually contain submodels of blocks, they dont have to. They can
also be useful for enhancing and documenting the model, serving as popup windows that reveal
pictures, text, and so forth when double-clicked. For an example, see Help block on page 572.
Presentation
Hierarchy
599
Hierarchical blocks
There are two ways to create a hierarchical block:
1) Select and encapsulate a group of blocks into a new hierarchical
block. This is most often used to organize the complexity of an existing model and is discussed at Making a selection into a hierarchical
block on page 600.
2) Create a new hierarchical block from scratch and build a submodel
within it. This is used for top-down modeling as discussed in Building a new hierarchical block on page 601.
The structure window. This is displayed if you create a new hierarchical block by giving the command Model > New Hierarchical Block or if you select an existing hierarchical block and give
the command Model > Open Hierarchical Block Structure. The structure window contains
another view of the submodel pane and additional panes for modifying the hierarchical blocks
icon, adding Help, and so forth. It is shown on page 602.
Characteristics of hierarchical blocks
Hierarchical blocks are unique; they have some characteristics of a block and some characteristics
of a model worksheet. All hierarchical blocks have the following in common:
A hierarchical block can contain no blocks, one block, a group of blocks, and other hierarchical
blocks. It can also contain text, graphics, cloned dialog items, and pictures.
How To
The submodel window. This is what is displayed if you double-click a hierarchical block. Use this
window to add blocks to the submodel, adjust block and connection line positioning, rename
connection text boxes, or add text and graphics to the submodel.
600
Presentation
Hierarchy
Hierarchical blocks can be copied to other areas of the model or to other models and used just
like other blocks.
The settings within a hierarchical block can be changed by double-clicking the hierarchical
block, then double-clicking the desired blocks icon, or by changing the desired blocks cloned
dialog items.
Hierarchical submodel windows are similar to model windows: add blocks from a library, create
hierarchical blocks, add graphics, type labels and other text, clone dialog items onto them, and
so forth.
The components of a hierarchical block (icon, connectors, or Help text) can be changed by
accessing the hierarchical blocks structure window.
Unlike other blocks, by default hierarchical blocks are saved directly in the model as copies. This
characteristic allows them to be treated much like a copy of a portion of the model. You can
copy a hierarchical block to another part of your model and make changes to its submodel window without affecting the original hierarchical block. This is known as physical hierarchy.
You can choose to save a hierarchical block in a library, in which case it can be treated much like
a regular block. When you make changes to the hierarchical blocks structure window and you
also choose to update all instances of that block, it is known as pure hierarchy.
Important notes about hierarchical blocks
The action of creating a hierarchical block cannot be undone. If you accidentally include more
blocks than intended in the hierarchical block, remove them from the blocks submodel and put
them back into the model using the Cut and Paste commands in the Edit menu.
Named connections (discussed on page 618) only connect within one level in a hierarchical model.
How To
This means that the data will not flow between levels if you have a named connection on one level
and a corresponding named connection in a block at a lower or higher level. To connect between
hierarchical levels, use the Throw and Catch blocks in the Value, Item, or Rate libraries, or add
connectors to hierarchical blocks. To see how Throw and Catch blocks are used with hierarchy, see
Throw Item and Catch Item blocks for merging item streams on page 152. For more information on adding connectors to hierarchical blocks, see Step 4: Add connectors on page 603.
By default a hierarchical block is saved only in the model. To save it in a library, use the Save Block
As command, described later in this topic.
Although the blocks within hierarchical blocks (see Hierarchy on page 598) are automatically
updated if they are changed in a library, because hierarchical blocks themselves are submodels and
contain both blocks and data, hierarchical blocks saved in a library will not automatically update
their corresponding hierarchical blocks in a model as that might change the existing data in the
model.
Because they can contain entire submodels, hierarchical blocks can become quite large. Libraries
have a 15MB limit, so you may need to use more than one library to store all the hierarchical
blocks for a model.
Presentation
Hierarchy
601
How To
5) Connect the new hierarchical block to the other blocks in the model.
602
Presentation
Hierarchy
ExtendSim prompts for a name for the hierarchical block, then opens its structure window.
Icon pane
Connector pane
Help pane
Submodel pane
How To
The hierarchical structure window is divided into four panes, which are work areas. The upper left
pane is the icon pane for designing the blocks icon and adding connectors. The upper right pane is
the Help pane for writing the Help text for this block. The lower left pane is the connector pane
which contains the names of the input and output connectors for the block; it can also be used to
rename the connectors. The large pane on the lower right is the submodel pane, where the submodel for this hierarchical block will be built. The submodel pane is what appears when you double-click a hierarchical blocks icon.
Presentation
Hierarchy
603
How To
4) Connect the blocks in the submodel pane to the connectors text label.
604
Presentation
Hierarchy
The connector type must match the input or output connectors of the block in the submodel pane.
Click in the icon pane at the desired position near the edge of the hierarchical blocks icon. For
this example, click on the right side of the icon.
This creates the default Con1In connector on
the icon in the icon pane, lists it in the connector pane, and adds a red-bordered connector
text label (similar to a named connection) in
the submodel pane.
Select the connector name in the connector pane (or double-click its text label in the submodel
pane) and change its name to WaterOut, then hit Enter.
How To
blocks in the Drug Ingestion model are examples Connector changed to output connector and added
to Math block
of hierarchical blocks with connectors. The
model is located at \Examples|Continuous\Standard Block Models and is discussed on page page 75.
Presentation
Hierarchy
605
If you later modify that hierarchical block on the model worksheet, the changes will not be
reflected in the master block in the library unless you specifically tell ExtendSim to save those
changes.
To save a hierarchical block in a library or to cause changes made to a hierarchical block to be
reflected in its master block in a library:
How To
606
Presentation
Hierarchy
Also save to library affects this instance of the block, the master block in the library, and
blocks placed from the library into the active model after the save.
Also update blocks in open models also saves the changes to instances of this hierarchical
block in any open models.
Discard changes
Cancel
How To
These options are also discussed in Summary of results of modifying hierarchical blocks on
page 608.
A hierarchical block that is saved in a library has its
name listed in the library preceded by the symbol >.
Like other blocks, hierarchical blocks that are saved in
libraries list the name of the library in their title bar. If
no library is listed, the hierarchical block is not saved in
a library. You can also get library information by selecting the block in the model window and choosing the
command File > Properties.
If you dont want to save the changes to the master block in the library, simply double-click the
hierarchical blocks icon and change the settings for individual blocks or modify the layout and
appearance of the submodel (e.g. add blocks, clone items onto the submodel window, add text
and drawings, etc.).
Presentation
Hierarchy
607
To save the changes to the master hierarchical block in a library, you must open the hierarchical
structure window. (You must also use the structure window to make any changes to the hierarchical blocks icon, connectors, or Help, even if you dont want to save these changes to the
library.)
The following indicates where to make changes to a hierarchical block:
Submodel
Window
Structure
Window
Add Help
Add animation
How To
Optionally add alternate views using the Views menu at the top of the icon pane. An example of
608
Presentation
Hierarchy
Adding animation
Hierarchical block icons can be animated, as discussed on page 612.
Summary of results of modifying hierarchical blocks
There are different results when a hierarchical block is modified, depending on whether its submodel window or structure window was modified and whether the block is saved just in a model
or is also saved in a library:
If you modify a hierarchical blocks submodel in the submodel pane window, those changes only
apply to that block. Changing a hierarchical blocks submodel is similar to changing parameters
in a regular blocks dialog: the changes affect only that instance of the block on the worksheet
and are saved with the model. This is true even for hierarchical blocks that were originally saved
in libraries.
If you modify the structure of a hierarchical block that is not saved in a library, those changes
only apply to that block. This has the same result as modifying a hierarchical blocks submodel
pane window. For example, you can make several copies of that hierarchical block in a model,
but when you change one of the copies, the other blocks remain unchanged.
If you modify the structure of a hierarchical block
that has been saved in a library, you can choose
how those changes should be reflected:
Only to this instance of the block on the
model worksheet (choose Save to this block
only).
Also in the master block in the library,
which only affects blocks placed in the
model from the library after the change has
been made (choose Also save to library).
How To
Changing a hierarchical block that is saved in a library can have unintended consequences if the
block is used in multiple places. Do not make changes to the master block in the library unless you
understand the effect those changes could have on other models that use that block.
To modify the structure of a hierarchical block saved in a library, copy a fresh hierarchical
block from its library window onto the model worksheet, then work on the block directly
in the model. Do not work on a hierarchical block that is already in the model or you
might overwrite the master hierarchical block with a block that has been customized for a
specific purpose in the model.
If you change the hierarchical blocks submodel, rename the block and save it to the library
using the new name. This will prevent existing instances of that hierarchical block from
being changed.
Presentation
Animation
609
Use caution if you change a parameter in a block in a submodel, then save the hierarchical
block to the library with the Also update blocks in open models choice. In that
case, each instance of the hierarchical block will have the changed parameter value.
Changes made to the structure of a hierarchical block that is saved in a library will not be reflected
in models that were not open when the change was made. In that case, open the model and replace
its hierarchical block with a new one from the library.
The Constant block (Value library) has an option to Retain constant if updated from hierarchy. If that option is checked, the Constant will retain its value when the enclosing hierarchical
block is updated from a library and existing instantiations of the block will not be changed inside
of existing hierarchical blocks. This is useful if each hierarchical block needs a unique identifier
which does not reset if the hierarchical block is updated from a library.
Animation
When presenting models to others you can show how plotter values or cloned outputs change as
the simulation progresses. However, ExtendSims animation capabilities give a more visually
descriptive representation of what is happening in the model.
This section of the User Guide discusses ExtendSims 2D animation capabilities. The ExtendSim
Suite product allows simulations to be run with 3D animation see the E3D module of this manual for more information.
Models can be animated using:
Blocks that have built-in animation
To animate a blocks icon
To animate items traveling in discrete event models
Specialized blocks for creating customized animation
Animation functions programmed into blocks you create
To see animation in a model:
Use the Animation Faster (rabbit) and Animation Slower (turtle) buttons to
change the speed of the animation.
If animation is running at its slowest speed, the Animation Slower button will
be grayed out. Likewise, if the animation is already running at the highest
speed, the Animation Faster button will not be available.
Animation buttons
Left: Faster
Right: Slower
How To
Due to redrawing, animation tends to slow the simulation. You may want to leave animation on
while you are testing, debugging, or presenting your model and then turn it off when you are running the model for quicker results.
610
Presentation
Animation
Select the command Run > Add Named Connection Animation when Show 2D Animation is
How To
checked.
Selecting an animation picture
When Show 2D Animation is enabled in a discrete event model, pictures representing individual
items pass from block to block. Initially, all items are represented by the default animation picture
(a green circle). You can cause a block to use any other animation picture included with ExtendSim, existing clip art, or pictures created in an external drawing package. The selection is made in
each blocks Item Animation tab.
To find out how to add your own animation pictures, see Animation pictures on page 614
Presentation
Animation
611
Change item animation using property. With this choice, the items animation will change
depending on its property (attribute, quantity, or priority). For this option to work, the items
attribute, quantity, or priority must have been set in a preceding block. Then in this block you
create a lookup table with properties corresponding to the desired animation pictures.
To change the animation based on an attribute value:
How To
Enter values in the Property Value column, then use the 2D popup menu to
select which picture will animate the
item when its attribute has that value.
For information about creating attributes, see Item attributes on page 119.
As discussed on page 612, the Animate Item block (Animation 2D-3D library) is also useful for
changing the animation picture of items that pass through it.
612
Presentation
Animation
If you choose to animate with a level, it can be displayed in a specific color and pattern that will
move between the top and bottom of the blocks icon. Be sure to specify maximum and minimum
values that represent the entire range of possibilities.
To flash animation when the input is greater than or equal to a value, select a box, text, picture, or
circle. The box and circle can have a color and pattern. Text must only be a few characters long so
that it fits within the blocks icon. To show an animation picture, select its name from the popup
menu.
How To
To play a movie in Mac OS, the movie must be stored in the Extensions folder and must be a
QuickTime movie.
Animate Item block
The Animate Item block can only be connected to the item connectors of discrete event blocks.
Depending on choices in the Block tab, when an item enters the block a colored box, piece of text,
a selected picture, or a selected movie (Mac OS only) is shown on the blocks icon. The Item tab is
useful for changing the animation picture of the item traveling through the block.
Animating a hierarchical blocks icon
As shown below, the steps to animate a hierarchical block are:
1) Create an animation object on the hierarchical blocks icon.
2) Include the Animate Item or Animate Value block (Animation 2D-3D library) in the submodel.
3) Select options in the Animate Item or Animate Value blocks dialog.
The animation block in the submodel reads the values from other submodel blocks and, using the
animation object, controls the hierarchical blocks animation based on those values.
Presentation
Animation
613
How To
614
Presentation
Animation
Enter the number of the animation object that the block is to control in the Animation object
number of enclosing H-block
field. For example, to animate
object number 1, enter 1 in the
field.
If you create custom blocks, including hierarchical blocks, use this same process to add animation objects to those blocks.
For an example of an animated hierarchical block, see the Markov Chain Weather model on
page 50 or the Animating Queue Contents model on page 146 (that model is not available with
ExtendSim CP.)
Animation functions
If you build your own blocks, ExtendSim offers a suite of functions to design how the block will
animate. For example, the Planet Dance model (located in the folder \Examples\Continuous\Custom Block Models) shows three planets orbiting in space. Their orbits are determined by numbers
entered in the blocks dialogs. See the Developer Reference for a description of the animation functions. Also, see Animating a hierarchical blocks icon on page 612 for an example of how to add
animation to a block. You use that same process to add animation to any blocks you create.
How To
Animation pictures
ExtendSim includes a large number of animation pictures as bitmaps (Windows) or PICT
resources (Mac OS). These pictures are used by discrete event blocks to show the flow of items, by
the Animate Value and Animate Item blocks (Animation 2D-3D library) to show custom pictures,
and in any custom block that calls the appropriate animation functions.
To add your own animation pictures to the available list, they must be of the correct file format
and they must be stored in the ExtendSim9/Extensions/Pictures folder. After placing the animation pictures in the Pictures folder, restart ExtendSim and the pictures will be available in animation picture popup menus. For information about these and other extensions, see the Developer
Reference.
Picture file formats
ExtendSim running on a Windows operating system accepts three kinds of pictures:
.WMF (Windows MetaFiles)
BMP (Bitmap)
Presentation
ExtendSim databases
615
A Mac OS PICT (picture) resource file that has been converted to Windows format using the
ExtendSim Mac/Win converter.
ExtendSim for the Mac OS accepts only picture resources.
ExtendSim databases
Databases are very useful when presenting models to others because a models inputs and outputs
can be stored in a centralized location and data can be organized in a logical manner. Each model
can have one or more ExtendSim databases for storing, managing, and reporting information. For
more information, see ExtendSim databases for internal data storage on page 726.
Connections
Connections are the main method blocks use to send data, items, or flow between each other.
ExtendSim has two types of connections, line connections and named connections. The following
discussion shows how to format connection lines and discusses the use of named connections. To
learn how to make and delete connections between blocks, refer to Connecting blocks on
page 27 and Smart connections on page 618.
The Value, Item, and Rate libraries each contain Throw and Catch blocks for sending data without
using connections. Use these blocks in situations where you cannot use a line or named connection, such as when you need to send data between hierarchical levels. For instance, see the example
at Throw Item and Catch Item blocks for merging item streams on page 152.
Connection lines
ExtendSim provides several formatting options to alter the appearance of connection lines. Some
default line options can be specified in the Edit > Options > Model tab. To change an existing line,
double-click to select it, then choose a connection line option.
Choose Model > Connection Lines to see the menu of options available.
How To
616
Presentation
Connections
To use the command, choose an option from the menu and draw a new connection.
right angle
straight
right arrow
left arrow
solid
dashed
black
colored
default line types
thin
medium
thick
hollow
Connection line choices
Styles
The first set of choices in the menu lets you specify the style of the connection lines, either right
angle or straight line.
Arrows
The second set of choices specifies whether or not you want arrows on your right-angle connections (arrows can only be used with right-angle connections). The direction of the top arrow head
follows the direction you draw the line when you make the connection; the bottom arrow head follows the opposite direction.
How To
Attributes
The third choice gives the ability to make the line solid or dashed. (Dashed lines are only available
for right-angle connections.)
Colors
The fourth set of choices in the Connection Lines command deals with the color of connection
lines. Like text or drawing objects, connection lines can be any color you choose. There is no limit
to the number of different colors you can use for connection lines in a single model. Selecting
Black Connections in the Connection Lines command causes all new connection lines to be drawn
black regardless of the current color selected in the color palette. Choosing Color Connections will
cause all new connections to be drawn using the color currently selected in the color palette.
To change the color of an existing connection line, select the line and click a color in the
color palette window. See Patterns and colors on page 620 for more information about
working with colors.
Line types
If you dont select the View Using Defaults option, the final connection line section lets you specify the type of line used for connections, such as thin, medium, or hollow. The View Using
Presentation
Connections
617
Defaults option will cause a connection line to be displayed using its default line type, based on the
type of connector. The default connection line types are:
Type of connector
Line type
Value
Item
Flow
For instance, most discrete event models track flows of items as well as calculate and show values.
You can visually differentiate the flow of items from the processing of values by using the default
line types. When looking at such a model, it is much clearer which flows are those of items and
which are of values. For example, the beginning Car Wash model shown on page 103 uses the
default types to specify item and value connection lines.
To specify the default connection type, choose the Model > Connection Lines > View Using
Defaults command. You can also choose whether or not to use the default connection types in the
Options dialog. When you use this command, the thickness or hollow line types are ignored. You
can leave the View Using Defaults command on while you build a model, or only turn it on when
you are viewing the model. Note that this is only a view option, not a true line type; if you turn the
option off, the line will be thick or hollow depending on the selection in this section.
How to change line formats
By double-clicking on a connection line segment you can select all
segments between two blocks. This makes it easier to change the
entire connection (e.g. line width, color, etc.) at the same time. Any
other line segments that may be connected to additional blocks will
not be selected.
This works with both regular connection lines and named connections.
How To
To select all the connection line segments that connect from a single
output, double-click on a line segment while holding down the Alt
(Windows) or Option (Mac OS) key. Alternately, you can click on one
segment of the connection, then choose the Edit > Select All Segments
command.
Clicking anywhere else on the model worksheet with deselect all the
selected line segments.
618
Presentation
Connections
Named connections
Named connections are text labels
that are used to represent one output at many locations in your
model. If you have two text labels
with the exact same text, you can
use these to have the data, items,
or flow jump from one part of the
model to another. Named connections are often used when you do
not want to clutter up your model
with many lines. You can place the
names near the blocks to which
they connect and leave much of
the area of your model free from
connection lines.
sensitive and spaces and returns are ignored, but you must use identical spelling in the text names.
By using named connections, you can eliminate a lot of connection lines in your model, making it
easier to see which blocks are connected to each other and preventing lines from crossing over
blocks or other model elements.
To learn how to create named connections, refer to Named connection on page 34.
How To
Named connections only connect within one level in a hierarchical model. This means that the
data will not flow between levels if you have a named connection on one level and a corresponding
named connection in a block at a lower or higher level. To connect between hierarchical levels, use
the Throw and Catch blocks in the Value, Item, or Rate libraries, or add connectors to hierarchical
blocks. For more information about using Throw and Catch blocks with hierarchy, see Throw
Item and Catch Item blocks for merging item streams on page 152. For more information on
adding connectors to hierarchical blocks, see Step 4: Add connectors on page 603.
Show Named Connections command
If you use many named connections in a model, you may accidentally connect a block to the
wrong named connection. The Model > Show Named Connections command draws a connection
line directly between all named connections. This helps you check that you made the connections
that you wanted.
With the Show Named Connections command selected, click on a connection line to highlight
the path between the named connections. If you click on one of the connection lines and then use
the Edit > Select All Segments command, all the connections for that particular named connection
will be highlighted.
Smart connections
The tutorial on page 27 showed how to connect blocks by drawing a connection line between one
blocks output connector and another blocks input. There are some faster methods you can also
use for blocks in the Item and Rate libraries:
When adding an Item or Rate library block to a model that already contains at least one other
block from the same library, bump the new block into the existing block as you drag it from the
Presentation
Model appearance
619
library. The two blocks will automatically and correctly connect to each other using whichever
connection line choices youve made.
To insert a new Item or Rate library block between two connected blocks from the same library,
drag the block from the library and drop the block onto the connection line such that the new
blocks input connector is on top of the line. This will both insert and connect the new block
between the two existing blocks.
Model appearance
Commands in the Model menu can change how model elements appear.
Reservoir model with hidden connection lines (L) and hidden connectors (R)
These commands work at each level of hierarchy separately and take effect in whichever level is the
active window. Thus if you want only the top level of the model to not show connectors, but the
hierarchical levels to show connectors, choose the command when no hierarchical levels are open.
How To
ExtendSim provides the capability for block icons to have alternate model styles that affect their
appearance in a model. This implementation depends on the block developer, so many libraries
have only one style - the default Classic style. If a library has multiple styles, use the Model >
Change Model Style command to choose a new style. If the library does not have multiple styles,
giving the command will have no effect on block appearance. Block developers can create libraries
with up to 8 model styles, as discussed in the Developer Reference.
620
Presentation
Patterns and colors
To resize or reshape an object, click the shape then click the small rectangle in
the bottom right and drag to create the desired shape. If you hold down the Shift
key as you reshape a rectangle, rounded rectangle, or oval, the shape will become a square or a circle. If you resize a square or circle while holding down the Shift key, it will maintain its proportional measurements.
Shuffling graphics
By default, new objects are created in front of existing ones. The Shuffle Graphics tool lets
you arrange drawing objects (not text) that are on top of each other. Click this tool, then
click on the object. If the object is in front, it will be sent behind. If it is not in front, it
will be brought to the front. Blocks, text, and cloned dialog items are always in front of
any drawing item and therefore cannot be shuffled.
You can also right-click an object with the Draw layer or All layers tool and choose Bring To Front
or Send To Back to change the order of the objects.
Modifying objects
When an object is selected, the Model menu has additional commands available:
Align left, right, top, or bottom (2 or more objects must be selected)
Rotate shape
Flip horizontally/vertically
Border thickness
How To
Shape Fill/Border (Depending on the selection in this commands hierarchical menu, the
selected color fills the shape or colors the shapes border.)
Click the Color and Pattern toolbar buttons to open their respective palette windows.
Change the color of a piece of text or the fill color of a drawing object by selecting the
drawing object on the model worksheet or the text in the text box and choosing a color
from the palette. To change the color of the drawing objects border, select the command
Model > Shape Fill/Border > Border Color before choosing the color from the palette. If you
change the color palette before you create the drawing object or start a text box, all new drawing
objects and text will be in that color.
Presentation
Working with pictures
621
When you select a color the hue, saturation, and value (brightness), or HSV, settings for the color
are listed at the bottom of the color palette window. This is helpful when you need to assign a
color using its HSV definition (in block code for example, as discussed in the Developer Reference.)
In the pattern palette, black gives a solid pattern, white gives an opaque white pattern, and
the N signifies no pattern, meaning transparent. Change a drawing objects pattern by
selecting the object and choosing a pattern from the palette. If you change the pattern palette before you create the drawing object, all new drawing objects will be in that pattern.
It doesnt matter what the original file format for the graphic was (JPEG, TIFF, GIF, etc.) Once it
has been copied into the Clipboard, ExtendSim treats it as a drawing object.
The screenshots that start on page 8 illustrate a use of pictures in ExtendSim models.
How To
How To
622
Presentation
Working with pictures
How To
Analysis
Making sense of your models
624
Analysis
Blocks that calculate statistics
Although simulation is a quantified subject, there is still room for analysis and judgmental procedures. This is especially true when your purpose in building a model is to spot trends or identify
patterns of behavior, or when you must make an immediate go, no-go decision. How statistically
precise your models should be depends on several factors, including the nature of the problem, the
importance of the decision, the level of risk you are willing to accept, and the sensitivity of the system to the input data.
One of the main benefits of ExtendSim is that it provides several methods for analyzing the results
of simulation runs. This chapter covers those techniques, including:
Blocks for statistically analyzing data
Confidence intervals for predicting the true mean value
Sensitivity analysis to investigate the impact of making changes
Optimization to determine the best values for a set of parameters
Using Stat::Fit to determine the appropriate distribution for a set of data
How to change parameters dynamically
Plotters for displaying results
Reporting model details and results
Remember that when you use statistical methods to analyze simulation output, you are performing
the analysis only on model results, not on the actual system. It is important to ensure that the
numbers entered accurately represent the details of the actual system. The significance and relevance of your analysis will depend on how closely the models inputs correspond with real-world
data (garbage in = garbage out).
How To
As described below, other ExtendSim blocks are specially designed to report statistical information
for particular types of blocks or for items that pass through the block, or to refine statistical data
collection.
Statistics
The Statistics block (Value library) accumulates data and calculates statistics using a
specified statistical method. Place a Statistics block anywhere in the model and,
depending on selections made in its dialog, it will report statistics for the following
blocks and types of blocks:
Activities (Activity, Convey Item, and Transport blocks in the Item library)
Mean & Variance block (Value library)
Queues (Queue, Queue Equation, and Queue Matching blocks in the Item library)
Resource Item block (Item library)
Resource Pool block (Item library)
Mixed blocks (clone drop)
Analysis
Blocks that calculate statistics
625
Accumulating data
When a simulation is run, one row of information is recorded in the blocks table for each block of
the specified type each time an observation is made. Observations can be recorded continuously,
which significantly slows simulation time, or at the end of the simulation. They are also made in
response to an item or value arriving at the Go universal input connector. For instance, attach a
Pulse block (Value library) to the Go connector to force a periodic or scheduled update of statistical information.
The first column of the table in the Statistics blocks dialog lists the blocks label. For a block without a label, the first column gives the blocks name.
To immediately see the current statistics, click the Update Now button; this is also useful if you
want to see which blocks will have their statistical information collected during the simulation run.
Statistical methods
The Statistics blocks Options tab allows you to select one of three statistical methods:
Multirun analysis
Batch means
Choosing one of the first two methods causes specific settings to be selected in the blocks Options
tab. For the custom option, manually select which settings you want.
How To
Custom
626
Analysis
Blocks that calculate statistics
Clear Statistics
As discussed in Non-terminating systems on page 588, when you start a simulation run there is no data in the model. After the model has been running for a while,
it gets to the point where it is functioning more like the real system. The interval
from when the model starts to when it is functioning in a steady or normal state is
called the warm-up period.
The Clear Statistics block (Value library) clears the statistics for selected blocks, eliminating the
statistical bias of a warm-up period. The type of blocks include:
Activities (Activity, Convey Item, Transport, Workstation)
Exit block
Mean & Variance block
Queues (Queue, Queue Equation, Queue Matching)
Resources (Resource Item, Resource Pool)
Information block
How To
Analysis
Confidence intervals
627
Information
The Information block (Item library) reports statistics about the items that pass
through it. It is useful for counting the number of items and for determining cycle
time statistics and the time between item arrivals (TBI). The block reports the average and the current statistics, as well as the minimum and maximum.
Cost Stats
The Cost Stats block (Item library) records in a table the input costs and total cost
generated by each costing block in a model. This block reports cost information for
item-based blocks, such as for a discrete event model. Information can be exported
to a spreadsheet. The block can be placed anywhere in the model.
Confidence intervals
Confidence interval estimation tells you, with a given level of probability or confidence, how close
the average simulation results are to the models true average or mean. The confidence interval is
the range within which it is predicted the true mean is located. This is expressed as the probability
that the true mean lies within interval x y, where x is the average obtained by multiple observations and y defines the outer limits of the intervals range. The confidence level is the probability
How To
The Information block can only be used in models that use item-based blocks, and it must be connected to a blocks item output. This block is used to calculate cycle time in the section Cycle timing on page 298.
628
Analysis
Sensitivity analysis
that the true mean will be located within the range. Typical confidence levels are 90%, 95%, and
99%. Notice that, at higher levels of probability, the interval gets wider.
The Statistics and Mean & Variance blocks (Value library) and the Cost Stats block (Item library)
provide the option to specify a confidence level in their dialogs. For example, the Statistics block
not only summarizes and reports statistical information, but also calculates confidence intervals for
the information given various levels of confidence.
To generate a confidence interval where each sample is the result from a single simulation run, in
the Run > Simulation Setup > Random Numbers tab do one of the following:
Randomize the seed by entering a blank or zero random seed.
Or, select Continue random number sequence in the popup.
Or, select Use Database table __Seed for values in the popup.
To obtain sufficient sample data to determine the confidence interval, multiple observations of
each statistic must be made and appended to the table of data. This is shown in the Run for CI
model located in the \Examples\Tips\Modeling Tips folder. The model runs repeatedly based on
the Mean & Variances Options tab settings Calculate for multiple simulations and Replicate until relative error is <= 0.01.
Sensitivity analysis
Sensitivity analysis allows you to conduct controlled experiments to explore how much of an
impact a particular parameter has on model results. ExtendSims sensitivity analysis features make
it easy and convenient to specify a parameter to investigate and settings to use for the analysis.
Overview
How To
You use sensitivity analysis to investigate the effect of changing one or more parameters upon an
area of interest. Sensitivity analysis works with all numeric parameter fields. It also works with
clones of those numeric items. You can add sensitivity to as many dialog values as you like. However, it is recommended that you only vary one or two dialog values at a time so as not to confuse
the analysis. Once a parameter has been sensitized, specify a multiple number of runs and run the
simulation.
The resulting values for the area of interest are usually plotted. Although you can use any of the
standard plotters from the Plotter library (such as the Plotter I/O or the Plotter Discrete Event), it
is more common to use a MultiSim plotter (to show up to four runs at a time in one plot window)
or an Error Bars plotter (to show the mean and standard deviation of the parameters over the
count of runs). The results of varying the parameter value over the selected settings will be displayed as the simulation is run multiple times.
Parameters are sensitized by right-clicking or by using the Edit > Sensitize Parameter command.
The Edit > Open Sensitized Blocks command shows all the dialogs for blocks that have sensitivity
settings, even if sensitivity analysis is not enabled. This is convenient if you have entered sensitivity
settings for many parameters in a large model.
To utilize sensitized parameters, the number of simulation runs must be greater than one.
Steps for using sensitivity analysis
For this example, use the Reservoir 1 model discussed in the Tutorial module.
Analysis
Sensitivity analysis
629
The number of runs can be set in either the Sensitivity Setup dialog or the Simulation Setup dialog.
Each controls the other so that the last value
selected in either of them controls the number of
runs.
a file, a specified range of values, a random distribution, or values from a database.The choices are
described in Specifying the sensitivity method on
page 630.
Sensitized parameter
Ensure that the Run > Use Sensitivity Analysis command is checked (it is checked by default).
Run the simulation. ExtendSim runs the simulation four times, from run 0 to run 3.
How To
630
Analysis
Sensitivity analysis
Description
Assigns the values from a text file. This is the option you will most likely use when
performing ad-hoc experiments. If the file has more than one column separated by
tab characters, specify the desired column. Starting with the first row of the specified column for the first run, this option uses the value of each successive row in
that column for subsequent runs.
Starting at...
Specifies the starting value and the amount of change. By default, the starting value
is the same as the parameters value in the dialog. Increase the variable with a positive number or decrease it with a negative number.
change by...
How To
Random distribution
Uses a random distribution to set the parameter. This is an easy way to make a single value in a model change randomly over many simulation runs while keeping the
value constant within a single run. Choose from one of the five types of distribution and enter the distribution parameters in the options to the right of the distribution. The seed is the number to use for the random number generator. As in the
Simulation Setup dialog, BLANK or 0 for the seed is random.
Database field
Assigns values from the fields in an ExtendSim database. Starting with the first
record of the specified field for the first run, this option uses the value of each successive record for subsequent runs.
If you are a developer, you can use the CurrentSense variable to control the order of use for the values set for specific runs from within a block. For example, you can cause the first simulation run to
use row 4 of a file, rather than the default use of row 1.
Analysis
Sensitivity analysis
631
sensitivity is temporarily disabled so that you dont have to re-enter the number for subsequent
analysis.
To remove sensitivity settings from a parameter (as compared to simply temporarily disabling the
settings by turning off the parameters Enable sensitivity box), open the Sensitivity Setup dialog
using any of the methods discussed on page 629, then click Delete.
Editing a sensitized parameter in a blocks dialog disables the sensitivity settings for that block.
When this happens, ExtendSim automatically unchecks the Enable sensitivity choice. ExtendSim assumes that if the value is edited, you want to use that new value, not the one that was
entered in the Sensitivity Setup dialog. If you want to turn off sensitivity analysis for a parameter
for the foreseeable future, open that items Sensitivity Setup dialog and click the Delete button.
This will help prevent accidentally changing the value in a future run of the simulation.
A parameter that has sensitivity settings has a frame inside of it. If sensitivity analysis is active for
the parameter (that is, if the Enable sensitivity choice is checked), the frame is green. If the sensitivity analysis is inactive for the parameter or if it is turned off for the model as a whole, the frame
is red.
The Edit > Open Sensitized Blocks command shows the dialogs of all blocks with sensitized
parameters, regardless of whether or not sensitivity is enabled.
Multi-dimensional scenarios
Sensitivity can be enabled on more than one item at a time. For instance, you may want to vary the
values of two Constant blocks and see the interaction between the two items. If you set the sensitivity for the parameters with the Starting at option, both values will increment at the same rate.
For instance, if you have one parameter start at 5 and increment by 1, and the second parameter
start at 100 and increment by 50, and the simulation is run seven times the value pairings will be:
Variable 1
Variable 2
100
150
200
250
300
10
350
11
400
How To
Run #
632
Analysis
Scenario analysis
Often, however, you want to look at all the possible pairings of the two (or more) variables. In this
example, you would want to run the model 36 times, with the following pairings:
Run #
Variable 1
Variable 2
100
150
200
250
...
...
...
100
150
...
...
...
35
11
400
In order to perform this kind of multi-dimensional analysis, you need to get the values from a file.
The most convenient way to do this is to create a file that has two columns separated by a tab character with all the desired pairings. For instance, the file for this example would start with:
5 100
5 150
5 200
...
How To
In the Sensitivity Setup dialogs for the two parameters, choose Read from file and enter the file
name. For the first variable, enter 1 for the column number; for the second variable, enter 2 for the
column number.
When you run a multi-dimensional analysis, you usually use a Write block (Value library) to write
out the values to examine. In the Write block, select a data destination on the Send Data tab and
check Row (or record) index is equal to run number on the Options tab. If the data takes a long
time to transmit, you should check Only write to (data destination) at the end of the run on the
Send Data tab.
Scenario analysis
Scenario analysis is a method for systemically and strategically examining the outcome of different
model configurations. The purpose is to support the exploration and analysis of alternatives, gaining insight into why your system behaves the way it does and how it can be improved and managed. ExtendSim facilitates scenario analysis through the Scenario Manager block (Value library)
which can be added to any model to control all aspects of the analysis. The Scenario Manager
essentially keeps track of multiple what-if models, all based on the same model. It offers a highly
flexible framework for experimentation and analysis.
The Scenario Manager is an advanced tool that is only available in the ExtendSim AT and ExtendSim Suite packages.
Analysis
Scenario analysis
633
The ExtendSim Scenario Manager is a data storage and analysis system that supports analysts as
they input, view, manage, and analyze various scenarios. It allows them to use a single model to
explore and evaluate an unlimited number of options while providing precise control over model
changes as well as easy access to the results. And it provides automated methods for quickly changing variable information and for generating scenario reports. It does this by assigning a named scenario to each combination of variables you choose to examine. For example, you can create best-,
worst-, and typical-case assumptions for input values. Then recall each of these scenarios to see
how the model behaves under different conditions. You can also recall scenarios in combination,
such as best-case sales and worst-case costs.
The ExtendSim database is a central part of the Scenario Manager's data storage and organization.
A database named Scenario DB is automatically created when a Scenario Manager block is added
to the model. This database is used to store the inputs and results for the scenarios. The Scenario
Manager also facilitates using a design of experiments (DOE) methodology for more efficient performance.
The Scenario Manager is one of three ExtendSim analysis tools; see Comparison with other analysis methods on page 646 for differentiators. While the Scenario Manager will meet the needs of
most ExtendSim modelers, like most ExtendSim blocks it is open source. Thus a programmer can
modify and enhance it should the need arise.
Most analysts would only use dialog parameters in their scenarios, so this tutorial focuses on those.
For advanced analysis, you can also use databases, tables, and so forth, as discussed on page 640.
The following example uses the Final Car Wash model from the User Guides Discrete Event tutorial to investigate how changes in a number of factors affect the average wait time and throughput.
The table below shows the model factors and how they will be varied:
Factor
Values
Number of attendants
1, 2, 3
How To
It is best to set aside some time for all of the scenarios to run. Depending on the size and complex-
634
Analysis
Scenario analysis
Factor
Values
5, 6, 7
6, 7, 8
3, 3.5, 4, 4.5, 5
Each scenario will be run 5 times to capture the variation in the results between one run and the
next. To evaluate all of the possible combinations requires 675 replications (135 scenarios ((3 x 3 x
3 x 5 levels)) at 5 runs each).
Fortunately, this model runs very quickly so this number of replications is not a problem. However,
if the model took significantly longer to run or if there were more factors, a design of experiments
(DOE) should be used to reduce the number of scenarios.
Steps
The steps for performing scenario analysis are:
1) Add a Scenario Manager block (Value library, ExtendSim AT and ExtendSim Suite only) to a
model
2) Identify and add the factors (model inputs) you want included in the analysis
3) Identify and add the responses (model results) you want to analyze
4) Determine what you want in the report
5) Determine the DOE, then generate and run the scenarios
6) Analyze the results
7) Optional. Export the scenarios to Excel, JMP, Minitab, a text file, or an ExtendSim database
for further analysis
Add the Scenario Manager block
Open the model named Final Car Wash (\Examples\Tutorials\Discrete Event)
Save the model as Final Car Wash Scenarios so you dont overwrite the original model
Place a Scenario Manager block (Value library, ExtendSim AT and ExtendSim Suite only) in the
How To
model. The block can be placed anywhere but the top of the model will provide easiest access.
Since all the other blocks are labeled, label the block Scenario Manager
As shown at the bottom of the Database menu, adding a Scenario Manager block to a model automatically creates a database named Scenario DB. This is where the results of each individual scenario, as well as model factors, are stored. See Analyze results on page 639 for more information.
Analysis
Scenario analysis
635
Your model should now look similar to the following screen shot:
As seen above, the Scenario Manager has tabs for Factors, Responses, Scenarios, and Export. These
represent the steps in using the Scenario Manager.
Parameter
Factor Name
Values
Initial number
Attendants
1, 2, 3
Delay (D)
Wash Time
5, 6, 7
Delay (D)
Wash&Wax Time
6, 7, 8
Mean
3, 3.5, 4, 4.5, 5
How To
636
Analysis
Scenario analysis
Shift-click. Shift-click the target parameter in the target blocks dialog and select where it should
go.
Clone drop. Drag a clone of the target parameter from the target blocks dialog and drop it onto
the Scenario Managers icon.
Manual. Manually enter the dialog variable name into the factors table.
Attendants factor
This section uses Shift-click to associate the parameters with the Scenario Manager. The response
section that follows uses clone-drop.
In the Resource Pool dialog:
While holding down the Shift key, click the Initial number dialog variable.
In the popup menu that appears, select Scenario Manager: Add Factor
In the dialog
that appears (shown on the left), name the factor
Attendants and click OK
Notice that the Dialog Factors table now contains all the information about Attendants the
block it came from, the number it is currently set at, and so forth.
How To
Other factors
Repeat the steps used for the Attendants factor, above, to place the remaining three factors in
the Scenario Managers Dialog Factors table
The Dialog Factors table should now look like this:
Entering values
Now that the factors have been entered, it is time to enter their proposed values. There are two
methods for entering values:
Directly in the columns of the Scenarios table. To do this, enter a value for each factor and every
scenario in the Scenarios table of the Scenarios tab.
Analysis
Scenario analysis
637
Automatically using a DOE method. To use the Scenario Manager's DOE features, you need to
choose the minimum, maximum, and step (the increment between the minimum and maximum values) for each dialog variable factor.
Since this example uses the Full Factorial DOE method:
Minimum
Maximum
Step
Attendants
Wash Time
Wash&Wax Time
0.5
While you could use any of the 3 options from page 635, this section uses the clone drop method
to associate the parameters with the Scenario Manager.
Tab
Parameter
Response Name
Results
Length: Average
Average Length
Results
Wait: Average
Average Wait
Notice that the Dialog Responses table in the Scenario Managers Responses tab now contains all
the information about the Average Length variable.
Use either the Shift-click or the clone-drop method to add the Average Wait response to the
Scenario Manager
The Dialog Responses table in the Responses tab should look like the following:
How To
In the Queue blocks Results tab, click the dialog variable field for Length: Average
Right-click the variable field and select Clone Tool
While holding the cursor on the parameter field, drag the field to the Scenario Managers icon.
When the icon becomes selected, release the cursor
In the dialog that appears, select Response
Name the response Average Length
638
Analysis
Scenario analysis
How To
In the Run Control section, choose DOE method: Full factorial design
Click the Create Scenarios button
This generates all of the combinations of the factor values. There will be a total of 135 rows (3 x 3
x 3 x 5 levels) in the Scenarios table. By default all of the scenarios are selected; to not run a specific
scenario, uncheck its Select check box.
Since you want all of the scenarios to run, leave all of the Select check boxes selected
Enter Runs per scenario: 5
Click the Run Scenarios button.
This process may take some time as 675 replications are required to complete the scenario analysis!
Suggestions:
The scenarios will run a LOT faster if the command Run > Show 2D Animation is not selected.
Uncheck Play Sound at End of Run in the Edit > Options > Model tab before the run.
Analysis
Scenario analysis
639
When the scenarios have completed running, you should see the following in the Scenarios table:
Analyze results
The Scenario DB database, listed in the Database menu, automatically stores all the responses of
each scenario in a series of tables. The tables correspond to the rows of the Scenario Name column
in the Scenarios table. The All Scenarios table of the Scenario DB contains information about all
the model factors and responses. You can use the Scenario DB to perform analysis, or export
selected information to a different database, to Excel, or to JMP or Minitab, as discussed on
page 639.
Some additional things to notice for your analysis are:
Uncheck Include in Report in the Responses tab to not include a responses in the Report
Each response will have the type of report indicated in the Report Set column of the Responses
tab. The default is to display the mean value for each response variable but you can also display
the confidence interval, standard deviation, and so forth.
Changing a Report Set after the scenarios have been run causes the Scenario Manager to recalculate
the results with the new set. This is useful if you change your mind about the report you want.
Depending on what has been selected as the Response tabs Report Set, each response will have
one or more columns in the Scenarios table of the Scenarios tab. These columns summarize the
results of each set of replications for each scenario. The type of report, for example CI for confidence interval, is indicated in parentheses in the header of the column.
On the Scenarios tab, the Details column in the Scenarios table opens a database table containing the original data that was used to calculate all the statistics. The table is from the Scenario
DB database that was created when the Scenario Manager block was first placed in the model.
How To
By default all of the scenarios are selected in the Scenarios table; to not run a specific scenario,
uncheck its Select box
640
Analysis
Scenario analysis
Complete Statistics exports all of the available statistics for each scenario. This is every possible statistic allowed by the Report Set column of the Responses tab.
Select the destination for the report: an ExtendSim database, Excel, Minitab, or JMP.
So that you dont accidentally overwrite the data, it is suggested that you do not export to the Scenario DB database.
Set the destination parameters for the exported data. This varies based on the selected export
destination.
Using database variables is more complicated than using dialog parameters. However, it is very useful when you have sets of data, rather than single variables, that you want to swap in and out for
each scenario. For example, several production schedules for a manufacturing model.
To use the Scenario Manager with a database variable, you must create an ExtendSim database and
any necessary tables, fields, and records (this tutorial assumes you already know how to do that).
You also need to specify targets and sources, as discussed below.
How To
Analysis
Scenario analysis
641
Response targets are a collection of output database variables where each variables value is
defined by a particular response source. They contain all of the results for all of the scenarios.
Overview
The architectures of the targets and the sources must match. For example, if the source is a database table, the target must also be a database table with the same number of fields.
A minimum number of sources and targets must be created for the model:
For database factors, at least two sources and at least one target. (Each set of data is a source
so having one source does not make any sense when there are sets of data.)
For database responses, one source and a number of targets. The number of targets depends
on whether ExtendSim creates the source and targets or you do it manually. If Auto-Create
Target is selected in the Database Responses table, ExtendSim will create a new database
target for every simulation run. If manually, create one source and one target per scenario.
If you run the model for testing purposes without using the Scenario Manager, the identified
variables can be used in the model. However, these variables are just placeholders and their contents will change when you use the Scenario Manager.
Factor target. When testing the model, use the target database factor in your blocks. (Either
link a parameter or data table to the target variable or use a Read or Write block to reference the target variable.)
Response source. Similarly to the above, build the model as if you will be using a placeholder
database response variable. However, use the source rather than the target.
Sources are always copied to targets. When and how this happens depends on whether the database variable is a factor or a response.
Factor. At the start of each set of scenario replications, the Scenario Manager copies the
contents of the source database factor variable into the target database factor variable. This
is done automatically by the Scenario Manager.
Response. At the end of each simulation run the database variables used in the model are
copied from the source to the target database variables for that scenario.
The contents of the table, rather than the table itself, is copied. Thus the index of the target dataHow To
642
Analysis
Scenario analysis
Sourcesfor
Sourcesfor
Sourcesfor
DBFactors
DBFactors
DBFactors
DBvariablesusedbymodel
Targetfor
DB Factors
Targetsfor
Targetsfor
Targetsfor
DBResponses
DBResponses
DBResponses
Sourcefor
DBResponses
Database factors are copied from the sources to the target at the start of each scenario run. Database responses are copied from the source to the targets at the end of each run.
Steps for scenario analysis
The steps for performing scenario analysis using database variables are:
1) Open a model
2) Create the required database, tables, fields, and records for the model
3) Optional. If you plan to perform DOE, create an additional table for each database variable,
where each table has a list of the possible values for that variable.
4) Create links between the model and the database variables
5) Enter information in the Database Factors table
6) Enter information in the Database Responses table (this example does not do this step)
7) Generate and run the scenarios
8) Optional. Export the report.
The above steps assume database tables are used for factors and responses. You can also use fields or
How To
Instead of starting with your previous model, this tutorial uses a similar model that already has the
required database structure in it.
Open the Scenario Manager Final Car Wash model (\Examples\Tutorials\Discrete Event)
Like the model you built in the previous tutorial, the Scenario Manager block in this model has:
Four factors in its Dialog Factors table: Attendants, Wash Time, Wash&Wax Time, and Car
Interarrival Time
Two responses in its Dialog Responses table: average wait time and throughput
This tutorial will keep these dialog factors and responses but will add a fifth factor (the percentage
of cars wanting Wash or Wash/Wax) and put it in the Database Factors table.
Analysis
Scenario analysis
643
Because they would commonly be used, the Model Data database has two tables that werent
strictly required for the example: the Parent table (Wash Type) and the list of source tables (Preference Sources).
How To
644
Analysis
Scenario analysis
Factor
Target
Factor
Sources
ListofFactorSources
How To
Click the Link button in the Random Number blocks Preference/Probability table
In the Link dialog popup menu, select Link To: Database Table
Select the database named Model Data
Choose the table named Wash Preference, then click Link
Close the Random Number dialog
Enter database factors
You cannot Shift-click or clone drop a database variable. However, you can enter the information
manually. The Database Factors table also has popups for selecting the appropriate information.
Check the Database Factors check box to enable the Database Factors table
Use the +/- resize button to add one row to the table
Analysis
Scenario analysis
645
Target Name
Wash or Wash/Wax
Target Type
Table
Target Database
Model Data
Target Table
Wash Preference
Target Field
Target Record
Source Database
Model Data
Source Table
Preference Sources
Source Field
How To
646
Analysis
Scenario analysis
DOE methods
As introduced on page 638, the Scenarios tab of the Scenario Manager block allows you to choose
the DOE method. These are described more fully below.
DOE Method
Description
Manual
Full factorial
Create Scenarios creates one scenario for each combination of factor values.
Since every possible combination of factors is generated, this takes the longest
to run.
JMP custom
(Windows only)
JMP custom
create and run
(Windows only)
Create and Run Scenarios opens JMP, causes it to create a Custom or D-optimal
design, displays the factors and responses in both ExtendSim and JMP, then
immediately runs the scenarios.
Minitab optimal
(Windows only)
Minitab optimal
- create and run
(Windows only)
Create and Run Scenarios opens Minitab, causes it to create an Optimal or Doptimal design, displays the factors and responses in both ExtendSim and
Minitab, and then immediately runs the scenarios.
The JMP custom and Minitab optimal methods result in far fewer scenarios than full factorial.
Comparison with other analysis methods
How To
The Scenario Manager is just one of the ExtendSim analysis tools. As described in the table below,
each tool has a different purpose.
Technique
Sensitivity Analysis
Scenario Manager
Optimization
Purpose
Question
Analysis
Optimization
Technique
Sensitivity Analysis
Advantages
Easiest to specify
Scenario Manager
647
Optimization
Determines the optimum
model configuration
Constraints can be added
to filter out infeasible
model configurations
An objective function is
required
Refer to
Sensitivity analysis on
page 628.
Scenario analysis on
page 632.
Optimization on
page 647.
Optimization
ExtendSim facilitates optimization by making the optimization algorithm available within a block
that can be added to any model to control all aspects of the optimization. Furthermore, having a
block do the optimization increases flexibility and opens up the method and source code to users
who might want to modify or create their own customized optimization blocks. The Optimizer
block (Value library) uses an evolutionary algorithm to reduce the number of times the model has
to run before a solution is found.
How To
Optimization is a powerful feature that can automatically determine ideal values for parameters in
a model. It does this by running the model many times using different values for selected parameters, searching the solution space until it is satisfied that it has found an acceptable solution. It then
populates the model with the optimized parameter values.
648
Analysis
Optimization
ExtendSim tries to minimize or maximize to save you going through the tedious process of manually trying different values with each model run.
Like most optimization algorithms, the ExtendSim Optimizer solves models using an initial population of possible solutions. Each solution is explored by running the model several times using different values for some selected parameters, averaging the samples (for stochastic, random models),
and sorting the solutions. The best solution sets of parameters are then used to derive slightly different but possibly better solutions. Each new derived solution is called a generation. This process
continues for enough generations until the Optimizer determines that there are probably no better
solutions in sight. The Optimizer then terminates the simulation runs and populates the model
with the best solutions it has found.
The downside to optimization is that the model needs to run repeatedly and this can take a long
time with large models. Also, optimization algorithms have an inability to tell when the best solution has been found, or even if the best solution has been attempted. A good approach is to allow
the optimization to run for a sufficient number of cases and to then see if the population of solutions has converged. Then try the optimization procedure several additional times to make sure
that the answers agree (or are close) and that the first answer is not a false or sub-optimal one.
There are no optimization algorithms that are guaranteed to converge to the best answer in a finite
time. The more time that you can give optimization to run, the better chance that it will provide
the optimum answer.
How To
The following tutorial assumes that you know how to clone parameters (see Cloning on
page 562) and that you are comfortable deriving equations (if not, see Equation-based blocks on
page 677).
Optimization tutorial
The model for this tutorial represents a drink stand at a county fair; it has these assumptions:
Drinks are dispensed from beverage tanks that can range in size from 1000-8000 drinks. (In the
example model, 1000 is used for the initial tank size setting.)
A truck delivers the beverage tank at the start of the day and exchanges it periodically throughout the day. (The model is initially set to get a second tank after 240 minutes.)
Analysis
Optimization
649
The truck exchanges the beverage tank for a new one of the same size. There is a $1 per drink
beverage charge plus a delivery charge of $1,000 per tank.
So that the beverage company will know when to deliver tanks and what size tank you will use
for the day, arrangements regarding tank size and delivery frequency must be made at the beginning of the day.
People purchase drinks according to a random distribution; the cost per drink is $2.50.
If the beverage tank becomes empty, you lose an estimated $100 per minute in sales because customers already in line go to another stand and new customers are discouraged from getting in
line.
If you exchange the tank too often, you lose money because the beverage inside the old tank gets
taken away along with the tank.
This model ignores other expenses, such as labor.
The model runs for a simulation time period of 480 minutes (8 hours).
The goal of this tutorial is to optimize both how big of a tank you should order and how often the
tanks are exchanged. It is a simple continuous model, but a good example to show some of the
optimization techniques you will use in any type of large model.
For comparison purposes, the final model for this example, Optimize 2, is located in the \Examples\How To\Optimization folder.
Adding an Optimizer block
So that the example file isnt overwritten, give the command File > Save Model As and save the
model as MyOptimizer.
How To
650
Analysis
Optimization
You will be adding most variables to the Optimizer block by doing a clone-drop.
How To
Analysis
Optimization
651
decision variables) so the equation can reference them. In some cases the required variable will be
a dialog parameter and in others it will need to be calculated based on a dialog parameter.
An Optimizer blocks access to model variables is accomplished by either using the Clone Layer
tool to drag clones of the desired dialog variables onto the blocks icon (clone dropping), or shiftclicking the variable and selecting Add to Optimizer.
Either operation adds information about the variable to the Variables table. It also enables the
Optimizer block to remotely read and change the value of that variable in the model, so that it can
explore possible solutions.
Using the variables nomenclature from the form for the equation (MaxProfit = $2.50*#sold #deliveries*($1000 + #drinks*$1.00) - time empty * $100), the steps are:
# sold
The total number of sales for the day is an output variable calculated by the model; it is directly
available in a blocks dialog.
The Optimizer block will highlight when a cloned variable can be dropped onto it. Starting with
the first row, each cloned item is automatically placed into successive rows of the Variables table.
# deliveries
Unlike the other required variables for this example, the number of deliveries is not directly available as a dialog item. However, that value can be calculated using the frequency of deliveries, as
you will see on page 652.
To get the repeat delivery time, open the Lookup Table block labeled Filler truck.
From the Table tab, use the Clone Layer tool to drag the parameter value (but not its label or
checkbox) for the Repeat table every field onto the closed Optimizer block.
Clone the data table from the Lookup Table blocks Table tab and drag it to the closed Optimizer block.
How To
#drinks
The decision variable for the number of drinks per tank is also located in the Lookup Table block
labeled Filler truck.
652
Analysis
Optimization
Open the Optimizers dialog so that the Variables table in the Objectives tab is visible.
On the first row of the Variables table (Total sales) do not enter any limits. This value is not
an input to be changed but rather an output value from the Holding Tank. So that it will be
more easily understood in the equation, in the Equation Variable column change the variables
name from Var0 to numSold.
On the second row (Filler truck Repeat_prm), which is the time between deliveries, enter a
Minimum Limit of 30 minutes (an estimated minimum) and a Maximum Limit of 480 minutes (the simulation end time). Also, in the Equation Variable column change the variables
name from Var1 to deliveryTimes.
On the third row (Filler truck Data_tbl), you need to tell the Optimizer which cell of the data
table to use and what its limits are:
Click on the Filler truck cell to open the Lookup Table blocks dialog. Notice that the cell
that holds the number of drinks per tank is at row 0 and column 1 of the data table (data
table rows and columns start at 0). For the Row, Col value in the Optimizer, enter 0,1.
For this variables limits, enter a Minimum Limit of 1000 and a Maximum Limit of 8000
drinks.
Do not enter a decimal point. The absence of a decimal point tells the Optimizer that the value for
the number of drinks has to be an integer.
How To
On the fourth row (Tot empty time) do not enter any limits because this value is a model output. Change the variables name from Var3 to emptyTime.
The columns of the
Objectives table
should now look
similar to the table
on the right.
Entering the objective function
Now that the limits have been entered, substitute each variables name for the row that holds the
value of interest. The result is:
MaxProfit = 2.50*numSold emptyTime*100;
#deliveries*(1000.0+delTankSize*1.00) -
The only variable from this equation that has not yet been specified is the #deliveries factor, which
can be calculated using the deliveryTimes variable.
The form for an equation to convert the deliveryTimes variable to the #deliveries factor is:
#deliveries = int((endTime-1)/deliveryTimes + 1)
Analysis
Optimization
653
EndTime is a global variable representing the end time of the run, in this case 480 minutes. DeliveryTimes is how frequently the deliveries are repeated, or every 240 minutes. If you were to divide
the endTime value of 480 by the deliveryTimes value of 240, it would result in 2 deliveries a day,
which appears correct. However, if you instead divide by 250, you get only 1.92 deliveries, even
though you still have 2 deliveries, one at the beginning of the day and one at 250 minutes. There
will always be a delivery at the beginning of the day, so you need to add 1 to deliveryTimes and
truncate any fractional result with the int() function. This results in 2.92, which when truncated
gives 2, the correct answer.
If you had a delivery every 480 minutes, there would be 2 deliveries, but the last one would happen at the same time as the stand closes. To remedy this, reduce the endTime by 1, preventing the
480 minute case (the maximum limit) from causing 2 deliveries.
The entire objective function can now be entered in the Optimizer blocks Objectives tab:
Below that variable definition, enter the equation that converts deliveryTimes into numDeliveries:
numDeliveries = int((endTime-1)/deliveryTimes + 1);
The variable definition and the two equations are the objective function for the Optimizer.
How To
654
Analysis
Optimization
The finished Objectives tab for the Optimizer block looks like:
Select the Run Parameters tab. Since this model has random elements, click the Quicker
Defaults button in the Random model section. This quickly sets up all the parameters for a stochastic (random) model needing multiple samples, but limits the number of samples by default
so you can get results more quickly.
Run the optimization by clicking New Run in the Optimizers dialog, clicking the Run OptimiHow To
zation or Sceanrios tool on the toolbar, or by giving the command Run > Run Optimization or
Scenarios.
While the optimization run is progressing, notice how the MaxProfit value is increasing in the top
rows of the table in the Results tab. Notice also how the plotter shows the MaxProfit and convergence values increasing.
The optimization will complete faster if you close the Optimizer block. You can leave the Optimization Value plotter open to watch the values converge without slowing the run down.
Analysis
Optimization
655
When the run is finished, the Optimizer opens and displays the Results tab.
The best values for the selected parameters (drink size and delivery times) will have already been
placed into the model, the drink tank is never empty, and the profit will be maximized. The results
of the run as seen on the Objectives and Results tabs are:
NumSold (total sales) is blank because it has not been changed; it is an output from the model.
DeliveryTimes (Filler truck repeat prm) = around 250 minutes between deliveries (2 deliveries).
DelTankSize (Filler truck data_tbl) = around 5200 drinks per tank delivered.
EmptyTime (Empty time contents) is blank because it is an output value from the model.
MaxProfit (on the Results tab) = around $12,000.
As mentioned earlier, it is a good idea to run the model with optimization additional times to make
sure that the answers agree or are at least close. This provides assurance that the first answer is not
a false or sub-optimal.
Adding constraints
The optimization results indicate that the profit would be maximized if you ordered tanks that
hold approximately 5200 drinks and if the second tank were delivered about mid-day. But what
would happen if the drink distributor only had specific size tanks and delivery times? By constraining a parameter, values that fall outside the constrained boundaries are not considered as part of
the possible solution space. You can constrain parameter values in almost an infinite number of
ways by entering constraint equations in the Optimizers Constraints tab.
How To
Your results will vary a little from those shown in this guide because of the randomness of the
model and because you have set the convergence and samples for a quick result.
656
Analysis
Optimization
For comparison purposes, a model with constraints titled Optimize 3 is located in the \Examples\Tutorial\Optimization folder.
This equation puts the tank sizes of 4000 or less into multiples of 1000, and tanks sizes greater
than 4000 into multiples of 2000, using an individual constraint. For example, if the Optimizer
suggests a size of 3300, the equation would convert it to a potential tank size of 3000. If the suggested size were 5200, the ELSE part of the IF statement would round it up to 6000.
The constrained delivery time
The individual constraint equation to granularize the delivery times is:
How To
The delivery time is converted to multiples of 30 minute intervals using an individual constraint,
similar to how the delivery tank size was converted, above.
Global constraints for 6000 and 8000 drink tanks
Although the preceding equation constrains the delivery times for most cases, you also need to
reject cases where the drink tank is 6000 drinks or more and the delivery time is less than 60 minutes.
Rather than the individual constraints used in the previous two equations, for this equation you
need a global constraint. Delivery times for tanks of 6000 and 8000 drinks are not limited to multiples of a specific number as was true for the tank size; they can be any value as long as it is greater
than or equal to 60. So the solution space is somewhat unlimited. In addition, it would not be
valid to just round up a delivery time that is less than 60. If the equation rounded up all the poten-
Analysis
Optimization
657
tial delivery times below 60 to exactly 60, as the preceding delivery time equation does, it would
cause a severe bias toward getting deliveries every 60 minutes. Instead the equation needs to reject
the entire solution set if the delivery time is below 60. This will cause the Optimizer to use a new
random delivery time to generate a different set of solutions that will be less biased.
If you use too many global constraints, or constraints that are too restrictive, the equation would
unnecessarily reject almost all cases and the Optimizer could take too long to run or might fail to
reach an acceptable solution.
The global constrained equation for deliveries of 6000 or more drinks is:
// can't deliver 6000 or more drinks sooner than 60 minutes apart
if (DelTankSize >= 6000 && DeliveryTimes < 60)
Reject = TRUE;
The Optimizer pre-defines Reject as a special variable to be used only with global constraints.
The Reject variable, if set to TRUE, will reject that case and cause the block to calculate another
possible case that could be acceptable. If Reject is not set to TRUE, the current case will be used
for the next series of runs.
Enter the constraint equations
In summary, the equations to enter on the Constraints tab of the Optimizer block are:
// round to delivery amounts (e.g. 1k, 2k, 3k, 4k, 6k, 8k)
if (DelTankSize<=4000) DelTankSize = int(DelTankSize/1000.0 +
0.5)*1000.0;
else DelTankSize = int(DelTankSize/2000.0 + 0.5)*2000.0;
// round fill up time to listed delivery times (e.g. 30 minutes)
DeliveryTimes = int(DeliveryTimes/30.0 + 0.5)*30.0;
// can't deliver 6000 or more drinks sooner than 60 minutes apart
if (DelTankSize >= 6000 && DeliveryTimes < 60)
Reject = TRUE;
How To
658
Analysis
Optimization
After entering the equations in the Optimizer block, the Constraints tab should look like:
How To
DeliveryTimes (Filler truck repeat time) = 270 minutes between deliveries (2 deliveries a day).
DelTankSize (Filler truck data_tbl) = 6000 drinks per tank delivered.
EmptyTime (empty time) is blank because it is an output value from the model.
MaxProfit = around $10,500.
Note that the profit may have decreased slightly from the previous optimum results. This is due to
the constraints put on the model parameters.
Analysis
Optimization
659
Decision variables to be optimized. These need their lower and upper limits entered.
Output variables from the model. These should have no limits entered.
Both lower and upper limits for a decision variable need to be entered directly in the Variables
table. Variables that are outputs from the model, such as Exited from an Exit block (Item library),
should not have any limits entered or the Optimizer will attempt to incorrectly change them.
If the variable is an integer type, such as a number of machines, do not enter a decimal point in
the limits. Conversely, variables that need to have real values, such as a delay time that could vary
from 1.0 to 2.2, need both limits entered with decimal points.
Specifying data table cells in the Variables table
If a cloned data table is dragged to the closed Optimizer block, the Row,Col indexes need to be
entered, separated by a comma. Since data tables are zero-based and start at row 0 and column 0,
the first cell would start at 0,0.
For example, to use the first row and second column cell of a data table, enter the Row,Col value
0,1 where 0 is the first row and 1 is the second column.
The Variables tables Row,Col column is only used to access a cell within a data table.
Objective functions
Optimizations can maximize profit, minimize a cost, or approach a constant, depending on the
form of the equation. Just like the equation field of the Equation block (Value library), optimization equations can be multi-lined, define variables, have control constructs (i.e. IF-ELSE, FOR...),
and call ModL functions. To see more information on equations, see Equation-based blocks on
page 677.
Maximizing profit or minimizing cost
For example, you may want to optimize the number of machines used to maximize the profit. In
that case, you can set up an equation:
MaxProfit = thruput*dollarsPerUnit - numMachines*dollarsPerMachine;
Or, you might want to write the equation as a cost, and minimize that cost:
MinCost = numMachines*dollarsPerMachine - thruput*dollarsPerUnit;
Approaching a constant
A special case for an objective function would be that the result needs to approach a constant K as
close as possible. In this case, you can write a profit equation.
For the case where the equation should approach a nonzero constant K, the form would be:
// maximizes when equation equals constant
MaxProfit = 1.0 - RealAbs(1.0 - equation/K);
Note that the RealAbs(x) function returns the positive absolute
value of x.
For the case where the equation should approach zero, the form would be:
How To
The variable names used in the MaxProfit or MinCost equations come from the Equation Variable column of the Optimizers Variables table. Depending on how you write the equation, the
Optimizer will either maximize or minimize the equation value by changing the values of the decision variables until the correct condition converges.
660
Analysis
Optimization
In this case, ConstantValue should be small, but large enough so that most of the population MaxProfit results are initially positive. If ConstantValue is too small, the convergence calculation will
fail because there will be both negative and positive values in the final population results. If ConstantValue is correct, all of the values will tend to become positive as the system converges, and the
convergence calculation will then be valid. If ConstantValue is too large, the convergence calculation will tend to be insensitive and high all of the time, causing a premature end of the optimization run.
These techniques can be adapted to solve any approaching a constant type of problem.
Run Parameters tab
In most cases, clicking the default buttons for the type of model you are optimizing (random or
non-random) will quickly set all of the parameters in this tab to useful values.
Two of the parameters are especially important to convergence of the optimization:
Maximum Samples per Case: The maximum number of runs averaged to get a member result.
For non-random models, this should be 1. For random models, this needs to be high enough to
get a useful mean value at the expense of run time. The Optimizer block starts the number of
samples at 1 and increases them with each generation until it reaches the maximum. Sometimes
it is useful to reduce the maximum number of samples (possibly to 5), to get a rough idea of the
best solution without spending too much time running samples. Most of the time, a useful
result will occur and, even if it is not the optimum one, it will be close.
Terminate if best and worst within (percent): This value is used to examine the current population of results to see if they are within a specified percentage of each other. The default of 0.99
might not be high enough for a precise answer in a noisy model. Increasing this value (i.e.
0.9999) will cause the optimization to continue until the population converges more closely,
increasing the likelihood of a more optimum answer at the expense of run time.
How To
Constraints
When building a model, there are almost always some parameter constraints that have to be satisfied. The two types of constraints are individual constraints and global constraints. The Optimizer block makes it easy to apply virtually any kind of constraint to a models parameters.
Individual constraints
Individual constraints are used to change a decision variables value if the value has to be limited or
if it depends on the values of other decision variables. These constraints are entered as equations,
usually with IF or IF-ELSE statements. For example:
if (NumQueueSlots > 7)
NumSlots = NumActivities+3; // change it
Analysis
Stat::Fit (Windows only)
661
In some cases you just need to modify the value of a variable. For example, if you need to constrain
its values to multiples of 0.5 (i.e. 1.0, 1.5, 2.0). You do this by multiplying the variable by 2, adding 0.5 before the Int() function truncates it so that it rounds it to the nearest integer, and then
dividing by 2.0, forcing the result to floating point values that are granular to 0.5:
Var2 = Int(var2*2.0+0.5)/2.0; // 0.5 Granularity
In any case the newly calculated Var2 value will replace the old Var2 value.
Global constraints
Global constraints are useful to reject an entire case if any or all of the decision variables dont meet
a specific criteria. Global constraints are entered as equations, usually with IF statements, to assign
the value TRUE to the variable REJECT if the variables are not within the constraint. They are
entered like this example:
if (Var4+Var5 > 7)
Reject = TRUE; // only reject if the sum is too large
Reject is a special optimization variable for use with global constraints. If set to TRUE, it will reject
that case and cause the block to calculate another possible case that could be acceptable. If Reject is
not set to TRUE, the current case will be used for the next series of runs.
Sometimes you might need a more complex form:
if (Var4+Var5 > 7 || Var4 < 2) // the || means OR, && means AND
Reject = TRUE;
In any case, any global constraint will abort that particular case and the Optimizer block will keep
attempting to create cases until the global constraint doesnt set REJECT to TRUE. It will try to
create 500 new cases before it gives up and prompts the user with an error message. If this occurs,
the global constraint is probably faulty.
Interpreting results
The Results tab shows the entire population of solutions, sorted with the best one on top (row 0).
As the optimization progresses, new and better solutions will replace inferior solutions in the population table.
If the optimization terminates for any reason, either via normal convergence or running for the
maximum number of generations, the best solution set found so far is automatically placed in the
model.
In simulation models, it is often useful to characterize a random input (for example, inter-arrival
times and demand rates) using a probability distribution. Typically, this involves obtaining historical data that documents the systems behavior, then analyzing the data to determine an appropriate
distribution to represent it. There are two advantages to using statistical distributions rather than
raw historical data as inputs to a model:
Values for input random variables are not limited to what has happened historically.
For continuous distributions, an infinite pool of data exists. With historical data, there is seldom
enough collected data to support multiple simulation runs.
Stat::Fit is a software package from Geer Mountain Software (www.geerms.com) that helps the
analyst determine which distributions, if any, offer a good fit for the underlying data. ExtendSim
has an interface so you can easily access the power of Stat::Fit.
How To
662
Analysis
Stat::Fit (Windows only)
Stat::Fit is a Windows application included with the ExtendSim AT and ExtendSim Suite products. It can be purchased separately for use with other ExtendSim products.
Tutorial
The StatFit Example, shown on the right, is a discrete event
model. It has Stat::Fit choose a distribution for a Random
Number block (Value library) using a pre-built text file of data.
By default, the Random Number block is set to the Uniform
Real distribution with a Minimum of 0 and a Maximum of 1.
The 32 historical data points in this project will be used by
Stat::Fit to define which distribution and associated parameters
might be more appropriate.
In the Distribution Fitting tab of the Random Number block, click Open Stat::Fit.
How To
The Stat::Fit application should appear on your screen with a new blank document.
In Stat::Fit, choose Fit > Auto::Fit or click the Auto::Fit button in the toolbar.
In the Auto::Fit window, click OK to use the default settings.
After Stat::Fit does some computation, a window appears displaying a list of parameterized distributions that have been ranked according to goodness of fit.
In Stat::Fit, choose File > Export > Export Fit or click the Export button in the Stat::Fit toolbar.
Analysis
Plotters
663
Select Extend under the application window (it should be the default), then choose the
desired distribution (there should only be one).
Click OK and return to ExtendSim. (You may exit Stat::Fit if you wish.)
The Random Number blocks dialog should reflect the Triangular distribution and parameters
Stat::Fit selected.
Additional Stat::Fit documentation is available in Stat::Fits Help menu and in the SF Manual
V2.pdf file located within the ExtendSim9\Documentation folder.
Plotters
Most of the ExtendSim plotters have many features in common. The Reservoir model in the Tutorial module shows some basics of how to use plotters. This section describes the ExtendSim plotters in more detail and shows how to make plots appear the way you want. All plotters are located
in the Plotter library.
Depending on their type, plotters allow you to plot from 1 to 6 traces (plotted lines) at a time. If
you build your own plotter using ExtendSims ModL language, you can plot up to 100 traces on a
single plotter. Your choice of plotter type depends on the type of model you build (continuous,
discrete event, or discrete rate) and how you want information plotted (such as batch runs, histogram, and so on). Plotter types are described later in this chapter.
You can have more than one plotter in a model and you can place plotters at any location in the
model. Usually plotters open automatically when the simulation is run. If the plotter is set to not
open (as discussed in Plotter dialogs on page 667), you can open it by double-clicking its icon.
only the current plot image is saved in the plot pane. In that case, use the Push Plot tool (described
on page 667) to save additional images.
Click on the number at the lower left of the plot pane to see each page. If the Key On/Off tool
(described on page 666) was on when the simulation ran, the key will be shown on the pages.
To see the exact numbers that generated a point, scroll through the numbers in the data pane. Or
simply put the cursor over the data item you want; the top row in the data pane displays the values
that match that point. (In scatter plots, this shows the X and Y values of that point.)
Change the plot axis labels and limits directly in the plot pane, as follows:
How To
Plot pane
The plot pane has four pages. If the plotter was open
during the simulation run, the four most recent runs
will automatically be saved on those pages.
664
Analysis
Plotters
Data pane
Resize the columns in the data pane by placing the cursor directly over the column divide, and dragging the
Changing maximum Y-axis value
divide to the desired location while holding down the
mouse. You can also tab through the data or use the
arrow keys. If you select a section of data, tabbing will move you just through the selection. Notice
that only the data for page 1 of the plot is displayed in the table.
If you change the data in the data pane, those changes are reflected in the plot. You can change
numbers, paste in rows, and so on. Use this capability to view how various data would be plotted,
or to plot a reference line.
The label headers for the columns are changed using the Trace properties tool, described on page
665. The color, pattern, and symbol for each trace is displayed to the left of its label.
Plotter tools
Tr
ac
e
How To
pr
op
er
tie
s
O
pe Lo
g
n
di
G
rid alo
de g
K ns
ey it
o y
A
ut nos of
f
A cal
ut
e
X
os
A
ut cal
e
os
ca Y
le
Zo XY
om
Zo
o in
R
ed m
ra ou
w
t
t
Pu r a c
sh e
pl
ot
Note the tools at the top of the plot pane. These are used to change the traces and views for the
plots, change the labels and formatting for the data being plotted, and to control how and when
the data is displayed. Tools with arrows beneath them are popup menus with multiple choices. The
toolbar in plotter windows looks like:
Plotter toolbar
Analysis
Plotters
665
ol
W or
id
Pa th
tte
r
S n
Sy tyl
m e
b
Fo ol
rm
a
Sh Y t
o w 1 /Y
Tr 2
ac
e
Tr
ac
e
am
Trace window
If you check the Delay changes until close checkbox, changes you make will occur in the plot only
after the Trace properties tool is closed. This is useful when you are making a lot of changes and
dont want the traces to be redrawn after each change.
Below the checkbox are nine columns of choices.
The Trace Name text at the left describes the traces and is used to label the columns in the data
pane. In a discrete event plotter, each trace has two sets of labels: the name of the trace and Time.
In a continuous plotter, each trace will only have one label, as shown above. To change a label,
click on the text in the Trace Name area and type the text you want.
The Color, Width, and Pattern choices describe how the trace looks. To change one of these items,
click on the box and choose from the list. You can select from seven standard colors or choose a
custom color. There are also five line widths and four patterns available.
The Style choice affects the manner in which the trace is drawn.
The top style indicates that the data points are connected by diagonal lines
(interpolated)
The middle style (the default) indicates that points are connected by horizontal
and vertical lines (stepped).
Trace style
choices
There are also many Symbol types, such as dots, squares, and circles, as well as a trace numbering
choice (marked #). If you choose a non-numeric symbol, it will be drawn at each point on the
trace. If you choose the # symbol, the number for that trace will be spaced evenly along the trace.
Except for numbers, each symbol is drawn using the trace color, width, and thickness settings;
numbers are drawn in black.
The Format option sets the number format that is used for the data in the data pane, including
Time for discrete event plotters. The four choices are General, x.xx (decimal), xxx (integer), and
x.xex (scientific notation).
The Y1/Y2 choice tells which axis to plot the numbers against. The default choice,
on the Y1 (left) axis. Clicking this changes it to , the Y2 (right) axis.
, plots values
How To
The bottom style indicates that you want the points plotted with no lines
between them.
666
Analysis
Plotters
The Show Trace choice tells whether to display the trace at all. If you click on this choice, it turns to
a closed eye and the trace is not drawn. This is useful if you have many traces and you temporarily
want to hide one to make the chart clearer or if one trace is on top of another.
Log tool
The Log tool lets you choose whether to make one or both axes use a
logarithmic scale. Click the tool to display the popup menu.
Open Dialog tool
Click the Open Dialog tool to show the plotters dialog. You use this
tool to make changes to the way the plotter operates. For example,
to not have the plot show during simulation runs or to plot every
nth point. The Plotter, Discrete Event block, for instance, has one
tab that controls how and when data is displayed and another tab
that allows you to specify the granularity of the plotted data. The
choices in the plotter dialogs are described in their Help and in
Plotter dialogs on page 667.
Log choices
How To
Analysis
Plotters
667
Note that you can also choose to have the data automatically scaled at the end of the simulation
run, during the run, or not at all. You do this using the autoscale popup menu in the Display tab
of the Dialog Open tool. By default, most plotters autoscale at the end of the simulation run.
Zoom in and Zoom out tools
There are many times you want to see a particular part of your plot in more detail, or want to
zoom out and look at a larger area of the plot. The Zoom in tool magnifies an area of the plot.
After you click this icon, the cursor becomes . Drag the cross-hairs over an area of the plot and
release the mouse to zoom in to match the described rectangle. The Zoom out tool zooms out by
changing the axes by a factor of 2 in each direction. After using the Zoom in or Zoom out tools,
you can use the Autoscale tool or the Edit > Undo command to reset your axes.
Redraw trace tool
The Redraw trace tool lets you change your data on the plot and see the results in the plotters data
table. Click and hold down the mouse on the tool to display the menu. Choose one of the four
traces that you want to change. The cursor becomes a pencil, . You use the pencil to redraw the
data that was plotted. After you are done drawing this, you can see the values for the drawn data by
looking in the data table. The Redraw trace tool is only available in continuous, non-scatter plotters, like the Plotter I/O.
Push plot tool
Each time you run a simulation with the plotter open, the previous run is automatically saved onto
page 2 of the plot. Changes made to the plot after the simulation run (such as autoscale, magnify,
and turning the key on) are not automatically saved. Also, if the plot was closed during the simulation run, the plot image from the last run will not be saved to page 2. After you change the view of
a plot or run a simulation with the plotter closed, you may want to save a copy of that plot in one
of the plotters plot pages. To do that, click the Push Plot tool.
For example, assume that you are looking at a magnified portion of the plot and you want to save
that magnified view before running the simulation again. Use the Zoom In tool, then click the
Push Plot tool to keep a record of that view. Then choose Edit > Undo Zoom in to restore your
original axis values, and run the simulation again.
When you use this tool, the current plot image is saved onto page 2. The previously saved images
are each pushed up one page so that the image that was on page 4 is discarded.
ExtendSim comes with many types of plotters, as seen in Types of plotters on page 668. Plotters
have a dialog that you can access by clicking on the Open dialog tool at the top of the plotter.
Choices that some of the plotters have in common are:
Choice
Description
Determines if the plotter window is automatically opened during the simulation. For example, you probably do not want the plotter to open if you are running the model with animation on.
How To
Plotter dialogs
668
Analysis
Plotters
Choice
Description
Show instantaneous For discrete event plotters, plots additional data to show when a queue changes
queue length
length in zero time. For example, when an item enters and leaves the queue
during one event.
Dont continue line
to Endsim
For discrete event plotters, stops drawing the plot trace at the last event, not at
the End Time of the model run.
Show plot
Brings the plot window to the front if it is already open, and opens it if it is
closed.
Autoscaling
Automatically resizes the Y-axis of the plot based on the maximum and minimum values observed. The plot can automatically scale during the simulation,
at the end of the run, or not at all.
When checked, enables a popup for selecting a background for the plot pane.
You can copy custom plotter backgrounds into the Extensions\Pictures folder.
They must be windows metafiles (.wmf ) or bitmaps (.bmp) for Windows or
PICT resources in a Macintosh resource file for Mac OS.
If Use Calendar dates is checked in the Run > Simulation Setup > Setup tab,
this option expresses time units on the plot pane in Calendar date format, displaying full date and time, no time, or time only. For more information, see
Calendar dates on page 586.
Plot every nth point In continuous plotters, lets you specify that the plotter should only draw the
nth point of the data it receives. This is useful if there are many data points and
the points are all very close together, or to make the plot draw faster.
Data storage tab
The choices on this tab are to plot all data, all important data, or reduced data.
This is useful if you have plotters that store too much data, as some of it may be
redundant. The Reduced data choice samples from the incoming stream, conserving memory.
Types of plotters
How To
Plotters are located in the Plotter library. As indicated in the following table, each plotter has a distinct purpose. Some can only be used in continuous models (C), some only in discrete event or
discrete rate models (DE/DR), others in both (Both).
Discrete Event plotters are used in discrete event models. However, since they plot values not
items, you must connect a value output (as opposed to an item output) to the Discrete Event plotter. This tells the plotter what information about the items or about the status of the model you
want to plot.
The MultiSim and Error Bar plotters are specifically designed to be used when you run multiple
simulations for Monte Carlo or sensitivity analysis. You choose the number of times you want the
simulation to run in the Run > Simulation Setup dialog.
Analysis
Plotters
Plotter
Bar Chart
Description
Model
Both
669
Windows only. Plots up to six Gantt chart bars. Each bar displays
Both
Creates a histogram of all the values it receives. Each bin counts the Both
number of data values that fall within its range, or the amount of
time that the incoming value was in that bin (if the Time Weighted
option is used). The number of bins and the overall minimum and
maximum range values are specified in the plotters dialog. The maximum and minimum can be the entire range received or specified
numbers. You can specify in the dialog whether to plot the data from
each step or, if you run multiple simulations, to plot the final values
of each run. The dialog also displays the number of points that fall
within the specified range.
DE/DR
Shows the mean and standard deviation of a value. This plotter is
used when running multiple discrete event or discrete rate simulations, such as for Monte Carlo modeling or for sensitivity analysis.
The time line is divided into a number of equal intervals specified in
the dialog. You can also choose to use time-weighted statistics. The
plotter calculates the average mean of the value over each interval
and from this determines the mean and standard deviation over all
of the runs.
Plotter,
DE MultiSim
DE/DR
Accumulates the values from up to four runs of a discrete event or
discrete rate simulation on a single plot pane and table. In the dialog, you can choose to only plot values when they change or to plot
all values. You can also specify by number which trace to show the
current run on and whether to automatically increment the trace
number.
Plotter, Discrete
Event
Gives plots and tables of data for up to four value inputs in discrete DE/DR
event and discrete rate models. Both the value and the time the value
was recorded are shown in the data table for each input. In the dialog you can specify whether to plot values only when they change or
to plot all values. Use the Show instantaneous length option if you
attach an input to the L connector of a queue-type block and you
want it to report on items that arrive and depart on the same time
step (these are items that stay in the queue for zero time).
How To
Plotter,
DE Error Bars
670
Analysis
Plotters
Plotter
Description
Model
Plotter, FFT
Plotter, I/O
Plotter, MultiSim
Accumulates the results of up to four runs of a continuous simulation on a single plot pane and table. You can specify by number
which trace to show the current run on and whether to automatically increment the trace number.
Plotter, Scatter
Shows two sets of data plotted as x,y value pairs. You must connect
both the x and y inputs of at least one pair in order to plot data.
Both
The same as the Plotter, Scatter except that you can plot up to four Both
sets of data. You must connect both the x and y inputs of at least one
pair in order to plot data.
How To
Plotter, Strip
C
Shows a moving strip chart of a specified number of data points
plotted over time. The strip chart moves left as the data appears on
the right side of the plotter. In the dialog, you can specify the numbers of points to show on the chart. Because it uses less memory than
the Plotter, I/O, this is especially useful if you are running a long
simulation and only need to monitor the current conditions.
Analysis
Reports
Plotter
Plotter, Worm
Description
671
Model
Shows two sets of data plotted as x, y value pairs for a specific num- Both
ber of points. You can specify how many points to show at a time
(the worm width) in the dialog. This is like the Plotter Scatter except
that points are deleted. Use this if you are generating a great deal of
data but do not need to see all of it. You must connect both the x
and y inputs of at least one pair in order to plot data.
Reports
The report commands in the Run
menu are for generating custom reports
of model data. The commands let you
choose just the blocks you want in the
report, or you can choose to report on
all the blocks in a model.
For example, if you have a discrete
event model with queues, you might
Report options
want to check each queue to see what
the maximum queue length was. You
could simply look in the report for those queues.
If you build your own blocks and want to use the Report features for debugging, add special code
to the blocks as described in the Developer Reference.
Types of reports
The Statistics (DB) report contains the final values for the output parameters. The statistical
data from each simulation run is stored in an ExtendSim database, organized by block type so
that there is one table per type of block.
The Dialogs (Text File) report includes the final values for the input and output parameters of
every chosen block, as well as the information in each blocks comments field. Since this report
includes the values and settings for all of the parameters in each of the selected blocks, it is a
good tool for documenting a model.
The Statistics (Text File) report contains the final values for the output parameters, stored in a
text file. This report arranges the statistics in tabular form, allowing for easy comparison of block
results and exporting to spreadsheets.
How To
672
Analysis
Reports
Generating reports
Before generating a report, you need to choose which blocks to report on. To include some blocks
in a report, select the blocks and choose Run > Add Selected to Report. To have all the blocks in a
model be included, choose Run > Add All To Report. To report on fewer blocks in the next simulation run, select the blocks you want out of the report and select Run > Remove Selected from
Report; to start over on your selection of blocks, choose Run > Remove All from Report.
Its highly recommended that you do not include a Plotter block in a report. Plotters write out all
report data to a very large file.
You can see which blocks are being reporting on by choosing Run > Show
Reporting Blocks; each block in the report displays the word Report on its icon.
Reports are opened, closed, and edited just like any other text file in ExtendSim.
file.
Reporting example
For example, the following (edited) reports were generated for Reservoir 1 models Random Number block for the first two simulation runs.
Dialogs report
ExtendSim Dialog Report - 9/27/2012 2:24:51 PM Run #0
Block Name: Random Number Block Number: 13 Block Label: Stream
DistType = Uniform Real
Argument1_prm = 0
Argument2_prm = 1
UseBlockSeed_chk = UnChecked
RandomSeed_prm = 14
RandomResult_prm = 0.396125656921534
GenerateOnce_chk = UnChecked
Analysis
Reports
673
***************************************************************
ExtendSim Dialog Report - 9/27/2012 2:24:51 PM Run #1
Block Name: Random Number Block Number: 13 Block Label: Stream
DistType = Uniform Real
Argument1_prm = 0
Argument2_prm = 1
UseBlockSeed_chk = UnChecked
RandomSeed_prm = 14
RandomResult_prm = 0.371057238775359
GenerateOnce_chk = UnChecked
How To
674
Analysis
Reports
For the Statistics report, Inputs is the blocks category in the Library menu.
How To
You can edit the text file reports just as you would any text file in ExtendSim; this is described in
Text files on page 761. If you program custom blocks, you can specify what data gets written in
the report as discussed in the Developer Reference.
When printing the Statistics report onto a standard 8.5" by 11" sheet, to ensure that the entire
page width is printed, use the Text command to change the font from the default size 12 to size 9.
The default size is set for easy on-screen viewing, but will exceed the page margins.
Reports can also be used as a debugging tool, but you can get more detailed information for debugging by performing model tracing. See Model tracing on page 707.
How To
I know that two and two make four - & should be glad to prove it too if I could
though I must say if by any sort of process I could convert 2 and 2 into 5
it would give me much greater pleasure.
George Gordon Noel Byron
676
ExtendSim provides an extensive palette of tools for integrating mathematical equations and randomness in a model. You can even control the exact moment that calculations will take place. This
chapter discusses:
Blocks that provide mathematical functionality
Using Equation blocks to create custom equations
Incorporating randomness in models
Selecting a probability distribution
Determining when inputs should be integrated or summed
For information about blocks that perform statistical analysis, see Blocks that calculate statistics
on page 624.
The following blocks may be used in any type of model to provide mathematical functionality
based on dialog selections:
Decision (Value library)
Compares the value at one input to the value at another input and reports a result.
For example, use this block to determine if one model value is greater than, less than,
or equal to another value during the simulation run.
How To
677
In addition to the blocks listed above, most blocks automatically calculate and report statistical
information during or at the end of a simulation run. For example, the Math block (Value library)
reports the results of the selected mathematical calculation in its Options tab and the Queue block
(Item library) displays statistics about the queue length, average wait time, utilization and so forth
in its Results tab.
Other options
There may not be an ExtendSim block that provides the specific function or equation that you
want. Or, you may want to combine the functionality of several blocks into one. Some possible
solutions are:
Select several blocks and make them into a hierarchical block, as discussed in Hierarchy on
page 598.
Add features to an ExtendSim block by modifying the structure of a block (its dialog and code)
as discussed in the ExtendSim Developer Reference.
Use the Equation block (Value library) or the Equation(I) or Queue Equation blocks (Item
library) to directly combine functions or to obtain behavior not available in other blocks. These
blocks are discussed in the next topic.
Equation-based blocks
The equation-based blocks calculate values for models based on formulas and ModL code entered
in their dialogs. There are five mathematical equation-based blocks:
Library
Purpose
Equation
Value
Equation(I)
Item
Queue Equation
Item
Query Equation
Value (AT & Suite) A user-defined equation selects one record from an
ExtendSim database table
Query Equation(I)
How To
Block
678
These blocks provide access to over 1,000 internal functions; you can also use operators to enter
logical statements, write compound conditions, and specify loops. The equation can be as simple
as performing a mathematical operation on the value from an input connector or it could be as
complex as a full programming segment. You can use include files (See Include Files in the Developer Reference) within your equation to reuse your own functions among many equation blocks,
and you can use the source code debugger (See Debugging equations on page 702) to check the
equation if you have a problem. The equation is automatically compiled when you click OK in the
blocks dialog.
The Equation(I), Queue Equation, and Query Equation(I) blocks can only be used in non-continuous (discrete event and discrete rate) models. They typically perform calculations when items
arrive or depart. Although it is a continuous block, you can use the Equation or Query Equation
block in non-continuous models. This is common when you want the equation to calculate independent of item status.
Overview
An equation-based block takes input variables, uses those values in an equation, and outputs the
results of the calculation. Equation-based blocks are similar to the formula bar of a spreadsheet.
Most of the usual components (operators, values, functions, and so on) are the same. There are
two differences - instead of a cell reference, these blocks have input and output variables that are
identified by name in the equation, and the results of the equation can be output to different destinations.
Equation components
The components of an equation are the input variables, the equation, and the output variables.
All of the equation-based blocks have a scrollable area for entering the equation. Most equationbased blocks also have a separate Equation Editor for viewing and editing the equation; it is discussed on page 683.
You can define local (temporary) input and output variables in the equation area or the Equation
Editor as well as static (permanent) input and output variables using include files.
As described below, most equation-based blocks also have two tables, Input Variables and Output
Variables, with predefined static variables you can use in equations.
How To
Input variables
Input variables are the model values used in an equation. With the exception of the Buttons and Optimizer
blocks, the equation-based blocks have a table for creating the input variables. Each row in the Input Variables
table (shown on right) has a popup menu for selecting
a pre-defined type of input variable and a field for its
name and value. Variables created here are static (permanent).
To modify the number of rows used in the variable
tables:
Change the number of rows in the table by clicking the green +/- resize button in the tables bottom right corner and entering the number of rows desired.
679
Delete rows by first selecting the rows you wish to delete, clicking the green +/- resize button,
and then selecting the option to "delete selected rows."
Duplicate any rows by first selecting the row you wish to duplicate, clicking the green +/- resize
button, and then selecting the option to "copy selected row."
Equation
Equation(I)
Queue Equation
Query Equation
Query Equation(I)
The Variable Type popup provides many options for input variables, as shown below. For more
information about each option, see the blocks Help.
DB read PRI using attrib reads the PRI from a variable database
location specified by a DB address attribute. See note below.
X
X
Static first run init a static variable that gets initialized to its starting
value only at the beginning of the first run. Specify starting value in the
Variable Value column.
Static mult run init a static variable that gets initialized to its starting
value at the beginning of each run. Specify starting value in the Variable
Value column.
Static open model init a static variable that gets initialized to its starting value when the model is opened. Specify starting value in the Variable Value column.
Next calc event time Used to get this block's next event time. (Only
enabled if the Use calc event time output variable option is chosen.)
How To
Item index the items index value from the Executives item array
Equation
Query Equation
Queue Equation
Query Equation(I)
Equation(I)
680
For the Variable Name column, use the default names, assign names that have more relevance to
the model, or select a name from a popup, depending on the type of variable selected. The type of
input variable selected also determines the options for the Variable Value field: enter a value
directly, select the value from a database location, and so forth.
The notation PRI (Parent Record Index) is used in blocks that interface with the ExtendSim database. It describes the type of value that is being read or written when dealing with a Child field.
The Queue Equation, Query Equation, and Query Equation(I) blocks have additional specific
input variable types. See Sorting items using the Queue Equation block on page 137 or Query
Equation and Query Equation(I) blocks on page 752.
How To
Output variables
Output variables are where the results are recorded
when the equation is calculated. With the exception of
the Buttons and Optimizer blocks, the equation-based
blocks have a table for creating the output variables.
Each row in the Output Variables table (shown at
right) has a popup menu for selecting a pre-defined
type of output variable and a field for its name and
value. Variables created here are static (permanent).
To modify the number of rows used in the variable
tables:
Change the number of rows in the table by clicking the green +/- resize button in the tables bottom right corner and entering the number of rows desired.
Delete rows by first selecting the rows you wish to delete, clicking the green +/- resize button,
and then selecting the option to "delete selected rows."
Duplicate any rows by first selecting the row you wish to duplicate, clicking the green +/- resize
button, and then selecting the option to "copy selected row."
The Variable Type popup provides many options for output variables, as shown below. For more
information about each option, see the blocks Help.
Equation
Equation(I)
Queue Equation
Query Equation
Query Equation(I)
DB write PRI using attrib writes the PRI (see above) to a non-fixed
database location specified by a DB address attribute. See note below.
Calc event time Used to set this block's next event. (Only enabled if
the Use calc event time output variable option is chosen.)
681
X
X
X
X
For the Variable Name column, use the default name, assign a name that has more relevance to the
model, or select a name from a popup, depending on the type of variable selected. The Variable
Value field reports the results for the selected output variable. In the Equation(I) block there is also
a column to specify what should happen to the result if an output is needed but there is no item to
trigger the equations recalculation.
base. It describes the type of value that is being read or written when dealing with a Child field.
The Queue Equation, Query Equation, and Query Equation(I) blocks have additional specific
output variable types. See Sorting items using the Queue Equation block on page 137 or Query
Equation and Query Equation(I) blocks on page 752.
Equation
An equation is a list of commands to be executed on one or more input variables, resulting in one
or more output variables. In the equation pane, enter an equation that uses the names of the input
and output variables and any of ExtendSims built-in functions and operators. The equation must
be of the general form output = equation; (the semicolon at the end is required).
For example, an equation that uses the values from input connectors named Input1 and Input2
and outputs the result to an output connector named OutputA would be:
How To
The notation PRI (Parent Record Index) is used in blocks that interface with the ExtendSim data-
682
To find out how to debug your equations, see Debugging equations on page 702.
The equation does not have to use all the names assigned to the input and output variables. However, if an input connector is connected, ExtendSim assumes that you will want to use it in the
equation. If you dont use it, ExtendSim will give a warning when the simulation runs. ExtendSim
will also warn if the equation uses a connector that is not named or is not connected.
Equation-based blocks can calculate separate results and output them using any number of output
variables.
How To
Original Reservoir model with overflow calculations (left) and using Equation block (right)
683
Equation Editor
As discussed earlier, all of the equation-based blocks have a scrollable area for entering equations.
Other than the Optimizer (Value library) and Buttons (Utilities library) blocks, the equation-based
blocks also have a separate Equation Editor window for viewing and editing the equation.
Although the equation could be edited within the blocks dialog, there are advantages to editing
the equation in the Equation Editor window:
The Equation Editor window can be resized to fit larger equations
Tabs can be used for indenting
Code colorization is allowed, so code is more understandable
Other editing commands, such as matching braces, are supported
Code completion is enabled in both the equation area and the Equation Editor window (which
also has a Code Completion button). Code completion (F8) makes it easier to recall function
names and their arguments
To see the Equation Editor:
It is common that several blocks would use the same or similar variable definitions and functions.
Include files simplify programming tasks that are repeated in multiple blocks. They are especially
helpful when you define your own functions for one block and want other blocks to have access to
those functions.
For those who are building complex equations, most of the equation-based blocks have an interface for adding include files. This feature is implemented in the Equation and Query Equation
blocks (Value library), Equation(I), and the Queue Equation, and Query Equation(I) blocks (Item
library).
Include files in equations are similar to the standard ModL include header files used when creating
a block and discussed in the Developer Reference. They can contain ModL symbol definitions
such as #define, conditional compilation statements such as #ifdef, and function definitions.
The main differences between the two methods of using include files are:
How To
684
Include files used with equations are normally saved in the same location as the model using
them; this makes it easy to move both the model and the includes it uses to a different location.
Include files used in block code should be saved in the Extensions/Includes folder.
Include files are added to block code via the #include syntax in the code, such as #include filename.h. However, include files in equations are added via an interface (Use include files) in the
equation blocks dialog. You cannot use the #include syntax in an equation block.
To create a new include file for an equation-based block:
Use the procedure in the equation. In this case, when the equation is called the block will display a user error that says Hello World.
If you have ExtendSim OR, ExtendSim AT, or ExtendSim Suite, see also the Equation Include File
model; it is located at \Examples\Discrete Event\Tips.
How To
Random numbers
The ability to include randomness and show dynamic aspects through time is one of the most
valuable characteristics of a simulation experiment. Introducing randomness into a model mimics
the patterns and unpredictability of the real world, increasing model accuracy. Since most models
have randomness, it is important to understand random numbers.
ExtendSim has blocks, features, and functions that provide randomness in models. For example,
the Random Number block (Value library) and the Create and Shutdown blocks (Item library) calculate random numbers using random distributions accessed through ModL functions. You can
also specify random settings when using Sensitivity Analysis and for values in the ExtendSim database, and developers can directly access several random number functions.
685
Numerical Recipes in C, 2nd edition, pp.279 A portable and reasonably fast minimum standard random number generator that uses Schrage's algorithm and L'Ecuyer - Comm. of the
ACM, Oct. 1990, vol. 33 and L'Ecuyer and Cote, ACM Transactions on Mathematical Software, March 1991.)
An optional generator based on Schrage, A More Portable Fortran Random Number Generator, ACM Transactions on Mathematical Software, Vol 5, No. 2, June 1979, pages 132-138.
The first type of generator is specified by default in the Run > Simulation Setup >Random Numbers tab and is highly recommended for building models. The second generator is used mainly for
backwards compatibility, so that models developed before ExtendSim 4.0 will retain results that
are consistent with those older versions of ExtendSim.
Random seeds
A random number stream is a sequence of random numbers; the numbers in the stream are
derived based on seed values. The pseudo random number generator is the internal mechanism in
ExtendSim which calculates the numbers in the stream.
ExtendSim provides independent random number streams with the ability to specify a seed so that
sequences of random numbers can be repeated. A random number is generated based on a seed.
You can specify a seed for the model as a whole in the Run > Simulation Setup > Random Numbers tab. A seed value of 0 or blank uses a random seed; any other value causes repeatable sequences
of pseudo-random numbers. This gives repeatable results, allowing you to determine exactly how
changes affect the model.
ExtendSim automatically assigns a separate seed to each block in the model that generates random
numbers. To specify your own seed, enter a value in the Use block seed field in the dialog of those
blocks. Any number entered as a seed in a block dialog will result in an independent random number stream that will not change across runs. Since each stream of random numbers is based on a
seed, and you can have a separate seed for each block that generates random numbers, random
number generation in ExtendSim is independent. The blocks that generate random arrivals or
numbers are the Create and Shutdown blocks (Item library) and the Random Number block
(Value library).
How To
Each cell in an ExtendSim database can have an independent seed for the selected distribution.
The database seed is dependent on what is set in the Run > Simulation Setup > Random Numbers
tab. The seed field in the Sensitivity Setup dialog is independent of the seed that is set in the Random Numbers tab.
686
Probability distributions
In real life you cannot know exactly when an event is going to occur until it happens. For example,
you do not know when the next customer will enter your store. However, by using the correct statistical distribution you can approximate what happens in the real world.
A distribution (also known as a probability distribution or a random distribution) is a set of random
values that specifies the relative frequency with which an event occurs or is likely to occur. ExtendSims random number distributions express both a probability that something will occur and a
range of values that specify the maximum and minimum value of occurrence.
Distributions represent the data observed in real-world situations. When you gather data for a simulation model, it is seldom in a useful form. By filling in the gaps, distributions help to compensate for information which was overlooked during data collection. For example, distributions
account for extreme or outlying values which may have been missed during typically short datagathering intervals. Stochastic models use distributions as a handy method for converting data into
useful form and inputting it into models.
Characteristics of distributions
The functions that produce a distribution have one or more parameter arguments which define
and control its characteristics. The most important characteristics are a distributions shape, its
spread, and its location or central tendency. Shape is often used to identify distributions; for example, the bell-shaped curve of a normal distribution is widely recognized. Shape can be characterized
according to skewness (leaning to one side or another) and kurtosis (whether it is peaked or flat).
You specify the characteristics for the selected distribution by the values you enter for these arguments.
Choosing a distribution
How To
Using random numbers means either choosing the theoretical distribution that best describes the
variability of the raw data, describing the data using a user-defined or empirical distribution (such
as the empirical distribution in the Create block), or fitting known data to a distribution. As seen
below, there are many distributions in ExtendSim and it also has the ability to interface with external distribution-fitting software, as discussed in the next topic.
The choice of one distribution over another is not an exact science, but rather is dependent on the
type and extent of the data which is gathered, the detail required for the process being modeled,
and (in the case where little data is available), informed guesswork. If the data does not fit any of
the distributions described below as typical for your process, but fits a distribution which is not
typical, go with what your data tells you. It is usually better to use an approximate distribution
than it is to keep a value constant.
Distribution fitting
There are also software applications which fit data to distributions. Use these tools in situations
where there is empirical data you want to model using random distributions, but the ExtendSim
distributions do not exactly fit. These products can help find the statistical distribution that best
emulates the real-world data.
Some ExtendSim packages come with the Stat::Fit distribution fitting application (see Stat::Fit
(Windows only) on page 661.) The Random Number block has a Distribution Fitting tab from
which to launch a distribution fitting package, analyze empirical data, and determine the appropriate statistical distribution for a given data set.
687
ExtendSim distributions
When there is sparse or no data, this guide of common uses may help you select a plausible distribution in the Create, Shutdown, or Random Number blocks, within the Sensitivity Setup dialog,
or when formatting a cell in the ExtendSim database:
Definition
Beta
Binomial
Cauchy
Used to represent the ratio of two equally distributed parameters in certain cases
or wildly divergent data as long as the data has a central tendency. It has a sharp
central peak but broad tails that are much heavier than the tails of the Normal
distribution.
Chi Squared
Used in statistical tests but, since it does not have a scaling parameter, its utilization is somewhat limited. It is a subset of the Gamma distribution with beta = 2
and alpha = nu/2.
Constant
This does not produce a random number, but a constant value which does not
change. Used when there is exactly the same amount of time between arrivals or
as a method to reduce the effects of randomness in the early stages of model
building.
Empirical
Erlang
Frequently used for queueing theory to represent service times for various activities or when modeling telephone traffic.
Exponential
Primarily used to define intervals between occurrences such as the time between
arrivals of customers or orders and the time between failures (TBF) or time to
repair (TTR) for electrical equipment. Also used for activity times such as repair
times or the duration of telephone conversations.
Extreme Value Type describes the limiting distribution of the greatest values of many types of sam1A
ples. Used to represent parameters in growth models, astronomy, human lifetimes, radioactive emissions, strength of materials, flood analysis, seismic
analysis, and rainfall analysis. Its peaked shape is always the same but it may be
shifted or scaled.
Extreme Value Type Describes the limiting distribution of the least values of many types of samples.
1B
Represents parameters in growth models, astronomy, human lifetimes, radioactive emissions, strength of materials, flood analysis, seismic analysis, and rainfall
analysis.
How To
Distribution
How To
688
Distribution
Definition
Gamma
Typically used to represent the time required to complete some task. The distribution is shaped like a decaying exponential for shape (2) values between 0 and
1. For shape values greater than 1, the distribution is shaped like a bell curve
skewed towards the low end.
Geometric
Outputs the number of failures before the first success in a sequence of independent Bernoulli trials with the probability of success on each trial. Typically
used for the number of items inspected before encountering the first defective
item, the number of items in a batch of random size, or the number of items
demanded from an inventory.
HyperExponential
Hypergeometric
Inverse Gaussian
Inverse Weibull
Johnson SB
Johnson SU
Laplace
Used in error analysis and to describe the difference of two independent, and
equally distributed, exponentials.
Logarithmic
Describes the diversity of a sample, that is, how many of a given type of thing
are contained in a sample of things. For instance, this distribution has been
used to describe the number of individuals of a given species in a sampling of
mosquitoes, or the number of parts of a given type in a sampling of inventory.
Logistic
Most often used a growth model: for populations, for weight gain, for business
failure, etc. Can also be used to test for the suitability of such a model, with
transformation to get back to the minimum and maximum values for the Logistic function. Occasionally used in place of the Normal function where exceptional cases play a larger role.
Log-Logistic
For Shape = 1, it resembles the Exponential distribution. For Shape < 1, it tends
to infinity at Location, and decreases with increasing X. For Shape > 1, it is zero
at Location, and then peaks and decreases.
LogNormal
Often used to represent the time to perform an activity (especially when there
are multiple sub-activities), the time between failures, or the duration of manual activities. This distribution is widely used in business for security or property valuation, such as the rate of return on stock or real estate returns.
Definition
Negative Binomial
Normal
The well-known Gaussian or bell curve. Most often used when events are due
to natural rather than man-made causes, to represent quantities that are the sum
of a large number of other quantities, or to represent the distribution of errors.
Pareto
Pearson Type V
Pearson Type VI
Poisson
Models the rate of occurrence, such as the number of telephone calls per minute, the number of errors per page, or the number of arrivals to the system
within a given time period. Note that in queueing theory, arrival rates are often
specified as poisson arrivals per time unit. This corresponds to an exponential
interarrival time.
Power Function
A continuous distribution with both upper and lower finite bounds. It is a special case of the Beta distribution with q = 1. The Uniform distribution is a special case of the Power Function distribution with p = 1.
Rayleigh
Frequently used to represent lifetimes because its hazard rate increases linearly
with time, e.g. the lifetime of vacuum tubes. This distribution also finds application in noise problems in communications.
Triangular
Usually more appropriate for business processes than the uniform distribution
since it provides a good first approximation of the true values. Used for activity
times where only three pieces of information (the minimum, the maximum,
and the most likely values) are known.
Uniform Integer
Describes a integer value that is likely to fall anywhere within a specified range.
Used to represent the duration of an activity if there is minimal information
known about the task.
Uniform Real
Describes a real value that is likely to fall anywhere within a specified range.
Used to represent the duration of an activity if there is minimal information
known about the task.
Weibull
Commonly used to represent product life cycles and reliability issues for items
that wear out, such as the time between failures (TBF) or time to repair (TTR)
for mechanical equipment.
These distributions and their arguments are described more fully in the Help of blocks that use
them.
How To
Distribution
689
690
Step
Summed
Integrated (delay)
2000
500
0.25
4000
500
1000
0.50
6000
1000
1500
0.75
8000
1500
2000
10000
2000
2500
How To
Summation occurs at each step so there is an amount calculated at time 0. Since summation
treats its input as an amount, the entire 2000 is added at each step.
The integrated (delay) choice treats its input as a rate and calculates a new result at the next
step. Because this backward Euler integration occurs during the interval between steps, there is
no amount at time 0.
The integrated (no delay) choice also treats its input as a rate. However, it calculates a new
result at the current step. Because its integration occurs at each step, there is an amount at time
0.
It is also important to note that if you subsequently change the delta time to something other than
0.25, the total amount in the summed Holding Tank would be different from the amounts shown
above, but the total amount in the integrated Holding Tank would remain the same.
Your choice of integration methods depends on the model:
You would generally use the integrated (delay) choice when there is only one integrating block
in the model, when the integrating blocks are not interdependent or cross-coupled, or when
there is no feedback.
691
In models with more than one integrating block, where the integrating blocks are interdependent or cross-coupled, the feedback between the blocks is usually a correction factor. If this feedback is delayed, the system may correct too late or overcorrect, causing the model results to
become unstable. This is often observed as a graph where the traces oscillate with increasing
magnitude as time progresses. The integrated (no delay) choice compensates for the feedback
delays by outputting results one step earlier. For example, the Predator_Prey model discussed on
page 74 is an example of interdependent Holding Tank blocks.
How To
How To
692
How To
Debugging Tools
Learn how ExtendSim can
help find errors in your models
694
Debugging Tools
Debugging hints
Creating a model is not so fool-proof that your work is finished once the model has been built.
Two important steps in any simulation project are verification of simulation results (compare the
results to what was intended or expected) and validation of results (compare the model to the real
system).
ExtendSim provides several methods for detecting problems in models and for debugging models
that are not working as expected, including:
Hints for debugging models
Debugging item flow using item Contents tab of queues and activities
Debugging equations in equation based blocks
Verifying results at each step of the model-building process
Specific blocks used for debugging
Getting the information you need to debug a model
Using the Find command to easily locate blocks or dialogs that require attention
Dotted lines to show unconnected connection lines
Running with animation to see if a model is behaving as expected
Using the Notebook to keep track of critical parameters in one location
Stepping through the model as it progresses
Show Simulation Order command
Model tracing for comparison with the real system
This chapter is concerned with debugging a model, not with debugging custom blocks. The
ExtendSim Developer Reference discusses in detail how use the ExtendSim Debugger to find bugs
in blocks you create.
Debugging hints
Efficient debugging of a simulation requires an organized, logical approach. Following the following steps will shorten the process:
How To
Duplicate the bug. Fix the random number stream so that the problem occurs the same way and
at the same time whenever the model is run.
Describe the bug. Defining the difference between the correct behavior and the observed behavior can lead to insight into the source of the problem. This also helps in formulating a strategy
for locating the source of the bug.
Assume the bug is yours. The vast majority of modeling errors are caused by the modelers themselves. It makes sense to start with the most likely source of the bug.
Divide and conquer. Determine the source of the bug. And, determine where the bug is not.
Build the simplest model that duplicates the error. This will make the model run faster and there
will be fewer variables to consider in the debugging process.
Think creatively. Bugs don't always come from the expected locations. If the source of the problem is not immediately evident, you may be looking at only a symptom. Look at other places in
the model that could be the actual source of the error.
Debugging Tools
Verifying results as you build a model
695
Leverage tools. ExtendSim comes with a variety of tools for debugging a simulation model. For
discrete event models, adding a History block (Item library) or Record Message (Utilities
library) block can provide insight into the operation of the model. In continuous models, writing a sequence of values to the ExtendSim Database or to a global array is an easy way to record
the values at a specific point in the model. Trace files are also useful at this point.
Start heavy debugging. Focus on the problem at hand and on how it can be fixed
Learn and share. This may be a problem that could occur in someone elses models. Share your
experiences with other modelers through the ExtendSim E-Xchange or the ExtendSim Academic E-Xchange as discussed in Additional resources on page 7.
Connector information
Connectors provide helpful information when you are debugging models. Run the model at any
point in the model building process. As the model runs, or at the end of a run, hover the cursor
over a connector to see its name and current value. You may also see additional information
depending on how the block is programmed.
Library
Use
Inputs/
Outputs
Displays the value of its input connector at each simulation step on the blocks icon and in the dialog. In the dialog, set the time between displays.
Notify
Value
Inputs/
Outputs
Statistics
Value
Statistics
History
Item
Information
Information
Item
Information
How To
Category
696
Debugging Tools
Measuring performance to debug models
Block
Library
Category
Use
Event Monitor
Utilities
Discrete
Event Tools
Find and
Replace
Utilities
Information
Discrete
Event Tools
Link Alert
Utilities
Discrete
Event Tools
Memory
Usage
Utilities
Information
Pause Sim
Utilities
Model
Control
Record Message
Utilities
Discrete
Event Tools
any plotter
Plotter
How To
You can clone dialog parameters to the model window or to the Notebook to create customized
reports and control panels, as shown in How to clone a dialog item on page 562.
Many of the blocks in the libraries have value output connectors that give direct access to specific information. For example, the U output connector on the Activity block outputs utilization
values. You can attach any value output to a plotter to display information about model performance. You can also attach value outputs to value inputs on diagnostic-type blocks, such as to
the Display Value block (Value library) to display information about that output.
Plotter blocks, from the Plotter library, conveniently display graphs and tables of data over time.
Plotters are useful not only for showing results but for identifying trends and anomalies. You can
choose what you want plotted and how you want it displayed, and you can use as many plotters
in a model as you want. See Plotters on page 663 for more information.
Animation shows the flow of items in a model, levels of values, etc. ExtendSim blocks have
built-in customizable animation; you can also add custom animation using the Animate tabs in
block dialogs or by using blocks from the Animation 2D-3D library. Animation is especially
useful for verifying a model since it can show if portions of the model are operating as expected.
Since animation can slow model performance considerably, it is common that you would use
Debugging Tools
Find command
697
animation in the early stages of model-building or for presentations. See Animation features for
debugging on page 705 for more information.
There are numerous blocks that can be used for debugging models and verifying results. For
instance, the Notify block (Value library) can stop the simulation and notify you when its input
goes above or below a specified level. The Information block (Item library) provides information
about the output of the block it is connected to (the interval between arrival times, how many
items are currently present at the output, and so forth).
Sensitivity analysis allows you to vary a parameter incrementally, randomly, or in an ad hoc
manner to determine how sensitive model results are to changes in one variable. See Sensitivity
analysis on page 628 for more information.
Running simulations multiple times, such as for Monte Carlo simulations, gives ranges of values
indicating the possible outcomes for the model. See Running a model multiple times on
page 580 for more information.
The Run > Generate Report command, discussed in Model reporting on page 707, instructs
ExtendSim to generate a text file of the final model results. You can report on all the blocks in a
model, or use menu commands to specify which blocks are included in the report. Reports are
especially useful for outputting to other applications, such as statistics packages, for further analysis.
The Statistics block (Value library) reports and statistically evaluates results. For example, it can
display information about every queue-type block in the model and calculates the confidence
intervals based on the results. As discussed in Clear Statistics on page 626, the Clear Statistics
block resets statistical accumulators at random intervals or in response to a system event; this is
used to eliminate statistical bias during the warm-up period.
Find command
If a model is large, it might be difficult to find all the blocks
by sight. For example, you may see in the Trace file that a
particular block didnt get the expected input. The Edit >
Find command lets you locate a block by its global block
number, name, label, or category, or find a text block by its
global block number or by the text within it.
How To
The Utilities library contains two blocks that are useful for debugging discrete event models.
The Record Message block, when connected between two value connectors, shows all of the
messages, the values transferred, and whether the message came in the input or output connector. The Item Messages block records the message communication between two item connectors. See Messaging in discrete event models on page 305 for a detailed discussion of the itembased messaging system.
698
Debugging Tools
Item Contents of queues and activities
defined by the user in the block dialog and are especially useful to find types of blocks. Category
refers to how the block is classified in the Library menu (e.g. Inputs).
The debugging blocks described above list the global block number in case you have many copies
of a block in the model. Use global block number and the Edit > Find command to quickly scroll
to a block and select it.
You can also use the Find and Replace block, listed in the table of debugging blocks above, to find
blocks. It is even more useful for finding specific dialog items in the located blocks, so you can
replace their parameter values.
How To
Debugging Tools
Item Contents of queues and activities
699
Historical Log Mode: Conversely, when the historical log mode has been selected, the table
displays all items that entered and exited the block during the simulation run. That is to
say a unique row will be "permanently" dedicated to each entering item.
Display contents: This popup is displayed only when the current contents mode has been chosen.
It contains three options including:
During run: The default, will update the contents table dynamically during the run.
Only on snapshot: Lets you click the snapshot button while the model is running in order
to display contents at the time the button was clicked. Note there is a field that will record
what time the snapshot was taken.
End of run: Will display any items that are present in the block at the end of the run.
Control log time: This checkbox is displayed only when the historical log mode has been chosen.
If this box is checked, start time and end time fields appear allowing you to control the window
of time during which log information will be collected.
Queue blocks
Contents
"Queue Type" blocks refer to the Queue, Queue Equation and Resource Item blocks. When they
are in current contents mode, the first 2 columns of the contents table are fixed. However, clicking
the green "+/-" resize button allows you to add more columns in order to track any number of
additional attributes.
Entry Time: records when an item entered the block.
Item Quantity: shows how many items the current item represents.
Items with a quantity greater than 1 are represented in one row of the contents table. When the
next item to leave the queue is a clone of the parent item, you will see the item quantity for original
item decrement by 1. Not only does this save on the memory allocated to the contents table, but
it also is a true representation of how items with quantities greater than 1 are handled inside the
queue.
How To
Historical Log
In historical log mode, the first two columns of the Queue Equation and Resource Item blocks are
fixed while the Queue block's first three columns are fixed. Clicking the green "+/-" resize button
allows you to add more columns in order to track any number of additional attributes.
700
Debugging Tools
Item Contents of queues and activities
Activity blocks
Contents
When the Activity is in current contents mode, the first 5 columns of the table are fixed. However,
clicking the green "+/-" resize button allows you to add more columns in order to track any number of additional attributes.
Entry Time: records when the item entered the block.
Shutdown Status: will show an item's shutdown status; a 0 when an item is not shutdown and a
1 when it is.
Shift Status: will show whether the item's shift status; a 1 for on-shift and a 0 for off-shift.
Time Down: will record how much time the item spent in a down state from both shutdowns
and off-shifting.
Finish Time: is the time the item finished processing. If an item does not have a value in the Finish Time column, then the item is still in processing. In current contents mode, since items are
removed from the table when they leave, if a finish time appears for an item that means it has
been blocked from leaving due to a downstream bottleneck. Otherwise, the item that has finished its processing time simply would not show up in the current contents table.
How To
Historical Log
When the Activity is in historical log mode, the first 5 columns of the table are also fixed, but two
of the columns differ from those found in the current contents table. The Entry Time, Time
Down, and Finish Time columns hold the same type of information that the current contents
table holds. The Exit Time column displays what time an item left the block. If a particular item
has a value in the Finish Time field but no Exit Time has been logged, then the item is currently
blocked from leaving. The Exit Point column describes how the item left the block; "Normal"
means the item left via the itemOut connector, "Preempt" means the item left via the prememption connector.
Debugging Tools
Item Contents of queues and activities
701
Close Selected Blocks: Much like the Open Selected Blocks button, clicking this button will close
the block dialogs of the blocks that have been selected in the navigator table.
Navigator Table: Each row appearing in this table represents a block currently residing in the
model. The number of blocks appearing in this table may be filtered using the filtering conditions that have been described above. Select column 1 of the table is a checkbox column allowing you to select certain blocks appearing in this table. This column's header has a popup which
allows you to select all, select none, or toggle the current selections. Selecting a particular block
in this column allows you to do other things to that block like open and close the selected
block's dialog or switch its contents tracking mode. Block Label column 2 will display the
How To
Open Selected Blocks: Clicking this button will open the block dialogs of the blocks that have
been selected in the navigator table. To select a block in the navigator table, check the associated
checkbox found in the first column of the navigator table.
702
Debugging Tools
The Source Code Debugger
block's label (or the block's name if the block does not have a label) as well as the block's global
number. On/Off column 3 has a popup in its header allowing you to either "turn all selected
on" or "turn all selected off". Choosing the former will turn content tracking on for all blocks
that have been checked in this column of the navigator table. Choosing the later will turn content tracking off for all selected blocks. Mode column 4 allows you to specify whether a given
block will do current contents tracking or historical logging. This column's head has a popup
which allows you to "Set all selected to Current Contents" or "Set all selected to Historical Log".
If either option is selected, it will be applied to any blocks that have been selected in the column
1.
Apply properties to selected blocks: Clicking this button will add the properties specified in the
properties table to the blocks that have been selected in the navigator table.
Debugging equations
The equation-based blocks allow you to enter equations that are simple logic statements (if x, then
y) or complex calculations that control the model using ModL functions. While in many cases you
wont need to debug the equation, ExtendSim provides an equation debugger so you can determine if equations are performing as expected. This works like the Source Code Debugger ExtendSim developers use, but it is specific to the equation-based blocks used by many modelers.
The equation debugger allows you to:
Set breakpoints for equations. A breakpoint is where the debugger initially stops execution of the
equation so you can step through the code.
Set breakpoint conditions for equations. Setting a breakpoint condition causes the breakpoint to
stop execution only under certain circumstances.
How To
Step through lines of code and examine the variables. Step commands allow you to trace the execution of the equation and examine the effects on the variables defined in the code.
Although the following tutorial uses a continuous model, the equation debugger can be used with
any of the equation-based blocks. For a list of equation-based blocks, see Equation-based blocks
on page 677.
Setting breakpoints
To step through each line of code, it is first necessary to stop the code execution. In this example, it
requires placing a breakpoint before the if statement at the beginning of the equation:
Debugging Tools
Debugging equations
703
In the dialog of the Equation block, check the Enable Debugger check box
Click the Set Breakpoints button
This recompiles the equation in debugging mode and opens two windows:
The Set Breakpoints window is where you set the breakpoints
The Breakpoints window lists the breakpoints that have been set. It is used later in this tutorial,
for Setting a conditional breakpoint on page 704.
If you click at the wrong line of code, just click it again to remove the breakpoint.
Close the Set Breakpoints window.
Run the simulation. The simulation will run until the breakpoint is reached.
Stepping through the code
When the breakpoint is reached, the Debugger
window opens.
In the Source pane at the bottom of the window,
a green arrow is placed at the left of the breakpoint. This indicates that the code before the
green arrow has been executed.
How To
704
Debugging Tools
Debugging equations
The Call Chain pane at the upper left tells where control is in the chain of command. It is not
used for debugging equations unless there are blocks in the model that have debugging code.
The if statement has not yet executed. To watch the statement execute:
Repeatedly click the Step Over button at the top of the Debugger window; the button is
shown on the right. Alternatively, use the right arrow to step over the function.
The green arrow in the Source pane indicates the flow of the code; the Variables pane shows the
change in value for the variables.
Hovering the cursor over a variable in the Source pane will also show its current value.
Getting to the overflow calculation
The next step is to set a breakpoint to find out
when the overflow value first gets calculated.
In the Debugger window:
at the top of
the Debugger window. or use Shift+right arrow.
Although the breakpoint is set at the overflow calculation line, the green arrow indicates that the calculation has not yet been performed. Thus the
overflow value will not be current.
In order to see the current overflow value:
How To
Breakpoint window
Debugging Tools
Dotted lines for unconnected connections
705
Remove the existing breakpoint by clicking its red circle in the Debugger window.
Add a new breakpoint to the Debugger window after the entire if and else statement;
in this case at the ending brace that is below the overflow = 0.0 statement.
The next step is to write a comparison statement that will compare the overflow value to zero.
Click OK
Notice that the breakpoints red circle in the Debugger window has changed to a half circle, indicating
there is a condition on the breakpoint.
The finished Conditional Breakpoint window
Since you have set conditions, and you want to find
the first time the condition is met, the calculation
must start again from the beginning. To start the run over:
Click the red Stop Executing button on the Debugger window. This closes the window and
stops the model run.
Run the simulation. The first overflow value will be displayed in the Variables pane.
As an additional exercise, try using different values for the overflow condition, such as 2.0, to see
when that value first appears.
Advanced modelers might benefit from reading about the Source Code Debugger in the Developer
Reference.
How To
Incomplete connection
706
Debugging Tools
Notebook
To learn more about how models, blocks, and connection lines are animated see Animation on
page 609.
Notebook
The Notebook is a convenient way to see the final values for several dialog items in a model or to
compare inputs to outputs. This is useful in debugging because you can group the dialog items by
what their final values are expected to be.
For more information, see Notebooks on page 566.
How To
Instead of using the Pause command, you can use the Pause Sim
The Step Entire Model, Step Next Animation, and Step Each Block commands in the Run >
Debugging menu tell ExtendSim how far to go when the Step button is clicked after pausing.
The Step Entire Model command starts at the selected block and runs until that block would be
executed again. This is a good way to examine what happens in the intervals between when a
block is called.
If you have animation turned on, the Step Next Animation command tells ExtendSim to step
until the next animation change. In models where there are many steps between animation
changes, this option makes going from visible change to visible change much faster.
The Step Each Block command causes the Step button to simply go to the next block. It is usually used in conjunction with the Show Block Messages command, otherwise what is happening
in the model will not be apparent.
Debugging Tools
Show Simulation Order command
707
If you select Run > Debugging > Show Block Messages when you are stepping through a simulation run, the block that is active will be highlighted with the current message name written on it. If
that block is not currently visible, the window will automatically scroll to the block if Scroll To
Messages is checked. You can also choose to only show the On Simulate messages.
The Run > Debugging > Pause at Beginning command automatically pauses the simulation after
the initial model processing (initialization, error checking, etc.) but before the first step. This gives
you a chance to step from the very beginning without having to guess when to click the Pause button.
Model reporting
The report commands in the Run menu are for generating customized reports of data to help
debug models. However, model tracing (discussed in the next topic) can offer more detailed information so you will probably use that option more for debugging, and the reports option for analysis.
Model tracing
Model tracing is useful for finding anomalies that occur as the simulation runs. The model tracing
commands act like the reporting commands, but the output is much more extensive. A trace text
file shows the details of block values at every step or event in the simulation.
Because of the large amount of information generated by the model tracing commands, most people dont use model tracing often. However, tracing is a highly effective method for following a single block or a few blocks to watch for values that do not match expectations.
The trace is saved as a text file and opens automatically at the end of the run. If the Runs field in
the Simulation Setup dialog is greater than 1, each consecutive trace is added to the end of the file
so that you can compare traces from earlier runs.
How To
To learn more about how to generate reports in ExtendSim, see Reports on page 671.
708
Debugging Tools
Model tracing
Generating traces
The tracing commands are located in the Run >
Debugging menu. To generate a trace:
Tracing commands
Choose the Run > Debugging > Generate Trace command to create a trace the next time you
run the model.
Run the simulation to see the trace results. ExtendSim prompts you for a name and location for
the trace file. Trace reports are opened, closed, and edited just like any other text file in ExtendSim.
To trace fewer blocks in the next simulation run, select the blocks you want out of the trace
report and select Remove Selected from Trace. To start over on the selection of blocks, choose
Remove All from Trace.
You can see which blocks are included in the trace by choosing Show Tracing Blocks; each traced
block in the model displays the word Trace on its icon.
Tracing example
For the Math block from the Reservoir 1 model, the top of the tracing report is:
ExtendSim Trace - 9/16/2012 3:48:57 PM
Run #0
### calculation at Math number 2. CurrentTime:0.
ValuesIn = 2.6
ResultOut = 3.1550072961999
----------------------
Step #1
-----------------------
How To
CurrentTime:1.
ValuesIn = 4.4
ResultOut = 5.3917648062033
----------------------
Step #2
-----------------------
CurrentTime:2.
ValuesIn = 6.7
ResultOut = 7.1088551154443
----------------------
Step #3
-----------------------
CurrentTime:3.
Debugging Tools
Model tracing
709
If you build your own blocks and want to use the Trace features for debugging, add special code to
the blocks, as described in the Developer Reference.
How To
How To
710
Debugging Tools
Model tracing
How To
712
ExtendSim provides a variety of standards-based options for managing and sharing data internally
and with other applications. This chapter covers:
User interfaces for exchanging data within ExtendSim and between ExtendSim and external
data structures:
Copy/Paste
Importing and exporting
Read, Write, and Query Equation blocks
DDL to dynamically link to internal data structures
DDE links to external data structures
Internal structures for storing and managing data
ExtendSim databases
Global arrays
Dynamic arrays
Embedded objects
Linked lists
Exchanging data with external applications
Blocks for accessing and managing data
How data source types are indexed and organized
Transferring data between ExtendSim and devices
Standard communication technologies:
Text files
ADO
DDE
ActiveX/COM/OLE
ODBC
How To
713
The flow of data can be one-directional or two-directional. With two-directional data flow, a
data change at the source affects data at the target and a change at the target affects data at the
source. One-directional data changes at the target do not affect the source.
Some methods require that two windows be open at the same time. Copy/Paste requires only
one window; you do not need to leave the ExtendSim dialog or application file open once the
data has been copied. On the other hand, DDE linking requires that windows in both ExtendSim and the other application be open to complete the process.
A communication method that has live links sends a data update message along with the data.
This means that as soon as the data at the source changes, the target is dynamically notified and
can take the appropriate actions to react to the new value.
Dynamic data linking is only used to access ExtendSim internal data structures, such as ExtendSim databases and global arrays. Other methods can be used either internally or externally (for
instance, copy/paste from one ExtendSim dialog to another or copy/paste from ExtendSim to
Excel).
The information is summarized in the following table.
Interface
See Page
Data
Direction
Open
Window(s)
Required
Live
Link
ExtendSim or
External
Application
Copy/Paste
713
One way
No
Both
Import/Export
714
One way
No
Both
Read/Write blocks
716
Two way
Possible
Both
717
One way
Yes
Internal
724
Two way
Yes
External
Most of the above methods are supported by an underlying industry-standard technology, as discussed in Data source indexing and organization on page 760.
Copy/Paste
How To
The Clipboard is useful for passing information within ExtendSim and between ExtendSim and
other applications on the same computer. The copy/paste action can occur before a simulation
run, after the run, or when the simulation is paused. While the Edit menus Copy, Paste, and
Duplicate commands work the same as in most applications, there are a few items you should
note:
714
To paste data into a data table or database table, click in the upper left corner, in the upper
left cell, or in a desired starting cell and give the command Edit > Paste Data. The table
cells will be populated downward to the extent of the data in the Clipboard or the number
of rows in the data table.
When an ExtendSim database or database tables are selected, the Copy Database/Paste Database
commands provide a convenient method to copy an ExtendSim database or tables from one
model or one database to another. The command Edit > Duplicate Database is useful for duplicating an ExtendSim database within a model, so you dont have to create a new database structure.
Regarding Allow data table titles copying in the Edit > Options dialog:
This option is off by default, because you typically would not want to also copy table titles
when copying data from a data table.
To also copy row and column titles when copying tables from Plotter blocks, select the
option Allow data table titles copying in the Edit > Options dialog. ExtendSim will
prompt for the titles to be copied. This is helpful when you are copying into a word processing program for presentation.
How To
715
1) The File menu has Import Data and Export Data commands for exchanging data using text
files, as shown in the example that follows.
2) The Data Import Export block (Value library) enables ExtendSim databases or global arrays to
directly import data from or export data to spreadsheets, external databases, or an FTP site.
Use of this block is described in detail on page 759.
3) Read and Write blocks (Value library) can import or export text files, ExtendSim database
tables, global arrays, or Excel worksheets as a local copy. See Read and Write blocks on
page 751.
4) You can use Database menu commands to:
Create a new, or replace an existing ExtendSim database from an imported database text
file. The text file can be generated by a different ExtendSim database or by an SDI Industry database.
Export an entire ExtendSim database as a text file. The file can be imported into a different
ExtendSim database in the same model or in a different model
Import tables from an ExtendSim or SDI Industry database as text files to an ExtendSim
database.
Export tables as text files from an ExtendSim database to a different ExtendSim database.
5) Among other capabilities, the ExtendSim DB Add-In for Excel works with database text files
to transfer data between an ExtendSim database and Microsoft Excel. It is described fully starting on page 740.
How to import data using the File menu
The example that follows uses a menu command to import a text file of data into the Reservoir
model that was discussed in the Tutorial module. The imported data will be used as the monthly
rainfall values. The steps are:
You must select the table column(s) to enable the Import Data or Export Data menu commands.
Give the command File > Import Data.
For Windows, choose Files of type: Text File as the type of file to open.
Find and open the Rainfall.txt file, located in the folder \Examples\How To.
How To
716
Since you are only importing one column of data, in the delimiter dialog (shown on the right) click OK to select the default
settings and import the data. (Delimiter settings are discussed
later in this section.)
This action replaces the data that had been in the Rain (inches) column with a local copy of the source data. This exchange is one-directional and not live; if the data in the originating text file is
subsequently changed, the text file must be re-imported to affect the
change in the block.
Use this same process to import data into any data table, ExtendSim
database table, or global array that is linked to a data table.
Delimiter dialog
How To
To also copy row and column titles from Plotter blocks, select the option Allow data table titles
copying in the Edit > Options > Miscellaneous tab. ExtendSim will prompt for the titles to be
copied. This is useful when exporting to a word processing program, but including titles could
cause data errors if the text file is imported into a spreadsheet or an ExtendSim table.
Where to get more information
For more information about:
Creating, saving, and using text files, see Text files on page 761.
How to import and export data using the Data Import Export block, go to page 759.
Read and Write blocks, see Read and Write blocks on page 751.
717
ing and writing are the Read and Write blocks in the Value library and the Read(I) and Write(I)
blocks in the Item library. The Read and Write blocks read data from or write data to ExtendSim
databases, global arrays, Excel workbooks, and text files. The Read(I) and Write(I) blocks read data
from or write data to ExtendSim databases.
The Query Equation and Query Equation(I) can use an equation to search an ExtendSim database
table for the highest ranking record available during the run.
These blocks are powerful tools for reading data from internal and external sources and writing
data into internal or external data destinations.
In contrast to the importing/exporting described above, the Read and Write blocks are usually
used to exchange data piece-by-piece as required during the run, rather than by one exchange of
the entire data set. Even though it may slow simulation speed, models may need to write and
read data while a model is running if the data that is written is in turn read and used in another
part of the model.
The Read and Write blocks can create a one-way live link between the target and the source. If
you write to a location in an ExtendSim database or global array, ExtendSim will send update
messages to all the Read blocks in the model linked to that location. When the Read block
receives the alert message, it will act on the fact that the data value changed, making the link
'live'. Writing to a cell in an Excel spreadsheet, or to a text file, will not have the same effect.
A potential disadvantage of using the Read and Write blocks is that reading and writing the data
each time the block is calculated can have an impact on simulation speed. If the data to be read or
written will not change over the course of the simulation, you should import/export the data as a
local copy in the block before or after the run. If the data is not going to change at all, consider
using another method, like a one-time copy/paste or import/export.
For more information, see Read and Write blocks on page 751 and Query Equation and Query
Equation(I) blocks on page 752.
Dynamic data links are live and bidirectional, so the value of a linked dialog item can change
immediately when the value of the data source changes, and vice versa.
You can use menu commands to dynamically link a dialog parameter or data table to an ExtendSim database or global array. The clone of a parameter or data table can also be dynamically linked.
Linking a clone has the same effect as linking the original dialog item - both the original and the
clone will be linked to the data structure.
How To
718
The sections that follow show how to create a dynamic link between dialog items (parameters and
data tables) and internal data structures (ExtendSim database tables and global arrays) through the
user interface. To learn how to use ModL code to dynamically link dialog items to internal structures, see the Developer Reference.
There is overhead associated with the process of accurately updating a linked dialog item with a
data structure. If you overload a model with links that frequently change, the models performance
can suffer. Consider the following suggestions: 1) Just link the data that is important to a model
and not link every piece of data to every possible source. 2) Import values into a Read block (Value
library) for use in the model, so they dont have to be continuously updated. 3) Send or receive link
alert messages only at the start or end of the simulation as discussed in Link dialog checkboxes
on page 722.
Linking a parameter to an internal data structure
Unless it is already linked for sensitivity analysis (see Sensitivity analysis on page 628) or through
the DDE link feature (see DDE links (Windows only) on page 724), a dialog parameter can be
dynamically linked to a specific cell of an internal data structure.
Parameter fields that are dynamically linked to an internal data structure are outlined in light blue.
(Parameter fields are outlined in green for active sensitivity analysis, red for inactive sensitivity
analysis, and yellow for DDE linking (Windows only) to an external application.)
How to link a parameter to an ExtendSim database
The following example uses the Reservoir 1 model from the Tutorial module. It describes how to
dynamically link the Holding Tanks Initial Content parameter to a cell in a database.
How To
Or, right click the Initial contents parameter field and choose Create/Edit Dynamic Link.
In the Link dialogs top popup menu (shown at
right with its default setting of No User-Defined
Link) choose Link to: Database Table.
719
Click the Link button to close the dialog and establish the link.
Save the model.
In the Holding Tanks dialog there is now a light blue frame around the Initial contents parameter, indicating that the field is dynamically linked. Mousing over the parameter field displays the
source and location of the linked cell. To open the Link dialog for viewing or changing the linked
settings, click in the parameter field and give the command Edit > Create/Edit Dynamic Link.
When the simulation is run the Reservoir will start with an initial contents of 25 inches; it gets
that value from a live link with the database.
Since the link is a live link, changing the value of the Initial contents parameter in the Holding
How To
Tank will change its record in the database table, and vice versa. If you do not want that behavior,
select the Read Only option in the Link dialog.
720
Or, right click the Initial contents parameter field and choose Create/Edit Dynamic
Link.
In the Link dialogs top popup menu choose Link to: Global Array.
In the popup menu that appears, select Array
name: Example Array 1. (The Reservoir 1 model
already had a global array, so you can concentrate
on learning how to create a dynamic link. For
information on creating a global array, see How
to create and use a global array on page 744.)
Since this is a two-way live link, changing the Initial contents parameter in the Holding Tank
will dynamically change the value of its record in the database table. To disable that behavior, select
the Read Only Link checkbox in the Link dialog when you create the link.
How To
721
In the ReservoirDBLink model you created on page 720, open the Lookup Table blocks dialog.
Open the Link dialog either by clicking the Link button in the lower left corner of the data
table or by selecting the data table and giving the command Edit > Create/Edit Dynamic Link.
How To
Since this is a two-way live link, changing the value of one or more cells in the blocks data table
722
Since the link is a two-way live link, changing the value of one or more cells in the blocks data
table will change the values in the global array, and vice versa. If you do not want that behavior,
select the Read Only option in the Link dialog.
When the Link dialog is first opened, the Link To popup menu displays the current linked data
How To
structure (if the parameter or data table is already linked), or the term No User-Defined Link (if
it is not linked).
The Link To popup menu has three options: No User-Defined Link, Global Array, and Database
Table. The No User-Defined Link setting is informational only. The Database Table and Global
Array options are active options for changing, or adding, a dynamic link to the parameter or data
table. If you select either of those options, the dialog displays additional popup menus and fields to
further define the data source.
A parameter or data table can only have one data source; if you change the option in the Link To
popup menu, the previously linked data source will be unlinked.
Link dialog checkboxes
Outside of a simulation run, blocks receive messages whenever dynamically linked data changes at
the source. To maximize simulation speed you may not want these update messages sent during
certain phases of a run. As shown on page 719 and page 720, when the Database Table or Global
Array option is selected in the Link dialog, the dialog displays four checkboxes:
723
Init messages
Sim messages
Final messages
Read-Only link
These allow you to control the links data update behavior, as discussed below.
The first three link options (Init messages, Sim messages, and Final messages) control whether or
not blocks receive update messages when linked values change during specific points in a simulation run. For example, the Init messages option determines whether a block receives a message if
a linked value changes during the InitSim message.
These three options default to on. Turning an option off prevents ExtendSim from sending data
update messages to the linked blocks if the data source is updated during that phase of the simulation. For example, if you know the dynamic link only updates during the FinalCalc message, it will
reduce the messaging and speed up the simulation to turn off the Init messages and Sim messages
options.
When the Init messages and Final messages options are turned on, linked blocks will receive an
additional message during InitSim and/or FinalCalc, causing an update of the linked dialog items
during those phases.
The fourth checkbox is the Read-Only link option, which is off by default. If checked, the linked
data can only be changed from the data structure side. In that case, you will not be allowed to edit
the parameter or the data table directly and the live link is only one-way (from the internal structure to the data table or parameter.
Use these options carefully, since they can dramatically change linking behavior. You would probably only want to uncheck a message option (Init messages, Sim messages, or Final messages) if you
are sure that the source data wont change during that message.
Finding linked dialog items
The command Edit > Open Dynamic
Linked Blocks opens the Find Links dialog, shown on the right. This is useful for
examining and locating linked dialog
items.
When the Find Links button is clicked, ExtendSim opens the dialog boxes of all the blocks with
the specified types of links.
How To
724
If the model is large and you specify all types of links this command can open many block dialogs.
It is usually advisable to search for specific types of links, so as not to have more dialogs open than
needed.
link between the two applications. ExtendSim supports two types of DDE links:
1) As a client application, importing data into ExtendSim by linking an external applications file
to an ExtendSim model.
2) As a server application, exporting data from an ExtendSim model to an external file.
The external application and ExtendSim communicate with each other in a type of data conversation, with one application (the server) sending the data and the other application (the client)
responding. A DDE link is a special registered Clipboard format that identifies the piece of data in
the conversation. These are hot links, causing the server to simultaneously notify the client of the
change and send the changed data to the client whenever the value of the specified data item has
changed.
This communication is unidirectional; data changes made in the server file affect the client file, but
not vice versa.
The underlying technology that supports DDE linking is Dynamic Data Exchange (DDE), a
Windows operating system protocol through which applications can exchange data. It is described
fully at DDE (Windows only) on page 765. Microsoft Excel is an example of an external application that support DDE links.
For data to be exchanged, DDE linking requires that the windows of both the server and the client
files be open.
How To
To create an outgoing link from ExtendSim, use the Edit > Copy command in ExtendSim and
the external applications linking commands, such as Paste Special.
To create an incoming link to ExtendSim, use the Edit > Paste DDE Link command. This command will only be active if all of the following is true:
The external application supports DDE links.
Both the external file and the ExtendSim model have been named and saved.
Both the external file and the ExtendSim model are open.
The Clipboard contains data that has been copied from the external application.
You have selected a location in the ExtendSim model to paste to.
Parameters or cells that have been linked with this command are outlined in yellow. ExtendSims
DDE links are saved with the model. When the model is opened, ExtendSim will attempt to reestablish the associated links.
An Excel worksheet embedded in an ExtendSim model can also be linked to ExtendSim data via
the Paste DDE Link command.
725
In Excel:
Open a new workbook.
Enter the value 10 at row 1, column 1.
Save the workbook as My Workbook.
The workbook must be named and saved before the data is copied.
Copy the value (10) from cell; this places a 10 in the Clipboard.
Leave the Excel workbook open!
In ExtendSim:
Open the Reservoir 1 model located at \ExtendSim9\Examples\Tutorials.
So that you dont overwrite the original file, save the model as ReservoirHotLink.
In the Holding Tank block, click in the Initial contents parameter field.
Give the command Edit > Paste DDE Link. A yellow outline appears around the parameter
field, indicating that the link has been created.
In the Holding Tanks dialog, click OK to save changes and close the dialog.
When you open the Holding Tanks dialog, the number 10 is in its Initial contents field. Mousing
over the field shows the location of the originating data.
How to create a DDE link from ExtendSim
To export data from an ExtendSim model to another application:
cally, you would choose Paste Special or Paste Link from the client applications Edit menu.
Any changes made to the parameter in ExtendSim will now be reflected in the other application.
To remove the link, refer to the other applications documentation.
Managing DDE links
To change a linked value, change the value in the Excel workbook, then save the workbook. For
instance, the Holding Tanks Initial contents value in the previous example will change once the
value in My Workbook has been changed and the file has been saved. To remove linking from a
parameter, use the Edit > Delete DDE Link command.
The Show DDE Links command opens all the dialogs that are linked using that technology in a
model. If linked applications are open and the links dont appear to be working correctly, or if the
How To
In ExtendSim:
Open a model.
Select the dialog parameter or data table values you want linked.
Select Edit > Copy.
Refer to the other applications documentation to determine how to create a DDE link. Typi-
726
server application has been closed, the Refresh DDE Links command attempts to reestablish existing links between ExtendSim and the external application.
If you directly change the value of an ExtendSim parameter or cell that has been linked, the field
will still be outlined in yellow but the model will use the value you entered instead of the link
value. The model will automatically refresh the link if the DDE value is changed and the external
file is saved.
Updating remote references
Creating a DDE link works in a fairly straightforward manner with the following exception: Excel
doesnt support reconnecting links in embedded objects when they are reopened by default. There
is an option called Update Remote References in Excels Options dialog that will enable this behavior. The following Excel VBA macro will turn this flag on:
Private Sub Workbook_Open()
With ThisWorkbook
.UpdateRemoteReferences = True
End With
End Sub
Unfortunately the value of this option does not seem to be saved in embedded Excel worksheet
objects. This means that the macro above should be used in worksheets that are embedded into
ExtendSim models if they use DDE link connections to share data with ExtendSim.
How To
727
Each model can have multiple databases associated with it and each database can contain multiple
tables of data. Each table has fields that represent columns of data, records that represent rows, and
cells that are the intersection of a field and a record.
Following the standard convention for databases, ExtendSim databases are organized by field and
record (similar to being organized by column and row.) However, data tables, arrays, and external
spreadsheets are organized by row and column. This is important to remember if you transfer data
between ExtendSim databases and other data structures such as global arrays.
ExtendSim databases are stored with the model. They automatically open when the model opens
and are automatically saved or closed when the model is saved or closed.
Using ExtendSims data access blocks or the dynamic data linking interface you can link model
parameters to a database without writing any code. In this manner, parameter-based models can be
easily changed to database-driven models.
How To
Separate the data from the model for better project and experiment management.
728
How To
So that you dont overwrite the original file, save the model as ReservoirDB.
729
The name can be anything you want as long as it does not start with
an underscore (_), is not used by another database, and does not exceed 63 characters. Database
names are not case sensitive; they can contain spaces.
The underscore character as the first character of a database name designates that database as a
Reserved database. Reserved databases are used by developers and are hidden from the user. See the
Developer Reference to find more information about Reserved databases.
Click Save to close the dialog and save the new database.
The database window opens in structure mode, as
shown at right. The
header for the window displays the
name of the database and its associated model. The
structure window is Database window
where you create
database tables, add fields to the tables, and create relationships between fields.
How To
With the database window active, create a new table using one of these methods:
Give the command Database > New Table.
Or, right click on the database window.
Or, click the New Table button in the databases toolbar.
In the dialog that opens, name the table My Table and click Save.
730
How To
731
How To
732
Draw a line from a connector point for My Field to a connector point for Contents.
Draw the line so the arrow points to the parent, the source of the data.
Since the child field has existing data, the Parent/Child Relationship dialog opens with options
for how the data in the child field should be handled.
In the Parent/Child Relationship dialog, select the default (top) choice and click Set Relationship. (The dialog is discussed later in this section.)
This establishes the Contents field as a parent to
the field named My Field. Parent fields have a
red background and are listed in red; child fields
have green backgrounds and are listed in green.
Select My Table in the table list pane at the left of the All Tables tab.
Click the arrow in record #1.
In the popup selector that appears, select the value 15.
How To
The child cell for field 1, record 1 is now set to 15; it gets that value from the parent field. If the
parent value changes, the child value will change (but not vice versa.)
The Child popup selector
In Viewer mode, when you click the
down arrow in a child cell it displays a
popup menu with 3 types of options.
The choices are to select a value
(whichever number is listed), add a
new value, or choose no value yet.
Choosing new value allows you to
place a new value in the cell; the value
is appended to the parent field. The
no value yet option leaves the cell
blank.
Child popup selector
733
How To
734
How To
Database usage is clarified visually. For example, instead of a blue outline around a parameter
field inside a blocks dialog, it is more obvious when the database value is coming from a Read
block.
Dynamic linking is fixed point-to-point. While you can change the value at the data source, you
cant dynamically control which database or table is accessed during a simulation run or in a
series of runs.
In some blocks there is no dialog parameter or data table you can directly link to,
It is easier to perform mathematical calculations on the database values.
The data can be more easily accessed at several places in the model.
It is more convenient for hierarchical blocks, allowing access to a different record for each
instance of the hierarchical block in a model.
The Monte Carlo model, located at \Examples\Continuous\Standard Block Models and described
on page 47 is an example of using Read and Write blocks to exchange data with an ExtendSim
database. For more information about these blocks, see Read and Write blocks on page 751.
735
Database management
This section provides additional information about using and managing ExtendSim databases,
database tables, fields, records, and data.
Opening a database window
To open a databases window so that you can change its structure or data, do one of the following:
Select the database from the databases listed at the bottom of the Database menu.
Or, open the Navigator, select its Database List mode, and double-click the name of the database in the list.
Or, select Window > Database List to open the Navigator in Database List mode, then doubleclick the name of the database in the list.
Opening a database list
To access the Database List, give the command Window > Database
List. The database list is used to open a database or when copying,
renaming, or deleting a database.
Copying, renaming, or deleting a database
To copy or duplicate a database, select it in the database list and give
the command Edit > Copy (or Duplicate) Database. Give the Paste
command in the database list or on the model worksheet; you can
paste into the current model or a different model. Pasting or duplicatDatabase list
ing places a copy of the database in the database list with a different
index number and a modified name (if the database is copied into the
same models Database List) or with the same name (if the database is copied into a different
model).
Giving the Paste command on the model worksheet places a copied ExtendSim database in the
Database List and makes it available to the model. It does not put a visual representation of the
database on the worksheet.
To move a database from one model to another, select the database in the Database List and use
the Edit > Cut Databases command, then paste the database into the other model.
How To
To rename a database, select it in the Database List and give the command Database > Rename
Database. To delete a database, select it in the Database List and give the command Edit > Clear
Database.
736
How To
Exported databases can only be imported to ExtendSim or to the ExtendSim DB Add-In for Excel.
Managing database tables and using tabs
Tabs are useful for organizing tables by category.
The All Tables tab will always contain a list of
all of a databases tables in its table list pane. You
can also list some of those tables in other tabs.
The database window must be in structure
mode to add a tab. To create the tab, either double-click the blank area of the tab bar (that is, to
the right of the All Tables tab) or give the command Database > New Database Tab. Clone a
table to the new tab by selecting the table in the
tables pane and giving the command Database >
Clone Selected Tables to Tab. In the dialog that
appears, select a tab to clone the table to.
Import and append tables into the current database by giving the command Database > Import Tables when a databases window is open. This
imports a database text file of tables from an ExtendSim or SDI Industry database.
Export selected tables by using the Database > Export Selected Tables command. The tables can be
exported as text files from one ExtendSim database to a different ExtendSim database.
To show/hide tables in the tables pane, unselect the table in the list of tables in any tab in the database window.
737
To copy a table from one database to another, select the table in the database window, give the
command Edit > Copy Tables, and paste the table into the same or a different databases window.
To move tables from one database to another, use the Edit > Cut Tables command instead of the
Copy Tables command.
Managing fields
Fields are formatted using the Field Properties and Field Type dialogs, discussed in Database dialogs and popup menus on page 737.
To reorder fields in a table, with the database window in Structure mode, click and drag the fields.
To edit a fields properties, with the database window in Structure mode, double-click that field.
To resize a fields column width, put the database window in Viewer mode. Then hover the cursor
over the column divider until it turns into a resize cursor, then click and drag to resize.
Use the Sort Table tool in the Viewer toolbar to sort a tables records by up to three fields; each
field can be sorted in either ascending or descending order. For example, use this to sort a tables
records first by last name, then by first name, and then by city.
To create a field with mixed formats (for instance, with both strings and numbers), set the field as a
string type in the Field Properties dialog. Enter numbers or strings into the cells.
Editing data
To access data for editing, in the database window do one of the following:
How To
Finding data
To find a string or number within a database, with the database structure window open, give the command Edit > Find. This command
opens the Find dialog. To only search a single table, select the table before giving the Edit > Find
command.
738
How To
Description
Field name
Field type
Decimals
Use separators
Record ID field
The field used as an index when searching for a record in this table.
When checked, the number or string for each record in this field must be
unique.
Read only
When checked, prevents the data from being changed after it has been
entered.
Initialize every record in If checked, initializes the data for all the records in the selected field to the
this field to:
entered parameter value. If the parameter is left blank, initializes the fields
records to a blank.
First run...Every run
739
Description
Number
An integer or double-precision floating point number. Choose general, scientific, percent, currency or integer.
String
Date/Time
Data address
Boolean checkbox
List of tables
Provides a popup menu of all the tables in the database, so you can select a
table.
you can assign a name to a distribution in a database, allowing the distri- Database Random Distribution dialog
bution to be selected by custom name
in that database. For example, enter typical values for an empirical table and name it Machine
Time Distribution. Or give a custom name to an exponential distribution with specific arguments.
How To
The random distributions in this dialog are the same as for the Random
Number block (Value library). For a
complete list and short description, see
Choosing a distribution on
page 686.
740
Select the ExtendSim DB Add-In.xla file and click OK. This returns you to the Excel Add-Ins
dialog and puts ExtendSim DB Add-In in the list of available Add-Ins. (Make sure the checkbox
next to ExtendSim DB Add-In is checked.)
Click OK to close the Excel Add-Ins dialog. This action installs a new Add-In menu command
called ExtendSim DB.
To export an ExtendSim database file from ExtendSim so that Excel can import it, see Importing
or exporting a database on page 735. The exported file will be in text file format.
How To
To import the exported ExtendSim database file into Excel, give the command ExtendSim DB >
Import Database in Excel. After importing the file, you can modify data in the tables, change the
number of records (rows) or fields (columns), change the field types, modify named and empirical
distributions. Although it is done infrequently and is much easier to do in ExtendSim, you can
even add or change relationships in the database.
741
Then import that file into ExtendSim using the command Databases > Import New Database as
discussed in Importing or exporting a database on page 735.
Check Database Consistency
One of the DB Add-In menu options is Check Database Consistency. This command performs
validations of the database and its parent/child relations. This ensures that the database structure
and data content are internally consistent and valid.
If errors are found they are recorded in an Errors Summary worksheet and a message is displayed at
the completion of the check. The Errors Summary worksheet has hyperlinks to the errors so you
can fix them.
The four validations
The Check Database Consistency command performs the following checks.
For each child field, the contents are checked to ensure that corresponding values exist in the
parent fields of the parent tables. Each instance of a child field value without a corresponding
parent field value is recorded in the Errors Summary worksheet.
2) Parent/child relations
The user-defined parent/child relations in the Indexed Fields table are validated. This check
ensures that each child and parent table and each parent and child field referenced in the
Indexed Fields table actually exists in the database workbook.
3) Table and field name uniqueness
This ensures that each table name in the workbook is unique and each field name is unique
for the given table. Each instance of a non-unique table and field name is recorded in the
Errors Summary worksheet.
How To
742
The DB Add-In only operates on one database at a time. It is therefore possible that other databases could have a table with the same name as a table in the workbooks database.
4) Each value unique
This looks at the record contents for each field that has Each value unique checked in its Field
Properties dialog. The validation ensures that all values in the corresponding tables are
unique. Non-unique values are reported in the Errors Summary worksheet.
Exporting the file
The DB Add-In will not allow you to export a database from a workbook until the database structure and content have been successfully validated.
Find Database Table
This command allows users to quickly find and go
to a database table in their workbook. Selecting
the command opens the Find Database Table
form which displays a list of all the tables in the
selected worksheet.
To select one of the database tabs, click the Worksheet popup list, which displays all of the tables on
the selected worksheet. To view a list of all tables
in the database, select the <All worksheets>
option.
When you select a table name in the list of tables, the active cell of the workbook will be set to the
location where the database table is defined.
How To
Parent/child fields
Parent and child fields are color-coded in the workbook. This matches the parent/child color
coding in ExtendSim red for parent fields and green for child fields.
When the database is imported and/or database consistency is checked, child field names are
hyperlinked to their parent fields. For example, clicking on a child fields green header takes you
to the linked field in the parent table. This allows users to quickly find parent tables and view
the list of valid child values.
Status bar
During importing, the Status bar at the bottom of the workbook reports the current table as well
as the number of the record being imported and the total number of records that will be imported.
Validation and performance while importing
The imported database is checked for unique fields. If some fields are not marked as unique, and
there are parent/child relationships, the DB Add-In displays a warning message during import.
When the file is exported back to ExtendSim, the Add-In will resolve any parent/child conflicts
by linking the child to the first appropriate parent field it locates.
The VBA code that manages the DB Add-In has been rewritten for faster performance when
importing files.
743
Global arrays
A global array is a two-dimensional (row and column) array of data that is accessible by any block
in a model. Like ExtendSim databases, global arrays are user-accessible structures for internally
storing and managing data. Use global arrays to share information between blocks when a direct
connection is either inconvenient or impossible, to store information that can be accessed by a row
and column index, or to exchange data with external sources.
Global arrays provide many of the same modeling advantages that ExtendSim databases do; see
Advantages of using internal databases on page 727, but they differ from databases in some
important aspects. Compared to databases, global arrays have a simpler data structure and take less
time to access data. However, global arrays arent as flexible as databases, which allow mixed data
types, randomness, and parent/child relationships. It is also easier to add or remove fields in a database than columns in a global array, and creating a global array requires adding a block to the
model.
Unless you are using custom blocks that create global arrays, a Data Source Create block must be in
the model to initially create the global array. Since the global array is saved with the model, the
block can be removed after the array has been created.
You just want a simple array structure of a single data type. For instance, to create an integer
array with 10 columns and 20 rows of data for use in a model.
You program blocks that can use a more simple data structure than a database requires, and you
dont need or want the data storage to be visible to the block user.
Creating a global array
There are three ways to create a global array:
1) Use the Data Source Create block (Value library) as illustrated later in this chapter.
How To
While it is common to use a database for managing and exchanging data, global arrays are handy
in situations where:
744
2) Through global array functions in an equation-based block from the Value or Item library.
These blocks are discussed in Equation-based blocks on page 677.
3) Programing with ModL code. For more information, see the Developer Reference.
You can name a global array anything you want as long as the name is fewer than 32 characters and
it does not begin with the underscore character (_). Global array names are not case sensitive;
spaces between characters are allowed.
A global array can only be of one data type - either integer or real (if the data type is selected
through the user interface), or integer, real, or string (if the data type is selected through ModL
code.) Each model can have one or more global arrays associated with it and each global array can
have multiple rows and columns. Global arrays are stored and saved with the model, even if the
Data Source Create block that created the array is deleted.
Following the standard conventions, ExtendSim databases are organized by field and record (similar to being organized by column and row.) However, arrays are organized by row and column.
This is important to consider when transferring data between databases and global arrays.
How to create and use a global array
The example that follows uses the Data Source Create block to create a global array for the Reservoir 1 model. As illustrated below, the steps are:
1) Place a Data Source Create block in a model.
2) Build the global array in the Data Source Create block.
3) Populate the array with data.
4) Determine how the model exchanges data with the array.
Using an example model
How To
ReservoirGA model
In the three dialogs that appear, name the array My Array, give it 12 rows, and give it 2
columns. Click OK after each dialog entry.
745
3) Using global array functions in an equation-based block from the Value or Item library to
manage data. These blocks are discussed in Equation-based blocks on page 677.
4) Programming using ModL code. See the Developer Reference for more information.
Dynamic arrays
A dynamic array is multi-dimensional internal data structure that is only accessible through programming. A model user can resize a data table that is linked to a dynamic array and can link the
data in the table to an ExtendSim database or global array. However, the dynamic array itself cannot be accessed outside of ModL code.
A data table linked to an internal data source will have its upper left corner in light blue rather
than the grey of the table header. If the source is a database (DB) or global array (GA), those ini-
How To
2) With data access blocks, such as the Read and Write blocks (Value library), to exchange data
between a model and a global array. Data access blocks are discussed on page 750.
746
tials will be displayed in the corner. If the source is a dynamic array, the upper left corner will not
have any initials.
Since dynamic arrays are created and managed through ModL code, see the Developer Reference
for more information.
For purposes of this manual, the word objects will mean both component objects and ActiveX
controls.
If clicking a container object causes any response other than selection, you need to select the command Edit > Design Mode to move it, as discussed on page 791.
How To
Double-clicking an embedded object activates features of the originating program. For instance,
double-clicking an embedded Excel Chart provides access to Excel tools for selecting a chart type
and configuring its display.
A typical use of embedded objects would be to insert an Excel worksheet into an ExtendSim
model, then use DDE Linking (discussed on page 724) or the Value librarys Read and Write
blocks (discussed on page 751) to exchange data between the model and the embedded object.
This gives ExtendSim the added capabilities of Excel, without opening the Excel application.
How to embed an object into a worksheet
The example that follows embeds an Excel worksheet into an existing model and uses the Write
block to send results to the worksheet.
747
In the dialog, select the button Create New (the default choice) and choose Object Type:
Microsoft Office Excel Worksheet. Then click OK to close the dialog and place the embedded
object in the model.
If the Excel worksheet object is in an inconvenient location, click elsewhere on the model window to deselect it, then click back on the worksheet to select and move it.
Delete the Plotter I/O block on the right side of the model.
Add a Write block (Value library) to the model where the Plotter block was. Then open its dialog:
In the Select destination type frame, choose Send data to: Excel workbook, check Use
embedded workbook, and select Embedded workbook list: Worksheet in ReservoirEmbed.
In the Specify Excel coordinates frame, select Sheet: Sheet 1, Write: one row, and Col
end: 4.
Leave the other settings at their defaults and close the Write blocks dialog.
To the left of the Write block, add a Simulation Variable block (Value library) to the model.
In its dialog, select Current time.
Connect the output of the Simulation Variable block to the top input of the Write block.
In the finished model, this block will output current simulation time to the Excel worksheet.
Draw a connection line from the remaining inputs of the Write block to the Contents, Rainfall,
and Stream named connections. (Be sure to make a complete connection; if a line segment is
dotted, it is not connected.)
Add a second Simulation Variable block (Value library) to the model. In its dialog, select Current step and specify that it adds 1 to the result.
Adding 1 is necessary because ExtendSim is zero-based and Excel is one-based, as discussed in
The mailslots feature allows communication between two ExtendSim applications running on
different computers on the same local area network (LAN). Since mail slots involve programming, they are described in the Developer Reference. on page 767.
Extend the variable connector at the bottom of the Write block so that the R (row) input is disThis causes the Write block to write the data to a new row at each step.
How To
played. Then connect the output of the second Simulation Variable block to the R input.
748
referenced in the blocks code via a combination of its dialog item name and container object block
number, using ModL functions as described in the Developer Reference.
The Bar Chart and Gantt Chart blocks (Plotter library) are examples of Graphics Server ActiveX
controls embedded in ExtendSim block dialogs. For more information on ModL programming to
control embedded objects or how to use ExtendSim as an Automation Client or Server, see the
Developer Reference.
The Insert Object dialog
The Insert Object dialog appears when the command Edit > Insert Object is given; it is used for
selecting an object for embedding. A scrollable lists
displays the insertable objects that are available for
your machine.
If Create New is selected in the dialog, ExtendSim
will create a new object of the indicated type with no
data associated with itbasically an empty document of the specified type. Selecting Create from
File creates an embedded object with the data from Insert Object dialog
that file as the starting point. If the Display As
Icon box is checked, the new object will only display in ExtendSim as an icon, rather than as the controls interface.
The use of the Insert Object dialog will have different meanings depending on which ExtendSim
window is open. If a model or hierarchical worksheet window is open, issuing this command will
insert a Container Object on the model. If a dialog with an Embedded Object dialog item is open,
it will insert the embedded object into that dialog item.
Linked lists
A linked list is an internal data structure that allows the construction and manipulation of complex
lists of data. It can be accessed only through programming. Linked lists are queue-like structures of
multiple types that maintain internal pointers between different elements. This enhances the sorting for complex structures by speeding the movement of the elements within the list.
ExtendSim implements linked lists:
How To
749
Spreadsheets
External databases
Other applications, such as word processors and statistics packages
There are several ways you can incorporate IPC into models, including:
With ExtendSim blocks, as discussed starting on page 750.
Using the DDE Link feature (Windows only) described on page 724.
Embedding objects (Windows only) as seen on page 746.
If you program, using the OLE and IPC functions discussed in the Developer Reference.
An application that communicates with another application can be categorized as either client or a
server. A client application requests a service from some other application and a server application
responds to the clients request. Many applications, such as ExtendSim, can act as either a client or
a server depending on the circumstances.
Spreadsheets
You may want to use spreadsheet data as the input for an ExtendSim model. Likewise, you may
want to send output data to a spreadsheet for further analysis or presentation. For instance, if you
have a spreadsheet that performs calculations on large amounts of data, you may want that spreadsheet to respond dynamically as you model real world conditions in ExtendSim.
ExtendSim facilitates communication with spreadsheets by:
The Command, Data Import Export, Read, and Write blocks (Value library). These blocks can
send data to and from spreadsheet applications, send one value to a specified cell in a spreadsheet
and request the recalculated value from another cell, or send commands or a macro to a spreadsheet. See Blocks for data management and exchange on page 750.
DDE Link commands in the Edit menu. For more information, see DDE links (Windows
only) on page 724.
The ExtendSim DB Add-in, which allows an exported ExtendSim database text file to be
imported into Excel. The data can then be stored in Excel, edited and exported to an external
database, or edited and exported back to ExtendSim as a database text file.
OLE and IPC functions to facilitate DDE or ActiveX/COM/OLE communication with spreadsheets. For more information, see the Developer Reference.
External databases
In many situations, the historical data for a a model is stored in an external database. ExtendSim
models can share information with external database applications:
With the Data Import Export block (Value library) to send data to or from ADO-compliant
database applications. This block can import a block of data to, or export a block of data from,
an ExtendSim database or global array. See Data access blocks on page 759.
How To
Import Data and Export Data commands in the File menu to create text files that can be
imported into a spreadsheet or to import a text file that has been exported from a spreadsheet.
For more information, see Importing and exporting data on page 714.
750
How To
Most of the following blocks allow block-level access to data structures without having to program
with the ModL functions. An additional group of blocks are designed to help block developers,
serving as templates for custom-built data management blocks.
Block
See Page
Library
Read/Write
751
Value
Read(I)/Write(I)
751
Item
Query Equation/QueryEquation(I)
752
Value/Item
759
Value
759
Value
Data Init
759
Value
Data Specs
759
Value
Command
759
Value
Object Mapper
759
Utilities
Since Microsoft constantly updates and replaces these protocols, it is best practice to use the
ExtendSim blocks for inter-application communication.
751
The Query Equation and Query Equation(I) can use an equation to search an ExtendSim database
table for the highest ranking record available during the run. See page 752 for more information.
ExtendSim database
Global array
Excel workbook
Text file
Local table (information that is entered the blocks data table)
How To
For an example of how the Read(I) block is used, see the DB Job Shop model located at Exam-
752
to be read from or written to (the address) depends on the type of data structure chosen, as
shown in the following table.
ExtendSim Database
Global Array
File name
Microsoft Excel
Text File
Database name
Field or column
Record or row
For instance, the fully specified address for accessing an Excel file would include the file name,
sheet, column, and row.
Interface methods
Once you have specified a data structure type to communicate with and determined what the fully
qualified address is, the next step is to determine where the data structure address is entered:
In the blocks dialog or through value input connector for the Read and Write blocks (Value
library)
In the blocks dialog, through value input connector, or by using attributes on items that pass
through the Read(I) and Write(I) blocks (Item library)
Triggers
The following table indicates the mechanism that will trigger when the data is sent or received.
Read
Write
Connector message
Read(I)
Write(I)
How To
753
At least one DBQ record rank output variable is required so that each record can have a ranking.
Spawned items
A feature unique to the Query Equation(I) block is the ability to optionally create additional
items. These spawned items can then be used for special purposes in the model. This is an independent and parallel system to how the items that pass through the block got created.
To use this feature, enable spawning on the Options tab. This causes a new item output connector
to appear on the top edge of the block's icon. It also causes some additional equation variable
types, with the prefix DBQS (for database query spawn), to be available. Those variables are shown
in the table on page 755.
The equation results for pass-through items are calculated independently from those for spawns.
Pass-through results are associated with the pass-through item and spawn results are associated
with the spawned item. For example, results for the pass-through item might get taken from record
6 (because 6 possessed the best pass-through record rank), while the spawn might use results from
record 2 (because 2 possessed the best spawn record rank).
When a spawned item is created, it represents a record from the query table. Consequently, you
can think of this newly created item as a spawned record.
How To
Typically items are created outside of the block and pass through the block. These items are called
pass-through items. In some instances, you might want to create additional action items, called
spawned items, based on equation logic and what has been found in the query table. If a spawn is
created for a particular record, an equation can be defined in such a way that results particular to
the spawned record may be saved as attributes on the spawned item.
754
Variables
The Query Equation blocks have several types of input and output variables.While the tables that
start on Input variables on page 678 and Output variables on page 680 describe the set of variables shared by all equation-based blocks, the following variables are unique to the query blocks.
To modify the number of rows used in the variable tables:
Change the number of rows in the table by clicking the green +/- resize button in the tables bottom right corner and entering the number of rows desired.
Delete rows by first selecting the rows you wish to delete, clicking the green +/- resize button,
and then selecting the option to "delete selected rows."
Duplicate any rows by first selecting the row you wish to duplicate, clicking the green +/- resize
button, and then selecting the option to "copy selected row."
Input variables
Input Variable
Query Equation
Query Equation(I)
How To
A static input variable that gets initialized at the beginning of every query cycle.
The record index with the best rank at this point in the
current query cycle. If the value of this input is < 1, then
no record has yet to be given a ranking.
Uses
Query Equation(I)
Input Variable
Query Equation
755
Uses
The record index with the best spawn rank at this point
in the current query cycle. If the value of this input is < 1,
then no record has yet to be given a ranking. (Only
enabled if spawning is enabled.)
The notation PRI (Parent Record Index) is used in blocks that interface with the ExtendSim database. It describes the type of value that is being read or written when dealing with a Child field.
Query Equation(I)
Uses
DBQS attribute
DBQS 3D object ID
How To
Output Variable
Query Equation
Output variables
756
As mentioned earlier, while you can specify other equation results, at least one of the output variables has to be of the type DBQ record rank. Furthermore:
Only the results for the record ranked best will be output.
You can use more than one DBQ record rank variable; the secondary ranking variable will be
used to arbitrate in the case of tied ranking. This is useful if you are concerned with tie breaking
for two or more records having the same primary. What constitutes a tie can also be defined on
the Options tab with the parameter Records ranked within +/- X are equal.
If the Spawning option is enabled, at least two output variables are required one variable of
DBQ record rank type plus one variable of DBQS record rank type.
Ranking rules
The rules that determine which record is selected are given on the blocks Options tab:
For a pass-through item
Highest pass-through record rank. Each records rank value is calculated by the equation. The
one with the highest rank is chosen.
Lowest pass-through record rank.Each records rank value is calculated by the equation. The
one with the lowest rank is chosen.
First True record rank. The equation will be calculated once for each record until either:
A record receives a True ranking
Or, there are no records left to evaluate
For a spawned item
Highest spawn record rank. Each records rank value is calculated by the equation. The one
with the highest rank is chosen.
Lowest spawn record rank.Each records rank value is calculated by the equation. The one with
the lowest rank is chosen.
First True spawn record rank. The equation will be calculated once for each record until either:
A record receives a True ranking
True spawn record ranks. Any record receiving a spawn rank 0.5 will be spawned. This
makes it possible to create any number of spawned action items for one pass-through item.
Description
Query cycle initiated only when an item arrives (similar to the Equation(I) block).
Query Equation(I)
How To
Query cycle initiation is controlled using options on the Options tab (similar to the
Equation block).
757
Query Equation(I)
Description
Query Equation
Supports Spawning
How To
The model simulates three parts, each with their own process sequence, being routed through five
potential processes. Depending on the part, a process sequence is made up of some combination of
milling, drilling, lathing, cutting, and exiting. For example, the process sequence for part 100-3 is
cut, mill, lathe, drill and then exit, while the sequence for part 100-1 only contains a milling step
before exiting. Each step in the process has a random delay that is unique to each part type.
758
All the information needed to drive this model is located in the ExtendSim database named Database 1. The table structure of that database is shown here.
The Products table contains the names of the three parts that are modeled.
The Production Schedule table is used by the Create block (through linking) to create parts by
schedule.
The Operations table contains a list of the five different potential operations mill, drill, lathe,
cut, and exit.
Each of the three part types has an associated Production Specs table. This is used to define the
steps in a part's production sequence and the delays associated with each step. The From and To
fields are used to define the appropriate destination given a particular origin: If you come from
here, go to there next.
In the model, one Query Equation(I) block is used to find the current part's next process step and
its associated delay. Both pieces of information are then stored as attributes on the pass-through
item. When the next item/part arrives, the query block starts looping through the Production
Specs table associated with that part.
How To
In this example, the query block is looking for the record whose From value matches the currStep
attribute found on the item. Once that is found, the block then finds the associated To and Process
Time values for that record and stores them as attributes on the item.
The equation in the query block is:
if(currStep == fromField)
{
rank = True;
currStep = toField;
activityDelay = delayField;
}
else
{
rank = False;
}
Given the complexity of what the query block is doing, the code is very simple.
759
Command
When triggered by a value at its send input, the Command block (Value library)
sends a command, such as an Excel macro or DDE command, to a spreadsheet. You
can select a command to send and choose when the command is sent.
How To
Data Specs
The Data Specs block (Value library) reports information about a selected ExtendSim
database or global array. You can assign a name to the specification report, select its
components through popup menus, initialize the outputs, and display the specifications name and/or values on output connectors.
760
Indexing
How organized
Data Tables
0-based
Row/Column
Spreadsheets
1-based
Row/Column
Internal Databases
1-based
Column/Row
(Field/Record)
External Databases
1-based
Column/Row
(Field/Record)
Arrays
0-based
Row/Column
N/A
Row/Column
How To
Text Files
761
Serial port functions on Windows. To pass data through serial devices, use the serial port functions. These functions can read and write any data (including real-time data) to and from the
computers serial ports. This is useful for transmitting and receiving data on a modem, for example. For more information, see the Developer Reference.
Text Files
ADO
ActiveX/COM/OLE
DDE
ODBC
DLLs (Windows)
Shared Libraries (Macintosh)
FTP
In addition to the uses listed above, these technologies are supported for block development. This
is described in the Developer Reference.
Text files
A text file (also known as an ASCII file) is a file of unformatted information. Text files contain
written text with the styles removed and/or numerical data separated by some delimiter or separator (such as tabs or spaces).
You can create text files in another application such as a spreadsheet, database, or word processing
program, then read those text files into ExtendSim. Or create text files in ExtendSim, then read
them into the other programs.
Text files contain text, data, or both data and text. There are many uses for text files. For example:
How To
Mail Slots
762
To supply internal data as the basis for analysis when using Sensitivity Analysis.
To share data with an external database or spreadsheet program such as Microsoft Access or
Excel.
To output model results to external applications, such as spreadsheets or word processing programs, for presentation or analysis.
Text files of information are generated for model Reports or Traces.
Most files transmitted from minicomputers and mainframes are text files.
Text files can reside locally, be remotely accessed over a network, or accessed via the internet using
FTP.
Creating and opening text files
Some ExtendSim blocks automatically create text files. For example, selected blocks automatically
output information in the form of a text file when the Generate Report command is chosen for a
run. If you program custom blocks, you can include ModL functions to have the blocks create or
read text files. In addition, there are two methods to directly open or create a text file in ExtendSim:
1) Use the File menu commands to create or open text files. This allows you to look at report files,
modify data input files, and so on, without having to open another application.
2) Use the Create or Open button in the dialogs of the Read and Write blocks (Value library)
when Text File is selected as the data type. This is useful if you want to create a file of data for
use in a model. The Read and Write blocks are discussed on page 751
How To
763
In the Text File window, enter the information shown on the right into
two tab-delimited columns. For example,
Type January
Click the tab key
Type 2.6
Click the enter or return key to start a new row
Continue entering the information, clicking the tab key after each
month to separate the information into two columns and clicking
the enter key after each value to start a new row of information.
Give the command File > Save Text File As and name the text file My
Text.
Because it is unformatted, the information in the text file will not be lined up as shown in the
screen shot above. It is important that you do not try to line up the data by adding extra tabs as
that will affect how the data is interpreted. There must be one, and only one, tab character separating the columns.
Delimiting text file data
Columns in text files can be separated by a tab, a space, or a comma. Carriage return characters are
always used to separate rows. When creating text files for use as inputs to ExtendSim blocks or
other applications, consider how the blocks or programs want the data presented. For example,
some ExtendSim blocks can take data columns separated a tab character, a space, or with another
character such as a comma. On the other hand, Sensitivity Analysis and many external applications
will only read files where the columns are delimited by tab characters. In general, it is best to use
tab characters.
Also, remember that programs expect only one delimiter (one tab, one space, or one comma)
between columns. For example, dont put in extra tab characters in order to make columns line up
visually; if you do, the program is sure to get confused.
How To
To permanently change the font or font size used when viewing text files, give the command
Edit > Options > Model tab and use the Text file font option.
764
cation. This is, for example, the technology used by the Read and Write blocks to communicate
with Excel.
When you use the OLE functions inside ExtendSim to communicate with another application,
ExtendSim is the Client in the automation communication and the other application is the server.
When the other application is using its scripting environment to communicate with ExtendSim,
ExtendSim is the Server.
When you develop custom blocks, automation is probably the most powerful tool that you can use
for interapplication communication. It does, however, come with a cost. Developing code to use
automation to control another application requires expertise with OLE/COM as well as knowledge of the object model of the target application.
An object model is essentially a list of the methods and objects that an application supports with
regard to ActiveX automation. ExtendSim has a simple yet powerful object model that is described
in some detail in the Developer Reference. Other applications have more or less complex object
models. Excel, one of the more common target applications, has a quite complex object model; it
is quite complex to deal with. The Object Mapper block (Custom Blocks library) is a tool that can
be useful in learning more about the object model of an application or ActiveX control.
Automation is also the most common tool used to communicate with embedded objects or
ActiveX controls when they are added to the ExtendSim application. The Bar Chart and Gantt
Chart plotters (Plotter library) use ActiveX automation through ExtendSim OLE function calls to
communicate and exchange data with the embedded objects.
ActiveX controls and embedded objects
The main ActiveX technology is COM (Component Object Model). COM is the framework for
developing and supporting ActiveX controls and component objects.
While the terms component objects and ActiveX controls are sometimes used interchangeably,
How To
an object is often considered to have a source application that it derives from and a control is usually defined as a stand-alone object that doesnt necessarily have an application behind it. For purposes of this manual, the words object or embedded object applies to either a component
object or an ActiveX control.
A component object is an identifiable part of a larger program that provides a particular function
or group of related functions; it is roughly equivalent to a Java applet. ActiveX controls can be created using one of several languages or development tools, or with scripting tools. In implementation, an ActiveX control is a dynamic link library (DLL) module. It runs in what is known as a
container, an application program that uses COM program interfaces.
OLE (Object Linking and Embedding) is Microsofts framework for a compound document technology for combining text, sound, animations, controls and so forth into a document. Each object
is an independent program component that can interact with the user and communicate with
other objects.
Whereas OLE provides services for the compound document that users see on their display; COM
provides the underlying services of interface negotiation, life cycle management (determining
when an object can be removed from the system), licensing, and event services (putting an object
into service as the result of an event that has happened to another object.)
ExtendSim supports embedding of COM/OLE objects and ActiveX controls in two places in the
application:
765
At the worksheet/model level, where they can be included as a container object and be manipulated much like blocks and other types of worksheet objects.
At the block dialog level, where they can be inserted into a special type of dialog item called an
embedded object.
The Gantt Chart (Plotter library) uses an embedded ActiveX control. The Read and Write blocks
(Value library) uses OLE/COM to communicate with other applications. ExtendSim also has
many OLE/COM functions to facilitate ActiveX controls and COM objects.
ExtendSim can be a container for objects embedded using the Insert Object menu command or
through ModL programming. It also has ModL functions to support its use as either an OLE automation client or server.
How To
When using ADO, make sure that the ExtendSim table and external database table have compati-
766
DDE linking can be used for one-time data transfers and for continuous exchanges in which applications send updates to one another as new data becomes available. It is most appropriate for data
exchanges that do not require ongoing user interaction. Some areas where it is useful are:
Performing data queries, such as an ExtendSim model requesting information from an
Excel worksheet.
Linking to real-time data, such as scientific instruments, process control, or stock market
updates
Creating compound documents, such as an ExtendSim model that includes an Excel chart.
In ExtendSim, DDE technology is implemented through:
Menu commands that establish a connection between two pieces of data. (See DDE links
(Windows only) on page 724.)
The Command block (Value library) for sending instructions to a spreadsheet, causing it
to execute a macro. (See Command on page 759.)
IPC functions that provide more flexibility than using just menu commands to create
DDE links, such as the ability to set a value in Excel without establishing a link. (See the
Developer Reference.)
Since Microsoft constantly updates and replaces these protocols, it is best practice to use the
ExtendSim blocks for DDE communication. See the ExtendSim blocks starting on page 750.
ODBC/SQL
Open DataBase Connectivity (ODBC) provides a standard application programming interface
(API) method for accessing database data independent of programming language, operating system, and database system. The goal is to enable access to data from any application, regardless of
which database management system (DBMS) is handling the data. It does this by inserting a middle layer between an application and the DBMS that translates data queries into commands understandable by the DBMS.
The ODBC API allows applications to access data in DBMS using SAG SQL (SAG = SQL Access
Group; SQL - Structured Query Language) as the standard for requesting information from a
database. SQL allows a single application to access different database management systems.
How To
ODBC offers connectivity to a wide variety of data sources, including relational databases and
non-relational data sources such as spreadsheets and text files.
Since Microsoft constantly updates and replaces these protocols, it is best practice to use the
ExtendSim blocks for ODBC communication. See the ExtendSim blocks starting on page 750.
FTP
File Transfer Protocol (FTP) is used to connect two computers over the Internet or an intranet for
the purpose of transferring data and commands. In an FTP environment, one computer acts as a
server and the other acts as a client.
As a client, ExtendSim initiates a connection to the server. Once connected, ExtendSim accesses a
specified file on the server and either imports data from it or exports data to it.
ExtendSim implements FTP by:
The Data Import Export block (Value library) can open a file on a remote computer and access
the data for use in an ExtendSim model.
767
Internet Access functions provide more flexibility than using the Data Import Export block. See
the Developer Reference.
How To
How To
768
How To
Miscellaneous
Other important features
that didnt fit somewhere else
770
Miscellaneous
Navigator
This chapter covers some additional ExtendSim features and topics, including:
Using the Navigator to explore models and to access library or database windows
Printing the model worksheet, Notebook, and block dialogs
Copying model elements within ExtendSim and between ExtendSim and other applications
Tool Tips
Changing parameters dynamically
Model sharing using the Lock Model command and the LT-RunTime version of ExtendSim
Navigator
The Navigator is an explorer-like window that provides easy access to different aspects of ExtendSim. As discussed later in this section, it has three modes:
Model Navigator mode. Lists the blocks in the active model, showing block icons, names,
labels, global block numbers, and any hierarchical levels. In this mode the word Model is displayed in the Navigator windows leftmost popup menu.
Database List mode. Provides a list of the databases the active model uses, if any. In this mode
the word Database List is displayed in the Navigator windows leftmost popup menu.
Library Window mode. Lists the blocks, including their icons and names, for a selected library.
In this mode all open libraries are listed alphabetically below the line in the Navigator windows
leftmost popup menu.
How To
The popup menu on the right (Model Navigator mode only) is for changing the order for how
the models blocks are listed in the window. You can sort by Block Label, Block Name, Block
Number, hierarchical Depth, or Simulation Order (the default order).
Miscellaneous
Navigator
771
To switch from one mode to the other, select the mode in the popup menu on the top left of the
Navigator window.
You can have multiple Navigator windows open at the same time, all set to the same or different
modes. To open a new Navigator window, Navigator windows that are already open cannot be in
Model Navigator mode.
All the ExtendSim databases used in a model are automatically opened when the model opens. The
Navigator is used to open a databases window, not the database.
To open a database window using the Navigator:
Open a model that uses a database, such as the Reservoir 1 model located at \Examples\Tutorials.
Open a Navigator.
In the Navigators leftmost popup menu, select Database List.
Any ExtendSim databases used in the model are listed below the model name.
Select a blocks icon in the library window. (To select multiple blocks at once use the Shift key.)
Drag and drop the block onto the model worksheet.
How To
If a library is selected in the Navigators leftmost popup menu, the Navigator displays an alphabetical list of blocks for that library. You can add blocks to a model from this list; this is often quicker
than using the Library menu.
772
Miscellaneous
Printing
Opening a library window directly (by choosing Library > Open Library, then selecting the Open
Library Window command at the top of the selected librarys submenu) is equivalent to choosing
the Library Window mode in the Navigator.
If a block has been compiled with external source code, it will be listed in the library window with
the designation CM (code management) on the right side of its icon. If a block has been compiled
with debugging code, its name and any additional information will be listed in the library window
in red and the block will display in the model with a red border around its icon. Compiling
options are used by block developers and are discussed in the Developer Reference.
Printing
Selecting what to print
ExtendSim gives you control over what appears on the printed page. The following table lists what
can be printed, depending on which window is active:
Active Window
Printed
Model worksheet
A picture of the worksheet as it appears on the screen. You can choose how many
hierarchical layers to print and to optionally print the contents of the dialogs and
plotters.
Dialog
A picture of the dialog. If the dialog has a data table, you can select whether or
not to print all of the data in the table. You can choose to print just the top tab or
all tabs.
Plotter
Navigator
Notebook
How To
Hierarchical block A picture of the worksheet as it appears on the screen. If you print more than one
worksheet
layer, it will also print the model worksheet.
Help text
Text file
Library window
Structure
window
All the panes from the structure window and the dialog editor window of a block
(see the Developer Reference for more information).
Miscellaneous
Printing
773
After you have selected what to print, the systems standard Print dialog allows you to specify
particulars about the print job. For example, you can set the number of copies to be printed and
(for model worksheets and Notebooks) the range of pages.
Worksheet, dialog, or plotter active
When you give the Print command with the worksheet, dialog, or plotter active, an ExtendSim
Print dialog opens.
Print model
worksheet
Only shows the worksheets top level (not the contents of hierarchical
blocks).
Levels
Specifies how many levels of hierarchical blocks to print (each level will
print on a separate page).
Add frame
Print Notebook
Selected blocks
All blocks
Specifies that the dialogs of all blocks in the model will be printed.
Top tab
All tabs
Include plot data tables Also prints the data tables in the plotters.
Include dialog data
tables
How To
Option
774
Miscellaneous
Copy/Paste and Duplicate commands
Before you choose the Edit or Duplicate command, it is important to select the tool from the tool-
How To
bar which will allow you to copy the desired items. For example, choosing the All Layers tool and
frame-selecting a section of a model causes all items in the frame (blocks, drawing objects, clones,
etc.) to be selected and available for copying. However, if you use the Block/Text Layer tool, only
blocks and text will be selected.
Miscellaneous
Copy/Paste and Duplicate commands
775
Data
Data can be copied from parameter entry fields and data tables and pasted into other entry fields
or data tables.
When copying data tables within ExtendSim, Allow data table titles copying should not be
selected on the Misc tab of the Options dialog. If it is, the titles will be added to the data and will
cause the original data to be displaced.
Copying an ExtendSim picture into the Clipboard changes it into a drawing object. To paste the
contents of the Clipboard into the receiving document, it is common to use the Edit > Paste Special command.
Windows: Use the Ctrl + Prnt Scrn key combination to save the entire screen as a bitmap. Or
use a capture program to capture specific parts of the screen.
Mac OS: Use the Command + Shift + 3 key combination to save the selection as a picture. Or
use a capture program to capture specific parts of the screen.
How To
When it is not possible to copy parts of a model directly using the Copy command (such as for the
entire plotter window), do the following:
776
Miscellaneous
Tool tips
or into an ExtendSim database. For more information, see Exchanging data with external applications on page 748.
Pictures and text
Pictures and text can be copied into ExtendSim in color or black-and-white to use on model windows, Notebooks, hierarchical windows, or in the icon pane of a blocks structure window. Create
a picture with a painting or drawing program and copy the picture to the Clipboard. Then paste
the copied picture into an ExtendSim window with the Edit > Paste Picture command.
It doesnt matter what the original file format for the text or graphic was (JPEG, TIFF, GIF, etc.)
Once it has been copied into the Clipboard, ExtendSim treats it as a drawing object.
In the model and Notebook windows, ExtendSim will paste the text or graphic object wherever
you last clicked on the window. Pictures and text pasted from another program into ExtendSim
become a drawing object which can be resized and repositioned using the Draw Layer tool.
Pictures are treated like other drawing elements. For example, use the Draw Layer tool to drag a
picture around the window and resize it however you want. Or use the Model menu commands to
rotate or flip the picture, To delete a picture, select it with the Draw Layer tool and choose Edit >
Clear or press the Backspace or Delete key. Pictures that are copied, like objects created with
ExtendSims drawing tools, always go behind ExtendSim blocks and text.
Pictures can be proportionately resized. To do this, hold down the Shift key as you reshape the picture. It will resize with all dimensions proportional to the original.
Tool tips
Tool tips can be turned on or off in the Edit > Options dialog. They help to quickly identify block
information without having to open the blocks dialog.
Resting the cursor above a block causes a small window to appear containing the blocks name,
its local and global numbers, and (if Include additional block information is selected) the first
sentence of the blocks online help.
Placing the cursor over an input or output connector gives information about it, such as its
name and the number of items that have exited or the blocks constraining rate.
How To
Tool tips also exist to identify the variable name for block dialog items. This can be helpful when
programming custom blocks and is discussed further in the Developer Reference.
Methods
There are a number of means for changing parameters dynamically:
The most common method is to use the connector that corresponds to the dialog parameter
field. Connect this to a block that calculates the desired value, such as a Random Number or
Miscellaneous
Sharing model files
777
Lookup Table block (Value library). This approach visually shows the connection between the
parameter value and where the value comes from. In general, this is also computationally efficient since only the blocks connected to the parameter are recalculated.
A second approach is to link the parameter field with a record in an ExtendSim database. To do
this, right-click the parameter and select create/edit dynamic link. (You can also create this link
programmatically by creating a custom block that links the parameters of other blocks with an
ExtendSim database or global array.) Whenever the linked value in the database changes, the
parameter will change as well. This method hides the relationship between the parameter and
where it is calculated, however it is very useful for centralizing the location of certain parameters
in the database or for broadcasting the same value at the same time to a number of blocks
throughout the model.
In a discrete event model, some blocks (such as the Activity or Equation (I) block) allow you to
specify a property value for a parameter. Using an items property is an easy way to make the
parameter value a function of the item in the block.
Sensitivity analysis allows you to change a parameter from one simulation run to the next. Sensitized parameters change values at the start of each new run. They can change randomly, based
on a value in a file, or by a fixed increment. Changing parameters is useful for sensitivity analysis
and Monte Carlo simulation. To utilize sensitized parameters, the number of simulation runs
must be greater than one. For a complete discussion, see Sensitivity analysis on page 628.
Some blocks allow you to specify that a parameter is random. While this is not directly changing
the parameter dynamically, this feature allows you to simulate a parameter that changes randomly each time the block is recalculated.
There are other methods, such as calling the SetDialogVariable function in an equation block or
custom block, but these are generally just used for specific situations.
How To
Locking a model to prevent anything other than parameter changes when the model is run in
the full version of ExtendSim.
Using the LT-RunTime version of ExtendSim to open and run models.
778
Miscellaneous
Sharing model files
The Lock Model dialog also has a Lock H-Blocks checkbox. Select this to prevent a user from double-clicking a hierarchical block to see the underlying submodel.
Once you have locked a model with a password, you must have that password to unlock the
model. Always make unlocked copies of models before you lock them.
To prevent end users from using the LT version to make changes to your models, use the Lock
Model command discussed on page 777.
The limitations of the LT version are:
How To
The model-building capability is limited to models of 75 blocks and expires after 180 days.
While a model larger than 75 blocks is running, or after the expiration period, the application
changes to RunTime mode. At that point, end users can only run models. They will no longer
be able to build a model, add or remove blocks from models, or alter connections between the
blocks.
Libraries converted to RunTime format cannot be used for model building. So that the end user
can run models you give them, but not use your libraries to build models, convert your libraries
to RunTime format using the full version of ExtendSim (see Convert Library to RunTime Format on page 801).
The scripting functions and ActiveX automation commands that place or create blocks are not
enabled.
As with any other application, distribution and usage rights are limited.
The ExtendSim LT version is licensed to a single user for the users personal use on a single computer. For information about any other use, such as distributing an LT version on a CD or from
your web site (right to distribute), or distributing ExtendSims functionality or use to others on
an intranet or through the internet (ASP license), contact Imagine That Inc.
Miscellaneous
Referencing dialog variables
779
These methods only work if one of the target blocks is in the model.
How To
How To
780
Miscellaneous
Referencing dialog variables
Appendix
782
This chapter explains all the commands that appear in the menus and the circumstances in which
you might use them. At the end of this chapter is a description of the tools in the application toolbar and ExtendSim database.
File menu
The File menu lets you open, save, close, and print
model and text files. Most of the commands in this
menu act just like they do in other applications.
New Model
Opens an untitled model window.
Open
Opens an existing model or text file. (Any libraries and
databases that the model uses open when the model
opens. To open a library file, use the Open Library
command described on page 799.) You can also open a
model by double-clicking the model file; this action
will launch ExtendSim before opening the model.
You can have any number of models open at the same
time; open models are listed at the bottom of the Window command. When ExtendSim opens the
model, it also opens any libraries that are used by the model.
Appendix
If ExtendSim cant find a library used by a model, the message Searching for library... will appear
as described in Searching for libraries and blocks on page 549. If ExtendSim cannot find all of
the blocks used in the model, the missing ones will be replaced with text blocks. When this occurs,
ExtendSim will open the model as Model-x to prevent accidentally saving over the old model.
Close
Closes the active window. For example, closes a model if the model worksheet is the active window
or closes the models Notebook, if the Notebook is the active window.
783
If a crash occurs during the save process, your original file could get corrupted. To protect against
file corruption, prior to saving any new changes ExtendSim makes a copy of the previously saved
version of the model and saves it as ModelName.BAK. To recover a model from a backup file,
add a .MOX extension after the .BAK, then open the backup file from the File menu. You may
choose to have ExtendSim automatically save backup files or delete them when a save is successful
(see Options on page 792).
Copies data from a selected table to a text file. It works the opposite of the Import Data command.
After you give the file name, ExtendSim puts up the column separator dialog (as shown in the previous section), so you can specify what type of separator to use in the text file. You can read the text
file in ExtendSim or in a word processing or spreadsheet application. For more information, refer
to Importing and exporting data on page 714.
Appendix
784
A table from a database, dialog or plotter must be selected before this command can be used.
Import DXF File (Windows only)
Imports CAD drawings in standard DXF format from AutoCAD v13 or earlier or other CAD programs. The drawing becomes a graphic image which can be used as a background picture in the
model, the notebook, or on an icon.
Show Page Breaks
Causes ExtendSim to draw a set of page boundaries on the active window and place page numbers
in the upper left hand corner of each page. These page boundaries show where page breaks will
occur if you print the window. Since the size of a page is dependent upon the settings in the Print
Setup (Windows) or Page Setup (Mac OS) command, it is recommended that you make your
Print or Page Setup choices before showing page breaks.
When you choose Show Page Breaks, this menu item has a check mark next to it. To hide page
breaks, select this command again.
This command works independently for each active window (each model worksheet, Notebook,
dialog window, and so forth). If the command is selected for a model, that setting is saved with the
model but is not saved for the models Notebook.
Appendix
785
If you program, the structure and dialog windows have their own print dialog that lets you choose
to print the ModL code, the dialog window, the connector names, the icon, or the help text.
The Print command also lets you print individual windows, such as the Notebook, the dialog, or
the plotter window. When one of these windows is the active window, the Print command will
print the contents of that window.
This command is only enabled if the ExtendSim application is a concurrent-user network license.
Network licenses require that the ExtendSim Network License Manager software be installed on a server as a Service. The ExtendSim
application and files are then either installed on the server (such that Network License menu
client computers use ExtendSim in memory) or on the hard drives of
individual client computers (such that the client computers use a local installation of ExtendSim).
License Info
The License Info window, shown at right, provides information about network license, such
as the maximum number of concurrent users
allowed, the number of current users, the utilization, and the name of the Server that has the
license management file. The window also has
several buttons:
Create Users List. Creates and opens a list of
licenses where ExtendSim is open and the
licenses are connected to the Server (that is,
not checked out).
Open Users List. Only needed when opening a Users list that was created at an earlier time
Create Checkout List. Creates and opens a list of the licenses currently checked out from the
Server.
Open Checkout List. Only needed when opening a Checkout list that was created at an earlier
time.
The WanUsers and WanExportList text files are stored in each Clients Documents folder. Creating
these files automatically replaces any existing files of the same name. To preserve the files, use the
Save As command to rename the file or copy the file to a new location.
WANUtilLog.txt contains a record of all actions taken by the networked Clients. This includes
when each connection was made to the Server and who made it, as well as when licenses were
checked in or checked out and who did it.
WANExportLog.txt contains just the information about the checking in and checking out of
licenses.
Appendix
Log files
Two log files are automatically created on the Server and stored in the Servers ExtendSimServer
folder:
786
These files can get quite large. They can be deleted or archived if necessary ExtendSim will create
a new file if the old one is not found.
Check Out License (Network license only)
Allows you to temporarily check out a license on a client computer, such as for a laptop that is to
be used offsite. Checking out a license reduces the maximum number of concurrent users the
server will allow. That number will be restored when the license is properly checked back in.
To permanently remove a client computer from the license network, see the Remove License command, below.
Check In License (Network license only)
After reconnecting the client computer to the license network, use this command to return a
license that had been temporarily checked out from the network. This also restores the number of
concurrent users the server allows.
Remove License (Network license only)
Use this command to permanently remove a client computer from the license network. This action
deletes the information that would enable the client installation of ExtendSim to connect to the
servers license management application. You can then uninstall ExtendSim from that client. (If
you dont uninstall ExtendSim from the client computer, the next time ExtendSim is launched it
will not be able to run unless you supply the connection information.)
To temporarily remove a client computer from the license network, see the Check Out License
command above.
Properties
Shows information about the selected block or blocks, including Controls, hierarchical blocks,
size, X-Y pixel location, creation and modified dates, and which library (if any) the selection came
from.
Exit/Quit
Appendix
Leaves ExtendSim. If there are any model files with unsaved changes, you are first prompted
whether you want to save them.
787
Edit menu
The Edit menu contains the standard Cut, Copy, and
Paste commands as well as commands for directly linking
with internal data sources and external applications, performing sensitivity analysis, and specifying global options.
Undo
Reverses the most recent action. You can undo commands, moving blocks, and so on.
Cut
Removes the selected item (such as a block, some text, or
numeric data from a data table) and places it on the Clipboard. You can see the current contents of the Clipboard
by choosing Edit > Show Clipboard.
Copy
Copies the selected item to the Clipboard. You can see the
current contents of the Clipboard by choosing Edit >
Show Clipboard. Copying is useful for duplicating parts
of a model as well as for exporting to other applications.
You can copy a single block, a piece of text, a group of
blocks and text, graphical objects, or numeric values from
a data table. You can also copy sections of the Notebook
or dialog box as a picture.
Paste
Copies the contents of the Clipboard to the model. If the
Clipboard contains text, a block, or a graphic item, the copied item is placed at the insertion point.
For example, if you copy a block, click on the model worksheet, and then use the Paste command,
the block will be pasted where you clicked the mouse. If there is no insertion point, the item is
placed in the upper left corner of the window.
Clear
Removes the selected item. The menu changes to indicate what is selected, such as Clear Data or
Clear Blocks.
Removes the selected records from the currently active ExtendSim database table.
Select All
Selects all the items, such as all the blocks in a model or all the text in a field. The items selected
(blocks and text, drawing items, and so on) depend on the selection tool chosen in the tool bar.
Appendix
788
Duplicate
Makes a copy of the selected item and puts it near the original item. This is faster and often more
convenient than copying and pasting an item.
Find
This command displays a different dialog
depending on whether or not text (such as
text within a text box or within the code
pane of a blocks structure window) is
selected.
If text is not selected, the dialog to the
right appears. This dialog finds a block by
its global block number, name, label, or
category, or locates a text block by its
global block number or by the text contained within the text block. Global block
numbers are unique, permanent identifiers
for blocks and text blocks. Name means
the name of the block in the library menu
(e.g. Equation). Block labels are defined
Find block dialog
by the user in the block dialog and are
especially useful to find types of blocks.
Category refers to how the block is classified in the Library menu (e.g. Inputs).
You can also choose to open the dialog of the block once it is located. This command is useful for
large models when you are looking for specific blocks.
If text is selected (such as within a text box or within the code pane of a blocks structure window),
this command presents the following dialog.
Appendix
In this dialog, enter the text you want to search for in the Search for: edit box. The Match
Words option tells ExtendSim to match whole words only. In that situation, for example, boxer
would not be found by a search specifying box as the Search for: string. The Wrap Around
choice tells the command to begin searching from the top of the ModL code if it did not find the
text before the end.
The Replace with: edit box is used for finding and replacing at the same time (see Replace).
ExtendSim searches for text starting at the current selection and going to the end of the text. If the
specified string is found, the string is selected. If it is not found, the insertion point is not moved.
See the Find and Replace block (Utilities library) for additional block search capabilities, including
the ability to find a dialog value and replace it with another value.
789
Find Again
Repeats the most recent find operation using the same search string.
Replace
Replaces the currently selected text with the text in the Replace with: edit box from the Find dialog. (Note that you can select text directly, in which case the text contained in the Search for: box
in the Find dialog may not be the same as the text you have selected and are replacing.) If there is
no text in the Replace with: edit box, the selected text is deleted.
Replace All
Replaces every instance of the text in the Search for: box with the text in the Replace with: edit
box in the Find dialog.
You cannot undo a Replace All command, so use it with caution.
Enter Selection
Chooses the selected text to be the search string. This puts the text in the Search for: edit box of
the Find dialog and also determines the search string to be used for the Find Again command. This
is useful if you want to find the next instance of some text that is already in the code.
The Create/Edit Dynamic Link command is only used for linking parameters and tables to internal data structures. Use the DDE link commands, discussed at Paste DDE Link (Windows
only) on page 791, to link parameters and cells to external applications
When you give the Create/Edit Dynamic Link command, a dialog appears with a popup menu to
select the data structure. Depending on the structure selected, other options are presented. To
delete a dynamic link, click the linked parameter or select the linked data table and give the Create/Edit Dynamic Link command. In the dialog, choose Delete Link.
. Another type of internal data source is a dynamic array, which is implemented through a blocks
code. You cannot use the Create/Edit Dynamic Link command to link to a dynamic array. However, if a data table is already linked to a dynamic array, its upper left corner will be blue.
Appendix
The command is equivalent to right-clicking the dialog item and choosing Create/Edit Dynamic
Link, or (for a data table) clicking the Link button. Dynamically linked parameters are outlined in
light blue. Dynamically linked data tables display the words DB (database) or GA (global array) in
their upper left corner. For more information, see Dynamic linking to internal data structures on
page 717.
790
The options in the dialog allow you to choose where you want to search (the contents of databases,
global arrays, and/or dynamic arrays) and what you want to find (code-defined links, user-defined
links, or registered blocks). User-defined links were created by the modeler through the user interface; code-defined links were defined by block developers through ModL code. Registered blocks do
not have any specific dialog items associated with a link. Instead, the block just requests that it be
informed when the linked data source changes.
The DB selectors and the GA popup menu on the right of the dialog specify which database or
global array structure will be searched for. (Leaving the DB name or GA name popup menus to the
default choices seen above will find any linked database or global array.)
When the Find Links button is clicked, ExtendSim opens the dialogs of all the blocks with the
specified types of links or registration.
For more information, see Finding linked dialog items on page 723
Sensitize Parameter
If a dialog parameter is selected, this command opens the Sensitivity Setup dialog, which lets you
set values for sensitivity analysis. An alternate method of opening the Sensitivity dialog is to click
on the dialog parameter once while holding down the Control (Windows) or Command (Mac
OS) key.
A parameter that has sensitivity settings has a frame inside of it. If sensitivity analysis is active for a
parameter (that is, if the Enable sensitivity choice is checked in the Sensitivity Setup dialog), the
frame is green. If the sensitivity analysis is inactive for the parameter or if it is turned off for the
model as a whole, the frame is red.
Appendix
791
The DDE Link commands only relate to ExtendSims interaction with external applications. See
the command Create/Edit Dynamic Link on page 789 for linking parameters and tables to
ExtendSims internal data structures.
For example, clicking a Graphics Server control object when you are not in Design Mode will have
the effect of in-place-activating it. In Design Mode, double-clicking the object opens a Property
Pages Graphics Server dialog for customizing its settings.
Appendix
The way embedded objects behave in and out of Design Mode is dependent on the type of object.
In general, this command causes the external source application to open when an embedded object
is double-clicked. For an embedded object that is activated by a single click, Design Mode changes
the single-click behavior from activation to selection, allowing the embedded object to be selected
and moved without activating it.
792
Show Clipboard
Shows the contents of the Clipboard in its own window.
Options
Lets you specify how you want ExtendSim to behave. Note that this is different from the Simulation Setup command which only affects the running of a specific model. The Options command
controls actions for all models and has six tabs: Model, Libraries, Programming, Model Style, 3D,
and Misc.
Model tab
Option
Description
Use default connection Specifies whether or not ExtendSim uses the default connection line types
line types
when creating new connections (see Connection lines on page 615).
Default connection line Sets the default for the Connection Lines command from the Model menu
style is right angle
to be right-angle connections instead of straight line connections.
Appendix
Hierarchical blocks
have drop shadows
Tool Tips on worksheet Causes the block name, number, and library to be displayed when the cursor is hovered over a block on the model worksheet. If you hover the cursor
over a connector, the connector name and value are displayed. Note that
Help captions for the tool bar stay on even if this choice isnt selected.
Include additional
block information
In addition to the block name, number and library, when a cursor is hovered over a block this command will cause additional information, such as a
description of the block, to be displayed.
Causes ExtendSim to play the default system sound at the end of every simulation run.
Option
Description
Specifies that default distance or length units in the Convey Item and
Transport blocks (Item library) is meters instead of feet. In the Convey Flow
block (Rate library), distance and length units are specified directly in the
blocks dialog and this setting is ignored.
Smart Connections
If enabled, intelligent connection line control will try to anticipate how you
want connection lines to behave when blocks are moved around. Turning
this off allows you to exercise more precise control over the lines.
Lets you specify the font and size of the characters for viewing and printing
text files.
If a model pathname is entered here, that model will open when ExtendSim
is launched (when ExtendSim is installed, Getting Started.mox is the
default model.) If no path is specified, ExtendSim will look for the model in
the application directory or folder.
793
Libraries tab
Description
Automatic search
Alternate path
Displays the modified and compiled dates for each block in the library windows.
Appendix
Option
794
Option
Description
You can turn the legacy library version warnings on and off by selecting or
deselecting this. This option is selected by default and protects you from
using obsolete libraries in new models and from unintentionally overwriting
existing models with new file formats.
NOTE: Legacy libraries are included so that models created using those
obsolete libraries can still run. They should not be used to create new models. This option causes a warning message to display if a legacy library is
opened using the Library > Open Library command; the warning is not displayed if the library is automatically opened because a model is opened.
Legacy
Preload libraries
Appendix
Opens the window of the library listed directly to the left of the checkbox
when ExtendSim is started.
795
Programming tab
Option
Description
Tool Tips on block dia- Displays the variable/message dialog names when the cursor is hovered over
logs
dialog items in a blocks dialog.
Tool Tips on dialog edi- Displays the variable/message dialog names when the cursor is hovered over
tor
dialog items in a blocks dialog editor window.
Structure window
opens in front
Opens the structure window in front of its dialog editor window. Deselect
this choice to cause the dialog window to open in front.
ModL font
Specifies the font and size of the characters for viewing and printing the text
in the code pane of the structure window.
Appendix
796
Appendix
If a block developer provides for this feature, blocks can have alternate styles that affect their
appearance in a model. Model styles are saved as indexes so the developer can rename the style and
it will still work on a different computer. The radio button selects the style that will be used as a
default when a new model is created. This does not affect models that are open or already built.
797
3D tab
Option
Description
Shadows
Sounds
Turns on the sounds for 3D objects, such ambient sounds, footfalls, vehicle
tire squeals, and sounds produced by calling the E3DPlaySound function.
Displays foot prints following the movement of people objects and vehicle
trails that follow vehicle movement.
MiniMap
3D window outside
application (after
restart)
Windows only. Specifies whether or not the E3D window is a child win-
Level of detail
Controls the level of detail with which 3D objects are displayed in the window. You would only need to change from the default setting of Very High
if there are many objects on the screen and the display is slow.
Appendix
The 3D options only apply to ExtendSim products that include 3D animation. For more information about the 3D animation, see the E3D module that starts on page 448.
798
Miscellaneous tab
Option
Description
Windows only. Causes models to retain the settings specified in the Print
Setup dialog. Caution, this may not transfer successfully from one computer to another because of differences in printer drivers.
Print header/footer
Specifies whether or not the Copy command copies row and column titles
when copying from a data table. Select this option if you want to copy the
titles, such as when you are copying to another program. Do not select this
if you are copying into another table within ExtendSim.
Plotter traces default to Draws plotter traces with a pattern, allowing traces to be visible on a black
patterns
and white monitor.
Save backup model files When a Save command is given, renames the existing model to ModelName.BAK, then saves the model. This is a precautionary measure, so the
original model file wont be overwritten when it is saved. See also Save
Model and Save Model As on page 783.
Appendix
Version check on appli- Allows ExtendSim to search for new versions when it launches, determining
cation launch
if the installed version is the most current version. The search occurs each
time ExtendSim is launched. If the installed version is current, nothing happens. If the installed version is not current, or if ExtendSim is unable to
connect to the internet, a warning is placed on the About ExtendSim
startup screen.
799
Text menu
The Text menu is used to set the style of text in the model and to
temporarily set the style of text in text files. The choices are the
same as in most applications. The Border command draws a shadowed border around the text box. The Transparent command
causes the background of the text to be transparent. If the Transparent command is not selected, the background of the text is white.
For more information about using text, see Working with text on
page 596.
If you make changes to the settings in the Text menu before you
enter text, those changes will apply to all text entered after the
changes. To change only an existing piece of text, select the text
within its text box, then change the Text menu settings. In that case, Text menu changes will apply
only to that existing piece of text, and not to text you subsequently enter.
Library menu
ExtendSim opens libraries automatically when you open models. To
open or close a library manually, use the Library menu. For more
information about libraries and their usage, see Using libraries on
page 548.
Open Library
Opens a library file. This causes the librarys name to appear in the
Library menu in alphabetical order. To view the blocks in the library,
click the Library menu and drag down to the name of the library.
When the library name is selected, blocks will be listed to the right of
the menu either alphabetically or by category, depending on the
option selected in Edit > Options >Libraries tab. The first choice in each list is Open Library
Window to open a window listing the blocks in the library, as discussed at Library windows on
page 551.
Close Library
Closes an open library. This command displays a dialog of the open libraries; select the library or
libraries to be closed from the list and click Close. Libraries that are in use cannot be closed. To
close multiple libraries, Shift select the libraries (or use the Ctrl (Windows) or Command key
(Mac OS)), then click Close.
New Library
Creates a new library. When you select this command, you will be presented with a dialog to specify the name of the new library.
Allows you to protect the code of blocks, set library versions, convert libraries to RunTime format,
and edit the Startup Screen for the LT-RunTime version.
Appendix
Tools
800
Other than the two RunTime commands, the following commands are of interest only to block
developers.
Appendix
801
You would only use this command to protect libraries of blocks you build yourself. Do not use this
command with the libraries that are included with ExtendSim.
Set Library Version
Allows you to set the long and short version strings for the library. This is useful if you are programming your own libraries and are concerned about version control.
Convert Library to RunTime Format
Changes a copy of a selected library to RunTime format. This removes the ModL code, as discussed in the Protect Library command, above. It also limits the use of the library:
A RunTime formatted library can be read by an ExtendSim LT/RunTime or Demo/Player version to run models but not to build models. (The ExtendSim LT-RunTime version is discussed
on page 778.)
The full version of ExtendSim cannot read libraries that are in RunTime format. Thus RunTime
formatted libraries cannot be used to run or build models in the full version.
Converting to RunTime format provides an easy method for providing libraries to others for evaluation or model running, while preventing those libraries from being used to build models.
If creating RunTime libraries on a different computer platform, you must convert and compile the
library on the desired platform before convertin that library to a RunTime library.
List of libraries
As libraries are opened, they will be listed at the bottom of the Library menu in alphabetical order.
Appendix
802
Model menu
The commands in this window affect the parts of the
model window and the way that the window is viewed.
Connection Lines
Sets the format of the connection lines. These are described in detail in Connection lines on
page 615.
Hide Connections
Hides the connecting lines between blocks. This is a cosmetic change that is mostly used to
enhance presentations. Select the command again to show the connecting lines.
Appendix
This command works at each level of hierarchy separately and takes effect in whichever level is the
active window. Thus if you want only the top level of the model to not show connections, but the
hierarchical levels to show connections, choose the command when no hierarchical levels are open.
Hide Connectors
Hides the connectors visible on blocks. This is a cosmetic change that is mostly used to enhance
presentations. Select the command again to show the connectors.
This command works at each level of hierarchy separately and takes effect in whichever level is the
active window. Thus if you want only the top level of the model to not show connectors, but the
hierarchical levels to show connectors, choose the command when no hierarchical levels are open.
803
Controls
Allows you to add a control to the model. You can add a Slider, a Switch, or a
Meter. These are described in Controls on page 567.
Align
If two or more graphic objects, pieces of text, clones or blocks are selected,
allows you to align the objects on the left, right, top, or bottom.
Controls
Rotate Shape
Rotates the selected shape or picture by 90 degrees clockwise. Especially useful when creating
rotated views for icons.
Border Thickness
Puts a border of specified thickness, or of no thickness, around shapes. The default is a black border; change border color using the Shape Fill/Border command, below.
Shape Fill/Border
Determines whether the color selected from the Color Palette is used to fill the shape or to color its
border. See also Border Thickness, above
If the developer has not implemented this feature in the libraries, changing model styles will have
no effect on the model. Most ExtendSim libraries do not use this feature.
Lock Model
Prevents any modification to a model other than changing dialog values. Can also be used to lock
a hierarchical block. Locking models and hierarchical blocks is useful if you are giving the model to
others who are unfamiliar with ExtendSims features and may accidentally move or delete blocks.
For more information, see Locking the model on page 777.
Once you have locked a model with a password, you must have that password to unlock the model.
Always make unlocked copies of models before you lock them. When in RunTime mode, you cannot unlock a model.
Creates an invisible snap grid on the model worksheet, Notebook, or icon pane to help you draw,
move, and resize objects and blocks. The grid spacing is 4 pixels. While the grid is enabled, you
can snap the upper left hand corner of an item to the grid. To override the grid, hold down the Alt
(Windows) or Option (Mac OS) key as you move the object.
Appendix
Use Grid
804
Database menu
You can create relational databases in ExtendSim to store
data for use in a model and to store model outputs. Databases are especially useful for managing data in complex
models.
Databases are stored with the model. Databases automatically open when the model opens and are automatically
saved or closed when the model is saved or closed.
Appendix
New Database
Opens a dialog for naming and creating a new ExtendSim Database for the model. The dialog also
shows a list of the models current databases so you can avoid using a duplicate name (ExtendSim
will warn you if you try to use a duplicate name.) After naming the database, select OK to go to
the database window.
805
If you choose the name of an existing database, it will be replaced. To import tables to an existing
database, such that the database tables are appended at the end of the database, see the Import
Tables command, below.
Export Database
Exports the entire ExtendSim Database into a text file. You do this so you can import the database
into another model, to send the database to another user, or to prepare a database text file for use
by the ExtendSim Excel Add-In. To export only specific tables from a database, see the Export
Selected Tables command, below. Exported databases can only be imported to ExtendSim or to
the ExtendSim Add-In for Excel. To enable this command, bring a database window to the front,
as described under Database menu, above.
Rename Database
Renames an existing ExtendSim database. The database renaming dialog shows a list of the models
current databases, so you can avoid duplicating a name (ExtendSim will warn you if you try to
duplicate a name.) To enable this command, open an existing database by clicking its name at the
bottom of the Database menu when the model window is active or select a database in the list
when you go to Window > Database List.
New Table
Creates a new table for an ExtendSim Database and adds it to the list of tables in the databases All
Tables tab. The dialog that appears displays a list of the databases existing tables. After naming the
table, click OK. To enable the New Table command, bring a database window to the front, as
described under Database menu, above.
To delete a table from a database, select the table and use the Delete or Backspace key or go to Edit
> Clear Table. A dialog displays the delete options and, if there is data dynamically linked to the
table, warns you before deleting it.
Import Tables
Imports tables from an exported ExtendSim or SDI Industry database and appends the tables to an
existing database. To create an entirely new database using imported files, see the Import New
Database command, above. Give the Import Tables command after opening an existing database.
In the dialog, select a file to import. This command imports all the tables from the exported file
and places them below the existing tables. If you end up with unneeded tables, you can delete
them; see also the Export Selected Tables command, below. To enable this command, bring a database window to the front, as described under Database menu, above.
To import data into a specific table from a tab delimited text file, such as from Excel, go to File >
Import Data.
Rename Table
Renames the selected table in an ExtendSim Database. A dialog opens with a list of the databases
existing tables and a field for entering the new name. To enable this command, bring a database
window to the front, as described under Database menu, above. Then select a table in the database
window.
Appendix
Creates and exports a ExtendSim Database text file containing only the selected tables. Use this
command instead of the Export Database command, when you want a file that contains only a
portion of the database. To enable the command, select one or more tables in a database window.
806
New Tab
Places a tab in the database window, to the right of
any previous tabs. This is equivalent to double-clicking the blank area to the right of existing tabs. To
enable this command, bring a database window to the
front, as described under Database menu, above.
A cloned table will behave exactly like the original table and will change when the original table
Appendix
changes. Likewise, changes made to the cloned table will be reflected in the original table. Cloning
is different than copying and pasting a table using the Edit menu. Tables that are copied and
pasted are neither linked to each other nor to the original table.
807
The dialog gives options for setting the fields properties, such as its name, type, and initialization.
To enable this dialog, bring a database window to the front, as described under Database menu,
above. Then select a table and give the command.
To delete a field, use the Delete or Backspace key or go to Edit > Clear Fields. A dialog displays the
delete options and, if there is data dynamically linked to the field, warns you before deleting it.
Appendix
808
when the database window is in structure mode or select the table from the list when the database
window is in viewer mode.
To delete a record, use the Delete or Backspace key or go to Edit > Clear Record. A dialog displays
the delete options and, if there is data dynamically linked to the record, warns you before deleting
it.
Develop menu
The Develop menu is used when creating or modifying
blocks in libraries. See the ExtendSim Developer Reference to learn how to create your own libraries of blocks
and for additional information on using these commands.
New Block
Appendix
809
Rename Block
Changes the name of the block, including a hierarchical block. The block must be either selected
in the library window or its structure window must be the active window.
Compile Block
Compiles the ModL code for the block. This is useful for checking the syntax of the code that you
are working on without having to close the structure or dialog editor windows. The Compile command is only available when the structure window of a block is the active window. You can also
choose to compile the block with debugging information and with external source code, as discussed below.
Generate Debugging Info
When the block is compiled, generates debugging information for the block. This allows you to
debug block source code using breakpoints, watch points, and so forth. Blocks with debugging
code run slower. Their names and any additional information will be listed in the library window
in red and they will show in a model window with a red border around them.
To remove debugging code from a block, open the blocks structure window and uncheck the Generate Debugging Info command, or right click the block on a model worksheet and select Remove
Breakpoints. To remove debugging code for an entire library, see Remove Debug Code in Open
Library Windows on page 800.
External Source Code
When the block is compiled, generates a text file containing the blocks source code. This is used
for version control. If a block has been compiled with external source code, it will be listed in the
library window with the designation CM (code management) on the right side of its icon.
Appendix
810
New Tab
Adds a new tab to the blocks dialog window. This is equivalent to double-clicking the blank area
to the right of existing tabs. This command is only enabled when a blocks dialog window is the
active window.
Appendix
811
Go To Line
Allows you to quickly move to a specific line in the block code. This command is only enabled
when a blocks structure window is the active window.
Go To Function/Message Handler
Jumps to where the function or message handler is defined in the code. Select the function or message handler name where it is used in the code, then give the command. This is equivalent to holding down the Alt (Windows) or Option (Mac OS) key while double clicking the function or
message handler name, or right-clicking on the function or message handler name. This command
is only enabled when a blocks structure window is the active window and the function or message
handler name is selected in the code.
Match Braces
Highlights the area between the start and end of braces or parentheses in block code. Click after
the opening brace or parenthesis, then give the command. This is equivalent to right-clicking after
the brace or parenthesis. This command is only enabled when a blocks structure window is the
active window.
Match IFDEF/ENDIF
Highlights the area between a #IFDEF or #IFNDEF and its corresponding #ENDIF in block
code. Click after the #IFDEF, then give the command. This is equivalent to right-clicking after the
#IFDEF. This command is only enabled when a blocks structure window is the active window.
Set Breakpoints
Opens the Set Breakpoints window for the selected block or brings it forward into view if it is
already open. This window shows the source code for the block, along with a breakpoint margin
on the left of the window. If needed, the block is automatically recompiled in debugging mode.
This command is only enabled when a block is selected on the model worksheet.
Opens the global breakpoints window, showing all breakpoints from all blocks in the model. This
command is only enabled when a model window is the active window.
Appendix
812
Continue
Continues execution from a breakpoint. This command is only enabled when you are debugging
the source code of a block and you are stepping through the code.
Step Over
Steps over a function call when stepping after a breakpoint. This command is only enabled when
you are debugging the source code of a block and you are stepping through the code.
Step Into
Steps into a function call when stepping after a breakpoint. This command is only enabled when
you are debugging the source code of a block and you are stepping through the code.
Step Out
Steps out of a called function to return to the caller when stepping after a breakpoint. This command is only enabled when you are debugging the source code of a block and you are stepping
through the code.
Appendix
Causes the models reserved databases, if any, to be listed at the bottom of the Database menu and
in the Database List. Reserved databases allow programmers to use database capabilities without
the model-user being aware of the database. Since reserved databases can only be created and modified through the ExtendSim database API, they are discussed in the ExtendSim Developer Reference.
813
Run menu
The Run menu lets you modify the way your simulation runs, show 2D and 3D animation, and generate model reports. A hierarchical menu at the end
provides commands for debugging models. For more
information about running models, see Model Execution on page 573.
Run Simulation
Starts a simulation. The command first checks every
block in the model to see that it has been compiled.
You can run multiple models at the same time; processor speed will be divided equally between the simulations. See also Prioritize Front Model, below.
Continue Simulation
This continues a simulation run in an opened model
that was previously paused and saved during a simulation run. See Saving intermediate results on
page 583.
Simulation Setup
Modifies the start time, end time, and other settings for a simulation run, and provides options for
setting random number seeds and showing 3D animation. The dialog is described in detail in
Simulation setup on page 574.
Show 2D Animation
Causes blocks in the model that have animation to animate when the simulation is run. This is discussed inAnimation on page 609. Note that some blocks can show some animation, such as text
Appendix
814
on the icon reporting final values, even if Show Animation is not selected. You can also choose to
animate along connection lines or between named connections, as discussed below.
Add Connection Line Animation
This option controls whether or not 2D animation will be displayed along connection lines in discrete event models. If this is on, blocks from discrete event libraries, such as the Item library, will
display their item animations as discussed in Animating the movement of items between blocks
(discrete event modeling only) on page 610. If its off, only animations on block icons will be displayed. This command requires that Show 2D animation be checked and is only available for discrete event models.
Add Named Connection Animation
For named connections (text labels indicate the path and connection line does not appear on the
worksheet), this option will cause the animation picture to travel in a straight line between the two
text labels. If this option is turned off, the animation picture will disappear when it has reached a
text label and reappear at the matching text label. This command requires that Show 2D animation be checked and is only available for discrete event models.
Show 3D Animation
Opens the E3D window for showing 3D animation. If the window is subsequently closed, it will
reopen when the simulation run begins. This is the same as choosing Run > Simulation Setup >
3D Animation tab and selecting Show 3D animation during simulation run. Note that only
models using libraries that support 3D animation, such as the Item library, will animate in this
window. For more information, see the E3D module that starts on page 447.
Appendix
Opens the Stat::Fit application. This command is only enabled if Stat::Fit is installed. Stat::Fit is
included with the Windows version of the ExtendSim AT and ExtendSim Suite products; it can be
purchased separately for use with other ExtendSim products. For more information about
Stat::Fit, see Stat::Fit (Windows only) on page 661.
Generate Report
Causes ExtendSim to generate a report file when the simulation is run. ExtendSim will prompt for
a name for the new report file when the model is run. Report files show final results of the simulation for selected blocks. They are described in Reports on page 671. Use the commands that follow to specify which type of report to generate and which blocks to include in the report.
815
Report Type
Allows you to choose which report type, Dialogs (Text File), Statistics (Text File), or Statistics
(DB), to generate when Generate Report is checked and the model is run. The current selection is
shown in parenthesis following the command.
Stop
Stops the simulation. This is the same as the Stop button in the toolbar. As an alternative, you can
hold down the Control (Windows) or Command (Mac OS) key while pressing the period (.) key.
Pause
Halts the simulation temporarily. This is the same as the Pause/Resume button in the toolbar.
When you give this command, the word Paused appears in the models status bar until the simulation is resumed. To restart the simulation, give the Resume command, below, or click Pause/
Resume.
Step
Steps the simulation depending on which mode (Step Each Block, Step to Next Animation, or
Step Entire Model) is selected in the Debugging menu as discussed at Debugging on page 816.
This is the same as the Step button in the toolbar.
Resume
Restarts a paused simulation. This is the same as clicking the Pause/Resume button in the toolbar.
Appendix
816
Debugging
This hierarchical menu lets you modify the way your simulation runs and facilitates finding a modeling problem. The
three Step... commands in this menu determine how the
Step command in the Run menu performs during a simulation run. The Trace commands are used to generate a Trace
file of the values for each selected block in the active model
at each step of the simulation. For debugging hints, see
Animation features for debugging on page 705.
Pause At Beginning
If this is enabled, pauses the simulation after it starts so that
the user can step through the run from step zero. When the
simulation is paused, the word Paused appears in the
models status bar.
Step Each Block
Controls the behavior of the Step command or button so
that you can step through a simulation block by block. This
command is only active when the Pause command or Pause
button have been activated.
Debugging menu
Appendix
817
Generate Trace
Causes ExtendSim to generate a trace file during the simulation. ExtendSim will prompt for a
name for the new trace file when the model starts running. The content of the trace file depends
on which blocks have been selected to be included. For more information, see the following commands and Model tracing on page 707.
Add Selected To Trace
Causes blocks that have been selected in the active model window to be included in the trace file.
Trace files are generated if Generate Trace is checked when the model is run.
Add All To Trace
Causes all blocks in the active model window to be included in the trace file. Trace files are generated if Generate Trace is checked when the model is run.
Remove Selected From Trace
Causes blocks that have been selected in the active model window to be removed from the trace
file.
Remove All From Trace
Causes all blocks in the active model window to be removed from the trace file. Use this before
starting a new type of trace.
Show Tracing Blocks
Causes blocks that have been included in a trace to show the word Trace on them in the model
window.
Profile Block Code
Generates a text file showing the percentage of time that each block spent executing during the
simulation run. See Inefficient settings or block code on page 590 for more information about
profiling a model.
Show Debug Messages
Allows the user to turn on and off the messages created using the debugMsg() function.
Window menu
In addition to the standard (Windows only) commands for arranging
the windows in ExtendSim, the Window menu lists ExtendSim windows such as the Notebook and Navigator. The window also lists all
open models, dialogs, and library windows at the bottom. To bring a
window to the top of your workspace, select it from the menu.
Notebook
Navigator
Opens or brings forward a Navigator window for a model. This is the same as choosing the Open
Navigator tool. The Navigator has three modes: an explorer-type interface for the model; a list of
Appendix
Opens or brings forward the Notebook for a model. This is the same
as choosing the Open Notebook tool. Notebooks are used for controlling model parameters,
reporting simulation results, and documenting the model. The words (has data) after the Notebook command indicates it has content. For more information, see Notebooks on page 566.
818
databases used in the model, and a library window for open libraries. For more information about
the Navigator, see Navigator on page 770.
Database List
Opens or brings forward a window showing the databases (if any) used in the model. This is the
same as choosing the Open Navigator tool and selecting Database List in the Navigators popup
menu. Databases and their usage are discussed at ExtendSim databases for internal data storage
on page 726.
Calendar
Opens or brings forward a Calendar. If you run a model and are using Calendar dates in the
model, the calendar will automatically scroll from the beginning simulation date until the end.
This window is only available if Use Calendar Dates is selected in the Setup tab of the Run > Simulation Setup command.
E3D Window
Opens or brings forward the E3D window for showing 3D animation. This is the same as selecting
the Open E3D Window tool. The command is only enabled if your ExtendSim product has 3D
animation capabilities. For more information, see The E3D environment on page 454.
Help menu
This menu has commands for accessing ExtendSim Help and useful web sites.
ExtendSim Help
Shows a list of available Help topics. Select a topic from the list
and click Help for more information. You can search for key
words within any Help topic.
User Forum
Uses your current browser to open the ExtendSim user group home page.
Appendix
Whats New
Uses your current browser to open the ExtendSim web page describing the features in the newest
ExtendSim release.
819
Toolbar buttons
Hide/Show connectors
Navigator
Notebook
New model
3D Window
Run
Run Optimization or Scenarios
Open model
Save model
All layers
Colors
Stop
Patterns
Pause/Continue
Cut
Step
Copy
Shuffle graphics
Animation on/off
Paste
Cursor position
Animation faster
Undo
Animation slower
Zoom
Block/text tool
Graphics layer
Clone layer
Rectangle
Round rectangle
Oval
Polygon
Line
Rt angle line
Insert records
New table
Append new field
Insert new field
Show all tables
Hide all tables
Appendix
Delete records
Appendix
820
Appendix
822
This chapter provides tables of the blocks in the Value library, separated by category. Each Value
library block has an icon that represents its function, predefined input and output connectors for
quick model building, and a dialog for entering parameters and viewing results.
The tables have brief descriptions and are useful to get an idea of a blocks functionality in your
model. For more details about the usage of a block:
Click the Help button in the lower left of the blocks dialog
Look in the index of ExtendSims online Help for the blocks name
Submenus
The blocks are listed by the block categories displayed in hierarchical submenus of the Value
library menu:
Data Access: Accessing global data
Holding: Accumulating or storing values
Inputs: Generating values
Math: Calculating values
Model Analysis: Finding the best solution
Outputs: Writing data to files or display
Routing: Routing or deciding which value to use
Statistics: Calculating mean, variance
Data Access
The blocks in this category are used to access and store data in your models.
Block
Function
Imports and exports data from and to external data sources such as Microsoft Excel, ADO and ODBC compatible databases, text files, and files
from the internet via FTP.
Appendix
The data can reside in ExtendSim database tables and global arrays.
Data Init
Defines any values needed to initialize multiple database tables and global
arrays before a simulation run starts.
Creates, resizes, deletes, and views global arrays and text files. Global arrays
are general purpose arrays available anywhere in the model. Text files are
ascii files containing text data, used as a data source, that can be saved on
the computer's local hard drive or on the network.
Note: If you are interested in creating, editing, or viewing database tables,
use the commands in the database menu.
Block
823
Function
Data Specs
Read
Reads data from a data source to be used in a model. The data sources supported are the ExtendSim database, global arrays, Excel workbooks, Text
Files, and local tables.
You can specify whether you want to read a single number or a row or column of data and you can specify when the data should be read.
Write
Writes data from a model to a data destination. The data destinations supported are: ExtendSim databases, global arrays, Excel Workbooks, Text
Files, and Local Tables.
You can specify whether you want to write a single number or a row or column of data, and when the data should be written.
Holding
The blocks in this category are used to accumulate or store contents.
Block
Function
Holding Tank
Accumulates the total of the input values, and allows you to request an
amount to be removed if it is available. You can also choose to allow a
request that would make the contents go negative (such as an overdraft).
You can specify that the inputs are summed or integrated.
Wait Time
Holds its inputs for a specified amount of simulation time (the delay)
before passing them to the output. This block works like a conveyor with
slots: values come into a slot, advance position based on an advance in simulation time, then exit when their slot reaches the end of the conveyor.
Note: This block should not be used in a discrete event model.
Appendix
824
Inputs
The blocks in this category generate values to be used as inputs for other blocks.
Block
Function
Constant
Generates a constant value at each step. You specify a constant value in the
dialog (the default constant is 1.0). This block is typically used for setting
the value for inputs to other blocks. For example, you can use it for a
steady flow of fluid, cash, or a delay time value.
If the ValueIn input on the left is connected, the input value is added to
the constant in the dialog and the sum of those two numbers is output.
Pulse
Outputs a true value (1) at specified times, and a false value (0) at all other
times. In the dialog, you specify the time between outputting true values
(the delay or time out); the dialog value is overridden by the D connector.
The R connector resets the block back to the beginning of the delay
period.
Random Number
Generates random integers or real numbers based on the selected distribution. You can use the dialog or the three inputs, 1, 2, and 3 to specify arguments for the distributions. You can select the type of distribution or use
an Empirical Table. The Empirical distribution uses a table to generate a
discrete, stepped, or interpolated distribution.
Simulation
Variable
Math
The blocks in this category are used to perform mathematical calculations and functions.
Appendix
Block
Function
Decision
Makes a decision and outputs TRUE or FALSE values based on the inputs
and defined logic. The dialog lets you perform the following tests comparing A to B: greater than, greater than or equal to, equal to, less than, less
than or equal to, and not equal. You can also test for A being an invalid
number (noValue). The block can be set to use hysteresis.
Equation
Outputs the results of the equations entered in the dialog. You can use
ExtendSim's built-in operators, functions, and some or all of the input values as part of the equation. The equations can have any number of inputs
and any number of outputs.
Block
825
Function
Integrate
Integrates the input values over time using either Euler or Trapezoidal integration methods. If present, an initial value is added to the outputs.
Lookup Table
Acts as a lookup table (x in and y out) that are used to calculate what the
output value would be for the given input. Input values can come from an
input connector (the default) or can be simulation time. The output can
be discrete, interpolated or stepped.
Math
Determines the maximum and minimum values from among the values
input. The dialog shows the maximum and minimum values and the input
connectors they came from. The block outputs the maximum or minimum values and the respective connector number.
Query Equation
Intelligently searches a database and reports the best-ranked record and its
field values. Outputs to database or connectors.
Time Unit
Converts the value at the input connector from one time unit to another.
Model Analysis
The blocks in this category are used to find optimum parameter and input values for your simulation.
Block
Function
Searches for the best set of model parameters that maximizes profit or minimizes cost, given parameter limits and any entered constraints. Uses evolutionary strategies that are similar to genetic algorithms.
Appendix
Optimizer
826
Block
Function
Scenario Manager
(AT and Suite versions only) Evaluate and compare different model configurations with results.
Outputs
The blocks in this category output data to files or to display.
Block
Function
Command
Display Value
Displays the value at the input connector on each simulation step. This is
useful for debugging models and scripts because you can display the value
of a block's value output connector at any time.
Notify
Notifies the user when an event occurs. The notification can take the form
of playing a sound, stopping the simulation, or querying the user for a new
input value.
Routing
The blocks in this category route values or decide which values to use.
Block
Function
Outputs values thrown from a Throw Value block. You specify in the dialog of the block which throw block(s) this block is connected to. This
block is typically used for passing a value from one point in a model to
another without using connectors, in conjunction with Throw Value
blocks.
Select Value In
Selects its output value to be one of its inputs according to the value of the
select connector. Up to 253 inputs can be used.
Appendix
Catch Value
Sends its input value to one of its outputs according to the value of the
select connector. Up to 253 outputs can be used.
Block
827
Function
Throw Value
Throws a value to one or more catch blocks in the model. You specify in
the dialog of the block which catch block(s) this block is connected to.
This block is typically used for passing a value from one point in a model
to another without using connectors, in conjunction with Catch Value
blocks.
Statistics
The blocks in this category report and clear statistics on various blocks.
Block
Function
DB Statistics
Clear Statistics
Calculates the mean, variance, and standard deviation of the values input
during the simulation.
Statistics
Collects common statistics from blocks in a model into a single table. You
can select which types of blocks will have their information collected. The
choices are Activity, Mean & Variance, queue, Resource Item, Resource
pool, or mixed.
Appendix
Appendix
828
Appendix
830
This chapter provides tables of the blocks in the Item library, separated by category. Each Item
library block has an icon that represents its function, predefined input and output connectors for
quick model building, and a dialog for entering parameters and viewing results.
The tables have brief descriptions and are useful to get an idea of a blocks functionality in your
model. For more details about the usage of a block:
Click the Help button in the lower left of the blocks dialog
Look in the index of ExtendSims online Help for the blocks name
Submenus
The blocks are listed by the block categories displayed in hierarchical submenus of the Item library
menu:
Activities: Processing items
Batching: Joining and dividing items
Data Access: Accessing global data
Information: Getting information about items
Properties: Assigns and displays properties for items
Queues: Holding, sorting, and ranking items
Resources: Representing items as resources
Routing: Moving items to the correct place
Executive: Needed in every discrete event and discrete rate model to handle events
Activity
The blocks in this category are used to process items in the model.
Appendix
Block
Function
Activity
Holds one or more items and passes them out based on the process time
and arrival time for each item.
Convey Item
Transport
Transports item from one point to another based on distance and speed
information. Useful in creating models with 3D animation as this block is
the primary way to model multiple 3D objects moving at the same.
Block
831
Function
Workstation
Batching
The blocks in this category are used to join and divide items.
Block
Function
Batch
Allows items from several sources to be joined as a single item. Useful for
synchronizing resources and combining various parts of a job (kitting).
Unbatch
Produces multiple items from a single input item. This block can be used
to disassemble a kit, break a message packet into component messages,
route the same message to several places, or distribute copies of invoices.
Data access
The blocks in this category are used to access and store data in your models.
Block
Function
Read(I)
Reads data from a database when an item arrives. You can define an indefinite number of reads to be made by the block when an item passes
through.
Write(I)
Writes data to a database when an item arrives. You can define an indefinite number of writes to be made by the block when an item passes
through.
Appendix
832
Information
The blocks in this category provide information about the blocks in your model.
Block
Function
Cost By Item
Views and displays the cost of the cost accumulators that pass through it.
By using a sorting attribute or the row connector, the throughput, average
cost, and total cost can be calculated for different item types.
Cost Stats
Reports Statistics for costing blocks in a model. Place this block anywhere
in the model and it will report the following statistics for all costing blocks
in the model: Block Number (or label, if a label is entered in the block),
Block Name, Cost Per Item, Cost Per Time Unit, and Total Cost.
History
Views and displays information about the items that pass through it. You
specify which properties will be displayed. Properties can be attributes on
the item, priority values, or other more obscure values that are available on
the item.
Information
Reports statistics about the items that pass through it, such as cycle time
and TBI (Time Between Items).
(AT and Suite versions only) Creates a log of item information from the
data found in selected History blocks and blocks with Contents tabs.
Stores the data in an ExtendSim database. Reports can be customized.
Properties
The blocks in this category assign and display item properties.
Appendix
Block
Function
Equation(I)
Calculates equations when an item passes through. The equations can use
multiple inputs and properties of the item as variables, and the result(s) of
the equations can be assigned to multiple outputs and properties of the
item.
Get
Displays and outputs properties from items that are passing through. The
property value is shown in the dialog and output at the value output connector. You can specify multiple properties and multiple output connectors.
Block
833
Function
Query Equation(I)
(AT and Suite versions only) Intelligently searches a database and reports
the best-ranked record and its field values when an item arrives. Outputs to
database, properties, or connectors.
Set
Sets the properties of items passing through the block from input connectors, values in the dialog, or databases.
Queues
The blocks in this category hold, sort, and rank items.
Block
Function
Queue
Queues items and releases them based on a user selected queuing algorithm, such as Resource pool queue, Attribute value, First in first out, Last
in first out, and Priority. Options include reneging and setting wait time.
If you need more advanced control over the queueing algorithm, consider
using the Queue Equation block, below.
Queue Equation
Queues items and releases them based on the results of user entered equations. The result(s) of the equations can optionally be assigned to properties of the item
Queue Matching
This block is useful for matching one type of item with another, such as in
reassembling parts in the correct order or to insure that subassemblies are
correctly matched with each other. Has a specified number of internal
queues for holding items in separate groups. Releases a group when there is
downstream capacity and the group requirements have been met.
Resources
Block
Resource Item
Function
This block holds and provides items (cars, workers, orders, and so forth) to
be used in a simulation. It can be used as part of an open or closed system.
Appendix
834
Block
Function
Resource Manager
(AT and Suite versions only) Develop sophisticated resource structures and
requirements.
Resource Pool
Shift
Shutdown
Generates a schedule over time which can be used to change the capacity of
other blocks in the model. Multiple Shift blocks can be connected together
to create complex shift patterns. For example the typical 40 hour work
week can be built with two connected Shift blocks, the first containing the
work days, the second contains the work hours.
Generates shutdown information for activities in the Item library and
valves in the Rate library according to inputs or distributions specifying
time between failures and time to repair.
Routing
The blocks in this category move items to the correct place.
Appendix
Block
Function
Catch Item
This block catches items sent by Throw Item blocks without using connection lines. Any number of Throw Item blocks can send items to a Catch
Item block.
Create
Provides items or values for a discrete event simulation at specified interarrival times. Choose either a distribution or a schedule for the arrival of
items or values into the model.
Block
835
Function
Exit
Passes items out of the simulation. The total number of items absorbed by
this block is reported in its dialog and at the value output connectors.
Gate
Select Item In
Throw Item
Selects which output gets items from the input, based on a decision
This block throws items to a Catch block without using connection lines.
Any number of Throw blocks can send items to a single Catch block. You
could use the Throw and Catch blocks instead of using Combine blocks,
even from inside one hierarchical block to inside another one.
Executive
The block in this category is needed in every discrete event and discrete rate model to handle
events.
Block
Function
Executive
This block must be placed to the left of all other blocks in discrete event
and discrete rate models. It does event scheduling and provides for simulation control, item allocation, attribute management, and other discrete
event and discrete rate model settings.
Appendix
Appendix
836
Appendix
838
This chapter provides a brief description of the blocks in the Rate library. There are no block categories used in this library. For more details about the usage of a block:
Click the Help button in the lower left of the blocks dialog
Look in the index of ExtendSims online Help for the blocks name
Block descriptions
The following table is useful to get an idea of a blocks functionality in your model. More details
about usage of a block can be obtained in two ways:
Look in the index of ExtendSims online Help for the blocks name
Click the Help button in the lower left of the blocks dialog
Appendix
Block
Function
Bias
Prioritizes the flow going through it, and thereby allows you to specify a
preference for where the models flow should be directed. The bias from a
Bias block is by definition stronger than the bias from any Merge or
Diverge block.
Catch Flow
Receives flow from non-connected Throw blocks. The Throw Flow and
Catch Flow blocks (and the Merge and Diverge blocks in certain modes as
well) can be used to move flow without the use of connection lines.
Change Units
Changes the flow unit of measurement. Blocks that are connected together
through flow connections and share the same flow unit are called a unit
group. The Change Units block uses the conversion factor to create a new
unit group. This causes the blocks downstream of the Change Units block
to be in a unit group different from its upstream blocks.
Convey Flow
Add a delay to the flow available at the output of the block. The Convey
Flow is FIFO and can be accumulating or non-accumulating.
Diverge
Distributes the input flow to two or more outputs. Systems modeled using
discrete rate technology frequently have one flow stream that needs to be
split (or diverged) into multiple streams (referred to as branches). It has
seven different rule-based options that define how the inflow will be distributed across the outputs.
Interchange
Acts as a Tank interfacing between Flow and Items. The Tank acts as
source, intermediate storage, or sink.
Block
839
Function
Merge
Merges flows from multiple inputs into one output. Systems modeled
using discrete rate technology frequently have multiple flow streams
(referred to as branches) that need to be merged into one stream. It has
seven different rule-based options that define how the inflow will be
merged from all inputs.
Sensor
Tank
Throw Flow
Sends flow to non-connected Catch blocks. The Throw Flow and Catch
Flow blocks (and the Merge and Diverge blocks in certain modes as well)
can be used to move flow without the use of connection lines.
Valve
Controls, monitors, and transfers flow. This block places an upper bound
on the rate at which flow is allowed to pass through. Goals can be set up to
control flow.
Appendix
Appendix
840
Appendix
842
This chapter provides tables of the blocks in the Utilities library, separated by category. Each Utilities library block has an icon that represents its function, predefined input and output connectors
for quick model building, and a dialog for entering parameters and viewing results.
The tables have brief descriptions and are useful to get an idea of a blocks functionality in your
model. For more details about the usage of a block:
Click the Help button in the lower left of the blocks dialog
Look in the index of ExtendSims online Help for the blocks name
Submenus
The blocks are listed by the block categories displayed in hierarchical submenus of the Utilities
library menu:
Developer Tools: Provides information about OLE objects
Discrete Event Tools: Managing and reporting on discrete event models
Information: Getting information about the model
Math: Performing mathematical calculations
Model Control: Controlling how the model runs
Time: Working with time functions
Developer Tools
The block in this category provides information about OLE objects.
Block
Object Mapper
Function
Gets information about IDispatch properties and methods exported by
activeX controls or objects that have been embedded or automated. It is
useful for those needing to navigate the object model of an outside application or an embedded object via Extend's OLE programming capabilities.
Appendix
Block
Function
Event Monitor
Displays the event calendar in discrete event models, revealing the event
times for all event posting blocks.
Item Messages
Displays detailed information about the messages used to pass items. This
block is invisible to the items and messages and passes each message it
gets on to the next block. Also see the Record Message block, below.
Block
843
Function
Link Alert
Queue Tools
Views and optionally initializes the contents of a queue via tables. Connect
the input connector to the length (L) connector on a queue (this is the
only type of connector that can be connected to this block).
Record Message
Records all the messages that pass between two value connections in a discrete event model. Also see the Item message block, above.
Stop Message
Transfers the value from the input to the output without relaying any discrete event messages. The output connector is set equal to the input connector, but the message is not sent out through the output connector.
Information
The block in this category provides general model information to the user.
Block
Function
Block Info
Count Blocks
Drag a clone of a dialog item onto this icon to search for similar dialog
items. You can also manually enter search criteria into the dialog.
Calculates the amount of memory required for each block, global array, or
database table in the model. It is helpful in locating where memory is being
used in large models.
Appendix
Memory Usage
Reports information (name, number, position, etc.) about the block connected to its input connector.
844
Math
The blocks in this category perform mathematical functions.
Block
Function
Data Fitter
Uses matrix techniques to obtain a least mean square curve fit to a set of
data. Both the data and the fitted curve are output during a simulation
through the output connectors (D and F, respectively).
Model Control
The blocks in this category provide various means of controlling the simulation run.
Block
Function
Buttons
Creates a pushbutton interface for a model. An equation is executed whenever the button is pushed. The button itself can be cloned to the model
worksheet, notebook, or hierarchical block to create a user interface for the
model.
Feedback
Meter
Displays the input relative to minimum and maximum values set in its dialog.The color and pattern can change when the current value reaches specified values. Useful as a progress bar or to animate hierarchical blocks.
Model Interface
Appendix
Pause Sim
Popups
Allows you to define a custom popup menu that you can clone to the
worksheet and also use as a numeric input to your model. Outputs the
value of the popup defined in the dialog, which is usually cloned to the
worksheet.
Run Model
Primarily used to clone out the Run Simulation Now button onto the
worksheet or notebook. This can also be done with the Buttons block.
Runs the simulation when the Run Simulation Now button is pressed.
Block
845
Function
Slider
Switch
Defines a switch for use on a model worksheet. Differs from the use of the
switch control defined in the model menu in that it sends out a message if
it is in a discrete event model.This will have the effect of making the other
blocks in the model react immediately to the switch click.
Time
The blocks in this category work with time functions in the model.
Block
Function
RealTimer
TimeSync
Synchronizes the model to run in real time. It does this by pausing on each
simulation step until the amount of simulation time that has passed equals
the amount of real time that has passed. This is only effective if the model
is running faster than real time.
Appendix
Appendix
846
Appendix
Upper Limits
A list of the maximum numbers of things
that you can do at one time
848
Upper Limits
Like every program, ExtendSim has its limits. It is unlikely that you will find them in your normal
work, but it is good to know what they are. Note: Some limits depend on available memory.
Steps in a simulation run
2 billion
2 billion
31
Blocks in a model
2 billion
Blocks in a library
200
40
200
2 billion
2 billion/1,000/2 billion
2 billion
255
4 megabytes
1024
255
2 gigabytes
255
Columns in a table
Total table size (cells) per block for static data tables
2 billion
Appendix
127
127
Nested loops
32
1E308
2,147,483,647
16 (double)
500
Appendix
Cross-Platform Considerations
File conversion, file name comparisons, and keyboard shortcuts
for the Windows and Macintosh operating systems
850
Cross-Platform Considerations
Libraries
Libraries
Libraries are located in the ExtendSim9\Libraries folder, but can be in subfolders within that
folder. Libraries needed by a model can also be at the model file location.
Windows: ExtendSim supports library file names up to 64 characters. Library names must end in
the .LIX extension.
Mac OS: Library names can be up to 31 characters long and usually end in Lib, although this is
not required.
Models
For Windows, ExtendSim supports long file names. All Windows models must end in the
.MOX extension. Mac OS model names can be up to 31 characters.
Appendix
The following table lists some common actions and keyboard shortcuts under the Windows and
Mac OS systems. Appendix A: Menu Command Reference starting on page 782 contains pictures of the ExtendSim menus, including the keyboard equivalents for the menu commands.
Action
Command
Windows keyboard
Mac OS keyboard
Open a model
CTRL+O
CMND+O
Open a library
CTRL+L
CMND+L
Save a model
CTRL+S
CMND+S
CTRL+W
CMND+W
Run a simulation
CTRL+R
CMND+R
Stop a simulation
CTRL+period (.)
CMND+period (.)
CTRL+period (.)
CMND+period (.)
Select a parameter
Edit > Sensitize
for sensitivity analy- Parameter
sis
(Select parameter first)
Open a library
blocks structure to
edit the Modl code
or icon
Cross-Platform Considerations
Transferring files between operating systems
Action
Command
Proportionately
scale drawing object
Windows keyboard
Mac OS keyboard
851
Models and libraries developed in an older version and different platform may not transfer successfully. It is strongly recommended that you upgrade to the latest version on the source platform, resave the structure of any hierarchical blocks stored in libraries (see Saving hierarchical blocks to a
library on page 605) and recompile any libraries that you have created. Then re-save your models
before transferring your files.
It is important that you do not delete the MOX extension from a Windows model file name before
transferring the model to your Mac OS system. The MOX extension is required so ExtendSim can
identify the file as a Windows model. After ExtendSim has converted the Windows model to Mac
OS format, save the model under the same name or a new name.
Mac OS to Windows: If you transfer files from a Mac OS to a Windows computer, you may
need to change the name of your file before you transfer it. ExtendSim supports file names of up
to 64 characters for Windows. File names must end in a three-character extension (the extensions are .MOX for ExtendSim model names, .LIX for library names, and .TXT for text
file names). To change your file names to Windows format, change the name of the file on the
Mac OS computer using ExtendSims Save As command (if the file is open) or using the Finder
(if the file is not open).
Libraries and extensions created on a Mac OS computer need to be converted before being physically transferred to the Windows system, as discussed below.
File conversion
Depending on the type of file, file conversion may be handled automatically by ExtendSim or may
involve using a conversion application. As discussed below, ExtendSim automatically converts
model files when they are opened on a different platform. If you program your own blocks, the
Appendix
Once you have made any necessary file name adjustments, physically transfer the files between
Windows and Mac OS computers. This process depends on your system resources and is independent of ExtendSim. For example, you might copy the file onto a memory stick. Or you could send
the files directly from one computer to the other if the computers are networked.
852
Cross-Platform Considerations
Transferring files between operating systems
ExtendSim for Mac OS package includes a file conversion utility which you can use to convert
libraries and picture resource extensions from one operating system format to another. Other
extensions that you build, such as QuickTime movies, DLLs, and Shared Libraries require more
extensive conversion. Include files are, of course, already cross-platform compatible.
Model files
The Windows version of ExtendSim can read ExtendSim model files created on the Mac OS as
long as the name format is correct, as discussed above. The Mac OS version of ExtendSim can read
ExtendSim model files created under Windows without file name modification (in fact, as discussed in the Note above, the MOX extension should not be removed.) When you open a model
file that was created on another operating system, ExtendSim will notify you that it is converting
the file from that system to the current one. Once you save the model file, it will be in the format
of your current operating system.
If your models (including hierarchical blocks) use libraries that you have created yourself, and you
have changed the name of those libraries, ExtendSim will not be able to locate the library. In this
case, ExtendSim will ask you to find and select the correct library as described in Searching for
libraries and blocks on page 549. Keeping all your libraries in the Libraries folder will make this
search process easier. Saving the model will cause the new libraries to be used from then on.
For model files that have blocks that access text files (such as the Read block from the Value
library), you may need to change the name of the text file that is being read to conform to platform
requirements, as discussed above. Be sure to also change the name of the file in the Read blocks
dialog to correspond to the new file name.
The first time you run a model that has been transferred from one operating system to another, any
Equation blocks in the model will recompile to the format of the new system at the beginning of
the simulation run. Messages that report this process may appear too quickly for you to read.
This is only required for hierarchical blocks saved in libraries; hierarchical blocks saved only in a
model get updated with the model.
Appendix
When you add a hierarchical block from a library to a model worksheet, the hierarchical block
causes ExtendSim to open the libraries of the blocks inside it. Since you have renamed those libraries, ExtendSim will not be able to locate them. In this case, ExtendSim will ask you to find and
open the correct libraries. Note: keeping all your libraries in the Libraries folder will make this
search process easier.
If you save the model worksheet that contains the hierarchical block, the location of the renamed
libraries is saved for the model only. Before you close the model worksheet, you also need to
update the hierarchical blocks library information. To do this, open the hierarchical blocks structure window and then close it, causing the hierarchical blocks Save dialog to appear. In the dialog,
choose Also save to library. This process is described in Summary of results of modifying hierarchical blocks on page 608.
Cross-Platform Considerations
Transferring files between operating systems
853
Libraries
The libraries that come with your ExtendSim package are already formatted correctly for your
operating system. However, if you build your own libraries, and want to transfer them to a computer running a different operating system, you must convert them to the appropriate operating
system format. You do this on the Mac OS computer using the Libraries > Tools > MacWin Conversion command (See MacWin Conversion (Mac OS only) on page 801). This converts libraries to the specified operating system format, ensures that the file names are properly formatted,
and so forth.
After the libraries have been converted to Windows or Mac OS format, physically transfer them to
the target computer (that is, keep them on the Mac OS or transfer them to a Windows computer).
Then recompile the libraries under the target computers operating system using the Library >
Tools > Compile Open Library Windows command.
The MacWin Conversion converts libraries to either Windows or Mac OS format. After conversion, you must recompile the library on the target computer. When you do this, the library will
compile to native code for the target system. For example, if you compile on a Windows computer,
the library will be in native Windows mode. If you compile on a Power Mac OS computer, the
library will be in native Power Mac OS mode.
Blocks that use the equation functions
If you build blocks that use the equation functions, your code needs to detect if the model is being
opened on a different platform. See the ExtendSim Developer Reference for more information.
Extensions
Extensions are files (such as pictures and DLLs) that can be accessed by ExtendSim to fulfill specialized tasks. Like libraries, the extensions that come with your ExtendSim package are formatted
correctly for your operating system. However, if you build your own extensions, and you want to
transfer your extensions or blocks to a computer running a different operating system, you will
need to do some conversion:
Pictures: As discussed in the Developer Reference, ExtendSim for Windows accepts three kinds
of pictures: WMF (Windows MetaFiles), BMP (Bitmap), and a Mac OS picture resource file
that has been converted to Windows format. ExtendSim for the Mac OS accepts only picture
resources. To convert Mac OS picture resource files to Windows format, use ExtendSims MacWin Converter utility on the Mac OS. To convert Windows pictures to Mac OS format, use a
graphics conversion application.
Sounds: Shareware utilities are available to convert Mac OS sound resources (SNDs) to Windows sound files (.WAV) and vice versa.
The following ModL constants return TRUE or FALSE depending on the platform: PLAT-
Appendix
DLLs and Shared Libraries: On Windows the DLL functions will search the ExtendSim
Extensions folder for a DLL file. For the Mac OS those same calls will search for a Shared
Library file.
854
Cross-Platform Considerations
Transferring files between operating systems
if (PLATFORMWINDOWS)
windows specific code
else if (PLATFORMMAC)
Appendix
Index
Symbols
_3D objectID property
ObjectID 522
_Animation property 206
_cost attribute 271, 275
_Item priority property 126
_Item quantity property 129, 206
_rate attribute 271, 275
+/- button 30
Numerics
3D Animation tab (Simulation Setup) 535, 579
3D Bank Line Advanced model 488
3D Bank Line Final model 474
3D Bank Line Start model 475
3D camera 455
3D Controller block 470, 507, 541
3D objectID property 130
3D Options tab of 3D Controller block 541
3D Position (X, Y, Z) option 538
3D Scenery block 505, 541
3D tab (Options command) 507, 534, 797
3D Text block 505, 542
3D window outside application option 457, 534, 797
A
ABC (activity based costing) 268
About ExtendSim command 819
Access 765
accumulate data 285, 625
with Holding Tank block 286
accumulating conveyor
Convey Flow block 400
Convey Item block 195
accumulation point 402
Action menu (E3D Editor) 528, 544
ActiveX 763
automation 763
COM (Component Object Model) 764
scheduling 179
activity based costing 268280
Activity block 830
contents 698
Item Animation tab 538
multitasking 190
Preempt tab 184
preemption options 184
processing items 170
processing options 173
Shutdown tab 185
tutorial 104
ad hoc experiments 630
Add All To Report command 672, 815
Add All To Trace command 708, 817
Add Connection Line Animation command 814
Add Debug Code to Open Library 800
Add External Code in Open Library 800
Add Named Connection Animation command 814
Add Selected To Report 672, 815
Add Selected To Trace command 708, 817
Add-In for ExtendSim database
Check Database Consistency 741
Find Database Table 742
address (of a data structure) 752
ADO 765
Advanced Resource Management (ARM) 229
blocks in the system 260
definitions of terms 230
how it works 229
policies 251
pools of resources 241
release rules 250
resource orders 247
Resource Pool blocks in 232
resource requirements 252
statistical information 241
tutorial 230
advanced resources 230, 231
Advanced Resources database 260, 261
agent-based modeling 51
Air Freight with Item Log model 285
Airline Security model 459
Align command 620, 803
allocate item availability 299
856
Index
857
B
backup files 783, 798
BAK files 783, 798
balking 135
Balking model 135
Bar Chart block 669
Batch and Unbatch Variable model 209
Batch block 201, 831
batching items 200
Item Animation tab 537
Mount objects option 538
options for 3D animation 537
batch into one item 201
Batch means 625
Batch Mode Merge model 375
Batch on Demand model 205
batch size 209
batch/unbatch mode 375
batched value 210
batching 200207
_Animation property 206
_Item quantity property 206
attribute options 206
batch size 201
Batch tab 201
delay kit at... 207
item properties 205
matching items 203
on demand 205
Options tab 201
priority options 206
Properties tab 206
resources with items 219
simple 203
using item attributes 203
variable number of items 204, 209
Batching and Unbatching model 208
Batching Variable model 204
beta distribution 687
Bias block 419, 838
bias order 381, 419
displaying 424
effective rate calculations 419
Index
global 743745
arrival times 115119
Arrivals and Activity model 228
Arrows option (connection lines) 616
ASCII files
text files 761
assumptions, changing 19
attributes
system 275
attributes (flow)
definition 339
displaying 342
Get(R) block 342
layers 341
merging and diverging 382
mixing with item attributes 343, 415
names 339
string 339
string layer 300, 339
types 339
values 339
attributes (item) 119126
_cost 271, 275
_rate 271, 275
arrays 125
costing 275
DB address 120, 123
deleting 299
example of use 108
for setting processing time 176
introduction to 96
managing 299
mixing with flow attributes 343, 415
removing 220
renaming 299
resource blocks 220
string 120, 123, 299
string, creating a 108
stripping 220
to hold cumulative values 285
types 120
using 121
value 120, 123
Attributes for Routing model 161
attribute-sorted queue 133
Auto Club Emergency Service model 238
AutoCAD files 784
Automatic search option 549, 553, 793
automation (ActiveX) 763
858
Index
block number
global 697
local 559
showing 804
block type table 301
block units 350
defining 351
introduction 315
blocking 159, 172, 189
definition 135
due to shutdown 190
in a Valve 423
in the Select Item Out block 155
using buffers to prevent 167
859
Index
Index
860
connector
Array 556
arrays of connectors 556
common for Rate library blocks 426
common Item library connectors 301
compatible 558
connecting 28
definition 15
description 28
diamond 603
Flow 314, 556
hiding 802
Item 97, 556
item index 97
messages of item connectors 305, 307
messages of value connectors 305
names 604
showing 619
text object 604
tool tips 792
861
connectos
hiding 619
conserving resources 207
Constant block 824
constant distribution 687
constant values
definition 57
constraining resources 216
constraints (discrete rate)
critical 361
impact on effective rates 369
relational 361
varying over time 322
Index
862
Index
D
D input connector 179
daisy-chaining 89
dashboard 564
data
blocks for data access 759
clearing from plotters 671
863
copying/pasting 713
databases for storing 726
editing in database 737
exchanging (ActiveX) 763
exchanging with external applications 748
global arrays for storing 744
import/export methods 714
importing/exporting 714
management 712767
management and exchange using blocks 750
managing 726
raw historical 661
reading 716
repository 726
sharing with external applications 724
source (organizing) 760
source indexing 760
structures (addressing) 751
structures (communicating with) 751
writing 716
database
Index
Access 765
external (exchanging data with) 749
external (opening links to) 791
Industry 735
internal (ExtendSim) 789
SQL 765
Database (ExtendSim) 726743
Index
864
determining 85
other than 1 85
setting 85, 576
865
distance
metric 793
Distance (m) option 538
distance ratio (3D animation) 579
distribute properties option 210
distribution
arguments 295
central tendency 686
list of distributions 687689
location argument 686
shape argument 686
shape of exponential 116
skewness 686
spread 686
theoretical 686
varying the arguments 295
distributional mode 378
bias order determination 424
Distributional Mode Diverge model 378
Distributional Mode Merge model 379
distributions
beta 687
binomial 687
Cauchy 687
Chi Square 687
constant 687
empirical 686, 687
Erlang 687
exponential 116, 687
Extreme Value Type 1A 687
Extreme Value Type 1B 687
gamma 688
geometric 688
Index
introduction 310
item connector messages 446
LP area 360, 435
LP technology 434
messages 445
messaging 444
outflow branches 373
overview 312
Rate block flow messages 446
rate sections 359
rates (introduction) 316
throw and catch 383
time units 350
units and unit groups 315
upstream supply 376, 441
value connector messages 445
Display Value block 590, 695, 826
866
hyperexponential 688
Hypergeometric 688
inverse gaussian 688
Inverse Weibull 688
Johnson SB 688
Johnson SU 688
Laplace 688
Logarithmic 688
Logistic 688
loglogistic 688
lognormal 688
negative binomial 689
normal 689
Pareto 689
Pearson type V 689
Pearson type VI 689
Poisson 689
Power Function 689
Rayleigh 689
triangular 689
uniform integer 689
uniform real 689
user-defined 686
Weibull 689
Index
E
E3D Editor 491498
creating scenery with 506
Gizmo 493
menu commands 543
mode categories 493
Terrain modes 496
World Editor Inspector (WEI) mode 492
World modes 494
E3D environment
867
controlling 451
opening the E3D window 454
overview 449
selecting the environment file 579
E3D window
3D Animation tab 535
3D window outside application 797
associated model 456
camera for E3D window 455
closing 457
conversion ratios 536
creating paths 525
definition 449
E3D Editor 491
environment file 490, 536, 579
exploring 454458
ExtendSim icon 455
foot prints 797
interface controls 454
level of detail 797
MiniMap 455
MiniMap option 797
mouse-look toggle 457
navigation within the window 456
opening 454, 457, 470, 534
outside the application window 457
scenery 469
shadows 797
sounds in 521, 797
title bar 455
vehicle trails 797
E3D Window command 457, 534, 818
Index
868
calendar 303
current 305
future 305
generating 303
messages in discrete event models 305
posting 304
zero time 303
ExtendSim
architecture 5
capabilities for modeling 4
databases 726743
Excel Add-In 805
Help 818
icon in E3D window 455
launching an alternate Extend application 783
legacy libraries 546, 547
levels of use 5
libraries 546
LT-RunTime version 778
messaging in models 591
network licenses 785
Options command 792
source code debugger 702
support 818
updates 818
upper limits 848
whats new 818
Excel 762
and DDE linking with ExtendSim 725
exchanging data with 749
ExtendSim DB Add-In 740
ExtendSim DB command in 740
updating remote references for DDE linking 726
Index
F
F connector 190
factors 633
FC
name of pool or group 258
feedback 87
delays 87
loops 87
Feedback block 844
Field name option 738
Field Name popup menu 719
Field Properties dialog 738
Field type option of Field Properties dialog 738
Field type popup menu (for database) 739
fields (database) 720
adding to a table 730
field types 730
for DB address attribute 120
in database table 727
869
managing 737
parent/child 731
fields (parameter)
blue frame 720
linking to a database or global array 718
outlined in green 718
outlined in red 718
outlined in yellow 718
filtering condition
creating 243, 253
definition 230
for a group 256
name of pool or group 258
types 253
Index
870
infinite 358
maximum 357
overview 357
types 357
flow rules
critical constraints 361
fixed 373, 376
information to Executive 437
relational constraints 361
Index
871
pure 600
uses 598
GS connector 393
H
header files 683
headers 774
help 818
getting technical support 7
printing the text 772
I
icon
changing the appearance (hierarchical block) 607
custom 554
grid 803
views 16, 554
IFDEF 811
IFNDEF 811
Imagine That Home Page command 818
Imagine That, Inc. 7
Import Data command 715, 762
Import Data Table command 783
Import DXF File command 784
Import New Database command 735, 804
Import Tables command 736, 805
importing data 714716
methods 714
Include additional block information option 792
include files 810
include files for equation-based blocks 683
indexing
table by data source type 760
indexing (data source) 760
indicators 337, 403
in Bucket Elevator 2 model 415
Indicators tab 338, 403
Industry database 735
Index
Index
872
873
J
JIT 191
JMP custom design 638, 646
Min/Max column of Scenario Manager block 638
Index
874
Index
875
LP Solver 434
M
M/M/1 queue 134
Macintosh
file conversion 851
Index
Index
876
basics 15
before you start 55
block definition 15
blocking of items 135
blocks that represent functions 676
building 25
closing 782
comparison of types 44
connection lines 16
connectors 15
continuous 60
continuous (definition) 44
converting for cross platform use 852
copying 775
cross-platform 850
debugging hints 694
definition 42
design of experiments 638
deterministic 58
differential equation 85
discrete event (definition) 44
discrete rate (definition) 45
distributions 686689
factors for scenario analysis 633
file names 850
goals 54
grid 803
icons 15
initial conditions 588
inputs for scenario analysis 633
integration methods 87, 690
item quantities 129
jockeying of items 136
layout for discrete event 95
locking 777, 803
logical models 43
Macintosh file name 850
measuring model performance 696
messages 591
Monte Carlo 47, 580
multiple runs 580, 589
multiple windows 591
names 850
non-terminating systems 588
notebook 566
number of runs 588
open a new model 25
opening 15, 782
order of calculation for blocks 88
parts of a model 15
877
discrete event 92
discrete rate 310
N
named connections 34, 618
Show Named Connections command 618
names of blocks 15
length of name 848
Navigator 770772
Database List mode 771
introduction to 37
Library Window mode 771
Model Navigator mode 38, 771
printing 772
Index
878
O
Object command 791
Object Mapper block 764, 842
object model 764
ObjectID 130, 482, 522
objective function 659
objects (3D) 500522
actions table 501
changing property values 511
collision 521
creating 502507
deleting 507
gravity, friction, and momentum 521
inspecting, using the E3D Editor 492
mounting 471, 519
moving 509
properties 501
rotation 470, 514
scaling 516
scenery 505
showing and hiding 512
skins 508
unlinking 2D/3D positions 484
waypoints 468, 518
objects (embedded)
using COM/OLE 764
objects (graphic)
aligning 803
colors 620
copying 774
drawing 619
Index
879
P
page breaks 784
page numbers 784
Page Setup command 784
parallel processing 153, 172
buffering 163
examples 105
explicit ordering 159
line balancing 163
simple parallel connections 172
successive ordering 158
using one Activity block 172
parameters
arguments 686
blue frame 720
changing 20
changing dynamically (methods for) 776
definition 57
green 718
linking to a global array 719
linking to an ExtendSim database 718
red 718
yellow 718
Parent Record Index 680, 681, 755
Index
880
Index
Predator/Prey model 74
Predict the path of the item 155
preempt connector 412
Preempt tab 184
Preempting model 185
preemption 184
definition 183
options in Activity block 184
preferences for ExtendSim 792
Preload libraries option 794
preprocessing 293
preserve uniqueness 210
in both Batch and Unbatch 210
in either Batch or Unbatch 211
preserved value 210
PRI 680, 681, 755
Print and Page Setup hints 774, 784
Print command 772, 784
print dialog 773, 784
Print header/footer option 798
Print Setup command 784
printing 772774, 784
add frame 773
header and footer options 798
headers and footers 774
hierarchical blocks 773
page breaks 784
page numbers 784
Print and Page Setup hints 774
Print Setup settings (saving) 798
selecting what to print 772
priorities 126128
overview 96
used for routing 160
Prioritize Front Model command 591, 813
Prioritize With Bias Blocks model 420
priority mode 376
bias order determination 424
Priority Mode Diverge model 377
Priority Mode Merge model 378
Priority model 134
priority-sorted queue 133, 134
probability distributions 686689
processes
costs 273
discrete event 170
examples 170
interrupted 183
881
parallel 172
serial 171
Q
QE
1 from name of pool or group 258
quantity expression
1 from name of pool or group 258
creating 244, 254, 256
definition 230
Order By clause 256
Quantity clause 255
Index
882
DBQS 753
differences from Query Equation block 756
input variables 678, 754
output variables 680, 755
pass-through items 753
query cycle 753
ranking rules 756
spawned items 753
queue
Index
R
R connector 363
Random Activity model 175
random distributions 686689
Random Intervals model 116
Random Number block 21, 824
setting time-based parameters 295
random number generator 577, 684
optional 685
recommended 578, 684
random number stream 685
random numbers 684685
for database cells 739
resetting 685
Random Numbers tab 577
and confidence intervals 628
random seed 577, 685
Random seed option 577
Random Shutdown model 189
random variables (definition) 57
randomness 58
ranking rules 139
least dynamic slack 139
maximizing service levels 141
minimize setup 140
tie-breaking 142
Rate attribute 130
Rate block flow messages
in discrete rate models 446
Rate library 547, 838
animation 428
common connectors 426
overview 313
rate sections 359
boundaries 359
determining 369
rates
effective 357, 423
flow 312
goal 391
in discrete rate models 316
infinite 358
maximum 357
precision 360
sections 359
883
Index
reneging 135
Reneging model 136
Replace All command 789
Replace command 789
replace with 788
Replace, Find Again command 789
replications 633
Report Type command 672, 815
reporting 671674
commands 814
Dialogs (Text File) report 671
report types 815
Statistics (DB) report 671
Statistics (Text File) report 671
steps 672
Reservoir 1 model 14
Reservoir 2 model 68
Reservoir 3 model 71
Reset random numbers for every run option 577
residence blocks 300
resize button 30
resolution popup menu (in E3D window) 455
resource allocation policy in ARM 251
resource filtering condition 253
Resource Item block 219, 272, 833
advantages and disadvantages 219, 259
creating resources as items 215
Resource Item method 215
Resource Manager 834
Resource Manager block 214
advantages and disadvantages 259
creating pools 241
creating resources 242
filtering conditions 243, 253
groups of resources 246
policies 251
Policies tab 235
quantity expressions 244, 254
release rules 250
Release Rules tab 234
Requirements tab 233
resource requirements 243, 245, 252, 257
Resources tab 232
used in a model 231
Resource Order ID
assigned to item 262
associating an item with a resource 247
definition 230
884
Index
scheduling 222
scheduling using other methods 223
scheduling using Shift block 224
scheduling using TR connector 222
status (in ARM) 247
used in multiple places 218
using the Resource Manager block 242
885
S
S (sensor) output connector 402
S (status) connector 423
Save and Next Field button 739
Save backup model files option 798
Save Block to Library As command 606
Save Model As command 783
Save Model command 783
Save Print Setup settings option 798
Save Text File As command 783
Save Text File command 783
saving
a hierarchical block 605
a library 552
a model 27, 783
an environment file 518
Scale option 538
scaling
number of items 293
scaling a 3D object 516
format of scale property 517
scattergram 670
scenario analysis 632
database varaibles 640
design of experiments 638
Dialog Factors table 635
Dialog Responses table 637
dialog variables 633
factors (defined) 633
levels 633
Model Data database 643
replications (defined) 633
responses (defined) 633
source list 644
sources 640
targets 640
tutorial I 633
tutorial II 640
Scenario DB database 634, 639
Scenario Manager 826
Scenario Manager block 632, 779
Dialog Factors table 635
Index
886
Index
887
Index
benefits 4
continuous modeling 60
controlling the run 583
Custom order 88
definition 43
deterministic 58
discrete event modeling 95
discrete rate modeling 310
duration 84, 584, 589
events 16
Flow order 88
importance 4
integration methods 87
interactive 16
Left to right order 88
messages 591
monitoring the run 583
Monte Carlo 47
multiple 580, 589
number of runs 575
number of runs (maximum) 848
order 88
order of execution 707
parameters 25
pausing 580, 583, 815
process 55
prompt for user input 569
replications 633
results 18
running 18, 33, 580584
running multiple models simultaneously 591
running with Equation/Equation(I) block 852
runs 25
runs (determining) 589
saving intermediate results 583
slowing down a 591
sound 569
speeding up a 589
state chart 49
State/Action 49
status bar 582
stepping through 580
steps 16
stochastic 58
stopping 569, 815
time 84
timer inconsistencies in discrete event models 582
timing 584
simulation order 88, 804
Simulation Setup command 25, 84, 574, 813
888
Index
T
tab delimited files 763, 783
Table Properties dialog 738
tables
changing number of rows 138, 678, 680, 754
deleting rows 138, 679, 680, 754
duplicating rows 138, 679, 680, 754
tabs
deleting dialog 810
moving dialog items to 810
new database 806
new dialog 810
renaming dialog 810
Tank block 320, 839
animation 428
attributes 341
block units 350
capacity 347
critical constraints 364
direction animation 429
infinite checkbox 321
initial contents 335
level animation 428
889
Index
890
transportation 192
Transportation 1 model 197
Transportation 2 model 197
travel time 292, 477
move time setting 478
options 193, 480
speed and calculated distance setting 480
speed and distance setting 485
Index
U
Unbatch block 207, 831
unbatching items 200
Unbatch Mode Diverge model 375
unbatch/batch mode 375
unbatching 154, 207210
batch size 209
batched value 210
create multiple items 208
distribute properties 210
item properties 210
preserve uniqueness 210
V
validation 57, 66
value attributes 120
value connector messages 294, 305
891
values
definition 57
dynamic 776
informational 96
static 776
Valve block 320, 839
animating blocking/starving status 430
animating goal 431
animating hysteresis 431
animating limiting status 429
animation 429
critical constraints 363
duration goal 395
Flow Control tab 390
goal for rate 391
GS (goal status) connector 393
hysteresis 397
maximum rate 357
maximum rate initialization 363
polling constraints 363
quantity goal 391
status options 423
W
Wait Time block 823
waiting costs 271, 279
wants 307
warm-up bias 589
warm-up period 283, 589, 626
waypoints 468
WEC (World Editor Creator) mode 495
Weekly and Daily Shifts model 227
WEI (World Editor Inspector) mode 492, 494
Weibull distribution 689
Whats New command 818
window
database 804
E3D Window 457
library 799
Navigator 770
Window menu 817
Window menu (E3D Editor) 544
Windows
file conversion 851
keyboard shortcuts 850
Windows MetaFiles 853
Windows to Macintosh 851
WMF (Windows MetaFiles) 614
worksheet
grid 803
Workstation block 831
Item Animation tab 538
processing items 170
World Editor Creator (WEC)
mode 495
panes 496
World Editor Inspector (WEI)
mode 492, 494
moving objects with 510
panes 495
World Editor mode of the E3D Editor 494
World menu (E3D Editor) 544
World modes of the E3D Editor 494
Index
variables (definition) 57
variables table 658
verification 56, 695
892
Y
yellow outline around field 725
yellow parameter fields 718
Yogurt Changeover model 413
Yogurt Production model 318, 413
Yogurt Production with Flavors model 343
Yogurt Production with Flavors Plus model 343
Index