# Calculation of Perez model

• mustafa_alotbah
• Topic Author
26 May 2022 12:09 - 26 May 2022 23:03 #11000 by mustafa_alotbah
Calculation of Perez model was created by mustafa_alotbah
I was looking into Perez model as implemented in SSC in cmod_pvwattsv0.cpp and comparing it to the technical handbook.

According to the module and other resources, the airmass should be

where b is the incidence angle.

Somehow in  this line  the equation for airmass is:
AIRMASS = 1.0 / (CZ + 0.15 * pow(93.9 - ZENITH, -1.253) );

and CZ in  this line  is:
CZ = cos(zen);

where zen is the sun's zenith in radiations and ZENITH the sun's zenith in degrees.

Shouldn't the equation for airmass replace CZ with cos(inc)? or am I missing something?

Best,
Mustafa Alotbah
##### Attachments:
Last edit: 26 May 2022 23:03 by pgilman.

• pgilman
26 May 2022 23:18 #11001 by pgilman
Replied by pgilman on topic Calculation of Perez model
Hi Mustafa,

Your observation is correct, but pvwattsv0 is a very outdated version of PVWatts.

The relevant code for the Perez model that is used by pvwattsv1 and later versions is here: github.com/NREL/ssc/blob/cd1b0110e43826d98fbe52bfac4f4f56f9d7afcc/shared/lib_irradproc.cpp#L2000

As of SAM 2021.12.02, SAM's implementation of PVWatts uses pvwattsv8.

Best regards,
Paul.

• mustafa_alotbah
• Topic Author
27 May 2022 09:29 #11003 by mustafa_alotbah
Replied by mustafa_alotbah on topic Calculation of Perez model
Hi Paul,

Thank you, I figured that out after I had published the post, but even in lib_irradproc.cpp this line  defines the airmass, which I think has the same issue, it uses CZ (Cos Zenith) instead of COSINC which is only defined afterwards.

Best regards,
Mustafa.﻿

• mustafa_alotbah
• Topic Author
27 May 2022 11:24 - 27 May 2022 22:02 #11005 by mustafa_alotbah
Replied by mustafa_alotbah on topic Calculation of Perez model
Hi Paul,

another thing,  in this line  B is calculated as
B = D * F1 * ZC / ZH;

ZC being "a" in the handbook and ZH assumed to be "b", however, this does not seem to be correct, according to the handbook:

which is B in the code, and b is defined as

while, ZH is the maxiumum of 85 degrees and CZ again, instead of ZC/COSINC, check these lines out:

1967  CZ = cos(zen);﻿
1968  ZH = (CZ > 0.0871557) ? CZ : 0.0871557;  /* Maximum of 85 deg */

Best regards,
Mustafa
##### Attachments:
Last edit: 27 May 2022 22:02 by pgilman.

• pgilman
27 May 2022 22:24 #11009 by pgilman
Replied by pgilman on topic Calculation of Perez model
Hi Mustafa,

ZC is defined here based on cos(inc): github.com/NREL/ssc/blob/cd1b0110e43826d98fbe52bfac4f4f56f9d7afcc/shared/lib_irradproc.cpp#L2000

CZ is different, and is part of a modification to the Perez model that treats diffuse irradiance as isotropic when the zenith angle not between 0 and 87.5 degrees.

Best regards,
Paul.