sct_protek608.c
Implements a protocol handler for the protek 608 multimeters which just allows us to read the display. It reports all elements of the display including the bar graph, it does not provide remote control of the multimeter. The protocol handler broadcasts a warning to all clients if the auto-off function is enabled. sct_rfamp.c This is a protocol handler for the Mirrortron 35V 7A AC Generator (ANSFR-83B). sinqhttpprot.c Copied the PSI script context http protocol handler. sct_orhvpsprot.c Ordela high voltage power supply protocol handler now catches unknown commands. sct_eurotherm_2000.tcl Eurotherm controller for the kowari load frame by Douglas Clowes. sct_lakeshore_3xx.tcl Latest update from Arndt. The two control loops are now independent, settletime and tolerance now work properly. common_instrument_dictionary.tcl Make instrument/status saveable. sct_orhvps_common.tcl Provides voltage ramping and implements the dhv1 command for the Ordela HVPS via the sct_orhpsprot.c protocol handler. hmm_configuration_common_1.tcl Adds new "histmem clockscale" subcommand to get and set the clock scale from the fat_clock_scale FAT parameter. You can now upload the FAT FRAME_BUFFER and FRAME_DUTYCYCLE parameters to the histogram memory. The veto commands are now "histmem veto on" and "histmem veto off". hmm_object.tcl The axis order for the histmem object has been restore to t,y,x sct_positmotor_common.tcl Code has been simplified. nxscripts_common_1.tcl Removed obsolete ::nexus::data function. TOF axis now correctly report time_of_flight instead of "time". plc_common_1.tcl Make PLC info saveable. scan_common_1.tcl SICS-385 The scan command should check the final scan variable value against he soft upper and lower limits, not against the hard limits. Make sure that the scan variable axis is saved. platypus, kowari, quokka hmm_configuration.tcl Use the HOR and VER entries in the new histmem_axes hash to select the horizontal and vertical axes for the histmem. kowari motor_configuration.tcl secondary_slit_configuration.tcl Flatten slits motor structure to match old layout in data files. quokka commands.tcl SICS-380 EApPosYmm -> EApPosY quokka detector.tcl Use new script context controller for Ordela HVPS quokka hmm_configuration.tcl Set detector height to 5.08*192 the same as the width quokka motor_configuration.tcl Code cleanup quokka positmotor_configuration.tcl Use new positmotor code. quokka aperture_configuration.tcl Added attenuation factor column to AttRotLookupTable quokka parameters.tcl SICS-380 Refactor nexus, remove redundant parameters. site_ansto.c Added the following protocols, Httpl, Protek608, aand RFAmp. scriptcontext.c SICS-386 SctActionHandler: set "send" string to NULL when a chain of scripts completes with state=idle. It turns out that if none of the scripts in the "read chain" call [sct send] each time the chain is executed, then SICS will hammer the device with calls to AsconWrite(). This can be avoided if SctActionHandler sets the 'send' string to NULL before "goto finish" in the idle state. This will be safer and still let you have chains with multiple [sct send] and read scripts. asyncprotocol.c Fix platypus memory leak. devser.c SICS-387 Started adding code to pass signals on to script context drivers. ascon.c AsconTask(): Make sure we return to the AsconIdle state when sending a command which expect no response, also only reconnect if there is a Timeout when there has been an error. r2888 | ffr | 2010-04-19 14:04:41 +1000 (Mon, 19 Apr 2010) | 90 lines
This commit is contained in:
committed by
Douglas Clowes
parent
aa6bb7f1da
commit
d9da95a5df
145
site_ansto/instrument/config/environment/sct_protek_common.tcl
Normal file
145
site_ansto/instrument/config/environment/sct_protek_common.tcl
Normal file
@@ -0,0 +1,145 @@
|
||||
##
|
||||
# @file sct_protek_common.tcl
|
||||
# @brief Gets display state from Protek 608 multimeters.
|
||||
#
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
|
||||
## MULTIMETER STATE FIELDS AND VALUES
|
||||
###### MODES
|
||||
# AUTOOFF:1/0 PULSE:1/0 MAX:1/0 PLUSPEAK:1/0 REL:1/0 RECALL:1/0 GO/NG:1/0 MINUSPER:1/0
|
||||
# RS232C:1/0 PLUS:1/0 MINUS:1/0 MIN:1/0 MINUSPEAK:1/0 AVG:1/0 STORE:1/0 REF:1/0 PLUSPER:1/0
|
||||
# LOBAT:1/0
|
||||
|
||||
###### MAIN DISPLAY
|
||||
# AC1:1/0 SIGN1:1/0 DC1:1/0 PW1:1/0
|
||||
# MD5:np MD4:np MD3:np MD2:np MD1:n
|
||||
# M1:1/0 k1:1/0 OHM1:1/0
|
||||
# u1:1/0 Hz1:1/0
|
||||
# m1:1/0 V1:1/0 A1:1/0
|
||||
# n1:1/0 S1:1/0 F1:1/0
|
||||
# DEGC1:1/0 s1:1/0
|
||||
# DEGF1:1/0
|
||||
|
||||
###### BAR GRAPH
|
||||
# B16K:1/0 B8K:1/0 B4K:1/0 B2K:1/0 B1K:1/0
|
||||
# B512:1/0 B256:1/0 B128:1/0 B64:1/0 B32:1/0
|
||||
# B16:1/0 B8:1/0 B4:1/0 B2:1/0 B1:1/0 B0:1/0
|
||||
|
||||
###### SUB DISPLAY
|
||||
# RANGE2:1/0 HOLD2:1/0 DUTY2:1/0
|
||||
# CONT2:1/0 ZD2:1/0
|
||||
# AC2:1/0 SIGN2:1/0 DC2:1/0
|
||||
# SD5:np SD4:np SD3:np SD2:np SD1:n
|
||||
# PERCENT2:1/0 dBm2:1/0
|
||||
# m2:1/0 V2:1/0 A2:1/0 DEGK2:1/0
|
||||
# G2:1/0 M2:1/0 k2:1/0 OHM2:1/0 Hz2:1/0
|
||||
|
||||
# ROTSWITCH:[0-8]
|
||||
|
||||
### The return values for nine bytes is undocumented,
|
||||
### they are labelled as X1 to X9
|
||||
# X[1-9]:?
|
||||
|
||||
##
|
||||
# @brief Sends a state report request to the protek script context protocol handler.
|
||||
proc rqStateRep {} {
|
||||
sct send "STATE"
|
||||
return rdStateRep
|
||||
}
|
||||
|
||||
##
|
||||
# @brief Processes state report from the protek script context protocol handler.
|
||||
proc rdStateRep {} {
|
||||
set stateRep [sct result]
|
||||
if {[string match "ASCERR:*" $stateRep]} {
|
||||
sct geterror $stateRep
|
||||
# Setting oldval forces update and clears geterror on next call
|
||||
sct oldval "UNKNOWN"
|
||||
return idle
|
||||
}
|
||||
|
||||
array set stateArr [split $stateRep "|:"]
|
||||
if {$stateArr(AUTOOFF)} {
|
||||
broadcast "PROTEK608:[sct IP]:[sct PORT] WARNING AUTO OFF IS ENABLED"
|
||||
}
|
||||
if {$stateArr(LOBAT)} {
|
||||
broadcast "PROTEK608: LOW BATTERY WARNING"
|
||||
}
|
||||
if {$stateRep != [sct oldval]} {
|
||||
sct update $stateRep
|
||||
sct oldval $stateRep
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
proc rqVal {} {
|
||||
return reportVal
|
||||
}
|
||||
proc ProtekMainDisplay {protek} {
|
||||
if [catch {
|
||||
set stateRep [hval $protek/state]
|
||||
set MDpath [sct]
|
||||
set scale [hval $MDpath/scale]
|
||||
set offset [hval $MDpath/offset]
|
||||
array set SA [split $stateRep "|:"]
|
||||
if {$SA(SIGN1)} {
|
||||
set sign1 "-"
|
||||
} else {
|
||||
set sign1 ""
|
||||
}
|
||||
set MDISP "$sign1$SA(MD5)$SA(MD4)$SA(MD3)$SA(MD2)$SA(MD1)"
|
||||
set MDISP [expr {$scale * $MDISP + $offset}]
|
||||
set oldval [sct oldval]
|
||||
if {$MDISP != $oldval} {
|
||||
sct update $MDISP
|
||||
sct oldval $MDISP
|
||||
}
|
||||
} msg ] {
|
||||
return -code error "[info level 0] $msg"
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
##
|
||||
# @brief Makes a state monitor object for the protek multimeter
|
||||
#
|
||||
# @param name, name of object which reports main display reading
|
||||
# @param IP, IP address of protek moxa box
|
||||
# @param PORT, port number for protek on moxa box
|
||||
# @param scale, scales reading to physical units
|
||||
# @param offset, offset for main display reading
|
||||
# @param interval, polling interval in seconds (optional, default = 0.5seconds)
|
||||
# NOTE: If the interval is negative then the multimeter will be polled on every cycle of
|
||||
# the SICS task loop.
|
||||
proc MakeProtek {name IP PORT {scale 1.0} {offset 0.0} {interval 0.5}} {
|
||||
set sctName "sct_$name"
|
||||
set sobjName "so_$name"
|
||||
set soState "so_state_$name"
|
||||
puts "MakeSICSObj $sobjName SCT_OBJECT"
|
||||
MakeSICSObj $soState SCT_OBJECT
|
||||
MakeSICSObj $sobjName SCT_OBJECT user float
|
||||
sicslist setatt $sobjName long_name $sobjName
|
||||
|
||||
hfactory /sics/$soState/state plain user text
|
||||
hsetprop /sics/$soState/state read rqStateRep
|
||||
hsetprop /sics/$soState/state rdStateRep rdStateRep
|
||||
hsetprop /sics/$soState/state oldval "UNKNOWN"
|
||||
hsetprop /sics/$sobjName read rqVal
|
||||
hsetprop /sics/$sobjName reportVal ProtekMainDisplay /sics/$soState
|
||||
hfactory /sics/$sobjName/scale plain user float
|
||||
hset /sics/$sobjName/scale $scale
|
||||
hfactory /sics/$sobjName/offset plain user float
|
||||
hset /sics/$sobjName/offset $offset
|
||||
hsetprop /sics/$sobjName oldval "UNKNOWN"
|
||||
|
||||
sicslist setatt $sobjName klass sample
|
||||
::scobj::hinitprops $sobjName
|
||||
sicslist setatt $sobjName long_name $name
|
||||
if {[SplitReply [environment_simulation]] == false} {
|
||||
makesctcontroller $sctName protek608 $IP:$PORT
|
||||
hsetprop /sics/$soState/state IP $IP
|
||||
hsetprop /sics/$soState/state PORT $PORT
|
||||
$sctName poll /sics/$soState/state $interval
|
||||
$sctName poll /sics/$sobjName $interval
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user