...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.
All 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.
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:
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.
Use a Write (Value library) block as an interface between the Database and the Optimizer (Value library). Follow these steps:
When the Optimizer changes the variables, they will automatically be changed in the Database.
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:
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.
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:
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:
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.
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%.
If your 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:
* Update to ExtendSim 10.0.9 as its enhancements may help speed this up.
To place a database table on a model worksheet or in a notebook, first link the table to a block dialog's Datatable. Then, clone that Datatable to the worksheet or notebook.
You can stop a simulation during the run by clicking the Stop button in the toolbar, giving the Run > Stop menu command, or using the Ctrl+. shortcut. These cause the current executing block to return an abort signal, causing the model to stop executing in whichever state it was in when the Stop command was given. Sometimes the Stop signal takes time to propagate through the block code and back to the simulation engine, so you can't tell when the simulation will actually stop.
To stop the model at an exact point in time, such as when all the blocks are up to date on that step, enter code in an Equation or custom block that gets executed when you want to stop. For example:
numSteps = currentStep+1 // This will cause the simulation engine to stop at the next step.
Note that the ExtendSim simulation engine uses the simulation step value and not the currentTime value to stop the model. However, you can use currentTime in your code to decide when to execute that line of code.