Home > System Defined Functions Reference > Simulation Functions

Simulation Functions

Function

Description

Syntax

ArrayInit

Sets all of the elements of the one- and two-dimensional arrays associated with AttributeName to Value, and returns Value as a result. Value can be of type numeric or string.

Example

ArrayInit(T.x, -1) initializes all of the elements of both the one- and two-dimensional arrays of T.x to -1.

ArrayInit(AttributeName[, Value = 0])

ArrayInitFromSheet

Returns the cell ID of the bottom right cell of the effective range; that is, the actual range of data that are used to set the attribute array is returned.

For complete documentation, see ArrayInitFromSheet in the System Defined Functions Addendum.

ArrayInitFromSheet( AttributeName,
SheetName [,
RangeName or CellID = “A1” [,
RowHeadings = False [,
ColumnHeadings = False [,
RowData = False ] ] ] ] )

ArrayStoreToSheet

Returns the cell ID of the bottom right cell of the stored data block.

For complete documentation, see ArrayStoreToSheet in the System Defined Functions Addendum.

ArrayStoreToSheet( AttributeName,
SheetName [,
RangeName or CellID = “A1” [,
RowHeadings = False [,
ColumnHeadings = False [,
RowData = False ] ] ] ] )

BatchAttrVal

Returns the value of the named attribute of the batched transactions. The value of the second parameter is:

1–Total
2–Max
3–Min
4–Average
5–Standard Deviation

Any value other than 1 through 5 throws an error and terminates the simulation run.

For example, if you had three transactions batched together with an attribute Attr that had value 1 for the first, 2 for the second, and 3 for the third, then BatchAttrVal(Attr,1) would return 6 (1 + 2 + 3) and BatchAttrVal(Attr,4) would return 2 (the average of the three values).

If you have a batch of batched transactions, a third parameter indicates the number of layers you want to descend. If this Depth parameter is omitted, only the first level of the batch is included. For example, if you have three batches of batched transactions and you want to find the minimum transaction value of the first two levels of batches, you would use BatchAttrVal(Attr,3,2).

BatchAttrVal(Attr,Number,Number)

BatchCount

Returns the number of transactions in the calling batch transaction. If the calling transaction is not a batch, it returns 0.

A batch transaction can batch other batch transactions. Depth indicates how many batch layers are counted. Depth is optional. If it is omitted (same as 0), only the first batch layer is counted.

BatchCount([Depth])

BatchTypeCount

Returns the number of transactions in the batch for which the attribute named has the value given. For instance, if you have a Type called ColorValue with member values Red, Blue and Green and a transaction attribute named Color of that type, then BatchTypeCount(Color, Red) would return the number of transactions in the batch for which Color has the value Red.

If the transaction the function is called on is not a batch transaction, the function returns 0.0.

The Depth parameter can control how deep in the batch transaction hierarchy the function is evaluated. Its default value is 0, which means only the topmost batch is considered. Other values only affect the result if the batch transaction contains other batch transactions.

BatchTypeCount(Attribute_Name, Member_Value, [Depth])

CellID

Return Value:

Function returns the cell ID of the cell at given row number and column number.

Cell ID is the identification of a cell, e.g. “A1”, “C12”, and etc. Alphabet characters are for column ID and must be upper cases. The numeric part is for row number. No zero or space is allowed in between column ID and row number. For examples, “A 12" and “A01” are invalid. The valid cell ID is from “A1” to “ZZ65535”.

Argument:

Row and Column are integers. They are the row and column numbers of the specific cell.

CellID(Row,Column)

CellRow

CellColumn

Return Value:

Function CellRow() returns the row number of the given cell ID. For example: “C2” returns 2; “K23” returns 23. The valid row number in Basic Sheet is from 1 to 65535.

Function CellColumn() returns the column number of the given Cell ID. For example: “C2” returns 3; “K23” returns 11. The valid column ID in Basic Sheet starts from “A” to “ZZ”. That is from “A” to “Z”, then “AA”, “AB”,”AC”, … to “AZ”. It then becomes “BA”, “BB”, “BC”, … to “BZ”. The column ID goes all the way to “ZX”, “ZY”, to “ZZ”.

Argument:

CellID is a string in double quotes. It is the identification of a cell, e.g. “A1”, “C12”, and etc. The valid cell ID is from “A1” to “ZZ65535”.

CellRow(CellID)

CellColumn(CellID)

Cost

Returns the costs accumulated on a transaction in the different cost categories. The cost is calculated up to the point in time in the simulation when the function is called. A value of zero returns all cost categories.

Value

1 = Value Added
2 = Business Value Added
3 = Value Added + Business Value Added
4 = No Value Added
5 = Value Added + No Value Added
6 = Business Value Added + No Value Added
7 = Value Added + Business Value Added + No Value Added (same as using 0)

Labor/Equipment/Other

1 = Labor
2 = Equipment
3 = Labor +Equipment
4 = Other
5 = Labor + Other
6 = Equipment + Other
7 = Labor + Equipment + Other (same as using 0)

Standard/Overtime

1= Standard cost (non-overtime)
2 = Overtime
3 = Standard + Overtime (same as using 0)

For example, Cost(0,0,0) returns total costs in all categories. Cost(1,1,2) returns value-added, overtime labor costs. Cost(4,0,0) returns non-value added costs.

Cost(Value,Labor/Equipment/Other, Standard/Overtime)

CustomData

Returns the value of the specified Custom Data definition within an activity. The following examples refer to the LoadCustomData example:

CustomData("Temperature") within the activity Kitchen returns 32.

CustomData("Temperature", S.Room["Bedroom"]) within any activity returns 72.

