Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/documentation'
Browse files Browse the repository at this point in the history
  • Loading branch information
sergirubio committed Oct 24, 2018
2 parents 53b5989 + aa19d23 commit 43ee88d
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
88 changes: 88 additions & 0 deletions doc/recipes/ConfigureTangoEvents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Configuring Tango Events
========================

The module fandango.tango provides 4 methods to manage attribute events:

.. contents::

check_attribute_events
----------------------

::

def check_attribute_events(model,ev_type=None,verbose=False):
"""
This method expects model and a list of event types.
If empty, CHANGE and ARCHIVE events are tested.
It will return a dictionary with:
- keys: available event types
- value: True for code-pushed events, int(period) for polled-based
"""

check_device_events
-------------------

::

def check_device_events(device):
"""
apply check_attribute_events to all attributes of the device
"""

get_attribute_events
--------------------

::

def get_attribute_events(target,polled=True,throw=False):
"""
Get current attribute events configuration

Pushed events will be not show, attributes not polled may not works
Use check_attribute_events to verify if events are really working
TODO: it uses Tango Device Proxy, should be Tango Database instead to
allow offline checking
"""

set_attribute_events
--------------------

::
def set_attribute_events(target, polling = None, rel_event = None,
abs_event = None, per_event = None,
arch_rel_event = None, arch_abs_event = None,
arch_per_event = None,verbose = False):
"""
Allows to set independently each event property of the attribute
Event properties should have same type that the attribute to be set
Polling must be integer, in millisecons
from fandango 14.3.0 onwards
Setting any event to 0 or False will erase the current configuration
"""
Example
-------

Use them like::

import fandango as fn
curr = 'sr/di/dcct/averagecurrent'
fn.tango.get_attribute_events(curr)
{'arch_event': [0.05, None, 320.0], 'per_event': [1000.0], 'polling': 0}
fn.tango.check_attribute_events('sr/di/dcct/averagecurrent')
Out: {tango._tango.EventType.CHANGE_EVENT: True}
# True means pushed, so the arch_event can be removed
fn.tango.set_attribute_events(curr,arch_abs_event=0,arch_per_event=0)
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ occasional clients (Panic GUI, ipython).
Events are not subscribed, polling is not active, all reads go directly to HW
except those with period < keepTime ; thus returning a Cached value.

Controlling the EventThread
---------------------------

The EventThread can be tuned like::

EventSource.get_thread().setup(period_ms=1000,latency=100,filtered=0.5)

- period_ms will control how often events are processed

- the latency is the maximum drift allowed between event arrival and processing

- if filtered has a value between 0 and 1, it will be the time value relative to the latency that will force event filtering (not processing all events but just the last arrived).

Conditions for Client Polling
-----------------------------

Expand Down

0 comments on commit 43ee88d

Please sign in to comment.