Edge architecture

How the guard, arbiter and planner share control on the gateway and work offline.

4 min read · Edit this page

The project has three edge applications. hemsd operates a household gateway. bemsd replays a building operator’s handover and community allocations. cemsd captures a commissioned OPC UA import register, reconciles it with independent closes and replays industrial peak decisions. The building and industrial demos use synthetic measurements. Run the demos.

Three planes

The household has to react to a grid instruction within a control cycle even while it is calculating the cheapest time to charge a car. Three components work at different timescales.

ComponentInputOutput
GuardGrid instructions, site wiring, device ratings and current measurementsPermitted power range for each asset and a reason for each restriction
ArbiterPermitted ranges, household requests, manager instructions and planned energyA device command each control tick, typically once a second
PlannerEffective prices, forecasts, available stores and household goalsQuarter-hour energy targets, flexibility ranges and marginal values

The guard

Two kinds of limit, and the difference matters

A battery reserve or inverter rating limits one device. A connection fuse or a network operator’s reduction can constrain several devices together. If two chargers each receive the entire 6 kW remaining at a connection, they can draw 12 kW. The guard allocates shared headroom before the arbiter issues individual commands.

The guard uses fresh measurements to establish headroom. It excludes assumed loads, loads it is stopping and demand an appliance can withdraw independently when those quantities would overstate safe export. A device’s commanded output and its confirmed output are separate observations. Grid constraints and measurement evidence.

The arbiter

Within the guard’s bounds, household overrides have priority over an external manager’s instruction, followed by the current plan and the local fallback. A device must also be able to realise the request. For example, cutting a three-phase EV charger below its minimum charging current can require a pause.

The arbiter tracks energy delivered over the slot. If an appliance briefly draws less than requested, the remaining target reflects the actual delivery.

The plan also states the grid exchange it expects in each slot, and a battery is held to it. Suppose a cloud removes the surplus a charge was planned into. The battery then charges only as far as keeps the import at the plan’s figure, instead of buying the rest at that slot’s price. In the same way, a discharge planned to cover the house does not export to the grid when the house draws less. A charge the plan intended to take from the grid, on a cheap night, still takes it. This rule only reduces what plan tracking asks for. The guard bounds the result, and the next plan decides what the missing energy is worth. A stale plan expires. During fallback the gateway can continue local self-consumption control and enforce grid limits. Device commands.

The planner

The default horizon is 192 quarter-hours, or 48 hours. The gateway acts on the current slot and replans as measurements or household goals change. A battery needs a fresh state of charge to participate. A car needs a connected vehicle and sufficient state for its goal. An omitted device receives no target from that plan. Planner inputs and costs.

Measurements and network connections

Power follows the load convention throughout the control loop. Positive grid power means import. An inverter producing 3 kW reports −3 kW, so a 4 kW load served by that roof gives +1 kW at the connection. Domain model.

The gateway owns sockets, time and persistence. Domain crates take measurements, events and time as inputs. A simulation can therefore run the same guard and arbiter against a recorded sequence. Protocol drivers consume bytes and produce typed measurements or outbound frames. The gateway handles reconnects and schedules polling. A lost device is retried after 1 s, then after twice as long each time, up to a minute. The wait goes back to 1 s only once the device has answered, so a gateway that accepts a connection and closes it at once is not retried every second.

For network-assisted planning, the box requests prices from tariffd and weather from forecastd. It models its own roof and retains learned corrections locally. Loss of the network can reduce the quality of a plan while the local control loop continues to enforce its limits. External managers connect through a separately authorized S2 session. Forecasting · Fleet services · S2 flexibility.