CustomData(Definition[,ActivityID])

CurrentDateTime

Returns the current simulation time in a string formatted with date and time as shown in the Simulation Progress window. For example:

“Monday 9:38:02.123456 AM”

“1/29/2009 Thursday 10:27:08.123456 AM”

If the simulation is not in calendar mode, then it returns simulation elapsed time in a string formatted as shown in the Simulation Progress window. For example:

“2h 36m 58.123456s”

“1y 2m 6d 5h 12m 8.123456s”

CurrentDateTime()

DeptId

Returns the current swimlane path at the point of the current transaction.

DeptId()

ElapsedTime

Returns the amount of time that has elapsed since the start of the simulation, in seconds. For example, ElapsedTime() after four hours of simulation = 14400.

ElapsedTime()

LoadCustomData

Reads the values of a Custom Data definition into an array so you can index the values by activity ID.

First, if DefaultValue is specified, do an ArrayInit(AttributeName, DefaultValue). Then, for each activity with an activity ID <a> that has a value <v> for the Custom Data definition DefinitionName, AttributeName[<a>] = <v>. The function then returns the number of activities that had a value as a numeric result.

Example

LoadCustomData(S.Temperature, "Temperature", "n/a") is used to initialize the scenario attribute S.Temperature within the Define Attributes dialog box.

The process diagram has a Custom Data definition Temperature that is of type numeric. The following three activities within the diagram have the following values for Temperature:

  • Activity1 Temperature is 32

  • Activity2 Temperature is undefined

  • Activity3 Temperature is 72

Once the LoadCustomData function has executed, S.Temperature[ActId()] returns 32 within Activity1, "n/a" within Activity2, and 72 within Activity3. The function returns the value 2, which is the number of activities that have a value for Temperature.

LoadCustomData(AttributeName, DefinitionName[, DefaultValue])

LoadCustomDataIndex

Reads the values of a Custom Data definition into an array so you can index the activity IDs by value. This lets you use a Custom Data definition as a label so you can obtain the activity ID of one activity from another activity.

For each activity with an activity id <a> that has a value <v> for the Custom Data definition DefinitionName, AttributeName[<v>] = <a>. An error is reported if more than one activity has the same value. The function then returns the number of activities that had a value as a numeric result.

Example

LoadCustomDataIndex(S.Room, "Room") is used to initialize the S.Room attribute within the Define Attributes dialog box. Following on the LoadCustomData example, let’s say there is also a Custom Data definition Room which is of type Text, and that:

  • On Activity1, the value of Room is "Kitchen"

  • On Activity2, the value of Room is "Attic"

  • On Activity3, the value of Room is "Bedroom"

Once the LoadCustomDataIndex function has executed:

  • S.Temperature[S.Room["Kitchen"]] = 32

  • S.Temperature[S.Room[""Attic""]] = "n/a"

  • S.Temperature[S.Room["Bedroom"]] = 72

LoadCustomDataIndex returns a value of 3, which is the number of activities that have a value for Room.

LoadCustomDataIndex(AttributeName,DefinitionName)

ParentActId

Returns the parent activity ID of the calling transaction. If the transaction is at the topmost process, this function returns 0.

ParentActId()

ProcId

Returns the process ID of the current process during a simulation as a numeric result.

ProcId()

SheetGetValue

SheetName is the name of a Basic Sheet in double quotes. It must exist, i.e. must be a component of the active document.

RangeName or CellID (String, default value is “A1”). It is either the name of a defined Named Range in SheetName or a cell ID (for example, “C3” or “E12”). These two can share the same field of this function because a Sheet does not allow a range name that is in conflict with cell ID. Refer to function CellID() for details on cell ID.

If CellID is provided, value in that cell is returned. If RangeName is provided, the value in the cell at top left corner of this range is returned.

SheetGetValue( SheetName, CellID or RangeName )

SheetPutValue

Value is the value to be stored into the specified CellID or RangeName.

SheetName is the name of a Basic Sheet in double quotes. It must exist, i.e. must be a component of the active document.

RangeName or CellID (String, no default value; it must be provided). It is either the name of a defined Named Range in SheetName or a cell ID (for example, “C3” or “E12”). Refer to function CellID() for details on cell ID.

If CellID is provided, value is placed in that cell. If RangeName is provided, the value is placed in the cell at top left corner of this range.

Returns the CellID where the value was stored.

Note: If you need to store more than one value from an array all at once, see the ArrayStoreToSheet function.

SheetPutValue( Value, SheetName, CellID or RangeName )

Time

Returns the amount of time that has accumulated on a transaction, in different categories, since the start of the simulation. The time is given in seconds with 0 = Cycle time,1 = Work time, 2 = Resource wait time, 3 = Blocked time, and 4 = Inactive time. For example, if ten minutes of inactive time has accumulated, Time(4) returns 600.

Time(Timetype)

TransCountAtAct

Returns the number of transactions currently at the specified activity. If the parameter activity ID is omitted, it returns the number of transactions at the current activity (that is, the activity from where the transaction is currently calling).

TransCountAtAct([activity_ID])

TransId

Returns the ID of the calling transaction.

Every transaction has a unique integer number as ID. This number is assigned by the system on the creation of a transaction, starting from 1.

TransId()

TransServiceTime

Returns the accumulated service time of a transaction up until the point that the function is evaluated. This does not include the duration on the current activity if it is evaluated as Attribute Settings Before Duration.

TransServiceTime()

TransWaitingTime

Returns the accumulated waiting time of a transaction up until the point that the function is evaluated. This does not include the duration on the current activity if it is evaluated as Attribute Settings Before Duration.

TransWaitingTime()

Related Topics

System Defined Functions Reference