Hiden XCS Vapor system generated driver

This commit is contained in:
Douglas Clowes
2014-02-28 16:38:12 +11:00
parent 1fd74bef01
commit bcefc2db60

View File

@ -0,0 +1,885 @@
# Generated driver for hiden_xcs
# vim: tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::hiden_xcs {
set debug_threshold 0
}
proc ::scobj::hiden_xcs::debug_log {debug_level debug_string} {
if {${debug_level} >= ${::scobj::hiden_xcs::debug_threshold}} {
set fd [open "/tmp/hiden_xcs.log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
}
}
# checklimits function for driveable interface
proc ::scobj::hiden_xcs::checklimits {tc_root} {
debug_log 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
sct driving 0
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
}
# check function for hset change
proc ::scobj::hiden_xcs::checkrange {tc_root} {
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
}
# checkstatus function for driveable interface
proc ::scobj::hiden_xcs::checkstatus {tc_root} {
if {[sct driving]} {
set sp "[sct target]"
set pv "[hval ${tc_root}/[sct driveable]]"
if { ${pv} > ${sp} - [sct tolerance] && ${pv} < ${sp} + [sct tolerance] } {
sct driving 0
return "idle"
}
return "busy"
} else {
return "idle"
}
}
# check function for hset change
proc ::scobj::hiden_xcs::chkrange_function {tc_root} {
debug_log 1 "chkrange_function tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
# hook code starts
# hooked
# hook code ends
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
}
# function to request the read of a parameter on a device
proc ::scobj::hiden_xcs::fetch_flow {tc_root nextState cmd_str} {
debug_log 1 "fetch_flow tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# hook code starts
set data 0.0
set targets 0.0
set path [pathname [sct]]
foreach node [list flow1 flow2] {
set data [expr ${data} + [hval ${path}/${node}]]
}
sct result ${data}
foreach node [list analog/sp1 analog/sp2] {
set targets [expr ${targets} + [hval ${path}/${node}]]
}
sct targets ${targets}
if { [hpropexists [sct] target] } {
set pid [pid_flow ${tc_root} [sct target] ${data}]
foreach node [list analog/sp1 analog/sp2] {
hsetprop ${path}/${node} bias_flow ${pid}
if { [hpropexists ${path}/${node} target] } {
hset ${path}/${node} [hgetpropval ${path}/${node} target]
} else {
hset ${path}/${node} [hval ${path}/${node}]
}
}
}
return ${nextState}
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
debug_log 1 "fetch_flow sct send ${cmd}"
sct send "${cmd}"
return ${nextState}
}
# function to request the read of a parameter on a device
proc ::scobj::hiden_xcs::getValue {tc_root nextState cmd_str} {
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
debug_log 1 "getValue sct send ${cmd}"
sct send "${cmd}"
return ${nextState}
}
# halt function for driveable interface
proc ::scobj::hiden_xcs::halt {tc_root} {
debug_log 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]"
### TODO hset [sct] [hval [sct]]
sct driving 0
return "idle"
}
# function to check the write parameter on a device
proc ::scobj::hiden_xcs::noResponse {tc_root} {
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
return "idle"
}
# pid function for PID control
proc ::scobj::hiden_xcs::pid_flow {tc_root sp pv} {
debug_log 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_deriv [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}]
sct pid_output ${pid}
return ${pid}
}
# pid function for PID control
proc ::scobj::hiden_xcs::pid_humidity {tc_root sp pv} {
debug_log 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_deriv [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}]
sct pid_output ${pid}
return ${pid}
}
# function to parse the read of a parameter on a device
proc ::scobj::hiden_xcs::rdValue {tc_root} {
debug_log 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
return -code error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
}
# function to parse the read of a parameter on a device
proc ::scobj::hiden_xcs::read_all_data {tc_root} {
debug_log 1 "read_all_data tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
return -code error "[sct geterror]"
}
# hook code starts
if { [string equal -nocase -length 2 "${data}" "A "] } {
set data_list [split [string range "${data}" 2 end-3] ',']
if { [llength ${data_list}] == 8 } {
set data [expr [lindex ${data_list} 0]]
hupdate ${tc_root}/temperature [expr [lindex ${data_list} 1]]
hupdate ${tc_root}/flow1 [expr [lindex ${data_list} 3] / [hval ${tc_root}/gas_factor]]
hupdate ${tc_root}/flow2 [expr [lindex ${data_list} 4] / [hval ${tc_root}/gas_factor]]
hupdate ${tc_root}/flow3 [expr [lindex ${data_list} 5] / [hval ${tc_root}/gas_factor]]
} else {
sct geterror "Syntax error (Result=${result}) in: '${data}'"
}
} else {
sct geterror "Syntax error for read_all_data in: '${data}'"
}
if { [hpropexists [sct] target] } {
set pid [pid_humidity ${tc_root} [sct target] ${data}]
set path [pathname [sct]]
foreach node [list analog/sp1 analog/sp2] {
set pid [expr -${pid}]
hsetprop ${path}/${node} bias_humidity ${pid}
if { [hpropexists ${path}/${node} target] } {
hset ${path}/${node} [hgetpropval ${path}/${node} target]
} else {
hset ${path}/${node} [hval ${path}/${node}]
}
}
}
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
}
# function to parse the read of a parameter on a device
proc ::scobj::hiden_xcs::read_digital {tc_root} {
debug_log 1 "read_digital tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
return -code error "[sct geterror]"
}
# hook code starts
if { [string equal -nocase -length 5 "${data}" "DOUT ="] } {
set result [scan "${data}" "DOUT = %d OK" val]
if { ${result} == 1 } {
set data ${val}
} else {
sct geterror "Syntax error (Result=${result}) in: '${data}'"
}
} else {
sct geterror "Syntax error in: '${data}'"
}
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
}
# function to parse the read of a parameter on a device
proc ::scobj::hiden_xcs::read_flow {tc_root} {
debug_log 1 "read_flow tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
return -code error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
}
# function to parse the read of a parameter on a device
proc ::scobj::hiden_xcs::read_sixteen {tc_root} {
debug_log 1 "read_sixteen tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
return -code error "[sct geterror]"
}
# hook code starts
if { [string equal -nocase -length 5 "${data}" "AIN ="] } {
set result [scan "${data}" "AIN = %d OK" val]
if { ${result} == 1 } {
if { [hpropexists [sct] base] } {
set base [sct base]
} else {
set base 0.0
}
if { [hpropexists [sct] span] } {
set span [sct span]
} else {
set span 500.0
}
set data [expr (${span} * (${val} - ${base})) / 65535.0]
} else {
sct geterror "Syntax error (Result=${result}) in: '${data}'"
}
} else {
sct geterror "Syntax error in: '${data}'"
}
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
}
# function to parse the read of a parameter on a device
proc ::scobj::hiden_xcs::read_twelve {tc_root} {
debug_log 1 "read_twelve tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
return -code error "[sct geterror]"
}
# hook code starts
if { [string equal -nocase -length 5 "${data}" "AOUT ="] } {
set result [scan "${data}" "AOUT = %d OK" val]
if { ${result} == 1 } {
if { [hpropexists [sct] base] } {
set base [sct base]
} else {
set base 0.0
}
if { [hpropexists [sct] span] } {
set span [sct span]
} else {
set span 500.0
}
set data [expr (${span} * (${val} - ${base})) / 4095.0]
} else {
sct geterror "Syntax (Result=${result}) error in: '${data}'"
}
} else {
sct geterror "Syntax error in: '${data}'"
}
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
}
# function to write a parameter value on a device
proc ::scobj::hiden_xcs::setValue {tc_root nextState cmd_str} {
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log 1 "setValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
}
# function to write a parameter value on a device
proc ::scobj::hiden_xcs::write_digital {tc_root nextState cmd_str} {
debug_log 1 "write_digital tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log 1 "write_digital sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
}
# function to write a parameter value on a device
proc ::scobj::hiden_xcs::write_flow {tc_root nextState cmd_str} {
debug_log 1 "write_flow tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# hook code starts
if { [hpropexists ${tc_root}/humidity target] } {
set humidity_target [hgetpropval ${tc_root}/humidity target]
} else {
set humidity_target [hval ${tc_root}/humidity]
}
set flow1_target [expr (0.01 * (100.0 - ${humidity_target})) * [sct target]]
set flow2_target [expr (0.01 * ( ${humidity_target})) * [sct target]]
hset ${tc_root}/analog/sp1 ${flow1_target}
hset ${tc_root}/analog/sp2 ${flow2_target}
set cmd "@@NOSEND@@"
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log 1 "write_flow sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
}
# function to write a parameter value on a device
proc ::scobj::hiden_xcs::write_humidity {tc_root nextState cmd_str} {
debug_log 1 "write_humidity tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# hook code starts
if { [hpropexists ${tc_root}/flow target] } {
set flow_target [hgetpropval ${tc_root}/flow target]
} else {
set flow_target [hval ${tc_root}/flow]
}
set flow1_target [expr (0.01 * (100.0 - [sct target])) * ${flow_target}]
set flow2_target [expr (0.01 * ( [sct target])) * ${flow_target}]
hset ${tc_root}/analog/sp1 ${flow1_target}
hset ${tc_root}/analog/sp2 ${flow2_target}
set cmd "@@NOSEND@@"
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log 1 "write_humidity sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
}
# function to write a parameter value on a device
proc ::scobj::hiden_xcs::write_twelve {tc_root nextState cmd_str} {
debug_log 1 "write_twelve tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# hook code starts
if { [hpropexists [sct] base] } {
set base [sct base]
} else {
set base 0.0
}
if { [hpropexists [sct] span] } {
set span [sct span]
} else {
set span 500.0
}
if { [hpropexists [sct] bias_humidity] } {
set par [expr ${par} + [sct bias_humidity]]
}
if { [hpropexists [sct] bias_flow] } {
set par [expr ${par} + [sct bias_flow]]
}
set par [expr int(${base} + (4095.0 * ${par} / ${span}))]
set cmd "${cmd_str}${par}"
# hook code ends
if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]"
}
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log 1 "write_twelve sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
}
proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
debug_log 1 "mk_sct_hiden_xcs for ${name}"
set ns "[namespace current]"
set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/flow plain user float
hsetprop ${scobj_hpath}/flow read ${ns}::fetch_flow ${scobj_hpath} read_flow {None}
hsetprop ${scobj_hpath}/flow read_flow ${ns}::read_flow ${scobj_hpath}
hsetprop ${scobj_hpath}/flow write ${ns}::write_flow ${scobj_hpath} noResponse {}
hsetprop ${scobj_hpath}/flow noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/flow check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/flow driving 0
hsetprop ${scobj_hpath}/flow checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/flow checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/flow halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/flow driveable flow
hsetprop ${scobj_hpath}/flow control true
hsetprop ${scobj_hpath}/flow data true
hsetprop ${scobj_hpath}/flow mutable false
hsetprop ${scobj_hpath}/flow nxsave true
hsetprop ${scobj_hpath}/flow lowerlimit 0
hsetprop ${scobj_hpath}/flow upperlimit 500
hsetprop ${scobj_hpath}/flow tolerance 1
hsetprop ${scobj_hpath}/flow oldval 0.0
hsetprop ${scobj_hpath}/flow pid_deriv "0"
hsetprop ${scobj_hpath}/flow pid_dvalue "0.0"
hsetprop ${scobj_hpath}/flow pid_error "0"
hsetprop ${scobj_hpath}/flow pid_imax "1"
hsetprop ${scobj_hpath}/flow pid_integ "0"
hsetprop ${scobj_hpath}/flow pid_ivalue "0.01"
hsetprop ${scobj_hpath}/flow pid_pvalue "0.05"
hfactory ${scobj_hpath}/flow1 plain user float
hsetprop ${scobj_hpath}/flow1 control true
hsetprop ${scobj_hpath}/flow1 data true
hsetprop ${scobj_hpath}/flow1 mutable false
hsetprop ${scobj_hpath}/flow1 nxsave true
hsetprop ${scobj_hpath}/flow1 oldval 0.0
hfactory ${scobj_hpath}/flow2 plain user float
hsetprop ${scobj_hpath}/flow2 control true
hsetprop ${scobj_hpath}/flow2 data true
hsetprop ${scobj_hpath}/flow2 mutable false
hsetprop ${scobj_hpath}/flow2 nxsave true
hsetprop ${scobj_hpath}/flow2 oldval 0.0
hfactory ${scobj_hpath}/flow3 plain user float
hsetprop ${scobj_hpath}/flow3 control true
hsetprop ${scobj_hpath}/flow3 data true
hsetprop ${scobj_hpath}/flow3 mutable false
hsetprop ${scobj_hpath}/flow3 nxsave true
hsetprop ${scobj_hpath}/flow3 oldval 0.0
hfactory ${scobj_hpath}/gas_factor plain user float
hsetprop ${scobj_hpath}/gas_factor control true
hsetprop ${scobj_hpath}/gas_factor data true
hsetprop ${scobj_hpath}/gas_factor mutable false
hsetprop ${scobj_hpath}/gas_factor nxsave true
hsetprop ${scobj_hpath}/gas_factor oldval 1.0
hset ${scobj_hpath}/gas_factor 1.0
hfactory ${scobj_hpath}/humidity plain user float
hsetprop ${scobj_hpath}/humidity read ${ns}::getValue ${scobj_hpath} read_all_data {?ALL DATA}
hsetprop ${scobj_hpath}/humidity read_all_data ${ns}::read_all_data ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity write ${ns}::write_humidity ${scobj_hpath} noResponse {}
hsetprop ${scobj_hpath}/humidity noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity check ${ns}::chkrange_function ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity driving 0
hsetprop ${scobj_hpath}/humidity checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity driveable humidity
hsetprop ${scobj_hpath}/humidity control true
hsetprop ${scobj_hpath}/humidity data true
hsetprop ${scobj_hpath}/humidity mutable false
hsetprop ${scobj_hpath}/humidity nxsave true
hsetprop ${scobj_hpath}/humidity lowerlimit 10
hsetprop ${scobj_hpath}/humidity upperlimit 90
hsetprop ${scobj_hpath}/humidity tolerance 1
hsetprop ${scobj_hpath}/humidity oldval 50
hset ${scobj_hpath}/humidity 50
hsetprop ${scobj_hpath}/humidity pid_deriv "0"
hsetprop ${scobj_hpath}/humidity pid_dvalue "0.0"
hsetprop ${scobj_hpath}/humidity pid_error "0"
hsetprop ${scobj_hpath}/humidity pid_imax "1"
hsetprop ${scobj_hpath}/humidity pid_integ "0"
hsetprop ${scobj_hpath}/humidity pid_ivalue "0.005"
hsetprop ${scobj_hpath}/humidity pid_pvalue "0.05"
hfactory ${scobj_hpath}/temperature plain user float
hsetprop ${scobj_hpath}/temperature control true
hsetprop ${scobj_hpath}/temperature data true
hsetprop ${scobj_hpath}/temperature mutable false
hsetprop ${scobj_hpath}/temperature nxsave true
hsetprop ${scobj_hpath}/temperature oldval 0.0
if {[SplitReply [environment_simulation]]=="false"} {
${sct_controller} poll ${scobj_hpath}/flow 1
${sct_controller} poll ${scobj_hpath}/humidity 1
${sct_controller} write ${scobj_hpath}/flow
ansto_makesctdrive ${name}_flow ${scobj_hpath}/flow ${scobj_hpath}/flow ${sct_controller}
${sct_controller} write ${scobj_hpath}/humidity
ansto_makesctdrive ${name}_humidity ${scobj_hpath}/humidity ${scobj_hpath}/humidity ${sct_controller}
}
hfactory ${scobj_hpath}/analog plain spy none
hfactory ${scobj_hpath}/analog/ansto_temp plain user float
hsetprop ${scobj_hpath}/analog/ansto_temp read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,12}
hsetprop ${scobj_hpath}/analog/ansto_temp read_sixteen ${ns}::read_sixteen ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/ansto_temp control true
hsetprop ${scobj_hpath}/analog/ansto_temp data true
hsetprop ${scobj_hpath}/analog/ansto_temp mutable false
hsetprop ${scobj_hpath}/analog/ansto_temp nxsave true
hsetprop ${scobj_hpath}/analog/ansto_temp oldval 0.0
hsetprop ${scobj_hpath}/analog/ansto_temp base "0"
hsetprop ${scobj_hpath}/analog/ansto_temp span "100"
hfactory ${scobj_hpath}/analog/pv1 plain user float
hsetprop ${scobj_hpath}/analog/pv1 read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,0}
hsetprop ${scobj_hpath}/analog/pv1 read_sixteen ${ns}::read_sixteen ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/pv1 control true
hsetprop ${scobj_hpath}/analog/pv1 data true
hsetprop ${scobj_hpath}/analog/pv1 mutable false
hsetprop ${scobj_hpath}/analog/pv1 nxsave true
hsetprop ${scobj_hpath}/analog/pv1 oldval 0.0
hsetprop ${scobj_hpath}/analog/pv1 base "0"
hsetprop ${scobj_hpath}/analog/pv1 span "500"
hfactory ${scobj_hpath}/analog/pv2 plain user float
hsetprop ${scobj_hpath}/analog/pv2 read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,1}
hsetprop ${scobj_hpath}/analog/pv2 read_sixteen ${ns}::read_sixteen ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/pv2 control true
hsetprop ${scobj_hpath}/analog/pv2 data true
hsetprop ${scobj_hpath}/analog/pv2 mutable false
hsetprop ${scobj_hpath}/analog/pv2 nxsave true
hsetprop ${scobj_hpath}/analog/pv2 oldval 0.0
hsetprop ${scobj_hpath}/analog/pv2 base "0"
hsetprop ${scobj_hpath}/analog/pv2 span "500"
hfactory ${scobj_hpath}/analog/pv3 plain user float
hsetprop ${scobj_hpath}/analog/pv3 read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,2}
hsetprop ${scobj_hpath}/analog/pv3 read_sixteen ${ns}::read_sixteen ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/pv3 control true
hsetprop ${scobj_hpath}/analog/pv3 data true
hsetprop ${scobj_hpath}/analog/pv3 mutable false
hsetprop ${scobj_hpath}/analog/pv3 nxsave true
hsetprop ${scobj_hpath}/analog/pv3 oldval 0.0
hsetprop ${scobj_hpath}/analog/pv3 base "0"
hsetprop ${scobj_hpath}/analog/pv3 span "500"
hfactory ${scobj_hpath}/analog/rhsense plain user float
hsetprop ${scobj_hpath}/analog/rhsense read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,9}
hsetprop ${scobj_hpath}/analog/rhsense read_sixteen ${ns}::read_sixteen ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/rhsense control true
hsetprop ${scobj_hpath}/analog/rhsense data true
hsetprop ${scobj_hpath}/analog/rhsense mutable false
hsetprop ${scobj_hpath}/analog/rhsense nxsave true
hsetprop ${scobj_hpath}/analog/rhsense oldval 0.0
hsetprop ${scobj_hpath}/analog/rhsense base "0"
hsetprop ${scobj_hpath}/analog/rhsense span "100"
hfactory ${scobj_hpath}/analog/rhtemp plain user float
hsetprop ${scobj_hpath}/analog/rhtemp read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,8}
hsetprop ${scobj_hpath}/analog/rhtemp read_sixteen ${ns}::read_sixteen ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/rhtemp control true
hsetprop ${scobj_hpath}/analog/rhtemp data true
hsetprop ${scobj_hpath}/analog/rhtemp mutable false
hsetprop ${scobj_hpath}/analog/rhtemp nxsave true
hsetprop ${scobj_hpath}/analog/rhtemp oldval 0.0
hsetprop ${scobj_hpath}/analog/rhtemp base "0"
hsetprop ${scobj_hpath}/analog/rhtemp span "100"
hfactory ${scobj_hpath}/analog/sp1 plain user float
hsetprop ${scobj_hpath}/analog/sp1 read ${ns}::getValue ${scobj_hpath} read_twelve {?AOUT,0}
hsetprop ${scobj_hpath}/analog/sp1 read_twelve ${ns}::read_twelve ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp1 write ${ns}::write_twelve ${scobj_hpath} noResponse {!AOUT,0,}
hsetprop ${scobj_hpath}/analog/sp1 noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp1 check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp1 control true
hsetprop ${scobj_hpath}/analog/sp1 data true
hsetprop ${scobj_hpath}/analog/sp1 mutable false
hsetprop ${scobj_hpath}/analog/sp1 nxsave true
hsetprop ${scobj_hpath}/analog/sp1 oldval 0.0
hsetprop ${scobj_hpath}/analog/sp1 base "0"
hsetprop ${scobj_hpath}/analog/sp1 span "500"
hfactory ${scobj_hpath}/analog/sp2 plain user float
hsetprop ${scobj_hpath}/analog/sp2 read ${ns}::getValue ${scobj_hpath} read_twelve {?AOUT,1}
hsetprop ${scobj_hpath}/analog/sp2 read_twelve ${ns}::read_twelve ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp2 write ${ns}::write_twelve ${scobj_hpath} noResponse {!AOUT,1,}
hsetprop ${scobj_hpath}/analog/sp2 noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp2 check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp2 control true
hsetprop ${scobj_hpath}/analog/sp2 data true
hsetprop ${scobj_hpath}/analog/sp2 mutable false
hsetprop ${scobj_hpath}/analog/sp2 nxsave true
hsetprop ${scobj_hpath}/analog/sp2 oldval 0.0
hsetprop ${scobj_hpath}/analog/sp2 base "0"
hsetprop ${scobj_hpath}/analog/sp2 span "500"
hfactory ${scobj_hpath}/analog/sp3 plain user float
hsetprop ${scobj_hpath}/analog/sp3 read ${ns}::getValue ${scobj_hpath} read_twelve {?AOUT,2}
hsetprop ${scobj_hpath}/analog/sp3 read_twelve ${ns}::read_twelve ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp3 write ${ns}::write_twelve ${scobj_hpath} noResponse {!AOUT,2,}
hsetprop ${scobj_hpath}/analog/sp3 noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp3 check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/analog/sp3 control true
hsetprop ${scobj_hpath}/analog/sp3 data true
hsetprop ${scobj_hpath}/analog/sp3 mutable false
hsetprop ${scobj_hpath}/analog/sp3 nxsave true
hsetprop ${scobj_hpath}/analog/sp3 oldval 0.0
hsetprop ${scobj_hpath}/analog/sp3 base "0"
hsetprop ${scobj_hpath}/analog/sp3 span "500"
if {[SplitReply [environment_simulation]]=="false"} {
${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 1
${sct_controller} poll ${scobj_hpath}/analog/pv1 1
${sct_controller} poll ${scobj_hpath}/analog/pv2 1
${sct_controller} poll ${scobj_hpath}/analog/pv3 1
${sct_controller} poll ${scobj_hpath}/analog/rhsense 1
${sct_controller} poll ${scobj_hpath}/analog/rhtemp 1
${sct_controller} poll ${scobj_hpath}/analog/sp1 1
${sct_controller} poll ${scobj_hpath}/analog/sp2 1
${sct_controller} poll ${scobj_hpath}/analog/sp3 1
${sct_controller} write ${scobj_hpath}/analog/sp1
${sct_controller} write ${scobj_hpath}/analog/sp2
${sct_controller} write ${scobj_hpath}/analog/sp3
}
hfactory ${scobj_hpath}/digital plain spy none
hfactory ${scobj_hpath}/digital/enabled plain user int
hsetprop ${scobj_hpath}/digital/enabled read ${ns}::getValue ${scobj_hpath} read_digital {?DOUT,2}
hsetprop ${scobj_hpath}/digital/enabled read_digital ${ns}::read_digital ${scobj_hpath}
hsetprop ${scobj_hpath}/digital/enabled write ${ns}::write_digital ${scobj_hpath} noResponse {!DOUT,2,}
hsetprop ${scobj_hpath}/digital/enabled noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/digital/enabled check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/digital/enabled control true
hsetprop ${scobj_hpath}/digital/enabled data true
hsetprop ${scobj_hpath}/digital/enabled mutable false
hsetprop ${scobj_hpath}/digital/enabled nxsave true
hsetprop ${scobj_hpath}/digital/enabled values 0,1
hsetprop ${scobj_hpath}/digital/enabled oldval 0
if {[SplitReply [environment_simulation]]=="false"} {
${sct_controller} poll ${scobj_hpath}/digital/enabled 5
${sct_controller} write ${scobj_hpath}/digital/enabled
}
hsetprop ${scobj_hpath} klass environment
# hook code starts
# hook code ends
} catch_message ]
handle_exception ${catch_status} ${catch_message} "in ${ns}::mk_sct_hiden_xcs"
}
namespace eval ::scobj::hiden_xcs {
namespace export debug_log
namespace export mk_sct_hiden_xcs
}
proc add_hiden_xcs {name IP port terminator {tol 0.5}} {
set ns "::scobj::hiden_xcs"
${ns}::debug_log 1 "add_hiden_xcs ${name} ${IP} ${port}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
} else {
${ns}::debug_log 1 "makesctcontroller sct_${name} std ${IP}:${port} ${terminator}"
makesctcontroller sct_${name} std ${IP}:${port} ${terminator}
}
}
${ns}::debug_log 1 "mk_sct_hiden_xcs sct_${name} ${name} ${tol}"
${ns}::mk_sct_hiden_xcs sct_${name} ${name} ${tol}
close ${fd}
}
puts stdout "file evaluation of sct_hiden_xcs.tcl"
::scobj::hiden_xcs::debug_log 1 "file evaluation of sct_hiden_xcs.tcl"