set title "Zing v6.0" 

set scr(H)      [winfo screenheight .]   ;      set scr(W)      [winfo screenwidth .] 
set kscreen(H)  [expr $scr(H) /768.]     ;      set kscreen(L)  [expr $scr(W) /1024.]  
set wideness [expr $scr(W)/$scr(H)]

set W(H)  [expr $scr(H)*0.87]  ;  set W(L) [expr $scr(W)*0.98]
set W(BH) [expr 0.08*$W(H)]
set W(MAP_H) [expr $scr(H)*0.5]

if {$wideness > 1.33} {  set kscreen(L) [expr $kscreen(L)*1.33/$wideness]
                         set W(L)       [expr $W(L)*1.33/$wideness]
}


       set size(0)  [expr round([expr 8* $kscreen(L)])]
       set size(2)  [expr round([expr 10*$kscreen(L)])]
       set size(3)  [expr round([expr 12*$kscreen(L)])]
       set size(4)  [expr round([expr 14*$kscreen(L)])]
       set size(5)  [expr round([expr 16*$kscreen(L)])]

foreach i { 0 2 3 4 5 }  { set font($i)  "-family Tahoma            -size $size($i) " 
                           set Bfont($i) "-family Tahoma            -size $size($i) -weight bold " ;#" -slant italic " 
                           set Sfont($i) "-family Symbol            -size $size($i) -weight bold -slant italic "
                           set Xfont($i) "-family {Comic Sans MS}   -size $size($i) -weight bold" 
}

 set Bfont(N) "-family {Times New Roman} -size $size(3) -weight bold -slant italic -underline 0" 
 set Bfont(S) "-family {Times New Roman} -size $size(3) -weight bold -slant italic -underline 1" 

 option add *font "-family Tahoma -size $size(2)" 

#--------------------------- Constants --------------------
#------------------------- for Autocheck ---------------------
# ---------------- Presure -----------
# P1 -> may be DPz  or Pvac
set Pref(V_NC)      0                                       ;#  value of AP-Z - vac NC
set Pref(V_opt-)   -0.90    
set Pref(V_opt+)   -0.30

set Pref(V_max)    55
set Pref(P_NC)      0    ;#  value of AP-Z - pres NC 
set Pref(P_0+)     60    ;#  value of Pizb , when Pat ~0
set Pref(P_++)    130    ;#  very big for iddle

#--------------Lambda----------------
set L_(01A) 40                       ;# ampl values------------
set L_(01A_U) [expr $L_(01A)*1.3]  ;  set L_(01A_L) [expr $L_(01A)*0.7]
set L_(01L) 8                        ;# min values------------
set L_(01L_U) [expr $L_(01L)*1.3]  ;  set L_(01L_L) [expr $L_(01L)*0.0]
set L_(01M) 23                       ;# mean values------------
set L_(01M_U) [expr $L_(01M)*1.3]  ;  set L_(01M_L) [expr $L_(01M)*0.7]

set L_(05A) 200                      ;# ampl values------------
set L_(05A_U) [expr $L_(05A)*1.3]  ;  set L_(05A_L) [expr $L_(05A)*0.7]
set L_(05L) 40                       ;# min values------------
set L_(05L_U) [expr $L_(05L)*1.3]  ;  set L_(05L_L) [expr $L_(05L)*0.0]
set L_(05M) 100                      ;# mean values------------
set L_(05M_U) [expr $L_(05M)*1.3]  ;  set L_(05M_L) [expr $L_(05M)*0.7]

#------------------ Tacho ------------------------
set lst(rpmGB)   { 500 550 600 650 700 750 800 850 900 950 1000 }   
set lst(rpm_min) {No 500 550 600 650 700 750 800 900 1000 }
set lst(rpm_max) {No 4600 4750 5000 5250 5500 5750 6000 6750 7000 } 
                           
#-----------------PZ---------------
set lst(P_sens)   [list  "AP-Z" "DP-Z" "AEB 025" $tmsg(P_No) "Pv+MAP" $tmsg(P_reserv) ]
set lst(p_fact)   {0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150}
set lst(pminDly)  {0 0.3 0.6 0.9 1.2 1.5 1.8 2.1 2.4 2.7 3.0}

     set const(AP_dP_Z)  0.  ;  set const(KP_dP_Z) 65.5         ;#57.3       ;# AP-Z 
     set const(AP_V_Z)  77.0 ;  set const(KP_V_Z)  67.0         
     
   #  set const(AP_dP_AEB)   6.0 ;  set const(KP_dP_AEB)  88.8       ;# AP-AEB 
   #  set const(AP_V_AEB)   83.0 ;  set const(KP_V_AEB)  90.0        ;#0.625*133 , 0.625*144
     set const(AP_dP_AEB)    1.0 ;  set const(KP_dP_AEB)  89.5       ;# AP-OMWL 
     set const(AP_V_AEB)   132.0 ;  set const(KP_V_AEB)  179.7        
 
     set const(AP_DP1_5)  -19.2  ;   set const(KP_DP1_5) 128.7 
     set const(AP_DP2_5)   32.8  ;   set const(KP_DP2_5) 67.9 

        
