SICS-377 hipadaba_configuration_common.tcl
One typo and forgetting to clear a temporary variable meant that the list of candidates for removal never shrank while pruning reflectometer/config/motors/sct_batmotor.tcl The beam attenuator is on axis D not A. Also provide statemon feedback, "busy" or "idle" sans/config/velsel/velsel.tcl Update velocity selector parameters for NVS 43 SICS-374 sans/config/velsel/sct_velsel.tcl Set velocity selector identifier script_context_util.tcl Don't override the "klass' attribute, just make sure that it matches the hdb klass property if it's defined. event.h and statemon.c Added statemon BUSY and IDLE events for the scbat because it when it oscillates it's busy doing something. r2875 | ffr | 2010-01-22 20:41:36 +1100 (Fri, 22 Jan 2010) | 18 lines
This commit is contained in:
committed by
Douglas Clowes
parent
4a7bfba81e
commit
3a3b6764ee
2
event.h
2
event.h
@@ -49,6 +49,8 @@
|
||||
#define STEND 22
|
||||
#define STPAUSE 23
|
||||
#define STCONTINUE 24
|
||||
#define STBUSY 25
|
||||
#define STIDLE 26
|
||||
|
||||
#line 115 "event.w"
|
||||
|
||||
|
||||
@@ -870,13 +870,14 @@ proc ::hdb::prune {instdict} {
|
||||
if { [llength [join $sobjects]] == 0 } {
|
||||
if {[llength [array get dictarr $name/*]] == 0} {
|
||||
array unset dictarr $name
|
||||
set tempdict ""
|
||||
foreach {n v} $dict {
|
||||
if {$n != $name} {
|
||||
lappend tempdict $n
|
||||
lappend tempdict $v
|
||||
}
|
||||
}
|
||||
set $dict $tempdict
|
||||
set dict $tempdict
|
||||
} else {
|
||||
if {[lsearch $candidates $name/*] >= 0} {
|
||||
lappend new_candidates $name
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace eval ::scobj::galil {
|
||||
|
||||
set NS ::scobj::galil
|
||||
set batObjName scbat
|
||||
|
||||
set batpath /sics/$batObjName
|
||||
|
||||
set sim_mode [SplitReply [motor_simulation]]
|
||||
@@ -113,14 +114,14 @@ namespace eval ::scobj::galil {
|
||||
# NOTE: If you change the status command you must also
|
||||
# update the rdStatus procedure
|
||||
proc getStatus {} {
|
||||
sct send "MG OSCD,POS,_TPA,DBAND"
|
||||
sct send "MG OSCD,POS,_TPD,DBAND"
|
||||
return rdStatus
|
||||
}
|
||||
|
||||
##
|
||||
# @brief Parse the status reply from the Galil and set
|
||||
# the abstract status.
|
||||
proc rdStatus {} {
|
||||
proc rdStatus {batName} {
|
||||
variable bat_state
|
||||
|
||||
set data [sct result]
|
||||
@@ -131,12 +132,15 @@ namespace eval ::scobj::galil {
|
||||
default {
|
||||
if {$data != [sct oldval]} {
|
||||
sct oldval $data
|
||||
foreach {OSCD POS TPA DBAND} $data {}
|
||||
foreach {OSCD POS TPD DBAND} $data {}
|
||||
if [expr $OSCD == $bat_state(OSC)] {
|
||||
statemon busy $batName
|
||||
set newStatus "busy"
|
||||
} elseif [expr abs($TPA - $POS) < $DBAND] {
|
||||
} elseif [expr abs($TPD - $POS) < $DBAND] {
|
||||
statemon idle $batName
|
||||
set newStatus "idle"
|
||||
} else {
|
||||
statemon busy $batName
|
||||
set newStatus "busy"
|
||||
}
|
||||
if {[sct oldStatus] != $newStatus} {
|
||||
@@ -161,7 +165,7 @@ namespace eval ::scobj::galil {
|
||||
# Report the abstract status to GumTree
|
||||
hfactory $batpath/status plain user text
|
||||
hsetprop $batpath/status read ${NS}::getStatus
|
||||
hsetprop $batpath/status rdStatus ${NS}::rdStatus
|
||||
hsetprop $batpath/status rdStatus ${NS}::rdStatus $batObjName
|
||||
hsetprop $batpath/status values busy,idle
|
||||
hsetprop $batpath/status oldval UNKNOWN
|
||||
hsetprop $batpath/status oldStatus UNKNOWN
|
||||
@@ -170,7 +174,7 @@ namespace eval ::scobj::galil {
|
||||
# Report the current position in encoder counts
|
||||
# Useful as an activity monitor and troubleshooting.
|
||||
hfactory $batpath/pos plain user int
|
||||
hsetprop $batpath/pos read ${NS}::getValue rdValue "TPA"
|
||||
hsetprop $batpath/pos read ${NS}::getValue rdValue "TPD"
|
||||
hsetprop $batpath/pos rdValue ${NS}::rdValue
|
||||
hsetprop $batpath/pos oldval UNKNOWN
|
||||
|
||||
|
||||
@@ -460,6 +460,10 @@ proc halt {root} {
|
||||
hsetprop $statusPath oldval "UNKNOWN"
|
||||
hsetprop $statusPath oldstate "UNKNOWN"
|
||||
|
||||
# Set identifier
|
||||
hfactory $velselPath/ID plain spy text
|
||||
hset $velselPath/ID $velsel_ID
|
||||
|
||||
# Abstract status info for GumTree
|
||||
hfactory $velselPath/status plain spy text
|
||||
hset $velselPath/status "UNKNOWN"
|
||||
@@ -548,7 +552,7 @@ proc halt {root} {
|
||||
hsetprop $velselPath/geometry/position type instrument
|
||||
hsetprop $velselPath/geometry/position data true
|
||||
hsetprop $velselPath/geometry/position control true
|
||||
foreach {hpath klass control data nxsave mutable priv alias} {
|
||||
foreach {hpBUSYath klass control data nxsave mutable priv alias} {
|
||||
LambdaA parameter true true true true user velsel_lambdaa
|
||||
LambdaResFWHM_percent parameter true true true true spy velsel_lambdaresfwhm_percent
|
||||
rspeed parameter true true true true spy velsel_rspeed
|
||||
|
||||
@@ -8,15 +8,16 @@ namespace eval ::scobj::velocity_selector {
|
||||
set ::currVelSel [string tolower $::currVelSel]
|
||||
switch $::currVelSel {
|
||||
40 {
|
||||
set velsel_ID "NVS40"
|
||||
set velsel_IP "137.157.202.73"
|
||||
set velsel_port 10000
|
||||
set m_dTwistAngle 48.30
|
||||
set m_dLength 0.250
|
||||
set m_iMaxSpeed 28300.0
|
||||
set rBeamCenter 0.110
|
||||
set rBeamCenter 0.1100
|
||||
set VNeutron 3955.98
|
||||
set ::scobj::velocity_selector::UID "NVS"
|
||||
set ::scobj::velocity_selector::PWD "NVS"
|
||||
set VNeutron 3955.98
|
||||
set ::scobj::velocity_selector::blocked_speeds {
|
||||
-inf 3099
|
||||
3600 4999
|
||||
@@ -26,12 +27,13 @@ namespace eval ::scobj::velocity_selector {
|
||||
}
|
||||
43 {
|
||||
# dc2-quokka.nbi.ansto.gov.au
|
||||
set velsel_ID "NVS43"
|
||||
set velsel_IP "137.157.202.74"
|
||||
set velsel_port 10000
|
||||
set m_dTwistAngle 37.6
|
||||
set m_dLength 0.250
|
||||
set m_iMaxSpeed 21500.0
|
||||
set rBeamCenter 0.1170
|
||||
set m_iMaxSpeed 21000.0
|
||||
set rBeamCenter 0.1100
|
||||
set VNeutron 3955.98
|
||||
set ::scobj::velocity_selector::UID "NVS"
|
||||
set ::scobj::velocity_selector::PWD "NVS"
|
||||
|
||||
@@ -23,15 +23,13 @@ proc ::scobj::hinit_nodeprops {node hpath} {
|
||||
}
|
||||
}
|
||||
proc ::scobj::hinit_scobjprops {scobj hpath} {
|
||||
foreach {prop propval} [subst {
|
||||
klass parameter
|
||||
long_name $scobj
|
||||
}] {
|
||||
if {[hpropexists $hpath $prop] == false} {
|
||||
sicslist setatt $scobj $prop $propval
|
||||
} else {
|
||||
sicslist setatt $scobj $prop [hgetpropval $hpath $prop]
|
||||
}
|
||||
if {[hpropexists $hpath klass]} {
|
||||
sicslist setatt $scobj klass [hgetpropval $hpath klass]
|
||||
}
|
||||
if {[hpropexists $hpath long_name]} {
|
||||
sicslist setatt $scobj long_name [hgetpropval $hpath long_name]
|
||||
} else {
|
||||
sicslist setatt $scobj long_name $scobj
|
||||
}
|
||||
hsetprop $hpath sicsdev $scobj
|
||||
::scobj::hinit_nodeprops $scobj $hpath
|
||||
|
||||
28
statemon.c
28
statemon.c
@@ -141,6 +141,14 @@ static int StateInterest(int iEvent, void *pEvent, void *pUser,
|
||||
snprintf(buffer,255,"CONTINUE = %s", device);
|
||||
SCWriteInContext(pCon,buffer,eWarning,cc);
|
||||
}
|
||||
if(iEvent == STBUSY){
|
||||
snprintf(buffer,255,"BUSY = %s", device);
|
||||
SCWriteInContext(pCon,buffer,eWarning,cc);
|
||||
}
|
||||
if(iEvent == STIDLE){
|
||||
snprintf(buffer,255,"IDLE = %s", device);
|
||||
SCWriteInContext(pCon,buffer,eWarning,cc);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -350,6 +358,12 @@ int StateMonAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
lID = RegisterCallback(self->pCall, SCGetContext(pCon),STCONTINUE, StateInterest,
|
||||
pCon, NULL);
|
||||
SCRegister(pCon,pSics, self->pCall,lID);
|
||||
lID = RegisterCallback(self->pCall, SCGetContext(pCon),STBUSY, StateInterest,
|
||||
pCon, NULL);
|
||||
SCRegister(pCon,pSics, self->pCall,lID);
|
||||
lID = RegisterCallback(self->pCall, SCGetContext(pCon),STIDLE, StateInterest,
|
||||
pCon, NULL);
|
||||
SCRegister(pCon,pSics, self->pCall,lID);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else if(strcmp(argv[1],"uninterest") == 0) {
|
||||
@@ -399,6 +413,20 @@ int StateMonAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} else if(strcmp(argv[1],"busy") == 0) {
|
||||
if(argc > 2){
|
||||
InvokeCallBack(self->pCall,STBUSY,argv[2]);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} else if(strcmp(argv[1],"idle") == 0) {
|
||||
if(argc > 2){
|
||||
InvokeCallBack(self->pCall,STIDLE,argv[2]);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user