From cf13f62460c61a11adb2fa97f0723abb919d4142 Mon Sep 17 00:00:00 2001 From: GeoDerp <18461782+GeoDerp@users.noreply.github.com> Date: Sun, 29 Dec 2024 01:15:48 +0000 Subject: [PATCH 1/2] configuration page init pv switch --- src/emhass/static/configuration_list.html | 4 ++++ src/emhass/static/configuration_script.js | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/emhass/static/configuration_list.html b/src/emhass/static/configuration_list.html index 523f34f9..43878e34 100644 --- a/src/emhass/static/configuration_list.html +++ b/src/emhass/static/configuration_list.html @@ -29,6 +29,10 @@

Deferrable Loads

Solar System (PV)

+
diff --git a/src/emhass/static/configuration_script.js b/src/emhass/static/configuration_script.js index b24267dd..69376a35 100644 --- a/src/emhass/static/configuration_script.js +++ b/src/emhass/static/configuration_script.js @@ -121,7 +121,7 @@ function loadConfigurationListView(param_definitions, config, list_html) { } //list parameters used in the section headers - header_input_list = ["set_use_battery", "number_of_deferrable_loads"]; + header_input_list = ["set_use_battery", "set_use_pv", "number_of_deferrable_loads"]; //get the main container and append list template html document.getElementById("configuration-container").innerHTML = list_html; @@ -265,7 +265,7 @@ function buildParamContainers( }); //check initial checkbox state, check "value" of input and match to "checked" value - let checkbox = document.querySelectorAll("input[type='checkbox']"); + let checkbox = SectionContainer.querySelectorAll("input[type='checkbox']"); checkbox.forEach(function (answer) { let value = answer.value === "true"; answer.checked = value; @@ -559,6 +559,19 @@ function headerElement(element, param_definitions, config) { } break; + //if set_use_pv, add or remove PV section (inc. related params) + case "set_use_pv": + if (element.checked) { + param_container.innerHTML = ""; + buildParamContainers("Solar System (PV)", param_definitions["Solar System (PV)"], config, [ + "set_use_pv", + ]); + element.checked = true; + } else { + param_container.innerHTML = ""; + } + break; + //if number_of_deferrable_loads, the number of inputs in the "Deferrable Loads" section should add up to number_of_deferrable_loads value in header case "number_of_deferrable_loads": //get a list of param in section From aeab3ef5730760b1c946b254cb62c156fd5914a4 Mon Sep 17 00:00:00 2001 From: GeoDerp <18461782+GeoDerp@users.noreply.github.com> Date: Sun, 29 Dec 2024 03:30:14 +0000 Subject: [PATCH 2/2] set_input_data_dict run get_weather_forecast if method list --- src/emhass/command_line.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/emhass/command_line.py b/src/emhass/command_line.py index 22fd74bd..3f8220ec 100644 --- a/src/emhass/command_line.py +++ b/src/emhass/command_line.py @@ -154,7 +154,10 @@ def set_input_data_dict( P_PV_forecast, P_load_forecast, df_input_data_dayahead = None, None, None elif set_type == "dayahead-optim": # Get PV and load forecasts - if optim_conf['set_use_pv']: + if ( + optim_conf["set_use_pv"] + or optim_conf.get("weather_forecast_method", None) == "list" + ): df_weather = fcst.get_weather_forecast( method=optim_conf["weather_forecast_method"] ) @@ -244,7 +247,10 @@ def set_input_data_dict( return False df_input_data = rh.df_final.copy() # Get PV and load forecasts - if optim_conf['set_use_pv']: + if ( + optim_conf["set_use_pv"] + or optim_conf.get("weather_forecast_method", None) == "list" + ): df_weather = fcst.get_weather_forecast( method=optim_conf["weather_forecast_method"] )