diff --git a/sicshdbadapter.c b/sicshdbadapter.c index 6031fde0..45bb1f0b 100644 --- a/sicshdbadapter.c +++ b/sicshdbadapter.c @@ -377,6 +377,7 @@ static pHdb MakeSicsVarNode(pSicsVariable pVar, char *name){ pHdbCallback pCall = NULL; commandContext comCom; int type; + hdbValue v; switch(pVar->eType){ case veInt: @@ -407,6 +408,18 @@ static pHdb MakeSicsVarNode(pSicsVariable pVar, char *name){ AppendHipadabaCallback(node,HCBSET,pCall); RegisterCallback(pVar->pCall,comCom, VALUECHANGE, ValueCallback, node,NULL); + switch(pVar->eType){ + case veInt: + v = MakeHdbInt(pVar->iVal); + break; + case veFloat: + v = MakeHdbFloat((double)pVar->fVal); + break; + case veText: + v = MakeHdbText(pVar->text); + break; + } + UpdateHipadabaPar(node,v,NULL); node->protected = 1; return node; diff --git a/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl b/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl index 1c404db2..24ae0d23 100644 --- a/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl +++ b/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl @@ -19,8 +19,13 @@ proc xhmake {path priv dtype pKey pVal} { } hmake /commands spy none -hsetprop /commands type commandset set pathlist(/commands) 1 +hsetprop /commands type commandset +hmake /graphics spy none +set pathlist(/graphics) 1 +hsetprop /graphics type graphset +hsetprop /commands type commandset + #TODO change this to hparts.tcl source $cfPath(hipadaba)/hpaths.tcl @@ -28,6 +33,9 @@ set instrument [string tolower [SplitReply [Instrument]] ] hmake /$instrument spy none hsetprop /$instrument type instrument set pathlist(/$instrument) 1 +hmake /$instrument/status spy none +set pathlist(/$instrument/status) 1 +hsetprop /$instrument/status type part # Generate hipadaba nodes for the paths in the hpaths file foreach hp $hpaths { @@ -75,17 +83,20 @@ foreach motor [sicslist type motor] { foreach {obj name part master_obj} $cvirtmotor_hpath { set path /$instrument/$part hattach $path $obj $name - sicspoll add $path/$name hdb 2 + foreach m $master_obj { + hchain $path/$name $path/$m + } + #FIXME polling causes scans to abort + #sicspoll add $path/$name hdb 2 } + #------------- scan command -hsetprop /commands type part - -#--- Graphics -hmake /graphics spy none -hsetprop /graphics type graphset ::scancommand::commands_hpath_setup /commands ::scancommand::graphics_hpath_setup /graphics ::scancommand::init +#------------- plc controller +::plc::status_hpath_setup /$instrument/status + unset pathlist; diff --git a/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl b/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl index 321cc82a..5289b335 100644 --- a/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl +++ b/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl @@ -9,7 +9,7 @@ set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}] set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]] -set tmpstr [string map {"$" ""} {$Revision: 1.22 $}] +set tmpstr [string map {"$" ""} {$Revision: 1.23 $}] set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]] MakeNXScript @@ -101,7 +101,7 @@ proc hmm_save {nxobj entryname point} { $nxobj updatedictvar padim0 $dim0 $nxobj updatedictvar padim1 $dim1 $nxobj putslab $dictalias(hmm) [list $point 0 0] [list 1 $dim0 $dim1 ] hmm [SplitReply [hmm_start]] $histo_length [SplitReply [hmm_bank]] - put2Dpolar_angle $nxobj $point $dim0 $dim1; +# put2Dpolar_angle $nxobj $point $dim0 $dim1; #TODO replace scandata with generic name $nxobj makelink scandata hmcounts $nxobj makelink scanhoraxis dhaxis diff --git a/site_ansto/instrument/config/plc/plc_common_1.tcl b/site_ansto/instrument/config/plc/plc_common_1.tcl new file mode 100644 index 00000000..38dc520c --- /dev/null +++ b/site_ansto/instrument/config/plc/plc_common_1.tcl @@ -0,0 +1,13 @@ +namespace eval plc { + proc status_hpath_setup {parent} { + set plcPath $parent/plc + hmake $plcPath spy none; + hsetprop $plcPath type part; + set objlist [sicslist match plc_*]; + foreach v $objlist { + if { [SplitReply [sicslist $v type]]== "SicsVariable"} { + hattach $plcPath $v [string replace $v 0 3]; + } + } + } +} diff --git a/site_ansto/instrument/config/scan/scan_common_1.tcl b/site_ansto/instrument/config/scan/scan_common_1.tcl index b2f41e1c..c2bbe9b2 100644 --- a/site_ansto/instrument/config/scan/scan_common_1.tcl +++ b/site_ansto/instrument/config/scan/scan_common_1.tcl @@ -243,7 +243,7 @@ variable scanVariable scan_var scanVarStart 0 scanVarStep 1 hsetprop $parent/beam_monitor_scan type graphdata; hsetprop $parent/beam_monitor_scan viewer default; hsetprop $parent/beam_monitor_scan rank 1; - hattach $parent/beam_monitor_scan bmonscan_np_graphics_target dim; + hattach $parent/beam_monitor_scan bmonscan_np_target dim; hattach $parent/beam_monitor_scan bmonscan_point_graphics_current point; hattach $parent/beam_monitor_scan bmonscan_var_graphics_value lastaxis hattach $parent/beam_monitor_scan bmonscan_counts lastdata diff --git a/site_ansto/instrument/hipd/config/INSTCFCOMMON.TXT b/site_ansto/instrument/hipd/config/INSTCFCOMMON.TXT index 49bd1e72..0db6ee7a 100644 --- a/site_ansto/instrument/hipd/config/INSTCFCOMMON.TXT +++ b/site_ansto/instrument/hipd/config/INSTCFCOMMON.TXT @@ -1,3 +1,4 @@ +config/plc/plc_common_1.tcl config/counter/counter_common_1.tcl config/hipadaba/common_hipadaba_configuration.tcl config/hmm/hmm_configuration_common_1.tcl diff --git a/site_ansto/instrument/hipd/config/hipadaba/hpaths.tcl b/site_ansto/instrument/hipd/config/hipadaba/hpaths.tcl index 5db02aac..24a55468 100644 --- a/site_ansto/instrument/hipd/config/hipadaba/hpaths.tcl +++ b/site_ansto/instrument/hipd/config/hipadaba/hpaths.tcl @@ -12,14 +12,14 @@ aperture slits ] # Configurable virtual motors # obj name path master_obj set cvirtmotor_hpath [list \ -ss1vg ss1vg slits/first top\ -ss1vo ss1vo slits/first top\ -ss1hg ss1hg slits/first right\ -ss1ho ss1ho slits/first right\ -ss2vg ss2vg slits/second top\ -ss2vo ss2vo slits/second top\ -ss2hg ss2hg slits/second right\ -ss2ho ss2ho slits/second right\ +ss1vg ss1vg slits/first [list top bottom left right]\ +ss1vo ss1vo slits/first [list top bottom left right]\ +ss1hg ss1hg slits/first [list top bottom left right]\ +ss1ho ss1ho slits/first [list top bottom left right]\ +ss2vg ss2vg slits/second [list top bottom left right]\ +ss2vo ss2vo slits/second [list top bottom left right]\ +ss2hg ss2hg slits/second [list top bottom left right]\ +ss2ho ss2ho slits/second [list top bottom left right]\ sth sth sample [SplitReply [stth long_name]]\ mth mth monochromator [SplitReply [mtth long_name]]] diff --git a/site_ansto/instrument/hipd/config/hmm/anstohm_full_small.xml b/site_ansto/instrument/hipd/config/hmm/anstohm_full_small.xml new file mode 100644 index 00000000..dfcec1d4 --- /dev/null +++ b/site_ansto/instrument/hipd/config/hmm/anstohm_full_small.xml @@ -0,0 +1,353 @@ + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + -0.5 0.5 + + + -0.5 0.5 + + + 0 200000 + + + + + + + + + -0.5 0.5 + + + -0.5 0.5 + + + 0 200000 + + + + + + + + + 127.5 126.5 + + + -0.5 0.5 + + + 0 200000 + + + + + + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.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. 0. 0. 0. 0. 0. 0. 0. 0. + 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. + 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. + + + + + + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + + + + + + + + + 991.5 987.5 + + + -0.5 3.5 + + + 0 200000 + + + + + diff --git a/site_ansto/instrument/hipd/config/hmm/anstohm_full_standard.xml b/site_ansto/instrument/hipd/config/hmm/anstohm_full_standard.xml new file mode 100644 index 00000000..309d9967 --- /dev/null +++ b/site_ansto/instrument/hipd/config/hmm/anstohm_full_standard.xml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 991.5 990.5 + + + 511.5 510.5 + + + 0 200000 + + + + + + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 + + + + + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + + + + + + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. + + + + + + 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. + 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.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hipd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl index b7c97943..12be0edf 100644 --- a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl @@ -14,6 +14,18 @@ if {$sim_mode == "true"} { } source $cfPath(hmm)/hmm_configuration_common_1.tcl +# Configure to upload a complete configuration to the histogram server. +# In this case it's the main config file plus the FAT, BAT and OAT files +# in the same direcory as the SICS executable (for this example). +# Alternatives: +# - A partial config could be uploaded instead - e.g. just the main config file, +# in that case the main config file points to a set of FAT, BAT OAT files +# located on the server. +# - The histogram server could configure itself from a config file set +# kept on the local file system (not automated presently, manual control only) +# - Or, no configuration at all could be uploaded, the +# histogram server can configure itself using its default config files. +hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full.xml" if {$sim_mode == "true"} { proc ::histogram_memory::hmm_initialize {} { @@ -62,7 +74,8 @@ proc setmode {mode} { hmm configure stitch_nxc [expr 480*8 - 1]; hmm configure oat_ntc_eff 1; } - hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_normal.xml" + #hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_normal.xml" + hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_small.xml" } } } diff --git a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl index 2c0e9e56..2bd22396 100644 --- a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl @@ -1,7 +1,7 @@ -# $Revision: 1.11 $ -# $Date: 2007-04-10 00:31:41 $ +# $Revision: 1.12 $ +# $Date: 2007-04-20 01:53:31 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) -# Last revision by: $Author: dcl $ +# Last revision by: $Author: ffr $ # START MOTOR CONFIGURATION @@ -90,7 +90,7 @@ set ss2d_HiRange [expr $vSlitHome + $vSlitLoRange] # set movecount high to reduce the frequency of # hnotify messages to a reasonable level -set move_count 100 +set move_count 10 ############################ # Motor Controller 1 diff --git a/site_ansto/instrument/hipd/config/plc/plc.tcl b/site_ansto/instrument/hipd/config/plc/plc.tcl new file mode 100644 index 00000000..6d9bdff6 --- /dev/null +++ b/site_ansto/instrument/hipd/config/plc/plc.tcl @@ -0,0 +1,5 @@ +MakeMultiChan plc_chan 137.157.204.65 30001 +MakeSafetyPLC plc plc_chan 0 + +source $cfPath(plc)/plc_common_1.tcl + diff --git a/site_ansto/instrument/hipd/wombat_configuration.tcl b/site_ansto/instrument/hipd/wombat_configuration.tcl index b4b04ca7..aebac4bb 100644 --- a/site_ansto/instrument/hipd/wombat_configuration.tcl +++ b/site_ansto/instrument/hipd/wombat_configuration.tcl @@ -1,7 +1,7 @@ -# $Revision: 1.14 $ -# $Date: 2007-04-17 23:32:58 $ +# $Revision: 1.15 $ +# $Date: 2007-04-20 01:53:31 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) -# Last revision by: $Author: dcl $ +# Last revision by: $Author: ffr $ # Required by server_config.tcl VarMake Instrument Text Internal @@ -25,6 +25,7 @@ fileeval $cfPath(motors)/motor_configuration.tcl ######## +fileeval $cfPath(plc)/plc.tcl fileeval $cfPath(counter)/counter.tcl fileeval $cfPath(hmm)/hmm_configuration.tcl fileeval $cfPath(nexus)/nxscripts.tcl @@ -70,7 +71,4 @@ detector_type lock detector_description 8 curved multiwire segments detector_description lock -fileeval extraconfig.tcl - -MakeMultiChan plc_chan 137.157.204.65 30001 -MakeSafetyPLC plc plc_chan 0 +fileeval extraconfig.tcl diff --git a/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT b/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT index 49bd1e72..0db6ee7a 100644 --- a/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT +++ b/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT @@ -1,3 +1,4 @@ +config/plc/plc_common_1.tcl config/counter/counter_common_1.tcl config/hipadaba/common_hipadaba_configuration.tcl config/hmm/hmm_configuration_common_1.tcl diff --git a/site_ansto/instrument/hrpd/config/hipadaba/hpaths.tcl b/site_ansto/instrument/hrpd/config/hipadaba/hpaths.tcl index c8af7500..8ef2ffaa 100644 --- a/site_ansto/instrument/hrpd/config/hipadaba/hpaths.tcl +++ b/site_ansto/instrument/hrpd/config/hipadaba/hpaths.tcl @@ -13,14 +13,14 @@ aperture slits ] # Configurable virtual motors # obj name path master_obj set cvirtmotor_hpath [list \ -ss1vg ss1vg slits/first top\ -ss1vo ss1vo slits/first top\ -ss1hg ss1hg slits/first right\ -ss1ho ss1ho slits/first right\ -ss2vg ss2vg slits/second top\ -ss2vo ss2vo slits/second top\ -ss2hg ss2hg slits/second right\ -ss2ho ss2ho slits/second right\ +ss1vg ss1vg slits/first [list top bottom left right]\ +ss1vo ss1vo slits/first [list top bottom left right]\ +ss1hg ss1hg slits/first [list top bottom left right]\ +ss1ho ss1ho slits/first [list top bottom left right]\ +ss2vg ss2vg slits/second [list top bottom left right]\ +ss2vo ss2vo slits/second [list top bottom left right]\ +ss2hg ss2hg slits/second [list top bottom left right]\ +ss2ho ss2ho slits/second [list top bottom left right]\ sth sth sample [SplitReply [stth long_name]]\ mth mth monochromator [SplitReply [mtth long_name]]] diff --git a/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl index 1bdc1796..e5605c9d 100644 --- a/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl @@ -14,6 +14,32 @@ if {$sim_mode == "true"} { } source $cfPath(hmm)/hmm_configuration_common_1.tcl +# Configure to upload a complete configuration to the histogram server. +# In this case it's the main config file plus the FAT, BAT and OAT files +# in the same direcory as the SICS executable (for this example). +# Alternatives: +# - A partial config could be uploaded instead - e.g. just the main config file, +# in that case the main config file points to a set of FAT, BAT OAT files +# located on the server. +# - The histogram server could configure itself from a config file set +# kept on the local file system (not automated presently, manual control only) +# - Or, no configuration at all could be uploaded, the +# histogram server can configure itself using its default config files. +proc setmode {mode} { + global cfPath; +switch $mode { + pulser { + hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_MESYTEC_PULSER.xml" + } + calibration { + hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_nofolding.xml" + } + normal - + default { + hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_folding.xml" + } +} +} if {$sim_mode == "true"} { proc ::histogram_memory::hmm_initialize {} { diff --git a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl index 03332c25..3495754a 100644 --- a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.14 $ -# $Date: 2007-04-06 09:32:57 $ +# $Revision: 1.15 $ +# $Date: 2007-04-20 01:53:31 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -91,7 +91,7 @@ set ss2d_HiRange [expr $vSlitHome + $vSlitLoRange] # set movecount high to reduce the frequency of # hnotify messages to a reasonable level -set move_count 100 +set move_count 10 ############################ # Motor Controller 1 diff --git a/site_ansto/instrument/hrpd/config/plc/plc.tcl b/site_ansto/instrument/hrpd/config/plc/plc.tcl new file mode 100644 index 00000000..a3d03111 --- /dev/null +++ b/site_ansto/instrument/hrpd/config/plc/plc.tcl @@ -0,0 +1,5 @@ +MakeMultiChan plc_chan 137.157.204.65 30002 +MakeSafetyPLC plc plc_chan 0 + +source $cfPath(plc)/plc_common_1.tcl + diff --git a/site_ansto/instrument/hrpd/echidna_configuration.tcl b/site_ansto/instrument/hrpd/echidna_configuration.tcl index ba25d226..0ceb8875 100644 --- a/site_ansto/instrument/hrpd/echidna_configuration.tcl +++ b/site_ansto/instrument/hrpd/echidna_configuration.tcl @@ -1,7 +1,7 @@ -# $Revision: 1.21 $ -# $Date: 2007-04-17 23:32:34 $ +# $Revision: 1.22 $ +# $Date: 2007-04-20 01:53:31 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) -# Last revision by: $Author: dcl $ +# Last revision by: $Author: ffr $ # Required by server_config.tcl VarMake Instrument Text Internal @@ -25,6 +25,7 @@ fileeval $cfPath(motors)/motor_configuration.tcl ######## +fileeval $cfPath(plc)/plc.tcl fileeval $cfPath(counter)/counter.tcl fileeval $cfPath(hmm)/hmm_configuration.tcl fileeval $cfPath(nexus)/nxscripts.tcl @@ -72,5 +73,3 @@ detector_description lock fileeval extraconfig.tcl -MakeMultiChan plc_chan 137.157.204.65 30002 -MakeSafetyPLC plc plc_chan 0 diff --git a/site_ansto/instrument/server_config.tcl b/site_ansto/instrument/server_config.tcl index 3f8ad06a..0e5417bc 100644 --- a/site_ansto/instrument/server_config.tcl +++ b/site_ansto/instrument/server_config.tcl @@ -1,7 +1,7 @@ # SICS common configuration -# $Revision: 1.23 $ -# $Date: 2007-04-13 03:13:22 $ +# $Revision: 1.24 $ +# $Date: 2007-04-20 01:53:31 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by $Author: ffr $ @@ -15,7 +15,8 @@ hmm $cfParent/hmm\ scan $cfParent/scan\ counter $cfParent/counter\ nexus $cfParent/nexus\ -hipadaba $cfParent/hipadaba] +hipadaba $cfParent/hipadaba\ +plc $cfParent/plc] ServerOption LogFileBaseName $sicsroot/log/serverlog @@ -51,7 +52,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]] sics_release lock VarMake sics_revision_num Text Internal -set tmpstr [string map {"$" ""} {$Revision: 1.23 $}] +set tmpstr [string map {"$" ""} {$Revision: 1.24 $}] sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]] sics_revision_num lock diff --git a/site_ansto/instrument/util/utility.tcl b/site_ansto/instrument/util/utility.tcl index 3e1fa5b3..7c520414 100644 --- a/site_ansto/instrument/util/utility.tcl +++ b/site_ansto/instrument/util/utility.tcl @@ -1,7 +1,7 @@ # Some useful functions for SICS configuration. -# $Revision: 1.2 $ -# $Date: 2007-03-13 21:27:28 $ +# $Revision: 1.3 $ +# $Date: 2007-04-20 01:53:31 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by $Author: ffr $ @@ -54,7 +54,9 @@ proc getinfo {object} { set wc [format "%s_*" $object]; set objlist [sicslist match $wc]; foreach v $objlist { - clientput [$v]; + if { [SplitReply [sicslist $v type]]== "SicsVariable"} { + clientput [$v]; + } } } publish getinfo spy diff --git a/site_ansto/safetyplc.c b/site_ansto/safetyplc.c index ec0e860b..b2d417e0 100644 --- a/site_ansto/safetyplc.c +++ b/site_ansto/safetyplc.c @@ -12,6 +12,7 @@ #include "multichan.h" #include "nwatch.h" #include "safetyplc.h" +#include "sicsvar.h" extern int DMC2280MotionControl; @@ -40,6 +41,25 @@ extern int DMC2280MotionControl; #define MOTOR_BOTH_BITS (MOTOR_ENABLED_BIT | MOTOR_DISABLED_BIT) #define ACCESS_BOTH_BITS (ACCESS_LOCKED_BIT | ACCESS_UNLOCKED_BIT) +int PLC_UserPriv = 0; /* Internal */ +typedef enum { +Unknown_low, Invalid_high, Enabled, Disabled, +Opened, Closed, Locked, Unlocked, True, False,}PLC_STATUS; + +char *plc_states[] = { +"Unknown_low", "Invalid_high", "Enabled", +"Disabled", "Opened", "Closed", +"Locked", "Unlocked", "True", "False"}; + +typedef enum { +Key,Secondary,Tertiary,MotionControl,Access, +DC,Exit,Trip,Fault,Operate,Relay,Ready,}PLC_PARAM; + +char *plc_parname[] = { +"plc_key","plc_secondary","plc_tertiary","plc_motioncontrol", +"plc_access","plc_dc","plc_exit","plc_trip", +"plc_fault","plc_operate","plc_relay","plc_ready"}; + typedef struct __SafetyPLCController SafetyPLCController, *pSafetyPLCController; struct __SafetyPLCController { @@ -47,6 +67,7 @@ struct __SafetyPLCController { pMultiChan mcc; /* associated MultiChan object */ int iGetOut; int iValue; + int oldValue; pNWTimer nw_tmr; /* NetWait timer handle */ int timeout; struct timeval tvSend; @@ -69,6 +90,8 @@ struct __command { void* cntx; }; +static int PLC_GetState(void *pData, char *param, PLC_STATUS *retState); + static int PLC_Tx(void* ctx) { int iRet = 1; @@ -202,8 +225,11 @@ static void PLC_Notify(void* context, int event) */ static int GetCallback(void* ctx, const char* resp, int resp_len) { - int iRet; + int iRet,i; unsigned int iRead; + PLC_STATUS plcState; + pSicsVariable plcVar=NULL; + pSafetyPLCController self = (pSafetyPLCController) ctx; if (resp_len < 0) { DMC2280MotionControl = -1; @@ -226,7 +252,15 @@ static int GetCallback(void* ctx, const char* resp, int resp_len) else /* disabled */ DMC2280MotionControl = 0; } + if (self->oldValue != self->iValue) { + for (i=0; i < sizeof(plc_parname)/sizeof(plc_parname[0]); i++) { + plcVar = (pSicsVariable)FindCommandData(pServ->pSics,plc_parname[i],"SicsVariable"); + PLC_GetState(self,plc_parname[i],&plcState); + VarSetText(plcVar,plc_states[plcState],PLC_UserPriv); + } + } + self->oldValue = self->iValue; self->iGetOut = 0; return 0; } @@ -249,128 +283,117 @@ static int MyTimerCallback(void* context, int mode) return 1; } +static int PLC_GetState(void *pData, char *param, PLC_STATUS *retState) +{ + pSafetyPLCController self = (pSafetyPLCController) pData; + if (strcasecmp(param, plc_parname[Key]) == 0) { + *retState = Unknown_low; + if ((self->iValue & KEY_BOTH_BITS) == KEY_BOTH_BITS) + *retState = Invalid_high; + else if (self->iValue & KEY_ENABLED_BIT) + *retState = Enabled; + else if (self->iValue & KEY_DISABLED_BIT) + *retState = Disabled; + return OKOK; + } + if (strcasecmp(param, plc_parname[Secondary]) == 0) { + *retState = Unknown_low; + if ((self->iValue & SEC_BOTH_BITS) == SEC_BOTH_BITS) + *retState = Invalid_high; + if (self->iValue & SEC_OPENED_BIT) + *retState = Opened; + else if (self->iValue & SEC_CLOSED_BIT) + *retState = Closed; + return OKOK; + } + if (strcasecmp(param, plc_parname[Tertiary]) == 0) { + *retState = Unknown_low; + if ((self->iValue & TER_BOTH_BITS) == TER_BOTH_BITS) + *retState = Invalid_high; + if (self->iValue & TER_OPENED_BIT) + *retState = Opened; + else if (self->iValue & TER_CLOSED_BIT) + *retState = Closed; + return OKOK; + } + if (strcasecmp(param, plc_parname[MotionControl]) == 0) { + *retState = Unknown_low; + if ((self->iValue & MOTOR_BOTH_BITS) == MOTOR_BOTH_BITS) + *retState = Invalid_high; + else if (self->iValue & MOTOR_ENABLED_BIT) + *retState = Enabled; + else if (self->iValue & MOTOR_DISABLED_BIT) + *retState = Disabled; + return OKOK; + } + if (strcasecmp(param, plc_parname[Access]) == 0) { + *retState = Unknown_low; + if ((self->iValue & ACCESS_BOTH_BITS) == ACCESS_BOTH_BITS) + *retState = Invalid_high; + else if (self->iValue & ACCESS_LOCKED_BIT) + *retState = Locked; + else if (self->iValue & ACCESS_UNLOCKED_BIT) + *retState = Unlocked; + return OKOK; + } + if (strcasecmp(param, plc_parname[DC]) == 0) { + *retState = False; + if (self->iValue & DC_POWEROK_BIT) + *retState = True; + return OKOK; + } + if (strcasecmp(param, plc_parname[Exit]) == 0) { + *retState = False; + if (self->iValue & EXIT_INPROGRESS_BIT) + *retState = True; + return OKOK; + } + if (strcasecmp(param, plc_parname[Trip]) == 0) { + *retState = False; + if (self->iValue & SAFETY_TRIPPED_BIT) + *retState = True; + return OKOK; + } + if (strcasecmp(param, plc_parname[Fault]) == 0) { + *retState = False; + if (self->iValue & SAFETY_MALFUNCTION_BIT) + *retState = True; + return OKOK; + } + if (strcasecmp(param, plc_parname[Operate]) == 0) { + *retState = False; + if (self->iValue & TER_OPERATE_BIT) + *retState = True; + return OKOK; + } + if (strcasecmp(param, plc_parname[Relay]) == 0) { + *retState = False; + if (self->iValue & RELAY_ENABLED_BIT) + *retState = True; + return OKOK; + } + if (strcasecmp(param, plc_parname[Ready]) == 0) { + *retState = False; + if (self->iValue & INST_READY_BIT) + *retState = True; + return OKOK; + } + return 0; +} + static int PLC_Print(SConnection *pCon, SicsInterp *pSics, void *pData, char *name, char *param) { char line[132]; - pSafetyPLCController self = (pSafetyPLCController) pData; - if (strcasecmp(param, "key") == 0) { - char* state = "unknown(low)"; - if ((self->iValue & KEY_BOTH_BITS) == KEY_BOTH_BITS) - state = "invalid(high)"; - else if (self->iValue & KEY_ENABLED_BIT) - state = "enabled"; - else if (self->iValue & KEY_DISABLED_BIT) - state = "disabled"; - snprintf(line, 132, "%s.Key = %s", name, state); + PLC_STATUS state; + + if (PLC_GetState(pData, param, &state) != OKOK) { + return 0; + } else { + snprintf(line, 132, "%s.%s = %s", name, param, plc_states[state]); SCWrite(pCon, line, eStatus); return OKOK; } - if (strcasecmp(param, "secondary") == 0) { - char* state = "unknown(low)"; - if ((self->iValue & SEC_BOTH_BITS) == SEC_BOTH_BITS) - state = "invalid(high)"; - if (self->iValue & SEC_OPENED_BIT) - state = "opened"; - else if (self->iValue & SEC_CLOSED_BIT) - state = "closed"; - snprintf(line, 132, "%s.Secondary = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "tertiary") == 0) { - char* state = "unknown(low)"; - if ((self->iValue & TER_BOTH_BITS) == TER_BOTH_BITS) - state = "invalid(high)"; - if (self->iValue & TER_OPENED_BIT) - state = "opened"; - else if (self->iValue & TER_CLOSED_BIT) - state = "closed"; - snprintf(line, 132, "%s.Tertiary = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "motioncontrol") == 0) { - char* state = "unknown(low)"; - if ((self->iValue & MOTOR_BOTH_BITS) == MOTOR_BOTH_BITS) - state = "invalid(high)"; - else if (self->iValue & MOTOR_ENABLED_BIT) - state = "enabled"; - else if (self->iValue & MOTOR_DISABLED_BIT) - state = "disabled"; - snprintf(line, 132, "%s.MotionControl = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "access") == 0) { - char* state = "unknown(low)"; - if ((self->iValue & ACCESS_BOTH_BITS) == ACCESS_BOTH_BITS) - state = "invalid(high)"; - else if (self->iValue & ACCESS_LOCKED_BIT) - state = "locked"; - else if (self->iValue & ACCESS_UNLOCKED_BIT) - state = "unlocked"; - snprintf(line, 132, "%s.Access = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "dc") == 0) { - char* state = "false"; - if (self->iValue & DC_POWEROK_BIT) - state = "true"; - snprintf(line, 132, "%s.DC = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "exit") == 0) { - char* state = "false"; - if (self->iValue & EXIT_INPROGRESS_BIT) - state = "true"; - snprintf(line, 132, "%s.Exit = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "trip") == 0) { - char* state = "false"; - if (self->iValue & SAFETY_TRIPPED_BIT) - state = "true"; - snprintf(line, 132, "%s.Trip = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "fault") == 0) { - char* state = "false"; - if (self->iValue & SAFETY_MALFUNCTION_BIT) - state = "true"; - snprintf(line, 132, "%s.Fault = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "operate") == 0) { - char* state = "false"; - if (self->iValue & TER_OPERATE_BIT) - state = "true"; - snprintf(line, 132, "%s.Operate = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "relay") == 0) { - char* state = "false"; - if (self->iValue & RELAY_ENABLED_BIT) - state = "true"; - snprintf(line, 132, "%s.Relay = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - if (strcasecmp(param, "ready") == 0) { - char* state = "false"; - if (self->iValue & INST_READY_BIT) - state = "true"; - snprintf(line, 132, "%s.Ready = %s", name, state); - SCWrite(pCon, line, eStatus); - return OKOK; - } - return 0; } static int PLC_Action(SConnection *pCon, SicsInterp *pSics, @@ -385,22 +408,25 @@ static int PLC_Action(SConnection *pCon, SicsInterp *pSics, } else if (argc == 2) { if (strcasecmp(argv[1], "list") == 0) { - PLC_Print(pCon, pSics, pData, argv[0], "key"); - PLC_Print(pCon, pSics, pData, argv[0], "secondary"); - PLC_Print(pCon, pSics, pData, argv[0], "tertiary"); - PLC_Print(pCon, pSics, pData, argv[0], "motioncontrol"); - PLC_Print(pCon, pSics, pData, argv[0], "access"); - PLC_Print(pCon, pSics, pData, argv[0], "dc"); - PLC_Print(pCon, pSics, pData, argv[0], "exit"); - PLC_Print(pCon, pSics, pData, argv[0], "trip"); - PLC_Print(pCon, pSics, pData, argv[0], "fault"); - PLC_Print(pCon, pSics, pData, argv[0], "operate"); - PLC_Print(pCon, pSics, pData, argv[0], "relay"); - PLC_Print(pCon, pSics, pData, argv[0], "ready"); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Key]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Secondary]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Tertiary]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[MotionControl]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Access]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[DC]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Exit]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Trip]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Fault]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Operate]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Relay]); + PLC_Print(pCon, pSics, pData, argv[0], plc_parname[Ready]); return OKOK; } if (PLC_Print(pCon, pSics, pData, argv[0], argv[1])) return OKOK; + } else if (argc == 3) { + if (strcasecmp(argv[1], "hattach") == 0) { + } } snprintf(line, 132, "%s does not understand %s", argv[0], argv[1]); SCWrite(pCon, line, eError); @@ -451,8 +477,10 @@ int SafetyPLCFactory(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]) { pSafetyPLCController pNew = NULL; - int iRet, status; + int iRet, status, i; char pError[256]; + pSicsVariable plcVar=NULL; + PLC_STATUS plcState; if(argc < 4) { @@ -479,6 +507,12 @@ int SafetyPLCFactory(SConnection *pCon, SicsInterp *pSics, SCWrite(pCon,pError,eError); } + for (i=0; i < sizeof(plc_parname)/sizeof(plc_parname[0]); i++) { + plcVar = VarCreate(PLC_UserPriv,veText,plc_parname[i]); + PLC_GetState(pNew,plc_parname[i],&plcState); + VarSetText(plcVar,plc_states[plcState],PLC_UserPriv); + AddCommand(pSics,plc_parname[i],VarWrapper,(KillFunc)VarKill,plcVar); + } /* create the command */