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  <20122013  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  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: 答复: Get a time difference in EPICS database
From: 洪春霞 <[email protected]>
To: "Tim Mooney" <[email protected]>
Cc: [email protected]
Date: Sat, 24 Nov 2012 19:52:34 +0800
Title: 答复: Get a time difference in EPICS database

Hi,

Thank you for your reply.

What I want to do is as follows:
1) First I want to have a judgement on the value of A and B in record(calcout,"h:time_difference"), if A=B, I will get the time2 (h:Systemtime2).
so I want to cause h:Systemtime2 to process just in the time of A=B,and if A is not equal to B, the h:Systemtime2 should not be processed.
so in record(stringin,"h:Systemtime2"), I use field(DISV,"0") and field(SDIS,"***"),because If DISV=DISA, the record will be disabled, so I
think if I set DISV!=DISA, the record will be enabled, but I do not know whether is it right?

2) I want to cause a recond to process just when some requirements were met in the EPICS database, for example, in field (CALC,"A=B?(C-D):0"),
I want to cause some reconds to process according to the different results of CALC, that is, a record is processed when  A=B, and another record is processed when  A!=B,
Now I do not know how to do?

Thank you so much. Best Wishes.

------------------------------------------
hongchunxia



-----Original Message-----
From: Tim Mooney [mailto:[email protected]]
Sent: 2012-11-24 (星期六) 12:46
To: 洪春霞
Cc: [email protected]
Subject: Re: Get a time difference in EPICS database

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:
Re: 答复: Get a time difference in EPICS database Tim Mooney
References:
Re: Get a time difference in EPICS database Tim Mooney

Navigate by Date:
Prev: Re: Get a time difference in EPICS database Tim Mooney
Next: Re: 答复: Get a time difference in EPICS database Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Get a time difference in EPICS database Tim Mooney
Next: Re: 答复: Get a time difference in EPICS database Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·