SICS-587 Setup hostport dictionary based configuration for dingo.
Also added simulated camera server and a camtest configuration file to run test scans against a dummy motor.
This commit is contained in:
76
site_ansto/instrument/TEST_SICS/fakeCameraServer/SIM_DINGO_CAMSERVER.py
Executable file
76
site_ansto/instrument/TEST_SICS/fakeCameraServer/SIM_DINGO_CAMSERVER.py
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from twisted.internet import reactor, protocol
|
||||||
|
from twisted.protocols.basic import LineReceiver
|
||||||
|
|
||||||
|
|
||||||
|
# camState = {'temp': "301.5", 'shspd': "21", 'ffmt': "TIFF", 'binres': "4", 'imsz': "2048", 'xstart': "0", 'ystart': "0", 'floc': "/experiments/dingo/camdata", 'fname': "image003.tiff", 'fcntr': "3", 'status': "Idle", 'shtime': "6"}
|
||||||
|
class CamServ(LineReceiver):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.camState = {'camera': "clock=1mhz,bin=1x,size=2048,gain=1xhs,flip=normal,xpos=0,ypos=0,exposure=0.777,temperature=-50,threshold=800,shutteropentime=100,shutterclosetime=200", 'file': "path=/experiments/dingo/data,basename=DingoTst,startnumber=1,imageformat=tiff,experimentdetail=this is an experiment", 'meta': "sx=100,sy=200,experiment=testing3", 'status': "camera status", 'state': "Idle", 'info': "camera info"}
|
||||||
|
print "Camera get/set commands: ", self.camState.keys()
|
||||||
|
|
||||||
|
def getCmd(self, par):
|
||||||
|
if par in self.camState:
|
||||||
|
self.sendLine(self.camState[par])
|
||||||
|
else:
|
||||||
|
self.sendLine("ERROR: Unknown parameter, " + par)
|
||||||
|
|
||||||
|
def setCmd(self, s):
|
||||||
|
par,val = s.split(',',1)
|
||||||
|
if par in self.camState:
|
||||||
|
self.camState[par] = val
|
||||||
|
self.sendLine("OK")
|
||||||
|
else:
|
||||||
|
self.sendLine("ERROR: Unknown parameter, " + par)
|
||||||
|
|
||||||
|
def takeCmd(self, cmd):
|
||||||
|
if cmd == 'shot':
|
||||||
|
self.sendLine("OK")
|
||||||
|
elif cmd == 'multishot':
|
||||||
|
self.sendLine("OK")
|
||||||
|
else:
|
||||||
|
self.sendLine("ERROR:1")
|
||||||
|
|
||||||
|
def clearCmd(self, par):
|
||||||
|
if par == 'meta':
|
||||||
|
self.sendLine("OK")
|
||||||
|
else:
|
||||||
|
self.sendLine("ERROR:1")
|
||||||
|
|
||||||
|
def lineReceived(self, line):
|
||||||
|
print "RECEIVED: " + line
|
||||||
|
cmd = line.split()
|
||||||
|
if len(cmd) == 0:
|
||||||
|
self.sendLine(line)
|
||||||
|
return
|
||||||
|
if cmd[0] == "get":
|
||||||
|
self.getCmd(cmd[1])
|
||||||
|
elif cmd[0] =="set":
|
||||||
|
if len(cmd) == 1:
|
||||||
|
self.sendLine("ERROR:2")
|
||||||
|
return
|
||||||
|
self.setCmd(cmd[1])
|
||||||
|
elif cmd[0] == "take":
|
||||||
|
if len(cmd) == 1:
|
||||||
|
self.sendLine("ERROR:2")
|
||||||
|
return
|
||||||
|
self.takeCmd(cmd[1])
|
||||||
|
elif cmd[0] == "clear":
|
||||||
|
if len(cmd) == 1:
|
||||||
|
self.sendLine("ERROR:2")
|
||||||
|
return
|
||||||
|
self.clearCmd(cmd[1])
|
||||||
|
else:
|
||||||
|
self.sendLine("ERROR: Unknown command, " + line)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
factory = protocol.ServerFactory()
|
||||||
|
factory.protocol = CamServ
|
||||||
|
reactor.listenTCP(63300,factory)
|
||||||
|
reactor.run()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -4,3 +4,7 @@ sics_ports.tcl
|
|||||||
script_validator_ports.tcl
|
script_validator_ports.tcl
|
||||||
config
|
config
|
||||||
util
|
util
|
||||||
|
hostport_config.tcl
|
||||||
|
hostport_config_test.tcl
|
||||||
|
camtest_configuration.tcl
|
||||||
|
dingo.hdd
|
||||||
|
|||||||
107
site_ansto/instrument/dingo/camtest_configuration.tcl
Normal file
107
site_ansto/instrument/dingo/camtest_configuration.tcl
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||||
|
|
||||||
|
# @file This is a barebones SICS configuration file for testing the camera
|
||||||
|
# driver.
|
||||||
|
#
|
||||||
|
# Usage: You must first launch the simulated camera server and then runsics
|
||||||
|
# with this configuration.
|
||||||
|
# Eg
|
||||||
|
# cd TEST_SICS/fakeCameraServer
|
||||||
|
# ./SIM_DINGO_CAMSERVER.py
|
||||||
|
# Then launch SICS from the server directory as follows,
|
||||||
|
# ./runsics.py --dev -c camtest_configuration.tcl -t fakedev start
|
||||||
|
# You should then be able to run a scan as follows,
|
||||||
|
# iscan add dummy_motor 0 0.1
|
||||||
|
# iscan run 5 timer 3
|
||||||
|
#
|
||||||
|
# NOTE\n
|
||||||
|
# This configuration does not create a GumTree interface or let you
|
||||||
|
# save nexus data files.
|
||||||
|
|
||||||
|
# Required by server_config.tcl
|
||||||
|
VarMake Instrument Text Internal
|
||||||
|
Instrument bare_dingo
|
||||||
|
Instrument lock
|
||||||
|
|
||||||
|
#START SERVER CONFIGURATION SECTION
|
||||||
|
source sics_ports.tcl
|
||||||
|
|
||||||
|
source server_config.tcl
|
||||||
|
|
||||||
|
set sicsroot ../
|
||||||
|
source util/utility.tcl
|
||||||
|
ServerOption LogFileBaseName $sicsroot/log/serverlog
|
||||||
|
|
||||||
|
###### installprotocolhandler
|
||||||
|
|
||||||
|
ServerOption statusfile $sicsroot/log/status.tcl
|
||||||
|
ServerOption RedirectFile $sicsroot/log/stdout
|
||||||
|
ServerOption LogFileDir $sicsroot/log
|
||||||
|
ServerOption QuieckPort [get_portnum $quieckport ]
|
||||||
|
ServerOption ServerPort [get_portnum $serverport ]
|
||||||
|
ServerOption InterruptPort [get_portnum $interruptport ]
|
||||||
|
ServerOption TelWord sicslogin
|
||||||
|
ServerOption TelnetPort [get_portnum $telnetport ]
|
||||||
|
ServerOption ReadUserPasswdTimeout 600000
|
||||||
|
ServerOption AcceptTimeOut 10
|
||||||
|
ServerOption ReadTimeOut 1000
|
||||||
|
SicsUser manager ansto 1
|
||||||
|
SicsUser user sydney 2
|
||||||
|
SicsUser spy 007 3
|
||||||
|
|
||||||
|
Motor dummy_motor asim [params \
|
||||||
|
asyncqueue mc1\
|
||||||
|
host mc1-dingo\
|
||||||
|
port pmc1-dingo\
|
||||||
|
axis A\
|
||||||
|
units mm\
|
||||||
|
hardlowerlim -500\
|
||||||
|
hardupperlim 500\
|
||||||
|
maxSpeed 1\
|
||||||
|
maxAccel 5\
|
||||||
|
maxDecel 5\
|
||||||
|
stepsPerX [expr 25000.0/5.0]\
|
||||||
|
absEnc 1\
|
||||||
|
absEncHome 0\
|
||||||
|
cntsPerX [expr 8192.0/5.0]]
|
||||||
|
dummy_motor part instrument
|
||||||
|
dummy_motor long_name dummy_motor
|
||||||
|
dummy_motor softlowerlim -500
|
||||||
|
dummy_motor softupperlim 500
|
||||||
|
dummy_motor home 0
|
||||||
|
|
||||||
|
|
||||||
|
MakeDrive
|
||||||
|
MakeAsyncQueue cmserver CAMERA localhost 63300
|
||||||
|
#MakeAsyncQueue cmserver CAMERA 137.157.204.193 33000
|
||||||
|
#MakeAsyncQueue cmserver CAMERA 137.157.236.122 33000
|
||||||
|
#MakeAsyncQueue cmserver CAMERA 192.168.56.1 33000
|
||||||
|
#MakeAsyncQueue cmserver CAMERA 192.168.1.2 33000
|
||||||
|
#MakeAsyncQueue cmserver CAMERA localhost 33000
|
||||||
|
MakeCounter cm1 anstocamera cmserver
|
||||||
|
MakeScanCommand iscan cm1 dingo.hdd recover.bin
|
||||||
|
foreach {n v} {
|
||||||
|
clock 1
|
||||||
|
bin 1
|
||||||
|
size 2048
|
||||||
|
gain 1
|
||||||
|
flip 0
|
||||||
|
xstart 1
|
||||||
|
ystart 1
|
||||||
|
xend 2048
|
||||||
|
yend 2048
|
||||||
|
exposure 0.777
|
||||||
|
temperature -50
|
||||||
|
threshold 800
|
||||||
|
shutteropentime 100
|
||||||
|
shutterclosetime 200
|
||||||
|
} {
|
||||||
|
cm1 setpar $n 0 $v
|
||||||
|
}
|
||||||
|
## SCAN TEST EXAMPLE
|
||||||
|
# iscan add dummy_motor 0 0.1
|
||||||
|
# iscan run 5 timer 3
|
||||||
|
|
||||||
|
exe batchpath ../batch
|
||||||
|
exe syspath ../batch
|
||||||
|
clientput "serverport [get_portnum $::serverport]"
|
||||||
@@ -19,9 +19,6 @@ proc ::counter::cm_initialize {} {
|
|||||||
variable isc_cm_address
|
variable isc_cm_address
|
||||||
variable isc_cm_port
|
variable isc_cm_port
|
||||||
|
|
||||||
set isc_cm_address 137.157.204.193
|
|
||||||
#set isc_cm_address localhost
|
|
||||||
set isc_cm_port 33000
|
|
||||||
|
|
||||||
MakeAsyncQueue cmserver CAMERA $isc_cm_address $isc_cm_port
|
MakeAsyncQueue cmserver CAMERA $isc_cm_address $isc_cm_port
|
||||||
MakeCounter cm1 anstocamera cmserver
|
MakeCounter cm1 anstocamera cmserver
|
||||||
@@ -68,14 +65,16 @@ proc ::counter::isc_initialize {} {
|
|||||||
variable isc_monitor_address
|
variable isc_monitor_address
|
||||||
variable isc_portlist
|
variable isc_portlist
|
||||||
variable isc_beam_monitor_list {MONITOR_1 MONITOR_2 MONITOR_3}
|
variable isc_beam_monitor_list {MONITOR_1 MONITOR_2 MONITOR_3}
|
||||||
|
variable isc_cm_address
|
||||||
|
variable isc_cm_port
|
||||||
|
|
||||||
#set isc_monitor_address "das1-[SplitReply [instrument]]"
|
#set isc_monitor_address "das1-[SplitReply [instrument]]"
|
||||||
#set isc_portlist [list 33000 33001 33002 33003 33004 33005 33006 33007]
|
#set isc_portlist [list 33000 33001 33002 33003 33004 33005 33006 33007]
|
||||||
#set isc_numchannels [llength $isc_beam_monitor_list]
|
#set isc_numchannels [llength $isc_beam_monitor_list]
|
||||||
#::counter::ic_initialize
|
#::counter::ic_initialize
|
||||||
|
|
||||||
set isc_cm_address 137.157.204.193
|
set isc_cm_address [dict get $::CAMERA_HOSTPORT HOST]
|
||||||
set isc_cm_port 33000
|
set isc_cm_port [dict get $::CAMERA_HOSTPORT PORT]
|
||||||
::counter::cm_initialize
|
::counter::cm_initialize
|
||||||
} message ] {
|
} message ] {
|
||||||
if {$::errorCode=="NONE"} {return $message}
|
if {$::errorCode=="NONE"} {return $message}
|
||||||
|
|||||||
@@ -7,28 +7,13 @@ set use_tiltstage 0
|
|||||||
set animal dingo
|
set animal dingo
|
||||||
set sim_mode [SplitReply [motor_simulation]]
|
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"} {
|
if {$sim_mode == "true"} {
|
||||||
set motor_driver_type asim
|
set motor_driver_type asim
|
||||||
} else {
|
} else {
|
||||||
set motor_driver_type DMC2280
|
set motor_driver_type DMC2280
|
||||||
MakeAsyncQueue mc1 DMC2280 $dmc2280_controller1(host) $dmc2280_controller1(port)
|
MakeAsyncQueue mc1 DMC2280 [dict get $::MOTOR_HOSTPORT MC1 HOST] [dict get $::MOTOR_HOSTPORT MC1 PORT]
|
||||||
MakeAsyncQueue mc2 DMC2280 $dmc2280_controller2(host) $dmc2280_controller2(port)
|
MakeAsyncQueue mc2 DMC2280 [dict get $::MOTOR_HOSTPORT MC2 HOST] [dict get $::MOTOR_HOSTPORT MC2 PORT]
|
||||||
MakeAsyncQueue mc3 DMC2280 $dmc2280_controller3(host) $dmc2280_controller3(port)
|
MakeAsyncQueue mc3 DMC2280 [dict get $::MOTOR_HOSTPORT MC3 HOST] [dict get $::MOTOR_HOSTPORT MC3 PORT]
|
||||||
# MakeAsyncQueue mc4 DMC2280 $dmc2280_controller4(host) $dmc2280_controller4(port)
|
|
||||||
# MakeAsyncQueue mc6 DMC2280 $dmc2280_controller6(host) $dmc2280_controller6(port)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
set sim_mode [SplitReply [plc_simulation]]
|
set sim_mode [SplitReply [plc_simulation]]
|
||||||
#if {$sim_mode == "false"} {
|
if {$sim_mode == "false"} {
|
||||||
MakeAsyncQueue plc_chan SafetyPLC 137.157.204.213 30000
|
MakeAsyncQueue plc_chan SafetyPLC [dict get $::PLC_HOSTPORT HOST] [dict get $::PLC_HOSTPORT PORT]
|
||||||
MakeSafetyPLC plc plc_chan 0
|
MakeSafetyPLC plc plc_chan 0
|
||||||
#}
|
}
|
||||||
|
|
||||||
proc shutter {args} {
|
proc shutter {args} {
|
||||||
set cmd "set shutter=$args\r\n"
|
set cmd "set shutter=$args\r\n"
|
||||||
|
|||||||
14
site_ansto/instrument/dingo/dingo.hdd
Normal file
14
site_ansto/instrument/dingo/dingo.hdd
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
*************************** DINGO Data File *******************************
|
||||||
|
Title = !!VAR(Title)!!
|
||||||
|
User = !!VAR(User)!!
|
||||||
|
File Creation Startdate: !!DATE!!
|
||||||
|
****************************************************************************
|
||||||
|
Dummy dummy_motor = !!DRIV(dummy_motor)!!
|
||||||
|
----------------------------------------------------------------------------
|
||||||
|
Zero dummy_motor = !!ZERO(dummy_motor)!!
|
||||||
|
----------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------
|
||||||
|
Scan Zero:
|
||||||
|
!!SCANZERO!!
|
||||||
|
**************************** DATA ******************************************
|
||||||
|
|
||||||
25
site_ansto/instrument/dingo/hostport_config.tcl
Normal file
25
site_ansto/instrument/dingo/hostport_config.tcl
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# MOTOR HOST AND PORT
|
||||||
|
foreach {mc host port} {
|
||||||
|
MC1 mc1-dingo pmc1-dingo
|
||||||
|
MC2 mc2-dingo pmc2-dingo
|
||||||
|
MC3 mc3-dingo pmc3-dingo
|
||||||
|
} {
|
||||||
|
dict set MOTOR_HOSTPORT $mc HOST $host
|
||||||
|
dict set MOTOR_HOSTPORT $mc PORT $port
|
||||||
|
}
|
||||||
|
|
||||||
|
# CAMERA SERVER
|
||||||
|
foreach {host port} {
|
||||||
|
137.157.204.193 33000
|
||||||
|
} {
|
||||||
|
dict set CAMERA_HOSTPORT HOST $host
|
||||||
|
dict set CAMERA_HOSTPORT PORT $port
|
||||||
|
}
|
||||||
|
|
||||||
|
# Safety Interlock System
|
||||||
|
foreach {host port} {
|
||||||
|
137.157.204.213 30000
|
||||||
|
} {
|
||||||
|
dict set PLC_HOSTPORT HOST $host
|
||||||
|
dict set PLC_HOSTPORT PORT $port
|
||||||
|
}
|
||||||
28
site_ansto/instrument/dingo/hostport_config_test.tcl
Normal file
28
site_ansto/instrument/dingo/hostport_config_test.tcl
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# 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 62300
|
||||||
|
MC2 localhost 62301
|
||||||
|
MC3 localhost 62302
|
||||||
|
} {
|
||||||
|
dict set MOTOR_HOSTPORT $key HOST $host
|
||||||
|
dict set MOTOR_HOSTPORT $key PORT $port
|
||||||
|
}
|
||||||
|
|
||||||
|
# CAMERA SERVER
|
||||||
|
foreach {host port} {
|
||||||
|
localhost 63300
|
||||||
|
} {
|
||||||
|
dict set CAMERA_HOSTPORT HOST $host
|
||||||
|
dict set CAMERA_HOSTPORT PORT $port
|
||||||
|
}
|
||||||
|
|
||||||
|
# Safety Interlock System
|
||||||
|
plc_simulation true
|
||||||
|
foreach {host port} {
|
||||||
|
localhost 63310
|
||||||
|
} {
|
||||||
|
dict set PLC_HOSTPORT HOST $host
|
||||||
|
dict set PLC_HOSTPORT PORT $port
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user