EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Index of highest value
From: Tim Mooney <[email protected]>
To: "Lawrence T. Hoff" <[email protected]>
Cc: [email protected]
Date: Mon, 20 Dec 2004 12:57:04 -0600
Lawrence T. Hoff wrote:
In my application, I have a dozen "stripping foils", only one of which can be in use at a time. Each foil degrades with use
(related to aggregate number of particles stripped). I plan to
associated a "goodness" (or "badness") factor with each foil (something like a battery capacity indicator in a cell phone).
Let's assume this means a dozen analog records of some sort,
one for each foil.


	Ideally, I will provide a facility where a user can say:
"insert the best foil", which will find the foil with the highest
"goodness factor", and substitute that foil for the current one.

To do this, I need to find the index of the foil with the
highest "goodness factor", and pass that index to the foil drive mechanism.


	I will probably use some sort of subroutine record to
achieve this. However, as a mental exercise, I tried to think
of how to do this with "standard" EPICS records. I could
not come up with what I thought was a "clean" solution!
Maybe someone can offer a suggestion about what I might be
missing?

	I.e. I realize that I can find the highest "goodness
factor" via a SEL record. As far as I know, that can provide
the highest value, but not which input that value came form.

I also realize that I can use CALC records, and can
even use both the "goodness factors", and the SEL record output
as inputs to the CALC record. However, I cannot think of a CALC expression to compute the index, within the constraints
of the CALC field length limit. I.e. if the raw values are
in fields A-K, and the highest value (from the SEL record)
is in L, the obvious expression is:


"K==L?10:J==L?9:I==L?8:H==L?7:G==L?6:F==L?5:E==L?4:D==L?3:C==L?2:B==L?1:
0"

which is too long (AFAIK).

I could break up the calculation into several CALC
records, or use a SEQ record to re-use a CALC record with
different formulas, but it seems to me that once the use of records exceeds some level of complexity, a subroutine record is called for.


Suggestions?

I don't have any suggestion for doing this with only the records in base, but you could do everything you've described with one transform record, which I'll call 'T'. Here are the field definitions:

T.A ... T.L are the goodness factors
T.CMTA ... T.CMTL are per-foil descriptions/comments, if needed
T.CLCM is 'max(a,b,c,d,e,f,g,h,i,j,k,l)'
T.CLCN is 'a==m?1:b==m?2:c==m?3:d==m?4:e==m?5:0'
T.CLCO is 'f==m?6:g==m?7:h==m?8:i==m?9:j==m?10:0'
T.CLCP is '(k==m?11:l==m?12:n+o)-1'

After the record processes:
T.M is the max goodness factor
T.P is the index of the best foil
T.OUTP is the PV to which you want to write the foil index.

--
Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab


Replies:
Re: Index of highest value Tim Mooney
References:
Index of highest value Lawrence T. Hoff

Navigate by Date:
Prev: database conversion john sinclair
Next: Re: database conversion Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Index of highest value Lawrence T. Hoff
Next: Re: Index of highest value Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·