Skip to content

solarposition. correctness of calculations #452

Closed
@stepanenkopaul

Description

@stepanenkopaul

I would like to clarify how correct my calculations are and whether I used the function correctly to calculate the zenith of the sun?

import pvlib
import pandas
import calendar
import re

f = open('_dni.txt','w')

#set year
y=2017

doy = 0#day of year counter

for m in range(1,2):
dc=calendar.monthrange(y,m)[1]

for d in range(1,dc+1):
   doy=doy+1 
   for h in range(0,24):
       s_time='{0}-{1}-{2} {3}:00'.format(y,m,d,h)
       time = pandas.Timestamp(s_time,tz='America/Phoenix')
  
       zenith=pvlib.solarposition.get_solarposition(time=time,
                                                 latitude=33.4333,
                                                 longitude=-112.017,
                                                 altitue=None,
                                                 pressure=None,
                                                 method='nrel_numpy',
                                                 temperature=12)
       
       f_zenith=float(zenith.zenith)

       print(s_time+"\t"+str(f_zenith)+"\n")
 

       f.write(s_time+"\t"+str(f_zenith)+"\n")

f.close()

As the source data (coordinates, time zone and GHI), I use the model data of the SAM application (System Advisor Model).

But when I try to calc DNI and DHI via pvlib, my findings are completely different from those of the model.

For example, in the model on the first day of the year at 10 o'clock, the values of GHI, DNI, DHI are as follows:
GHI: 457
DNI: 901
DHI: 53

The calculated zenith angle is equal to 66.9732005775

I try to calculate the DNI and GHI as follows:
#---------------------

#day of year
doy=1
i_ghi=457
f_zenith=66.9732005775

f_dni=pvlib.irradiance.erbs(i_ghi,f_zenith,doy)["dni"]
f_dhi=pvlib.irradiance.erbs(i_ghi,f_zenith,doy)["dhi"]

#---------------------

The values of DNI and GHI are as follows:
DNI: 975.5429981466746
GHI: 75.405

These values are far from the values of model.
How much do I correctly calculate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions