Running irradproc submodule with PySSC

7 posts / 0 new
Last post
Running irradproc submodule with PySSC

I am attempting to use the irradproc module and the PySSC wrapper to calculate sun zenith angle. Here is my Python code:

ssc = PySSC()
#create the data container where everthing gets carried around
wfd = ssc.data_create()
ssc.data_set_number(wfd, b'lat', sp._lat)
ssc.data_set_number(wfd, b'lon', sp._lon)
ssc.data_set_number(wfd, b'tz', sp._tz)
ssc.data_set_array(wfd, b'year', sp._year.tolist())
ssc.data_set_array(wfd, b'month', sp._month.tolist())
ssc.data_set_array(wfd, b'day', sp._day.tolist())
ssc.data_set_array(wfd, b'hour', sp._hour.tolist())
ssc.data_set_array(wfd, b'minute', sp._minute.tolist())
ssc.data_set_number(wfd, b'azimuth', sp.azimuth)
ssc.data_set_number(wfd, b'track_mode', 1)

module = ssc.module_create(b'irradproc')
if ssc.module_exec(module, wfd) == 0:
print('irradproc simulation error')
idx = 1
msg = ssc.module_log(module, 0)
while (msg != None):
print(' : ' + msg.decode("utf - 8"))
msg = ssc.module_log(module, idx)
idx = idx + 1
SystemExit( "Simulation Error" );
#Check the desired output
np.array(ssc.data_get_array(wfd, b'sun_zen'))[:100]

I get the following error:

irradproc simulation error
: ssc variable does not exist: 'global'

I am not sure if the error is because PySSC is setup to only run the pvsamv1 and PySSC is asking for something that ssc doesn't have in this case or if this is an error internal to the compiled ssc libraries. OR, perhaps I am just using the submodule wrong.

Any help with this issue would be greatly appreciated.



If you go to the SAM SDK folder for your platform and execute sdktool (sdktool.exe) you can check out the variables for your module of interest. You'll see that 'irradproc' does require a variable 'global' (Global horizontal irradiance) with the default 'irrad_mode' (Irradiance input mode) of 0.

sdktool makes it easy to check what variables you need for each SAM module.

Kind regards




Thanks for the quick reply! I had been using the SDK tool but had incorrectly assumed the variable names were the same as those used in the pvsamv1 weather container.



Just to note, the order implied in the SDKtool UI for which value of irrad_mode is which option is incorrect. Specifically, the option 0 is not Beam+Diff, but instead Global+Beam (so the default requires global). Might be something to improve in later releases.

Paul Gilman

Thanks for pointing that out. I've made a note in the SSC issues list so we can address it before the next release:

Best regards,


Hi Casey, just wanted to let you know that we've looked into this bug and the documentation is actually correct for all irrad_mode options, but there was a different bug. Option 0 does use Beam + Diffuse, but faulty logic inside the function threw the error that "global" was still required, when in fact it was not required and not used by the function. There was a similar problem with the "gcr" input, where it would fail as being required when in fact it was not. This error only affected the irradproc compute module (cmod_irradproc), NOT any of the other compute modules using the irradproc functions (pvsamv1, pvwatts, etc).

We've checked a fix into our open source version that should go out with our next patch. In the meantime, a safe workaround is to assign something to global (and to GCR, if you have a problem with that too)- the code won't actually use the values you pass in.

Good luck!


Thanks Janine good to know!

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer