From a2b0b1d3f4ae002a3aab2bc32c2676ac8c292167 Mon Sep 17 00:00:00 2001 From: Brian Mirletz Date: Fri, 20 Oct 2023 17:07:44 -0600 Subject: [PATCH] update UI forms for v3 --- .../ui/Battery Model Simple with REopt.json | 14 +++++++------- .../runtime/ui/Battery REopt Optimization.json | 18 +++++++++--------- deploy/runtime/webapis.conf | 4 ++-- src/invoke.cpp | 14 +++++++------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/deploy/runtime/ui/Battery Model Simple with REopt.json b/deploy/runtime/ui/Battery Model Simple with REopt.json index eda10cb199..5339f07942 100644 --- a/deploy/runtime/ui/Battery Model Simple with REopt.json +++ b/deploy/runtime/ui/Battery Model Simple with REopt.json @@ -826,7 +826,7 @@ "\t\texit;", "\t}", "", - "\tif (y.outputs == null || y.outputs.Scenario == null){", + "\tif (y.outputs == null){", "\t\tmsgbox(\"Error in REopt response. Try again later or try another system design.\");", "\t\tvalue(\"batt_simple_dispatch\",dispatch_original_mode); //restore original dispatch mode for early exit from ReOPT", "\t\tvalue(\"batt_simple_kw\", batt_kw_original);", @@ -834,9 +834,9 @@ "\t\texit;", "\t}", "\t", - "\tpv = y.outputs.Scenario.Site.PV;", - "\tbatt = y.outputs.Scenario.Site.Storage;", - "\telec = y.outputs.Scenario.Site.ElectricTariff;", + "\tpv = y.outputs.PV;", + "\tbatt = y.outputs.ElectricStorage;", + "\telec = y.outputs.ElectricUtility;", "", "\tif (batt.size_kw == null && batt.size_kwh == null){", "\t\tapply_str = \"Apply results?\\nOptimal capacity (kWh): \" + to_string(0) + ", @@ -875,9 +875,9 @@ "\tbatt_to_grid = null;", "\tif (batt.year_one_to_grid_series_kw)", "\t\tbatt_to_grid = batt.year_one_to_grid_series_kw;", - "\tbatt_to_load = batt.year_one_to_load_series_kw;", - "\tpv_charge = pv.year_one_to_battery_series_kw;", - "\tgrid_charge = elec.year_one_to_battery_series_kw;", + "\tbatt_to_load = batt.storage_to_load_series_kw;", + "\tpv_charge = pv.electric_to_storage_series_kw;", + "\tgrid_charge = elec.electric_to_storage_series_kw;", "", "", "\tvalue('batt_simple_dispatch', 2);", diff --git a/deploy/runtime/ui/Battery REopt Optimization.json b/deploy/runtime/ui/Battery REopt Optimization.json index 350913ec93..0d83d7a18c 100644 --- a/deploy/runtime/ui/Battery REopt Optimization.json +++ b/deploy/runtime/ui/Battery REopt Optimization.json @@ -292,7 +292,7 @@ "\t", "\ty = reopt.response;", "", - "\tif (y.outputs == null || y.outputs.Scenario == null)", + "\tif (y.outputs == null)", "\t{", "\t\tmsgbox('Error in REopt API response.\\nTry again later or try another system design.');", "\t\tvalue('batt_dispatch_choice_ui',dispatch_original_mode); //make sure UI input is consistent with SSC input", @@ -302,9 +302,9 @@ "\t\texit;", "\t}", "", - "\tif (y.outputs.Scenario.status != 'optimal')", + "\tif (y.status != 'optimal')", "\t{", - "\t\tmsgbox('REopt could not find optimal battery size and dispatch.\\n' + y.outputs.Scenario.status);", + "\t\tmsgbox('REopt could not find optimal battery size and dispatch.\\n' + y.status);", "\t\tvalue('batt_dispatch_choice_ui',dispatch_original_mode); //make sure UI input is consistent with SSC input", "\t\tvalue('batt_bank_power', batt_kw_original);", "\t\tvalue('batt_bank_size_ui', batt_kwh_original); ", @@ -312,9 +312,9 @@ "\t\texit;", "\t}", "", - "\tpv = y.outputs.Scenario.Site.PV;", - "\tbatt = y.outputs.Scenario.Site.Storage;", - "\telec = y.outputs.Scenario.Site.ElectricTariff;", + "\tpv = y.outputs.PV;", + "\tbatt = y.outputs.ElectricStorage;", + "\telec = y.outputs.ElectricUtility;", "", "\tif (batt.size_kw == null && batt.size_kwh == null)", "\t{", @@ -365,9 +365,9 @@ "\t{", "\t\tbatt_to_grid = batt.year_one_to_grid_series_kw;", "\t}", - "\tbatt_to_load = batt.year_one_to_load_series_kw;", - "\tpv_charge = pv.year_one_to_battery_series_kw;", - "\tgrid_charge = elec.year_one_to_battery_series_kw;", + "\tbatt_to_load = batt.storage_to_load_series_kw;", + "\tpv_charge = pv.electric_to_storage_series_kw;", + "\tgrid_charge = elec.electric_to_storage_series_kw;", "", "\tvalue('batt_dispatch_choice_ui', 2); // make sure UI input is consistent with SSC input", "\tvalue('batt_dispatch_excl', value('batt_dispatch_choice_ui'));", diff --git a/deploy/runtime/webapis.conf b/deploy/runtime/webapis.conf index 1f0da0e085..4e1f2bc782 100644 --- a/deploy/runtime/webapis.conf +++ b/deploy/runtime/webapis.conf @@ -10,8 +10,8 @@ google_staticmap_api=https://maps.googleapis.com/maps/api/staticmap?
&zoo ios_build=https://sam.nrel.gov/sites/default/files/content/mobile/ios/readme.html nsrdb_query=https://developer.nrel.gov/api/nsrdb/v2/solar/nsrdb-data-query.json?&api_key=&wkt=POINT(%20) release_notes=https://nrel.github.io/SAM/doc/releasenotes.html -reopt_poll=https://developer.nrel.gov/api/reopt/v1/job//results/?api_key= -reopt_post=https://developer.nrel.gov/api/reopt/v1/job?format=json&api_key= +reopt_poll=https://developer.nrel.gov/api/reopt/v3/job//results/?api_key= +reopt_post=https://developer.nrel.gov/api/reopt/v3/job?format=json&api_key= support_email=mailto:sam.support@nrel.gov urdb_ask=https://en.openei.org/w/index.php?title=Special:Ask&q=&po=&eq=yes&p[format]=json urdb_companies_all=https://api.openei.org/utility_companies?version=3&format=json&api_key=&scope= diff --git a/src/invoke.cpp b/src/invoke.cpp index 7952bec871..024dee4dfe 100644 --- a/src/invoke.cpp +++ b/src/invoke.cpp @@ -5946,14 +5946,14 @@ static void fcall_reopt_size_battery(lk::invoke_t &cxt) cxt.result().hash_item("error", " " + err); break; } - if (lk::vardata_t* res = cxt_result->lookup("outputs")){ - optimizing_status = res->lookup("Scenario")->lookup("status")->as_string(); - if (optimizing_status.find("error") != std::string::npos){ - std::string error = res->lookup("messages")->lookup("error")->as_string().ToStdString(); - cxt.result().hash_item("error", error); - break; - } + + optimizing_status = cxt_result->lookup("status")->as_string(); + if (optimizing_status.find("error") != std::string::npos){ + std::string error = cxt_result->lookup("messages")->lookup("error")->as_string().ToStdString(); + cxt.result().hash_item("error", error); + break; } + } dlg.Close(); }