dove.models package#
Model registry and builder pattern implementation for DOVE.
This module provides a registry system for model builders in the DOVE framework. It allows different model building strategies to be registered and retrieved by name.
- The module defines:
BUILDER_REGISTRY: A dictionary mapping model builder names to their classes
register_builder: A decorator for registering model builder classes
Examples
- To register a new model builder:
``` @register_builder(βmy_modelβ) class MyModelBuilder(BaseModelBuilder):
β¦
- To access a registered builder:
` builder_cls = BUILDER_REGISTRY["my_model"] builder = builder_cls(...) `
- class dove.models.PriceTakerBuilder[source]
Bases:
BaseModelBuilder
Builder class for creating price taker optimization models.
This class implements the builder pattern to construct a price taker optimization model step by step. A price taker model represents a participant in an energy market that accepts prices as given and optimizes their operations accordingly.
The builder adds sets, variables, constraints, and an objective function to the optimization model, and provides methods to solve it and extract results.
- model
The Pyomo concrete model being constructed.
- Type:
pyo.ConcreteModel
- system
The energy system being modeled, containing components, resources, and time indices.
- Type:
Examples
>>> builder = PriceTakerBuilder(system) >>> model = builder.build().solve() >>> results = builder.extract_results()
- Parameters:
system (
System
)
- build()[source]
Build the price taker optimization model.
Creates a Pyomo concrete model and adds the necessary sets, variables, constraints, and objective function to formulate the price taker optimization problem.
- Returns:
The builder instance, allowing for method chaining.
- Return type:
Self
- extract_results()[source]
Extract results from the solved model into a DataFrame.
Collects flow values for all resources produced or consumed by components, as well as state of charge and charge/discharge rates for storage components.
- Returns:
A DataFrame containing the optimization results with time index and columns for each component-resource flow and storage variables.
- Return type:
pd.DataFrame
- solve(**kw)[source]
Solve the built optimization model.
- Parameters:
**kw (Any) β
Keyword arguments for the solver configuration. - solver : str, optional
The solver to use for optimization, default is βcbcβ.
- Returns:
The solved Pyomo model.
- Return type:
pyo.ConcreteModel
Subpackages#
- dove.models.price_taker package
dove.models.price_taker
PriceTakerBuilder
- Submodules
- dove.models.price_taker.builder module
- dove.models.price_taker.rulelib module
dove.models.price_taker.rulelib
transfer_rule()
max_capacity_rule()
min_capacity_rule()
ramp_up_rule()
ramp_down_rule()
ramp_track_up_rule()
ramp_track_down_rule()
ramp_bin_up_rule()
ramp_bin_down_rule()
ramp_freq_window_rule()
steady_state_upper_rule()
steady_state_lower_rule()
state_selection_rule()
balance_rule()
storage_balance_rule()
charge_limit_rule()
discharge_limit_rule()
soc_limit_rule()
periodic_storage_rule()
objective_rule()
Submodules#
dove.models.base module#
dove.models.base
#
Base module providing abstract base classes for model builders in the DOVE system.
This module defines the foundation for all model builders, which are responsible for creating, solving, and extracting results from computational models.
- class dove.models.base.BaseModelBuilder[source]#
Bases:
ABC
Abstract base class for all model builders in the DOVE system.
This class defines the interface that all model builders must implement, providing a consistent workflow for building, solving, and extracting results from models.
- model#
The constructed model object (initialized to None).
- Type:
Any
- Parameters:
system (
System
)
- __init__(system)[source]#
Initialize a model builder.
- Parameters:
system (System) β Reference to the DOVE system instance.
- Return type:
None
- abstractmethod build()[source]#
Build a model based on the system configuration.
This method should create and populate the model structure based on the current system state.
- Returns:
The built model object.
- Return type:
Any