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  <20132014  2015  2016  2017  2018  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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Relative time in XY graph
From: Bruce Hill <[email protected]>
To: EPICS Tech Talk <[email protected]>
Date: Fri, 17 May 2013 19:33:14 -0700
Hi Ralph,
Thanks for the tip!   I hadn't realized we could use a stringin record
that contained a floating point string representation as an input link.
I'm not sure why EPICS doesn't allow us to just access the <PV>.TIME
field and get the same timestamp as a floating point sec since epoch,
but the stringin record works.

Himanshu,
Here's an example below of how to create two compress records (arrays),
one with the values, TST:IOC:Array1, and one with relative timestamps,
TST:IOC:TimeArray1.   

Note the %s format used in TST:IOC:SinValue1:TimeStamp to convert
the epics sec and ns timestamp to a floating point sec since epoch (1970).
That format string supports all the format characters in strftime().

Regards,
- Bruce
record( calc, "TST:IOC:SinValue1" )
{
    field( SCAN, "1 second" )
    field( INPA, "0" )
    field( INPB, "TST:IOC:Array1.NSAM" )
    field( CALC, "SIN(A*d2r);A:=A+(180/B)" )
    field( PREC, 2 )
    field( FLNK, "TST:IOC:Array1" )
}
record( compress, "TST:IOC:Array1" )
{
    field( INP,  "TST:IOC:SinValue1 NPP NMS" )
    field( NSAM, "20" )
    field( ALG,  "Circular Buffer" )
    field( PREC, "5" )
    field( FLNK, "TST:IOC:SinValue1:TimeStamp" )
}
record( stringin, "TST:IOC:SinValue1:TimeStamp" )
{
    field( DTYP, "Soft Timestamp" )
    field( TSEL, "TST:IOC:SinValue1.TIME" )
#   field( INP,  "@%m/%d/%Y %H:%M:%S.%09f" )
    field( INP,  "@%s.%09f" )
    field( FLNK, "TST:IOC:SinValue1:TimeRel" )
}
record( calc, "TST:IOC:SinValue1:TimeRel" )
{
    field( INPA, "TST:IOC:SinValue1:TimeStamp" )
    field( INPB, "0" )
    field( CALC, "B==0?0:(A-B);B:=(B==0?A:B)" )
    field( PREC, 9 )
    field( FLNK, "TST:IOC:TimeArray1" )
}
record( compress, "TST:IOC:TimeArray1" )
{
    field( INP,  "TST:IOC:SinValue1:TimeRel" )
    field( NSAM, "20" )
    field( ALG,  "Circular Buffer" )
    field( EGU,  "sec" )
    field( PREC, "5" )
}


On 05/17/2013 03:20 PM, Ralph Lange wrote:
On Fri May 17 2013 21:37:01 GMT+0200 (CEST), Bruce Hill <[email protected]> wrote:
[...]
One option would be for you to provide a 2nd array for the X PV and
fill it with the time values for each value in your waveform.    The best
way I know how to create the time array would be with the aSub record,
but maybe other EPICS user's may have other ways to do that.


For the time array I'm using a compress record in circular buffer mode (one for each different waveform size/timebase), pointing its INP to a stringin record (one per IOC) that scans every second and shows its own time stamp as seconds since epoch using soft timestamp device support.

~Ralph


-- 
Bruce Hill
Member Technical Staff
SLAC National Accelerator Lab
2575 Sand Hill Road M/S 10
Menlo Park, CA  94025

Replies:
Re: Relative time in XY graph Ralph Lange
References:
Relative time in XY graph Himanshu Tyagi
Re: Relative time in XY graph Himanshu Tyagi
Re: Relative time in XY graph Bruce Hill
Re: Relative time in XY graph Ralph Lange

Navigate by Date:
Prev: Re: PV value logging Bruce Hill
Next: Re: Relative time in XY graph Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Relative time in XY graph Ralph Lange
Next: Re: Relative time in XY graph Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·