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  <20162017  2018  2019  2020  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  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Variable SCAN Intervall and Roundoff function
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Tue, 16 Aug 2016 11:55:05 -0500
Hi Raul,

On 08/16/2016 08:32 AM, [email protected] wrote:
> i have two question für a simple controlapplication.

I can answer your second question:

> 2.) I use a voltage divider with a poti in rheostat-mode (1024 steps).
> Because it's non-linear I have to calculate the respective bits for a
> value. My record works finde:
> 
> record(calc, "LINEAR_" ) {
>   field(INPA, "LINEAR_ NPP NMS" )
>   field(CALC, "CALCULATION")
>   field(PREC, "2")
> }
> 
> How can I round off the value? Let's say my calculated value is 375,6
> (steps). How can I round the result off to 375 and not 376? I want to
> round off all result:
> Example: 512,8 = 512 (noit 513)

The calc engine that is used by the calc and calcout record types is
documented at
http://www.aps.anl.gov/epics/base/R3-15/4-docs/AppDevGuide/node20.html#SECTION002020000000000000000
and if you look under section 19.2.1.9 you'll see it supports the
floor() numeric function, which rounds its argument value down to the
next-lower integer.

- Andrew

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

References:
Variable SCAN Intervall and Roundoff function info22

Navigate by Date:
Prev: Re: Variable SCAN Intervall and Roundoff function Konrad, Martin
Next: Re: Variable SCAN Intervall and Roundoff function Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Variable SCAN Intervall and Roundoff function info22
Next: Re: Variable SCAN Intervall and Roundoff function Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Aug 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·