3 KPP_REAL SunRise
, SunSet
;
4 KPP_REAL Thour
, Tlocal
, Ttmp
;
9 Tlocal
= Thour
- ((int)Thour
/24)*24;
11 if ( (Tlocal
>= SunRise
) && (Tlocal
<= SunSet
) ) {
12 Ttmp
= (2.0*Tlocal
-SunRise
-SunSet
)/(SunSet
-SunRise
);
13 if (Ttmp
> 0) Ttmp
= Ttmp
*Ttmp
;
14 else Ttmp
= -Ttmp
*Ttmp
;
15 SUN
= ( 1.0 + cos(PI
*Ttmp
) )/2.0;