Run configuration and inputs
In the Calculator, open Run input to choose Run mode, Currency and Store amounts. These settings apply to the base calculation and every scenario. Select Update results after changing them. Money and percentage input fields show their units beside the entered value; for example, enter 5 in a percentage field for 5%.
Model authors can choose initial run controls with calculator.defaultRun, including Monte Carlo, 128 simulations and Sobol. Saved and explicitly selected settings take precedence.
The input area and results sit beside each other on desktop, including in the editor preview. Drag the divider to adjust their widths, or focus it and use the left and right arrow keys. On smaller screens, results appear below the inputs. For individual field alternatives, see Create scenarios in the Calculator.
Monte Carlo progress appears automatically after 300 ms of execution, with real completed-work feedback when available. It reaches 100% only after accepted success and then fades; cancellation or errors clear it. There is no progress setting to add to the financial model or its run options. See Calculation progress for observations and optional Web API feedback.
run(model, options) accepts a run configuration object. Defined fields are currency, moneyValue, amountStorage, discountRate, seed, trial, overrides, parameters, and deterministic.
Top-level parameters supplies values for named deccf.bind.parameter declarations; it does not change model structure. These names are separate from deterministic.parameters input overrides. Use deccf.prepare(model, options).run({parameters}) to reuse a fixed model across comparisons, and outputs at preparation to select final values. See Static bindings and explicit dynamic callbacks for defaults, validation, result shapes and callable examples.
Money value
deccf.run(model, {moneyValue: "today"}) expresses monetary outputs in purchasing power at the first resolved model timeline date. Omission or "nominal" returns nominal amounts. Other values are rejected. In the Calculator, the results' money value selector appears when effective inflation is nonzero and defaults to Nominal. Changing the selection sends a new calculation and updates Run input, including the setting used for scenarios.
Declare the annual assumption with defineModel({inflation: 0.02, ...}) for 2%, or pass an existing declared scalar numeric input reference as inflation. The reference can live anywhere in the input layout. Omission defaults to zero. Rates and effective overrides must be finite and greater than -1; negative inflation is valid, and zero produces identical amounts in both modes. Curves, Money inputs, derived references and undeclared inputs are unsupported. A distribution input uses its central value.
Today's value divides a dated monetary amount by (1 + inflation) ** elapsedYears, counting full calendar anniversaries and actual days for partial years. An explicit deccf.money(amount, currency, {date: "2027-01-01"}) valuation date takes priority. Otherwise a series uses its point date and a custom money metric uses its last evaluated window date. This also applies to Money leaves inside structured records, including future projections generated during a single model period.
Plain numeric outputs, rates, ages and text retain their values. Financial callbacks, inputs and state remain nominal; the model must explicitly use inflation if costs or income should grow. model.total sums converted cashflows, while model.npv already represents base-date present value and keeps its value. runMonteCarlo() converts monetary trial outcomes before computing statistics; runScenarios() resolves each scenario's rate and base date. The result records moneyValue, inflation and moneyValueBaseDate. See Show money in today's value for complete callable examples.
Amount storage
Choose Each calculation period (default), Calendar year or Fiscal year in Run input → Store amounts. The corresponding amountStorage values are "period", "calendar-year" and "fiscal-year"; other values are rejected. Annual storage keeps monthly calculations and final metrics while saving fewer monetary observations.
Cashflows and posting amounts are summed, balances keep their final value, and monetary metrics follow annualAggregation ("last" by default). Today's-value conversion happens before aggregation. Fiscal years use each owner's attributes.fiscalYearStartMonth (an integer from 1 to 12); ownerless values use January. A metric's explicit fiscal start overrides its owner. Partial years keep actual covered start and end dates. Source periods are assigned by their start date and are never split or prorated.
The setting applies to published monetary series, legacy cashflow series, account postings and report groups. Nonmonetary series and authored calculation records retain their original detail. Monthly reference accessors and result.dates retain the calculation timeline. Monte Carlo summaries and final metric values are unchanged; the ordinary baseline uses the chosen storage. runScenarios() applies it to every scenario, and prepare() accepts it among its fixed run options. See Store monetary results by year for callable examples and report limitations.
Run currency
Change the denomination used for one run without editing the model:
import { cashflow, currencies, defineModel, entity, inflow, periods, run, schedule } from "deccf";
const building = entity.asset();
const rent = cashflow({ owner: building, direction: inflow, schedule: schedule.monthly(), amount: 1_000 });
const model = defineModel({
name: "currency-override",
currency: currencies.SEK,
timeline: periods.monthly({ from: "2026-01", count: 12 }),
entities: { building },
flows: { rent },
});
const result = run(model, { currency: currencies.EUR });
return model;This keeps numeric amounts unchanged and updates the result denomination. It does not convert amounts using an exchange rate.
The selected currency replaces the model's original denomination in Money inputs, including nested fields and rows, account balances, cashflows, calculation records and monetary results. Their numeric amounts stay the same. The input fields' currency addons update as soon as you select the run currency. Other explicitly specified denominations keep their currency and remain subject to the usual currency checks.
For example, this model starts in USD and runs in SEK:
const savings = deccf.input.money(450000, deccf.currencies.USD);
const model = deccf.defineModel({
currency: deccf.currencies.USD,
timeline: deccf.periods.annual({from:'2026-01', count:1}),
preconditions: {savings},
metrics: {savings: ctx => ctx.get(savings)},
});
const result = deccf.run(model, {currency: deccf.currencies.SEK});
// result.deterministic.metrics['metric.savings'] is {amount:450000, currency:'SEK'}.
return model;The saved model defaults and submitted input values retain their source denomination; selecting another run currency does not rewrite them. Supply input overrides in their declared currency. Selecting USD again restores the original denomination on the next run.
Inline inputs
To reuse one model with different preconditions, pass deterministic.inputs:
import { cashflow, currencies, defineModel, entity, inflow, input, periods, run, schedule } from "deccf";
const building = entity.asset();
const growth = input.rate(0.02);
const occupancy = input.fraction(0.92);
const start = input.date("2026-01");
const rent = cashflow({
dynamic:true,
owner: building,
direction: inflow,
schedule: schedule.monthly(),
amount: (ctx) => 20_000 * (1 + ctx.get(growth)) ** (ctx.time.index / 12) * ctx.get(occupancy),
});
const model = defineModel({
name: "inline-inputs",
currency: currencies.SEK,
timeline: periods.monthly({ from: start, count: 24 }),
preconditions: { growth, occupancy, start },
entities: { building },
flows: { rent },
});
const result = run(model, {
deterministic: {
inputs: {
growth: 0.035,
occupancy: { value: 0.92, source: { method: "forecast" } },
start: "2027-01",
},
},
});
return model;Keys are precondition names. The inputs. prefix is also accepted, but is usually omitted in the object. Values can be JavaScript numbers, Money values, Currency references, or date strings for a date input. A wrapped value can have { value, source }. A wrapped series or quantile is also part of the accepted schema, but quantile overrides are currently unsupported.
Replace a curve with series:
import { cashflow, currencies, defineModel, entity, inflow, input, periods, run, schedule } from "deccf";
const building = entity.asset();
const growth = input.curve([
{ date: "2026-01", value: 0.02 },
{ date: "2027-01", value: 0.04 },
], { interpolation: "linear" });
const rent = cashflow({
dynamic:true,
owner: building,
direction: inflow,
schedule: schedule.monthly(),
amount: (ctx) => 10_000 * (1 + ctx.get(growth)) ** (ctx.time.index / 12),
});
const model = defineModel({
name: "curve-override",
currency: currencies.SEK,
timeline: periods.monthly({ from: "2026-01", count: 24 }),
preconditions: { growth },
entities: { building },
flows: { rent },
});
const result = run(model, {
deterministic: {
inputs: {
growth: {
series: {
points: [
{ date: "2026-01", value: 0.02 },
{ date: "2027-01", value: 0.04 },
],
interpolation: "linear",
},
},
},
},
});
return model;series can be a dated point list or an object with points and interpolation. The curve's declared kind and domain are retained; its default interpolation is used unless an override is supplied.
Other forms
deterministic.parameters takes keys of the form inputs.<name> and scalar values:
import { cashflow, currencies, defineModel, entity, inflow, input, periods, run, schedule } from "deccf";
const building = entity.asset();
const growth = input.rate(0.02);
const rent = cashflow({
dynamic:true,
owner: building,
direction: inflow,
schedule: schedule.monthly(),
amount: (ctx) => 10_000 * (1 + ctx.get(growth)) ** (ctx.time.index / 12),
});
const model = defineModel({
name: "parameter-override",
currency: currencies.SEK,
timeline: periods.monthly({ from: "2026-01", count: 24 }),
preconditions: { growth },
entities: { building },
flows: { rent },
});
const result = run(model, { deterministic: { parameters: { "inputs.growth": 0.035 } } });
return model;options.overrides is a compatibility form: a Map keyed by declared input references. It cannot replace a curve input with a scalar.
An input cannot appear more than once across overrides, parameters, and inputs. All names must exist in the model's preconditions. Values are checked against type, currency, domain, and clipping rules. Distribution clip is read from the distribution parameter object. deterministic only accepts annual_discount_rate, parameters, and inputs.
Discount rate and reproducibility
Set either discountRate or deterministic.annual_discount_rate, not both. The rate must be finite and greater than −1. seed and trial control calls to ctx.draw() and ctx.sample(); a deterministic run() uses central distribution values when no draw state is provided.
Inline overrides and their optional source are included with the preconditions in the result. The current result marks inline inputs with origin: "file" even though the JavaScript API received an object; treat origin as a legacy source label, not proof that a file was read. The API does not load input files.