bifacial_radiance icon indicating copy to clipboard operation
bifacial_radiance copied to clipboard

'set1axis' type error

Open ECSape opened this issue 3 years ago • 7 comments

Hi, I am trying to set up an hourly fixed-tilt simulation. Referring to the API page, the 'set1axis' can be used to achieve this with 'fixed_tilt_angle' being set to a numeric value as shown below: trackerdict = demo.set1axis(metdata = metdata,axis_azimuth = 90, limit_angle = limit_angle, backtrack = backtrack, gcr = gcr, cumulativesky = cumulativesky, fixed_tilt_angle = 30.0)

However the console gives me error message as 'object of type 'int' has no len()'. I have tried different input values for the 'fixed_tilt_angle'. But It seems that there will always be this error message as long as I passed 'fixed_tilt_angle' to 'set1axis'. Is there any solution to this error or another way for setting up hourly fixed-tilt simulation? Thanks.

ECSape avatar Jan 31 '22 20:01 ECSape

Hi, I can try to track this down, could you paste the full error traceback with what line it's crashing on? Thanks.

cdeline avatar Feb 02 '22 16:02 cdeline

yes, of course.

File "C:\Users\SimulationScene\Fixed_Tilt_Hourly\fixed_tilt_hourly.py", line 68, in trackerdict = demo.set1axis(metdata = metdata,axis_azimuth = 90, limit_angle = limit_angle, backtrack = backtrack, gcr = gcr, cumulativesky = cumulativesky, fixed_tilt_angle = 30)

File "C:\ProgramData\Anaconda3\lib\site-packages\bifacial_radiance\main.py", line 1150, in set1axis trackerdict = metdata._set1axis(cumulativesky=cumulativesky,

File "C:\ProgramData\Anaconda3\lib\site-packages\bifacial_radiance\main.py", line 3065, in _set1axis trackingdata = self._getTrackingAngles(axis_azimuth,

File "C:\ProgramData\Anaconda3\lib\site-packages\bifacial_radiance\main.py", line 3145, in _getTrackingAngles pvsystem = pvlib.pvsystem.PVSystem(fixed_tilt_angle,axis_azimuth)

File "C:\ProgramData\Anaconda3\lib\site-packages\pvlib\pvsystem.py", line 251, in init elif len(arrays) == 0:

TypeError: object of type 'int' has no len()

ECSape avatar Feb 02 '22 16:02 ECSape

Hi @ECSape

I was able to reproduce your error on the main branch. Pvlib has been updating its code and that is why this error is now happening. We have updated our working with pvlib for this function in the development branch . At the moment, we will not address this issue as the next release is SO CLOSE SO SO CLOSE, and this will be fixed for you then. Sorry to not provide more suggestions at the moment other than: try using the development version or give us one more week.

image

Code to reproduce error (on main only, at the moment)

import bifacial_radiance
demo = bifacial_radiance.RadianceObj('demo')  
print(bifacial_radiance.__version__)
demo.setGround(0.25)
epwfile = demo.getEPW(30, -110)
metdata = demo.readWeatherFile(epwfile)
trackerdict = demo.set1axis(metdata = metdata,axis_azimuth = 90, limit_angle = 60, backtrack = True, 
                            gcr = 0.3, cumulativesky = False, fixed_tilt_angle = 30.0)
          

Same code working well on development branch:

image

shirubana avatar Feb 02 '22 16:02 shirubana

Thank you so much for the help and suggestions!

ECSape avatar Feb 02 '22 17:02 ECSape

Hi,

Sorry to barge right in. I am facing a similar problem as @ECSape, however, I am using the GUI as I am not the best of coders!

In my case, I am trying to control my simulation with "Fixed, Hourly with Start/End times" to get hour-by-hour results (for a day or two). I get the following error traceback:

Using Pre-determined Module Type: Prism Solar Bi60

***Starting Fixed-tilt hourly simulation ***

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\yjkm\Anaconda3\lib\tkinter_init_.py", line 1892, in call return self.func(*args) File "C:\Users\yjkm\Documents\bifacial_radiance-main\bifacial_radiance\gui.py", line 434, in runBifacialRadiance self.data, self.analysis = bifacial_radiance.modelchain.runModelChain(simulationParamsDict=simulationParamsDict, File "C:\Users\yjkm\Anaconda3\lib\site-packages\bifacial_radiance\modelchain.py", line 246, in runModelChain trackerdict = demo.set1axis(cumulativesky=False, File "C:\Users\yjkm\Anaconda3\lib\site-packages\bifacial_radiance\main.py", line 1150, in set1axis trackerdict = metdata._set1axis(cumulativesky=cumulativesky, File "C:\Users\yjkm\Anaconda3\lib\site-packages\bifacial_radiance\main.py", line 3065, in _set1axis trackingdata = self._getTrackingAngles(axis_azimuth, File "C:\Users\yjkm\Anaconda3\lib\site-packages\bifacial_radiance\main.py", line 3145, in _getTrackingAngles trackingdata keys: 'tracker_theta', 'aoi', 'surface_azimuth', 'surface_tilt' File "C:\Users\yjkm\Anaconda3\lib\site-packages\pvlib\pvsystem.py", line 251, in init elif len(arrays) == 0: TypeError: object of type 'float' has no len()

I have tried to use the development version, as @shirubana suggested but I still get the same error message. Thanks a ton!

yjkm avatar Feb 03 '22 09:02 yjkm

@yjkm I was not able to reproduce your issue in the development branch. Maybe the installation didn't get updated properly when you switched? To check please print bifacial_radiance.version once you have imported it from a python terminal or jupyter notebook. Fyi --- this is how the GUI looks like on the development version vs the Master version:

image

OPTION in the meantime for release: @kanderso-nrel suggested trying downgrading the pvlib installation to pvlib==0.8.1. This works with the Master and the GUI from Master.

pip install pvlib==0.8.1 There is still a warning from pvlib but it works :) image

shirubana avatar Feb 03 '22 15:02 shirubana

Hi @shirubana,

Thank you for helping out! For some reason, it did not work for me yet (with the development version), perhaps because of silly coding errors that I make.

Anyway, the way @kanderso-nrel suggested did the trick! So many thanks to both of you :-)

I can't wait for the new GUI version to be up soon - not long left I hope :D

yjkm avatar Feb 03 '22 16:02 yjkm