Skip to content

Commit

Permalink
update UI forms for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
brtietz committed Oct 20, 2023
1 parent 932e008 commit a2b0b1d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions deploy/runtime/ui/Battery Model Simple with REopt.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,17 @@
"\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);",
"\t\tvalue(\"batt_simple_kwh\", batt_kwh_original); ",
"\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) + ",
Expand Down Expand Up @@ -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);",
Expand Down
18 changes: 9 additions & 9 deletions deploy/runtime/ui/Battery REopt Optimization.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -302,19 +302,19 @@
"\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); ",
"\t\trefresh();",
"\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{",
Expand Down Expand Up @@ -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'));",
Expand Down
4 changes: 2 additions & 2 deletions deploy/runtime/webapis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ google_staticmap_api=https://maps.googleapis.com/maps/api/staticmap?<CENTER>&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=<SAMAPIKEY>&wkt=POINT(<LON>%20<LAT>)
release_notes=https://nrel.github.io/SAM/doc/releasenotes.html
reopt_poll=https://developer.nrel.gov/api/reopt/v1/job/<RUN_UUID>/results/?api_key=<SAMAPIKEY>
reopt_post=https://developer.nrel.gov/api/reopt/v1/job?format=json&api_key=<SAMAPIKEY>
reopt_poll=https://developer.nrel.gov/api/reopt/v3/job/<RUN_UUID>/results/?api_key=<SAMAPIKEY>
reopt_post=https://developer.nrel.gov/api/reopt/v3/job?format=json&api_key=<SAMAPIKEY>
support_email=mailto:[email protected]
urdb_ask=https://en.openei.org/w/index.php?title=Special:Ask&q=<QUESTION>&po=<PROPERTIES>&eq=yes&p[format]=json
urdb_companies_all=https://api.openei.org/utility_companies?version=3&format=json&api_key=<SAMAPIKEY>&scope=<SCOPE>
Expand Down
14 changes: 7 additions & 7 deletions src/invoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5946,14 +5946,14 @@ static void fcall_reopt_size_battery(lk::invoke_t &cxt)
cxt.result().hash_item("error", "<json-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();
}
Expand Down

0 comments on commit a2b0b1d

Please sign in to comment.