Battery module execution errors

4 posts / 0 new
Last post
Battery module execution errors

I'm trying to run battery storage module separately.

Having issues in running battwatts module using SAM SDK after setting the input parameters specified in battwatts module SDK. Can I run it as standalone module? meaning not running pvwatts module before this run. Any dependent input values populated by pvwatts that needs to be set?

Is there a way to debug or get more information on SAM module exec failure? Like missing input parameters, invalid values for the parameter etc? (ssc_module_log always returns null, is this call invocation correct?)

I don't see any errors being logged in the console using ssc_module_exec_simple method either.

Here is the Java code snippet to execute battwatts module.

api.ssc_data_set_number( data, "system_capacity", 2000f );
set_array( data, "load", "./load.csv", 8760); // Using the default load.csv generated from SAM application
api.ssc_data_set_number( data, "batt_simple_enable", 1f );
api.ssc_data_set_number( data, "batt_simple_kwh", 1000f );
api.ssc_data_set_number( data, "batt_simple_kw", 700f );
api.ssc_data_set_number( data, "batt_simple_chemistry", 1f );
api.ssc_data_set_number( data, "batt_simple_dispatch", 0f );
api.ssc_data_set_number( data, "batt_simple_meter_position", 0f );
api.ssc_data_set_number( data, "dc", 1900000f );
api.ssc_data_set_number( data, "ac", 1500000f );
api.ssc_data_set_number( data, "inverter_model", 0f );
api.ssc_data_set_number( data, "inverter_efficiency", 96f );

mod = api.ssc_module_create("battwatts");
if (api.ssc_module_exec(mod,data)==0)
System.out.println("error during simulation.");
int idx = 0;
int[] type = new int[2];
float[] time = new float[2];
String msg = null;
while ((msg = SSCAPIJNI.ssc_module_log(mod, idx, type, time)) != null) {
System.out.println("SAM module log " + msg + " Type:" + type[0] + " time:" + time[0]);
else {
System.out.println("battwatts run completed");

Appreciate your help.


Paul Gilman

Dear Ashok,

Please see the SDK Guide that comes with the SDK: Section 3.4 describes how to generate a list of inputs for an SSC compute module.

The best way to to debug your code is to write it in LK for SDKtool so you can execute it in the SDKtool development environment that allows you to explore the SSC data container and modules. Once you have a basic model working in SDKtool, you can convert it to Java or another language and further develop it.

From the Module Browser in SDKtool, you can see that the ac and dc inputs are arrays, not numbers as you have specified above.

Best regards,


Thanks Paul, exporting to LK script and running it using SDKTool helped.

Is there a way to enable debug logs in ssc_module_exec to get more information when it fails?

Was facing another failure in ssc_module_exec (pvsamv1 module), found out it was caused by setting the solar_resource_file param twice. ssc_module_exec failed but there was no error reported in ssc_module_log.
SSCAPIJNI.ssc_data_set_string( data, "solar_resource_file", "PhoenixTMY2.csv" );


Paul Gilman

Dear Ashok,

I think you know this, but for the benefit of others, Sections 4.4 and 4.5 of the SDK Guide explain how to access warning and error messages generated by the compute module during simulations. As you note, you can retrieve those messages using the ssc_module_log() function.

I'm not sure why setting the value of solar_resource_file twice would cause pvsamv1 to fail.

Best regards,

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer