Merge branch 'RELEASE-3_1'

Conflicts:
	sics/site_ansto/instrument/config/environment/hiden_xcs_sct.tcl
	sics/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl
	sics/site_ansto/instrument/hipd/wombat_configuration.tcl
	sics/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl
	sics/site_ansto/instrument/pelican/pelican_configuration.tcl
	sics/site_ansto/instrument/reflectometer/platypus_configuration.tcl
	sics/site_ansto/instrument/util/gen_sct.py
This commit is contained in:
Douglas Clowes
2014-11-06 14:13:20 +11:00
52 changed files with 4133 additions and 3116 deletions

View File

@@ -0,0 +1,57 @@
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
driver eurotherm_3200 = {
protocol = modbus_ap;
class = environment;
simulation_group = environment_simulation;
add_args = 'id datype dev_id tol';
make_args = 'id datype dev_id tol';
group util = {
data = false; control = false; nxsave = false; mutable = false;
var unit = { type = int; value = '${dev_id}'; }
var mode = { type = text; allowed = "int,float"; value = 'int'; }
}
group loop1 = {
readable = 1;
type = float;
var sensor = { read_command = '1'; permlink = 'T.S01'; };
writeable = 1;
var setpoint = { read_command = '2'; write_command = '2'; permlink = 'T.SP01';
driveable = loop1/sensor; lowerlimit = 0; upperlimit =40; tolerance = '${tol}';
};
}
group loop1_extra = {
readable = 1;
type = float;
data = false; control = false; nxsave = false; mutable = false;
var manual_output = { read_command = '3'; }
var working_output = { read_command = '4'; }
var working_setpoint = { read_command = '5'; }
var active_setpoint = { read_command = '15'; }
writeable = 1;
var alarm1_thresh = { read_command = '13'; write_command = '13'; }
var alarm2_thresh = { read_command = '14'; write_command = '14'; }
var power_limit_high = { read_command = '30'; write_command = '30'; }
var power_limit_low = { read_command = '31'; write_command = '31'; }
var setpoint_slew_rate = { read_command = '35'; write_command = '35'; }
var power_slew_rate = { read_command = '37'; write_command = '37'; }
}
code getValue = {
@TCL
if { [string equal -nocase [hval ${tc_root}/util/mode] "float"] } {
set cmd "[hval ${tc_root}/util/unit]:3:[expr {32768+2*${cmd_str}}]:1:F32"
} else {
set cmd "[hval ${tc_root}/util/unit]:3:${cmd_str}:1:U16"
}
@END
}
code setValue = {
@TCL
if { [string equal -nocase [hval ${tc_root}/util/mode] "float"] } {
set cmd "[hval ${tc_root}/util/unit]:16:[expr {32768+2*${cmd_str}}]:1:F32:${par}"
} else {
set cmd "[hval ${tc_root}/util/unit]:16:${cmd_str}:1:U16:${par}"
}
@END
}
}

View File

@@ -7,6 +7,6 @@ driver eurotherm_m2000 = {
add_args = 'id datype dev_id tol'
make_args = 'id datype dev_id tol'
code mkDriver = {%%
mk_sct_eurotherm_et2000 sct_controller environment $name $dev_id $tol $id $datype
add_eurotherm_2000 $name $ip_address $tcp_port $dev_id $tol $id $datype
%%}
}

View File

@@ -42,7 +42,7 @@ proc ::scobj::eurotherm_m2000::mkDriver { sct_controller name device_class simul
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts
mk_sct_eurotherm_et2000 sct_controller environment $name $dev_id $tol $id $datype
add_eurotherm_2000 $name $ip_address $tcp_port $dev_id $tol $id $datype
# mkDriver hook code ends
} catch_message ]
handle_exception ${catch_status} ${catch_message}

View File

