Run configuration and inputs
run(model, options) accepts a run configuration object. Defined fields are currency, discountRate, seed, trial, overrides, and deterministic.
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.
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({
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({
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({
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.