the sardana device pool a strange “future” demonstration a talk given by and at the hamburger...

36
The Sardana device pool A strange “future” demonstration by and at the Hamburger Tango Meeting 17/18 th Authors: Emmanuel Taurel, Alejandro Homs, Vicente Rey, Pep Ribas, and more Jörg Klora Tiago Coutinho

Upload: valentine-summers

Post on 04-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

The Sardana device poolA strange “future” demonstration

A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010

Authors: Emmanuel Taurel, Alejandro Homs, Vicente Rey, Pep Ribas, and more

Jörg Klora Tiago Coutinho

Page 2: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Get an overview about the flow of the demonstration to come

Hamburger Tango Meeting

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

Page 3: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Introduce the different roles of the users of the sardana pool

Hamburger Tango Meeting

Installation

• Back to the future

• Main Screen

• Back to the future

• Main Screen

Page 4: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Understand the different roles to not confuse the changing viewpoints throughout the demonstration

Hamburger Tango Meeting

POINTS

• Different roles:– Developer of the core system (few)– Developer of add-ons (many)– Software support – Expert users– End user

Page 5: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

See how easy it is to install the whole system from scratch

Hamburger Tango Meeting

Prepare for installation• Prepare for Installation• Result

• Prepare for Installation• Result

Page 6: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Make the points about the need for easy installation

Hamburger Tango Meeting

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!

Page 7: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Start to add hardware to an empty system to see the system from the point of view of the technician

Hamburger Tango Meeting

Add two motors

• Add motors

Page 8: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Use the generic configuration GUI as a mean to understand the underlying server

Hamburger Tango Meeting

Historical

Moviefrom2007

Page 9: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain the details of the configuration GUI and the server to clearly see the difference

Hamburger Tango Meeting

Behind the scenes

Sardana Device Pool

Pool Device

sup

sdown

POOL> wa

POOL> mv th 2.3

POOL>

ControllerHuber

ControllerHuber

Page 10: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

See the result of our efforts from the role of the end user of the CLI

Hamburger Tango Meeting

CLI demo

IPython

Page 11: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Make the points to clearly explain what the functionallity of the Sardana pool is

Hamburger Tango Meeting

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

Page 12: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Add more hardware to see who powerful the system already is

Hamburger Tango Meeting

Add more hardware

• Add a counter, multimeter and measurement group

Page 13: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Add a counter controller with the low level generic configuration GUI

Hamburger Tango Meeting

Create counter

controller

Page 14: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Add the well known 3 standard channels to compare the concepts with existing solutions

Hamburger Tango Meeting

Create counter channels

secmondet

Page 15: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Add an integrating electrometer to see that standard macro solution are already included

Hamburger Tango Meeting

Addpico

ampermeterchannel

Page 16: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Introduce the concept of a measurement group even with the GUI for didactic purposes

Hamburger Tango Meeting

Create measure

mentgroup

Page 17: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Further explain the pool Hamburger Tango Meeting

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

Page 18: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Demonstrate the actions so far from the users point of view

Hamburger Tango Meeting

CLI demo

IPython with scanning and more hardware

Page 19: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain the macro server and its relation to a command line interface

Hamburger Tango Meeting

Macro Server

Behind the scenes – CLI and Macros

Sardana Device Pool

Pool Device

sup

sdown

POOL> wa

POOL> mv th 2.3

POOL>

ControllerJorg

Mymv

Door

Macromymv

sup

sdown

Pool DeviceMacro Device Pool Device

Page 20: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Write a simple macro to understand the concept of a macro and the distinction to python functions

Hamburger Tango Meeting

Write a macro

• Create new macro file

Page 21: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain the edit process and show how the internal processes are hidden from the macro programmer

Hamburger Tango Meeting

Behind the scenes – Editing Macros

POOL> wa

POOL> mv th 2.3

POOL>

POOL> wa

POOL> mv th 2.3

POOL>

Mymv

Sardana Device Pool

sup

sdown ControllerHuber

Pool Device

CVS Server

Macro ServerDoor

sup

sdown

Macro Device

Door

Step 1When a client starts it gets the macro list with its arguments from the serverStep 2A new macro file is created from the templateStep 3The macro is sent to the CVS Server and the Macro Server is informedStep 4The macro file is loaded from the CVS Server and into memoryStep 5An event is sent with the new macro list

Mymv

Page 22: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Make the points about the macro server and the edit process

Hamburger Tango Meeting

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

Page 23: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain the simple macro to understand further what a macro is

Hamburger Tango Meeting

Move macroclass 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 1

A macro is a class which inherits from MacroPOINT 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

Page 24: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Hint on many more advanced points in the macro server we have no time to treat here

Hamburger Tango Meeting

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

Page 25: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Show the controller code to allow to grasp the concept of device specific plug-ins

Hamburger Tango Meeting

Write a controller

• edit a motor controller

Page 26: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Insist on the very well defined structure of a controller and the supervisor role of the pool

Hamburger Tango Meeting

Controller Code

start_one

state_one

prestart_one

start_all

abort_one

Serial line channelF

eatu

res

(i.e.

ba

ckla

sh)

….

Ext

ra P

aram

eter

s

Ext

ra A

ttrib

utes

Page 27: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Repeat the important points of the controller and try to make the distinction to device servers

Hamburger Tango Meeting

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

Page 28: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain communication channels to access devices in a simple, configurable and controlled way

Hamburger Tango Meeting

Use our controller

• Add the communication channel to the hardware

Page 29: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Insist on the points before with the generic configuration GUI

Hamburger Tango Meeting

Creation of a

communication channel

Page 30: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain pseudo motor as advanced plug-ins for this common functionality

Hamburger Tango Meeting

Pseudo Motors

• are an example of specialized plug-ins (pseudo counters, constraints, file formats, logging destinations, …..)

Page 31: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Show how easy it is to define the pseudo motors even in the very generic configuration GUI

Hamburger Tango Meeting

Create pseudo motor

slit

Page 32: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Explain in detail the pseudo motor code to proof how simple it is to add to the system

Hamburger Tango Meeting

Pseudo controller codefrom 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

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 PseudoMotorControllerSome information i.e. for GUI beautification The roles of the real and pseudo motors A method to calculate real positions from pseudoA method to calculate pseudo positions from realSome extra properties

Page 33: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Further insist on the points of specific plug-ins

Hamburger Tango Meeting

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 ..

Page 34: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Make it clear that we are talking about the hidden part of the iceberg less supported by our users

Hamburger Tango Meeting

The most important is …

Page 35: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Give a short overview about the current status

Hamburger Tango Meeting

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

Page 36: The Sardana device pool A strange “future” demonstration A Talk given by and at the Hamburger Tango Meeting 17/18 th September 2010 Authors: Emmanuel Taurel,

18/9/2007

Resume in "one" sentence and cry for help

Hamburger Tango Meeting

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