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  2020  <20212022  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  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Get timestamp from another IOC
From: Michael Davidsaver via Tech-talk <tech-talk at aps.anl.gov>
To: Adrian Martinez <adrian.martinez at sevensols.com>
Cc: tech-talk at aps.anl.gov
Date: Wed, 16 Jun 2021 13:26:22 -0700
On 6/16/21 7:49 AM, Adrian Martinez via Tech-talk wrote:
> Hello Yuliang,
> 
> I've used '*dbr*' command on *IOC1* and this is the out for *Timestamp_from_IOC1:*
> *
> *
> *ioc > dbpr MBT-RBN:TMG-EVR-01:*/*Timestamp_from_IOC1*/* 10*
...
> DSET: 0x7f5fc4122160                    DTYP: Obj Prop string                  
> EVNT:               FLNK:DB_LINK MBT-RBN:TMG-EVR-01:TimeErr-I                  
> INP:INST_IO @OBJ=EVR-MTCA, PROP=NextSecond                  LCNT: 0            
...
> NAME: MBT-RBN:TMG-EVR-01:*/*Timestamp_from_IOC1*/*   NSEV: NO_ALARM      NSTA: NO_ALARM      
...
> RSET: 0x7f5fc3ca6560                    SCAN: 1 second      SDIS:CONSTANT      

This looks like my mrfioc2 driver[1].  FYI. "PROP=NextSecond" with a 1 second scan
may not be as what you want if your goal is to drive record processing in another IOC.

Using an event code counters[2] may be a better fit.  These are SCAN="I/O Intr", and
so have better latency.  To assist in moving event code RX time across CA, the provided
evrevent.db template includes an counter record which can be linked from another IOC.

