Sei sulla pagina 1di 135

ISBN: 978-0-9825040-3-1 Copyright 2010 by Imagine That Inc. or its Licensors. All rights reserved.

. Printed in the United States of America. You may not copy, transmit, or translate this manual or any part of this manual in any form or by any means, electronic or mechanical, including photocopying, recording, or information storage and retrieval systems, for any purpose other than the purchaser's personal use without the prior 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 its Licensors. ExtendSim blocks may 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, Items (db), Mfg, Rate, SDI Tools, 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), Simulation Dynamics, Inc. is the copyright owner of SDI Industry, Wolverine Software Corporation owns the copyright for Proof Animation, and the copyright for Stat::Fit is owned by Geer Mountain Software. TGE, SDI Industry, Proof Animation, and Stat::Fit are licensed to Imagine That, Inc. for distribution with ExtendSim. All other product names used in this manual are the trademarks of their respective owners. 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 originally created by Bob Diamond Chief architects for ExtendSim 8: Bob Diamond, Steve Lamperti, Dave Krahl, Anthony Nastasi, Cecile Damiron, Peter Tag Graphics, documentation, and production for ExtendSim 8: Carla Sackett, Pat Diamond, 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

T2

Table of Contents

Table of Contents About This Addendum


Using the ExtendSim 8 Addendum .........................................................................................2 How the Addendum is organized ............................................................................................2 Summary of ExtendSim 8 changes ..........................................................................................2
New features and blocks..................................................................................................................2 Enhancements to the user interface and existing blocks...................................................................3

Upgrading from ExtendSim 7 .................................................................................................4


Installing ExtendSim 8 ....................................................................................................................4 Running ExtendSim 8.....................................................................................................................5 Legacy files......................................................................................................................................5

Upgrading from Extend 6 or earlier.........................................................................................6


Legacy libraries and files..................................................................................................................6 New product names ........................................................................................................................6 Installing and running ExtendSim 8................................................................................................7

Technical support....................................................................................................................7
Sources of support...........................................................................................................................7 Assistance from our support staff.....................................................................................................7

User Guide Addendum


Equations & Equation-Based Blocks ................................................................... 9
Overview.................................................................................................................................10 List of equation-based blocks...................................................................................................10 Equation components .............................................................................................................10
Input variables.................................................................................................................................11 Output variables..............................................................................................................................12

Equation Editor ......................................................................................................................13 Debugging equations ..............................................................................................................14


Starting the tutorial .........................................................................................................................14 Setting breakpoints..........................................................................................................................15 Stepping through the code ..............................................................................................................15 Getting to the overflow calculation..................................................................................................16 Setting a conditional breakpoint......................................................................................................16

Include files for equations........................................................................................................17 Queue Equation block ............................................................................................................18


How the block works ......................................................................................................................19 Variables..........................................................................................................................................19 Ranking rules ..................................................................................................................................20

Query Equation and Query Equation(I) blocks.......................................................................20


How the blocks work ......................................................................................................................21 Spawned items ................................................................................................................................21 Variables..........................................................................................................................................22 Ranking rules ..................................................................................................................................24

Table of Contents

T3

Differences between the query blocks..............................................................................................24 DB Job Shop Query model .............................................................................................................25

ExtendSim Databases ...........................................................................................27


Overview ................................................................................................................................ 28 Database commands ............................................................................................................... 28
Edit Table Properties (Database menu)............................................................................................28 Edit Field Properties (Database menu) ............................................................................................28 Read/Write Index Checking ............................................................................................................28 Show Reserved Databases (Develop menu) .....................................................................................28

Table Properties dialog............................................................................................................ 29 Save and Next Field button..................................................................................................... 29 New Overwrite and Delete button....................................................................................... 29 Reserved databases .................................................................................................................. 29 Improved DB Add-In ............................................................................................................. 29
Check Database Consistency...........................................................................................................30 Find Database Table........................................................................................................................31 Other Add-In enhancements...........................................................................................................31

Scenario Manager .................................................................................................33


Scenario analysis ..................................................................................................................... 34 How the Scenario Manager works........................................................................................... 34 Tutorial I (dialog parameters).................................................................................................. 35
Steps ...............................................................................................................................................35 Add the Scenario Manager block.....................................................................................................35 Identify and add factors and values..................................................................................................36 Identify and add targeted responses .................................................................................................38 Determine what will be in the report...............................................................................................39 Select the DOE and run scenarios ...................................................................................................39 Analyze results.................................................................................................................................40 Export the results (optional)............................................................................................................40

Tutorial II (database variables) ................................................................................................ 41


Targets and sources..........................................................................................................................41 Open the model ..............................................................................................................................43 Create a database structure for the model ........................................................................................44 Create a source list (optional) ..........................................................................................................45 Link to the target table ....................................................................................................................45 Enter database factors......................................................................................................................45 Generate and run the scenarios........................................................................................................46

DOE methods ........................................................................................................................ 46 Comparison with other analysis methods................................................................................ 46

Advanced Resource Management .........................................................................49


Resource management ............................................................................................................ 50
Resources ........................................................................................................................................50 Modeling resources .........................................................................................................................50 How to model resources ..................................................................................................................50

Advanced Resource Management............................................................................................ 51


How Advanced Resource Management works .................................................................................51

T4

Table of Contents

Definitions......................................................................................................................................52

Tutorial ...................................................................................................................................53 Phase I: Adding ARM to a model............................................................................................54


Add the Resource Manager block ....................................................................................................54 Resource Pool..................................................................................................................................54 Queue .............................................................................................................................................55 Resource Pool Release......................................................................................................................56 Save and run ...................................................................................................................................56

Phase II: Organizing resources.................................................................................................57


Resource Pools ................................................................................................................................58 Requirements tab of Resource Manager...........................................................................................59 Create a string attribute...................................................................................................................60 Save and run ...................................................................................................................................62 Results ............................................................................................................................................62 Gathering statistical information .....................................................................................................63

Phase III: An alternate method for creating pools ....................................................................63


Use a Resource Manager to create a pool and resources ...................................................................63 Create a resource requirement .........................................................................................................65

Additional information ...........................................................................................................67


Groups ............................................................................................................................................68 Resource orders ...............................................................................................................................69 Status and transitions ......................................................................................................................69 Properties ........................................................................................................................................70 Release rules ....................................................................................................................................72 Policies ............................................................................................................................................73

Resource requirements ............................................................................................................74


Hierarchy of a resource requirement................................................................................................74 Steps to take before creating ............................................................................................................74 How to create a new resource requirement ......................................................................................75 Filtering conditions .........................................................................................................................75 Quantity expressions .......................................................................................................................76 Resource requirements ....................................................................................................................79 Default resource requirements.........................................................................................................80

Comparison of the three resource methods..............................................................................81 The Advanced Resources database ...........................................................................................82 Blocks that compose the ARM system.....................................................................................82 Primary transactions for ARM.................................................................................................83
Item-initiated ARM transactions .....................................................................................................84 Resource Pool-initiated ARM transactions ......................................................................................86 Shift ................................................................................................................................................87

Block Changes ..................................................................................................... 89


Hierarchical blocks..................................................................................................................90 New blocks in libraries ............................................................................................................90 Changed blocks in libraries .....................................................................................................91
Value library....................................................................................................................................91 Item library .....................................................................................................................................92 Rate library .....................................................................................................................................94 Utilities library ................................................................................................................................94

Table of Contents

T5

Odds and Ends .....................................................................................................95


3D animation ......................................................................................................................... 96
Stacking overflows...........................................................................................................................96 Collision avoidance .........................................................................................................................96 Hierarchical blocks and 3D animation ............................................................................................96 Shelf object .....................................................................................................................................96

File menu change.................................................................................................................... 96


Network License .............................................................................................................................96

Edit menu changes.................................................................................................................. 98


Open Dynamic Linked Blocks command........................................................................................98 Options command ..........................................................................................................................98

Develop menu changes ........................................................................................................... 99


Show Reserved Databases................................................................................................................99

Run menu changes ................................................................................................................. 99


Run Optimization or Scenarios .......................................................................................................99

Other interface changes .......................................................................................................... 99


Getting Started model.....................................................................................................................99

Miscellaneous ......................................................................................................................... 100


Other item properties......................................................................................................................100

Developer Reference Addendum


Programming Techniques .....................................................................................101
Reserved databases .................................................................................................................. 102
Example ..........................................................................................................................................102 Creating and editing .......................................................................................................................102

Remote access to dialog variables ............................................................................................ 103


Custom remote blocks interfacing with a stand-alone block ............................................................103 Custom stand-alone block referencing remote dialog variables ........................................................103

Registered blocks .................................................................................................................... 105 COM DLL example ............................................................................................................... 105 Integer arrays .......................................................................................................................... 106

Messages, Variables, and Functions ......................................................................107


Menu and keyboard equivalents for developers ....................................................................... 108
Develop menu.................................................................................................................................108 Run menu.......................................................................................................................................108

Menu command numbers for new commands ........................................................................ 108 Messages ................................................................................................................................. 108
Simulation messages........................................................................................................................109 Dialog messages ..............................................................................................................................109 3D Animation messages ..................................................................................................................109

System variables ...................................................................................................................... 109


CurrentScenario ..............................................................................................................................109 NumScenarios.................................................................................................................................109

Functions................................................................................................................................ 110
Function returns .............................................................................................................................110

T6

Table of Contents

Math functions ...............................................................................................................................110 I/O functions ..................................................................................................................................111 E3D animation ...............................................................................................................................111 Blocks and inter-block communication ...........................................................................................112 Models and notebook......................................................................................................................114 Scripting .........................................................................................................................................115 Database functions..........................................................................................................................116 Pointer functions.............................................................................................................................120

Index to the Addendum


Index .................................................................................................................... 121

User Guide Addendum

About This Addendum

2 Using the ExtendSim 8 Addendum

Using the ExtendSim 8 Addendum


Intro
This Addendum reflects the changes made to ExtendSim for release 8. It is a supplement to the two printed manuals ExtendSim User Guide and Developer Reference which were released with ExtendSim 7. The electronic versions of the User Guide and Developer Reference have been updated for release 8 and are located in the ExtendSim8\Documentation folder. To access those two documents, give the command Help > ExtendSim Help.

How the Addendum is organized


To describe the features that are new to v8, the Addendum is organized into these main sections: 1) This Introduction gives a brief overview of the new features as well as information for those who are upgrading from releases prior to ExtendSim 8. 2) User interface and block-level changes and additions. Pages 10 to 100 of the Addendum supplement the printed User Guide. This section describes new and changed features and blocks that you can use when building models. 3) Changes and additions to the development environment. Starting on 102, this Addendum supplements the printed Developer Reference. In addition to new features, this section also describes the new or changed functions, message handlers, and system variables. You use these in equations or when modifying/building blocks. Wherever possible, the appropriate page or section of the printed User Guide or Developer Reference is noted. Note however that the electronic versions of the User Guide and Developer Reference have been updated for release 8.

Summary of ExtendSim 8 changes


Release 8 added the following features and enhancements to release 7. (As noted below, some features and enhancements are specific to certain ExtendSim products.)

New features and blocks


1) Enhanced equation capabilities (all products) Equation Editor. While you can still enter equations and use code completion in the blocks equation area, the new Equation Editor window can be resized to fit larger equations, has tabs for indenting, and allows code colorization, matching braces, and more. Equation Debugger. This works like the current ExtendSim source code debugger, but is specific to equation-based blocks. You can set breakpoints and conditions for equations, step through lines of code, and examine values of variables. Include files for equations. You can now call an include file from an equation-based block. This simplifies maintenance when a set of commands (definitions, assignments, and functions) has more than one use. Like ModL in general, include files allow functions and message handlers to be overwritten and compilation to be conditional. More input and output variable types. These predefined variable types make it easier to create equations. 2) Scenario Manager (ExtendSim AT and Suite). The Scenario Manager block (Value library) is used to design and run experiments on models. The objective is to explore the projected outcomes that result when a models inputs are varied. Each experiment has a different set of

3 Summary of ExtendSim 8 changes

inputs and thus different results. All data is stored in an ExtendSim database to facilitate analysis; data can be exported to JMP or Excel for further analysis. 3) A Getting Started model(all products). A new model file, Getting Started, appears as a window each time you launch ExtendSim. Use it to open a recent model file, open a new model worksheet, view video clips, and access example models and other informative files. 4) Advanced Resource Management (ExtendSim AT and Suite). The Advanced Resource Management System allows a sophisticated resource structure to be defined, including hierarchies of resource types and a complex set of requirements for how those resources get allocated to items. It provides interfaces for creation and editing (of resources, resource pools, groups of resources, resource properties, resource requirements and release rules), and produces automatic logs of resource allocations, release, and state transitions. 5) New Query Equation and Query Equation(I) blocks (ExtendSim AT and Suite). These blocks are used to rank the records in an ExtendSim database and intelligently select one record, based on a ranking rule entered in a user-defined equation. Query blocks are especially useful when a database holds information that is required for making decisions in a model. 6) New blocks (all products). Other new blocks include Block Info, DBStatistics, Link Alert, Model Interface, MYOB DB Dialogs, and Slider. 7) Preloading of libraries (all products). Depending on the particular product, the major libraries shipped with ExtendSim preload by default. 8) Shift-click support (all products). You can now Shift-click an appropriate dialog item to add variables to certain blocks. Developers can also add Shift-click support to their custom blocks. 9) New user-requested functions, system variables, and message handlers. 10) The annual Maintenance Plan now includes technical support, as well as upgrades to major releases, for all single-user (stand alone) licenses of ExtendSim.

Intro

Enhancements to the user interface and existing blocks


1) Reporting and controlling block contents (Item library of ExtendSim OR, AT, and Suite). Queue blocks and the Activity now have a Contents tab that displays either current contents or a historical log. You can also track any number of item attributes. The Executive blocks new Item Contents tab allows you to remotely control the settings (such as choosing current or historical log and which attributes) in the Contents tab of selected blocks. 2) Improved ExtendSim DB Add-In for Excel (ExtendSim AT and Suite). The ExtendSim DB Add-In now has new features to help when creating and using ExtendSim databases: Two new menu commands: Check Database Consistency and Find Database Table Enhancements for parent/child fields, including color-coding Improvements to the Status bar Faster run times when importing data 3) Enhancements to the ExtendSim Database (all products) include:

4 Upgrading from ExtendSim 7

Intro

A Save and Next Field button in the Field Properties dialog, so fields can be added more quickly to database tables. A new Table Properties dialog that allows records to be deleted at the beginning of a new simulation run or at the beginning of a multi-run simulation. A new reserved database feature so programmers can provide database capabilities without the modeler being aware of the database. 4) Improvements to the E3D animation (ExtendSim Suite). E3D window mount stack limit counts the number of objects; if more than a specified number, that number will appear on the top of the stack. Improved collision handling, including complete control over how collision works if you program custom code. A new interface that allows you to select multiple blocks within a hierarchical block to be represented by 3D objects. 5) Improved calculations in the Rate library (ExtendSim AT and Suite). The LP calculations have been enhanced and performance has been improved. 6) Enhancements to existing blocks (appropriate products). Significant enhancements to a number of blocks in the Item, Value, and Utilities libraries. 7) Copying and deleting rows in the middle of a data table. A new mechanism for copying and deleting rows in the middle of the table. Also, when the number of rows is increased, the contents of the original last row is used for the newly added rows.

For a description of all the new features in ExtendSim 8, see the ExtendSim command Help >
Whats New in ExtendSim or go to www.extendsim.com/prods_features_new.html.

Upgrading from ExtendSim 7


Release 8 builds on the features of release 7. Thus there should be no major issues when upgrading. Some things to consider are:

Installing ExtendSim 8
1) While it is unlikely that there will be any problems, please back up before installing. Our technical support people often work wonders, but they cant recover your lost or overwritten files. 2) Install ExtendSim 8 by following the instructions on the separate Installation Guide. 3) For Windows, the installer will separate the ExtendSim files into two different locations: The ExtendSim application and other files that are not meant to be modified (such as the User Guide and the License Agreement) will be installed in the folder Program Files\ExtendSim8. User-modifiable files, such as example models, libraries, and extensions, will be installed in your Documents folder. Typically this would be located at C:\Documents and Settings\My Documents\ExtendSim 8. 4) If you have created custom models, blocks, include files, DLLs, and so forth: Copy your models to the ExtendSim8 folder. (For Windows, this will be located in the My Documents folder.)

5 Upgrading from ExtendSim 7

Copy custom libraries to the ExtendSim8\Libraries folder. (For Windows, this will be located in the My Documents folder.) Copy your custom extensions into the appropriate folder within the ExtendSim8\Extension folder. (For Windows, this will be located in the My Documents folder.) It is strongly suggested that you store backup copies of custom files in a separate folder. That will allow recovery if you accidentally overwrite the files using ExtendSim 8. 5) After installing release 8 and moving your custom files, you may uninstall the ExtendSim 7 application and files. If you decide to instead keep ExtendSim 7 installed, see the next section regarding the Update Launch Control command.

Intro

Running ExtendSim 8
1) Because of the extensive architectural changes, once files have been saved in ExtendSim 8 they cannot be read by older versions. If you want a file kept as readable by an older version, use the Save As command to rename the file or to save a copy of the file in a different location. The newly saved file can then be used in ExtendSim 8 without overwriting your older file. If your models have links that were created using the command File > Paste DDE Link, changing the model name and/or location will break the links. Be sure to make a backup copy of any linked models before opening them in ExtendSim 8. 2) A new model file, Getting Started, appears when you first launch ExtendSim. It replaces the old Demo.mox file. Getting Started allows you to open a recent file, open a new file, view video clips, and access example models and other informative files. 3) Because ExtendSim now supports separate Options files, you will need to restate your preferences. This is done in the Edit > Options menu command. 4) Only one instance of ExtendSim can run at a time. If you have more than one release of ExtendSim installed, and you want to open a specific instance of ExtendSim by double-clicking a model or library file, use the File > Update Launch Control command. (Note: we do not provide technical support for older versions.)

Legacy files
After release 6, some libraries were no longer supported; these are called Legacy libraries. The Industry database was also replaced and moved to legacy status. And a new 3D animation capability replaced Proof Animation, the 2.5D product, in ExtendSim Suite. So that you can run models built in Extend 6 or prior, most of the Legacy libraries (Animation, BPR, Discrete Event, Generic, Mfg, and Quick Blocks) are included in ExtendSim 8. Some Legacy libraries (Flow, Items(DB), and SDI Tools), as well as the Industry database, are not included in release 8. Proof Animation is not included in release 8. If you upgraded from Extend Suite 6 to ExtendSim Suite 7, and you still want to use Proof Animation, contact Imagine That Inc. for a Proof Animation (P4) code. Note: Proof Animation 5 (P5) is only available from Wolverine Corp. For help in transitioning out of the Legacy libraries, see the v6 to v8 Equivalents file located at ExtendSim8\Documentation. (For Windows, the Documentation folder is located in the Program Files folder.) This file lists each legacy block and the corresponding new block or feature.

6 Upgrading from Extend 6 or earlier

Intro

Legacy libraries have not been updated since release 6, are not supported, and will not be shipped in later versions. They are only supplied in release 8 so that you can run older models. They should not be used when building new models.

Upgrading from Extend 6 or earlier


There were major and extensive changes between Extend 6 and ExtendSim 7. These changes have been carried forward and will affect how you use ExtendSim 8.

Legacy libraries and files


