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: Ralph Lange <[email protected]>
To: EPICS Tech Talk <[email protected]>
Date: Tue, 28 Sep 2010 16:30:58 -0400
When playing database golf:
In a calcout record, you can assign intermediate results to fields inside CALC, and then use OCAL to continue your calculation. (So you get >70 characters to do your math.)
Removing "unnecessary" brackets and spaces also obfuscates things nicely. (And saves space.)


Hole in one!
Ralph


On 28.09.2010 16:20, Ned Arnold wrote:
Andrew -

It is not uncommon to break the expression up between multiple calc records to work around the length limitation. You can put those floating point constants in spare inputs ... and then have a second calc that returns "(235>B&& 5>D&& 5>E)" to another input ... and I think you will fit.

Ned



On Sep 28, 2010, at 3:11 PM, Mark Rivers wrote:

I suspect your CALC expression is longer than 40 characters and that is
the source of the error.

Mark


-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Andrew Wagner Sent: Tuesday, September 28, 2010 3:04 PM To: [email protected] Subject: CALC expression

Hey everyone,

I need to evaluate a somewhat complicated conditional statement in a
calc record. Presently I need to evaluate:

field(CALC, "(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")

where the letters are input variables. When I load the record I get the
error

Can't set "VOLT:PID.CALC" to "(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"
Error at or before ")" in file "MagnetCtrlApp/Db/MagnetCtrl.db" line 113

Does CALC not support nested evaluations? Perhaps I need a subroutine
record? Any advice would be greatly appreciated.

Cheers,

Andrew

References:
CALC expression Andrew Wagner
RE: CALC expression Mark Rivers
Re: CALC expression Ned Arnold

Navigate by Date:
Prev: Re: CALC expression Ned Arnold
Next: Re: archiving system John William Sinclair
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 Ned Arnold
Next: Re: CALC expression Tim Mooney
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 ·