Hi Randall,
One example, which I would like to explain, may be useful to you.
You can add the reading unit to update the current EGU field. For
example, you have three PVs:
* I-RB (ai)
* EGU-RB (mbbi)
* FLNK-EGU (stringout)
record(ai, I-RB) { ... }
record(mbbi, EGU-RB) { ...
field(FLNK, "FLKN-EGU")
}
record(stringout, "FLNK-EGU") {
field(OUT, "I-RB.EGU NPP")
field(OMSL, "closed_loop")
field(DOL, "EGU-RB.VAL NPP")
}
With this logic, you always make sure your value has the correct unit
(EGU) in that PV.
You also have to consider when two records are processed. In my case,
the mbbi record is processed when my IOC starts with the assumption that the
device EGU value will not be changed and myIOC doesn't have the write
permission on the device.
HTH,
Han
P.S. You can contact me through my lab account if you want.
On Mon, Jan 25, 2021 at 12:40 PM Mark Rivers via Tech-talk
<tech-talk at aps.anl.gov> wrote:
>
> There are a lot of useful records in that epics-modules/calc repository.
>
> Mark
>
>
> -----Original Message-----
> From: Randall Cayford <rcayford at lbl.gov>
> Sent: Monday, January 25, 2021 2:38 PM
> To: Mark Rivers <rivers at cars.uchicago.edu>
> Subject: Re: changing unit string to scale factor
>
> That looks like the right way to go. It’s not in the base record types documentation so I hadn’t seen it. Thanks!
>
> > On Jan 25, 2021, at 12:27 PM, Mark Rivers <rivers at cars.uchicago.edu> wrote:
> >
> > Look at the scalcout record:
> >
> > http://htmlpreview.github.io/?https://github.com/epics-modules/calc/blob/master/documentation/sCalcoutRecord.html
> >
> > Mark
> >
> >
> > -----Original Message-----
> > From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Randall Cayford via Tech-talk
> > Sent: Monday, January 25, 2021 2:16 PM
> > To: Engbretson, Mark S. via Tech-talk <tech-talk at aps.anl.gov>
> > Subject: changing unit string to scale factor
> >
> > I have a device which returns a value and a string indicating the units of the value. I’ll get inputs like 0.3nA or 3.4mA, etc. Since I want to report the value in a consistent unit, I want to convert the unit string to a scale factor (nA=1, uA=1000, mA=10000) and then use a calc record to scale the value. CALC records seem to only take numbers as input and I don’t see any other appropriate record type.
> >
> > In programming I would use a case statement or if-elseif constructs. How do I do this with EPICS record processing?
> >
> > Randall
> > LBNL
> >
>
- References:
- changing unit string to scale factor Randall Cayford via Tech-talk
- RE: changing unit string to scale factor Mark Rivers via Tech-talk
- RE: changing unit string to scale factor Mark Rivers via Tech-talk
- Navigate by Date:
- Prev:
Re: Altering timestamp of softIOC PV Johnson, Andrew N. via Tech-talk
- Next:
EPICS Archiver routing issue Manoussakis, Adamandios 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
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: changing unit string to scale factor Mark Rivers via Tech-talk
- Next:
Re: changing unit string to scale factor Zimoch Dirk (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
2020
<2021>
2022
2023
2024
|