diff --git a/CHANGELOG.md b/CHANGELOG.md index 6131e0bc..b4d17f31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/config_emhass.json b/config_emhass.json index bfe2643a..23b31a50 100644 --- a/config_emhass.json +++ b/config_emhass.json @@ -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}, diff --git a/config_emhass.yaml b/config_emhass.yaml index 21c86e3b..381475af 100644 --- a/config_emhass.yaml +++ b/config_emhass.yaml @@ -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 diff --git a/setup.py b/setup.py index 54808545..c8ab0170 100644 --- a/setup.py +++ b/setup.py @@ -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) diff --git a/src/emhass/optimization.py b/src/emhass/optimization.py index c4a1c05e..817d49e9 100644 --- a/src/emhass/optimization.py +++ b/src/emhass/optimization.py @@ -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: