SICS-587 (in progress) Put IP and PORT configuration in one file.
Platypus TODO hmm, environment, and devices like multimeters and the sylvac.
This commit is contained in:
@@ -4,3 +4,5 @@ script_validator_ports.tcl
|
||||
extraconfig.tcl
|
||||
config
|
||||
util
|
||||
hostport_config.tcl
|
||||
hostport_config_test.tcl
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
set sim_mode [SplitReply [chopper_simulation]]
|
||||
|
||||
namespace eval ::scobj::chopper {
|
||||
variable chopper_IP "137.157.202.137"
|
||||
variable chopper_port "10000"
|
||||
variable chopper_IP [dict get $::CHOPPER_HOSTPORT NCS013 HOST]
|
||||
variable chopper_port [dict get $::CHOPPER_HOSTPORT NCS013 PORT]
|
||||
variable UID "NCS"
|
||||
variable PWD "NCS013"
|
||||
}
|
||||
|
||||
@@ -15,10 +15,19 @@ proc ::counter::isc_initialize {} {
|
||||
variable isc_numchannels
|
||||
variable isc_monitor_address
|
||||
variable isc_portlist
|
||||
if {0} {
|
||||
variable isc_beam_monitor_list {MONITOR_1 MONITOR_2}
|
||||
|
||||
set isc_monitor_address "das1-[SplitReply [instrument]]"
|
||||
set isc_portlist [list 30000 30001 30002 30003 30004 30005 30006 30007]
|
||||
}
|
||||
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 ] {
|
||||
|
||||
@@ -8,27 +8,14 @@
|
||||
set animal platypus
|
||||
set sim_mode [SplitReply [motor_simulation]]
|
||||
|
||||
# Setup addresses of Galil DMC2280 controllers.
|
||||
set dmc2280_controller1(host) mc1-$animal
|
||||
set dmc2280_controller1(port) pmc1-$animal
|
||||
|
||||
set dmc2280_controller2(host) mc2-$animal
|
||||
set dmc2280_controller2(port) pmc2-$animal
|
||||
|
||||
set dmc2280_controller3(host) mc3-$animal
|
||||
set dmc2280_controller3(port) pmc3-$animal
|
||||
|
||||
set dmc2280_controller4(host) mc4-$animal
|
||||
set dmc2280_controller4(port) pmc4-$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 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]
|
||||
}
|
||||
|
||||
#Measured absolute encoder reading at home position
|
||||
|
||||
35
site_ansto/instrument/reflectometer/hostport_config.tcl
Normal file
35
site_ansto/instrument/reflectometer/hostport_config.tcl
Normal file
@@ -0,0 +1,35 @@
|
||||
# MOTOR HOST AND PORT
|
||||
foreach {mc host port} {
|
||||
MC1 mc1-platypus pmc1-platypus
|
||||
MC2 mc2-platypus pmc2-platypus
|
||||
MC3 mc3-platypus pmc3-platypus
|
||||
MC4 mc4-platypus pmc4-platypus
|
||||
} {
|
||||
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-platypus 30000
|
||||
MONITOR_2 das1-platypus 30001
|
||||
} {
|
||||
dict set MONITOR_HOSTPORT $bm HOST $host
|
||||
dict set MONITOR_HOSTPORT $bm PORT $port
|
||||
}
|
||||
|
||||
# HISTOGRAM SERVER HOST AND PORT
|
||||
foreach {key host port} {
|
||||
HMM das1-platypus.nbi.ansto.gov.au 8080
|
||||
} {
|
||||
dict set HISTMEM_HOSTPORT $key HOST $host
|
||||
dict set HISTMEM_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# CHOPPER HOST AND PORT
|
||||
foreach {key host port} {
|
||||
NCS013 137.157.202.137 10000
|
||||
} {
|
||||
dict set CHOPPER_HOSTPORT $key HOST $host
|
||||
dict set CHOPPER_HOSTPORT $key PORT $port
|
||||
}
|
||||
37
site_ansto/instrument/reflectometer/hostport_config_test.tcl
Normal file
37
site_ansto/instrument/reflectometer/hostport_config_test.tcl
Normal file
@@ -0,0 +1,37 @@
|
||||
# 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 62530
|
||||
MC2 localhost 62531
|
||||
MC3 localhost 62532
|
||||
MC4 localhost 62533
|
||||
} {
|
||||
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 30000
|
||||
MONITOR_2 localhost 30001
|
||||
} {
|
||||
dict set MONITOR_HOSTPORT $key HOST $host
|
||||
dict set MONITOR_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# TEST HISTOGRAM SERVER HOST AND PORT
|
||||
foreach {key host port} {
|
||||
HMM das1-test.nbi.ansto.gov.au 8080
|
||||
} {
|
||||
dict set HISTMEM_HOSTPORT $key HOST $host
|
||||
dict set HISTMEM_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# TEST CHOPPER HOST AND PORT
|
||||
foreach {key host port} {
|
||||
NCS013 localhost 10000
|
||||
} {
|
||||
dict set CHOPPER_HOSTPORT $key HOST $host
|
||||
dict set CHOPPER_HOSTPORT $key PORT $port
|
||||
}
|
||||
@@ -6,44 +6,31 @@
|
||||
VarMake sicsdebug Int Mugger
|
||||
sicsdebug 0
|
||||
|
||||
VarMake opal_simulation Text internal
|
||||
# Simulation flags, possible values = true or false
|
||||
# true: The simulated driver will be used.
|
||||
# false: The real driver will be used.
|
||||
# icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined)
|
||||
# fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev)
|
||||
foreach {simflag icsval fakedev} {
|
||||
opal_simulation true true
|
||||
detector_simulation false true
|
||||
hmm_simulation false true
|
||||
environment_simulation false true
|
||||
counter_simulation false false
|
||||
motor_simulation false false
|
||||
chopper_simulation false true
|
||||
velsel_simulation false true
|
||||
plc_simulation false true
|
||||
rfgen_simulation false true
|
||||
goniometer_simulation false true
|
||||
magnetic_simulation false true
|
||||
} {
|
||||
dict set SIMFLAG_VAL $simflag ICSVAL $icsval
|
||||
dict set SIMFLAG_VAL $simflag FAKEDEV $fakedev
|
||||
VarMake $simflag Text internal
|
||||
}
|
||||
|
||||
opal_simulation true
|
||||
|
||||
VarMake detector_simulation Text internal
|
||||
detector_simulation false
|
||||
|
||||
VarMake hmm_simulation Text internal
|
||||
hmm_simulation false
|
||||
|
||||
VarMake environment_simulation Text internal
|
||||
environment_simulation false
|
||||
|
||||
VarMake counter_simulation Text internal
|
||||
counter_simulation false
|
||||
|
||||
VarMake motor_simulation Text internal
|
||||
motor_simulation false
|
||||
|
||||
VarMake chopper_simulation Text internal
|
||||
chopper_simulation false
|
||||
|
||||
VarMake velsel_simulation Text internal
|
||||
velsel_simulation false
|
||||
|
||||
VarMake plc_simulation Text internal
|
||||
plc_simulation false
|
||||
|
||||
VarMake rfgen_simulation Text internal
|
||||
rfgen_simulation false
|
||||
|
||||
VarMake goniometer_simulation Text internal
|
||||
goniometer_simulation false
|
||||
|
||||
VarMake magnetic_simulation Text internal
|
||||
magnetic_simulation false
|
||||
|
||||
VarMake sics_fullsimulation Text internal
|
||||
VarMake sics_simulation Text internal
|
||||
|
||||
source util/utility.tcl
|
||||
source util/script_context_util.tcl
|
||||
@@ -57,41 +44,62 @@ publish syncbackup Spy
|
||||
if {[info exists env(SICS_SIMULATION)] != 1} {
|
||||
set sicsroot ../
|
||||
source sics_ports.tcl
|
||||
sics_fullsimulation false
|
||||
sics_simulation false
|
||||
dict for {simflag d} $SIMFLAG_VAL {
|
||||
$simflag [dict get $d ICSVAL]
|
||||
}
|
||||
if [file exists hostport_config.tcl] {
|
||||
fileeval hostport_config.tcl
|
||||
} else {
|
||||
#TODO SICS-587 Abort with error when all instruments have been refactored.
|
||||
clientput WARNING: hostport_config.tcl is missing
|
||||
# sics_exitus
|
||||
}
|
||||
} else {
|
||||
switch $env(SICS_SIMULATION) {
|
||||
"full" {
|
||||
set sicsroot ../
|
||||
source sics_ports.tcl
|
||||
sics_fullsimulation true
|
||||
sics_simulation true
|
||||
}
|
||||
"fakedev" {
|
||||
set sicsroot ../
|
||||
source sics_ports.tcl
|
||||
sics_simulation fakedev
|
||||
if [file exists hostport_config_test.tcl] {
|
||||
fileeval hostport_config_test.tcl
|
||||
} else {
|
||||
#TODO SICS-587 Abort with error when all instruments have been refactored.
|
||||
clientput ERROR: hostport_config_test.tcl is missing
|
||||
sics_exitus
|
||||
}
|
||||
}
|
||||
"script_validator" {
|
||||
VarMake sics_script_validator Text internal
|
||||
sics_script_validator true
|
||||
set sicsroot ../script_validator/
|
||||
source script_validator_ports.tcl
|
||||
sics_fullsimulation true
|
||||
sics_simulation true
|
||||
MakeSync localhost [expr [get_portnum $serverport ]-10] spy 007 ../log/syncfile.tcl
|
||||
}
|
||||
default {
|
||||
error "ERROR: SICS_SIMULATION must be full or script_validator, not $env(SICS_SIMULATION)"
|
||||
error "ERROR: SICS_SIMULATION must be full, script_validator, or fakedev, not $env(SICS_SIMULATION)"
|
||||
sics_exitus
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[string trim [lindex [split [sics_fullsimulation] =] 1]] == "true"} {
|
||||
opal_simulation true
|
||||
detector_simulation true
|
||||
hmm_simulation true
|
||||
counter_simulation true
|
||||
environment_simulation true
|
||||
motor_simulation true
|
||||
chopper_simulation true
|
||||
velsel_simulation true
|
||||
plc_simulation true
|
||||
rfgen_simulation true
|
||||
goniometer_simulation true
|
||||
magnetic_simulation true
|
||||
switch $env(SICS_SIMULATION) {
|
||||
"full" - "simdriv" - "script_validator" {
|
||||
dict for {simflag d} $SIMFLAG_VAL {
|
||||
$simflag true
|
||||
}
|
||||
}
|
||||
"fakedev" {
|
||||
dict for {simflag d} $SIMFLAG_VAL {
|
||||
$simflag [dict get $d FAKEDEV]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set cfParent config
|
||||
|
||||
Reference in New Issue
Block a user