Upload
cecil-garrison
View
215
Download
2
Embed Size (px)
Citation preview
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
The Sardana device poolfor SPEC lovers
BLISS Seminar January 15, 2007
Tiago Coutinho - ALBA
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Agenda• What is Sardana • Guidelines• Structure• Sardana and other systems• Adding new features• Examples• Current state• Future
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Runtime add/update of new SW featuresEnables creation of lightweight, platform rich client interfaces:•Java/ATK•IPython•PyQT•C++/QT,C++/MFC•etc
Efficient, reliable, time consistent information feedback to the user
Easy creation and deployment of new SW features
What is Sardana?A software system for instrument A software system for instrument
control and data acquisitioncontrol and data acquisition• Client-server architecture• Event driven architecture• Plug-in architecture• Scriptable• Multi-user• Open source
Where have I heard this before?
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Guidelines• Long lifetime usage
• Core is HW independent→HW specific code written as plug-ins
• Performance→Minimize HW calls
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
SardanaSardana
Configuration API
Sardana Structure
Motors / Pseudo MotorsMotors / Pseudo Motors
MCAsMCAs
Motor GroupsMotor Groups
Counters / Pseudo countersCounters / Pseudo counters
LibController LibPseudo Motor Lib…
ConfigurationTool
ClientApplications
.SO.SO
CCDsCCDs
Measurement GroupsMeasurement Groups
ControllersControllers
HW
HW
ET
H
GP
IBC
AN
TA
NG
O D
evic
e S
erve
r
Remote PC
...
HW
HW
HW
HW
HW
HW
Remote PC
SP
EC
HW
HW
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Sardana / SPECSardana SPEC
Core code(C++ Tango Device – called Pool)
C code
SardanaConfig tool edconfpseudo motors
constraints*
in python
macro motors
calc motors
macro hooks
in ‘SPEC’ language
IPython CLI SPEC prompt / executable
Extra Server* Macros, Data files, Plot* not yet implemented
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Sardana / Tango Abstract classes
Sardana Abstract classesAs much code as possible
↓
interface & generic behavior
No code
↓
Just interface
Adapter design pattern
(aka Wrapper)
Union design pattern
(inheritance & polimorphism)
Evolution is foreseen Entire problem is well known
Dynamic interfaces Static interface
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Adding new features• Controllers (motor, counter, MCA, CCD, etc.)• Pseudo Motors• Pseudo Counters• Constraints
• Languages:– Python– C++ (only for controllers)
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Write a new motor controllertopBlade
beamBlade 1
Blade 2
bottomBlade
gap
offset
SardanaSardana
dummyctrl01
Motor Controller Lib
topBlade
bottomBlade
Config Interface1. Get the motor controller skeleton
2. Change it to your needs
3. Put it in the right place
4. Create an instance of the controller
5. Create motors
6. Enjoy
class MotorControllerSkeleton(MotorController): """Insert your motor controller description here"""
ctrl_extra_attributes = { # insert your extra features here }
ctrl_features = [ # insert features supported by your controller here ]
def __init__(self,inst,props): MotorController.__init__(self,inst,props) def PreStartAll(self): pass
def PreStartOne(self,axis,pos): return True
def StartOne(self,axis,pos): pass
def StartAll(self): pass . . .
class MotorControllerSkeleton(MotorController): """Insert your motor controller description here"""
ctrl_extra_attributes = { # insert your extra features here }
ctrl_features = [ # insert features supported by your controller here ]
def __init__(self,inst,props): MotorController.__init__(self,inst,props) def PreStartAll(self): pass
def PreStartOne(self,axis,pos): return True
def StartOne(self,axis,pos): pass
def StartAll(self): pass . . .
IDLE : Motor Controller Skeleton.py
Example
class FirePapController(MotorController): ""“An IcePap controller for Sardana"""
ctrl_extra_attributes = { }
ctrl_features = [‘Encoder','Backlash']
def __init__(self,inst,props): MotorController.__init__(self,inst,props)
self.socket_connected = False def PreStartAll(self): pass
def PreStartOne(self,axis,pos): return True
def StartOne(self,axis,pos): self.GOAbsolute(axis,pos)
def StartAll(self): pass . . .
class FirePapController(MotorController): ""“An IcePap controller for Sardana"""
ctrl_extra_attributes = { }
ctrl_features = [‘Encoder','Backlash']
def __init__(self,inst,props): MotorController.__init__(self,inst,props)
self.socket_connected = False def PreStartAll(self): pass
def PreStartOne(self,axis,pos): return True
def StartOne(self,axis,pos): self.GOAbsolute(axis,pos)
def StartAll(self): pass . . .
IDLE : FirePapCtrl.py
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Write a new pseudo motortopBlade
beamBlade 1
Blade 2
bottomBlade
gap
offset
SardanaSardana
dummyctrl01
Pseudo Motor Lib
topBlade
bottomBlade
Config Interface1. Get the pseudo motor skeleton
2. Change it to your needs
3. Put it in the right place
4. Create an instance of it
5. Enjoy
class PseudoMotorSkeleton(PseudoMotor):
"""Insert your pseudo motor system description here"""
pseudo_motor_roles = () motor_roles = () class_prop = { # insert your properties here
}
def calc_physical(self,index,pseudo_pos):# insert your code herepass
def calc_pseudo(self,index,physical_pos):# insert your code herepass
class PseudoMotorSkeleton(PseudoMotor):
"""Insert your pseudo motor system description here"""
pseudo_motor_roles = () motor_roles = () class_prop = { # insert your properties here
}
def calc_physical(self,index,pseudo_pos):# insert your code herepass
def calc_pseudo(self,index,physical_pos):# insert your code herepass
IDLE : Pseudo Motor Skeleton.py
class Slit(PseudoMotor):
"""A Slit pseudo motor system for controlling gap and offset pseudo motors"""
pseudo_motor_roles = ("Gap", "Offset") motor_roles = ("sl2t", "sl2b") class_prop = { 'a_string' : { 'Description' : 'string property example',
'Type' : 'PyTango.DevString', 'DefaultValue' : 'something to print' }
} def calc_physical(self,index,pseudo_pos): print self.a_string half_gap = pseudo_pos[0]/2.0 if index == 0: return raw_offset – half_gap else: return raw_offset + half_gap
def calc_pseudo(self,index,physical_pos): if index == 0: return physical_pos[1] - physical_pos[0] else: return (physical_pos[0] + physical_pos[1])/2.0
class Slit(PseudoMotor):
"""A Slit pseudo motor system for controlling gap and offset pseudo motors"""
pseudo_motor_roles = ("Gap", "Offset") motor_roles = ("sl2t", "sl2b") class_prop = { 'a_string' : { 'Description' : 'string property example',
'Type' : 'PyTango.DevString', 'DefaultValue' : 'something to print' }
} def calc_physical(self,index,pseudo_pos): print self.a_string half_gap = pseudo_pos[0]/2.0 if index == 0: return raw_offset – half_gap else: return raw_offset + half_gap
def calc_pseudo(self,index,physical_pos): if index == 0: return physical_pos[1] - physical_pos[0] else: return (physical_pos[0] + physical_pos[1])/2.0
IDLE : Slit.py
gap
offset
Example
# ipython Welcome to the IPython Sardana CLI SPEC emulator
1.ISardana> wa
Current Positions (user, dial)
topBlade 100.00 0.0bottomBlade 50.00 0.0gap 50.00offset 75.00
2.ISardana> mv gap 10
3.ISardana> wa
Current Positions (user, dial)
topBlade 80.00 -20.0bottomBlade 70.00 20.0gap 10.00offset 75.00
4.ISardana>
# ipython Welcome to the IPython Sardana CLI SPEC emulator
1.ISardana> wa
Current Positions (user, dial)
topBlade 100.00 0.0bottomBlade 50.00 0.0gap 50.00offset 75.00
2.ISardana> mv gap 10
3.ISardana> wa
Current Positions (user, dial)
topBlade 80.00 -20.0bottomBlade 70.00 20.0gap 10.00offset 75.00
4.ISardana>
IPython
By the way:By the way:
This is a This is a 300300 line of line of code example!code example!
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Current state• Server
– Multi-threaded Pool core
– Motor Controller– Motor– Pseudo Motor– Motor Group– Counter Controller*– Counter, Timer*
• Client– IPython (not up to date)– Java ATK configuration
(up to date)
• Simulators– Motor Controller – Counter Controller
• Motor Controllers:– IcePap
*Early development stage
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Future• data acquisition
– counter– timer– pseudo counter– multimeter – MCA– CCD– data storage– ...
• scan operations• data acquisition simulator
• geometry library• safety
– static pre-conditions– dynamic limit check– ...
• IPython client• GUI• Plotting• Macros• windows platform
• SPEC interaction
• …
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Thank you for your time
QuestionsQuestions
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Nice Features
# ipython Welcome to the IPython Sardana CLI SPEC emulator
1.ISardana> wa
Current Positions (user, dial)
topBlade 100.00 0.0bottomBlade 50.00 0.0gap 50.00offset 75.00
2.ISardana> mv gap 10
3.ISardana>
# ipython Welcome to the IPython Sardana CLI SPEC emulator
1.ISardana> wa
Current Positions (user, dial)
topBlade 100.00 0.0bottomBlade 50.00 0.0gap 50.00offset 75.00
2.ISardana> mv gap 10
3.ISardana>
IPython
SardanaSardana
•Add/modify features without havingAdd/modify features without havingrestart the serverrestart the server
•Multiple clientsMultiple clients
•Copy/paste beamlineCopy/paste beamlineconfigurationsconfigurations
The Sardana device pool for SPEC lovers - BLISS Seminar - January 15, 2007
Sardana Layer
CORBACORBA
SardanaSardana
TangoTango
motors, counters, scans, procedures, data files
IPythonIPython ATKATK
SPECSPEC
BLISS BLISS FrameworkFramework
Network Abstraction Layer
Devices, commands, attributes, properties
CLICLIuser interface