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  2017  2018  2019  <20202021  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  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: get the timestamp of a record as a human-readable string and restore it after rebooting
From: "Mooney, Tim M. via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, "Hu, Yong" <yhu at bnl.gov>
Date: Wed, 19 Aug 2020 00:33:15 +0000
Hi Yong,

Two things:

  1. I think there might be a typo.  The calc _expression_ "1" doesn't do what you say you want the calcout record to do.
  2. I don't see why you use PINI to process the stringin record, if you want it to have the timestamp of the last time recordA made a transition to 0.  If you remove the PINI setting, what is the value of the stringin record immediately after rebooting?

Tim Mooney (mooney at anl.gov) (630)252-5417
Beamline Controls Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Hu, Yong via Tech-talk <tech-talk at aps.anl.gov>
Sent: Tuesday, August 18, 2020 6:00 PM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: get the timestamp of a record as a human-readable string and restore it after rebooting
 

Hello everyone,

 

Since the field .TIME is internal to a record (e.g. recordA), it seems not straightforward for a string record (e.g. recordB) to directly get the timestamp of recordA as a human-readable string, although it is straightforward for a Python program to put a record’s timestamp as a string.

 

I managed to use “Soft Timestamp” together with “TSEL” to get the timestamp of a not-on-the-same-IOC record as a human-readable string. See below:

record(calcout,"recordA -Calc_") {

   field(INPA,"recordA CP")

    field(CALC,"1")

    field(OOPT,"Transition To Zero")

    field(OUT, "recordB.PROC")

}

 

record(stringin, "recordB")

{

    field(DTYP,"Soft Timestamp")

field(PINI,"YES")

#without TSEL, recordB will not be exactly the same as recordA’s timestamp

    field(TSEL,"recordA.TIME")

    field(INP, "@%Y-%m-%d %H:%M:%S.%f")

    info(autosaveFields_pass0, "VAL")

}

 

recordA is a bi record running on another IOC (that is why I use CP in INPA). I want to use recordB to latch the timestamp of recordA when recordA’s value goes from 1 to 0. Everything seems working as expected. However, there is one problem with autosave. After the IOC is rebooted, the value of recordB is <undefined>, it is not restored to its saved value although I see the saved value “2020-08-15 01:18:55.236900451” in the *_pass0.sav file before I reboot the IOC. I also tried to use pass1, the same result <undefined>.

$ caget -a recordB

recordB     <undefined> <undefined>

 

I see some errors during the rebooting. I guess the reason why I get “dbGetTimeStamp failed” is that the CA link is not established yet before initial process (PINI=YES). However, when I look through the code https://github.com/epics-base/epics-base/blob/3.15/src/ioc/misc/iocInit.c, dbCaLinkInit() is indeed before initialProcess().

reboot_restore: entry for file 'settings_pass0.sav'

reboot_restore: Found filename 'settings_pass0.sav' in restoreFileList.

*** restoring from './as/save/settings_pass0.sav' at initHookState 6 (before record/device init) ***

reboot_restore: done with file 'settings_pass0.sav'

recGblGetTimeStamp: dbGetTimeStamp failed, recorddB.TSEL = recordA

 

How do I solve this problem? Any suggestions are appreciated!

I am using Base-3.15.6-2 and autosave-5.9 if versions matter.

 

Thanks,

Yong Hu


Replies:
Re: get the timestamp of a record as a human-readable string and restore it after rebooting Hu, Yong via Tech-talk
References:
get the timestamp of a record as a human-readable string and restore it after rebooting Hu, Yong via Tech-talk

Navigate by Date:
Prev: RE: ADPilatus and camserver version Ivashkevych, Oksana via Tech-talk
Next: RE: accepting channel name drops in Qt from MEDM [SEC=UNOFFICIAL] STARRITT, Andrew via Tech-talk
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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: get the timestamp of a record as a human-readable string and restore it after rebooting Hu, Yong via Tech-talk
Next: Re: get the timestamp of a record as a human-readable string and restore it after rebooting Hu, Yong via Tech-talk
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  <20202021  2022  2023  2024 
ANJ, 18 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·