From 49d10793fa5b0f8bd2a294b25cb796d0f9b0e263 Mon Sep 17 00:00:00 2001 From: Jeremy Poulter Date: Fri, 19 Jan 2024 23:57:38 +0000 Subject: [PATCH 1/6] Initial changes to support simulating the current shapper --- divert_sim/.vscode/launch.json | 26 ++++++++++++++++ divert_sim/Makefile | 6 ++-- divert_sim/data/test_shapper.json | 3 ++ divert_sim/divert_sim.cpp | 50 +++++++++++++++++++++---------- 4 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 divert_sim/data/test_shapper.json diff --git a/divert_sim/.vscode/launch.json b/divert_sim/.vscode/launch.json index 713b444c..238a008d 100644 --- a/divert_sim/.vscode/launch.json +++ b/divert_sim/.vscode/launch.json @@ -4,6 +4,32 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "name": "divert_sim: data_shaper.csv", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/divert_sim", + "args": [ + "-c", "data/test_shapper.json", + "-l", "1", + "--sep", "\\;", + "<", "${workspaceFolder}/data/data_shaper.csv" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "build", + "miDebuggerPath": "/usr/bin/gdb" + }, { "name": "divert_sim: day1.csv", "type": "cppdbg", diff --git a/divert_sim/Makefile b/divert_sim/Makefile index 465bf2c9..03397bc7 100644 --- a/divert_sim/Makefile +++ b/divert_sim/Makefile @@ -32,9 +32,9 @@ CPPFLAGS := \ -D ENERGY_METER_STORE_STATE=0 \ -D ARDUINOJSON_ENABLE_PROGMEM=0 \ -D ENABLE_CONFIG_V1_IMPORT=0 \ - -D ENABLE_CONFIG_CHANGE_NOTIFICATION=0 -# \ -# -D ENABLE_DEBUG \ + -D ENABLE_CONFIG_CHANGE_NOTIFICATION=0 \ + -D ENABLE_DEBUG \ + -D ENABLE_DEBUG_MICRO_TASK \ # -D ENABLE_DEBUG_DIVERT \ # -D ENABLE_DEBUG_INPUT_FILTER \ # -D ENABLE_DEBUG_EVSE_MAN \ diff --git a/divert_sim/data/test_shapper.json b/divert_sim/data/test_shapper.json new file mode 100644 index 00000000..f1d78ddb --- /dev/null +++ b/divert_sim/data/test_shapper.json @@ -0,0 +1,3 @@ +{ + "current_shaper_max_pwr": 3000 +} diff --git a/divert_sim/divert_sim.cpp b/divert_sim/divert_sim.cpp index 7aa5a06a..4a5da4d5 100644 --- a/divert_sim/divert_sim.cpp +++ b/divert_sim/divert_sim.cpp @@ -9,6 +9,7 @@ #include "event.h" #include "event_log.h" #include "manual.h" +#include "current_shaper.h" #include "parser.hpp" #include "cxxopts.hpp" @@ -33,8 +34,9 @@ extern double smoothed_available_current; int date_col = 0; int grid_ie_col = -1; -int solar_col = 1; -int voltage_col = 1; +int solar_col = -1; +int voltage_col = -1; +int live_pwr_col = -1; time_t simulated_time = 0; time_t last_time = 0; @@ -48,17 +50,19 @@ time_t parse_date(const char *dateStr) if(6 != sscanf(dateStr, "%d-%d-%dT%d:%d:%dZ", &y, &M, &d, &h, &m, &s)) { if(6 != sscanf(dateStr, "%d-%d-%dT%d:%d:%d+00:00", &y, &M, &d, &h, &m, &s)) { if(6 != sscanf(dateStr, "%d-%d-%d %d:%d:%d", &y, &M, &d, &h, &m, &s)) { - if(3 != sscanf(dateStr, "%d:%d %s", &h, &m, ampm)) { - if(1 == sscanf(dateStr, "%d", &s)) { - return s; - } - } else { - y = 2020; M = 1; d = 1; s = 0; - if(12 == h) { - h -= 12; - } - if('P' == ampm[0]) { - h += 12; + if(6 != sscanf(dateStr, "%d/%d/%d %d:%d:%d", &d, &M, &y, &h, &m, &s)) { + if(3 != sscanf(dateStr, "%d:%d %s", &h, &m, ampm)) { + if(1 == sscanf(dateStr, "%d", &s)) { + return s; + } + } else { + y = 2020; M = 1; d = 1; s = 0; + if(12 == h) { + h -= 12; + } + if('P' == ampm[0]) { + h += 12; + } } } } @@ -112,6 +116,7 @@ int main(int argc, char** argv) ("d,date", "The date column", cxxopts::value(date_col), "N") ("s,solar", "The solar column", cxxopts::value(solar_col), "N") ("g,gridie", "The Grid IE column", cxxopts::value(grid_ie_col), "N") + ("l,livepwr", "The live power column", cxxopts::value(live_pwr_col), "N") ("c,config", "Config options, either a file name or JSON", cxxopts::value(config)) ("v,voltage", "The Voltage column if < 50, else the fixed voltage", cxxopts::value(voltage_arg), "N") ("kw", "values are KW") @@ -125,6 +130,8 @@ int main(int argc, char** argv) exit(0); } + EpoxyTest::set_millis(millis()); + fs::EpoxyFS.begin(); config_reset(); @@ -158,19 +165,25 @@ int main(int argc, char** argv) evse.begin(); divert.begin(); + shaper.begin(evse); // Initialise the EVSE Manager while (!evse.isConnected()) { MicroTask.update(); } - divert.setMode(DivertMode::Eco); + if(solar_col >= 0 || grid_ie_col >= 0) { + divert.setMode(DivertMode::Eco); + } + if(live_pwr_col >= 0) { + shaper.setState(true); + } CsvParser parser(std::cin); parser.delimiter(sep.c_str()[0]); int row_number = 0; - std::cout << "Date,Solar,Grid IE,Pilot,Charge Power,Min Charge Power,State,Smoothed Available" << std::endl; + std::cout << "Date,Solar,Grid IE,Pilot,Charge Power,Min Charge Power,State,Smoothed Available,Live Power" << std::endl; for (auto& row : parser) { try @@ -187,6 +200,8 @@ int main(int argc, char** argv) grid_ie = get_watt(val.c_str()); } else if (solar_col == col) { solar = get_watt(val.c_str()); + } else if (live_pwr_col == col) { + shaper.setLivePwr(get_watt(val.c_str())); } else if (voltage_col == col) { voltage = stoi(field); } @@ -199,6 +214,7 @@ int main(int argc, char** argv) int delta = simulated_time - last_time; if(delta > 0) { EpoxyTest::add_millis(delta * 1000); + DBUGVAR(millis()); } } last_time = simulated_time; @@ -218,7 +234,9 @@ int main(int argc, char** argv) double smoothed = divert.smoothedAvailableCurrent() * voltage; - std::cout << buffer << "," << solar << "," << grid_ie << "," << ev_pilot << "," << ev_watt << "," << min_ev_watt << "," << state << "," << smoothed << std::endl; + int live_power = shaper.getLivePwr(); + + std::cout << buffer << "," << solar << "," << grid_ie << "," << ev_pilot << "," << ev_watt << "," << min_ev_watt << "," << state << "," << smoothed << "," << live_power << std::endl; } catch(const std::invalid_argument& e) { From ee89f1ffb9def3aea967810adf5cada3b2378ebe Mon Sep 17 00:00:00 2001 From: Jeremy Poulter Date: Sun, 21 Jan 2024 21:32:22 +0000 Subject: [PATCH 2/6] Set the default mode to active This adds a change to allow the default flags to be updated. Only the flags explicitly saved by the user are loaded. This may loose the current configured default state, but it is causing confusion for many users. --- src/app_config.cpp | 89 ++++++++++++++++++++++++++++--------------- src/app_config_mode.h | 19 ++++++--- src/app_config_mqtt.h | 19 ++++++--- 3 files changed, 87 insertions(+), 40 deletions(-) diff --git a/src/app_config.cpp b/src/app_config.cpp index 10784912..54dc7336 100644 --- a/src/app_config.cpp +++ b/src/app_config.cpp @@ -86,6 +86,7 @@ String time_zone; // 24-bits of Flags uint32_t flags; +uint32_t flags_changed; // Ohm Connect Settings String ohm; @@ -130,11 +131,13 @@ String esp_hostname_default = "openevse-"+ESPAL.getShortId(); void config_changed(String name); -ConfigOptDefenition flagsOpt = ConfigOptDefenition(flags, - CONFIG_SERVICE_SNTP | - CONFIG_OCPP_AUTO_AUTH | - CONFIG_OCPP_OFFLINE_AUTH, - "flags", "f"); +#define CONFIG_DEFAULT_FLAGS (CONFIG_SERVICE_SNTP | \ + CONFIG_OCPP_AUTO_AUTH | \ + CONFIG_OCPP_OFFLINE_AUTH | \ + CONFIG_DEFAULT_STATE) + +ConfigOptDefenition flagsOpt = ConfigOptDefenition(flags, CONFIG_DEFAULT_FLAGS, "flags", "f"); +ConfigOptDefenition flagsChanged = ConfigOptDefenition(flags_changed, 0, "flags_changed", "c"); ConfigOpt *opts[] = { @@ -228,31 +231,33 @@ ConfigOpt *opts[] = // Flags &flagsOpt, + &flagsChanged, // Virtual Options - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_EMONCMS, CONFIG_SERVICE_EMONCMS, "emoncms_enabled", "ee"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_MQTT, CONFIG_SERVICE_MQTT, "mqtt_enabled", "me"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_MQTT_ALLOW_ANY_CERT, 0, "mqtt_reject_unauthorized", "mru"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_MQTT_RETAINED, CONFIG_MQTT_RETAINED, "mqtt_retained", "mrt"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_OHM, CONFIG_SERVICE_OHM, "ohm_enabled", "oe"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_SNTP, CONFIG_SERVICE_SNTP, "sntp_enabled", "se"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_TESLA, CONFIG_SERVICE_TESLA, "tesla_enabled", "te"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_DIVERT, CONFIG_SERVICE_DIVERT, "divert_enabled", "de"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_CUR_SHAPER, CONFIG_SERVICE_CUR_SHAPER, "current_shaper_enabled", "cse"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_PAUSE_USES_DISABLED, CONFIG_PAUSE_USES_DISABLED, "pause_uses_disabled", "pd"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_VEHICLE_RANGE_MILES, CONFIG_VEHICLE_RANGE_MILES, "mqtt_vehicle_range_miles", "mvru"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_SERVICE_OCPP, CONFIG_SERVICE_OCPP, "ocpp_enabled", "ope"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_OCPP_AUTO_AUTH, CONFIG_OCPP_AUTO_AUTH, "ocpp_auth_auto", "oaa"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_OCPP_OFFLINE_AUTH, CONFIG_OCPP_OFFLINE_AUTH, "ocpp_auth_offline", "ooa"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_OCPP_ACCESS_SUSPEND, CONFIG_OCPP_ACCESS_SUSPEND, "ocpp_suspend_evse", "ops"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_OCPP_ACCESS_ENERGIZE, CONFIG_OCPP_ACCESS_ENERGIZE, "ocpp_energize_plug", "opn"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_RFID, CONFIG_RFID, "rfid_enabled", "rf"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_FACTORY_WRITE_LOCK, CONFIG_FACTORY_WRITE_LOCK, "factory_write_lock", "fwl"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_THREEPHASE, CONFIG_THREEPHASE, "is_threephase", "itp"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_WIZARD, CONFIG_WIZARD, "wizard_passed", "wzp"), - new ConfigOptVirtualBool(flagsOpt, CONFIG_DEFAULT_STATE, CONFIG_DEFAULT_STATE, "default_state", "dfs"), - new ConfigOptVirtualMqttProtocol(flagsOpt, "mqtt_protocol", "mprt"), - new ConfigOptVirtualChargeMode(flagsOpt, "charge_mode", "chmd")}; + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_EMONCMS, CONFIG_SERVICE_EMONCMS, "emoncms_enabled", "ee"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_MQTT, CONFIG_SERVICE_MQTT, "mqtt_enabled", "me"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_MQTT_ALLOW_ANY_CERT, 0, "mqtt_reject_unauthorized", "mru"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_MQTT_RETAINED, CONFIG_MQTT_RETAINED, "mqtt_retained", "mrt"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_OHM, CONFIG_SERVICE_OHM, "ohm_enabled", "oe"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_SNTP, CONFIG_SERVICE_SNTP, "sntp_enabled", "se"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_TESLA, CONFIG_SERVICE_TESLA, "tesla_enabled", "te"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_DIVERT, CONFIG_SERVICE_DIVERT, "divert_enabled", "de"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_CUR_SHAPER, CONFIG_SERVICE_CUR_SHAPER, "current_shaper_enabled", "cse"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_PAUSE_USES_DISABLED, CONFIG_PAUSE_USES_DISABLED, "pause_uses_disabled", "pd"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_VEHICLE_RANGE_MILES, CONFIG_VEHICLE_RANGE_MILES, "mqtt_vehicle_range_miles", "mvru"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_SERVICE_OCPP, CONFIG_SERVICE_OCPP, "ocpp_enabled", "ope"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_OCPP_AUTO_AUTH, CONFIG_OCPP_AUTO_AUTH, "ocpp_auth_auto", "oaa"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_OCPP_OFFLINE_AUTH, CONFIG_OCPP_OFFLINE_AUTH, "ocpp_auth_offline", "ooa"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_OCPP_ACCESS_SUSPEND, CONFIG_OCPP_ACCESS_SUSPEND, "ocpp_suspend_evse", "ops"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_OCPP_ACCESS_ENERGIZE, CONFIG_OCPP_ACCESS_ENERGIZE, "ocpp_energize_plug", "opn"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_RFID, CONFIG_RFID, "rfid_enabled", "rf"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_FACTORY_WRITE_LOCK, CONFIG_FACTORY_WRITE_LOCK, "factory_write_lock", "fwl"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_THREEPHASE, CONFIG_THREEPHASE, "is_threephase", "itp"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_WIZARD, CONFIG_WIZARD, "wizard_passed", "wzp"), + new ConfigOptVirtualMaskedBool(flagsOpt, flagsChanged, CONFIG_DEFAULT_STATE, CONFIG_DEFAULT_STATE, "default_state", "dfs"), + new ConfigOptVirtualMqttProtocol(flagsOpt, flagsChanged, "mqtt_protocol", "mprt"), + new ConfigOptVirtualChargeMode(flagsOpt, flagsChanged, "charge_mode", "chmd") +}; ConfigJson user_config(opts, sizeof(opts) / sizeof(opts[0]), EEPROM_SIZE, CONFIG_OFFSET); ConfigJson factory_config(opts, sizeof(opts) / sizeof(opts[0]), EEPROM_SIZE, FACTORY_OFFSET); @@ -265,7 +270,7 @@ config_version() { return config_ver; } -void +void increment_config() { config_ver++; DBUGVAR(config_ver); @@ -310,6 +315,30 @@ config_load_settings() DBUGF("No JSON config found, using defaults"); #endif } + + // Handle setting the newly added flag changed bits + if(0 == flags_changed) + { + // Assume all flags that do not match the default value have changed + uint32_t new_changed = (flags ^ CONFIG_DEFAULT_FLAGS) & ~CONFIG_DEFAULT_STATE; + + // Handle the default charge state differently as that was set as a default to 0 previously, but is now 1 + // We will assume that if set to 1 it was intentional, but if 0 we will assume it was the just the default + // and not an intentinal change + if(flags != CONFIG_DEFAULT_FLAGS && + CONFIG_DEFAULT_STATE == (flags & CONFIG_DEFAULT_STATE)) + { + new_changed |= CONFIG_DEFAULT_STATE; + } + + // Save any changes + if(flagsChanged.set(new_changed)) { + user_config.commit(); + } + } + + // now lets apply any default flags that have not explicitly been set by the user + flags |= CONFIG_DEFAULT_FLAGS & ~flags_changed; } void config_changed(String name) @@ -527,7 +556,7 @@ bool config_serialize(DynamicJsonDocument &doc, bool longNames, bool compactOutp doc["wifi_serial"] = serial; doc["protocol"] = "-"; doc["espinfo"] = ESPAL.getChipInfo(); - doc["espflash"] = ESPAL.getFlashChipSize(); + doc["espflash"] = ESPAL.getFlashChipSize(); // EVSE information are only evailable when config_version is incremented if(config_ver > 0) { diff --git a/src/app_config_mode.h b/src/app_config_mode.h index de77405a..05e24da4 100644 --- a/src/app_config_mode.h +++ b/src/app_config_mode.h @@ -11,11 +11,13 @@ class ConfigOptVirtualChargeMode : public ConfigOpt { protected: ConfigOptDefenition &_base; + ConfigOptDefenition &_change; public: - ConfigOptVirtualChargeMode(ConfigOptDefenition &b, const char *l, const char *s) : - ConfigOpt(l, s), - _base(b) + ConfigOptVirtualChargeMode(ConfigOptDefenition &base, ConfigOptDefenition &change, const char *long_name, const char *short_name) : + ConfigOpt(long_name, short_name), + _base(base), + _change(change) { } @@ -30,7 +32,14 @@ class ConfigOptVirtualChargeMode : public ConfigOpt if(value == "eco") { newVal |= 1 << 10; } - return _base.set(newVal); + + if(_base.set(newVal)) { + uint32_t new_change = _change.get() | CONFIG_CHARGE_MODE; + _change.set(new_change); + return true; + } + + return false; } virtual bool serialize(DynamicJsonDocument &doc, bool longNames, bool compactOutput, bool hideSecrets) { @@ -38,7 +47,7 @@ class ConfigOptVirtualChargeMode : public ConfigOpt doc[name(longNames)] = get(); return true; } - + return false; } diff --git a/src/app_config_mqtt.h b/src/app_config_mqtt.h index 236e379c..93829f59 100644 --- a/src/app_config_mqtt.h +++ b/src/app_config_mqtt.h @@ -11,11 +11,13 @@ class ConfigOptVirtualMqttProtocol : public ConfigOpt { protected: ConfigOptDefenition &_base; + ConfigOptDefenition &_change; public: - ConfigOptVirtualMqttProtocol(ConfigOptDefenition &b, const char *l, const char *s) : - ConfigOpt(l, s), - _base(b) + ConfigOptVirtualMqttProtocol(ConfigOptDefenition &base, ConfigOptDefenition &change, const char *long_name, const char *short_name) : + ConfigOpt(long_name, short_name), + _base(base), + _change(change) { } @@ -29,7 +31,14 @@ class ConfigOptVirtualMqttProtocol : public ConfigOpt if(value == "mqtts") { newVal |= 1 << 4; } - return _base.set(newVal); + + if(_base.set(newVal)) { + uint32_t new_change = _change.get() | CONFIG_MQTT_PROTOCOL; + _change.set(new_change); + return true; + } + + return false; } virtual bool serialize(DynamicJsonDocument &doc, bool longNames, bool compactOutput, bool hideSecrets) { @@ -37,7 +46,7 @@ class ConfigOptVirtualMqttProtocol : public ConfigOpt doc[name(longNames)] = get(); return true; } - + return false; } From 7cfec774e1d8527f806b003ea4cc7ce8abbf0c16 Mon Sep 17 00:00:00 2001 From: Jeremy Poulter Date: Sun, 21 Jan 2024 21:35:04 +0000 Subject: [PATCH 3/6] Initial changes to run the shapper simulations from the web UI --- divert_sim/divert_sim.cpp | 8 ++-- divert_sim/interactive.html | 14 +++++- divert_sim/run_simulations.py | 8 +++- divert_sim/server.py | 26 ++++++----- divert_sim/simulations.css | 6 +++ divert_sim/simulations.js | 87 ++++++++++++++++++++++++----------- divert_sim/test_divert.py | 3 ++ src/current_shaper.cpp | 5 +- src/current_shaper.h | 1 + 9 files changed, 114 insertions(+), 44 deletions(-) diff --git a/divert_sim/divert_sim.cpp b/divert_sim/divert_sim.cpp index 4a5da4d5..3c0f59f1 100644 --- a/divert_sim/divert_sim.cpp +++ b/divert_sim/divert_sim.cpp @@ -151,7 +151,7 @@ int main(int argc, char** argv) kw = result.count("kw") > 0; divert_type = grid_ie_col >= 0 ? 1 : 0; - + if(voltage_arg >= 0) { if(voltage_arg < 50) { voltage_col = voltage_arg; @@ -183,7 +183,7 @@ int main(int argc, char** argv) parser.delimiter(sep.c_str()[0]); int row_number = 0; - std::cout << "Date,Solar,Grid IE,Pilot,Charge Power,Min Charge Power,State,Smoothed Available,Live Power" << std::endl; + std::cout << "Date,Solar,Grid IE,Pilot,Charge Power,Min Charge Power,State,Smoothed Available,Live Power,Smoother Live Power,Shapper Max Power" << std::endl; for (auto& row : parser) { try @@ -235,8 +235,10 @@ int main(int argc, char** argv) double smoothed = divert.smoothedAvailableCurrent() * voltage; int live_power = shaper.getLivePwr(); + int smoothed_live_pwr = shaper.getLivePwr(); + int shapper_max_power = shaper.getMaxPwr(); - std::cout << buffer << "," << solar << "," << grid_ie << "," << ev_pilot << "," << ev_watt << "," << min_ev_watt << "," << state << "," << smoothed << "," << live_power << std::endl; + std::cout << buffer << "," << solar << "," << grid_ie << "," << ev_pilot << "," << ev_watt << "," << min_ev_watt << "," << state << "," << smoothed << "," << live_power << "," << smoothed_live_pwr << "," << shapper_max_power << std::endl; } catch(const std::invalid_argument& e) { diff --git a/divert_sim/interactive.html b/divert_sim/interactive.html index 825bb415..d064fd5a 100644 --- a/divert_sim/interactive.html +++ b/divert_sim/interactive.html @@ -18,7 +18,11 @@ "divert_PV_ratio": parseFloat($("#divert_PV_ratio").val()), "divert_attack_smoothing_time": parseInt($("#divert_attack_smoothing_time").val()), "divert_decay_smoothing_time": parseInt($("#divert_decay_smoothing_time").val()), - "divert_min_charge_time": parseInt($("#divert_min_charge_time").val()) + "divert_min_charge_time": parseInt($("#divert_min_charge_time").val()), + "current_shaper_max_pwr": parseInt($("#current_shaper_max_pwr").val()), + "current_shaper_smoothing_time": parseInt($("#current_shaper_smoothing_time").val()), + "current_shaper_min_pause_time": parseInt($("#current_shaper_min_pause_time").val()), + "current_shaper_data_maxinterval": parseInt($("#current_shaper_data_maxinterval").val()) }), () => { init_summary(profiles); loadSummary("output/summary_master.csv", () => { @@ -50,6 +54,14 @@

