conversions¶
Delayed conversions with a yield curve: feed in, product released over the following hours or days.
In the model file this key holds a list of conversion entries, each named by its name.
A scenario, an experiment or an optimizer can set a field by the path conversions.<name>.<field>.
Typical uses¶
These sections model quantities that change continuously: a tank, a battery, a stock, an energy bus. A level is the quantity with its bounds. A flow moves it at a rate. A conversion turns a feed into a product that is released later, such as biogas from feedstock. Use them when counting entities is the wrong view.
Behaviour and rules¶
A flow rate is an expression that is re-evaluated only at events, so it is constant between them. Every level is then a straight line between events, and the engine solves for the instant a level reaches a bound or a threshold. There is no fixed time step unless simulation.sd asks for one.
The engine enforces the bounds. A level at its min passes on no more than flows into it, and a full level scales its inflows down. What is lost is recorded as unmet for demand not served and as spilled for overflow. A rate needs no guard for an empty level. A negative rate is clamped to 0 unless the flow is a biflow.
A price is money per unit moved and an emission_factor is an impact per unit. Both are integrated exactly. A peak_price is a demand charge, billed once at the end of the run. A flow with a tag is summed by FLOWSUM("tag"), which is how many assets share one site bus.
A TRANSFER block moves a lump between an entity and a level. A conversion releases its product after a delay that follows a yield curve, in cohorts closed every cohort_interval.
Fields¶
| Field | Type | Required | Default | Unit | Description |
|---|---|---|---|---|---|
name |
string | yes | The conversion's name. | ||
description |
string | What the conversion stands for; the run does not read it. | |||
unit |
string | Label for the product, e.g. Nm3. | |||
cohort_interval |
number | 1.0 |
time (time_unit) |
Feed accumulated over this interval closes into one cohort and releases from its CLOSE, so the mean delay is longer by up to half an interval. Curve knots round onto the same grid. | |
time_unit |
choice | "base" |
Unit the cohort interval and the curve ages are in. One of base, milliseconds, seconds, minutes, hours, days, weeks, months, years. |
||
substrates |
list of object | yes | The feeds that go in, each with its own rate and yield curve. | ||
locals |
object | Submodel parameter bindings, written by flattening; not authored by hand. |
A field of a nested object is described in the JSON Schema (naga schema).
Example¶
{"conversions": [{"name": "Digestion", "cohort_interval": 24, "time_unit": "hours", "substrates": [{"name": "Maize", "feed": "10", "yield": 200, "curve": [[12, 0.3], [24, 0.7], [48, 1.0]]}]}]}
In the Python builder:
from nagasim import build as nb
m = nb.Model()
m.add_conversion(name='Digestion', cohort_interval=24, time_unit='hours', substrates=[{'name': 'Maize', 'feed': '10', 'yield': 200, 'curve': [[12, 0.3], [24, 0.7], [48, 1.0]]}])
Used in¶
Bundled models: Biogas digester, holder and CHP, Biogas plant (library assets).
Guides: Experiments, Model file format, Continuous quantities: levels, flows and time-series inputs, Semantic diff.