360 likes | 526 Views
The Sardana device pool. A strange “future” demonstration. Authors: Emmanuel Taurel, Alejandro Homs, Vicente Rey, Pep Ribas, and more. A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010. Jörg Klora. Tiago Coutinho.
E N D
The Sardana device pool A strange “future” demonstration Authors: Emmanuel Taurel, Alejandro Homs, Vicente Rey, Pep Ribas, and more A Talk given by and at the Hamburger Tango Meeting 17/18th September 2010 Jörg Klora Tiago Coutinho
Get an overview about the flow of the demonstration to come Our Sardana “Demonstration” • Get the sardana system and install it on this PC • Add some hardware: • Two motors • A counter, multimeter, and a communication channel • Pseudo motor gap and offset • Use the CLI (and understand the role of the macro server) • Write your own macro • Look at a motor controller code • Understand pseudo motor code
Introduce the different roles of the users of the sardana pool Installation • Back to the future • Main Screen • Back to the future • Main Screen
Understand the different roles to not confuse the changing viewpoints throughout the demonstration POINTS • Different roles: • Developer of the core system (few) • Developer of add-ons (many) • Software support • Expert users • End user
See how easy it is to install the whole system from scratch Prepare for installation • Prepare for Installation • Result • Prepare for Installation • Result
Make the points about the need for easy installation POINTS • Special care for easy installation on a single PC or in a complicated beamline scenario • All necessary packages will be downloaded – otherwise there are too many dependencies!
Start to add hardware to an empty system to see the system from the point of view of the technician Add two motors • Add motors
Use the generic configuration GUI as a mean to understand the underlying server Historical Moviefrom2007
Explain the details of the configuration GUI and the server to clearly see the difference Behind the scenes POOL> wa POOL> mv th 2.3 POOL> Pool Device Sardana Device Pool sup sdown Controller Huber Controller Huber
See the result of our efforts from the role of the end user of the CLI CLI demo IPython
Make the points to clearly explain what the functionallity of the Sardana pool is POINTS • Standard tango device are created • Different hardware will always produce the same standard motor device • A specific client has only knowledge about the simple motor devices not the pool device • Multi clients because of use of events (as far as possible with current version of TANGO!!) • The motor interface is for high level access – think of it as the user commands (mv, set, setdial …) in SPEC
Add more hardware to see who powerful the system already is Add more hardware • Add a counter, multimeter and measurement group
Add a counter controller with the low level generic configuration GUI Create counter controller
Add the well known 3 standard channels to compare the concepts with existing solutions Create counter channelssecmondet
Add an integrating electrometer to see that standard macro solution are already included Addpicoampermeterchannel
Introduce the concept of a measurement group even with the GUI for didactic purposes Create measurementgroup
Further explain the pool POINTS • High performance core (C++ , python) • The pool knows about motors, counters, and lots of other devices and provides a simple, standard and unique interface to them • The pool synchronizes the measurement, minimizes hardware access and allows different users to use the hardware together • The pool is a client software where the standard <ASCII> interface has been replaced by a series of TANGO devices
Demonstrate the actions so far from the users point of view CLI demo IPython with scanning and more hardware
Explain the macro server and its relation to a command line interface Behind the scenes – CLI and Macros POOL> wa POOL> mv th 2.3 POOL> Pool Device Pool Device Macro Device Pool Device Sardana Device Pool Macro Server sup Door sup Macro mymv sdown Controller Jorg sdown Mymv
Write a simple macro to understand the concept of a macro and the distinction to python functions Write a macro • Create new macro file
Explain the edit process and show how the internal processes are hidden from the macro programmer Behind the scenes – Editing Macros Mymv Mymv CVS Server Macro Device Macro Server POOL> wa POOL> mv th 2.3 POOL> Door Door Pool Device Sardana Device Pool sup sup sdown Controller Huber sdown Step 1 When a client starts it gets the macro list with its arguments from the server Step 2 A new macro file is created from the template Step 3 The macro is sent to the CVS Server and the Macro Server is informed Step 4 The macro file is loaded from the CVS Server and into memory Step 5 An event is sent with the new macro list
Make the points about the macro server and the edit process POINTS • Macros are global to all clients of the macro server • The internal structure is hidden from the user (i.e. CVS) • Macros are commands in the CLI (i.e. wa mv) • The current threading model is that macros are serialized • Every client uses at least one “mostly private” door
Explain the simple macro to understand further what a macro is Move macro POINT 1 A macro is a class which inherits from Macro class mymv(Macro): """Move motor to position""" param_def = [ ['motor', Type.Motor, None, 'Motor to move'], ['pos', Type.Float, None, 'Position to move to'] ] def run(self, motor, pos): motor.startMove(pos) motor.waitMove() POINT 2 A macro has a description of itself and its parameters POINT 3 A macro has a method run which will be started in a separate thread
Hint on many more advanced points in the macro server we have no time to treat here Macros • A macro is a class which inherits from Macro • A macro has a description of itself and its parameters • A macro has a method run which will be started in a separate thread • The macro server knows also about: • Macros i.e. macros call macros • Parameters i.e. add new type of parameters • Output through logging framework i.e. wa • Dataflow with different file formats and online plotting
Show the controller code to allow to grasp the concept of device specific plug-ins Write a controller • edit a motor controller
Insist on the very well defined structure of a controller and the supervisor role of the pool Controller Code Features (i.e. backlash) …. Extra Parameters Extra Attributes start_one prestart_one Serial line channel state_one start_all abort_one
Repeat the important points of the controller and try to make the distinction to device servers POINTS • Controllers are easy to write and include only code specific the device (i.e. no backlash capacity in the controller and the pool will simulate this feature) • One can not write an “incompatible” controller • Maximum performance through minimum number of hardware calls (i.e. if move multiple exists it will be used) • Controllers can talk to the hardware by communication channels or device servers
Explain communication channels to access devices in a simple, configurable and controlled way Use our controller • Add the communication channel to the hardware
Insist on the points before with the generic configuration GUI Creation of a communication channel
Explain pseudo motor as advanced plug-ins for this common functionality Pseudo Motors • are an example of specialized plug-ins (pseudo counters, constraints, file formats, logging destinations, …..)
Show how easy it is to define the pseudo motors even in the very generic configuration GUI Create pseudo motorslit
Explain in detail the pseudo motor code to proof how simple it is to add to the system Pseudo controller code from PseudoMotorController import PseudoMotorController class Slit(PseudoMotorController): """A Slit pseudo motor system “”” gender , model, organisation = "Pseudo motor“, "Slit“, "CELLS - ALBA" image, logo = "slit.png“, "ALBA_logo.png" pseudo_motor_roles = ("Gap", "Offset") motor_roles = (“top blade", "bottom blade") class_prop = { ‘resolution' : { 'Description' : ‘The encoder resolution', 'Type' : 'PyTango.DevFloat, ‘DefaultValue' : 1.0 }, } def calc_physical(self,index,pseudo_pos): half_gap = pseudo_pos[0]/2.0 if index == 0: return pseudo_pos[1] - half_gap else: return pseudo_pos[1] + 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 A class inheriting from PseudoMotorController Some information i.e. for GUI beautification The roles of the real and pseudo motors A method to calculate real positions from pseudo A method to calculate pseudo positions from real Some extra properties from PseudoMotorController import PseudoMotorController class Slit(PseudoMotorController): """A Slit pseudo motor system “”” gender , model, organisation = "Pseudo motor“, "Slit“, "CELLS - ALBA" image, logo = "slit.png“, "ALBA_logo.png" pseudo_motor_roles = ("Gap", "Offset") motor_roles = ("top blade", "bottom blade") class_prop = { ‘resolution' : { 'Description' : ‘The encoder resolution', 'Type' : 'PyTango.DevFloat, ‘DefaultValue' : 1.0 }, } def calc_physical(self,index,pseudo_pos): half_gap = pseudo_pos[0]/2.0 if index == 0: return pseudo_pos[1] - half_gap else: return pseudo_pos[1] + 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
Further insist on the points of specific plug-ins POINTS • Pseudo motors are generic to the system and not inside a specific client • Very simple to write all the details are taken care of by the pool (events when finished, update intervals, ….) • Specific plug-ins for specific purpose ..
Make it clear that we are talking about the hidden part of the iceberg less supported by our users The most important is …
Give a short overview about the current status Old Problems (from 2007) • Still too unstable (pre alpha) • Some features missing MCA, CCD, hkl • Ease of installation and use not there yet • Older problems: • TANGO Events are too specific and not adapted for these type of IPC • Tango Servers in Python were not possible
Resume in "one" sentence and cry for help Conclusion • Machine and Experiments need a generic client (i.e currently SPEC and Middle Layer) • The device pool aims to be this tool – A generic client in the center of data acquisition and control • The client can be “easily” adapted to other synchrotrons with all kind of plug-ins • PLEASE HELP