Search
Modeling Techniques

In other simulation tools, the items (also referred to as entities or transactions) are put on the event calendar (scheduled for future consideration when a time delay is encountered). In ExtendSim, the blocks have an entry on the event calendar. Some blocks contain their own event calendars with an entry for each item in the block.

Scheduling the blocks rather than the items has a number of advantages:

Because there are typically fewer event scheduling blocks in the model than there are items to be scheduled and the number of event scheduling blocks in a model does not change, the ExtendSim event calendar is relatively small. This eliminates the need for time consuming insertion and deletion of events on the calendar. This is particularly important in large model where searching the event calendar for the next event can be a large portion of the execution time.

It is very easy to change the event time. Because the block’s event time is stored in a fixed location, the future event time for the block can be changed with a simple assignment.

Items are not necessary for an event. A block can schedule an event without needing to create (and then dispose of) an item.

Any block in the model can schedule an event. This makes it particularly easy to build modeling components which simulate system features such as preemption and reneging. These types of features normally require internal or dummy items in other simulation tools.

ExtendSim uses both a push and pull mechanism to propel items through a model. Residence blocks (residence blocks are any block that can hold an item for a non-zero amount of time, such as queues, activities, resource blocks, and some decision blocks) attempt to pull items in until it is full or until there are no more items to pull in. Then the residence blocks will try to push items out until there are no items left or the downstream path is blocked. In some cases, the residence block will hold the item for a specific time delay before attempting to push the item out.

In ExtendSim 10, ARM records utilization and quantity utilization because it is now possible for a record in the [Resources] database table to represent a quantity of resources other than 1. In v9.3 and earlier versions of ExtendSim, each record in the [Resources] table represented exactly one resource. In the new version of ARM, a record in the [Resources] table now has an explicitly defined quantity field. The quantity can be any non-zero real or integer number. When any portion of the quantity of a resource record is BUSY, ARM tracks the resource record as being utilized. This utilization is recorded in the Utilization field. The Quantity Utilization is a measure of how much of the available quantity for the resource record has been utilized during the simulation run.‬‬ ‪

For example, a resource record has a quantity of 10. During the entire simulation run, a quantity of only 1 is continuously utilized. The Utilization for this resource record would be reported as 100%, but the quantity utilization would be reported as 10%.‬‬

Use a Write (Value library) block as an interface between the Database and the Optimizer (Value library). Follow these steps:

1. In a Write block, select the Database and table with the variables for the Optimizer.

2. Drag the clone of the preview table from the Write block to the Optimizer once per variable in the Optimizer.

3. Set the row and column in the Optimizer for the table. Remember that these are 0 based references (the first row and column are numbered 0).

When the Optimizer changes the variables, they will automatically be changed in the Database.

Showing simultaneous movement requires the use of a Transport and/or Convey Item block from the Item library (included in ExtendSim DE and ExtendSim Pro). To animate the simultaneous movement of items through a model, follow these steps:

1. Place a Transport or Convey Item block at the point in the model where you want a transit time. A transit time is required to show simultaneous movement, otherwise the movement would have no duration.

2. Open the block's dialog. On the Transport Animation tab of the Transport and/or Convey Item block, check the "2D animation shows simultaneous movement" option. Tip: Use the Find and Replace block from the Utilities library to change all of the blocks at once.

3. Select "in a straight line" or "along connections" for the movement.

4. Turn off "Add Connection Line Animation" from the Run menu.

Connect a Switch block from the Utilities library to the "Q" (Item Quantity) input connector on the Create block (Item library). If the Switch is On, a quantity of 1 is sent to the Create block and an item is created. When the Switch is Off, a quantity of 0 is sent to the Create block and no item is created.

The item will wait in the last upstream residence block until the Activity block (Item library) can receive it. Residence blocks are any block that can hold an item for a non-zero amount of time. Examples include queues, activities, resource blocks, and some decision blocks. If the last residence block is a generator type block, the item will be held until a new item is created or the activity pulls the item. This is the only time that an item will be destroyed if there is downstream capacity.

