des Discrete-Event Components
Process-oriented discrete-event simulation: entities are created by sources, wait in queues, are processed by servers, travel through delays, branch at routers, and leave through sinks. Time advances event to event on the shared kernel clock.
Generated from spec/libraries/des.library.json · library version 0.1.0 · OSDL 0.1
des.source SourceFlow#
Creates entities at stochastic or deterministic intervals and sends them through out. Stops after limit entities if set.
Ports
| Port | Direction | Description |
out |
out |
Newly created entities leave here. |
Parameters
| Param | Type | Description |
interarrivalrequired |
numericValue |
Time between consecutive entity creations, in model time units. Negative sampled durations are treated as 0. |
entityType |
string |
Type label stamped on created entities; defaults to the component id. |
limit |
integer |
Maximum number of entities to create. Unlimited if omitted. min 1 |
Observable state
| State | Type | Description |
count |
integer |
Entities created so far. |
held |
integer |
1 while a created entity is blocked waiting for the downstream component to accept it (the arrival process is paused), else 0. |
Emitted events
| Event | Description |
entity.created |
Emitted for every entity this source creates. |
des.queue QueueFlow#
Holds entities until the downstream component accepts them. Ordering follows discipline; with priority, the expression is evaluated per entity and higher values dequeue first. If capacity is set and the queue is full, an arrival on in is blocked and stays in kernel escrow with custody at the sender; the queue reports readiness for in once a place frees, and the kernel redelivers the blocked arrivals oldest first.
Ports
| Port | Direction | Description |
in |
in multiple |
Entities enter the queue here. |
out |
out |
Entities leave toward the downstream component when it accepts them. |
Parameters
| Param | Type | Description |
discipline |
"fifo" | "lifo" | "priority" |
Queueing policy for release order. fifo sends oldest first, lifo sends most recent first, priority uses priority values. default "fifo" · "fifo" | "lifo" | "priority" |
capacity |
integer |
Maximum entities held. Unbounded if omitted. min 1 |
priority |
expressionString |
Expression evaluated per entity when discipline is priority; higher values dequeue first. |
Observable state
| State | Type | Description |
length |
integer |
Number of entities currently waiting. |
waitTime |
number |
Waiting time of the most recently dequeued entity, in model time units. |
des.server ServerFlow#
Processes up to capacity entities concurrently, each occupying the server for serviceTime. It accepts an arrival on in while a service slot is free and blocks it otherwise, reporting readiness for in when a slot frees; it releases entities through out when service completes. capacity may be an expression, so processing capacity can be driven by other components (e.g. a system-dynamics variable) and is re-evaluated as the model evolves.
Ports
| Port | Direction | Description |
in |
in multiple |
Entities enter service here when capacity is available. |
out |
out |
Entities leave here when their service completes. |
Parameters
| Param | Type | Description |
serviceTimerequired |
numericValue |
Time an entity occupies one unit of capacity, sampled per entity. Negative sampled durations are treated as 0. |
capacity |
scalarValue |
Concurrent service slots. Non-integer values are truncated; values below 1 are treated as 1. default 1 |
Observable state
| State | Type | Description |
busy |
integer |
Entities currently in service. |
utilization |
number |
Time-weighted fraction of capacity in use since the start of recording, in [0, 1]. |
held |
integer |
Entities that finished service but are blocked waiting for the downstream component to accept them. |
des.delay DelayFlow#
Holds each entity for duration, with unlimited concurrency, then releases it. Models travel or processing time that has no capacity constraint.
Ports
| Port | Direction | Description |
in |
in multiple |
Entities enter the delay here. |
out |
out |
Entities leave here after their delay elapses. |
Parameters
| Param | Type | Description |
durationrequired |
numericValue |
Holding time, sampled per entity. Negative sampled durations are treated as 0. |
Observable state
| State | Type | Description |
inTransit |
integer |
Entities currently inside the delay. |
des.router RouterFlow#
Forwards each arriving entity to exactly one of its outgoing connections, chosen by policy. random uses weights if given (matched to outgoing connections in document order, defaulting to uniform); conditional evaluates conditions in document order against the outgoing connections and takes the first that holds, falling back to the last connection if none do; roundRobin cycles; shortestQueue picks the destination reporting the smallest length state.
Ports
| Port | Direction | Description |
in |
in multiple |
Entities to be routed. |
out |
out multiple |
One outgoing connection per destination; selection per entity follows the routing policy. |
Parameters
| Param | Type | Description |
policy |
"random" | "roundRobin" | "shortestQueue" | "conditional" |
Outgoing path selection policy. Use random, roundRobin, or shortestQueue for deterministic policies, or conditional for rule matching in document order. default "random" · "random" | "roundRobin" | "shortestQueue" | "conditional" |
weights |
array<number> |
Relative weights for random routing, one per outgoing connection in document order. |
conditions |
array<expressionString> |
Boolean expressions for conditional routing, one per outgoing connection in document order. |
Observable state
| State | Type | Description |
count |
integer |
Entities routed so far. |
held |
integer |
Entities buffered inside the router, including one whose delivery is in flight or blocked. |
des.sink SinkFlow#
Absorbs and disposes entities, ending their journey through the model.
Ports
| Port | Direction | Description |
in |
in multiple |
Entities to dispose. |
Parameters
None.
Observable state
| State | Type | Description |
count |
integer |
Entities disposed so far. |
Emitted events
| Event | Description |
entity.disposed |
Emitted for every entity this sink absorbs. |