# 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} { set catch_status [ catch { 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} } } catch_message ] } # checklimits function for driveable interface proc ::scobj::hiden_xcs::checklimits {tc_root} { set catch_status [ catch { 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] } # hook code goes here if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { sct driving 0 error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" } return OK } catch_message ] handle_exception ${catch_status} ${catch_message} } # check function for hset change proc ::scobj::hiden_xcs::checkrange {tc_root} { set catch_status [ catch { 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] } # hook code goes here if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" } return OK } catch_message ] handle_exception ${catch_status} ${catch_message} } # checkstatus function for driveable interface proc ::scobj::hiden_xcs::checkstatus {tc_root} { set catch_status [ catch { # hook code goes here 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" } } catch_message ] handle_exception ${catch_status} ${catch_message} } # check function for hset change proc ::scobj::hiden_xcs::chkrange_function {tc_root} { set catch_status [ catch { 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 } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to request the read of a parameter on a device proc ::scobj::hiden_xcs::fetch_flow {tc_root nextState cmd_str} { set catch_status [ catch { 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}] # cut this function short return ${nextState} # hook code ends if { [hpropexists [sct] geterror] } { debug_log 1 "[sct] error: [sct geterror]" error "[sct geterror]" } debug_log 1 "fetch_flow sct send ${cmd}" sct send "${cmd}" return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to request the read of a parameter on a device proc ::scobj::hiden_xcs::getValue {tc_root nextState cmd_str} { set catch_status [ catch { debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set cmd "${cmd_str}" # hook code goes here debug_log 1 "getValue sct send ${cmd}" sct send "${cmd}" return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # halt function for driveable interface proc ::scobj::hiden_xcs::halt {tc_root} { set catch_status [ catch { debug_log 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" ### TODO hset [sct] [hval [sct]] # hook code goes here sct driving 0 return "idle" } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to check the write parameter on a device proc ::scobj::hiden_xcs::noResponse {tc_root} { set catch_status [ catch { debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" # hook code goes here return "idle" } catch_message ] handle_exception ${catch_status} ${catch_message} } # pid function for PID control proc ::scobj::hiden_xcs::pid_flow {tc_root sp pv} { set catch_status [ catch { 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}] # hook code starts set path [pathname [sct]] 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}] } } } # hook code ends sct pid_output ${pid} } catch_message ] handle_exception ${catch_status} ${catch_message} return ${pid} } # pid function for PID control proc ::scobj::hiden_xcs::pid_humidity {tc_root sp pv} { set catch_status [ catch { 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}] # hook code starts set path [pathname [sct]] set sign 1 foreach node [list analog/sp1 analog/sp2] { set sign [expr -${sign}] set signed_pid [expr ${sign} * ${pid}] hsetprop ${path}/${node} bias_humidity ${signed_pid} if { [hpropexists ${path}/${node} target] } { hset ${path}/${node} [hgetpropval ${path}/${node} target] } else { hset ${path}/${node} [hval ${path}/${node}] } } } # hook code ends sct pid_output ${pid} } catch_message ] handle_exception ${catch_status} ${catch_message} return ${pid} } # function to parse the read of a parameter on a device proc ::scobj::hiden_xcs::rdValue {tc_root} { set catch_status [ catch { 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}" error "[sct geterror]" } # hook code goes here 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::hiden_xcs::read_all_data {tc_root} { set catch_status [ catch { 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}" 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}] # hook code ends if { [hpropexists [sct] geterror] } { debug_log 1 "[sct] error: [sct geterror]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::hiden_xcs::read_digital {tc_root} { set catch_status [ catch { 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}" 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]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::hiden_xcs::read_flow {tc_root} { set catch_status [ catch { 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}" error "[sct geterror]" } # hook code goes here 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::hiden_xcs::read_sixteen {tc_root} { set catch_status [ catch { 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}" 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]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::hiden_xcs::read_twelve {tc_root} { set catch_status [ catch { 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}" 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]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::hiden_xcs::setValue {tc_root nextState cmd_str} { set catch_status [ catch { 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}" # hook code goes here 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::hiden_xcs::write_digital {tc_root nextState cmd_str} { set catch_status [ catch { 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}" # hook code goes here 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::hiden_xcs::write_flow {tc_root nextState cmd_str} { set catch_status [ catch { 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]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::hiden_xcs::write_humidity {tc_root nextState cmd_str} { set catch_status [ catch { 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]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::hiden_xcs::write_twelve {tc_root nextState cmd_str} { set catch_status [ catch { 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]] } if { ${par} < 0.0 } { set par 0.0 } if { ${par} > ${span} } { set par ${span} } 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]" 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } 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}/enabled plain user int hsetprop ${scobj_hpath}/enabled read ${ns}::getValue ${scobj_hpath} read_digital {?DOUT,2} hsetprop ${scobj_hpath}/enabled read_digital ${ns}::read_digital ${scobj_hpath} hsetprop ${scobj_hpath}/enabled write ${ns}::write_digital ${scobj_hpath} noResponse {!DOUT,2,} hsetprop ${scobj_hpath}/enabled noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/enabled check ${ns}::checkrange ${scobj_hpath} hsetprop ${scobj_hpath}/enabled control true hsetprop ${scobj_hpath}/enabled data true hsetprop ${scobj_hpath}/enabled mutable false hsetprop ${scobj_hpath}/enabled nxsave true hsetprop ${scobj_hpath}/enabled values 0,1 hsetprop ${scobj_hpath}/enabled oldval 0 hsetprop ${scobj_hpath}/enabled klass "environment" hsetprop ${scobj_hpath}/enabled sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/enabled type "part" hsetprop ${scobj_hpath}/enabled nxalias "${name}_enabled" 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 true 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 klass "environment" 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 "30" hsetprop ${scobj_hpath}/flow pid_integ "0" hsetprop ${scobj_hpath}/flow pid_ivalue "0.1" hsetprop ${scobj_hpath}/flow pid_pvalue "0.2" hsetprop ${scobj_hpath}/flow sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/flow type "drivable" hsetprop ${scobj_hpath}/flow nxalias "${name}_flow" hfactory ${scobj_hpath}/flow1 plain user float hsetprop ${scobj_hpath}/flow1 control false hsetprop ${scobj_hpath}/flow1 data false hsetprop ${scobj_hpath}/flow1 mutable false hsetprop ${scobj_hpath}/flow1 nxsave false hsetprop ${scobj_hpath}/flow1 oldval 0.0 hsetprop ${scobj_hpath}/flow1 klass "environment" hsetprop ${scobj_hpath}/flow1 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/flow1 type "part" hsetprop ${scobj_hpath}/flow1 nxalias "${name}_flow1" hfactory ${scobj_hpath}/flow2 plain user float hsetprop ${scobj_hpath}/flow2 control false hsetprop ${scobj_hpath}/flow2 data false hsetprop ${scobj_hpath}/flow2 mutable false hsetprop ${scobj_hpath}/flow2 nxsave false hsetprop ${scobj_hpath}/flow2 oldval 0.0 hsetprop ${scobj_hpath}/flow2 klass "environment" hsetprop ${scobj_hpath}/flow2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/flow2 type "part" hsetprop ${scobj_hpath}/flow2 nxalias "${name}_flow2" hfactory ${scobj_hpath}/flow3 plain user float hsetprop ${scobj_hpath}/flow3 control false hsetprop ${scobj_hpath}/flow3 data false hsetprop ${scobj_hpath}/flow3 mutable false hsetprop ${scobj_hpath}/flow3 nxsave false hsetprop ${scobj_hpath}/flow3 oldval 0.0 hsetprop ${scobj_hpath}/flow3 klass "environment" hsetprop ${scobj_hpath}/flow3 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/flow3 type "part" hsetprop ${scobj_hpath}/flow3 nxalias "${name}_flow3" 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 hsetprop ${scobj_hpath}/gas_factor klass "environment" hsetprop ${scobj_hpath}/gas_factor sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/gas_factor type "part" hsetprop ${scobj_hpath}/gas_factor nxalias "${name}_gas_factor" 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 true 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 klass "environment" 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 "30" hsetprop ${scobj_hpath}/humidity pid_integ "0" hsetprop ${scobj_hpath}/humidity pid_ivalue "0.1" hsetprop ${scobj_hpath}/humidity pid_pvalue "0.2" hsetprop ${scobj_hpath}/humidity sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/humidity type "drivable" hsetprop ${scobj_hpath}/humidity nxalias "${name}_humidity" hfactory ${scobj_hpath}/temperature plain user float hsetprop ${scobj_hpath}/temperature control false hsetprop ${scobj_hpath}/temperature data false hsetprop ${scobj_hpath}/temperature mutable false hsetprop ${scobj_hpath}/temperature nxsave false hsetprop ${scobj_hpath}/temperature oldval 0.0 hsetprop ${scobj_hpath}/temperature klass "environment" hsetprop ${scobj_hpath}/temperature sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/temperature type "part" hsetprop ${scobj_hpath}/temperature nxalias "${name}_temperature" hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} nxsave "true" if {[SplitReply [environment_simulation]]=="false"} { ${sct_controller} poll ${scobj_hpath}/enabled 10 ${sct_controller} poll ${scobj_hpath}/flow 1 ${sct_controller} poll ${scobj_hpath}/humidity 1 ${sct_controller} write ${scobj_hpath}/enabled ${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 false hsetprop ${scobj_hpath}/analog/ansto_temp data false hsetprop ${scobj_hpath}/analog/ansto_temp mutable false hsetprop ${scobj_hpath}/analog/ansto_temp nxsave false hsetprop ${scobj_hpath}/analog/ansto_temp oldval 0.0 hsetprop ${scobj_hpath}/analog/ansto_temp base "0" hsetprop ${scobj_hpath}/analog/ansto_temp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/ansto_temp span "100" hsetprop ${scobj_hpath}/analog/ansto_temp type "part" hsetprop ${scobj_hpath}/analog/ansto_temp nxalias "${name}_analog_ansto_temp" 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 false hsetprop ${scobj_hpath}/analog/pv1 data false hsetprop ${scobj_hpath}/analog/pv1 mutable false hsetprop ${scobj_hpath}/analog/pv1 nxsave false hsetprop ${scobj_hpath}/analog/pv1 oldval 0.0 hsetprop ${scobj_hpath}/analog/pv1 base "0" hsetprop ${scobj_hpath}/analog/pv1 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/pv1 span "500" hsetprop ${scobj_hpath}/analog/pv1 type "part" hsetprop ${scobj_hpath}/analog/pv1 nxalias "${name}_analog_pv1" 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 false hsetprop ${scobj_hpath}/analog/pv2 data false hsetprop ${scobj_hpath}/analog/pv2 mutable false hsetprop ${scobj_hpath}/analog/pv2 nxsave false hsetprop ${scobj_hpath}/analog/pv2 oldval 0.0 hsetprop ${scobj_hpath}/analog/pv2 base "0" hsetprop ${scobj_hpath}/analog/pv2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/pv2 span "500" hsetprop ${scobj_hpath}/analog/pv2 type "part" hsetprop ${scobj_hpath}/analog/pv2 nxalias "${name}_analog_pv2" 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 false hsetprop ${scobj_hpath}/analog/pv3 data false hsetprop ${scobj_hpath}/analog/pv3 mutable false hsetprop ${scobj_hpath}/analog/pv3 nxsave false hsetprop ${scobj_hpath}/analog/pv3 oldval 0.0 hsetprop ${scobj_hpath}/analog/pv3 base "0" hsetprop ${scobj_hpath}/analog/pv3 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/pv3 span "500" hsetprop ${scobj_hpath}/analog/pv3 type "part" hsetprop ${scobj_hpath}/analog/pv3 nxalias "${name}_analog_pv3" 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 false hsetprop ${scobj_hpath}/analog/rhsense data false hsetprop ${scobj_hpath}/analog/rhsense mutable false hsetprop ${scobj_hpath}/analog/rhsense nxsave false hsetprop ${scobj_hpath}/analog/rhsense oldval 0.0 hsetprop ${scobj_hpath}/analog/rhsense base "0" hsetprop ${scobj_hpath}/analog/rhsense sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/rhsense span "100" hsetprop ${scobj_hpath}/analog/rhsense type "part" hsetprop ${scobj_hpath}/analog/rhsense nxalias "${name}_analog_rhsense" 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 false hsetprop ${scobj_hpath}/analog/rhtemp data false hsetprop ${scobj_hpath}/analog/rhtemp mutable false hsetprop ${scobj_hpath}/analog/rhtemp nxsave false hsetprop ${scobj_hpath}/analog/rhtemp oldval 0.0 hsetprop ${scobj_hpath}/analog/rhtemp base "0" hsetprop ${scobj_hpath}/analog/rhtemp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/rhtemp span "100" hsetprop ${scobj_hpath}/analog/rhtemp type "part" hsetprop ${scobj_hpath}/analog/rhtemp nxalias "${name}_analog_rhtemp" 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 false hsetprop ${scobj_hpath}/analog/sp1 data false hsetprop ${scobj_hpath}/analog/sp1 mutable false hsetprop ${scobj_hpath}/analog/sp1 nxsave false hsetprop ${scobj_hpath}/analog/sp1 oldval 0.0 hsetprop ${scobj_hpath}/analog/sp1 base "0" hsetprop ${scobj_hpath}/analog/sp1 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/sp1 span "500" hsetprop ${scobj_hpath}/analog/sp1 type "part" hsetprop ${scobj_hpath}/analog/sp1 nxalias "${name}_analog_sp1" 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 false hsetprop ${scobj_hpath}/analog/sp2 data false hsetprop ${scobj_hpath}/analog/sp2 mutable false hsetprop ${scobj_hpath}/analog/sp2 nxsave false hsetprop ${scobj_hpath}/analog/sp2 oldval 0.0 hsetprop ${scobj_hpath}/analog/sp2 base "0" hsetprop ${scobj_hpath}/analog/sp2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/sp2 span "500" hsetprop ${scobj_hpath}/analog/sp2 type "part" hsetprop ${scobj_hpath}/analog/sp2 nxalias "${name}_analog_sp2" 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 false hsetprop ${scobj_hpath}/analog/sp3 data false hsetprop ${scobj_hpath}/analog/sp3 mutable false hsetprop ${scobj_hpath}/analog/sp3 nxsave false hsetprop ${scobj_hpath}/analog/sp3 oldval 0.0 hsetprop ${scobj_hpath}/analog/sp3 base "0" hsetprop ${scobj_hpath}/analog/sp3 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analog/sp3 span "500" hsetprop ${scobj_hpath}/analog/sp3 type "part" hsetprop ${scobj_hpath}/analog/sp3 nxalias "${name}_analog_sp3" if {[SplitReply [environment_simulation]]=="false"} { ${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 5 ${sct_controller} poll ${scobj_hpath}/analog/pv1 5 ${sct_controller} poll ${scobj_hpath}/analog/pv2 5 ${sct_controller} poll ${scobj_hpath}/analog/pv3 5 ${sct_controller} poll ${scobj_hpath}/analog/rhsense 5 ${sct_controller} poll ${scobj_hpath}/analog/rhtemp 5 ${sct_controller} poll ${scobj_hpath}/analog/sp1 5 ${sct_controller} poll ${scobj_hpath}/analog/sp2 5 ${sct_controller} poll ${scobj_hpath}/analog/sp3 5 ${sct_controller} write ${scobj_hpath}/analog/sp1 ${sct_controller} write ${scobj_hpath}/analog/sp2 ${sct_controller} write ${scobj_hpath}/analog/sp3 } hsetprop ${scobj_hpath} klass environment # hook code starts # hook code ends } catch_message ] handle_exception ${catch_status} ${catch_message} } 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 catch_status [ catch { 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} } catch_message ] handle_exception ${catch_status} ${catch_message} } puts stdout "file evaluation of sct_hiden_xcs.tcl" ::scobj::hiden_xcs::debug_log 1 "file evaluation of sct_hiden_xcs.tcl"