|
Hello,
Sorry to ask one more question! I would like to create several simulated devices with one sim control device per simulated devices in one device server process. To do so, I have created in database two devices of my simulated Modbus class and I have also created two devices of the ModbusSimControl class. Unfortunately, the device server does not start. Here are the outputs
python Modbus manu
Exiting: Server exited with tango.DevFailed:
DevFailed[
DevError[
desc = RuntimeError: Could not find model with device name or key et/modbus/02. Set the "model_key" device property to the correct value.
origin = File "/home/taurel/.local/lib/python2.7/site-packages/tango/device_class.py", line 553, in __DeviceClass__device_factory
device = self._new_device(deviceImplClass, klass, dev_name)
File "/home/taurel/.local/lib/python2.7/site-packages/tango/device_class.py", line 533, in __DeviceClass__new_device
return klass(dev_class, dev_name)
File "/home/taurel/.local/lib/python2.7/site-packages/tango_simlib/sim_test_interface.py", line 37, in __init__
super(TangoTestDeviceServerBase, self).__init__(dev_class, name)
File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 551, in __init__
self.init_device()
File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 349, in init_device
return get_worker().execute(init_device_orig, self)
File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 1498, in execute
return func(*args, **kwargs)
File "/home/taurel/.local/lib/python2.7/site-packages/tango_simlib/tango_sim_generator.py", line 311, in init_device
super(SimControl, self).init_device()
File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 349, in init_device
return get_worker().execute(init_device_orig, self)
File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 1498, in execute
return func(*args, **kwargs)
File "/home/taurel/.local/lib/python2.7/site-packages/tango_simlib/sim_test_interface.py", line 58, in init_device
'correct value.'.format(self.model_key))
reason = PyDs_PythonError
severity = ERR]
]
Exited
I looked a little into the source code. I noticed something strange in the configure_device_model() function of the tango_sim_generator.py file. here is the code:
def configure_device_model(sim_data_file=None, test_device_name=None):
data_file = sim_data_file
server_name = helper_module.get_server_name()
klass_name = get_device_class(data_file)
if test_device_name is None:
db_instance = Database()
# db_datum is a PyTango.DbDatum structure with attribute name and value_string.
# The name attribute represents the name of the device server and the
# value_string attribute is a list of all the registered device instances in
# that device server instance for the TANGO class 'TangoDeviceServer'.
db_datum = db_instance.get_device_name(server_name, klass_name)
# We assume that at least one device instance has been
# registered for that class and device server.
dev_names = getattr(db_datum, 'value_string')
if dev_names:
dev_name = dev_names[0]
else:
# In case a device name is not provided during testing a
# default name is assigned since it cannot be found in database.
dev_name = 'test/nodb/tangodeviceserver'
else:
dev_name = test_device_name
# In case there are more than one data description files to be used to configure the
# device.
parsers = []
for file_descriptor in data_file:
parsers.append(get_parser_instance(file_descriptor))
# In case there is more than one parser instance for each file
model = Model(dev_name)
for parser in parsers:
model_quantity_populator = PopulateModelQuantities(parser, dev_name, model)
sim_model = model_quantity_populator.sim_model
PopulateModelActions(parser, dev_name, sim_model)
return model
This function is called with test_device_name set to None. Therefore device names are fetched from the database using the db_instance.get_device_name() method but only the first returned device name is used (dev_name = dev_names[0])
Then my question is: Is it possible to have within the same device server process several simulated devices which each of them having their own sim control device?
Thank's for your time
Emmanuel
|