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: "Hu, Yong via Tech-talk" <tech-talk at aps.anl.gov>
To: "Mooney, Tim M." <mooney at anl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Wed, 19 Aug 2020 01:59:37 +0000

Hi Tim,

 

1) Yes, you are right. It is a typo. It should be “A” instead of “1”;

 

2) I always have the habit of using PINI=YES in records to avoid the “UDF”. After removing the PINI, the string value is indeed restored although I get something like this when I use caget -a recordB.

$ caget  recordB

recordB 2020-08-18 08:14:40.958718535

$ caget -a recordB

recordB <undefined> 2020-08-18 08:14:40.958718535 UDF NO_ALARM

 

Removing PINI works although the output “caget -a” seems unusual.

 

Thanks,

Yong

 

 

From: "Mooney, Tim M." <mooney at anl.gov>
Date: Tuesday, August 18, 2020 at 8:33 PM
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, "Hu, Yong" <yhu at bnl.gov>
Subject: Re: get the timestamp of a record as a human-readable string and restore it after rebooting

 

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, recordB.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 Ralph Lange 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
Re: get the timestamp of a record as a human-readable string and restore it after rebooting Mooney, Tim M. via Tech-talk

Navigate by Date:
Prev: Re: installing synApps on Ubuntu Michael Davidsaver via Tech-talk
Next: Re: installing synApps on Ubuntu Randall Cayford 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: Re: get the timestamp of a record as a human-readable string and restore it after rebooting Mooney, Tim M. via Tech-talk
Next: Re: get the timestamp of a record as a human-readable string and restore it after rebooting Ralph Lange 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, 24 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·