Files
sea/tcl/startup/hepump.tcl
2023-07-03 17:54:19 +02:00

64 lines
1.7 KiB
Tcl

proc makeHePump {} {
if {[sicsdescriptor hepump] eq "notfound"} {
makenv hepump -driver hepump hemot
set type [silent xds35_auto result instconfig he_pump_type]
if {$type eq "xds35_auto" || $type eq "other_pump_with_valve"} {
set type 0
} elseif {$type eq "xds35_manual"} {
set type 1
} elseif {$type eq "sv65"} {
set type 2
} elseif {$type eq "neodry"} {
set type 8
} else {
error "unknown hepump type: $type"
}
hset /hepump $type
if {$type == 0 || $type == 8} {
makenv hemot -driver trinamic -base /hepump/ hepump
if {[silent 0 result instconfig sensirion]} {
makenv nvflow -driver sensirion -controller _hemot
}
hsetprop /hepump/hemot label "valve motor"
}
}
}
proc pump_is_off {} {
# used in drivers/ccu4flow.tcl and drivers/nvstep.tcl
# to be called from /nv
set msghead "needle valve control suspended"
set pmsg "$msghead ([silent "" sct off_reason])"
set now [DoubleTime]
if {$now < [silent $now sct off_until]} {
if {[hvali [sct]/status] ne $pmsg} {
if {[silent "" sct off_reason] ne "pump mode changed"} {
clientput "ERROR: $pmsg"
}
}
hupdate [sct]/status $pmsg
return 1
}
if {[string match ${msghead}* [hvali [sct]/status]]} {
hupdate [sct]/status ""
}
return 0
}
proc pump_health_update {instrument value} {
# this script is used on seaman
global helium_last
set now [DoubleTime]
pump_health makeitem $instrument $value
if {[silent "" hdbgetpropval /pump_health/$instrument logger_name] eq ""} {
logsetup /pump_health/$instrument
}
GraphAdd pump_health.$instrument %_3 pump_$instrument auto
}
publishLazy pump_health_update Spy