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 | 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 |
<== 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> Hi Yong, Two things:
Tim Mooney (mooney at anl.gov) (630)252-5417 From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Hu, Yong via Tech-talk <tech-talk at aps.anl.gov> 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 |