EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  <19981999  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  Index 1994  1995  1996  1997  <19981999  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 
<== Date ==> <== Thread ==>

Subject: linear conversion in ai & ao records
From: Benjamin Franksen <[email protected]>
To: [email protected]
Date: Mon, 26 Jan 1998 16:02:11 +0100
Hi EPICS-Freaks,

after a lot of discussion with Marty Kraimer & Bob Dalesio, the new
versions of ai and ao records are ready to appear in one of the next
EPICS releases. The changes concern the way linear conversion is done. A
short summary:

1) A new (additional) field called EOFF (type DBR_DOUBLE) takes over the
role that until now has been played by ROFF. The latter remains for
compatibility with existing device supports, but may be eliminated in
some future EPICS release.

2) New device supports are supposed not to use ROFF but EOFF instead.
The main difference is that EOFF is an engeneering unit value, not a raw
value. Linear conversion now follows the formula

	VAL = AVAL * ESLO + EOFF

where AVAL is the adjusted raw value, ie 

	AVAL = RVAL * ASLO + AOFF

(as before). Prior to the adjustment of the raw value, ROFF is added as
it is now (and EOFF is initialized with EGUL), but this is done only to
ensure compatibility. New device supports should ignore ROFF completely.

3) The advantages of the new version over the old one are: 

- 32bit devices are supported without limitation.

- Calculation of adjustment (ASLO/AOFF) and linear conversion
(ESLO/EOFF) are no longer intermixed with each other.

- Offset addition (EOFF) is only done if LINR field is set to LINEAR.
(ROFF addition had been unconditionally).

- Linear conversion is easier understood (I hope).

For details refer to the attached file, which will be (more or less)
part of the release notes to the next EPICS release.

	Ben
-- 
The Notorious Neb Nesknarf
-----------------------------------------------------------------------
BESSY II
Berliner Elektronenspeicherring-                phone: +49 30 6392-4865
Gesellschaft fuer Synchrotronstrahlung            fax: +49 30 6392-4859
Rudower Chaussee 5                         email: [email protected]
D-12489 Berlin                       web: http://www.bessy.de/~franksen
-----------------------------------------------------------------------
HOME: Benjamin Franksen, Fichtestr. 19a, D-10967 Berlin, +49(30)6913756
-----------------------------------------------------------------------
Linear Conversion and the Usage of EGUL, EGUF, ESLO, EOFF
=========================================================

Application Developer:

If linear conversion is desired (field LINR set to LINEAR), the fields
(EGUL, EGUF) must be set to the (low,high) value in engineering units 
corresponding to the (low,high) ADC input (DAC output). There are no 
further restrictions whatsoever on the values of EGUL and EGUF as long 
as both fit into a double.

Device Support Developer:

Linear conversion should be supported by setting the fields ESLO and
EOFF inside init_record() and special_linconv(). In both functions, if
LINR has the value LINEAR, it should be assumed that the Application
Developer has set correct values for EGUL and EGUF. ESLO and EOFF shall
then be set so that the following formulas will become true:

        ESLO = (EGUF - EGUL) / (RAWF - RAWL)

        EOFF = (RAWF * EGUL - RAWL * EGUF) / (RAWF - RAWL)

Here, RAWL and RAWF are not record fields, but represent the lowest
resp. the highest possible raw value for this device. This ensures that
RAWL is mapped to EGUL and RAWF is mapped to EGUF (for aiRecord, vice
versa for aoRecord).

Example:

A unipolar 12bit ADC reads voltages from 4 to 20mV. The raw values range
from RAWL=0 to RAWF=2^12-1=4095. Then device support should set

        ESLO = (EGUF - EGUL) / 4095

        EOFF = (4095 * EGUL - 0 * EGUF) / 4095 
             = EGUL

Application Developer may set EGUL=4, EGUF=20, EGU="mV" if (s)he is
interested in the measured voltage. If (s)he knows that the voltage is
measured over a resistor of 4kOhm and is interested in the current
rather than the voltage, (s)he may set EGUL=0.001, EGUF=0.005, EGU="mA"
and obtain correct results.

Navigate by Date:
Prev: Re: about GPIB interface Marty Kraimer
Next: FW: Ada vs C/C++ Jeff Hill
Index: 1994  1995  1996  1997  <19981999  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: new record support Nick Rees
Next: Re: linear conversion in ai & ao records Tim Mooney
Index: 1994  1995  1996  1997  <19981999  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 
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 ·