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

@@ -567,14 +567,17 @@ clientput "file evaluation of sct_astrium_chopper.tcl"
proc ::scobj::astrium_chopper::read_config {} {
set catch_status [ catch {
set ns "::scobj::astrium_chopper"
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
}
@@ -583,12 +586,15 @@ proc ::scobj::astrium_chopper::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "astrium_chopper"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [chopper_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[chopper_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"]
@@ -608,6 +614,9 @@ proc ::scobj::astrium_chopper::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_astrium_chopper ${name} ${IP} ${PORT}
} else {
add_astrium_chopper ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -305,14 +305,17 @@ clientput "file evaluation of sct_shutters.tcl"
proc ::scobj::shutters::read_config {} {
set catch_status [ catch {
set ns "::scobj::shutters"
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
}
@@ -321,12 +324,15 @@ proc ::scobj::shutters::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "shutters"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [motor_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[motor_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"]
@@ -346,6 +352,9 @@ proc ::scobj::shutters::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_shutters ${name} ${IP} ${PORT}
} else {
add_shutters ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -340,14 +340,17 @@ clientput "file evaluation of sct_tank.tcl"
proc ::scobj::tank::read_config {} {
set catch_status [ catch {
set ns "::scobj::tank"
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
}
@@ -356,12 +359,15 @@ proc ::scobj::tank::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "tank"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [motor_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[motor_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"]
@@ -381,6 +387,9 @@ proc ::scobj::tank::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_tank ${name} ${IP} ${PORT}
} else {
add_tank ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -250,19 +250,19 @@ proc ::scobj::hiden_xcs::no_op {tc_root nextState cmd_str} {
proc ::scobj::hiden_xcs::pid_flow {tc_root sp pv} {
set catch_status [ catch {
debug_log ${tc_root} 1 "pid_flow 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_flow hook code starts
foreach node [list ${tc_root}/analog/sp1 ${tc_root}/analog/sp2] {
if { !([hpropexists ${node} bias_flow] && [hgetpropval ${node} bias_flow] == ${pid}) } {
@@ -285,19 +285,19 @@ proc ::scobj::hiden_xcs::pid_flow {tc_root sp pv} {
proc ::scobj::hiden_xcs::pid_humidity {tc_root sp pv} {
set catch_status [ catch {
debug_log ${tc_root} 1 "pid_humidity 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_humidity hook code starts
set sign 1
foreach node [list ${tc_root}/analog/sp1 ${tc_root}/analog/sp2] {
@@ -1050,7 +1050,6 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/flow/sensor 1
${sct_controller} write ${scobj_hpath}/flow/setpoint
ansto_makesctdrive ${name}_flow_setpoint ${scobj_hpath}/flow/setpoint ${scobj_hpath}/flow/sensor ${sct_controller}
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs"
}
@@ -1109,12 +1108,15 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/humidity/sensor 1
${sct_controller} write ${scobj_hpath}/humidity/setpoint
ansto_makesctdrive ${name}_humidity_setpoint ${scobj_hpath}/humidity/setpoint ${scobj_hpath}/humidity/sensor ${sct_controller}
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_flow_setpoint ${scobj_hpath}/flow/setpoint ${scobj_hpath}/flow/sensor ${sct_controller}
ansto_makesctdrive ${name}_humidity_setpoint ${scobj_hpath}/humidity/setpoint ${scobj_hpath}/humidity/sensor ${sct_controller}
}
# mkDriver hook code starts
# mkDriver hook code ends
} catch_message ]
@@ -1154,14 +1156,17 @@ clientput "file evaluation of sct_hiden_xcs.tcl"
proc ::scobj::hiden_xcs::read_config {} {
set catch_status [ catch {
set ns "::scobj::hiden_xcs"
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
}
@@ -1170,12 +1175,15 @@ proc ::scobj::hiden_xcs::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "hiden_xcs"] } {
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"]
@@ -1196,14 +1204,23 @@ proc ::scobj::hiden_xcs::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {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_hiden_xcs ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_hiden_xcs ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -414,12 +414,14 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name } {
${sct_controller} poll ${scobj_hpath}/Loop1/vTmpActive 1
${sct_controller} poll ${scobj_hpath}/Loop1/vTmpMode 1
${sct_controller} write ${scobj_hpath}/Loop1/setpoint
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor_int ${sct_controller}
} else {
::scobj::huber_pilot::sics_log 9 "[environment_simulation] => No poll/write for huber_pilot"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 1
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor_int ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -458,14 +460,17 @@ clientput "file evaluation of sct_huber_pilot.tcl"
proc ::scobj::huber_pilot::read_config {} {
set catch_status [ catch {
set ns "::scobj::huber_pilot"
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
}
@@ -474,12 +479,15 @@ proc ::scobj::huber_pilot::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "huber_pilot"] } {
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"]
@@ -499,6 +507,9 @@ proc ::scobj::huber_pilot::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_huber_pilot ${name} ${IP} ${PORT}
} else {
add_huber_pilot ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -345,14 +345,17 @@ clientput "file evaluation of sct_isotech_ps.tcl"
proc ::scobj::isotech_ps::read_config {} {
set catch_status [ catch {
set ns "::scobj::isotech_ps"
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
}
@@ -361,12 +364,15 @@ proc ::scobj::isotech_ps::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "isotech_ps"] } {
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"]
@@ -386,6 +392,9 @@ proc ::scobj::isotech_ps::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_isotech_ps ${name} ${IP} ${PORT}
} else {
add_isotech_ps ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -484,7 +484,6 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name } {
${sct_controller} write ${scobj_hpath}/ch1/i_trip
${sct_controller} write ${scobj_hpath}/ch1/v_ramp
${sct_controller} write ${scobj_hpath}/ch1/v_sp
ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller}
} else {
::scobj::nhq_200::sics_log 9 "[environment_simulation] => No poll/write for nhq_200"
}
@@ -661,12 +660,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name } {
${sct_controller} write ${scobj_hpath}/ch2/i_trip
${sct_controller} write ${scobj_hpath}/ch2/v_ramp
${sct_controller} write ${scobj_hpath}/ch2/v_sp
ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
} else {
::scobj::nhq_200::sics_log 9 "[environment_simulation] => No poll/write for nhq_200"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 1
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller}
ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -705,14 +707,17 @@ clientput "file evaluation of sct_nhq_200.tcl"
proc ::scobj::nhq_200::read_config {} {
set catch_status [ catch {
set ns "::scobj::nhq_200"
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
}
@@ -721,12 +726,15 @@ proc ::scobj::nhq_200::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "nhq_200"] } {
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"]
@@ -746,6 +754,9 @@ proc ::scobj::nhq_200::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_nhq_200 ${name} ${IP} ${PORT}
} else {
add_nhq_200 ${name} "aqadapter" ${asyncqueue}
}
}

View File

@@ -272,14 +272,17 @@ clientput "file evaluation of sct_omron_hldc.tcl"
proc ::scobj::omron_hldc::read_config {} {
set catch_status [ catch {
set ns "::scobj::omron_hldc"
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
}
@@ -288,12 +291,15 @@ proc ::scobj::omron_hldc::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "omron_hldc"] } {
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"]
@@ -313,6 +319,9 @@ proc ::scobj::omron_hldc::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_omron_hldc ${name} ${IP} ${PORT}
} else {
add_omron_hldc ${name} "aqadapter" ${asyncqueue}
}
}

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,7 +662,6 @@ 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"
@@ -689,14 +691,20 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id ctrl_sensor 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_julabo_lh45_gen ${name} ${IP} ${PORT} {*}$arg_list
} else {
@@ -705,7 +713,6 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}

View File

@@ -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,12 +357,15 @@ 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"]
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"]
@@ -379,6 +385,9 @@ proc ::scobj::lakeshore_218::read_config {} {
${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

@@ -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
@@ -129,14 +128,20 @@ proc ::scobj::lakeshore_m370::read_config {} {
}
}
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

@@ -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,12 +569,15 @@ 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"]
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"]
@@ -590,14 +598,23 @@ proc ::scobj::mercury_base::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id 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_mercury_base ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_base ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -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,12 +244,15 @@ 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"]
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"]
@@ -267,14 +273,23 @@ proc ::scobj::mercury_level::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {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_mercury_level ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_level ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -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,12 +410,15 @@ 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"]
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"]
@@ -431,14 +439,23 @@ proc ::scobj::mercury_pres::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id 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_mercury_pres ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_pres ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -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,12 +765,15 @@ 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"]
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"]
@@ -786,14 +794,23 @@ proc ::scobj::mercury_scpi::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id permlink tol valve_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_mercury_scpi ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_scpi ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -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,12 +415,15 @@ 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"]
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"]
@@ -436,14 +444,23 @@ proc ::scobj::mercury_temp::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id 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_mercury_temp ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_temp ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -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,12 +364,15 @@ 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"]
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"]
@@ -385,14 +393,23 @@ proc ::scobj::mercury_valve::read_config {} {
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id valve_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_mercury_valve ${name} ${IP} ${PORT} {*}$arg_list
} else {
add_mercury_valve ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}

View File

@@ -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]
@@ -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,12 +514,15 @@ 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"]
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"]
@@ -534,6 +542,9 @@ proc ::scobj::pfeiffer_hg::read_config {} {
${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

@@ -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
@@ -129,14 +128,20 @@ proc ::scobj::west4100::read_config {} {
}
}
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 {

View File

@@ -344,14 +344,17 @@ clientput "file evaluation of sct_reactor_status.tcl"
proc ::scobj::reactor_status::read_config {} {
set catch_status [ catch {
set ns "::scobj::reactor_status"
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
}
@@ -360,12 +363,15 @@ proc ::scobj::reactor_status::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "reactor_status"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [opal_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[opal_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"]
@@ -385,6 +391,9 @@ proc ::scobj::reactor_status::read_config {} {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_reactor_status ${name} ${IP} ${PORT}
} else {
add_reactor_status ${name} "aqadapter" ${asyncqueue}
}
}