April:
Newsletter Home  I ProModel Home Product/Support News  I Featured Story  I Tips and Techniques

Tips and Techniques

ProModel MedModel ServiceModel Tip


Tip: How Can I Decrease the Time Required
to Import Array Data from Excel?

Many customers use arrays to import their data from Excel. ProModel imports array data at the start of every replication and every scenario every time the simulation is run. You may have noticed that when importing data to multiple arrays in ProModel, the process of importing data can take a long time. Here is a way to speed up the array import process:

1. After setting up all of your different array data in various worksheets in Excel, link all of the data to a single hidden Excel sheet.
2. Create a new array in ProModel that is large enough to comprehend all of the individual arrays you would like to import.
3. Turn off the Import File data for all of the arrays except for the global array that will contain all of the other arrays. Set up this array so that it imports from the hidden Excel sheet that has references to all of the other Excel sheets where your individual array data is contained.
4. Create a subroutine, let’s call it sFillArrays, with logic like the logic provided below.
5. In your initialization logic (Build > General Information > Initialization Logic) add the following line:

ACTIVATE sFillArrays

The code below works in conjunction with the attached Excel spreadsheet which represents the hidden spreadsheet in Excel:

INT i, j // i = individual array rows, j = individual array columns
INT x, y // x = yAllData rows, y = yAllData columns

//populate yResourceJob1 array, a 10x2 array
WHILE j < 2 DO
{
INC j
INC y
i = 1
x = 4 //starting row in Excel spreadsheet
WHILE i <= 10 DO
{
yResourceJob1[i,j] = yAllData[x,y]
INC i
INC x
}
}

//populate yResourceJob2 array, a 40x2 array
j = 1
y = 1
WHILE j <= 2 DO
{
i = 1
x = 17 //starting row in Excel spreadsheet

WHILE i <= 40 DO
{
yResourceJob2[i,j] = yAllData[x,y]
INC i
INC x
}
INC j
INC y
}

//populate yEventEnable array, a 10x12 array
j = 1
y = 1
WHILE j <= 12 DO
{
i = 1
x = 59 //starting row in Excel spreadsheet

WHILE i <= 10 DO
{
yEventEnable[i,j] = yAllData[x,y]
INC i
INC x
}
INC j
INC y
}

//populate yTimeEnable arrays, a 40x12 array
j = 1
y = 1
WHILE j <= 12 DO
{
i = 1
x = 71
WHILE i <= 40 DO
{
yTimeEnable[i,j] = yAllData[x,y]
INC i
INC x
}
INC j
INC y
}

//populate yTimeOnOff array, a 40x12 array
j = 1
y = 1
WHILE j <= 12 DO
{
i = 1
x = 113

WHILE i <= 40 DO
{
yTimeOnOff[i,j] = yAllData[x,y]
INC i
INC x

INC j
INC y
}

//Populate yJob1 array, a 10x1 array
i = 1
x = 4
WHILE i <= 10 DO
{
yEventJobs[i] = yAllData[x,4]
INC i
INC x
}

//Populate yJob2 array, a 40x1 array
i = 1
x = 4
WHILE i <= 40 DO
{
yTimeJobs[i] = yAllData[x,6]
INC i
INC x
}

//populate yShutDown array, a 12x1 array
i = 1
x = 16
WHILE i <= 12 DO
{
yShutDown[i] = yAllData[x,4]
INC i
INC x
}

Sample Excel Spreadsheet

 

Process Simulator Tip


Tip: How can I increment a variable by the cost of an entity?

1. Create a local variable, let's say it's called lvCost.

2. Use the Assignment tool to assign lvCost = GetCost(). You can find GetCost() in the System Functions.

3. Use the Increment tool to add lvCost to the variable that you want to hold the cost. INC vEntCost, lvCost.

Technique: A single entity (Order) comes into my system and generates several different entities which flow through the system and must be integrated back together later on. How do I model this in Process Simulator?

The Visio flowchart file below demonstrates how this can be done.

Visio File