Skip to content

CREATE

Source of arrivals: creates parts, orders, customers or jobs at random intervals or on an hourly arrival schedule.

Either samples the inter-arrival gap from distribution (arrival_mode = "Interarrival", the classic behaviour) or drives a non-homogeneous Poisson process from an arrival Schedule by thinning (arrival_mode = "Schedule"). Every model needs at least one CREATE block.

Family: source. Python builder: m.create(...).

Typical uses

Use CREATE as the source of every flow: it creates the parts, orders, customers or jobs that enter the model. A model needs at least one CREATE. It can draw gaps from a distribution, follow an arrival schedule that changes over the day, or release a book of orders. To bring in material rather than entities, use a flow on a level.

Behaviour and rules

In the default mode Interarrival, the first arrival comes at start_time, with no gap before it. Each later gap is drawn from the distribution. A negative draw is cut to 0 and a warning is logged. A constant gap of 0 with unlimited arrivals is an error, because time could never advance.

max_arrivals counts arrival events, not entities. Each event creates entities_per_arrival entities. A value of 0 means unlimited. The e_type is stamped on every entity the block creates.

In the mode Schedule, arrivals follow the named arrival schedule as a random process whose rate changes with time. In a deterministic run, arrival number k comes when the schedule's accumulated rate reaches k. In the mode Orders, the block releases the orders assigned to it, each at its release time, and ignores the distribution, max_arrivals and entities_per_arrival. A release before start_time waits for it.

The sequence is a literal routing name that every entity starts at step 0. When population is set, each entity also gets a new agent in that population.

Ports

  • Inputs: none: a flow starts here.
  • Outputs: one outgoing link.

Parameters

Parameter Type Default Required Quantity Unit key Description
e_type str 'DEFAULT' Entity type assigned to every entity this block creates.
arrival_mode str 'Interarrival' "Interarrival": sample the gap from distribution. "Schedule": a non-homogeneous Poisson process driven by schedule_name. "Orders": release the model's declared orders, each at its own release time with its due date, quantity and routing.
schedule_name str '' Name of an arrival Schedule to drive from, when arrival_mode is "Schedule".
distribution str 'Constant' Name of a registered distribution (see the distribution reference).
dist_params dict {'value': 1.0} time time_unit Parameters for distribution, by name (e.g. {"rate": 0.5} for Exponential).
time_unit str 'base' Unit the sampled duration is expressed in: "base" (the model's own unit, no conversion) or one of seconds/minutes/hours/days.
entities_per_arrival int 1 count Number of entities created per arrival event.
max_arrivals int 0 count Number of arrival events before this block stops; 0 = unlimited.
start_time float 0 time start_time_unit Simulation time of the first possible arrival.
start_time_unit str 'base' Unit of start_time: "base" (the model's) or one of its quantity's units.
sequence str '' Name of a declared routing sequence: every entity created here starts it at step 0. Empty = no routing. It is a literal name, not an expression -- use an ASSIGN to entity.sequence when the routing depends on the entity.
population str '' Name of a declared population. When set, every entity created here also gets a new agent there (its statechart starts), and entity.agent points to it. Empty = off. A full population raises the same error a spawn action would.

Statistics

Every run fills system and entity_summary (see the KPI reference). The example below also fills:

Frame Columns
material_flow_summary Run, From, To, Entities

Problem codes

A check of the model reports these about this block:

Code Meaning
E_ARRIVAL_MODE A CREATE's arrival_mode is not a known one.
E_ARRIVAL_SCHEDULE A CREATE in Schedule mode needs a declared arrival schedule.
E_CREATE_NO_OUTPUT A CREATE block has no outgoing link.
E_CREATE_ZERO_INTERARRIVAL A CREATE block has a constant interarrival time of zero and unlimited arrivals, so simulation time could never advance.
E_INITIAL_ARRIVALS initial_state.arrivals does not give a CREATE block a count and a next time.
E_MESMAP_FEED An unknown feed, or a feed the model cannot take (no Orders-mode CREATE, no such process-time table, an override path that does not apply).
E_NO_CREATE The model has no CREATE block, so nothing ever arrives.
E_ORDER_SOURCE An order's source is not a CREATE block in "Orders" arrival mode.
E_SEQUENCE_UNKNOWN A CREATE or ASSIGN names a sequence the model does not declare.
W_CREATE_NO_ORDERS A CREATE block is in "Orders" mode but no order names it.
W_ORDERS_NOT_CONSUMED Orders are declared but no CREATE block is in "Orders" mode.
W_UNREACHABLE A block cannot be reached from any CREATE.

Example

The snippet seeds itself; its output is from a run made when this page was generated.

from nagasim import build as nb

m = nb.Model(time_limit=100)
m.create(distribution=nb.Exponential(rate=0.5), max_arrivals=20) >> m.dispose()

results = m.run(seed=1)
print(int(results.kpi("system/Total Entities Created")), "entities created")
print(int(results.kpi("system/Total Entities Completed")), "entities completed")
20 entities created
20 entities completed

Used in

Bundled models: Berth: shore power, Biogas plant (library assets), Emergency department: staffing game, Supply line: order-rate management game, Belt with stops, a divert and a merge, Hub day: electrifying the ground support equipment and 34 more.

Guides: Model file format, Digital twin, Event log to model, Entities and attributes, Coming from AnyLogic, Coming from SimPy and 47 more.

See also