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  <20172018  2019  2020  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  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: saving samples
From: Pete Jemian <[email protected]>
To: <[email protected]>
Date: Tue, 13 Jun 2017 11:34:51 -0500
I use an swait record (from synApps calc module: https://github.com/epics-modules/calc) to do this type of thing when the value is a number, not an array. For strings, there is a similar scalcout record.

Here's an example with swait using a random number generator where the current and previous three values are buffered and then averaged.

record(swait, "random_signal") {
    field(DESC, "example random signal")
    field(CALC, "rndm")
}
record(swait, "memory_example") {
    field(DESC, "average of last four values")
    field(INAN, "random_signal")
    field(INAP, "Yes")
    field(INBN, "memory_example.A")
    field(INBP, "No")
    field(INCN, "memory_example.B")
    field(INCP, "No")
    field(INDN, "memory_example.C")
    field(INDP, "No")
    field(CALC, "(A+B+C+D)/4")
    field(SCAN, "I/O Intr")
}

Each of the last buffered values is available:

memory_example.A    current value of monitored signal "random_signal"
memory_example.B    previous value of memory_example.A
memory_example.C    previous value of memory_example.B
memory_example.D    previous value of memory_example.C
memory_example.VAL  average of these four values


The swait record provides up to 12 fields (letters A-L): the 11 most recent values could be buffered by extending this example.

HTH,
   Pete


On 06/13/2017 11:06 AM, Miguel Bordalo wrote:
save in another PV the last sample (scalar) (or more samples) of other
PV that is updated periodically.
this is for example: i have the temperature of a room being updated
periodically. I want another PV to act as a buffer that stores the last
two samples of the room's temperature . And i want to be able to acess
them individually of course.
Thanks!

-------------------------------------------------------------------------
*Miguel Bordalo*

Licenciado em Engenharia Electrotécnica e de Computadores
Instituto Superior Técnico

[email protected] <mailto:[email protected]>


On 13 June 2017 at 16:01, Ralph Lange <[email protected]
<mailto:[email protected]>> wrote:

    Please clarify a bit further.

    What do you mean by "save"?

        Write to a file? Store in an archiver? Write to another record?

    What kind of PV?

        Scalar or array data?

        If array: does "last" mean last array in time, or last element
        in array?


    Cheers,
    ~Ralph


    On Tue, Jun 13, 2017 at 4:18 PM, Miguel
    <[email protected] <mailto:[email protected]>>
    wrote:

        What is the easiest way to save periodicaly the last sample (or
        last 2/3 samples) of a certain PV ?

        ty




--
----------------------------------------------------------
 Pete R. Jemian, Ph.D.                <[email protected]>
 Beam line Controls and Data Acquisition, Group Leader
 Advanced Photon Source,   Argonne National Laboratory
 Argonne, IL  60439                   630 - 252 - 3189
-----------------------------------------------------------
    Education is the one thing for which people
       are willing to pay yet not receive.
-----------------------------------------------------------


Replies:
Re: saving samples Pete Jemian
Re: saving samples Miguel Bordalo
References:
saving samples Miguel
Re: saving samples Ralph Lange
Re: saving samples Miguel Bordalo

Navigate by Date:
Prev: Re: saving samples Miguel Bordalo
Next: Re: saving samples Pete Jemian
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: saving samples Miguel Bordalo
Next: Re: saving samples Pete Jemian
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·