In release 7, several libraries (Animation, BPR, Discrete Event, Flow, Generic, Items(DB), Mfg, Quick Blocks, and SDI tools) were replaced by new libraries. In addition, the Industry database was replaced by the new ExtendSim database and Proof Animation was replaced by the new 3D animation capability of ExtendSim Suite. The Item library replaced the BPR, Discrete Event, and Mfg (Manufacturing) libraries. The Value library replaced the Generic library. A Rate library replaced the Flow library. The Animation 2D-3D library replaced the old Animation library. Built-in features in ExtendSim, as well as in the Item and Value libraries, replaced the Items (DB) and SDI Tools libraries. An ExtendSim database capability replaced the Industry database that was included in Extend Suite and Extend Industry. A 3D animation feature replaced the Proof Animation software that was in Extend Suite. Collectively the replaced files are called Legacy files. Those files are no longer supported and should not be used except to run models built in prior versions. 1) So that you can run models built in Extend 6 or prior, most of the Legacy libraries (Animation, BPR, Discrete Event, Generic, Mfg, and Quick Blocks) are included in ExtendSim 8. They are located in the folder \Libraries\Legacy. 2) Some Legacy libraries (Flow, Items(DB), and SDI Tools), as well as the Industry database, are not included in release 8. 3) Proof Animation is not included in release 8. If you are upgrading from Extend Suite 6 to ExtendSim Suite 8, and you still want to use Proof Animation, contact Imagine That Inc. for a Proof Animation (P4) code. (Proof Animation 5 ((P5) is only available from Wolverine Corp. 4) For help in transitioning out of the Legacy libraries, see the v6 to v8 Equivalents file located at ExtendSim8\Documentation. (For Windows, the file will be located in the Program Files folder.) This file lists each legacy block and the corresponding new block or feature. Legacy libraries have not been updated since release 6, are not supported, and will not be shipped in later versions. They are only supplied in release 8 so that you can run older models. They should not be used when building new models.

New product names


With release 7, Extend was re-branded as ExtendSim and some product names changed. The new product lineup is: 1) ExtendSim CP is the upgrade from Extend CP

7 Technical support

2) ExtendSim OR is the upgrade from Extend OR

Intro

3) ExtendSim AT is the upgrade from Extend Industry 4) ExtendSim Suite is the upgrade from Extend Suite

Installing and running ExtendSim 8


Follow the instructions for upgrading from release 7, above.

Technical support
Sources of support
Printed and electronic documentation ExtendSim help in-product block help and tool tips plus online support pages and FAQs (see Support at www.ExtendSim.com) Networking ExtendSim user forums, networks, and blogs (see Links at www.ExtendSim.com) From our wonderful support staff (see below)

Assistance from our support staff


After a 60 day complimentary support period, assistance from our support staff is available either under an annual Maintenance Plan or on a Per-Incident basis. For concurrent-user (network) licenses For concurrent-user (network) licenses of ExtendSim an annual Maintenance Plan for support and upgrades is required. For the first year, the Maintenance Plan is included in the price of the product; it must be renewed annually after the first year. Maintenance Plans cover basic usage questions and troubleshooting by our support staff as well as upgrades to major releases. For single-user (stand alone) licenses For single-user (stand alone) licenses of ExtendSim an annual Maintenance Plan for support and upgrades is optional but highly recommended.

In addition to support and upgrades, a Maintenance Plan provides discounts on special ExtendSim
webinars and trainings as well as first looks at upcoming products and features. 1) If a Maintenance Plan is purchased for the license Maintenance Plans cover basic usage questions and troubleshooting by our support staff as well as upgrades to major releases. A Maintenance Plan subscription can only be purchased when a new single-user license or upgrade is purchased or within 60 days of that purchase. 2) If a Maintenance Plan is NOT purchased for the license Our support staff will provide complimentary technical assistance for installation questions or bug reports related to the current release. Our support staff will provide complimentary assistance for basic usage questions and troubleshooting for a limited time. This support expires 60 days after the purchase of a new product or upgrade. (A Maintenance Plan may be purchased during this period.) For usage questions and troubleshooting after the first 60 days, purchase support on a perincident basis; each incident is a discussion and resolution of one issue. Per-Incident Support can be purchased from our sales staff or through the ExtendSim store at http:// www.extendsim.com/store.

8 Technical support

Intro

User Guide Addendum

Equations & Equation-Based Blocks

10

Equations & Equation-Based Blocks Overview

Overview
There have been several enhancements to the set of equation-based blocks, including new Query blocks, an equation editor, an equation debugger, and the ability to call include files.

List of equation-based blocks


Equations
Block Equation Equation(I) Queue Equation Library Value Item Item Purpose Computes user-defined equations and outputs the results Computes user-defined equations when an item arrives, then outputs the results Stores items and releases them based on the results of user-entered equations. See Queue Equation block on page 18.

Query Equation Query Equation(I) Optimizer Buttons

Value (AT & Suite) A user-defined equation selects one record from an ExtendSim database table Item (AT & Suite) Value Utilities A user-defined equation selects one record from an ExtendSim database table when an item arrives Finds the optimum value (lowest cost or highest profit) Used to create a push-button interface to a model. Has several predefined buttons plus the ability to define or modify a button using user-defined equations.

The two new equation-based blocks in release 8 are: Query Equation (Value library for ExtendSim AT and ExtendSim Suite only) Query Equation(I) (Item library for ExtendSim AT and ExtendSim Suite only)

Equation components

Because there were extensive changes to the equation-based blocks in release 8, including more predefined variables and changed terminology, the Equation components section of the User Guide has been rewritten. printed User Guide, page 602-603 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 13. While you can define local (temporary) input and output variables in the equation area or the Equation Editor, most equation-based blocks also have two tables, Input Variables and Output Variables, for specifying static (permanent) variables. As described below, ExtendSim provides several pre-defined types of input and output variables you can use in equations.

Equations & Equation-Based Blocks Equation components

11

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). Add rows to the table by clicking the green +/- resize button in the tables bottom right corner; you can select a different input option for each row.

Equations

Input Variables table

The Variable Type popup provides many options for input variables, as shown below. For more information about each option, see the blocks Help. Query Equation(I) X X X X X X X X X X X X X X X X X X Queue Equation X X X X X X X X X X X Query Equation X X

Connector value input connector DB read value reads a value from a fixed location in a database table. Specify location in the Variable Value column. DB read value using attrib reads a value from a variable database location specified by a DB address attribute DB read PRI reads the Parent Record Index (PRI) from a cell in a Child field. Read location is fixed and is specified in the Variable Value column. See note below. DB read PRI using attrib reads the PRI from a variable database location specified by a DB address attribute. See note below. DB address a database address chosen in the Variable Value column. DB database index a database index chosen in Variable Value column DB table index a database table chosen in the Variable Value column. DB field index a database field chosen in the Variable Value column. DB record index a database record chosen in Variable Value column. 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.

Equation X X X X X X X X X

Input Variable Type

Equation(I) X X X X X X X X X X X

12

Equations & Equation-Based Blocks Equation components

Equations

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. Attribute the value of the attribute named in Variable Name. Item quantity the items quantity value. Item priority the items priority value. Item index the items index value from the Executives item array. 3D object ID the index of the items 3D object.

Equation

Input Variable Type

X X X X X

X X X X X

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. input variable types. See Queue Equation block on page 18 or Query Equation and Query Equation(I) blocks on page 20 of this Addendum.

The Queue Equation, Query Equation, and Query Equation(I) blocks have additional specific
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). Add rows to the table by clicking the green +/- resize button in the tables bottom right corner; you can select a different output option for each row.
Output Variables table

The Variable Type popup provides many options for output variables, as shown below. For more information about each option, see the blocks Help.

Query Equation(I) X X X X X X

Queue Equation

Query Equation

Equation(I)

Equations & Equation-Based Blocks Equation Editor

13

Equation

Output Variable Type

Query Equation(I) X X X X X X X X X

Queue Equation

Query Equation

Equation(I)

Equations

Connector value output connector DB write value writes a value to a fixed location in a database table. Specify location in the Variable Value column. DB write value using attrib writes a value to a non-fixed database location specified by a DB address attribute DB write PRI writes a Parent Record Index (PRI) to a fixed location in a database table. Specify location in the Variable Value column. PRI is the index of the parent cell that is being written to the child. 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. Attribute the value of the attribute named in Variable Name Item quantity the items quantity value Item priority the items priority value 3D object ID the index of the items 3D object

X X

X X X

X X X X

X X

X X X X X

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

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. output variable types. See Queue Equation block on page 18 or Query Equation and Query Equation(I) blocks on page 20 of this Addendum.

The Queue Equation, Query Equation, and Query Equation(I) blocks have additional specific
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

14

Equations & Equation-Based Blocks Debugging equations

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:

Other editing commands, such as matching braces, are supported

Equations

Open the Reservoir 3 model located at \Examples\Tutorials\Continuous In the model, open the dialog of the Equation block; it is labeled Calculate Overflow In the blocks dialog,
click Open Equation Editor. The window that opens is shown in the screenshot to the right.
Equation Editor window showing overflow equation As you can see, the contents of the window automatically uses the indenting and code colorization features. The Code Completion button at the bottom of the window is useful when searching for a function or to get the correct argument list. To use code completion, type the first part of the function name in the code pane, then click the Code Completion button or press F8. If the function that appears isnt the one you want, click F8 again until the correct function appears.

Debugging equations
printed User Guide, page 618 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. 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 page 10.

Starting the tutorial Open the Reservoir 3 model located at \Examples\Tutorials\Continuous So that you dont overwrite the original model, save the model as Equation Debugging In the model, open the dialog of the Equation block; it is labeled Calculate Overflow

Equations & Equation-Based Blocks Debugging equations

15

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:

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

Equations

Code in the Set Breakpoints window cannot be edited.


The gray breakpoint lines in the left margin of the Set Breakpoints window indicate the only places where breakpoints can be set.

In the left margin


of the Set BreakSet Breakpoints window showing breakpoint at if points window, click the breakpoint line that is at the left of the if statement. This turns the gray dash into a red circle.

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. be executed next, once the run is continued.

The green arrow indicates which line of code will

The Variables pane at the top right shows the variables used in the equation and the value of each variable at the point before the line of code at the breakpoint is executed. Along the top of the window are five buttons. These are used to continue the run, to step over,
Debugger window showing breakpoint and variable

16

Equations & Equation-Based Blocks Debugging equations

into, or out of functions, and to stop the run. (These buttons are explained fully in the Developer Reference.) 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.

Equations

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:

Remove the first breakpoint by clicking its red


circle

Add a new breakpoint at the overflow = contents... line

Click the Continue button

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:

Click the Step Over button to execute that line


of code. The calculated overflow value is shown in the Variables pane.

Debugger window breaking at first overflow

Setting a conditional breakpoint


Conditional breakpoints cause a calculation to break only when the overflow value is calculated and within a specified range or specific value. The Breakpoints window is for setting breakpoint conditions. It allows you to: See which breakpoints have been set and where they have been set Add conditions to a breakpoint Click a breakpoints red circle to disable or enable any breakpoint, without deleting it. (In place of the red circle, disabled breakpoints have an open circle.) Delete a breakpoint by selecting its name and clicking the Delete or Backspace key

Breakpoint window

Equations & Equation-Based Blocks Include files for equations

17

To set a condition on the breakpoint so it will break only if the overflow is greater than 0.0:

In the Debugger window: 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.

Equations

In the Breakpoints window: Double-click the area to the right of the breakpoint. This opens the Conditional Breakpoint window, shown below.

In the Variable A column of the Conditional


Breakpoint window, select the overflow variable as A.

Since you want the condition to determine


when the overflow is greater than zero, choose A>B as the comparison.

Check the Use constant for B check box and


enter 0.0 as the constant.

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.

Include files for equations


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

18

Equations & Equation-Based Blocks Queue Equation block

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: 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 used in equations only support local variable declarations. They should not have any static variable declarations - variables that are declared outside the boundaries of a function or procedures definition. Include files used in block code sometimes do have static variables; these are usually placed at the top of a blocks ModL code. 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:

Equations

Check Use include files in the blocks Equation tab Click the Create New button Give the new include file a name In the window that appears, enter the procedure or function. For instance:
//********************************** //START: Equation Include Prototypes procedure myproc();//this will be displayed in the prototype list //END: Equation Include Prototypes //********************************** procedure myproc() { userError("Hello World"); }

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.

Queue Equation block

Because there were extensive changes to the Queue Equation block in release 8, this section of the
User Guide has been rewritten. printed User Guide, page 133-135 The Queue Equation block (Item library) is used to release items in an order that is based on a ranking rule. Items enter the queue and are stored in the order of their arrival (FIFO). However, instead of the items leaving in FIFO order, an equation in the blocks dialog determines which item (if any) should leave the queue next. The equation is automatically calculated once for each item in the queue and the results are used to assign a ranking for each item. The item with the best ranking is the one that is allowed to leave next.

Equations & Equation-Based Blocks Queue Equation block

19

How the block works


Importantly, only the equation results from the winning item are used for that particular calculation cycle. For example, if the queue currently holds 10 items, the equation will be calculated 10 times and 10 individual sets of equation results will be collected. But only the equation results from the item with the best ranking will be used; results from the other 9 items are discarded.

Equations

So that the item leaving next will be properly chosen, by default a new calculation cycle is initiated every time an item enters or leaves the queue or when a value input connector receives a message. To override the default behavior, the factors that initiate calculation cycles can be controlled through check boxes in the blocks Option tab. The tables below describe a number of equation input and output variables that are unique to the Queue Equation block. Along with the common input and output variables described in Equation components on page 10, these variables are designed to help users write equations that will properly select the next leaving item. In particular, the QEQ item rank variable is used to assign a ranking to each item in the queue.

At least one QEQ item rank output variable must be defined for this block to function properly.
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 20. 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 that start on page 11 (input variables) or page 12 (output variables) describe the common set of variables shared by all equation-based blocks. The following variables are unique to the Queue Equation block. Input variables
.

Input Variable QEQ arrival time QEQ FIFO position QEQ current best item rank QEQ attrib last item to exit QEQ num items in queue QEQ static calc cycle init

Uses The time the item arrived to the queue The items first-in, first-out (FIFO) position in the queue 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 The number of items currently in the queue A static variable that gets initialized to its starting value at the beginning of every calculation cycle. Changes to this variable remain fixed (static) across equation calculations. This boolean variable is True if an advanced resource (AR) requirement is available for the current item. See note below. Provides the number of advanced resource (AR) requirements available for the current item. See note below.

AR requirement is avail AR num requirements avail

20

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

The AR variables are only shown in the Queue Equation block if Advanced Resources (AR) is
Output variables

enabled in the blocks Options tab and the model contains a Resource Manager block. (See also Advanced Resource Management on page 51.)

Equations

Output Variable QEQ item rank QEQ halt calculation cycle AR allocate requirement

Uses Defines each items rank (position) in the queue. At least one of the output variables must be of this type. If set to True, this variable will prematurely halt the current calculation cycle. 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. 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.

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. printed User Guide, pages 133-135

Query Equation and Query Equation(I) blocks


The Query Equation blocks are used to rank the records in an ExtendSim database table and intelligently select one record, based on a ranking rule. A user-defined equation in the blocks dialog is

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

21

calculated once for each record in the table; the results are used to assign a ranking for each record. The record with the best ranking is the one that gets selected. The query blocks are used when a database holds information that is required for making decisions in a model. While the querying and ranking behavior could be accomplished using the Equation blocks, the equations would be long and complicated. Furthermore, the query blocks provide critical pieces of information that support writing more powerful queries. There are two query blocks: Query Equation (Value library of ExtendSim AT and ExtendSim Suite) Query Equation(I) (Item library of ExtendSim AT and ExtendSim Suite) The major differences between these two blocks is presented in the table on page 24. The Query Equation blocks are advanced modeling tools. They only available in the ExtendSim AT and ExtendSim Suite packages.

Equations

How the blocks work


A query cycle is the point in time when a query block executes its equation to pick the next winning record. In the case of the Query Equation(I), this occurs every time an item passes through. For the Query Equation block, its Options tab has choices for controlling the initiation of the query cycle. Importantly, only the results of the equation for the winning record are used for that particular query cycle. For example, if the query table has 10 records, the equation will be calculated 10 times, and 10 individual sets of equation results will be collected. However, only the equation results from the record with the best ranking are used and the results from the other 9 records are discarded. The blocks input and output variable types are specifically designed to help modelers write equations that will properly rank the records and select the winning record. So that each record will have a ranking, the user-defined equation is calculated once for each record. The records are ranked according to the ranking rule selected in the blocks Options tab; the rules are listed on page 24. The block's internal data structure keeps track of the ranking and any other results of the equation for each record.

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

22

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

types, with the prefix DBQS (for database query spawn), to be available. Those variables are shown in the table on page 23.

The equation results for pass-through items are calculated independently from those for spawns.
Equations
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.

Variables
The Query Equation blocks have several types of input and output variables.While the tables that start on page 11 (input variables) and page 12 (output variables) describe the set of variables shared by all equation-based blocks, the following variables are unique to the query blocks. Input variables
.

Input Variable

Query Equation(I) X X X X X X X X X

Query Equation

Uses

DBQ read value

Requires the user to choose a field in the query table. As the query block starts to loop through each record, this variable automatically takes on the value found in that field for the current record. (This is easier than calling DBDataGetAsNumber() to reference information residing in the query table for the current record.) The Parent Record Index value from the specified field for the current record. See note below. The record to start the query cycle. (The default behavior is to start at record 1.) The number of records in the query table. The index of the record currently being evaluated in the query cycle. A static input variable that gets initialized at the beginning of every query cycle. Current best record rank result in the current query cycle. Number of non-blank ranked records at this point in the current query cycle. Current best spawn rank result in the current query cycle.

DBQ read PRI DBQ start record DBQ num records DBQ current record index DBQ static query init DBQ current best rank result DBQ num non-blank ranks DBQS current best rank result

X X X X X X X

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

23

Input Variable

Query Equation(I)

Query Equation

Uses

Equations

DBQS num non-blank ranks

Number of non-blank spawn ranked records at this point in the current query cycle.

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. Output variables Query Equation(I) X X X X X X X X Query Equation

Output Variable

Uses

DBQ record rank DBQ halt query DBQ next record DBQS record rank DBQS attribute

X X X

Rank result for the current record A True value halts the current query cycle Tells block which record to query next Spawn rank for the current record For assigning attribute values to a spawned item. If the record's spawn rank is good enough to merit a spawning, then results from that record can be attached to the spawned item in the form of DBQS attributes. See Spawned items on page 21. Item quantity to be placed on spawned item. Also see DBQS attribute, above. Item priority to be placed on spawned item. Also see DBQS attribute, above. 3D object ID to be placed on spawned item. Also see DBQS attribute, above.

DBQS item quantity DBQS item priority DBQS 3D object ID

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

24

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

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.

Equations

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 Or, there are no records left to evaluate 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.

Differences between the query blocks


Query Equation(I) X X X X X X Query Equation

Description

Query cycle initiated only when an item arrives (similar to the Equation(I) block). Query cycle initiation is controlled using options on the Options tab (similar to the Equation block). Supports Spawning Works in continuous models Works in discrete event models

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

25

Description

Query Equation(I) X

Query Equation

Equations

Works in discrete rate models

DB Job Shop Query model


The DB Job Shop Query model is located at \Examples\Discrete Event\Routing.

DB Job Shop Query model

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

Table structure of Database 1

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.

26

Equations & Equation-Based Blocks Query Equation and Query Equation(I) blocks

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. 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; }

Equations

Given the complexity of what the query block is doing, the code is very simple.

User Guide Addendum

ExtendSim Databases

28

ExtendSim Databases Overview

Overview
ExtendSim databases are internal repositories for storing, managing, and controlling model data. They are especially useful for complex models and for models that contain a large amount of data. The ExtendSim DB Add-In allows an exported ExtendSim database file to be edited in Excel. Release 8 has new Database menu commands and properties dialogs as well as a new Reserved Databases feature for programmers. The DB Add-In for Excel, discussed on page 29, has also been improved.

The ExtendSim database feature is available in all ExtendSim products; unless it is purchased separately, the DB Add-In for Excel is only available in ExtendSim AT and ExtendSim Suite. The following commands are used with databases and are new in release 8:

Databases

Database commands
Edit Table Properties (Database menu)
Opens a dialog, discussed below in Table Properties dialog, for editing table properties. This command works the same as right-clicking a database table and selecting Edit Table Properties. printed User Guide, page 702

Edit Field Properties (Database menu)


Opens the Field Properties dialog. This is useful for editing the information, such as the fields name and type, that was entered into the Field Properties dialog when the field was created. This command works the same as double-clicking a tables field while the Database window is in Structure mode. printed User Guide, pages 642, 649, and 700-702

Read/Write Index Checking


For database read/write functions, the Database menu command Read/Write Index Checking can enable error messages if a read/write function call has illegal indexes. This is a good tool to find illegal indexes and leaving this check on does not impact the speed of a simulation run. Leave it off if it is preventing a legacy model from running. New models have this check on by default. printed User Guide, page 703

Show Reserved Databases (Develop menu)


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 on page 102. printed User Guide, pages 700-702

ExtendSim Databases Table Properties dialog

29

Table Properties dialog


ExtendSim database tables now have a Table Properties dialog that allows you to: Edit the tables name. This works the same as the command Database > Rename Table. Delete all the records. If selected, the initialization is done at the beginning of each run or at the beginning of a multi-run simulation. Enter a Tooltip. This is the same as entering text in the field at the right side of the Database windows header. The text will be displayed in the Table Viewer or when a cursor is hovered over the table. The Table Properties dialog can be accessed through the new menu command Database > Edit Table Properties or by right-clicking a database table and selecting Edit Table Properties. printed User Guide, page 641

Databases

Save and Next Field button


This button, located in the Field Properties dialog, allows you to start a new field immediately after you save the properties of the field you have been working on. This is faster than saving a field and returning to the Database window to append a new field. printed User Guide, page 642

New Overwrite and Delete button


When one database is imported into a database with the same name, buttons allow you to choose how the import should be handled. If the original database had more tables than the imported one, a new button (Overwrite and Delete), removes the extra tables.

Reserved databases
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 on page 102 of this Addendum.

Improved DB Add-In
The ExtendSim DB Add-In allows an exported ExtendSim database file to be read into an Excel workbook, where its data and structure can be edited before it is exported back to ExtendSim.

The DB Add-In for Excel is included only in ExtendSim AT and ExtendSim Suite; it can also be
purchased separately. As discussed in detail below, the new features in release 8 of the DB Add-In include: Two new menu commands: Check Database Consistency and Find Database Table. And checking consistency generates an Errors Summary worksheet with hyperlinks to the errors. Enhancements for parent/child fields Improvements to the Status bar Faster importing of databases into Excel and improved error checking while a database is being imported

30

ExtendSim Databases Improved DB Add-In

At the time of this printing, the DB Add-In only works on Windows and requires Office 2007 or
better. (Office 2008 for the Macintosh no longer supports Visual Basic Add-Ins and the ExtendSim DB Add-In does not work with earlier versions of Office on either Windows or Macintosh).

printed User Guide, page 650-651

Check Database Consistency


One of the new 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.

Databases

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. 1) Parent/child data content 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.

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.

ExtendSim Databases Improved DB Add-In

31

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.

Each worksheet is equivalent to one of the tabs in


the imported database. 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.

Databases

Other Add-In enhancements


Parent/child fields Parent and child fields are now 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 now 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.

32

ExtendSim Databases Improved DB Add-In

Databases

User Guide Addendum

Scenario Manager

34

Scenario Manager Scenario analysis

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. 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 46 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. printed User Guide, page 572 (between Sensitivity Analysis and Optimization).

Scenarios

How the Scenario Manager works


For scenario management you evaluate and compare a number of model configurations or scenarios, where each scenario is one set of model inputs or factors. These factors are typically specific dialog parameters (such as the maximum number of items in an Activity) but can also be complete databases, tables, fields, or records. A scenario can have any number of factors and each factor can have any number, or levels, of different values that it can take on. (For example, setting the maximum number of items in the Activity to 2, 6, or 10 would be 3 levels.) At the beginning of each set of simulation runs, or replications, the Scenario Manager copies the model factors for the current scenario into the appropriate locations in the model. Typically each scenario is run multiple times to capture any stochastic behavior. At the end of each of these replications, the results of interest (responses) are generated, recorded, and summarized. After all replications have completed, the scenario results are stored in tables in the Scenario DB database. You can also generate a report and export the data to a different ExtendSim database, an Excel workbook, or JMP.

Scenario Manager Tutorial I (dialog parameters)

35

It is best to set aside some time for all of the scenarios to run. Depending on the size and complexity it may take minutes to hours to complete the entire set of runs. You should also be careful not to create too many scenarios. This is particularly easy to do if you create a full factorial design.

Tutorial I (dialog parameters)

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 41. 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 Number of attendants Wash only time Wash and wax time Car interarrival rate Values 1, 2, 3 5, 6, 7 6, 7, 8 3, 3.5, 4, 4.5, 5

Scenarios

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) Adding a Scenario Manager block (Value library, ExtendSim AT and ExtendSim Suite only) to a model 2) Identifying and adding the factors (model inputs) to be included in the analysis 3) Identifying and adding the responses (model results) to be analyzed 4) Determining what you want in the report 5) Determining the DOE (design of experiments), then generating and running the scenarios 6) Analyzing the results 7) Optional. Exporting the scenarios to JMP, Excel, 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
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

36

Scenario Manager Tutorial I (dialog parameters)

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 40 for more information. Your model should now look similar to the following screen shot:

Scenarios

Model with Scenario Manager block

Open the dialog of the Scenario Manager block

Dialog of Scenario Manager block

As seen above, the Scenario Manager has tabs for Factors, Responses, Scenarios, and Export. These represent the steps in using the Scenario Manager.

Identify and add factors and values


The next step is to determine and add to the Dialog Factors table any dialog factors (model parameters) you want to include in the analysis. The information is in the following table. Block Name (Label) Resource Pool (Attendant Resource) Activity (Wash Bay) Activity (Wash/Wax Bay) Parameter Initial number Delay (D) Delay (D) Factor Name Attendants Wash Time Wash&Wax Time Values 1, 2, 3 5, 6, 7 6, 7, 8

Scenario Manager Tutorial I (dialog parameters)

37

Block Name (Label) Create (Dirty Cars)

Parameter Mean

Factor Name Car Interarrival Time

Values 3, 3.5, 4, 4.5, 5

Methods for referencing dialog variables as factors There are 3 ways to add a dialog variable as a factor to the Dialog Factors table: 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.

Go to the dialog of the Resource Pool block (labeled Attendant Resources) While holding down the Shift key, click the Initial number dialog variable (2) In the popup menu that appears, shown at right, select
Scenario Manager: Add Factor

Scenarios

In the
dialog that appears, name the factor Attendants as shown at left. Then click OK

Go to the Scenario Managers Factors tab


Notice that the Dialog Factors table now contains all the information about the Attendants factor the block it came from, the variable value it is currently set at, and so forth.

By default, the Attendants minimum value is set to its current variable value, the maximum value
is 1 more than that, and the step is 1. These numbers will be changed later in this tutorial. Other factors Repeat the steps used for the Attendants factor, above, to place the remaining three factors (Wash Time, Wash/Wax Time, and Car Interarrival Time) in the Scenario Managers Dialog Factors table. See the table on page 36 for the parameters to use and which blocks. they are in. With its default values, the Dialog Factors table should now look like this:

Portion of Dialog Factors table

38

Scenario Manager Tutorial I (dialog parameters)

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. Automatically using a DOE (design of experiments) 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:

Go to the Factors tab of the Scenario Manager block Enter the new minimum, maximum, and step values for each of the factors as shown below
Factor Name Minimum 1 5 6 3 Maximum 3 7 8 5 Step 1 1 1 0.5

Scenarios

Attendants Wash Time Wash&Wax Time Car Interarrival Time

Identify and add targeted responses

While you could use any of the 3 options from page 37, this section uses the clone drop method to
associate the parameters with the Scenario Manager. The responses (results of interest) are in the following table: Block Name (Label) Queue (Wait for Attendant) Queue (Wait for Attendant) Tab Results Results Parameter Length: Average Wait: Average Response Name Average Length Average Wait

The next step is to add responses to the Scenario Manager.

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
Notice that the Dialog Responses table in the Scenario Managers Responses tab now contains all the information about the Average Length variable.

In a similar manner, use either the Shift-click or the clone-drop method to add the response
named Average Wait to the Scenario Manager

Scenario Manager Tutorial I (dialog parameters)

39

The Dialog Responses table in the Responses tab should look like the following:

Portion of responses table

Determine what will be in the report


The fourth step is to determine what type of report you want and what you want in the report. The Dialog Responses table in the Responses tab is where you specify what level of statistics you want the report to calculate and which responses you want included in the report. To run a JMP DOE, set the Min/Max column to the desired JMP analysis type: Maximize, Match Target, Minimize, or None. The Report Set column determines which report is run for the specific response. The default is to only show the mean or average value of the response for each scenario, but more detailed statistics can be added by selecting a different report set. The Include in Report column is for choosing which responses will be included in the report. For this example:

Scenarios

Keep the default settings Select the DOE and run scenarios
The Scenarios tab of the Scenario Manager block is for choosing a method for the DOE as well as for creating and running the scenarios. As described more on page 46, there are three DOE methods you can choose: Manual design Full factorial design JMP custom design which has two options The two options for the JMP custom design allow you to either create then run the scenarios (and later export the report to JMP), or create and immediately run the scenarios, automatically exporting the report to JMP and storing it in ExtendSim. Both options require JMP from SAS Corporation to generate the design and analyze the results.

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 Suggestion: Use the Animation Off button or uncheck the Run > Show 2D Animation command to turn 2D animation off

Click the Run Scenarios button.


This process may take some time as 675 replications are required to complete the scenario analysis!

40

Scenario Manager Tutorial I (dialog parameters)

Suggestions:
The scenarios will run a LOT faster if animation is not on. Uncheck Play Sound at End of Run in the Edit > Options > Model tab before the run. When the scenarios have completed running, you should see the following in the Scenarios table:

Portion of 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, as discussed on page 40. Some additional things to notice for your analysis are: Uncheck Include in Report in the Responses tab to not include certain 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.

Scenarios

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. By default all of the scenarios are selected in the Scenarios table; to not run a specific scenario, uncheck its Select box

Export the results (optional)


The form of the Scenario DB database tables may not be exactly what you want. To do additional analysis using a different format, export a report on the Export tab. For example, you could export complete results, including the values from every scenario, to JMP. Then use JMP's analysis capabilities to compare the different scenarios. To export the results:

Choose the type of report.


Complete Results exports the contents of the Scenario DB database the factors and responses for every run in every scenario.

Scenario Manager Tutorial II (database variables)

41

Displayed Statistics exports the statistics for each scenario as shown in the Scenarios table. What gets displayed depends on what is selected in the Response tabs Report Set column. 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, or JMP.

So that you dont accidentally overwrite the data, it is suggested that you do not export to the Scenario DB database. destination.

Set the destination parameters for the exported data. This varies based on the selected export Click Export Report
Once you have exported the results, analyze the scenarios by sorting, plotting, or generating comparison statistics.

Tutorial II (database variables)


This section assumes you understand how to create ExtendSim databases, including how to link to them and how to enter parent/child relationships. Databases are described in the User Guide. So far you have controlled only dialog variables with the Scenario Manager. While most analysts would use only dialog parameters as factors and responses, a select few of you will want to do more advanced analysis. With the Scenario Manager you can use entire databases or a subset of a database (database tables, fields, or records), as factors and/or responses. These database variables can be used in addition to, or instead of, dialog variables.

Scenarios

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.

Targets and sources


The concept of targets and sources is specific to the Scenario Manager and allows more sophisticated analysis. Definitions A database variable is a variable that references an entire database or a subset of a database, such as a database table or field. A source is a database variable that gets copied to a target Factor sources are the set of values that a database variable can take for all the different scenarios. They contain all of the information for all of the scenarios. A response source is the value of a database output variable for a particular replication. Each response source only has the information for the current set of replications. A target is a database variable whose value is defined by a source A factor target is a database input variable whose value has been defined by a particular factor source. Each factor target only has the information for the current set of scenario replications.

42

Scenario Manager Tutorial II (database variables)

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.

Scenarios

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 database variable does not change.

Scenario Manager Tutorial II (database variables)

43

Diagram of sources and targets The following diagram shows how sources and targets are related to factors and responses.

Sources for Sources for Sources for DB Factors DB Factors DBFactors

DBvariablesusedbymodel

Targets for Targets for Targets for DB Responses DB Responses DBResponses

Targetfor DB Factors

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

Scenarios

The above steps assume database tables are used for factors and responses. You can also use fields or
records, or even entire databases, as targets and/or responses.

Open the model


In the previous tutorial you built a model using dialog variables as factors and responses. This tutorial starts where the previous tutorial ended.

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.

44

Scenario Manager Tutorial II (database variables)

In the model, the proportion of cars wanting either wash only or wash and wax is set in the empirical table of the Random Number block (labeled Preference Percentage). The table is shown at right. For this tutorial the Wash or Wash/Wax factor will have three combinations of percentages, which represent 3 levels: 1) 75% wash and 25% wash & wax the base case 2) 90% wash and 10% wash & wax the more wash case 3) 50% wash and 50% wash & wax the less wash case As in the earlier tutorial, 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 now requires 2,025 replications (405 scenarios ((3 x 3 x 3 x 5 x 3 levels)) at 5 runs each).

Create a database structure for the model


As shown at the bottom of the Database menu, the Scenario Manager Final Car Wash model already has two databases:

Scenarios

The Scenario DB database. This was automatically created when the Scenario Manager block was added to the model; it is discussed on page 40. A Model Data database. So that you can focus on the tutorial, the required database has already been created for this model. The Model Data database stores the different options and probabilities for the wash or wash/wax factor in 6 tables: A Parent table, Wash Type, that lists the options for the two wash types: wash only and wash & wax. Its contents are shown on the right. Three factor source tables, each of which has one of the probability combinations: Base Case (75% wash/25% wash&wax), Less Wash (50%/50%), and More Wash (90%/10%). These are Child tables that get their wash type information from the Wash Type table. A factor target table named Wash Preference. Each record in the factor target table has a wash type field and a probability field associated with that wash type. This table is used as a placeholder for model data. Thus before the scenario runs begin, the table is identical to the Base Case source table. A factor sources list table, named Preference Sources, that is a list of the three factor source tables. The contents of this table is shown at right. This table is used when performing DOE, so that you will know which tables to select from when creating the design. See Create a source list (optional), below, for more information.

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

Scenario Manager Tutorial II (database variables)

45

The structure of the Model Data database is shown below.

Factor Target

Factor Sources ListofFactorSources


Scenarios

Create a source list (optional)


If you plan to perform DOE, create an additional table for each database factor variable, where each table has a list of the possible values for that variable. This is a table of tables, or a factor source list. Using a factor source list allows you to choose from a subset of database variables rather than from all of the database variables in the model. This makes it easier to create the scenarios manually and to use DOE. Without this list of factor sources, any table in the database would be listed in the Database Factors table as a possible factor source table. As discussed earlier, a factor source list, named Preference Sources, has already been created for this example. As you will see later, checking Use Source List in the Database Factors table limits the possible entries to those in the source list (in this case, to the Preference Sources database table).

Link to the target table


To control the models wash preference probabilities, the Random Number blocks empirical probability table must be linked to the target table Wash Preference:

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

46

Scenario Manager DOE methods

Enter the following information in the Database Factors table:


Column Header Target Name Target Type Target Database Target Table Target Field Target Record Use Source List Source Database Enter or Select This Information Wash or Wash/Wax Table Model Data Wash Preference (leave this cell blank) (leave this cell blank) X (check the box; see page page 45 for more about source lists) Model Data Preference Sources Wash Preference Table Name

Scenarios

Source Table Source Field

Generate and run the scenarios


Generate and run the scenarios as you did in Select the DOE and run scenarios on page 39. If you use the Full Factorial method and have 5 runs per scenario, 405 scenarios should be created and it will take 2,025 replications.

DOE methods
As discussed onpage 39, the Scenarios tab of the Scenario Manager block allows you to choose the DOE method. These are described more fully below. DOE Method Manual Full factorial Description Enter factors for each scenario manually Sequence Create, Run, Export

Create Scenarios creates one scenario for each combination of Create, Run, Export factor values. Since every possible combination of factors is generated, this takes the longest to run. Create Scenarios opens JMP and causes it to create the design. Create, Run, Export This results in far fewer scenarios than full factorial, but it should be sufficient for most practical applications. Create and Run Scenarios opens JMP, causes it to create the design, runs the scenarios, and displays the factors and responses in both ExtendSim and JMP. Create and Run

JMP custom

JMP custom create and run

Comparison with other analysis methods


The Scenario Manager is just one of the ExtendSim analysis tools. As described in the table below, each tool has a different purpose.

Scenario Manager Comparison with other analysis methods

47

Technique Purpose

Sensitivity Analysis Study the behavior of the model in response to changes in a single input parameter

Scenario Manager Study and compare the behavior of the model in response to changes in multiple input parameters. Learn how the system behaves under different conditions.

Optimization Determine the best configuration of model parameters, given a specific goal (usually to minimize cost or maximize profit)

Question

If a parameter had this value, how would it effect model outputs? Easiest to specify

If several parameters had What configuration allows these values, how would a model to behave optithat effect model outputs? mally? Determines the optimum model configuration Constraints can be added to filter out infeasible model configurations

Advantages

Gives the most complete understanding of how the Included in all ExtendSim model reacts to different products factors

Factors can be from databases as well as dialog variIncluded in all ExtendSim ables products Automatically records each response for every simulation run Design of experiments can reduce the number of scenarios required to study factor interactions Disadvantages Evaluating more than one factor is cumbersome Additional modeling is required to record model results A set of scenarios must be created by the modeler An objective function is required

Scenarios

May require many simula- Does not record the results tion runs to evaluate all of of each individual run the scenarios There is a practical limit Only available in Extend- on the number of factors, and their possible values, Sim AT and ExtendSim that can be examined Suite May require many simulation runs to determine the optimal configuration

Refer to

Printed User Guide, pages Printed User Guide, pages This Addendum 568-572 572-586

48

Scenario Manager Comparison with other analysis methods

Scenarios

User Guide Addendum

Advanced Resource Management

50

Advanced Resource Management Resource management

Resource management
Resource management is the efficient and effective deployment of resources when, where, and to the extent they are needed. The management of resources is essential whenever supply and demand is an issue. The objective is to maximize the utilization of resources to achieve goals while performing the necessary activities.

Resources
printed User Guide, page 95 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 the chapter on Resources and Shifts in the ExtendSim User Guide for more information.

Modeling resources Resources


printed User Guide, page 209 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.

How to model resources


As seen in the following sections, there are many ways to simulate resources when building models some are explicit and some are implicit. Resources can be explicitly modeled using specialized resource management blocks; this has the advantage of direct access to features like automatic costing and utilization calculations. In some situations, however, it could be simpler or provide more control to model resources just as any other item in the model or by limiting block capacity. Explicit methods The ExtendSim discrete event architecture supports three explicit methods for modeling resources: Resource Pool method. As a count of the resources that are available in a pool. By keeping track of the available resource pool units, this method controls the flow of items that require the resources. This is accomplished using the resource pool blocks (Resource Pool, Queue [in resource pool queue mode], and Resource Pool Release), as shown in the Resource Pool method section of the User Guide. Resource Item method. As one or more resource items that are available to another item. This method involves batching resource items from the Resource Item block with the items that require them and, typically, unbatching the resource when it is no longer needed, as described in the Resource Item method section of the User Guide.

Advanced Resource Management Advanced Resource Management

51

Advanced Resource Management method. As records in a table in an internal database, where each record represents a resource with individual properties and statistics. The Resource Manager block provides the interface for managing advanced resources. This resource management system is an advanced tool that is only available in the ExtendSim AT and ExtendSim Suite packages. It is described below. These methods are compared in the table on page 81. 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.

Advanced Resource Management


