Skip to content

Commit

Permalink
Fix - Some minor fixes, see changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
davidusb-geek committed May 21, 2023
1 parent 19fdde4 commit d3a34c9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.4.10] - 2023-05-21
### Fix
- Fixed wrong name of new cost sensor.
- Fixed units of measurements of costs to €/kWh.
- Added color sequence to plot figures, now avery line should be plotted with a different color.

## [0.4.9] - 2023-05-20
### Fix
- Updated default value for total number of days for ML model training.
Expand Down
4 changes: 2 additions & 2 deletions src/emhass/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def treat_runtimeparams(runtimeparams: str, params: str, retrieve_hass_conf: dic
'custom_batt_soc_forecast_id': {"entity_id": "sensor.soc_batt_forecast", "unit_of_measurement": "%", "friendly_name": "Battery SOC Forecast"},
'custom_grid_forecast_id': {"entity_id": "sensor.p_grid_forecast", "unit_of_measurement": "W", "friendly_name": "Grid Power Forecast"},
'custom_cost_fun_id': {"entity_id": "sensor.total_cost_fun_value", "unit_of_measurement": "", "friendly_name": "Total cost function value"},
'custom_unit_load_cost_id': {"entity_id": "sensor.unit_load_cost", "unit_of_measurement": "€", "friendly_name": "Unit Load Cost"},
'custom_unit_prod_price_id': {"entity_id": "sensor.unit_prod_price", "unit_of_measurement": "€", "friendly_name": "Unit Prod Price"},
'custom_unit_load_cost_id': {"entity_id": "sensor.unit_load_cost", "unit_of_measurement": "€/kWh", "friendly_name": "Unit Load Cost"},
'custom_unit_prod_price_id': {"entity_id": "sensor.unit_prod_price", "unit_of_measurement": "€/kWh", "friendly_name": "Unit Prod Price"},
'custom_deferrable_forecast_id': custom_deferrable_forecast_id}
if 'passed_data' in params.keys():
for key, value in default_passed_dict.items():
Expand Down
13 changes: 10 additions & 3 deletions src/emhass/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@
def get_injection_dict(df, plot_size = 1366):
# Create plots
cols_p = [i for i in df.columns.to_list() if 'P_' in i]
n_colors = len(cols_p)
colors = px.colors.sample_colorscale("jet", [n/(n_colors -1) for n in range(n_colors)])
fig_0 = px.line(df[cols_p], title='Systems powers schedule after optimization results',
template='presentation', width=plot_size, height=0.5*plot_size, line_shape="hv")
template='presentation', width=plot_size, height=0.5*plot_size, line_shape="hv",
color_discrete_sequence=colors)
fig_0.update_layout(xaxis_title='Timestamp', yaxis_title='System powers (W)')
if 'SOC_opt' in df.columns.to_list():
fig_1 = px.line(df['SOC_opt'], title='Battery state of charge schedule after optimization results',
template='presentation', width=plot_size, height=0.5*plot_size, line_shape="hv")
template='presentation', width=plot_size, height=0.5*plot_size, line_shape="hv",
color_discrete_sequence=colors)
fig_1.update_layout(xaxis_title='Timestamp', yaxis_title='Battery SOC (%)')
cols_cost = [i for i in df.columns.to_list() if 'cost_' in i or 'unit_' in i]
n_colors = len(cols_cost)
colors = px.colors.sample_colorscale("jet", [n/(n_colors -1) for n in range(n_colors)])
fig_2 = px.line(df[cols_cost], title='Systems costs obtained from optimization results',
template='presentation', width=plot_size, height=0.5*plot_size, line_shape="hv")
template='presentation', width=plot_size, height=0.5*plot_size, line_shape="hv",
color_discrete_sequence=colors)
fig_2.update_layout(xaxis_title='Timestamp', yaxis_title='System costs (currency)')
# Get full path to image
image_path_0 = fig_0.to_html(full_html=False, default_width='75%')
Expand Down

0 comments on commit d3a34c9

Please sign in to comment.