Skip to content

Commit

Permalink
Imp - Added option to ## [0.2.11] - 2022-04-28
Browse files Browse the repository at this point in the history
  • Loading branch information
David HERNANDEZ authored and David HERNANDEZ committed Apr 29, 2022
1 parent 1e2c20e commit 7ad84eb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.11] - 2022-04-28
### Improvement
- Added config parameter to consider that all PV power is injected to the grid

## [0.2.11] - 2022-04-28
### Fix
- Fixed wrong handling of DateTimeIndex when dealing with forecast method for list of values and csv read.
Expand Down
3 changes: 2 additions & 1 deletion config_emhass.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
{"var_interp": ["sensor.power_photovoltaics", "sensor.power_load_no_var_loads"]}
],
"optim_conf":
[
[
{"set_total_pv_sell": false},
{"set_use_battery": false},
{"delta_forecast": 1},
{"num_def_loads": 2},
Expand Down
1 change: 1 addition & 0 deletions config_emhass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ retrieve_hass_conf:
- 'sensor.power_load_no_var_loads'

optim_conf:
- set_total_pv_sell: False # consider that all PV power is injected to the grid (self-consumption with total sell)
- set_use_battery: False # consider a battery storage
- delta_forecast: 1 # days
- num_def_loads: 2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setup(
name='emhass', # Required
version='0.2.11', # Required
version='0.2.12', # Required
description='An Energy Management System for Home Assistant', # Optional
long_description=long_description, # Optional
long_description_content_type='text/markdown', # Optional (see note above)
Expand Down
19 changes: 14 additions & 5 deletions src/emhass/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,21 @@ def perform_optimization(self, data_opt: pd.DataFrame, P_PV: np.array,
for i in set_I:
P_def_sum.append(plp.lpSum(P_deferrable[k][i] for k in range(self.optim_conf['num_def_loads'])))
if self.costfun == 'profit':
objective = plp.lpSum(-0.001*self.timeStep*(unit_load_cost[i]*(P_load[i] + P_def_sum[i]) + \
unit_prod_price[i] * P_grid_neg[i])
for i in set_I)
if self.optim_conf['set_total_pv_sell']:
objective = plp.lpSum(-0.001*self.timeStep*(unit_load_cost[i]*(P_load[i] + P_def_sum[i]) + \
unit_prod_price[i]*P_grid_neg[i])
for i in set_I)
else:
objective = plp.lpSum(-0.001*self.timeStep*(unit_load_cost[i]*P_grid_pos[i] + \
unit_prod_price[i]*P_grid_neg[i])
for i in set_I)
elif self.costfun == 'cost':
objective = plp.lpSum(-0.001*self.timeStep*unit_load_cost[i]*(P_load[i] + P_def_sum[i])
for i in set_I)
if self.optim_conf['set_total_pv_sell']:
objective = plp.lpSum(-0.001*self.timeStep*unit_load_cost[i]*P_grid_pos[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])
for i in set_I)
elif self.costfun == 'self-consumption':
objective = plp.lpSum(0.001*self.timeStep*unit_load_cost[i]*SC[i] for i in set_I)
else:
Expand Down

0 comments on commit 7ad84eb

Please sign in to comment.