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  <20102011  2012  2013  2014  2015  2016  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  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CALC expression
From: Matthieu Bec <[email protected]>
To: <[email protected]>
Date: Tue, 28 Sep 2010 18:01:51 -0400

Andrew,


I'll be the devil's advocate and recommend a sub/gensub/asub. Your expression is getting quite 'complex' and may deserve a bit of documentation: external readers would find that easily in the SNAM/gensub source code.
It might also give more padding should the expression change and grow (more input, more tests, less characters).
Finally, a sub's routine will get compiled and be slightly more efficient - I'm assuming a calc interprets its expression each time it process but have not looked at the internal to be 100% sure.


Regards,
Matthieu

On 09/28/10 17:43, Tim Mooney wrote:
Andrew,

You don't need a subroutine record for this. You might be able to get it
into a single calcout
record using techniques folks have already mentioned, but as they've
noted, the result might
be hard to understand.

I would do this with a transform record, if the record is available.
You'd have 16 calc-type expressions, each with a comment to describe it,
all in one record,
so you could break this into separate expressions and then combine the
results.

For example:
field(CLCF, "235>B && 5>D && 5>E")
field(CLCG, "B*0.00835-0.7")
field(CLCH, "A+(C-B)*0.25")
field(CLCI, "F?(G>H?G:H):0)

Actually, I'd rewrite that last expression as
field(CLCI, "F?MAX(H,G):0")

This seems to me easier to understand and modify than the equivalent
implementation
with calcout records.

Tim

On 9/28/2010 3:03 PM, Andrew Wagner wrote:
(235>B&& 5>D&& 5>E) ? (B*0.00835 - 0.7> A + (C-B)*0.25 ? B*0.00835 -
0.7: A + (C-B)*0.25): 0



--
Matthieu Bec              Gemini Observatory
Tel: +56 51 205785        c/o AURA, Casilla 603
Fax: +56 51 205650        La Serena, Chile

Replies:
Re: CALC expression Andrew Johnson
References:
CALC expression Andrew Wagner
Re: CALC expression Tim Mooney

Navigate by Date:
Prev: Re: CALC expression Maren Purves
Next: Re: CALC expression Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CALC expression Maren Purves
Next: Re: CALC expression Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 28 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·