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  <20192020  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  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Record for a running sum
From: Donny Domagoj Cosic via Tech-talk <[email protected]>
To: "Hu, Yong" <[email protected]>
Cc: [email protected]
Date: Wed, 11 Dec 2019 09:30:37 +0100
Hi Yong,

Thank you very much for the detailed response. I follow your logic and it seems like a good solution. All the solution that I came up with were a lot more complicated so I really enjoy the simplicity of this solution. The only thing that I had to add to your solution is a new record that saves the "Dosage:1h" values before every reset. However with my limited knowledge of EPICS (I just started working with EPICS a month ago) I dont think i did it properly. I created a new calc record that looks for the reset and forwards the old Dosage:1h value. Im sure there is a better way to do this maybe using the OOPT field, however I was not able to get it to work properly. Am I thinking about this in the right way?

Regards,
Donny

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

Dana 05.12.2019 22:14, Hu, Yong je napisao(la):
Hi Donny,

I did similar applications at NSLS-II: calculate hourly, daily,
monthly, yearly cumulative beam current in the Storage Ring.

Here is one example to test the cumulative dosage in one minute:
"DosagePV" is a simulated PV; "Dosage:1h" is the cumulative dosage;
Whenever one minute passes, the value of “TimeStamp” (@%M) will
change and "Dosage:1h-Reset_" will set "Dosage:1h" to 0.

To calculate hourly, daily, monthly, yearly dosage, simply change %M
in field(INP, "@%M") to %H, %d, %b, %Y.

To preserve the cumulative dosage, you should use EPICS AutoSave
(info(autosaveFields_pass0, "VAL")). Otherwise, the value will be 0
after your IOC is rebooted.

record(calc, "DosagePV") {

 field(INPA, "DosagePV")

 field(SCAN, "1 second")

 field(CALC, "A+1")

 field(FLNK, "TimeStamp")

}

record(stringin, "TimeStamp")

{

 field(DTYP, "Soft Timestamp")

 field(PINI,"YES")

 #field(INP, "@%b %d, %Y %H:%M:%S.%03f")

 field(INP, "@%M")

}

record(calcout, "Dosage:1h-Reset_")

{

 field(INPA, "TimeStamp CP")

 field(CALC, "0")

 field(OUT, "Dosage:1h PP")

}

record(calcout, "Dosage:1h-Calc_")

{

 field(INPA, "Dosage:1h")

 field(INPB, "DosagePV CP")

 field(CALC, "A+B")

 field(OUT, "Dosage:1h PP")

}

record(ai, "Dosage:1h")

{

 field(PREC, "3")

 field(EGU, "blabla")

 field(PINI,"YES")

 info(autosaveFields_pass0, "VAL")

}

There are other ways to calculate the cumulative dosage: use compress
record.

I prefer the first approach above. The approach below works only if
“DosagePV” updates at a regular rate (i.e. 1Hz).

record(compress,"Dosage:1h-Com_")

{

 field(INP,"DosagePV CP")

 field(ALG,"N to 1 Average")

 field(NSAM,"1")

 field(N,"3600")

 field(PREC,"3")

 field(FLNK,"Dosage:1h_")

}

record(calc, "Dosage:1h_")

{

 field(INPA, "Dosage:1h-Com_")

 field(CALC, "3600*A")

 field(PREC, "3")

}

HTH,

Yong Hu

NSLS-II Controls Group

FROM: Tech-talk <[email protected]> on behalf of
"[email protected]" <[email protected]>
 ORGANIZATION: Institut Ruđer Bošković
 REPLY-TO: Donny Domagoj Cosic <[email protected]>
 DATE: Thursday, December 5, 2019 at 9:20 AM
 TO: "[email protected]" <[email protected]>
 SUBJECT: Record for a running sum

Hello,

I developed an IOC for the radiation monitors found throughout our

laboratory. Through this IOC I am able to read in the values of each

probe and display them nicely using CS-Studio. However I would like to


add the ability to the IOC to keep a running sum so I can calculate
the

cumulative monthly and yearly doses throughout the laboratory but I am


not sure how to implement this. I tried searching for similar projects


of examples, but without any luck. Would you be able to provide me
with

some pointers onto how to implement such a feature?

Regards,

Donny

--

Donny Domagoj Cosic

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

Replies:
Re: Record for a running sum Hu, Yong via Tech-talk
References:
Record for a running sum Donny Domagoj Cosic via Tech-talk
Re: Record for a running sum Hu, Yong via Tech-talk

Navigate by Date:
Prev: Re: Old base version bug in configure/os/CONFIG_SITE.linux-x86_64.UnixCommon Di Wang 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Record for a running sum Hu, Yong via Tech-talk
Next: Re: Record for a running sum 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  <20192020  2021  2022  2023  2024 
ANJ, 20 Dec 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·