deviceDesc = 9 Tesla vertical cryomagnet

defineTemperature tt
device stick_menu "ma09 dil2 dil3 dil4"

makenv tt -driver [lsdriver] {
  lsc_sensor tm B -sensor x63879 -sensorname VTI
  lsc_sensor ts C -sensorname sample
  lsc_sensor ts_2 D -sensor code -sensorname sample2
  lsc_loop set -loop 1 -channel B -maxheater 40W -resist 80Ohm -color green
  if {[lsdriver] eq "336_lsc"} {
    lsc_loop setsamp -loop 2 -channel C -maxheater 50W -resist 50Ohm -color dark_green
  }
}
tt set/limit 310

makeCCU4 ma09 nv
catch {
   hupdate /nv/set 2.0
   nv ctrl/minpulse_o 0.01
   nv ctrl/minpulse_c 0.05
   nv tol 0.02
}

makeIps -limit 9 -startRamp 0.5 -port ma09-ts:3002
catch {
  mf limit 7.9
}

# Usage makeN2Fill [ccu | host:port | levelcmd] code
# in the second option, ccu2 is used as controller
makeN2Fill ma09-ts:3004 {
  n2 tmo2 2400
}

makeIlm -channels 1 -port ma09-ts:3001

makenv tcoil -driver mom -port ma09-ts:3003 {
  mom_sensor td -label MagBot      -curve c_ab -adjust {394.4 293 420 77.4 1108 4.22}
  mom_sensor tc -label MagTop      -curve c_ab -adjust {395.4 293 420 77.4 1108 4.22}
  mom_sensor tb -label AboveLambda -curve c_ab -adjust {250.5 293 270 77.4 963 4.22}
  mom_sensor ta -label OnLambda    -curve c_ab -adjust {218.0 293 238 77.4 974 4.22}
}

makeLPR lpr lnv ma09-ts:3004 "/tcoil/tb /tcoil/ta /tcoil/td /tcoil/tc"

catch {
  lnv int 200
  lnv flowmax 35
  default ignore_msg mf
  default ignore_msg lnv
  default n2
}

makenv table -driver table /tt/tm {
  "tt set/prop" "50:50 300:20"
  "tt set/integ" "10:50 50:20 300:5"
  "tt dblctrl/int2" "2:10 20:50 50:300 120:500 300:800"
  "tt dblctrl/prop_up" "20:0.1 50:0.4"
  "tt dblctrl/prop_lo" "20:0.1 50:0.8"
}
