Enhance SAM with features tailored to your specific needs! We collaborate with companies, universities, and organizations to privately fund new capabilities or analyses. Your investment drives innovation while benefiting the broader energy community. Email us to learn more.

Running irradproc submodule with PySSC

  • caseyzak24
  • Topic Author
More
09 Mar 2018 14:22 #6107 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.

  • Angus King
More
11 Mar 2018 09:12 #6108 by Angus King
Replied by Angus King on topic Running irradproc submodule with PySSC
Casey

See my response to your post on the SAM forum -> sam.nrel.gov/comment/8563#comment-8563

Kind regards

Angus

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

Moderators: Paul Gilman
Powered by Kunena Forum