Skip to content

Commit

Permalink
Added missing parameter in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
davidusb-geek committed Jun 2, 2024
1 parent e666fdd commit fc13e55
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 109 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.10.0 - Unreleased
### Improvement
- Added support for hybrid inverters
- Implemented a new `continual_publish` service that avoid the need of setting a special automation for data publish. Thanks to @GeoDerp
- Implement a deferrable load start penalty functionality. Thanks to @werdnum
- This feature also implement a `def_current_state` that can be passed at runtime to let the optimization consider that a deferrable load is currently scheduled or under operation when launching the optimization task
### Fix
- Fixed forecast methods to treat delta_forecast higher than 1 day
- Fixed solar.forecast wrong interpolation of nan values

## 0.9.1 - 2024-05-13
### Fix
- Fix patch for issue with paths to modules and inverters database
Expand Down
1 change: 1 addition & 0 deletions config_emhass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ plant_conf:
- 16
strings_per_inverter: # The number of used strings per inverter
- 1
inverter_is_hybrid: False # Set if it is a hybrid inverter (PV+batteries) or not
Pd_max: 1000 # If your system has a battery (set_use_battery=True), the maximum discharge power in Watts
Pc_max: 1000 # If your system has a battery (set_use_battery=True), the maximum charge power in Watts
eta_disch: 0.95 # If your system has a battery (set_use_battery=True), the discharge efficiency
Expand Down
1 change: 1 addition & 0 deletions options.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"strings_per_inverter": 1
}
],
"inverter_is_hybrid": false,
"set_use_battery": false,
"battery_discharge_power_max": 1000,
"battery_charge_power_max": 1000,
Expand Down
6 changes: 3 additions & 3 deletions scripts/script_debug_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
optim_conf.update({'lp_solver_path': 'empty'}) # set the path to the LP solver, COIN_CMD default is /usr/bin/cbc
optim_conf.update({'treat_def_as_semi_cont': [True, True]})
optim_conf.update({'set_def_constant': [False, False]})
optim_conf.update({'P_deferrable_nom': [[500.0, 100.0, 100.0, 500.0], 750.0]})
# optim_conf.update({'P_deferrable_nom': [[500.0, 100.0, 100.0, 500.0], 750.0]})

optim_conf.update({'set_use_battery': False})
optim_conf.update({'set_nocharge_from_grid': False})
optim_conf.update({'set_battery_dynamic': True})
optim_conf.update({'set_nodischarge_to_grid': True})

optim_conf.update({'inverter_is_hybrid': False})
plant_conf.update({'inverter_is_hybrid': True})

df_input_data.loc[df_input_data.index[25:30],'unit_prod_price'] = -0.07
df_input_data['P_PV_forecast'] = df_input_data['P_PV_forecast']*2
Expand All @@ -102,7 +102,7 @@
fig_inputs_dah.show()

vars_to_plot = ['P_deferrable0', 'P_deferrable1','P_grid', 'P_PV', 'P_PV_curtailment']
if optim_conf['inverter_is_hybrid']:
if plant_conf['inverter_is_hybrid']:
vars_to_plot = vars_to_plot + ['P_hybrid_inverter']
if optim_conf['set_use_battery']:
vars_to_plot = vars_to_plot + ['P_batt']
Expand Down
8 changes: 4 additions & 4 deletions src/emhass/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def perform_optimization(self, data_opt: pd.DataFrame, P_PV: np.array, P_load: n
if self.costfun == 'self-consumption':
SC = {(i):plp.LpVariable(cat='Continuous',
name="SC_{}".format(i)) for i in set_I}
if self.optim_conf['inverter_is_hybrid']:
if self.plant_conf['inverter_is_hybrid']:
P_hybrid_inverter = {(i):plp.LpVariable(cat='Continuous',
name="P_hybrid_inverter{}".format(i)) for i in set_I}
P_PV_curtailment = {(i):plp.LpVariable(cat='Continuous', lowBound=0,
Expand Down Expand Up @@ -264,7 +264,7 @@ def perform_optimization(self, data_opt: pd.DataFrame, P_PV: np.array, P_load: n

## Setting constraints
# The main constraint: power balance
if self.optim_conf['inverter_is_hybrid']:
if self.plant_conf['inverter_is_hybrid']:
constraints = {"constraint_main1_{}".format(i) :
plp.LpConstraint(
e = P_hybrid_inverter[i] - P_def_sum[i] - P_load[i] + P_grid_neg[i] + P_grid_pos[i] ,
Expand Down Expand Up @@ -298,7 +298,7 @@ def perform_optimization(self, data_opt: pd.DataFrame, P_PV: np.array, P_load: n
P_nom_inverter = inverter.Paco
else:
P_nom_inverter = self.plant_conf['inverter_model']
if self.optim_conf['inverter_is_hybrid']:
if self.plant_conf['inverter_is_hybrid']:
constraints.update({"constraint_hybrid_inverter1_{}".format(i) :
plp.LpConstraint(
e = P_PV[i] - P_PV_curtailment[i] + P_sto_pos[i] + P_sto_neg[i] - P_nom_inverter,
Expand Down Expand Up @@ -642,7 +642,7 @@ def create_matrix(input_list, n):
SOC_opt.append(SOCinit - SOC_opt_delta[i])
SOCinit = SOC_opt[i]
opt_tp["SOC_opt"] = SOC_opt
if self.optim_conf['inverter_is_hybrid']:
if self.plant_conf['inverter_is_hybrid']:
opt_tp["P_hybrid_inverter"] = [P_hybrid_inverter[i].varValue for i in set_I]
opt_tp["P_PV_curtailment"] = [P_PV_curtailment[i].varValue for i in set_I]
opt_tp.index = data_opt.index
Expand Down
Loading

0 comments on commit fc13e55

Please sign in to comment.