In ExtendSim, Advanced Resource Management (ARM) is an integrated system for organizing resources, distinguishing between them, and allocating them throughout a model. ARM provides a convenient and straightforward method for defining complex resource requirements for items as well as a flexible set of rules for how resources get allocated to them. And it provides automated methods for quickly changing resource information and generating statistical reports. The ARM system is an advanced tool that is only available in the ExtendSim AT and ExtendSim Suite packages. It is new in ExtendSim 8. The ExtendSim database feature provides the ARM systems architectural framework. ARM uses an Advanced Resources database to represent, manage, and track the status and properties of resources, pools, and groups, as well as allocation and release rules. The database is automatically created when a Resource Manager block is added to a model. Resources database.

Resources

In the ARM system, resources are records that are stored in the Resources table of the Advanced

In addition to the database, several blocks (listed on page 82) 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.

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.

How Advanced Resource Management works


The basic mechanism for allocating and releasing resources using ARM is: 1) The model has multiple types of resources with specified properties 2) Resource requirements are defined; each resource requirement is a specification of how many and what types of resources are needed 3) A Queue is set to be an advanced resource queue 4) Depending on their needs, items in the Queue request resources, then wait until their resource requirements can be satisfied

52

Advanced Resource Management Advanced Resource Management

5) Once resources are allocated to items, the items are released from the Queue 6) Resources remain allocated to items until the resources are released by Resource Pool Release blocks 7) Shift blocks can be used to bring advanced resources on and off schedule 8) The management of resource states and quantities and the allocation and release of resources is controlled by the Resource Manager 9) As the model runs, discrete transactions occur between the advanced resource blocks and an internal advanced resource database. These transactions are driven by item arrivals in the Queue and Resource Pool Release blocks, shift changes, and resource pool quantity changes.

The primary ARM transactions are illustrated and described in more detail starting on page 83.
Definitions

The following definitions and abbreviations are used regarding the ARM system. Italicized words are defined in the table. Term Definition

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. A means for organizing resources. Groups can be used to control which types of resources are allocated to and released from items. Although a resource can only belong to one pool, it can be a member of many different groups. A method for distinguishing one resource, group, pool, or item from the others. A component of a resource requirement that specifies the desired number of resources to be selected from a list of those that meet the filtering conditions. A resource requirement has a quantity expression that consists of a specified quantity of one or more filtering condition results. The means by which process activities and operations are performed. Typical resources include equipment, personnel, space, energy, time, and money. A request by an item to satisfy a resource requirement. This causes the Resource Manager to assign the item a unique Resource Order ID. The location (record index) of a resource order in the Orders database table. 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.

Resources

Group

Properties Quantity expression (QE)

Resource Resource order Resource Order ID Resource pool

Advanced Resource Management Tutorial

53

Term Resource requirement (RR)

Definition 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. A customizable mechanism for controlling which resources to release when items enter Resource Pool Release blocks. Each resource release rule is associated with a specific resource requirement and is designed to control the release of resources at the quantity expression level of the resource requirement.

Resource release rule

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 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 54. 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 57, Phase II shows how to create complex resources and resource requirements. 1) Creating three resource pools to represent three types of resources 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 63. 1) Creating a pool and resources using the Resource Manager block 2) Defining a new resource requirement

Resources

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.

54

Advanced Resource Management Phase I: Adding ARM to a model

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.

Phase I: Adding ARM to a model


This phase changes dialog settings of the blocks in the Final Car Wash model, causing the model to use advanced resources without changing its basic behavior. When finished, running the new model should result in exactly the same outputs as running the original model.

Add the Resource Manager block


The advanced resource capability is not enabled until the model has a Resource Manager block.

Open the model named Final Car Wash (\Examples\Tutorials\Discrete Event) Save the model as Final Car Wash RM so you dont overwrite the original model Place a Resource Manager block (Item library, ExtendSim AT and ExtendSim Suite only) in the
model. The block can be placed anywhere, but the top of the model will provide easiest access.

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.

Label the block Resource Manager

Resource Pool Resources

Because using them automates many of the steps, Resource Pool blocks provide a quick and efficient entry to using the ARM system. Change block settings In the dialog of the models Resource Pool block (labeled Attendant Resource):

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.

Change the resource pool behavior to: advanced resource pool Create a new pool: Select Advanced pool name: New advanced resource pool In the dialog that appears, name the advanced resource pool Washer/Waxer Define the properties for the pools resources
as follows:

Initial status: Idle (the default) Shift: none (the default) Initial number: 2 Click OK to close the blocks dialog The dialog that appears is a message
that the properties of this pool have been changed. Click OK to accept the changes and close that dialog.

Advanced Resource Management Phase I: Adding ARM to a model

55

The resource pool of 2 who can wash and wax cars has now been replaced by an advanced resource pool of 2 who can wash and wax cars. What happened This process created a new advanced resource pool, named Washer/Waxer, that has 2 resources. Both resources have an initial status of Idle and no Shift. When the pool was created, the ARM system automatically named the resources Washer/Waxer_1 and Washer/Waxer_2, stored them as records in the Resources table of the Advanced Resources database, and listed them in the Resource Manager block so they can be edited. (As will be discussed later, the ARM system also automatically created a default requirement for the pools resources.) Look at the Resource Manager: Resources tab To see how the Washer/Waxer pools resources are stored in the Resource Manager:

Go to the Resources tab of the Resource Manager block Select Mode: Edit resources In the Set resource filters frame: Choose Pool name: Washer/Waxer as the filter Leave the rest of the filtering fields as they are
The Edit filtered resources table at the bottom now lists the two resources that are in the Washer/ Waxer pool, along with their initial properties. This table is where resource properties can be edited.

Resources

2 resources

Do not change any of the initial properties Click OK to close the Resource Managers dialog Queue
The Queue is where item/cars wait until the required types of resources, in the specified quantities, are available. Change block settings In the dialog of the Queue block (Wait for Attendant):

Change the queue behavior to: advanced resource queue Choose Get resource requirement from:
List selection (the default)

In the list selection popup, choose: RR_Washer/Waxer 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 asso-

56

Advanced Resource Management Phase I: Adding ARM to a model

ciated 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 80. Look at the Resource Manager: Requirements tab It is helpful to see how the Resource Manager handles resource requirements.

Go to the Requirements tab of the Resource Manager block Check to enable Create/modify resource requirements (the top check box)
The dialog expands to show the resource requirements popup, some operators, and an expression area. This frame is where resource requirements can be created or edited, but it is also useful for getting a quick look at the existing requirements. For instance, RR_Washer/ Waxer is the name of the default resource requirement that was automatically defined when the new pool was created. The expression area indicates that RR_Washer/Waxer requires 1 resource from the Washer/Waxer pool for each car to exit the Queue.

Resources

Click OK to close the Resource Managers dialog Resource Pool Release


In the dialogs of both of the Resource Pool Release blocks (Release Attendants):

For the release behavior, select Release: advanced resources For the release rule, choose Release: all resources (the default setting) Click OK Save and run So that the changes to the Advanced Resources database will be saved, save the model 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. 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.

Advanced Resource Management Phase II: Organizing resources

57

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 While not needed in this tutorial, custom release rules can be created and saved on the Resource Managers Release Rules tab. For more information, see Release rules on page 72. Look at the Resource Manager: Policies tab When a resource transitions to the idle status, it immediately attempts to service one of the items waiting for advanced resources. If multiple items are waiting, they are serviced in an order governed by settings on the Resource Managers Policies tab. 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.) While not needed for this example, the Policies tab provides additional flexibility when building advanced resource models. For more information, see Policies on page 73.

Resources

Phase II: Organizing resources


If the ARM system only substituted for the Resource Pool method it wouldnt be very useful. The advanced resource management system provides a mechanism for implementing far more complicated resource requirements. The next part of the tutorial has two purposes: Showing how to allocate resources by type Using attributes to set resource requirements These are described below. Allocating resources by type Phase II of the tutorial has a generalist who can both wash and wax cars plus two specialists, one of whom can only wash while the other can only wax. The purpose of the simulation is to explore how many workers need to be cross-trained as generalists. Because some resources are specialized, complexity will be added to the resource allocation logic: Cars that need washing only will require either one Washer or one Washer/Waxer Cars that need washing and waxing will require either one Washer and one Waxer or one Washer/Waxer To enable this, three different resource pools will represent the different skill sets of the car wash workers. The first pool consists of workers who can only wash cars, the second pool consists of workers who can only wax cars, and the third consists of workers who can both wash and wax cars.

58

Advanced Resource Management Phase II: Organizing resources

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 68. Using attributes to set resource requirements While Phase I showed how to select the resource requirement from a popup list, the following section shows how to set the resource requirement as a string attribute and use that attribute to specify 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

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 be created using the Resource Manager, as shown in Phase III. Change the original Resource Pool This phase of the tutorial uses the same model created in Phase I the Final Car Wash RM model.

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.

Resources

Continue with the Final Car Wash RM model 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 one of the original two resources from the pool will be
deleted. Click OK to 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 duplicate the
existing Resource Pool block.)

In the blocks dialog, define the advanced resources as follows: Select Advanced pool name: New advanced resource pool In the dialog that appears, name the advanced resource
pool Washer

Enter Initial number: 1 but leave the rest of the settings at the default

Change the label of the block to Washer Click OK to close the dialog If the new Resource Pool block is a duplicate of the original, a dialog appears with a
reminder that the properties of this pool have been changed. Click OK to accept the changes and close that dialog.

Add a third Resource Pool to the model and repeat the above process, except:

Advanced Resource Management Phase II: Organizing resources

59

Name the third advanced resource pool Waxer Change the label of the block to Waxer Save the model Requirements tab of Resource Manager
Some cars need only to be washed and some need waxing as well as washing. The next step is to define those resource requirements. Now that there are three Resource Pool blocks in the model, there are also three default resource requirements: RR_Waxer, RR_Washer, and RR_Washer/ Waxer. These are listed in popup menus in the Queues dialog and in the Create/modify resource requirements frame of the Resource Managers Requirements tab. (Default resource requirements are discussed more on page 80.)

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. Cars requiring washing only These cars can be washed by either a washer/waxer or by a washer. This model then needs a new resource requirement that will request either one washer/waxer or one washer.

Go to the Requirements tab of the Resource Manager. Check Create/Modify Resource Requirements. This enables a section where operators and
logical expressions are used to define requirements. Notice that the popup list of resource requirements has the three default resource requirements (each of which is 1 resource from the pool) that were automatically created for the three pools in this model. To create a new resource requirement:

Resources

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.

From the popup labeled Insert quantity expression, choose

Mistakes can be cleared clicking Clear Last or Clear All.

1 from Washer/Waxer. This places that quantity expression in the expression area.

Click the OR button to cause that operator to be placed in the expression area From the Insert quantity expression popup, choose 1 from Washer. This places that quantity
expression in the expression area after the OR operator. The expression should look like this:

Click the Save As button In the dialog that appears, name the requirement Wash Requirement
This creates a new resource requirement named Wash Requirement. The expression area indicates that this requirement can be satisfied using either 1 resource from the Washer/Waxer pool or 1 resource from the Washer pool. If both the resources are available, the Washer/Waxer resource will be used first. The expression is evaluated from left to right. Thus resources towards the left of the expression will be used before those on the right. This evaluation affects model results, as discussed on page 62.

60

Advanced Resource Management Phase II: Organizing resources

Cars also requiring waxing The next step is to create a new resource requirement for the cars that also want waxing. Those cars can use either one washer/waxer or one washer and one waxer. To create the new resource requirement:

Select Choose Resource requirement: New resource requirement To open a parenthesis in the expression area, click the left grouping operator ( From the Insert quantity expression popup, choose 1 from Washer Click the AND operator From the Insert quantity expression popup, choose 1 from Waxer To close the parenthesis, click the grouping operator ) Click the OR operator From the Insert quantity expression popup, choose 1 from Washer/Waxer
The expression should look like the screenshot to the right.

Click the Save As button Name the requirement Wash/Wax Requirement Resources
When executed, this requirement will first attempt to allocate one resource from the Washer pool and one resource from the Waxer pool. If these resources are not both available, it will then attempt to allocate one resource from the Washer/Waxer pool.

Click OK to close the dialog Create a string attribute


In the original Final Car Wash model, the preference for washing only or for washing and waxing is set as a string attribute named Preference. By pointing to either row 1 or 2 in a table in the Executives Attributes tab (shown at the immediate right) the attribute routes cars to the correct bay.

Resource Requirements table of Advanced Resources database

String values table In Executive blocks Attributes tab

As you will see below, the two new resource requirements (Wash Requirement and Wash/Wax Requirement) are in records 4 and 5, respectively, of the databases Requirements table, shown above right. This section shows how to create a new string attribute that points to records 4 and 5 in the database table. The goal is to link the Executives string values table to the databases table of resource requirements. This will give the Resource Manager a mechanism to point to the records that contain the resource requirements for the model.

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

Advanced Resource Management Phase II: Organizing resources

61

When the string attribute is changed, settings in the following blocks must also be changed to use the new attribute: 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
Attributes tab. The string values table on the right is now named Requirements.

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
requirements that have been created for this model.

Resources

Click Link. This causes the Executives Attributes tab to


appear. It also causes the Resource Requirements table to be linked to the Requirements string attribute, as indicated in the string values table shown at right.

Close the Executives dialog. Notice that in the Set blocks dialog the Property Name is now Requirements.

Table with attribute strings

Close the Sets dialog Save the model


Random Number The resource requirement now comes from the value of a string attribute named Requirements. However, the Random Number block originally looked at the Preference attribute to determine how often the requirement would be for wash only or for wash and wax. The block must be changed to use the correct values of the new string attribute.

In the dialog of the Random Number block (Preference Percentage): In row 0, select Wash Requirement from the popup. That requirement will now be selected
75% of the time.

In row 1, select Wash/Wax Requirement from the popup. That requirement will be
selected 25% of the time.

Close the dialog

62

Advanced Resource Management Phase II: Organizing resources

Queue The Queue is where items in this model get their resource requirements. Instead of from a list selection, the block must now get the resource requirement from the new string attribute. In the dialog of the Queue block (Wait for Attendant):

Choose: Get resource requirement record from: Attribute value For the attribute name, select
Requirements

Close the dialog


Select Item Out The Select Item Out block is where items get routed to one bay or the other. This step is to select the item routing method using the new string attribute. In the dialog of the Select Item Out block (Select Route):

For the selection condition, choose Select output based on: property (it should already be
selected)

For the property, choose the string attribute Requirements In the Requirements column of the Select options table: For row 0, choose Wash Requirement For row 1, choose Wash/Wax Requirement Resources
Notice that the To Block column indicates where cars with that requirement will be routed.
Select Item Out table

Close the dialog Save and run Save the model Run the simulation and observe the results 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.

Advanced Resource Management Phase III: An alternate method for creating pools

63

For example, there are three possible ways the Wash Requirement could have been written: 1) 1 from Washer/Waxer OR 1 from Washer 2) 1 from Washer OR 1 from Washer/Waxer 3) 1 from Washer Likewise, there are two possible ways the Wash/Wax Requirement could have been written: 1) (1 from Washer AND 1 from Waxer) OR 1 from Washer/Waxer 2) 1 from Washer/Waxer OR (1 from Washer AND 1 from Waxer) Thus from a resource requirements perspective alone, there are six (3 x 2) different ways to configure this model. Try experimenting with each configuration to determine which one produces the best system performance. (The Scenario Manager would be especially useful for doing that.) Use the Event Logging tab of the Resource Manager block to generate a resource transaction log in order to observe which resources are getting allocated to specific orders.

Gathering statistical information


The ARM system provides extensive data for analysis and there are a number of ways to observe and analyze results for this model: 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.

Resources

Phase III: An alternate method for creating pools


Resource Pool blocks are useful for quickly creating an ARM system. Additionally, the default resource requirements that are automatically created when a those blocks are used can be helpful. However, models would soon get too busy if Resource Pool blocks were the only method for creating pools. And it is unlikely that every resource requirement would be for only 1 of one type of resource, as happens with the default requirements. This phase of the tutorial shows how to use the ARM system without the help of Resource Pool blocks and their default resource requirements.

Use a Resource Manager to create a pool and resources


Resource Pool blocks provide a quick entry into the ARM system. The Resource Manager block, however, is more flexible and allows for more robust configurations. Create the pool Open the Final Car Wash RM model that was used in the previous two phases

Go to the Resources tab of the Resource Manager block

64

Advanced Resource Management Phase III: An alternate method for creating pools

Choose Mode: Create resources


In the Specify default resource properties frame:

Select Pool name: new resource pool In the dialog that appears, name the pool My New Pool
A second dialog asks if you want to create a default resource requirement for the new pool. (Default resource requirements are discussed on page 80.)

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 Create the resources Change the name and set the properties Whichever name is entered in the Resource name field will be the root name for all the resources created for this pool. In addition, whichever default properties are set will apply to every resource in the pool. (Names and properties can be changed later, as seen below.)

Resources

In the Specify default resource properties frame:

Enter Resource name: My Resources Do not change the default properties
Create the resources In the Create resources with the specified properties frame:

Enter 5 as the number of new resources for the pool Click Create
Five resources are created and displayed in the table. Notice the following: Since Make names distinct is checked, each resource has the root name (My Resources) followed by a different number. Every resource has the default properties. Modifying resource properties By default, the newly created resources all have the same properties and they all use the same root name. There are two methods for changing resource properties, including names: 1) Change the properties in the Create resources table while the tab is still in Create resources mode. Only the newly created resources for the selected pool will appear in the table. If you close the block or switch modes, the table will reset to empty.

Advanced Resource Management Phase III: An alternate method for creating pools

65

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) Change the mode to Edit resources, filter for the pool (leaving Resource name blank), and change properties in the Edit filtered resources table. All of the resources for the selected pool will appear in the table.

It is not necessary to change any resource properties for this tutorial
Save the model In order for the new pool, its resources, and their properties to be saved:

Save the model


This action also saves the Advanced Resources database, which contains all the information about the pools and their resources.

Create a resource requirement


The previous section purposefully chose to not have the ARM system create a default resource requirement for the pool. This section shows how to manually create a resource requirement. Resource requirements are built in three steps. 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. 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.

Resources

This section of the tutorial gives a quick overview. For more information about creating resource
requirements, see Resource requirements on page 74. Create a filtering condition The Resource Managers Requirements tab has three check boxes that are unchecked by default. Because resource requirements can be very complex, it is easiest to work in this tab if only one frame is open at a time. In the Requirements tab:

Check the box to enable Create/modify filtering conditions. Choose filtering condition: new filtering condition
The popup changes to unsaved filtering condition and the text is in red a reminder that the filCreating a new filtering condition tering condition must be saved to be usable.

66

Advanced Resource Management Phase III: An alternate method for creating pools

Choose to Filter using properties of:


resources

Using the popups, create the expression


Property: Pool = My New Pool

Click Save As and save the filtering condition as Any New Pool Resources

Creating a filtering condition

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

Close the Viewer Disable the Create/modify filtering conditions frame by unchecking its check box
Create a quantity expression

Check the box to enable Create/modify quantity expression Choose quantity expression: new quantity expression
The popup changes to unsaved quantity expression and the text is in red a reminder that it must be saved to be usable.

Resources

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:

Click WHERE, causing it to be placed in the expression area From the Insert resource filtering condition popup, choose Any New Pool Resources
The expression indicates that two resources will be selected from the Resources table where the pool name is My New Pool.

Save the quantity expression as 2 from My New Pool


A dialog appears asking if you want a resource requirement to be created for this quantity expression. The choices are: 1) Choose Yes if you want the resource requirement to be the same as what is described in the quantity expression. In this case, the resource requirement would be for any two resources as long as they were from the pool named My New Pool. 2) Choose No if you want a resource requirement that is more complex than what is described in the quantity expression. (For more information about default resource requirements, see page 80.)

In the dialog, choose No. (If you instead chose Yes, the resulting resource requirement can be
ignored or deleted.)

Advanced Resource Management Additional information

67

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.

Close the Viewer Close the Create/modify quantity expression frame by unchecking the check box
Create a resource requirement Check the box to enable Create/modify resource requirements

Choose resource requirement: new resource requirement


The popup changes to unsaved resource requirement and the text is in red a reminder that the requirement must be saved.

