add archive (files probably no longer used)

here we can find old files
This commit is contained in:
l_samenv
2022-08-22 15:28:09 +02:00
parent 6c83e592de
commit 4d9961fe5c
85 changed files with 3635 additions and 0 deletions

View File

@ -0,0 +1,60 @@
namespace eval DAQ {} {
}
proc stdConfig::DAQ {} {
controller std "\n" 20
prop startcmd "*IDN?"
obj DAQ -none
kids settings {
node resist upd
node stddev upd
node file upd
node measure out
default 0
prop write DAQ::measure
prop enum 1
node freq out
default 5000.0
prop write DAQ::setval
node ampl out
default 0.1
prop write DAQ::setval
}
}
proc DAQ::measure {} {
sct send "AQUIRE"
return DAQ::update
}
proc DAQ::update {} {
set output [sct result]
set items [split $output ","]
hupdate [sct parent]/resist [lindex $items 0]
hupdate [sct parent]/stddev [lindex $items 1]
hupdate [sct parent]/file [lindex $items 2]
hupdate [sct] 0
return idle
}
proc DAQ::setval {} {
sct send "PULSE [format "%0.2f" [sctval [sct parent]/freq]] [format "%0.3f" [sctval [sct parent]/ampl]]"
# clientput "PULSE [format "%0.2f" [sctval [sct parent]/freq]] [format "%0.3f" [sctval [sct parent]/ampl]]"
return DAQ::readval
}
proc DAQ::readval {} {
set dat [sct result]
scan $dat "F=%fHz; A= %fVpp" f a
hupdate [sct parent]/freq $f
hupdate [sct parent]/ampl $a
return idle
}

View File

@ -0,0 +1,122 @@
# read 8 ADC channels with taskit RS232 ADC
namespace eval ana8 {
}
if {![namespace exists lsc]} {
source drivers/lsc.tcl
}
proc stdConfig::ana8 {channel {scale 1} {offset 0} {curve ""}} {
controller std "\r" 2
prop node_$channel 0
prop time_$channel 0
poll 1 read ana8::poll
pollperiod 5
obj ANA8 rd
prop read "ana8::read $channel"
variable name
variable path
kids "$name analog input" {
node scale par $scale
node offset par $offset
node raw upd
node curve out -text
prop width 32
prop model 0
prop check ana8::curve
prop write stdSct::completeUpdate
kids "calibration" {
hfactory $path/points plain mugger floatvarar 1
}
}
if {$curve ne "" && $curve ne "raw"} {
hset /$name/curve $curve
} else {
hupdate /$name/curve ""
}
return "ANA8"
}
proc ana8::start {} {
# set adc rate to 11
sct send ":10000D000102000B.."
return ana8::start2
}
proc ana8::start2 {} {
# set all i/o to output / push-pull / low
sct send ":10000000030600FF00FF0000.."
return ana8::getidn
}
proc ana8::getidn {} {
sct send ":0300030001.."
return stdSct::completeStart
}
proc ana8::read {channel} {
sct node_$channel [sct]
sct time_$channel [DoubleTime]
return idle
}
proc ana8::poll {} {
set now [DoubleTime]
set channels [list ]
foreach channel {0 1 2 3 4 5 6 7} {
if {$now < [silent 0 sct time_$channel] + 30} {
lappend channels $channel
}
}
if {[llength $channels] == 0} {
return idle
}
set first [lindex $channels 0]
set nchan [expr [lindex $channels end] - $first + 1]
if {$nchan > 0} {
sct channels $channels
sct nchan $nchan
sct send ":04000${first}000${nchan}.."
return ana8::update
}
return idle
}
proc ana8::update {} {
set first [lindex [sct channels] 0]
set nb [format %.2X [expr [sct nchan] * 2]]
set res [scan [sct result] ":04${nb}%4x%4x%4x%4x%4x%4x%4x%4x" a0 a1 a2 a3 a4 a5 a6 a7]
if {$res < [sct nchan]} {
error "bad response to '[sct send]': '[sct result]'"
}
foreach ch [sct channels] {
set i [expr $ch - $first]
set scale [hval [sct node_$ch]/scale]
set offset [hval [sct node_$ch]/offset]
# 26214 = (2^32-1) steps / 2.5 V
set raw [expr [set a$i] / 26214. * $scale + $offset]
set node [sct node_$ch]
updateval $node/raw $raw
if {[hval $node/curve] eq ""} {
updateval $node $raw
} else {
set t [interpolate [hvali $node/curve/points] 0 $raw logy extrapolate]
updateval $node $t
}
}
return idle
}
proc ana8::curve {} {
if {[sct requested] ne "" && [sct requested] ne "raw"} {
lsc::read_curve
}
}

