Merge branch 'master' of gitlab.psi.ch-samenv:samenv/sea

This commit is contained in:
l_samenv
2023-08-22 17:23:46 +02:00
27 changed files with 140 additions and 54 deletions

View File

@ -385,12 +385,14 @@ proc stdConfig::ccu4 {{title CCU4} args} {
} elseif {[string match valve* $a]} {
set nvalve [string range $a 5 end]
for {set ch 1} {$ch <= 12} {incr ch} {
node v$ch upd
node v$ch rd -int 10
prop read ccu4::readValve v$ch
prop enum valve_off,valve_on,no_valve,timeout,timeout1,boost
if {$ch > $nvalve} {
prop visible false
}
node vc$ch out -int
prop write ccu4::writeValve v$ch
prop enum valve_off,valve_on
if {$ch > $nvalve} {
prop visible false
@ -404,6 +406,20 @@ proc stdConfig::ccu4 {{title CCU4} args} {
return "CCU4"
}
proc ccu4::readValve {valve} {
# for some strange reason, v... are not queried with '?'
# we have to do it here
sct send $valve
return ccu4::complete
}
proc ccu4::writeValve {valve} {
set res [ccu4::write]
# update readback value immediately
hupdate [sct parent]/$valve [sct target]
return $res
}
proc ccu4::completeStart {name} {
set resval(cid) 0
set resval(cir) ""

View File

@ -546,7 +546,7 @@ proc ccu4flow::ctrl {} {
} elseif {$now < $lastim + $period} {
# wait
} else {
set slope [expr 0.01 + abs($dif) * $period / [hvali [sct]/ctrl/deriv$_dir]]
set slope [expr 0.00 + abs($dif) * $period / [hvali [sct]/ctrl/deriv$_dir]]
set totalmin ""
set ddif [format %.2f [expr -($dif - [sct olddif]) * [sct dir]]]
sct filtered_ddif [expr max(0,[silent 0 sct filtered_ddif] * 0.9 + $ddif * 0.1)]

View File

@ -26,10 +26,9 @@ proc stdConfig::cryotel {} {
node cool wr
prop label Cool
prop enum on,off
prop writecmd "SET SSTOP=%i"
prop readcmd "SET SSTOP{2}"
prop readfmt "SET SSTOP ,%i"
prop enum 1
prop write cryotel::writecool
prop read cryotel::readcool
node control wr
default 1
@ -219,3 +218,23 @@ proc cryotel::checkcontrol {} {
hsetprop [sct] write stdSct::write
}
}
proc cryotel::writecool {} {
set flag [expr ! [sct target]]
sct send "SET SSTOP=$flag"
sct update [sct target]
return stdSct::complete
}
proc cryotel::readcool {} {
sct send "SET SSTOP{2}"
return cryotelboa::updatecool
}
proc cryotel::updatecool {} {
lassign [split [sct result] ,] _ value
sct update [expr $value == 0]
return idle
}

View File

@ -28,10 +28,9 @@ proc stdConfig::cryotelboa {} {
node cool wr
prop label Cool
prop enum on,off
prop writecmd "SET SSTOP=%i"
prop readcmd "SET SSTOP{2}"
prop readfmt "SET SSTOP ,%i"
prop enum 1
prop read cryotelboa::readcool
prop write cryotelboa::writecool
node control wr
default 1
@ -193,3 +192,22 @@ proc cryotelboa::checkcontrol {} {
sct write stdSct::write
}
}
proc cryotelboa::writecool {} {
set flag [expr ! [sct target]]
sct send "SET SSTOP=$flag"
sct update [sct target]
return stdSct::complete
}
proc cryotelboa::readcool {} {
sct send "SET SSTOP{2}"
return cryotelboa::updatecool
}
proc cryotelboa::updatecool {} {
lassign [split [sct result] ,] _ value
sct update [expr $value == 0]
return idle
}

View File

@ -257,6 +257,9 @@ proc stdConfig::dil12 args {
prop label "remove mixture status"
prop check dil12::check_removephase
prop write stdSct::completeUpdate
node ignore_vti_temp -int par 0
prop enum 1
}
}
hset $name/heatermode 0
@ -993,10 +996,15 @@ proc dil12::autostep {phase init} {
dil12::openvalves v1 v6 v12 v13 vm_open
sorb mode 0
dil12::set_VtiT 1.25
hset [sct]/onekstate 0
nv set [silent 5 hvali [sct]/circulateflow]
nv 2 ;# auto
if {[hval [sct]/ignore_vti_temp]} {
dil12::set_VtiT 0
nv 1 ;# controlled
} else {
dil12::set_VtiT 1.25
nv 2 ;# auto
}
dil12::msg ""
}
circulate {
@ -1035,7 +1043,11 @@ proc dil12::autostep {phase init} {
sct optimize [clock seconds]
clientput "reduced VTI flow to [hvali [sct]/circulateflow]"
nv set $circulateflow
nv 2 ;# auto
if {[hval [sct]/ignore_vti_temp]} {
nv 1 ;# controlled
} else {
nv 2 ;# auto
}
}
}
}

View File

@ -204,7 +204,7 @@ proc hepump::check_valve {} {
}
proc hepump::set_valve {} {
if {[sctval [sct parent]] != 0} return
if {[sctval [sct parent]] % 8 != 0} {return idle}
set val [hvali [sct]]
if {[sct target] < 2} {
if {[hvali [sct parent]/[sct @motname]/encoder] > 20} {
@ -238,7 +238,7 @@ proc hepump::slow_close {} {
}
proc hepump::get_valve {} {
if {[sctval [sct parent]] != 0} {return idle}
if {[sctval [sct parent]] % 8 != 0} {return idle}
set p [sct parent]/[sct @motname]
set stat [hgetpropval $p status]
set pos [hvali $p/encoder]
@ -296,7 +296,7 @@ proc hepump::get_valve {} {
}
proc hepump::chk_running {} {
if {[sctval [sct parent]] != 0} return
if {[sctval [sct parent]] % 8 != 0} return
if {[sct target]} {
hset [sct parent]/[sct @motname]/output0 1
} else { # off
@ -314,8 +314,8 @@ proc hepump::chk_running {} {
}
proc hepump::get_running {} {
# only for xds35
if {[sctval [sct parent]] != 0} {return idle}
# only for xds35 and neodry
if {[sctval [sct parent]] % 8 != 0} {return idle}
set running [sctval [sct parent]/[sct @motname]/output0]
set pumpoff [silent 1 hval [sct parent]/[sct @motname]/input3]
@ -361,6 +361,7 @@ proc hepump::get_running {} {
}
proc hepump::set_eco {} {
# xds35 only, not for neodry
if {[sctval [sct parent]] != 0} {return idle}
if {[sct target] != [hvali [sct]]} {
hset [sct parent]/auto 0
@ -374,6 +375,7 @@ proc hepump::set_eco {} {
}
proc hepump::get_eco {} {
# xds35 only, not for neodry
if {[sctval [sct parent]] != 0} {
sct update 0
return idle
@ -385,11 +387,13 @@ proc hepump::get_eco {} {
}
proc hepump::set_auto {} {
# xds35 only, not for neodry
if {[sctval [sct parent]] != 0} {return idle}
sct update [sct target]
}
proc hepump::get_auto {} {
# xds35 only, not for neodry
if {[sctval [sct parent]] != 0} {return idle}
set auto [hvali [sct]]
set oldeco [sctval [sct parent]/eco]

View File

@ -758,7 +758,7 @@ proc secop::update_ {} {
}
error_update {
lassign $val etype erepr
set etext erepr
set etext $erepr
regexp {.*'(.*)'} $erepr -> etext
hsetprop $path geterror "${etype}: $etext"
}

View File

@ -496,10 +496,12 @@ proc trun::read_run {} {
}
set now [DoubleTime]
set tr [silent none sct target]
set prev_tr [silent $tr sct prev_tr]
if {$tr eq "none"} {
set tr $tmain
sct prev_tr $tr
} else {
set dif [expr abs($tr) - [hvali [sct]/target]]
set dif [expr $tr - $prev_tr]
updateval_u [sct]/target $tr 0
set dblmode [silent -1 hval [sct]/dblctrl/mode]
if {$dblmode >= 0} { # not disabled