-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix trigonometry around sunset and sunrise #10
base: main
Are you sure you want to change the base?
Conversation
1 == 2 corresponds to initial implementation and assumes hourly instantaneous radiation input 2 == 2 calculates the 1/cos(solar_zenith) contribution differently and assumes cumulative radiation data (e.g. from reanalyses or climate models)
- durations need to have a value in current implementation. Set to nan here. Are not used anyway.
Thanks @jwohland! I have added a stub to differentiate between accumulated/instantaneous. I think it would also make sense to test what value works for I have also run |
- Updated docstrings to mention that we assume centered data
- output of sun_angles now adapted to specified irradiance type. Output unchange for 'instantaneous'. Only sun_azimuth and timestepmean of (1/cos(zenith) for 'cumulative'.
- Black reformatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
./gsee/test/test_trigon.py:120:10: B008: Do not perform function calls in arg...
./gsee/test/test_trigon.py:120:10: B008: Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value. ./gsee/test/test_trigon.py:121:13: B008: Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.
…or conversion from dni to radiation perpendicular to the cell)
The current implementation in gsee.trigon has some problems around sunrise and sunset where PV capacities become unreasonably large. This is due to the 1/cos(solar-zenith) term and the way that timestepping is handled.
I suggest a different way to compute the 1/cos contribution that is more representative for cumulative data and can handle non-hourly input data better. The basic idea is to compute 1/cos repeatedly on a sub-timestep scale, set unreasonably large contributions to zero and then average everything. More details can be found here:
background.pdf
I attach plots made using 3h reanalysis data for the initial implementation, using my changes and the difference between both. There are arch-like structures close to the sunset/sunrise lines in individual timesteps (most visible in June and December) using the initial version which vanish in the proposed one.
Initial
![pv_3h_CERA20C_year_1901_initial](https://user-images.githubusercontent.com/20681098/84990007-ce953980-b144-11ea-96ae-55016955b150.jpeg)
![pv_3h_CERA20C_year_1901_new](https://user-images.githubusercontent.com/20681098/84990001-cd640c80-b144-11ea-98cd-d828cde4dca2.jpeg)
![pv_3h_CERA20C_year_1901_diff](https://user-images.githubusercontent.com/20681098/84989993-cb9a4900-b144-11ea-801c-7d7c217bc266.jpeg)
New
Difference
Open questions: