Skip to content

data_bindings

Which column, filtered and transformed how, feeds which override path.

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

Typical uses

These sections connect a model to data. data_sources declare where data lives: a CSV or Excel file, a database, a web address, or a live plant connection. data_bindings read a column from a source, reduce it, and write the result into a model parameter. initial_state starts a run from a snapshot of a real system instead of an empty one.

Behaviour and rules

A binding names a source, a column, an optional filter and a transform, such as mean, last, table or fit. Its target is an override path such as resources.Nurse.capacity. A binding whose target does not exist is an error. A disabled binding leaves the parameter at its file value. A filter holds comparisons only, never code.

A model never holds an address or a credential. For a live source, connection names an entry in the connections file of whoever runs the model. A file path is relative to the model file. Network access, redirects and the size of what is read are limited, and the caller, not the file, decides whether the network may be used.

An initial_state places entities in blocks, sets variables, levels and resource states, and sets the clock. Statistics then cover the run from that clock, as after a warm-up of that length. A state that names a block the model does not have is an error. The schedule_offset makes a mid-shift start resume the shift.

Fields

Field Type Required Default Unit Description
name string yes The binding's name.
source string yes The name of the data source to read.
column string The column (or field) to read from the source.
filter object {"column": value} or {"column >=": value}; comparisons only, never code.
transform string yes One of mean, median, last, sum, count, value, fit, empirical, orders, or quantile:<argument>, rate_per:<argument>, arrival_schedule:<argument>, table:<argument>, series:<argument>.
target string yes An override path, e.g. "resources.Nurse.capacity".
map object "orders" transform only: {order field: source column} for any field whose column is not already named after it.
enabled boolean true When false the binding is skipped and the parameter keeps its file value.
description string What the binding sets; the run does not read it.

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

Example

The fragment refers to entries that are defined elsewhere in the same file:

{"data_sources": [{"name": "Arrivals", "kind": "csv", "location": "arrivals.csv"}], "resources": [{"name": "Server", "capacity": 1}]}

The fragment:

{"data_bindings": [{"name": "Server count", "source": "Arrivals", "column": "servers", "transform": "last", "target": "resources.Server.capacity"}]}

In the Python builder:

from nagasim import build as nb
m = nb.Model()
m.add_data_binding(name='Server count', source='Arrivals', column='servers', transform='last', target='resources.Server.capacity')

Used in

Bundled models: Berth: shore power, Hub day: electrifying the ground support equipment, Container terminal: electrification, Container terminal: quay to yard, Hub day: turnaround workload (crews, ground equipment, on-time departures), Walk-in clinic digital twin.

Guides: Model file format, Digital twin, Semantic diff.

See also