90 |
|
#include "sun.h" |
91 |
|
#include "loadEPW.h" |
92 |
|
|
93 |
– |
char *progname; /* Program name */ |
93 |
|
const double DC_SolarConstantE = 1367.0; /* Solar constant W/m^2 */ |
94 |
|
const double DC_SolarConstantL = 127.5; /* Solar constant klux */ |
95 |
|
|
331 |
|
int i, j; |
332 |
|
double timeinterval = 0; |
333 |
|
|
334 |
< |
progname = argv[0]; |
334 |
> |
fixargv0(argv[0]); |
335 |
|
/* get options */ |
336 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
337 |
|
switch (argv[i][1]) { |
500 |
|
dpthist[0] = -100; |
501 |
|
/* process each time step in tape */ |
502 |
|
while ((j = EPWread(epw, &erec)) > 0) { |
503 |
< |
int mo = erec.date.month+1; |
504 |
< |
int da = erec.date.day; |
505 |
< |
double hr = erec.date.hour; |
503 |
> |
const int mo = erec.date.month+1; |
504 |
> |
const int da = erec.date.day; |
505 |
> |
const double hr = erec.date.hour; |
506 |
|
double sda, sta, st; |
507 |
|
int sun_in_sky; |
508 |
+ |
/* 3-hour dew point temp */ |
509 |
+ |
if (EPWisset(&erec,dptemp)) { |
510 |
+ |
if (dpthist[0] < -99) |
511 |
+ |
dpthist[0] = dpthist[1] = erec.dptemp; |
512 |
+ |
dew_point = (1./3.)*(dpthist[0] + dpthist[1] + erec.dptemp); |
513 |
+ |
dpthist[0] = dpthist[1]; dpthist[1] = erec.dptemp; |
514 |
+ |
} else |
515 |
+ |
dpthist[0] = -100; |
516 |
|
/* compute solar position */ |
517 |
|
if ((mo == 2) & (da == 29)) { |
518 |
|
julian_date = 60; |
531 |
|
} |
532 |
|
altitude = salt(sda, st); |
533 |
|
sun_in_sky = (altitude > -DegToRad(SUN_ANG_DEG/2.)); |
534 |
< |
if (sun_hours_only && !sun_in_sky) |
534 |
> |
if (sun_hours_only & !sun_in_sky) |
535 |
|
continue; /* skipping nighttime points */ |
536 |
|
azimuth = sazi(sda, st) + PI - DegToRad(rotation); |
537 |
|
|
556 |
|
dif = erec.diffillum; |
557 |
|
break; |
558 |
|
} |
552 |
– |
if (EPWisset(&erec,dptemp)) { /* 3-hour dew point temp */ |
553 |
– |
if (dpthist[0] < -99) |
554 |
– |
dpthist[0] = dpthist[1] = erec.dptemp; |
555 |
– |
dew_point = (1./3.)*(dpthist[0] + dpthist[1] + erec.dptemp); |
556 |
– |
dpthist[0] = dpthist[1]; dpthist[1] = erec.dptemp; |
557 |
– |
} |
559 |
|
mtx_offset = 3*nskypatch*nstored; |
560 |
|
nstored += !avgSky | !nstored; |
561 |
|
/* make space for next row */ |
711 |
|
int index; /* Category index */ |
712 |
|
double norm_diff_illum; /* Normalized diffuse illuimnance */ |
713 |
|
int i; |
714 |
< |
|
714 |
> |
|
715 |
|
/* Calculate atmospheric precipitable water content */ |
716 |
|
apwc = CalcPrecipWater(dew_point); |
717 |
|
|