View File

@ -0,0 +1,10 @@
namespace eval anders {
}
proc stdConfig::anders {} {
controller std "\n++read eoi\n"
obj TCOUPLE rd
prop readcmd "SETP?1"
prop readfmt "%g"
}

View File

@ -0,0 +1,27 @@
# ASM 120 h, analog output read by fluke 45
namespace eval asm120h {} {
}
proc stdConfig::asm120h {} {
controller std "\n" 5 ">"
prop startcmd "*IDN?"
obj Fluke45 rd
prop read asm120h::read
prop readcmd "MEAS?"
prop readfmt "%g"
}
proc asm120h::read {} {
sct send "MEAS?"
return asm120h::update
}
proc asm120h::update {} {
set res 0
scan [sct result] %f res
sct update [expr $res - 9]
return idle
}

View File

@ -0,0 +1,130 @@
namespace eval asm142 {} {
}
proc stdConfig::asm142 {} {
controller bin
pollperiod 0.01
obj ASM142 rd
prop read asm142::read
kids "leak detector" {
node p upd
node state upd
prop enum standby,cycle,test
node vent upd
prop enum 1
node manualvalve par 0
prop enum 1
}
}
proc asm142::read {} {
# we wait for at least one byte. the bin driver adds additional bytes
# arriving immediately, but as we are sending nothing, nothing is purged
# (modification of SICS 22.10.2014)
sct send " / hex"
return asm142::update
}
proc asm142::update {} {
# Format of data sent from ASM142 to its remote control:
# ff <adr> <data>
# for <adr>==04 <data> is 2 bytes, for all other known <adr> 1 byte
# several (not always all) data chunks are sent one by one
# at the end, "ff 00 00" is sent, and the remote control respond is
# "00 00" (or i.e. "00 02" when CYCLE is pressed)
# if the remote control is not connected, only ff "00 00" is sent
# known data chunks:
# 01 <i>: mbar bargraph (<i> = 1 ... 20, meaning 1e-3 ... 2e+3, 3 per magnitude)
# 02 <i>: leak rate bargraph (<i> = 1 ... 40, meaning 1.7e-12 ... 1e-2)
# 04 nm cl: leak rate (n.mE-l, BCD format, where c seems to be the code for "-")
# 06 10tzaclr (LEDs bits: test, zero, autocal, cycle, left, right)
# 07 0000v0s0 (LEDs bits: vent, snif)
# 0d <i>: threshold for leak rate (blinking) (<i> = 128 + bar number)
set buf [silent "" sct buf]
set res [concat [silent "" sct oldres] [sct result]]
#clientput $res
foreach byte $res {
if {$byte eq "ff"} {
if {[llength $buf] > 0} {
set adr [lindex $buf 1]
set val [lrange $buf 2 end]
switch $adr {
04 {
set exp1 0
scan $val "%1s%1s %1s%1s" dig1 dig2 exp1 exp2
switch $exp1 {
3 {set exp1 "e-1"}
c {set exp1 "e-"}
}
if {$exp1 ne "0"} {
sct update "${dig1}.${dig2}${exp1}${exp2}"
}
}
01 {
set p 0
scan $val "%x" p
updateval [sct]/p [expr pow(10, ($p-1)/3.0) * 0.001]
}
06 {
set state 0
set led 0
scan $val "%x" led
if {$led & 32} {
set state 2
} elseif {$led & 4} {
set state 1
}
updateval [sct]/state $state
}
07 {
set vent 0
set led 0
scan $val "%x" led
if {$led & 8} {
set vent 1
}
updateval [sct]/vent $vent
}
# 02 - 0d {
# # ignore leak rate bar and level
# set press 0
# scan $val "%x" p
# updateval [sct]/p [expr pow(10, ($p-1)/3.0) * 0.001]
# }
# default {
# set old ""
# global pars
# catch {set old $pars($adr)}
# if {$old ne $val} {
# set pars($adr) $val
# clientput "${adr}:${val}"
# }
# }
}
set buf ""
}
set buf $byte
} else {
append buf " $byte"
if {$buf eq "ff 00 00" && [silent 0 sct noremote]} {
#clientput "send 00 00"
sct buf ""
sct send "00 00 /"
return asm142::readnext
}
}
}
sct buf $buf
return idle
}
proc asm142::readnext {} {
sct oldres [sct result]
return idle
}