Select Insert quantity expression: 1 from Washer Click OR Select Insert quantity expression: 2 from My New Pool Save the new resource requirement as New Resource
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 74. ments using the Resource Manager block. Since the new resource requirement is not used in the model, it has no affect on model behavior.

Resources

The purpose of Phase III was just to show how to create pools, resources, and resource require-

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:

Save the model


End of the tutorial For another advanced resources example, see the Auto Club Emergency Service model; it is located at Examples\Discrete Event\Resources and Shifts\Advanced Resources.

Additional information
The following areas were not covered, or not completely covered, in the tutorial; they are discussed below. Groups Resource orders

68

Advanced Resource Management Additional information

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. Creating groups and grouping resources To create a new group that includes some resources:

Although a resource can only belong to one pool, it can be a member of many different groups.

Resources

Go to the Resources tab of the Resource Manager block Select Mode: Manage groups Optional: in the Set resource filters frame, choose filters to limit which resources are displayed In the Create/modify groups frame, choose Group: New resource group Name the new group In the dialog that appears, choose whether or not the system should create a default resource
requirement for the group. This option is explained in Default resource requirements on page 80.

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 72, 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

Go to the Resources tab of the Resource Manager block Select Mode: Manage groups Optional: in the Set resource filters frame, choose filters to limit which resources are displayed In the Create/modify groups frame, choose the group you want to delete To delete the entire group, click Delete Group

Advanced Resource Management Additional information

69

To remove only certain members, check the appropriate Select boxes and click Remove
Selected Members

Deleting a group and its members, or removing individual members from a group, does not delete
the resources. Using a group in a resource requirement A filtering condition can be created that filters on a group property, either Skill Level or Resource Rank. That filtering condition can then be used as a component of a quantity expression, but only in conjunction with a second filtering condition that filters on a specific resource group. For more information, see Using group filtering conditions on page 78.

Resource orders
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. 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 72). 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 83.

Resources

Status and transitions


A resources status provides information about its current state. The status usually changes dynamically during a simulation run. Resources can have any one of five different status settings: 1) Idle 2) Busy 3) Off Shift 4) Down 5) Disabled

70

Advanced Resource Management Additional information

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

Resources

Advanced Resource Management Additional information

71

Pending status and pending status start time Total orders serviced Total idle/busy/disabled status time Total down or off-shift time Utilization Total cost Aside from being useful for analysis, these dynamic properties are made available when creating or modifying filtering conditions. Custom resource properties In addition to the dynamic resource properties that are pre-defined in the ARM system, custom dynamic resource properties can be added. To create a custom dynamic resource property:

In the Resource Managers Resources tab, choose either


Mode: Create resources or Mode: Edit resources

Check the box to Display groups, pools, and properties

In the new frame that appears to the right, change its
mode from Groups to Properties

Click Add New and name the new property Select a data type from the popup menu shown at right
The new property is now available for any resource. It will be displayed in the property popup menu when a resource filtering condition is created (Requirements tab of Resource Manager block). Editing resource properties To edit resource properties, choose Mode: Edit resources in the Resource Managers Resources tab. In this mode, the tab is divided into two sections the top is for narrowing the list of resources that will be displayed in the table that is at the bottom. For individual resources, change the appropriate settings in that resources row To change one or more properties for several resources:

Resources

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.

72

Advanced Resource Management Additional information

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

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 69.) 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 73.

Resources

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:

Go to the Resource Managers Release Rules tab Choose an existing resource release rule or create a new one Select the resource requirement that the rule should be associated with

Advanced Resource Management Additional information

73

In the Quantity Expression table, specify the Release Quantity Policies
When a resource transitions to the idle status, it immediately attempts to service an item that is waiting for advanced resources. If multiple items are waiting, they are serviced in an order governed by settings on the Resource Managers Policies tab. As discussed in more detail below, the Policies tab is for: Setting a resource allocation policy that determines which item gets the next idle resource Overriding the resource requirement rank. (The original resource requirement rank is entered on the Requirements tab when the resource requirement is created.) Resource allocation policy The top section of the tab is for determining which item, from a sorted list of all the waiting items in the model, gets the resource. How the items are sorted affects which item gets the resource. Sorting criteria Item properties are used to control the order in which waiting items are sorted. The properties are: 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 74.) Items can be sorted by any one of these properties, in ascending or descending order. A secondary sorting order is also allowed.

Resources

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.

74

Advanced Resource Management Resource requirements

Overriding the resource requirement rank One of the properties that waiting items can be sorted by is the resource requirement rank, discussed in Sorting criteria on page 73. The resource requirement rank is a single value that applies by default to every resource that is part of the particular resource requirement. A resource requirement rank must be 0; the default resource requirement rank is 1. On the Resource Managers Policies tab, the resource requirement rank can be overridden for an individual resource. This means that, only for the specified resource, a resource requirements rank will differ from the original value entered on the Requirements tab. Since a resource Wash/Wax resource requirement is ranked higher requirement could be composed of multiple resources, each resource that is part of a resource requirement can override the resource requirements rank with a different value. 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:

Resources

Manually, as discussed below By default, as discussed starting on page 80

Hierarchy of a resource requirement


Resource requirements are developed in the Requirements tab of the Resource Manager block. They are created using a three-level hierarchy of components: 1) Resource requirements are the top level component. They consist of quantity expressions. 2) Quantity expressions are components that are created at the middle level of the hierarchy. They consist of filtering conditions. 3) Filtering conditions are created at the bottom level of the hierarchy.

Steps to take before creating


Before creating a resource requirement, it is helpful to perform the following steps: 1) Identify the components that will be needed: a)Determine how many distinct collections of resources are required b)Identify the criteria that are common to each resource collection c)Determine the quantity required from each collection d)Determine if alternative collections could be considered if the quantity cannot be obtained from a particular collection e)Identify the criteria for any of those alternative collections f )Determine the quantity required from any of the alternative collections

Advanced Resource Management Resource requirements

75

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.

How to create a new resource requirement


As was shown starting on page 65 the steps in manually creating a resource requirement are:

Create the filtering conditions needed by the quantity expressions Create the quantity expressions needed by the resource requirement Create a resource requirement using the quantity expressions Filtering conditions
Filtering conditions are the smallest component of a resource requirement and creating one or more filtering conditions is the first step in defining a resource requirement. A filtering condition is a specified aspect of a resource or group property. For example, a filtering condition could be that the resource comes from a particular pool or that a group member has a skill level higher than a certain number. Saved filtering conditions are used in quantity expressions, discussed later. When a quantity expression with a filtering condition gets executed, the population of resources is narrowed to a list of resources that meet the specific condition that was filtered for. The Create/modify filtering conditions frame (Resource Managers Requirements tab) is where filtering conditions are created and edited.
Creating a new filtering condition

Resources

Types of filtering conditions Filtering conditions filter on properties. There are two types of filtering conditions, depending on whether the properties belong to resources or group members: 1) A resource filtering condition filters on one specified resource property, as shown in the screenshot to the right. A resource property is one of the dynamic or static properties in the Resources table. Examples of resource properties are: pool, total idle time, or a group. (See Resource properties on page 70.) 2) A group filtering condition filters on one specified group property either Skill Level or Resource Rank. (See Group properties on page 72.) There must be at least one group in the model to enable group filtering conditions. Note that a group filtering condition is not associated with a particular group. Instead, it is a condition on the properties of group members generally. As discussed in Using group filtering conditions on page 78, a group filtering condition must have a corresponding resource filtering condition that limits the collection of resources to a specific group.

76

Advanced Resource Management Resource requirements

Creating a filtering condition On the Requirements tab, check the Create/modify filtering conditions frame to enable it. Then either choose an existing filtering condition from the popup menu and modify it or create and name a new filtering condition. Each filtering condition is composed of one conditional operator applied to one property. The conditional operators are: =, >, <, >=, <=, and != (not equal). The property can be a resource property or a group property. (See Properties on page 70). Note that group properties are only enabled if the model has at least one group of resources.

Each filtering condition filters for one condition of one property.


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. Deleting a filtering condition If you try to delete a filtering condition, it may give an error message that it is being used by a quantity expression. Before the filtering condition can be deleted, any quantity expressions that use it must also be deleted. And before those quantity expressions can be deleted, any resource requirements that use them must also be deleted. Default filtering conditions By default one filtering condition is automatically created for each pool that was created using a Resource Pool block; default filtering conditions are optional if pools or groups are created using the Resource Manager block. Default filtering conditions have FC_ before the name of the pool or group. See Default resource requirements on page 80. Examples of filtering conditions Examples of filtering conditions include: FC#1 filter using a resource property Pool that has the condition = Pool 2 FC#2 filter using a resource property Total Idle Time that has the condition > 10 FC#3 filter using a group property Skill Level that has the condition = 2 FC#4 filter using a resource property Group that has the condition = Group A As discussed below, saved filtering conditions are used to create a quantity expression.

Saving the filtering condition saves it to a database. To save the database, save the model.
Resources

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

Advanced Resource Management Resource requirements

77

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:

Resources

How a quantity expression gets applied during the simulation run (Order By is optional)

The Create/modify quantity expressions frame (Resource Managers Requirements tab) is for specifying the quantity of resources to be drawn from a set of resources defined by filtering conditions. The result is then saved as a quantity expression for use when building a resource requirement. Choices for the Quantity clause The quantity is entered using a popup menu at the right of the SELECT button, shown in the screen shot above. As seen in the screen shot to the right, the choices for popup menu are: All the resources A quantity determined from a named attribute A quantity that is user-input Unless it is limited by a WHERE clause in the quantity expression, the selected number of resources will be drawn from all the resources in the Advanced Resourcess Resources table.

78

Advanced Resource Management Resource requirements

Choices for the Order By clause Ordering the resources is optional. If chosen, any one of the resource properties listed on page 70 can be used to sort the resources. The resources at the top of the sorted list will be used first. The default is that an ascending value of utilization is used to sort the resources. This causes resources that are being utilized the least to be selected first. Creating a quantity expression On the Requirements tab, check the Create/modify quantity expressions frame to enable it. Then either choose an existing quantity expression from the popup menu and modify it or create a new quantity expression. To create a new quantity expression:

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
clause on page 78). 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
Resources
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 76. 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.

See below if group filtering conditions are used.

Advanced Resource Management Resource requirements

79

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. Deleting a quantity expression If you try to delete a quantity expression, it will probably give an error message that the quantity expression is being used by a resource requirement. Before the quantity expression can be deleted, any resource requirements that use it must also be deleted. Default quantity expressions One quantity expression with a default quantity of 1 is automatically created for each pool created using a Resource Pool block; default quantity expressions are optional if pools or groups are created using the Resource Manager block. A corresponding resource requirement is optionally created when a new quantity expression is created. See Default resource requirements on page 80.

Saving the quantity expression saves it to a database. To save the database, save the model.

Resources

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 73. It can be overridden for a particular resource, as discussed in Overriding the resource requirement rank on page 74. 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.

80

Advanced Resource Management Resource requirements

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 67 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
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. When a quantity expression is created When a new quantity expression is created, the option is given to create a corresponding default resource requirement. The default resource requirement will be the same as the quantity expression, but its name would be preceded by RR. The name of the resource requirement can be changed before the requirement is saved.

Resources

The default resource requirement for a new pool or group is that one resource will be required.

Advanced Resource Management Comparison of the three resource methods

81

Comparison of the three resource methods


Technique Resource Item Block Resource Pool Method Resources are represented as a quantity in a pool in the Resource Pool block. Individual resources cannot have properties and are thus indistinguishable within a pool. The Resource Pool block maintains statistics. Requirements are specified using a data table in the Queue. The table specifies the required quantities from one or more pools. The required pools are selected using the settings in the dialog. The required counts can be specified using attribute values or connectors. Advanced Resource Management Resources are represented in a table in an internal database. Each resource is a record in this table. The fields in the table are used to store property values and statistics for individual resources. Requirements are specified using logical expressions created in the dialog of the Resource Manager block. These expressions consist of components that specify required quantities and filtering conditions that limit the set of resources to those wanted.

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. Requirements Specification There is no dedicated user interface for specifying resource item requirements. Typically, Queue Equation or Queue Matching blocks are used to hold items until the required resource items are available. Then, released items are batched with resource items.

Resources

Advantages

1. Does not require con1. Because resources are items, they can have prop- nections to blocks. erties that allow them to be distinguished individually. 2. Does not need complex routing logic to control the 2. Modelers have full con- allocation and release of trol over the logic govern- resources. ing how resources are 3. Resources automatically utilized. know which items are waiting for them. 4. Provides the capability to globally prioritize the allocation of resources to the highest ranked items.

1. Does not require connections to blocks nor complex routing logic. 2. Resources automatically know which items are waiting for them. 3. The allocation of resources to the highest ranked items is globally prioritized; multi-tiered ranking is supported. 4. Resources have properties that allow them to be distinguished individually. 5. Allows for very complex resource requirements and provides a flexible mechanism for creating resource release rules. 6. All information about resources is globally available to the model; details can be logged in the database.

82

Advanced Resource Management The Advanced Resources database

Technique

Resource Item Block

Resource Pool Method 1. Does not allow the use of attributes or other properties to track information about individual resources.

Advanced Resource Management 1. The complexity of this method requires more learning time compared to the other methods. 2. Advanced Resource Management is only available with the ExtendSim AT and ExtendSim Suite packages.

Disadvantages 1. The Resource Item block must be connected in the model such that the resources it outputs can be batched with the items that require them.

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.

The Advanced Resources database


The Advanced Resources database provides the architectural framework for the ARM system. ARM uses the database to represent, manage, and track the status and properties of resources, pools, and groups, as well as resource allocation and release rules. The database is automatically created when a Resource Manager block is added to a model. It is easily accessed by clicking the View Database button in the Resource Managers tabs or through the ExtendSim Database menu. There are several tables in the database. The most relevant to the modeler are described below.

Resources

Table Pools Resources Resource Transaction Log

Description Summarizes the results from the simulation run (total idle time, total utilization, and so forth) for each pool. Lists each resource and its properties, current status, and statistical information. Depending on the settings in the Resource Managers Event Logging tab, this table displays the transactions, status transitions, and results of the simulation run.

Also see Primary transactions for ARM on page 83.

Blocks that compose the ARM system


While the Resource Manager block is central to the ARM architecture, several other blocks perform important functions.

Advanced Resource Management Primary transactions for ARM

83

Block (Library) Resource Manager (Item AT & Suite)

Function When Used With Advanced Resources Provides the interface for managing advanced resources, resource requirements (allocation rules), release rules, and transaction logs. Use it to: 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 (Item) Queue Equation (Item) Resource Pool (Item)

Controls the ordering and allocation of resources Note: Selected queue behavior must be advanced resource queue. The equation can be used to conditionally allocate requirements to items released from the Queue Equation block. Note: Enable advanced resources (AR) on the blocks Options tab. A shortcut for creating a pool of resources. Controls the initial properties and number of resources in a pool and reports aggregated results for its resources. Notes: 1) Selected behavior must be advanced resource pool. 2) Since all its capabilities can be achieved using the Resource Manager block, this block is optional. 3) Resource Pool resources do not have properties unless the resources are advanced. Controls the release of resources. Notes: 1) Selected behavior must be release advanced resources. 2) Even if the model doesnt use any Resource Pool blocks, use of Resource Pool Release blocks is optional only if the resources are considered to be consumed and there are no concerns about model size and computer memory due to the accumulation of excess records for the non-disposed resources. Reports statistics for individual resources. Especially useful for exporting data and for performing batch means and multi-run analyses. Notifies the Resource Manager block when there is a change to a shift being used by one or more advanced resources.

Resources

Resource Pool Release (Item)

Statistics (Value) Shift (Item)

Primary transactions for ARM


The following diagrams and tables give an overview of how advanced resources are used in a model. The explanation is divided into three sections which describe what happens when: An item arrives at a Queue that is part of the ARM system A Resource Pool block gets a message to add or remove advanced resources A Shift block is used in the ARM system

In the explanations, the Database Tables Used column has the following abbreviations: RO
(Resource Orders), RTL (Resource Transaction Log), and RR (Resource Requirements).

84

Advanced Resource Management Primary transactions for ARM

Item-initiated ARM transactions


This part explains what happens when an item arrives at a Queue that is part of the ARM system.
INTERNAL DATABASE

, 7 , 11
RESOURCE MANAGER

,6
5

10

QUEUE

RESOURCE POOL RELEASE

Resources

# 1 2 3

Description An advanced resource item arrives in the Queue. The Queue orders resources from the Resource Manager. The Resource Manager generates a resource order and assigns a Resource Order ID to the item. The Resource Manager checks for availability of required resources.

MessageSending Block

MessageDatabase Tables Receiving Block Used Queue

Queue

Resource Manager RO, RTL

4 5

RO, Resources, RR, RTL Queue

The Resource Manager notifies the Resource Queue when the required resources are Manager available for the item. The Queue checks if it is blocked. If it Queue is not, it grants permission to the Resource Manager to allocate the resources to the item.

Resource Manager

RO, Resources, RTL

Advanced Resource Management Primary transactions for ARM

85

# 7

Description The Resource Manager allocates the resources and changes their status to busy. The item with the resources allocated to it is released to the model. The item arrives in the Resource Pool Release.

MessageSending Block

MessageDatabase Tables Receiving Block Used RO, Resources, RTL

8 9 10

Queue Resource Pool Release Resource Manager RO, Resources, Resource Release Rules, RTL RO, Resources, RTL

The Resource Pool Release sends a Resource Pool command to the Resource Manager to Release release resources from the item. The Resource Manager releases resources from the item and changes the status of the released resources from busy to their pending status.

11

Resources

86

Advanced Resource Management Primary transactions for ARM

Resource Pool-initiated ARM transactions


When a Resource Pool block receives a message that resources need to be added or removed, the transactions occur as illustrated below.
INTERNAL DATABASE

RESOURCE POOL

3 2

,7
RESOURCE MANAGER

6 5
QUEUE

Resources

# 1 2

Description The Resource Pool receives a message to add/remove resources.

MessageSending Block

MessageDatabase Tables Receiving Block Used Resource Pool Resource Manager Resources, RTL RO, Resources, RR, RTL

The Resource Pool notifies the Resource Pool Resource Manager that the quantity of pool resources has changed. The Resource Manager changes the quantity of resources for the pool. If resources were added, the Resource Manager attempts to service waiting items. If items can be serviced, the Resource manager notifies Queues with waiting items that the required resources are available. Resource Manager

3 4

Queue

Advanced Resource Management Primary transactions for ARM

87

# 6

Description

MessageSending Block

MessageDatabase Tables Receiving Block Used Resource Manager RO, Resources, RTL

The Queues check for being blocked. If Queue they are not blocked, they grant permission to the Resource Manager to allocate the idle resources to the items. The Resource Manager allocates the resources and changes their status to busy. The Queues release the items. Queue

RO, Resources, RTL

Shift
When advanced resources use a Shift block, the transactions are as follows.
INTERNAL DATABASE SHIFT

1 3

,7
RESOURCE MANAGER

Resources

6 5
QUEUE

# 1 2

Description The Shift receives a status change message. The Shift sends a shift status change message to the Resource Manager.

MessageSending Block

MessageDatabase Tables Receiving Block Used Shift

Shift

Resource Manager

88

Advanced Resource Management Primary transactions for ARM

# 3 4

Description The Resource Manager changes the status of all resources that use the Shift. If any resources have transitioned to the idle status, the Resource Manager attempts to service waiting items that depend on those resources. If items can be serviced, the Resource Manager notifies Queues with waiting items that the required resources are available.

MessageSending Block

MessageDatabase Tables Receiving Block Used Resources, RTL RO, Resources, RR, RTL

Resource Manager

Queue

The Queues check for being blocked. If Queue they are not, they grant permission to the Resource Manager to allocate the idle resources to their items. The Resource Manager allocates the resources and changes their status to busy. The Queues release the items. Queue

Resource Manager

RO, Resources, RTL

RO, Resources, RTL

Resources

User Guide Addendum

Block Changes

90

Block Changes Hierarchical blocks

