# Generated driver for hiden_xcs # vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent # namespace eval ::scobj::hiden_xcs { set debug_threshold 5 } proc ::scobj::hiden_xcs::debug_log {tc_root debug_level debug_string} { set catch_status [ catch { set debug_threshold [hgetpropval ${tc_root} debug_threshold] if {${debug_level} >= ${debug_threshold}} { set fd [open "../log/hiden_xcs_[basename ${tc_root}].log" "a"] set line "[clock format [clock seconds] -format "%T"] ${debug_string}" puts ${fd} "${line}" close ${fd} } } catch_message ] } proc ::scobj::hiden_xcs::sics_log {debug_level debug_string} { set catch_status [ catch { set debug_threshold ${::scobj::hiden_xcs::debug_threshold} if {${debug_level} >= ${debug_threshold}} { sicslog "::scobj::hiden_xcs::${debug_string}" } } catch_message ] } # checklimits function for driveable interface proc ::scobj::hiden_xcs::checklimits {tc_root} { set catch_status [ catch { debug_log ${tc_root} 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] } # checklimits 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 ${tc_root} 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] } # checkrange 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 { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" set pv "[hval ${tc_root}/[sct driveable]]" if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { sct driving 0 return "idle" } return "busy" } else { sct utime settle_time_start return "busy" } } sct driving 0 return "idle" } if { [hpropexists [sct] settle_time_start] } { hdelprop [sct] settle_time_start } 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 ${tc_root} 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] } # chkrange_function hook code starts # hooked # chkrange_function 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 ${tc_root} 1 "fetch_flow tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set cmd "${cmd_str}" # fetch_flow hook code starts set data 0.0 foreach node [list flow1 flow2] { set data [expr ${data} + [hval ${tc_root}/${node}]] } sct result ${data} set sp [pathname [sct]]/setpoint if { [hpropexists ${sp} target] } { set sp [hgetpropval ${sp} target] pid_flow ${tc_root} ${sp} ${data} } set cmd "@@NOSEND@@" # fetch_flow hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } debug_log ${tc_root} 1 "fetch_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 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 ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set cmd "${cmd_str}" # getValue hook code goes here debug_log ${tc_root} 1 "getValue sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { 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 ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" ### TODO hset [sct] [hval [sct]] # halt 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 ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" # noResponse hook code goes here return "idle" } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::hiden_xcs::no_op {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "no_op 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}" # no_op hook code starts set cmd "@@NOSEND@@" # no_op hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 1 "no_op sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } 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 ${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_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}] # 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}) } { hsetprop ${node} bias_flow ${pid} if { [hpropexists ${node} target] } { hset ${node} [hgetpropval ${node} target] } else { hset ${node} [hval ${node}] } } } # pid_flow 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 ${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_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}] # pid_humidity hook code starts set sign 1 foreach node [list ${tc_root}/analog/sp1 ${tc_root}/analog/sp2] { set sign [expr -${sign}] set signed_pid [expr ${sign} * ${pid}] if { !([hpropexists ${node} bias_humidity] && [hgetpropval ${node} bias_humidity] == ${signed_pid}) } { hsetprop ${node} bias_humidity ${signed_pid} if { [hpropexists ${node} target] } { hset ${node} [hgetpropval ${node} target] } else { hset ${node} [hval ${node}] } } } # pid_humidity 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 ${tc_root} 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]" } # rdValue hook code goes here if { ${data} != [sct oldval] } { debug_log ${tc_root} 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 ${tc_root} 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]" } # read_all_data 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 (not 8) for read_all_data in: '${data}'" } } else { sct geterror "Syntax error (not A) for read_all_data in: '${data}'" } set sp [pathname [sct]]/setpoint if { [hpropexists ${sp} target] } { set sp [hgetpropval ${sp} target] pid_humidity ${tc_root} ${sp} ${data} } # read_all_data hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { ${data} != [sct oldval] } { debug_log ${tc_root} 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 ${tc_root} 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]" } # read_digital 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}'" } # read_digital hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { ${data} != [sct oldval] } { debug_log ${tc_root} 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 ${tc_root} 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]" } # read_flow hook code goes here if { ${data} != [sct oldval] } { debug_log ${tc_root} 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 ${tc_root} 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]" } # read_sixteen 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}'" } # read_sixteen hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { ${data} != [sct oldval] } { debug_log ${tc_root} 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 ${tc_root} 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]" } # read_twelve 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}'" } # read_twelve hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { ${data} != [sct oldval] } { debug_log ${tc_root} 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 ${tc_root} 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}" # setValue hook code goes here if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 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 ${tc_root} 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}" # write_digital hook code goes here if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 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 ${tc_root} 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}" # write_flow hook code starts if { [hpropexists ${tc_root}/humidity/setpoint target] } { set humidity_target [hgetpropval ${tc_root}/humidity/setpoint target] } else { set humidity_target [hval ${tc_root}/humidity/setpoint] } 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 nextState "idle" set cmd "@@NOSEND@@" # write_flow hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 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 ${tc_root} 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}" # write_humidity hook code starts if { [hpropexists ${tc_root}/flow/setpoint target] } { set flow_target [hgetpropval ${tc_root}/flow/setpoint target] } else { set flow_target [hval ${tc_root}/flow/setpoint] } 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 nextState "idle" set cmd "@@NOSEND@@" # write_humidity hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 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 ${tc_root} 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}" # write_twelve 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}" # write_twelve hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 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::mkDriver { sct_controller name id } { ::scobj::hiden_xcs::sics_log 9 "::scobj::hiden_xcs::mkDriver ${sct_controller} ${name} ${id}" 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 permlink data_set "G[format "%02d" ${id}]X02" hsetprop ${scobj_hpath}/enabled @description "G[format "%02d" ${id}]X02" 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}/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}/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 {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { ${sct_controller} poll ${scobj_hpath}/enabled 10 ${sct_controller} write ${scobj_hpath}/enabled } else { ::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs" } 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 {[string equal -nocase [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 } else { ::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs" } hfactory ${scobj_hpath}/flow plain spy none hsetprop ${scobj_hpath}/flow data "true" hsetprop ${scobj_hpath}/flow nxsave "true" hfactory ${scobj_hpath}/flow/sensor plain user float hsetprop ${scobj_hpath}/flow/sensor read ${ns}::fetch_flow ${scobj_hpath} read_flow {None} hsetprop ${scobj_hpath}/flow/sensor read_flow ${ns}::read_flow ${scobj_hpath} hsetprop ${scobj_hpath}/flow/sensor control true hsetprop ${scobj_hpath}/flow/sensor data true hsetprop ${scobj_hpath}/flow/sensor mutable true hsetprop ${scobj_hpath}/flow/sensor nxsave true hsetprop ${scobj_hpath}/flow/sensor permlink data_set "G[format "%02d" ${id}]S01" hsetprop ${scobj_hpath}/flow/sensor @description "G[format "%02d" ${id}]S01" hsetprop ${scobj_hpath}/flow/sensor oldval 0.0 hsetprop ${scobj_hpath}/flow/sensor klass "environment" hsetprop ${scobj_hpath}/flow/sensor pid_deriv "0" hsetprop ${scobj_hpath}/flow/sensor pid_dvalue "0.0" hsetprop ${scobj_hpath}/flow/sensor pid_error "0" hsetprop ${scobj_hpath}/flow/sensor pid_imax "30" hsetprop ${scobj_hpath}/flow/sensor pid_integ "0" hsetprop ${scobj_hpath}/flow/sensor pid_ivalue "0.1" hsetprop ${scobj_hpath}/flow/sensor pid_pvalue "0.2" hsetprop ${scobj_hpath}/flow/sensor sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/flow/sensor type "part" hsetprop ${scobj_hpath}/flow/sensor nxalias "${name}_flow_sensor" hfactory ${scobj_hpath}/flow/setpoint plain user float hsetprop ${scobj_hpath}/flow/setpoint write ${ns}::write_flow ${scobj_hpath} noResponse {} hsetprop ${scobj_hpath}/flow/setpoint noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/flow/setpoint check ${ns}::checkrange ${scobj_hpath} hsetprop ${scobj_hpath}/flow/setpoint driving 0 hsetprop ${scobj_hpath}/flow/setpoint checklimits ${ns}::checklimits ${scobj_hpath} hsetprop ${scobj_hpath}/flow/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} hsetprop ${scobj_hpath}/flow/setpoint halt ${ns}::halt ${scobj_hpath} hsetprop ${scobj_hpath}/flow/setpoint driveable flow/sensor hsetprop ${scobj_hpath}/flow/setpoint control true hsetprop ${scobj_hpath}/flow/setpoint data true hsetprop ${scobj_hpath}/flow/setpoint mutable true hsetprop ${scobj_hpath}/flow/setpoint nxsave true hsetprop ${scobj_hpath}/flow/setpoint lowerlimit 0 hsetprop ${scobj_hpath}/flow/setpoint upperlimit 500 hsetprop ${scobj_hpath}/flow/setpoint tolerance 1 hsetprop ${scobj_hpath}/flow/setpoint permlink data_set "G[format "%02d" ${id}]SP01" hsetprop ${scobj_hpath}/flow/setpoint @description "G[format "%02d" ${id}]SP01" hsetprop ${scobj_hpath}/flow/setpoint oldval 100 hset ${scobj_hpath}/flow/setpoint 100 hsetprop ${scobj_hpath}/flow/setpoint klass "environment" hsetprop ${scobj_hpath}/flow/setpoint sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/flow/setpoint type "drivable" hsetprop ${scobj_hpath}/flow/setpoint nxalias "${name}_flow_setpoint" 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" } hfactory ${scobj_hpath}/humidity plain spy none hsetprop ${scobj_hpath}/humidity data "true" hsetprop ${scobj_hpath}/humidity nxsave "true" hfactory ${scobj_hpath}/humidity/sensor plain user float hsetprop ${scobj_hpath}/humidity/sensor read ${ns}::getValue ${scobj_hpath} read_all_data {?ALL DATA} hsetprop ${scobj_hpath}/humidity/sensor read_all_data ${ns}::read_all_data ${scobj_hpath} hsetprop ${scobj_hpath}/humidity/sensor control true hsetprop ${scobj_hpath}/humidity/sensor data true hsetprop ${scobj_hpath}/humidity/sensor mutable true hsetprop ${scobj_hpath}/humidity/sensor nxsave true hsetprop ${scobj_hpath}/humidity/sensor permlink data_set "G[format "%02d" ${id}]S02" hsetprop ${scobj_hpath}/humidity/sensor @description "G[format "%02d" ${id}]S02" hsetprop ${scobj_hpath}/humidity/sensor oldval 0.0 hsetprop ${scobj_hpath}/humidity/sensor klass "environment" hsetprop ${scobj_hpath}/humidity/sensor pid_deriv "0" hsetprop ${scobj_hpath}/humidity/sensor pid_dvalue "0.0" hsetprop ${scobj_hpath}/humidity/sensor pid_error "0" hsetprop ${scobj_hpath}/humidity/sensor pid_imax "30" hsetprop ${scobj_hpath}/humidity/sensor pid_integ "0" hsetprop ${scobj_hpath}/humidity/sensor pid_ivalue "0.1" hsetprop ${scobj_hpath}/humidity/sensor pid_pvalue "0.2" hsetprop ${scobj_hpath}/humidity/sensor sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/humidity/sensor type "part" hsetprop ${scobj_hpath}/humidity/sensor nxalias "${name}_humidity_sensor" hfactory ${scobj_hpath}/humidity/setpoint plain user float hsetprop ${scobj_hpath}/humidity/setpoint write ${ns}::write_humidity ${scobj_hpath} noResponse {} hsetprop ${scobj_hpath}/humidity/setpoint noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/humidity/setpoint check ${ns}::chkrange_function ${scobj_hpath} hsetprop ${scobj_hpath}/humidity/setpoint driving 0 hsetprop ${scobj_hpath}/humidity/setpoint checklimits ${ns}::checklimits ${scobj_hpath} hsetprop ${scobj_hpath}/humidity/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} hsetprop ${scobj_hpath}/humidity/setpoint halt ${ns}::halt ${scobj_hpath} hsetprop ${scobj_hpath}/humidity/setpoint driveable humidity/sensor hsetprop ${scobj_hpath}/humidity/setpoint control true hsetprop ${scobj_hpath}/humidity/setpoint data true hsetprop ${scobj_hpath}/humidity/setpoint mutable true hsetprop ${scobj_hpath}/humidity/setpoint nxsave true hsetprop ${scobj_hpath}/humidity/setpoint lowerlimit 10 hsetprop ${scobj_hpath}/humidity/setpoint upperlimit 90 hsetprop ${scobj_hpath}/humidity/setpoint tolerance 1 hsetprop ${scobj_hpath}/humidity/setpoint permlink data_set "G[format "%02d" ${id}]SP02" hsetprop ${scobj_hpath}/humidity/setpoint @description "G[format "%02d" ${id}]SP02" hsetprop ${scobj_hpath}/humidity/setpoint oldval 50 hset ${scobj_hpath}/humidity/setpoint 50 hsetprop ${scobj_hpath}/humidity/setpoint klass "environment" hsetprop ${scobj_hpath}/humidity/setpoint sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/humidity/setpoint type "drivable" hsetprop ${scobj_hpath}/humidity/setpoint nxalias "${name}_humidity_setpoint" 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 # mkDriver hook code starts # mkDriver hook code ends } catch_message ] handle_exception ${catch_status} ${catch_message} } namespace eval ::scobj::hiden_xcs { namespace export debug_threshold namespace export debug_log namespace export sics_log namespace export mkDriver } proc add_hiden_xcs {name IP port id} { set catch_status [ catch { ::scobj::hiden_xcs::sics_log 9 "add_hiden_xcs ${name} ${IP} ${port} ${id}" if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "aqadapter" "${IP}"]} { ::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}" makesctcontroller sct_${name} aqadapter ${port} } else { ::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}" makesctcontroller sct_${name} std ${IP}:${port} } } else { ::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No sctcontroller for hiden_xcs" } ::scobj::hiden_xcs::sics_log 1 "::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${id}" ::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${id} } catch_message ] handle_exception ${catch_status} ${catch_message} } clientput "file evaluation of sct_hiden_xcs.tcl" ::scobj::hiden_xcs::sics_log 9 "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"] } { set name [dict get $v name] set enabled [string tolower [dict get $v "enabled"]] set implementation [dict get $v "implementation"] set v [dict get $::config_dict $implementation] if { [dict get $v "driver"] == "hiden_xcs" } { if { [dict get $v enabled] } { if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { set asyncqueue "null" ${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" } elseif { [dict exists $v "asyncqueue"] } { set asyncqueue [dict get $v "asyncqueue"] } else { if { [dict exists $v "asyncprotocol"] } { set asyncprotocol [dict get $v "asyncprotocol"] } else { set asyncprotocol ${name}_protocol MakeAsyncProtocol ${asyncprotocol} if { [dict exists $v "terminator"] } { ${asyncprotocol} sendterminator "[dict get $v "terminator"]" ${asyncprotocol} replyterminator "[dict get $v "terminator"]" } } set asyncqueue ${name}_queue set IP [dict get $v ip] set PORT [dict get $v port] MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT} if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } } set arg_list [list] foreach arg {id} { if {[dict exists $v $arg]} { lappend arg_list "[dict get $v $arg]" } else { ${ns}::sics_log 9 "Missing configuration value $arg" error "Missing configuration value $arg" } } add_hiden_xcs ${name} "aqadapter" ${asyncqueue} {*}$arg_list } } } } } catch_message ] handle_exception ${catch_status} ${catch_message} } if { [info exists ::config_dict] } { ::scobj::hiden_xcs::read_config } else { ::scobj::hiden_xcs::sics_log 5 "No config dict" }