116
TANGO users training : April 2003 Session TANGO TRAINING User Session organised by SOLEIL Control/Command and Acquisition Group April 2003

TANGO TRAINING User Session organised by SOLEIL Control/Command and Acquisition Group April 2003

  • Upload
    balin

  • View
    22

  • Download
    1

Embed Size (px)

DESCRIPTION

TANGO TRAINING User Session organised by SOLEIL Control/Command and Acquisition Group April 2003. Goals. Present basic concepts share a common vocabulary Understand what a TANGO interface is to get correct interfaces specifications Show current applications - PowerPoint PPT Presentation

Citation preview

Page 1: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO TRAININGUser Sessionorganised by

SOLEIL Control/Command and Acquisition Group

April 2003

Page 2: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Goals

• Present basic concepts– share a common vocabulary

• Understand what a TANGO interface is– to get correct interfaces specifications

• Show current applications– to show what the control system will actually

be like

Page 3: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Audience

• Users of control systems have to:– Share common concepts and vocabulary with the

Computing Services. – Be trained to software tools proposed by the

Control/Command group

• Applications developers linked to the Control/Command Group :

– Scientists, who collect, use, process data obtained by the Control/Command group

– Engineers/Technicians from Equipment pools, who have to understand/monitor the behavior of their systems

• Engineers from other institutes – Who wish to have a first glance at the TANGO tool

developed by the ESRF/SOLEIL collaboration

Page 4: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Contributors

• Alain Buteau• Majid Ounsy• Jean Chinkumo

Page 5: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Today’s Programme

• Part I – what is TANGO ? – A software bus– A «computing tool» dedicated to the implementation of systems which

are heterogeneous, distributed and control/command oriented– Chronology

• Part II – Basic Concepts– Device– Interface

• Commands• Attributes• Statuses• Device Server

• Part III – Current high-level applications– Control system configuration– Properties– Monitoring– Logging– Archiving

Page 6: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

- Part I -What is

TANGO ?

Page 7: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO system: A software bus

Page 8: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

A software bus

• Analogy with an electronical bus because: – Each card plugged on the bus has a well-

identified function– Each card is not or hardly coupled to the

others – Development of each card can be decoupled

• But each card– Must respect a strict and well-defined

interface in order to connect to the bus

Page 9: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO software Bus

Device

interface

HW (motor…)

The device: a bus element

Page 10: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Example: motor interface:

MOTOR:

Commands:

- GoForward()…

Attributes:

- Speed (R/W)…

Interface

Hardware control code

Page 11: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

And high-level modular applications

DeviceDevice

TANGO Software Bus

LoggingMonitoringConfiguration

(motor…)

Hardware

(E/S…)

Hardware

ArchivingUsers

Environments :MATLAB, IGOR, python, Labview

Bindings

Page 12: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

TANGO Software Bus

Device Mouse

interface

Attributes:

- PositionX (R/W)

- PositionY(R/W)

Commands:

- Center()

Hardware control code

Page 13: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

• Connect your Device to the bus – Start-db.bat (explanations will come

later)– Start-mouse.bat

• Start an application to see your Device– Start-mousepanel.bat

Page 14: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO systemA «computing tool»

dedicated to the implementation of

distributed, heterogeneous and control/command

oriented systems

Page 15: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Control/command problematics at SOLEIL

• Implement:– 1 control system for accelerators: LINAC, ring, Booster– 1 control system for every beamline– Need to exchange information between those different

systems, using a common language

As a whole, at least 25 different control systems

Page 16: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Which computing tool do we need?

• Distributed systems

• Heterogeneous systems?

• A computing tool, ctrl/command oriented

Page 17: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Distributed systems

Profibus

Supervision / Control : TANGO

Process Management General Services: Archiving, Configuration,

. TANGO

equipments equipments

ETHERNET

CPCI board

Profibus

PLCs

ETHERNET

Motor board GALIL/midi

engineering

The system components are geographically distributed on machines interconnected by a computing network:

–More than 100 Compact PCI frontend –More than 100 robots –Dozens of operator stations

Page 18: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Heterogeneous systems on hardware and software levels

• Slow industrial systems: robots• Fast acquisition systems• Ready for use systems:

– LINAC control/command– Control software sold with equipments (Residual

gas analyzers, SCIENTA analyzers)

• Heterogeneous operating systems– Scientific applications under Linux– Drivers/libraries under WIN32 or under Linux

