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.16 by greg, Wed Jul 30 17:30:27 2014 UTC vs.
Revision 2.17 by greg, Fri Aug 31 16:01:45 2018 UTC

# Line 4 | Line 4
4   *                              Centre de Valbonne, 500 route des Lucioles, 06565 Sophia Antipolis Cedex, France
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   */
9  
10   #define  _USE_MATH_DEFINES
# Line 53 | Line 54 | float defangle_phi[] = {
54          90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, 285, 300, 315, 330, 345, 0, 20, 40, 60,
55          80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 0, 30, 60, 90, 120, 150, 180, 210,
56          240, 270, 300, 330, 0, 60, 120, 180, 240, 300, 0};
57 + /* default values for Berlin */
58 + float   locus[] = {
59 + -4.843e9,2.5568e6,0.24282e3,0.23258,-4.843e9,2.5568e6,0.24282e3,0.23258,-1.2848,1.7519,-0.093786};
60  
61  
62  
# Line 140 | Line 144 | double         *c_perez;
144   int     output=0;       /* define the unit of the output (sky luminance or radiance): */
145                          /* visible watt=0, solar watt=1, lumen=2 */
146   int     input=0;        /* define the input for the calulation */
147 <
147 > int     color_output=0;
148   int     suppress_warnings=0;
149  
150          /* default values */
# Line 151 | Line 155 | double  betaturbidity = 0.1;
155   double  gprefl = 0.2;
156   int     S_INTER=0;
157  
158 +
159          /* computed values */
160   double  sundir[3];
161   double  groundbr = 0;
# Line 207 | Line 212 | int main(int argc, char** argv)
212                                  cloudy = argv[i][0] == '+' ? 2 : 1;
213                                  dosun = 0;
214                                  break;
215 +                        case 'C':
216 +                                if (argv[i][2] == 'I' && argv[i][3] == 'E' ) {
217 +                                locus[0] = -4.607e9;
218 +                                locus[1] = 2.9678e6;
219 +                                locus[2] = 0.09911e3;
220 +                                locus[3] = 0.244063;
221 +                                locus[4] = -2.0064e9;
222 +                                locus[5] = 1.9018e6;
223 +                                locus[6] = 0.24748e3;
224 +                                locus[7] = 0.23704;
225 +                                locus[8] = -3.0;
226 +                                locus[9] = 2.87;
227 +                                locus[10] = -0.275;
228 +                                 }else{ color_output = 1;
229 +                                 }
230 +                                break;
231 +                        case 'l':
232 +                                locus[0] = atof(argv[++i]);
233 +                                locus[1] = atof(argv[++i]);
234 +                                locus[2] = atof(argv[++i]);
235 +                                locus[3] = atof(argv[++i]);
236 +                                locus[4] = locus[0];
237 +                                locus[5] = locus[1];
238 +                                locus[6] = locus[2];
239 +                                locus[7] = locus[3];
240 +                                locus[8] = atof(argv[++i]);
241 +                                locus[9] = atof(argv[++i]);
242 +                                locus[10] = atof(argv[++i]);
243 +                                break;
244 +
245                          case 't':
246                                  betaturbidity = atof(argv[++i]);
247                                  break;
# Line 676 | Line 711 | void printsky()
711                  printf("0\n0\n");
712                  printf("4 %f %f %f %f\n", sundir[0], sundir[1], sundir[2], 2*half_sun_angle);
713          }
714 <        
715 <
716 <        printf("\nvoid brightfunc skyfunc\n");
717 <        printf("2 skybright perezlum.cal\n");
714 > /* print colored output if activated in command line (-C). Based on model from A. Diakite, TU-Berlin. Implemented by J. Wienold, August 26 2018 */      
715 >        if  (color_output==1 && skyclearness < 4.5 && skyclearness >1.065 )  
716 >        {
717 >        fprintf(stderr, "       warning: sky clearness(epsilon)= %f \n",skyclearness);
718 >        fprintf(stderr, "       warning: intermediate sky!! \n");
719 >        fprintf(stderr, "       warning: color model for intermediate sky pending  \n");
720 >        fprintf(stderr, "       warning: no color output ! \n");
721 >        color_output=0;
722 >        }
723 >        if (color_output==1)
724 >        {
725 >        printf("\nvoid colorfunc skyfunc\n");
726 >        printf("4 skybright_r skybright_g skybright_b perezlum_c.cal\n");
727          printf("0\n");
728 <        printf("10 %.3e %.3e %lf %lf %lf %lf %lf %f %f %f \n", diffnormalization, groundbr,
728 >        printf("22 %.3e %.3e %lf %lf %lf %lf %lf %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n", diffnormalization, groundbr,
729                  *(c_perez+0),*(c_perez+1),*(c_perez+2),*(c_perez+3),*(c_perez+4),
730 <                sundir[0], sundir[1], sundir[2]);
730 >                sundir[0], sundir[1], sundir[2],skyclearness,locus[0],locus[1],locus[2],locus[3],locus[4],locus[5],locus[6],locus[7],locus[8],locus[9],locus[10]);
731 >        }else{
732 >        printf("\nvoid brightfunc skyfunc\n");
733 >        printf("2 skybright perezlum.cal\n");
734 >        printf("0\n");
735 >        printf("10 %.3e %.3e %lf %lf %lf %lf %lf %f %f %f \n", diffnormalization, groundbr,
736 >                *(c_perez+0),*(c_perez+1),*(c_perez+2),*(c_perez+3),*(c_perez+4),
737 >                sundir[0], sundir[1], sundir[2]);
738 >         }
739          
740   }
741  
# Line 742 | Line 794 | void usage_error(char* msg)                    /* print usage error and
794          fprintf(stderr, "       -E global-horizontal-irradiance (W/m^2)\n\n");
795          fprintf(stderr, "       Output specification with option:\n");
796          fprintf(stderr, "       -O [0|1|2]  (0=output in W/m^2/sr visible, 1=output in W/m^2/sr solar, 2=output in candela/m^2), default is 0 \n");
797 <        fprintf(stderr, "       gendaylit version 2.4 (2013/09/04)  \n\n");
797 >        fprintf(stderr, "       gendaylit version 2.5 (2018/04/18)  \n\n");
798          exit(1);
799   }
800  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines