ska-sa / tango-simlib

Generic data-driven device simulator generation for PyTango
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

read and write Spectrum/Image attribute problem #157

Open liujin001 opened 2 years ago

liujin001 commented 2 years ago

Now tango-simlib can support SPECTRUM and IMAGE attribute addition correctly. but read and write attribute value have some problems.

  1. In Spectrum_SimDD.json file, if we change doubleSpectrum attribute's "quantity_simulation_type" from "ConstantQuantity" to "GaussianSlewLimited" (with mean, std_dev, max_slew_rate, min_bound, max_bound set), then we can not read doubleSpectrum attribute of simulator device, the exception description is: Wrong Python type for attribute doubleSpectrum of type DevDouble. Expected a sequence;
  2. If we set value for the attribute of SPECTRUM and IMAGE data format through sim control device's attribute (by attribute_name and last_val), then the simulator device's attribute of SPECTRUM and IMAGE data format can not read, the exception description is: Wrong Python type for attribute XXX of type DevDouble. Expected a sequence. This may be caused by that last_val is SCALAR format forever, we can only write a scalar value to it. May solution is that if the data format of attribute set by attribute_name is SPECTRUM or IMAGE, we should disable write last_val attribute of sim control device?
kmadisa commented 2 years ago

Thanks @liujin001 for raising these issues.

Now tango-simlib can support SPECTRUM and IMAGE attribute addition correctly. but read and write attribute value have some problems.

  1. In Spectrum_SimDD.json file, if we change doubleSpectrum attribute's "quantity_simulation_type" from "ConstantQuantity" to "GaussianSlewLimited" (with mean, std_dev, max_slew_rate, min_bound, max_bound set), then we can not read doubleSpectrum attribute of simulator device, the exception description is: Wrong Python type for attribute doubleSpectrum of type DevDouble. Expected a sequence;

I tried to think of a use case for using the GaussianSlewLimited simulation type for the SPECTRUM attributes but didn't think it would be needed. But it should be possible to generate the values in a list for that. Would you want each value generated as part of the list be unique?

  1. If we set value for the attribute of SPECTRUM and IMAGE data format through sim control device's attribute (by attribute_name and last_val), then the simulator device's attribute of SPECTRUM and IMAGE data format can not read, the exception description is: Wrong Python type for attribute XXX of type DevDouble. Expected a sequence. This may be caused by that last_val is SCALAR format forever, we can only write a scalar value to it. May solution is that if the data format of attribute set by attribute_name is SPECTRUM or IMAGE, we should disable write last_val attribute of sim control device?

Yes, I think it would be best not to allow writing to the last_val attribute for now.