Experimental Physics and Industrial Control System
hongchunxia,
Two things:
1) If you are using the soft time device support in EPICS base, and you want to use a calc record to calculate the time difference, you should not get the time as a formatted string, but instead get it as the raw number of seconds since the fixed "epoch" (which I think is some time back in 1990 or something):
record(ai,"time1") {
field(DTYP, "Soft Timestamp")
}
record(ai,"time2") {
field(DTYP, "Soft Timestamp")
}
record(calcout,"timeDiff") {
field(DESC,"time2-time1 (seconds)")
field(INPA,"time1 NPP")
field(INPB,"time2" NPP)
field(CALC,"b-a")
}
2) I don't see anything in your database that would cause h:Systemtime2 to process. I think your job might be easier if you separate the job of deciding whether h:Systemtime2 should process, from the job of calculating the difference between h:Systemtime1 and h:Systemtime2.
Tim Mooney
----- Original Message -----
From: "洪春霞" <[email protected]>
To: [email protected]
Sent: Friday, November 23, 2012 2:07:26 AM
Subject: Get a time difference in EPICS database
Hi,
I want to get a time difference in EPICS database, the record of h:Systemtime1 is run when ioc is start, that is, it is the realtime time.
The record of h:Systemtime2 is get when A=3 in the record(calcout,"h:monitor_time"), and it should be executed once, but now I can not get the time of h:Systemtime2.
When I input “camonitor h:Systemtime2” in another Terminal, I always get “h:Systemtime2 <underfined> UDF INVALID”,and I input “camonitor h:time_plus” in another Terminal, I get the time is the value of C.
That is to say, the record of h:Systemtime2 is not executed.
Can you give me some advice? Thank you very much.
Best Wishes.
The database which I use is as follows:
record(ai, "h:status")
{
}
record(stringin,"h:Systemtime1")
{
field(DESC,"Systemtime1")
field(DTYP,"Soft Timestamp")
field(SCAN,"1 second")
field(PINI,"YES")
field(INP,"@%s")
}
record(stringin,"h:Systemtime2")
{
field(DESC,"Systemtime2")
field(DTYP,"Soft Timestamp")
field(INP,"@%s")
field(DISV,"0")#If DISV=DISA, then the record will be disabled
field(SDIS,"h:monitor_time PP MS")#
}
#This is the value that is compared with DISV to determine if the record is
#disabled. Its value is obtained via SDIS if SDIS is a database or channel access
#link.
record(calcout,"h:time_difference")
{
field(CALC,"A=B?(C-D):0")
field(INPA,"h:status PP NMS")
field(INPB,"3")
field(INPC,"h:Systemtime1 PP NMS")
field(INPD,"h:Systemtime2 NPP NMS")
field(OUT,"h:time_plus PP NMS")
field(OOPT,"Transition To Non-zero")
}
------------------------------------------
hongchunxia
--
Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab
- Replies:
- 答复: Get a time difference in EPICS database 洪春霞
- References:
- Get a time difference in EPICS database 洪春霞
- Navigate by Date:
- Prev:
Utilities for EPICS on Multi-Core Linux Ralph Lange
- Next:
答复: Get a time difference in EPICS database 洪春霞
- 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
- Navigate by Thread:
- Prev:
Get a time difference in EPICS database 洪春霞
- Next:
答复: Get a time difference in EPICS database 洪春霞
- 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