Schema Reference
This page documents the schema.json contract. The schema is the source of truth for buildings, devices, EVs, deferrable appliances, escalators, interfaces, observation bundles, demand response, robustness, dynamic topology and local market configuration.
General Rules
Rule |
Contract |
|---|---|
Paths |
Relative paths are resolved from |
Tabular files |
CSV and Parquet are interchangeable when columns and units are equivalent. |
Energy |
Dataset energy series are |
Power and limits |
Power ratings and limits are |
Prices |
Prices are per |
Emissions |
Carbon intensity is |
Timesteps |
Windows, deadlines and topology events use global simulation timestep indices. |
Legacy washing machines |
|
Top-Level Keys
Key |
Type |
Required |
Purpose |
|---|---|---|---|
|
string |
yes |
Base folder for dataset files. |
|
int/null |
no |
Global random seed. |
|
bool |
yes |
Single controller or one agent per building. |
|
number |
yes |
Physical duration of each step. |
|
int |
yes |
First global timestep. |
|
int |
yes |
Last global timestep. |
|
int/list/null |
no |
Episode length or explicit episode windows. |
|
bool/null |
no |
Sequential episode windows. |
|
bool/null |
no |
Random episode windows. |
|
object/string |
yes |
Reward class and kwargs. |
|
object |
yes |
Flat observation catalog and flags. |
|
object |
yes |
Flat action catalog and flags. |
|
object |
yes |
Building definitions. |
|
object/string |
no |
CLI agent configuration. |
|
object |
if EVs exist |
EV catalog. |
|
|
no |
Environment I/O mode. |
|
object |
no |
Additional entity observation bundles. |
|
|
no |
Enables topology events. |
|
list |
if dynamic |
Add/remove events. |
|
object |
no |
Dataset-driven DSO/TSO flexibility requests and settlement. |
|
object |
no |
Dataset-driven observation, forecast, action and asset availability perturbations. |
|
object |
no |
Local market and market KPIs. |
|
float |
no |
Symmetric departure SOC accuracy tolerance, default |
|
float |
no |
Lower departure SOC service tolerance for minimum acceptable EV service, default |
|
string |
no |
|
|
|
no |
Export format for render, KPI and BAU time-series files. |
|
int |
no |
Rows per export chunk; defaults to |
|
bool |
no |
Export KPIs at episode end. |
|
string |
no |
Base date for render/export. |
|
bool |
no |
Runtime timing logs. |
|
bool |
no |
Validate observation bounds. |
|
bool |
no |
Runtime physical invariant checks. |
|
int |
no |
Runtime metric log cadence. |
observations
"hour": {
"active": true,
"shared_in_central_agent": true
}
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
bool |
|
Enables the flat observation. |
|
bool |
|
Includes a common observation once in central-agent vectors. |
Observation names with prefix electric_vehicle_ are expanded per charger. Names with prefix deferrable_appliance_ are expanded per deferrable appliance. Names with prefix escalator_ are expanded per escalator.
actions
"electrical_storage": {
"active": true
}
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
bool |
|
Enables the action. |
electric_vehicle_storage expands to electric_vehicle_storage_{charger_id}. deferrable_appliance expands to deferrable_appliance_{appliance_id}. escalator expands to escalator_{escalator_id}.
observation_bundles
Entity-only configuration:
"observation_bundles": {
"entity_core_electrical": true,
"entity_community_operational": true,
"entity_forecasts_existing": false,
"entity_forecasts_derived": false,
"entity_demand_response": false,
"entity_robustness": false,
"entity_action_feedback": false,
"entity_temporal_derived": true
}
Bundle |
Default |
Adds |
|---|---|---|
|
always on |
Essential charger, storage, phase and deferrable features. |
|
|
Power, step energy, PV, BESS, EV, efficiency and building electrical metrics. |
|
|
District/community aggregates, headroom, counts and topology version. |
|
|
Forecasts already present in the dataset. |
|
|
Compact point forecasts for price, load, PV and net demand. |
|
|
Current district DR request fields, frozen baseline and previous-step delivery/shortfall. |
|
|
Active robustness state and previous-step corruption counters in the district table. |
|
|
Short lags, rolling means and calendar sin/cos features. |
|
|
Requested, limited and applied action feedback plus clipping-reason flags. |
Load/PV sources for the derived bundle are configurable:
"derived_forecasts": {
"load_pv_method": "daily_persistence",
"persistence_period_seconds": 86400,
"cold_start": "current_step",
"price_source": "publication_aware_day_ahead_market_input",
"price_publication_time_local": "13:00",
"price_unpublished_fallback": "daily_persistence",
"price_horizon_steps": [4, 24, 96]
}
actual_future remains the backward-compatible load/PV default. Use
daily_persistence for causal algorithm benchmarks that must not expose future
load or PV truth.
buildings
"buildings": {
"Building_1": {
"include": true,
"type": "citylearn.building.Building",
"energy_simulation": "Building_1.csv",
"weather": "weather.parquet",
"pricing": "pricing.csv",
"carbon_intensity": "carbon.csv"
}
}
Key |
Type |
Required |
Purpose |
|---|---|---|---|
|
bool |
no |
Include the building initially. In dynamic topology it may start inactive. |
|
string |
no |
Building class path, e.g. |
|
string |
yes |
Main load, calendar and PV input file. |
|
string/object |
yes |
Weather file. |
|
string/object |
yes |
Pricing file. |
|
string/object |
no |
Carbon intensity file. |
|
list |
no |
Disable observations for this building. |
|
list |
no |
Disable actions for this building. |
|
object |
HVAC datasets |
End-use devices. |
|
object |
HVAC datasets |
Thermal storages. |
|
object |
no |
Building BESS. |
|
object |
no |
Building PV. |
|
object |
no |
EV chargers. |
|
object |
no |
Normalized deferrable appliances. |
|
object |
no |
Building/phase charging limits. |
|
object |
no |
Import/export service limits. |
|
string |
no |
Group used by equity KPIs. |
|
object |
no |
Indoor temperature dynamics model. |
|
object |
no |
Occupant interaction model. |
|
object |
no |
Outage configuration. |
|
int |
no |
Hold time for occupant interaction. |
Device Sections
Common shape:
"electrical_storage": {
"type": "citylearn.energy_model.Battery",
"attributes": {
"capacity": 50.0,
"nominal_power": 25.0,
"depth_of_discharge": 0.9
},
"autosize": false,
"autosize_attributes": {}
}
Field |
Type |
Purpose |
|---|---|---|
|
string |
Python class path. |
|
object |
Constructor kwargs. |
|
bool |
Calls the building autosizer when available. |
|
object |
Autosizer kwargs. |
Common classes:
Class |
Main attributes |
|---|---|
|
|
|
|
|
|
|
|
|
|
PV
"pv": {
"type": "citylearn.energy_model.PV",
"attributes": {
"nominal_power": 120.0,
"generation_mode": "absolute"
}
}
|
Aliases |
Interprets |
Formula |
|---|---|---|---|
|
|
Normalized profile per installed kW in |
|
|
|
Absolute generation already in |
|
Use absolute for real measured generation or converter-generated energy series. Use per_kw for normalized PV profiles.
Chargers
"chargers": {
"AC001": {
"type": "citylearn.electric_vehicle_charger.Charger",
"charger_simulation": "chargers/AC001.parquet",
"attributes": {
"max_charging_power": 7.4,
"min_charging_power": 1.4,
"max_discharging_power": 0.0,
"min_discharging_power": 0.0,
"efficiency": 0.95,
"phase_connection": "L1"
}
}
}
Field |
Unit |
Purpose |
|---|---|---|
|
path |
Charger schedule file. |
|
kW |
Charging upper limit. |
|
kW |
Technical minimum charging power. |
|
kW |
V2G upper limit. |
|
kW |
Technical minimum V2G power. |
|
ratio |
Fixed/default efficiency. |
|
ratio vs normalized power |
Optional charging efficiency curve. |
|
ratio vs normalized power |
Optional discharging efficiency curve. |
|
|
Electrical phase assignment. |
EV Definitions
"electric_vehicles_def": {
"EV_1": {
"type": "citylearn.electric_vehicle.ElectricVehicle",
"include": true,
"battery": {
"attributes": {
"capacity": 60.0,
"nominal_power": 50.0,
"initial_soc": 0.4,
"depth_of_discharge": 0.9
}
}
}
}
Field |
Purpose |
|---|---|
|
EV class path. |
|
Include the EV in the initial pool. |
|
|
EV battery standby loss is intentionally isolated from stationary storage defaults:
Missing or
nullbattery.attributes.loss_coefficientdefaults to0.0for EVs.Explicit EV
loss_coefficientvalues are interpreted as hourly loss ratios.All
StorageDeviceimplementations, including stationaryBatteryandStorageTank, convert hourlyloss_coefficientvalues to effective per-step loss withloss_coefficient * seconds_per_time_step / 3600.Stationary storage default parameter ranges are unchanged.
Deferrable Appliances
"deferrable_appliances": {
"washer_1": {
"type": "citylearn.energy_model.DeferrableAppliance",
"cycle_profiles_file": "deferrables/washer_profiles.csv",
"flexibility_schedule_file": "deferrables/washer_schedule.csv",
"attributes": {
"trigger_threshold": 0.5
}
}
}
Field |
Required |
Purpose |
|---|---|---|
|
no |
Appliance class. Default: |
|
yes |
Physical cycle profile catalog. |
|
yes |
Flexibility requests/windows. |
|
no |
Start action threshold (default |
Escalators (flat interface)
"escalators": {
"EscadaRolante_1": {
"type": "citylearn.energy_model.Escalator",
"simulation": "EscadaRolante_1.csv",
"attributes": {
"standby_power": 0.08,
"slow_power": 0.42,
"normal_power": 2.10,
"minimum_state_steps": 1,
"service_threshold_passengers": 0.5
}
}
}
Field |
Required |
Purpose |
|---|---|---|
|
no |
Escalator class. Default: |
|
yes |
CSV with one row per simulation step. |
|
yes |
Non-negative kW powers; must be non-decreasing. |
|
no |
Minimum residence in a state; default |
|
no |
Passenger demand above which service is required; default |
The CSV requires time_step, passengers_from_trains_15min,
background_pedestrians_15min, passengers_expected_15min, people_detected,
arriving_trains, departing_trains, minutes_to_next_train and available.
passengers_expected_15min must equal the sum of the two passenger components.
Escalator support is currently exposed through the flat interface.
Dynamic Topology
topology_mode="dynamic" requires interface="entity".
"topology_events": [
{
"id": "add_pv_b2_t100",
"time_step": 100,
"operation": "add_asset",
"target_member_id": "Building_2",
"target_asset_type": "pv",
"target_asset_id": "pv_1",
"source_member_id": "Building_1",
"source_asset_id": "pv_1",
"overrides": {"nominal_power": 80.0}
}
]
Field |
Type |
Purpose |
|---|---|---|
|
string |
Event ID. |
|
int |
Global timestep where the event is applied. |
|
enum |
|
|
string |
Target building. |
|
enum |
|
|
string |
Target asset. |
|
string |
Source building for cloning. |
|
string |
Source asset for cloning. |
|
object |
Attributes applied after cloning. |
Removing a deferrable appliance cancels pending/running cycles and clears future consumption. Removing PV creates a zero PV. Removing storage creates a zero BESS.
Demand Response
Demand response v1 is dataset-driven and entity-only. The agent observes district-level flexibility requests and responds through the physical actions that already exist, such as storage, EVs and flexible loads.
"demand_response": {
"enabled": true,
"requests_file": "demand_response_requests.csv",
"baseline_method": "rolling_pre_event_average",
"baseline_window_seconds": 3600,
"allow_overlapping_requests": false
}
Field |
Default |
Purpose |
|---|---|---|
|
|
Enables demand-response request loading, observations, settlement and KPIs. |
|
required when enabled |
CSV or Parquet file relative to |
|
|
Baseline method. This is the only v1 method. |
|
|
Pre-event history window used to compute the frozen event baseline. |
|
|
Overlapping requests are rejected in v1. |
Request file columns:
Column |
Unit/domain |
Meaning |
|---|---|---|
|
string |
Unique request ID. Exposed in observation |
|
|
Entity that issued the request. |
|
|
Load perspective: |
|
global timestep |
Inclusive activation window. |
|
kW |
Positive district target power. |
|
currency/kWh |
Credited delivery price. |
|
currency/kWh |
Penalty for shortfall. |
|
kW |
Optional tolerance; defaults to |
When active, enable the observation bundle:
"observation_bundles": {
"entity_demand_response": true
}
The numeric features are added to the district entity table. The active request_id is kept in observations["meta"]["demand_response"], not in the numeric matrix.
Robustness
Robustness v1 is dataset-driven and fully optional. Observation and forecast events corrupt only the payload returned to the agent. Rewards, physical KPIs and demand-response settlement continue to use the real simulator state. Action and asset-control events change the action effectively applied.
"robustness": {
"enabled": true,
"events_file": "robustness_events.csv",
"random_seed": 0,
"missing_replacement_value": -9999.0,
"modules": {
"observations": {"enabled": true},
"forecasts": {"enabled": true},
"actions": {"enabled": true},
"assets": {"enabled": true}
}
}
Field |
Default |
Purpose |
|---|---|---|
|
|
Enables robustness event loading and application. |
|
required when enabled |
CSV or Parquet file relative to |
|
|
Deterministic seed for event noise. |
|
|
Default sentinel for missing observation/telemetry values. |
|
|
Individually enables observations, forecasts, actions and assets. |
Event file columns:
Column |
Unit/domain |
Meaning |
|---|---|---|
|
string |
Unique event ID exposed in metadata. |
|
|
Perturbation module. |
|
entity type |
|
|
id or |
Target entity name/id, or all compatible targets. |
|
feature/action |
For assets use |
|
global timestep |
Inclusive activation window. |
|
enum |
Observation/forecast: |
|
numeric |
Optional mode parameters. |
|
numeric |
Optional missing/telemetry sentinel. |
|
count |
Optional action delay horizon. |
When using entity observations, enable diagnostics if needed:
"observation_bundles": {
"entity_robustness": true
}
Metadata is exposed under observations["meta"]["robustness"].
Community Market
"community_market": {
"enabled": true,
"local_price_ratio_to_grid_import": 0.8,
"import_member_weights": {
"Building_1": 1.0,
"Building_2": 2.0
},
"kpis": {
"community_local_traded_enabled": true,
"community_self_consumption_enabled": true
}
}
Field |
Default |
Purpose |
|---|---|---|
|
|
Enables local settlement. |
|
|
Local price relative to grid import price. |
|
alias |
Legacy name for the same ratio. |
Residual grid-export remuneration |
fixed |
Runtime settlement currently uses zero; |
|
|
Weights for allocating local energy among importers. |
|
|
Enables local traded energy KPI. |
|
|
Enables local import-share KPI. |
Important Combinations
The local price ratio is clipped to [0, 1]. The legacy
intra_community_sell_ratio key is an alias. Local settlement values
same-timestep member imports and exports; it does not change the physical
device dispatch.
Case |
Configuration |
|---|---|
Classic flat training |
Omit |
Entity/GNN/Transformer |
|
Dynamic topology |
|
Demand response |
|
Robustness |
Any interface, |
Real PV measurements |
|
15-second data |
|
Large datasets |
Prefer Parquet paths with the same columns. |