@@ -0,0 +1,620 @@
# Generated driver for eurotherm_3200
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::eurotherm_3200 {
set debug_threshold 5
}
proc ::scobj::eurotherm_3200::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/eurotherm_3200_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
}
} catch_message ]
}
proc ::scobj::eurotherm_3200::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::eurotherm_3200::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::eurotherm_3200::${debug_string}"
}
} catch_message ]
}
# checklimits function for driveable interface
proc ::scobj::eurotherm_3200::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::eurotherm_3200::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::eurotherm_3200::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}
}
# function to request the read of a parameter on a device
proc ::scobj::eurotherm_3200::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 starts
if { [string equal -nocase [hval ${tc_root}/util/mode] "float"] } {
set cmd "[hval ${tc_root}/util/unit]:3:[expr {32768+2*${cmd_str}}]:1:F32"
} else {
set cmd "[hval ${tc_root}/util/unit]:3:${cmd_str}:1:U16"
}
# getValue hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
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::eurotherm_3200::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::eurotherm_3200::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 parse the read of a parameter on a device
proc ::scobj::eurotherm_3200::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 write a parameter value on a device
proc ::scobj::eurotherm_3200::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 starts
if { [string equal -nocase [hval ${tc_root}/util/mode] "float"] } {
set cmd "[hval ${tc_root}/util/unit]:16:[expr {32768+2*${cmd_str}}]:1:F32:${par}"
} else {
set cmd "[hval ${tc_root}/util/unit]:16:${cmd_str}:1:U16:${par}"
}
# setValue 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 "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}
}
proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } {
::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
set ns "[namespace current]"
set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/loop1 plain spy none
hsetprop ${scobj_hpath}/loop1 data "true"
hsetprop ${scobj_hpath}/loop1 klass "@none"
hsetprop ${scobj_hpath}/loop1 type "part"
hfactory ${scobj_hpath}/loop1/sensor plain user float
hsetprop ${scobj_hpath}/loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {1}
hsetprop ${scobj_hpath}/loop1/sensor rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/sensor control true
hsetprop ${scobj_hpath}/loop1/sensor data true
hsetprop ${scobj_hpath}/loop1/sensor mutable true
hsetprop ${scobj_hpath}/loop1/sensor nxsave true
hsetprop ${scobj_hpath}/loop1/sensor permlink data_set "T[format "%02d" ${id}]S01"
hsetprop ${scobj_hpath}/loop1/sensor @description "T[format "%02d" ${id}]S01"
hsetprop ${scobj_hpath}/loop1/sensor oldval 0.0
hsetprop ${scobj_hpath}/loop1/sensor klass "parameter"
hsetprop ${scobj_hpath}/loop1/sensor sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1/sensor type "part"
hsetprop ${scobj_hpath}/loop1/sensor nxalias "${name}_loop1_sensor"
hfactory ${scobj_hpath}/loop1/setpoint plain user float
hsetprop ${scobj_hpath}/loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {2}
hsetprop ${scobj_hpath}/loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/setpoint write ${ns}::setValue ${scobj_hpath} noResponse {2}
hsetprop ${scobj_hpath}/loop1/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/setpoint check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/setpoint driving 0
hsetprop ${scobj_hpath}/loop1/setpoint checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/setpoint halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1/setpoint driveable loop1/sensor
hsetprop ${scobj_hpath}/loop1/setpoint control true
hsetprop ${scobj_hpath}/loop1/setpoint data true
hsetprop ${scobj_hpath}/loop1/setpoint mutable true
hsetprop ${scobj_hpath}/loop1/setpoint nxsave true
hsetprop ${scobj_hpath}/loop1/setpoint lowerlimit 0
hsetprop ${scobj_hpath}/loop1/setpoint upperlimit 40
hsetprop ${scobj_hpath}/loop1/setpoint tolerance ${tol}
hsetprop ${scobj_hpath}/loop1/setpoint permlink data_set "T[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/loop1/setpoint @description "T[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/loop1/setpoint oldval 0.0
hsetprop ${scobj_hpath}/loop1/setpoint klass "parameter"
hsetprop ${scobj_hpath}/loop1/setpoint sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1/setpoint type "drivable"
hsetprop ${scobj_hpath}/loop1/setpoint nxalias "${name}_loop1_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/loop1/setpoint 1
${sct_controller} write ${scobj_hpath}/loop1/setpoint
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
}
hfactory ${scobj_hpath}/loop1_extra plain spy none
hsetprop ${scobj_hpath}/loop1_extra data "false"
hsetprop ${scobj_hpath}/loop1_extra klass "@none"
hsetprop ${scobj_hpath}/loop1_extra type "part"
hfactory ${scobj_hpath}/loop1_extra/active_setpoint plain user float
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {15}
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint control false
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint data false
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint mutable false
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxsave false
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint type "part"
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxalias "${name}_loop1_extra_active_setpoint"
hfactory ${scobj_hpath}/loop1_extra/alarm1_thresh plain user float
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh read ${ns}::getValue ${scobj_hpath} rdValue {13}
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh write ${ns}::setValue ${scobj_hpath} noResponse {13}
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh control false
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh data false
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh mutable false
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxsave false
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh type "part"
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxalias "${name}_loop1_extra_alarm1_thresh"
hfactory ${scobj_hpath}/loop1_extra/alarm2_thresh plain user float
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh read ${ns}::getValue ${scobj_hpath} rdValue {14}
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh write ${ns}::setValue ${scobj_hpath} noResponse {14}
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh control false
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh data false
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh mutable false
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxsave false
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh type "part"
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxalias "${name}_loop1_extra_alarm2_thresh"
hfactory ${scobj_hpath}/loop1_extra/manual_output plain user float
hsetprop ${scobj_hpath}/loop1_extra/manual_output read ${ns}::getValue ${scobj_hpath} rdValue {3}
hsetprop ${scobj_hpath}/loop1_extra/manual_output rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/manual_output control false
hsetprop ${scobj_hpath}/loop1_extra/manual_output data false
hsetprop ${scobj_hpath}/loop1_extra/manual_output mutable false
hsetprop ${scobj_hpath}/loop1_extra/manual_output nxsave false
hsetprop ${scobj_hpath}/loop1_extra/manual_output oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/manual_output sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/manual_output type "part"
hsetprop ${scobj_hpath}/loop1_extra/manual_output nxalias "${name}_loop1_extra_manual_output"
hfactory ${scobj_hpath}/loop1_extra/power_limit_high plain user float
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high read ${ns}::getValue ${scobj_hpath} rdValue {30}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high write ${ns}::setValue ${scobj_hpath} noResponse {30}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high control false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high data false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high mutable false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxsave false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high type "part"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxalias "${name}_loop1_extra_power_limit_high"
hfactory ${scobj_hpath}/loop1_extra/power_limit_low plain user float
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low read ${ns}::getValue ${scobj_hpath} rdValue {31}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low write ${ns}::setValue ${scobj_hpath} noResponse {31}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low control false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low data false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low mutable false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxsave false
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low type "part"
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxalias "${name}_loop1_extra_power_limit_low"
hfactory ${scobj_hpath}/loop1_extra/power_slew_rate plain user float
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {37}
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate write ${ns}::setValue ${scobj_hpath} noResponse {37}
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate control false
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate data false
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate mutable false
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxsave false
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate type "part"
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxalias "${name}_loop1_extra_power_slew_rate"
hfactory ${scobj_hpath}/loop1_extra/setpoint_slew_rate plain user float
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {35}
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate write ${ns}::setValue ${scobj_hpath} noResponse {35}
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate control false
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate data false
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate mutable false
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxsave false
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate type "part"
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxalias "${name}_loop1_extra_setpoint_slew_rate"
hfactory ${scobj_hpath}/loop1_extra/working_output plain user float
hsetprop ${scobj_hpath}/loop1_extra/working_output read ${ns}::getValue ${scobj_hpath} rdValue {4}
hsetprop ${scobj_hpath}/loop1_extra/working_output rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/working_output control false
hsetprop ${scobj_hpath}/loop1_extra/working_output data false
hsetprop ${scobj_hpath}/loop1_extra/working_output mutable false
hsetprop ${scobj_hpath}/loop1_extra/working_output nxsave false
hsetprop ${scobj_hpath}/loop1_extra/working_output oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/working_output sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/working_output type "part"
hsetprop ${scobj_hpath}/loop1_extra/working_output nxalias "${name}_loop1_extra_working_output"
hfactory ${scobj_hpath}/loop1_extra/working_setpoint plain user float
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {5}
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint control false
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint data false
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint mutable false
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxsave false
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint oldval 0.0
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint type "part"
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxalias "${name}_loop1_extra_working_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/loop1_extra/active_setpoint 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm1_thresh 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm2_thresh 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/manual_output 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_high 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_low 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_slew_rate 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/setpoint_slew_rate 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_output 1
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_setpoint 1
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm1_thresh
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm2_thresh
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_high
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_low
${sct_controller} write ${scobj_hpath}/loop1_extra/power_slew_rate
${sct_controller} write ${scobj_hpath}/loop1_extra/setpoint_slew_rate
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
}
hfactory ${scobj_hpath}/util plain spy none
hsetprop ${scobj_hpath}/util data "false"
hsetprop ${scobj_hpath}/util klass "@none"
hsetprop ${scobj_hpath}/util type "part"
hfactory ${scobj_hpath}/util/mode plain user text
hsetprop ${scobj_hpath}/util/mode control false
hsetprop ${scobj_hpath}/util/mode data false
hsetprop ${scobj_hpath}/util/mode mutable false
hsetprop ${scobj_hpath}/util/mode nxsave false
hsetprop ${scobj_hpath}/util/mode values int,float
hsetprop ${scobj_hpath}/util/mode oldval int
hset ${scobj_hpath}/util/mode int
hsetprop ${scobj_hpath}/util/mode sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/util/mode type "part"
hsetprop ${scobj_hpath}/util/mode nxalias "${name}_util_mode"
hfactory ${scobj_hpath}/util/unit plain user int
hsetprop ${scobj_hpath}/util/unit control false
hsetprop ${scobj_hpath}/util/unit data false
hsetprop ${scobj_hpath}/util/unit mutable false
hsetprop ${scobj_hpath}/util/unit nxsave false
hsetprop ${scobj_hpath}/util/unit oldval ${dev_id}
hset ${scobj_hpath}/util/unit ${dev_id}
hsetprop ${scobj_hpath}/util/unit sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/util/unit type "part"
hsetprop ${scobj_hpath}/util/unit nxalias "${name}_util_unit"
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_loop1_setpoint ${scobj_hpath}/loop1/setpoint ${scobj_hpath}/loop1/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} {
set catch_status [ catch {
::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
}
} else {
::scobj::eurotherm_3200::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for eurotherm_3200"
}
::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::eurotherm_3200 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id tol} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::eurotherm_3200::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}"
}
clientput "file evaluation of sct_eurotherm_3200.tcl"
::scobj::eurotherm_3200::sics_log 9 "file evaluation of sct_eurotherm_3200.tcl"
proc ::scobj::eurotherm_3200::read_config {} {
set catch_status [ catch {
set ns "::scobj::eurotherm_3200"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
set enabled [string tolower [dict get $u "enabled"]]
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
}
if { [string equal -nocase [dict get $v "driver"] "eurotherm_3200"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
}
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
set missing_list [list]
foreach arg {id datype dev_id tol} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
lappend missing_list $arg
}
}
if { [llength $missing_list] > 0 } {
error "$name is missing configuration values $missing_list"
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::eurotherm_3200::read_config
} else {
::scobj::eurotherm_3200::sics_log 5 "No config dict"
}

View File

@@ -1906,8 +1906,8 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
other selftest 1 0 0 0 0 1 1 int user {*TST?} {rdValue} {} {setValue} {}
other relayStatusHi 1 0 1 0 1 1 1 int spy {RELAYST? 1} {rdValue} {} {setValue} {}
other relayStatusLo 1 0 1 0 2 1 1 int spy {RELAYST? 2} {rdValue} {} {setValue} {}
other relayCtrlParmHi 1 1 1 0 0 1 1 int spy {RELAY? 1} {rdValue} {RELAY 1,} {setValue} {}
other relayCtrlParmLo 1 1 1 0 0 1 1 int spy {RELAY? 2} {rdValue} {RELAY 2,} {setValue} {}
other relayCtrlParmHi 1 1 1 0 0 1 1 int spy {RELAY? 1} {rdValue} {RELAY 1,2,} {setValue} {}
other relayCtrlParmLo 1 1 1 0 0 1 1 int spy {RELAY? 2} {rdValue} {RELAY 2,2,} {setValue} {}
other statusByte 1 0 1 0 0 1 1 int spy {*STB?} {rdValue} {} {setValue} {}
}
# The following 2 commands take no parameter - this makes them difficult to implement in a hipadaba structure

