Merge branch 'RELEASE-3_1'

Conflicts:
	sics/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl
	sics/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl
	sics/site_ansto/instrument/config/environment/isotech_ps.sct
	sics/site_ansto/instrument/config/environment/isotech_ps_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct
	sics/site_ansto/instrument/config/environment/temperature/julabo_lh45_gen_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/ls340_sct.tcl
	sics/site_ansto/instrument/util/gen_sct.py
This commit is contained in:
Douglas Clowes
2014-11-13 13:52:46 +11:00
18 changed files with 678 additions and 307 deletions

View File

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

View File

@ -93,6 +93,7 @@ proc ::anticollider::genveto {veto_rules} {
lappend condlist $mot $range lappend condlist $mot $range
} }
lappend veto_region($vp(for)) [list $vp(forbid) @and $condlist] lappend veto_region($vp(for)) [list $vp(forbid) @and $condlist]
unset condlist
} elseif [info exists vp(when)] { } elseif [info exists vp(when)] {
lappend veto_region($vp(for)) [list $vp(forbid) $vp(when) $vp(in)] lappend veto_region($vp(for)) [list $vp(forbid) $vp(when) $vp(in)]
} else { } else {
@ -132,12 +133,12 @@ proc ::anticollider::veto_region_acscript {args} {
foreach row $veto_region($regmot) { foreach row $veto_region($regmot) {
if { [lindex $row 1] == "@and"} { if { [lindex $row 1] == "@and"} {
set forbid [lindex $row 0] set forbid [lindex $row 0]
set veto 0 set veto 1
foreach {mot range} [lindex $row 2] { foreach {mot range} [lindex $row 2] {
set pos [SplitReply [$mot]] set pos [SplitReply [$mot]]
foreach {lower upper} [join $range] { foreach {lower upper} [join $range] {
if {$pos >= $lower && $pos <= $upper} { if {$pos < $lower || $pos > $upper} {
set veto 1 set veto 0
break break
} }
} }
@ -147,7 +148,10 @@ proc ::anticollider::veto_region_acscript {args} {
} else { } else {
foreach {min max} $forbid {} foreach {min max} $forbid {}
if {$min <= $target && $target <= $max} { if {$min <= $target && $target <= $max} {
error "ERROR:The range ($forbid) is forbidden for $regmot when [lindex $row 2]" foreach {mot range} [lindex $row 2] {
lappend msg [list $mot in $range]
}
error "ERROR:The range ($forbid) is forbidden for $regmot when [join $msg { and }]"
} }
} }
} else { } else {
@ -212,15 +216,13 @@ proc ::anticollider::init {} {
lappend ::anticollider::scripts ::anticollider::veto_region_acscript lappend ::anticollider::scripts ::anticollider::veto_region_acscript
proc ::anticollider::acscript {args} { proc ::anticollider::acscript {args} {
set catch_status [ catch { set catch_status [ catch {
if {[::anticollider::enable $args] == "false"} { foreach {regmot target} $args {
return anticollision add 0 $regmot $target
} else {
foreach {regmot target} $args {
anticollision add 0 $regmot $target
}
} }
foreach script $::anticollider::scripts { if {[::anticollider::enable $args] == "true"} {
$script {*}$args foreach script $::anticollider::scripts {
$script {*}$args
}
} }
} message ] } message ]
handle_acscript_exception $catch_status $message handle_acscript_exception $catch_status $message

View File

@ -4,42 +4,73 @@ driver he3_polanal = {
protocol = std; protocol = std;
class = instrument; class = instrument;
simulation_group = rfgen_simulation; simulation_group = rfgen_simulation;
make_args = '{has_pol true} {has_anal true}';
group polariser = { group polariser = {
conditional = '[string equal -nocase ${has_pol} "true"]';
type = float;
var spin = { var spin = {
type = text;
readable = 900; readable = 900;
read_command = 'polariser'; read_command = 'polariser';
read_function = rdValue; read_function = rdValue;
writeable = 1; writeable = 1;
write_command = 'polariser'; write_command = 'polariser';
check_function = chkWrite; check_function = chkWrite;
allowed = "+,-,0" allowed = "+,-,Refresh"
} }
var Amplitude = { type = text; } var amplitude = { }
var Freq = { type = text; units = 'Hertz'; } var freq = { units = 'Hertz'; }
var Phase = { type = text; units = 'Degree'; } var phase = { units = 'Degree'; }
var Time2 = { type = text; units = 'Second'; } var time2 = { units = 'Second'; }
var Field = { type = text; units = 'Oersted'; } var field = { units = 'Oersted'; }
var timestamp = { }
} }
group polariser_start = {
conditional = '[string equal -nocase ${has_pol} "true"]';
type = float;
var spin = { }
var amplitude = { }
var freq = { units = 'Hertz'; }
var phase = { units = 'Degree'; }
var time2 = { units = 'Second'; }
var field = { units = 'Oersted'; }
var timestamp = { }
}
group analyser = { group analyser = {
conditional = '[string equal -nocase ${has_anal} "true"]';
type = float;
var spin = { var spin = {
type = text;
readable = 900; readable = 900;
read_command = 'analyser'; read_command = 'analyser';
read_function = rdValue; read_function = rdValue;
writeable = 1; writeable = 1;
write_command = 'analyser'; write_command = 'analyser';
check_function = chkWrite; check_function = chkWrite;
allowed = "+,-,0" allowed = "+,-,Refresh"
} }
var Amplitude = { type = text; } var amplitude = { }
var Freq = { type = text; units = 'Hertz'; } var freq = { units = 'Hertz'; }
var Phase = { type = text; units = 'Degree'; } var phase = { units = 'Degree'; }
var Time2 = { type = text; units = 'Second'; } var time2 = { units = 'Second'; }
var Field = { type = text; units = 'Oersted'; } var field = { units = 'Oersted'; }
var timestamp = { }
} }
group analyser_start = {
conditional = '[string equal -nocase ${has_anal} "true"]';
type = float;
var spin = { }
var amplitude = { }
var freq = { units = 'Hertz'; }
var phase = { units = 'Degree'; }
var time2 = { units = 'Second'; }
var field = { units = 'Oersted'; }
var timestamp = { }
}
code chkWrite = {%% code chkWrite = {%%
[namespace current]::rdValue ${tc_root} [namespace current]::rdValue ${tc_root}
clientput [sct result]
%%} %%}
code rdValue = {%% code rdValue = {%%
@ -61,25 +92,13 @@ driver he3_polanal = {
set data [lindex ${dlist} 1] set data [lindex ${dlist} 1]
} }
set path [pathname [sct]] set path [pathname [sct]]
if {[llength ${dlist}] > 2} { set timestamp [clock seconds]
set new_value [lindex ${dlist} 2] [namespace current]::do_update ${path}/amplitude ${dlist} 2
if { "${new_value}" == "NaN" } { [namespace current]::do_update ${path}/freq ${dlist} 3
set new_value 0 [namespace current]::do_update ${path}/phase ${dlist} 4
} [namespace current]::do_update ${path}/time2 ${dlist} 5
hupdateif ${path}/Amplitude "${new_value}" [namespace current]::do_update ${path}/field ${dlist} 6
} hupdateif ${path}/timestamp ${timestamp}
if {[llength ${dlist}] > 3} {
hupdateif ${path}/Freq "[lindex ${dlist} 3]"
}
if {[llength ${dlist}] > 4} {
hupdateif ${path}/Phase "[lindex ${dlist} 4]"
}
if {[llength ${dlist}] > 5} {
hupdateif ${path}/Time2 "[lindex ${dlist} 5]"
}
if {[llength ${dlist}] > 6} {
hupdateif ${path}/Field "[lindex ${dlist} 6]"
}
%%} %%}
code setValue = {%% code setValue = {%%
@ -87,6 +106,9 @@ driver he3_polanal = {
if {[string equal -nocase [sct target] "refresh"]} { if {[string equal -nocase [sct target] "refresh"]} {
set cmd "${cmd_str}" set cmd "${cmd_str}"
} }
if {[string equal -nocase [sct target] "minus"]} {
set cmd "${cmd_str} -"
}
if {[string equal -nocase [sct target] "dn"]} { if {[string equal -nocase [sct target] "dn"]} {
set cmd "${cmd_str} -" set cmd "${cmd_str} -"
} }
@ -96,6 +118,9 @@ driver he3_polanal = {
if {[sct target] == "-" || [sct target] == -1} { if {[sct target] == "-" || [sct target] == -1} {
set cmd "${cmd_str} -" set cmd "${cmd_str} -"
} }
if {[string equal -nocase [sct target] "plus"]} {
set cmd "${cmd_str} +"
}
if {[string equal -nocase [sct target] "up"]} { if {[string equal -nocase [sct target] "up"]} {
set cmd "${cmd_str} +" set cmd "${cmd_str} +"
} }
@ -103,4 +128,26 @@ driver he3_polanal = {
set cmd "${cmd_str} +" set cmd "${cmd_str} +"
} }
%%} %%}
code preamble = {
@TCL
proc do_update { node dlist idx } {
if {[llength ${dlist}] > ${idx}} {
if {![string is double [lindex ${dlist} ${idx}]]} {
hupdateif ${node} 0.0
} else {
hupdateif ${node} [lindex ${dlist} ${idx}]
}
}
}
@END
}
code postamble = {
@TCL
proc stash {node} {
foreach arg {spin amplitude freq phase time2 field timestamp} {
hupdateif ${node}_start/${arg} [hval ${node}/${arg}]
}
}
@END
}
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::bruker::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/bruker_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/bruker_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -51,7 +54,9 @@ proc ::scobj::bruker::add_driver {name device_class simulation_flag ip_address t
makesctcontroller sct_${name} astvelsel ${ip_address}:${tcp_port} makesctcontroller sct_${name} astvelsel ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::bruker::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for bruker" ::scobj::bruker::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for bruker"
::scobj::bruker::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} }
::scobj::bruker::sics_log 1 "::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}" ::scobj::bruker::sics_log 1 "::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}"
::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol} ::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}
@ -69,7 +74,7 @@ namespace eval ::scobj::bruker {
proc add_bruker {name ip_address tcp_port id datype {tol 0.1}} { proc add_bruker {name ip_address tcp_port id datype {tol 0.1}} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::bruker::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${{tol}" "${0.1}}" ::scobj::bruker::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}
} }
clientput "file evaluation of sct_bruker.tcl" clientput "file evaluation of sct_bruker.tcl"
@ -108,20 +113,31 @@ proc ::scobj::bruker::read_config {} {
if { ![string equal -nocase "${simulation_flag}" "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip] set ip_address [dict get $v ip]
set tcp_port [dict get $v port] set tcp_port [dict get $v port]
} makesctcontroller sct_${name} astvelsel ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else { } else {
if { [dict exists $v "asyncprotocol"] } { if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"] set asyncprotocol [dict get $v "asyncprotocol"]
} else { } else {
set asyncprotocol ${name}_protocol set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol} MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } { if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]"
} }
} }
@ -132,6 +148,7 @@ proc ::scobj::bruker::read_config {} {
if { [dict exists $v "timeout"] } { if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]" ${asyncqueue} timeout "[dict get $v "timeout"]"
} }
makesctcontroller sct_${name} aqadapter ${asyncqueue}
} }
set arg_list [list] set arg_list [list]
set missing_list [list] set missing_list [list]
@ -148,11 +165,7 @@ proc ::scobj::bruker::read_config {} {
if { [llength $missing_list] > 0 } { if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
${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
}
} }
} }
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::knauer_pump::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/knauer_pump_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/knauer_pump_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -583,7 +586,12 @@ proc ::scobj::knauer_pump::volume_checkstatus {tc_root} {
# volume_checkstatus hook code goes here # volume_checkstatus hook code goes here
if {[sct driving]} { if {[sct driving]} {
set sp "[sct target]" set sp "[sct target]"
set pv "[hval ${tc_root}/[sct driveable]]" if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
set pv "${sp}"
hupdateif ${tc_root}/[sct driveable] ${sp}
} else {
set pv "[hval ${tc_root}/[sct driveable]]"
}
if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { abs(${pv} - ${sp}) <= [sct tolerance] } {
if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time] } {
if { [hpropexists [sct] settle_time_start] } { if { [hpropexists [sct] settle_time_start] } {
@ -881,9 +889,6 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/dummy plain spy none hfactory ${scobj_hpath}/dummy plain spy none
hsetprop ${scobj_hpath}/dummy data "false"
hsetprop ${scobj_hpath}/dummy klass "@none"
hsetprop ${scobj_hpath}/dummy type "part"
hfactory ${scobj_hpath}/dummy/glp plain user text hfactory ${scobj_hpath}/dummy/glp plain user text
hsetprop ${scobj_hpath}/dummy/glp read ${ns}::getValue ${scobj_hpath} read_glp {GLP?} hsetprop ${scobj_hpath}/dummy/glp read ${ns}::getValue ${scobj_hpath} read_glp {GLP?}
@ -898,6 +903,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/dummy/glp type "part" hsetprop ${scobj_hpath}/dummy/glp type "part"
hsetprop ${scobj_hpath}/dummy/glp nxalias "${name}_dummy_glp" hsetprop ${scobj_hpath}/dummy/glp nxalias "${name}_dummy_glp"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/dummy/glp 1
hsetprop ${scobj_hpath}/dummy/glp simulated false
} else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/dummy/glp simulated true
}
hfactory ${scobj_hpath}/dummy/status plain user text hfactory ${scobj_hpath}/dummy/status plain user text
hsetprop ${scobj_hpath}/dummy/status read ${ns}::getValue ${scobj_hpath} read_status {STATUS?} hsetprop ${scobj_hpath}/dummy/status read ${ns}::getValue ${scobj_hpath} read_status {STATUS?}
hsetprop ${scobj_hpath}/dummy/status read_status ${ns}::read_status ${scobj_hpath} hsetprop ${scobj_hpath}/dummy/status read_status ${ns}::read_status ${scobj_hpath}
@ -912,16 +925,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/dummy/status nxalias "${name}_dummy_status" hsetprop ${scobj_hpath}/dummy/status nxalias "${name}_dummy_status"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/dummy/glp 1
${sct_controller} poll ${scobj_hpath}/dummy/status 1 ${sct_controller} poll ${scobj_hpath}/dummy/status 1
hsetprop ${scobj_hpath}/dummy/status simulated false
} else { } else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/dummy/status simulated true
} }
hsetprop ${scobj_hpath}/dummy data "false"
hsetprop ${scobj_hpath}/dummy klass "@none"
hsetprop ${scobj_hpath}/dummy type "part"
hfactory ${scobj_hpath}/pump plain spy none hfactory ${scobj_hpath}/pump plain spy none
hsetprop ${scobj_hpath}/pump data "true"
hsetprop ${scobj_hpath}/pump klass "@none"
hsetprop ${scobj_hpath}/pump type "part"
hfactory ${scobj_hpath}/pump/remote plain user int hfactory ${scobj_hpath}/pump/remote plain user int
hsetprop ${scobj_hpath}/pump/remote read ${ns}::getValue ${scobj_hpath} remote_read {REMOTE?} hsetprop ${scobj_hpath}/pump/remote read ${ns}::getValue ${scobj_hpath} remote_read {REMOTE?}
@ -940,6 +954,15 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/remote type "part" hsetprop ${scobj_hpath}/pump/remote type "part"
hsetprop ${scobj_hpath}/pump/remote nxalias "${name}_pump_remote" hsetprop ${scobj_hpath}/pump/remote nxalias "${name}_pump_remote"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/remote 1
${sct_controller} write ${scobj_hpath}/pump/remote
hsetprop ${scobj_hpath}/pump/remote simulated false
} else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/remote simulated true
}
hfactory ${scobj_hpath}/pump/state plain user text hfactory ${scobj_hpath}/pump/state plain user text
hsetprop ${scobj_hpath}/pump/state read ${ns}::state_fetch ${scobj_hpath} rdValue { } hsetprop ${scobj_hpath}/pump/state read ${ns}::state_fetch ${scobj_hpath} rdValue { }
hsetprop ${scobj_hpath}/pump/state rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/pump/state rdValue ${ns}::rdValue ${scobj_hpath}
@ -953,6 +976,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/state type "part" hsetprop ${scobj_hpath}/pump/state type "part"
hsetprop ${scobj_hpath}/pump/state nxalias "${name}_pump_state" hsetprop ${scobj_hpath}/pump/state nxalias "${name}_pump_state"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/state 1
hsetprop ${scobj_hpath}/pump/state simulated false
} else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/state simulated true
}
hfactory ${scobj_hpath}/pump/status plain user text hfactory ${scobj_hpath}/pump/status plain user text
hsetprop ${scobj_hpath}/pump/status read ${ns}::status_fetch ${scobj_hpath} rdValue { } hsetprop ${scobj_hpath}/pump/status read ${ns}::status_fetch ${scobj_hpath} rdValue { }
hsetprop ${scobj_hpath}/pump/status rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/pump/status rdValue ${ns}::rdValue ${scobj_hpath}
@ -967,18 +998,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/status nxalias "${name}_pump_status" hsetprop ${scobj_hpath}/pump/status nxalias "${name}_pump_status"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/remote 1
${sct_controller} poll ${scobj_hpath}/pump/state 1
${sct_controller} poll ${scobj_hpath}/pump/status 1 ${sct_controller} poll ${scobj_hpath}/pump/status 1
${sct_controller} write ${scobj_hpath}/pump/remote hsetprop ${scobj_hpath}/pump/status simulated false
} else { } else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/status simulated true
} }
hsetprop ${scobj_hpath}/pump data "true"
hsetprop ${scobj_hpath}/pump klass "@none"
hsetprop ${scobj_hpath}/pump type "part"
hfactory ${scobj_hpath}/pump/flow plain spy none hfactory ${scobj_hpath}/pump/flow plain spy none
hsetprop ${scobj_hpath}/pump/flow data "true"
hsetprop ${scobj_hpath}/pump/flow klass "@none"
hsetprop ${scobj_hpath}/pump/flow type "part"
hfactory ${scobj_hpath}/pump/flow/pval plain user float hfactory ${scobj_hpath}/pump/flow/pval plain user float
hsetprop ${scobj_hpath}/pump/flow/pval read ${ns}::flow_fetch ${scobj_hpath} rdValue { } hsetprop ${scobj_hpath}/pump/flow/pval read ${ns}::flow_fetch ${scobj_hpath} rdValue { }
@ -994,6 +1024,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/flow/pval units "mL/min" hsetprop ${scobj_hpath}/pump/flow/pval units "mL/min"
hsetprop ${scobj_hpath}/pump/flow/pval nxalias "${name}_pump_flow_pval" hsetprop ${scobj_hpath}/pump/flow/pval nxalias "${name}_pump_flow_pval"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/flow/pval 1
hsetprop ${scobj_hpath}/pump/flow/pval simulated false
} else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/flow/pval simulated true
}
hfactory ${scobj_hpath}/pump/flow/setp plain user float hfactory ${scobj_hpath}/pump/flow/setp plain user float
hsetprop ${scobj_hpath}/pump/flow/setp write ${ns}::flow_write ${scobj_hpath} noResponse { } hsetprop ${scobj_hpath}/pump/flow/setp write ${ns}::flow_write ${scobj_hpath} noResponse { }
hsetprop ${scobj_hpath}/pump/flow/setp noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/pump/flow/setp noResponse ${ns}::noResponse ${scobj_hpath}
@ -1013,16 +1051,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/flow/setp nxalias "${name}_pump_flow_setp" hsetprop ${scobj_hpath}/pump/flow/setp nxalias "${name}_pump_flow_setp"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/flow/pval 1
${sct_controller} write ${scobj_hpath}/pump/flow/setp ${sct_controller} write ${scobj_hpath}/pump/flow/setp
hsetprop ${scobj_hpath}/pump/flow/setp simulated false
} else { } else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/flow/setp simulated true
} }
hsetprop ${scobj_hpath}/pump/flow data "true"
hsetprop ${scobj_hpath}/pump/flow klass "@none"
hsetprop ${scobj_hpath}/pump/flow type "part"
hfactory ${scobj_hpath}/pump/ratio plain spy none hfactory ${scobj_hpath}/pump/ratio plain spy none
hsetprop ${scobj_hpath}/pump/ratio data "true"
hsetprop ${scobj_hpath}/pump/ratio klass "@none"
hsetprop ${scobj_hpath}/pump/ratio type "part"
hfactory ${scobj_hpath}/pump/ratio/pval plain user text hfactory ${scobj_hpath}/pump/ratio/pval plain user text
hsetprop ${scobj_hpath}/pump/ratio/pval read ${ns}::ratio_fetch ${scobj_hpath} rdValue { } hsetprop ${scobj_hpath}/pump/ratio/pval read ${ns}::ratio_fetch ${scobj_hpath} rdValue { }
@ -1038,6 +1077,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/ratio/pval units "percent" hsetprop ${scobj_hpath}/pump/ratio/pval units "percent"
hsetprop ${scobj_hpath}/pump/ratio/pval nxalias "${name}_pump_ratio_pval" hsetprop ${scobj_hpath}/pump/ratio/pval nxalias "${name}_pump_ratio_pval"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/ratio/pval 1
hsetprop ${scobj_hpath}/pump/ratio/pval simulated false
} else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/ratio/pval simulated true
}
hfactory ${scobj_hpath}/pump/ratio/setp plain user text hfactory ${scobj_hpath}/pump/ratio/setp plain user text
hsetprop ${scobj_hpath}/pump/ratio/setp write ${ns}::ratio_write ${scobj_hpath} noResponse { } hsetprop ${scobj_hpath}/pump/ratio/setp write ${ns}::ratio_write ${scobj_hpath} noResponse { }
hsetprop ${scobj_hpath}/pump/ratio/setp noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/pump/ratio/setp noResponse ${ns}::noResponse ${scobj_hpath}
@ -1055,16 +1102,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/ratio/setp nxalias "${name}_pump_ratio_setp" hsetprop ${scobj_hpath}/pump/ratio/setp nxalias "${name}_pump_ratio_setp"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/ratio/pval 1
${sct_controller} write ${scobj_hpath}/pump/ratio/setp ${sct_controller} write ${scobj_hpath}/pump/ratio/setp
hsetprop ${scobj_hpath}/pump/ratio/setp simulated false
} else { } else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/ratio/setp simulated true
} }
hsetprop ${scobj_hpath}/pump/ratio data "true"
hsetprop ${scobj_hpath}/pump/ratio klass "@none"
hsetprop ${scobj_hpath}/pump/ratio type "part"
hfactory ${scobj_hpath}/pump/volume plain spy none hfactory ${scobj_hpath}/pump/volume plain spy none
hsetprop ${scobj_hpath}/pump/volume data "true"
hsetprop ${scobj_hpath}/pump/volume klass "@none"
hsetprop ${scobj_hpath}/pump/volume type "part"
hfactory ${scobj_hpath}/pump/volume/pval plain user float hfactory ${scobj_hpath}/pump/volume/pval plain user float
hsetprop ${scobj_hpath}/pump/volume/pval read ${ns}::volume_fetch ${scobj_hpath} volume_read { } hsetprop ${scobj_hpath}/pump/volume/pval read ${ns}::volume_fetch ${scobj_hpath} volume_read { }
@ -1080,6 +1128,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/volume/pval units "mL" hsetprop ${scobj_hpath}/pump/volume/pval units "mL"
hsetprop ${scobj_hpath}/pump/volume/pval nxalias "${name}_pump_volume_pval" hsetprop ${scobj_hpath}/pump/volume/pval nxalias "${name}_pump_volume_pval"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/volume/pval 1
hsetprop ${scobj_hpath}/pump/volume/pval simulated false
} else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/volume/pval simulated true
}
hfactory ${scobj_hpath}/pump/volume/setp plain user float hfactory ${scobj_hpath}/pump/volume/setp plain user float
hsetprop ${scobj_hpath}/pump/volume/setp read ${ns}::volume_fsm ${scobj_hpath} volume_store { } hsetprop ${scobj_hpath}/pump/volume/setp read ${ns}::volume_fsm ${scobj_hpath} volume_store { }
hsetprop ${scobj_hpath}/pump/volume/setp volume_store ${ns}::volume_store ${scobj_hpath} hsetprop ${scobj_hpath}/pump/volume/setp volume_store ${ns}::volume_store ${scobj_hpath}
@ -1107,18 +1163,20 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio
hsetprop ${scobj_hpath}/pump/volume/setp nxalias "${name}_pump_volume_setp" hsetprop ${scobj_hpath}/pump/volume/setp nxalias "${name}_pump_volume_setp"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pump/volume/pval 1
${sct_controller} poll ${scobj_hpath}/pump/volume/setp 1 ${sct_controller} poll ${scobj_hpath}/pump/volume/setp 1
${sct_controller} write ${scobj_hpath}/pump/volume/setp ${sct_controller} write ${scobj_hpath}/pump/volume/setp
hsetprop ${scobj_hpath}/pump/volume/setp simulated false
} else { } else {
::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump"
hsetprop ${scobj_hpath}/pump/volume/setp simulated true
} }
hsetprop ${scobj_hpath}/pump/volume data "true"
hsetprop ${scobj_hpath}/pump/volume klass "@none"
hsetprop ${scobj_hpath}/pump/volume type "part"
ansto_makesctdrive ${name}_pump_volume_setp ${scobj_hpath}/pump/volume/setp ${scobj_hpath}/pump/volume/pval ${sct_controller}
hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 0 hsetprop ${scobj_hpath} debug_threshold 0
if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_pump_volume_setp ${scobj_hpath}/pump/volume/setp ${scobj_hpath}/pump/volume/pval ${sct_controller}
}
# mkDriver hook code starts # mkDriver hook code starts
#hset ${scobj_hpath}/pump/remote 1 #hset ${scobj_hpath}/pump/remote 1
# mkDriver hook code ends # mkDriver hook code ends
@ -1138,7 +1196,9 @@ proc ::scobj::knauer_pump::add_driver {name device_class simulation_flag ip_addr
makesctcontroller sct_${name} knauer_ap ${ip_address}:${tcp_port} makesctcontroller sct_${name} knauer_ap ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::knauer_pump::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for knauer_pump" ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for knauer_pump"
::scobj::knauer_pump::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} }
::scobj::knauer_pump::sics_log 1 "::scobj::knauer_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::knauer_pump::sics_log 1 "::scobj::knauer_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::knauer_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ::scobj::knauer_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
@ -1156,7 +1216,7 @@ namespace eval ::scobj::knauer_pump {
proc add_knauer_pump {name ip_address tcp_port} { proc add_knauer_pump {name ip_address tcp_port} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::knauer_pump::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} ::scobj::knauer_pump::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port}
} }
clientput "file evaluation of sct_knauer_pump.tcl" clientput "file evaluation of sct_knauer_pump.tcl"
@ -1195,20 +1255,31 @@ proc ::scobj::knauer_pump::read_config {} {
if { ![string equal -nocase "${simulation_flag}" "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip] set ip_address [dict get $v ip]
set tcp_port [dict get $v port] set tcp_port [dict get $v port]
} makesctcontroller sct_${name} knauer_ap ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else { } else {
if { [dict exists $v "asyncprotocol"] } { if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"] set asyncprotocol [dict get $v "asyncprotocol"]
} else { } else {
set asyncprotocol ${name}_protocol set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol} MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } { if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]"
} }
} }
@ -1219,12 +1290,9 @@ proc ::scobj::knauer_pump::read_config {} {
if { [dict exists $v "timeout"] } { if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]" ${asyncqueue} timeout "[dict get $v "timeout"]"
} }
makesctcontroller sct_${name} aqadapter ${asyncqueue}
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
} }
} }
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::mvp_valve::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/mvp_valve_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/mvp_valve_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -59,7 +62,7 @@ namespace eval ::scobj::mvp_valve {
proc add_mvp_valve {name ip_address tcp_port id datype} { proc add_mvp_valve {name ip_address tcp_port id datype} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::mvp_valve::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" ::scobj::mvp_valve::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
} }
clientput "file evaluation of sct_mvp_valve.tcl" clientput "file evaluation of sct_mvp_valve.tcl"
@ -95,34 +98,7 @@ proc ::scobj::mvp_valve::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mvp_valve"] } { if { [string equal -nocase [dict get $v "driver"] "mvp_valve"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } { ::scobj::mvp_valve::sics_log 9 "No sctcontroller for mvp_valve"
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 arg_list [list]
set missing_list [list] set missing_list [list]
foreach arg {id datype} { foreach arg {id datype} {
@ -138,11 +114,7 @@ proc ::scobj::mvp_valve::read_config {} {
if { [llength $missing_list] > 0 } { if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
${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
}
} }
} }
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::syringe_pump::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/syringe_pump_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/syringe_pump_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -51,7 +54,9 @@ proc ::scobj::syringe_pump::add_driver {name device_class simulation_flag ip_add
makesctcontroller sct_${name} syringe ${ip_address}:${tcp_port} makesctcontroller sct_${name} syringe ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::syringe_pump::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for syringe_pump" ::scobj::syringe_pump::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for syringe_pump"
::scobj::syringe_pump::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} }
::scobj::syringe_pump::sics_log 1 "::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}" ::scobj::syringe_pump::sics_log 1 "::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
@ -69,7 +74,7 @@ namespace eval ::scobj::syringe_pump {
proc add_syringe_pump {name ip_address tcp_port id datype} { proc add_syringe_pump {name ip_address tcp_port id datype} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::syringe_pump::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" ::scobj::syringe_pump::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
} }
clientput "file evaluation of sct_syringe_pump.tcl" clientput "file evaluation of sct_syringe_pump.tcl"
@ -108,20 +113,31 @@ proc ::scobj::syringe_pump::read_config {} {
if { ![string equal -nocase "${simulation_flag}" "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip] set ip_address [dict get $v ip]
set tcp_port [dict get $v port] set tcp_port [dict get $v port]
} makesctcontroller sct_${name} syringe ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else { } else {
if { [dict exists $v "asyncprotocol"] } { if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"] set asyncprotocol [dict get $v "asyncprotocol"]
} else { } else {
set asyncprotocol ${name}_protocol set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol} MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } { if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]"
} }
} }
@ -132,6 +148,7 @@ proc ::scobj::syringe_pump::read_config {} {
if { [dict exists $v "timeout"] } { if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]" ${asyncqueue} timeout "[dict get $v "timeout"]"
} }
makesctcontroller sct_${name} aqadapter ${asyncqueue}
} }
set arg_list [list] set arg_list [list]
set missing_list [list] set missing_list [list]
@ -148,11 +165,7 @@ proc ::scobj::syringe_pump::read_config {} {
if { [llength $missing_list] > 0 } { if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
${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
}
} }
} }
} }

