Skip to content

Commit

Permalink
Merge pull request #135 from onIon-energy/michaelpiron-patch-1
Browse files Browse the repository at this point in the history
Update optimization.py
  • Loading branch information
davidusb-geek authored Dec 15, 2023
2 parents bec6f76 + d77c4f6 commit 4aa01ad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/emhass/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ def perform_optimization(self, data_opt: pd.DataFrame, P_PV: np.array, P_load: n
for i in set_I)
elif self.costfun == 'cost':
if self.optim_conf['set_total_pv_sell']:
objective = plp.lpSum(-0.001*self.timeStep*unit_load_cost[i]*P_grid_pos[i]
objective = plp.lpSum(-0.001*self.timeStep*unit_load_cost[i]*(P_load[i] + P_def_sum[i])
for i in set_I)
else:
objective = plp.lpSum(-0.001*self.timeStep*unit_load_cost[i]*(P_load[i] + P_def_sum[i])
objective = plp.lpSum(-0.001*self.timeStep*unit_load_cost[i]*P_grid_pos[i]
for i in set_I)
elif self.costfun == 'self-consumption':
if type_self_conso == 'bigm':
Expand Down Expand Up @@ -450,7 +450,10 @@ def perform_optimization(self, data_opt: pd.DataFrame, P_PV: np.array, P_load: n
opt_tp["cost_fun_profit"] = [-0.001*self.timeStep*(unit_load_cost[i]*P_grid_pos[i].varValue + \
unit_prod_price[i]*P_grid_neg[i].varValue) for i in set_I]
elif self.costfun == 'cost':
opt_tp["cost_fun_cost"] = [-0.001*self.timeStep*unit_load_cost[i]*(P_load[i] + P_def_sum_tp[i]) for i in set_I]
if self.optim_conf['set_total_pv_sell']:
opt_tp["cost_fun_cost"] = [-0.001*self.timeStep*unit_load_cost[i]*(P_load[i] + P_def_sum_tp[i]) for i in set_I]
else:
opt_tp["cost_fun_cost"] = [-0.001*self.timeStep*unit_load_cost[i]*P_grid_pos[i].varValue for i in set_I]
elif self.costfun == 'self-consumption':
if type_self_conso == 'maxmin':
opt_tp["cost_fun_selfcons"] = [-0.001*self.timeStep*unit_load_cost[i]*SC[i].varValue for i in set_I]
Expand Down

0 comments on commit 4aa01ad

Please sign in to comment.