View File

@ -0,0 +1,50 @@
# ASM340 RS232 interface.
# Setup: >EINSTELLUNGEN>Extras>Seriell Schnittstelle#1
# Typ: Seriell
# >Konfiguration
# Betriebsart: Tabelle
# Zeitintervall: 1 s
# Handshake: None
# Versor.pin9: 5 Volt (not relevant)
#
namespace eval asm340 {} {
}
proc stdConfig::asm340 {} {
controller std timeout=10
# pollperiod 1 1
obj ASM340 rd
prop read asm340::read
kids "ASM 340" {
node p upd
node text -text upd
}
}
proc asm340::read {} {
sct send "@@NOSEND@@"
return asm340::update
}
proc asm340::update {} {
if {[scan [sct result] "%s %s S=%s P=%s %s %s" x e s p t f] == 6} {
sct update $s
updateval [sct]/p $p
if {$e ne "on"} {
set tail "filament off"
} else {
set tail ""
}
updateval [sct]/text "$x $tail"
} else {
clientput "NO"
sct geterror "syntax error"
hsetprop [sct]/p geterror "syntax error"
updateval [sct]/text [sct result]
clientput "NO [sct result]"
}
return idle
}

View File

@ -0,0 +1,13 @@
namespace eval avs45 {} {
}
proc stdConfig::avs45 {} {
controller std sendterminator=\r
# attention: baud rate 4800
obj AVS45 rd
prop readcmd "D"
prop readfmt "%g"
}

View File

@ -0,0 +1,22 @@
namespace eval bin {} {
}
proc stdConfig::bin {} {
controller bin chksum-crc 5
obj BIN upd
prop read bin::poll
}
proc bin::read {} {
sct send " / dump"
sct print poll
return bin::update
}
proc bin::update {} {
sct print [sct result]
return idle
}

View File

@ -0,0 +1,82 @@
# calibration with a 370 using 6 channels
# datafile format: <time> <log10(R)> <channel>
namespace eval calib370 {} {
}
proc stdConfig::calib370 {} {
variable ctrl
controller std "\n" 5
prop startcmd "*IDN?"
obj calib370 rd
default 0
prop read calib370::read
prop period 30
prop period0 0
kids "Sensor Channels" {
node chan1 upd
prop newline 1
node active1 par 1
prop enum 1
node chan2 upd
node active2 par 1
prop enum 1
node chan3 upd
node active3 par 1
prop enum 1
node chan4 upd
node active4 par 1
prop enum 1
node chan5 upd
node active5 par 1
prop enum 1
node chan6 upd
node active6 par 1
prop enum 1
}
}
proc calib370::read {} {
if {[sct period] ne [sct period0]} {
[sct controller] poll [sct] [sct period] read read
sct period0 [sct period]
}
if {[hvali [sct]] > 0} {
sct send "RDGR?[hvali [sct]]"
sct utime send_time
if {[silent 0 sct base_time] == 0} {
sct base_time [expr [clock seconds] / 3600 * 3600]
}
return calib370::update
}
sct update 1
sct send "SCAN 1,0;SCAN?"
return stdSct::complete
}
proc calib370::update {} {
set chan [hvali [sct]]
set value [expr log10([sct result])]
hdelprop [sct]/chan$chan geterror
hupdate [sct]/chan$chan $value
set file [silent 0 sct outputfile]
if {$file ne "0"} {
set fd [open $file a]
set now [expr [sct utime] * 0.5 + [sct send_time] * 0.5 - [sct base_time]]
puts $fd [format "%.3f\t%.6f\t%d" $now $value $chan]
close $fd
}
for {set i 0} {$i < 6} {incr i} {
incr chan
if {$chan > 6} {
set chan 1
}
if {[hvali [sct]/active$chan]} {
break
}
}
sct update $chan
sct send "SCAN $chan,0;SCAN?"
return stdSct::complete
}

View File

