It is not possible to use SamUL to change the values stored in a library. For example, you cannot change the Voc value for module in the CEC Module library. SamUL does allow you to change the value of input variables that are editable on the input pages.

You can use SamUL to choose different modules from the CEC module library. Here is sample script that shows a few library-related functions:

BEGIN SAMUL SCRIPT

SetActiveCase("New Flat Plate PV Case 1")

'Show a list of libraries
lib = Library()
outln(lib)
outln()

'Show a list of all modules in the CECModule library
lib_cec = library("CECModule")
outln(lib_cec)
outln()

'Show the module model that is currently active on the Module page:
' 0 = Simple Efficiency Model
' 1 = CEC Performance Model with Module Database,
' 2 = CEC Performance Model with User Entered Specifications
' 3 = Sandia PV Array Performance Model with Module Database
model = GetInput("pv.mod.model_type")
outln(model)
outln()

'Set the current module model to CEC with database
SetInput("pv.mod.model_type",1)

'Show the name of the CEC module that is currently active on the Module page
name = GetInput("pv.mod.cec.module_name")
outln(name)
outln()

'Run a simulation and show the system's total annual output
'for the first five modules in the CECModule library
for ( i=0 ; i<5; i=i+1 )

SetInput("pv.mod.cec.module_name",lib_cec[i])
name = GetInput("pv.mod.cec.module_name")

I am trying to retrieve the input for the calculation, and it is not working. It is instead accessing the CEC user entered specifications section, dispite the line:

Sorry I misunderstood your question. The variable names for the CEC Module model with database parameters are not available in the SamUL input variable list. Here they are:

Efficiency: pv.mod.cec.eff
Maximum Power (Pmp): pv.mod.cec.p_mp_ref
Max Power Voltage (Vmp): pv.mod.cec.v_mp_ref
Max Power Current (Imp): pv.mod.cec.i_mp_ref
Open Circuit Voltage (Voc): pv.mod.cec.v_oc_ref
Short Circuit Current (Isc): pv.mod.cec.i_sc_ref
Temperature Coefficient of Power (%/C): pv.mod.cec.gamma_r
Temperature Coefficient of Power (W/C): pv.mod.cec.gamma_r_calc
Temperature Coefficient of Open Circuit Voltage (%/C): pv.mod.cec.beta_oc_calc
Temperature Coefficient of Open Circuit Voltage (V/C): pv.mod.cec.beta_oc
Temperature Coefficient of Short Circuit Current (%/C): pv.mod.cec.alpha_sc_calc
Temperature Coefficient of Short Circuit Current (A/C): pv.mod.cec.alpha_sc

You should only use SamUL to read these values, not to set them. (If you want to change the values, you should use the CEC model with user-entered specifications instead.)

sorry, I didn't preview my question.

here is the code in a visable format:

function modulePerString(mintemp)

type = getInput("pv.mod.model_type")

setInput("pv.mod.model_type",1)

oldmodules = getinput("pv.array.user_modules_per_string")

out("there were ", oldmodules , " modules per string\n")

STC = 25

tempc = (mintemp-STC)

Voc = getInput("pv.mod.6par.voc")

Vcoef = getInput("pv.mod.6par.bvoc")

vdcmax = 600

vocmax= (tempc*(Vcoef))+Voc

modules = (vdcmax/vocmax)

modulesint = integer(modules)

out("type :",type, "Voc:",Voc,"Vcoef: ",Vcoef,"Vocmax: ",vocmax,"\n")

setInput( "pv.array.user_modules_per_string", modulesint)

out("there are now ", modulesint , " modules per string\n")

end

Hello,

It is not possible to use SamUL to change the values stored in a library. For example, you cannot change the Voc value for module in the CEC Module library. SamUL does allow you to change the value of input variables that are editable on the input pages.

You can use SamUL to choose different modules from the CEC module library. Here is sample script that shows a few library-related functions:

BEGIN SAMUL SCRIPT

SetActiveCase("New Flat Plate PV Case 1")

'Show a list of libraries

lib = Library()

outln(lib)

outln()

'Show a list of all modules in the CECModule library

lib_cec = library("CECModule")

outln(lib_cec)

outln()

'Show the module model that is currently active on the Module page:

' 0 = Simple Efficiency Model

' 1 = CEC Performance Model with Module Database,

' 2 = CEC Performance Model with User Entered Specifications

' 3 = Sandia PV Array Performance Model with Module Database

model = GetInput("pv.mod.model_type")

outln(model)

outln()

'Set the current module model to CEC with database

SetInput("pv.mod.model_type",1)

'Show the name of the CEC module that is currently active on the Module page

name = GetInput("pv.mod.cec.module_name")

outln(name)

outln()

'Run a simulation and show the system's total annual output

'for the first five modules in the CECModule library

for ( i=0 ; i<5; i=i+1 )

SetInput("pv.mod.cec.module_name",lib_cec[i])

name = GetInput("pv.mod.cec.module_name")

Simulate()

annual_output = GetOutput("sv.annual_output")

outln(name + ": " + annual_output + " kWh/yr")

end

END SAMUL SCRIPT

Best regards,

Paul.

Thank you for the sample script, I will be able to find good use for it.

My concern is not to change the library values, but to access the data within it, as you can see from the lines:

Voc = getInput("pv.mod.6par.voc")

Vcoef = getInput("pv.mod.6par.bvoc")

I am trying to retrieve the input for the calculation, and it is not working. It is instead accessing the CEC user entered specifications section, dispite the line:

setInput("pv.mod.model_type",1)

Thanks,

Jonathan Topham

Dear Jonathan,

Sorry I misunderstood your question. The variable names for the CEC Module model with database parameters are not available in the SamUL input variable list. Here they are:

Efficiency: pv.mod.cec.eff

Maximum Power (Pmp): pv.mod.cec.p_mp_ref

Max Power Voltage (Vmp): pv.mod.cec.v_mp_ref

Max Power Current (Imp): pv.mod.cec.i_mp_ref

Open Circuit Voltage (Voc): pv.mod.cec.v_oc_ref

Short Circuit Current (Isc): pv.mod.cec.i_sc_ref

Temperature Coefficient of Power (%/C): pv.mod.cec.gamma_r

Temperature Coefficient of Power (W/C): pv.mod.cec.gamma_r_calc

Temperature Coefficient of Open Circuit Voltage (%/C): pv.mod.cec.beta_oc_calc

Temperature Coefficient of Open Circuit Voltage (V/C): pv.mod.cec.beta_oc

Temperature Coefficient of Short Circuit Current (%/C): pv.mod.cec.alpha_sc_calc

Temperature Coefficient of Short Circuit Current (A/C): pv.mod.cec.alpha_sc

You should only use SamUL to read these values, not to set them. (If you want to change the values, you should use the CEC model with user-entered specifications instead.)

Best regards,

Paul.