put things from HAL-9500 muSR instrument into git
This commit is contained in:
@ -80,23 +80,35 @@ proc stdConfig::bfgh {} {
|
||||
prop write bfgh::setrmt
|
||||
prop enum 1
|
||||
}
|
||||
node ext_still_control par 1
|
||||
prop help "control still with lakeshore 370 output from /bfgh/ext"
|
||||
prop enum 1
|
||||
|
||||
node stillpower wr
|
||||
default 0.01
|
||||
prop help "when /bfgh/ext is on, stillpower is applied to /tbf/set/manualpower"
|
||||
prop check bfgh::check_still
|
||||
prop write stdSct::completeUpdate
|
||||
prop read bfgh::read_still
|
||||
|
||||
node serial_turbo_control par 1
|
||||
prop help "use serial instead of analog connection for switching turbo on/off"
|
||||
prop enum 1
|
||||
}
|
||||
node stillpower par 0.008
|
||||
prop help "when ext is on, stillpower is applied to /tbf/set/manualpower. set stillpower to 0 for no link between /bfgh/ext and /tbf/set"
|
||||
|
||||
variable ctrl
|
||||
variable path
|
||||
$ctrl updatescript $path/ext bfgh::ext_update
|
||||
$ctrl updatescript $path/turbo1 bfgh::turbo1_update
|
||||
}
|
||||
|
||||
proc bfgh::ext_update {value} {
|
||||
set mp [hval [sct parent]/stillpower]
|
||||
if {$mp} {
|
||||
if {[hval [sct parent]/ext_still_control]} {
|
||||
set old [hval /tbf/set/mode]
|
||||
set oldp [hval /tbf/set/manualpower]
|
||||
if {$value} {
|
||||
set new 2
|
||||
set newp $mp
|
||||
set newp [hval [sct parent]/stillpower]
|
||||
} else {
|
||||
set new 0
|
||||
set newp 0
|
||||
@ -110,6 +122,46 @@ proc bfgh::ext_update {value} {
|
||||
}
|
||||
}
|
||||
|
||||
proc bfgh::read_still {} {
|
||||
[sct controller] updatescript /tbf/set/manualpower "bfgh::update_still [sct]"
|
||||
sct update [hvali [sct]]
|
||||
return idle
|
||||
}
|
||||
|
||||
proc bfgh::update_still {path value} {
|
||||
if {$value} {
|
||||
updateval $path $value
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
proc bfgh::check_still {} {
|
||||
if {[sctval [sct parent]/ext_still_control]} {
|
||||
tbf set/manualpower [sct target]
|
||||
}
|
||||
}
|
||||
|
||||
proc bfgh::turbo1_update {value} {
|
||||
set ser [hval [sct parent]/serial_turbo_control]
|
||||
if {$ser} {
|
||||
if {$value} {
|
||||
if {!([hval /turbo1a/on] && [hval /turbo1a/motor] && [hval /turbo1b/on] && [hval /turbo1b/motor])} {
|
||||
turbo1a on 1
|
||||
turbo1b on 1
|
||||
turbo1a motor 1
|
||||
turbo1b motor 1
|
||||
}
|
||||
} else {
|
||||
if {[hval /turbo1a/on] || [hval /turbo1a/motor] || [hval /turbo1b/on] || [hval /turbo1b/motor]} {
|
||||
turbo1a motor 0
|
||||
turbo1b motor 0
|
||||
turbo1a on 0
|
||||
turbo1b on 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc bfgh::chanread {} {
|
||||
sct send "status"
|
||||
return bfgh::chanupd
|
||||
|
104
tcl/drivers/tc400.tcl
Normal file
104
tcl/drivers/tc400.tcl
Normal file
@ -0,0 +1,104 @@
|
||||
namespace eval tc400 {} {
|
||||
}
|
||||
|
||||
proc stdConfig::tc400 {adr} {
|
||||
controller std "\r" 5
|
||||
prop startcmd "0010031202=?101"
|
||||
prop read tc400::read
|
||||
prop write tc400::write
|
||||
|
||||
pollperiod 5 5
|
||||
|
||||
obj "TC400" wr
|
||||
prop par 707
|
||||
prop @adr $adr
|
||||
prop type fix2
|
||||
|
||||
kids "turbo $adr" {
|
||||
node on wr
|
||||
prop par 10
|
||||
prop type bool
|
||||
prop enum 1
|
||||
|
||||
node motor wr
|
||||
prop par 23
|
||||
prop type bool
|
||||
prop enum 1
|
||||
|
||||
node speed rd
|
||||
prop par 309
|
||||
prop type fix0
|
||||
|
||||
node nominalspeed rd
|
||||
prop par 308
|
||||
prop type fix0
|
||||
|
||||
node current rd
|
||||
prop par 310
|
||||
prop type fix2
|
||||
|
||||
node errorcode -text rd
|
||||
prop par 303
|
||||
prop type text
|
||||
|
||||
node ovtempelec rd
|
||||
prop par 304
|
||||
prop type bool
|
||||
|
||||
node ovtemppump rd
|
||||
prop par 305
|
||||
prop type bool
|
||||
|
||||
node temppmpbot rd
|
||||
prop par 330
|
||||
prop type fix0
|
||||
|
||||
node tempbearng rd
|
||||
prop par 342
|
||||
prop type fix0
|
||||
|
||||
node tempmotor rd
|
||||
prop par 346
|
||||
prop type fix0
|
||||
|
||||
}
|
||||
|
||||
return "TC400 turbo pump"
|
||||
}
|
||||
|
||||
proc tc400::addcksum {str} {
|
||||
set cksum 0
|
||||
foreach num [scan $str [string repeat %c [string length $str]]] {
|
||||
incr cksum $num
|
||||
}
|
||||
return "$str[format %3.3d [expr $cksum % 256]]"
|
||||
}
|
||||
|
||||
proc tc400::read {} {
|
||||
sct send [addcksum [format "%3.3d00%3.3d02=?" [sct @adr] [sct par]]]
|
||||
return tc400::update
|
||||
}
|
||||
|
||||
proc tc400::update {} {
|
||||
set end 15
|
||||
set value [string range [sct result] 10 $end]
|
||||
if {![scan $value %d value]} {
|
||||
error "$value"
|
||||
}
|
||||
switch [sct type] {
|
||||
bool { sct update [expr $value != 0] }
|
||||
fix2 { sct update [expr $value * 0.01] }
|
||||
default { sct update $value }
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
proc tc400::write {} {
|
||||
switch [sct type] {
|
||||
bool {set val [format "06%6.6d" [expr ([sct target] != 0) * 111111]]}
|
||||
fix2 {set val [format "06%6.6d" [expr int(0.5 + [sct target] * 100)]]}
|
||||
default {set val [format "06%6.6d" [expr int(0.5 + [sct target])]]}
|
||||
}
|
||||
sct send [addcksum [format "%3.3d10%3.3d$val" [sct @adr] [sct par] [sct target]]]
|
||||
return tc400::update
|
||||
}
|
Reference in New Issue
Block a user