One Cycle Battery Dispatch Heuristic

class hopp.simulation.technologies.dispatch.power_storage.one_cycle_battery_dispatch_heuristic.OneCycleBatteryDispatchHeuristic(pyomo_model: ConcreteModel, index_set: Set, system_model: BatteryStateful, financial_model: Singleowner, block_set_name: str = 'one_cycle_heuristic_battery', dispatch_options: dict | None = None)

Bases: SimpleBatteryDispatchHeuristic

One cycle per day heuristic battery dispatch.

__init__(pyomo_model: ConcreteModel, index_set: Set, system_model: BatteryStateful, financial_model: Singleowner, block_set_name: str = 'one_cycle_heuristic_battery', dispatch_options: dict | None = None)

Initialize OneCycleBatteryDispatchHeuristic.

Parameters:
  • pyomo_model (pyomo.ConcreteModel) – Pyomo concrete model.

  • index_set (pyomo.Set) – Indexed set.

  • system_model (BatteryModel.BatteryStateful) – Battery system model.

  • financial_model (Singleowner.Singleowner) – Financial model.

  • block_set_name (str, optional) – Name of the block set. Defaults to ‘one_cycle_heuristic_battery’.

  • dispatch_options (dict, optional) – Dispatch options. Defaults to None.

_heuristic_method(gen)

Sets battery dispatch using a one cycle per day assumption.

Method:
  • Sort input prices

  • Determine the duration required to fully discharge and charge the battery

  • Set discharge and charge operations based on sorted prices

  • Check SOC feasibility

  • If infeasible, find infeasibility, shift operation to the next sorted price periods

  • Repeat step 4 until SOC feasible

NOTE: If operation is tried on half of time periods, then operation defaults to ‘do nothing’

_discharge_battery(discharge_remaining, next_discharge_idx, sorted_prices, fixed_dispatch)

Discharges battery using the remaining discharge and the next best discharge period.

Returns:

Adjusted fixed dispatch and next discharge index to be tried.

Return type:

Tuple[list, int]

_charge_battery(charge_remaining, next_charge_idx, sorted_prices, fixed_dispatch)

Charges battery using the remaining charge and the next best charge period.

Returns:

Adjusted fixed dispatch and next charge index to be tried.

Return type:

Tuple[list, int]

_get_duration_battery_full_cycle() Tuple[float, float]

Calculates discharge and charge hours required to fully cycle the battery.

Returns:

Discharge and charge hours.

Return type:

Tuple[float, float]

test_soc_feasibility(fixed_dispatch) Tuple[bool, int]

Steps through fixed_dispatch and tests SOC feasibility.

Returns:

Tuple indicating SOC feasibility and index of first infeasible operation.

Return type:

Tuple[bool, int]

static _check_efficiency_value(efficiency)

Checks efficiency is between 0 and 1 or 0 and 100. Returns fractional value

_check_initial_soc(initial_soc)

Checks initial state-of-charge.

Parameters:

initial_soc – Initial state-of-charge value.

Returns:

Checked initial state-of-charge.

Return type:

float

_create_capacity_parameter(storage)

Creates storage capacity parameter.

Parameters:

storage – Storage instance.

_create_efficiency_parameters(storage)

Creates storage efficiency parameters.

Parameters:

storage – Storage instance.

_create_lifecycle_count_constraint()

Creates lifecycle count constraint.

_create_lifecycle_model()

Creates lifecycle model.

_create_port(hybrid)

Creates storage port.

Parameters:

hybrid – Hybrid instance.

Returns:

Storage port.

Return type:

Port

_create_soc_inventory_constraint(storage)

Creates state-of-charge inventory constraint for storage.

Parameters:

storage – Storage instance.

_create_soc_linking_constraint()

Creates state-of-charge linking constraint.

_create_storage_constraints(storage)
_create_storage_parameters(storage)

Creates storage parameters.

Parameters:

storage – Storage instance.

static _create_storage_port(storage)

Creates storage port.

Parameters:

storage – Storage instance.

_create_storage_variables(storage)

Creates storage variables.

Parameters:

storage – Storage instance.

_create_variables(hybrid)

Creates storage variables.

Parameters:

hybrid – Hybrid instance.

Returns:

Tuple containing battery discharge and charge variables.

Return type:

Tuple

_enforce_power_fraction_limits()

Enforces battery power fraction limits and sets _fixed_dispatch attribute.

_fix_dispatch_model_variables()

