Segments¶
Segments are the building blocks that define connection behavior. Each connection composes an ordered segment chain to apply limits, efficiency losses, pricing, or internal balancing.
Composing connections¶
Segments are functional transforms on power flow expressions.
The Connection creates LP variables for power_in and passes them through its segment chain.
Each segment receives a power_in expression at construction time and exposes a power_out expression.
Most segments are identity transforms — they return the input unchanged and add constraints or costs as side effects:
- Identity segments:
power_out = power_in, add constraint/cost. - Transform segments:
power_out = power_in * factor(e.g., efficiency). - Auxiliary segments:
power_out = power_in, create auxiliary LP variables for penalties.
This design means:
- Segments do not create power flow LP variables.
- Variable count = connection flow decisions (T) + auxiliary variables only.
- Segments are composable and order-independent for identity transforms.
Segment types¶
- SOC pricing segment for battery SOC penalty costs.
- Efficiency segment for loss modeling.
- Power limit segment for power limits.
- Pricing segment for transfer costs and fees.
- Passthrough segment for lossless flow with no constraints or cost.
Next steps¶
-
Connection model
Segment-based connection formulation.
-
Elements
Battery and Node model elements.
-
Implementation
View segment source code.