ExtendSim Database
ExtendSim Database
You may not copy, transmit, or translate all or any part of this document in any form or by any
means, electronic or mechanical, including photocopying, recording, or information storage and re-
trieval systems, for any purpose other than your personal use without the prior and express written
permission of Imagine That Inc.
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 and components (including but not limited to icons, dialogs, and
block code) are copyright © by Imagine That Inc. and/or its Licensors. ExtendSim
blocks and components contain proprietary and/or trademark information. If you build
blocks, and you use all or any portion of the blocks from the ExtendSim libraries 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 valid 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 trade-
marks 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 Win-
dows is a trademark of Microsoft Corporation. GarageGames, Inc. is the copyright owner of the
Torque Game Engine (TGE), and the copyright for Stat::Fit® is owned by Geer Mountain Software.
All other product names used in this manual are the trademarks of their respective owners. TGE and
Stat::Fit are licensed to Imagine That, Inc. for distribution with ExtendSim. All other ExtendSim
products and portions of products are copyright by Imagine That Inc. All right, title and interest, in-
cluding, without limitation, all copyrights in the Software shall at all times remain the property of
Imagine That Inc. or its Licensors.
Acknowledgments
Extend was created in 1987 by Bob Diamond; it was re-branded as ExtendSim in 2007.
Chief architects for ExtendSim 10: Steve Lamperti and Bob Diamond
Simulation Engineers: Anthony Nastasi, Cecile Pieper, Peter Tag, and Dave Krahl
Graphics, documentation, and editing: Kathi Hansen, Carla Sackett, and Pat Diamond
Imagine That Inc • 6830 Via Del Oro, Suite 230 • San Jose, CA 95119 USA
408.365.0305 • fax 408.629.1251 • [email protected]
www.ExtendSim.com
Table of Contents
Introduction ............................................................................................................ 1
Welcome! ........................................................................................................................1
About this document.......................................................................................................1
Who should read this document .....................................................................................1
Chapters in this reference ...............................................................................................1
Introduction to databases ................................................................................................2
The ExtendSim database.................................................................................................3
Using spreadsheets and databases ..................................................................................6
Where to get more information.......................................................................................6
Basics: Exploring a Database ................................................................................ 9
Overview.........................................................................................................................9
Database basics...............................................................................................................9
Exploring an ExtendSim database ..................................................................................10
Tutorial 1: Creating a Database ............................................................................ 15
Overview.........................................................................................................................15
A sample model ..............................................................................................................15
Create the database .........................................................................................................16
Dynamic data linking......................................................................................................19
Tutorial 2: Enhancing Your Database .................................................................. 25
Overview.........................................................................................................................25
Set a database cell to use a random number ...................................................................25
Create a Parent/Child relationship ..................................................................................27
Use tabs to categorize tables...........................................................................................29
DB Line Chart block for viewing database data.............................................................30
Other blocks for use with the ExtendSim database ........................................................32
Tutorial 3: Data Exchange ..................................................................................... 35
Overview.........................................................................................................................35
The Data Import Export block for automating data exchange .......................................35
Read and Write blocks ....................................................................................................38
Reference ................................................................................................................. 45
Overview.........................................................................................................................45
Methods for exchanging data with an ExtendSim database ...........................................45
Indexes and data organization ........................................................................................45
Link alerts .......................................................................................................................47
Finding a number or a string...........................................................................................48
Fields with string data types; PRI and PRV....................................................................48
Databases ........................................................................................................................50
Tables ..............................................................................................................................53
Fields...............................................................................................................................57
Records ...........................................................................................................................58
Cells ................................................................................................................................59
Properties and other dialogs............................................................................................60
Read and Write blocks ....................................................................................................66
Data Import Export block ...............................................................................................69
DB Line Chart block.......................................................................................................72
Equation-based blocks ....................................................................................................76
Query Equation and Query Equation(I) blocks ..............................................................77
Excel Add-In...................................................................................................................84
What’s new in the database since release 9.0 .................................................................91
ExtendSim Database
Tutorial & Reference
Introduction
Welcome!
Thank you for using ExtendSim, the power tool for simulation modeling! We hope you enjoy
using ExtendSim and that you find this document helpful.
About this document
The ability to create and use an internal relational database is an essential feature when build-
ing complex or data-intensive models. To enable this, the ExtendSim relational database is pro-
vided in, and fully integrated with, all ExtendSim products.
The purpose of this document is to get ExtendSim modelers knowledgeable about and familiar
with the ExtendSim Graphical Simulation Database.
This document assumes you already know how to launch ExtendSim and build a model. If not,
see one of the Quick Start Guides—Continuous Process, Discrete Event, or Discrete Rate.
Who should read this document
The ExtendSim Graphical Simulation Database (GSDB) is included in all ExtendSim products
and is the best method for managing model information. This document is for:
• All model builders. Whether you think you will use the ExtendSim database in your models
or not, you should at least read this introductory chapter. While it is entirely possible to cre-
ate models without using it, the ExtendSim database provides a robust foundation for build-
ing scalable models. So unless your models are particularly simple or data-sparse, you will
find the GSDB indispensable.
• Modelers who currently use the database. There’s always something new to learn (plus
there’s a section starting on page 91 that describes what’s new since release 9.0).
☞ The ExtendSim database provides a foundation for building complex and scalable models.
Chapters in this reference
1) Introduction to databases (this chapter of the document):
* Definitions
* About the ExtendSim Graphical Simulation Database (GSDB)
2 Database Tutorial & Reference
Introduction to databases
Due to their efficiency, ease of use, and ability to perform a variety of useful tasks, relational
databases are the dominant type of database for high performance applications such as simula-
tion applications.
Advantages of using a relational database for simulation
There are many advantages to using a relational database when simulating. For instance, to:
• Organize information in a logical fashion, either within one database or across several data-
bases.
• Separate the data from the model for scalability and for better project and experiment man-
agement.
• Provide a globally accessible repository of data that can be quickly read from and written to
during the simulation run.
• Gather, view, and manipulate data by product type, location, components, or any other com-
mon characteristic.
• Support decision-making during the simulation run, through the use of Link Alerts.
• Provide a centralized location for information that is used in several parts of a model, getting
easier access to different sets of data depending on model needs.
• Reuse common sets of data from one model to the next.
• Import model inputs from, or export results to, external applications.
While using a database to manage data is indispensable for large models, the user interface
makes it convenient to use an ExtendSim database even for small models.
The ExtendSim database
☞ ExtendSim products include the ability to create and use ExtendSim databases.
What is the ExtendSim database?
The ExtendSim database is a relational database specifically designed to meet the needs of
simulation modelers. It allows multiple databases per model and (as discussed below) has
many advanced features to facilitate the entry, storage, and retrieval of information.
ExtendSim databases aren’t just repositories of data.
• They provide model builders with a systematic way to manage information for the model,
import information to the model from existing data repositories, and export model results to
other applications for presentation or further analysis.
• They provide model users with a centralized location for information that can be accessed
for use throughout a model without needing to be concerned about how or where the infor-
mation is stored.
• Most importantly, the ExtendSim database provides a robust foundation when building com-
plex and scalable models.
In addition to being used by model builders and users, the developers of ExtendSim use the
database to manage data for the Scenario Manager, Advanced Resource Management (ARM),
and Reports Manager. It is also the basis for other ExtendSim offerings, such as the Smart
Block feature that provides a list of potential blocks to connect to when you right-click on a
block’s connector.
4 Database Tutorial & Reference
The ExtendSim database
This database window is in Schema view. The database’s tables are listed on the left and the
structures for the selected tables, as well as parent (red) and child (green) relationships, are
shown on the right. The components of an ExtendSim database are discussed fully in the next
chapter.
ExtendSim database features
ExtendSim databases have several features that make them efficient and reliable components
of simulation models, including:
Implementation in
Feature Description Advantage
ExtendSim
Relational A field can be linked to another Supports normalized database Parent/Child relations.
field in the same table or to design and improves data
fields in another table. integrity.
Components Every database, table, field, and Cells and other database com- Read, Write, Data Import
have a record has an index. Cells have a ponents can be individually Export, and equation
unique key DBAddress composed of those and separately addressed. blocks can access infor-
indexes. mation using the keys.
Introduction 5
The ExtendSim database
Implementation in
Feature Description Advantage
ExtendSim
Linked Parameters and data tables in Blocks can access any infor- Dynamic Data Linking
ExtendSim models are easily mation in a database; databases (DDL)
linked to database cells and can access block data.
tables.
Name track- Automatically tracks database Model components point to the All blocks that interface
ing indexes and alerts model com- correct locations in the data- with the database (Read,
ponents if there is a change to a base even if structural changes Write, Data Import
linked database component. have been made. Export, Equation, etc).
Integrated The database is part of the The database was developed Simple access through
ExtendSim application. Data- specifically for use with simu- the user interface (menu
base structure and information is lation models. and right-click com-
easily accessible and is saved Read/Write access between the mands) or ExtendSim
with the model. model and the database is fully IDE (integrated develop-
supported. ment environment).
Database structure and infor-
mation is retained with the
model and can’t be lost.
Automated A model’s linked parameters As soon as the information at Link Alerts and the Link
real time and data tables receive notifica- the source changes, the target Alert block (Utilities
updating of tions whenever information is dynamically notified and can library)
information changes in the database, and take the appropriate actions to
vice versa, even during the run. react to the new value.
Scalable Models can have 2 billion data- No imposed upper limit on the Database size is limited
bases, 2 billion tables per data- amount of information that can only by the computer’s
base, 1,000 fields per table, and be stored or how complicated memory.
2 billion records per table. queries can be.
Resides in Database structure and informa- Much faster response times Integrated with the appli-
memory tion are stored in memory. and performance than using an cation.
external application.
Querying Searching the database and You can query for information Query Equation blocks,
retrieval of specific information. during the run. equation-based blocks,
and other blocks. Also
through ExtendSim API
which has many data-
base-related functions.
Connectivity Database information can be Allows analysts who don’t ExtendSim DB Add-In
imported from and exported to have ExtendSim to use Excel for Excel, Line Chart
external data sources including or other tools to configure the DB, Read/Write and Data
Excel workbooks, ODBC and structure and contents of an Import Export blocks,
ADO compatible databases, and ExtendSim database. and technologies such as
FTP and text files. OLE/COM, ODBC,
ADO and more.
6 Database Tutorial & Reference
Using spreadsheets and databases
Technical Reference
In most cases modelers will use the user interface to create ExtendSim databases and link
model data with database information using ExtendSim blocks. However, the Technical Refer-
ence lists many functions that can be used to create, read, write, import, export, and delete
databases and their components as well as programmatically establish links to the data.
Note that in addition to the programming interface and dialog editor, the ExtendSim integrated
development environment (IDE) gives programmers access to sophisticated tools such as
include files, a code editor, conditional compilation, a source code debugger, code completion,
and external source code capabilities.
Introduction 7
Where to get more information
view, records are the horizontal component, similar to rows in a spreadsheet. (Records are
also sometimes called tuples, but ExtendSim uses the more common term records.)
• Cells represent one piece of information about the item. Each cell is the intersection of one
field and one record. And not to be confusing, but a cell in a database is the equivalent of
what is called a field in a spreadsheet.
☞ Depending on the field type, a cell can hold numbers or strings, Boolean checkboxes (Yes or
No), a DBAddress, or even a list of tables. So the word “information” can mean any of those.
Example
For example, a database might be composed of one or more of the following components:
A database window:
• Has in its title bar:
* The word “Database” followed by the name of the database.
* The database’s index, in this case “1”, in square brackets following its name.
* The name of the model the database is attached to, in angle brackets.
• Provides a popup menu for viewing either the structure (Schema) of the database or its infor-
mation (Data).
• Has a button for sorting database tables by name or by index number.
• Has toolbar buttons for performing common tasks, such as adding a table
• Has an All Tables tab and other tabs that display:
* A list of tables on the left of the window (Table List pane)
* The structure of the selected tables (showing their fields and relationships, if any) in a
Tables pane on the right
By default, the All Tables tab is presented in front and lists all the tables in the database; other
tabs can be added.
☞ Every database, table, field, and record has an index number (a unique key for identification)
and each cell has a DBAddress that is the combination of those indexes. These are unique to
that component sequence and are used for referring to databases and their components in equa-
tions or ModL code. More information is at “Indexes and data organization” on page 45.
Explore the Schema view
By default the database window opens in Schema view. This view shows the physical structure
of a database, with all its tables and fields. It is also where parent/child relationships are estab-
lished.
Toolbar buttons
Schema view has 6 buttons in its toolbar. They are used to add a table to the database, append
or insert a field into a table, and show, hide, or reposition the tables in the Tables pane.
12 Database Tutorial & Reference
Exploring an ExtendSim database
Tables
As seen in the All Tables tab, this database
has four tables:
1) Stream Amount (with one field—Max
Volume)
2) Rainfall Amount (with two fields—
Month and Rainfall)
3) Stream Volumes (with one field—Vol-
ume)
4) Contents (with two fields—Month and Amount)
The numbers in brackets after the table and field names are their indexes. Tables can be sorted
in the All Tables tab by index or by name.
Each field in a table has connector points on its left and right sides. As will be shown later,
these are used to establish parent/child relationships between fields.
☞ Only tables that are checked in the Tables List pane will be shown in the Tables pane on the
right.
Explore the Data view
In the database window, change the popup menu from Schema View to Data View
In Data view, the database window’ shows the fields, records, and cells for the table selected
on the left. This is also where you enter data for the table and can sort a table’s data.
Stream Amount table
In the Table List pane at the left, select the table
named Stream Amount.
☞ If the font size is too small, use the Zoom In button in
the ExtendSim toolbar to increase it. As long as Auto
Resize Column is not selected, fields can be resized
manually; this is discussed on page 57.
In Data view, selecting the Stream Amount table causes its field (Max Volume), record (1), and
data (4.00) to be displayed in the Data pane, which is to the right of the Table List pane.
Toolbar buttons
Data view has 6 buttons in its toolbar. They are used to append or insert a record into a field,
delete records, make a cell random or remove randomness, and sort data in the selected table.
Basics: Exploring a Database 13
Exploring an ExtendSim database
The database built in this chapter will be similar to the one seen in the previous chapter, except
it will have only one table.
A sample model
☞ The ExtendSim database feature is included in all ExtendSim products. Since every ExtendSim
product has continuous modeling capabilities, this tutorial creates a database for a continuous
model. And while a database is obviously unnecessary for the Reservoir model, the purpose of
the example is to show how to create and use an internal relational database.
Open the model Reservoir 1 from the Documents/ExtendSim/Examples/Tutorials/Continu-
ous folder.
So that you don’t overwrite the original file, Save the model as Reservoir Tutorial.
The reservoir model has two sources of water flowing into it: rainfall and a stream.
• The amount of rainfall is based on historic averages and varies with the month, as shown in
the data table in the dialog of the block labeled Rainfall (a Lookup Table block).
16 Database Tutorial & Reference
Create the database
• The block labeled Stream (a Random Number block) contributes an amount that is calcu-
lated using a Uniform Real random distribution, with a minimum of 0 inches per month and
a maximum of 1 inch.
Through the tutorials you will link the maximum parameter in the Stream block and the data
table in the Rainfall block to a cell and a table, respectively, in an ExtendSim database.
For expediency, this tutorial adds a database to an existing model. However, it is more com-
mon for a modeler to create the database before building the model. This is best practice
because arranging database tables for the expected inputs and outputs helps with developing
the model.
Create the database
The following example creates a database through the user interface—menu and right-click
commands.
☞ As discussed on page 50 there are other ways to create a database but this is the most common.
Assumption
The database you create will have one table, one field, and one record, as shown below.
plays the name of the database and its associated model. The number 2 after the database’s
name indicates it was the second database added to this model.
The database window has two views, Schema and Data. By default, the window opens in
Schema view, as shown here. The Schema view is the graphical depiction of the database’s
structure. This is where the database is logically configured with tables and fields and where
relationships between fields are defined. The Data view is for adding and configuring records
and data.
Save the model
Save the model (you can leave the database window open)
Notice that Reservoir DB is now listed at the bottom of the Database menu
☞ Databases are stored with the model. Saving a model also saves the model’s databases.
Add a table
Each table represents one entity type. In this case, the table will represent the maximum vol-
ume of water flowing in the stream.
Methods for adding a table
With the database window active and in Schema view, create a database table using one of
the following methods:
Give the command Database > New
Table.
Or, right-click on the database win-
dow’s Table pane (on the right) and
choose New Table.
Or, click the New Table button in the
database window’s toolbar.
The Create New Table dialog opens with a popup list of existing tables (if any) and a field for
naming the new table.
☞ If there are tables in the list of existing tables, you can select one of them and that name will
appear as the New table name. Then append characters or otherwise change the name to create
a unique name for your new table.
Name the table
This table will hold the maximum volume of water that the stream contributes to the reservoir.
Name the table Stream Amount.
Leave the options as is and click the Create New Table button. This closes the dialog and
adds the table to the database.
The new table is placed in the All Tables tab of the
database window. As shown here, names of the
database’s tables are listed in the Table List pane at
the left and a physical view of the tables (the data-
base structure) is shown in the Tables pane on the right.
18 Database Tutorial & Reference
Create the database
In the database window’s popup menu, change the database window from Schema to Data
view.
Select the table’s name (Stream Amount) in the Table List pane on the left.
Methods for adding a record
Create a record for the table using one of the following methods:
Right-click the field’s name (Max Volume) and select Append New Record
Or, click the Append New Records button in the Data
view’s toolbar
Or, give the command Database > Append New
Records
Since you only want one record, in the Append Records dia-
log enter 1 for the number of records and click OK.
The field and record should look like the screen shot at the right.
Enter a value for the cell
In your Reservoir Tutorial model the dialog of the Stream block has a
value of 1 as the maximum number of inches of monthly rainfall. For this
tutorial, you will set the maximum to 4.
There is now one cell in the database, the intersection of the Max Volume field and record #1.
Click on the cell and enter the number 4.
Close the database window and save the model to save your work.
☞ By default the values in cells are constants. While it wasn’t done for this example, you can set
a cell to use a random or empirical distribution. See “Set a database cell to use a random num-
ber” on page 25 for more information.
Dynamic data linking
Databases are used to store data for use in the model or to store model outputs before, after,
and during a simulation run. A model can exchange information with a database by any of
these methods:
• Dynamically linking a parameter or data table to the database
• Accessing database cells using specialized blocks (e.g. equation-based, Data Import Export,
Read, or Write blocks)
• Through ModL programming.
☞ This section focuses on using dynamic data linking as a method for exchanging data. The other
methods (e.g. data access and equation-based blocks) for exchanging information are dis-
cussed on page 45 and shown in Tutorial 2.
Dynamic data linking (DDL) is the proprietary method ExtendSim uses for creating live links
between a model and an ExtendSim internal data structure. This application-level protocol
tracks which dialog items (model parameters and data tables, including their clones) are linked
to which internal data structures (ExtendSim database tables, global arrays, and dynamic
arrays).
20 Database Tutorial & Reference
Dynamic data linking
Dynamic data links are extremely powerful because they are live and bidirectional. This means
that the value of a linked dialog item can change immediately when the value of the data
source changes, and vice versa.
The same features that make dynamic linking so powerful mean it should be used judiciously.
Avoid overloading models with dynamic links to data sources that get frequently updated; it
could slow simulation performance as messages are sent to linked blocks every time their data
source is modified. For alternatives such as using the Read, Write, and Data Import Export
blocks, see “Read and Write blocks” on page 66.
Link a dialog parameter to a database table
Unless it is already linked for sensitivity analysis, a dialog parameter can be dynamically
linked to a specific cell of an ExtendSim database. Parameter fields that are dynamically linked
to a database are outlined in light blue.
☞ Parameter fields are outlined in green for active sensitivity analysis and red for inactive sensi-
tivity analysis; sensitivity analysis is discussed in the User Reference.
Overview
For this example, you will link the Maximum parameter from the Stream (Random Number)
block’s dialog to a cell in a database. This allows you to use the database, rather than the dialog
parameter, to control the maximum amount of water coming from the stream.
If your Reservoir Tutorial model isn’t already open, open it.
Open the dialog of the block labeled Stream. As indicated by its blue border, the parameter
field for Maximum is already linked to a database table.
Right-click in the Maximum parameter field (or go to the Model menu) and select Create/
Edit Dynamic Link.
24 Database Tutorial & Reference
Dynamic data linking
Formatting cells
The tutorial titled “Create the database” on page 16 showed how to create a field using the
default format options in the New Field dialog. That dialog’s options, discussed more on
page 60, allow you to specify a field type, set the number of decimals to display, and more.
Whichever options are selected for the field are also assigned to its cells. And by default, all
the cells for a field are formatted as constants. Instead of a constant value, you might want a
cell’s value to be a random number.
Making a cell random
To cause a cell to use a random or empirical distribution:
Open the Example DB database from the Database menu
In its database window, select Data view
26 Database Tutorial & Reference
Set a database cell to use a random number
In the Table List pane, select the Rainfall Amount table
In the Rainfall field, select record #2 (value = 4.40)
Either give the right-click or Database command Make
Cell Random, or click the Make Cell Random button in the
toolbar
In the Database Random Distribution window that
appears, for the Distribution Parameters choose:
Distribution: Normal
Mean = 4
Std Dev = 0.25
Location = 0
At the top of the dialog, click Submit to Cell
Save the model to save your changes
This creates a randomized value for that month’s
amount of rainfall. The setting will be shown in that
cell of the database table (on the left side of the
screen shot shown here) as well as in the Rainfall
block’s data table (on the right side of the screen
shot).
☞ Depending on how you make the selection, you can
randomize one cell, several, or an entire field.
As discussed below, a distribution selection and settings can be saved as a named distribution.
Creating a named distribution
Distributions can be assigned a name and saved for use throughout the database. You can cre-
ate a named distribution as you randomize a cell or afterwards.
To save the distribution you created above as a named distribution:
Go to the database window for the Example DB database and select Data view. Alterna-
tively, open the Table Viewer for the Rainfall Amount table.
To reopen the popup, select the database cell you randomized above and choose to Make
Cell Random using the right-click or Database menu command or the Make Cell Random
button in the toolbar.
In the Database Random Distribution dialog that
appears, choose Save to Named Distribution from the
popup menu at the top of the window
In the Save to Named Distribution dialog that appears,
name the distribution My Distribution
Click Save to close the dialog
In the Database Random Distribution dialog, click Submit to Cell
Save the model to save your work
Tutorial 2: Enhancing Your Database 27
Create a Parent/Child relationship
• See complete information about this block and its uses on page 72.
Other blocks for use with the ExtendSim database
In addition to the DB Line Chart block, other blocks are useful when using the ExtendSim
database.
Blocks for exchanging data with an ExtendSim database
The ExtendSim database is a very powerful tool used both by ExtendSim developers and
model developers. Accordingly, ExtendSim includes blocks for exchanging data between the
model and a database and between a database and external applications and files.
Tutorial 1 showed how to create a dynamic data link (DDL) between a model and a database.
There are other and more powerful data exchange options when you don’t want to, can’t, or
shouldn’t link a dialog item or data table to a database table.
DB Statistics block
The DB Statistics block (Report library) calculates the
mean, variance, standard deviation, minimum, maximum,
median, and other information for a field in a database
table.
Place the block anywhere on a model. It does not need to
be connected to other blocks to capture the information.
Select a field on the block’s Database tab and the results
will be calculated automatically and displayed on the
Results tab. In the Database tab, choose to calculate statis-
tics either at the end of each run (to calculate values as
each run completes) or at the end of all runs (to calculate
values after all of the simulation runs have completed).
Equation-based blocks
These blocks use database information as part of their calculations and/or output the results of
calculations to a database. For more information, see “Equation-based blocks” on page 76.
Link Alert block
The Link Alert block (Utilities library)
tracks and notifies when an ExtendSim
database or one of its components
changes either its contents or its struc-
ture during the simulation run.
Once you specify a database location to
be monitored (database, table, field, or
record), the block senses if there are any
changes to the content of, or the struc-
ture at, that location.
Whenever a change occurs, the block’s
output connectors report the change as
well as the Global Object ID of the block
that caused the change. This block also
has an option to log the information in a
data table, capturing any changes that
occurred during the run.
Place the block anywhere on a model.
It does not need to be connected to other blocks to log the information.
34 Database Tutorial & Reference
Other blocks for use with the ExtendSim database
Popups block
Use the Popups block
(Utilities library) to
define a custom popup
menu that you can clone
to the model worksheet
and use as a numeric
input to the model.
To use this block to
obtain the index of the
selected record, select
Database Record as the
popup type and enter the
database information.
It is common to connect
this block’s output to the
R input on a Read or
Write block (Value
library), so you can
manually change which
record is being read or
written to.
ExtendSim Database
Tutorial & Reference
The left side of the screenshot above shows importing from Excel to an ExtendSim database. The right
side shows exporting to Access from an ExtendSim database.
The following examples show how to import data from Excel into a continuous model’s ExtendSim
database and export data from the database to Access.
☞ For a complete description of the Data Import Export block, see page 69.
Import data from Excel to an ExtendSim database
This example uses a continuous process model that all ExtendSim modelers have access to. An Excel
worksheet is the source of the data and an ExtendSim database table is the target.
☞ The tutorial on page 22 dynamically linked a block’s data table with an ExtendSim database table, caus-
ing the block to get its data from the database. The data in the database came from an Excel worksheet;
this tutorial shows how the database got that data from Excel.
36 Database Tutorial & Reference
The Data Import Export block for automating data exchange
Compared to using dynamic data linking (DDL) to link a model parameter or data table to an
ExtendSim database, these blocks have some advantages:
• They allow you to dynamically control which database or table is accessed during a simula-
tion run as well as when it is accessed
• The data can be more easily accessed at several places in the model
☞ For a complete description of the Read and Write blocks, see page 66
Use a Write block to send model data to an ExtendSim database
The following example uses a Write block (Value library) in the Reservoir DB model. This is
obviously completely unnecessary for this small model and in fact requires the additional step
of adding a System Variable block. However, the purpose is to show how to use a Write block
to send data from a model to an ExtendSim database, and all ExtendSim modelers have access
to continuous process models such as the Reservoir model.
In this tutorial you will write the contents of the reservoir to the Contents table in the Example
DB database. That table has two fields, Month and Amount, and 37 records for holding data.
Open the model and add the block
Open the Reservoir Tutorial model you created in the previous chapter
If the model includes the Data Import Export block (from the tutorial above), delete it. You
don’t want ExtendSim to write to the database at the same time as the data is being exported
from it.
Place a Write block (Value library) on the model worksheet and label it Write to DB
In the Write block’s Write Data dialog, specify the
database coordinates:
DB: Example DB
Table: Contents
Field: Multiple Fields
Leave the Record and other fields in the
Write Data dialog as is
☞ If the block had been set up to write to a child field,
the dialog would display the text “Write the parent’s
record” and give options for the record value (PRV) or index (PRI). This is discussed on
page 48.
In the Write block’s Options dialog, define when writing will take place:
Check the box “Write data during run”
Choose Continuous (since the Reservoir Tutorial
is a continuous model)
Also in the Write block’s Options dialog, to make sure there are enough records in the data-
base table to hold all the generated data:
Check the box “Expand number of records in the data destination, if necessary”
So that the connections are clearer, check the box to Show connector numbers
40 Database Tutorial & Reference
Read and Write blocks
The following tutorial will change the model so that each time a car item leaves the Entry Line
and heads towards the Wash Bay, the Read(I) block will get a value from a cell in an Extend-
42 Database Tutorial & Reference
Read and Write blocks
Sim database. That value will provide a random delay for the time it takes to wash the car. The
database cell has been customized to use a random distribution, as was discussed on page 25.
Make a copy of the Car Wash model
So that you don’t overwrite the example model:
Save the model under the name “My Read Tutorial”
Add a Read(I) block to the model
Insert and connect a Read(I) block (Item library) between
the Queue block labeled Entry Line and the Activity block
labeled Wash Bay. (If you know how to use the Smart
Blocks technique, separate the two blocks and right-click
the output connector of the Entry Line to insert and con-
nect the Read(I) block.)
Save your model, because its the right thing to do
In the Read(I) block’s Read Data dialog tab, select Database: Car Wash DB. (By default,
the first database in a model is automatically selected by default.)
In the first column (Read Name) of the dialog table, enter the word Delay. This will be used
to label the connector that outputs the values as they are read from the database.
In the second column (Table) of the dialog table:
Click once on the down arrow in the cell to reveal the popup shown at
right
Choose Select from list
From the popup list, select the table named Wash Delays
In the third column (Field) of the dialog table:
Click once on the cell’s down arrow to reveal the popup
Choose Select from list
From the popup list, select the field named Delay Time
In the fourth column (Record) of the dialog table:
Click once on the down arrow in the cell to reveal the
popup
Choose Select from list
From the popup list, select the triangular distribution,
the second record
☞ Notice that the cell displays the information about the Triangular distribution—a minimum of
5, maximum of 7, and most likely value of 6. This is helpful if records have distributions with
the same name.
Leave the other columns in the dialog table in their default settings and go to the block’s
Options tab
Tutorial 3: Data Exchange 43
Read and Write blocks
Reference
Overview
This section provides additional information about using and managing ExtendSim databases.
It also has a section highlighting the changes and enhancements since ExtendSim 9.0.
Methods for exchanging data with an ExtendSim database
ExtendSim provides the following methods for exchanging data with its databases.
☞ In addition, the Query Equation and Query Equation(I) blocks search a database and locate
specific records according to the criteria you specify. They are discussed on page 77.
Indexes and data organization
When interfacing between a model and an ExtendSim database, or between an ExtendSim
database and an external application’s files, it is important to know how data is organized and
how data locations are indexed.
46 Database Tutorial & Reference
Indexes and data organization
☞ When exchanging data, it is important to compensate for the fact that the data tables in Extend-
Sim blocks are 0-based, and ExtendSim databases are 1-based. Usually this is accomplished by
adding 1 to the output from the data table to the database (as shown on page 40), or subtracting
1 from a database input going to a data table.
ExtendSim database indexes and addresses
ExtendSim assigns a unique index number to each database. As seen for the Example DB data-
base discussed in the tutorials, that number is appended to the database name and enclosed in
square brackets.
Likewise every database table, field, and record is assigned an index number that is displayed
after its name. And each cell has a DBAddress that is the combination of those index numbers.
☞ A DBAddress is a single value that contains between 1 and 4 numbers—the index numbers for
a specific database, table, field, and record as appropriate.
Database index numbers start with 1, such that the first database in a model has an index of 1,
the first table in a database has an index of 1, and so forth. ExtendSim uses a database’s index
information to assign addresses to the database and to each of its components.
Reference 47
Link alerts
These numbers are unique to that component sequence and are used for referring to databases
and their components from blocks or in equations or ModL code. For instance, every read/
write operation in a block requires a fully qualified address that specifies a specific set of data-
base components and hence the location of the targeted data.
☞ ExtendSim databases and their tables and fields have both name and index identifiers. Records
have index identifiers, and, through the Field Properties dialog, each table can have one
Record ID field that allows records to be named.
Read/Write Index Checking command
This command in the Database menu is helpful if you program and use database read/write
functions. It causes error messages to be displayed if a read/write function call has illegal
indexes.
This is a good tool for finding illegal indexes, and enabling this option does not impact the
speed of a simulation run. Leave it unchecked if it is preventing a legacy model from running.
New models have this menu command checked by default.
Link alerts
Live update messages, called Link Alerts, are automatically sent to ExtendSim blocks and the
ExtendSim databases or global arrays they are dynamically linked to. This means that as soon
as the data at the source changes, an alert will be dynamically sent to all the blocks linked to
that location so those target blocks can take actions to react to the new value.
For example, if you write to a location in an ExtendSim database, ExtendSim will send update
messages to all the Read blocks in the model linked to that location. When the Read block
receives the alert message, it will act on the fact that the data value changed.
Writing to a cell in an Excel spreadsheet or to a text file will not have the same live link effect.
Link alerts can significantly slow simulation speed if enabled during the simulation run. To
control when they are sent, see:
• “Link dialog checkboxes” on page 65 for managing the alerts during the simulation run
when block parameters and data tables are linked to an ExtendSim database or global array
• The checkbox When receive database link alert msgs in the Equation block (Value library)
• The data source changes check box in the Options tab of the Read block (Value library)
For the most part, link alerts will just make the blocks that have implemented them work as
expected—when data changes, the blocks will respond appropriately. However, due to all the
48 Database Tutorial & Reference
Finding a number or a string
opportunities for response, link alerts are an especially powerful tool for those who use equa-
tion-based blocks or who create custom blocks.
If you are developing a block that needs to respond to changes in data in ExtendSim database
or global or dynamic arrays, or you are creating sophisticated equations that need this, or you
need to use the Link Alert block, go to the Technical Reference to understand more about how
Link Alerts work.
☞ See also the Link Alert block discussed at page 33.
Finding a number or a string
Use the Edit > Find command (or the right-click
menu) to find data (a number or string) within a
database. With the database window open in
Schema or Data view, give the command Edit >
Find. This opens the Find Data in Database dia-
log, shown at right.
To only search within a specific table, open that
table’s Table Viewer before giving the Edit >
Find command; the Find Data in Table dialog appears. The Table Viewer is discussed on
page 13.
☞ To locate a table by name, click in the All Tables pane in Schema or Data view. Then type the
first letter (or more) of the table’s name. The first table with those initials will be highlighted.
Repeat that letter (or set of letters) to go to the next table name with those initials.
Fields with string data types; PRI and PRV
Database fields are often formatted as strings. On the other hand, a model’s block connectors,
dialog parameters, and attributes require numbers to perform calculations. ExtendSim provides
a mechanism for translating strings in the database into the numbers the model requires.
The translation is based on the fact that child fields have both an index value and a data value.
This means that each child field can be referenced by one of those two values: either the data
(which can be a number or a string) or the index (which points to the location of the data).
How the translation occurs depends on the circumstances, as discussed below.
• The field has a numeric data type (that is, not a string)—the link will, of course, get created
• The field has a string data type—the link will be rejected with an error message because it
doesn’t make any sense
• The Parent Record Value (PRV) is the actual value that you see in the child field. (It is also
one of the values in the parent field.)
• The Parent Record Index (PRI) is the index at the parent’s location for the PRV
For example, if a Read block is set up to get data from a
child field that has a string, the block’s dialog will display
the Read the parent’s record value(PRV)/index(PRI)
option. If you choose PRI, ExtendSim will automatically translate a cell’s string into a numeric
value that can be used in the model.
☞ It is best practice to use PRI whenever you’re doing a read/write and there is a parent/child
relationship. In most cases there is a lot of parent data and PRI will increase reliability and
enhance performance.
Databases
ExtendSim databases are created and managed through the:
• Database menu
• Right-click (context/shortcut) menu
• Database window
• Database List window
Or, give the command Window > Database List. when the list appears at the bottom of the
library window tiles, double-click the name of the database in the list to open it.
The database window is shown and discussed starting on page 10.
Editing a database’s properties
☞ The only property of a database that can be changed is its name.
Accessing the Edit Database Properties dialog
To access the Edit Database Properties dialog:
Either make a model that has one or more data-
bases the active window, then going to the Data-
base > Edit Database Properties command
Or, give the Window > Database List command
and right-click on the database’s name in the list
that appears at the bottom of the library windows
area
Renaming a database
To rename a database:
• Use one of the methods above to access the Edit Database Properties dialog
• From the popup menu, select the database to rename
☞ The database’s name can be anything you want as long as it does not start with an underscore
(_), is not used by another database in that model (although see “Overwriting an existing data-
base” on page 53), and does not exceed 63 characters. Database names are not case sensitive
and they can contain spaces.
Copying or deleting a database
As is true for the Database menu, the Database List displays all the model’s databases and is
useful for opening and renaming databases. However, unlike the list in the menu, the Database
List also lets you copy and delete a database.
To access the Database List, give the command Window >
Database List. This places the list of databases at the bottom
of the same area as the library windows.
Copy, duplicate, move
To copy or duplicate a database, select it in the
Database List and either use the right-click menu
shown here or give the command Edit > Copy (or
Edit > Duplicate) Database in the menu bar.
You can paste a database into the current model or
into a different model. You can paste into the
Database List or onto a model worksheet.
Duplicating, or pasting into the current model’s
Database List, places a copy of the database into
that Database List. It will be under a different
index number and a modified name so as to not overwrite the existing database.
52 Database Tutorial & Reference
Databases
Pasting into a different model’s Database List or onto a different model’s worksheet copies the
database into that model with the same name as the original database.
☞ Giving the Paste command on the model worksheet places a copied ExtendSim database in the
Database menu and the Database List and makes it available to that model. It does not put a
visual representation of the database on the worksheet.
To move a database from one model to another, select the database in the Database List and
right-click to cut the database, then paste the database into the other model.
Delete
To delete an entire database:
In the Database List, select the database to be deleted
Use the Delete or Backspace key or right-click and choose Clear
Importing or exporting an ExtendSim database
☞ Unless they are exported as text files and translated using the language of a target application,
exported ExtendSim databases can only be imported to an ExtendSim model or to the Extend-
Sim DB Add-In for Excel.
Export an entire database
The Database > Export Database command exports the entire ExtendSim database—all tables,
fields, records, and so forth—into a specially formulated database text file.You export a data-
base so you can do one or more of the following:
• Import the entire database into another model
• Send the database as a text file to another ExtendSim user so they can import it
• Prepare a database text file for use by the ExtendSim DB Add-In for Excel (discussed on
page 84)
☞ The command Database > Export Database is only active when an ExtendSim database win-
dow is active.
To export only specific tables from a database, see the discussion on page 56.
Import an entire database
The Database > Import Database command creates a
new ExtendSim database by importing a database
text file that was exported using the Export Database
command.
In the dialogs that appear, select the database text file
to import then name and import the database. This
command imports all the tables, fields, records, rela-
tions, and data from the exported file and creates a
new database.
If the imported database is named the same as an existing database in the model, see “Over-
writing an existing database” below.
To instead import tables to an existing database, see “Importing and exporting database tables”
on page 53. See also “Excel Add-In” on page 84.
Reference 53
Tables
☞ If there are a lot of tables and you only want to show certain ones, use the Hide All Tables but-
ton. Then select the tables you want to display using the checkboxes in the Table List pane.
Sorting tables
Whether in Schema or Data view, a popup menu in
the database window allows you to choose how tables
are listed in the Tables List pane—by name or by
index.
As discussed on page 46, an index is a unique key for identification that is assigned to each
ExtendSim database, table, field, and record when it is created. For a table, its index number is
displayed in square brackets after its name.
☞ No matter which sorting choice is selected in the database window, it does not affect how data-
base tables are presented in selector windows throughout ExtendSim. Selector windows
always present table names alphabetically.
Editing table properties
To access the Edit Table Properties
dialog:
Open the database window
Select a table’s name in the
Tables List pane and either:
Go to the Database > Edit
Table Properties command
Or, right-click on the table’s
title in the Tables pane
(database window in
Schema view) and select
Edit Table Properties.
The editing options are:
• Choose a different table to mod-
ify
• Rename the selected table
• Initialize the table so that all records are deleted only on the first run of a multi-run simula-
tion or on every run
• Enter text for tooltips to display when hovering over the table
Or, right-click on the table’s title in the Tables pane and choose Copy Selected Tables. Then
give the Paste Tables command.
The table can be pasted into the same database’s window or into a different database’s window.
To move tables from one database to another, use the Edit > Cut Tables command instead of
the Copy Tables command. This removes the table from one database and places it in the Clip-
board so it can be pasted into the database window of other database.
☞ Tables cannot be moved from the All Tables tab to a different tab. However, they can be cloned
to new tabs as discussed in “Use tabs to categorize tables” on page 29.
Renaming and deleting
To rename a database table, access the Edit Table Properties window as shown on page 55.
To delete a table, use the Delete key, the Edit > Cut Selected Tables or Edit > Clear Selected
Tables commands, or right-click to the commands.
Importing and exporting tables
There are types of files for imported/exported ExtendSim database tables:
• As database text files for use by an ExtendSim database or the ExtendSim DB Add-In for
Excel. See “Importing and exporting database tables” on page 53.
• As delimited files for use in other applications, as discussed below
The main purpose of exporting a table as a delimited text file is so the file can be read by Excel
or some other application. And the main purpose of importing a delimited file is to use a file
created in Excel or some other application. However, delimited files are not automatically for-
matted as an ExtendSim database table as would be generated using the Export Selected Tables
or Import Tables to Database commands. If you want to work on ExtendSim databases in
Excel, a better method would be to use the ExtendSim DB Add-In as discussed on page 84.
Exporting a delimited file
With a database window open, export the
selected table by giving the command Database
> Export Table to Delimited File. After you
give the file name, ExtendSim puts up the col-
umn separator dialog (shown here), so you can
specify which type of separator to use in the
text file. You can read the text file in Extend-
Sim (however, see warning above) or in a word
processing or spreadsheet application.
Importing a delimited file
With a database window open and a database
table selected, import a table into the current
database by giving the command Database > Import Delimited File to Table. This imports a
text file that has been exported from an external application such as a word processing or
spreadsheet application.
☞ See also “Excel Add-In” on page 84. The Add-In is a better method for working on ExtendSim
databases in Excel compared to importing/exporting delimited text files.
Reference 57
Fields
Fields
As shown on page 10, each field specifies some attribute or characteristic of whatever the data-
base table represents, for example:
Table Fields
Customers Last Name, First Name, Company
Products Product Name, Shipping Weight (pounds),
Inventory Level (units)
Process Steps Step, Setup Time (minutes), Operator
Resources Item, Capacity (gallons), Pressurized?
Every field has a name, an index, and a defined data type—integer, string, date/time, and so
forth—that defines the structure of the information or data. Fields can also have parent/child
relationships with each other.
☞ The field’s name can be anything you want as long is not used by another field in that table and
is less than 64 characters. Field names are not case sensitive and can contain spaces.
Creating a field
There are several methods for creating a field. See “Methods for adding a field” on page 18.
Upon creation, every field is assigned an index, a unique key for identification. A field’s index
number is displayed in square brackets after its name.
☞ To create a field with a mixed format (for instance, with both strings and numbers), set the field
as a string type in the Field Properties dialog. Enter numbers or strings into the cells.
Formatting and editing a field
• Fields are formatted using the Field Properties dialog discussed in “Properties and other dia-
logs” on page 60. To access the Field Properties dialog for an existing field, with the data-
base window in Schema view double-click or right-click the field, or select the field and use
the Edit Field Properties menu command.
• Each cell in the field takes on the formatting assigned to the field through the Field type set-
ting shown on page 61. (As discussed in “Formatting” on page 59, by default cells are con-
stants but can be changed to be random.)
• To reorder fields in a table, with the database window in Schema view click and drag the
fields.
• Use the ExtendSim Zoom In tool to cause fields to be larger; the zoomed setting is saved
with the model.
• To resize a field’s column width, put the database window in Data view. Then hover the cur-
sor over the column divider until it turns into a resize cursor and click and drag to resize.
☞ If the column has been set in the Field Properties dialog to Auto-
size column width (see page 60), you won’t be able to resize by
dragging the column divider. To turn off auto resizing, right-
click somewhere within the column (in Data View or Table
Viewer mode) and select Manually Resize Column.
58 Database Tutorial & Reference
Records
Creating a record
Records can be added to a database table either when the database window is in Data view or
by when the database’s Table Viewer is opened. See “Add a record to the table” on page 18 for
more information.
Upon creation, each record is assigned an index number, a unique key for identification.
By default, new records are appended to (placed below) any other records in the field. Records
can also be inserted using the Insert New Records command, right-click, or button.
Formatting and editing a record
Records take on the formatting assigned to the fields through the “Field type popup menu” on
page 61. (Note that individual cells are constant by default, but can be set to use a random dis-
tribution, as discussed in “Cells” on page 59.) Records are deleted using a menu command or a
button in the Data view’s toolbar.
Sorting data
With the database window in Data
view, use the Sort Data button in the
toolbar to sort a table’s data by numeric
or string values.
The dialog lets you choose up to three
fields where each field can be sorted in
either ascending or descending order.
For example, use this to sort a table’s
records first by last name, then by first
name, and then by city.
Cells
Each cell is the intersection of one field and one record.
Definition
Cells represent one piece of information, such as a customer’s last name, a product’s weight, or
a process step.
Cells can be:
• Required—information needs to be manually entered or needs to be imported from some
other place
• Optional—the cell can be left empty
• Calculated—the cell’s information is calculated based on a formula involving one or more
other cells.
Formatting
Each cell in a field takes on the formatting assigned to the field through the Field type popup
shown on page 61.
By default cells formatted as numerics are constants. Individual cells can be made random by
selecting a cell and using a menu command, right-clicking, or using the Make Cell Random
button in the Table Viewer or the database window’s (Data View) toolbar. Making a cell ran-
60 Database Tutorial & Reference
Properties and other dialogs
dom allows it to access any of the ExtendSim built-in distributions or even a named distribu-
tion. For more information, see the “Database Random Distribution dialog” on page 62.
☞ See “Formatting and editing a field” on page 57 for information about manually resizing a
record or having the record auto resize to accommodate large numbers in cells.
Properties and other dialogs
Most of the database dialogs are self-explanatory. The following require some explanation.
Table Properties dialog
When they’re created, ExtendSim database
tables have a Create New Table dialog. After
creation, a table’s properties can be viewed
or changed in the Table Properties dialog.
The two dialogs have the same options.
In the database window, access the Edit
Table Properties dialog by selecting a table
and giving the command Database > Edit
Table Properties or by right-clicking a data-
base table (Schema view of the database
window) and selecting Edit Table Proper-
ties.
The Table Properties dialog allows you to:
• Rename the selected table.
• Delete all the records. If selected, the ini-
tialization is done at the beginning of each
run or at the beginning of a multi-run sim-
ulation. Always check this if you are
doing multiple runs and the number of
records could change.
• Enter a Tooltip. This is the same as entering text in the field at the right side of the Database
window’s header. The text will be displayed in the Table Viewer or when a cursor is hovered
over the table.
Options
Option Description
Field name Enter any unique name, up to 63 characters. Spaces and special charac-
ters are allowed. Duplicate field names are not allowed in the same
table. In the Edit Field Properties dialog you can rename the field.
Autosize column width When checked, causes columns to automatically resize depending on
the maximum width of cells. You can also manually resize columns
using the right-click menu.
Field type Format for the field. For details, see “Field
type popup menu” on page 61.
Display decimals/sig- Displayed only for certain field types. For general format or scientific
Figs numbers, the number of digits to display. For currency and percent, the
number of digits to the right of the decimal point.
Use separators Displayed only for certain field types. Inserts commas and periods to
separate digits.
Record ID field The field used as an index when searching for a record in this table.
Each value unique When checked, the number or string for each record in this field must
be unique.
Read only When checked, prevents the data in a linked dialog parameter field
from being changed.
Initialize every record If checked, initializes the data for all the records in the selected field to
in this field to: the parameter value entered in the field. If the parameter is left blank,
initializes the field’s records to a blank.
First run...Every run Specifies when the record initialization takes place.
Information to display For displaying important information about the field.
Relationship dialog
When a parent/child relationship is
created and the field that will become
the child already has data, this dialog
opens and allows you to arbitrate
what happens. If there is no existing
data, the dialog does not open.
The options are:
• Try to match existing data in the
Child field to a record in the Parent
field. If existing data in the child
matches data in the parent, the data is left unchanged. Otherwise, it is cleared and the record
is left blank so the value can be manually selected using the Child popup selector
• Clear Child data. This option clears all the existing data in the child so the choice can be
manually selected using the Child popup selector.
Link dialog
This dialog opens if you
click a data table’s Link
button or (by using the
menu command or right-
click) select Create/Edit
Dynamic Link for a dia-
log parameter.
Use the Link dialog to
create a dynamic link
between a block’s param-
eter or data table and a
database or global array.
It can also be used to
delete a link, change link
settings, and even change
between linked data struc-
tures.
Dialog structure
As shown here, the Link
dialog opens with two
tabs: Database and Global
Array.
• If the data table or
parameter is already
linked to a database or
global array, the dialog
will display informa-
tion about the existing link. For example: Link: DB Link - Reservoir DB:Stream
Amount:Max Volume. You can change or delete the link.
• If the data table or parameter is already linked to a dynamic array, the Link dialog will dis-
play Link: No user created link. (A dynamic array is an internal data structure only accessi-
ble through programming.) You can create a link to a database table or global array.
• If the data table or dialog parameter is not linked to anything, the dialog will display Link:
No link. You can create a link to a database table or global array.
☞ See also “Finding linked dialog items” on page 66.
Delete Link button
The Link dialog is also used to delete a link.
A parameter or data table can only link to one data structure. If you change any of the compo-
nents, such as linking to a different database table, the previous linkage will be automatically
deleted.
Deleting a linked parameter
To delete a link between a dialog parameter and a database:
Reference 65
Properties and other dialogs
Right-click in the linked parameter field and select Create/Edit Dynamic Link. (Note:
don’t select or left-click the parameter field first.)
In the Link dialog that appears, click the Delete Link button.
Deleting a linked data table
To delete the link to a model’s data table:
Click the Link button at the bottom left of the data table
In the Link dialog that appears, click the Delete Link button.
☞ ExtendSim knows which link is being deleted, so you don’t need to select the table the param-
eter or data table is linked to before deleting the link.
Link dialog checkboxes
When the Database Table or Global Array option is selected in the Link dialog, it displays four
checkboxes that allow you to control the link’s behavior:
• Init messages
• Sim messages
• Final messages
• Read-Only link
Alert messages
As discussed on page 47, link alert messages are sent whenever the dynamically linked data
changes at the source, whether the simulation is running or not. Outside of a simulation run,
those alert messages are available to the Link Alert block (Utilities library; see page 33), equa-
tion-based blocks, and blocks you create. You can then use the alerts to detect changes or cause
something to happen in the linked blocks.
However, it is most common to want alerts about data changes during the simulation run. The
Link dialog’s Init messages, Sim messages, and Final messages check boxes control whether
or not all blocks receive link alert update messages when linked values change during specific
points in a simulation run. For example, the “Init messages” option determines whether a block
receives a message if a linked value changes during the InitSim message.
• These three options default to on. Turning an option off prevents ExtendSim from
sending data update messages to the linked blocks if the data source is updated during
that phase of the simulation.
• To maximize simulation speed you may not want these update messages sent during
certain phases of a run. For example, if you know the dynamic link only updates during
the FinalCalc message, it will reduce the messaging and speed up the simulation to
uncheck the Init messages and Sim messages options.
• When the Init messages and Final messages options are checked, linked blocks will
receive an additional message during InitSim and/or FinalCalc, causing an update of
the linked dialog items during those phases.
Use these options carefully and consider your objective (get the most up-to-date data, get a
consistent set of data, etc.) since they can dramatically affect runtime performance and results.
66 Database Tutorial & Reference
Read and Write blocks
Read-Only link
The fourth checkbox is the Read-Only link option, which is off by default. If checked, the
linked data can only be changed from the internal data structure (database or global array). In
that case, you will not be allowed to edit the parameter or the data table in the block’s dialog
and the live link is only one-way (from the database or global array to the data table or param-
eter).
Finding linked dialog items
The Model > Open Dynamic Linked Blocks command opens the Find Links dialog. This is
useful for examining and locating linked dialog items, and the options in the dialog allow you
to selectively choose which types of links you want to open.
The blocks then report that information through their value output connectors. The Read(I)
block can also store the information as an attribute on items passing through, so the informa-
tion can be used by other blocks in the model.
Writing
The two Write blocks send information to a specified data target or destination:
• For the Write block (Value library) the data target could be an ExtendSim database or global
array, Excel workbook, or text file
• For the Write(I) block (Item library) the data target is an ExtendSim database.
The information to be sent can come from their value input connectors. The Write(I) block can
also send the attribute information that has been found on items passing through.
Link alerts in Read and Write blocks
The link alert feature makes the Read, Read(I), Write, and Write(I) blocks especially powerful
when used to exchange data between blocks in the model and an ExtendSim database or global
array. When either the target or the source is an ExtendSim database or global array, the read/
write blocks can create a one-way live link between the target and the source. Writing to a cell
in an Excel spreadsheet or to a text file will not have the same live link effect.
See “Link alerts” on page 47 for more information.
Compared to DDL
Dynamic data linking (DDL) is discussed on page 19. Instead of dynamically linking data from
a block’s dialog parameter or data table to a database cell or table, you can use the blocks that
read or write to access the cells in a database for use throughout a model.
The advantages of using blocks that read and write rather than dynamic data linking (DDL)
are:
• These blocks allow more control over which database values get used, and where and when
they are used.
• Database usage is clarified visually. Instead of a blue outline around a parameter field inside
a block’s dialog, it is more obvious when a database value is coming from a Read block.
• Dynamic linking is limiting because it is fixed point-to-point. While you can change the
value at the data source, you can’t dynamically change which database cell is accessed
during a simulation run or in a series of runs.
• Rather than setting up a dynamic link for each parameter or data table, data can be more eas-
ily accessed at several places in the model.
• The read/write blocks support name tracking whereby blocks are alerted if there is a change
to the structure of a ExtendSim database component, such as the insertion or deletion of a
record. DDL does not support name tracking.
• In some blocks there is no dialog parameter or data table you can directly link to.
• It is often easier to perform mathematical calculations on the database values.
• It is more convenient for hierarchical blocks, allowing access to a different record for each
instance of the hierarchical block in a model.
68 Database Tutorial & Reference
Read and Write blocks
Compared to importing/exporting
Rather than using the Data Import Export block (described on page 35), which exchanges the
entire set of data at a time, the Read and Write blocks are usually used to exchange data piece-
by-piece as required during the run. Even though it may slow simulation speed, models may
need to write and read data while the simulation is running. For example, it is common that the
data that is written is in turn read and used in another part of the model.
See page 71 for some advantages of importing/exporting compared to reading/writing.
A potential disadvantage of using the Read and Write blocks is that reading and writing the
data each time the block is calculated can impact simulation speed. If the data to be read or
written will not change over the course of the simulation, you should import/export the data as
a local copy in the block before or after the run. If the data is not going to change at all, con-
sider using another method, like a one-time copy/paste or import/export.
Where to get more information
• For a tutorial showing how to use these blocks in a model, go to page 38
• For an example of how the blocks are used, explore the Monte Carlo and DB Job Shop mod-
els discussed below
• Since the Read and Write blocks in the Value library have uses beyond interfacing with data-
bases, they are also discussed in the How To: Data Management chapter of the User Refer-
ence.
2) Controls the timing of when data exchanges occur—at the beginning, during, or after the
simulation run
☞ The main advantage of using the Data Import Export block is that information is exchanged as
one piece rather than step by step during the simulation run. Thus it is typically used to load the
model with data before the simulation run and export results at the end of the run.
Import and Export modes and interfaces
The Data Import Export block can be configured to operate in either import or export mode. It
exchanges data between an ExtendSim database and:
• A Microsoft Excel workbook (specified by rows and columns,
named ranges, or by workbook table)
• External databases that are ODBC or ADO compliant (Microsoft
Access, Oracle, MySQL, SQLServer; Windows only).
☞ The Oracle and SQLServer databases are useful as automated
bridges between ExtendSim databases and ERP programs such as
SAP.
If you use the Data Import Export block to exchange data with an ODBC or ADO database
such as Access, the database and its drivers must be 64-bit compatible.
• An FTP (file transfer protocol) data source type, where the file resides on a remote machine
and access to it requires a user name and password.
• Text files such as those generated by Notepad or Excel or any other applications where the
modeler has read access to a file that resides on the local computer or a local area network
(LAN).
• An XML (extensible markup language) file, a flexible way to share structured data with
external databases, the World Wide Web, intranets, and elsewhere.
☞ The Data Import Export block even allows you to export an entire ExtendSim database to an
ADO-compliant database, such as Access.
Server the source/target is specified using a server name and a database name. For Oracle, a
user name and database name must be specified.
If information other than a file name and location is required, the block’s Options tab will be
enabled. The Options tab is helpful for configuring tables, entering a data source name (DSN)
data structure, and so forth. As is true when files are selected and configured on the Import
Export tab, the fields on the Options tab will vary depending on the external application or file.
If there is nothing additional to configure, the Options tab will be disabled.
☞ See “Fields with string data types; PRI and PRV” on page 48 if the block will exchange data
with an ExtendSim database’s child field.
Import and export timing
The Data Import Export block provides three options for when the external source or target
exchanges data with the ExtendSim database:
• Manually whenever the Import Now or Export Now button is clicked, even if the simulation
is not running.
• During the simulation run, when the block’s input connector gets a value greater than 0
(zero).
• During a specified phase of the simulation run:
If the Import at beginning of simulation checkbox is checked, data is automatically
imported at pre-CheckData. The Options tab offers alternative import points.
If the Export at end of simulation checkbox is selected, data is automatically exported
at EndSim.
Compared to reading/writing data
The advantages of using blocks that read/write, rather than import/export, to exchange data
between a model and a database are discussed on page 68.
The advantages of using import/export compared to reading and writing data include:
• Import/export might be faster than reading and writing data because the data gets completely
copied in a single operation. Whether the exchange happens before, during, or after a simu-
lation run, all the data is made available to the target at the same time, rather than transfer-
ring piece by piece during the simulation run.
• The information can be accessed even if it originated on a different computer or an external
device.
For example, simulations often run faster because the data is exchanged as one piece—all the
data is made available to the target at the same time rather than transferring piece by piece
during the simulation run. This is true whether the data is imported/exported before, during, or
after a simulation run.
Where to get more information
• For a tutorial showing how to use this block in a model, go to page 35
• For an example of how the block is used, explore the Dynamic Resource Qualification
model discussed below
☞ Since the Data Import Export block has uses beyond interfacing with ExtendSim databases, it
is also discussed in the How To: Data Management chapter of the User Reference.
72 Database Tutorial & Reference
DB Line Chart block
Block structure
When the DB Line Chart’s icon is double-
clicked on the model worksheet, it opens
with the Graph tab being front most. There
are three tabs along the left side—Dialog,
Graph, and Data.
The Data tab is for recording data, and the
Graph tab is for displaying data, during the
simulation run. The Dialog tab is for enter-
ing settings for the block. As shown below,
additional tabs appear if the Dialog tab is
the active window.
See the User Reference for complete infor-
mation about the Trace Editor and Graph
Properties dialogs that appear when you
right-click the Graph tab in Chart library blocks.
Dialog tab
When the Dialog tab on the left side is selected, the block shows three tabs across the top: Data
Collection, Display, and Comments.
• The Display tab is much the same
for all the blocks in the Chart
library. Use it to set general
options such as whether the
graph opens automatically, how
autoscaling is handled, and so
forth. For example, you might
not want to see the graph until the
end of the simulation or until you
manually open the block’s dialog.
Or you might clone the graph onto the model worksheet and never need the block’s dialog to
open. See the User Reference for more information about the options in the Dialog tab’s Dis-
play tab.
• The modes and options in the Dialog tab’s Data Collection tab, shown and discussed below,
are specific to graphing database data. In addition to having options for what exactly gets
graphed and when, the tab has options that limit the amount of recording time and the
amount of data that gets recorded.
Miscellaneous
Some other features of the DB Line Chart block to note:
• Each DB Line Chart block has a maximum of 20 traces.
• You can graph multiple database cells, or fields, or tables on separate traces in a DB Line
Chart block, but you cannot mix cells, fields, and tables in the same block. Instead, use sepa-
rate blocks for each component.
76 Database Tutorial & Reference
Equation-based blocks
• You don’t need to run a simulation to use the DB Line Chart block. It is also useful when you
just want to visualize and compare sets of data within a database or between one database
and another. After selecting the data sources and options, use the Plot Now button in the
Data Collection tab to graph the data. (Note that this option is not available if you are graph-
ing one cell per trace.)
• If you choose “one cell per trace” for the data collection, the best way to drill down to the
wanted cell is by clicking first on a cell in the Select column. This takes you to the Database
Address Selector so you can choose the database, table, field, and record in one window.
• To increase the number of available rows, and hence the number of traces, in a table
in the dialog’s Data Collection tab, click the +/- button (as shown to the right) in the
lower right corner of the table. Unused rows will appear as empty columns in the
Data tab.
Equation-based blocks
The equation-based blocks calculate values for, and perform operations in, models based on
formulas and ModL code entered in their dialogs.
Overview
There are five equation-based blocks:
☞ The Buttons block (Utilities library) is also equation-based but is used for more specific pur-
poses. It is discussed in the User Reference.
Reference 77
Query Equation and Query Equation(I) blocks
These blocks provide access to over 1,200 ExtendSim ModL functions of the ExtendSim API;
you can also use operators to enter logical statements, write compound conditions, and specify
loops. The most common use of equation blocks is to write if-then-else logic statements.
The equation can be as simple as performing a mathematical operation on the value from an
input connector or it could be as complex as a full programming segment. You can use include
files (See Include Files in the Technical Reference) within your equation to reuse your own
functions among many equation blocks, and you can use the source code debugger (see the
User Reference) to check the equation if you have a problem.
The components of an equation are the input variables, the equation, and the output variables.
An equation-based block takes input variables, uses those values in the equation, and outputs
the results of the calculation. There are several pre-defined input and output variables with
static variables you can use in equations and several of them relate to the ExtendSim database.
For example, DB address, DB database index, DB table index are pre-defined input variables
while DB write value and DB write value using attribute are output variables.
Use with ExtendSim databases
In addition to the Read/Write blocks from the Value and Item libraries, equation-based blocks
also allow you to perform read/write database operations. And while equations require more
effort to access the database, sometimes the added control and flexibility they provide are
needed. For example:
• Searching. Combine reading and looping logic by searching an entire field (reading one
record at a time) for a particular value by calling DBGetDataAsNumber() inside the “for”
loop.
• Reading. Specify a DB Read Value as the input variable in the block, then use the read value
to influence the if-then-else logic in the equation.
• Writing. Use the value of an input connector variable to write different kinds of information
to a database using if-then-else logic.
☞ The Equation, Equation(I), and Queue Equation blocks are used extensively whether a model
has a database or not. They are discussed fully in the How To: Math and Statistics chapter of
the User Reference. Since the two Query Equation blocks are only used to perform Extend-
Sim database queries, they are discussed below.
Query Equation and Query Equation(I) blocks
☞ Unlike the Read/Write, Data Import Export, and equation-based blocks which have multiple
uses, the Query Equation and Query Equation(I) blocks are unique blocks that are only used
with the ExtendSim database. Therefore, these two blocks are discussed fully here rather than
in the User Reference.
A query finds records in a database according to the criteria you
specify. The Query Equation blocks are used to search an ExtendSim
database, rank the records, and intelligently select one record based
on a ranking rule. A user-defined equation in the block’s dialog is
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 deci-
sions in a model. While the querying and ranking behavior could be accomplished using the
78 Database Tutorial & Reference
Query Equation and Query Equation(I) blocks
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)
• Query Equation(I) (Item library)
The major differences between these two blocks is presented in the table on page 82.
The Query Equation blocks are advanced modeling tools. They are not available in all Extend-
Sim products.
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) block in the Item library, this occurs every time an item
passes through.
• For the Query Equation block in the Value library, 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 block’s Options tab; the
rules are listed on page 81. 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 rank-
ing.
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.
☞A spawned item essentially represents a record that has been “spawned” as an item.
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 connec-
tor to appear on the top edge of the block's icon. It also causes some additional equation vari-
able types, with the prefix DBQS (for database query spawn), to be available. Those variables
are shown in the table on page 80.
Reference 79
Query Equation and Query Equation(I) blocks
☞ The equation results for pass-through items are calculated independently from those for
spawns.
Pass-through results are associated with the pass-through item and spawn results are associated
with the spawned item. For example, results for the pass-through item might get taken from
record 6 (because 6 possessed the best pass-through record rank), while the spawn might use
results from record 2 (because 2 possessed the best spawn record rank).
When a spawned item is created, it represents a record from the query table. Consequently, you
can think of this newly created item as a “spawned record”.
☞One pass-through item can result in anywhere from 0-n spawns being created, where n is the
number of records in the query table. The number is determined by spawn settings and the
equation results.
Variables
The Query Equation blocks have several types of input and output variables. Most of those
variables are the same as shared by other equation-based blocks. However, the following vari-
ables are unique to the query blocks.
☞ See the How To: Math and Statistics chapter of the User Reference for a list of the input and
output variables that are shared by all equation-based blocks.
To modify the number of rows used in the variable tables:
• Change the number of rows in the table by clicking the green +/- resize button in the table’s
bottom right corner and entering the number of rows desired.
• Delete rows by first selecting the rows you wish to delete, clicking the green +/- resize but-
ton, and then selecting the option to “delete selected rows”
• Duplicate any rows by first selecting the row you wish to duplicate, clicking the green +/-
resize button, and then selecting the option to "copy selected row."
Input variables
This list is only for variables that are unique to the query blocks; see the How To: Math and
Statistics chapter of the User Reference for descriptions of the other input variables.
.
Query Equation(I)
Query Equation
DBQ read value X X 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 informa-
tion residing in the query table for the current record.)
80 Database Tutorial & Reference
Query Equation and Query Equation(I) blocks
Query Equation(I)
Query Equation
Input Variable Uses
DBQ read PRI X X The Parent Record Index value from the specified field
for the current record. See note below.
DBQ start record X X The record to start the query cycle. (The default behav-
ior is to start at record 1.)
DBQ num records X X The number of records in the query table.
DBQ current record index X X The index of the record currently being evaluated in the
query cycle.
DBQ static query init X X A static input variable that gets initialized at the begin-
ning of every query cycle.
DBQ current best rank result X X Current best record rank result in the current query
cycle.
DBQ current best record X X The record index with the best rank at this point in the
current query cycle. If the value of this input is < 1,
then no record has yet to be given a ranking.
DBQ num non-blank ranks X X Number of non-blank ranked records at this point in the
current query cycle.
DBQS current best rank X Current best spawn rank result in the current query
result cycle. (Only enabled if spawning is enabled.)
DBQS current best record X The record index with the best spawn rank at this point
in the current query cycle. If the value of this input is <
1, then no record has yet to be given a ranking. (Only
enabled if spawning is enabled.)
DBQS num non-blank ranks X Number of non-blank spawn ranked records at this
point in the current query cycle. (Only enabled if
spawning is enabled.)
☞ The notation PRI (Parent Record Index) is used in blocks that interface with the ExtendSim
database. It describes the type of value that is being read or written when dealing with a Child
field. See “Fields with string data types; PRI and PRV” on page 48.
Output variables
This list is only for variables that are unique to the query blocks; see the How To: Math and
Statistics chapter of the User Reference for descriptions of the other output variables.
Reference 81
Query Equation and Query Equation(I) blocks
Query Equation(I)
Query Equation
Output Variable Uses
As mentioned earlier, while you can specify other equation results, at least one of the output
variables has to be of the type DBQ record rank. Furthermore:
• Only the results for the record ranked best will be output.
• You can use more than one DBQ record rank variable; the secondary ranking variable will
be used to arbitrate in the case of tied ranking. This is useful if you are concerned with tie
breaking for two or more records having the same primary. What constitutes a tie can also be
defined on the Options tab with the parameter Records ranked within +/- X are equal.
• If the Spawning option is enabled, at least two output variables are required – one variable of
DBQ record rank type plus one variable of DBQS record rank type.
Ranking rules
The rules that determine which record is selected are given on the block’s Options tab:
For a pass-through item
• Highest pass-through record rank. Each record’s rank value is calculated by the equation.
The one with the highest rank is chosen.
• Lowest pass-through record rank.Each record’s 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:
82 Database Tutorial & Reference
Query Equation and Query Equation(I) blocks
Query Equation(I)
Query Equation
Description
Query cycle initiated only when an item arrives (similar to the Equation(I) block). X
Query cycle initiation is controlled using options on the Options tab (similar to the X
Equation block).
Supports Spawning X
Works in continuous models X
Works in discrete event models X X
Works in discrete rate models X X
Reference 83
Query Equation and Query Equation(I) blocks
through item. When the next item/part arrives, the query block starts looping through the Pro-
duction Specs table associated with that part.
In this example, the query block is looking for the record whose From value matches the curr-
Step attribute found on the item. Once that is found, the block then finds the associated To and
Process Time values for that record and stores them as attributes on the item.
The equation in the query block is:
if(currStep == fromField)
{
rank = True;
currStep = toField;
activityDelay = delayField;
}
else
{
rank = False;
}
Given the complexity of what the query block is doing, the code is very simple.
Excel Add-In
The ExtendSim DB Add-In is a tool for externalizing the modification and construction of
ExtendSim databases.
Uses
Use the Add-In to:
• Import an ExtendSim database text file into Excel for editing, then export it back to Extend-
Sim.
• Create new, fully structured, ExtendSim database files within Excel, then export those files
for use within ExtendSim.
• Let Excel be the master for documenting the data and database structure. For instance, charts
and data tables can be added in Excel to help explain or analyze inputs to the database. (Any
tables that do not start on row 20 can be used because they are not considered ExtendSim
database tables and will be discarded when the file is exported to ExtendSim.)
The data and structure of an ExtendSim database can thus be edited or created in Excel, sepa-
rate from, and even in the absence of, the ExtendSim application. For example, analysts can
structure or edit database files for use in models without knowing anything about ExtendSim.
☞ The DB Add-In for Excel is included only in specific ExtendSim products; it can also be pur-
chased separately by those who have other ExtendSim products or who don’t have ExtendSim.
Using ExtendSim versus the DB Add-In to create or modify a database
Depending on which environment you feel more comfortable in, you can choose to create data-
base files in Excel or in ExtendSim. There are some things to note though:
• There is no undo in the Add-In.
Reference 85
Excel Add-In
• In ExtendSim, database tables can exist on multiple tabs. In Excel, a database table can only
exist on one worksheet.
Importing to Excel
To import a database text file into Excel, give the command ExtendSim DB > Import Database.
Then choose a database text file that has been exported from ExtendSim using the Export
Database command, as mentioned above.
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.
After the file has been opened, you will be given the opportunity to perform a database consis-
tency check, discussed on page 90.
If some or all of the database tables had been organized onto different tabs in the database, as
discussed in “Use tabs to categorize tables” on page 29, Excel will populate the workbook with
worksheets that correspond to those tabs. Thus each worksheet is the equivalent to one of the
tabs in the imported database.
Exporting from Excel
To export a database file from Excel so that ExtendSim can import it, give the command
ExtendSim DB > Export Database. The workbook will be exported as a database text 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, as discussed on page 90. During
export, the Indexed Fields table (Data Relationship tab) in the workbook will be erased and
repopulated with the current data from the workbook.
☞ Only ExtendSim formatted tables, those with fields present on row 20 of the worksheets, will
be exported. If you use tables or pivot tables in the workbook to help explain or analyze input,
start those on rows other than row 20.
Importing to ExtendSim
See “Importing or exporting an ExtendSim database” on page 52.
Creating a new database in Excel
The ExtendSim DB Add-In can be used to fully specify an ExtendSim database in Excel,
including parent/child relationships, formatting, data validation, and more.
To create a new ExtendSim database in Excel, install the ExtendSim DB Add-In and give the
command ExtendSim DB > Create New Database. This opens a new workbook with three
tabs:
• All Tables
• Tab 1
• Data Relationships
The All Tables and Data Relationships tabs are discussed in “Required and protected work-
sheets” on page 87.
The All Tables and Tab 1 worksheets are for creating ExtendSim database tables. Add more
worksheets as desired.
Any tables that you want registered as ExtendSim database tables must have their fields present
on row 20. Any other tables will be discarded upon export.
Reference 87
Excel Add-In
Cell randomization
To make a data cell random:
Select the cell and choose
the command ExtendSim
DB > Make Random.
In the Randomize dialog
that appears, select the dis-
tribution and enter required
values.
Empirical tables must be
named and require additional
information. In the Random-
ize dialog’s “Distribution
name” popup select Save to
Named Distribution, then give
the table a name. Choose if the
values are discrete, stepped, or
interpolated. Then click the Set Values button and enter values and probabilities on the Empir-
ical Table Data worksheet that appears. Be sure to enter probabilities that total 100 for all the
rows you want values in, then click OK. To view the table, go to the Named Distributions
worksheet.
• Other than for the empirical table, it is optional to name the distribution. However, named
distributions appear on the Named Distributions worksheet and are made available to other
cells when Make Random is clicked.
• You can only randomize cells with an appropriate format, such as general. If the Make Ran-
dom command is not enabled, check the field format.
Parent/child relationships
Parent and child fields are color-coded in the workbook. This matches the parent/child color
coding in ExtendSim – red text for parent fields and green text for child fields. All relations are
stored on the Data Relationships worksheet.
☞ A parent field must be designated as Unique and must have Record ID enabled. Make those
changes in the parent’s field properties header before creating a relationship.
90 Database Tutorial & Reference
Excel Add-In
Any errors are reported on an Excel worksheet with hyperlinks to each error and an appropriate
error message.
Find Table by Sheet
This command allows users to quickly find and go to a database table in their workbook.
Selecting the command opens a dialog that displays a list of all the worksheets for the database
and all the tables in the selected worksheet.
What’s new in the database since release 9.0
The ExtendSim internal relational database has been completely rewritten for release 10. In
addition to all the capability of the previous iteration, this 3rd generation release is more pow-
erful, easier to use, and has a new interface.
• When creating a new field, choose Auto resize to have the col-
umn automatically minimize based on the size of its largest
cell. To select Auto resize after creating the field, select the
field in Schema view using the Edit Field Properties command or right-click menu.
• To autosize or manually resize a column, in Data view or the
Table Viewer select a field and right-click for the menu shown
here.
• In blocks that access an ExtendSim database, such as the DB
Line Chart block (Chart library), quickly capture an entire data-
base address by selecting components or by entering names or indexes in the database
address selector.
W-Z
worm chart 75
Write block (Value library) 38, 39, 66
Write(I) block (Item library) 38, 66
XML
import from or export to 70
Extend