Skip to content

entities

Entity types: shape, colour, optional size and WIP holding cost.

In the model file this key holds a list of entity entries, each named by its name.

Typical uses

These sections hold the values that expressions read. variables are numbers that a model changes while it runs. tables are fixed lookups by one or two keys. timeseries_inputs are profiles over time, such as a tariff or a demand curve. entities describe the entity types: how they look and what holding them costs.

Behaviour and rules

A variable is read as a bare name in an expression and written by an ASSIGN block. Its initial value is restored at the start of every replication. A table is read with TABLE("name", key) or with two keys for a 2-D table. The key_mode decides what happens between keys: exact, step or linear. A missing exact key is a run-time error unless the table has a default.

A time series is read with TS("name") for now, or with a second argument for another time. Its interpolation is step by default, which is exact for a rate. Past the last sample, beyond decides whether the last value holds, the series repeats, or the run stops with an error. Sample times must increase.

An entity type is named by the e_type of a CREATE block. A holding_cost charges each entity for the time it spends in the system, from its creation to its disposal, and only time after the warm-up counts.

Fields

Field Type Required Default Unit Description
name string yes The entity type's name, the e_type a CREATE block gives its entities.
shape string The shape the editor draws for these entities, such as "circle".
color string The colour the editor draws these entities in, as a hex string such as "#1f77b4".
icon string Path to an animation icon image.
graphic string Inline SVG token (24 x 24 artboard), usually copied from a library's entity preset; checked by core/svgsafe before it is drawn.
size object Item size on a conveyor, in the model's length unit (simulation.length_unit); on a typed belt an item takes ceil((length + gap) / cell) cells.
holding_cost number 0.0 rate (holding_cost_time_unit) WIP cost per entity per base time unit.
holding_cost_time_unit choice "base" Unit holding_cost is per. One of base, milliseconds, seconds, minutes, hours, days, weeks, months, years.

A field of a nested object is described in the JSON Schema (naga schema).

Example

{"entities": [{"name": "Order", "shape": "square", "color": "#1f77b4"}]}

In the Python builder:

from nagasim import build as nb
m = nb.Model()
m.add_entity(name='Order', shape='square', color='#1f77b4')

Used in

Bundled models: Berth: shore power, Biogas plant (library assets), Emergency department: staffing game, Supply line: order-rate management game, Hub day: electrifying the ground support equipment, Container terminal: electrification and 32 more.

Guides: Digital twin, Model file format, Entities and attributes, Semantic diff.

See also