On this page
Dashboard configuration with #=
Manual contents | Tutorial | Model logic | Platforms | Where NuML runs
The #= operator configures everything the user sees and the clock that
drives the run: input controls, graphs and tables, integration settings, and
the analytical platforms (which have their own chapter).
Directives override the hosting app's factory settings for the components the
model mobilizes; untouched components keep their defaults and unreferenced
ones stay hidden. Source: directive.js.
1. Directive statement forms
Component #= [directive(args), directive(args), …] // the normal form
Component #= directive(args) // single directive
property #= value // bare runtime property
integration #= [dt(0.25), method("RK4"), maxTime(15), batch, autorun]
Each directive is written param(arg, …) and assigns its arguments to the
named configuration parameter of the component on the other side of #=.
String arguments may be quoted or, where unambiguous, bare identifiers
(legend(Exp) and legend("Exp") are both accepted). Arithmetic in
arguments is folded (value(1/3), max(2 * Math.PI)).
Runtime properties can be set individually with the bare form:
dt #= 0.5
maxTime #= 15
method #= Euler
autorun #= true
batch #= true
or grouped in one integration statement, where bare batch, autorun,
and rerun tokens act as flags.
2. The DynSS dashboard inventory
A NuML program addresses components by name; the hosting app defines which names exist. The DynSS apps provide:
| Component names | Kind | Dashboard position |
|---|---|---|
Slider1 … Slider35 |
numeric input | input panel (five rows of seven) |
Switch1 … Switch4 |
binary input (0/1) | input panel |
TimeGraph, TimeGraph1, TimeGraph2, TimeGraph3 |
time-series line graph | display quadrants 00, 01, 10, 11 |
PhaseGraph, PhaseGraph1, PhaseGraph2, PhaseGraph3 |
x-y line graph | the same four quadrants |
TimeGraph00, TimeGraph01, TimeGraph10, TimeGraph11 |
time-series variants | the same four quadrants |
Table00, Table01, Table10, Table11 |
per-step table | the same four quadrants |
COB |
cobweb (Lemeray) plot | quadrant 01 |
The four display quadrants are shared: TimeGraph and PhaseGraph both
occupy quadrant 00, so use at most one of them (when mixing kinds, the
convention is TimeGraph plus PhaseGraph1). Which display receives data
is decided by the model's
update statements; #=
directives only format it.
Other hosting environments expose different inventories — a Project.model
program addresses the display and input codes its own Project declares
(NuML in Project.model).
3. Sliders and switches
Slider1 #= [legend("Carrying Capacity (K)"), min(50), max(500), value(200), step(10)]
Switch1 #= [legend("Vaccination"), left("Off"), right("On"), value(0)]
| Directive | Applies to | Meaning |
|---|---|---|
legend(label) |
both | the control's label; also the name sensParam matches against |
min(n), max(n) |
slider | range |
step(n) |
slider | increment |
value(n) |
both | initial setting (0/1 for switches) |
left(label), right(label) |
switch | labels for the off/on positions |
Every slider or switch the model binds should carry a legend, range, initial value, and step; unconfigured inputs keep the app's generic defaults.
4. Graphs
TimeGraph #= [legend("S", "I", "R"), title("SIR Model"), ylabel("Population")]
PhaseGraph #= [legend(Exp), title("Iterated Logistic"), color("blue"), mode("markers"), size(2)]
| Directive | Meaning |
|---|---|
title(text) |
graph title |
legend(a, b, …) |
one label per data stream; the count must equal the variable count of the corresponding update |
xlabel(text), ylabel(text) |
axis labels |
interval(n) |
steps between plotted points |
color(name) |
stream color |
mode(kind) |
plot mode, e.g. "markers" for point clouds |
size(n) |
marker size |
dom([lo, hi]) |
x-axis domain |
width(n), height(n) |
plot dimensions |
phase(…) |
phase-plot pairing options |
Legend labels do double duty: the analytical platforms name their targets by
legend string (sensTarget("I"), stocHist("Harvested")), so give stable,
meaningful labels to any stream you may analyze.
5. Tables
Table01 #= [legend("Step", "Population", "Survivors", "Recruits"), title("Dynamics"), precision(0)]
A table shows one row per step; column 1 is always model time, so legend
includes a header for it. precision(n, …) sets decimal places per column —
if the list is shorter than the columns, the last entry applies to the rest.
interval(n) emits a row every n steps. title(text) as for graphs.
6. Cobweb plots
The COB component draws a cobweb (Lemeray) diagram for one-dimensional
iterated maps:
COB #= [legend("f(x)", "Cobweb Path"), plot("x => r * x * (1 - x)", 0, 1, 0.01),
xlabel("x"), start(Slider1)]
| Directive | Meaning |
|---|---|
plot(fnString, lo, hi, dx) |
the reference function (a string evaluating to a function) and the plot domain/resolution |
start(input) |
the input supplying the iteration's starting value |
legend(…) |
labels for the reference curve and cobweb path (the y = x line is implied) |
xlabel(text) |
x-axis label |
7. Integration and run control
integration #= [dt(1), method("Euler"), maxTime(100), batch, autorun]
| Directive / property | Meaning |
|---|---|
dt(n) |
the clock step — every deriv is scaled by it; next is not |
method("RK4") or method("Euler") |
the integrator; RK4 for deriv models, Euler for next or stochastic models (why) |
maxTime(n) |
stop time; the run halts when the clock reaches it |
batch |
run to completion in bursts without animating intermediate frames — essential for long or repeated runs |
autorun |
re-run automatically whenever an input changes |
rerun |
re-run the model after the current run completes |
These override the hosting Project's dt, visitMode/method, and
maxTime; the dashboard's method and dt selectors reflect the override. The
runtime semantics of dt, RK4 staging, and stopping are specified in the
SD manual.
8. Directive reference table
The complete directive vocabulary recognized by the configuration engine:
| Area | Directives |
|---|---|
| Inputs | legend, min, max, step, value, left, right |
| Graphs/tables | title, legend, xlabel, ylabel, interval, precision, color, mode, size, dom, width, height, phase, plot, start, site |
| Runtime | integration, dt, method, maxTime, batch, autorun, rerun |
| Sensitivity platform | title, sensTarget, sensParam, sensRuns, sensLo, sensHi (legacy aliases statParam, statDat, statRuns, statLo, statHi) |
| Stochastic platform | stocRuns, stocHist, stocHistTitle, stocHistLabel, stocHistRange, binSize, site, stocStats, stocStatsTitle (aliases FreqGraph*, HistGraph*) |
The platform directives are specified in the platforms chapter. Directives repeated for the same component merge; a directive repeated with new arguments replaces its earlier value.