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"] ) 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