@ -0,0 +1,45 @@
namespace eval cryocon_sniffer {} {
}
proc stdConfig::cryocon_sniffer {} {
controller std "\n" 5
pollperiod 0.001 0.001
obj CryoconSniffer rd
prop read cryocon_sniffer::read
prop rdcmd "INPUT A:SENPR?"
prop path ""
kids "cryocon" {
# node tb upd
# prop rdcmd "INPUT B:SENPR?"
node l1 upd
prop rdcmd "LOOP 1:OUTPWR?"
node l2 upd
prop rdcmd "LOOP 2:OUTPWR?"
}
}
proc cryocon_sniffer::read {} {
sct send "@@NOSEND@@"
return cryocon_sniffer::update
}
proc cryocon_sniffer::update {} {
if {[sct result] eq [sct rdcmd]} {
sct path [sct]
return idle
}
foreach var [hlist [sct]] {
if {[sct result] eq [silent "" hgetpropval [sct]/$var rdcmd]} {
sct path [sct]/$var
return idle
}
}
if {[sct path] ne ""} {
updateval [sct path] [sct result]
sct path ""
}
return idle
}

View File

@ -0,0 +1,48 @@
namespace eval cryotel {} {
}
proc stdConfig::cryotel {} {
# controler uses std with send terminator "\r" 5sec comm.interval receive terminator "\n" and multi line replies will be separated by ","
controller std "\r" 5 "\n" ","
# the {2} in addition to the command defines the number of expected return values
prop startcmd "SERIAL{2}"
# driver for Sunpower stirling cooler CryoTel
# serial interface is set to:
# Char Size/Stop Bits: 8/1 Input Speed: 4800
# Flow Ctrl: None Output Speed: 4800
# Parity: None Modem Control: None
obj cryo rd
prop label Temperature
prop readcmd "TC{2}"
prop readfmt "TC ,%f"
#cryotel::readT
kids cryo {
node setT wr
prop label Setpoint
prop writecmd "SET TTARGET=%.2f"
prop readcmd "SET TTARGET{2}"
prop readfmt "SET TTARGET ,%f"
node power rd
prop label Power
prop readcmd "P{2}"
prop readfmt "P ,%f"
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"
}
}

View File

@ -0,0 +1,84 @@
# based on untested flowbusprot, not used M.Z. Feb 2017
namespace eval flowbus {} {
}
proc stdConfig::flowbus {label scale {adr 128} {readonly 0}} {
controller flowbus "\r\n"
# driver for Bronkhorst Flow or Pressure regulator (i.e.P-602CV-21KA-AAD)
# serial interface is set to:
# Char Size/Stop Bits: 8/1 Input Speed: 38400
# Flow Ctrl: None Output Speed: 38400
# Parity: None Modem Control: None
# syntax (chaining not mentioned):
# read command: :06Ad04CopyPrTp
# write command: :LnAd01PrTpData
# where:
# Ln: number of bytes (hex digits pairs) following
# Ad: node address (starting from 3)
# Copy: values just to be copied by the reply (first and third digit < 8)
# recommended practice: Use PrTp for Copy
# Pr: Process number (<80)
# Tp: Type + parameter number. Type: 00 byte, 20 int, 40 long/float, 60 string
# for strings either 00 (for nul terminated) or the max. number of chars
# has to be appended to the type
# Data: length depending on type.
# the interface returns readings on a scale where 32000 is 100%
set adr [format %02x $adr]
clientput "BRONK $label $scale $adr"
obj bflow rd
prop label $label
prop readcmd "r$adr 1 i0"
prop readfmt "%d"
prop update flowbus::conv $scale
prop @adr $adr
kids "$label" {
node setpoint wr
prop label Setpoint
prop write flowbus::setp $scale
prop readcmd "r$adr 1 i1"
prop readfmt "%d"
prop update flowbus::conv $scale
}
}
proc flowbus::conv {scale} {
if {[scan [sct result] [sct readfmt] flow ] != 1} {
error "bad result format: '[sct result]'"
}
sct update [format %.6g [expr $flow * $scale / 32000.]]
return idle
}
proc flowbus::setp {scale} {
set setval [expr int( [sct target] * 32000.0 / $scale) ]
if {$setval > 32000 } {
if {$setval < 32320} {
set setval 32000
} else {
error "[sct]: setpoint [sct target] must be <= $scale"
}
} elseif {$setval < 0 } {
error "[sct]: setpoint [sct target] must be >= 0"
}
sct send "w [sct @adr] 1 i1=$setval"
return "flowbus::acknowledge"
}
proc flowbus::acknowledge {} {
if {[string compare [sct result] "0" ] != 0} {
error "bad result format: '[sct result]' [sct result]"
}
return read
}

View File

