Sensitivities & Scenarios

pd4castr lets you run alternative versions of your model with modified input data, so you can explore “what if” scenarios alongside your base forecast. You can also define input aggregations to display summary views of input conditions alongside forecast results.

Sensitivities

Sensitivities execute the same model container with transformed input data. A SQL query modifies the base input before the container runs, letting you answer questions like “what if demand is 10% higher?” or “what if wind generation drops by 20%?”

How sensitivities execute

When a base model run is triggered, one additional run is created for each enabled sensitivity. All runs share the same runDatetime. Before each sensitivity run starts, the SQL query runs against the input files in DuckDB and produces a modified version of the input data. The container then receives this transformed data instead of the original.

Configuration

Define sensitivities in the sensitivities array in .pd4castrrc.json:

FieldTypeRequiredDescription
namestringYesDisplay name for the scenario. Shown in the pdView options sidebar.
querystringYesPath to a SQL file that transforms the input data.

Here’s an example sensitivity that increases demand by 10%:

{
  "sensitivities": [
    {
      "name": "High Demand (+10%)",
      "query": "queries/sensitivities/high-demand.sql"
    }
  ]
}

The SQL file at queries/sensitivities/high-demand.sql might look like this:

SELECT
  forecast_datetime,
  region,
  demand * 1.10 AS demand
FROM input_data

Viewing sensitivity results

Sensitivity runs appear as toggleable options in the pdView sidebar. When enabled, the sensitivity forecast overlays on the main chart alongside the base forecast, making it easy to compare scenarios visually.

Input aggregations

Input aggregations are SQL-derived summary views of your input data. They display as a secondary chart below the main forecast chart in pdView, giving users visibility into the input conditions that drove a particular forecast.

Configuration

Define input aggregations in the inputAggregations array in .pd4castrrc.json:

FieldTypeRequiredDescription
namestringYesDisplay name for the aggregation chart.
querystringYesPath to a SQL file that aggregates the input data.
descriptionstringNoTooltip text shown in the platform when hovering over the chart title.
coloursstring[]NoArray of hex colour strings for chart series.

How aggregations execute

Aggregation queries run against model input files after a run is triggered. The results are stored alongside the forecast output and served in pdView as supplementary charts.

Example

Here’s a configuration that shows average demand by region as a secondary chart:

{
  "inputAggregations": [
    {
      "name": "Native Demand",
      "query": "queries/input-aggregations/native-demand.sql",
      "description": "Regional demand represented by demand_and_nonshedgen",
      "colours": ["#008000", "#009900", "#00B300", "#00CC00", "#00E600"]
    },
    {
      "name": "Solar & Wind",
      "query": "queries/input-aggregations/solar-wind.sql",
      "description": "Expected generation of wind and solar",
      "colours": ["#008000", "#009900", "#00B300", "#00CC00", "#00E600"]
    }
  ]
}

SQL file paths

All query paths (for sensitivities, input aggregations, and runDatetimeQuery) are relative to the project root. The CLI reads these files and inlines the SQL content when you publish the model.

Next steps

  • See the Configuration file reference for all sensitivity and aggregation fields.
  • Learn about Run modes and scheduling to understand how sensitivity runs are triggered alongside base runs.