TANGO Device Composition

Hi all,

I have created a number of TANGO devices. Some of these devices inherit from other devices, whilst others are standalone. For arguments sake, let's say I have created two base devices, A and B. I then create a device C that inherits from A, and adds some other functionality. So far so good.

I would now like to create a new device D, that does not inherit from A/B/C, but rather, is a new device which is composed of a device of type B and C, plus some other functionality. What's the proper pattern to use in this case?

Note this is not a group, but a composition of very different devices to form another device e.g. A CAR device can be composed of a DIESEL engine, which inherits from a generic ENGINE class, whilst also including a TRANSMISSION device, 4 WHEEL devices etc.

Thanks,
Andrea
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Hi Andrea,

Seems to be an interesting use case.

I would use forwarded attributes/commands to achieve this. Components are defined in the properties. Pseudo code:



@Init
public void init(){

for(Map<String,String[]> prop : properties)
  TangoProxy proxy = …;
  for(Attribute attr : proxy.getAttributes())
     dynamicManager.addAttribute(new Forwarded(…))
  for(Command cmd : proxy.getCommands())
     dynamicManager.addCommand(new Forwarded(…))

}


Forwarded attributes/commands were added in Tango 9. Using Tango <9 you have to manually code proxy attributes/commands. A bit more work though.

Hope this helps…
Hi Ingvord,

Thanks for your input. I'm using Tango 8 for the time being as our development is on PyTango, which is still on version 8.

I had a similar idea, probably even simpler:
1) Create a new device.
2) Register a number of DeviceProxys as global declarations (of course the lower-level devices need to be active in the system)
3) Run all required calls to these devices with command_inout as any other client

Of course by doing things this way, I'd get a working solution, but by accessing the top-level device I can't automatically "drill-down" to the lower-level devices. In order to do that I'd have to use something like forward attributes or manually code attributes which point to the proxies as you suggested above.

Thanks for the information,

Andrea
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
 
Register or login to create to post a reply.