View File

@ -3,8 +3,8 @@ driver eurotherm_3200 = {
protocol = modbus_ap; protocol = modbus_ap;
class = environment; class = environment;
simulation_group = environment_simulation; simulation_group = environment_simulation;
add_args = 'id datype dev_id tol'; add_args = 'id datype dev_id {tol 5 } {lowerlimit 0} {upperlimit 500}';
make_args = 'id datype dev_id tol'; make_args = 'id datype dev_id {tol 5} {lowerlimit 0} {upperlimit 500}';
group util = { group util = {
data = false; control = false; nxsave = false; mutable = false; data = false; control = false; nxsave = false; mutable = false;
@ -17,7 +17,7 @@ driver eurotherm_3200 = {
var sensor = { read_command = '1'; permlink = 'T.S01'; }; var sensor = { read_command = '1'; permlink = 'T.S01'; };
writeable = 1; writeable = 1;
var setpoint = { read_command = '2'; write_command = '2'; permlink = 'T.SP01'; var setpoint = { read_command = '2'; write_command = '2'; permlink = 'T.SP01';
driveable = loop1/sensor; lowerlimit = 0; upperlimit =40; tolerance = '${tol}'; driveable = loop1/sensor; lowerlimit = '${lowerlimit}'; upperlimit = '${upperlimit}'; tolerance = '${tol}';
}; };
} }
group loop1_extra = { group loop1_extra = {

View File

@ -10,9 +10,12 @@ proc ::scobj::eurotherm_3200::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/eurotherm_3200_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/eurotherm_3200_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -86,7 +89,12 @@ proc ::scobj::eurotherm_3200::checkstatus {tc_root} {
# checkstatus hook code goes here # checkstatus hook code goes here
if {[sct driving]} { if {[sct driving]} {
set sp "[sct target]" set sp "[sct target]"
set pv "[hval ${tc_root}/[sct driveable]]" if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
set pv "${sp}"
hupdateif ${tc_root}/[sct driveable] ${sp}
} else {
set pv "[hval ${tc_root}/[sct driveable]]"
}
if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { abs(${pv} - ${sp}) <= [sct tolerance] } {
if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time] } {
if { [hpropexists [sct] settle_time_start] } { if { [hpropexists [sct] settle_time_start] } {
@ -224,8 +232,8 @@ proc ::scobj::eurotherm_3200::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } { proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id {tol 5} {lowerlimit 0} {upperlimit 500} } {
::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -237,9 +245,6 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/loop1 plain spy none hfactory ${scobj_hpath}/loop1 plain spy none
hsetprop ${scobj_hpath}/loop1 data "true"
hsetprop ${scobj_hpath}/loop1 klass "@none"
hsetprop ${scobj_hpath}/loop1 type "part"
hfactory ${scobj_hpath}/loop1/sensor plain user float hfactory ${scobj_hpath}/loop1/sensor plain user float
hsetprop ${scobj_hpath}/loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {1} hsetprop ${scobj_hpath}/loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {1}
@ -256,6 +261,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1/sensor type "part" hsetprop ${scobj_hpath}/loop1/sensor type "part"
hsetprop ${scobj_hpath}/loop1/sensor nxalias "${name}_loop1_sensor" hsetprop ${scobj_hpath}/loop1/sensor nxalias "${name}_loop1_sensor"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1/sensor 1
hsetprop ${scobj_hpath}/loop1/sensor simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1/sensor simulated true
}
hfactory ${scobj_hpath}/loop1/setpoint plain user float hfactory ${scobj_hpath}/loop1/setpoint plain user float
hsetprop ${scobj_hpath}/loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {2} hsetprop ${scobj_hpath}/loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {2}
hsetprop ${scobj_hpath}/loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
@ -271,8 +284,8 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1/setpoint data true hsetprop ${scobj_hpath}/loop1/setpoint data true
hsetprop ${scobj_hpath}/loop1/setpoint mutable true hsetprop ${scobj_hpath}/loop1/setpoint mutable true
hsetprop ${scobj_hpath}/loop1/setpoint nxsave true hsetprop ${scobj_hpath}/loop1/setpoint nxsave true
hsetprop ${scobj_hpath}/loop1/setpoint lowerlimit 0 hsetprop ${scobj_hpath}/loop1/setpoint lowerlimit ${lowerlimit}
hsetprop ${scobj_hpath}/loop1/setpoint upperlimit 40 hsetprop ${scobj_hpath}/loop1/setpoint upperlimit ${upperlimit}
hsetprop ${scobj_hpath}/loop1/setpoint tolerance ${tol} hsetprop ${scobj_hpath}/loop1/setpoint tolerance ${tol}
hsetprop ${scobj_hpath}/loop1/setpoint permlink data_set "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}/loop1/setpoint @description "T[format "%02d" ${id}]SP01"
@ -283,17 +296,19 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1/setpoint nxalias "${name}_loop1_setpoint" hsetprop ${scobj_hpath}/loop1/setpoint nxalias "${name}_loop1_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/loop1/setpoint 1 ${sct_controller} poll ${scobj_hpath}/loop1/setpoint 1
${sct_controller} write ${scobj_hpath}/loop1/setpoint ${sct_controller} write ${scobj_hpath}/loop1/setpoint
hsetprop ${scobj_hpath}/loop1/setpoint simulated false
} else { } else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1/setpoint simulated true
} }
hsetprop ${scobj_hpath}/loop1 data "true"
hsetprop ${scobj_hpath}/loop1 klass "@none"
hsetprop ${scobj_hpath}/loop1 type "part"
ansto_makesctdrive ${name}_loop1_setpoint ${scobj_hpath}/loop1/setpoint ${scobj_hpath}/loop1/sensor ${sct_controller}
hfactory ${scobj_hpath}/loop1_extra plain spy none hfactory ${scobj_hpath}/loop1_extra plain spy none
hsetprop ${scobj_hpath}/loop1_extra data "false"
hsetprop ${scobj_hpath}/loop1_extra klass "@none"
hsetprop ${scobj_hpath}/loop1_extra type "part"
hfactory ${scobj_hpath}/loop1_extra/active_setpoint plain user float hfactory ${scobj_hpath}/loop1_extra/active_setpoint plain user float
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {15} hsetprop ${scobj_hpath}/loop1_extra/active_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {15}
@ -307,6 +322,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint type "part" hsetprop ${scobj_hpath}/loop1_extra/active_setpoint type "part"
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxalias "${name}_loop1_extra_active_setpoint" hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxalias "${name}_loop1_extra_active_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/active_setpoint 1
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint simulated true
}
hfactory ${scobj_hpath}/loop1_extra/alarm1_thresh plain user float hfactory ${scobj_hpath}/loop1_extra/alarm1_thresh plain user float
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh read ${ns}::getValue ${scobj_hpath} rdValue {13} hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh read ${ns}::getValue ${scobj_hpath} rdValue {13}
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh rdValue ${ns}::rdValue ${scobj_hpath}
@ -322,6 +345,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh type "part" hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh type "part"
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxalias "${name}_loop1_extra_alarm1_thresh" hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxalias "${name}_loop1_extra_alarm1_thresh"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm1_thresh 1
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm1_thresh
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh simulated true
}
hfactory ${scobj_hpath}/loop1_extra/alarm2_thresh plain user float hfactory ${scobj_hpath}/loop1_extra/alarm2_thresh plain user float
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh read ${ns}::getValue ${scobj_hpath} rdValue {14} hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh read ${ns}::getValue ${scobj_hpath} rdValue {14}
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh rdValue ${ns}::rdValue ${scobj_hpath}
@ -337,6 +369,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh type "part" hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh type "part"
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxalias "${name}_loop1_extra_alarm2_thresh" hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxalias "${name}_loop1_extra_alarm2_thresh"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm2_thresh 1
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm2_thresh
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh simulated true
}
hfactory ${scobj_hpath}/loop1_extra/manual_output plain user float hfactory ${scobj_hpath}/loop1_extra/manual_output plain user float
hsetprop ${scobj_hpath}/loop1_extra/manual_output read ${ns}::getValue ${scobj_hpath} rdValue {3} hsetprop ${scobj_hpath}/loop1_extra/manual_output read ${ns}::getValue ${scobj_hpath} rdValue {3}
hsetprop ${scobj_hpath}/loop1_extra/manual_output rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/manual_output rdValue ${ns}::rdValue ${scobj_hpath}
@ -349,6 +390,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/manual_output type "part" hsetprop ${scobj_hpath}/loop1_extra/manual_output type "part"
hsetprop ${scobj_hpath}/loop1_extra/manual_output nxalias "${name}_loop1_extra_manual_output" hsetprop ${scobj_hpath}/loop1_extra/manual_output nxalias "${name}_loop1_extra_manual_output"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/manual_output 1
hsetprop ${scobj_hpath}/loop1_extra/manual_output simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/manual_output simulated true
}
hfactory ${scobj_hpath}/loop1_extra/power_limit_high plain user float hfactory ${scobj_hpath}/loop1_extra/power_limit_high plain user float
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high read ${ns}::getValue ${scobj_hpath} rdValue {30} hsetprop ${scobj_hpath}/loop1_extra/power_limit_high read ${ns}::getValue ${scobj_hpath} rdValue {30}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/power_limit_high rdValue ${ns}::rdValue ${scobj_hpath}
@ -364,6 +413,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high type "part" hsetprop ${scobj_hpath}/loop1_extra/power_limit_high type "part"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxalias "${name}_loop1_extra_power_limit_high" hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxalias "${name}_loop1_extra_power_limit_high"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_high 1
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_high
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high simulated true
}
hfactory ${scobj_hpath}/loop1_extra/power_limit_low plain user float hfactory ${scobj_hpath}/loop1_extra/power_limit_low plain user float
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low read ${ns}::getValue ${scobj_hpath} rdValue {31} hsetprop ${scobj_hpath}/loop1_extra/power_limit_low read ${ns}::getValue ${scobj_hpath} rdValue {31}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/power_limit_low rdValue ${ns}::rdValue ${scobj_hpath}
@ -379,6 +437,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low type "part" hsetprop ${scobj_hpath}/loop1_extra/power_limit_low type "part"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxalias "${name}_loop1_extra_power_limit_low" hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxalias "${name}_loop1_extra_power_limit_low"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_low 1
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_low
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low simulated true
}
hfactory ${scobj_hpath}/loop1_extra/power_slew_rate plain user float hfactory ${scobj_hpath}/loop1_extra/power_slew_rate plain user float
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {37} hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {37}
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate rdValue ${ns}::rdValue ${scobj_hpath}
@ -394,6 +461,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate type "part" hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate type "part"
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxalias "${name}_loop1_extra_power_slew_rate" hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxalias "${name}_loop1_extra_power_slew_rate"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_slew_rate 1
${sct_controller} write ${scobj_hpath}/loop1_extra/power_slew_rate
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate simulated true
}
hfactory ${scobj_hpath}/loop1_extra/setpoint_slew_rate plain user float hfactory ${scobj_hpath}/loop1_extra/setpoint_slew_rate plain user float
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {35} hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {35}
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate rdValue ${ns}::rdValue ${scobj_hpath}
@ -409,6 +485,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate type "part" hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate type "part"
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxalias "${name}_loop1_extra_setpoint_slew_rate" hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxalias "${name}_loop1_extra_setpoint_slew_rate"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/setpoint_slew_rate 1
${sct_controller} write ${scobj_hpath}/loop1_extra/setpoint_slew_rate
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate simulated true
}
hfactory ${scobj_hpath}/loop1_extra/working_output plain user float hfactory ${scobj_hpath}/loop1_extra/working_output plain user float
hsetprop ${scobj_hpath}/loop1_extra/working_output read ${ns}::getValue ${scobj_hpath} rdValue {4} hsetprop ${scobj_hpath}/loop1_extra/working_output read ${ns}::getValue ${scobj_hpath} rdValue {4}
hsetprop ${scobj_hpath}/loop1_extra/working_output rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/working_output rdValue ${ns}::rdValue ${scobj_hpath}
@ -421,6 +506,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/working_output type "part" hsetprop ${scobj_hpath}/loop1_extra/working_output type "part"
hsetprop ${scobj_hpath}/loop1_extra/working_output nxalias "${name}_loop1_extra_working_output" hsetprop ${scobj_hpath}/loop1_extra/working_output nxalias "${name}_loop1_extra_working_output"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_output 1
hsetprop ${scobj_hpath}/loop1_extra/working_output simulated false
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/working_output simulated true
}
hfactory ${scobj_hpath}/loop1_extra/working_setpoint plain user float hfactory ${scobj_hpath}/loop1_extra/working_setpoint plain user float
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {5} hsetprop ${scobj_hpath}/loop1_extra/working_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {5}
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint rdValue ${ns}::rdValue ${scobj_hpath} hsetprop ${scobj_hpath}/loop1_extra/working_setpoint rdValue ${ns}::rdValue ${scobj_hpath}
@ -434,30 +527,17 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxalias "${name}_loop1_extra_working_setpoint" hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxalias "${name}_loop1_extra_working_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/active_setpoint 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm1_thresh 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm2_thresh 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/manual_output 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_high 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_low 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_slew_rate 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/setpoint_slew_rate 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_output 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_setpoint 1 ${sct_controller} poll ${scobj_hpath}/loop1_extra/working_setpoint 1
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm1_thresh hsetprop ${scobj_hpath}/loop1_extra/working_setpoint simulated false
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm2_thresh
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_high
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_low
${sct_controller} write ${scobj_hpath}/loop1_extra/power_slew_rate
${sct_controller} write ${scobj_hpath}/loop1_extra/setpoint_slew_rate
} else { } else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint simulated true
} }
hsetprop ${scobj_hpath}/loop1_extra data "false"
hsetprop ${scobj_hpath}/loop1_extra klass "@none"
hsetprop ${scobj_hpath}/loop1_extra type "part"
hfactory ${scobj_hpath}/util plain spy none hfactory ${scobj_hpath}/util plain spy none
hsetprop ${scobj_hpath}/util data "false"
hsetprop ${scobj_hpath}/util klass "@none"
hsetprop ${scobj_hpath}/util type "part"
hfactory ${scobj_hpath}/util/mode plain user text hfactory ${scobj_hpath}/util/mode plain user text
hsetprop ${scobj_hpath}/util/mode control false hsetprop ${scobj_hpath}/util/mode control false
@ -481,20 +561,20 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula
hsetprop ${scobj_hpath}/util/unit sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/util/unit sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/util/unit type "part" hsetprop ${scobj_hpath}/util/unit type "part"
hsetprop ${scobj_hpath}/util/unit nxalias "${name}_util_unit" hsetprop ${scobj_hpath}/util/unit nxalias "${name}_util_unit"
hsetprop ${scobj_hpath}/util data "false"
hsetprop ${scobj_hpath}/util klass "@none"
hsetprop ${scobj_hpath}/util type "part"
hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_loop1_setpoint ${scobj_hpath}/loop1/setpoint ${scobj_hpath}/loop1/sensor ${sct_controller}
}
# mkDriver hook code goes here # mkDriver hook code goes here
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} { proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id {tol 5 } {lowerlimit 0} {upperlimit 500}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}"
if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
@ -504,10 +584,12 @@ proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_a
makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port} makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for eurotherm_3200" ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for eurotherm_3200"
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} }
::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}"
::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
@ -520,9 +602,9 @@ namespace eval ::scobj::eurotherm_3200 {
namespace export add_driver namespace export add_driver
} }
proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id tol} { proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id {tol 5 } {lowerlimit 0} {upperlimit 500}} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::eurotherm_3200::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}" ::scobj::eurotherm_3200::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}
} }
clientput "file evaluation of sct_eurotherm_3200.tcl" clientput "file evaluation of sct_eurotherm_3200.tcl"
@ -561,20 +643,31 @@ proc ::scobj::eurotherm_3200::read_config {} {
if { ![string equal -nocase "${simulation_flag}" "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip] set ip_address [dict get $v ip]
set tcp_port [dict get $v port] set tcp_port [dict get $v port]
} makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else { } else {
if { [dict exists $v "asyncprotocol"] } { if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"] set asyncprotocol [dict get $v "asyncprotocol"]
} else { } else {
set asyncprotocol ${name}_protocol set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol} MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } { if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]"
} }
} }
@ -585,14 +678,19 @@ proc ::scobj::eurotherm_3200::read_config {} {
if { [dict exists $v "timeout"] } { if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]" ${asyncqueue} timeout "[dict get $v "timeout"]"
} }
makesctcontroller sct_${name} aqadapter ${asyncqueue}
} }
set arg_list [list] set arg_list [list]
set missing_list [list] set missing_list [list]
foreach arg {id datype dev_id tol} { array unset default_map
array set default_map [list tol 5 lowerlimit 0 upperlimit 500]
foreach arg {id datype dev_id tol lowerlimit upperlimit} {
if {[dict exists $u $arg]} { if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]" lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} { } elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]" lappend arg_list "[dict get $v $arg]"
} elseif {[info exists default_map($arg)]} {
lappend arg_list $default_map($arg)
} else { } else {
${ns}::sics_log 9 "Missing configuration value $arg" ${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg lappend missing_list $arg
@ -601,11 +699,7 @@ proc ::scobj::eurotherm_3200::read_config {} {
if { [llength $missing_list] > 0 } { if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
${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
}
} }
} }
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::srs_sr630::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/srs_sr630_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/srs_sr630_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -217,6 +220,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/id type "part" hsetprop ${scobj_hpath}/id type "part"
hsetprop ${scobj_hpath}/id nxalias "${name}_id" hsetprop ${scobj_hpath}/id nxalias "${name}_id"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/id 600
hsetprop ${scobj_hpath}/id simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/id simulated true
}
hfactory ${scobj_hpath}/sensor_01 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {1}
hsetprop ${scobj_hpath}/sensor_01 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_01 readSensor ${ns}::readSensor ${scobj_hpath}
@ -230,6 +241,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_01 type "part" hsetprop ${scobj_hpath}/sensor_01 type "part"
hsetprop ${scobj_hpath}/sensor_01 nxalias "${name}_sensor_01" hsetprop ${scobj_hpath}/sensor_01 nxalias "${name}_sensor_01"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_01 60
hsetprop ${scobj_hpath}/sensor_01 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_01 simulated true
}
hfactory ${scobj_hpath}/sensor_02 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {2}
hsetprop ${scobj_hpath}/sensor_02 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_02 readSensor ${ns}::readSensor ${scobj_hpath}
@ -243,6 +262,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_02 type "part" hsetprop ${scobj_hpath}/sensor_02 type "part"
hsetprop ${scobj_hpath}/sensor_02 nxalias "${name}_sensor_02" hsetprop ${scobj_hpath}/sensor_02 nxalias "${name}_sensor_02"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_02 600
hsetprop ${scobj_hpath}/sensor_02 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_02 simulated true
}
hfactory ${scobj_hpath}/sensor_03 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {3}
hsetprop ${scobj_hpath}/sensor_03 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_03 readSensor ${ns}::readSensor ${scobj_hpath}
@ -256,6 +283,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_03 type "part" hsetprop ${scobj_hpath}/sensor_03 type "part"
hsetprop ${scobj_hpath}/sensor_03 nxalias "${name}_sensor_03" hsetprop ${scobj_hpath}/sensor_03 nxalias "${name}_sensor_03"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_03 600
hsetprop ${scobj_hpath}/sensor_03 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_03 simulated true
}
hfactory ${scobj_hpath}/sensor_04 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {4}
hsetprop ${scobj_hpath}/sensor_04 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_04 readSensor ${ns}::readSensor ${scobj_hpath}
@ -269,6 +304,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_04 type "part" hsetprop ${scobj_hpath}/sensor_04 type "part"
hsetprop ${scobj_hpath}/sensor_04 nxalias "${name}_sensor_04" hsetprop ${scobj_hpath}/sensor_04 nxalias "${name}_sensor_04"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_04 600
hsetprop ${scobj_hpath}/sensor_04 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_04 simulated true
}
hfactory ${scobj_hpath}/sensor_05 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {5}
hsetprop ${scobj_hpath}/sensor_05 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_05 readSensor ${ns}::readSensor ${scobj_hpath}
@ -282,6 +325,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_05 type "part" hsetprop ${scobj_hpath}/sensor_05 type "part"
hsetprop ${scobj_hpath}/sensor_05 nxalias "${name}_sensor_05" hsetprop ${scobj_hpath}/sensor_05 nxalias "${name}_sensor_05"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_05 600
hsetprop ${scobj_hpath}/sensor_05 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_05 simulated true
}
hfactory ${scobj_hpath}/sensor_06 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {6}
hsetprop ${scobj_hpath}/sensor_06 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_06 readSensor ${ns}::readSensor ${scobj_hpath}
@ -295,6 +346,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_06 type "part" hsetprop ${scobj_hpath}/sensor_06 type "part"
hsetprop ${scobj_hpath}/sensor_06 nxalias "${name}_sensor_06" hsetprop ${scobj_hpath}/sensor_06 nxalias "${name}_sensor_06"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_06 600
hsetprop ${scobj_hpath}/sensor_06 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_06 simulated true
}
hfactory ${scobj_hpath}/sensor_07 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {7}
hsetprop ${scobj_hpath}/sensor_07 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_07 readSensor ${ns}::readSensor ${scobj_hpath}
@ -308,6 +367,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_07 type "part" hsetprop ${scobj_hpath}/sensor_07 type "part"
hsetprop ${scobj_hpath}/sensor_07 nxalias "${name}_sensor_07" hsetprop ${scobj_hpath}/sensor_07 nxalias "${name}_sensor_07"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_07 600
hsetprop ${scobj_hpath}/sensor_07 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_07 simulated true
}
hfactory ${scobj_hpath}/sensor_08 plain user float 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 read ${ns}::getSensor ${scobj_hpath} readSensor {8}
hsetprop ${scobj_hpath}/sensor_08 readSensor ${ns}::readSensor ${scobj_hpath} hsetprop ${scobj_hpath}/sensor_08 readSensor ${ns}::readSensor ${scobj_hpath}
@ -321,23 +388,17 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor_08 type "part" hsetprop ${scobj_hpath}/sensor_08 type "part"
hsetprop ${scobj_hpath}/sensor_08 nxalias "${name}_sensor_08" hsetprop ${scobj_hpath}/sensor_08 nxalias "${name}_sensor_08"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor_08 600
hsetprop ${scobj_hpath}/sensor_08 simulated false
} else {
::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
hsetprop ${scobj_hpath}/sensor_08 simulated true
}
hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" 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} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
@ -358,7 +419,9 @@ proc ::scobj::srs_sr630::add_driver {name device_class simulation_flag ip_addres
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::srs_sr630::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for srs_sr630" ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for srs_sr630"
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} }
::scobj::srs_sr630::sics_log 1 "::scobj::srs_sr630::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::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} ::scobj::srs_sr630::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
@ -376,7 +439,7 @@ namespace eval ::scobj::srs_sr630 {
proc add_srs_sr630 {name ip_address tcp_port} { proc add_srs_sr630 {name ip_address tcp_port} {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]" set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::srs_sr630::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port} ::scobj::srs_sr630::add_driver ${name} "NXdetector" ${simulation_flag} ${ip_address} ${tcp_port}
} }
clientput "file evaluation of sct_srs_sr630.tcl" clientput "file evaluation of sct_srs_sr630.tcl"
@ -415,20 +478,31 @@ proc ::scobj::srs_sr630::read_config {} {
if { ![string equal -nocase "${simulation_flag}" "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip] set ip_address [dict get $v ip]
set tcp_port [dict get $v port] set tcp_port [dict get $v port]
} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else { } else {
if { [dict exists $v "asyncprotocol"] } { if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"] set asyncprotocol [dict get $v "asyncprotocol"]
} else { } else {
set asyncprotocol ${name}_protocol set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol} MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } { if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]"
} }
} }
@ -439,12 +513,9 @@ proc ::scobj::srs_sr630::read_config {} {
if { [dict exists $v "timeout"] } { if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]" ${asyncqueue} timeout "[dict get $v "timeout"]"
} }
makesctcontroller sct_${name} aqadapter ${asyncqueue}
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
} }
} }
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::west_6100::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/west_6100_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/west_6100_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -86,7 +89,12 @@ proc ::scobj::west_6100::checkstatus {tc_root} {
# checkstatus hook code goes here # checkstatus hook code goes here
if {[sct driving]} { if {[sct driving]} {
set sp "[sct target]" set sp "[sct target]"
set pv "[hval ${tc_root}/[sct driveable]]" if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
set pv "${sp}"
hupdateif ${tc_root}/[sct driveable] ${sp}
} else {
set pv "[hval ${tc_root}/[sct driveable]]"
}
if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { abs(${pv} - ${sp}) <= [sct tolerance] } {
if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time] } {
if { [hpropexists [sct] settle_time_start] } { if { [hpropexists [sct] settle_time_start] } {
@ -363,6 +371,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/alarm1 type "part" hsetprop ${scobj_hpath}/alarm1 type "part"
hsetprop ${scobj_hpath}/alarm1 nxalias "${name}_alarm1" hsetprop ${scobj_hpath}/alarm1 nxalias "${name}_alarm1"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/alarm1 1
${sct_controller} write ${scobj_hpath}/alarm1
hsetprop ${scobj_hpath}/alarm1 simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/alarm1 simulated true
}
hfactory ${scobj_hpath}/alarm2 plain user float hfactory ${scobj_hpath}/alarm2 plain user float
hsetprop ${scobj_hpath}/alarm2 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {14} hsetprop ${scobj_hpath}/alarm2 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {14}
hsetprop ${scobj_hpath}/alarm2 rdDecimal ${ns}::rdDecimal ${scobj_hpath} hsetprop ${scobj_hpath}/alarm2 rdDecimal ${ns}::rdDecimal ${scobj_hpath}
@ -379,6 +396,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/alarm2 type "part" hsetprop ${scobj_hpath}/alarm2 type "part"
hsetprop ${scobj_hpath}/alarm2 nxalias "${name}_alarm2" hsetprop ${scobj_hpath}/alarm2 nxalias "${name}_alarm2"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/alarm2 1
${sct_controller} write ${scobj_hpath}/alarm2
hsetprop ${scobj_hpath}/alarm2 simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/alarm2 simulated true
}
hfactory ${scobj_hpath}/power plain user int hfactory ${scobj_hpath}/power plain user int
hsetprop ${scobj_hpath}/power read ${ns}::getInteger ${scobj_hpath} rdInteger {3} hsetprop ${scobj_hpath}/power read ${ns}::getInteger ${scobj_hpath} rdInteger {3}
hsetprop ${scobj_hpath}/power rdInteger ${ns}::rdInteger ${scobj_hpath} hsetprop ${scobj_hpath}/power rdInteger ${ns}::rdInteger ${scobj_hpath}
@ -392,6 +418,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/power type "part" hsetprop ${scobj_hpath}/power type "part"
hsetprop ${scobj_hpath}/power nxalias "${name}_power" hsetprop ${scobj_hpath}/power nxalias "${name}_power"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/power 1
hsetprop ${scobj_hpath}/power simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/power simulated true
}
hfactory ${scobj_hpath}/powermax plain user int hfactory ${scobj_hpath}/powermax plain user int
hsetprop ${scobj_hpath}/powermax read ${ns}::getInteger ${scobj_hpath} rdInteger {20} hsetprop ${scobj_hpath}/powermax read ${ns}::getInteger ${scobj_hpath} rdInteger {20}
hsetprop ${scobj_hpath}/powermax rdInteger ${ns}::rdInteger ${scobj_hpath} hsetprop ${scobj_hpath}/powermax rdInteger ${ns}::rdInteger ${scobj_hpath}
@ -408,6 +442,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/powermax type "part" hsetprop ${scobj_hpath}/powermax type "part"
hsetprop ${scobj_hpath}/powermax nxalias "${name}_powermax" hsetprop ${scobj_hpath}/powermax nxalias "${name}_powermax"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/powermax 1
${sct_controller} write ${scobj_hpath}/powermax
hsetprop ${scobj_hpath}/powermax simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/powermax simulated true
}
hfactory ${scobj_hpath}/ramprate plain user float hfactory ${scobj_hpath}/ramprate plain user float
hsetprop ${scobj_hpath}/ramprate read ${ns}::getDecimal ${scobj_hpath} rdDecimal {24} hsetprop ${scobj_hpath}/ramprate read ${ns}::getDecimal ${scobj_hpath} rdDecimal {24}
hsetprop ${scobj_hpath}/ramprate rdDecimal ${ns}::rdDecimal ${scobj_hpath} hsetprop ${scobj_hpath}/ramprate rdDecimal ${ns}::rdDecimal ${scobj_hpath}
@ -424,6 +467,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/ramprate type "part" hsetprop ${scobj_hpath}/ramprate type "part"
hsetprop ${scobj_hpath}/ramprate nxalias "${name}_ramprate" hsetprop ${scobj_hpath}/ramprate nxalias "${name}_ramprate"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ramprate 1
${sct_controller} write ${scobj_hpath}/ramprate
hsetprop ${scobj_hpath}/ramprate simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/ramprate simulated true
}
hfactory ${scobj_hpath}/sensor plain user float hfactory ${scobj_hpath}/sensor plain user float
hsetprop ${scobj_hpath}/sensor read ${ns}::getDecimal ${scobj_hpath} rdDecimal {1} hsetprop ${scobj_hpath}/sensor read ${ns}::getDecimal ${scobj_hpath} rdDecimal {1}
hsetprop ${scobj_hpath}/sensor rdDecimal ${ns}::rdDecimal ${scobj_hpath} hsetprop ${scobj_hpath}/sensor rdDecimal ${ns}::rdDecimal ${scobj_hpath}
@ -439,6 +491,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor type "part" hsetprop ${scobj_hpath}/sensor type "part"
hsetprop ${scobj_hpath}/sensor nxalias "${name}_sensor" hsetprop ${scobj_hpath}/sensor nxalias "${name}_sensor"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor 1
hsetprop ${scobj_hpath}/sensor simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/sensor simulated true
}
hfactory ${scobj_hpath}/setpoint plain user float hfactory ${scobj_hpath}/setpoint plain user float
hsetprop ${scobj_hpath}/setpoint read ${ns}::getDecimal ${scobj_hpath} rdDecimal {2} hsetprop ${scobj_hpath}/setpoint read ${ns}::getDecimal ${scobj_hpath} rdDecimal {2}
hsetprop ${scobj_hpath}/setpoint rdDecimal ${ns}::rdDecimal ${scobj_hpath} hsetprop ${scobj_hpath}/setpoint rdDecimal ${ns}::rdDecimal ${scobj_hpath}
@ -466,6 +526,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/setpoint type "drivable" hsetprop ${scobj_hpath}/setpoint type "drivable"
hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint" hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/setpoint 1
${sct_controller} write ${scobj_hpath}/setpoint
hsetprop ${scobj_hpath}/setpoint simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/setpoint simulated true
}
hfactory ${scobj_hpath}/w_sp plain user float 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 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {21}
hsetprop ${scobj_hpath}/w_sp rdDecimal ${ns}::rdDecimal ${scobj_hpath} hsetprop ${scobj_hpath}/w_sp rdDecimal ${ns}::rdDecimal ${scobj_hpath}
@ -482,33 +551,21 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/w_sp type "part" hsetprop ${scobj_hpath}/w_sp type "part"
hsetprop ${scobj_hpath}/w_sp nxalias "${name}_w_sp" hsetprop ${scobj_hpath}/w_sp nxalias "${name}_w_sp"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/w_sp 1
${sct_controller} write ${scobj_hpath}/w_sp
hsetprop ${scobj_hpath}/w_sp simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/w_sp simulated true
}
hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller}
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 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 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 read ${ns}::getInteger ${scobj_hpath} rdInteger {18}
@ -523,6 +580,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/aux/decimal type "part" hsetprop ${scobj_hpath}/aux/decimal type "part"
hsetprop ${scobj_hpath}/aux/decimal nxalias "${name}_aux_decimal" hsetprop ${scobj_hpath}/aux/decimal nxalias "${name}_aux_decimal"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/aux/decimal 2
hsetprop ${scobj_hpath}/aux/decimal simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/aux/decimal simulated true
}
hfactory ${scobj_hpath}/aux/instatus plain user int 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 read ${ns}::getInteger ${scobj_hpath} rdInteger {133}
hsetprop ${scobj_hpath}/aux/instatus rdInteger ${ns}::rdInteger ${scobj_hpath} hsetprop ${scobj_hpath}/aux/instatus rdInteger ${ns}::rdInteger ${scobj_hpath}
@ -535,6 +600,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/aux/instatus type "part" hsetprop ${scobj_hpath}/aux/instatus type "part"
hsetprop ${scobj_hpath}/aux/instatus nxalias "${name}_aux_instatus" hsetprop ${scobj_hpath}/aux/instatus nxalias "${name}_aux_instatus"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/aux/instatus 2
hsetprop ${scobj_hpath}/aux/instatus simulated false
} else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/aux/instatus simulated true
}
hfactory ${scobj_hpath}/aux/model plain user int 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 read ${ns}::getInteger ${scobj_hpath} rdInteger {122}
hsetprop ${scobj_hpath}/aux/model rdInteger ${ns}::rdInteger ${scobj_hpath} hsetprop ${scobj_hpath}/aux/model rdInteger ${ns}::rdInteger ${scobj_hpath}
@ -548,18 +621,18 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model" hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model"
if {[string equal -nocase "${simulation_flag}" "false"]} { 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 ${sct_controller} poll ${scobj_hpath}/aux/model 2
hsetprop ${scobj_hpath}/aux/model simulated false
} else { } else {
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
hsetprop ${scobj_hpath}/aux/model simulated true
} }
hsetprop ${scobj_hpath}/aux data "false"
hsetprop ${scobj_hpath}/aux klass "@none"
hsetprop ${scobj_hpath}/aux type "part"
hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller}
}
# mkDriver hook code goes here # mkDriver hook code goes here
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
@ -577,7 +650,9 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres
makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port} makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::west_6100::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for west_6100" ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for west_6100"
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} }
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" ::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}
@ -595,7 +670,7 @@ namespace eval ::scobj::west_6100 {
proc add_west_6100 {name ip_address tcp_port id} { proc add_west_6100 {name ip_address tcp_port id} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" ::scobj::west_6100::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id}
} }
clientput "file evaluation of sct_west_6100.tcl" clientput "file evaluation of sct_west_6100.tcl"
@ -634,20 +709,31 @@ proc ::scobj::west_6100::read_config {} {
if { ![string equal -nocase "${simulation_flag}" "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip] set ip_address [dict get $v ip]
set tcp_port [dict get $v port] set tcp_port [dict get $v port]
} makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else { } else {
if { [dict exists $v "asyncprotocol"] } { if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"] set asyncprotocol [dict get $v "asyncprotocol"]
} else { } else {
set asyncprotocol ${name}_protocol set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol} MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } { if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]"
} }
} }
@ -658,6 +744,7 @@ proc ::scobj::west_6100::read_config {} {
if { [dict exists $v "timeout"] } { if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]" ${asyncqueue} timeout "[dict get $v "timeout"]"
} }
makesctcontroller sct_${name} aqadapter ${asyncqueue}
} }
set arg_list [list] set arg_list [list]
set missing_list [list] set missing_list [list]
@ -674,11 +761,7 @@ proc ::scobj::west_6100::read_config {} {
if { [llength $missing_list] > 0 } { if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
${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
}
} }
} }
} }

