hyveopt.single_bus_pv_el_battery_det package
Submodules
hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det module
- class hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.PlanningTimeConfig(planning_horizon_start: Timestamp, planning_horizon_end: Timestamp, scenarios_per_year: int, scenario_resolution: str, scenario_subsampling: str)[source]
Bases:
SerializableDataClass
Configuration class for defining time-related parameters in a planning horizon.
- Parameters:
planning_horizon_start (str or pandas.Timestamp) – The start date of the planning horizon. If a string is provided, it will be converted to a pandas.Timestamp.
planning_horizon_end (str or pandas.Timestamp) – The end date of the planning horizon. If a string is provided, it will be converted to a pandas.Timestamp.
scenarios_per_year (int) – Number of representative scenarios to generate per year.
scenario_resolution (str) – Temporal resolution of each scenario. For example, ‘1D’ represents daily scenarios, ‘1W’ represents weekly scenarios, etc.
scenario_subsampling (str) – Subsampling frequency used for dynamic modeling purposes, such as battery simulation within the defined scenario. For example, ‘1h’ for hourly subsampling.
- Raises:
ValueError – If planning_horizon_end is earlier than or equal to planning_horizon_start.
Examples
Create a time configuration for a planning horizon from 2025 to 2065 with daily scenarios and hourly subsampling:
```python time_config = TimeConfig(
planning_horizon_start=’2025-01-01’, planning_horizon_end=’2065-12-31’, scenarios_per_year=12, scenario_resolution=’1D’, scenario_subsampling=’1h’
)
- property range: DatetimeIndex
Returns the range of dates from planning_horizon_start to planning_horizon_end at the resolution specified by scenario_resolution.
- Returns:
pd.DatetimeIndex – A range of dates between planning_horizon_start and planning_horizon_end using the frequency defined in scenario_resolution.
Examples
>>> time_config = TimeConfig( ... planning_horizon_start='2025-01-01', ... planning_horizon_end='2025-12-31', ... scenarios_per_year=12, ... scenario_resolution='1D', ... scenario_subsampling='1h' ... ) >>> time_config.range DatetimeIndex(['2025-01-01', '2025-01-02', ..., '2025-12-31'], dtype='datetime64[ns]', freq='D')
- class hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.SCIPSolution(el_size: float, pv_size: float, bat_size: float, bat_pin: pandas.core.frame.DataFrame, bat_pout: pandas.core.frame.DataFrame, bat_soc: pandas.core.frame.DataFrame, pv_gen: pandas.core.frame.DataFrame, el_gen: pandas.core.frame.DataFrame)[source]
Bases:
object
- class hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.SerializableDataClass[source]
Bases:
object
- class hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.SingleBusDesignData(plant_template: hyveopt.pdata.PlantTemplate, tsdata: shilps.components.DataTimeSeries, time_config: hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.PlanningTimeConfig, budget_inv_M: float = 100.0)[source]
Bases:
SerializableDataClass
- static generate_tsdata(plant_template: PlantTemplate, time_config: PlanningTimeConfig) DataTimeSeries [source]
- property n_years
- plant_template: PlantTemplate
- property sce_default
- time_config: PlanningTimeConfig
- tsdata: DataTimeSeries
- property years
Returns a sorted list of years in the time series data.
- class hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.SingleBusDesignModel(pdata: SingleBusDesignData)[source]
Bases:
object
- AMPL_MODEL = '/home/jp/Dropbox/Projects/event_simulator/hyveopt/src/hyveopt/single_bus_pv_el_battery_det/single_bus_pv_el_battery_det.mod'
- depr_rate_sce(scenario: int) float [source]
Returns the depreciation rate for a given scenario.
- Parameters:
scenario (int) – The scenario index.
- Returns:
float – The depreciation rate for the scenario.
- plot_daily_profiles(solution: SCIPSolution)[source]
- plot_solution(solution: SCIPSolution)[source]
Plots key variables (PV generation, Electrolyzer generation, Battery SOC) for each scenario, with the x-axis representing hours.
- retrieve_scip_solution() SCIPSolution [source]
- hyveopt.single_bus_pv_el_battery_det.single_bus_pv_el_battery_det.generate_scenario_time_ranges(time_config: PlanningTimeConfig) Dict[Tuple[int, int], DatetimeIndex] [source]
Generate a set of time ranges indexed by a tuple (year, scenario), where each time range corresponds to a randomly selected time period within the year, using the scenario resolution and scenario subsampling frequency from the TimeConfig.
- Parameters:
time_config (TimeConfig) – The configuration that defines the planning horizon, scenario resolution, and subsampling frequency.
- Returns:
Dict[Tuple[int, int], pd.DatetimeIndex] – A dictionary where the keys are tuples (year, scenario), and the values are the corresponding time ranges with subsampling frequency.