DECCF · Cash Flow Modeler and Calculator

Work with curves

A curve is a precondition whose value varies by date. Declare dated points and choose step or linear interpolation.

step holds the latest point until the next one. linear interpolates between adjacent points. ctx.get(occupancy) reads the value at the current period date; ctx.curveAt(occupancy, date) reads it at an explicit date.

A run can replace a declared curve without changing the model:

import { cashflow, currencies, defineModel, entity, inflow, input, periods, run, schedule } from "deccf";

const building = entity.asset();
const occupancy = input.curve([
  { date: "2026-01", value: 0.75 },
  { date: "2026-07", value: 0.9 },
], { kind: "fraction", interpolation: "linear" });
const rent = cashflow({
  owner: building,
  direction: inflow,
  schedule: schedule.monthly(),
  amount: (ctx) => 20_000 * ctx.get(occupancy),
});
const model = defineModel({
  name: "occupancy-rent-curve",
  currency: currencies.SEK,
  timeline: periods.monthly({ from: "2026-01", count: 12 }),
  preconditions: { occupancy },
  entities: { building },
  flows: { rent },
});
const result = run(model, {
  deterministic: {
    inputs: {
      occupancy: {
        series: {
          points: [
            { date: "2026-01", value: 0.8 },
            { date: "2026-10", value: 0.95 },
          ],
          interpolation: "linear",
        },
        source: { note: "updated forecast" },
      },
    },
  },
});
return model;

A curve must contain at least one point, and its dates and values are validated. A scalar override cannot replace a curve input.