Configuring Models with Expressions


SIMPROCESS comes with its own scripting language for building and executing Expressions. Model components (Entity Types, Resource, and Activities) and the model itself contain various activation points where Expression code can be executed. (Part D of the SIMPROCESS User’s Manual describes the use of Expressions and the various user-defined Attributes, System Attributes, and System Methods that can be included in an Expression.) There are many System Methods available that facilitate configuring a SIMPROCESS model from an external source, such as a spreadsheet or database. What is the value of configuring a model through Expressions? Consider the Inventory.spm demonstration model that is a part of the SIMPROCESS installation. It models an inventory and manufacturing process. Orders are received for the finished product. If enough finished product is available the order is fulfilled. If not, more finished product is manufactured. Each product consists of two components. If there is not enough of either component then raw materials are retrieved in order to manufacture the component. So there is one product consisting of two components and each component consists of generic raw materials. What if there are an unknown number of products and what if each product consists of an unknown number of components? What if the time to manufacture and the resources required to manufacture vary by product? The Inventory.spm demonstration model cannot handle such questions as it only models one product with two components. For these types of questions a model is needed that can handle a varying number of products with varied number of components required for each product. The model needs the resources required and other things to be configured without changing the model.

Configuring the Model

Multiple aspects of a model can be configured through the SIMPROCESS Expressions. In a sense all Expressions configure a model since complex calculation and decision making can be accomplished in Expressions. However, there are Expression statements that can change previously set properties, and there are statements that can create items that were not previously defined. These Expression statements can only be used in the Start Run Expression. The Start Run Expression is a Model Expression (Define/Model Expressions). This provides an introduction to these Expression statements and how they are used. It is recommended that all the Expressions, including the Start Run Expressions, of ConfigureWithSpreadsheet.spm and ConfigureWithDatabase.spm (included in the ExpressionDemos directory) be examined carefully since they show how many of these statements are used. Further explanatory comments are also included in the Expressions. The Run Settings, Resources, Entity Type, Activities, and Attributes can be configured at the beginning of a simulation.

Run Settings

Various model Run Settings can be set in the Start Run Expression.

  • SetSimulationStartEnd – sets the starting date/time and ending data/time of the simulation.
  • SetReplications – sets the number of replications for the simulation run.
  • SetWarmupLength – sets the amount of warmup time for the simulation run.

Resource Configuration

There are Expression statements for creating Resources and configuring Resources.

  • CreateResource – creates a Resource for use during the simulation. The properties included are the name, capacity, statistics collection, fractional, and consumable.
  • SetResourceCost – sets the various cost options for a Resource.
  • SetResourceExpression – sets the Expression code for any of the Resource Expression points.
  • SetResourceDowntime – applies a predefined Resource Downtime to a Resource.
  • SetResourceShift – applies a predefined Resource Shift to a Resource.
  • CreateResourceShift – creates a Resource Shift for a specific Resource.
  • CreateWeeklyResourceDowntime – creates a Weekly Resource Downtime schedule for a specific Resource.

Entity Type Configuration

There are Expression statements for creating Entity Types and configuring Entity Types.

  • CreateEntityType – creates an Entity Type for use during the simulation. The properties included are the name, icon, priority, Entity preemption, and statistics collection.
  • SetEntityExpression – sets the Expression code for any of the Entity Instance Expression points.
  • SetEntityTypeExpression – sets the Expression code for any of the Entity Type Expression points.

Activity Configuration

There are Expression statements for configuring Activities. Activities cannot be created or connected through Expressions.

  • SetActivityExpression – sets the Expression code for any of the Activity Expression points. The Expression points will vary based on the type of the Activity.
  • SetDuration – sets the delay distribution for Activities that can have a delay time.
  • SetResourceAcquisitionPolicy – sets the Resource acquisition policy for Delay and GetResource Activities.
  • GetResource – creates a request to obtain a Resource in a Delay or GetResource Activity. This statement can only be used in the Accept Entity Expression of the Activity.
  • FreeResource – creates a request to free a Resource in a Delay or FreeResource Activity. This statement can only be used in the Accept Entity Expression of the Activity.

Attribute Configuration

There are Expression statements for creating Attributes and setting and getting their values.

  • CreateAttribute – creates an Attribute for an Entity Type, Resource, Activity, or the Model. The Attribute can be global or local to a particular model component. The properties included are the name, type (Entity, Entity.Type, etc.), owner, mode (REAL, INTEGER, etc.), default value, and array size.
  • GetAttributeValue – returns the value of an Attribute.
  • SetAttributeValue – sets the value of an Attribute.

Other Expression Statements

The examples ConfigureWithSpreadsheet.spm and ConfigureWithDatabase.spm use many other Expression statements in order to fully implement the external configurations. The comments in each Expression of these models give further information about these other statements. It is recommended that the complete list of System Attributes and System Methods in Part D of the SIMPROCESS User’s Manual be reviewed. SIMPROCESS Attributes (user-defined and System) and System Methods give the modeler extreme modeling power and flexibility.

Advantages and Disadvantages


The advantages of configuring a model from an external source are many. A few of these advantages are

  • Reduced Model Size – Since an Activity can be configured in any way, multiple Activities representing different Resource combinations and/or delay times are not necessary.
  • Fewer Models – Since a model can be configured there is no need for processes with similar flows to each have a separate model.
  • Object Oriented Models – Models can be built with data structures in mind. This means a single Activity or Process can represent whatever data configures those items. Also, various sets of data can be run at the same time with the data required being determined by the Entity entering the Process or Activity.
  • External Interface – Configuring a model from an external source is usually required if an external interface to the model will be developed, either a web based interface or an interface built in another application.


There are disadvantages to having a model be highly configured from an external source.

  • Excel Spreadsheet and Windows – There are issues when using an Excel spreadsheet with SIMPROCESS on Windows. Due to Windows peculiarities a spreadsheet file is not fully released until SIMPROCESS is closed.
  • Some Features Restricted – Depending on the level of external configuration certain SIMPROCESS features may not be useful. For example, defining an optimization or custom report may not be possible if some of the items required are not created until run time. The ultimate purpose of the model must be kept in mind when determining the level of external configuration.
  • More Complex Verification – Model verification ensures the model is running correctly. (Model validation is another issue.) Configuring a model from an external source adds the tasks of ensuring the external data is being correctly read in and correctly used.


SIMPROCESS gives the modeler ultimate flexibility when building a model. If a basic model of a single process is all that is needed, SIMPROCESS more than fits the bill. However, if a data driven model is desired and/or needed, SIMPROCESS is fully equipped to interface with files, spreadsheets, and databases to create a powerful and flexible model.