battery.hpp file
Header for battery energy storage components.
This module defines data structures for representing battery energy storage systems (BESS) in power system planning models. A battery stores and releases electrical energy between time blocks, subject to capacity and efficiency constraints. It is coupled to the electrical network through a Converter that links it to a discharge Generator and a charge Demand.
Standalone battery (unified definition)
When the optional bus field is set (without source_generator), the system automatically generates the associated Generator (discharge path), Demand (charge path), and Converter during preprocessing — no separate elements are needed. Both charge and discharge connect to the same external bus:
{ "uid": 1, "name": "bess1", "bus": 3, "input_efficiency": 0.95, "output_efficiency": 0.95, "emin": 0, "emax": 100, "capacity": 100, "pmax_charge": 60, "pmax_discharge": 60, "gcost": 0 }
Generation-coupled battery (hybrid / behind-the-meter)
When both bus and source_generator are set, the battery is in generation-coupled mode: the source_generator directly feeds the battery charge path through an auto-created internal bus. System::expand_batteries() will:
- Create an internal bus (name = battery.name + "_int_bus")
- Connect the discharge Generator to the external
bus - Connect the charge Demand to the internal bus
- Set the
source_generator's bus to the internal bus
The source_generator should have no bus set, or its bus will be overwritten with the internal bus.
{ "uid": 1, "name": "bess1", "bus": 3, "source_generator": "solar1", "input_efficiency": 0.95, "output_efficiency": 0.95, "emin": 0, "emax": 100, "capacity": 100, "pmax_charge": 60, "pmax_discharge": 60, "gcost": 0 }
Traditional multi-element definition
Without the bus field, a separate Converter, Generator, and Demand must be defined manually to couple the battery to the electrical network:
{ "uid": 1, "name": "bess1", "input_efficiency": 0.95, "output_efficiency": 0.95, "emin": 0, "emax": 100, "capacity": 100 }
Fields that accept a number/array/string value can hold:
- A scalar constant
- A 1-D inline array indexed by
[stage] - A filename string referencing a Parquet/CSV schedule in
input_directory/Battery/
Namespaces
- namespace gtopt
Classes
- struct gtopt::Battery
- Represents a battery energy storage system (BESS)