View File

@ -10,9 +10,12 @@ proc ::scobj::epson_pandp::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch { set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold] set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} { if {${debug_level} >= ${debug_threshold}} {
set fd [open "../log/epson_pandp_[basename ${tc_root}].log" "a"] set now [clock seconds]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set ts [clock format ${now} -format "%Y%m%d"]
puts ${fd} "${line}" set log_file_name "../log/epson_pandp_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd} close ${fd}
} }
} catch_message ] } catch_message ]
@ -60,7 +63,7 @@ namespace eval ::scobj::epson_pandp {
proc add_epson_pandp {name ip_address tcp_port robot_name} { proc add_epson_pandp {name ip_address tcp_port robot_name} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::epson_pandp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${robot_name}" ::scobj::epson_pandp::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}
} }
clientput "file evaluation of sct_epson_pandp.tcl" clientput "file evaluation of sct_epson_pandp.tcl"
@ -96,34 +99,7 @@ proc ::scobj::epson_pandp::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "epson_pandp"] } { if { [string equal -nocase [dict get $v "driver"] "epson_pandp"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } { ::scobj::epson_pandp::sics_log 9 "No sctcontroller for epson_pandp"
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 arg_list [list]
set missing_list [list] set missing_list [list]
foreach arg {robot_name} { foreach arg {robot_name} {
@ -139,11 +115,7 @@ proc ::scobj::epson_pandp::read_config {} {
if { [llength $missing_list] > 0 } { if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
${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
}
} }
} }
} }

View File

@ -246,6 +246,14 @@ terminator = \r\n
tol1 = 1.0 tol1 = 1.0
tol2 = 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] [mercury_scpi_01]
desc = "Oxford Mercury temperature controller in Mercury mode" desc = "Oxford Mercury temperature controller in Mercury mode"
driver = "mercury_scpi" driver = "mercury_scpi"
@ -311,3 +319,4 @@ imptype = temperature
ip = 10.157.205.25 ip = 10.157.205.25
port = 502 port = 502
timeout = 2000 timeout = 2000

View File

@ -16,6 +16,7 @@ config/hmm/hmm_object.tcl
config/hmm/hmm_cylindrical_detector_configuration.tcl config/hmm/hmm_cylindrical_detector_configuration.tcl
config/hmm/anstohm_linked.xml config/hmm/anstohm_linked.xml
config/robots/sct_pickandplace.tcl config/robots/sct_pickandplace.tcl
config/robots/sct_epson_pandp.tcl
config/scan/scan_common_1.hdd config/scan/scan_common_1.hdd
config/scan/scan_common_1.tcl config/scan/scan_common_1.tcl
config/nexus/nxscripts_common_1.tcl config/nexus/nxscripts_common_1.tcl

View File

@ -50,6 +50,7 @@ fileeval $cfPath(environment)/sct_protek_common.tcl
fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/sct_protekmm.tcl
fileeval $cfPath(environment)/temperature/west400.tcl fileeval $cfPath(environment)/temperature/west400.tcl
fileeval $cfPath(environment)/temperature/sct_west4100.tcl fileeval $cfPath(environment)/temperature/sct_west4100.tcl
fileeval $cfPath(environment)/temperature/sct_west_6100.tcl
fileeval $cfPath(environment)/temperature/sct_watlow_pm.tcl fileeval $cfPath(environment)/temperature/sct_watlow_pm.tcl
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl

