deviceDesc = 6.8 Tesla horizontal cryomagnet

defineTemperature tt
device stick_menu "ma7 dil2 dil3 dil4 coil"

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

makeCCU4 ma7 nv_release_blocked he_ilm

hupdate /nv/set 1.2
# increase n.v. motor current
cc mc 75
nv ctrl/openpulse 2

makeN2Fill ccu4ilm {
  ln2fill lowlevel 30
  ln2fill highlevel 80
  ln2fill minfillminutes 8
  ln2fill maxfillminutes 40
  ln2fill minholdhours 24
  ln2fill maxholdhours 96
#  appendVars ln2fill.smooth/%/N2smooth/13
}

makeIps -limit 6.8 -startRamp 0.25 -port ma7-ts:3001 -startScript checkMA7 6.2
if {[result instrument] eq "rita2"} {
  mf limit 4.0
}

makeIlm -channels 2 -port ma7-ts:3002

makenv tcoil -driver mom -port ma7-ts:3003 {
  mom_sensor ta -label T_Coil1 -curve c_ab270 -adjust {371 293 456 77.4 5400 4.22}
  mom_sensor tb -label T_Coil2 -curve c_ab270 -adjust {367 293 456 77.4 5400 4.22}
}

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

setstickrot ma7-ts:3007