Fixes dispatch model variables based on the fixed dispatch values.

_lifecycle_count_rule(m, i)

Calculates lifecycle count rule.

Parameters:
  • m – Model instance.

  • i – Index.

Returns:

Lifecycle count.

Return type:

float

_set_control_mode()

Sets control mode.

_set_model_specific_parameters(round_trip_efficiency=88.0)

Sets model-specific parameters.

Parameters:

round_trip_efficiency (float, optional) – The round-trip efficiency including converter efficiency. Defaults to 88.0, which includes converter efficiency.

_set_power_fraction_limits(gen: list, grid_limit: list)

Set battery charge and discharge power fraction limits based on available generation and grid capacity, respectively.

Parameters:
  • gen (list) – Generation blocks.

  • grid_limit (list) – Grid capacity.

NOTE: This method assumes that battery cannot be charged by the grid.

property blocks: Block
property capacity: float

Capacity.

property charge_efficiency: float

Charge efficiency.

property charge_power: list

Charge power.

check_gen_grid_limit(gen: list, grid_limit: list)

Checks if generation and grid limit lengths match fixed_dispatch length.

Parameters:
  • gen (list) – Generation blocks.

  • grid_limit (list) – Grid capacity.

Raises:

ValueError – If gen or grid_limit length does not match fixed_dispatch length.

property cost_per_charge: float

Cost per charge.

property cost_per_discharge: float

Cost per discharge.

property current: list

Current.

property discharge_efficiency: float

Discharge efficiency.

property discharge_power: list

Discharge power.

dispatch_block_rule(storage)
Initializes storage parameters, variables, and constraints.

Called during Dispatch’s __init__.

Parameters:

storage – Storage instance.

static enforce_power_fraction_simple_bounds(power_fraction: float) float

Enforces simple bounds (0, .9) for battery power fractions.

Parameters:

power_fraction (float) – Power fraction from heuristic method.

Returns:

Bounded power fraction.

Return type:

power_fraction (float)

property fixed_dispatch: list

List of fixed dispatch.

Type:

list

property generation: list

Generation.

property initial_soc: float

Initial state-of-charge.

initialize_parameters()

Initializes parameters.

property is_charging: list

Storage is charging.

property is_discharging: list

Storage is discharging.

property lifecycle_cost: float

Lifecycle cost.

property lifecycle_cost_per_kWh_cycle: float

Lifecycle cost per kWh cycle.

property lifecycles: float

Lifecycles.

max_gross_profit_objective(hybrid_blocks)

Sets the max gross profit objective for the dispatch.

Parameters:

hybrid_blocks (Pyomo.block) – A generalized container for defining hierarchical models by adding modeling components as attributes.

property maximum_power: float

Maximum power.

property maximum_soc: float

Maximum state-of-charge.

min_operating_cost_objective(hybrid_blocks)

Sets the min operating cost objective for the dispatch.

Parameters:

hybrid_blocks (Pyomo.block) – A generalized container for defining hierarchical models by adding modeling components as attributes.

property minimum_power: float

Minimum power.

property minimum_soc: float

Minimum state-of-charge.

property model: ConcreteModel
property power: list

Power.

property round_trip_efficiency: float

Round trip efficiency.

set_fixed_dispatch(gen: list, grid_limit: list)

Sets charge and discharge power of battery dispatch using fixed_dispatch attribute and enforces available generation and grid limits.

Parameters:
  • gen (list) – Generation blocks.

  • grid_limit (list) – Grid capacity.

Raises:

ValueError – If gen or grid_limit length does not match fixed_dispatch length.

property soc: list

State-of-charge.

property time_duration: list

Time duration.

update_dispatch_initial_soc(initial_soc: float | None = None)

Updates dispatch initial state of charge (SOC).

Parameters:

initial_soc (float, optional) – Initial state of charge. Defaults to None.

update_soc(power_fraction: float, soc0: float) float

Updates SOC based on power fraction threshold (0.1).

Parameters:
  • power_fraction (float) – Power fraction from heuristic method. Below threshold is charging, above is discharging.

  • soc0 (float) – Initial SOC.

Returns:

Updated SOC.

Return type:

soc (float)

update_time_series_parameters(start_time: int)

Updates time series parameters.

Parameters:

start_time (int) – The start time.

property user_fixed_dispatch: list

List of user fixed dispatch.

Type:

list

property prices: list

List of normalized prices [-1, 1] (Charging (-), Discharging (+)).

Returns:

Prices.

Return type:

list