Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update optimization.py #135

Merged
merged 2 commits into from
Dec 15, 2023
Merged
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
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 @@
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])

Check warning on line 207 in src/emhass/optimization.py

View check run for this annotation

Codecov / codecov/patch

src/emhass/optimization.py#L207

Added line #L207 was not covered by tests
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 @@
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]

Check warning on line 454 in src/emhass/optimization.py

View check run for this annotation

Codecov / codecov/patch

src/emhass/optimization.py#L454

Added line #L454 was not covered by tests
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
Loading