In a discrete event model, you can control the order that time ties (two or more events occurring at the same time) are processed. ExtendSim will put the blocks on the event calendar in simulation order. Blocks with a lower simulation order will receive their event message first. You can change the simulation order with the following steps:

Go to Run > Simulation Setup > Continuous tab. Under Simulation Order, choose Custom (Advanced only)

Under the Model menu, turn on Show Simulation Order.

Select an event scheduling block. Choose Set Simulation Order from the Model menu. Set your Custom Simulation Order.

Note, the simulation order will only make a difference if two or more events occur at exactly the same time. If the events are not exactly at the same time, events will occur in chronological order.

1. Are there any caveats to how I can use the RunSimulation, PauseSim, and ResumeSimulation functions?

These functions are not recommended for use via OLE automation or DDE Execute messages at all. These functions were developed before the External Scripting functionality was fully developed, and they do not work as well in this context as the ExecuteMenuCommand function. This function acts exactly as if you have selected the specified command from the menu bar and will perform better with the external control methods. The ExecuteMenuCommand function takes one argument, the command number. These numbers are defined in the Technical Reference.


2. Should I use a different modeling technique if I am running a simulation that basically finishes instantly versus running a simulation that will run for longer and want to control interactively?

There is a difference in how you should set up your code in these two cases.

If the simulation is going to complete instantly and/or you are not interested in sending other commands to ExtendSim while the simulation is running, you can just send the executeMenuCommand(6000) to ExtendSim without a worry.

If, however, you are interested in running a longer simulation, and you want to be able to pause and resume it or get data while the simulation is running, you should use the IPCServerAsync(TRUE); function. This function specifies to ExtendSim that the following Execute control action should execute asynchronously, not synchronously. A synchronously executed instruction will execute immediately and the application that sent the command will wait for the instruction to complete before it continues its execution. An async command, on the other hand, will return immediately allowing the application to continue on with other things while the simulation runs. The sequence of instructions you should execute in this case would be as follows:

a. IPCServerAsync(TRUE);

b. ExecuteMenuCommand(6000);

c. IPCServerAsync(FALSE);

These should be sent as three different execute messages. It is important to send the final IPCServerAsync(FALSE) and not to send any other Async messages while the simulation is running, as ExtendSim doesn't allow multiple asynchronous messages to be processed simultaneously.

If you add new dialog items or static variables to your custom block, they will need to be initialized. The easiest way to do this is in the openModel message handler. This is called whenever a model is loaded. If you delete or change the dimensions of dialog items or static variables, the data in the existing blocks may not match up correctly with the data in the existing blocks. To avoid this, delete the existing blocks and re-add them to the model. You can also use the "hide" feature to hide the dialog item. You should do this if your blocks are being used in models where it would be inconvenient to replace each instance of the block.

...I would like to use the Interchange block (from the Rate library in ExtendSim Pro) to represent the berth. Vessels would come to either load or unload. Can I use just one Interchange block to both load and unload?

Yes. In fact, there are three different ways to model a berth that is used both for loading and unloading:

Solution 1 -  One Interchange block simulates the ships at berth and the berth itself.

Solution 2 - One Interchange block simulates the ship loading or unloading and Tanks and Valve simulate the loading and unloading of product to and from the berth.

Solution 3 - One Interchange block is used for unloading and one Interchange block for loading.

downloadAll three solutions are illustrated within this freely downloadable model that illustrates how to load and unload at the same physical location.

Note: This model was built in ExtendSim 9 so can be viewed in either ExtendSim 9 or 10.

If you're databases are running slower than you think they should, here are a few things to think about that might slow the run time of ExtendSim databases:

String to number or number to string conversions. For example, writing or reading numbers from a string field can sometimes slow the database.

Using Record ID fields to search for a record.*

Writing to child fields as it needs to see if the parent value exists.*

Linked data and Link Alert messages.

 

* Enchancements in ExtendSim 10.0.5 help speed this up.