Site Orchestration
The SiteOrchestrator is a background service that maintains energy balance across simulated assets.
Overview
text
Grid = Load - Solar + EV_Charging ± BatteryThe orchestrator:
- Polls load profile for building consumption
- Reads solar generation, EV charging, battery state
- Calculates net grid power to balance the site
- Updates
SimulatedGridMeterevery 5 seconds
Asset Discovery
The orchestrator automatically discovers assets from the Assets configuration section based on DeviceClass:
| DeviceClass | Role |
|---|---|
SimulatedGridMeter | Grid connection (required) |
SimulatedSolarInverter | Solar generation (optional) |
SimulatedBattery | Energy storage (optional) |
SimulatedChargeStation | EV charging (optional) |
Configuration
Automatic Discovery (Recommended)
Just configure your assets - the orchestrator finds them automatically:
json
{
"Assets": [
{
"Name": "grid-meter",
"DeviceClass": "SimulatedGridMeter",
"AssetType": "Grid"
},
{
"Name": "solar",
"DeviceClass": "SimulatedSolarInverter",
"AssetType": "Solar"
},
{
"Name": "battery",
"DeviceClass": "SimulatedBattery",
"AssetType": "Battery"
}
]
}Explicit Configuration
Override discovery with explicit asset names:
json
{
"SiteOrchestrator": {
"GridMeterName": "my-grid",
"SolarInverterName": "my-solar",
"BatteryName": "my-battery",
"EvChargerName": "my-ev"
}
}Registration
Register the orchestrator and a load profile in DI:
csharp
// Choose a load profile
services.AddSingleton<ILoadProfileProvider, ResidentialLoadProfile>();
// Or: services.AddSingleton<ILoadProfileProvider, CommercialLoadProfile>();
// Register the orchestrator
services.AddHostedService<SiteOrchestrator>();Energy Balance Calculation
Each update cycle:
text
Load Power = ILoadProfileProvider.GetLoadPower(now)
Solar Power = SimulatedSolarInverter.GetActivePower() (negative = generation)
EV Power = SimulatedChargeStation.GetActivePower() (positive = charging)
Battery Power = SimulatedBattery.GetActivePower() (positive = discharge, negative = charge)
Grid Power = Load - Solar + EV ± BatteryThe result is applied to SimulatedGridMeter.SetPower(gridPower):
- Positive grid power: Site imports from utility
- Negative grid power: Site exports to utility
Update Interval
Default: 5 seconds
The orchestrator updates all assets and recalculates grid power at this interval.
Requirements
- A
SimulatedGridMetermust be configured - orchestration is disabled without it - At least one
ILoadProfileProvidermust be registered - Other assets are optional
Example: Full Site
json
{
"Assets": [
{
"Name": "grid-meter",
"DeviceClass": "SimulatedGridMeter",
"AssetType": "Grid"
},
{
"Name": "solar-inverter",
"DeviceClass": "SimulatedSolarInverter",
"AssetType": "Solar",
"SimulatedSolarInverter": {
"InstalledCapacityW": 15000.0
}
},
{
"Name": "battery",
"DeviceClass": "SimulatedBattery",
"AssetType": "Battery",
"SimulatedBattery": {
"ConfigurationModel": "MediumResidential"
}
},
{
"Name": "ev-charger",
"DeviceClass": "SimulatedChargeStation",
"AssetType": "ChargeStation"
}
]
}csharp
services.AddSingleton<ILoadProfileProvider, ResidentialLoadProfile>();
services.AddHostedService<SiteOrchestrator>();This creates a home with:
- 15 kW solar
- 15 kWh battery (MediumResidential preset)
- 7.4 kW EV charger
- Residential load profile