Memorized Attributes

18 views
Skip to first unread message

Christophe Chappet

unread,
Jun 29, 2016, 2:57:25 AM6/29/16
to ta...@esrf.fr

Hi Tangoers,

I try to set the memorized option on an attribut using W7 - Python 2.7.11 - PyTango 8.1.6

The declaration of the attribut is :

                                'freeze' : [ [        PyTango.ArgType.DevBoolean,
                                                        PyTango.AttrDataFormat.SCALAR,
                                                        PyTango.AttrWriteType.READ_WRITE],

but when I try this :

        MAttr = self.get_device_attr()
        attr = MAttr.get_attr_by_name("freeze")
        attr.set_memorized(True)

I get that :

-------> Received a DevFailed exception: DevFailed[
DevError[
    desc = AttributeError: 'WAttribute' object has no attribute 'set_memorized'
          
  origin =   File "C:\Python\lib\site-packages\PyTango\device_class.py", line 518, in __DeviceClass__device_factory
    device = self._new_device(deviceImplClass, klass, dev_name)
  File "C:\Python\lib\site-packages\PyTango\device_class.py", line 498, in __DeviceClass__new_device
    return klass(dev_class, dev_name)
  File "D:\cchappet\git\PyGMT\src\PyGMT\GMTTango\devices\Survbal\SurvbalManagerImpl.py", line 30, in __init__
    attr.set_memorized(True)

what am I doing wrong ?
Cheers,
Christophe

--
Christophe CHAPPET  -  DSFM/GF2I
Responsable Unité Informatique et Instrumentation
Responsable Projet MORPHO
Tél: + 33 6 38 10 33 09  -  Fax : + 33 5 61 56 63 63

ONERA - The French Aerospace Lab - Centre du Fauga-Mauzac
Nous suivre sur:
www.onera.fr | Twitter |  LinkedIn | Facebook

Avertissement/disclaimer http://www.onera.fr/onera-en/emails-terms

message-footer.txt

Nexeya TANGO Team

unread,
Jun 29, 2016, 5:30:43 AM6/29/16
to Christoph...@onera.fr, ta...@esrf.fr

Hi,

 

I think you have to try :

 

attr.set_memorized()

attr.set_memorized_init(False or True) // reload the value in db

 

Sébastien GARA

Ingénieur d’études - Formateur TANGO / Research engineer - TANGO Trainer

 

NEXEYA France

24 avenue de Pasleck

CS 30019

16400 La Couronne

France

Tel: 33 (0)5.45.24.22.36

sebastien.gara@nexeya.com / www.nexeya.com

 

Retrouvez-nous sur / Find us on :

https://plus.google.com/u/0/b/116619432754563830101/116619432754563830101/posts         

http://www.youtube.com/channel/UCJzQii0D-woM0vHX7DSerSQ

http://www.dailymotion.com/nexeya

 

Afin de contribuer au respect de l'environnement, merci de n'imprimer ce courriel qu'en cas de nécessité.
Ce message et les fichiers pouvant être attachés sont confidentiels, réservés à l'usage unique des destinataires et n'engagent NEXEYA sous aucune forme que ce soit.
This email and any files transmitted with it are confidential, intented solely for the unique use of the recipients and don't commit NEXEYA.

 

De : Christophe Chappet [mailto:Christoph...@onera.fr]
Envoyé : mercredi 29 juin 2016 08:57
À : ta...@esrf.fr
Objet : Memorized Attributes

message-footer.txt

Christophe Chappet

unread,
Jun 30, 2016, 3:27:12 AM6/30/16
to Nexeya TANGO Team, ta...@esrf.fr

Hi Sébastien,

I think I have to learn reading documentation :-( , you are right, no parameter for set_memorized()

Nevertheless, it still doesn't work.

Using the attached example, I get :

desc = AttributeError: 'WAttribute' object has no attribute 'set_memorized' with PyTango.AttrWriteType.READ_WRITE

desc = AttributeError: 'Attribute' object has no attribute 'set_memorized' with PyTango.AttrWriteType.READ

That's true, set_memorized is only defined in Attr class.
How can I get a handle on an Attr attribute ?
TestDeviceServer.py
message-footer.txt

Christophe Chappet

unread,
Jun 30, 2016, 3:30:18 AM6/30/16
to jmoldes, ta...@esrf.fr

Hi Jairo,

Thanks, it works this way.

Christophe

Le 29/06/2016 à 09:09, jmoldes a écrit :
You can set attribute properties when defining the list of attributes. For 
example:

    attr_list = {
       ...
        'RFDelta':
            [[PyTango.DevDouble,
              PyTango.SCALAR,
              PyTango.READ_WRITE],
             {
                'unit': 'Hz',
                'memorized': 'true'
            }],
       ...
    }

Memorized value can be "true_without_hard_applied" or "true", which correspond 
to the tango cpp versions MEMORIZED and MEMORIZED_WRITE_INIT explained  in 
section A.2.2.1.3 of:
http://ftp.esrf.fr/pub/cs/tango/tango_92.pdf

Hope this helps. Regards,
Jairo

On Wednesday 29 June 2016 08:56:39 Christophe Chappet wrote:
message-footer.txt

Christophe Chappet

unread,
Jun 30, 2016, 4:26:36 AM6/30/16
to jmoldes, ta...@esrf.fr

Last question, what is the best way to initialize the value of a memorized attribute ?

Do I have to create a "__value" property for each attribute or is there a clever way ?

Christophe

message-footer.txt

Emmanuel TAUREL

unread,
Jun 30, 2016, 9:32:57 AM6/30/16
to ta...@esrf.fr
Hi Christophe,


On 30/06/2016 10:26, Christophe Chappet wrote:

Last question, what is the best way to initialize the value of a memorized attribute ?

Do I have to create a "__value" property for each attribute or is there a clever way ?

Not at all, this is automatically managed by Tango

Cheers

Emmanuel

message-footer.txt

Christophe Chappet

unread,
Jun 30, 2016, 9:45:22 AM6/30/16
to tau...@esrf.fr, ta...@esrf.fr

Yes, I realized that I just have to initialize the class variable and it's works.

The read_myattribut is only called is myattribut is not initialised in the database.

    attr_list = {                'instrument' : [ [        PyTango.ArgType.DevString,
                                                        PyTango.AttrDataFormat.SCALAR,
                                                        PyTango.AttrWriteType.READ_WRITE],
                                                     {
                                                        'label':"instrument",
                                                        'unit':"",
                                                        'format':"",
                                                        'memorized': 'true',
                                                      } ],
                 }
   
class TestDeviceServerImpl(PyTango.Device_4Impl):

    def __init__(self,cl,name):
        PyTango.Device_4Impl.__init__(self,cl,name)
        self.instrument = "1234"
       
    def read_instrument(self, the_att):
        the_att.set_value(self.instrument)

Thanks,

Christophe

message-footer.txt
Reply all
Reply to author
Forward
0 new messages