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 2019 2020 2021 2022 2023 2024 2025 | 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 2019 2020 2021 2022 2023 2024 2025 |
<== 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:
-- Bruce Hill Member Technical Staff SLAC National Accelerator Lab 2575 Sand Hill Road M/S 10 Menlo Park, CA 94025 |