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

Comparing ray/src/util/evalglare.c (file contents):
Revision 2.4 by greg, Thu Jul 28 16:46:10 2016 UTC vs.
Revision 2.6 by greg, Thu May 18 02:25:27 2017 UTC

# Line 1 | Line 1
1   #ifndef lint
2   static const char RCSid[] = "$Id$";
3   #endif
4 < /* EVALGLARE V1.29
4 > /* EVALGLARE V2.00
5   * Evalglare Software License, Version 2.0
6   *
7   * Copyright (c) 1995 - 2016 Fraunhofer ISE, EPFL.
# Line 310 | Line 310 | changed masking threshold to 0.05 cd/m2
310     */
311   /* evalglare.c, v1.30 2016/07/28 change zonal output: If just one zone is specified, only one zone shows up in the output (bug removal).
312     */
313 + /* evalglare.c, v1.31 2016/08/02  bug removal: default output did not calculate the amout of glare sources before and therefore no_glaresources was set to zero causing dgi,ugr being set to zero as well. Now renumbering of the glare sources and calculation of the amount of glare sources is done for all output versions.
314 +   */
315 + /* evalglare.c, v2.00 2016/11/15  add of a second fast calculation mode for annual calculations, activted by -2. Output: dgp,ugr
316 +   */
317 + /* evalglare.c, v2.01 2016/11/16  change of -2 option (now -2 dir_illum). External provision of the direct illuminance necessary, since the sun interpolation of daysim is causing problems in calculation of the background luminance.
318 +   */
319 + /* evalglare.c, v2.02 2017/02/28  change of warning message, when invalid exposure setting is found. Reason: tab removal is not in all cases the right measure - it depends which tool caused the invalid exposure entry   */
320 +  
321   #define EVALGLARE
322   #define PROGNAME "evalglare"
323 < #define VERSION "1.30 release 29.07.2016 by EPFL, J.Wienold"
323 > #define VERSION "2.02 release 28.02.2017 by EPFL, J.Wienold"
324   #define RELEASENAME PROGNAME " " VERSION
325  
326  
# Line 1199 | Line 1207 | float get_ugr(pict * p, double lum_backg, int igs, int
1207                  }
1208          }
1209          ugr = 8 * log10(0.25 / lum_backg * sum_glare);
1210 <
1210 >        if (sum_glare==0) {
1211 >        ugr=0.0;
1212 >        }
1213 >        if (lum_backg<=0) {
1214 >        ugr=-99.0;
1215 >        }
1216 >        
1217          return ugr;
1218  
1219   }
# Line 1376 | Line 1390 | int main(int argc, char **argv)
1390                  detail_out, posindex_picture, non_cos_lb, rx, ry, rmx,rmy,apply_disability,band_calc,band_color,masking,i_mask,no_glaresources,force;
1391          double  lum_total_max,age_corr_factor,age,dgp_ext,dgp,low_light_corr,omega_cos_contr, setvalue, lum_ideal, E_v_contr, sigma,om,delta_E,
1392                  E_vl_ext, lum_max, new_lum_max, r_center, ugp, ugr_exp, dgi_mod,lum_a, pgsv,E_v_mask,pgsv_sat,angle_disk,dist,n_corner_px,zero_corner_px,
1393 <                search_pix, a1, a2, a3, a4, a5, c3, c1, c2, r_split, max_angle,r_actual,lum_actual,
1393 >                search_pix, a1, a2, a3, a4, a5, c3, c1, c2, r_split, max_angle,r_actual,lum_actual,dir_ill,
1394                  omegat, sang, E_v, E_v2, E_v_dir, avlum, act_lum, ang, angle_z1, angle_z2,per_95_band,per_75_band,pos,
1395                  l_max, lum_backg, lum_backg_cos, omega_sources, lum_sources,per_75_mask,per_95_mask,per_75_z1,per_95_z1,per_75_z2,per_95_z2,
1396                  lum, lum_source,teta,Lveil_cie,Lveil_cie_sum,disability_thresh,u_r,u_g,u_b,band_angle,band_avlum,
# Line 1425 | Line 1439 | int main(int argc, char **argv)
1439          muc_rvar_clear(s_posweight2);
1440  
1441          /*set required user view parameters to invalid values*/
1442 +        dir_ill=0.0;
1443          delta_E=0.0;
1444          no_glaresources=0;
1445          n_corner_px=0;
# Line 1737 | Line 1752 | int main(int argc, char **argv)
1752                  case '1':
1753                          output = 1;
1754                          break;
1755 +                case '2':
1756 +                        output = 2;
1757 +                        dir_ill = atof(argv[++i]);
1758 +                        break;
1759  
1760                  case 'v':
1761                          if (argv[i][2] == '\0') {
# Line 1768 | Line 1787 | int main(int argc, char **argv)
1787  
1788   /*fast calculation, if gendgp_profile is used: No Vertical illuminance calculation, only dgp is calculated*/
1789  
1790 < if (output == 1 && ext_vill == 1) {
1790 > if (output == 1 && ext_vill == 1 ) {
1791                         calcfast=1;
1792                         }
1793 +                      
1794 + if (output == 2 && ext_vill == 1 ) {
1795 +                       calcfast=2;
1796 +                       }
1797 +                      
1798   /*masking and zoning cannot be applied at the same time*/
1799  
1800   if (masking ==1 && zones >0) {
# Line 2221 | Line 2245 | if (cut_view==1) {
2245   /*      pict_write(p,"firstscan.pic");   */
2246  
2247  
2248 < if (calcfast == 1 || search_pix <= 1.0) {
2248 >
2249 >
2250 > if (calcfast ==1 || search_pix <= 1.0 || calcfast == 2 ) {
2251     skip_second_scan=1;
2252     }
2253 +  
2254  
2255   /* second glare source scan: combine glare sources facing each other */
2256          change = 1;
# Line 2398 | Line 2425 | if (calcfast == 1 || search_pix <= 1.0) {
2425  
2426   /* calculation of direct vertical illuminance for CGI and for disability glare, coloring glare sources*/
2427  
2428 <        if (calcfast == 0) {
2428 >        if (calcfast == 0 || calcfast == 2) {
2429          for (x = 0; x < pict_get_xsize(p); x++)
2430                  for (y = 0; y < pict_get_ysize(p); y++) {
2431                          if (pict_get_hangle(p, x, y, p->view.vdir, p->view.vup, &ang)) {
# Line 2495 | Line 2522 | if (calcfast == 1 || search_pix <= 1.0) {
2522   /* print detailed output */
2523          
2524          
2498        if (detail_out == 1) {
2525  
2526   /* masking */
2527  
# Line 2540 | Line 2566 | if (calcfast == 1 || search_pix <= 1.0) {
2566   /* PSGV only why masking of window is applied! */
2567                   pgsv = get_pgsv(E_v, E_v_mask, omega_mask, lum_mask_av);
2568                   pgsv_sat =get_pgsv_sat(E_v);
2569 +
2570 +        if (detail_out == 1) {
2571 +
2572                  printf ("masking:no_pixels,omega,av_lum,median_lum,std_lum,perc_75,perc_95,lum_min,lum_max,pgsv,pgsv_sat: %i %f %f %f %f %f %f %f %f %f %f\n",i_mask,omega_mask,lum_mask_av,lum_mask_median[0],sqrt(lum_mask_std[0]),per_75_mask,per_95_mask,bbox[0],bbox[1],pgsv,pgsv_sat );
2573  
2574 +        }      
2575                  
2546                
2576          }
2577  
2578   /* zones */
# Line 2633 | Line 2662 | if (calcfast == 1 || search_pix <= 1.0) {
2662                  per_95_z1=lum_z1_median[0];
2663                  muc_rvar_get_median(s_z1,lum_z1_median);
2664                  muc_rvar_get_bounding_box(s_z1,bbox_z1);
2665 <
2665 >        if (detail_out == 1) {
2666 >
2667                  printf ("zoning:z1_omega,z1_av_lum,z1_median_lum,z1_std_lum,z1_perc_75,z1_perc_95,z1_lum_min,z1_lum_max: %f %f %f %f %f %f %f %f\n",omega_z1,lum_z1_av,lum_z1_median[0],sqrt(lum_z1_std[0]),per_75_z1,per_95_z1,bbox_z1[0],bbox_z1[1] );
2668  
2669                 if (zones == 2 ) {
2670  
2671                  printf ("zoning:z2_omega,z2_av_lum,z2_median_lum,z2_std_lum,z2_perc_75,z2_perc_95,z2_lum_min,z2_lum_max:  %f %f %f %f %f %f %f %f\n",omega_z2,lum_z2_av,lum_z2_median[0],sqrt(lum_z2_std[0]),per_75_z2,per_95_z2,bbox_z2[0],bbox_z2[1] );
2672 < }            
2672 > } }            
2673                  
2674          }
2675  
# Line 2653 | Line 2683 | if (calcfast == 1 || search_pix <= 1.0) {
2683                  no_glaresources=i;
2684  
2685   /* glare sources */
2686 +        if (detail_out == 1) {
2687 +
2688                  printf
2689                          ("%i No pixels x-pos y-pos L_s Omega_s Posindx L_b L_t E_vert Edir Max_Lum Sigma xdir ydir zdir Eglare_cie Lveil_cie teta glare_zone\n",
2690                           i);
# Line 2817 | Line 2849 | if (calcfast == 0) {
2849                                  if (E_vl_ext < 1000) {
2850                                  low_light_corr=1.0*exp(0.024*E_vl_ext-4)/(1+exp(0.024*E_vl_ext-4)); } else {low_light_corr=1.0 ;}
2851                                  dgp =low_light_corr*dgp;
2852 <                                dgp =age_corr_factor*dgp;
2853 <                printf("%f\n", dgp);
2852 >
2853 >                     if (calcfast == 2) {
2854 >                    
2855 >                         lum_backg_cos=(E_vl_ext-dir_ill)/3.1415927;
2856 >                         ugr = get_ugr(p, lum_backg_cos, igs, posindex_2);
2857 >                         printf("%f %f \n", dgp,ugr);
2858 >                     }else{      
2859 >                         printf("%f\n", dgp);
2860 >                }
2861          }
2862  
2863  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines