diff --git a/site_ansto/instrument/config/environment/hiden_xcs.sct b/site_ansto/instrument/config/environment/hiden_xcs.sct index 4d43597a..8c0e8088 100644 --- a/site_ansto/instrument/config/environment/hiden_xcs.sct +++ b/site_ansto/instrument/config/environment/hiden_xcs.sct @@ -74,6 +74,7 @@ driver hiden_xcs = { property pid_ivalue = 0.1 property pid_dvalue = 0.0 property pid_imax = 30 + property settle_time = 5.250 } var gas_factor = { value = 1.0; } control = false diff --git a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl index 3fffc2fc..043b1a82 100644 --- a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl +++ b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl @@ -77,10 +77,25 @@ proc ::scobj::hiden_xcs::checkstatus {tc_root} { if {[sct driving]} { set sp "[sct target]" set pv "[hval ${tc_root}/[sct driveable]]" - if { ${pv} > ${sp} - [sct tolerance] && ${pv} < ${sp} + [sct tolerance] } { + 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" @@ -819,6 +834,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } { hsetprop ${scobj_hpath}/humidity pid_ivalue "0.1" hsetprop ${scobj_hpath}/humidity pid_pvalue "0.2" hsetprop ${scobj_hpath}/humidity sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/humidity settle_time "5.25" hsetprop ${scobj_hpath}/humidity type "drivable" hsetprop ${scobj_hpath}/humidity nxalias "${name}_humidity" diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index b3a80fa9..0c841d48 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -967,10 +967,25 @@ def put_checkstatus_function(MyDriver, func): txt += [' if {[sct driving]} {'] txt += [' set sp "[sct target]"'] txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] - txt += [' if { ${pv} > ${sp} - [sct tolerance] && ${pv} < ${sp} + [sct tolerance] } {'] + txt += [' if { abs(${pv} - ${sp}) <= [sct tolerance] } {'] + txt += [' if { [hpropexists [sct] settle_time] } {'] + txt += [' if { [hpropexists [sct] settle_time_start] } {'] + txt += [' if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} {'] + txt += [' sct driving 0'] + txt += [' return "idle"'] + txt += [' }'] + txt += [' return "busy"'] + txt += [' } else {'] + txt += [' sct utime settle_time_start'] + txt += [' return "busy"'] + txt += [' }'] + txt += [' }'] txt += [' sct driving 0'] txt += [' return "idle"'] txt += [' }'] + txt += [' if { [hpropexists [sct] settle_time_start] } {'] + txt += [' hdelprop [sct] settle_time_start'] + txt += [' }'] txt += [' return "busy"'] txt += [' } else {'] txt += [' return "idle"']