lakeshore340_common.tcl
Lakeshore controllers will be connected to the ca5-[instrument] moxa box Default config parameters are now available via a tc_dfltPar array IP and socket number are now mandatory when creating an ls340 object hrpd/.../lakeshore340.tcl Multiple lakeshores can now be added to the hdb tree echidna_configuration.tcl Provide example for configuring two lakeshores SICS-134 reflectometer/../commands.tcl First draft of beam/attenuator command, currently sends POS=xx (this won't work) reflectometer/../motor_configuration.tcl Add bat position feedback via action sans/../motor_configuration.tcl Renamed action parameter (aoid) to "action" server_config.tcl Initialise motor movecount to 500 to reduce number of position updates by a factor of 50 SICS-134 action.c Update the beam/attenuator command feedback variable when POS changes. SICS-134 motor_dmc2280.c Added PLP:BAT:POS status response handler for platypus bat position updates Only send IDLE state position updates if position change is greater than the precision. Rename action parameter (aoid) to "action" r2679 | ffr | 2008-08-19 15:11:55 +1000 (Tue, 19 Aug 2008) | 31 lines
This commit is contained in:
committed by
Douglas Clowes
parent
8090104407
commit
165f1b90a4
@@ -20,6 +20,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
static char *SV_FastShutter = "FastShutter";
|
static char *SV_FastShutter = "FastShutter";
|
||||||
|
static char *SV_BATPOS = "::beam::attenuator::_fb_BeamAttenuator";
|
||||||
|
|
||||||
static void setTextSICSVar(char *VarName, char *value) {
|
static void setTextSICSVar(char *VarName, char *value) {
|
||||||
int privilege = 1;
|
int privilege = 1;
|
||||||
@@ -38,7 +39,7 @@ static void setTextSICSVar(char *VarName, char *value) {
|
|||||||
void AO_istatus(int input, char *identifier) {
|
void AO_istatus(int input, char *identifier) {
|
||||||
int testVal;
|
int testVal;
|
||||||
|
|
||||||
if (strcasecmp(identifier, "TI1") == 0) {
|
if (strcasecmp(identifier, "QKK:TI1") == 0) {
|
||||||
testVal = 48 & input;
|
testVal = 48 & input;
|
||||||
if (testVal == 32) { // Fast shutter open
|
if (testVal == 32) { // Fast shutter open
|
||||||
setTextSICSVar(SV_FastShutter, "OPEN");
|
setTextSICSVar(SV_FastShutter, "OPEN");
|
||||||
@@ -49,6 +50,19 @@ void AO_istatus(int input, char *identifier) {
|
|||||||
} else { // 0 ie both limits activated
|
} else { // 0 ie both limits activated
|
||||||
setTextSICSVar(SV_FastShutter, "FAULT");
|
setTextSICSVar(SV_FastShutter, "FAULT");
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(identifier, "TS") == 0) {
|
} else if (strcasecmp(identifier, "PLP:BAT:POS") == 0) {
|
||||||
|
// Handle platypus:BAT POS
|
||||||
|
switch (input) {
|
||||||
|
case -1:
|
||||||
|
setTextSICSVar(SV_BATPOS, "OUT");
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
setTextSICSVar(SV_BATPOS, "IN");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
setTextSICSVar(SV_BATPOS, "OSCILLATING");
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
namespace eval ::environment::temperature { }
|
namespace eval ::environment::temperature {
|
||||||
|
# Default temperature controller parameters
|
||||||
|
array set tc_dfltPar {
|
||||||
|
tolerance 1
|
||||||
|
settle 30
|
||||||
|
range 2
|
||||||
|
upperlimit 500
|
||||||
|
lowerlimit 4
|
||||||
|
}
|
||||||
|
set tc_dfltURL ca5-[instname]
|
||||||
|
array set moxaPortMap {1 4001 2 4002 3 4003 4 4004}
|
||||||
|
}
|
||||||
|
|
||||||
# @brief Make a simulated temperature controller object.
|
# @brief Make a simulated temperature controller object.
|
||||||
#
|
#
|
||||||
@@ -19,7 +30,7 @@ proc ::environment::temperature::mkls340sim {temp_sobj} {
|
|||||||
# @param temp_sobj, name for temperature controller object
|
# @param temp_sobj, name for temperature controller object
|
||||||
# @param IP, (optional) IP address for temperature controller.
|
# @param IP, (optional) IP address for temperature controller.
|
||||||
# @param port, (optional) port number for temperature controller.
|
# @param port, (optional) port number for temperature controller.
|
||||||
proc ::environment::temperature::mkls340 {temp_sobj {IP 137.157.201.50} {port 4001}} {
|
proc ::environment::temperature::mkls340 {temp_sobj IP port} {
|
||||||
Makeasyncqueue sertemp1 LS340 $IP $port
|
Makeasyncqueue sertemp1 LS340 $IP $port
|
||||||
sertemp1 timeout 2000
|
sertemp1 timeout 2000
|
||||||
EvFactory new $temp_sobj ls340 sertemp1 1 D ABCD
|
EvFactory new $temp_sobj ls340 sertemp1 1 D ABCD
|
||||||
|
|||||||
@@ -5,20 +5,48 @@ source $cfPath(environment)/temperature/lakeshore340_common.tcl
|
|||||||
# This must be called when the instrument configuration is loaded and before\n
|
# This must be called when the instrument configuration is loaded and before\n
|
||||||
# the buildHDB function is called. Currently there is no way to add and remove\n
|
# the buildHDB function is called. Currently there is no way to add and remove\n
|
||||||
# environment controllers and their hdb paths at runtime.
|
# environment controllers and their hdb paths at runtime.
|
||||||
proc ::environment::temperature::add_ls340 {} {
|
#
|
||||||
set sim_mode [SplitReply [environment_simulation]]
|
# @param tcn temperature controller name, the hdb name will be tcn_cntrl
|
||||||
if {$sim_mode == "true"} {
|
# @param mport, the moxa RS232 port number, ie 1,2,3,4
|
||||||
::environment::temperature::mkls340sim tc1
|
#
|
||||||
} else {
|
# Optional parameters, see lakeshore340_common.tcl for defaults in tc_dfltPar
|
||||||
::environment::temperature::mkls340 tc1
|
# @param tolerance, temperature controller tolerance
|
||||||
tc1 tolerance 1
|
# @param settle, settling time in seconds
|
||||||
tc1 Settle 30
|
# @param range, lakeshore range
|
||||||
tc1 range 2
|
# @param upperlimit, upper temperature limit Kelvin
|
||||||
tc1 UpperLimit 500
|
# @param lowerlimit, lower temperature limit Kelvin
|
||||||
tc1 LowerLimit 4
|
proc ::environment::temperature::add_ls340 {tcn mport args} {
|
||||||
|
variable tc_dfltPar
|
||||||
|
variable tc_dfltURL
|
||||||
|
variable moxaPortMap
|
||||||
|
if [catch {
|
||||||
|
if {$tcn == "" || $mport == ""} {
|
||||||
|
error "ERROR: You must provide a temperature controller name and moxa port number"
|
||||||
}
|
}
|
||||||
|
|
||||||
sicslist setatt tc1 environment_name tempone
|
array set tc_param [array get tc_dfltPar]
|
||||||
sicslist setatt tc1 long_name control_sensor_reading
|
|
||||||
::environment::mkenvinfo tc1 {heateron {priv user} range {priv manager} }
|
if {$args != ""} {
|
||||||
|
array set tc_param $args
|
||||||
|
foreach {nm v} $args {
|
||||||
|
set tc_param($nm) $v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set sim_mode [SplitReply [environment_simulation]]
|
||||||
|
if {$sim_mode == "true"} {
|
||||||
|
::environment::temperature::mkls340sim $tcn
|
||||||
|
} else {
|
||||||
|
::environment::temperature::mkls340 $tcn $tc_dfltURL $moxaPortMap($mport)
|
||||||
|
foreach nm [array names tc_param] {
|
||||||
|
$tcn $nm $tc_param($nm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sicslist setatt $tcn environment_name ${tcn}_cntrl
|
||||||
|
sicslist setatt $tcn long_name control_sensor_reading
|
||||||
|
::environment::mkenvinfo $tcn {heateron {priv user} range {priv manager} }
|
||||||
|
} message ] {
|
||||||
|
if {$::errorCode=="NONE"} {return $message}
|
||||||
|
return -code error $message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# $Revision: 1.32 $
|
# $Revision: 1.33 $
|
||||||
# $Date: 2008-08-07 03:17:28 $
|
# $Date: 2008-08-19 05:11:55 $
|
||||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||||
# Last revision by: $Author: ffr $
|
# Last revision by: $Author: ffr $
|
||||||
|
|
||||||
@@ -40,7 +40,8 @@ source gumxml.tcl
|
|||||||
# AN ERROR IF THERE IS NO ../log/status.tcl FILE.
|
# AN ERROR IF THERE IS NO ../log/status.tcl FILE.
|
||||||
restore
|
restore
|
||||||
catch {
|
catch {
|
||||||
# ::environment::temperature::add_ls340
|
# ::environment::temperature::add_ls340 tc1 1
|
||||||
|
# ::environment::temperature::add_ls340 tc2 2
|
||||||
server_init
|
server_init
|
||||||
|
|
||||||
if [file exists ../extraconfig.tcl] {
|
if [file exists ../extraconfig.tcl] {
|
||||||
|
|||||||
@@ -5,6 +5,26 @@ namespace eval motor {
|
|||||||
variable is_homing_list ""
|
variable is_homing_list ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace eval beam {
|
||||||
|
command attenuator {text=in,out,osc pos} {
|
||||||
|
switch $pos {
|
||||||
|
"in" {
|
||||||
|
bat send POS=0
|
||||||
|
}
|
||||||
|
"out" {
|
||||||
|
bat send POS=-1
|
||||||
|
}
|
||||||
|
"osc" {
|
||||||
|
bat send POS=1
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
return -code error "ERROR: valid values are in, out, osc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
::beam::attenuator -addfb text BeamAttenuator
|
||||||
|
|
||||||
namespace eval exp_mode {
|
namespace eval exp_mode {
|
||||||
variable valid_modes
|
variable valid_modes
|
||||||
variable guide_for_mode ;#guide element for a specific mode
|
variable guide_for_mode ;#guide element for a specific mode
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ m1ro precision 0.001
|
|||||||
# Beam Attenuator (16mm/turn, 200mm travel)
|
# Beam Attenuator (16mm/turn, 200mm travel)
|
||||||
Motor bat $motor_driver_type [params \
|
Motor bat $motor_driver_type [params \
|
||||||
asyncqueue mc1\
|
asyncqueue mc1\
|
||||||
|
action MC1\
|
||||||
axis D\
|
axis D\
|
||||||
units mm\
|
units mm\
|
||||||
hardlowerlim 0\
|
hardlowerlim 0\
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# $Revision: 1.23 $
|
# $Revision: 1.24 $
|
||||||
# $Date: 2008-08-13 04:16:30 $
|
# $Date: 2008-08-19 05:11:55 $
|
||||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||||
# Last revision by: $Author: ffr $
|
# Last revision by: $Author: ffr $
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ Motor det $motor_driver_type [params \
|
|||||||
asyncqueue mc1\
|
asyncqueue mc1\
|
||||||
host mc1-quokka\
|
host mc1-quokka\
|
||||||
port pmc1-quokka\
|
port pmc1-quokka\
|
||||||
aoid MC1\
|
action MC1\
|
||||||
axis G\
|
axis G\
|
||||||
units mm\
|
units mm\
|
||||||
hardlowerlim 350\
|
hardlowerlim 350\
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# SICS common configuration
|
# SICS common configuration
|
||||||
|
|
||||||
# $Revision: 1.40 $
|
# $Revision: 1.41 $
|
||||||
# $Date: 2008-08-18 03:01:29 $
|
# $Date: 2008-08-19 05:11:55 $
|
||||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||||
# Last revision by $Author: ffr $
|
# Last revision by $Author: ffr $
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
|||||||
sics_release lock
|
sics_release lock
|
||||||
|
|
||||||
::utility::mkVar sics_revision_num Text internal
|
::utility::mkVar sics_revision_num Text internal
|
||||||
set tmpstr [string map {"$" ""} {$Revision: 1.40 $}]
|
set tmpstr [string map {"$" ""} {$Revision: 1.41 $}]
|
||||||
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||||
sics_revision_num lock
|
sics_revision_num lock
|
||||||
|
|
||||||
@@ -163,6 +163,9 @@ exe syspath ../batch
|
|||||||
|
|
||||||
proc server_set_sobj_attributes {} {
|
proc server_set_sobj_attributes {} {
|
||||||
if [ catch {
|
if [ catch {
|
||||||
|
foreach m [lrange [sicslist type Motor] 1 end] {
|
||||||
|
$m movecount 500
|
||||||
|
}
|
||||||
motor_set_sobj_attributes
|
motor_set_sobj_attributes
|
||||||
::utility::set_motor_attributes
|
::utility::set_motor_attributes
|
||||||
::utility::set_histomem_attributes
|
::utility::set_histomem_attributes
|
||||||
|
|||||||
@@ -1249,9 +1249,10 @@ static int rspStatus(pDMC2280Driv self, const char* text) {
|
|||||||
&iStopCode, &iTIzero, &iTIone, &iXQ0);
|
&iStopCode, &iTIzero, &iTIone, &iXQ0);
|
||||||
if (iRet != 8)
|
if (iRet != 8)
|
||||||
return 0;
|
return 0;
|
||||||
/* TODO some kind of callback for builtin status would be better */
|
/* TODO Put the following in specialised response handlers */
|
||||||
if (self->ao_id[0] != '\0') {
|
if (self->ao_id[0] != '\0') {
|
||||||
AO_istatus(iTIone, "TI1");
|
AO_istatus(iTIone, "QKK:TI1");
|
||||||
|
AO_istatus(iSteps, "PLP:BAT:POS");
|
||||||
}
|
}
|
||||||
if (self->axisLabel >= 'A' && self->axisLabel <= 'D')
|
if (self->axisLabel >= 'A' && self->axisLabel <= 'D')
|
||||||
iIOByte = iTIzero;
|
iIOByte = iTIzero;
|
||||||
@@ -1745,7 +1746,9 @@ static void DMCState_Idle(pDMC2280Driv self, pEvtEvent event) {
|
|||||||
pAsyncTxn pCmd = event->event.msg.cmd;
|
pAsyncTxn pCmd = event->event.msg.cmd;
|
||||||
if (self->subState == 1) { /* Status Response */
|
if (self->subState == 1) { /* Status Response */
|
||||||
int iRet;
|
int iRet;
|
||||||
long lDelta;
|
long lDelta, lprecision;
|
||||||
|
float fprecision;
|
||||||
|
|
||||||
iRet = rspStatus(self, pCmd->inp_buf);
|
iRet = rspStatus(self, pCmd->inp_buf);
|
||||||
if (iRet == 0)
|
if (iRet == 0)
|
||||||
break;
|
break;
|
||||||
@@ -1756,11 +1759,16 @@ static void DMCState_Idle(pDMC2280Driv self, pEvtEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* if the motor moved, update any observers */
|
/* if the motor moved, update any observers */
|
||||||
if (self->abs_encoder)
|
MotorGetPar(self->pMot, "precision", &fprecision);
|
||||||
|
if (self->abs_encoder) {
|
||||||
lDelta = fabs(self->currCounts - self->lastCounts);
|
lDelta = fabs(self->currCounts - self->lastCounts);
|
||||||
else
|
lprecision = (long) (fprecision * self->cntsPerX + 0.5);
|
||||||
|
} else {
|
||||||
lDelta = fabs(self->currSteps - self->lastSteps);
|
lDelta = fabs(self->currSteps - self->lastSteps);
|
||||||
if (lDelta > 10) {
|
lprecision = (long) (fprecision * self->stepsPerX + 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lDelta > lprecision) {
|
||||||
set_lastMotion(self, self->currSteps, self->currCounts);
|
set_lastMotion(self, self->currSteps, self->currCounts);
|
||||||
report_motion(self);
|
report_motion(self);
|
||||||
}
|
}
|
||||||
@@ -3660,7 +3668,7 @@ MotorDriver *CreateDMC2280(SConnection *pCon, char *motor, char *params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pNew->ao_id[0] = '\0';
|
pNew->ao_id[0] = '\0';
|
||||||
if ((pPtr=getParam(pCon, interp, params, "aoid", _OPTIONAL)) != NULL) {
|
if ((pPtr=getParam(pCon, interp, params, "action", _OPTIONAL)) != NULL) {
|
||||||
strncpy(pNew->ao_id, pPtr, sizeof(pNew->ao_id));
|
strncpy(pNew->ao_id, pPtr, sizeof(pNew->ao_id));
|
||||||
pNew->ao_id[sizeof(pNew->ao_id) - 1] = '\0';
|
pNew->ao_id[sizeof(pNew->ao_id) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user