Make all sct drivers.
This commit is contained in:
@@ -180,7 +180,7 @@ proc ::scobj::nhq_200::rdCurrent {tc_root} {
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -206,7 +206,7 @@ proc ::scobj::nhq_200::rdValue {tc_root} {
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -239,7 +239,7 @@ proc ::scobj::nhq_200::rdVoltage {tc_root} {
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -484,7 +484,6 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name } {
|
||||
${sct_controller} write ${scobj_hpath}/ch1/i_trip
|
||||
${sct_controller} write ${scobj_hpath}/ch1/v_ramp
|
||||
${sct_controller} write ${scobj_hpath}/ch1/v_sp
|
||||
ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller}
|
||||
} else {
|
||||
::scobj::nhq_200::sics_log 9 "[environment_simulation] => No poll/write for nhq_200"
|
||||
}
|
||||
@@ -661,12 +660,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name } {
|
||||
${sct_controller} write ${scobj_hpath}/ch2/i_trip
|
||||
${sct_controller} write ${scobj_hpath}/ch2/v_ramp
|
||||
${sct_controller} write ${scobj_hpath}/ch2/v_sp
|
||||
ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
|
||||
} else {
|
||||
::scobj::nhq_200::sics_log 9 "[environment_simulation] => No poll/write for nhq_200"
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass environment
|
||||
hsetprop ${scobj_hpath} debug_threshold 1
|
||||
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
|
||||
ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller}
|
||||
ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
|
||||
}
|
||||
# mkDriver hook code goes here
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -705,14 +707,17 @@ clientput "file evaluation of sct_nhq_200.tcl"
|
||||
proc ::scobj::nhq_200::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::nhq_200"
|
||||
dict for {k v} $::config_dict {
|
||||
if { [dict exists $v "implementation"] } {
|
||||
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
|
||||
continue
|
||||
}
|
||||
set name [dict get $v name]
|
||||
set enabled [string tolower [dict get $v "enabled"]]
|
||||
set implementation [dict get $v "implementation"]
|
||||
set enabled [string tolower [dict get $u "enabled"]]
|
||||
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
|
||||
continue
|
||||
}
|
||||
set name [dict get $u name]
|
||||
set implementation [dict get $u "implementation"]
|
||||
if { !([dict exists $::config_dict $implementation]) } {
|
||||
continue
|
||||
}
|
||||
@@ -721,31 +726,37 @@ proc ::scobj::nhq_200::read_config {} {
|
||||
continue
|
||||
}
|
||||
if { [string equal -nocase [dict get $v "driver"] "nhq_200"] } {
|
||||
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
} 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
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
} 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"]"
|
||||
}
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
add_nhq_200 ${name} ${IP} ${PORT}
|
||||
} else {
|
||||
add_nhq_200 ${name} "aqadapter" ${asyncqueue}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user