1 Electrical
azaroth08 edited this page 2026-01-31 17:20:37 +00:00

Electrical

The electrical system is modeled as a graph of Power Buses connected by Power Pins.

Devices do not push power directly to other devices. Instead, they connect to a Power Bus and declare how much power they can supply or how much power they require.

[ Device ] ── PowerPin ── PowerBus ── PowerPin ── [ Device ]

  • Devices declare how much power they want, or can supply
  • power pins connect devices to the bus
  • the bus connects multiple pins together to aggregate supply and demand
  • junction boxes transfer power between different buses

PowerPin

These are the connection points that link the devices to the distribution logic.

  • a pin belongs to one power bus
    • some devices, such as the junciton box, may have an internal private bus
  • pins are bidirectional
  • pins do not decide power flow
  • pins are passive; they react to the device telling them what they want
PowerPin
 ├─ ConnectedBus
 ├─ DeclaredSupply
 └─ DeclaredDemand 

PowerBus

The powerbus represents a collections of pins, forming a small electrical network.

PowerBus
 ├─ ConnectedPins[]
 ├─ TotalSupply
 └─ TotalDemand
  • Aggregate supply and demand from connected pins
  • expose the totals to other devices (such as the generator)
  • no energy storage capability
  • no prioritization or routing abilitiy

Power Consumption

Devices that require power declare their demand to the powerbus via the devices powerpin

[ Light Device ]
 ├─ Requests: 1.0 kW
 ├─ Observes: Available power
 └─ Activates only if demand is satisfied
  • devices do not pull power directy
    • they are only supplied with as much power as is available up to their demand
  • they do not communicate with other devices
  • they do not traverse the electrical network

Power Supply

Devices that generate power or are capable of injecting power into the PowerBus for ex. Generators, Docked power source, and batteries (these are consumpers and suppliers).

[ Generator ]
 ├─ Produces up to X kW
 ├─ Limited by fuel / damage
 └─ Declares supply to connected bus
  • supply is dynamic and can change over time
    • there may be a ramp up period where there is not enough power provided
    • storage devices will help maintain power if this occurs

Power Storage

Bidirectional energy storage device that uses powerbus power to charge, and supplies power when there is not enough power available on the grid.

[ Battery ]
 ├─ Single PowerPin
 ├─ Internal charge state
 ├─ Consumes power when surplus exists
 └─ Supplies power when demand exceeds supply
  • charge when excess power on grid
  • discharge when grid has a power deficit
  • special logic for bidirectional power flow from powerpin

Junction Box

A device that links multiple PowerBus together.

    [ Bus A ]
       │
  ┌────┴────┐
  │ Junction│
  └────┬────┘
       │
    [ Bus B ]
  • This done not merge differnt buses
    • provides an interface between bus A and bus C
  • observe supply and demand on each bus