@ -0,0 +1,56 @@
namespace eval ihelium3_cryocon {} {
}
proc stdConfig::ihelium3_cryocon {} {
controller std "\n" 5
pollperiod 0.001 0.001
obj CryoconSniffer rd
prop read ihelium3_cryocon::read
prop path ""
kids "cryocon" {
# node tb upd
# prop rdcmd "INPUT B:SENPR?"
node ra upd
prop rdcmd "INPUT A:SENPR?"
prop sensno 054
node l1 upd
prop rdcmd "LOOP 1:OUTPWR?"
node l2 upd
prop rdcmd "LOOP 2:OUTPWR?"
node bref par 0
}
}
proc ihelium3_cryocon::read {} {
sct send "@@NOSEND@@"
return ihelium3_cryocon::update
}
proc ihelium3_cryocon::update {} {
foreach var [hlist [sct]] {
if {[sct result] eq [silent "" hgetpropval [sct]/$var rdcmd]} {
sct path [sct]/$var
return idle
}
}
if {[sct path] ne ""} {
updateval [sct path] [sct result]
set sensno [silent "" hgetpropval [sct path] sensno]
sct path ""
if {$sensno ne ""} {
if {![silent 0 sct $sensno]} {
ihelium3_calib $sensno
sct $sensno 1
}
set tk [ihelium3_res2temp $sensno [hvali [sct]/bref] [sct result]]
sct update $tk
}
}
return idle
}

View File

@ -0,0 +1,25 @@
# itc503 simple nv control
namespace eval itc503p {} {
}
proc stdConfig::itc503p {} {
controller std "\r" 5
prop startcmd "V"
obj nv rd
prop readcmd "R7"
prop readfmt "R%g"
kids nvoi {
node set wr
prop read stdSct::read
prop readcmd "R7"
prop readfmt "R%g"
prop write itc503p::write
}
}
proc itc503p::write {} {
sct send [format G%3.0f [sct target]]
return read
}

View File

@ -0,0 +1,61 @@
# keithley 2701 Digital multimeter
namespace eval kdvm {} {
}
proc stdConfig::kdvm {} {
controller std "\n" 5
prop startcmd "*IDN?"
obj Keithley2701 rd -none
prop read kdvm::read
kids channels {
node u1 upd
node u2 upd
node chan out
default 0
prop write kdvm::setchan
prop enum auto,chan1,chan2
}
}
proc kdvm::read {} {
sct send "READ?"
return kdvm::update
}
proc kdvm::update {} {
set mode [hvali [sct]/chan]
if {$mode == 0} {
set chan [silent 1 sct channel]
} else {
set chan $mode
}
hupdate [sct]/u$chan [sct result]
hdelprop [sct]/u$chan geterror
if {$mode != 0} {
return idle
}
set chan [expr 3-$chan]
sct send "ROUT:CLOS (@10${chan}); *IDN?"
sct channel $chan
return stdSct::complete
}
proc kdvm::setchan {} {
set mode [sct target]
if {$mode == 0} {
sct update $mode
return idle
}
set chan $mode
sct send "ROUT:CLOS (@10${chan}); *IDN?"
sct channel $chan
return kdvm::updatechan
}
proc kdvm::updatechan {} {
sct update [sct result]
return idle
}

View File

@ -0,0 +1,14 @@
namespace eval kei195 {} {
}
proc stdConfig::kei195 {} {
controller std "sendterminator=\n"
# prop startcmd "++addr 16"
obj kei195 rd
prop readcmd "++read eoi"
prop readfmt "NDCV %g"
# kids "avs settings" { }
}

View File

@ -0,0 +1,36 @@
namespace eval lowdpflow {} {
}
proc stdConfig::lowdpflow {} {
controller std "\r\n"
# driver for mass flow meter bronkhorst low-dp-flow
# serial interface is set to:
# Char Size/Stop Bits: 8/1 Input Speed: 38400
# Flow Ctrl: None Output Speed: 38400
# Parity: None Modem Control: None
obj low-dp-flow rd
# 0C=length
# 80=address
# 04=read
# 00 not chained, custom process 0
# 40 not chained, float, custom parameter 0
# 21 process 33
# 40 float, parameter 0
prop readcmd ":06800400402140"
prop readfmt ":0880020040%8s"
prop update lowdpflow::update
}
proc lowdpflow::update {} {
if {[scan [sct result] [sct readfmt] flow] != 1} {
error "bad result format: '[sct result]' $flow"
}
set flow [cnvrt xieee2float $flow]
sct update $flow
return idle
}

View File

