Skip to content

Activity Queries

Activity queries read how full an activity is right now. Name the activity in quotes, then the value you want.

QueryWhat it returns
Activity('X').ContentsEntities currently inside the activity.
Activity('X').CapIts capacity (0 means unlimited).
Activity('X').FreeCapFree capacity remaining.
Activity('X').QueueLengthEntities waiting in its input queue.
Activity('X').QueueTimeAverage time entities wait there.
Activity('X').ThroughputHow many have passed through.
Activity('X').BatchCountBatches waiting to form, at a batching activity.

The input and output queues have their own capacity readings: CapInq, FreeCapInq, CapOutq, and FreeCapOutq.

Hold an entity until the next activity has room:

WAIT UNTIL Activity('Paint').FreeCap > 0

Send work to whichever line is emptier:

IF Activity('Line1').Contents < Activity('Line2').Contents THEN ROUTE 1 ELSE ROUTE 2 ENDIF
LegacyHow this worked in the previous version

Returns the total number of entities at an activity. Use CONTENTS(name of activity) to make decisions based on how busy an activity is. Using CONTENTS() to keep track of the number of entities at an activity requires fewer steps and allows more flexibility than using variables to count the number of entities that enter and exit an activity. For example, the second syntax does in one statement what would require several statements without the CONTENTS() function.

Example

A car wash has an activity called Wash that often gets too busy for one operator to handle so the supervisor then comes to help. The logic below models this situation with an IF…THEN statement and the CONTENTS() function. As long as the activity contains fewer than three cars, the worker processes any arriving car. However, if the contents of the activity are greater than three, the Supervisor may also be used.

SUYgQ09OVEVOVFMoV2FzaCkKCXsKCUdFVCBXb3JrZXIKCX0KRUxTRQoJewoJR0VUIFdvcmtlciBPUiBTdXBlcnZpc29yCgl9

[

Functions

](/help/functions/)

Returns the available capacity of an activity (an integer).

Example

Suppose an entity can be routed to one of two identical ovens for a curing process. However, you would like to ensure the ovens are loaded as evenly as possible at all times. The following logic could be used to set an attribute (called a_Router) to a 1 or a 2 based on the available capacity of the ovens. Conditional routings would then be used to route to the appropriate oven:

SUYgRlJFRUNBUChPdmVuMSkgPiBGUkVFQ0FQKE92ZW4yKSBUSEVOCgl7CglhX1JvdXRlcj0xCgl9CkVMU0UKCXsKCWFfUm91dGVyPTIKCX0=

Functions

](/help/functions/)