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.5 by greg, Tue Aug 2 16:35:01 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.31
4 > /* EVALGLARE V2.00
5   * Evalglare Software License, Version 2.0
6   *
7   * Copyright (c) 1995 - 2016 Fraunhofer ISE, EPFL.
# Line 312 | Line 312 | changed masking threshold to 0.05 cd/m2
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.31 release 02.08.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 1201 | 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 1378 | 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 1427 | 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 1739 | 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 1770 | 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 2223 | 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 2400 | 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 2824 | 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