View File

@ -1,4 +1,9 @@
# Forbid detector motion when the detector voltage is on # Prevent m2om encoder from driving into sample holder.
# comment out -- Jing forbid {10 inf} for m2om whenall {m2y in {-inf 200} m2om in {-inf 10}}
#forbid {-inf inf} for det when dhv1 in {800 inf} forbid {-inf 170} for m2om whenall {m2y in {-inf 200} m2om in {170 inf}}
#forbid {-inf inf} for detoff when dhv1 in {800 inf} forbid {-inf inf} for m2om whenall {m2y in {-inf 200} m2om in {11 169}}
forbid {-inf 200} for m2y when m2om in {10 170}
# Following two rules allow recovery if m2om position has crept above 10 or below 170
forbid {11 inf} for m2om whenall {m2y in {-inf 200} m2om in {10 11}}
forbid {-inf 169} for m2om whenall {m2y in {-inf 200} m2om in {169 170}}

View File

@ -120,7 +120,7 @@ def stop_cmd(server, args):
print 'Failed again!' print 'Failed again!'
print "Terminating PID %d with EXTREME PREJUDICE (-15)" % (pid) print "Terminating PID %d with EXTREME PREJUDICE (-15)" % (pid)
subprocess.call(shlex.split('sudo -u %s /bin/kill -15 %d' % subprocess.call(shlex.split('sudo -u %s /bin/kill -15 %d' %
sics_killer, (pid))) (sics_killer, pid)))
else: else:
return return
if status_cmd(server, args) != (0,0): if status_cmd(server, args) != (0,0):

View File

@ -64,6 +64,26 @@ proc ::histogram_memory::isc_initialize {} {
} }
} }
# Returns 0 If all trips acknowledged, -n if n trips unacknowledged, +n if too many acks?
::utility::macro::getset float ::histogram_memory::reset_trip {args} {
set num_trips [ SplitReply [hmm configure detector_protect_num_trip] ]
set num_acks [ SplitReply [hmm configure detector_protect_num_trip_ack] ]
set trip_cnt_diff [expr {$num_acks - $num_trips}]
if {$args == ""} {
return "reset_trip = $trip_cnt_diff"
} else {
if {$trip_cnt_diff != 0} {
hmm configure fat_detector_protect_num_trip_ack $num_trips
hmm astop
wait 2
hmm init
}
}
}
sicslist setatt ::histogram_memory::reset_trip klass detector
sicslist setatt ::histogram_memory::reset_trip long_name reset_trip
sicslist setatt ::histogram_memory::reset_trip data false
proc histmem {cmd args} { proc histmem {cmd args} {
eval "_histmem $cmd $args" eval "_histmem $cmd $args"
} }