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

Subject: Re: Manipulating time in records
From: Andrew Johnson <[email protected]>
To: [email protected]
Cc: Mahajan Kirti <[email protected]>, Di Maio Franck <[email protected]>, Makijarvi Petri <[email protected]>
Date: Mon, 18 Oct 2010 15:26:41 -0500
Hi Franck,

On Monday 18 October 2010 07:56:03 Di Maio Franck wrote:
>
> A typical ITER use case:
>
> "Do A at time T",
> - T: a setting controllable by PV(s),
> - A: an action implemented by a record triggered by an event occurring at
> time T.
>
> We are implementing this use case with a module that receives time over
> PTP, so the time shall be expressed with nano-second resolution.
>
> So we need:
> - one unsigned int32 for seconds
> - one (unsigned or not) int32 for fraction of second expressed as
> nano-seconds. Same as time-stamp (TS), right?

True, the same as the epics time-stamp, but that is unfortunately not a 
primitive data type so you can't transfer them around as a simple CA value.

> Maybe 2 longout but I am not sure if UINT32 is OK with longout.
> In addition, we'll have "pulse time", with a specific time origin, so maybe
> also sub or calc records to convert between relative and absolute time.
>
> We'll appreciate advices on the records to be used... Good or bad
> ideas/experiences welcome.

You could use an aSub record type and handle the time-stamp as an array of 2 
DBF_LONG values, that array being a type which both CA and DB links can handle 
properly.  You then write aSub subroutines that process the timestamps as 
needed.

If you're going to need to do a lot of work with time-stamp values you might 
want to consider creating a special-purpose record type that has input and 
output links that transfer those kinds of arrays and that does the relative 
<=> absolute time conversion, or that just calculates the sum and difference 
of two such time-stamp arrays.  A new record type probably doesn't offer 
anything that you can't already do with an aSub record, but it should save a 
few steps configuring all the relevant input and output fields to 2-element 
LONG arrays.

You can stop a record's TIME field from being overwritten by setting its TSE 
field to -2, which would allow aSub code to copy a time-stamp into the TIME 
field.  You can also point the TSEL link of one record to the TIME field of 
another record to make the first record inherit time-stamp values from the 
second.

HTH,

- Andrew
-- 
If a man is offered a fact which goes against his instincts, he will
scrutinize it closely, and unless the evidence is overwhelming, he will
refuse to believe it.  If, on the other hand, he is offered something
which affords a reason for acting in accordance to his instincts, he
will accept it even on the slightest evidence.  -- Bertrand Russell


References:
Manipulating time in records Di Maio Franck

Navigate by Date:
Prev: Re: Problem in registerRecordDeviceDriver Andrew Johnson
Next: RE: EPICS CA problems Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Manipulating time in records Dirk Zimoch
Next: Re: Manipulating time in records Luedeke Andreas
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Oct 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·