How to obtain a coherent whole from heterogeneous hardware and software?

Page 19: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

A ctrl/command oriented computing tool

• Beyond computing technologies to exchange information between systems

Need for services specific to a control system (archiving, logging, warnings, …)

Page 20: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

How does TANGO solve the constraints of activity

distribution and of interoperability of the

heterogeneous components?

Page 21: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Machine A

SE1

Application 1

Application 2

L

L

Machine B

Application 4

L

Application 3

L

SE2

?

?

?

TANGO: introduction

Page 22: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Machine A

Application 1

Application 2

Machine B

Application 3

Application 4

L

L

L

L

SE1 SE2

Page 23: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Machine A

Application 1

Application 2

Machine B

Application 3

Application 4

L

L

L

L

SE1 SE2

Page 24: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Machine A

Application 1

Application 2

Machine B

Application 3

Application 4

L

L

L

L

SE1 SE2

Page 25: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Machine A

Application 1

Application 2

Machine B

Application 3

Application 4

L

L

L

L

SE1 SE2

Page 26: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Distributed Application

Page 27: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Page 28: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Page 29: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Page 30: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Page 31: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Dev DevDev Dev

DevDev Dev

DevDev

Dev Dev Dev

TANGO: introduction

TANGO software Bus

• An abstract concept: the «device»– Central element of the architecture

• Tango is based on CORBA – a standard for the administration of communications

between software components making up distributed and heterogeneous applications)

Page 32: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device

Dev DevDev Dev

DevDev Dev

DevDev

Dev Dev Dev

TANGO Software Bus

Device

Hardware

• 1 Device :– Is the software representative for an equipment in the control system – Represents absolutely different equipments under a common software

structure

Page 33: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: introduction

Page 34: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO Chronology

Page 35: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO at the ESRF

• Birth at the ESRF in 1999• TANGO is an evolution of TACO

– As a concept, TANGO is not an absolutely new system

– However, TANGO et TACO are 2 source codes, which are totally disconnected

• Put into production on the ESRF Machine and used for a brand new development

– Synch. booster sextupole control, SR current transformer, vacuum equipment, fluid equipment, alarm system, image acquisition, global feedback

– ID14 biocrystallo beamline

Page 36: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

ESRF-SOLEIL Collaboration

• First Software Development Plan defined in April 2002

• Cooperation Agreement in the Field of Control-Software for Accelerators and Beamlines:– Technical coordinators and regular meetings – Equal contributions from both parties– Intellectual properties and licensing policy (GNU)– Software plan:

• Short-term developments to add essential missing features

• Middle-term ones

officially firmed the 20th of June 2002

TANGO a strategical choice

Page 37: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

• First realizations milestone : Q3 2002– User environments bindings: MATLAB, IGOR , Python– Configuration tool: jive– Supervision tool : devicetree

• Milestone : Q1 2003– Historical Database– Logging services– Packaging and common source repository– Port to another CORBA layer: ORBACUS OMNIORB– Asynchronism: point-to-point communication scheme

• Milestone : Q2 2003– Events: many-to-many communication schemes– Python device servers

ESRF-SOLEIL CollaborationIN

P

RO

GR

ES

SD

ON

E

Page 38: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO – current Resources

ESRF 4 (almost) fulltime programmers 4 halftime programmers

Soleil 3 fulltime programmers 2 halftime programmers

We hope that other institutes will join TANGO as : Regular users Taking part in developments

FRM II: New German neutrons source

LLB: CEA/CNRS neutrons source Elletra : third generation Italian

Synchrotron Others …

                                                              

Page 39: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Tango: some more links

• The source code is available on SourceForge– http://sourceforge.net/projects/tango-cs– There is still much to improve to make this

distribution easily usable

• The ESRF site is still a reference– http://www.esrf.fr/computing/cs/tango/index.html

• The collaboration site SOLEIL/ESRF presents projects under development– http://www-controle.synchrotron-soleil.fr:8001/

Page 40: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

- II -Basic concepts

Page 41: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

What is a Device ?

Page 42: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device

• an abstract concept: the «device»– central element in the architecture

O OO O

OO O

OO

O O O

Application RépartieControl system

Dev DevDev Dev

DevDev Dev

DevDev

Dev Dev Dev

Page 43: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: definition

• device = 1 <entity> to control– Hardware or software – «physical» device / «logical» device

• device = 1 polymorphous object – 1 hardware (ex: 1 power supply)– 1 collection of equipment (ex: 1 motor + 1 coder)– 1 cluster of devices (ex: a beamline)

Page 44: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Interface HWEquipment

Ctrl/power supply switch.

TANGO: device: definition

Device

BOO-B1/VI/PI55-3

SC User

Equipment

Ionic pump

Single Identifier (SOLEIL list)

• device = 1 equipment– Most simple and standard case

Page 45: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: definition

• 1 Device is also a services provider, which– Describes services provided by a group of

equipment

Software Bus

lambda MotorDevice

phi MotorDevice

Theta MotorDevice

MonochromateurDevice

energy

Page 46: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

TANGO Software Bus

Device Mouse

interface

Device Keyboard

interface

Page 47: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

• Connect your Device to the bus – Start-keyboard.bat

• Start an application to display your Device– Start-keyboardpanel.bat

• Discover the Device Keyboard interface– NumLockOff et NumLockOn

Page 48: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

TANGO Software Bus

DeviceSupervisor

Page 49: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

• The DeviceSupervisor– Sums up your mouse movements by asking the position to

the Device Mouse– If you do not move it enough, it will have the Device

Keyboard flash

• Start the Device Supervisor and its command panel– Start-supervisor.bat et Start-supervisorpanel.bat

• Start the monitoring of your mouse movements– SupervisionMouseOn

• Check that the Device Supervisor :– Provides 1 service, which depends on basic services

provided by Mouse and Keyboard basic devices

Page 50: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: definition

• 1 Device is also a services provider, which– Describes the service provided by another system to which it is interconnected

– note : this software interconnection must be made available: this possibility must be mandatorily requested from suppliers

TANGO Software Bus

DeviceLINAC

Ou SCIENTA

provider Control system

Page 51: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

What is an interface ?

Page 52: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface

• Each Device has a communication interface

– interface = commands + attributes• commands actions• attributes physical units

Hardware control code

InterfaceCommands Attributes

Generics Specifics Generics Specifics

InitStateStatus

PowerOnPowerOff - current

TANGO Software Bus

Page 53: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Commands

•Generics commands•Specifics commands

Page 54: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

• Has a communication interface – interface = commands + attributes

• commands actions• attributes physical units

Hardware control code

InterfaceCommands Attributes

Generics Specifics Generics Specifics

InitStateStatus

PowerOnPowerOff - current

TANGO Software Bus

Page 55: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: generics command

• Generics commands exist for EVERY type of Device• Their name is supposed to describe what is expected

from them!!– Info: on which machine does the Device run, etc ..– Ping: tries to communicate with the Device– BlackBox: list of commands last executed on the

Device– Init: reinitializes the Device– State: 1 of the 14 predefined states of TANGO:

• ON, OFF, ALARM– Status: Device status in text format :

• « motor has reached limit switch »

Page 56: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise: generics commands

• Start the tool to display the Device Supervisor– Start-supervisorpanel.bat

• Check that Init, State, Status commands are also available on Mouse and Keyboard

• Execute Init command on Supervisor– What’s happening ?

Page 57: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

• The specifics commands– Are defined by the Device developer– have : 0 or 1 in argument (argin)– give : 0 or 1 out argument (argout)

• argin & argout = 1 of the 20 TANGO types• Execution :

– launch the command_inout function with the following arguments :• command name• In parameter of the command• Output:

– result of command execution

Page 58: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

TANGO Desc MatlabDEV_VOID no argin and/or no argout -

DEV_STATE device status 1-by-n char array

DEV_STRING characters array 1-by-n char array

DEV_BOOLEAN boolean 1-by-1 uint16 array

DEV_SHORT Signed 16 bits integer 1-by-1 int16 array

DEV_USHORT Unsigned 16 bits integer 1-by-1 uint16 array

DEV_LONG Signed 32 bits integer 1-by-1 int32 array

DEV_ULONG Unsigned 32 bits integer 1-by-1 uint32 array

• About argin & argout types…

DEV_FLOAT 32 bits floating point 1-by-1 single array

DEV_DOUBLE 64 bits floating point 1-by-1 double array

DEVVAR_CHARARRAY table of bytes (i.e. characters ) 1-by-n char array

DEVVAR_ SHORTARRAY table of signed 16 bits integers 1-by-n int16 array

DEVVAR_ USHORTARRAY table of unsigned 16 bits integers 1-by-n uint16 array

DEVVAR_ LONGARRAY table of signed 32 bits integers 1-by-n int32 array

DEVVAR_ ULONGARRAY table of unsigned 32 bits integers 1-by-n uint32 array

DEVVAR_ FLOATARRAY table of 32 bits floating points 1-by-n single array

Page 59: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

TANGO Desc Matlab

DEVVAR_ DOUBLEARRAY table of 64 bits floating points 1-by-n double array

DEVVAR_ STRINGARRAYtable of unbound strings of

characters1-by-n cell array of {1-by-n char array}

DEVVAR_LONGSTRINGARRAYstructure comprehending a table of

signed 32 bits integers and a table of strings of characters

1-by-n struct array { field lvalue: 1-by-n int32 array field svalue: 1-by-n cell array of {1-by-n char array} }

DEVVAR_DOUBLESTRINGARRAYstructure comprehending a table of 64 bits floating points and a table of

strings of characters

1-by-n struct array { field dvalue: 1-by-n double array field svalue: 1-by-n cell array of {1-by-n char array} }

• About argin & argout types…

Page 60: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

• Syntaxe from bindings– Prog. Env. OO (C++, Java, Python)

argout = dev.command_inout (cmd_name, argin)argout = dev.command_inout (cmd_name, argin)

– User Env. (Matlab, Igor Pro, …)

argout = tango_command_inout (dev_name, argout = tango_command_inout (dev_name, cmd_name, argin)cmd_name, argin)

