Hello all,
during the last few weeks I had some discussion with Marty Kraimer & Bob
Dalesio about proposed changes to ai & ao records. These changes are
concerned with the ROFF field of both record types.
Record support uses ROFF to calculate linear conversion between raw
values (RVAL, type DBF_LONG) and engeneering unit values (VAL, type
DBF_DOUBLE) according to the formula
VAL = (RVAL + ROFF) * ESLO + EGUL
resp.
RVAL = (VAL - EGUL) / ESLO - ROFF (rounded)
There are two problems with the current implementation:
1) ROFF has type DBF_LONG. This imposes a limitation on the size of raw
values. For instance, a 32 bit device outputting 'signed long' values
would require ROFF to be set to
minus minimum raw value = - (-2^31) = 2^31
which will not fit into a signed long. So it is impossible to use linear
conversion in this case. Furthermore, even if one sets ROFF to
an existing signed long value like 2^31-1 the above calculation leads to
an integral overflow causing, for example, negative raw values to be
mapped to large positive VALs instead of negative ones. (The latter can
be remedied by including some type casts to double _before_ the
calculation takes place).
2) ROFF is used by record support to convert between VAL & RVAL even if
LINR is set to NO_CONVERSION (zero). This is not the intended use of
ROFF (one should use AOFF if an actual offset appears in the instrument,
which is also configurable by DCT; AOFF as well as ASLO is _always_
calculated into the values, no matter what LINR is).
Solution:
1) make ROFF a DBF_DOUBLE,
2) insert something like 'if(precord->linr==1)' before using roff in
record support calculations.
Marty agreed that I should make the above changes and test them. If
everything works out fine they are to be included in (one of) the next
release(s).
BEWARE: these changes possibly (but not necessarily) affects device
supports (existing or still to be written).
Also another WARNING: the discussion is still evolving. Please comment
if there are questions or objections.
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
-----------------------------------------------------------------------
- Replies:
- Re: Proposed changes in ai & ao records Benjamin Franksen
- Navigate by Date:
- Prev:
VME-GPIB 1014 problems (beginner questions) mauro
- Next:
Re: VME-GPIB 1014 problems (beginner questions) Ned Arnold
- Index:
1994
1995
1996
<1997>
1998
1999
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: VME-GPIB 1014 problems (beginner questions) Bill Brown
- Next:
Re: Proposed changes in ai & ao records 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
2016
2017
2018
2019
2020
2021
2022
2023
2024
|