From f54146b58ece76b693f5ad9f0000d7ca9f015cba Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 31 Oct 2007 15:54:49 +1100 Subject: [PATCH] Added ::plc::inst_ready command which is used to check if the instrument is ready before starting a scan. Also add plc simulation mode r2202 | ffr | 2007-10-31 15:54:49 +1100 (Wed, 31 Oct 2007) | 3 lines --- .../instrument/config/plc/plc_common_1.tcl | 40 ++++++++++++++++--- site_ansto/instrument/server_config.tcl | 10 +++-- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/site_ansto/instrument/config/plc/plc_common_1.tcl b/site_ansto/instrument/config/plc/plc_common_1.tcl index 1a5ca85d..a56f415b 100644 --- a/site_ansto/instrument/config/plc/plc_common_1.tcl +++ b/site_ansto/instrument/config/plc/plc_common_1.tcl @@ -1,10 +1,38 @@ +set sim_mode [SplitReply [plc_simulation]] + namespace eval plc { - proc set_sobj_attributes {} { - set objlist [sicslist match plc_*]; - foreach v $objlist { - if { [SplitReply [sicslist $v type]]== "SicsVariable"} { - ::utility::mkData $v [string replace $v 0 3] plc privilege user control true data false - } +} + +proc ::plc::set_sobj_attributes {} { + set objlist [sicslist match plc_*]; + foreach v $objlist { + if { [SplitReply [sicslist $v type]]== "SicsVariable"} { + ::utility::mkData $v [string replace $v 0 3] plc privilege user control true data false + } + } +} + +if {$sim_mode == "true"} { + proc ::plc::inst_ready {} { + variable readyflag + return $readyflag + } + proc ::plc::set_readyflag {flag} { + variable readyflag + set readyflag $flag + } + ::plc::set_readyflag 1 + publish ::plc::set_readyflag user +} else { +## +# @brief Check if instrument is ready +# +# @return 1: if ready, 0: if not ready + proc ::plc::inst_ready {} { + if {[SplitReply [plc plc_ready]] == "True"} { + return 1 + } else { + return 0 } } } diff --git a/site_ansto/instrument/server_config.tcl b/site_ansto/instrument/server_config.tcl index 8b9047ff..40177cbe 100644 --- a/site_ansto/instrument/server_config.tcl +++ b/site_ansto/instrument/server_config.tcl @@ -1,7 +1,7 @@ # SICS common configuration -# $Revision: 1.30 $ -# $Date: 2007-10-23 02:42:52 $ +# $Revision: 1.31 $ +# $Date: 2007-10-31 04:54:49 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by $Author: ffr $ @@ -57,7 +57,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]] sics_release lock ::utility::mkVar sics_revision_num Text internal -set tmpstr [string map {"$" ""} {$Revision: 1.30 $}] +set tmpstr [string map {"$" ""} {$Revision: 1.31 $}] sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]] sics_revision_num lock @@ -92,6 +92,9 @@ motor_simulation false ::utility::mkVar chopper_simulation Text internal chopper_simulation false +::utility::mkVar plc_simulation Text internal +plc_simulation false + ::utility::mkVar sics_fullsimulation Text internal sics_fullsimulation false @@ -100,6 +103,7 @@ if {[SplitReply [sics_fullsimulation]] == "true"} { counter_simulation true motor_simulation true chopper_simulation true + plc_simulation true } proc server_set_sobj_attributes {} {