– Python example:>> from PyTango import *>> mouse= DeviceProxy ("px1/tdl/mouse")>> mouse.command_inout(“Center")  >> mouse.command_inout(“ChangeCenter“,[10,10])

Page 61: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

• On the Mouse Device, execute the following commands with arguments:– Change center definition in executing

• ChangeCenter(newcenter_X, newcenter_y)

– Change cursor shape with • ChangeCursor(« help »)

Page 62: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

• Name and signature of commands ?– Device documentation

• http://controle/DeviceServers/Galil/doc_html– Prog. env. OO (C++, Java, Python)

• cmd_list_info = dev.command_list_query () • cmd_info = dev.command_query (cmd_name)

– User env. (Matlab, Igor Pro, …)• cmd_list_info = tango_command_list_query (dev_name) • cmd_info = command_query (dev_name, cmd_name)

– Python examples:• >> com_info = mouse.command_query("ChangeCenter")• >> print com_info.cmd_name• >> print com_info.cmd_tag• >> print com_info.in_type• >> print com_info.out_type• >> print com_info.in_type_desc  • >> print com_info.out_type_desc  

Page 63: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

• On the Mouse Device, execute the following commands– Change center definition in executing

• ChangeCenter(5000,200)• Is the command executed?

– Idem with changing the cursor shape with• ChangeCursor(« square»)

Page 64: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: command

Page 65: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Attributes

Page 66: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface

• Has a communication interface – interface = commands + attributes

• commands actions• attributes physical units

Hardware control code

InterfaceCommands Attributes

Generics Specifics Generics Specifics

InitStateStatus

PowerOnPowerOff - current

TANGO Software Bus

Page 67: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device interface: attribute

• Definition– Physical unit produced or administrated by the device– ex: motor position, power emitted by a power supply, …

• Format– from 0 to 2 dimensions

• SCALAR • SPECTRUM (i.e. vector)• IMAGE (i.e. matrix)

• Type• DEV_SHORT, DEV_LONG, DEV_DOUBLE

– scalar, spectrum or image

• DEV_STRING– scalar only

Page 68: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: attribute

• Accessibility– READ

• read-only access– WRITE

• write-only access– READ_WRITE

• Read-and-write only access• set values vs actual value

Page 69: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: attribute

• List of attributes ?– Device documentation

• http://controle/DeviceServers/Galil/doc_html– Prog. env. OO (C++, Java, Python)

• attr_list = dev.get_attribute_list () – User env. (Matlab, Igor Pro, …)

• attr_list = tango_get_attribute_list (dev_name) – Python example:

• >> attr_list = mouse.get_attribute_list()

Page 70: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: attribute

• Obtain the attribute’s current value?– READ, READ_WRITE attributes – Read Result => structure { read value + infos }

• name : name of the attribute• quality : quality of the return value

– ATTR_VALID : ok, the return value is valid– ATTR_ALARM : an alarm threshold was crossed. (cf. min_alarm et max_alarm)– ATTR_INVALID : error, undefined value

• dim_x : dim.x of the value (dim_x <= attr_config.max_dim_x) • dim_y : dim.y of the value (dim_y <= attr_config. max_dim_y) • timestamp : value stamp • value : instant time attribute value <timestamp>

– SCALAR » READ : [0 : val] » READ_WRITE et READ_WITH_WRITE : [0:measure, 1:set value]

– SPECTRUM» [0 : measure, …, dim_x – 1 : measure]

– IMAGE » [0 : measure, …, dim_x – 1 : measure] x [0 : measure, …, dim_y – 1 : measure]

Page 71: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: attribute

• Obtain the current value of an attribute?– Prog. Env. OO (C++, Java, Python)

• dev.read_attributes (attr_name_list)

– User Env. (Matlab, Igor Pro, …)• tango_read_attribute (dev_name, attr_name)• tango_read_attributes (dev_name, attr_name_list)

• Python Example:>> x = mouse.read_attribute ("positionX")

>> print x.value

>> x.value=100

>> mouse.write_attribute (x)

Page 72: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: interface: attribute

• Modify the value of an attribute ?– WRITE, READ_WRITE attributes – attr_config.min_value <= set value <= attr_config.max_value

• Error, if not– Prog. env. OO (C++, Java, Python)

• dev.write_attributes (attr_val_list)– User env. (Matlab, Igor Pro, …)

• tango_write_attribute (dev_name, attr_name, value)• tango_write_attributes (dev_name, attr_name_attr_value_struct_list)

– Python example:• x = mouse.read_attribute ("positionX")• y = mouse.read_attribute ("positionY")• x.value=100• y.value=200• mouse.write_attribute(x)• mouse.write_attributes ([x,y])

Page 73: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Statuses

Page 74: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device: status

• 1 device -> 1 status– behavior = f (internal status)

• query -> internal status -> execute or error• internal status generated by the device developer

– 14 predefined statuses • ON, OFF, CLOSE, OPEN, INSERT, EXTRACT, MOVING,

STANDBY, FAULT, INIT, RUNNING, ALARM, DISABLE, UNKNOWN

• a color code defined by Tango is associated to each status

• Obtain a device current status?– Prog. env. OO (C++, Java, Python)

• dev.state () – User env. (Matlab, Igor Pro, …)

• dev_state = tango_state (dev_name)– Python example :

• print mouse.state()• print mouse.status()

Page 75: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device

Page 76: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

DeviceServer

Page 77: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: device server

DevDev Dev

Bus Logiciel TANGO

DevDev Dev

TANGO Software Bus

• Practically, 1 executable called DeviceServer– Is in charge of « connecting » several Devices to the bus – The system can be parameterized so as to change the list of Devices, which 1 DeviceServer has to administrate

Device Server

DServer

DeviceDeviceDevice

Page 78: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Supervision: Exercise

• Start start-2supervisorspanel.bat• Check that 2 Supervisor devices are

connected to the bus software• Stop the DeviceServer supervisor.exe• Check on the control panel that the 2

Supervisor devices are not available

Page 79: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

- Part IV -Temporary

conclusion on TANGO

Page 80: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Tango: perimeter

DeviceDevice

Bus Logiciel TANGO

LoggingMonitoringConfiguration

(motor…)

Hardware

(E/S…)

Hardware

Archivageenvironments Utilisateurs:

MATLAB, IGOR, python, Labview

DeviceDeviceDevice

TANGO Software Bus

LoggingMonitoringConfigurationConfiguration

Hardware

(E/S…)

Hardware

ArchivingUsers

environments:MATLAB, IGOR, python, Labview

Bindings

Ready-to-useHigh-level Applications

The bus and Devices development tools

Page 81: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO: APIs and platforms

• Programming APIs/Languages– C++ (performances)– Java (portability)– Python (scripts)– Others (Matlab, Igor Pro, LabView)

• Platforms– Linux– Windows NT/2000/XP– Sun-Solaris

Servers

Clients

Page 82: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Questions…

Page 83: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

How to specify the Devices interfaces

Page 84: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

How to specify a Device

• Define the basic Devices of your system– For example, all your motors

• Think of how helpful a group of equipments can be– A monochromator is a set of motors which provides a service as such

• Describe like attributes the measurable values produced by the Device, which you want to be considered at a high level

– Describe like commands the actions which you want to perform on the Device– Describe the different Device statuses

• A good idea is to start from the control/command operator interface of the system to control – Values displayed are attributes– Boxes/buttons give access to commands

Page 85: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

- Part III -High-level

applications

Page 86: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

- Part III -High-level

applications

Page 87: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Device

Multimeter ADC

Signal

Acquisition

Captor

Device

Logging

TANGO software Bus

SupervisionConfiguration Archiving

High-level applications

Page 88: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration of the control system

Page 89: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration: needs

Properties

ens-[seg]/dom/elem.1

ens-[seg]/dom/elem.2

ens-[seg]/dom/elem.3several of them

myDevice

Commands AttributesStatuses

ID Unique

• Needs– Define equipments present in the experiment

Control/Command system– Parameterize equipments

• Parameters linked to the Hardware (GPIB address, etc.. )

• Min and max attributes values• Alarm thresholds• Etc

Page 90: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration: properties

• Definition– configuration data– concept generalized to all TANGO entities

• Device, attribute

– device property• distinctive feature of the device • defined by the developer• ex: GPIB address of an external device

– attribute property • 18 predefined TANGO properties + …• … properties defined by the developer• ex: attribute initial value

Page 91: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration: properties: example

TANGO software Bus

(Pico…)(Pico…)

• Device property– GPIB address =

10• Properties of the

current attribute– Min_alarm=15– Max_alarm=100

• Device property– GPIB address = 12

• Properties of the current attribute

– Min_alarm=10– Max_alarm=200

Page 92: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration: attribute properties

• Each attribute has 18 properties• generic properties (valid whatever the

attribute)• 8 non modifiable properties

– name : attribute name– data_type : data type (DEV_SHORT, DEV_LONG, …) – data_format : data format (SCALAR, SPECTRUM ou IMAGE) – writable : access mode (READ, WRITE, …)– max_dim_x, max_dim_y : max dimensions

» dim_x <= max_dim_x » dim_y <= max_dim_y

– disp_level : expert or operator– writable_attribute_name :

Page 93: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration: attribute properties

• 10 modifiable properties (user)– description : attr. description (text)– label : label associated to the attr. (text)– unit : unit in which the value associated to the attr. is expressed

(text)– standard_unit : conversion factor to MKSA units (text)– display_unit : unit * standard_unit (text)– format : display format for “numerical” attributes (text)

» keywords : fixed, scientific, uppercase, showpoint, showpos, setprecision(), setw()

» ex : scientific;uppercase;setprecision(3)

– min_value : min. value of a WRITE or READ_WRITE attribute (text)– max_value : max. value of a WRITE or READ_WRITE attribute (text)– min_alarm : alarm threshold <low> of a READ or READ_WRITE

attribute (text)– max_alarm : alarm threshold <high> of a READ ou READ_WRITE

attribute (text)

Page 94: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Configuration: database (static)

• Configuration database– Critical element of the system– unique source of information for devices and clients

• Implementation– 1 dedicated device = TANGO interface of a SGBD– The TANGO_HOST environment variable = host_name:host_port

(ex: localhost:20000) defines the static database that is used

TANGO Software Bus

1 dedicated TANGO device = TANGO interface of a SGBD

1 information storage medium: 1 computing database

Configuration

Page 95: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Jive

Graphical Application for TANGO control system

Configuration: tool

Page 96: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

• Change the min_alarm and max_alarm values of the positionX Mouse attribute

– Move the mouse outside your predefined areas – What’ s happening in the positionX attribute display in

DeviceTree ?

• Modify min_value and max_value values of positionX Mouse attribute

– Modify the value of positionX attribute outside your predefined areas

– What’s happening ?

• Start Test Device window in Jive– Execute generic commands– Check that you do have 18 defined properties for each

attribute

Page 97: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

High-level applications

Device

Multimeter ADC

Signal

Acquisition

Captor

Device

Logging

TANGO Software Bus

SupervisionJive Archiving

Page 98: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Supervision

Page 99: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Supervision: needs

• Needs– Interact with equipments directly

– Have an overview of the status of each piece of equipment

– Monitor the evolution of any Device attribute

Page 100: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

DeviceTree

Generic application to design and customize your graphical interfaces, displaying, for a set of equipment:

• Supported commands (ReadScreen())• Produced attributes : (Voltage,

Temperature,etc )

Supervision: tool

Page 101: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

DeviceTree

Graphical application for the monitoring of a sub-set of the control system

Supervision: tool

Page 102: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Supervision: Exercise

• Customize a DeviceTree panel, in adding drag-and-drop attributes in the attributes table: – PositionX, PositionY

• And commands in the commands table– Center, ChangeCenter

• Save the panel in a file • Restart DeviceTree and reload the new file

Page 103: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

High-level applications

Device

Multimeter ADC

Signal

Acquisition

Captor

Device

Logging

TANGO Software Bus

DeviceTreeJive Archiving

Page 104: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Logging

Page 105: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Logging: needs

• Aims– Follow the acquisition sequencing in progress – Analyze a posteriori the actions/incidents that

happened in the experimental system– Trace precisely the behavior of a part of the

experimental system so as to understand potential failures

Page 106: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

• LogViewr

Visualise, filter and analyse error and information messages, emitted in « real time » by the different Devices of the control system

Logging: tool

Page 107: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise: Logging

• Start the logs visualization tool– Start-tlv-stat.bat

• Restart the Mouse, Keyboard et Supervisor Devices

• Check messages displayed in the logging of the application

• Start the Mouse supervision panel – Start-mouse-panel.bat

• What’s happening upon reading of each mouse position?

Page 108: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Archiving

Page 109: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Archiving : needs

• Record attributes values:– Following specific criteria (frequency or other),

the archiving system is supposed to memorize the values of any attribute of any Device of the control system.

• Extract values recorded by:– client applications (data exploitation) like a

MATLAB application – “ready-to-use” applications, provided by the

computing services.

• Administration of «Set values files»– Memorize values of a set of attributes (at a given

time) in order to be able to restore parameters in the future (Set values files)

• Example: «I want to memorize the structure of my beamline experiment in order to be able to recreate the same conditions in 2 months»

Historical Database

Set values files

Page 110: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Historical database: archiving modes

• Periodical– Archiving is made periodically (Example : Archiving every 3600 seconds )

• Absolute – Archiving starts when the value received is above a specific level (a set value) – Example: given an event received every 10 seconds, value included between [0 ; 10], Suppose the minimum value is 3 and the maximum 8. Every value event included between [0 ; 3] or [8 ;10] will be archived.

• Relative– Archiving is made when the current value is superior to (or is inferior to) a given

percentage of the last recorded value.

• Calculation– Example : archiving of the average of n successive values at a given frequency

• External– Example : storage of the reference to a data that is not a Tango attribute.

Page 111: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

TANGO Software Bus

Static database

Archiving

Historical database

Device Mouse

Device Mouse : Attribut Position X TimeStamp Valeur 22-04-2003 : 15h 23mn 12 s 236 22-04-2003 : 15h 23mn 22 s 354 22-04-2003 : 15h 23mn 32 s 374 22-04-2003 : 15h 23mn 42 s 374

Several databases

Configuration

Archiving

Page 112: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Archiving

Historical database

Device Mouse : Attribut Position X TimeStamp Valeur 22-04-2003 : 15h 23mn 12 s 236 22-04-2003 : 15h 23mn 22 s 354 22-04-2003 : 15h 23mn 32 s 374 22-04-2003 : 15h 23mn 42 s 374

Several databases

Archiving

Page 113: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise: Archiving

• Start the tool which controls archiving– Start-archivage.bat

• Check that Mouse and Keyboard devices attributes do show in the panel

• Parameterize archiving of one of its attributes

• Start archiving

Page 114: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Annex : TANGO in 2 pictures

Page 115: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

And high-level modular applications

DeviceDevice

TANGO Software Bus

LoggingMonitoringConfiguration

(motor…)

Hardware

(E/S…)

Hardware

Archiving Users environments:MATLAB, IGOR, python, Labview

Bindings

Page 116: TANGO TRAINING User Session organised by  SOLEIL Control/Command and Acquisition Group  April 2003

TANGO users training : April 2003 Session

Exercise

TANGO software Bus

Device Mouse

interface

Attributes:

- PositionX (R/W)

- PositionY(R/W)

Commands:

- Center()

Hardware control code