ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/gendaylit.c
(Generate patch)

Comparing ray/src/gen/gendaylit.c (file contents):
Revision 2.17 by greg, Fri Aug 31 16:01:45 2018 UTC vs.
Revision 2.18 by greg, Thu Nov 7 23:15:06 2019 UTC

# Line 104 | Line 104 | double         air_mass();
104  
105   double  solar_sunset(int month, int day);
106   double  solar_sunrise(int month, int day);
107 double  stadj();
108 int     jdate(int month, int day);
107  
108   const double    AU = 149597890E3;
109   const double    solar_constant_e = 1367;    /* solar constant W/m^2 */
# Line 122 | Line 120 | const double   skybrigsup = 0.6;
120  
121  
122   /* required values */
123 + int  year = 0;                                  /* year (optional) */
124   int     month, day;                             /* date */
125   double  hour;                                   /* time */
126   int     tsolar;                                 /* 0=standard, 1=solar */
# Line 204 | Line 203 | int main(int argc, char** argv)
203                                  cloudy = 0;
204                                  dosun = argv[i][0] == '+';
205                                  break;
206 +                        case 'y':
207 +                                year = atoi(argv[++i]);
208 +                                break;
209                          case 'R':
210                                  u_solar = argv[i][1] == 'R' ? -1 : 1;
211                                  solarbr = atof(argv[++i]);
# Line 347 | Line 349 | void computesky()
349          /* compute solar direction */
350                  
351          if (month) {                    /* from date and time */
350                int  jd;
352                  double  sd;
353  
354 <                jd = jdate(month, day);         /* Julian date */
355 <                sd = sdec(jd);                  /* solar declination */
356 <                if (tsolar)                     /* solar time */
357 <                        st = hour;
358 <                else
359 <                        st = hour + stadj(jd);
360 <                
361 <                                        
354 >                st = hour;
355 >                if (year) {                     /* Michalsky algorithm? */
356 >                        double  mjd = mjdate(year, month, day, hour);
357 >                        if (tsolar)
358 >                                sd = msdec(mjd, NULL);
359 >                        else
360 >                                sd = msdec(mjd, &st);
361 >                } else {
362 >                        int  jd = jdate(month, day);    /* Julian date */
363 >                        sd = sdec(jd);                  /* solar declination */
364 >                        if (!tsolar)                    /* get solar time? */
365 >                                st = hour + stadj(jd);
366 >                }
367 >                                                        
368                  if(timeinterval) {
369                          
370                          if(timeinterval<0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines