Merge branch 'RELEASE-3_1' into RELEASE-3_2

Conflicts:
	sics/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl
	sics/site_ansto/instrument/bilby/config/motors/shutters_sct.tcl
	sics/site_ansto/instrument/bilby/config/motors/tank_sct.tcl
	sics/site_ansto/instrument/bilby/util/sics_config.ini
	sics/site_ansto/instrument/config/environment/hiden_xcs_sct.tcl
	sics/site_ansto/instrument/config/environment/huber_pilot_sct.tcl
	sics/site_ansto/instrument/config/environment/isotech_ps_sct.tcl
	sics/site_ansto/instrument/config/environment/keithley_m2700_sct.tcl
	sics/site_ansto/instrument/config/environment/magneticField/oxford12tlv_sct.tcl
	sics/site_ansto/instrument/config/environment/magneticField/tsi_smc_sct.tcl
	sics/site_ansto/instrument/config/environment/nhq_200_sct.tcl
	sics/site_ansto/instrument/config/environment/omron_hldc_sct.tcl
	sics/site_ansto/instrument/config/environment/protekmm_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/eurotherm_m2000_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/julabo_lh45_gen_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/lakeshore_218_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/ls336_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/ls340_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/mercury_base_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/mercury_level_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/mercury_pres_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/mercury_scpi_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/mercury_temp_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/mercury_valve_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/nprvasm2_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/pfeiffer_hg_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/watlow_mpm_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/watlow_mrm_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/watlow_mst4_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/west_6100.sct
	sics/site_ansto/instrument/config/source/reactor_status_sct.tcl
	sics/site_ansto/instrument/hrpd/echidna_configuration.tcl
	sics/site_ansto/instrument/sans/quokka_configuration.tcl
	sics/site_ansto/instrument/tas/config/motors/motor_configuration.tcl
	sics/site_ansto/instrument/util/gen_sct.py
	sics/site_ansto/instrument/util/motor_utility.tcl
This commit is contained in:
Douglas Clowes
2014-09-26 17:04:19 +10:00
75 changed files with 5146 additions and 540 deletions

View File