Indeed my default card templates[3] include a synchronous 1Hz counter (event #125)
which may be a starting point for you.

This count, and associated timestamp, can be linked from another IOC with something
like the following.

> record(longin, "$(USER)ShadowCnt") {
>     field(INP,  "$(SYS){$(D)}1hzCnt-I CP")
>     field(TSEL, "$(SYS){$(D)}1hzCnt-I.TIME CA")
> }

The trick I've used is subscribing to counter value changes,
and also taking the timestamp from the most cached counter update.

To verify subscribe to both with 'camonitor' and confirm that the updates come in
pairs with exactly matching timestamps.


[1] https://github.com/epics-modules/mrfioc2/blob/0ce53468b1e35d5a4a801f72b99ab4189786b267/evrMrmApp/Db/evrSoftEvt.template#L14

[2] https://github.com/epics-modules/mrfioc2/blob/0ce53468b1e35d5a4a801f72b99ab4189786b267/evrApp/Db/evrevent.db#L22-L28

[3] https://github.com/epics-modules/mrfioc2/blob/0ce53468b1e35d5a4a801f72b99ab4189786b267/evrMrmApp/Db/evr-mtca-300.substitutions#L75


> SEVR: NO_ALARM      SIML:CONSTANT       SIMM: NO            SIMS: NO_ALARM      
> SIOL:CONSTANT       SPVT: 0x1558ce0     STAT: NO_ALARM      SVAL:              
> TIME: 2021-06-16 14:47:16.997443401     TPRO: 0             TSE: 0              
> TSEL:CONSTANT       UDF: 1              UDFS: INVALID      
> VAL: Sun, 07 Feb 2106 06:28:16*  
> 
> The SCAN field is 1s, VAL field never changes but the TIME field of the PV does.
> 
> Thanks, Adrián
> 
> El mié, 16 jun 2021 a las 16:13, Zhang Yuliang (<zhangyl at ihep.ac.cn <mailto:zhangyl at ihep.ac.cn>>) escribió:
> 
>     Hello Adrian,
> 
> 
>     Please paste the code of record "/*$(Y):Timestamp_from_IOC1*/". Can you make sure the record "/*$(Y):Timestamp_from_IOC1*/" processed periodically or only once?
> 
> 
>     Regards,
> 
>     Yuliang 
> 
> 
> 
>         -----原始邮件-----
>         *发件人:*"Adrian Martinez" <adrian.martinez at sevensols.com <mailto:adrian.martinez at sevensols.com>>
>         *发送时间:*2021-06-16 18:38:42 (星期三)
>         *收件人:* "Zhang Yuliang" <zhangyl at ihep.ac.cn <mailto:zhangyl at ihep.ac.cn>>
>         *抄送:* tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>
>         *主题:* Re: Get timestamp from another IOC
> 
>         Hello Yuliang,
> 
>         I have deleted CP but It does not work. The PV "TimeStr" is still not updated.
> 
>         Thanks, Adrián.
> 
>         El mié, 16 jun 2021 a las 12:09, Zhang Yuliang (<zhangyl at ihep.ac.cn <mailto:zhangyl at ihep.ac.cn>>) escribió:
> 
>             Hello Adrian,
> 
> 
>             Try to delete CP in line "/*field(TSEL, "$(Y):Timestamp_from_IOC1.TIME CP MS")*/".
> 
> 
>             Regards,
> 
>             Yuliang
> 
> 
> 
>                 -----原始邮件-----
>                 *发件人:*"Adrian Martinez via Tech-talk" <tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>>
>                 *发送时间:*2021-06-16 18:03:22 (星期三)
>                 *收件人:* tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>
>                 *抄送:*
>                 *主题:* Get timestamp from another IOC
> 
>                 Hello,
> 
>                 I'm trying to get the timestamp from another IOC (we will call it "IOC1") using the following DB records:
> 
>                 /*record(stringin, "$(user):TimeStr") {*/
>                 /*    field(DTYP, "Soft Timestamp")
>                     field(TSEL, "$(Y):Timestamp_from_IOC1.TIME CP MS")
>                     field(INP, "@%s")
>                     field(SCAN, ".2 second")
>                 }
> 
>                 record(ao, "$(user):Time"){
>                      field(DTYP, "asynInt32")
>                      field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))my_time")
>                 }
> 
>                 record(calcout, "$(user):TimeCalc"){
>                      field(OUT, "$(user):Time PP")
>                      field(CALC, "A")
>                      field(INPA, "$(user):TimeStr.VAL CP MS")
>                      field(PINI, "YES")
>                 }*/
>                 /*
>                 */
>                 At the startup of IOC2 I am able to get the timestamp from IOC1 but only once. The PV "TimeStr" doesn't update.
>                 Can someone help me with this task?
> 
>                 Thanks in advance, Adrián.
> 
>                  This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof are confidential and proprietary to Seven Solutions,S.L and/or its affiliates, and are *confidential*. Without the prior written consent of Seven Solutions, this content may not (i) be disclosed to any third party, (ii) be reproduced, modified or otherwise used by anyone other than current employees of Seven Solutions or its affiliates. If you are not the intended recipient or if this message has been received in error, please notify us immediately via e-mail and delete it. 
> 
> 
> 
>         -- 
>         http://sevensols.com <http://sevensols.com>
>         Adrián Martínez Múnera
> 
>         /Embedded Software Engineer/
> 
>         This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof are confidential and proprietary to Seven Solutions,S.L and/or its affiliates, and are **confidential**. Without the prior written consent of Seven Solutions, this content may not (i) be disclosed to any third party, (ii) be reproduced, modified or otherwise used by anyone other than current employees of Seven Solutions or its affiliates. If you are not the intended recipient or if this message has been received in error, please immediately notify us via e-mail and delete it./
>         /
> 
>          This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof are confidential and proprietary to Seven Solutions,S.L and/or its affiliates, and are *confidential*. Without the prior written consent of Seven Solutions, this content may not (i) be disclosed to any third party, (ii) be reproduced, modified or otherwise used by anyone other than current employees of Seven Solutions or its affiliates. If you are not the intended recipient or if this message has been received in error, please notify us immediately via e-mail and delete it. 
> 
> 
> 
> -- 
> *Adrián Martínez*
> Embedded Software Engineer
> 	Seven Solutions
>  
> Mail: adrian.martinez at sevensols.com <mailto:adrian.martinez at sevensols.com>
> www.sevensols.com <http://www.sevensols.com/>
> 
> 
>  This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof are confidential and proprietary to Seven Solutions,S.L and/or its affiliates, and are *confidential*. Without the prior written consent of Seven Solutions, this content may not (i) be disclosed to any third party, (ii) be reproduced, modified or otherwise used by anyone other than current employees of Seven Solutions or its affiliates. If you are not the intended recipient or if this message has been received in error, please notify us immediately via e-mail and delete it.


References:
Get timestamp from another IOC Adrian Martinez via Tech-talk
Re: Get timestamp from another IOC Zhang Yuliang via Tech-talk
Re: Get timestamp from another IOC Adrian Martinez via Tech-talk
Re: Re: Get timestamp from another IOC Zhang Yuliang via Tech-talk
Re: Re: Get timestamp from another IOC Adrian Martinez via Tech-talk

Navigate by Date:
Prev: Re: Get timestamp from another IOC Timo Korhonen via Tech-talk
Next: database could big data, compute and analyse 网易邮件中心 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  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Re: Re: Get timestamp from another IOC Hu, Yong via Tech-talk
Next: Re: Get timestamp from another IOC 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  2020  <20212022  2023  2024 
ANJ, 17 Jun 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·