Skip to content

Site Orchestration

The SiteOrchestrator is a background service that maintains energy balance across simulated assets.

Overview

text
Grid = Load - Solar + EV_Charging ± Battery

The orchestrator:

  1. Polls load profile for building consumption
  2. Reads solar generation, EV charging, battery state
  3. Calculates net grid power to balance the site
  4. Updates SimulatedGridMeter every 5 seconds

Asset Discovery

The orchestrator automatically discovers assets from the Assets configuration section based on DeviceClass:

DeviceClassRole
SimulatedGridMeterGrid connection (required)
SimulatedSolarInverterSolar generation (optional)
SimulatedBatteryEnergy storage (optional)
SimulatedChargeStationEV charging (optional)

Configuration

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 ± Battery

The 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 SimulatedGridMeter must be configured - orchestration is disabled without it
  • At least one ILoadProfileProvider must 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