Dear Xinyue,
SAM consists of the user interface whose code resides in
github.com/nrel/sam, and SSC (
github.com/nrel/ssc).
The SDK provides access to SSC, but not to the SAM user interface.
As you note, the SSC inputs are for the number of modules per string, number of strings in parallel, and number of inverters. The code to estimate values for those inputs from a desired system size is in the SAM user interface, which you cannot access from the SDK.
So, you will have to write your own code to estimate the values for modules per string, strings in parallel, and number of inverters.
Here is the algorithm SAM uses for the calculations. This is a fairly rudimentary approach, so you may want to use this as a starting point:
equations{ '$MIMO$ pv_size_array' } = define()
{
if (${size_auto_or_manual}==1)
{
${modules_per_string} = ${user_modules_per_string};
${strings_in_parallel} = ${user_strings_in_parallel};
${inverter_count} = ${user_inverter_count};
//positive number of inverters warning
}
if (${size_auto_or_manual}==0)
{
/* Sizing rules
1. Voc < Vdcmax
2. Vmp > Vmin
3. Vmp < Vmax
4. num series * num_parallel is about desired array size (num_parallel = desired / (num series * mod_power)
5. num inverters is about desired array size (num_inv = num_series * num_parallel * mod_power) / inv_power
*/
// module parameters
mod_vmp= ?${module_model} [ ${spe_vmp},${cec_v_mp_ref},${6par_vmp},${snl_ref_vmp},${sd11par_Vmp0}];
mod_voc= ?${module_model} [ ${spe_voc},${cec_v_oc_ref},${6par_voc},${snl_ref_voc},${sd11par_Voc0}];
mod_power= ?${module_model} [${spe_power}, ${cec_p_mp_ref}, ${6par_pmp}, ${snl_ref_pmp},${sd11par_Pmp0}];
//default logstatus mimo_pv_size_array: Invalid module selection
//if mod_power<=0 logstatus mimo_pv_size_array: The module power is less than zero.Please check the module selected
//if mod_vmp<=0 logstatus mimo_pv_size_array: The module Vmp = %lg Wdc. The sizing wizard only works with modules with positive Vmp
// inverter parameters
inv_vmin= ?${inverter_model} [${inv_snl_mppt_low}, ${inv_ds_mppt_low}, ${inv_pd_mppt_low},${inv_cec_cg_mppt_low}];
inv_vdcmax= ?${inverter_model} [${inv_snl_vdcmax}, ${inv_ds_vdcmax}, ${inv_pd_vdcmax},${inv_cec_cg_vdcmax}];
inv_vmax= ?${inverter_model} [${inv_snl_mppt_hi}, ${inv_ds_mppt_hi}, ${inv_pd_mppt_hi},${inv_cec_cg_mppt_hi}];
inv_power= ?${inverter_model} [${inv_snl_paco}, ${inv_ds_paco}, ${inv_pd_paco},${inv_cec_cg_paco}];
//default logstatus mimo_pv_size_array: Invalid inverter selection
// DC-connected battery parameters (assumed to use common inverter)
batt_max_power_dc = 0;
f = financing();
if (f != "LCOE Calculator" && f != "None")
{
if (${en_batt}){
if (${batt_ac_or_dc} == 0)
batt_max_power_dc = ${batt_max_power};
}
}
// calculations
if(mod_vmp>0)
{num_series= 0.5 * (inv_vmin + inv_vmax)/mod_vmp;}
if(inv_vdcmax > 0){
while ((num_series > 0) && ((num_series*mod_voc) > inv_vdcmax)){
num_series= num_series -1;
}
}
if (num_series < 1)
{ num_series= 1;}
num_series= to_int(num_series);
num_parallel= ${desired_size} * 1000 /(num_series * mod_power);
if (num_parallel < 1)
{ num_parallel= 1;}
num_parallel= to_int(num_parallel);
//if (desired_size * 1000 < inv_power) logstatus mimo_pv_size_array: The desired array power is less than a single inverter capacity
if (${dcac_ratio} > 0)
{ inverters = ((num_series * num_parallel * mod_power) /* + batt_max_power_dc */) / (${dcac_ratio} * inv_power);
//round inverters for best DC-AC ratio
if((inverters - floor(inverters)) < 0.5)
{ num_inverters = floor(inverters); }
else
{ num_inverters = ceil(inverters); }
}
else
{ num_inverters = ceil(((num_series * num_parallel * mod_power) /* + batt_max_power_dc */) / inv_power);}
if (num_inverters < 1)
{ num_inverters = 1;}
${modules_per_string} = num_series;
${strings_in_parallel} = num_parallel;
${inverter_count} = num_inverters;
}
};
Best regards,
Paul.