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