Entity Properties
An entity property is a value carried by the entity that is currently being processed. Unlike an attribute, which you define yourself, these are built in and always available.
| Property | What it returns |
|---|---|
Entity.Age | Time since the entity was created, in minutes. |
Entity.TimeSinceEntry | Time since it entered the current activity. |
Entity.TotalCost | Cost accumulated so far. |
Entity.VATime | Minutes spent at value-added activities. |
Entity.NVATime | Minutes spent at non-value-added activities and in queues. |
Entity.RNVATime | Minutes spent at required non-value-added activities. |
Entity.TypeName | The entity’s type, for example "Order". |
Entity.Name | Its name, including any set with NEWNAME. |
Entity.Id | Its unique number (also available as the bare Id). |
Entity.GroupQty | How many entities the current group holds. An entity travelling on its own is a group of one, so this is never 0. |
Entity.HeldResourceCount | How many resource units it currently holds. |
Entity.HeldResourceName() | The name of a resource it holds (see below). |
Entity.TypeName and Entity.Name are text, so compare them with quotes: IF Entity.TypeName = "Rush" THEN .... The value-added timers (VATime, NVATime, RNVATime) can also be set, to start an entity as though it had already spent time in the model.
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.
How long the entity has been around:
// Minutes since this entity was createdSET a_AgeNow TO Entity.Age
// Minutes since it entered the activity it is in nowIF Entity.TimeSinceEntry > 30 THEN DISPLAY "Held here over half an hour" ENDIFWhat it has cost, and where that time went:
// Cost the entity has picked up so farSET v_RunningCost TO Entity.TotalCost
// Split its time three ways for a value-stream summarySET a_Value TO Entity.VATimeSET a_Waste TO Entity.NVATimeSET a_Needed TO Entity.RNVATimeWhich entity this is:
// Branch on the entity type; TypeName is text, so quote the comparisonIF Entity.TypeName = "Rush" THEN GET 1, Expert ENDIF
// Its current name, which NEWNAME may have changed along the wayIF Entity.Name = "Job_7" THEN DISPLAY "Job 7 reached inspection" ENDIF
// Its unique number, the reliable way to trace one entity through a runDISPLAY "Now at inspection: {Entity.Id}"
// Entities in the group, so a check can take longer for a bigger batch; 1 on its ownSET a_BatchSize TO Entity.GroupQtyThe resource an entity holds
Section titled “The resource an entity holds”Two properties read what the entity is currently holding:
// How many resource units it holds at this momentSET a_Held TO Entity.HeldResourceCount
// The name of the one it captured most recently, handed straight to a FREEFREE Entity.HeldResourceName()Entity.HeldResourceName() comes in two forms:
| Form | Which resource it names |
|---|---|
Entity.HeldResourceName() | The one captured most recently. |
Entity.HeldResourceName(n) | The nth by how long it has been held: (1) is the longest-held, (2) the next, and so on up to Entity.HeldResourceCount. |
// Release the resource it has held longest, keeping the restFREE Entity.HeldResourceName(1)Both forms hand back empty text when there is no resource to name: when the entity is holding nothing at all, and when n is past Entity.HeldResourceCount. Read the count first whenever the logic that follows depends on getting a name back:
// Only free a resource when the entity is actually holding oneIF Entity.HeldResourceCount > 0 THEN FREE Entity.HeldResourceName() ENDIFThis replaces the old OwnedResource() function from earlier versions.
LegacyHow this worked in the previous version
GroupQty() function
Section titled “GroupQty() function”Returns the number of entities in a batched or loaded entity (a loaded entity is an entity with other entities attached to it). If the entity is a loaded entity, it will return only the number of loaded entities, not the base entity. For example, if you attach four Castings to a Pallet, the GroupQty() will return the number of Castings (i.e. 4), which does not include the entity Pallet.
In the case of multiple levels of groups and loads, GroupQty() returns the number of entities in the uppermost level only.
Example
A group of documents called Folder arrives at the Secretary in-box and is processed for some amount of time according to the number of documents in the folder. Each document takes 3.0 minutes to process.
VElNRSAoR1JPVVBRVFkoKSAqMy4wIG1pbik=
[
Functions
](/help/functions/)
OwnedResource() function
Section titled “OwnedResource() function”Returns the n th resource currently being used by the entity. Each resource is referenced according to the order it was put into use so that the longest held resource is OwnedResource(1). The most recently captured resource can be referenced by omitting the number: OwnedResource().
Example
The **OwnedResource() **function is useful when a decision must be made based on the resource that was captured. For example, suppose an entity captures either Worker_1 or Worker_2 in order to perform an activity. If Worker_1 is used, the activity takes 5 minutes. If Worker_2 is used, the activity takes 6.5 minutes. This can be defined using the following Action logic.
R0VUIFdvcmtlcl8xIE9SIFdvcmtlcl8yCklGIE9XTkVEUkVTT1VSQ0UoKSA9IFdvcmtlcl8xIFRIRU4ge1RJTUUoNS4wIG1pbil9CkVMU0Uge1RJTUUoNi41IG1pbil9CkZSRUUgT1dORURSRVNPVVJDRSgp
- This function cannot be assigned a resource name in Action logic. For example, an assignment statement like OwnedResource() = Worker_1 will generate an error.
Functions
](/help/functions/)

