deviceDesc = 14.9 Tesla superconducting cryomagnet

defineTemperature tt
device stick_menu "ma15 ma15t dil2 dil3 dil4 coil"
makenv tt -driver [lsdriver] {
  lsc_sensor tm A -sensor x28611 -sensorname VTI
  lsc_sensor ts C -sensorname sample
  lsc_sensor ts_2 D -sensor code -sensorname sample2
  lsc_loop set -loop 1 -channel A -maxheater 80W -resist 40Ohm -color green
  if {[lsdriver] eq "336_lsc"} {
    lsc_loop setsamp -loop 2 -channel C -maxheater 10W -resist 300Ohm -color dark_green
  }
}
tt set/limit 310

makeCCU4 ma15 nv he_ilm
catch {
  hupdate /nv/set 1
  nv ctrl/minpulse_o 0.01
  nv ctrl/minpulse_c 0.05
  cc mc 75
}

makeIps -limit 14.9 -startRamp 0.31 -port ma15-ts:3002
catch {
  mf limit 13.5
  mf perscurrent 1.0
}
makeIlm 2 -port ma15-ts:3001

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

# renamed ta...td, but kept the labels in order (M.Z. 27.8.2015)

makenv tcoil -driver mom -port ma15-ts:3003 {
  mom_sensor td -label OnLambda    -curve c_ab   -adjust {223.0 295 242.5 77.4 1151 4.22 4772 2.16}
  mom_sensor tb -label AboveLambda -curve c_ab   -adjust {222.0 295 241.14 77.4 1147 4.22 4882 2.16}
  mom_sensor tc -label MagTop      -curve x30906 -adjust {194.0 295 362.78 77.4 3968 4.22 11180 2.16}
  mom_sensor ta -label MagBot      -curve c_ab   -adjust {170.5 295 192.33 77.4 1125 4.22 5064 2.16}
}

makeLPR lpr lnv ma15-ts:3004 "/tcoil/tb /tcoil/ta /tcoil/tc /tcoil/td"
# outmax must be lower than outmin as a lower T means higher flow (inversed from typical T control)
lpr outmax 12
lpr outmin 35
lpr prop 0.5
lpr int 600

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 ma15-ts:3005
