5 |
|
* *BOUYGUES |
6 |
|
* 1 Avenue Eugene Freyssinet, Saint-Quentin-Yvelines, France |
7 |
|
* print colored output if activated in command line (-C). Based on model from A. Diakite, TU-Berlin. Implemented by J. Wienold, August 26 2018 |
8 |
+ |
* version 2.6 (2021/01/29): dew point dependency added according to Perez publication 1990 (W -> atm_preci_water=exp(0.07*Td-0.075) ). by J. Wienold, EPFL |
9 |
|
*/ |
10 |
|
|
11 |
|
#define _USE_MATH_DEFINES |
134 |
|
double skybrightness = 0; |
135 |
|
double solarradiance; |
136 |
|
double diffuseilluminance, directilluminance, diffuseirradiance, directirradiance, globalirradiance; |
137 |
< |
double sunzenith, daynumber, atm_preci_water=2; |
137 |
> |
double sunzenith, daynumber, atm_preci_water, Td=10.97353115; |
138 |
|
|
139 |
|
/*double sunaltitude_border = 0;*/ |
140 |
|
double diffnormalization = 0; |
200 |
|
for (i = 4; i < argc; i++) |
201 |
|
if (argv[i][0] == '-' || argv[i][0] == '+') |
202 |
|
switch (argv[i][1]) { |
203 |
+ |
case 'd': |
204 |
+ |
Td = atof(argv[++i]); |
205 |
+ |
if (Td < -40 || Td > 40) { |
206 |
+ |
Td=10.97353115; } |
207 |
+ |
break; |
208 |
|
case 's': |
209 |
|
cloudy = 0; |
210 |
|
dosun = argv[i][0] == '+'; |
329 |
|
{ fprintf(stderr,"Out of memory error in function main"); return 1; } |
330 |
|
|
331 |
|
|
332 |
+ |
atm_preci_water=exp(0.07*Td-0.075); |
333 |
|
printhead(argc, argv); |
334 |
|
computesky(); |
335 |
|
printsky(); |
707 |
|
|
708 |
|
printf("# Local solar time: %.2f\n", st); |
709 |
|
printf("# Solar altitude and azimuth: %.1f %.1f\n", altitude*180/M_PI, azimuth*180/M_PI); |
710 |
+ |
printf("# epsilon, delta, atmospheric precipitable water content : %.4f %.4f %.4f \n", skyclearness, skybrightness,atm_preci_water ); |
711 |
|
|
712 |
|
|
713 |
|
if (dosun&&(skyclearness>1)) |
796 |
|
{ |
797 |
|
if (msg != NULL) |
798 |
|
fprintf(stderr, "%s: Use error - %s\n\n", progname, msg); |
799 |
< |
fprintf(stderr, "Usage: %s month day hour [...]\n", progname); |
800 |
< |
fprintf(stderr, " or: %s -ang altitude azimuth [...]\n", progname); |
799 |
> |
fprintf(stderr, "Usage: %s month day hour [-y year] [...]\n", progname); |
800 |
> |
fprintf(stderr, " or: %s -ang altitude azimuth [...]\n", progname); |
801 |
|
fprintf(stderr, " followed by: -P epsilon delta [options]\n"); |
802 |
|
fprintf(stderr, " or: [-W|-L|-G] direct_value diffuse_value [options]\n"); |
803 |
< |
fprintf(stderr, " or: -E global_irradiance [options]\n\n"); |
804 |
< |
fprintf(stderr, " Description:\n"); |
803 |
> |
fprintf(stderr, " or: -E global_irradiance [options]\n\n"); |
804 |
> |
fprintf(stderr, " Description:\n"); |
805 |
|
fprintf(stderr, " -P epsilon delta (these are the Perez parameters) \n"); |
806 |
|
fprintf(stderr, " -W direct-normal-irradiance diffuse-horizontal-irradiance (W/m^2)\n"); |
807 |
|
fprintf(stderr, " -L direct-normal-illuminance diffuse-horizontal-illuminance (lux)\n"); |
1435 |
|
/* degrees into radians */ |
1436 |
|
double radians(double degres) |
1437 |
|
{ |
1438 |
< |
return degres*M_PI/180.0; |
1438 |
> |
return degres*(M_PI/180.); |
1439 |
|
} |
1440 |
|
|
1441 |
|
|
1442 |
|
/* radian into degrees */ |
1443 |
|
double degres(double radians) |
1444 |
|
{ |
1445 |
< |
return radians/M_PI*180.0; |
1445 |
> |
return radians*(180./M_PI); |
1446 |
|
} |
1447 |
|
|
1448 |
|
|
1473 |
|
buffer += (*(lv+i))*cos(radians(*(theta+i))); |
1474 |
|
} |
1475 |
|
|
1476 |
< |
return buffer*2*M_PI/144; |
1476 |
> |
return buffer*(2.*M_PI/145.); |
1477 |
|
} |
1478 |
|
|
1479 |
|
|