View File

@@ -27,6 +27,33 @@ proc ::scobj::west_6100::sics_log {debug_level debug_string} {
} catch_message ]
}
# checklimits function for driveable interface
proc ::scobj::west_6100::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::west_6100::checkrange {tc_root} {
set catch_status [ catch {
@@ -53,6 +80,40 @@ proc ::scobj::west_6100::checkrange {tc_root} {
handle_exception ${catch_status} ${catch_message}
}
# checkstatus function for driveable interface
proc ::scobj::west_6100::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}
}
# function to request the read of a parameter on a device
proc ::scobj::west_6100::getDecimal {tc_root nextState cmd_str} {
set catch_status [ catch {
@@ -101,6 +162,18 @@ proc ::scobj::west_6100::getInteger {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message}
}
# halt function for driveable interface
proc ::scobj::west_6100::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::west_6100::noResponse {tc_root} {
set catch_status [ catch {
@@ -262,8 +335,8 @@ proc ::scobj::west_6100::wrInteger {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id } {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
set ns "[namespace current]"
set catch_status [ catch {
@@ -358,6 +431,8 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor data true
hsetprop ${scobj_hpath}/sensor mutable true
hsetprop ${scobj_hpath}/sensor nxsave true
hsetprop ${scobj_hpath}/sensor permlink data_set "T[format "%02d" ${id}]S01"
hsetprop ${scobj_hpath}/sensor @description "T[format "%02d" ${id}]S01"
hsetprop ${scobj_hpath}/sensor oldval 0.0
hsetprop ${scobj_hpath}/sensor klass "parameter"
hsetprop ${scobj_hpath}/sensor sdsinfo "::nexus::scobj::sdsinfo"
@@ -370,14 +445,25 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/setpoint write ${ns}::wrDecimal ${scobj_hpath} noResponse {2}
hsetprop ${scobj_hpath}/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint driving 0
hsetprop ${scobj_hpath}/setpoint checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint driveable sensor
hsetprop ${scobj_hpath}/setpoint control true
hsetprop ${scobj_hpath}/setpoint data true
hsetprop ${scobj_hpath}/setpoint mutable true
hsetprop ${scobj_hpath}/setpoint nxsave true
hsetprop ${scobj_hpath}/setpoint lowerlimit 0
hsetprop ${scobj_hpath}/setpoint upperlimit 1600
hsetprop ${scobj_hpath}/setpoint tolerance 1
hsetprop ${scobj_hpath}/setpoint permlink data_set "T[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/setpoint @description "T[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/setpoint oldval 0.0
hsetprop ${scobj_hpath}/setpoint klass "parameter"
hsetprop ${scobj_hpath}/setpoint sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/setpoint type "part"
hsetprop ${scobj_hpath}/setpoint settle_time "30"
hsetprop ${scobj_hpath}/setpoint type "drivable"
hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint"
hfactory ${scobj_hpath}/w_sp plain user float
@@ -471,14 +557,17 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller}
}
# mkDriver hook code goes here
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} {
proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port id} {
set catch_status [ catch {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
@@ -490,8 +579,8 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres
} else {
::scobj::west_6100::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for west_6100"
}
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
@@ -504,9 +593,9 @@ namespace eval ::scobj::west_6100 {
namespace export add_driver
}
proc add_west_6100 {name ip_address tcp_port dev_id} {
proc add_west_6100 {name ip_address tcp_port id} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}"
::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}"
}
clientput "file evaluation of sct_west_6100.tcl"
@@ -572,7 +661,7 @@ proc ::scobj::west_6100::read_config {} {
}
set arg_list [list]
set missing_list [list]
foreach arg {dev_id} {
foreach arg {id} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {

View File

@@ -20,10 +20,12 @@ MakeRS232Controller sertemp $IP 502
sertemp timeout 300
sertemp sendterminator 0x0
sertemp replyterminator 0x0
EvFactory new tc1 west4100 sertemp $ID 2
#ffr 2014-09-22: The modbus addr should be 1 for single port moxas (Not $ID which is a SICS ID)
# EvFactory new tc1 west4100 sertemp $ID 2
EvFactory new $temp_sobj west4100 sertemp 1 2
sicslist setatt tc1 units kelvin
sicslist setatt tc1 klass @none
sicslist setatt $temp_sobj units kelvin
sicslist setatt $temp_sobj klass @none
}
# @brief Adds a west400 temperature controller object.

View File

@@ -3,8 +3,8 @@ driver west_6100 = {
protocol = modbus_ap
class = environment
simulation_group = environment_simulation
add_args = 'dev_id'
make_args = 'dev_id'
add_args = 'id'
make_args = 'id'
Group = {
priv = user; data = true; control = true; mutable = true;
type = float;
@@ -12,8 +12,12 @@ driver west_6100 = {
fetch_function = getDecimal;
read_function = rdDecimal;
write_function = wrDecimal;
var sensor = { read_command = "1"; }
var setpoint = { read_command = "2"; write_command = "2"; writeable = 1; }
var sensor = { read_command = "1"; permlink = "T.S01"; }
var setpoint = {
read_command = "2"; permlink = "T.SP01";
write_command = "2"; writeable = 1;
driveable = sensor; lowerlimit = 0; upperlimit = 1600;
tolerance = 1; property settle_time = 30; }
var w_sp = { read_command = "21"; write_command = "21"; writeable = 1; }
var ramprate = { read_command = "24"; write_command = "24"; writeable = 1; }
var alarm1 = { read_command = "13"; write_command = "13"; writeable = 1; }

View File

@@ -27,6 +27,33 @@ proc ::scobj::west_6100::sics_log {debug_level debug_string} {
} catch_message ]
}
# checklimits function for driveable interface
proc ::scobj::west_6100::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::west_6100::checkrange {tc_root} {
set catch_status [ catch {
@@ -53,6 +80,45 @@ proc ::scobj::west_6100::checkrange {tc_root} {
handle_exception ${catch_status} ${catch_message}
}
# checkstatus function for driveable interface
proc ::scobj::west_6100::checkstatus {tc_root} {
set catch_status [ catch {
# checkstatus hook code goes here
if {[sct driving]} {
set sp "[sct target]"
if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
set pv "${sp}"
hset ${tc_root}/[sct driveable] ${sp}
}
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}
}
# function to request the read of a parameter on a device
proc ::scobj::west_6100::getDecimal {tc_root nextState cmd_str} {
set catch_status [ catch {
@@ -101,6 +167,18 @@ proc ::scobj::west_6100::getInteger {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message}
}
# halt function for driveable interface
proc ::scobj::west_6100::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::west_6100::noResponse {tc_root} {
set catch_status [ catch {
@@ -262,8 +340,8 @@ proc ::scobj::west_6100::wrInteger {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id } {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
set ns "[namespace current]"
set catch_status [ catch {
@@ -409,6 +487,8 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/sensor data true
hsetprop ${scobj_hpath}/sensor mutable true
hsetprop ${scobj_hpath}/sensor nxsave true
hsetprop ${scobj_hpath}/sensor permlink data_set "T[format "%02d" ${id}]S01"
hsetprop ${scobj_hpath}/sensor @description "T[format "%02d" ${id}]S01"
hsetprop ${scobj_hpath}/sensor oldval 0.0
hsetprop ${scobj_hpath}/sensor klass "parameter"
hsetprop ${scobj_hpath}/sensor sdsinfo "::nexus::scobj::sdsinfo"
@@ -430,14 +510,25 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/setpoint write ${ns}::wrDecimal ${scobj_hpath} noResponse {2}
hsetprop ${scobj_hpath}/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint driving 0
hsetprop ${scobj_hpath}/setpoint checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/setpoint driveable sensor
hsetprop ${scobj_hpath}/setpoint control true
hsetprop ${scobj_hpath}/setpoint data true
hsetprop ${scobj_hpath}/setpoint mutable true
hsetprop ${scobj_hpath}/setpoint nxsave true
hsetprop ${scobj_hpath}/setpoint lowerlimit 0
hsetprop ${scobj_hpath}/setpoint upperlimit 1600
hsetprop ${scobj_hpath}/setpoint tolerance 1
hsetprop ${scobj_hpath}/setpoint permlink data_set "T[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/setpoint @description "T[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/setpoint oldval 0.0
hsetprop ${scobj_hpath}/setpoint klass "parameter"
hsetprop ${scobj_hpath}/setpoint sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/setpoint type "part"
hsetprop ${scobj_hpath}/setpoint settle_time "30"
hsetprop ${scobj_hpath}/setpoint type "drivable"
hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint"
if {[string equal -nocase "${simulation_flag}" "false"]} {
@@ -479,6 +570,7 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
# End of unnamed group
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller}
# Start of named group: aux
hfactory ${scobj_hpath}/aux plain spy none
@@ -558,9 +650,9 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} {
proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port id} {
set catch_status [ catch {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
@@ -574,8 +666,8 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
}
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
@@ -588,9 +680,9 @@ namespace eval ::scobj::west_6100 {
namespace export add_driver
}
proc add_west_6100 {name ip_address tcp_port dev_id} {
proc add_west_6100 {name ip_address tcp_port id} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west_6100::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
::scobj::west_6100::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id}
}
clientput "file evaluation of sct_west_6100.tcl"
@@ -668,7 +760,7 @@ proc ::scobj::west_6100::read_config {} {
}
set arg_list [list]
set missing_list [list]
foreach arg {dev_id} {
foreach arg {id} {
if {[dict exists $u $arg]} {
lappend arg_list "[dict get $u $arg]"
} elseif {[dict exists $v $arg]} {