Running irradproc submodule with PySSC

  • caseyzak24
  • Topic Author
More
09 Mar 2018 14:24 #6109 by caseyzak24
Running irradproc submodule with PySSC was created by caseyzak24
I am attempting to use the
Code:
irradproc
module and the
Code:
PySSC
wrapper to calculate sun zenith angle. Here is my Python code:

Code:
sp=SolarProject() ssc = PySSC() ssc.module_exec_set_print(0) #create the data container where everthing gets carried around wfd = ssc.data_create() ssc.data_set_array(wfd,b'beam',[0]*8760) ssc.data_set_array(wfd,b'diffuse',[0]*8760) 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)
Code:
####RUN THE SIMULATION#### 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" ); ssc.module_free(module) #Check the desired output np.array(ssc.data_get_array(wfd, b'sun_zen'))[:100]


I get the following error:

Code:
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
Code:
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.

Please Log in or Create an account to join the conversation.

  • ozsolarwind
More
11 Mar 2018 08:54 #6110 by ozsolarwind
Replied by ozsolarwind on topic Running irradproc submodule with PySSC
Casey

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

Angus

Please Log in or Create an account to join the conversation.

  • caseyzak24
  • Topic Author
More
13 Mar 2018 10:23 #6111 by caseyzak24
Replied by caseyzak24 on topic Running irradproc submodule with PySSC
Angus,

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
Code:
pvsamv1
weather container.

Please Log in or Create an account to join the conversation.

  • caseyzak24
  • Topic Author
More
13 Mar 2018 10:30 #6112 by caseyzak24
Replied by caseyzak24 on topic Running irradproc submodule with PySSC
Also,

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.

Please Log in or Create an account to join the conversation.

  • pgilman
More
13 Mar 2018 15:08 #6113 by pgilman
Replied by pgilman on topic Running irradproc submodule with PySSC
Thanks for pointing that out. I've made a note in the SSC issues list so we can address it before the next release:

github.com/NREL/ssc/issues/143

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • jfreeman
More
14 Mar 2018 18:00 #6114 by jfreeman
Replied by jfreeman on topic Running irradproc submodule with PySSC
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!
Janine

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum