Device Inheritance

I have a design/programming question and would greatly appreciate your opinion/input. Assuming I have a working device server, let's conceptually call this "EngineDS". I know I can create many instances from this device server, and control these instances from a Tango client, with group calls (or otherwise).

However I was wondering if I can create a new device server, say, "AeroplaneDS", which internally has a number of instances of "EngineDS", and controls them internally. The client would then just interact with an instance of "AeroplaneDS". If this is possible, could you perhaps provide a Python example of how I could refer to instances of EngineDS from within AeroplaneDS?

Thanks smile
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,

Some vocabulary first:
- A device server (DS) is a operating system process
- Within a device server process, you have one or several Tango class(es). In C++, this is the class_factory.cpp file which help
you to have one or more Tango class(es) within the same process (assuming the Makefile is also modified)
- For each Tango class embedded in the device server process, you define its device list (using tool like Jive)
- You can have several instances of the same device server process assuming they have different instance name (the parameter you
give on the command line when you start the DS)

Now, I assume your question is about having several Tango classes within the same DS. How a device belonging to Tango class A
talk to a device belonging to Tango class B when Tango class A and Tango class B are in the same device server process?
Device of your Tango class A acts as client for Tango class B device and therefore you write your code as you normally
write a Tango client. You create a DeviceProxy instance to the Tango class B device and then you execute command(s) or R/W attribute.

Hoping this help

Emmanuel
Hi Manu,

That's great, I'll just use the Tango Client API within a Tango Device itself just like you said - perfectly acceptable :)

Cheers,
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
Andrea,

this solution has the advantage that you can have the devices in the same server process or if for performance or whatever reason you need to run them in separate processes or hosts you can do this without changing the code. The API converts the in-process calls to network calls transparently.

This device pattern keeps devices loosely coupled which is better in the long run.

Andy
Hi all,

A related question to having device communication. Assuming a hierarchy, where the parent class is called STATION, and within this station are a multitude of equivalent devices of the class SUBSTATION.

I am using Tango grouping to be able to communicate with all substations from my main station class. Adding/removing SUBSTATION devices to the STATION is not a problem. I now want to run a particular command on all SUBSTATION within my STATION, with something like:

replies = self.station_devices.command_inout(fnName, fnInput)

I am following the API here.

However I get the following error:
PyTango.DevFailed: DevFailed[
DevError[
    desc = ArgumentError: Python argument types in
               __Group.command_inout_asynch(__Group, str, str)
           did not match C++ signature:
               command_inout_asynch(Tango::Group {lvalue} self, std::string cmd_name, std::vector<Tango::DeviceData, std::allocator<Tango::DeviceData> > param, bool forget=False, bool forward=True)
               command_inout_asynch(Tango::Group {lvalue} self, std::string cmd_name, Tango::DeviceData param, bool forget=False, bool forward=True)
               command_inout_asynch(Tango::Group {lvalue} self, std::string cmd_name, bool forget=False, bool forward=True)

It seems Tango is expecting a certain type for "param", however the API doc says this "param" could be of any type.

Any help appreciated.
Cheers,
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
Edited 9 years ago
 
Register or login to create to post a reply.