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:
[...]
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
|