deviceDesc = MA15 LN2 cooldown (does it work?)

defineTemperature tt

device stick_menu 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 2.2
  nv ctrl/minpulse_o 0.01
  nv ctrl/minpulse_c 0.05
  nv tol 0.02
}

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}
}

appendVars n2coolPar.istate|i|State|1 lc|mbar|Lambda_p|4
makeN2cool "tcoil ta"
catch {
  # finish hour (tomorrow morning)
  n2coolPar time 6
  # target temperature for MagBot
  n2coolPar topLimit 85
  # cooling rate K / min.
  n2coolPar coolRate 0.3
}

GraphAdd n2coolpar.reg|K_2|T_reg|green
GraphAdd n2coolpar.tfil|K_2|T_filtered|red

hsetprop /LN2fill group "LN2 fill (not for LN2 precool)"

makenv lnv -driver nv_ccu -controller _lnv -port ma15-ts:3004 "lambda needle valve"
