deviceDesc = "BlueFors dil"


# --- lakeshore 370 ctrl ---
makenv tbf -driver 370_lsc -port psts262:3007 {
  lsc_sensor pt1 1 PT1012 -excitation 2mV
  GraphAdd tbf.pt1 K T_Stage1 yellow

  lsc_sensor pt2 2 X64004 -excitation 2mV
  GraphAdd tbf.pt2 K T_Stage2 cyan

  lsc_sensor still 5 X63592 -excitation 63.2uV
  GraphAdd tbf.still K T_Still green

#  lsc_sensor mc 6 rx03312  -excitation 20uV
#  GraphAdd tbf.mc K T_MC blue
#  GraphAdd tbf.mc.raw Ohm R_MC blue

  lsc_sensor test 6 rx270c  -excitation 20uV
  GraphAdd tbf.test K T_entropy orange
  GraphAdd tbf.test.raw Ohm R_entropy orange

  lsc_sensor cf 7 rx03310 -excitation 20uV
  GraphAdd tbf.cf K T_cf magenta
  GraphAdd tbf.cf.raw Ohm R_cf magenta
 
# GraphAdd tbf.set.power mW MC_Pow blue

#  lsc_sensor t1k 15 ruoxben1k
#  GraphAdd tbf.t1k K test1k_T magenta

#  lsc_sensor t5k 16 ruox5k
#  GraphAdd tbf.t5k K test5k_T orange

  lsc_loop set -channel 5 -maxheater 10mA -resist 120
  GraphAdd tbf.set.power mW Still_Pow green
}

if {0} { # exclude tcf lakeshore
  # lakeshore 370 ctrl CF
  makenv tcf -driver 370_lsc -port psts262:3008 {
  #    lsc_sensor rua 6 manual  -excitation 20uV
  #  GraphAdd tcf.rua K 102A_T orange
  #  GraphAdd tcf.rua.raw Ohm 102A orange
  #    lsc_sensor rub 7 manual  -excitation 20uV
  #  GraphAdd tcf.rub K 102B magenta
  #  GraphAdd tcf.rub.raw Ohm 102B magenta
  #    lsc_sensor ruc 8 manual  -excitation 20uV
  #  GraphAdd tcf.ruc K EntropC cyan
  #  GraphAdd tcf.ruc.raw Ohm EntropC cyan

    lsc_sensor mc 6 rx03312  -excitation 20uV
    GraphAdd tcf.mc K T_mc blue
    GraphAdd tcf.mc.raw Ohm R_mc blue

    lsc_sensor rod 7 rx102a  -excitation 20uV
    GraphAdd tcf.rod K T_WL orange
    GraphAdd tcf.rod.raw Ohm R_WL orange


    lsc_loop set -channel 6 -maxheater 31mA -resist 120
    GraphAdd tcf.set.power mW MC_Pow blue
  }
}


## --- LS370 scanner ---
#makenv t ls370bf
#t active3 0
#t active4 0
#t active8 0
#t active9 0
#t active10 0
#t active11 0
#t active12 0
#t active13 0
#t active14 0
#GraphAdd t.chan1 K T50K   red
#GraphAdd t.chan2 K T4K    green
#GraphAdd t.chan5 K TStill blue
#GraphAdd t.chan6 K TMC    magenta
#GraphAdd t.chan7 K TCF    yellow
#GraphAdd t.chan15 K 1Ktest    orange


#GraphAdd t.res1 Ohm R50K   red
#GraphAdd t.res2 Ohm R4K    green
#GraphAdd t.res5 Ohm RStill blue
#GraphAdd t.res6 Ohm RMC    magenta
#GraphAdd t.res7 Ohm RCF    black
#GraphAdd t.res15 Ohm 1Ktest yellow
#GraphAdd t.res16 Ohm 5Ktest orange

#GraphAdd t.set K Tset black
#GraphAdd t.htr W Phtr red
#GraphAdd t.still % Still red


#--- Fixpoint dev---
#makenv Vfp nanov
# --- compressor ---
#makenv cp2800 cp2800

#GraphAdd cp2800.inp_water_t C InpWater_C red
#GraphAdd cp2800.out_water_t C OutWater_C blue
#GraphAdd cp2800.oil_t       C Oil_C      green
#GraphAdd cp2800.helium_t    C Helium_C   magenta

