SDK API to save/load data container

5 posts / 0 new
Last post
g1ashok
SDK API to save/load data container

SDK Tool provides a way to Save the variables in the data container to a data file. (.bdat) and Load data file (.bdat).

I'm looking for ways to save and load data container via Java API. Don't see anything listed in SSC guide (SSCJNI) API list.

Is there an API that can be invoked programatically to save and load the data container like SDK tool?

Thanks
Ashok

Paul Gilman

Dear Ashok,

Please see Section 3.6 of the SDK Guide that comes as a PDF file with the SAM SDK. It explains how to generate a list of all variables in a data container.

And, as a reminder, the best way to generate code to start working in the various languages supported by the SDK is using the code generator from SAM's user interface as shown in this brief video:

Best regards,
Paul.

g1ashok

Hi Paul,

Thanks for the information. I'm using the code generator in SAM. Generated code creates 15 or so result metrics.

I can iterate the data container using ssc_data_first, ssc_data_next and ssc_data_query to get rest of the results in data container and save it.

Wondering if there is an alternative way to save the full data container as a file that can be loaded later similar to SDK tool save/load option via the JNI API call.

Thanks
Ashok

Paul Gilman

Dear Ashok,

Those 15 or so metrics are just examples to show you how to work with the results variables.

There is not a built-in function for saving the data container. You can find the C++ code for the SDKtook's save/load functions in the SSC code repository on GitHub:

https://github.com/NREL/ssc/blob/develop/sdktool/sscdev.cpp

The functions in question are:

WriteBdatToDisk() defined around line 683

WriteVarTable() defined around Line 515

Best regards,
Paul.

g1ashok

Thanks Paul, this is exactly what I was looking for.

-Ashok

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer