Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24 03 06 merge patch into develop #1731

Merged
merged 102 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
d637d3b
update CSP entries for PySAM config_to_cmod_name table
dguittet Oct 6, 2023
04b781c
Merge branch 'develop' into pysam_hybrids
dguittet Oct 10, 2023
ba368e6
Merge branch 'develop' into pysam_hybrids
dguittet Oct 19, 2023
8dc9f0e
Code generation almost working for JSON option #1515
sjanzou Nov 7, 2023
b0e4572
Tested Values vartable for variable updates for base case for code ge…
sjanzou Nov 7, 2023
b943b5a
Merge branch 'develop' into SAM_1515
sjanzou Nov 14, 2023
d8bedc1
Add SSC_DATARR support to CodeGen_json::Input
sjanzou Nov 14, 2023
b80b99a
update export_config
dguittet Nov 16, 2023
84cbf5d
Merge branch 'develop' into pysam_hybrids
dguittet Nov 16, 2023
c6b4378
update pysam files
dguittet Nov 16, 2023
757d000
Merge branch 'develop' into pysam_hybrids
dguittet Nov 16, 2023
10cfc6e
remove print statement
dguittet Nov 16, 2023
3ac496e
fix run_defaults_diff.py
dguittet Nov 17, 2023
ec2cacf
Fix broken config_extractor build on Windows
sjanzou Nov 26, 2023
f7f3d6d
use sscapi for adding hybrid vartable
dguittet Dec 4, 2023
03f23da
Merge branch 'develop' into pysam_hybrids
dguittet Dec 5, 2023
d18ad81
update library
dguittet Dec 5, 2023
c099aa2
Merge branch 'develop' into pysam_hybrids
dguittet Dec 5, 2023
28258a6
update pysam files
dguittet Dec 5, 2023
946c523
Merge branch 'develop' into pysam_hybrids
dguittet Dec 11, 2023
adde2ee
update AdjustmentFactors
dguittet Dec 12, 2023
89f4625
Merge branch 'develop' into pysam_hybrids
dguittet Dec 13, 2023
fbb22b0
Merge branch 'adjust_api' into pysam_hybrids
dguittet Dec 13, 2023
0de809c
Update SAMapi files
dguittet Dec 13, 2023
a1b6ab9
Merge branch 'pysam_hybrids' of https://github.com/NREL/SAM into pysa…
dguittet Dec 13, 2023
91bd4c9
adjustment factors default to 0
dguittet Dec 18, 2023
3f3a86c
fix tcsmslf
dguittet Dec 18, 2023
6a513a2
update pysam docs generation
dguittet Dec 19, 2023
b166bd2
updated git attributes file to correctly ignore subfolders for github…
janinefreeman Jan 2, 2024
e62f0ac
Remove nSCA as an input for CSP and IPH models. Add as design output.
taylorbrown75 Jan 3, 2024
eb42034
Merge pull request #1675 from NREL/fix-trough-dispatch
tyneises Jan 15, 2024
01d9b0d
Update file generation process to catch bad weather files, return error
mjprilliman Jan 25, 2024
9b33dd0
Add DC loss factor checks to PV, PV + battery report template
mjprilliman Feb 5, 2024
da88612
Clean up PV subhourly clipping losses correction UI (#1689)
cpaulgilman Feb 7, 2024
69cd639
Update array sizing for battery thermal fixed option, add label for
mjprilliman Feb 8, 2024
780af34
Update PV land area calcs to be based on total module area and gcr
mjprilliman Feb 12, 2024
6965816
Reset adjust periods to three zero columns when no custom period is set
mjprilliman Feb 13, 2024
81116be
Clean up UI Save / Load buttons (#1695)
cpaulgilman Feb 13, 2024
6ee3366
Fix PV shading diagrams (#1696)
cpaulgilman Feb 13, 2024
113be3c
Merge branch 'patch' into me-wave-file-reader
mjprilliman Feb 14, 2024
357ee27
Add error message for errors in reading wave time series file for jpd
mjprilliman Feb 14, 2024
2586636
Update ground area variable label
cpaulgilman Feb 15, 2024
3c68673
Merge branch 'patch' into pysam_hybrids
sjanzou Feb 19, 2024
3cbafaf
update defaults maneuvering for hybrids
dguittet Feb 19, 2024
081a9b1
Fix solar resource download geocoding issues (#1692)
cpaulgilman Feb 19, 2024
29c97b9
Merge pull request #1698 from NREL/adjust-periods-reset
mjprilliman Feb 19, 2024
781ec2c
update defaults maneuvering for hybrids
dguittet Feb 19, 2024
ee1d735
Fix failing Windows build and export_config updates
sjanzou Feb 20, 2024
54cfe4b
Merge branch 'patch' into SAM_1515
sjanzou Feb 20, 2024
ce26386
Merge branch 'pysam_hybrids' of https://github.com/nrel/SAM into pysa…
dguittet Feb 20, 2024
b9de64c
Update JSON code generation and test for hybrids in ssc
sjanzou Feb 21, 2024
2f7b3d9
Update Solar Resource Data to not have valid solar_resource_file if s…
sjanzou Feb 22, 2024
87ad92c
update windows results
dguittet Feb 22, 2024
2809cb8
Create equations to fail with library value blank
sjanzou Feb 25, 2024
7518a81
Update Tower SolarPilot Solar Field.json
qualand Feb 26, 2024
adc23a7
Merge pull request #1697 from NREL/land-area-update
mjprilliman Feb 26, 2024
6ef95eb
Address issue list from meeting
mjprilliman Feb 26, 2024
954d848
Merge pull request #1711 from NREL/sam-1672-fix
qualand Feb 26, 2024
beb911f
Merge branch 'patch' into battery-thermal-array
mjprilliman Feb 26, 2024
aaa03ce
Merge branch 'patch' into dc-degradation-pv-report-template
mjprilliman Feb 26, 2024
10ec4a6
Fix issues with curtailment and degradation in pv + pv+batt report;
mjprilliman Feb 26, 2024
d769713
Merge pull request #1710 from NREL/SAM_1314
sjanzou Feb 27, 2024
1362e95
Merge pull request #1694 from NREL/battery-thermal-array
mjprilliman Feb 27, 2024
cda0828
Merge pull request #1690 from NREL/dc-degradation-pv-report-template
mjprilliman Feb 27, 2024
9debef4
Fix PV time series shading (#1712)
cpaulgilman Feb 27, 2024
73ff4a9
Update `fuelcell_dispatch_excl` when opening old Fuel Cell cases (#1707)
cpaulgilman Feb 27, 2024
db99724
update export config for hybrids
dguittet Feb 27, 2024
106f974
Merge branch 'patch' into SAM_1515
sjanzou Feb 28, 2024
3202f3b
Fix URL to SAM forum from Help window (#1716)
cpaulgilman Feb 28, 2024
d5918fa
Update test results for change in cost defaults
mjprilliman Feb 28, 2024
c891277
Fix #1682 PVWatts land area calculation (#1721)
cpaulgilman Feb 29, 2024
bb20186
Merge pull request #1718 from NREL/SAM_1515
sjanzou Feb 29, 2024
2b9bc3a
Merge branch 'patch' into pysam_hybrids
dguittet Feb 29, 2024
e83363d
Fix battery life defaults (#1715)
cpaulgilman Feb 29, 2024
59eae61
Add support for MSG V1.0.0 NSRDB API endpoint (#1720)
cpaulgilman Feb 29, 2024
c2a3cc2
Improve REopt calls (#1714)
cpaulgilman Feb 29, 2024
baf3b21
Fix trough loop configuration label. (#1709)
taylorbrown75 Feb 29, 2024
e6bc92b
Merge branch 'patch' into me-wave-file-reader
mjprilliman Feb 29, 2024
21a1302
Merge branch 'patch' into SAM_1515
sjanzou Mar 1, 2024
48c6c6a
Limit code generation to compute module inputs only
sjanzou Mar 1, 2024
799d6bf
Automatically scan downloads folder for wave and tidal files
mjprilliman Mar 1, 2024
7e69cdd
Help updates for SAM 2023.12.17 r1
cpaulgilman Mar 1, 2024
e6e3861
Merge pull request #1701 from NREL/me-wave-file-reader
mjprilliman Mar 1, 2024
ef25bb7
Improve description array orientation convention
cpaulgilman Mar 1, 2024
87aa262
Merge pull request #1725 from NREL/help-2023-patch-1
sjanzou Mar 3, 2024
977bee6
Merge branch 'patch' into pysam_hybrids
sjanzou Mar 3, 2024
a05b87c
Merge branch 'pysam_hybrids' into SAM_1515
sjanzou Mar 3, 2024
2723ded
Update build_C_API.cpp for C++11 in patch and update code generator f…
sjanzou Mar 3, 2024
cd4cade
Updates from all patch merges for Patch 1
sjanzou Mar 3, 2024
fd397a2
Update results for failing GitHub Actions.
sjanzou Mar 4, 2024
07d3687
Merge pull request #1727 from NREL/Windows_defaults_updates
sjanzou Mar 4, 2024
2ac0e8d
2023.12.17.r1.ssc.290 patch 1 candidate built 3/4/2024
sjanzou Mar 4, 2024
da6d81f
Merge branch 'SAM_1515' into pysam_hybrids
dguittet Mar 4, 2024
71940c6
fix codegenerator
dguittet Mar 4, 2024
da1d203
Merge branch 'SAM_1515' into pysam_hybrids
dguittet Mar 4, 2024
49b6106
Merge branch 'patch' into pysam_hybrids
dguittet Mar 4, 2024
513ec26
fix codegenerator for hybrids
dguittet Mar 4, 2024
54b86fd
Merge pull request #1730 from NREL/2023.12.17.r1.ssc.290
sjanzou Mar 5, 2024
b2d14ae
update test_results_win64.csv
dguittet Mar 5, 2024
4ea27ba
Clean and build and run on Windows
sjanzou Mar 6, 2024
5f9f0e6
Merge pull request #1584 from NREL/pysam_hybrids
sjanzou Mar 6, 2024
6c4faf1
Merge branch 'patch' into 24-03-06-merge-develop
tyneises Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Sandia/* linguist-vendored
deploy/* linguist-vendored
Sandia/** linguist-vendored=true
deploy/** linguist-vendored=true
samples/** linguist-vendored=true

# Autodetect text files
* text=auto
Expand All @@ -18,3 +19,4 @@ deploy/runtime/defaults/*.txt text eol=lf
# Ensure those won't be messed up with
*.jpg binary
*.data binary

36 changes: 30 additions & 6 deletions api/api_autogen/builder_C_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


// C++17 only - not in patch branch
//#include <filesystem>
#include <wx/file.h>
#include <shared/lib_util.h>

#include "builder_C_API.h"
Expand All @@ -39,8 +40,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void builder_C_API::create_SAM_headers(const std::string &cmod, const std::string &file_dir, bool stateful) {
std::string cmod_symbol = format_as_symbol(cmod);

if (cmod_symbol == "6parsolve")
cmod_symbol = "SixParsolve";
else if (cmod_symbol == "Tcsmslf")
cmod_symbol = "TcsMSLF";
else if (root->m_vardefs.find(cmod_symbol) != root->m_vardefs.end())
cmod_symbol += "Model";

std::string filename = file_dir + "/SAM_" + cmod_symbol + ".h";
// if (std::filesystem::exists(filename))
if (wxFileExists(filename))
return;

std::ofstream fx_file;
fx_file.open(file_dir + "/SAM_" + cmod_symbol + ".h");
fx_file.open(filename);
assert(fx_file.is_open());

fx_file << "#ifndef SAM_" << util::upper_case(cmod_symbol)<< "_H_\n"
Expand Down Expand Up @@ -193,8 +206,20 @@ void builder_C_API::create_SAM_headers(const std::string &cmod, const std::strin
void builder_C_API::create_SAM_definitions(const std::string &cmod, const std::string &file_dir, bool stateful) {
std::string cmod_symbol = format_as_symbol(cmod);

if (cmod_symbol == "6parsolve")
cmod_symbol = "SixParsolve";
else if (cmod_symbol == "Tcsmslf")
cmod_symbol = "TcsMSLF";
else if (root->m_vardefs.find(cmod_symbol) != root->m_vardefs.end())
cmod_symbol += "Model";

std::string filename = file_dir + "/SAM_" + cmod_symbol + ".cpp";
// if (std::filesystem::exists(filename))
if (wxFileExists(filename))
return;

std::ofstream fx_file;
fx_file.open(file_dir + "/SAM_" + cmod_symbol + ".cpp");
fx_file.open(filename);
assert(fx_file.is_open());

fx_file << "#include <string>\n"
Expand Down Expand Up @@ -228,6 +253,7 @@ void builder_C_API::create_SAM_definitions(const std::string &cmod, const std::s

if (mm->first == "AdjustmentFactors")
continue;


for (auto & vardef : vardefs) {
std::string var_symbol = vardef.first;
Expand Down Expand Up @@ -335,8 +361,6 @@ void builder_C_API::create_SAM_definitions(const std::string &cmod, const std::s
else{
throw std::runtime_error(vd.type + " for " + var_name);
}
fx_file << "\n\n";

}
}
fx_file.close();
Expand Down
75 changes: 66 additions & 9 deletions api/api_autogen/builder_PySAM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,21 @@ void builder_PySAM::all_options_of_cmod(const std::string &cmod) {
void builder_PySAM::create_PySAM_files(const std::string &cmod, const std::string &file_dir, bool stateful) {
std::string cmod_symbol = format_as_symbol(cmod);

std::string tech_symbol = cmod_symbol;
if (cmod_symbol == "6parsolve")
tech_symbol = "SixParsolve";
cmod_symbol = "SixParsolve";
else if (cmod_symbol == "Tcsmslf")
cmod_symbol = "TcsMSLF";
else if (root->m_vardefs.find(cmod_symbol) != root->m_vardefs.end())
tech_symbol += "Model";
cmod_symbol += "Model";
std::string tech_symbol = cmod_symbol;

std::ofstream fx_file;
fx_file.open(file_dir + "/modules/" + tech_symbol + ".c");
assert(fx_file.is_open());

fx_file << "#include <Python.h>\n"
"\n"
"#include <SAM_" << cmod_symbol << ".h>\n"
"#include <SAM_" << tech_symbol << ".h>\n"
"#include <SAM_api.h>\n"
"\n"
"#include \"PySAM_utils.h\"\n\n";
Expand Down Expand Up @@ -612,6 +614,30 @@ void builder_PySAM::create_PySAM_files(const std::string &cmod, const std::strin

fx_file << "\tPyObject_Del(self);\n"
"}\n\n\n";
fx_file << "static PyObject *\n"
"" << tech_symbol << "_get_data_ptr(" << object_type << " *self, PyObject *args)\n"
"{\n\tPyObject* ptr = PyLong_FromVoidPtr((void*)self->data_ptr);\n"
"\treturn ptr;\n}\n\n\n";

fx_file << "static PyObject *\n"
"" << tech_symbol << "_set_data_ptr(" << object_type << " *self, PyObject *args)\n"
"{\n"
"\tlong long int ptr = 0; // 64 bit arch\n"
"\tif (!PyArg_ParseTuple(args, \"L:data_ptr\", &ptr)){\n"
"\t\tPyErr_BadArgument();\n"
"\t\treturn NULL;\n"
"\t}\n\tself->data_ptr = (void*)ptr;\n";

// modify the data ptr for all the groups
for (auto& i : root->vardefs_order) {
auto mm = root->m_vardefs.find(i);
if (mm->second.empty()) continue;
std::string module_symbol = format_as_symbol(mm->first);
fx_file << "\tVarGroupObject* " << module_symbol << "_obj = (VarGroupObject*)PyDict_GetItemString(self->x_attr, \"" << module_symbol << "\");\n"
"\t" << module_symbol << "_obj->data_ptr = (void*)ptr;\n";
}

fx_file << "\treturn Py_None;\n}\n\n\n";

if (stateful) {
fx_file << "static PyObject *\n"
Expand Down Expand Up @@ -693,6 +719,10 @@ void builder_PySAM::create_PySAM_files(const std::string &cmod, const std::strin

fx_file << "\t\t{\"execute\", (PyCFunction)" << tech_symbol << "_execute, METH_VARARGS,\n"
"\t\t\t\tPyDoc_STR(\"execute(int verbosity) -> None\\n Execute simulation with verbosity level 0 (default) or 1\")},\n"
"\t\t{\"get_data_ptr\", (PyCFunction)" << tech_symbol << "_get_data_ptr, METH_VARARGS,\n"
"\t\t\t\tPyDoc_STR(\"get_data_ptr() -> Pointer\\n Get ssc_data_t pointer\")},\n"
"\t\t{\"set_data_ptr\", (PyCFunction)" << tech_symbol << "_set_data_ptr, METH_VARARGS,\n"
"\t\t\t\tPyDoc_STR(\"set_data_ptr(data_ptr)\\n Set ssc_data_t pointer\")},\n"
"\t\t{\"assign\", (PyCFunction)" << tech_symbol << "_assign, METH_VARARGS,\n"
"\t\t\t\tPyDoc_STR(\"assign(dict) -> None\\n Assign attributes from nested dictionary, except for Outputs\\n\\n"
"``nested_dict = { '" << root->vardefs_order[0] << "': { var: val, ...}, ...}``\")},\n"
Expand Down Expand Up @@ -1100,8 +1130,17 @@ void builder_PySAM::create_PySAM_files(const std::string &cmod, const std::strin
fx_file << "-";
fx_file << "-\n\n";

fx_file << ".. autoclass:: PySAM." << tech_symbol << "." << tech_symbol << "." << module_symbol << "\n";
fx_file << "\t:members:\n\n";
if (module_symbol == "AdjustmentFactors") {
fx_file << ".. autoclass:: PySAM.AdjustmentFactors.AdjustmentFactors\n";
}
else {
fx_file << ".. autoclass:: PySAM." << tech_symbol << "." << tech_symbol << "." << module_symbol << "\n";
}
fx_file << "\t:members:\n";
if (module_symbol == "AdjustmentFactors") {
fx_file << "\t:noindex:\n";
}
fx_file << "\n";
}

fx_file.close();
Expand All @@ -1127,6 +1166,12 @@ void builder_PySAM::create_PySAM_files(const std::string &cmod, const std::strin
"\tdef export(self):\n"
"\t\tpass\n"
"\n"
"\tdef get_data_ptr(self):\n"
"\t\tpass\n"
"\n"
"\tdef set_data_ptr(self, data_ptr):\n"
"\t\tpass\n"
"\n"
"\tdef __getattribute__(self, *args, **kwargs):\n"
"\t\tpass\n"
"\n"
Expand Down Expand Up @@ -1159,14 +1204,26 @@ void builder_PySAM::create_PySAM_files(const std::string &cmod, const std::strin
"\t\t\tpass\n"
"\t\n"
"\t\tconstant = float\n"
"\t\ten_hourly = float\n"
"\t\ten_periods = float\n"
"\t\ten_timeindex = float\n"
"\t\thourly = tuple\n"
"\t\tperiods = tuple\n"
"\t\timeindex = tuple\n"
"\t\tdc_constant = float\n"
"\t\tdc_en_hourly = float\n"
"\t\tdc_en_periods = float\n"
"\t\tdc_en_timeindex = float\n"
"\t\tdc_hourly = tuple\n"
"\t\tdc_periods = tuple\n"
"\t\thourly = tuple\n"
"\t\tperiods = tuple\n"
"\t\tdc_imeindex = tuple\n"
"\t\tsf_constant = float\n"
"\t\tsf_en_hourly = float\n"
"\t\tsf_en_periods = float\n"
"\t\tsf_en_timeindex = float\n"
"\t\tsf_hourly = tuple\n"
"\t\tsf_periods = tuple\n\n";
"\t\tsf_periods = tuple\n"
"\t\tsf_timeindex = tuple\n\n";
continue;
}

Expand Down
62 changes: 30 additions & 32 deletions api/api_autogen/builder_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <shared/lib_util.h>
#include <ssc/sscapi.h>
#include <ssc/ssc_equations.h>
#include <ssc/core.h>

#include "lk_env.h"
#include "lk_eval.h"
Expand All @@ -54,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "builder_C_API.h"
#include "builder_PySAM.h"


std::unordered_map<std::string, bool> SAM_completed_cmods;


Expand All @@ -80,8 +82,11 @@ builder_generator::builder_generator(config_extractor *ce){
for (size_t i = 0; i < cmods.size(); i++){
std::string cmod_name = cmods[i];
ssc_module_t p_mod = ssc_module_create(const_cast<char*>(cmod_name.c_str()));
ssc_module_objects.insert({cmod_name, p_mod});

if (config_name.find("Hybrid") != std::string::npos) {
ssc_module_hybridize(p_mod);
}
ssc_module_objects.insert({cmod_name, p_mod});
}
}

Expand Down Expand Up @@ -123,12 +128,18 @@ void builder_generator::select_ui_variables(std::string ui_name, std::map<std::s
void builder_generator::gather_variables_ssc(const std::string &cmod_name) {
ssc_module_t p_mod = ssc_module_create(const_cast<char*>(cmod_name.c_str()));

// hybrid technology compute modules have extra financial variables that need to be exported to defaults
if (active_config.find("Hybrid") != std::string::npos) {
ssc_module_hybridize(p_mod);
}

digraph* graph = nullptr;
if (SAM_config_to_variable_graph.find(active_config) != SAM_config_to_variable_graph.end())
graph = SAM_config_to_variable_graph[active_config];

int var_index = 0;
ssc_info_t mod_info = ssc_module_var_info(p_mod, var_index);
var_info* mod_info_cast = static_cast<var_info*>(mod_info);
std::map<std::string, var_def> adj_map;
std::map<std::string, var_def> outputs_map;
while (mod_info){
Expand Down Expand Up @@ -173,17 +184,6 @@ void builder_generator::gather_variables_ssc(const std::string &cmod_name) {
std::vector<std::string> ssctype_str = {"invalid", "string", "number", "array", "matrix", "table"};
vd.type_n = ssc_info_data_type(mod_info);
vd.type = ssctype_str[vd.type_n];
/*
if (vd.group == "Adjustment Factors") {
size_t pos = vd.name.find(':');
size_t pos2 = vd.name.find("adjust");
vd.name = vd.name.substr(0, pos2) + vd.name.substr(pos+1);
adj_map.insert({vd.name, vd});
++var_index;
mod_info = ssc_module_var_info(p_mod, var_index);
continue;
}
*/
int var_type = ssc_info_var_type(mod_info);

size_t pos = vd.name.find(':');
Expand Down Expand Up @@ -419,32 +419,31 @@ void builder_generator::export_variables_json(const std::string &cmod, const std

VarValue* vv = nullptr;

/* // if adjustment factors, the default values are stored in a table
if (module_name == "AdjustmentFactors"){
// if adjustment factors, the variables need to have the 'adjust_' prefix removed
if (module_symbol == "AdjustmentFactors"){
size_t pos = v.name.find('_');
std::string adj_type = "adjust";
if (pos != std::string::npos){
adj_type = v.name.substr(0, pos + 1) + adj_type;
}

vv = SAM_config_to_defaults[config_name][adj_type];
vv = SAM_config_to_defaults[config_name][v.name];
if (vv){
std::string name = v.name.substr(pos+1);
if (name == "hourly" && !(vv->Table().Get("en_hourly")->Boolean()))
continue;
if (name == "periods" && !(vv->Table().Get("en_periods")->Boolean()))
continue;
vv = vv->Table().Get(name);
var_symbol = v.name.substr(pos+1);
}
else
continue;
}
else
*/ vv = SAM_config_to_defaults[config_name][v.name];
else{
if (config_name.find("Hybrid") != std::string::npos){
VarValue* vt = SAM_config_to_defaults[config_name].Get(format_as_symbol(cmod));
if (!vt)
vt = SAM_config_to_defaults[config_name].Get("Hybrid");
vv = vt->Table()[v.name];
}
else{
vv = SAM_config_to_defaults[config_name][v.name];

// if it's a battery configuration, turn on battery by default
if ((cmod == "battery" && v.name == "en_batt") || (cmod == "battwatts" && v.name == "batt_simple_enable"))
vv->Set(1);
// if it's a battery configuration, turn on battery by default. Hybrid techs don't need this because cmod_hybrid does it
if ((cmod == "battery" && v.name == "en_batt") || (cmod == "battwatts" && v.name == "batt_simple_enable"))
vv->Set(1);
}
}

// vv can be null in the case of variables not available in UI
if (!vv && v.reqif != "*")
Expand All @@ -458,7 +457,6 @@ void builder_generator::export_variables_json(const std::string &cmod, const std
json << "\n\t\t\t\"" + format_as_variable(var_symbol) + "\": ";
json << ssc_value_to_json(v.type_n, vv);


first = false;
}
json << "\n\t\t}";
Expand Down
2 changes: 1 addition & 1 deletion api/api_autogen/builder_generator_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ std::string ssc_value_to_json(int ssc_type, VarValue* vv){
break;
case SSC_ARRAY:
json += "[";
if (vv){
if (vv && vv->Array().size()){
std::vector<double> vec = vv->Array();
for (size_t j = 0; j < vec.size(); j++){
if (vec[j] > std::numeric_limits<double>::max()){
Expand Down
Loading
Loading