Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Optimizer:
"""

def __init__(self, strategy: OptimizationStrategy, grid: GridConfig, batteries: List[BatteryConfig], time_series: TimeSeriesData,
eta_c: float = 0.95, eta_d: float = 0.95, M: float = 1e6, optimizer_settings: OptimizerSettings | None = None):
eta_c: float = 0.89, eta_d: float = 0.95, M: float = 1e6, optimizer_settings: OptimizerSettings | None = None):
"""
Optimizer Constructor
"""
Expand Down Expand Up @@ -615,8 +615,10 @@ def get_clean_objective_value(self):

# charge for import power demand rate. The demand rate is applied to the maximum
# power draw beyond the threshold within the time horizon.
p_max_imp_exc = None
if self.is_grid_demand_rate_active:
clean_objective += - self.grid.prc_p_exc_imp \
* pulp.value(self.variables['p_max_imp_exc'])
p_max_imp_exc = pulp.value(self.variables['p_max_imp_exc'])
if p_max_imp_exc is not None:
clean_objective += - self.grid.prc_p_exc_imp * p_max_imp_exc

return clean_objective
90 changes: 90 additions & 0 deletions test_cases/000-default-openapi-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"expected_response": {
"status": "Optimal",
"objective_value": 0,
"limit_violations": {
"grid_import_limit_exceeded": false,
"grid_export_limit_hit": false
},
"batteries": [
{
"charging_power": [
0
],
"discharging_power": [
0
],
"state_of_charge": [
0
]
}
],
"grid_import": [
0
],
"grid_export": [
0
],
"flow_direction": [
0
],
"grid_import_overshoot": [
0
],
"grid_export_overshoot": [
0
]
},
"request": {
"strategy": {
"charging_strategy": "string",
"discharging_strategy": "string"
},
"grid": {
"p_max_imp": 0,
"p_max_exp": 0,
"prc_p_exc_imp": 0
},
"batteries": [
{
"charge_from_grid": true,
"discharge_to_grid": true,
"s_capacity": 0,
"s_min": 0,
"s_max": 0,
"s_initial": 0,
"p_demand": [
0
],
"s_goal": [
0
],
"c_min": 0,
"c_max": 0,
"d_max": 0,
"p_a": 0,
"c_priority": 0
}
],
"time_series": {
"dt": [
0
],
"gt": [
0
],
"ft": [
0
],
"p_N": [
0
],
"p_E": [
0
]
},
"eta_c": 0.95,
"eta_d": 0.95
},
"test_items": {}
}
Loading