set var(P_clbr_LPG) 1.0
set var(P_clbr_CNG) 1.9
#---------------- T------------------
set lst(t_trans) {20 25 30 35 40 45 50 55}
set lst(t_fact)  {0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150}
set lst(t_min)   {No 0 5 10 15 20 25 30}
 set const(AT) 255  ;   set const(KT) 2.0      ;#2.35
set const(NC_T) 250  ;   set const(SC_T) 10      

#-----------------Lev----------------
set lst(level_sensor) [list  "50k A(AC)"  "50k (AC)"  "1050 AEB"  "100 (AC)"  "Hana"  "90 AEB"   "OMB"  $tmsg(lev_userL)  $tmsg(lev_userH)  $tmsg(lev_No) "AEB806" ]
#------------------------------  1  ------  2  --------  3  -------  4  -------  5   ---- 6  ----- 7  -------- 8   ----------   9   --------   10  

set lst(lev_points_15) [list 0 0 0 0 0]

set lst(lev_points_1) [list 0 0 0 0 0]                   ;# 50-A AC
 set d_bord_R(1) 0 ; set d_bord_1(1) 0 ; set d_bord_2(1) 0 ; set d_bord_3(1) 0

set lst(lev_points_2)  [list 174 144 105 53 0]           ;# 50k AC  
set lst(Lev_borders_2) [list 197 186 174 160 144 126 105 81 53 19]

set lst(lev_points_3)  [list 133 97 50 18 0]             ;# 20k T (1050)
set lst(Lev_borders_3) [list 203 133 97 70 50 33 18 5] 

set lst(lev_points_4)  [list 41 57 83 105 0]             ;# 100 AC  
set lst(Lev_borders_4) [list 33 41 48 57 68 83 95 105] 

set lst(lev_points_5)  [list 101 75 51 27 127]            ;# 110 Hana  red - is last  +
set lst(Lev_borders_5) [list 0 0 0 0 0 0 0 0 0 0]

set lst(lev_points_6)  [list 50 75 97 121 35]            ;# 90 AEB    red - is last +- 
set lst(Lev_borders_6) [list 0 0 0 0 0] 

set lst(lev_points_7)  [list 134 97 51 18 0]             ;# 30k OMB
set lst(Lev_borders_7) [list 203 134 97 71 51 31 18 5] 

set lst(lev_points_8)  [list 0 0 0 0 0]                  ;# user Lo
set lst(Lev_borders_8) [list 0 0 0 0]
 set d_bord_R(8) 0 ; set d_bord_1(8) 0 ; set d_bord_2(8) 0 ; set d_bord_3(8) 0 

set lst(lev_points_9)  [list 0 0 0 0 0]                  ;# user Hi
set lst(Lev_borders_9) [list 0 0 0 0]
 set d_bord_R(9) 0 ; set d_bord_1(9) 0 ; set d_bord_2(9) 0 ; set d_bord_3(9) 0 

set lst(lev_points_10)  [list 0 0 0 0 0]                 ;# NC
set lst(Lev_borders_10) [list 0 0 0 0]

set lst(lev_points_11)  [list 150 81 44 21 250]          ;#CNG   
set lst(Lev_borders_11) [list 0 0 0 0 0 0 0 0 0 0]


set const(Alev_15) 1.    ;  set const(Klev_15) 1.
 set const(Alev)  77.    ;  set const(Klev)   73.

set const(Alev_0)  1.    ;  set const(Klev_0)  1.
set const(Alev_1) 77.    ;  set const(Klev_1) 73.         ;# -- 50k adj (was A=83,K=78)
set const(Alev_2) 197.   ;  set const(Klev_2) -193.0      ;# -- 50k diskr {was A=182; K=-187)
set const(Alev_3) 247.   ;  set const(Klev_3) -254.6      ;# -- 20k diskr
set const(Alev_4) 23.5   ;  set const(Klev_4)  77.        ;# -- 0-100 diskr (was A=23,5; K=77) 30,5 83.6
set const(Alev_5) 100.5  ;  set const(Klev_5) -77.        ;# -- 100-0 diskr (+?)
set const(Alev_6) 0.00   ;  set const(Klev_6)  1.00
set const(Alev_7) 0.00   ;  set const(Klev_7)  1.00
set const(Alev_8) 0.00   ;  set const(Klev_8)  1.00
set const(Alev_9) 0.00   ;  set const(Klev_9)  1.00
set const(Alev_10) 0.00  ;  set const(Klev_10) 1.00
set const(Alev_11) 0.00  ;  set const(Klev_11) 1.00

#-------------------- Clbr ---------------------------------------------
set lst(accur)    [list 0.05 0.10 0.15 0.20 0.50]
set lst(limits)   [list 0.15 0.20 0.25 0.30 0.35 0.40 0.50 0.55]
set lst(n_attemp) [list 3 4 5 6 7 8 9 10]
set lst(rej_dif)  [list 0.05 0.10 0.15 0.20 0.25]
set lst(B_ident)  [list 0.05 0.10 0.15 0.20 0.25]
set lst(n_float)  [list 2 3 4 5 6 7 8 9 10]

#----------------- Functional buttons --------------------------------
set     F_but(Panno)           "F5"
set     F_but(Clbr)            "F6"
set     F_but(Curves)          "F7"
set     F_but(Info)            "h"
set     F_but(Ready)           "F8"

set Dtau 0.2

set lst(lev_points_0) 0

set const(AP_DP) 1.
set const(KP_DP) 1.