Resource Queries
Resource queries read the state of a resource. Name the resource in quotes.
| Query | What it returns |
|---|---|
Resource("X").FreeUnits | Units currently free. |
Resource("X").Available | 1 if any unit is free, 0 if none. |
Resource("X").Utilization | Fraction of time in use, from 0 to 1. |
Resource("X").OnShift | 1 if the resource is on shift, 0 if off. |
Resource("X").Qty | Units of the resource the current entity holds. |
Resource("X").WaitCount | Entities waiting for the resource. |
Resource("X").DownQty | Units currently down. |
An example of each
Section titled “An example of each”Each line below is a complete piece of action logic, with a // note saying what it does.
Whether anyone is free, and how many:
// Hold the entity here until a doctor comes freeWAIT UNTIL Resource("Doctor").FreeUnits > 0
// Take the shortcut only when a specialist is free; Available is 1 or 0IF Resource("Specialist").Available = 1 THEN GET 1, Specialist ENDIFHow hard the resource is working, and whether it is on duty at all:
// Share of the run the doctors have been in use, from 0 to 1SET v_DoctorUse TO Resource("Doctor").Utilization
// Send work to the night desk only while its clerk is on shiftIF Resource("NightClerk").OnShift = 1 THEN ROUTE 1 ELSE ROUTE 2 ENDIF
// Note when a machine has units down for repairIF Resource("Machine").DownQty > 0 THEN DISPLAY "A machine unit is down" ENDIFWhat this entity holds, and who else is waiting:
// Units of Nurse this entity is holding right nowSET a_NursesHeld TO Resource("Nurse").Qty
// Call for a second window when the queue for the teller growsIF Resource("Teller").WaitCount > 5 THEN SIGNAL SEND "OpenWindow" ENDIFLegacyHow this worked in the previous version
FreeUnits() function
Section titled “FreeUnits() function”Returns the free units of an activity or resource (an integer).
Example
The example below demonstrates the use of the FREEUNITS() function to adjust the processing time for an entity based on the number of units of a resource available to process it. Once a Plane arrives at a passenger gate, it captures a certain number of resources named BH (Baggage Handlers). Operation logic at the gate determines how many BH resources have been captured and, accordingly, how long it will take to service the Plane. The more Baggage Handlers a Plane captures, the less time it takes to service it.
V0hJTEUgRlJFRVVOSVRTKEJIKSA8MwoJewoJRE8gVElNRSgyIG1pbikKCX0KSUYgRlJFRVVOSVRTKEJIKT49NSBUSEVOIHtHRVQgNSBCSH0KRUxTRQoJewoJR0VUIEZSRUVVTklUUyhCSCkgQkgKCVRJTUUoNjAvUkVTUVRZKEJIKSBtaW4pCgl9
ResQty() function
Section titled “ResQty() function”Returns the number of units of a specific resource that the current entity owns. You can use RESQTY() to determine the amount of time necessary to process an entity based on the number of units of a resource the entity owns.
Example
The example below demonstrates the use of RESQTY() to adjust the processing time for an entity based on the number of resources available to process it. Once a Plane arrives at a passenger gate, it captures a certain number of resources named BH (Baggage Handlers). Operation logic at the gate determines how many BH resources have been captured and, accordingly, how long it will take to service the Plane. The more Baggage Handlers a Plane captures, the less time it takes to service it.
SUYgRlJFRVVOSVRTKEJIKT49NSBUSEVOIHtHRVQgNSBCSH0KRUxTRQoJewoJR0VUIEZSRUVVTklUUyhCSCkgQkgKCX0KVElNRSg0NS9SRVNRVFkoQkgpIG1pbik=
Percent() function
Section titled “Percent() function”The percent function allows you to execute one or more statements only a certain percentage of the time. Used in an IF…THEN statement, the function returns a TRUE or FALSE.
To use the percent function, enter PERCENT(n) where n is the percentage of the time that the statement will return a TRUE condition in an IF…THEN statement.
Example
In the first example, logic following the THEN statement is executed 21.5% of the time. In the second, logic following the THEN statement is executed 35% of the time and the logic following the ELSE statement is executed 65% of the time.
MSkgSUYgUEVSQ0VOVCgyMS41KSBUSEVO4oCmCjIpIElGIFBFUkNFTlQoMzUpIFRIRU7igKYKRUxTReKApg==

