Update forecast_output.json

2026-06-18 21:32:21 +00:00
parent e39120ec56
commit 713437e9ec
+94
@@ -1 +1,95 @@
<-- [[Home]]
# forecast_output.json
Chart-ready forecast output from **`forecast.py`**. Loaded by **`test.php`** when you click **Load forecast** or use `?forecast=1`.
[[Forecast]] · [[test.php]] · [[Home]]
---
## What it is
| | |
|---|---|
| **Created by** | `python forecast.py` |
| **Location** | Project root (next to `forecast.py`) |
| **Format** | JSON object, one key per BACnet point |
| **Not** | Live data — static file until you re-run the script |
---
## Schema
Each **top-level key** = point name (e.g. `"P"`, `"Ia"`).
Each value:
| Field | Type | Meaning |
|-------|------|---------|
| `mae` | number | Mean absolute error on the **last 20%** backtest (same units as the point) |
| `future` | array | Predicted readings **after** the last sample in training data |
Each item in `future`:
| Field | Type | Meaning |
|-------|------|---------|
| `x` | integer | Unix time in **milliseconds** (matches sample JS / `getData`) |
| `y` | number | Predicted value (2 decimals) |
### Example
{
"P": {
"mae": 11.17,
"future": [
{ "x": 1781713080000, "y": 19.05 },
{ "x": 1781713200000, "y": 19.04 }
]
}
}
---
## Default keys (current `JOBS`)
| Key | From | Dashboard |
|-----|------|-----------|
| `P` | veris-sample.js | Line P (+ dashed forecast) |
| `Ia`, `Ib`, `Ic` | veris-sample.js | Phase compare (+ forecast) |
| `ServRmTmp` | rtu-sample.js | In file; RTU overlay not wired yet |
Add points in `forecast.py``JOBS`, re-run, refresh forecast in browser.
---
## How test.php uses it
1. `fetch("forecast_output.json")`
2. `basForecastSeries(actualSeries, pointName)` → last real `{x,y}` + `future` array
3. Dashed red line on **Line P** and **Phase compare** only
Point name in JSON must **match** the series key on the chart (e.g. `P`, not `Demand`, unless that is the actual key in your data).
`mae` is stored but **not shown in the UI** yet.
---
## Refresh
python forecast.py
Then **Load forecast** in test.php (or reload with `?forecast=1`).
---
## Troubleshooting
| Issue | Fix |
|-------|-----|
| File missing | Run `forecast.py` from project root |
| No dashed line | JSON key must match chart point; load sample/live data first |
| Stale forecast | Re-run `forecast.py` after sample JS changes |
---
*forecast_output.json — output contract for the forecast pipeline.*