#GraphAdd cp2800.high_side_p_min psi High_psi_min red
#GraphAdd cp2800.high_side_p_max psi High_psi_max orange
#GraphAdd cp2800.low_side_p_min psi Low_psi_min green
#GraphAdd cp2800.low_side_p_max psi Low_psi_max dark_green

#makenv tcf -driver loop -invar "/t/chan7" -outvar "t still" \
#  -outmax 100 -prop 0.2 -int 0.2

# pc11003 is the Windows computer controller the gas handling system
makenv bfgh -driver bfgh -port pc11003:1234

GraphAdd bfgh.pivc mbar IVC black
GraphAdd bfgh.pstill mbar Still_line red
GraphAdd bfgh.pcond mbar Condensing_line blue
GraphAdd bfgh.phep mbar He3_pump_back green
GraphAdd bfgh.pdump mbar Dump orange
GraphAdd bfgh.paux mbar auxillary magenta
GraphAdd bfgh.flow mmolsec He3_flow  black
 
GraphAdd bfgh.turbo1 sw He3-Turbo red
GraphAdd bfgh.scroll1 sw He3-scroll hot_pink
GraphAdd bfgh.turbo2 sw aux-Turbo blue
GraphAdd bfgh.scroll2 sw aux-scroll sky_blue
GraphAdd bfgh.pulsetube sw PulseTube black
GraphAdd bfgh.compressor sw He3-compressor magenta
GraphAdd bfgh.hs-still sw HS-Still yellow
GraphAdd bfgh.hs-mc sw HS-MC gray
GraphAdd bfgh.ext sw Still_heat cyan


#makenv cmn -driver cmnnanov -port psts257:3016

if {0} {# inhibit --- autoheater ---
  makenv autoheater -driver auto370 tcf {tcf mc}

  auto370::mode 0 normal {
    autoheater ttable 0.01 0.022 0.064 0.22 1.0
    autoheater prop 5
    autoheater propmin 0.5
    autoheater 1
    autoheater autoprop 1
    autoheater propmin 0.5
    autoheater maxrange 6
    tcf set/integ 100
  }

  auto370::mode 1 partial_circulate {
    autoheater ttable 0.01 0.022 0.8 1.2 5 100
    autoheater 0
    autoheater heaterrange 7
    autoheater autoprop 1
    autoheater prop 40
    autoheater propmin 2
    autoheater maxrange 7
    tcf set/integ 100
  }

  hset autoheater/mode 0
}

# --- sim 921 ac res. bridge ---
#makenv ac -driver sim921 1 rod 3 mc
makenv ac -driver sim921 -port psts262:3004 1 rod 3 mc

GraphAdd ac.rod K T_rod red
GraphAdd ac.rod.r Ohm R_rod red

GraphAdd ac.mc K T_mc blue
GraphAdd ac.mc.r Ohm R_mc blue

catch {
  ac mc/curve rx03312
}

# --- heaterboxes WL = rodhtr
#                 MC = mchtr
# weak link
makenv rodhtr dilhtr -port psts262:3006

makenv tlrod -driver piloop -invar /ac/rod -outvar rodhtr -outmin 0 -outmax 3.3 \
  -prop 1 -int 6 -precision 0.001 -inpfunc 1 -outfunc 1 -outlinear 0.04 \
  -inplinear 0.01 -ramptime 240 -smoothtime 60 -ramptol 0.05

#catch {
#  # detect automatically open sensor
#  ac rod/sensorcheck 1
#}

GraphAdd tlrod.set K tlrod_set grey
GraphAdd tlrod.reg K tlrod_reg black
GraphAdd rodhtr mW rod_htr red

# mix chamber
makenv mchtr dilhtr -port psts262:3005

makenv tlmc -driver piloop -invar /ac/mc -outvar mchtr -outmin 0 -outmax 3.3 \
  -prop 0.2 -int 60 -precision 0.001 -inpfunc 1 -outfunc 1 -outlinear 0.04 \
  -inplinear 0.01 -ramptime 240 -smoothtime 60 -ramptol 0.05

GraphAdd tlmc.set K tlmc_set green
GraphAdd tlmc.reg K tlmc_reg olive
GraphAdd mchtr mW mc_htr blue

device stick_menu "lt wl noother"


makenv bfdil -driver bfdil

# default stick should be selected after config
#stick lt



makeobject magnet array
magnet makeitem field
GraphAdd magnet.field T Magnet 

