diff --git a/site_ansto/instrument/tas/MANIFEST.TXT b/site_ansto/instrument/tas/MANIFEST.TXT index ba3f9a36..2871a006 100644 --- a/site_ansto/instrument/tas/MANIFEST.TXT +++ b/site_ansto/instrument/tas/MANIFEST.TXT @@ -3,3 +3,5 @@ script_validator_ports.tcl taipan_configuration.tcl config util +hostport_config.tcl +hostport_config_test.tcl diff --git a/site_ansto/instrument/tas/config/counter/counter.tcl b/site_ansto/instrument/tas/config/counter/counter.tcl index f0a9886f..4f7e802b 100644 --- a/site_ansto/instrument/tas/config/counter/counter.tcl +++ b/site_ansto/instrument/tas/config/counter/counter.tcl @@ -15,10 +15,14 @@ proc ::counter::isc_initialize {} { variable isc_numchannels variable isc_monitor_address variable isc_portlist - variable isc_beam_monitor_list {MONITOR_1 MONITOR_2} - set isc_monitor_address [hostnam "das2-[SplitReply [instrument]]"] - set isc_portlist [list 33000 33001 33002 33003 33004 33005 33006 33007] + dict for {k v} $::MONITOR_HOSTPORT { + lappend monlist $k + lappend hostlist [dict get $v HOST] + lappend isc_portlist [dict get $v PORT] + } + variable isc_beam_monitor_list $monlist + set isc_monitor_address [lindex $hostlist 0] set isc_numchannels [llength $isc_beam_monitor_list] ::counter::ic_initialize } message ] { diff --git a/site_ansto/instrument/tas/config/motors/motor_configuration.tcl b/site_ansto/instrument/tas/config/motors/motor_configuration.tcl index 7f0d597b..e93801f5 100644 --- a/site_ansto/instrument/tas/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/tas/config/motors/motor_configuration.tcl @@ -10,31 +10,15 @@ set use_tiltstage 0 set animal taipan set sim_mode [SplitReply [motor_simulation]] -# Setup addresses of Galil DMC2280 controllers. -set dmc2280_controller1(host) [hostnam mc1-$animal] -set dmc2280_controller1(port) [portnum pmc1-$animal] - -set dmc2280_controller2(host) [hostnam mc2-$animal] -set dmc2280_controller2(port) [portnum pmc2-$animal] - -set dmc2280_controller3(host) [hostnam mc3-$animal] -set dmc2280_controller3(port) [portnum pmc3-$animal] - -set dmc2280_controller4(host) [hostnam mc4-$animal] -set dmc2280_controller4(port) [portnum pmc4-$animal] - -set dmc2280_controller6(host) [hostnam mc6-$animal] -set dmc2280_controller6(port) [portnum pmc6-$animal] - if {$sim_mode == "true"} { set motor_driver_type asim } else { set motor_driver_type DMC2280 - MakeAsyncQueue mc1 DMC2280 $dmc2280_controller1(host) $dmc2280_controller1(port) - MakeAsyncQueue mc2 DMC2280 $dmc2280_controller2(host) $dmc2280_controller2(port) - MakeAsyncQueue mc3 DMC2280 $dmc2280_controller3(host) $dmc2280_controller3(port) - MakeAsyncQueue mc4 DMC2280 $dmc2280_controller4(host) $dmc2280_controller4(port) - MakeAsyncQueue mc6 DMC2280 $dmc2280_controller6(host) $dmc2280_controller6(port) + MakeAsyncQueue mc1 DMC2280 [dict get $::MOTOR_HOSTPORT MC1 HOST] [dict get $::MOTOR_HOSTPORT MC1 PORT] + MakeAsyncQueue mc2 DMC2280 [dict get $::MOTOR_HOSTPORT MC2 HOST] [dict get $::MOTOR_HOSTPORT MC2 PORT] + MakeAsyncQueue mc3 DMC2280 [dict get $::MOTOR_HOSTPORT MC3 HOST] [dict get $::MOTOR_HOSTPORT MC3 PORT] + MakeAsyncQueue mc4 DMC2280 [dict get $::MOTOR_HOSTPORT MC4 HOST] [dict get $::MOTOR_HOSTPORT MC4 PORT] + MakeAsyncQueue mc6 DMC2280 [dict get $::MOTOR_HOSTPORT MC6 HOST] [dict get $::MOTOR_HOSTPORT MC6 PORT] } #Measured absolute encoder reading at home position diff --git a/site_ansto/instrument/tas/hostport_config.tcl b/site_ansto/instrument/tas/hostport_config.tcl new file mode 100644 index 00000000..65808b6d --- /dev/null +++ b/site_ansto/instrument/tas/hostport_config.tcl @@ -0,0 +1,20 @@ +# MOTOR HOST AND PORT +foreach {mc host port} { + MC1 mc1-taipan pmc1-taipan + MC2 mc2-taipan pmc2-taipan + MC3 mc3-taipan pmc3-taipan + MC4 mc4-taipan pmc4-taipan + MC6 mc6-taipan pmc6-taipan +} { + dict set MOTOR_HOSTPORT $mc HOST $host + dict set MOTOR_HOSTPORT $mc PORT $port +} + +# BEAM MONITOR HOST AND PORT +foreach {bm host port} { + MONITOR_1 das1-taipan 33000 + MONITOR_2 das1-taipan 33001 +} { + dict set MONITOR_HOSTPORT $bm HOST $host + dict set MONITOR_HOSTPORT $bm PORT $port +} diff --git a/site_ansto/instrument/tas/hostport_config_test.tcl b/site_ansto/instrument/tas/hostport_config_test.tcl new file mode 100644 index 00000000..e033fd03 --- /dev/null +++ b/site_ansto/instrument/tas/hostport_config_test.tcl @@ -0,0 +1,22 @@ +# Specify NONE for HOST and PORT if there is no fake device to talk to. + +# TEST MOTOR HOST AND PORT +foreach {key host port} { + MC1 localhost 62730 + MC2 localhost 62731 + MC3 localhost 62732 + MC4 localhost 62733 + MC6 localhost 62734 +} { + dict set MOTOR_HOSTPORT $key HOST $host + dict set MOTOR_HOSTPORT $key PORT $port +} + +# TEST BEAM MONITOR HOST AND PORT +foreach {key host port} { + MONITOR_1 localhost 33000 + MONITOR_2 localhost 33001 +} { + dict set MONITOR_HOSTPORT $key HOST $host + dict set MONITOR_HOSTPORT $key PORT $port +}