@ -0,0 +1,86 @@
#LS370 simple driver
namespace eval ls370bf {} {
}
proc stdConfig::ls370bf {} {
variable ctrl
controller std "\n" 5
prop startcmd "*IDN?"
obj ls370bf rd
default 0
prop read ls370bf::read
prop period 15
prop period0 0
kids "Sensor Channels" {
node set wr
prop writecmd "SETP %g;*OPC?"
prop readcmd "SETP?"
prop readfmt "%g"
node htr rd
prop readcmd "HTR?"
prop readfmt "%g"
node still wr
prop writecmd "STILL %g;*OPC?"
prop readcmd "STILL?"
prop readfmt "%g"
foreach chan {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} {
node active$chan par 1
prop enum 1
if {$chan == 1} {
prop newline 1
}
}
foreach chan {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} {
node chan$chan upd
if {$chan == 1} {
prop newline 1
}
node res$chan upd
}
}
}
proc ls370bf::read {} {
if {[sct period] ne [sct period0]} {
[sct controller] poll [sct] [sct period] read read
sct period0 [sct period]
}
if {[hvali [sct]] > 0} {
sct send "RDGK?[hvali [sct]]"
return ls370bf::readR
}
sct update 1
sct send "SCAN 1,0;SCAN?"
return stdSct::complete
}
proc ls370bf::readR {} {
set chan [hvali [sct]]
hdelprop [sct]/chan$chan geterror
hupdate [sct]/chan$chan [sct result]
sct send "RDGR?$chan"
return ls370bf::update
}
proc ls370bf::update {} {
set chan [hvali [sct]]
hdelprop [sct]/res$chan geterror
hupdate [sct]/res$chan [sct result]
for {set i 0} {$i < 16} {incr i} {
incr chan
if {$chan > 16} {
set chan 1
}
if {[hvali [sct]/active$chan]} {
break
}
}
sct update $chan
sct send "SCAN $chan,0;SCAN?"
return stdSct::complete
}

View File

@ -0,0 +1,53 @@
namespace eval moxa {
}
proc stdConfig::moxa {} {
variable ctrl
variable node
if {[controller tmo 10 2]} {
controllerDesc "MOXA http connection"
}
obj moxa out
default 0
prop check moxa::check
prop write moxa::getline
prop connections ""
$ctrl queue $node write moxa::getline
}
proc moxa::getline {} {
sct send "GET /Mn_line.htm HTTP/1.1\r\n"
return moxa::updateline
}
proc moxa::updateline {} {
set r [sct result]
set l 0
set pattern {<TR><TD>(.*?)</TD><TD>TCP Server Mode</TD><TD>(.*?)</TD>.*?</TR>}
array set iplist {}
while {[regexp -start $l -indices ($pattern) $r idx]} {
set l [lindex $idx 1]
set line [string range $r [lindex $idx 0] $l]
regexp $pattern $line all port ip
if {$ip ne "Listen"} {
lappend iplist($ip) [expr 3000+$port]
}
}
sct connections [array get iplist]
sct update 0
clientput "connections: [sct connections]"
# seaclient hostport ${ip}:${po}
# seaclient cmd "disconnect_from [sct sicsdev]"
return idle
}
proc moxa::check {} {
sct connections ""
sct update [sct target]
[sct controllerName] reconnect
}

View File

@ -0,0 +1,17 @@
namespace eval nvdummy {} {
}
proc stdConfig::nvdummy {} {
controller syncedprot
obj NvDummy par 0
kids "nv dummy" {
node set par 0
node flow par 5
node autoflow par 0
kids "autoflow" {
node flowtarget par 5
}
}
}

View File

