EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Camonitor with client dictated update rate
From: Emanuele Laface via Tech-talk <[email protected]>
To: Hinko Kocevar <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 4 Jun 2019 08:28:56 +0000
Andrew and Hinko,

thanks a lot, this is exactly what I was thinking and it works perfectly.
e.

> On 3 Jun 2019, at 22:43, Hinko Kocevar <[email protected]> wrote:
> 
> Thank you very much Andrew!   I was about to dive into base code (and eventually bother Ralph while here at ITER collaboration meeting) to help me with a POC code for this use case.
> 
> Emanuele, I've just added Andrew's decimate.c to the LEBT FC EPICS base code and recompiled FC IOC.
> 
> If you use the suffix '.{"dec":{"n":3}}' with any of the FC PVs, you should be decimating update rate by 3.. use '.{"dec":{"n":14}}' to get once a second update rate with 14hz machine repetition rate.
> 
> Example of decimating with 3, on a scalar PV:
> 
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV.{"dec":{"n":3}} 2019-06-03 22:26:52.406211 175
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:52.905615 176
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:53.405869 177
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:53.906040 178
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV.{"dec":{"n":3}} 2019-06-03 22:26:53.906040 178
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:54.405597 179
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:54.906160 180
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:55.406045 181
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV.{"dec":{"n":3}} 2019-06-03 22:26:55.406045 181
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:55.906312 182
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:56.406191 183
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV 2019-06-03 22:26:56.905855 184
> LEBT-020:PBI-FC-001:AMC31-ArrayCounter_RBV.{"dec":{"n":3}} 2019-06-03 22:26:56.905855 184
> 
> 
> or with decimation of 14 on a waveform:
> 
> [dev@fc-01 fcioc-R1-2]$ camonitor -# 10 LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 'LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData.{"dec":{"n":14}}'
> 
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:17.902296 10 -0.089574 0.113525 -0.101521 -0.161256 -0.06568 -0.113468 -0.053733 -0.041786 0.05379 -0.041786
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:18.402304 10 -0.113468 -0.113468 -0.005945 -0.077627 0.006002 -0.101521 -0.101521 -0.06568 -0.017892 -0.137362
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:18.902304 10 0.017949 0.006002 -0.005945 -0.125415 -0.041786 -0.053733 -0.077627 -0.041786 -0.077627 -0.125415
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:19.402315 10 -0.101521 -0.209044 -0.149309 -0.161256 -0.077627 -0.041786 -0.06568 0.113525 0.006002 -0.017892
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:19.902315 10 0.006002 -0.077627 -0.077627 -0.041786 -0.101521 -0.053733 -0.101521 -0.101521 -0.041786 -0.089574
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:20.402325 10 0.05379 0.041843 -0.005945 -0.041786 -0.029839 -0.005945 0.101578 0.017949 -0.041786 -0.053733
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:20.902325 10 -0.005945 0.017949 0.077684 -0.029839 -0.089574 -0.053733 -0.017892 -0.041786 -0.053733 -0.101521
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:21.402332 10 -0.173203 -0.089574 -0.089574 0.006002 -0.089574 -0.161256 0.029896 -0.125415 -0.101521 -0.101521
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:21.902332 10 -0.077627 -0.053733 -0.041786 -0.125415 -0.005945 -0.029839 -0.113468 -0.005945 -0.017892 -0.029839
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:22.402336 10 -0.06568 -0.06568 -0.149309 -0.017892 -0.029839 -0.077627 -0.041786 -0.029839 -0.077627 -0.017892
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:22.902336 10 -0.113468 -0.089574 -0.041786 -0.053733 -0.017892 -0.18515 0.041843 -0.041786 0.065737 0.017949
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:23.402360 10 0.029896 -0.041786 0.017949 0.065737 -0.077627 -0.041786 -0.089574 -0.017892 0.029896 -0.077627
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:23.902360 10 -0.149309 -0.077627 -0.101521 -0.06568 -0.053733 -0.029839 -0.077627 -0.125415 -0.113468 -0.089574
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:24.402369 10 -0.077627 -0.077627 -0.113468 -0.005945 -0.005945 -0.137362 -0.101521 -0.029839 0.05379 -0.06568
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData.{"dec":{"n":14}} 2019-06-03 22:40:24.402369 10 -0.077627 -0.077627 -0.113468 -0.005945 -0.005945 -0.137362 -0.101521 -0.029839 0.05379 -0.06568
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:24.902369 10 -0.017892 0.041843 -0.005945 -0.053733 -0.077627 0.137419 0.006002 -0.125415 -0.017892 -0.029839
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:25.402382 10 -0.005945 0.041843 -0.125415 -0.077627 0.029896 0.017949 0.017949 -0.017892 -0.06568 -0.101521
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:25.902382 10 -0.089574 -0.101521 -0.077627 -0.101521 -0.029839 -0.077627 -0.005945 -0.029839 -0.017892 -0.137362
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:26.402392 10 -0.053733 -0.017892 -0.101521 0.006002 -0.029839 -0.113468 -0.005945 0.017949 0.029896 0.006002
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:26.902392 10 0.017949 -0.017892 0.065737 -0.029839 -0.005945 0.041843 0.006002 -0.077627 -0.053733 -0.029839
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:27.402403 10 -0.113468 -0.149309 -0.017892 -0.101521 -0.089574 0.006002 0.006002 -0.077627 -0.077627 -0.089574
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:27.902403 10 -0.005945 -0.053733 -0.029839 -0.029839 -0.005945 -0.029839 -0.005945 -0.173203 -0.113468 -0.125415
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:28.402411 10 -0.089574 -0.005945 0.041843 -0.029839 -0.017892 -0.173203 -0.101521 -0.077627 -0.125415 -0.005945
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:28.902411 10 -0.077627 -0.053733 0.006002 -0.041786 -0.041786 -0.077627 -0.089574 -0.029839 0.05379 -0.125415
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:29.402421 10 -0.06568 -0.005945 -0.017892 -0.06568 -0.077627 -0.053733 -0.089574 -0.089574 -0.149309 -0.017892
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:29.902421 10 -0.029839 -0.077627 -0.173203 -0.209044 -0.017892 -0.137362 -0.101521 -0.113468 -0.077627 -0.017892
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:30.402432 10 0.065737 0.029896 0.006002 -0.041786 0.041843 -0.041786 0.029896 -0.06568 -0.077627 -0.101521
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:30.902432 10 -0.017892 -0.113468 -0.06568 -0.005945 -0.113468 0.006002 -0.125415 -0.017892 0.017949 -0.041786
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:31.402436 10 -0.053733 -0.005945 -0.041786 -0.029839 -0.029839 -0.029839 0.041843 -0.18515 -0.077627 -0.053733
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData.{"dec":{"n":14}} 2019-06-03 22:40:31.402436 10 -0.053733 -0.005945 -0.041786 -0.029839 -0.029839 -0.029839 0.041843 -0.18515 -0.077627 -0.053733
> LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData 2019-06-03 22:40:31.902436 10 -0.149309 -0.125415 -0.077627 -0.053733 -0.125415 -0.101521 -0.161256 -0.053733 -0.077627 -0.041786
> 
> 
> 
> 
> 
> 
> Cheers,
> hinko
> 
> ________________________________________
> From: [email protected] <[email protected]> on behalf of Emanuele Laface via Tech-talk <[email protected]>
> Sent: Monday, June 3, 2019 9:49:20 PM
> To: Johnson, Andrew N.
> Cc: [email protected]
> Subject: Re: Camonitor with client dictated update rate
> 
> Thanks, I will try this solution as soon as possible.
> e.
> 
> On 3 Jun 2019, at 19:47, Johnson, Andrew N. <[email protected]<mailto:[email protected]>> wrote:
> 
> Hi Emanuele,
> 
> On 6/2/19 4:25 PM, Emanuele Laface via Tech-talk wrote:
> I have this scenario: N PVs of waveforms (arrays) of 10^5 data in each PV.
> The IOc runs at 14 Hz, it means that if I subscribe in monitor mode I will be updated 14 times per second with N x 10^5 numbers.
> 
> Now I have an interface that I want to update just once per second with the content of these waveforms.
> If I am in monitor, I can easily get the value once per second but my python script will anyway use the bandwidth and the cpu to process at 14 Hz because the threads of the monitoring will be updated at that frequency.
> 
> If I use caget once per second I need to deal with all the timeouts that can occur if some pv is down, disconnected, unreachable etc.
> 
> I haven’t find a reliable way to get the data once per second in a full asynchronous mode but without rejecting the data that anyway occupy bandwidth and cpu.
> 
> So from your description you really want/need the filtering to happen at the server. The existing solution for this is to add an additional record to the IOC for each waveform that you want to see at 1 Hz. The "slow data" record would have SCAN="1 second" and its INP link would be a DB link pointing to the equivalent "fast data" waveform record. Then once every second the "slow" record reads the current array from the "fast" record and publishes it from its own VAL field.
> 
> However I just converted the existing "sync" server-side filter into a fairly simplistic "dec" (decimate) filter which allows a client to request only one in every N monitor updates from a channel. Here I'm monitoring a 1Hz counter anj:count but also asking for a decimated view of that counter that gives me only one in three of the updates:
> tux% camonitor anj:count 'anj:count.{"dec":{"n":3}}'
> anj:count                      2019-06-03 12:26:26.719940 16
> anj:count.{"dec":{"n":3}}      2019-06-03 12:26:26.719940 16
> anj:count                      2019-06-03 12:26:27.719992 17
> anj:count                      2019-06-03 12:26:28.719933 18
> anj:count                      2019-06-03 12:26:29.719946 19
> anj:count.{"dec":{"n":3}}      2019-06-03 12:26:29.719946 19
> anj:count                      2019-06-03 12:26:30.719933 20
> anj:count                      2019-06-03 12:26:31.719952 21
> 
> My demonstration shows a scalar value but it will work for any array field too. You can add this filter directly to any 3.15 or later IOC: Just build the attached source file into the IOC and add the registrar entry below to a DBD file that it also loads:
> registrar(decInitialize)
> 
> If this filter works for you I will add it to the next 3.15 release of Base.
> 
> - Andrew
> 
> --
> Complexity comes for free, Simplicity you have to work for.
> 
> 
> <decimate.c>
> 


Replies:
Re: Camonitor with client dictated update rate Hinko Kocevar via Tech-talk
References:
Camonitor with client dictated update rate Hinko Kocevar via Tech-talk
Re: Camonitor with client dictated update rate William Layne via Tech-talk
Re: Camonitor with client dictated update rate Hinko Kocevar via Tech-talk
Re: Camonitor with client dictated update rate Matt Newville via Tech-talk
Re: Camonitor with client dictated update rate Emanuele Laface via Tech-talk
Re: Camonitor with client dictated update rate Johnson, Andrew N. via Tech-talk
Re: Camonitor with client dictated update rate Emanuele Laface via Tech-talk
Re: Camonitor with client dictated update rate Hinko Kocevar via Tech-talk

Navigate by Date:
Prev: RE: Receiving duplicate monitor values using CA PV Gateway Layne (US), William C via Tech-talk
Next: RE: [EXTERNAL] RE: How to share asyn's queue thread among ports? Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Camonitor with client dictated update rate Hinko Kocevar via Tech-talk
Next: Re: Camonitor with client dictated update rate Hinko Kocevar via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 10 Jun 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·