Hierarchical blocks
The name of the top level model now appears in angle brackets (< >) in the title bar of each hierarchical block. printed User Guide, page 541 3D objects can now be represented by multiple blocks within a hierarchical block. See Hierarchical blocks and 3D animation on page 96. printed User Guide, page 474

New blocks in libraries


There are several new blocks in ExtendSim 8. Note that some blocks are specific to a particular ExtendSim product while others are included in every ExtendSim package.

All page references are to this Addendum.


Block Block Info Library (product) Utilities (CP, OR, AT, Suite) Use Reports information (name, number, position, etc.) about the block connected to its input connector. Calculates statistics for all of the records in a database field. Displays the event calendar in discrete event models, revealing the event times for all event posting blocks. Registers a section of a database so that the block receives a message when data in the linked database changes. Creates an interface for controlling a model. 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. Shows how to develop ExtendSim database popup menus. Develop sophisticated resource structures. See Resource management on page 50 of this Addendum. Evaluate and compare model configurations. See Scenario analysis on page 34 of this Addendum. Provides a flexible slider for models. It can be cloned to the worksheet or Notebook, be linked to a database, and more.

DBStatistics Event Monitor

Value (CP, OR, AT, Suite) Utilities (CP, OR, AT, Suite)

Link Alert

Utilities (CP, OR, AT, Suite)

Blocks

Model Interface Memory Usage

Utilities (CP, OR, AT, Suite) Utilities (CP, OR, AT, Suite)

MYOB DB Dialogs Resource Manager

ModL Tips (CP, OR, AT, Suite) Item (AT, Suite)

Scenario Manager

Value (AT, Suite)

Slider

Utilities (CP, OR, AT, Suite)

Block Changes Changed blocks in libraries

91

Block Query Equation

Library (product) Value (AT, Suite)

Use Intelligently searches a database and reports the best-ranked record. See Query Equation and Query Equation(I) blocks on page 20 of this Addendum. Intelligently searches a database and reports the best-ranked record when an item arrives. See Query Equation and Query Equation(I) blocks on page 20 of this Addendum.

Query Equation(I)

Item (AT, Suite)

Changed blocks in libraries


While there have been enhancements to many of the blocks, the following blocks have significant changes.

All page references are to this Addendum.


Value library
Block Catch Value Command Changes Based on their broadcast mode, you can limit which Throw Value blocks to get the value from. Uses COM as the underlying inter-application technology, replacing IPC. When sending a command to a selected Excel workbook, the dialog has a new popup menu that lists the workbooks macros. Additional control over when the command is sent. Three check boxes for controlling the behavior of Excel after the command is sent, after the workbook is saved, and after the workbook is opened. Equation The Options tab has more choices for controlling when the equation is calculated. There is also a new check box to enable control of messaging. There is a new mechanism for copying and deleting rows in the middle of a table. The options appear when the green +/- resize button is clicked. When the number of rows is increased, the contents of the current last rows are used as the content for the newly added rows. The names of some input and output variable types have been changed and new variable types have been added. See Equation components on page 10 of this Addendum. As is true for other equation-based blocks, the block now has an Equation Editor and Debugger and it supports include files. See pages 13, 14, and 17of this Addendum. When the cursor hovers over the Variable Value columns, tool tips display the names associated with the database indexes for DB Read and DB Write type variables.

Blocks

92

Block Changes Changed blocks in libraries

Block Optimizer Read Throw Value Write

Changes Supports Shift-clicking to add dialog variables to the Objectives table. See Referencing dialog variables on page 100 of this Addendum. The Options tab has several new check boxes for more control over when a read takes place. Has a new mode for broadcasting the value within a hierarchical block. The Options tab has several new check boxes for more control over when a write takes place.

Item library
Block Activity Changes A new Contents tab that shows either current information about items or a historical log. Since displaying during the run can impact performance, the tab has 2 other options for when contents are calculated and displayed. The Results tab now provides information about shifts and blocked/busy/idle times as well as explicit control over how utilization is calculated. Create Supports creating items from multiple random streams. This feature requires the use of the ExtendSim database but is infinitely scalable. A maximum number of items, which includes item quantities, can be set if the block creates items infinitely. A Maximum item creation events box defines the maximum number to be just generated items, ignoring item quantities. Name tracking is supported when the block creates items by schedule. If the schedule has DB Address Attributes defined in it, the block will now do name tracking on any relevant changes that might take place in the database. When creating values by schedule, the block supports multiple columns, i.e., each row in the schedule may now create n values for the output connectors. Equation(I) There is a new mechanism for copying and deleting rows in the middle of a table. The options appear when the green +/- resize button is clicked. When the number of rows is increased, the contents of the current last row are used as the content for the newly added rows. The names of some input and output variable types have been changed and new variable types have been added. See Equation components on page 10. As is true for other equation-based blocks, the block now has an Equation Editor and Debugger and it supports include files. See pages 13, 14, and 17 of this Addendum. Executive The Item Contents tab is for locating blocks in the model that have Contents tabs and remotely controlling what is being tracked. For each specified block, you can change between showing current currents or a historical log, select one or more attributes to track, and enable/disable the tracking. Use the Select column to choose all the blocks, none of the blocks, or to toggle between them.

Blocks

Block Changes Changed blocks in libraries

93

Block Queue

Changes A new Contents tab that shows either current information about items or a historical log. Since displaying during the run can impact performance, the tab has 2 other options for when contents are calculated and displayed. Has a new behavior allowing it to be set as an advanced resource queue. See Advanced Resource Management on page 51 of this Addendum.

Queue Equation

A new Contents tab; see Queue. There is a new mechanism for copying and deleting rows in the middle of a table. The options appear when the green +/- resize button is clicked. When the number of rows is increased, the contents of the current last row are used as the content for the newly added rows. The names of some input and output variable types have been changed and new variable types have been added. See Equation components on page 10 of this Addendum. As is true for other equation-based blocks, the block now has an Equation Editor and Debugger and it supports include files. See pages 13, 14, and 17 of this Addendum.

Queue Matching

A new Contents tab; see Queue. The block now supports FIFO, LIFO, Priority, and Attribute ordering rules. There is a value input connector to specify the order. Use the Common Group check box to classify one match attribute value as common. An item with this is available for matching with any other group. Performance has been improved and item information, which greatly impacts performance, is now optional.

Blocks

Read(I)

There is a new mechanism for copying and deleting rows in the middle of a table. The options appear when the green +/- resize button is clicked. When the number of rows is increased, the contents of the current last row are used as the content for the newly added rows. Options have been moved to their own tab. A new option is for choosing the time units format in which data from a date field should be read either simulation time or date time. The Read table has three new options for specifying the record index: Item Count, Record Search Using Attribute, Record Search Using Connector. The Read table also has a new option, Previous result, for specifying table, field, and record indexes. This uses the result from a previous read (a row higher in the table) as an index. Consequently, modelers will no longer have to place two or more Read(I) blocks in a row in a model.

Resource Pool Resource Pool Release

Has a new behavior allowing it to be set as an advanced resource pool. See Advanced Resource Management on page 51 of this Addendum. Has a new behavior allowing it to release advanced resources. See Advanced Resource Management on page 51 of this Addendum.

94

Block Changes Changed blocks in libraries

Block Shutdown

Changes The Shutdown is now integrated with the Shift block, allowing a remote scheduled shutdown from the Shift. Failures can now be caused by the progression of simulation time, uptime only, or item count. The competing failures mode is now called multiple fail stream. In single fail stream mode, failures are caused either by the progression of uptime or the item count. In multiple fail stream mode, the progression of simulation time option is also available.

Unbatch Write(I)

Now has the option to create duplicates of each items batched preserved items. printed User Guide, pages 204-205 There is a new mechanism for copying and deleting rows in the middle of a table. The options appear when the green +/- resize button is clicked. When the number of rows is increased, the contents of the current last row are used as the content for the newly added rows. Options have been moved to their own tab. A new option is for choosing the time units format in which data from a date field should be read either simulation time or date time. A popup chooses if the data replaces the destination data or is appended to it. The Write table has three new options for specifying the record index: Item Count, Record Search Using Attribute, Record Search Using Connector.

Rate library
Valve A popup menu has been added to this blocks Flow Control tab so you can start the simulation run with the goal off, on, or defined by the value at the G connector. The fourth bullet on page 338 of the printed User Guide should read: 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.) printed User Guide, pages 338 and 340

Blocks

Utilities library
Buttons This block has a new Options tab for controlling when the equation is calculated when the model is opened, when an enclosing hierarchical block is opened, and so forth. printed User Guide, page 507

User Guide Addendum

Odds and Ends

96

Odds and Ends 3D animation

3D animation
The ExtendSim Suite product has 3D animation capabilities, called E3D animation. The following E3D improvements have been made in release 8.

Stacking overflows
In release 7 mountStacks were unlimited in height. Blocks that held a large number of items would display an equally large number of objects in the E3D world, causing the simulation to run slowly or fail. In release 8, queues, activities, and resources (Item library) have a dialog item so you can limit the number of items visually represented in the E3D world. If not overridden, the default mountStack limit is 10. printed User Guide, page 410

Collision avoidance
If objects in the E3D world are not meant to collide, they will now appear to pass through each other. This is automatically handled by the Item library blocks. If you program, a new function and message handler give you complete control over how collisions are handled. See the function E3DMountStackLimit(integer blockNumber, integer limit) on page 112 of this Addendum.

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 relationship that the block has inside the hierarchical block. 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. printed User Guide, page 474

Odds/Ends

Shelf object
For custom object builders, the Shelf object now has multiple mount point behaviors. printed User Guide, page 392

File menu change


The only change to the File menu involves the Network License command.

This command is only enabled if the ExtendSim application is a concurrent-user network license.
The Network License command has several options: License Info, Check Out License, Check In License, and Remove License. For release 8, the License Info options changed and there are two new log files.

Network License

Odds and Ends File menu change

97

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. ing 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. Log files Two log files are automatically created on the Server and stored in the Servers ExtendSimServer folder: 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. 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.

The WanUsers and WanExportList text files are stored in each Clients Documents folder. Creat-

Odds/Ends

printed User Guide, page 683

98

Odds and Ends Edit menu changes

Edit menu changes


Open Dynamic Linked Blocks command
The command Edit > Open Dynamic Linked Blocks opens the Find Links dialog, shown on the right.

In release 8 this dialog also

finds registered blocks. Since they are mainly for developers, registered blocks are discussed on page 105. The Find Links dialog is useful for locating and examining linked dialog items or registered blocks.

Link dialog for Global Array

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. printed User Guide, page 635

Options command Odds/Ends


The Options command is located in the Edit menu. It opens a dialog for setting preferences. The Libraries and Misc tabs of the Options command have some new options. Libraries tab Preload libraries Depending on the particular product, the major libraries (Animation 2D-3D, Item, Plotter, Rate, Utilities, and Value) preload by default. For example, launching ExtendSim CP causes the Animation 2D-3D, Plotter, Utilities, and Value libraries to also open. The libraries that will open on application launch are listed in fields on the Libraries tab. To cause the library window to open when a library opens, check the check box next to its field. To cause a library to not preload, erase its name from the field. Show legacy/prior version warnings This new 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.

Odds and Ends Develop menu changes

99

As discussed on page 6, legacy libraries are included so that models created using those obsolete libraries can still run. The 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 libraries are no longer supported and should not be used to create new models.
Models are not backwards compatible. Once they have been saved in a new version of ExtendSim, models cannot be opened using a prior version. If you open an older model, ExtendSim warns that it is converting the older file to v8 format. To avoid overwriting the older file, give the File > Save As command to save the new file under a different name or save a copy of the file to a new location. printed User Guide, page 690 Misc tab New option: Version check on application launch. Allows ExtendSim to search for new versions when it launches, determining 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. printed User Guide, page 694

Develop menu changes


Show Reserved Databases
This command is discussed on page 28.

Run menu changes


Run Optimization or Scenarios
Previously this command (and its related tool in the toolbar) only ran optimizations. Now it can be used to run either optimizations or scenarios, depending on which block (Optimizer or Scenario Manager) is placed in the model. The Optimizer and Scenario Manager blocks are located in the Value library. Optimization is discussed in the printed User Guide on pages 572-586. Scenario Management is a new feature in ExtendSim 8; it is discussed on page 96 of this Addendum. Note that you cannot run optimization and scenarios at the same time. ExtendSim will warn if you give this command, or use the Run Optimization or Scenarios tool, with both an Optimizer and a Scenario Manager block in the model. printed User Guide, pages 579, 583, 714

Odds/Ends

Other interface changes


Getting Started model
A new model file, Getting Started, appears as a window each time you launch ExtendSim. Use it to open a recent model file, open a new model worksheet, view video clips, and access example models and other informative files.

100

Odds and Ends Miscellaneous

To cause the model to not open the next time ExtendSim 8 is launched, click Dont Show Again. The next time ExtendSim is launched, a new blank model window will appear instead. If you have clicked Dont Show Again but now want the Getting Started model to open when ExtendSim launches, enter the model name in the Edit > Options > Model tab: Default model path: Getting Started.mox. Referencing dialog variables Sometimes a modeler must use a source blocks dialog variable as a parameter in a target block. For instance, this is how modelers set model factors and get model responses with the Scenario Manager block, discussed on page 96. Blocks that use the interface The following blocks reference dialog variables from other blocks: Find and Replace (Utilities) Optimizer (Value) Scenario Manager (Value library of ExtendSim AT and Suite) Statistics(Value library) Custom built blocks, if they use specific functions All of the Value, Item, and Rate blocks have code that supports these interfaces; the feature is also available to block developers, as discussed in Remote access to dialog variables on page 103. Methods for referencing dialog variables as factors There are 3 ways to add a dialog variable to target blocks: Shift-click. Shift-click the source parameter in the source blocks dialog. In the window that appears, select which target block should get the parameter. Clone drop. Drag a clone of the source parameter from the source blocks dialog and drop it onto the target blocks icon. This method is especially helpful when one or more of the blocks is within a hierarchical block. Manual. Manually enter the dialog variable name into a field or table in the target blocks dialog.

Odds/Ends

These methods only work if one of the target blocks is in the model.
Miscellaneous
Other item properties

_Resource Order ID. This item property is only available in the Queue and Queue Equation blocks (Item library) if Store Resource Order ID in attribute is checked and the blocks are part of the Advanced Resource Management system. The property is the value of a record index in the Resource Orders table of the Advanced Resources database. The record represents the last requested requirement that was assigned to an advanced resource item. The property is stored in itemArrayI2[][5]. Advanced resources are discussed in the chapter starting on page 50. printed User Guide, page 126

Developer Reference Addendum

Programming Techniques

102

Programming Techniques Reserved databases

Reserved databases
ExtendSim databases are internal repositories for storing, managing, and controlling model data. A reserved database is a specialized type of ExtendSim database that can be hidden from the modeler. Reserved databases provide database capabilities without the modeler having to use, or even be aware of, the reserved database. Typically a database would be created by a modeler for a specific model. A reserved database, on the other hand, is usually created by a programmer using the database API. printed Developer Reference, page 102

Example
A common use of a reserved database is to support the architecture of a block. For example, when the Resource Manager block (Item library of ExtendSim AT and ExtendSim Suite) is added to a model it creates a reserved database named _rM_Database. There are numerous tables in that database, each focusing on different aspects of the block and how it functions. For instance, the Dialog Colors table, shown here, stores the HSV values of the colors used for text labels in the blocks dialog. Other tables track filtering conditions, store resources with their ranking and skill levels, and so forth. When the modeler enters data and makes selections in the Resource Manager block, these are tracked in the reserved database. This process is invisible to the modeler. The Optimizer block (Value library) is an example where a reserved database is used to provide a feature for the modeler. This is discussed in Shift-click example on page 105.

Creating and editing


Reserved databases are created and edited in much the same manner as you would create or edit any ExtendSim database. Some differences are: To notify ExtendSim that the database is to be reserved, enter a leading underscore (_) at the beginning of the databases name. For example, the name would look like _AReservedDB. To prevent modelers from accidentally writing to reserved databases, they require special write functions. These are listed on page 118. An error message will be displayed if the special write functions are used for non-reserved databases, and vice versa. Since they are intended for developers, ExtendSim doesnt support using blocks (such as Read or Write) to access reserved databases. It also doesnt allow modelers to link dialog items to a reserved database. When a block that requires a reserved database is added to a model, the code of the block creates the database in the model. In most cases, unless a block that requires a reserved database is placed in the model, the model will not have any reserved databases. If a model has reserved databases, they will not be displayed in the Database List or at the bottom of the Database menu unless you first give the command Develop > Show Reserved Databases. By default, this command is not selected. Furthermore, the command is re initialized to off each time the model is opened. Even if a reserved database is not listed in the Database List or at the bottom of the Database menu, it is always accessible through ModL functions.

Techniques

Programming Techniques Remote access to dialog variables

103

Changing anything in a reserved database is equivalent to changing the code of a block. It is likely to corrupt any blocks that use it.

Remote access to dialog variables


Sometimes it is useful to allow a modeler to use a stand-alone block to get or set the value of a dialog variable in a remote block. For instance, this is how modelers set model factors and get model responses using the Scenario Manager block, discussed on page 34. In ExtendSim there are three mechanisms for interfacing dialog variables between a stand-alone block and a remote block: 1) Manually enter the remote blocks number and dialog variable name into the stand-alone block 2) Clone-drop, using the Clone tool to drag the parameter onto the icon of the stand-alone block 3) Shift-click a dialog parameter and select from the popup menu of available options to add that parameter to the stand-alone block. This is especially helpful when one or more of the blocks is within a hierarchical block. The Find and Replace (Utilities library), and the Optimizer, Scenario Manager, and Statistics blocks (Value library) reference dialog variables in other blocks. And all of the Value, Item, and Rate blocks have interfaces that support this feature. These interfaces are also available to developers. As discussed below, taking advantage of these interfaces requires only minor additions to your custom block code. printed Developer Reference, page 92

Custom remote blocks interfacing with a stand-alone block


The blocks in the Value, Item, and Rate library have code that allows a stand-alone block to get or set their dialog variables; they support all 3 of the above options. Your custom block can also take advantage of this interface, allowing a stand-alone block to interface with your blocks variables: Options 1 and 2 will automatically be implemented without any modification to your blocks. For option 3, you need to add the following code to your custom block:

Include MouseClick v8.h Add the following code


{ if(do_keydown_mouse_click()) return; } #include "MouseClick v8.h" On DialogClick // called whenever the modeler clicks a dialog item

If you have additional code in this message handler, put it after this code.
Custom stand-alone block referencing remote dialog variables
If you create a stand-alone block that will reference (get or set) remote dialog variables in other blocks, you can implement any or all of the above methods for collecting the information from the remote block, as discussed below. (While it is also possible to develop your own interface, using one or more of the ExtendSim interfaces will be easier and more consistent with existing blocks.)

Techniques

104

Programming Techniques Remote access to dialog variables

Manual data entry Implementing a manual method for referencing from the list in a custom stand-alone block depends on your particular implementation, interface, and needs. Some blocks, such as Find and Replace (Utilities library), only work with one remote dialog variable at a time. Other blocks, such as Statistics (Value library), have a list of remote dialog variables. For coding examples, look at one of those blocks. Clone drop Adding a clone-drop interface to a custom block requires a DragCloneToBlock message handler. This is called whenever a clone is dragged to the icon of that block. Inside of this message handler, call GetDraggedCloneList. This function requires two arguments an integer dynamic array and a string dynamic array. It returns the number of clones (usually 1) dropped onto the block. You then use this information to reference a dialog item in another block. Shift-click The shift-click feature is more complicated to implement because it requires using a reserved database (discussed on page 102) and an include file. The reserved database (_leftClickDB) provides the necessary information for the shift-click action. The include file (MouseClick.h) has two functions defined in it that are required for managing the reserved database: 1) RegisterBlockInLeftClickDB(String blockNumberDialogVariable, String staticStringVariableForRemoteBlockName, String sStaticStringVariableforRowAndColumn, String popupMenuLabel, integer optionNumber). Registers a block in the database of blocks that add a popup to a shift-click action. This is called in the CreateBlock, PasteBlock and OpenModel message handlers. See the MouseClick v8.h include file for an explanation of the arguments. 2) UnRegisterBlockInLeftClickDB. Removes a block from the database of blocks that add a popup to a shift-click action. This should be called in the DeleteBlock message handler. Coding for Shift-click The key to the Shift-click functionality is a hidden dialog variable in the stand-alone block. When this dialog variable is set by the remote block, the stand-alone block receives a message that it has been sent a reference to a dialog variable in the remote block. The name of the hidden dialog variable is stored in a table in the reserved database (_leftClickDB) by the RegisterBlockInLeftClickDB function. The information sent by the remote block must be processed in the message handler for the hidden dialog variable. This information has been set in static variables in the stand-alone block by the remote block. The names of the static variables are set in the RegisterBlockInLeftClickDB function. The information includes the block number, dialog variable name, and database tables row and column. These values can be found in the Dialog and Static variables that are arguments to the RegisterBlockInLeftClickDB function.

