From 7bacc4dc7f7e80fc12d00bbd614e859534ef483d Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 18 Sep 2013 16:16:06 +1000 Subject: [PATCH] Use sics_config.ini to generate 12T magnet setup on Taipan. --- .../temperature/sct_lakeshore_340.tcl | 12 +++++++ site_ansto/instrument/server_config.tcl | 5 +++ .../tas/config/motors/motor_configuration.tcl | 36 +++++++++++++++++-- .../instrument/tas/util/sics_config.ini | 27 ++++++++++++++ site_ansto/instrument/util/config_reader.tcl | 3 +- 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 site_ansto/instrument/tas/util/sics_config.ini diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl index cd60cb95..06b67d83 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl @@ -2102,4 +2102,16 @@ proc add_sct_ls340 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0} } } +if { [ info exists ::config_dict ] } { + if { [ dict get $::config_dict ls340_1 enabled ] } { + set IP [dict get $::config_dict ls340_1 ip] + set PORT [dict get $::config_dict ls340_1 port] + set name [dict get $::config_dict ls340_1 name] + set term [dict get $::config_dict ls340_1 terminator] + set tol1 [dict get $::config_dict ls340_1 tol1] + set tol2 [dict get $::config_dict ls340_1 tol2] + + add_sct_ls340 $name $IP $PORT $term $tol1 $tol2 + } +} namespace import ::scobj::ls340::* diff --git a/site_ansto/instrument/server_config.tcl b/site_ansto/instrument/server_config.tcl index 15dc588f..a92d8716 100644 --- a/site_ansto/instrument/server_config.tcl +++ b/site_ansto/instrument/server_config.tcl @@ -119,6 +119,11 @@ if {[info exists env(SICS_SIMULATION)] != 1} { } } +fileeval util/config_reader.tcl +if [file exists ../sics_config.ini] { + set config_dict [config_reader::dump ../sics_config.ini] +} + set cfParent config #WARNING Make sure there are no spaces after the back-slashes diff --git a/site_ansto/instrument/tas/config/motors/motor_configuration.tcl b/site_ansto/instrument/tas/config/motors/motor_configuration.tcl index 40c23542..d3a8496f 100644 --- a/site_ansto/instrument/tas/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/tas/config/motors/motor_configuration.tcl @@ -138,6 +138,36 @@ dummy_s1 softupperlim 180 dummy_s1 precision 0.02 dummy_s1 home 0 +if { [ info exists ::config_dict ] && [ dict get $::config_dict s1_sample_insert enabled ] } { + set samp_stage_name "s1ss" + set tilt_motor_driver_type asim + + Motor s1 $motor_driver_type [params \ + asyncqueue mc2\ + host mc2-taipan\ + port pmc2-taipan\ + axis A\ + units degrees\ + hardlowerlim -180\ + hardupperlim 180\ + maxSpeed 1\ + maxAccel 1\ + maxDecel 1\ + stepsPerX 12500\ + absEnc 1\ + absEncHome 10695068\ + cntsPerX 4096] + s1 part sample + s1 long_name s1 + s1 softlowerlim -180 + s1 softupperlim 180 + s1 home 0 + +} else { + set samp_stage_name "s1" + set tilt_motor_driver_type $motor_driver_type +} + #if $use_tiltstage { # mc1: Monochromator crystal selection rotation/Tilt Motor mtilt $motor_driver_type [params \ @@ -263,7 +293,7 @@ a2 decel 0.2 # # mc2: Sample Tilt 1 -Motor sgu $motor_driver_type [params \ +Motor sgu $tilt_motor_driver_type [params \ asyncqueue mc2\ host mc2-taipan\ port pmc2-taipan\ @@ -286,7 +316,7 @@ sgu home 0 sgu backlash_offset -0.2 # mc2: Sample Tilt 2 -Motor sgl $motor_driver_type [params \ +Motor sgl $tilt_motor_driver_type [params \ asyncqueue mc2\ host mc2-taipan\ port pmc2-taipan\ @@ -355,7 +385,7 @@ stl home 0.0 stl backlash_offset -0.2 # mc2: Sample Rotate -Motor s1 $motor_driver_type [params \ +Motor $samp_stage_name $motor_driver_type [params \ asyncqueue mc2\ host mc2-taipan\ port pmc2-taipan\ diff --git a/site_ansto/instrument/tas/util/sics_config.ini b/site_ansto/instrument/tas/util/sics_config.ini new file mode 100644 index 00000000..14cd0d34 --- /dev/null +++ b/site_ansto/instrument/tas/util/sics_config.ini @@ -0,0 +1,27 @@ +[12tmagnet] +desc = "12 Tesla Oxford Magnet" +enabled = False +group = environment:magnet +ip = 137.157.203.153 +port = 55001 + +[12tmagnet_setup] +cascade = 12tmagnet,s1_sample_insert +enabled = False +group = 0setup + +[ls340_1] +enabled = False +group = environment:temperature +ip = 137.157.203.137 +name = tc1 +port = 4001 +terminator = "\r\n" +tol1 = 1.0 +tol2 = 1.0 + +[s1_sample_insert] +desc = "s1 will be defined as the sample insert rotation. Sample stage will be renamed to s1ss and sgu and sgl will be simulated" +enabled = False +group = motors + diff --git a/site_ansto/instrument/util/config_reader.tcl b/site_ansto/instrument/util/config_reader.tcl index 80757e30..ad72e992 100644 --- a/site_ansto/instrument/util/config_reader.tcl +++ b/site_ansto/instrument/util/config_reader.tcl @@ -73,7 +73,6 @@ proc config_reader::parse_file {filename} { return $dictionary } -if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} { proc config_reader::dump {{the_config startup.ini}} { set my_dict [config_reader::parse_file $the_config] puts "Dict: $my_dict" @@ -88,6 +87,8 @@ if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} { } return $my_dict } + +if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} { set filename "/tmp/test_[pid].ini" set sects [list] lappend sects "\[Section_1\]"