OpenEVSE Solar Divert Simulations



+ +
+ +
+ +
+ +
diff --git a/divert_sim/run_simulations.py b/divert_sim/run_simulations.py index 897d1a0c..0d588f68 100644 --- a/divert_sim/run_simulations.py +++ b/divert_sim/run_simulations.py @@ -40,7 +40,8 @@ def run_simulation(dataset: str, output: str, config: bool = False, grid_ie_col: bool = False, solar_col: bool = False, voltage_col: bool = False, - separator: str = ',', is_kw: bool = False) -> None: + separator: str = ',', is_kw: bool = False, + live_power_col: bool = False) -> None: """Run the divert_sim process on the given dataset and return the results""" line_number = 0 @@ -73,6 +74,9 @@ def run_simulation(dataset: str, if solar_col: command.append("-s") command.append(str(solar_col)) + if live_power_col: + command.append("-l") + command.append(str(live_power_col)) if voltage_col: command.append("-v") command.append(str(voltage_col)) @@ -82,6 +86,8 @@ def run_simulation(dataset: str, if is_kw: command.append("--kw") + print(f"cat {input_data.name} | {' '.join(command)}") + divert_process = Popen(command, stdin=input_data, stdout=PIPE, stderr=PIPE, universal_newlines=True) while True: diff --git a/divert_sim/server.py b/divert_sim/server.py index 0629115f..759771f2 100644 --- a/divert_sim/server.py +++ b/divert_sim/server.py @@ -32,41 +32,43 @@ def do_POST(self): # Run the simulation setup_summary('_interactive') run_simulation('almostperfect', 'almostperfect_interactive', - config=json.dumps(config)) + solar_col=1, config=json.dumps(config)) run_simulation('CloudyMorning', 'CloudyMorning_interactive', - config=json.dumps(config)) + solar_col=1, config=json.dumps(config)) run_simulation('day1', 'day1_interactive', - config=json.dumps(config)) + solar_col=1, config=json.dumps(config)) run_simulation('day2', 'day2_interactive', - config=json.dumps(config)) + solar_col=1, config=json.dumps(config)) run_simulation('day3', 'day3_interactive', - config=json.dumps(config)) + solar_col=1, config=json.dumps(config)) run_simulation('day1_grid_ie', 'day1_grid_ie_interactive', - grid_ie_col=2, config=json.dumps(config)) + solar_col=1, grid_ie_col=2, config=json.dumps(config)) run_simulation('day2_grid_ie', 'day2_grid_ie_interactive', - grid_ie_col=2, config=json.dumps(config)) + solar_col=1, grid_ie_col=2, config=json.dumps(config)) run_simulation('day3_grid_ie', 'day3_grid_ie_interactive', - grid_ie_col=2, config=json.dumps(config)) + solar_col=1, grid_ie_col=2, config=json.dumps(config)) run_simulation('solar-vrms', 'solar-vrms_interactive', - voltage_col=2, config=json.dumps(config)) + solar_col=1, voltage_col=2, config=json.dumps(config)) run_simulation('Energy_and_Power_Day_2020-03-22', 'Energy_and_Power_Day_2020-03-22_interactive', - separator=';', is_kw=True, config=json.dumps(config)) + solar_col=1, separator=';', is_kw=True, config=json.dumps(config)) run_simulation('Energy_and_Power_Day_2020-03-31', 'Energy_and_Power_Day_2020-03-31_interactive', - separator=';', is_kw=True, config=json.dumps(config)) + solar_col=1, separator=';', is_kw=True, config=json.dumps(config)) run_simulation('Energy_and_Power_Day_2020-04-01', 'Energy_and_Power_Day_2020-04-01_interactive', - separator=';', is_kw=True, config=json.dumps(config)) + solar_col=1, separator=';', is_kw=True, config=json.dumps(config)) + run_simulation('data_shaper', 'data_shaper_interactive', + live_power_col=1, separator=';', config=json.dumps(config)) self.wfile.write("OK".encode('utf-8')) diff --git a/divert_sim/simulations.css b/divert_sim/simulations.css index 81aa2582..4c6eed36 100644 --- a/divert_sim/simulations.css +++ b/divert_sim/simulations.css @@ -13,6 +13,12 @@ width: 100%; } +.shapper +{ + height: 370px; + width: 100%; +} + .gridie { height: 740px; diff --git a/divert_sim/simulations.js b/divert_sim/simulations.js index 1d373bfa..9d46e63b 100644 --- a/divert_sim/simulations.js +++ b/divert_sim/simulations.js @@ -11,6 +11,7 @@ var datasets = [ { id: "Energy_and_Power_Day_2020-03-22", class: "solar", title: "Energy and Power Day 2020-03-22" }, { id: "Energy_and_Power_Day_2020-03-31", class: "solar", title: "Energy and Power Day 2020-03-31" }, { id: "Energy_and_Power_Day_2020-04-01", class: "solar", title: "Energy and Power Day 2020-04-01" }, + { id: "data_shaper", class: "shapper", title: "Shapper example 1" }, ]; var summary = {}; @@ -87,38 +88,72 @@ function loadChart(id, csv, title, type) { showInLegend: true, dataPoints: points[3] }); - opts.data.push({ - name: "Solar", - type: "line", - lineThickness: 1, - showInLegend: true, - dataPoints: points[0] - }); - if("gridie" === type) { + if("gridie" === type || "solar" === type) { opts.data.push({ - name: "Grid IE", + name: "Solar", type: "line", lineThickness: 1, showInLegend: true, - dataPoints: points[1] + dataPoints: points[0] + }); + if("gridie" === type) { + opts.data.push({ + name: "Grid IE", + type: "line", + lineThickness: 1, + showInLegend: true, + dataPoints: points[1] + }); + opts.data.push({ + name: "Smoothed", + type: "line", + lineThickness: 1, + showInLegend: true, + dataPoints: points[6] + }); + opts.data.push({ + name: "Min Charge", + type: "line", + lineThickness: 1, + lineDashType: "shortDash", + lineColor: "#38761d", + showInLegend: true, + dataPoints: points[4] + }); + opts.data.push({ + name: "Min Grid IE", + type: "line", + lineThickness: 1, + lineDashType: "shortDash", + lineColor: "#38761d", + showInLegend: true, + dataPoints: points[2] + }); + } + } + if("shapper" == type) { + opts.data.push({ + name: "Live Power", + type: "line", + lineThickness: 1, + showInLegend: true, + dataPoints: points[7] + }); + opts.data.push({ + name: "Live Power (Smoothed)", + type: "line", + lineThickness: 1, + showInLegend: true, + dataPoints: points[8] + }); + opts.data.push({ + name: "Max Power", + type: "line", + lineThickness: 1, + showInLegend: true, + dataPoints: points[9] }); } - opts.data.push({ - name: "Smoothed", - type: "line", - lineThickness: 1, - showInLegend: true, - dataPoints: points[6] - }); - opts.data.push({ - name: "Min Charge", - type: "line", - lineThickness: 1, - lineDashType: "shortDash", - lineColor: "#38761d", - showInLegend: true, - dataPoints: points[4] - }); var chart = new CanvasJS.Chart(id, opts); diff --git a/divert_sim/test_divert.py b/divert_sim/test_divert.py index 73b1abce..e3bd57fb 100644 --- a/divert_sim/test_divert.py +++ b/divert_sim/test_divert.py @@ -25,6 +25,9 @@ def run_test_with_dataset(dataset: str, separator: str = ',', is_kw: bool = False) -> None: """Run the divert_sim process on the given dataset and return the results""" + if False is solar_col: + solar_col = 1 + ( solar_kwh, ev_kwh, kwh_from_solar, diff --git a/src/current_shaper.cpp b/src/current_shaper.cpp index 100359fa..208aa5bd 100644 --- a/src/current_shaper.cpp +++ b/src/current_shaper.cpp @@ -196,6 +196,9 @@ int CurrentShaperTask::getMaxPwr() { int CurrentShaperTask::getLivePwr() { return _live_pwr; } +int CurrentShaperTask::getSmoothedLivePwr() { + return _smoothed_live_pwr; +} double CurrentShaperTask::getMaxCur() { return _max_cur; @@ -210,4 +213,4 @@ bool CurrentShaperTask::isActive() { bool CurrentShaperTask::isUpdated() { return _updated; -} \ No newline at end of file +} diff --git a/src/current_shaper.h b/src/current_shaper.h index eee7ab28..d534cefe 100644 --- a/src/current_shaper.h +++ b/src/current_shaper.h @@ -56,6 +56,7 @@ class CurrentShaperTask: public MicroTasks::Task bool getState(); int getMaxPwr(); int getLivePwr(); + int getSmoothedLivePwr(); double getMaxCur(); bool isActive(); bool isUpdated(); From e0014d463faf6bf0d452207e8b1cbf41fac22e43 Mon Sep 17 00:00:00 2001 From: Jeremy Poulter Date: Sun, 21 Jan 2024 21:35:23 +0000 Subject: [PATCH 4/6] Disable debug --- divert_sim/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/divert_sim/Makefile b/divert_sim/Makefile index 03397bc7..adb4471c 100644 --- a/divert_sim/Makefile +++ b/divert_sim/Makefile @@ -33,8 +33,8 @@ CPPFLAGS := \ -D ARDUINOJSON_ENABLE_PROGMEM=0 \ -D ENABLE_CONFIG_V1_IMPORT=0 \ -D ENABLE_CONFIG_CHANGE_NOTIFICATION=0 \ - -D ENABLE_DEBUG \ - -D ENABLE_DEBUG_MICRO_TASK \ +# -D ENABLE_DEBUG \ +# -D ENABLE_DEBUG_MICRO_TASK \ # -D ENABLE_DEBUG_DIVERT \ # -D ENABLE_DEBUG_INPUT_FILTER \ # -D ENABLE_DEBUG_EVSE_MAN \ From 61792f827e6c127f4130d6effda78eac5a02cbc5 Mon Sep 17 00:00:00 2001 From: Jeremy Poulter Date: Sun, 21 Jan 2024 23:04:04 +0000 Subject: [PATCH 5/6] Updated to latest ConfigJson library --- platformio.ini | 2 +- src/app_config.cpp | 94 +++++++++++++++++++++---------------------- src/app_config_mode.h | 8 ++-- src/app_config_mqtt.h | 8 ++-- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/platformio.ini b/platformio.ini index 4116b208..0a8870c6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,7 +33,7 @@ lib_deps = bblanchon/ArduinoJson@6.20.1 jeremypoulter/ArduinoMongoose@0.0.18 jeremypoulter/Micro Debug@0.0.5 - jeremypoulter/ConfigJson@0.0.5 + jeremypoulter/ConfigJson@0.0.6 jeremypoulter/OpenEVSE@0.0.14 jeremypoulter/ESPAL@0.0.3 jeremypoulter/StreamSpy@0.0.1 diff --git a/src/app_config.cpp b/src/app_config.cpp index 54dc7336..176fa0ab 100644 --- a/src/app_config.cpp +++ b/src/app_config.cpp @@ -136,98 +136,98 @@ void config_changed(String name); CONFIG_OCPP_OFFLINE_AUTH | \ CONFIG_DEFAULT_STATE) -ConfigOptDefenition flagsOpt = ConfigOptDefenition(flags, CONFIG_DEFAULT_FLAGS, "flags", "f"); -ConfigOptDefenition flagsChanged = ConfigOptDefenition(flags_changed, 0, "flags_changed", "c"); +ConfigOptDefinition flagsOpt = ConfigOptDefinition(flags, CONFIG_DEFAULT_FLAGS, "flags", "f"); +ConfigOptDefinition flagsChanged = ConfigOptDefinition(flags_changed, 0, "flags_changed", "c"); ConfigOpt *opts[] = { // Wifi Network Strings - new ConfigOptDefenition(esid, "", "ssid", "ws"), + new ConfigOptDefinition(esid, "", "ssid", "ws"), new ConfigOptSecret(epass, "", "pass", "wp"), - new ConfigOptDefenition(ap_ssid, "", "ap_ssid", "as"), + new ConfigOptDefinition(ap_ssid, "", "ap_ssid", "as"), new ConfigOptSecret(ap_pass, "", "ap_pass", "ap"), // Language String - new ConfigOptDefenition(lang, "", "lang", "lan"), + new ConfigOptDefinition(lang, "", "lang", "lan"), // Web server authentication (leave blank for none) - new ConfigOptDefenition(www_username, "", "www_username", "au"), + new ConfigOptDefinition(www_username, "", "www_username", "au"), new ConfigOptSecret(www_password, "", "www_password", "ap"), // Advanced settings - new ConfigOptDefenition(esp_hostname, esp_hostname_default, "hostname", "hn"), - new ConfigOptDefenition(sntp_hostname, SNTP_DEFAULT_HOST, "sntp_hostname", "sh"), + new ConfigOptDefinition(esp_hostname, esp_hostname_default, "hostname", "hn"), + new ConfigOptDefinition(sntp_hostname, SNTP_DEFAULT_HOST, "sntp_hostname", "sh"), // Time - new ConfigOptDefenition(time_zone, DEFAULT_TIME_ZONE, "time_zone", "tz"), + new ConfigOptDefinition(time_zone, DEFAULT_TIME_ZONE, "time_zone", "tz"), // Limit - new ConfigOptDefenition(limit_default_type, {}, "limit_default_type", "ldt"), - new ConfigOptDefenition(limit_default_value, {}, "limit_default_value", "ldv"), + new ConfigOptDefinition(limit_default_type, {}, "limit_default_type", "ldt"), + new ConfigOptDefinition(limit_default_value, {}, "limit_default_value", "ldv"), // EMONCMS SERVER strings - new ConfigOptDefenition(emoncms_server, "https://data.openevse.com/emoncms", "emoncms_server", "es"), - new ConfigOptDefenition(emoncms_node, esp_hostname, "emoncms_node", "en"), + new ConfigOptDefinition(emoncms_server, "https://data.openevse.com/emoncms", "emoncms_server", "es"), + new ConfigOptDefinition(emoncms_node, esp_hostname, "emoncms_node", "en"), new ConfigOptSecret(emoncms_apikey, "", "emoncms_apikey", "ea"), - new ConfigOptDefenition(emoncms_fingerprint, "", "emoncms_fingerprint", "ef"), + new ConfigOptDefinition(emoncms_fingerprint, "", "emoncms_fingerprint", "ef"), // MQTT Settings - new ConfigOptDefenition(mqtt_server, "emonpi", "mqtt_server", "ms"), - new ConfigOptDefenition(mqtt_port, 1883, "mqtt_port", "mpt"), - new ConfigOptDefenition(mqtt_topic, esp_hostname, "mqtt_topic", "mt"), - new ConfigOptDefenition(mqtt_user, "emonpi", "mqtt_user", "mu"), + new ConfigOptDefinition(mqtt_server, "emonpi", "mqtt_server", "ms"), + new ConfigOptDefinition(mqtt_port, 1883, "mqtt_port", "mpt"), + new ConfigOptDefinition(mqtt_topic, esp_hostname, "mqtt_topic", "mt"), + new ConfigOptDefinition(mqtt_user, "emonpi", "mqtt_user", "mu"), new ConfigOptSecret(mqtt_pass, "emonpimqtt2016", "mqtt_pass", "mp"), - new ConfigOptDefenition(mqtt_solar, "", "mqtt_solar", "mo"), - new ConfigOptDefenition(mqtt_grid_ie, "emon/emonpi/power1", "mqtt_grid_ie", "mg"), - new ConfigOptDefenition(mqtt_vrms, "emon/emonpi/vrms", "mqtt_vrms", "mv"), - new ConfigOptDefenition(mqtt_live_pwr, "", "mqtt_live_pwr", "map"), - new ConfigOptDefenition(mqtt_vehicle_soc, "", "mqtt_vehicle_soc", "mc"), - new ConfigOptDefenition(mqtt_vehicle_range, "", "mqtt_vehicle_range", "mr"), - new ConfigOptDefenition(mqtt_vehicle_eta, "", "mqtt_vehicle_eta", "met"), - new ConfigOptDefenition(mqtt_announce_topic, "openevse/announce/" + ESPAL.getShortId(), "mqtt_announce_topic", "ma"), + new ConfigOptDefinition(mqtt_solar, "", "mqtt_solar", "mo"), + new ConfigOptDefinition(mqtt_grid_ie, "emon/emonpi/power1", "mqtt_grid_ie", "mg"), + new ConfigOptDefinition(mqtt_vrms, "emon/emonpi/vrms", "mqtt_vrms", "mv"), + new ConfigOptDefinition(mqtt_live_pwr, "", "mqtt_live_pwr", "map"), + new ConfigOptDefinition(mqtt_vehicle_soc, "", "mqtt_vehicle_soc", "mc"), + new ConfigOptDefinition(mqtt_vehicle_range, "", "mqtt_vehicle_range", "mr"), + new ConfigOptDefinition(mqtt_vehicle_eta, "", "mqtt_vehicle_eta", "met"), + new ConfigOptDefinition(mqtt_announce_topic, "openevse/announce/" + ESPAL.getShortId(), "mqtt_announce_topic", "ma"), // OCPP 1.6 Settings - new ConfigOptDefenition(ocpp_server, "", "ocpp_server", "ows"), - new ConfigOptDefenition(ocpp_chargeBoxId, "", "ocpp_chargeBoxId", "cid"), - new ConfigOptDefenition(ocpp_authkey, "", "ocpp_authkey", "oky"), - new ConfigOptDefenition(ocpp_idtag, "DefaultIdTag", "ocpp_idtag", "idt"), + new ConfigOptDefinition(ocpp_server, "", "ocpp_server", "ows"), + new ConfigOptDefinition(ocpp_chargeBoxId, "", "ocpp_chargeBoxId", "cid"), + new ConfigOptDefinition(ocpp_authkey, "", "ocpp_authkey", "oky"), + new ConfigOptDefinition(ocpp_idtag, "DefaultIdTag", "ocpp_idtag", "idt"), // Ohm Connect Settings - new ConfigOptDefenition(ohm, "", "ohm", "o"), + new ConfigOptDefinition(ohm, "", "ohm", "o"), // Divert settings - new ConfigOptDefenition(divert_type, -1, "divert_type", "dm"), - new ConfigOptDefenition(divert_PV_ratio, 1.1, "divert_PV_ratio", "dpr"), - new ConfigOptDefenition(divert_attack_smoothing_time, 20, "divert_attack_smoothing_time", "das"), - new ConfigOptDefenition(divert_decay_smoothing_time, 600, "divert_decay_smoothing_time", "dds"), - new ConfigOptDefenition(divert_min_charge_time, 600, "divert_min_charge_time", "dt"), + new ConfigOptDefinition(divert_type, -1, "divert_type", "dm"), + new ConfigOptDefinition(divert_PV_ratio, 1.1, "divert_PV_ratio", "dpr"), + new ConfigOptDefinition(divert_attack_smoothing_time, 20, "divert_attack_smoothing_time", "das"), + new ConfigOptDefinition(divert_decay_smoothing_time, 600, "divert_decay_smoothing_time", "dds"), + new ConfigOptDefinition(divert_min_charge_time, 600, "divert_min_charge_time", "dt"), // Current Shaper settings - new ConfigOptDefenition(current_shaper_max_pwr, 0, "current_shaper_max_pwr", "smp"), - new ConfigOptDefenition(current_shaper_smoothing_time, 60, "current_shaper_smoothing_time", "sst"), - new ConfigOptDefenition(current_shaper_min_pause_time, 300, "current_shaper_min_pause_time", "spt"), - new ConfigOptDefenition(current_shaper_data_maxinterval, 120, "current_shaper_data_maxinterval", "sdm"), + new ConfigOptDefinition(current_shaper_max_pwr, 0, "current_shaper_max_pwr", "smp"), + new ConfigOptDefinition(current_shaper_smoothing_time, 60, "current_shaper_smoothing_time", "sst"), + new ConfigOptDefinition(current_shaper_min_pause_time, 300, "current_shaper_min_pause_time", "spt"), + new ConfigOptDefinition(current_shaper_data_maxinterval, 120, "current_shaper_data_maxinterval", "sdm"), // Vehicle settings - new ConfigOptDefenition(vehicle_data_src, 0, "vehicle_data_src", "vds"), + new ConfigOptDefinition(vehicle_data_src, 0, "vehicle_data_src", "vds"), // Tesla client settings new ConfigOptSecret(tesla_access_token, "", "tesla_access_token", "tat"), new ConfigOptSecret(tesla_refresh_token, "", "tesla_refresh_token", "trt"), - new ConfigOptDefenition(tesla_created_at, -1, "tesla_created_at", "tc"), - new ConfigOptDefenition(tesla_expires_in, -1, "tesla_expires_in", "tx"), - new ConfigOptDefenition(tesla_vehicle_id, "", "tesla_vehicle_id", "ti"), + new ConfigOptDefinition(tesla_created_at, -1, "tesla_created_at", "tc"), + new ConfigOptDefinition(tesla_expires_in, -1, "tesla_expires_in", "tx"), + new ConfigOptDefinition(tesla_vehicle_id, "", "tesla_vehicle_id", "ti"), // RFID storage - new ConfigOptDefenition(rfid_storage, "", "rfid_storage", "rs"), + new ConfigOptDefinition(rfid_storage, "", "rfid_storage", "rs"), #if RGB_LED // LED brightness - new ConfigOptDefenition(led_brightness, LED_DEFAULT_BRIGHTNESS, "led_brightness", "lb"), + new ConfigOptDefinition(led_brightness, LED_DEFAULT_BRIGHTNESS, "led_brightness", "lb"), #endif // Scheduler options - new ConfigOptDefenition(scheduler_start_window, SCHEDULER_DEFAULT_START_WINDOW, "scheduler_start_window", "ssw"), + new ConfigOptDefinition(scheduler_start_window, SCHEDULER_DEFAULT_START_WINDOW, "scheduler_start_window", "ssw"), // Flags &flagsOpt, diff --git a/src/app_config_mode.h b/src/app_config_mode.h index 05e24da4..e67bef47 100644 --- a/src/app_config_mode.h +++ b/src/app_config_mode.h @@ -2,7 +2,7 @@ #define app_config_mode_h #include -#include +#include #include "mqtt.h" #include "app_config.h" @@ -10,11 +10,11 @@ class ConfigOptVirtualChargeMode : public ConfigOpt { protected: - ConfigOptDefenition &_base; - ConfigOptDefenition &_change; + ConfigOptDefinition &_base; + ConfigOptDefinition &_change; public: - ConfigOptVirtualChargeMode(ConfigOptDefenition &base, ConfigOptDefenition &change, const char *long_name, const char *short_name) : + ConfigOptVirtualChargeMode(ConfigOptDefinition &base, ConfigOptDefinition &change, const char *long_name, const char *short_name) : ConfigOpt(long_name, short_name), _base(base), _change(change) diff --git a/src/app_config_mqtt.h b/src/app_config_mqtt.h index 93829f59..334fc112 100644 --- a/src/app_config_mqtt.h +++ b/src/app_config_mqtt.h @@ -2,7 +2,7 @@ #define app_config_mqtt_h #include -#include +#include #include "mqtt.h" #include "app_config.h" @@ -10,11 +10,11 @@ class ConfigOptVirtualMqttProtocol : public ConfigOpt { protected: - ConfigOptDefenition &_base; - ConfigOptDefenition &_change; + ConfigOptDefinition &_base; + ConfigOptDefinition &_change; public: - ConfigOptVirtualMqttProtocol(ConfigOptDefenition &base, ConfigOptDefenition &change, const char *long_name, const char *short_name) : + ConfigOptVirtualMqttProtocol(ConfigOptDefinition &base, ConfigOptDefinition &change, const char *long_name, const char *short_name) : ConfigOpt(long_name, short_name), _base(base), _change(change) From 4707017b7c964c60e1dc35b9879de83f8866af27 Mon Sep 17 00:00:00 2001 From: Jeremy Poulter Date: Wed, 24 Jan 2024 18:10:16 +0000 Subject: [PATCH 6/6] New required options --- divert_sim/.vscode/launch.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/divert_sim/.vscode/launch.json b/divert_sim/.vscode/launch.json index 238a008d..df4f466b 100644 --- a/divert_sim/.vscode/launch.json +++ b/divert_sim/.vscode/launch.json @@ -37,6 +37,7 @@ "program": "${workspaceFolder}/divert_sim", "args": [ "-c", "data/test_config.json", + "-s", "1", "<", "${workspaceFolder}/data/day1.csv" ], "stopAtEntry": false, @@ -84,6 +85,7 @@ "request": "launch", "program": "${workspaceFolder}/divert_sim", "args": [ + "-s", "1", "-v", "2", "<", "${workspaceFolder}/data/solar-vrms.csv" ], @@ -108,6 +110,7 @@ "request": "launch", "program": "${workspaceFolder}/divert_sim", "args": [ + "-s", "1", "--sep", "\\;", "--kw", "<", "${workspaceFolder}/data/Energy_and_Power_Day_2020-03-22.csv" ],