How to get histroy from hdb++?
|
|
---|---|
I have started to archiving 1 element. And I understood that hdbpp server working in docker(tangobox-hdbpp), and I am connecting to mysql in the docker: And now I have 1 problem, where history saving? And how I can get it in python or c++? I didn't found example in the libraries https://github.com/tango-controls-hdbpp Thanks. |
|
|
---|---|
Hi, I think today and tomorrow are official holidays in Spain in Italy. So before you get potentially more details from the HDB++ specialists living in these countries, I can already give you some information. If you have an attribute which is a DevDouble SCALAR Read/Only attribute, the history data is saved in att_scalar_devdouble_ro table. You will need to retrieve the att_conf_id of your attribute. You can get it from att_conf table but I think you already figured that out. In MySQL HDB++ DB schema, you can find out the data type and format of a stored attribute using the att_conf_data_type_id field value from att_conf, and then look for the value of the corresponding data type and format in att_conf_data_type table. For instance for a DevDouble SCALAR Read Only attribute, att_conf_data_type_id value will be 5, which corresponds to scalar_devdouble_ro value in att_conf_data_type table. For the extraction of data from python, you can use pytangoarchiving. https://github.com/tango-controls/PyTangoArchiving https://tango-controls.readthedocs.io/en/latest/tutorials-and-howtos/how-tos/how-to-pytangoarchiving.html From C++, maybe our friends from Elettra have something available? Hoping this helps. Kind regards, Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new. |
|
|
---|---|
Hi, In the tango box you should find a java application called hdbpp-viewer; this will allow you to plot and extract the recorded data. From PyTangoArchiving you can extract the data with this python code: import PyTangoArchiving api = PyTangoArchiving.HDBpp(host='yourhostname',db_name='yourdbname',user='…',passwd='…') data = api.get_attribute_values('attribute_name','YYYY-MM-DD','YYYY-MM-DD') #attribute, start date, stop date Please, report here if it worked properly Sergi |
|
|
---|---|
Hi, thank you. I have goten PyTangoArchiving and fandango from pip. Now I can get archive and stop attr archiving, but how I can start archiving attr? My script: #!/usr/bin/python # -*- coding: utf-8 -*- import PyTango import PyTangoArchiving # connect to the docker registry.gitlab.com/s2innovation/tangobox-docker/tangobox-hdbpp:latest api = PyTangoArchiving.HDBpp(host='172.18.0.7', db_name='hdbpp', user='root', passwd='tango') data = api.get_attribute_values('tangobox:10000/ECG/ecg/1/Lead','2020-12-01','2020-12-15') #attribute, start date, stop date #print(data) #api.stop_archiving('tangobox:10000/ECG/ecg/1/Lead') api.start_archiving(['tango://tangobox:10000/ECG/ecg/1/Lead'], {'MODE_P':[60000],'MODE_R':[15000,1,1]}) start_archiving not working: HDBpp(hdbpp@172.18.0.7) ERROR 2020-12-10 03:46:37.957: start_archiving(tango://tangobox:10000/ECG/ecg/1/Lead): Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/PyTangoArchiving-8.15.0-py2.7.egg/PyTangoArchiving/hdbpp/config.py", line 823, in start_archiving archiver = fn.tango.get_full_name(archiver,fqdn=True) File "/usr/local/lib/python2.7/dist-packages/fandango-14.8.1-py2.7.egg/fandango/tango/methods.py", line 205, in get_full_name model = model.split('tango://')[-1]AttributeError: 'dict' object has no attribute 'split' in function get_full_name sending {'MODE_P':[60000],'MODE_R':[15000,1,1]} def get_full_name(model,fqdn=None): ____""" ____Returns full schema name as needed by HDB++ api ____""" ____model = model.split('tango://')[-1] ____ ____…. And everything have broken ), in the model = model.split('tango://')[-1] because model is {'MODE_P':[60000],'MODE_R':[15000,1,1]} |
|
|
---|---|
I and my boss have understood how to (start, stop, add, remove) attr to arhiving. We are using python module tango. Later I am writing how do it. This was very hard ;) We were watching source code for example (hdbpp-configure) |