Techniques

In the following code example, the stand-alone block gets: The block number for the remote block in the dialog variable AddFactor_prm The name of the remote block's dialog variable in the static string variable DialogVarName The row and column of the remote dialog variable in the RowColumnDialogVar static string variable And the popup menu is labeled Scenario Manager: Add Factor. Because the Scenario Manager has two options (one for adding a factor and one for adding a response), this is option 1.

Programming Techniques Registered blocks

105

On OpenModel { RegisterBlockInLeftClickDB( "AddFactor_prm","DialogVarName", "RowColumnDialogVar", "Scenario Manager: Add Factor", 1); } On AddFactor_prm { // Receive message from remote block and process hidden variables // AddFactor_prm is the block number of the remote block // DialogVarName is the dialog variable in the remote block // RowColumn is the row and column in the remote block }

Shift-click example When the Optimizer block (Value library) is added to a model it creates the reserved database _leftClickDB. The entries in the database table cause options, such as Optimizer: Add Parameter, to be added to a menu that appears when an appropriate dialog item is Shift-clicked. Through block code, the Shift-click action causes the selected variable to be used in the Optimizer block. Using this type of architecture makes it easy for developers to add their own block options to the Shift-click menu. printed Developer Reference, page 92

Registered blocks
printed Developer Reference, page 334 Block registration is a method for keeping a block informed when there is a change in the linked data source. Unlike user-defined or code-defined links (which link a particular dialog item to a data source), block registration functions link an entire block to a data source. The block registration functions start with DBBlockRegister or GABlockRegister. Depending on the function chosen, the block gets a LinkContents message if the content of the data source changes or a LinkStructure message if the structure of the data source (such as the name of a table or the location of a field) changes. An example of block registration for content changes is the Read block (Value library). When Link Alerts is checked in its Options tab, the block registers itself so that it will be alerted if/when changes are made to its source data.

Techniques

Registered blocks can be located using the Find Links dialog (Edit > Open Dynamic Linked Blocks) discussed on page 98. Use registered blocks judiciously. Due to the extra messaging, a registered block can significantly slow the simulation run.

COM DLL example


printed Developer Reference, page 107

106

Programming Techniques Integer arrays

The VB.net COM DLL example model (Windows only) shows how to interface from ExtendSim with a COM DLL created in VB.net. The COM DLL folder includes the model plus an ExtendSim library with a custom block as well as the source code used to create the COM DLL. ExtendSim is the Client in this automation example; this is the inverse of the Client App example where VB is the Client.

See the folder ExtendSim8\Examples\DeveloperTips\OLE Automation\VB\ COM DLL


Integer arrays
There are two integer arrays: The array itemArrayI[][5] is passed through SysGlobal4. It is discussed on page 161 of the printed Developer Reference. The new itemArrayI2[][5] is passed through SysGlobal18 and has 5 columns, all of which are reserved: Slot # 0 Description Resource Order ID. If an item has requested at least one advanced resource requirement, the integer held in slot 0 represents the record associated with the last requested requirement in the "Resource Orders" database table. Resource Order ID is used with Advanced Resource Management (ARM). Reserved for future use Reserved for future use Reserved for future use Reserved for future use printed Developer Reference, page 161

1 2 3 4

Techniques

Developer Reference Addendum

Messages, Variables, and Functions

108

Messages, Variables, and Functions Menu and keyboard equivalents for developers

Menu and keyboard equivalents for developers


printed Developer Reference, page 382 The following commands are not new in release 8. However, they were left out of the printed Developer Reference.

Develop menu
Command Compile Block New Dialog Item Shift Selected Code Left Shift Selected Code Right Go To Line Match Braces Match IFDEF/ENDIF Windows Ctrl+K Ctrl+I Ctrl+[ Ctrl+] Ctrl+ Ctrl+J Ctrl+I Macintosh Cmnd+K Cmnd+I Cmnd+[ Cmnd+] Cmnd+ Cmnd+J Cmnd+I

Run menu
Command Run Simulation Simulation Setup Add Selected To Report Remove Selected From Report Stop Pause Step Resume Debugging > Add Selected To Trace Debugging > Remove Selected From Trace printed Developer Reference, page 371 The command numbers for the new menu commands are: Database menu: Edit Table Properties 1932 Database menu: Edit Field Properties 1933 Database menu: Read/Write Index Check 1931 Develop menu: Show Reserved Databases 1928 Windows Ctrl+R Ctrl+Y Ctrl+6 Ctrl+7 Ctrl+. Ctrl+/ Ctrl+, Ctrl+Ctrl+8 Ctrl+9 Macintosh Cmnd+R Cmnd+Y Cmnd+6 Cmnd+7 Cmnd+. Cmnd+/ Cmnd+, Cmnd+Cmnd+8 Cmnd+9

Menu command numbers for new commands

Functions

Messages
printed Developer Reference, pages 198-208

Messages, Variables, and Functions System variables

109

Simulation messages
ModifyRunParameter Sent before the simulation run begins to allow changing the Simulation Setup parameters via the SetRunParameter() function. Note that this is sent only once even for multiple simulation runs. SimStart Sent after ModifyRunParameter but before all other simulation message handlers. See BlockSimStartPriority function on page 114 for details. SimFinish Sent after all other simulation message handlers. See BlockSimFinishPriority function on page 114 for details.

Dialog messages
DataTableHover Send to the block when the cursor is hovering over a data table. (Use DTToolTipSet to set the value of the tool tip caption to be displayed.)

3D Animation messages
E3DCollision Sent when two objects are about to collide in the E3D window. Used to control whether or not a collision occurs or otherwise to respond to a collision. (Be aware that this message can occur multiple times for each potential collision.) If a collision is about to happen, the block associated with the 3D object that is about to collide with another 3D object receives an E3DCollision message. The new function E3DMessageInfo (see page 112) allows the programmer to request the 3D object ID of the object that is about to collide and/or the object that is about to be collided with. The E3DCollision message has been defined such that aborting the message will tell the E3D engine that the collision should not happen. This makes the objects noncolliadible for the purposes of that collision. The result is that they will visually pass right through each other or, in the event that the collision would have just been the two objects brushing edges, they will just pass right by each other. This functionality is implemented in the Item library to reduce unintentional collisions that could cause objects to move incorrectly in E3D models.

System variables
printed Developer Reference, pages 194-196

CurrentScenario
In models where the Scenario Manager is running a series of scenarios, this is the current scenario number. This will be equal to the row in the Scenarios table that is currently providing the factors to the model.

NumScenarios
In models where the Scenario Manager is running a series of scenarios, this is the total number of scenarios that will be run.

Functions

110

Messages, Variables, and Functions Functions

Functions
The following are mostly new functions. Where noted, however, some older functions have been updated with new values or features.

Function returns
Except for void functions, which do not return values, all functions return values that are real, integer, or string. The type of value returned is indicated in the third column of the function tables as: Return R I S V Meaning Real or Double (8 byte double) Integer or Long (4 byte long integer) String (up to 255 characters) Void function (no value returned)

Math functions
printed Developer Reference, page 225+ Equations EquationIncludeSet(string theIncludeName) IncludeFileEditor(string includeFileName, integer blockNumber) Description Called right before one of the equationCompile functions, this puts the contents of the specified include file into the compiled equation. Call this for each include desired. Tags the specified include file to do the following: If you click the close box, it will not close, but instead will send a message to the block specified by blockNumber. Equation-based blocks use this for their external code editor functionality; see the equation blocks for examples. Returns 0 for success or a negative value to indicate failure. Return V

Equation Debug is a new category of functions. See the code of equation-based blocks for more
information on how the following functions are used. Description Converts the equation code and variable names into block form so it can be debugged. DebugEquationIndex is the previously returned value from a previous call to this function for this equation, or zero when this function is called for the first time with this equation. Returns a debug equation index to be used in the other equation debugging functions. TabOrder is the tab order of the text item with the equation. See the equation-based blocks for how to use this function. Equation Debug EquationDebugCompile(integer debugEquationIndex, string equationCodeArray[], string varsInputArray[], string varsOutputArray[], long tabOrder) Return I

Functions

EquationDebugSetBreak- Opens a Set Breakpoints window so the user can click to crepoints(integer ate debugger breakpoints. Returns a True value if an error debugEquationIndex) occurs.

Messages, Variables, and Functions Functions

111

Equation Debug EquationDebugCalculate(integer debugEquationIndex, real inputVarValuesArray[], real outputVarValuesArray[]) EquationDebugDispose(integer debugEquationIndex)

Description Calculates the equation using specified input values. The output values for the result will be put into outputVarValuesArray. Returns a TRUE value if an error occurs.

Return I

Disposes the hidden block specified by debugEquationIndex used to debug a particular equation. This does not affect the visible equation block.

I/O functions
printed Developer Reference, page 227+ File I/O (unformatted) FileInfo(string filePathName, integer which) Description Returns information about the file specified in the filePathName argument. The which argument specifies what information will be returned: 1: created date 2: modified date Dates are returned as ExtendSim date values. Returns the type of machine the currently active model was saved on. (This is only useful if models have been moved from one platform to another. Otherwise, it will be the same as the machine the model is running on.) Type 2 is Windows, 1 is models built on 68k Macs, and 4 is models built on PPC Macs. Return R

GetFileReadMachineType()

Alerts & Prompts isKeyDown(integer keyCode)

Description Returns a True/False value for whether or not the specified key is pressed. The constants for keyCode are the constants for the API call GetKeyState (Windows) or the GetKeys functionality (Macintosh). User prompt with the ability to customize the text of the buttons. Returns True (1) if the first button is pressed or False (0) otherwise.

Return I

userPromptCustomButtons(string str, string button1, string button2)

E3D animation
printed Developer Reference, page 260+ 3D post E3DPostSetObjectBlockNumber(double time, long objectID, long blockNumber)

Functions

112

Messages, Variables, and Functions Functions

3D mountStack

Description

Return I

E3DMountStackLimit(in Determines the limit for mountStacks created by a specified teger blockNumber, inte- block. The purpose is to reduce the number of objects displayed ger limit) in the E3D window, enhancing performance. The mountStack limit only renders up to limit objects; after that it indicates the total count of objects as a number on the top of the stack. If not overridden by block code, the default mountStack limit is 10.

3D miscellaneous E3DMessageInfo(integer which)

Description Returns information about a message sent by the E3D window to ExtendSim. This function is used in the E3DCollision message handler to request the 3D object ID of the object that is about to collide (which=1) or the object that is about to be collided with (which=2).

Return I

E3DCollisionBlocker(inte Collision optimization. Used by the Transport and Convey ger objectID, integer Item blocks to inform a 3D object that it is in a queuing situablocker) tion and can optimize its collision calculations by only looking at the object specified in the blocker argument. Blocker should be the object ID of the object that is in front of the specified object in the queue.

Blocks and inter-block communication


printed Developer Reference, page 275+ Block numbers, etc. FindInHierarchy2(integer blockNumber, string findBlockName, string findBlockLabel, integer findDialog) Description The same as the FindInHierarchy function except it takes a block number argument. Return I

Block connection GetConnectionColor(integer blockFrom, integer conFrom, integer blockTo, integer conTo, integer colorArray[])

Description Fills the color array (three integer element) with the hue, saturation, and brightness (HSV) values for the color of the connection line. The HSV color palette is on page 252 of the printed Developer Reference. Returns 0 for success or a negative value to indicate failure.

Return I

Functions

Messages, Variables, and Functions Functions

113

Block dialog items

Description

Return S

DITitleGet(integer block- Returns the string title of the dialog item. For dialog items like Number, string dialogradio buttons and check boxes, the title is the text that appears ItemName) on the dialog. Use this function to retrieve the string if it has been set by the function DITitleSet. DISetFocus(integer block- Sets the focus on the specified dialog item. Returns 0 for success Number, string dialogor a negative value to indicate failure. ItemName) GetDialogNames(integer This function has additional values for typeArray. block, string nameArray[], Returns a list of the dialog variables in the specified block. Both integer typeArray[]) nameArray and typeArray are dynamic arrays. This function returns the number of items in the target blocks dialog. For each item in the blocks dialog, the string array will contain the name of the dialog item and typeArray will contain the type of dialog item. Values for typeArray are: 1:Button, 2:Check Box, 3:Radio Button, 4:Meter, 5:Parameter, 6:Slider, 7:Data Table, 8:Editable Text, 9:Static Text, 12:Switch, 13:Text Table, 16:Popup Menu, 17:Embedded Object, 18:Dynamic Text, 19:Text Frame, 20:Calendar, and 21:Editable Text31 (31 characters) LastSetDialogVariableString() Returns the last string value that was set by SetDialogVariable. This is useful if one is setting the value of a dialog item like a popup menu, where the stored value is not the value that the popup menu contains, but rather an additional string variable. In this case, using the WhoInvoked() function, below, and this function you can have the code of the block change the correct string for the dialog item, so the SetDialogVariable function will react as the user expects, even though the data is not directly contained in the dialog item. Determines if a dialog item message handler was invoked by a call to SetDialogVariable or by user interaction. Returns one if the invoke was through SetDialogVariable, or zero if through user interaction. Called in the message handler for the dialog item, this is useful if you need the code to react differently when the dialog item value has been set by the SetDialogVariable function.

WhoInvoked()

Block data tables

Description

Return V

DTToolTipSet(string cap- In conjunction with the DataTableHover message handler distionString) cussed on page 109 of this Addendum, this function allows you to show custom tool tips when the cursor hovers over a data table.

Functions

114

Messages, Variables, and Functions Functions

Dynamic linking DILinkUpdateInfo(integer which)

Description This function now has some new values for which: Should be called in the LinkStructure, LinkContent, or dialog item name message handlers. It will return information about which link changed and what the change was. Values for which: 0:Link type (returns 0:no link, 1:global array, 2:database, 3: dynamic array) 1:DB Index returns the index of the database for the link (if it's a DB link) 2:table/array index returns the value of the index 3:returns column index 4:returns row index 5:what changed (see below for values) 6:number of rows or columns changed 7:dialog item ID 8:the block number of the block that changed the data A which value of 5 (what changed) returns 1:data changed, 2:field inserted, 3:field deleted, 4:field renamed, 5:record inserted, 6:record deleted, 7:table or GA deleted, 8:table or GA renamed, 9:DB deleted, 10:DB renamed, 11:link created, 12:link modified, 13:link cleared, 14:DB replaced via DBDatabaseImport(), 15:GA resized, 16:table inserted, 17:field properties modified, 18:field moved, 19:table sorted, 20:Table Properties modified, 21:record ID modified.

Return I

Block messaging

Description

Return I

BlockSimStartPriorSets the priority value for receiving the SimStart message disity(integer blockNumber, cussed on page 109 of this Addendum. Returns 0 for success or integer priority) a negative value for failure. The default value is -1 and any block with a priority value of less than 0 will not receive the message. Blocks that have a priority value greater than -1 will receive the message in priority order (lowest to highest). BlockSimFinishPriorSets the priority value for receiving the SimFinish message disity(integer blockNumber, cussed on page 109. Returns 0 for success or a negative value for integer priority) failure. The default value is -1 and any block with a priority value of less than 0 will not receive the message. Blocks that have a priority value greater than -1 will receive the message in priority order (lowest to highest). DuringHBlockUpdate() During an HBlock update, some connections are temporarily broken and then reconnected. Returns True if called during an HBlock update so you can determine if ConnectionMake or ConnectionBreak messages can be safely ignored.

Functions

Models and notebook


printed Developer Reference, page 304+

Messages, Variables, and Functions Functions

115

Models, notebook GetRunParameterLong(integer which)

Description This function has additional values for which. Gets the specified run parameter using the value of which: 3:numSims, 4:numSteps, 5:random seed, 6:seedControl (value, from 1-3, of the seed popup from the Random Numbers tab), 7:checkRandomSeeds (value of the duplicate seeds check box from the Random Numbers tab), 8:timeUnits, 9:calendarDates, and 11: __seed table database index. Returns a true value if the notebook is currently open.

Return I

NotebookIsOpen()

I I

SaveTopDocAs(string file- Saves the top document under the file name and path name Path) defined by filePath. Similar to SaveModelAs except it will work on whichever the top ExtendSim document is. (Specifically used by the Equation block to save and close Include files.) Returns 0 for success or a negative value to indicate failure. SetRunParameter(real paramValue, integer which) This function has additional values for which. Also, see new ModifyRunParameter simulation message, above. Sets a single parameter in the Simulation Setup dialog. As an enumerated list, this function is more expandable than SetRunParameters(). The values for which are: 1:endTime, 2:startTime, 3:numSims, 4:numSteps, 5:random seed), 6:seedControl (value, from 1-3, for the seed popup from the Random Numbers tab), 7:checkRandomSeeds (value for the duplicate seeds check box for the Random Numbers tab), 8:timeUnits, 9:calendarDates, 10:startDate, 11: __seed table database index.

Scripting
printed Developer Reference, page 307+ Scripting ActivateApplication() ApplicationFrame(integer frame[], integer inside) Description Brings the ExtendSim application to the foreground. This is primarily used for interapplication/scripting Returns the application frame in global coordinates. The Inside argument specifies if the returned frame should be inside (includes the menubar and window frame) of the application frame window, or the outside. Declare frame as: Integer frame[4]; When the function returns, frame will contain: frame [0] - Top, frame[1] - Left, frame[2] - Bottom, frame[3] - Right Return V I

Functions

116

Messages, Variables, and Functions Functions

Scripting

Description

Return I

CloneGetInfo(integer clo- This function now has additional information. neID, integer whatInfo) For whatInfo, 1:returns the type of the clone, 2:returns the block number of the clone, 3:returns True if the clone is selected and False if it is not. Values for the type of clone (whatInfo:1) are: 1:Button, 2:Check Box, 3:Radio Button, 4:Meter, 5:Parameter, 6:Slider, 7:data table, 8:EditText, 9:StaticText, 12:Switch, 13:String Table, 14:Plotter pane, 15:Plotter data table, 16:Popup Menu, 17:EmbeddedObject, 18:DynamicText, 19:Text frame, 20:Calendar, 21:EditText(31). CloneHideDisable(integer cloneID, integer disable, integer flag) Disables or hides the specified clone. Returns zero if successful or an error code (negative number) otherwise. If disable is True, the function disables or enables the clone based on the value of flag. If disable is False, the function hides or shows the clone based on the value of flag. Specifies that the dialog box for blockNumber should be fixed to the specified height and width. User resizing of the block dialog will be restricted. Returns the path to the user documents directory. Similar to GetAppPath. Returns the full path to the specified recent file from the list of 5 recent files at the bottom of the File menu. The specified file (which) will be a number from 1 to 5. Returns TRUE if the running version of ExtendSim will open a specific type of library. Type values are: 17: OR library, 18: AT library, 19: Suite library Returns the block number of the last block placed on the active worksheet. Sets the application associated with the passed in handle to be the foreground window. Passing in a zero, sets ExtendSim as the foreground window. Windows handles for other applications then ExtendSim will need to be acquired through some means. One example would be querying the Excel object model through OLE/COM to return the object handle for Excel. See the code of the Command block in the Value library for an example of doing this.

DialogFixedSize(integer blockNumber, integer height, integer width) GetUserPath() GetRecentFilePath(integer which) IsLibEnabled(integer type) LastBlockPlaced() WinSetForegroundWindow(integer handle)

S S

I V

Database functions
printed Developer Reference, page 321+

Functions

Messages, Variables, and Functions Functions

117

DB creating/deleting DBDatabaseDeleteByIndex(integer databaseIndex)

Description Deletes entire database using index, returns error code. See also DBDatabaseDelete() in the Developer Reference.

Return I

Creates field fieldName using specified indexes, returns error DBFieldCreateByIncode. See also DBFieldCreate() in the Developer Reference. dex(integer databaseIndex, integer tableIndex, string fieldName, integer fieldFormat, integer decimals, integer unique, integer readOnly, integer invisible) DBFieldDeleteByIndex(integer databaseIndex, integer tableIndex, integer fieldIndex) DBTableCreateByIndex(integer databaseIndex, string tableName) DBTableDeleteByIndex(integer databaseIndex, integer tableIndex) DB import/export DBDatabaseImport(string databaseName, string pathName) Deletes field using index, returns error code. See also DBFieldDelete() in the Developer Reference.

Creates table tableName in current database using indexes, returns negative error code. See also DBTableCreate() in the Developer Reference. Deletes table using index, returns error code. See also DBTableDelete() in the Developer Reference.

Description There is new behavior: Import database from text file pathName, replacing the database named databaseName or creating it if it didnt exist. If the database name is in the form databaseName<delete>, it deletes any left over tables that were not imported in this file. If pathName is a blank string, let the user select a text file. Returns the database index or -1 if it fails. Sends both a LinkStructure message (what changed: DB replaced) and a LinkContent message (what changed: data changed) to linked blocks. See DILinkUpdateInfo() for an explanation of what changed. Description

Return I

Database properties

Return I

DBDatabaseRename(inte- Renames a database. Returns a negative error code if newDatager databaseIndex, string baseName already exists or the old database doesn't exist. newDatabaseName) DBDatabaseShowHideReserved(integer showIfTrueHideIfFalse) Use this to hide or show reserved databases without using the menu command. Reserved databases are discussed on page 102. Note: When the model closes, the reserved databases return to being hidden. So this command must be called again whenever the model is opened.

Functions

118

Messages, Variables, and Functions Functions

Database properties

Description

Return I

Passing in a database index, table index, field index, returns DBFieldExists(integer TRUE if the field exists, FALSE if it doesnt exist. Also see databaseIndex, integer tableIndex, integer fieldIn- DBDatabaseExists(), DBTableExists(), and DBRecordExists(). dex) Moves field fieldName to newFieldIndex, moving other fields in DBFieldMove(integer the process. Returns a negative when indexes are incorrect. databaseIndex, integer tableIndex, integer fieldIndex, integer newFieldIndex) DBFieldRename(integer Renames a field. Returns a negative error code if the field already exists or the old field doesn't exist. databaseIndex, integer tableIndex, integer fieldIndex, string newFieldName) DBRecordExists(integer databaseIndex, integer tableIndex, integer fieldIndex, integer recordIndex) DBTableGetProperties(integer databaseIndex, integer tableIndex) DBTableRename(integer databaseIndex, integer tableIndex, string newTableName) DBTableSetProperties(integer databaseIndex, integer tableIndex, integer initializeMethod) Passing in a database index, table index, field index, record index, returns TRUE if the record (database cell) exists, FALSE if it doesnt exist. Also see DBDatabaseExists(), DBTableExists(), and DBFieldExists(). Returns the initialization method: 0 is no initialization, 1 is delete all records for first run, 2 is delete all records for every run. Returns -1 if error. Renames a table. Returns a negative error code if the table already exists or old table doesn't exist.

Sets the initialization method: 0 is no initialization, 1 is delete all records for first run, 2 is delete all records for every run. Returns -1 if error.

The following read/write functions are for use only with reserved databases, which are discussed on page 102 of this Addendum. These functions protect modelers from accidentally modifying a reserved database. printed Developer Reference, pages 328-329 DB read/write Description Return I

DBDataSetAsNumberRe- This function works only with reserved databases. Otherwise, it served(integer databaseIn- is the same as DBDataSetAsNumber(), which works only with non-reserved databases. dex, integer tableIndex, integer fieldIndex, integer recordIndex, real valueDouble)

Functions

DBDataSetAsNumberUs- This function works only with reserved databases. Otherwise, it ingAddressReserved(real is the same as DBDataSetAsNumberUsingAddress(), which dbAddress, real valueDou- works only with non-reserved databases. ble)

Messages, Variables, and Functions Functions

119

DB read/write

Description

Return I

This function works only with reserved databases. Otherwise, it DBDataSetAsParentIndexReserved(integer data- is the same as DBDataSetAsParentIndex(), which works only with non-reserved databases. baseIndex, integer tableIndex, integer fieldIndex, integer recordIndex, integer parentIndex) DBDataSetAsParentIndexUsingAddressReserved(real dbAddress, integer parentIndex) This function works only with reserved databases. Otherwise, it is the same as DBDataSetAsParentIndexUsingAddress(), which works only with non-reserved databases.

This function works only with reserved databases. Otherwise, it DBDataSetAsStringReserved(integer databaseIn- is the same as DBDataSetAsString(), which works only with non-reserved databases. dex, integer tableIndex, integer fieldIndex, integer recordIndex, string valueString) DBDataSetAsStringUsingAddressReserved(real dbAddress, string valueString) This function works only with reserved databases. Otherwise, it is the same as DBDataSetAsStringUsingAddress(), which works only with non-reserved databases.

This function works only with reserved databases. Otherwise, it DBDataSetDateAsSimis the same as DBDataSetDateAsSimTime(), which works only TimeReserved(integer dbIndex, integer tableIn- with non-reserved databases. dex, integer fieldIndex, integer recordIndex, real simTimeVal, integer timeUnits) DBDataSetDateAsSimTimeUsingAddressReserved(real addressValue, real simTimeVal, integer timeUnits) DB sort/search DBRecordFindParentRecordIndex(integer databaseIndex, integer tableIndex, integer childFieldIndex, integer startingRecordIndex, integer findParentIndexValue) This function works only with reserved databases. Otherwise, it is the same as DBDataSetDateAsSimTimeUsingAddress() which works only with non-reserved databases.

Description Returns the index of the child record found pointing to startingParentIndex. StartingRecordIndex can be 0 or 1 to start at the first record. To keep searching for more matches, increment the returned record index by 1 for startingRecordIndex. Returns index of found record or 0 for record not found, -1 for indexing error.

Return I

Functions

120

Messages, Variables, and Functions Functions

DB address DBAddressGetAllIndexes(real addressValue, integer returnIndexesArray[4])

Description Return the indexes from a DBAddress value. ReturnIndexesArray can be declared as a local variable array (can be declared in equation blocks): integer returnIndexesArray[4]; returnIndexesArray[0] returns Database index returnIndexesArray[1] returns Table index returnIndexesArray[2] returns Field index returnIndexesArray[3] returns Record index

Return

DBAddressGetDlg2(integer DBIndex, integer tableIndex, integer fieldIndex, integer recordIndex)

Similar to DBAddressGetDlg. Displays a dialog so the user can enter a database address. Note that in addition to entering the DB coordinates as separate values, you can also pass -2 for a DB coordinate, and this will hide that coordinate on the dialog. This allows you to enter just a DB index, for example, or just a DB and table index. Returns a database address. Returns the real database address when the string argument is of the form D:T:F:R where D, T, F, and R are the numerical indexes of the address.

DBAddressGetFromString(string dbAddressStr)

This is a new category of functions that could go on page 337 of the printed Developer Reference..
Dynamic array pointer functions allow you to copy the contents of dynamic arrays into an independent data structure that can be created, used by other blocks if desired, and disposed of by any block. You can create a very large number of independent pointers, if desired. They are also useful for creating complex structures of pointers. Using a disposed pointer will cause a crash (uses malloc() and free()). Pointers Description Return I

Pointer functions

PointerFromDynamicAr- Copies data from any type of dynamic array to a new pointer ray(dynamicArray) created by malloc() and returns the pointer. If you pass the pointer to an external DLL, the first integer in the pointer's data is the size of the pointer's data in bytes. Including the size data, the pointer is actually that size plus 4. PointerDispose(integer pointer) PointerToDynamicArray(integer pointer, dynamicArray) Frees the memory used by the pointer using free(). The pointer is now invalid and can cause a crash if used. Takes a pointer created by PointerFromDynamicArray() and copies it to a dynamic array, so ModL code can access it. This action writes over any old data in that dynamic array. The dynamic array must be the same type as the array in the pointer. The pointer must still be disposed of by PointerDispose().

V V

Functions

Index to the Addendum Index

122

Index

Symbols
_(underscore) character for databases 102 _leftClickDB 104, 105

Numerics
3D animation functions 111

BlockSimStartPriority 114 breakpoint 15 conditional 16 Breakpoints window 15, 16

C
Check Database Consistency option 30 clone-drop code for a custom stand-alone block 104 method 37, 103 CloneGetInfo 116 CloneHideDisable 116 code-defined links 98 COM DLL example 106 conditional breakpoints 16 CurrentScenario 109 custom resource properties 71

A
ActivateApplication 115 Add-In for ExtendSim database Check Database Consistency 30 Find Database Table 31 Advanced Resource Management (ARM) 51 blocks in the system 82 definitions of terms 52 how it works 51 policies 73 pools of resources 63 release rules 72 resource orders 69 Resource Pool blocks in 54 resource requirements 74 statistical information 63 tutorial 53 advanced resources 52, 54 Advanced Resources database 82, 83 analysis methods scenario analysis 34 ApplicationFrame 115 AR (advanced resources) 52 variables in Queue Equation block 20 ARM method 51 ARM system 51 Auto Club Emergency Service model 60

D
database Industry 6 Database (ExtendSim) _character at beginning of name 102 Advanced Resources 82, 83 DB Job Shop Query model 25 Field Properties dialog 28 read/write functions 118 reserved 102 Scenario DB 36 Table Properties dialog 29 Database Factors table entering values 45 database functions 116 DataTableHover 109 DB Job Shop Query model 25 DBAddressGetAllIndexes 120 DBAddressGetDlg2 120 DBAddressGetFromString 120 DBBlockRegister 105 DBBlockRegisterContents 105 DBBlockRegisterStructure 105 DBDatabaseDeleteByIndex 117 DBDatabaseImport 117 DBDatabaseRename 117 DBDatabaseShowHideReserved 117 DBDataSetAsNumberReserved 118

B
blocks communicating with each other 103 communication 103 dialog item functions 113 messaging functions 114 registered 105 remote communication 103 BlockSimFinishPriority 114

Index

123

DBDataSetAsNumberUsingAddressReserved 118 DBDataSetAsParentIndexReserved 119 DBDataSetAsParentIndexUsingAddressReserved 119 DBDataSetAsStringReserved 119 DBDataSetAsStringUsingAddressReserved 119 DBDataSetDateAsSimTimeReserved 119 DBDataSetDateAsSimTimeUsingAddressReserved 119 DBFieldCreateByIndex 117 DBFieldDeleteByIndex 117 DBFieldExists 118 DBFieldMove 118 DBFieldRename 118 DBQS (database query spawn) 22 DBRecordExists 118 DBRecordFindParentRecordIndex 119 DBTableCreateByIndex 117 DBTableDeleteByIndex 117 DBTableGetProperties 118 DBTableRename 118 DBTableSetProperties 118 debugging equations 14 design of experiments maximum, minimum, step 38 methods 39 Develop menu keyboard equivalents 108 Dialog Factors table 36 dialog variables getting and/or setting remotely 103 remote interface with 103 DialogFixedSize 116 DILinkUpdateInfo 114 DISetFocus 113 DITitleGet 113 DOE maximum, minimum, step 38 methods 39 double 110 DragCloneToBlock 104 DTToolTipSet 113 DuringHBlockUpdate 114

dynamic data linking (DDL) finding linked dialogs 98 finding registered blocks 98

E
E3DCollision 109 E3DCollisionBlocker 112 E3DMountStackLimit 112 E3DPostSetObjectBlockNumber 111 Edit Field Properties command 28 Edit Table Properties command 28 enhancements in ExtendSim8 3 Equation block input variables 11 output variables 12 equation debugger 14 equation editor 13 Equation(I) block input variables 11 output variables 12 equation-based blocks code colorization 13 code completion 14 components 10 equation debugger 14 equation editor 13 header files 18 include files 17 input variable types 11 list 10 output variable types 12 Variable Type popup for inputs 11 Variable Type popup for outputs 12 EquationDebugCalculate 111 EquationDebugCompile 110 EquationDebugDispose 111 EquationDebugSetBreakpoints 110 EquationIncludeSet 110 equations equation editor 13 local (temporary) variables 10 static (permanent) variables 10 ExtendSim8 enhancements 3 new features 2 technical support 7

124

Index

upgrading from release 6 6 upgrading from release 7 4

F
factors 34 features new in ExtendSim 8 2 Field Properties dialog 28 FileInfo 111 filtering condition creating 65, 75 definition 52 for a group 78 types 75 Final Car Wash RM model 54 Final Car Wash Scenarios model 35 Find Database Table option 31 Find Links dialog 98 FindInHierarchy2 112 free() 120 full factorial design 39 functions 3D animation 111 3D miscellaneous 112 3D mountStack 112 alerts & prompts 111 block numbers 112 data tables 113 database 116 database creating/deleting 117 database DBAddress 120 database import/export 117 database read/write 118 dialog items 113 equation debug 110 file I/O (unformatted) 111 math 110 messaging blocks 114 models 115 notebook 115 pointers 120 returns 110 scripting 115

GABlockRegisterContents 105 GABlockRegisterStructure 105 GetConnectionColor 112 GetDialogNames 113 GetDraggedCloneList 104 GetFileReadMachineType 111 GetRecentFilePath 116 GetRunParameterLong 115 Getting Started model 3 GetUserPath 116 green arrow for equation debugger 15 group filtering condition 75 groups definition 52 filtering conditions in ARM 75 properties 72 using in ARM 68

H
header files 18

I
include files for equation-based blocks 17 IncludeFileEditor 110 includes MouseClick 103, 104 Industry database 6 input variables in equation-based blocks 11 variable types 11 integer function return 110 isKeyDown 111 IsLibEnabled 116 itemArrayI2 106 items properties in ARM 72 status in ARM 69

J
JMP custom design 39 job shop 25

K
keyboard shortcuts for developers 108

G
GABlockRegister 105

Index

125

L
LastBlockPlaced 116 LastSetDialogVariableString 113 legacy libraries 6 overview 6 levels for factors 34 Link Alerts 105 Link Contents 105 Link dialog finding links 98 Link Structure 105 long 110

O
Open Dynamic Linked Blocks command 98 output variables in equation-based blocks 12 variable types 12

P
Parent Record Index 12, 13, 23 pass-through items 21 ranking rules 24 pointer functions 120 PointerDispose 120 PointerFromDynamicArray 120 PointerToDynamicArray 120 policies in ARM 73 pools Advanced Resource Management method 51 properties in ARM 71 resource pool definition 52 Resource Pool method 50 using Resource Pool block 54 using the Resource Manager block 63 PRI 12, 13, 23 Proof Animation 6 properties custom resource in ARM 71 editing for resources 64 group in ARM 72 of items in ARM 72 of resources in ARM 70 pool in ARM 71

M
maintenance plan 7 malloc() 120 menu command shortcuts for developers 108 messages DataTableHover 109 DragCloneToBlock 104 E3DCollision 109 GetDraggedCloneList 104 ModifyRunParameter 109 SimFinish 109 SimStart 109 model analysis 34 design of experiments 39 factors for scenario analysis 34 inputs for scenario analysis 34 resources 50 responses for scenario analysis 34 scenario management 34 Model Data database 44 ModifyRunParameter 109 MouseClick.h 103, 104

Q
quantity expression creating 66, 76 definition 52 Order By clause 78 Quantity clause 77 query cycle 21 Query Equation block 20 differences from Query Equation(I) block 24 input variables 11, 22 output variables 12, 23 ranking rules 24 Query Equation(I) block DB Job Shop Query model 25

N
1 from 80 FC_ 80 RR_ 80 NotebookIsOpen 115 notebooks functions 115 NumScenarios 109

126

Index

DBQS 21, 22 differences from Query Equation block 24 input variables 11, 22 output variables 12, 23 pass-through items 21 query cycle 21 ranking rules 24 spawned items 21 Queue block used in Advanced Resource Management 55 Queue Equation block 18 input variables 11, 19 output variables 12, 20 Release popup 20

R
ranking rules 20 Read/Write Index Checking command 28 real function return 110 red circle in equation debugger 15 RegisterBlockInLeftClickDB 104 registered blocks 105 finding 98 release rules in ARM 72 replications 34 reserved database 102 _character 102 blocks that use 102 resource allocation policy in ARM 73 resource filtering condition 75 Resource Item block advantages and disadvantages 81 Resource Item method 50 resource management definition 50 Resource Manager block advantages and disadvantages 81 creating pools 63 creating resources 64 filtering conditions 65, 75 groups of resources 68 policies 73 Policies tab 57 quantity expressions 66, 76 release rules 72

Release Rules tab 57 Requirements tab 56 resource requirements 65, 67, 74, 79 Resources tab 55 used in a model 54 Resource Order ID assigned to item 84 associating an item with a resource 69 definition 52 item property 72 used in itemArrayI2 106 resource orders in ARM 69 Resource Pool block in Advanced Resource Management 54 Resource Pool method 50 advantages and disadvantages 81 Resource Pool Release block in Advanced Resource Management 56 resource release rule definition 53 resource requirement rank 73, 79 overriding 74 resource requirements creating 74 creating manually 65, 79 creating new 67 default in ARM 80 definition 53 resources advanced 52, 54 allocation policy in ARM 73 definition 50 filtering conditions in ARM 75 groups in ARM 68 implicit modeling of 51 modeling methods 50 pools from the Resource Manager block 63 pools of 54 properties in ARM 70 requirements in ARM 65 resource requirement rank in ARM 73 status (in ARM) 69 using the Resource Manager block 64 responses 34 returns 110

Index

127

Run menu keyboard equivalents 108

S
Save and Next Field button 29 SaveTopDocAs 115 scenario analysis 34 database variables 41 design of experiments 39 Dialog Factors table 36 Dialog Responses table 38 dialog variables 35 factors (defined) 34 levels 34 Model Data database 44 replications (defined) 34 responses (defined) 34 source list 45 sources 41 targets 41 tutorial I 35 tutorial II 41 Scenario DB database 36, 40 Scenario Manager block 34 Dialog Factors table 36 Dialog Responses table 38 Export tab 40 Include in Report column 39 Report Set column 39 Scenario Manager Final Car Wash model 43 scripting functions 115 Set Breakpoints window 15 SetRunParameter 115 Shift-click 103 _leftClickDB 105 code for a custom stand-alone block 104 code in blocks used remotely 103 method 37 Show legacy/prior version warnings option 98 Show Reserved Databases command 28, 102 SimFinish 109 SimStart 109 simulation replications 34 source list for scenario analysis 45 sources 41 spawned items 21

ranking rules 24 string function return 110 string attributes for Advanced Resource Management 60 structures (pointers) 120 support for ExtendSim 7 support incidents 7 system variables list 109

T
Table Properties dialog 29 targets 41 technical support 7

U
UnRegisterBlockInLeftClickDB 104 upgrading to ExtendSim 8 from release 6 or earlier 6 from release 7 4 user-defined links 98 userPromptCustomButtons 111

V
Variable Name column 12 output variables 13 Variable Type popup input variables 11 output variables 12 Variable Value field 12 variables input, in equation-based blocks 11 local 10 output, in equation-based blocks 12 static 10 VB.net 106 VB.net COM DLL example 106 Version check on application launch option 99 void 110

W
WhoInvoked 113 WinSetForegroundWindow 116

Potrebbero piacerti anche