@ -2127,8 +2127,17 @@ static void hookFunc(const char *pText, OutCode eOut, void*pData)
{
SConnection *pCon = (SConnection *) pData;
int text_len = strlen(pText);
char txt[5];
ANETwrite(pCon->sockHandle, pText, text_len);
if (!VerifyConnection(pCon)) {
return;
}
if (!ANETvalidHandle(pCon->sockHandle)) {
return;
}
snprintf(txt, 5, "%3s:", OutCodeToTxt(eOut));
ANETwrite(pCon->sockHandle, txt, 4);
ANETwrite(pCon->sockHandle, (char *)pText, text_len);
if (pText[text_len - 1] != '\n')
ANETwrite(pCon->sockHandle, "\n", 1);
}
@ -2151,9 +2160,13 @@ int KillCapture(SConnection * pCon)
int LogCapture(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[])
{
SConnection * pConMaster;
char pBueffel[512];
int i;
pConMaster = SCfindMaster(pCon);
if (pConMaster == NULL)
return 0;
/* check no af args */
if (argc < 2) {
snprintf(pBueffel,sizeof(pBueffel)-1, "Insufficient number of arguments to %s", argv[0]);
@ -2164,18 +2177,19 @@ int LogCapture(SConnection * pCon, SicsInterp * pSics, void *pData,
/* Branch according to argv[1] */
if (strcmp(argv[1], "kill") == 0) {
KillCapture(pCon);
KillCapture(pConMaster);
return 1;
} else if (strcmp(argv[1], "all") == 0) {
AddSICSLogHook(hookFunc, "all", pCon);
AddSICSLogHook(hookFunc, "all", pConMaster);
return 1;
} else if (argc == 2) {
/* must be outcode, try find it */
AddSICSLogHook(hookFunc, argv[1], pCon);
AddSICSLogHook(hookFunc, argv[1], pConMaster);
return 1;
} else {
/* make it a list */
int i, len;
int i;
size_t len;
char *pBuff;
for (i = 1, len = 0; i < argc; ++i)
len += strlen(argv[i]) + 1;
@ -2193,7 +2207,7 @@ int LogCapture(SConnection * pCon, SicsInterp * pSics, void *pData,
strcpy(&pBuff[len], argv[i]);
len += strlen(argv[i]);
}
AddSICSLogHook(hookFunc, pBuff, pCon);
AddSICSLogHook(hookFunc, pBuff, pConMaster);
if (pBuff != pBueffel)
free(pBuff);
return 1;
@ -2212,7 +2226,8 @@ int LogOutput(SConnection * pCon, SicsInterp * pSics, void *pData,
{
char pBueffel[512];
char *pBuff;
int i, len, result, start;
int i, result, start;
size_t len;
OutCode outcode;
/* check no af args */
@ -2323,7 +2338,7 @@ int SCTaskFunction(void *pData)
pPassword = strtok(NULL, " \t\r\n");
iRet = IsValidUser(pUser, pPassword);
if (iRet >= 0) {
SCWrite(self, "Login OK", eError);
SCWrite(self, "Login OK", eLog);
self->iLogin = 1;
SCSetRights(self, iRet);
pHost[0] = '\0';

View File

@ -270,8 +270,8 @@ static FILE *fLogFile = NULL;
static int iFile = 0;
static int iLineCount = 0;
static int iLogUsable = 1;
static char filnam[512];
static char prevfilnam[512];
static char filnam[1024];
static char prevfilnam[1024];
/*---------------------------------------------------------------------------*/
int OpenVerifyLogFile()
@ -280,17 +280,21 @@ int OpenVerifyLogFile()
char *pChar = NULL;
char fPath[1024];
/* snprintf(fPath, 1023, "%s/", getenv("SICS_INIT_LOGPATH")); */
snprintf(fPath, 1023, "%s/", "../log");
pChar = getenv("SICS_INIT_LOGPATH");
if (!pChar) {
snprintf(fPath, sizeof(fPath) - 1, "%s/", "../log");
} else {
snprintf(fPath, sizeof(fPath) - 1, "%s/", pChar);
}
pChar = IFindOption(pSICSOptions, "LogFileBaseName");
if (!pChar) { /* Try to write to file "server" in */
strcpy(pFile, "server");
} else {
strlcpy(pFile, pChar, 255);
strlcpy(pFile, pChar, sizeof(pFile) - 1);
}
snprintf(filnam, 511, "%s%s_%19.19s.%02d.log", fPath, pFile, timestamp(NULL, '-'), iFile);
snprintf(filnam, sizeof(filnam) - 1, "%s%s_%19.19s.%02d.log", fPath, pFile, timestamp(NULL, '-'), iFile);
iFile++;
if (iFile >= MAXFILES) {
iFile = 0;

View File

@ -456,7 +456,7 @@ int VarWrapper(SConnection * pCon, SicsInterp * pInterp, void *pData,
return 1;
case veFloat:
VarGetFloat(pVar, &fVal);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s = %f", argv[0], fVal);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s = %g", argv[0], fVal);
SCWrite(pCon, pBueffel, eValue);
DeleteTokenList(pList);
return 1;

View File

@ -4,3 +4,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation false true
detector_simulation false true
hmm_simulation false true
environment_simulation false false
counter_simulation true true
motor_simulation false false
chopper_simulation false true
velsel_simulation false true
plc_simulation false true
rfgen_simulation false true
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -8,4 +8,4 @@ driver = astrium_chopper
imptype = disk_chopper
ip = 137.157.203.39
port = 3302
terminator = \r\n

View File

@ -45,6 +45,7 @@ proc handle_acscript_exception {status message args} {
proc ::anticollider::loadscript {args} {
variable veto_rules
catch {
set fh [open $::cfPath(anticollider)/[lindex $args 0] RDONLY ]
while {[gets $fh line] >= 0} {
# Skip empty lines and comments
@ -54,6 +55,10 @@ proc ::anticollider::loadscript {args} {
lappend veto_rules $line
}
}
catch {
close $fh
}
}
##
# @brief Compile compile an anticollider declaration into a veto region table

View File

@ -27,8 +27,8 @@ proc ::scobj::agilent_33220A::sics_log {debug_level debug_string} {
} catch_message ]
}
proc ::scobj::agilent_33220A::mkDriver { sct_controller name ip_address tcp_port } {
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}"
proc ::scobj::agilent_33220A::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]"
set catch_status [ catch {
@ -40,21 +40,27 @@ proc ::scobj::agilent_33220A::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::agilent_33220A::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A"
::scobj::agilent_33220A::sics_log 1 "::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::agilent_33220A {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_agilent_33220A {name ip_address tcp_port} {
set catch_status [ catch {
::scobj::agilent_33220A::sics_log 9 "add_agilent_33220A ${name} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A"
::scobj::agilent_33220A::sics_log 1 "::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::agilent_33220A::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
}
clientput "file evaluation of agilent_33220A_sct.tcl"
@ -65,6 +71,8 @@ proc ::scobj::agilent_33220A::read_config {} {
set ns "::scobj::agilent_33220A"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
@ -72,6 +80,12 @@ proc ::scobj::agilent_33220A::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
@ -82,9 +96,9 @@ proc ::scobj::agilent_33220A::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "agilent_33220A"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -111,9 +125,9 @@ proc ::scobj::agilent_33220A::read_config {} {
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_agilent_33220A ${name} ${ip_address} ${tcp_port}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
add_agilent_33220A ${name} "aqadapter" ${asyncqueue}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
}
}

View File

@ -0,0 +1,372 @@
#
# Template driver for the Knauer BlueShadow Pump 40P
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
#
driver knauer_pump = {
debug_threshold = 0;
vendor = knauer; device = pump40p; protocol = knauer_ap;
class = environment;
simulation_group = environment_simulation;
#
group dummy = {
type = text; readable = 1; data = false; control = false; nxsave = false;
var status = { read_command = 'STATUS?'; read_function = read_status; }
var glp = { read_command = 'GLP?'; read_function = read_glp; property real_data = ' '; }
}
group pump = {
var remote = {
type = int;
readable = 1; read_command = 'REMOTE?'; read_function = remote_read;
writeable = 1; write_function = remote_write;
}
var state = {
type = text;
readable = 1;
read_command = ' ';
fetch_function = state_fetch;
}
var status = {
type = text;
readable = 1;
read_command = ' ';
fetch_function = status_fetch;
}
var volume_pv = {
type = float;
readable = 1;
read_command = ' ';
fetch_function = volume_fetch;
#checkrange_function = volume_reject;
property 'units' = 'mL';
}
var volume_sp = {
type = float;
writeable = 1;
write_command = ' ';
write_function = volume_write;
driveable = pump/volume_pv
checkstatus_function = volume_checkstatus;
halt_function = volume_halt;
lowerlimit = 0; upperlimit = 100; tolerance = 0.01;
readable = 1;
read_command = ' ';
fetch_function = volume_checkpumping;
property 'units' = 'mL';
}
var ratio_pv = {
type = text;
readable = 1; read_command = ' '; fetch_function = ratios_fetch;
property 'units' = 'percent';
}
var ratio_sp = {
type = text;
writeable = 1; write_command = ' '; write_function = ratios_write; checkrange_function = ratios_check;
property 'units' = 'percent';
}
var flow_pv = {
type = float;
readable = 1; read_command = ' '; fetch_function = flow_fetch;
property 'units' = 'mL/min';
}
var flow_sp = {
type = float;
writeable = 1; write_command = ' '; write_function = flow_write;
lowerlimit = 0; upperlimit = 10;
property 'units' = 'mL/min';
}
}
group stuff = {
readable = 60;
type = text;
data = false; control = false; nxsave = false;
var an_out = { read_command = 'AN_OUT?'; }
var boardinfo = { read_command = 'BOARDINFO?'; }
var config = { read_command = 'CONFIG?'; }
var cprofinfo = { read_command = 'CPROFINFO?'; }
var dout = { read_command = 'DOUT?'; }
var error = { read_command = 'ERROR?'; }
var errors = { read_command = 'ERRORS?'; }
var flushpmp = { read_command = 'FLUSHPMP?'; }
var head = { read_command = 'HEAD?'; }
var head_par = { read_command = 'HEAD_PAR?'; }
var identify = { read_command = 'IDENTIFY?'; }
var lpg = { read_command = 'LPG?'; }
var oem = { read_command = 'OEM?'; }
var opt = { read_command = 'OPT?'; }
var plim = { read_command = 'PLIM?'; }
var pressure = { read_command = 'PRESSURE?'; }
var prfastacq = { read_command = 'PRFASTACQ?'; }
var purge = { read_command = 'PURGE?'; }
var remote = { read_command = 'REMOTE?'; }
var rfid = { read_command = 'RFID?'; }
var service = { read_command = 'SERVICE?'; }
var sysinfo = { read_command = 'SYSINFO?'; }
var 'units' = { read_command = 'UNITS?'; }
var valves = { read_command = 'VALVES?'; }
}
group prog = {
readable = 30;
type = text;
var line_01 = { read_command = "TT_GET:1,1"; }
var line_02 = { read_command = "TT_GET:1,2"; }
var line_03 = { read_command = "TT_GET:1,3"; }
var line_04 = { read_command = "TT_GET:1,4"; }
var line_05 = { read_command = "TT_GET:1,5"; }
}
group glp = {
type = text;
readable = 1;
fetch_function = fetch_from_glp;
var board_time = { read_command = '0'; }
var motor_time = { read_command = '1'; }
var head_count = { read_command = '3'; }
var head_time = { read_command = '4'; }
var head_volm = { read_command = '5'; }
var head_voln = { read_command = '6'; }
var head_pwrhi = { read_command = '7'; }
var head_pwrlo = { read_command = '8'; }
var pump_revs = { read_command = '9'; }
var pump_volm = { read_command = '10'; }
var pump_voln = { read_command = '11'; }
var pump_pwrhi = { read_command = '12'; }
var pump_pwrlo = { read_command = '13'; }
}
group status = {
type = text;
readable = 1;
fetch_function = fetch_from_status;
var state = { read_command = '1'; }
var cur_error = { read_command = '2'; }
var cur_run_time = { read_command = '3'; }
var flow_rate = { read_command = '4'; }
var lpg_0 = { read_command = '5'; }
var lpg_1 = { read_command = '6'; }
var lpg_2 = { read_command = '7'; }
var lpg_3 = { read_command = '8'; }
var evt_0 = { read_command = '9'; }
var evt_1 = { read_command = '10'; }
var evt_2 = { read_command = '11'; }
var evt_3 = { read_command = '12'; }
var evt_4 = { read_command = '13'; }
var evt_5 = { read_command = '14'; }
var evt_6 = { read_command = '15'; }
var evt_7 = { read_command = '16'; }
var cur_pres = { read_command = '17'; }
var start_in = { read_command = '18'; }
var error_in = { read_command = '19'; }
}
code fetch_from_glp = {%%
set index ${cmd_str}
set data [hgetpropval ${tc_root}/dummy/glp real_data]
set dlist [split ${data} ","]
if { [llength ${dlist}] > ${index} } {
sct result [lindex ${dlist} ${index}]
} else {
sct result ""
}
set cmd "@@NOSEND@@"
%%}
code fetch_from_status = {%%
set index ${cmd_str}
set data [hgetpropval ${tc_root}/dummy/status real_data]
set dlist [split ${data} ","]
if { [llength ${dlist}] > ${index} } {
sct result [lindex ${dlist} ${index}]
} else {
sct result ""
}
set cmd "@@NOSEND@@"
%%}
code read_glp = {%%
if { [string equal -nocase -length 6 ${data} "ERROR:"] } {
} else {
set dlist [split [lindex [split ${data} ":"] 1] ","]
sct real_data "[join [lrange ${dlist} 0 end] ,]"
set data "Hidden in real_data property"
}
%%}
code read_status = {%%
set dlist [split [lindex [split ${data} ":"] 1] ","]
sct real_data "[join [lrange ${dlist} 0 end] ,]"
set data "Hidden in real_data property"
%%}
code status_fetch = {%%
set index 1
set data [hgetpropval ${tc_root}/dummy/status real_data]
set dlist [split ${data} ","]
set status_code [lindex ${dlist} ${index}]
set cmd "@@NOSEND@@"
if { ${status_code} == 3 } {
sct result "PUMPING"
} else {
sct result "IDLE"
}
%%}
code state_fetch = {%%
set index 1
set data [hgetpropval ${tc_root}/dummy/status real_data]
set dlist [split ${data} ","]
set state_code [lindex ${dlist} ${index}]
set cmd "@@NOSEND@@"
if { ${state_code} < 0 || ${state_code} > 9 } {
sct geterror "Invalid device_state ${state_code}"
error "[sct geterror]"
}
set slist [list "SYS_ST_INITIALIZING" \
"SYS_ST_OFF" \
"SYS_ST_IDLE" \
"SYS_ST_RUN" \
"SYS_ST_HOLD" \
"SYS_ST_PURGE" \
"SYS_ST_STANDBY" \
"SYS_ST_FAILED" \
"SYS_ST_RUNATEND" \
]
sct result [lindex ${slist} ${state_code}]
%%}
code halt = {%%
set rlist [hval ${tc_root}/pump/ratio_sp]
set ratio_tgt [join [split ${rlist} /] ,]
set cmd "RAMP:0,0,${ratio_tgt},0,0,0,0,0,0,0,0,2"
%%}
code flow_fetch = {%%
set data [hgetpropval ${tc_root}/dummy/status real_data]
set dlist [split ${data} ","]
set flow_pv [lindex ${dlist} 4]
sct result [expr {0.001 * ${flow_pv}}]
set cmd "@@NOSEND@@"
%%}
code flow_write = {%%
set data [sct target]
set cmd "@@NOSEND@@"
set nextState idle
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
%%}
code ratios_check = {%%
set rlist [split ${setpoint} /]
if { [llength ${rlist}] != 4 } {
sct geterror "${setpoint} has [llength ${rlist}] components, needs 4"
error [sct geterror]
}
set sum [expr [lindex ${rlist} 0] + [lindex ${rlist} 1] + [lindex ${rlist} 2] + [lindex ${rlist} 3]]
if { ${sum} != 100 } {
sct geterror "sum is ${sum}, must be 100"
error [sct geterror]
}
%%}
code ratios_fetch = {%%
set data [hgetpropval ${tc_root}/dummy/status real_data]
set dlist [split ${data} ","]
set ratio_vals "[lindex ${dlist} 5]/[lindex ${dlist} 6]/[lindex ${dlist} 7]/[lindex ${dlist} 8]"
sct result ${ratio_vals}
set cmd "@@NOSEND@@"
%%}
code ratios_write = {%%
set data [sct target]
set cmd "@@NOSEND@@"
set nextState idle
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
%%}
code remote_read = {%%
if { [string equal -length 7 ${data} "REMOTE:"] } {
set data [lindex [split ${data} :] 1]
} else {
sct geterror "bad response"
error "[sct geterror]"
}
%%}
code remote_write = {%%
if { ${par} == 0 } {
set cmd "LOCAL"
} else {
set cmd "REMOTE"
}
%%}
code volume_fetch = {%%
set data [hgetpropval ${tc_root}/dummy/glp real_data]
set dlist [split ${data} ","]
if { [llength ${dlist}] > 11 } {
set pump_volm [lindex ${dlist} 10]
set pump_voln [lindex ${dlist} 11]
set pump_volume [expr {${pump_volm} + 0.000001 * ${pump_voln}}]
} else {
set pump_volume 0.0
}
sct raw_volume ${pump_volume}
if { [hpropexists [sct] base_volume] } {
set pump_volume [expr {${pump_volume} - [sct base_volume]}]
} elseif { [hpropexists [sct] raw_volume] } {
sct base_volume [sct raw_volume]
}
sct result [format "%.2f" ${pump_volume}]
set cmd "@@NOSEND@@"
%%}
code volume_write = {%%
hsetprop ${tc_root}/[sct driveable] base_volume [hgetpropval ${tc_root}/[sct driveable] raw_volume]
hset ${tc_root}/[sct driveable] 0.0
set flow_tgt [expr {int(1000.0 * [hval ${tc_root}/pump/flow_sp])}]
set ratio_tgt [join [split [hval ${tc_root}/pump/ratio_sp] /] ,]
set cmd "RAMP:0,${flow_tgt},${ratio_tgt},0,0,0,0,0,0,0,0,3"
sct pumping 1
set data ${par}
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
%%}
code volume_checkpumping = {%%
set cmd "@@NOSEND@@"
set nextState idle
if { [hpropexists [sct] pumping] && [sct pumping] } {
if { [hpropexists [sct] driving] && [sct driving] } {
volume_checkstatus "${tc_root}"
}
set sp "[sct target]"
set pv "[hval ${tc_root}/[sct driveable]]"
if { (${sp} - ${pv}) <= [sct tolerance] } {
set flow_tgt 0
set ratio_tgt [join [split [hval ${tc_root}/pump/ratio_sp] /] ,]
set cmd "RAMP:0,${flow_tgt},${ratio_tgt},0,0,0,0,0,0,0,0,2"
set nextState noResponse
sct driving 0
sct pumping 0
}
}
%%}
code volume_halt = {%%
set flow_tgt 0
set ratio_tgt [join [split [hval ${tc_root}/pump/ratio_sp] /] ,]
set cmd "RAMP:0,${flow_tgt},${ratio_tgt},0,0,0,0,0,0,0,0,2"
sct send ${cmd}
%%}
code volume_reject = {%%
sct geterror "cannot use hset on [sct]"
error "[sct geterror]"
%%}
}

View File

@ -27,8 +27,8 @@ proc ::scobj::green_magnet_labview::sics_log {debug_level debug_string} {
} catch_message ]
}
proc ::scobj::green_magnet_labview::mkDriver { sct_controller name ip_address tcp_port } {
::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}"
proc ::scobj::green_magnet_labview::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]"
set catch_status [ catch {
@ -46,21 +46,27 @@ proc ::scobj::green_magnet_labview::mkDriver { sct_controller name ip_address tc
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::green_magnet_labview::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::sics_log 9 "No sctcontroller for green_magnet_labview"
::scobj::green_magnet_labview::sics_log 1 "::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::green_magnet_labview {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_green_magnet_labview {name ip_address tcp_port} {
set catch_status [ catch {
::scobj::green_magnet_labview::sics_log 9 "add_green_magnet_labview ${name} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::sics_log 9 "No sctcontroller for green_magnet_labview"
::scobj::green_magnet_labview::sics_log 1 "::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::green_magnet_labview::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
}
clientput "file evaluation of green_magnet_labview_sct.tcl"
@ -71,6 +77,8 @@ proc ::scobj::green_magnet_labview::read_config {} {
set ns "::scobj::green_magnet_labview"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
@ -78,6 +86,12 @@ proc ::scobj::green_magnet_labview::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
@ -88,9 +102,9 @@ proc ::scobj::green_magnet_labview::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "green_magnet_labview"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -117,9 +131,9 @@ proc ::scobj::green_magnet_labview::read_config {} {
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_green_magnet_labview ${name} ${ip_address} ${tcp_port}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
add_green_magnet_labview ${name} "aqadapter" ${asyncqueue}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
}
}

View File

@ -3,8 +3,8 @@
#
driver nhq_200 = {
vendor = FastComTech; device = NHQ; protocol = std;
class = environment;
simulation_group = environment_simulation;
class = NXdetector;
simulation_group = detector_simulation;
group = {
readable = 10;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
driver lakeshore_218 = {
vendor = lakeshore; device = ls218; protocol = std;
class = environment; simulation_group = environment_simulation;
class = NXdetector; simulation_group = detector_simulation;
group = {
data = false;

View File

@ -1,15 +1,15 @@
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
driver lakeshore_m370 = {
protocol = std
sobj_priv_type = 'user float'
sobj_priv_type = 'user none'
class = environment
simulation_group = environment_simulation
add_args = 'id tol'
make_args = 'id tol'
code mkDriver = {%%
::scobj::lakeshore_370::mk_sct_driver $sct_controller environment $name $tol
hsetprop ${scobj_hpath}/setpoint permlink data_set T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/setpoint @description T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/Loop1/setpoint permlink data_set T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/Loop1/setpoint @description T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/Sensor/value permlink data_set T[format "%02d" ${id}]S01
hsetprop ${scobj_hpath}/Sensor/value @description T[format "%02d" ${id}]S01
%%}

View File

@ -27,24 +27,23 @@ proc ::scobj::lakeshore_m370::sics_log {debug_level debug_string} {
} catch_message ]
}
proc ::scobj::lakeshore_m370::mkDriver { sct_controller name ip_address tcp_port id tol } {
::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${tol}"
proc ::scobj::lakeshore_m370::mkDriver { sct_controller name id tol} {
::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${id} ${tol}"
set ns "[namespace current]"
set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float
MakeSICSObj ${name} SCT_OBJECT user none
sicslist setatt ${name} klass environment
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts
::scobj::lakeshore_370::mk_sct_driver $sct_controller environment $name $tol
hsetprop ${scobj_hpath}/setpoint permlink data_set T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/setpoint @description T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/Loop1/setpoint permlink data_set T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/Loop1/setpoint @description T[format "%02d" ${id}]SP01
hsetprop ${scobj_hpath}/Sensor/value permlink data_set T[format "%02d" ${id}]S01
hsetprop ${scobj_hpath}/Sensor/value @description T[format "%02d" ${id}]S01
# mkDriver hook code ends
@ -59,24 +58,24 @@ namespace eval ::scobj::lakeshore_m370 {
namespace export mkDriver
}
proc add_lakeshore_m370 {name ip_address tcp_port id tol} {
proc add_lakeshore_m370 {name IP port id tol} {
set catch_status [ catch {
::scobj::lakeshore_m370::sics_log 9 "add_lakeshore_m370 ${name} ${ip_address} ${tcp_port} ${id} ${tol}"
::scobj::lakeshore_m370::sics_log 9 "add_lakeshore_m370 ${name} ${IP} ${port} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
} else {
::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${port}
}
} else {
::scobj::lakeshore_m370::sics_log 9 "[environment_simulation] => Null sctcontroller for lakeshore_m370"
::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
}
::scobj::lakeshore_m370::sics_log 1 "::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}"
::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}
::scobj::lakeshore_m370::sics_log 1 "::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${id} ${tol}"
::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${id} ${tol}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
@ -87,20 +86,29 @@ clientput "file evaluation of lakeshore_m370_sct.tcl"
proc ::scobj::lakeshore_m370::read_config {} {
set catch_status [ catch {
set ns "::scobj::lakeshore_m370"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
continue
}
set enabled [string tolower [dict get $u "enabled"]]
set enabled [string tolower [dict get $v "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
set name [dict get $v name]
set implementation [dict get $v "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set arg_list [list]
foreach arg {id} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
@ -112,8 +120,8 @@ proc ::scobj::lakeshore_m370::read_config {} {
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
set IP [dict get $v ip]
set PORT [dict get $v port]
}
} else {
if { [dict exists $v "asyncprotocol"] } {
@ -127,30 +135,23 @@ proc ::scobj::lakeshore_m370::read_config {} {
}
}
set asyncqueue ${name}_queue
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
foreach arg {tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
error "Missing configuration value $arg"
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_lakeshore_m370 ${name} ${ip_address} ${tcp_port} {*}$arg_list
add_lakeshore_m370 ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_lakeshore_m370 ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}

View File

@ -989,6 +989,8 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
set sensorValue $tc_root/sensor/sensorValue$whichSensor
if {$whichCtrlLoop <= 2} {
set nodename $tc_root/sensor/setpoint$whichCtrlLoop
hset $tc_root/control/tolerance1 1
hset $tc_root/control/tolerance2 1
hset $nodename [hval $sensorValue]
hsetprop $nodename driving 0
}

View File

@ -0,0 +1,459 @@
# Generated driver for srs_sr630
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::srs_sr630 {
set debug_threshold 5
}
proc ::scobj::srs_sr630::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/srs_sr630_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
}
} catch_message ]
}
proc ::scobj::srs_sr630::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::srs_sr630::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::srs_sr630::${debug_string}"
}
} catch_message ]
}
# check function for hset change
proc ::scobj::srs_sr630::checkrange {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
# checkrange hook code goes here
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to request the read of a parameter on a device
proc ::scobj::srs_sr630::fetch_id {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "fetch_id tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# fetch_id hook code starts
if {[hval [sct]] == "UNKNOWN"} {
set cmd "[clock format [clock seconds] -format "DATE %m,%d,%Y;TIME %H,%M,%S;*IDN?"]"
} else {
set cmd "*IDN?"
}
# fetch_id hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
debug_log ${tc_root} 1 "fetch_id sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to request the read of a parameter on a device
proc ::scobj::srs_sr630::getSensor {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "getSensor tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# getSensor hook code starts
set cmd "UNIT ${cmd_str},ABS;MEAS? ${cmd_str}"
# getSensor hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
debug_log ${tc_root} 1 "getSensor sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to check the write parameter on a device
proc ::scobj::srs_sr630::noResponse {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
# noResponse hook code goes here
return "idle"
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::srs_sr630::readSensor {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "readSensor tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# readSensor hook code goes here
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::srs_sr630::read_id {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "read_id tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# read_id hook code goes here
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to write a parameter value on a device
proc ::scobj::srs_sr630::setValue {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# setValue hook code goes here
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log ${tc_root} 1 "setValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::srs_sr630::sics_log 9 "::scobj::srs_sr630::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]"
set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/id plain user text
hsetprop ${scobj_hpath}/id read ${ns}::fetch_id ${scobj_hpath} read_id {@}
hsetprop ${scobj_hpath}/id read_id ${ns}::read_id ${scobj_hpath}
hsetprop ${scobj_hpath}/id control true
hsetprop ${scobj_hpath}/id data true
hsetprop ${scobj_hpath}/id mutable true
hsetprop ${scobj_hpath}/id nxsave true
hsetprop ${scobj_hpath}/id oldval UNKNOWN
hset ${scobj_hpath}/id UNKNOWN
hsetprop ${scobj_hpath}/id klass "parameter"
hsetprop ${scobj_hpath}/id sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/id type "part"
hsetprop ${scobj_hpath}/id nxalias "${name}_id"
hfactory ${scobj_hpath}/sensor_01 plain user float
hsetprop ${scobj_hpath}/sensor_01 read ${ns}::getSensor ${scobj_hpath} readSensor {1}
hsetprop ${scobj_hpath}/sensor_01 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_01 control true
hsetprop ${scobj_hpath}/sensor_01 data true
hsetprop ${scobj_hpath}/sensor_01 mutable true
hsetprop ${scobj_hpath}/sensor_01 nxsave true
hsetprop ${scobj_hpath}/sensor_01 oldval 0.0
hsetprop ${scobj_hpath}/sensor_01 klass "parameter"
hsetprop ${scobj_hpath}/sensor_01 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_01 type "part"
hsetprop ${scobj_hpath}/sensor_01 nxalias "${name}_sensor_01"
hfactory ${scobj_hpath}/sensor_02 plain user float
hsetprop ${scobj_hpath}/sensor_02 read ${ns}::getSensor ${scobj_hpath} readSensor {2}
hsetprop ${scobj_hpath}/sensor_02 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_02 control true
hsetprop ${scobj_hpath}/sensor_02 data true
hsetprop ${scobj_hpath}/sensor_02 mutable true
hsetprop ${scobj_hpath}/sensor_02 nxsave true
hsetprop ${scobj_hpath}/sensor_02 oldval 0.0
hsetprop ${scobj_hpath}/sensor_02 klass "parameter"
hsetprop ${scobj_hpath}/sensor_02 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_02 type "part"
hsetprop ${scobj_hpath}/sensor_02 nxalias "${name}_sensor_02"
hfactory ${scobj_hpath}/sensor_03 plain user float
hsetprop ${scobj_hpath}/sensor_03 read ${ns}::getSensor ${scobj_hpath} readSensor {3}
hsetprop ${scobj_hpath}/sensor_03 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_03 control true
hsetprop ${scobj_hpath}/sensor_03 data true
hsetprop ${scobj_hpath}/sensor_03 mutable true
hsetprop ${scobj_hpath}/sensor_03 nxsave true
hsetprop ${scobj_hpath}/sensor_03 oldval 0.0
hsetprop ${scobj_hpath}/sensor_03 klass "parameter"
hsetprop ${scobj_hpath}/sensor_03 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_03 type "part"
hsetprop ${scobj_hpath}/sensor_03 nxalias "${name}_sensor_03"
hfactory ${scobj_hpath}/sensor_04 plain user float
hsetprop ${scobj_hpath}/sensor_04 read ${ns}::getSensor ${scobj_hpath} readSensor {4}
hsetprop ${scobj_hpath}/sensor_04 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_04 control true
hsetprop ${scobj_hpath}/sensor_04 data true
hsetprop ${scobj_hpath}/sensor_04 mutable true
hsetprop ${scobj_hpath}/sensor_04 nxsave true
hsetprop ${scobj_hpath}/sensor_04 oldval 0.0
hsetprop ${scobj_hpath}/sensor_04 klass "parameter"
hsetprop ${scobj_hpath}/sensor_04 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_04 type "part"
hsetprop ${scobj_hpath}/sensor_04 nxalias "${name}_sensor_04"
hfactory ${scobj_hpath}/sensor_05 plain user float
hsetprop ${scobj_hpath}/sensor_05 read ${ns}::getSensor ${scobj_hpath} readSensor {5}
hsetprop ${scobj_hpath}/sensor_05 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_05 control true
hsetprop ${scobj_hpath}/sensor_05 data true
hsetprop ${scobj_hpath}/sensor_05 mutable true
hsetprop ${scobj_hpath}/sensor_05 nxsave true
hsetprop ${scobj_hpath}/sensor_05 oldval 0.0
hsetprop ${scobj_hpath}/sensor_05 klass "parameter"
hsetprop ${scobj_hpath}/sensor_05 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_05 type "part"
hsetprop ${scobj_hpath}/sensor_05 nxalias "${name}_sensor_05"
hfactory ${scobj_hpath}/sensor_06 plain user float
hsetprop ${scobj_hpath}/sensor_06 read ${ns}::getSensor ${scobj_hpath} readSensor {6}
hsetprop ${scobj_hpath}/sensor_06 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_06 control true
hsetprop ${scobj_hpath}/sensor_06 data true
hsetprop ${scobj_hpath}/sensor_06 mutable true
hsetprop ${scobj_hpath}/sensor_06 nxsave true
hsetprop ${scobj_hpath}/sensor_06 oldval 0.0
hsetprop ${scobj_hpath}/sensor_06 klass "parameter"
hsetprop ${scobj_hpath}/sensor_06 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_06 type "part"
hsetprop ${scobj_hpath}/sensor_06 nxalias "${name}_sensor_06"
hfactory ${scobj_hpath}/sensor_07 plain user float
hsetprop ${scobj_hpath}/sensor_07 read ${ns}::getSensor ${scobj_hpath} readSensor {7}
hsetprop ${scobj_hpath}/sensor_07 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_07 control true
hsetprop ${scobj_hpath}/sensor_07 data true
hsetprop ${scobj_hpath}/sensor_07 mutable true
hsetprop ${scobj_hpath}/sensor_07 nxsave true
hsetprop ${scobj_hpath}/sensor_07 oldval 0.0
hsetprop ${scobj_hpath}/sensor_07 klass "parameter"
hsetprop ${scobj_hpath}/sensor_07 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_07 type "part"
hsetprop ${scobj_hpath}/sensor_07 nxalias "${name}_sensor_07"
hfactory ${scobj_hpath}/sensor_08 plain user float
hsetprop ${scobj_hpath}/sensor_08 read ${ns}::getSensor ${scobj_hpath} readSensor {8}
hsetprop ${scobj_hpath}/sensor_08 readSensor ${ns}::readSensor ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor_08 control true
hsetprop ${scobj_hpath}/sensor_08 data true
hsetprop ${scobj_hpath}/sensor_08 mutable true
hsetprop ${scobj_hpath}/sensor_08 nxsave true
hsetprop ${scobj_hpath}/sensor_08 oldval 0.0
hsetprop ${scobj_hpath}/sensor_08 klass "parameter"
hsetprop ${scobj_hpath}/sensor_08 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor_08 type "part"
hsetprop ${scobj_hpath}/sensor_08 nxalias "${name}_sensor_08"
hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/id 600
${sct_controller} poll ${scobj_hpath}/sensor_01 60
${sct_controller} poll ${scobj_hpath}/sensor_02 600
${sct_controller} poll ${scobj_hpath}/sensor_03 600
${sct_controller} poll ${scobj_hpath}/sensor_04 600
${sct_controller} poll ${scobj_hpath}/sensor_05 600
${sct_controller} poll ${scobj_hpath}/sensor_06 600
${sct_controller} poll ${scobj_hpath}/sensor_07 600
${sct_controller} poll ${scobj_hpath}/sensor_08 600
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
}
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::srs_sr630::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::srs_sr630::sics_log 9 "::scobj::srs_sr630::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for srs_sr630"
}
::scobj::srs_sr630::sics_log 1 "::scobj::srs_sr630::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::srs_sr630::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::srs_sr630 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_srs_sr630 {name ip_address tcp_port} {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::srs_sr630::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port}
}
clientput "file evaluation of sct_srs_sr630.tcl"
::scobj::srs_sr630::sics_log 9 "file evaluation of sct_srs_sr630.tcl"
proc ::scobj::srs_sr630::read_config {} {
set catch_status [ catch {
set ns "::scobj::srs_sr630"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
set device_class "NXdetector"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
}
if { [string equal -nocase [dict get $v "driver"] "srs_sr630"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
}
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::srs_sr630::read_config
} else {
::scobj::srs_sr630::sics_log 5 "No config dict"
}

View File

@ -0,0 +1,604 @@
# Generated driver for west_6100
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::west_6100 {
set debug_threshold 5
}
proc ::scobj::west_6100::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/west_6100_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
}
} catch_message ]
}
proc ::scobj::west_6100::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::west_6100::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::west_6100::${debug_string}"
}
} catch_message ]
}
# check function for hset change
proc ::scobj::west_6100::checkrange {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
# checkrange hook code goes here
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to request the read of a parameter on a device
proc ::scobj::west_6100::getDecimal {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "getDecimal tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# getDecimal hook code starts
set cmd "1:3:${cmd_str}:1:U16"
# getDecimal hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
debug_log ${tc_root} 1 "getDecimal sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to request the read of a parameter on a device
proc ::scobj::west_6100::getInteger {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "getInteger tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# getInteger hook code starts
set cmd "1:3:${cmd_str}:1:U16"
# getInteger hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
debug_log ${tc_root} 1 "getInteger sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to check the write parameter on a device
proc ::scobj::west_6100::noResponse {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
# noResponse hook code goes here
return "idle"
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::west_6100::rdDecimal {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "rdDecimal tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# rdDecimal hook code starts
set decimal [hval ${tc_root}/aux/decimal]
if { ${decimal} > 0 } {
set data [expr {pow(10, -${decimal}) * ${data}}]
}
# rdDecimal hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::west_6100::rdInteger {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "rdInteger tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# rdInteger hook code goes here
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to write a parameter value on a device
proc ::scobj::west_6100::setValue {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# setValue hook code goes here
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log ${tc_root} 1 "setValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to write a parameter value on a device
proc ::scobj::west_6100::wrDecimal {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "wrDecimal tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# wrDecimal hook code starts
set decimal [hval ${tc_root}/aux/decimal]
set par [sct target]
if { ${decimal} > 0 } {
set par [expr {pow(10, ${decimal}) * ${par}}]
}
set par [expr {round(${par})}]
set cmd "1:16:${cmd_str}:1:U16:${par}"
# wrDecimal hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log ${tc_root} 1 "wrDecimal sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to write a parameter value on a device
proc ::scobj::west_6100::wrInteger {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "wrInteger tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# wrInteger hook code starts
set cmd "1:16:${cmd_str}:1:U16:${par}"
# wrInteger hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log ${tc_root} 1 "wrInteger sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
set ns "[namespace current]"
set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/alarm1 plain user float
hsetprop ${scobj_hpath}/alarm1 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {13}
hsetprop ${scobj_hpath}/alarm1 rdDecimal ${ns}::rdDecimal ${scobj_hpath}
hsetprop ${scobj_hpath}/alarm1 write ${ns}::wrDecimal ${scobj_hpath} noResponse {13}
hsetprop ${scobj_hpath}/alarm1 noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/alarm1 check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/alarm1 control true
hsetprop ${scobj_hpath}/alarm1 data true
hsetprop ${scobj_hpath}/alarm1 mutable true
hsetprop ${scobj_hpath}/alarm1 nxsave true
hsetprop ${scobj_hpath}/alarm1 oldval 0.0
hsetprop ${scobj_hpath}/alarm1 klass "parameter"
hsetprop ${scobj_hpath}/alarm1 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/alarm1 type "part"
hsetprop ${scobj_hpath}/alarm1 nxalias "${name}_alarm1"
hfactory ${scobj_hpath}/alarm2 plain user float
hsetprop ${scobj_hpath}/alarm2 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {14}
hsetprop ${scobj_hpath}/alarm2 rdDecimal ${ns}::rdDecimal ${scobj_hpath}
hsetprop ${scobj_hpath}/alarm2 write ${ns}::wrDecimal ${scobj_hpath} noResponse {14}
hsetprop ${scobj_hpath}/alarm2 noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/alarm2 check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/alarm2 control true
hsetprop ${scobj_hpath}/alarm2 data true
hsetprop ${scobj_hpath}/alarm2 mutable true
hsetprop ${scobj_hpath}/alarm2 nxsave true
hsetprop ${scobj_hpath}/alarm2 oldval 0.0
hsetprop ${scobj_hpath}/alarm2 klass "parameter"
hsetprop ${scobj_hpath}/alarm2 sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/alarm2 type "part"
hsetprop ${scobj_hpath}/alarm2 nxalias "${name}_alarm2"
hfactory ${scobj_hpath}/power plain user int
hsetprop ${scobj_hpath}/power read ${ns}::getInteger ${scobj_hpath} rdInteger {3}
hsetprop ${scobj_hpath}/power rdInteger ${ns}::rdInteger ${scobj_hpath}
hsetprop ${scobj_hpath}/power control true
hsetprop ${scobj_hpath}/power data true
hsetprop ${scobj_hpath}/power mutable true
hsetprop ${scobj_hpath}/power nxsave true
hsetprop ${scobj_hpath}/power oldval 0
hsetprop ${scobj_hpath}/power klass "parameter"
hsetprop ${scobj_hpath}/power sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/power type "part"
hsetprop ${scobj_hpath}/power nxalias "${name}_power"
hfactory ${scobj_hpath}/powermax plain user int
hsetprop ${scobj_hpath}/powermax read ${ns}::getInteger ${scobj_hpath} rdInteger {20}
hsetprop ${scobj_hpath}/powermax rdInteger ${ns}::rdInteger ${scobj_hpath}
hsetprop ${scobj_hpath}/powermax write ${ns}::wrInteger ${scobj_hpath} noResponse {20}
hsetprop ${scobj_hpath}/powermax noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/powermax check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/powermax control true
hsetprop ${scobj_hpath}/powermax data true
hsetprop ${scobj_hpath}/powermax mutable true
hsetprop ${scobj_hpath}/powermax nxsave true
hsetprop ${scobj_hpath}/powermax oldval 0
hsetprop ${scobj_hpath}/powermax klass "parameter"
hsetprop ${scobj_hpath}/powermax sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/powermax type "part"
hsetprop ${scobj_hpath}/powermax nxalias "${name}_powermax"
hfactory ${scobj_hpath}/ramprate plain user float
hsetprop ${scobj_hpath}/ramprate read ${ns}::getDecimal ${scobj_hpath} rdDecimal {24}
hsetprop ${scobj_hpath}/ramprate rdDecimal ${ns}::rdDecimal ${scobj_hpath}
hsetprop ${scobj_hpath}/ramprate write ${ns}::wrDecimal ${scobj_hpath} noResponse {24}
hsetprop ${scobj_hpath}/ramprate noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ramprate check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ramprate control true
hsetprop ${scobj_hpath}/ramprate data true
hsetprop ${scobj_hpath}/ramprate mutable true
hsetprop ${scobj_hpath}/ramprate nxsave true
hsetprop ${scobj_hpath}/ramprate oldval 0.0
hsetprop ${scobj_hpath}/ramprate klass "parameter"
hsetprop ${scobj_hpath}/ramprate sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ramprate type "part"
hsetprop ${scobj_hpath}/ramprate nxalias "${name}_ramprate"
hfactory ${scobj_hpath}/sensor plain user float
hsetprop ${scobj_hpath}/sensor read ${ns}::getDecimal ${scobj_hpath} rdDecimal {1}
hsetprop ${scobj_hpath}/sensor rdDecimal ${ns}::rdDecimal ${scobj_hpath}
hsetprop ${scobj_hpath}/sensor control true
hsetprop ${scobj_hpath}/sensor data true
hsetprop ${scobj_hpath}/sensor mutable true
hsetprop ${scobj_hpath}/sensor nxsave true
hsetprop ${scobj_hpath}/sensor oldval 0.0
hsetprop ${scobj_hpath}/sensor klass "parameter"
hsetprop ${scobj_hpath}/sensor sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/sensor type "part"
hsetprop ${scobj_hpath}/sensor nxalias "${name}_sensor"
hfactory ${scobj_hpath}/setpoint plain user float
hsetprop ${scobj_hpath}/setpoint read ${ns}::getDecimal ${scobj_hpath} rdDecimal {2}
hsetprop ${scobj_hpath}/setpoint rdDecimal ${ns}::rdDecimal ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint write ${ns}::wrDecimal ${scobj_hpath} noResponse {2}
hsetprop ${scobj_hpath}/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint control true
hsetprop ${scobj_hpath}/setpoint data true
hsetprop ${scobj_hpath}/setpoint mutable true
hsetprop ${scobj_hpath}/setpoint nxsave true
hsetprop ${scobj_hpath}/setpoint oldval 0.0
hsetprop ${scobj_hpath}/setpoint klass "parameter"
hsetprop ${scobj_hpath}/setpoint sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/setpoint type "part"
hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint"
hfactory ${scobj_hpath}/w_sp plain user float
hsetprop ${scobj_hpath}/w_sp read ${ns}::getDecimal ${scobj_hpath} rdDecimal {21}
hsetprop ${scobj_hpath}/w_sp rdDecimal ${ns}::rdDecimal ${scobj_hpath}
hsetprop ${scobj_hpath}/w_sp write ${ns}::wrDecimal ${scobj_hpath} noResponse {21}
hsetprop ${scobj_hpath}/w_sp noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/w_sp check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/w_sp control true
hsetprop ${scobj_hpath}/w_sp data true
hsetprop ${scobj_hpath}/w_sp mutable true
hsetprop ${scobj_hpath}/w_sp nxsave true
hsetprop ${scobj_hpath}/w_sp oldval 0.0
hsetprop ${scobj_hpath}/w_sp klass "parameter"
hsetprop ${scobj_hpath}/w_sp sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/w_sp type "part"
hsetprop ${scobj_hpath}/w_sp nxalias "${name}_w_sp"
hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/alarm1 1
${sct_controller} poll ${scobj_hpath}/alarm2 1
${sct_controller} poll ${scobj_hpath}/power 1
${sct_controller} poll ${scobj_hpath}/powermax 1
${sct_controller} poll ${scobj_hpath}/ramprate 1
${sct_controller} poll ${scobj_hpath}/sensor 1
${sct_controller} poll ${scobj_hpath}/setpoint 1
${sct_controller} poll ${scobj_hpath}/w_sp 1
${sct_controller} write ${scobj_hpath}/alarm1
${sct_controller} write ${scobj_hpath}/alarm2
${sct_controller} write ${scobj_hpath}/powermax
${sct_controller} write ${scobj_hpath}/ramprate
${sct_controller} write ${scobj_hpath}/setpoint
${sct_controller} write ${scobj_hpath}/w_sp
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
}
hfactory ${scobj_hpath}/aux plain spy none
hsetprop ${scobj_hpath}/aux data "false"
hsetprop ${scobj_hpath}/aux klass "@none"
hsetprop ${scobj_hpath}/aux type "part"
hfactory ${scobj_hpath}/aux/decimal plain user int
hsetprop ${scobj_hpath}/aux/decimal read ${ns}::getInteger ${scobj_hpath} rdInteger {18}
hsetprop ${scobj_hpath}/aux/decimal rdInteger ${ns}::rdInteger ${scobj_hpath}
hsetprop ${scobj_hpath}/aux/decimal control false
hsetprop ${scobj_hpath}/aux/decimal data false
hsetprop ${scobj_hpath}/aux/decimal mutable false
hsetprop ${scobj_hpath}/aux/decimal nxsave false
hsetprop ${scobj_hpath}/aux/decimal oldval 0
hset ${scobj_hpath}/aux/decimal 0
hsetprop ${scobj_hpath}/aux/decimal sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/aux/decimal type "part"
hsetprop ${scobj_hpath}/aux/decimal nxalias "${name}_aux_decimal"
hfactory ${scobj_hpath}/aux/instatus plain user int
hsetprop ${scobj_hpath}/aux/instatus read ${ns}::getInteger ${scobj_hpath} rdInteger {133}
hsetprop ${scobj_hpath}/aux/instatus rdInteger ${ns}::rdInteger ${scobj_hpath}
hsetprop ${scobj_hpath}/aux/instatus control false
hsetprop ${scobj_hpath}/aux/instatus data false
hsetprop ${scobj_hpath}/aux/instatus mutable false
hsetprop ${scobj_hpath}/aux/instatus nxsave false
hsetprop ${scobj_hpath}/aux/instatus oldval 0
hsetprop ${scobj_hpath}/aux/instatus sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/aux/instatus type "part"
hsetprop ${scobj_hpath}/aux/instatus nxalias "${name}_aux_instatus"
hfactory ${scobj_hpath}/aux/model plain user int
hsetprop ${scobj_hpath}/aux/model read ${ns}::getInteger ${scobj_hpath} rdInteger {122}
hsetprop ${scobj_hpath}/aux/model rdInteger ${ns}::rdInteger ${scobj_hpath}
hsetprop ${scobj_hpath}/aux/model control false
hsetprop ${scobj_hpath}/aux/model data false
hsetprop ${scobj_hpath}/aux/model mutable false
hsetprop ${scobj_hpath}/aux/model nxsave false
hsetprop ${scobj_hpath}/aux/model oldval 0
hsetprop ${scobj_hpath}/aux/model sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/aux/model type "part"
hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/aux/decimal 2
${sct_controller} poll ${scobj_hpath}/aux/instatus 2
${sct_controller} poll ${scobj_hpath}/aux/model 2
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
}
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} {
set catch_status [ catch {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
}
} else {
::scobj::west_6100::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for west_6100"
}
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::west_6100 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_west_6100 {name ip_address tcp_port dev_id} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}"
}
clientput "file evaluation of sct_west_6100.tcl"
::scobj::west_6100::sics_log 9 "file evaluation of sct_west_6100.tcl"
proc ::scobj::west_6100::read_config {} {
set catch_status [ catch {
set ns "::scobj::west_6100"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
}
if { [string equal -nocase [dict get $v "driver"] "west_6100"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
}
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {dev_id} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::west_6100::read_config
} else {
::scobj::west_6100::sics_log 5 "No config dict"
}

View File

@ -0,0 +1,45 @@
# Stanford Research Systems SR630 Thermocouple Monitor
# vim: ts=8 sts=2 sw=2 expandtab nocindent autoindent smartindent
driver srs_sr630 = {
vendor = StanfordResearchSystems; device=SR630;
protocol = std;
class = NXdetector;
simulation_group = detector_simulation;
group = {
priv = user;
var id = {
readable = 600;
type = text;
fetch_function = fetch_id;
read_function = read_id;
read_command = "@";
value = "UNKNOWN";
}
type = float;
fetch_function = getSensor;
read_function = readSensor;
var sensor_01 = { readable = 60; read_command = "1"; }
var sensor_02 = { readable = 600; read_command = "2"; }
var sensor_03 = { readable = 600; read_command = "3"; }
var sensor_04 = { readable = 600; read_command = "4"; }
var sensor_05 = { readable = 600; read_command = "5"; }
var sensor_06 = { readable = 600; read_command = "6"; }
var sensor_07 = { readable = 600; read_command = "7"; }
var sensor_08 = { readable = 600; read_command = "8"; }
}
code fetch_id = {%%
if {[hval [sct]] == "UNKNOWN"} {
set cmd "[clock format [clock seconds] -format "DATE %m,%d,%Y;TIME %H,%M,%S;*IDN?"]"
} else {
set cmd "*IDN?"
}
%%}
code read_id = {%%
%%}
code getSensor = {%%
set cmd "UNIT ${cmd_str},ABS;MEAS? ${cmd_str}"
%%}
code readSensor = {%%
%%}
}

View File

@ -27,8 +27,8 @@ proc ::scobj::west4100::sics_log {debug_level debug_string} {
} catch_message ]
}
proc ::scobj::west4100::mkDriver { sct_controller name ip_address tcp_port dev_id } {
::scobj::west4100::sics_log 9 "::scobj::west4100::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${dev_id}"
proc ::scobj::west4100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } {
::scobj::west4100::sics_log 9 "::scobj::west4100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
set ns "[namespace current]"
set catch_status [ catch {
@ -39,21 +39,27 @@ proc ::scobj::west4100::mkDriver { sct_controller name ip_address tcp_port dev_i
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west4100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} {
set catch_status [ catch {
::scobj::west4100::sics_log 9 "::scobj::west4100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::sics_log 9 "No sctcontroller for west4100"
::scobj::west4100::sics_log 1 "::scobj::west4100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::west4100 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_west4100 {name ip_address tcp_port dev_id} {
set catch_status [ catch {
::scobj::west4100::sics_log 9 "add_west4100 ${name} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::sics_log 9 "No sctcontroller for west4100"
::scobj::west4100::sics_log 1 "::scobj::west4100::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west4100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}"
}
clientput "file evaluation of west4100_sct.tcl"
@ -64,6 +70,8 @@ proc ::scobj::west4100::read_config {} {
set ns "::scobj::west4100"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
@ -71,6 +79,12 @@ proc ::scobj::west4100::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
@ -81,9 +95,9 @@ proc ::scobj::west4100::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "west4100"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -125,9 +139,9 @@ proc ::scobj::west4100::read_config {} {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_west4100 ${name} ${ip_address} ${tcp_port} {*}$arg_list
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else {
add_west4100 ${name} "aqadapter" ${asyncqueue} {*}$arg_list
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}

View File

@ -34,7 +34,7 @@ driver west_6100 = {
fetch_function = getInteger;
read_function = rdInteger;
var model = { type = int; read_command = "122"; }
var decimal = { type = int; read_command = "18"; }
var decimal = { type = int; read_command = "18"; value = 0; }
var instatus = { type = int; read_command = "133"; }
}
code fetch_function getInteger = {
@ -59,12 +59,20 @@ driver west_6100 = {
}
code read_function rdDecimal = {
@TCL
set data [expr {0.10 * ${data}}]
set decimal [hval ${tc_root}/aux/decimal]
if { ${decimal} > 0 } {
set data [expr {pow(10, -${decimal}) * ${data}}]
}
@END
}
code write_function wrDecimal = {
@TCL
set par [expr {round(10.0 * [sct target])}]
set decimal [hval ${tc_root}/aux/decimal]
set par [sct target]
if { ${decimal} > 0 } {
set par [expr {pow(10, ${decimal}) * ${par}}]
}
set par [expr {round(${par})}]
set cmd "1:16:${cmd_str}:1:U16:${par}"
@END
}

View File

@ -0,0 +1,15 @@
# Simple driver generator for the Epson Pick and Place Robots
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent
driver epson_pandp = {
vendor = Epson; device = 'Pick and Place Robot'; protocol = std;
class = environment;
simulation_group = environment_simulation;
add_args = "robot_name"
make_args = "robot_name"
wrapper_property nosctcontroller = True;
code mkWrapper = {%%
clientput "add_robot ${robot_name} ${ip_address} ${tcp_port}"
add_robot ${robot_name} ${ip_address} ${tcp_port}
%%}
}

View File

@ -0,0 +1,158 @@
# Generated driver for epson_pandp
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::epson_pandp {
set debug_threshold 5
}
proc ::scobj::epson_pandp::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/epson_pandp_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
}
} catch_message ]
}
proc ::scobj::epson_pandp::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::epson_pandp::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::epson_pandp::${debug_string}"
}
} catch_message ]
}
proc ::scobj::epson_pandp::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port robot_name } {
::scobj::epson_pandp::sics_log 9 "::scobj::epson_pandp::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}"
set ns "[namespace current]"
set catch_status [ catch {
# mkWrapper hook code starts
clientput "add_robot ${robot_name} ${ip_address} ${tcp_port}"
add_robot ${robot_name} ${ip_address} ${tcp_port}
# mkWrapper hook code ends
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::epson_pandp::add_driver {name device_class simulation_flag ip_address tcp_port robot_name} {
set catch_status [ catch {
::scobj::epson_pandp::sics_log 9 "::scobj::epson_pandp::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}"
::scobj::epson_pandp::sics_log 9 "No sctcontroller for epson_pandp"
::scobj::epson_pandp::sics_log 1 "::scobj::epson_pandp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}"
::scobj::epson_pandp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::epson_pandp {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_epson_pandp {name ip_address tcp_port robot_name} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::epson_pandp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${robot_name}"
}
clientput "file evaluation of sct_epson_pandp.tcl"
::scobj::epson_pandp::sics_log 9 "file evaluation of sct_epson_pandp.tcl"
proc ::scobj::epson_pandp::read_config {} {
set catch_status [ catch {
set ns "::scobj::epson_pandp"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
}
if { [string equal -nocase [dict get $v "driver"] "epson_pandp"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
}
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {robot_name} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::epson_pandp::read_config
} else {
::scobj::epson_pandp::sics_log 5 "No config dict"
}

View File

@ -247,6 +247,10 @@ cat PATCH.TXT > $TEMPDIR/$DESTDIR/${NEWSERVER}/PATCH.TXT
fi
cat $SRCDIR/MANIFEST.TXT $SRCDIR/$INSTSRC/MANIFEST.TXT > $TEMPDIR/$DESTDIR/${NEWSERVER}/MANIFEST.TXT
# Strip the date and time from FILEMAP
echo sed -i $FILEMAP -e s/${NEWSERVER}/server/
sed -i $FILEMAP -e s/${NEWSERVER}/server/
cd $TEMPDIR
# remove any .svn directories
rm -rf $(find $TARDIR -type d -name .svn)

View File

@ -8,3 +8,4 @@ hostport_config.tcl
hostport_config_test.tcl
camtest_configuration.tcl
dingo.hdd
sics_simulation.tcl

View File

@ -199,6 +199,41 @@ dz softlowerlim 0
dz softupperlim 170
dz home 0
# mc1:H Sample rotation axis
# Resolver 2,048 counts per degree
# Motor 12,500 steps per degree
# Positive steps are CCW viewed from above
set soma_Home 9867748
#set somaStepRate [expr -$motorrate*100.0]
set somaStepRate 12500
Motor soma $motor_driver_type [params \
asyncqueue mc1\
host mc1-dingo\
port pmc1-dingo\
axis H\
units degree\
hardlowerlim -722\
hardupperlim 722\
maxSpeed 12\
maxAccel 1\
maxDecel 1\
stepsPerX $somaStepRate\
absEnc 1\
absEncHome $soma_Home\
nopowersave 1\
cntsPerX 2048 ]
soma speed 0.1
soma accel 0.1
soma decel 0.1
soma part sample
soma long_name soma
soma softlowerlim -1
soma softupperlim 361
soma home 0
#soma bias_bits 25
#soma rotary_bits 25
soma creep_offset 0.05
############################
# Motor Controller 2

View File

@ -1,8 +1,8 @@
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Author: Jing Chen (jgn@ansto.gov.au)
# Required by server_config.tcl
VarMake Instrument Text Internal
Instrument bare_dingo
Instrument dingo
Instrument lock
#START SERVER CONFIGURATION SECTION
@ -14,12 +14,46 @@ MakeDrive
########################################
# INSTRUMENT SPECIFIC CONFIGURATION
source $cfPath(hipadaba)/hipadaba_configuration.tcl
fileeval $cfPath(source)/source.tcl
fileeval $cfPath(plc)/plc.tcl
fileeval $cfPath(motors)/motor_configuration.tcl
#fileeval $cfPath(motors)/positmotor_configuration.tcl
#fileeval $cfPath(motors)/extraconfig.tcl
fileeval $cfPath(plc)/plc.tcl
#fileeval $cfPath(counter)/counter.tcl
#fileeval $cfPath(hmm)/hmm_configuration.tcl
fileeval $cfPath(nexus)/nxscripts.tcl
fileeval $cfPath(scan)/scan.tcl
fileeval $cfPath(commands)/commands.tcl
#fileeval $cfPath(commands)/pulser.tcl
#fileeval $cfPath(commands)/hvcommands.tcl
fileeval $cfPath(anticollider)/anticollider.tcl
source gumxml.tcl
#::utility::mkVar ::anticollider::protect_detector text manager protect_detector false detector true false
#::anticollider::protect_detector "true"
# fix all motors
if {1} {
set motorlist "[sicslist type motor]"
puts $motorlist
foreach m $motorlist {
if {$m == "motor" || $m == "dummy_motor"} {
# skipit
} else {
$m fixed 1
}
}
}
server_init
exe batchpath ../batch
exe syspath ../batch
clientput "serverport [get_portnum $::serverport]"
###########################################
# WARNING: Do not add any code below server_init, if you do SICS may fail to initialise properly.
# You can add extra-configuration code in ../extraconfig.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation true true
detector_simulation true true
hmm_simulation true true
environment_simulation false false
counter_simulation true true
motor_simulation false false
chopper_simulation false true
velsel_simulation false true
plc_simulation true true
rfgen_simulation false true
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -7,3 +7,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -2,58 +2,6 @@
# AJS Dec 2010
# SetHistoSync: sets the histogram to receive $framenum worth of frames on receiving
# TTL pulse in frame sync input. Note: Framebuffer should be set to OFF for long runs
proc SetHistoSync {framenum} {
histmem stop
bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum
bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 }
fat_table -set NOS_PERIODS $framenum
oat_table -set T {0 2200000} NTC 1
histmem loadconf
histmem fsrce EXTERNAL
}
publish SetHistoSync user
# SetHistoNormal: resets the histo for standard operation
proc SetHistoNormal {} {
histmem stop
bat_table -set NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1
bat_table -set NO_REPEAT_ENTRY 0 NO_REPEAT_TABLE 0 NO_EXECUTE_TABLE 0 PERIOD_INDICES { 0}
fat_table -set NOS_PERIODS 1
oat_table -set T {0 2200000} NTC 1
oat_table -set Y {-0.5 3.5} NYC 128
histmem loadconf
histmem fsrce INTERNAL
proc ::histogram_memory::pre_count {} {}
}
publish SetHistoNormal user
proc SetHistoOneShot {frq framenum } {
histmem stop
oct speed 0.25
oct accel 0.25
oct decel 0.25
drive oct 0
bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum
bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 }
fat_table -set NOS_PERIODS $framenum
oat_table -set T {0 2200000} NTC 1
oat_table -set Y {-0.5 15.5} NYC 16
histmem freq $frq
histmem loadconf
histmem fsrce INTERNAL
histmem mode unlimited
}
publish SetHistoOneShot user
# continous scan for EPHI- the euler cradle phi stage (innermost axis)
# note make sure controller 2 has the PHISCAN code in it

View File

@ -0,0 +1,108 @@
#vactex
set currentoct 0
set somdir 1
set somstart 0
set somend 0
set octrange 0
proc SetUpVacTex {_somstart _somend} {
global currentoct somdir somstart somend octrange
set somstart $_somstart
set somend $_somend
# set octrange $_octrange
set currentrun 0
set somdir 1
# set currentoct [expr $octrange/2.0]
oct accel 2
# oct speed 0.5
oct decel 2
som accel 3
som decel 3
som speed 3
drive som $somstart
som speed 3
}
publish SetUpVacTex user
proc VacTex {somstep} {
global currentoct somdir somstart somend octrange
# set octspeed [expr {$octrange*1.0/$somtime}]
# oct speed $octspeed
set i_bool 0
if {$somdir == 1} {
set currentsom $somstart
set i 0
} else {
set currentsom $somend
set i [expr {int(($somend-$somstart)/$somstep)}]
}
histmem mode unlimited
newfile HISTOGRAM_XY
while {$i_bool==0} {
set currentoct [expr {$currentoct *-1}]
drive som $currentsom
# run oct $currentoct
oct oscillate_count 1
oct oscillate start
hmm countblock
save $i
broadcast $i $currentsom $currentoct
if {($somdir > 0)} {
set currentsom [expr {$currentsom + $somstep}]
if {$currentsom > $somend} {set i_bool 1}
incr i
} else {
set currentsom [expr {$currentsom - $somstep}]
if {$currentsom < $somstart} {set i_bool 1}
incr i -1
}
}
set somdir [expr {(-1*$somdir)}]
}
publish VacTex user
proc VacRamp {temp rate somstep} {
set tstart [SplitReply [tc1 setpoint]]
set tim1 [clock seconds]
set tlength [expr abs($tstart-$temp)/($rate/3600.0)]
tc1 ramprate $rate
tc1 setpoint $temp
set bool 0
# RadCollOn $oscno
while {$bool==0} {
VacTex $somstep
set tim2 [expr [clock seconds]-$tim1]
if {$tim2>$tlength} {set bool 1}
}
}
publish VacRamp user
proc VacRun {tmins somstep} {
set tim1 [clock seconds]
set tlength [expr {$tmins * 60}]
set bool 0
# RadCollOn $oscno
while {$bool==0} {
VacTex $somstep
set tim2 [expr [clock seconds]-$tim1]
if {$tim2>$tlength} {set bool 1}
}
}
publish VacRun user

View File

@ -29,6 +29,7 @@ proc histset_XYTperiod {} {
proc histmem_period_single { } {
# Because bugs may not yet have been corrected in hmm_configuration_common_1.tcl,
# apply the default settings before attempting del/clear.
histmem astop
global n_periods
set n_periods 1
FAT_TABLE -set NOS_PERIODS 1
@ -41,23 +42,9 @@ proc histmem_period_single { } {
}
Publish histmem_period_single User
# orig version of this pre Oct 09
#
#proc histmem_period_sequence { Np Nf } {
# Note - sequence needs to be at least 2 periods.
# global n_periods
# set n_periods $Np
# set fatstr "FAT_TABLE -set NOS_PERIODS $Np"
# set fatstr2 "FAT_TABLE -set PERIOD_INDICES { 0 1 }"
# set batstr "BAT_TABLE -set NO_BAT_ENTRIES $Np NO_BAT_PERIODS $Np NO_REPEAT_ENTRY $Nf NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1"
# eval $fatstr
# eval $fatstr2
# eval $batstr
# histmem loadconf
#
#}
proc histmem_period_sequence {Np Nt} {
histmem stop
hmm astop
global n_periods
set n_periods $Np
#FAT_TABLE -set NOS_PERIODS $Np
@ -69,9 +56,12 @@ proc histmem_period_sequence {Np Nt} {
# newfile HISTOGRAM_XYT
}
Publish histmem_period_sequence User
proc histmem_period_sequence_off {} {
histmem stop
hmm astop
global n_periods
set n_periods $Np
FAT_TABLE -set NOS_PERIODS 1
@ -79,7 +69,7 @@ proc histmem_period_sequence_off {} {
histmem loadconf
histset_XYperiod
}
Publish histmem_period_sequence User
Publish histmem_period_sequence_off User
@ -95,6 +85,8 @@ proc histmem_save_period_sequence { } {
Publish histmem_save_period_sequence User
proc histmem_period_strobo {Freq Bins} {
histmem stop
hmm astop
global nos_bins
set nos_bins $Bins
set bintime [expr int(1000000./($Freq*$Bins))]
@ -108,6 +100,7 @@ proc histmem_period_strobo {Freq Bins} {
Publish histmem_period_strobo User
proc histmem_strobo_off {} {
hmm astop
histmem fsrce INTERNAL
OAT_TABLE -set T { 0 200000 } NTC 1
histmem loadconf
@ -115,44 +108,56 @@ proc histmem_strobo_off {} {
}
Publish histmem_strobo_off User
# SetHistoSync: sets the histogram to receive $framenum worth of frames on receiving
# TTL pulse in frame sync input. Note: Framebuffer should be set to OFF for long runs
proc histmem_acquire_period_sequence { Np Nf } {
newfile HISTOGRAM_XYT
proc SetHistoSync {framenum} {
histmem stop
histmem_period_sequence $Np $Nf
hmm astop
bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum
bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 }
fat_table -set NOS_PERIODS $framenum
oat_table -set T {0 2200000} NTC 1
histmem loadconf
histmem start
set dlytime [ expr int( 1000 * $Nf / 50. ) ]
# clientput "Waiting for" $dlytime "ms..."
after $dlytime
# clientput "tc1 reading is: " [tc1 get]
global n_periods
for { set i 0 } { $i < $n_periods } { incr i } {
# after $dlytime
# set current_period -1
# while { $current_period < $i } {
# update
# after 500
# # hmm count
# # hmm init 2
# clientput [hmm configure current_period]
# set current_period [lindex [split [hmm configure current_period] " "] 2]
# clientput "i = " $i " and the current period is " $current_period
# }
hmm configure read_data_period_number $i
save [expr $i]
histmem fsrce EXTERNAL
}
clientput "Acquisition completed."
publish SetHistoSync user
# SetHistoNormal: resets the histo for standard operation
proc SetHistoNormal {} {
histmem stop
hmm astop
bat_table -set NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1
bat_table -set NO_REPEAT_ENTRY 0 NO_REPEAT_TABLE 0 NO_EXECUTE_TABLE 0 PERIOD_INDICES { 0}
fat_table -set NOS_PERIODS 1
oat_table -set T {0 2200000} NTC 1
oat_table -set Y {-0.5 3.5} NYC 128
histmem loadconf
histmem fsrce INTERNAL
proc ::histogram_memory::pre_count {} {}
}
publish SetHistoNormal user
proc SetHistoOneShot {frq framenum } {
histmem stop
hmm astop
bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum
bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 }
fat_table -set NOS_PERIODS $framenum
oat_table -set T {0 2200000} NTC 1
oat_table -set Y {-0.5 15.5} NYC 16
histmem freq $frq
histmem loadconf
histmem fsrce INTERNAL
histmem mode unlimited
}
Publish histmem_acquire_period_sequence User
publish SetHistoOneShot user

View File

@ -345,8 +345,8 @@ Motor $sample_stage_rotate $motor_driver_type [params \
hardlowerlim -71\
hardupperlim 116\
maxSpeed 5\
maxAccel 1\
maxDecel 1\
maxAccel 3\
maxDecel 3\
stepsPerX 12500\
absEnc 1\
absEncHome $som_Home\

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation true true
detector_simulation false true
hmm_simulation false true
environment_simulation false false
counter_simulation false true
motor_simulation false false
chopper_simulation false true
velsel_simulation false true
plc_simulation false true
rfgen_simulation false true
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -103,7 +103,6 @@ implementation = normal_sample_stage
name = sample_stage
optype = motion_axis
[12tmagnet_oxford]
asyncqueue = sct
desc = "12 Tesla Oxford Magnet"
driver = "oxford_labview"
imptype = magnetic_field
@ -130,6 +129,7 @@ desc = "Function Generator"
driver = agilent_33220A
imptype = function_generator
ip = 10.157.205.16
name = pulser
port = 5025
[eularian_cradle]
@ -185,7 +185,7 @@ asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 137.157.201.21
ip = 10.157.205.30
port = 7777
terminator = \r\n
tol1 = 1.0
@ -290,10 +290,41 @@ port = 4001
desc = "Load the small omega configuration"
imptype = motion_axis
[west4100]
desc = "Blue furnace temperature controller"
[vf1_west4100]
asyncqueue = sct
desc = "VF1 Blue furnace temperature controller"
dev_id = 1
driver = "west4100"
imptype = temperature
ip = 10.157.205.19
ip = 10.157.205.24
port = 502
[vf1_west6100]
asyncprotocol = modbus_ap
desc = "VF1 Blue furnace 6100 temperature controller"
dev_id = 1
driver = "west_6100"
imptype = temperature
ip = 10.157.205.24
port = 502
timeout = 2000
[vf2_west4100]
asyncqueue = sct
desc = "VF2 Blue furnace temperature controller"
dev_id = 1
driver = "west4100"
imptype = temperature
ip = 10.157.205.25
port = 502
[vf2_west6100]
asyncprotocol = modbus_ap
desc = "VF2 Blue furnace 6100 temperature controller"
dev_id = 1
driver = "west_6100"
imptype = temperature
ip = 10.157.205.25
port = 502
timeout = 2000

View File

@ -56,12 +56,14 @@ fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
fileeval $cfPath(environment)/magneticField/oxford12tlv_sct.tcl
fileeval $cfPath(environment)/he3/sct_he3.tcl
fileeval $cfPath(environment)/magneticField/sct_green_magnet.tcl
fileeval $cfPath(environment)/magneticField/sct_green_magnet_labview.tcl
fileeval $cfPath(hmm)/hmm_configuration.tcl
fileeval $cfPath(nexus)/nxscripts.tcl
fileeval $cfPath(scan)/scan.tcl
fileeval $cfPath(commands)/commands.tcl
fileeval $cfPath(commands)/pulser.tcl
fileeval $cfPath(commands)/hvcommands.tcl
fileeval $cfPath(commands)/vactex.tcl
fileeval $cfPath(commands)/eulerscan.tcl
fileeval $cfPath(anticollider)/anticollider.tcl
fileeval $cfPath(hmm)/hmm_rapid.tcl
@ -81,7 +83,7 @@ SetVoltScale 2000.0
# Eurotherm
# add_et2000 name IP PORT MODBUS_ADDR TOL
# add_et2000 et2000 10.157.205.19 502 1 5
# add tcf1 west400 10.157.205.19 502
# add_west400 tcf1 157.205.25 502
# Using a Keithley 2700 mulitimeter to read pressure
# add_k2700 pressure 137.157.201.86 4004 "\r"

View File

@ -7,3 +7,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -25,19 +25,37 @@ source $cfPath(hipadaba)/hipadaba_configuration.tcl
fileeval $cfPath(motors)/positmotor_configuration.tcl
fileeval $cfPath(plc)/plc.tcl
fileeval $cfPath(counter)/counter.tcl
#TODO Provide method for choosing environment controller
fileeval $cfPath(environment)/sct_agilent_33220A.tcl
fileeval $cfPath(environment)/sct_hiden_xcs.tcl
fileeval $cfPath(environment)/sct_huber_pilot.tcl
fileeval $cfPath(environment)/sct_isotech_ps.tcl
fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl
fileeval $cfPath(environment)/temperature/sct_eurotherm_m2000.tcl
fileeval $cfPath(environment)/sct_keithley_2700.tcl
fileeval $cfPath(environment)/magneticField/sct_green_magnet.tcl
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
fileeval $cfPath(environment)/magneticField/oxford12tlv_sct.tcl
fileeval $cfPath(environment)/sct_keithley_2700.tcl
fileeval $cfPath(environment)/sct_keithley_m2700.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_218.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl
fileeval $cfPath(environment)/temperature/sct_ls336.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl
fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl
fileeval $cfPath(environment)/temperature/mercury_scpi_sct.tcl
fileeval $cfPath(environment)/temperature/sct_ls340.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_base.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_level.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_pres.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_temp.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl
fileeval $cfPath(environment)/sct_protek_common.tcl
fileeval $cfPath(environment)/sct_protekmm.tcl
fileeval $cfPath(environment)/temperature/west400.tcl
fileeval $cfPath(environment)/temperature/sct_west4100.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_pm.tcl
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl
fileeval $cfPath(environment)/he3/sct_he3.tcl
fileeval $cfPath(environment)/magneticField/sct_green_magnet.tcl
fileeval $cfPath(environment)/magneticField/sct_green_magnet_labview.tcl
fileeval $cfPath(hmm)/hmm_configuration.tcl
fileeval $cfPath(nexus)/nxscripts.tcl
fileeval $cfPath(scan)/scan.tcl
@ -47,6 +65,7 @@ fileeval $cfPath(commands)/commands.tcl
fileeval $cfPath(anticollider)/anticollider.tcl
#fileeval $cfPath(environment)/robby_configuration.tcl
fileeval $cfPath(robots)/sct_pickandplace.tcl
fileeval $cfPath(robots)/sct_epson_pandp.tcl
source gumxml.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation false true
detector_simulation false true
hmm_simulation false true
environment_simulation false true
counter_simulation false false
motor_simulation false false
chopper_simulation false false
velsel_simulation false false
plc_simulation false true
rfgen_simulation false false
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -94,6 +94,11 @@ id = 2
implementation = none
name = volts2
optype = multimeter
[robot]
enabled = True
implementation = robbie
name = robot
optype = pickandplace
[sample_stage]
enabled = Always
implementation = normal_sample_stage
@ -241,6 +246,14 @@ terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls370_1]
desc = "Lakeshore 370 Resistance Bridge"
driver = "lakeshore_m370"
imptype = temperature
ip = 10.157.205.42
port = 4001
tol = 1.0
[mercury_scpi_01]
desc = "Oxford Mercury temperature controller in Mercury mode"
driver = "mercury_scpi"
@ -283,6 +296,24 @@ imptype = multimeter
ip = 10.157.205.37
port = 4001
[robbie]
asyncqueue = sct
desc = "Robbie: Epson Pick and Place Robot"
driver = epson_pandp
imptype = pickandplace
ip = 137.157.201.26
port = 6000
robot_name = robbie
[rosie]
asyncqueue = sct
desc = "Rosie: Epson Six Axis Robot in Pick and Place Mode"
driver = epson_pandp
imptype = pickandplace
ip = 137.157.201.26
port = 6000
robot_name = rosie
[small_omega]
desc = "Load the small omega configuration"
imptype = motion_axis

View File

@ -6,3 +6,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -232,7 +232,8 @@ Motor m1chi $motor_driver_type [params \
stepsPerX -$m1chiSetRate\
absEnc 1\
absEncHome $m1chi_Home\
cntsPerX [expr 131072*100.0/68.681] ]
cntsPerX [expr 131072*100.0/68.681]\
nopowersave 1]
m1chi precision 0.001
m1chi speed 0.200
m1chi part crystal
@ -317,7 +318,7 @@ Motor ss1u $motor_driver_type [params \
axis D\
units mm\
hardlowerlim -33.5\
hardupperlim 37.8\
hardupperlim 35.9\
maxSpeed [expr $maxSpeedSlit/$ss1uSetRate]\
maxAccel [expr 5000.0/$ss1uSetRate/0.5]\
maxDecel [expr 5000.0/$ss1uSetRate/0.5]\
@ -440,7 +441,8 @@ samz long_name samz
samz softlowerlim 0
samz softupperlim 660
samz home 0
samz positions 33.5 178.5 323.5 468.5 613.5
samz position_names 1 2 3 4 5
############################
# Motor Controller 3
@ -585,7 +587,8 @@ Motor m2chi $motor_driver_type [params \
stepsPerX -$m2chiSetRate\
absEnc 1\
absEncHome $m2chi_Home\
cntsPerX [expr 131072*100.0/68.681]]
cntsPerX [expr 131072*100.0/68.681]\
nopowersave 1]
m2chi precision 0.001
m2chi speed 0.200
m2chi part crystal
@ -686,6 +689,12 @@ m2y softupperlim 355
m2y home 0
make_gap_motors ss1vg ss1vg ss1vo ss1vo ss1u ss1d mm gaps
make_gap_motors ss1hg ss1hg ss1ho ss1ho ss1r ss1l mm gaps
make_gap_motors ss2vg ss2vg ss2vo ss2vo ss2u ss2d mm gaps
make_gap_motors ss2hg ss2hg ss2ho ss2ho ss2r ss2l mm gaps
proc motor_set_sobj_attributes {} {
}

View File

@ -8,14 +8,14 @@
# Note EndFacePosY and RotApPosY are surveyed positions
foreach {var lname type priv units klass} {
wavelength wavelength float user Angstrom crystal
dOmega dOmega float user degrees crystal
gDQv gDQv float user none crystal
MainDeadTime MainDeadTime float user s detector
TransDeadTime TransDeadTime float user s detector
TransmissionTube TransmissionTube int user none detector
bkgLevel bkgLevel float user 1 experiment
deg2QConv deg2QConv float user none experiment
dOmega dOmega float user degrees experiment
empLevel empLevel float user none experiment
gDQv gDQv float user none experiment
level level float user none experiment
thickness thickness float user mm sample
defaultMCR defaultMCR float user count/sec monitor

View File

@ -12,9 +12,7 @@ foreach {mc host port} {
# BEAM MONITOR HOST AND PORT
foreach {bm host port} {
MONITOR_1 das1-kookaburra 30000
MONITOR_2 das1-kookaburra 30001
MONITOR_3 das1-kookaburra 30002
MONITOR_1 137.157.205.24 30000
} {
dict set MONITOR_HOSTPORT $bm HOST $host
dict set MONITOR_HOSTPORT $bm PORT $port

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation true true
detector_simulation false true
hmm_simulation false true
environment_simulation false false
counter_simulation false true
motor_simulation false false
chopper_simulation false true
velsel_simulation false true
plc_simulation true true
rfgen_simulation false true
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -6,3 +6,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -6,3 +6,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -423,13 +423,16 @@ namespace eval ::chopper {
set catch_status [ catch {
if [hgetpropval $hpath/$node abort] {
hsetprop $hpath/$node abort 0
clientput "ERROR: User requested stop. Aborting operation"
set errStr "ERROR: User requested stop. Aborting operation"
clientput $errStr
hsetprop $hpath/$node errmsg $errStr
return $SCode(HWFault)
}
set devErr [hval $hpath/$node/control/device_error]
if {$devErr != ""} {
clientput "ERROR: Drive request failed. Aborting operation"
clientput $devErr
set errStr "ERROR: Drive request failed. Aborting operation: device_error = $devErr"
clientput $errStr
hsetprop $hpath/$node errmsg $errStr
return $SCode(HWFault)
}
if [hpropexists $hpath geterror] {
@ -458,6 +461,8 @@ namespace eval ::chopper {
return $SCode(HWBusy)
} elseif {[expr $readtime - $timecheck] > $timeout} {
return $SCode(HWIdle)
} else {
return $SCode(HWBusy)
}
} else {
if {$timecheck != -1} {
@ -498,6 +503,9 @@ namespace eval ::chopper {
proc imot_PhRun {hpath node addr name target} {
global SCode
if {[hval $hpath/$node/control/device_error] != ""} {
hset $hpath/$node/control/device_error ""
}
hset $hpath/$node/control/set_ref_delay $target
hsetprop $hpath/$node/control timecheck -1
set readtime [hgetpropval $hpath read_time]

View File

@ -418,7 +418,7 @@ publish set_data_record user
MakeAsyncProtocol std
MakeAsyncQueue hvport std 10.157.205.10 4001
MakeAsyncQueue hvport std 137.157.202.215 55011
# Main process call to create the driver
::scobj::hv::mkHV {
name "hv"
@ -427,9 +427,3 @@ MakeAsyncQueue hvport std 10.157.205.10 4001
tuning 1
interval 5
}

View File

@ -1,7 +1,11 @@
#FIXME Does pelican have a PLC interface?
plc_simulation true
set sim_mode [SplitReply [plc_simulation]]
if {$sim_mode == "false"} {
# MakeAsyncQueue plc_chan SafetyPLC 137.157.204.79 31001
# MakeSafetyPLC plc plc_chan 0
MakeAsyncQueue plc_chan SafetyPLC IP? PORT?
MakeSafetyPLC plc plc_chan 0
}
source $cfPath(plc)/plc_common_1.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation false true
detector_simulation false true
hmm_simulation false true
environment_simulation false false
counter_simulation false true
motor_simulation false false
chopper_simulation false true
velsel_simulation false true
plc_simulation true true
rfgen_simulation false true
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -8,7 +8,7 @@ enabled = False
cascade = T1:ls336_01,T2:ls340_11,sample_stage:normal_sample_stage
enabled = False
[Default]
cascade = sample_stage:normal_sample_stage
cascade = sample_stage:normal_sample_stage,T1:ls340_pelican
enabled = True
[OC1]
cascade = T1:OC1_ls340,sample_stage:normal_sample_stage
@ -43,9 +43,9 @@ name = curr2
optype = multimeter
[T1]
datype = T
enabled = False
enabled = True
id = 1
implementation = none
implementation = ls340_pelican
name = tc1
optype = temperature
[T2]
@ -83,6 +83,11 @@ id = 2
implementation = none
name = volts2
optype = multimeter
[ls218]
enabled = Always
implementation = ls218-01
name = ls218
optype = lakeshore_218
[sample_stage]
enabled = Always
implementation = normal_sample_stage
@ -120,6 +125,13 @@ imptype = function_generator
ip = 10.157.205.16
port = 5025
[ls218-01]
desc = "Lakeshore 218 Temperature Monitor"
driver = "lakeshore_218"
imptype = lakeshore_218
ip = ca2-pelican
port = 4002
[ls336_01]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"

View File

@ -6,3 +6,4 @@ koala.hdd
troubleshoot_setup.tcl
extraconfig.tcl
InstXML.xml
sics_simulation.tcl

View File

@ -7,3 +7,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation true true
detector_simulation false true
hmm_simulation false true
environment_simulation false true
counter_simulation false false
motor_simulation false false
chopper_simulation false false
velsel_simulation false false
plc_simulation false true
rfgen_simulation false false
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -7,3 +7,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation false true
detector_simulation false true
hmm_simulation false true
environment_simulation false true
counter_simulation false false
motor_simulation false false
chopper_simulation false false
velsel_simulation false false
plc_simulation false true
rfgen_simulation false false
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -64,7 +64,7 @@ def start_cmd(server, args):
'none': '',
'fullsim': 'SICS_SIMULATION=full%s' % soffset,
'fakedev': 'SICS_SIMULATION=fakedev%s' % soffset,
'scriptval': 'SICS_SIMULATION=script_validator%s' % soffset
'scriptval': 'SICS_INIT_LOGPATH="../script_validator/log" SICS_SIMULATION=script_validator%s' % soffset
}
# Set SICS_SIMULATION environment variable
if (server == 'scriptval'):

View File

@ -7,3 +7,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -0,0 +1,96 @@
# \file Implements 'dsc actime interval' command.
set GROWFILE_STATE "DISABLED"
set growfileSaveIndex 0
proc doGrowFile {} {
global GROWFILE_STATE
global growfileSaveIndex
# Reset the GROWFILE_STATE variable in case some naughty user sets it directly
set GROWFILE_STATE "ENABLED"
set HMSTATE [SplitReply [hmm configure daq]]
set FSTATE [SplitReply [file_status]]
# broadcast CALLED: [info level 0], HMSTATE = $HMSTATE, FSTATE = $FSTATE
if { $FSTATE != "UNKNOWN" && $FSTATE != "OPEN" && $HMSTATE == "Started"} {
# broadcast growfile $growfileSaveIndex
save $growfileSaveIndex "growfile"
incr growfileSaveIndex
} else {
if {$growfileSaveIndex == 0} {
broadcast ERROR: GROWFILE HMSTATE = $HMSTATE, FSTATE = $FSTATE. The histmem must be running and you must create a newfile before calling "growfile"
} else {
broadcast STOP GROWFILE Acquisition finished. HMSTATE = $HMSTATE, FSTATE = $FSTATE.
save $growfileSaveIndex "growfile"
newfile clear
broadcast Saved [hval /experiment/file_name]
}
set growfileSaveIndex 0
sicspoll del doGrowFile
set GROWFILE_STATE "DISABLED"
hsetprop /instrument/detector/hmm mutable true
}
}
publish doGrowFile user
proc growfile { {interval 300} } {
global GROWFILE_STATE
global growfileSaveIndex
set GROWFILE_STATE "DISABLED"
set growfileSaveIndex 0
set as_error 0
set myrights [set_rights manager]
if {$myrights == -1} {
return -code error "ERROR: You are not authorized for this operation"
}
set interval [string tolower $interval]
if {$interval == "check" || $interval == "status"} {
if { $GROWFILE_STATE == "ENABLED" } {
return "GROWFILE $GROWFILE_STATE [sicspoll intervall doGrowFile]"
} else {
return "GROWFILE $GROWFILE_STATE"
}
} elseif {[string is integer $interval]} {
if {$interval <= 0} {
if { $GROWFILE_STATE == "ENABLED" } {
sicspoll del doGrowFile
set GROWFILE_STATE "DISABLED"
}
} else {
if {$GROWFILE_STATE == "DISABLED"} {
sicspoll add doGrowFile script $interval doGrowFile
# sicspoll listen # WARNING:When the listening client exits it leaves SICSPOLL task with a corrupt connection object.
set GROWFILE_STATE "ENABLED"
} else {
sicspoll intervall doGrowFile $interval
}
}
} else {
set as_error 1
}
set_rights $myrights
if {$as_error} {
return -code error "ERROR: Invalid argument in '[info level 0]', should be an integer or 'check'"
}
}
publish growfile user
# \brief Run histogram for the specified time and save XY binned data at the given interval.
# \param actime Acquisition time in seconds.
# \param saveint Save interval in seconds.
proc dsc {actime saveint} {
hsetprop /instrument/detector/hmm mutable false
newfile HISTOGRAM_XY
histmem mode time
histmem preset $actime
histmem start
growfile $saveint
}
publish dsc user

View File

@ -26,35 +26,35 @@ fileeval $cfPath(parameters)/parameters.tcl
fileeval $cfPath(plc)/plc.tcl
fileeval $cfPath(optics)/optics.tcl
fileeval $cfPath(counter)/counter.tcl
fileeval $cfPath(environment)/agilent_33220A_sct.tcl
fileeval $cfPath(environment)/hiden_xcs_sct.tcl
fileeval $cfPath(environment)/huber_pilot_sct.tcl
fileeval $cfPath(environment)/isotech_ps_sct.tcl
fileeval $cfPath(environment)/sct_agilent_33220A.tcl
fileeval $cfPath(environment)/sct_hiden_xcs.tcl
fileeval $cfPath(environment)/sct_huber_pilot.tcl
fileeval $cfPath(environment)/sct_isotech_ps.tcl
fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl
fileeval $cfPath(environment)/temperature/eurotherm_m2000_sct.tcl
fileeval $cfPath(environment)/temperature/sct_eurotherm_m2000.tcl
fileeval $cfPath(environment)/sct_keithley_2700.tcl
fileeval $cfPath(environment)/keithley_m2700_sct.tcl
fileeval $cfPath(environment)/temperature/lakeshore_218_sct.tcl
fileeval $cfPath(environment)/sct_keithley_m2700.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_218.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl
fileeval $cfPath(environment)/temperature/ls336_sct.tcl
fileeval $cfPath(environment)/temperature/sct_ls336.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl
fileeval $cfPath(environment)/temperature/ls340_sct.tcl
fileeval $cfPath(environment)/temperature/sct_ls340.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl
fileeval $cfPath(environment)/temperature/lakeshore_m370_sct.tcl
fileeval $cfPath(environment)/temperature/mercury_scpi_sct.tcl
fileeval $cfPath(environment)/nhq_200_sct.tcl
fileeval $cfPath(environment)/omron_hldc_sct.tcl
fileeval $cfPath(environment)/temperature/pfeiffer_hg_sct.tcl
fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl
fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl
fileeval $cfPath(environment)/sct_nhq_200.tcl
fileeval $cfPath(environment)/sct_omron_hldc.tcl
fileeval $cfPath(environment)/temperature/sct_pfeiffer_hg.tcl
fileeval $cfPath(environment)/sct_protek_common.tcl
fileeval $cfPath(environment)/protekmm_sct.tcl
fileeval $cfPath(environment)/sct_protekmm.tcl
fileeval $cfPath(environment)/temperature/sct_rvasm2.tcl
fileeval $cfPath(environment)/temperature/nprvasm2_sct.tcl
fileeval $cfPath(environment)/temperature/sct_nprvasm2.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_pm.tcl
fileeval $cfPath(environment)/temperature/watlow_mpm_sct.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_mpm.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_rm.tcl
fileeval $cfPath(environment)/temperature/watlow_mrm_sct.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_mrm.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_st4.tcl
fileeval $cfPath(environment)/temperature/watlow_mst4_sct.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_mst4.tcl
fileeval $cfPath(hmm)/hmm_configuration.tcl
fileeval $cfPath(nexus)/nxscripts.tcl
fileeval $cfPath(hmm)/detector.tcl
@ -63,7 +63,7 @@ fileeval $cfPath(commands)/commands.tcl
fileeval $cfPath(anticollider)/anticollider.tcl
fileeval $cfPath(environment)/temperature/sct_julabo_lh45.tcl
fileeval $cfPath(environment)/temperature/sct_qlink.tcl
fileeval $cfPath(environment)/magneticField/tsi_smc_sct.tcl
fileeval $cfPath(environment)/magneticField/sct_tsi_smc.tcl
fileeval $cfPath(environment)/temperature/sct_oxford_itc.tcl
fileeval $cfPath(environment)/magneticField/oxford_labview.tcl
fileeval $cfPath(environment)/magneticField/sct_bruker_BEC1.tcl
@ -73,6 +73,7 @@ fileeval $cfPath(environment)/sct_antonparr_MCR500.tcl
fileeval $cfPath(beamline)/spin_flipper.tcl
fileeval $cfPath(commands)/pulser.tcl
fileeval $cfPath(commands)/hvcommands.tcl
fileeval $cfPath(commands)/growfile.tcl
source gumxml.tcl

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation true true
detector_simulation false true
hmm_simulation false true
environment_simulation false false
counter_simulation false true
motor_simulation false false
chopper_simulation false true
velsel_simulation false true
plc_simulation false true
rfgen_simulation false true
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -0,0 +1,94 @@
#!/usr/bin/env python
# vim: ft=python ts=8 sts=4 sw=4 expandtab autoindent smartindent
""" Find the trigger time for Differenctial Scanning Calorimetry data in nx.hdf files. """
import sys
import os
import h5py
import argparse
import time
from collections import defaultdict
class SkipFile(BaseException):
"""This exception should be raised to skip processing a file"""
pass
PARSER = argparse.ArgumentParser(
description = """Report the time offset for the start of the DSC profile relative to the start time of the histogram data.
This program can process multiple hdf files by specifying the path to the first file and the number of files to process.
You can also speficy a list of 'file_path numfile' pairs.""",
usage='dsc file_path numfile {file_path numfile}'
)
PARSER.add_argument('files', nargs='+', help = 'List of "file_path numfile" pairs')
ARGS = PARSER.parse_args()
FAILS = defaultdict(list)
for startfile, num in zip(ARGS.files[0::2], ARGS.files[1::2]):
numfiles = int(num)
hfdir = os.path.dirname(startfile)
hfbase = os.path.basename(startfile)
idx = hfbase.find('.')
startFID = hfbase[:idx]
ext = hfbase[idx:]
idnum = int(startFID[3:])
inst_abname = hfbase[:3]
hfval = {}
print
for i in range(numfiles):
try:
currid = idnum + i
fileID = inst_abname + '%07d' % currid
if (hfdir == ''):
nxfile = fileID + ext
else:
nxfile = hfdir + '/' + fileID + ext
try:
hf = h5py.File(nxfile, 'r')
except:
FAILS['badfile'].append(nxfile)
continue
if (hfbase.startswith('QKK')):
rootpath = fileID + '/'
else:
rootpath = 'entry1/'
for dpath in ['time_stamp', 'instrument/detector/start_time', 'sample/dsc_val']:
dscpath = rootpath + dpath
if dscpath in hf:
hfval[dpath] = hf[dscpath][:]
else:
FAILS['badpath:{0}'.format(dpath)].append(nxfile)
hf.close()
raise SkipFile
print fileID
datiter = {}
dat_hasnext = 0
time_tuple = time.strptime(hf[rootpath + 'start_time'][0], '%Y-%m-%d %H:%M:%S')
hfval['time_stamp'] += time.mktime(time_tuple)
hfval['time_stamp'] -= hfval['instrument/detector/start_time']
dsc0 = hfval['sample/dsc_val'][0]
no_transition = True
for i in range(1, len(hfval['sample/dsc_val'][1:])):
dsc1 = hfval['sample/dsc_val'][i]
if abs(dsc1 - dsc0) > 1.9:
no_transition = False
msg = 'dsc_val transition from {dsc0} to {dsc1} volts at {time} seconds from detector start time, array index = {index}'
print msg.format(dsc0=dsc0, dsc1=dsc1, time=hfval['time_stamp'][i], index=i)
dsc0 = dsc1
if no_transition:
print 'dsc_val no transition'
print
hf.close()
except SkipFile:
continue
for k in FAILS.keys():
if (len(FAILS[k])):
print >> sys.stderr, 'Skipped following files. Reason = ', k
print >> sys.stderr, FAILS[k]

View File

@ -4,6 +4,9 @@ enabled = False
[12Tmagnet_setup]
cascade = B1:12tmagnet_oxford,sample_stage:Oxford_12tmagnet_sample_insert,T1:mercury_scpi_01
enabled = False
[20_position_pulser]
cascade = T1:julabo_lh45,Function_Generator:agilent_33220A,High_Voltage:protek_02,sample_stage:20_pos_sample_stage
enabled = False
[20_position_setup]
cascade = T1:julabo_lh45,sample_stage:20_pos_sample_stage
enabled = False
@ -70,6 +73,13 @@ id = 2
implementation = none
name = curr2
optype = multimeter
[Power Supply]
datype = V
enabled = False
id = 1
implementation = none
name = isops
optype = power_supply
[Rheometry]
enabled = False
implementation = none
@ -155,11 +165,19 @@ optype = motion_axis
desc = "Load the ten position sample changer configuration"
imptype = motion_axis
[11tmagnet_oxford]
desc = "11/10 Tesla Oxford Magnet"
driver = "oxford_labview"
imptype = magnetic_field
interval = 5
ip = 10.157.205.44
port = 55001
[12tmagnet_oxford]
asyncqueue = sct
desc = "12 Tesla Oxford Magnet"
driver = "oxford_labview"
imptype = magnetic_field
interval = 5
ip = 10.157.205.3
port = 55001
@ -217,6 +235,13 @@ ip = 10.157.205.13
port = 4444
type = B
[isotech_ps]
desc = "Isotech Power Supply:Baud=2400,Data=8,Stop=1,Parity=None,Flow=None"
driver = "isotech_ps"
imptype = power_supply
ip = 137.157.202.79
port = 4001
[julabo_lh45]
ctrl_sensor = "bath"
desc = "Julabo temperature controller"
@ -315,6 +340,16 @@ terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls340_09]
desc = "Lakeshore 340 temperature controller"
driver = "ls340"
imptype = temperature
ip = 137.157.202.79
port = 4002
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls340_11]
desc = "Lakeshore 340 temperature controller"
driver = "ls340"

View File

@ -15,6 +15,9 @@ set quieckport 60004
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
if [file exists ./sics_simulation.tcl] {
source ./sics_simulation.tcl
} else {
foreach {simflag icsval fakedev} {
opal_simulation false true
detector_simulation false true
@ -33,6 +36,7 @@ foreach {simflag icsval fakedev} {
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}
}
VarMake sics_simulation Text internal
@ -120,7 +124,9 @@ if {[info exists env(SICS_SIMULATION)] != 1} {
}
fileeval util/config_reader.tcl
if [file exists ../sics_config.ini] {
if [file exists ./sics_config.ini] {
set config_dict [config_reader::parse_file ./sics_config.ini]
} elseif [file exists ../sics_config.ini] {
set config_dict [config_reader::parse_file ../sics_config.ini]
}
@ -198,6 +204,9 @@ SicsDataPath lock
::utility::mkVar Email Text user email true user true true
::utility::mkVar Phone Text user phone true user true true
::utility::mkVar starttime Text user start true experiment true true
::utility::mkVar gumtree_version Text user gumtree_version true experiment true true
::utility::mkVar gumtree_status Text user gumtree_status true experiment true false
::utility::mkVar gumtree_time_estimate float user gumtree_time_estimate true experiment true false
exe batchpath ../batch
exe syspath ../batch
@ -245,25 +254,20 @@ proc waitaction {obj action args} {
publish waitaction user
proc server_set_sobj_attributes {} {
if [ catch {
motor_set_sobj_attributes
::utility::set_motor_attributes
if [ catch { motor_set_sobj_attributes } msg ] { puts $msg }
if [ catch { ::utility::set_motor_attributes } msg ] { puts $msg }
#XXX::utility::set_histomem_attributes
::utility::set_sobj_attributes
::utility::set_envcontrol_attributes
::plc::set_sobj_attributes
::counter::set_sobj_attributes
::nexus::set_sobj_attributes
::histogram_memory::set_sobj_attributes
::utility::set_chopper_attributes
::utility::set_sct_object_attributes
if [ catch { ::utility::set_sobj_attributes } msg ] { puts $msg }
if [ catch { ::utility::set_envcontrol_attributes } msg ] { puts $msg }
if [ catch { ::plc::set_sobj_attributes } msg ] { puts $msg }
if [ catch { ::counter::set_sobj_attributes } msg ] { puts $msg }
if [ catch { ::nexus::set_sobj_attributes } msg ] { puts $msg }
if [ catch { ::histogram_memory::set_sobj_attributes } msg ] { puts $msg }
if [ catch { ::utility::set_chopper_attributes } msg ] { puts $msg }
if [ catch { ::utility::set_sct_object_attributes } msg ] { puts $msg }
## TODO move the following to the new ansto gumxml.tcl
sicslist setatt getgumtreexml privilege internal
if [ catch { sicslist setatt getgumtreexml privilege internal } msg ] { puts $msg }
clientput "serverport $::serverport"
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error $message
}
}
proc server_init {} {

View File

@ -6,3 +6,4 @@ config
util
hostport_config.tcl
hostport_config_test.tcl
sics_simulation.tcl

View File

@ -4,9 +4,6 @@
# FastShutter is currently set on Quokka only
#::utility::mkVar FastShutter text manager FastShutter false instrument true false
# SET TO 1 TO USE THE TILT STAGE ie sample phi and chi
set use_tiltstage 0
set animal taipan
set sim_mode [SplitReply [motor_simulation]]
@ -93,6 +90,42 @@ set move_count 100
############################
#
# CHOOSE HERE for sample stage configuration
##########################################
# Set axis_config as follows to use different axis configurations
# 0: normal stage configuration
# 1: Oxford magnet sample stick
set axis_config 0
if { [ info exists ::config_dict ] } {
if { [ dict exists $::config_dict sample_stage implementation ] } {
set implementation [ dict get $::config_dict sample_stage implementation ]
if {$implementation == "normal_sample_stage"} {
set axis_config 0
} elseif {$implementation == "12tmagnet_sample_insert"} {
set axis_config 1
} else {
set axis_config 0
}
}
}
switch $axis_config {
0 {
set use_normal_config "true"
set tilt_motor_driver_type $motor_driver_type
}
1 {
set magmot s1
set magmot_aq "mc2"
set magmot_axis "A"
set use_normal_config "false"
set tilt_motor_driver_type asim
fileeval $cfPath(motors)/magnet_configuration.tcl
}
}
# Dummy translation motor, useful for testing scans
Motor dummy_motor asim [params \
@ -138,36 +171,6 @@ dummy_s1 softupperlim 180
dummy_s1 precision 0.02
dummy_s1 home 0
if { [ info exists ::config_dict ] && [ dict get $::config_dict s1_sample_insert enabled ] } {
set samp_stage_name "s1ss"
set tilt_motor_driver_type asim
Motor s1 $motor_driver_type [params \
asyncqueue mc2\
host mc2-taipan\
port pmc2-taipan\
axis A\
units degrees\
hardlowerlim -1440\
hardupperlim 1440\
maxSpeed 1\
maxAccel 1\
maxDecel 1\
stepsPerX [expr 67.0 * 25000 / 360]\
absEnc 1\
absEncHome 31275743\
cntsPerX [expr 67.0 * 8192 / 360]]
s1 part sample
s1 long_name s1
s1 softlowerlim -180
s1 softupperlim 180
s1 home 0
} else {
set samp_stage_name "s1"
set tilt_motor_driver_type $motor_driver_type
}
#if $use_tiltstage {
# mc1: Monochromator crystal selection rotation/Tilt
Motor mtilt $motor_driver_type [params \
asyncqueue mc1\
@ -182,16 +185,14 @@ Motor mtilt $motor_driver_type [params \
maxDecel 1\
stepsPerX 25000\
absEnc 1\
absEncHome 79650\
absEncHome 27115\
cntsPerX 4096]
mtilt part crystal
mtilt long_name mtilt
mtilt softlowerlim -5
mtilt softupperlim 5
mtilt home 0
#}
set atest mtilt
# mc1: Monochromator Linear (Translate)
Motor mtrans $motor_driver_type [params \
@ -207,7 +208,7 @@ Motor mtrans $motor_driver_type [params \
maxDecel 1\
stepsPerX 25000\
absEnc 1\
absEncHome 469388\
absEncHome 859242\
cntsPerX 4096]
mtrans part crystal
mtrans long_name mtrans
@ -229,7 +230,7 @@ Motor m2 $motor_driver_type [params \
port pmc1-taipan\
axis F\
units degrees\
precision 0.01\
precision 0.001\
hardlowerlim 17\
hardupperlim 80\
maxSpeed 0.414\
@ -246,9 +247,9 @@ m2 softupperlim 80
m2 home 20
m2 motOnDelay 0
m2 motOffDelay 0
m2 backlash_offset -0.1
m2 backlash_offset -0.5
m2 creep_offset 0.1
m2 creep_precision 0.005
m2 creep_precision 0.0
m2 speed 0.4
m2 accel 0.04
m2 decel 0.04
@ -384,7 +385,8 @@ stl home 0.0
stl backlash_offset -0.2
# mc2: Sample Rotate
Motor $samp_stage_name $motor_driver_type [params \
if {$use_normal_config == "true"} {
Motor s1 $motor_driver_type [params \
asyncqueue mc2\
host mc2-taipan\
port pmc2-taipan\
@ -399,12 +401,13 @@ Motor $samp_stage_name $motor_driver_type [params \
absEnc 1\
absEncHome 10695068\
cntsPerX 4096]
$samp_stage_name part sample
$samp_stage_name long_name $samp_stage_name
$samp_stage_name softlowerlim -170
$samp_stage_name softupperlim 120
$samp_stage_name home 35.997
$samp_stage_name backlash_offset -0.2
s1 part sample
s1 long_name s1
s1 softlowerlim -170
s1 softupperlim 120
s1 home 35.997
s1 backlash_offset -0.2
}
# mc2: Analyser Detector Rotate -- Sample Scattering Angle
# absEncHome 20728908\ at -50

View File

@ -0,0 +1,23 @@
# Simulation flags, possible values = true or false
# true: The simulated driver will be used.
# false: The real driver will be used.
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
foreach {simflag icsval fakedev} {
opal_simulation true true
detector_simulation false true
hmm_simulation false true
environment_simulation false true
counter_simulation false false
motor_simulation false false
chopper_simulation false false
velsel_simulation false false
plc_simulation true true
rfgen_simulation false false
goniometer_simulation false true
magnetic_simulation false true
} {
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
VarMake $simflag Text internal
}

View File

@ -61,9 +61,21 @@ source gumxml.tcl
# init for the tasUB
#make mcv mch acv ach into mvfocus mhfocus avfocus ahfocus when it works
puts "doing tasub"
MakeTasUB tasub m1 m2 mcv mch s1 s2 sgu sgl a1 a2 acv ach
MakeTasUB tasub m1 m2 mvfocus mhfocus s1 s2 sgu sgl a1 a2 avfocus ahfocus
tasub mono dd 3.35416
tasub ana dd 3.35416
tasub mono vb1 102.2
tasub mono vb2 1.78
tasub mono hb1 184.42
tasub mono hb2 -60.1
tasub mono hb3 0.951
tasub ana vb1 115
tasub ana vb2 2.13
tasub ana hb1 45.68
tasub ana hb2 105.7
tasub ana hb3 0.945
tasub focusfn energy
tasub autofocus 0
tasub updatetargets
puts "done tasub"

View File

@ -1,156 +1,304 @@
[12tmagnet]
desc = "12 Tesla Oxford Magnet"
driver = "12tmagnet"
enabled = False
group = environment:magnet
id = 11
ip = 10.157.205.3
name = magnetic
port = 55001
type = B
[12tmagnet_setup]
cascade = 12tmagnet,s1_sample_insert,mercury_scpi
cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_scpi_01
enabled = False
group = 0setup
[ls336_1]
desc = "tc1: Lakeshore 336 temperature controller"
driver = "ls336"
[CF1]
cascade = T1:CF1_ls340,sample_stage:normal_sample_stage
enabled = False
[Default]
cascade = sample_stage:normal_sample_stage
enabled = True
[B1]
datype = B
enabled = False
group = environment:temperature
id = 1
ip = 10.157.205.28
name = tc1
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
[ls336_12]
desc = "tc6: Lakeshore 336 temperature controller"
driver = "ls336"
implementation = none
name = magnet1
optype = magnetic_field
[Function_Generator]
datype = V
enabled = False
group = environment:temperature
id = 6
ip = 10.157.205.31
name = tc6
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
[ls336_2]
desc = "tc2: Lakeshore 336 temperature controller"
driver = "ls336"
id = 1
implementation = none
name = pulser
optype = function_generator
[I1]
datype = I
enabled = False
id = 1
implementation = none
name = curr1
optype = multimeter
[I2]
datype = I
enabled = False
group = environment:temperature
id = 2
ip = 10.157.205.29
implementation = none
name = curr2
optype = multimeter
[T1]
datype = T
enabled = False
id = 1
implementation = none
name = tc1
optype = temperature
[T2]
datype = T
enabled = False
id = 2
implementation = none
name = tc2
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
[ls336_4]
desc = "tc3: Lakeshore 336 temperature controller"
driver = "ls336"
optype = temperature
[T3]
datype = T
enabled = False
group = environment:temperature
id = 3
ip = 10.157.205.30
implementation = none
name = tc3
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
[ls336_5]
desc = "tc4: Lakeshore 336 temperature controller"
driver = "ls336"
optype = temperature
[T4]
datype = T
enabled = False
group = environment:temperature
id = 4
ip = 137.157.201.21
implementation = none
name = tc4
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
[ls336_6]
desc = "tc5: Lakeshore 336 temperature controller"
driver = "ls336"
optype = temperature
[V1]
datype = V
enabled = False
group = environment:temperature
id = 5
ip = 137.157.201.21
name = tc5
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
id = 1
implementation = none
name = volts1
optype = multimeter
[V2]
datype = V
enabled = False
id = 2
implementation = none
name = volts2
optype = multimeter
[sample_stage]
enabled = Always
implementation = normal_sample_stage
name = sample_stage
optype = motion_axis
[12tmagnet_oxford]
asyncqueue = sct
desc = "12 Tesla Oxford Magnet"
driver = "oxford12tlv"
imptype = magnetic_field
interval = 5
ip = 10.157.205.3
port = 55001
[ls340_1]
desc = "tc13: Lakeshore 340 temperature controller"
[12tmagnet_sample_insert]
desc = "s1 will be redefined as the magnet sample insert rotation."
imptype = motion_axis
[CF1_ls340]
desc = "cf1: Bottom loading cryofurnace"
driver = "ls340"
enabled = False
group = environment:temperature
id = 13
ip = 137.157.203.137
name = tc13
imptype = temperature
ip = 10.157.205.43
port = 4001
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
type = T
[ls370]
desc = "tc8: Lakeshore 370 temperature controller"
driver = "ls370"
enabled = False
group = environment:temperature
id = 8
ip = 137.157.203.137
name = tc8
port = 4003
[agilent_33220A]
asyncqueue = sct
desc = "Function Generator"
driver = agilent_33220A
imptype = function_generator
ip = 10.157.205.16
name = pulser
port = 5025
[ls336_01]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 10.157.205.28
port = 7777
terminator = \r\n
tol = 2.0
type = T
tol1 = 1.0
tol2 = 1.0
[mercury_scpi]
desc = "tc9: Oxford Mercury temperature controller in Mercury mode"
driver = "mercury_scpi"
enabled = False
group = environment:temperature
id = 9
[ls336_02]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 10.157.205.29
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls336_04]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 10.157.205.30
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls336_05]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 137.157.201.21
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls336_06]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 10.157.205.30
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls336_11]
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 10.157.205.27
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls336_12]
asyncqueue = sct
desc = "Lakeshore 336 temperature controller"
driver = "ls336"
imptype = temperature
ip = 10.157.205.31
port = 7777
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls340_01]
asyncqueue = sct
desc = "Lakeshore 340 temperature controller"
driver = "ls340"
imptype = temperature
ip = 137.157.201.86
port = 4001
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls340_02]
asyncqueue = sct
desc = "Lakeshore 340 temperature controller"
driver = "ls340"
imptype = temperature
ip = 137.157.201.86
port = 4002
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[ls340_11]
desc = "Lakeshore 340 temperature controller"
driver = "ls340"
imptype = temperature
ip = 137.157.201.86
port = 4001
terminator = \r\n
tol1 = 1.0
tol2 = 1.0
[mercury_scpi_01]
desc = "Oxford Mercury temperature controller with three temperature loops."
driver = "mercury_base"
imptype = temperature
ip = 10.157.205.5
name = tc9
offifon = mercury_itc500
permlink = LT
port = 7020
terminator = \r
tol = 2.0
type = T
terminator = \r\n
tol = 1.0
valve_tol = 2
[s1_sample_insert]
desc = "s1 will be defined as the sample insert rotation. Sample stage will be renamed to s1ss and sgu and sgl will be simulated"
enabled = False
group = motors
[mercury_scpi_02]
desc = "Oxford Mercury temperature controller with four temperature loops and needle valve control"
driver = "mercury_scpi"
imptype = temperature
ip = 10.157.205.47
permlink = LT
port = 7020
terminator = \r\n
tol = 1.0
valve_tol = 2
[west4100]
desc = "tc10: Blue furnace temperature controller"
[normal_sample_stage]
desc = "This is the default sample stage configuration"
imptype = motion_axis
[protek_01]
asyncqueue = sct
desc = "Protek Multimeter"
driver = "protekmm"
imptype = multimeter
ip = 10.157.205.36
port = 4001
[protek_02]
asyncqueue = sct
desc = "Protek Multimeter"
driver = "protekmm"
imptype = multimeter
ip = 10.157.205.37
port = 4001
[vf1_west4100]
asyncqueue = sct
desc = "VF1 Blue furnace temperature controller"
dev_id = 1
driver = "west4100"
enabled = False
group = environment:temperature
id = 10
ip = 10.157.205.19
name = tc10
type = T
imptype = temperature
ip = 10.157.205.24
port = 502
[vf1_west6100]
asyncprotocol = modbus_ap
desc = "VF1 Blue furnace 6100 temperature controller"
dev_id = 1
driver = "west_6100"
imptype = temperature
ip = 10.157.205.24
port = 502
timeout = 2000
[vf2_west4100]
asyncqueue = sct
desc = "VF2 Blue furnace temperature controller"
dev_id = 1
driver = "west4100"
imptype = temperature
ip = 10.157.205.25
port = 502
[vf2_west6100]
asyncprotocol = modbus_ap
desc = "VF2 Blue furnace 6100 temperature controller"
dev_id = 1
driver = "west_6100"
imptype = temperature
ip = 10.157.205.25
port = 502
timeout = 2000

View File

@ -1364,14 +1364,16 @@ def put_group(MyDriver, MyGroup):
txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])]
if readable_or_writeable:
txt += ['']
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
txt += [' if {[string equal -nocase "${simulation_flag}" "false"]} {']
for var in sorted(MyGroup['Vars']):
MyVar = MyGroup['Vars'][var]
nodename = groupname + MyVar['name']
if MyVar['readable'] > 0:
poll_period = MyVar['readable']
if poll_period < 1 or poll_period > 300:
poll_period = 5
if poll_period < 1:
poll_period = 1
if poll_period > 3600:
poll_period = 3600
txt += [' ${sct_controller} poll ${scobj_hpath}/%s %s' % (nodename, poll_period)]
for var in sorted(MyGroup['Vars']):
MyVar = MyGroup['Vars'][var]
@ -1383,7 +1385,7 @@ def put_group(MyDriver, MyGroup):
driveable = '${name}_' + make_path(MyVar)
MyDriver['Deferred'] += ['ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (driveable, nodename, MyVar['driveable'])]
txt += [' } else {']
txt += [' %s::sics_log 9 "[%s] => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['simulation_group'], MyDriver['name'])]
txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['name'])]
txt += [' }']
for grp in sorted(MyGroup['Groups']):
txt += put_group(MyDriver, MyGroup['Groups'][grp])
@ -1392,15 +1394,15 @@ def put_group(MyDriver, MyGroup):
def put_mkDriver(MyDriver):
txt = ['']
if 'make_args' in MyDriver:
line = 'proc %s::mkDriver { sct_controller name ip_address tcp_port %s } {' % (MyDriver['namespace'], MyDriver['make_args'])
line = 'proc %s::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port %s } {' % (MyDriver['namespace'], MyDriver['make_args'])
else:
line = 'proc %s::mkDriver { sct_controller name ip_address tcp_port } {' % (MyDriver['namespace'])
line = 'proc %s::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {' % (MyDriver['namespace'])
txt += [line]
if 'make_args' in MyDriver:
make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()])
txt += [' %s::sics_log 9 "%s::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)]
txt += [' %s::sics_log 9 "%s::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)]
else:
txt += [' %s::sics_log 9 "%s::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])]
txt += [' %s::sics_log 9 "%s::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])]
txt += [' set ns "[namespace current]"']
txt += [' set catch_status [ catch {']
txt += ['']
@ -1423,7 +1425,7 @@ def put_mkDriver(MyDriver):
ms_line = ' MakeSICSObj ${name} SCT_OBJECT'
txt += [ms_line]
txt += ['']
txt += [' sicslist setatt ${name} klass %s' % MyDriver['class']]
txt += [' sicslist setatt ${name} klass ${device_class}']
txt += [' sicslist setatt ${name} long_name ${name}']
if 'DriverProperty' in MyDriver:
for key in MyDriver['DriverProperty']:
@ -1434,11 +1436,11 @@ def put_mkDriver(MyDriver):
for group in sorted(MyDriver['Groups']):
txt += put_group(MyDriver, MyDriver['Groups'][group])
txt += [' hsetprop ${scobj_hpath} klass %s' % MyDriver['class']]
txt += [' hsetprop ${scobj_hpath} klass ${device_class}']
txt += [' hsetprop ${scobj_hpath} data true']
txt += [' hsetprop ${scobj_hpath} debug_threshold %s' % str(MyDriver['debug_threshold'])]
if len(MyDriver['Deferred']) > 0:
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
txt += [' if {[string equal -nocase "${simulation_flag}" "false"]} {']
for line in MyDriver['Deferred']:
txt += [' ' + line]
txt += [' }']
@ -1456,28 +1458,21 @@ def put_mkDriver(MyDriver):
def put_postamble(MyDriver):
txt = ['']
txt += ['namespace eval %s {' % MyDriver['namespace']]
txt += [' namespace export debug_threshold']
txt += [' namespace export debug_log']
txt += [' namespace export sics_log']
txt += [' namespace export mkDriver']
txt += ['}']
txt += ['']
if 'add_args' in MyDriver:
line = 'proc add_%s {name ip_address tcp_port %s} {' % (MyDriver['name'], MyDriver['add_args'])
line = 'proc %s::add_driver {name device_class simulation_flag ip_address tcp_port %s} {' % (MyDriver['namespace'], MyDriver['add_args'])
else:
line = 'proc add_%s {name ip_address tcp_port} {' % MyDriver['name']
line = 'proc %s::add_driver {name device_class simulation_flag ip_address tcp_port} {' % (MyDriver['namespace'])
txt += [line]
txt += [' set catch_status [ catch {']
if 'make_args' in MyDriver:
make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()])
txt += [' %s::sics_log 9 "add_%s ${name} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['name'], make_args)]
txt += [' %s::sics_log 9 "%s::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)]
else:
txt += [' %s::sics_log 9 "add_%s ${name} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['name'])]
txt += [' %s::sics_log 9 "%s::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])]
if ('WrapperProperty' in MyDriver) and ('nosctcontroller' in MyDriver['WrapperProperty']):
txt += [' %s::sics_log 9 "No sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['name'])]
else:
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
txt += [' if {[string equal -nocase "${simulation_flag}" "false"]} {']
txt += [' if {[string equal -nocase "aqadapter" "${ip_address}"]} {']
txt += [' %s::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"' % MyDriver['namespace']]
txt += [' makesctcontroller sct_${name} aqadapter ${tcp_port}']
@ -1491,17 +1486,17 @@ def put_postamble(MyDriver):
txt += [' makesctcontroller sct_${name} %s ${ip_address}:${tcp_port}' % MyDriver['protocol']]
txt += [' }']
txt += [' } else {']
txt += [' %s::sics_log 9 "[%s] => Null sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['simulation_group'], MyDriver['name'])]
txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['name'])]
txt += [' %s::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"' % MyDriver['namespace']]
txt += [' makesctcontroller sct_${name} aqadapter NULL']
txt += [' }']
if 'make_args' in MyDriver:
make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()])
txt += [' %s::sics_log 1 "%s::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)]
txt += [' %s::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} %s' % (MyDriver['namespace'], make_args)]
txt += [' %s::sics_log 1 "%s::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)]
txt += [' %s::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s' % (MyDriver['namespace'], make_args)]
else:
txt += [' %s::sics_log 1 "%s::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])]
txt += [' %s::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}' % (MyDriver['namespace'])]
txt += [' %s::sics_log 1 "%s::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])]
txt += [' %s::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}' % (MyDriver['namespace'])]
# TODO
#txt += [' %s::sics_log "makesctemon ${name} /sics/${name}/emon/monmode /sics/${name}/emon/isintol /sics/${name}/emon/errhandler"' % (MyDriver['namespace'])]
# txt += [' makesctemon ${name} /sics/${name}/emon/monmode /sics/${name}/emon/isintol /sics/${name}/emon/errhandler']
@ -1509,8 +1504,29 @@ def put_postamble(MyDriver):
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}']
txt += ['']
txt += ['clientput "file evaluation of %s"' % MyDriver['filename']]
txt += ['%s::sics_log 9 "file evaluation of %s"' % (MyDriver['namespace'], MyDriver['filename'])]
txt += ['namespace eval %s {' % MyDriver['namespace']]
txt += [' namespace export debug_threshold']
txt += [' namespace export debug_log']
txt += [' namespace export sics_log']
txt += [' namespace export mkDriver']
txt += [' namespace export add_driver']
txt += ['}']
txt += ['']
if 'add_args' in MyDriver:
line = 'proc add_%s {name ip_address tcp_port %s} {' % (MyDriver['name'], MyDriver['add_args'])
else:
line = 'proc add_%s {name ip_address tcp_port} {' % MyDriver['name']
txt += [line]
txt += [' set simulation_flag "[string tolower [SplitReply [%s]]]"' % MyDriver['simulation_group']]
line = ' %s::add_driver ${name} "%s" "${simulation_flag}" ${ip_address} ${tcp_port}' % (MyDriver['namespace'], MyDriver['class'])
if 'add_args' in MyDriver:
for arg in MyDriver['add_args'].split():
line += ' "${%s}"' % arg
txt += [line]
txt += ['}']
txt += ['']
txt += ['clientput "file evaluation of sct_%s.tcl"' % MyDriver['name']]
txt += ['%s::sics_log 9 "file evaluation of sct_%s.tcl"' % (MyDriver['namespace'], MyDriver['name'])]
emit(txt)
def put_read_config(MyDriver):
@ -1520,6 +1536,8 @@ def put_read_config(MyDriver):
txt += [' set ns "%s"' % MyDriver['namespace']]
txt += [' dict for {k u} $::config_dict {']
txt += [' if { [dict exists $u "implementation"] } {']
txt += [' set simulation_flag "[string tolower [SplitReply [%s]]]"' % MyDriver['simulation_group']]
txt += [' set device_class "%s"' % MyDriver['class']]
txt += [' if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {']
txt += [' continue']
txt += [' }']
@ -1527,6 +1545,12 @@ def put_read_config(MyDriver):
txt += [' if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {']
txt += [' continue']
txt += [' }']
txt += [' if { [dict exists $u "simulation_group"] } {']
txt += [' set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]']
txt += [' }']
txt += [' if { [dict exists $u "device_class"] } {']
txt += [' set device_class "[dict get $u "device_class"]"']
txt += [' }']
txt += [' set name [dict get $u name]']
txt += [' set implementation [dict get $u "implementation"]']
txt += [' if { !([dict exists $::config_dict $implementation]) } {']
@ -1537,9 +1561,9 @@ def put_read_config(MyDriver):
txt += [' continue']
txt += [' }']
txt += [' if { [string equal -nocase [dict get $v "driver"] "%s"] } {' % MyDriver['name']]
txt += [' if { ![string equal -nocase [SplitReply [%s]] "false"] } {' % MyDriver['simulation_group']]
txt += [' if { ![string equal -nocase "${simulation_flag}" "false"] } {']
txt += [' set asyncqueue "null"']
txt += [' ${ns}::sics_log 9 "[%s] => using null asyncqueue"' % MyDriver['simulation_group']]
txt += [' ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"']
txt += [' } elseif { [dict exists $v "asyncqueue"] } {']
txt += [' set asyncqueue [dict get $v "asyncqueue"]']
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
@ -1582,15 +1606,15 @@ def put_read_config(MyDriver):
txt += [' error "$name is missing configuration values $missing_list"']
txt += [' }']
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
txt += [' add_%s ${name} ${ip_address} ${tcp_port} {*}$arg_list' % MyDriver['name']]
txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list']
txt += [' } else {']
txt += [' add_%s ${name} "aqadapter" ${asyncqueue} {*}$arg_list' % MyDriver['name']]
txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list']
txt += [' }']
else:
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
txt += [' add_%s ${name} ${ip_address} ${tcp_port}' % MyDriver['name']]
txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}']
txt += [' } else {']
txt += [' add_%s ${name} "aqadapter" ${asyncqueue}' % MyDriver['name']]
txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}']
txt += [' }']
txt += [' }']
txt += [' }']

0
site_ansto/instrument/util/gitloader.py Normal file → Executable file
View File

0
site_ansto/instrument/util/gitrefer.py Normal file → Executable file
View File

View File

@ -52,6 +52,9 @@
#include "lld.h"
#include "exebuf.h"
#define CLEAN_LOCKED 1
#define CLEAN_MISSING 2
static int parameterChange = 0;
/*-----------------------------------------------------------------------*/
int StatusFileTask(void *data)
@ -217,6 +220,94 @@ static int listRestoreErr(pRestoreObj self, SConnection * pCon)
return 1;
}
/*-----------------------------------------------------------------------*/
static int cleanRestoreErr(pRestoreObj self, SConnection * pCon, int hard)
{
char command[1024];
char message[1024];
char *errMsg = NULL;
int status;
int newErrList;
pDynString data = NULL;
pStringDict dict;
int count_in = 0;
int count_ex = 0;
if (!self->errList)
return 1;
data = CreateDynString(256,256);
if (data == NULL) {
SCWrite(pCon,"ERROR: out of memory cleaning errors",eError);
return 0;
}
dict = CreateStringDict();
if (dict == NULL) {
SCWrite(pCon,"ERROR: out of memory cleaning errors",eError);
DeleteDynString(data);
return 0;
}
/* create new list */
newErrList = LLDstringCreate();
if (newErrList < 0) {
SCWrite(pCon,"ERROR: out of blobs cleaning errors",eError);
DeleteDynString(data);
DeleteStringDict(dict);
return 0;
}
status = LLDnodePtr2First(self->errList);
while (status == 1) {
LLDstringData(self->errList, command);
status = LLDnodePtr2Next(self->errList);
if (status != 1) {
/* Error */
errMsg = "ERROR: unpaired error cleaning errors";
break;
}
LLDstringData(self->errList, message);
if (command[0] == '#' || message[0] != '#') {
/* Error */
errMsg = "ERROR: sequence error cleaning errors";
break;
}
DynStringClear(data);
DynStringConcat(data, command);
DynStringConcat(data, message);
status = LLDnodePtr2Next(self->errList);
++count_in;
/* Skip duplicate messages */
if (StringDictExists(dict, GetCharArray(data)))
continue;
/* Skip "configured locked!" messages */
if (hard == CLEAN_LOCKED &&
strstr(message, "#ERR: ERROR: variable ") &&
strstr(message, " is configured locked!"))
continue;
/* Skip "not found" messages */
if (hard == CLEAN_MISSING &&
strstr(message, "#ERR: Object ") &&
strstr(message, "not found"))
continue;
/* add to dictionary and new list */
StringDictAddPair(dict, GetCharArray(data), "");
LLDstringAppend(newErrList, command);
LLDstringAppend(newErrList, message);
++count_ex;
}
if (errMsg) {
SCWrite(pCon, errMsg, eError);
LLDstringDelete(newErrList);
} else {
/* swap lists */
LLDstringDelete(self->errList);
self->errList = newErrList;
SCPrintf(pCon, eLog, "CleanErr: %d pairs in, %d pairs out", count_in, count_ex);
}
DeleteDynString(data);
DeleteStringDict(dict);
return 1;
}
/*-----------------------------------------------------------------------*/
int RestoreStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[])
@ -245,6 +336,13 @@ int RestoreStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
} else {
if (strcasecmp(argv[1], "listerr") == 0) {
return listRestoreErr(self, pCon);
} else if (strcasecmp(argv[1], "cleanerr") == 0) {
if (argc > 2 && strcasecmp(argv[2], "locked") == 0)
return cleanRestoreErr(self, pCon, CLEAN_LOCKED);
else if (argc > 2 && strcasecmp(argv[2], "missing") == 0)
return cleanRestoreErr(self, pCon, CLEAN_MISSING);
else
return cleanRestoreErr(self, pCon, 0);
} else if (strcasecmp(argv[1], "killerr") == 0) {
if (self->errList >= 0) {
LLDdeleteBlob(self->errList);

16
tasub.c
View File

@ -370,14 +370,14 @@ int TasUBFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
/*
curvature motors may be missing, anything else is a serious problem
*/
status += testMotor(pNew, pCon, "a1", A1);
status += testMotor(pNew, pCon, "a2", A2);
status += testMotor(pNew, pCon, "a3", A3);
status += testMotor(pNew, pCon, "a4", A4);
status += testMotor(pNew, pCon, "sgu", SGU);
status += testMotor(pNew, pCon, "sgl", SGL);
status += testMotor(pNew, pCon, "a5", A5);
status += testMotor(pNew, pCon, "a6", A6);
status += testMotor(pNew, pCon, pNew->motname[A1], A1);
status += testMotor(pNew, pCon, pNew->motname[A2], A2);
status += testMotor(pNew, pCon, pNew->motname[A3], A3);
status += testMotor(pNew, pCon, pNew->motname[A4], A4);
status += testMotor(pNew, pCon, pNew->motname[SGU], SGU);
status += testMotor(pNew, pCon, pNew->motname[SGL], SGL);
status += testMotor(pNew, pCon, pNew->motname[A5], A5);
status += testMotor(pNew, pCon, pNew->motname[A6], A6);
if (status != 8) {
SCWrite(pCon, "ERROR: a required motor is missing, tasub NOT installed",
eError);