Make all sct drivers.

This commit is contained in:
Ferdi Franceschini
2014-07-15 10:56:27 +10:00
parent ac136f3426
commit c1b5b558f0
20 changed files with 882 additions and 652 deletions

View File

@@ -643,14 +643,17 @@ clientput "file evaluation of sct_julabo_lh45_gen.tcl"
proc ::scobj::julabo_lh45_gen::read_config {} {
set catch_status [ catch {
set ns "::scobj::julabo_lh45_gen"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -659,49 +662,53 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "julabo_lh45_gen"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
foreach arg {id ctrl_sensor tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_julabo_lh45_gen ${name} ${IP} ${PORT} {*}$arg_list
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
add_julabo_lh45_gen ${name} "aqadapter" ${asyncqueue} {*}$arg_list
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 [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id ctrl_sensor tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_julabo_lh45_gen ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_julabo_lh45_gen ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}

View File

@@ -127,7 +127,7 @@ proc ::scobj::lakeshore_218::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -338,14 +338,17 @@ clientput "file evaluation of sct_lakeshore_218.tcl"
proc ::scobj::lakeshore_218::read_config {} {
set catch_status [ catch {
set ns "::scobj::lakeshore_218"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -354,31 +357,37 @@ proc ::scobj::lakeshore_218::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "lakeshore_218"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_lakeshore_218 ${name} ${IP} ${PORT}
} else {
add_lakeshore_218 ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -27,7 +27,7 @@ proc ::scobj::lakeshore_m370::sics_log {debug_level debug_string} {
} catch_message ]
}
proc ::scobj::lakeshore_m370::mkDriver { sct_controller name tol} {
proc ::scobj::lakeshore_m370::mkDriver { sct_controller name tol } {
::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${tol}"
set ns "[namespace current]"
set catch_status [ catch {
@@ -80,21 +80,20 @@ clientput "file evaluation of sct_lakeshore_m370.tcl"
proc ::scobj::lakeshore_m370::read_config {} {
set catch_status [ catch {
set ns "::scobj::lakeshore_m370"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set enabled [string tolower [dict get $v "enabled"]]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $v name]
set implementation [dict get $v "implementation"]
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set arg_list [list]
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
@@ -128,15 +127,21 @@ proc ::scobj::lakeshore_m370::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set arg_list [list]
set missing_list [list]
foreach arg {tol} {
if {[dict exists $v $arg]} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_lakeshore_m370 ${name} ${IP} ${PORT} {*}$arg_list
} else {

View File

@@ -180,7 +180,7 @@ proc ::scobj::mercury_base::rdText {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -212,7 +212,7 @@ proc ::scobj::mercury_base::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -350,7 +350,6 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name id tol } {
${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop1/setpoint
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base"
}
@@ -427,7 +426,6 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name id tol } {
${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop2/setpoint
ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base"
}
@@ -504,12 +502,16 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name id tol } {
${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop3/setpoint
ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller}
ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller}
ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -548,14 +550,17 @@ clientput "file evaluation of sct_mercury_base.tcl"
proc ::scobj::mercury_base::read_config {} {
set catch_status [ catch {
set ns "::scobj::mercury_base"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -564,40 +569,52 @@ proc ::scobj::mercury_base::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "mercury_base"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 arg_list [list]
foreach arg {id tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_base ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_base ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -107,7 +107,7 @@ proc ::scobj::mercury_level::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -225,14 +225,17 @@ clientput "file evaluation of sct_mercury_level.tcl"
proc ::scobj::mercury_level::read_config {} {
set catch_status [ catch {
set ns "::scobj::mercury_level"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -241,40 +244,52 @@ proc ::scobj::mercury_level::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "mercury_level"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 arg_list [list]
foreach arg {id} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_level ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_level ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -180,7 +180,7 @@ proc ::scobj::mercury_pres::rdText {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -212,7 +212,7 @@ proc ::scobj::mercury_pres::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -345,12 +345,14 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name id tol } {
${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop8/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop8/setpoint
ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller}
} else {
::scobj::mercury_pres::sics_log 9 "[environment_simulation] => No poll/write for mercury_pres"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -389,14 +391,17 @@ clientput "file evaluation of sct_mercury_pres.tcl"
proc ::scobj::mercury_pres::read_config {} {
set catch_status [ catch {
set ns "::scobj::mercury_pres"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -405,40 +410,52 @@ proc ::scobj::mercury_pres::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "mercury_pres"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 arg_list [list]
foreach arg {id tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_pres ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_pres ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -180,7 +180,7 @@ proc ::scobj::mercury_scpi::rdText {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -212,7 +212,7 @@ proc ::scobj::mercury_scpi::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -421,7 +421,6 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop1/setpoint
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
@@ -498,7 +497,6 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop2/setpoint
ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
@@ -575,7 +573,6 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop3/setpoint
ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
@@ -652,7 +649,6 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop4/setpoint
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
@@ -700,12 +696,18 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
${sct_controller} write ${scobj_hpath}/Valve/setpoint
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller}
ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller}
ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -744,14 +746,17 @@ clientput "file evaluation of sct_mercury_scpi.tcl"
proc ::scobj::mercury_scpi::read_config {} {
set catch_status [ catch {
set ns "::scobj::mercury_scpi"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -760,40 +765,52 @@ proc ::scobj::mercury_scpi::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "mercury_scpi"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 arg_list [list]
foreach arg {id permlink tol valve_tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id permlink tol valve_tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_scpi ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_scpi ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -180,7 +180,7 @@ proc ::scobj::mercury_temp::rdText {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -212,7 +212,7 @@ proc ::scobj::mercury_temp::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -350,12 +350,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name id tol } {
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop4/setpoint
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
} else {
::scobj::mercury_temp::sics_log 9 "[environment_simulation] => No poll/write for mercury_temp"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -394,14 +396,17 @@ clientput "file evaluation of sct_mercury_temp.tcl"
proc ::scobj::mercury_temp::read_config {} {
set catch_status [ catch {
set ns "::scobj::mercury_temp"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -410,40 +415,52 @@ proc ::scobj::mercury_temp::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "mercury_temp"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 arg_list [list]
foreach arg {id tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_temp ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_temp ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -180,7 +180,7 @@ proc ::scobj::mercury_valve::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -299,12 +299,14 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name id valve_tol } {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
${sct_controller} write ${scobj_hpath}/Valve/setpoint
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
} else {
::scobj::mercury_valve::sics_log 9 "[environment_simulation] => No poll/write for mercury_valve"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -343,14 +345,17 @@ clientput "file evaluation of sct_mercury_valve.tcl"
proc ::scobj::mercury_valve::read_config {} {
set catch_status [ catch {
set ns "::scobj::mercury_valve"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -359,40 +364,52 @@ proc ::scobj::mercury_valve::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "mercury_valve"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 arg_list [list]
foreach arg {id valve_tol} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id valve_tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_valve ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_valve ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -60,7 +60,7 @@ proc ::scobj::pfeiffer_hg::ack_enq {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -197,19 +197,19 @@ proc ::scobj::pfeiffer_hg::noResponse {tc_root} {
proc ::scobj::pfeiffer_hg::pid_pressure {tc_root sp pv} {
set catch_status [ catch {
debug_log ${tc_root} 1 "pid_pressure tc_root=${tc_root} sct=[sct] pv=${pv} sp=${sp}"
sct pid_error [expr ${sp} - ${pv}]
set p_value [expr [sct pid_pvalue] * [sct pid_error]]
set d_value [expr [sct pid_dvalue] * (${pv} - [sct oldval])]
sct pid_error [expr {${sp} - ${pv}}]
set p_value [expr {[sct pid_pvalue] * [sct pid_error]}]
set d_value [expr {[sct pid_dvalue] * (${pv} - [sct oldval])}]
sct pid_deriv [sct pid_error]
sct pid_integ [expr [sct pid_integ] + [sct pid_error]]
sct pid_integ [expr {[sct pid_integ] + [sct pid_error]}]
if { [sct pid_integ] > [sct pid_imax] } {
sct pid_integ [sct pid_imax]
}
if { [sct pid_integ] < -[sct pid_imax] } {
sct pid_integ -[sct pid_imax]
}
set i_value [expr [sct pid_ivalue] * [sct pid_integ]]
set pid [expr ${p_value} + ${i_value} + ${d_value}]
set i_value [expr {[sct pid_ivalue] * [sct pid_integ]}]
set pid [expr {${p_value} + ${i_value} + ${d_value}}]
# pid_pressure hook code starts
if { [hpropexists [sct] pid_control] } {
set co [hgetpropval [sct] pid_control]
@@ -249,7 +249,7 @@ proc ::scobj::pfeiffer_hg::rdValue {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -289,7 +289,7 @@ proc ::scobj::pfeiffer_hg::readPR1 {tc_root} {
sct oldval ${data}
sct update ${data}
sct utime readtime
}
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -446,12 +446,14 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name } {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/pressure/sensor 1
${sct_controller} write ${scobj_hpath}/pressure/setpoint
ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller}
} else {
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No poll/write for pfeiffer_hg"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller}
}
# mkDriver hook code starts
hsetprop ${scobj_hpath}/pressure/sensor read ${ns}::sendPR1 ${scobj_hpath} ack_enq {PR1}
hsetprop ${scobj_hpath}/pressure/sensor ack_enq ${ns}::ack_enq ${scobj_hpath}
@@ -493,14 +495,17 @@ clientput "file evaluation of sct_pfeiffer_hg.tcl"
proc ::scobj::pfeiffer_hg::read_config {} {
set catch_status [ catch {
set ns "::scobj::pfeiffer_hg"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
@@ -509,31 +514,37 @@ proc ::scobj::pfeiffer_hg::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "pfeiffer_hg"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} 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
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
} 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 [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_pfeiffer_hg ${name} ${IP} ${PORT}
} else {
add_pfeiffer_hg ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -27,7 +27,7 @@ proc ::scobj::west4100::sics_log {debug_level debug_string} {
} catch_message ]
}
proc ::scobj::west4100::mkDriver { sct_controller name IP dev_id} {
proc ::scobj::west4100::mkDriver { sct_controller name IP dev_id } {
::scobj::west4100::sics_log 9 "::scobj::west4100::mkDriver ${sct_controller} ${name} ${IP} ${dev_id}"
set ns "[namespace current]"
set catch_status [ catch {
@@ -80,21 +80,20 @@ clientput "file evaluation of sct_west4100.tcl"
proc ::scobj::west4100::read_config {} {
set catch_status [ catch {
set ns "::scobj::west4100"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set enabled [string tolower [dict get $v "enabled"]]
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
set name [dict get $v name]
set implementation [dict get $v "implementation"]
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set arg_list [list]
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
@@ -128,15 +127,21 @@ proc ::scobj::west4100::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set arg_list [list]
set missing_list [list]
foreach arg {IP dev_id} {
if {[dict exists $v $arg]} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_west4100 ${name} ${IP} ${PORT} {*}$arg_list
} else {