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. It moves with the parts, as described below. |
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. After NEWNAME it is the name of the entity type the entity was renamed to. |
Entity.Id | Its unique number (also available as the bare Id). |
Entity.GroupQty | How many entities the current group holds. An entity traveling 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.CycleStart | The time the entity was created, in minutes. You can set it. |
Entity.Priority | The priority its resource requests carry when they name none. Higher is more urgent. You can set it. |
Entity.Capacity | How many children it can carry, 0 for no limit. You can set it. |
Entity.LoadedCount | How many children it is carrying now. |
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.
Entity.TotalCost moves with the parts. A part loaded by an attach route set to Keep, or by a pickup route, reads 0, because its cost is now in the entity carrying it. When the parts are detached, each one reads an equal share of what the carrier holds. An unbatch leaves the batch container at 0 and shares its cost over the members.
Setting a property
Section titled “Setting a property”Entity.Priority, Entity.CycleStart and Entity.Capacity can be set, as the value-added timers can, with SET Entity.Priority TO 5 or Entity.Priority = 5.
Entity.Priorityis the priority the entity’s requests for a resource carry when the request, from aGETor a connection, names none of its own. Higher is more urgent. It is read when the request is made, so setting it does not reorder a wait the entity is already in.Entity.CycleStartis the time the entity was created, in minutes. Setting it moves the starting point ofEntity.Ageand of the entity’s time in the model, soClock() - Entity.CycleStartalways equalsEntity.Age.Entity.Capacityis the entity’s carrying capacity, set here for one entity (see Carrying capacity). It is rounded to a whole number and cannot go below 0.Entity.LoadedCountreads how many children the entity carries after an attach route set to Keep. It cannot be set, and neither canEntity.Id,Entity.NameorEntity.TypeName: setting one gives a warning.
An example of each
Section titled “An example of each”Each example 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, ExpertENDIF
// Its current name, which NEWNAME may have changed along the wayIF Entity.Name = "Expedited" THEN DISPLAY "An expedited entity 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()ENDIFUse Entity.HeldResourceName() whenever your logic needs the name of a resource the entity is holding.
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/)

