🚧 Implement continous simulation
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Example CONTINUOUS (soak) scenario — pump station endurance run.
|
||||
#
|
||||
# Demonstrates spec §8: long-duration simulation driven by a CSV
|
||||
# inflow dataset IN PARALLEL with logic, degradation, invariants and
|
||||
# snapshots. Run:
|
||||
#
|
||||
# wago-sim run --node config/pump_node.yaml \
|
||||
# --scenario scenarios/pump_soak.yaml \
|
||||
# --report-jsonl out/pump_soak.jsonl
|
||||
|
||||
name: pump_soak_8h
|
||||
description: "8-hour soak: diurnal inflow, pump wear, level bounds"
|
||||
|
||||
mode: continuous
|
||||
until: 8h # run length (sim time)
|
||||
|
||||
# datasets: inflow demand replayed from a historian export (optional;
|
||||
# logic-only runs are equally valid — see FR-8.2.13)
|
||||
datasets:
|
||||
inflow:
|
||||
file: data/inflow_day.csv
|
||||
interpolation: linear
|
||||
repeat: 1
|
||||
|
||||
# aliases (per-type addressing per FR-4.3.11 v1.5)
|
||||
inputs:
|
||||
tank_level: { type: ai, module: 0, channel: 0, scale: 0.1 } # AI0.0
|
||||
inflow_cmd: { type: ai, module: 0, channel: 1, scale: 1.0 } # AI0.1
|
||||
|
||||
outputs:
|
||||
pump_relay: { type: do, module: 0, channel: 0 } # DO0.0
|
||||
|
||||
# aging plant: capacity decays with pump runtime; maintenance alarm
|
||||
# expected from the PLC when capacity drops below 75 %
|
||||
degradation:
|
||||
pump_capacity:
|
||||
observes: pump_relay
|
||||
model: linear
|
||||
rate: 0.01 # -1% capacity per runtime hour
|
||||
from: 1.0
|
||||
maintenance_at: 0.75
|
||||
diagnosis: { module: 0, channel: 0, value: 0x0001 }
|
||||
|
||||
# every-tick conditions; breaches fail the run as bounded episodes
|
||||
invariants:
|
||||
- { alias: tank_level, condition: '>= 0', label: level_floor }
|
||||
- { alias: tank_level, condition: '<= 9000', label: level_brim }
|
||||
|
||||
rate_limits:
|
||||
- { alias: tank_level, max_per_hour: 5000 } # level may not race
|
||||
|
||||
snapshot_every: 30m # periodic state dumps for the report
|
||||
|
||||
# scheduled discrete events interleave with the datasets (FR-8.4.6)
|
||||
sequence:
|
||||
- at: 4h
|
||||
report: PASS # mid-run milestone check
|
||||
- at: 7h
|
||||
maintenance_reset: true # service the pump: capacity restored
|
||||
Reference in New Issue
Block a user