DNI calculation

44 views
Skip to first unread message

Suraj Bhanu Jat

unread,
May 2, 2023, 3:22:07 AM5/2/23
to pvlib-python
Hello all,

I have data data available for GHI, DHI and zenith angle but not for DNI. Can anyone please suggest the calculation of DNI using other 3 features.

Thanks and regards,
Suraj Bhanu Jat

Jurand Bien

unread,
May 2, 2023, 5:04:35 AM5/2/23
to Suraj Bhanu Jat, pvlib-python
Hi Suraj,

All information you need you are able to find here: 

The application how to use it I've presented in post:
I know it is in Polish but now having chatgpt or google translator I think it is not a problem;)

Regards
Jurand 


--
You received this message because you are subscribed to the Google Groups "pvlib-python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pvlib-python...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pvlib-python/CAKDC0WN9xDQ0Vjeq6WqNFEuKf9oO4-ruDcHkV10VcWa7dGb1Ng%40mail.gmail.com.

Suraj Bhanu Jat

unread,
May 2, 2023, 5:08:47 AM5/2/23
to Jurand Bien, pvlib-python
Thanks, I'll check it out. 

Saurabh Aneja

unread,
May 2, 2023, 3:05:39 PM5/2/23
to pvlib-python
Hi Suraj - if you have the features as described, see here:

Adam R. Jensen

unread,
May 2, 2023, 5:28:12 PM5/2/23
to pvlib-python
The relationship between the three irradiance components can be expressed by the closure equation:

GHI = DHI + DNI * cos(zenith)

Given that you have two of the three irradiance components, the third can be calculated. Thus it is not advisable to use a model such as the DISC!

The function that Saurabh linked to implements the closure equation but implements some clever limits for high solar zenith angles to reduce unfeasible high values near sunrise/sunset. The reason unfeasible values tend to occur is that cos(zenith) approaches zero at sunrise/sunset and small measurement uncertainties in GHI/DHI are magnified as DNI = (GHI-DHI)/cos(zenith).

Mark Mikofski

unread,
May 3, 2023, 12:52:27 PM5/3/23
to pvlib-python
One of the goals of pvlib (and it's affiliation with the PV Performance Modeling Collaborative https://pvpmc.sandia.gov/) is to be a source of truth. Python is ideal for this because the code is plain text, less cluttered, uses whitespace, and is generally perceived as more humanly readable. From the help page for pvlib.irradiance.dni linked above, you may find 2 links:
* [source] - https://pvlib-python.readthedocs.io/en/stable/_modules/pvlib/irradiance.html#dni
both lead to the source code where you can see the formula that Adam referenced:
    # calculate DNI
    dni = (ghi - dhi) / tools.cosd(zenith)

You can also find this same formula in the modeling steps pages on the PVPMC website:

I hope you find these tools and this Google Group helpful! 
Reply all
Reply to author
Forward
0 new messages