@ -0,0 +1,191 @@
namespace eval nvstep {
}
proc stdConfig::nvstep {} {
variable name
controller syncedprot
pollperiod 1 1
obj NvStep wr
prop write nvstep::setmode
prop read nvstep::read
prop enum fixed=0,controlled=1,automatic=2,close=3,open=4
prop write nvstep::write
prop lastpulse 0
prop filter 0
prop closetest 0
default 0
kids "needle value" {
node motpos upd
node flow upd
node set out
default 2.5
prop check nvstep::checkset
prop write stdSct::complete
prop label "flow set"
node flowmax par 20
prop label "flow maximum"
node ctrl -none
kids "control parameters" {
node prop par 50
node int par 15
node delay par 5
node dif upd
node lim upd
node tol upd
}
node autoflow -none
kids "autoflow control parameters" {
flow::make flow::tmts {result tt set/reg}
}
}
}
proc nvstep::checkset {} {
sct update [sct target]
set s [hvali [sct parent]]
if {[hvali /cc/fa] == 0 || ($s != 1 && $s != 2)} {
hset [sct parent] 1
}
}
proc nvstep::write {} {
switch {[sct target]} {
3 {
nvmot [hvali /nvmot/posclosed]
sct closetest 1
}
4 {
nvmot [hvali /nvmot/posopen]
}
}
sct update [sct target]
return idle
}
proc nvstep::transf {flow} {
if {$flow > 1} {
set flow [expr 2 - 1.0 / $flow]
}
return $flow
}
proc nvstep::poll {} {
hupdate [sct]/motpos [hvali /nvmot/pos]
set now [DoubleTime]
set delta [expr $now - [silent 0 sct lastpoll]]
sct lastpoll $now
if {$delta > 1} {
set delta 1
}
set umsg "automatic needle valve not activated - set temperature undefined"
switch [hvali [sct]] {
1 - 2 {
if {[hvali [sct]] == 1} {
set soll [hvali [sct]/set]
hupdate [sct]/autoflow/flowtarget $soll
} else {
flow::task [sct]/autoflow [hvali [sct]/set] [hvali [sct]/flowmax]
set soll [hvali [sct]/autoflow/flowset]
if {[hgetpropval [sct]/autoflow/getTset t_set_undefined]} {
if {[hvali [sct]/status] ne $umsg} {
clientput "ERROR: $umsg"
}
hupdate [sct]/status $umsg
}
}
set ist [hvali [sct]/flow]
set soll2 [expr $soll + [hvali [sct]/ctrl/tol]]
set soll [nvstep::transf $soll]
set tol [expr [nvstep::transf $soll2] - $soll]
set ist [nvstep::transf $ist]
set dif [expr $soll - $ist]
set lim [hvali [sct]/ctrl/lim]
set int [hvali [sct]/ctrl/int]
set lim [expr $lim * exp(-$delta/$int)]
if {abs($dif) > $tol + $lim} {
set lim [expr abs($dif) * exp($delta*[hvali [sct]/ctrl/delay]/double($int)) - $tol]
set step [expr $dif * [hvali [sct]/ctrl/prop]]
run nvmot [expr [hvali /nvmot] + $step]
}
hupdate [sct]/ctrl/dif [expr log(abs($dif)/$tol + 1e-3)]
hupdate [sct]/ctrl/tol [expr log($lim/$tol + 1.0)]
hupdate [sct]/ctrl/lim $lim
sct lastmode [hvali [sct]]
}
0 - 3 - 4 { # fixed, close, open
if {[hvali [sct]] == 3 && [sct closetest]} {
if {[hgetpropval /nvmot status] ne "run"} {
if {[hvali /nvmot] < [hvali /nvmot/posopen] + [hvali /nvmot/precision]} {
hupdate [sct]/status "needle valve not fully closed"
}
sct closetest 0
}
}
switch -- [hvali /cc/fm] {
2 - 4 { # closing or closed
sct update 3
}
1 - 3 { # opening or opened
sct update 4
}
default {
# sct update 0
}
}
logsetup [sct]/set clear
logsetup [sct]/autoflow/flowtarget clear
return idle
}
}
if {[hvali [sct]/status] eq $umsg && \
([sctval [sct]] != 2 || [hgetpropval [sct]/autoflow/getTset t_set_undefined] == 0)} {
hsetprop [sct]/autoflow/getTset t_set_undefined 0
hupdate [sct]/status ""
}
return idle
}
proc nvstep::read {} {
hsetprop /cc/fa nvpath [sct]
_cc updatescript /cc/fa nvstep::updatemode
hsetprop /cc/f nvpath [sct]
hsetprop /cc/f nvctrl [sct controller]
_cc updatescript /cc/f nvstep::updateflow
return unpoll
}
proc nvstep::updateflow {value} {
set filter [lrange "[silent $value sct filter] $value" end-9 10]
sct filter $filter
# filter out values which are within the 3 highest or 3 lowest values
# out of 10 last values (i.e. within 5 seconds)
set m 3
set filter [lsort -real $filter]
if {[llength $filter] < 10} {
set flow $value
} else {
set min [lindex $filter $m]
set max [lindex $filter end-$m]
set flow [silent 0 hvali [sct nvpath]/flow]
if {$max < $flow} {
set flow $max
} elseif {$min > $flow} {
set flow $min
}
}
if {$flow < -50} {
set flow -62.5
}
# clientput "flow $value $flow"
updateval_e [sct nvpath]/flow $flow -62.5 no_sensor
[sct nvctrl] queue [sct nvpath] read nvstep::poll
}

View File

@ -0,0 +1,129 @@
namespace eval taskit {} {
}
proc stdConfig::taskit {} {
controller std "\r" 5
obj TaskitADC rd
prop readcmd ":0400000008.."
prop update taskit::update
kids "Taskit Settings" {
node dig out -text
default 00
prop write taskit::write
node mode out -text
default ff
prop write taskit::write
node pulse out -int
prop write taskit::pulse
node res wr -int
prop write taskit::writeRes
prop read taskit::readRes
node a0 upd
node a1 upd
node a2 upd
node a3 upd
node a4 upd
node a5 upd
node a6 upd
node a7 upd
node p upd
}
return "new taskit"
}
proc taskit::writeRes {} {
sct send [format ":10000D00010200%2.2x.." [sct target]]
return taskit::readRes
}
proc taskit::readRes {} {
sct send ":03000D0001.."
return taskit::updateRes
}
proc taskit::updateRes {} {
set res 0
scan [sct result] ":0302%4x" res
sct update $res
return idle
}
proc taskit::update {} {
if {[scan [sct result] ":0410%4x%4x%4x%4x%4x%4x%4x%4x" \
a(0) a(1) a(2) a(3) a(4) a(5) a(6) a(7)] == 8} {
set vmax 2.5
foreach i {0 1 2 3 4 5 6 7} {
set a($i) [expr 2.5 * $a($i) / 65535.]
hupdate [sct]/a$i $a($i)
}
hupdate [sct]/p [expr 250 * ($a(2) - 0.4) / 1.6]
set x [expr ($a(6) - $vmax * 0.5)]
set y [expr ($a(7) - $vmax * 0.5)]
set r [expr abs($x) + abs($y)]
set old [silent 0 sct old]
if {$r < $vmax * 0.4 || $r > $vmax * 0.6} {
error "illegal value $r = |$x| + |$y|"
} elseif {$y > 0} {
if {$x > 0} {
set ang [expr $y/$r * 90]
} else {
set ang [expr - $x/$r * 90 + 90]
}
} else {
if {$x < 0} {
set ang [expr - $y/$r * 90 + 180]
} else {
set ang [expr $x/$r * 90 + 270]
}
}
set ang [expr $ang + 360 * round(($old - $ang) / 360.0)]
sct update $ang
sct old $ang
} else {
error "bad result: [sct result]"
}
return idle
}
proc taskit::write {} {
set value 0
set mode ff
sct update [sct target]
scan [hvali [sct objectPath]/dig] %x value
scan [hvali [sct objectPath]/mode] %x mode
sct send [format ":10000000030600FF%4.4X%4.4X.." $mode $value]
return taskit::completeOut
}
proc taskit::completeOut {} {
sct update [sct target]
return idle
}
proc taskit::pulse {} {
scan [hvali [sct objectPath]/dig] %x value
scan [hvali [sct objectPath]/mode] %x mode
set p [expr 1 << [sct target]]
set value [expr $value & (255 - $p)]
sct send [format ":10000000030600FF%4.4X%4.4X.." $mode $value]
sct update [sct target]
return taskit::pulsEnd
}
proc taskit::pulsEnd {} {
scan [hvali [sct objectPath]/dig] %x value
scan [hvali [sct objectPath]/mode] %x mode
set p [expr 1 << [sct target]]
set value [expr $value | $p]
sct send [format ":10000000030600FF%4.4X%4.4X.." $mode $value]
return taskit::completeOut
}

View File

@ -0,0 +1,21 @@
namespace eval testsync {
}
proc stdConfig::testsync {} {
controller syncedprot
obj test wr
prop write testsync::write
prop read testsync::read
}
proc testsync::write {} {
_lev debug 0
sctsync {lev mode [sct target]}
return stdSct::completeUpdate
}
proc testsync::read {} {
_lev debug -1
sct update [silent 0 hvali [sct]]
return idle
}

View File

@ -0,0 +1,31 @@
namespace eval ttdummy {} {
}
proc stdConfig::ttdummy {} {
controller syncedprot
obj NvDummy wr 1.5
prop read ttdummy::update
prop write ttdummy::update
prop check ttdummy::update
prop target 1.5
kids "tt dummy" {
node set par 0
node tm par 1.5
node ts par 1.5
kids "settings" {
node curve -text par "undefined"
}
}
}
proc ttdummy::update {} {
sct update [sct target]
hset [sct]/tm [sct target]
hset [sct]/ts [sct target]
return idle
}