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  <20152016  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  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: how NOT to update the record
From: Ralph Lange <[email protected]>
To: Tasaddaq Khan <[email protected]>
Cc: EPICS Tech-Talk <[email protected]>
Date: Wed, 15 Jul 2015 10:50:58 +0200
Hi Tasaddaq,

I am not sure I understand correctly what you want to achieve.
From your last mail, I assume that your record "b" should act as a gate.
Whenever "b" gets 1, you want the counter record "time" to start counting from 0, and the counter record "result" to continue counting from where it was left.
While "b" is 0, the counter record "time"should be reset to 0, the counter record "result" should keep its value.

This can be done using the following database (many other solutions possible):

record (bi, "b") {
}

record (calcout, "time") {
    field(SCAN, "1 second")
    field(INPB, "b")
    field(INPC, "1")
    field(CALC, "B?VAL+C:0")
}

record(calcout, "result") {
    field(SCAN, "1 second")
    field(INPB, "b")
    field(INPC, "1")
    field(CALC, "B?VAL+C:VAL")
}

Cheers,
~Ralph


On 12/07/2015 21:24, Tasaddaq Khan wrote:
Hi Ralph

I have tried many combinition but could not get the desired result. Please have a look at my record,

record (bi, "b"){
    field(DESC, "Increment")
    field(DTYP, "Soft Channel")
    field(FLNK, "time")
}

record (calcout, "time"){
    field(SCAN, "1 second")
    field(INPA, "time")
    field(INPB, "b")
    field(INPC, "1")
    field(CALC, "B=1?a+c:0")
    field(OOPT, "When Non-zero")
    field(OCAL, "")
    field(OUT,  "result PP")
}

record(calcout, "result"){
    field(SCAN, "Passive")
#  field(INPA, "time")
    field(INPB, "result")
    field(INPC, "1")
    field(CALC, "B+C")
}

The record result is derived by the record time. When record b.VAL=1 things works fine but when record b.VAL=0 record time.VAL=0 and record result.VAL holds the last value. Upto here things are working fine. Now when I again put b.VAL=1, time.VAL starts from 1 and it also derives result.VAL again from 1 but not from the last value it holds. Then I disables the field(INPA, "time") (as in the record), the record time still derives the record result and the solution is same. Please have a look and suggest me how to change my values in order to get the desired result.

regards

Tasaddaq

On Fri, Jul 10, 2015 at 12:41 PM, Ralph Lange <[email protected]> wrote:
Hi Tasaddaq,

You have explicitly configured your record d to do "A+1", with A fetched from record c, and you say that c should be zero if you set b to 0.
The value that record b puts into the VAL field of record d will be overwritten when d processes, fetching A from record c and calculating "A+1".

If you want d to use its own last VAL, d.CALC should be "VAL+1".

~Ralph



On 10/07/2015 07:59, Tasaddaq Khan wrote:
Hi Tim Mooney

The problem is still same and this does not solve the problem. Even with this value of record 'd' does not update.
Is there any other way to solve the problem in EPICS?

tasaddaq

On Thu, Jul 9, 2015 at 7:56 PM, Mooney, Tim M. <[email protected]> wrote:
Hi Tasaddaq,

One way to do that is like this:

record (calcout, "c"){
field(SCAN, "1 second")
field(INPA, "c")
field(INPB,"b")
field(INPC,"1")
field(CALC,"d:=a+c;b")
field(OCAL,"d")
field(OOPT, "When Non-zero")
field(DOPT, "Use OCAL")
field(OUT,"d PP")
}


Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: Tasaddaq Khan [[email protected]]
Sent: Thursday, July 09, 2015 2:11 AM
To: Mooney, Tim M.
Subject: Re: how NOT to update the record

Hi Tim

I changed my program and use the OOPT field in record c, but the result is same. It sets the value c=0 when b=0 and record d keeps the last value that is fine, but when I again put b=1, it starts from the starting point but not from the last value it keeps which I do not want. I want that my record d keeps the last value when b=0 and starts from this value when I again put the b=1.

record (bi,"b"){
field(FLNK, "c")
}

record (calcout, "c"){
field(SCAN, "1 second")
field(INPA, "c")
field(INPB,"b")
field(INPC,"1")
field(CALC,"B=1?A+C:0")
field(OOPT, "When Non-zero")
field(OUT,"d PP")
}

record(calcout, "d"){
field(INPA, "c")
field(INPB,"1")
field(CALC,"A+B^2")
}

regards,
tasaddaq

On Thu, Jul 9, 2015 at 3:48 AM, Mooney, Tim M. <[email protected]> wrote:
Hi Tasaddaq,

You can use the OOPT field to specify when the output link should be executed.  c.OOPT="When Non-zero"

Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: [email protected] [[email protected]] on behalf of Tasaddaq Khan [[email protected]]
Sent: Wednesday, July 08, 2015 1:59 PM
To: [email protected]
Subject: how NOT to update the record

Dear all

I have three records, when the value in the record "b" is "1" the value in the record c is calculated and the record d is updated as well. Upto this the things are working fine. But I want one more thing that when the b=0, the value of record "c" should become the zero (that is happening) but it should not send the value zero to the record d means at b=0 record c should be updated but it should not update the record d. I want to keep the last value of record d so that when b=1 again then record d should start from the last value that it will hold. Please tell me how to do this?

record (bi,"b"){
field(FLNK, "c")
}

record (calcout, "c"){
field(SCAN, "1 second")
field(INPA, "c")
field(INPB,"b")
field(INPC,"1")
field(CALC,"B=1?A+C:0")
field(OUT,"d PP")
}

record(calcout, "d"){
field(INPA, "c")
field(INPB,"1")
field(CALC,"A+B")
}

regards,
Tasaddaq






References:
how NOT to update the record Tasaddaq Khan
RE: how NOT to update the record Mooney, Tim M.
RE: how NOT to update the record Mooney, Tim M.
Re: how NOT to update the record Tasaddaq Khan
Re: how NOT to update the record Ralph Lange

Navigate by Date:
Prev: using motor / steppermotor record for Trinamic TMCM-351 controller Christian Pauly
Next: Prosilica GigE on MAC Hinko Kocevar
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: how NOT to update the record Ralph Lange
Next: how to write array data to waveform record in cothread? Silver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·