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  <20202021  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  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Update a record at a specific time
From: Donny Domagoj Cosic via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Wed, 03 Jun 2020 16:03:02 +0200
Hi Mark,

Yes!! That is what I was trying to accomplish, with your example I now understand how the OCAL field is used.
Thank you very much.

Donny

---
Donny Domagoj Cosic
 Institut Ruđer Bošković, Bijenička cesta 54, 10000 Zagreb, Croatia

Dana 03.06.2020 15:43, Mark Rivers via Tech-talk je napisao(la):
Hi Danny,


Now I think I understand what you want to do.  You want to write B if
and only if A==10?


I think this will do what you want:


record(calcout, "Name"){
    field(INPA, "In_A")
    field(INPB, "In_B")
    field(CALC, "A==10")

    field(OCAL, "B"

    field(OOPT, "When Non-zero")

    field(DOPT, "Use OCAL")

    field(OUT, "Out")
}


The CALC is now just A==10.  OOPT tests if the CALC is non-zero (i.e.
True) and only writes to the output if it is.  OCAL determines what is
written, and it is set to B.  DOPT says to write OCAL, not CAL, to the
output link.


Mark



________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Donny
Domagoj Cosic via Tech-talk <tech-talk at aps.anl.gov>
Sent: Wednesday, June 3, 2020 8:32 AM
To: tech-talk at aps.anl.gov
Subject: Re: Update a record at a specific time

Hi Mark,

Thank you for your response,
I was referring to the CALC field of the calcout record:

record(calcout, "Name"){
    field(INPA, "In_A")
    field(INPB, "In_B")
    field(CALC, "A==10?B")
    field(OUT, "Out")
}

the line "field(CALC, "A==10?B")" is not valid because there is no else
statement ie. "A==10?B:0". If i understood your response correctly, this
can be accomplished by setting the OOPT field to "Transition To
Non-zero" and the record will only write the output when it is non zero.

Regards,
Donny

---
Donny Domagoj Cosic
  Institut Ruder Boskovic, Bijenicka cesta 54, 10000 Zagreb, Croatia

Dana 03.06.2020 14:03, Mark Rivers via Tech-talk je napisao(la):
Additionally, a simple follow up question that I
am not able to solve in a simple way. Is there a simple way to create
a
"if" statement without the "else" part. As in, I would like the OUT
record processed only then the "if" condition is met.


I'm not positive I understand the question.  But if you can make your
calculation "if" return 0 or non-zero then the calcout record has an
OOPT field that can be either "Transition To Zero" or "Transition To
Non-zero" (among other choices).  That will write the output only
under the specified condition.  It also has a DOPT field that lets you
write a different value from the result of the calculation if you set
it to "Use OCAL" rather than "Use CAL".

Mark


________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Donny
Domagoj Cosic via Tech-talk <tech-talk at aps.anl.gov>
Sent: Wednesday, June 3, 2020 6:45 AM
To: tech-talk at aps.anl.gov
Subject: Update a record at a specific time

Hello,

For archiving purposes I am trying to record a value from a PV everyday
at a specific time. I accomplished similar things using a Soft
Timestamp
record when a specific date/time field updates. ie:

record(stringin, "TeslaMeters:$(position):TimeStamp"){
     field(DTYP, "Soft Timestamp")
     field(PINI, "YES")
     field(INP,  "@%d")
}

record(calcout, "TeslaMeters:$(position):Calc"){
    field(INPA, "TeslaMeters:$(position):TimeStamp CP")
    field(INPB, "TeslaMeters:$(position)")
    field(CALC, "B")
    field(OUT, "TeslaMeters:$(position):Midnight PP")
}

record(ai, "TeslaMeters:$(position):Midnight")
{
     field(PREC, "3")
     field(EGU,  "Tesla")
     field(PINI, "YES")
}


Could I use a similar strategy to compare a time string generated by
the
Soft Timestamp? I see that there is a scalcout record, but i was not
able to get it to work. Additionally, a simple follow up question that
I
am not able to solve in a simple way. Is there a simple way to create a
"if" statement without the "else" part. As in, I would like the OUT
record processed only then the "if" condition is met.

Thank you,
Donny

--
Donny Domagoj Cosic
  Institut Ruder Boskovic, Bijenicka cesta 54, 10000 Zagreb, Croatia

References:
Update a record at a specific time Donny Domagoj Cosic via Tech-talk
Re: Update a record at a specific time Mark Rivers via Tech-talk
Re: Update a record at a specific time Donny Domagoj Cosic via Tech-talk
Re: Update a record at a specific time Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: Update a record at a specific time Mark Rivers via Tech-talk
Next: AW: pco Camera USB and IEEE interface Sintschuk, Michael 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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Update a record at a specific time Mark Rivers via Tech-talk
Next: Lexium MDrive Ethernet Stubbs Scott Allen (PSI) 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  <20202021  2022  2023  2024 
ANJ, 03 Jun 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·