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  2016  2017  2018  <20192020  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  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: quadEM Positions XY
From: Mark Rivers via Tech-talk <[email protected]>
To: Luka Debenjak <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 26 Feb 2019 15:12:37 +0000
Hi Luka,

> I am testing the Quad Electrometer AH501B with quadEM driver and would like to understand how the numbers for X and Y positions are calculated.
> According to the manual [1] the position is calculated as:

> Position = Diff/Sum * PositionScale - PositionOffset.
> But if I calculate the position manually from given Diff and Sum it does not match to what I get from the corresponding PV ($(P)$(R)Pos[X,Y]:MeanValue_RBV).

> Even in the example screenshot from the quadEM driver manual [2] the X and Y positions do not correspond to the calculation above,

> e.g. Position X: 2800.5 != -860.2/3181.4 * 12330.0 - 3606.7 = ?6940.5.


I believe the documentation is correct.  Here is the code from drvQuadEM.cpp:


 doubleData[QESumAll] = doubleData[QECurrent1] + doubleData[QECurrent2] +
                           doubleData[QECurrent3] + doubleData[QECurrent4];
    if (geometry == QEGeometrySquare) {
        doubleData[QESumX]   = doubleData[QESumAll];
        doubleData[QESumY]   = doubleData[QESumAll];
        doubleData[QEDiffX]  = (doubleData[QECurrent2] + doubleData[QECurrent3]) -
                               (doubleData[QECurrent1] + doubleData[QECurrent4]);
        doubleData[QEDiffY]  = (doubleData[QECurrent1] + doubleData[QECurrent2]) -
                               (doubleData[QECurrent3] + doubleData[QECurrent4]);
    }
    else {
        doubleData[QESumX]   = doubleData[QECurrent1] + doubleData[QECurrent2];
        doubleData[QESumY]   = doubleData[QECurrent3] + doubleData[QECurrent4];
        doubleData[QEDiffX]  = doubleData[QECurrent2] - doubleData[QECurrent1];
        doubleData[QEDiffY]  = doubleData[QECurrent4] - doubleData[QECurrent3];
    }
    denom = doubleData[QESumX];
    if (denom == 0.) denom = 1.;
    doubleData[QEPositionX] = (positionScale[0] * doubleData[QEDiffX] / denom) -  positionOffset[0];
    denom = doubleData[QESumY];
    if (denom == 0.) denom = 1.;
    doubleData[QEPositionY] = (positionScale[1] * doubleData[QEDiffY] / denom) -  positionOffset[1];



I believe the discrepency you are observing is due to the way that averaging is done.  There are 2 ways that the averaging could be done:


1) AveragePosition = AverageDiff/AverageSum * PositionScale - PositionOffset

2) AveragePosition = average(Diff/Sum * PositionScale - PositionOffet)

The driver uses method 2, i.e. it computes the position for each reading, and then computes the average of these over the AveragingTime.

These 2 methods do not yield the same answer.  In the screen shot you can see that the AveragePositionX is 2800.5 but the standard deviation when computing the average is 400409, i.e. it is huge compared to the mean.

If you set the sampling time and averaging time to be the same, so that NumAverage=1 then methods 1 and 2 should be identical and if you do the computation manually you will get what you expect.

Mark


________________________________
From: [email protected] <[email protected]> on behalf of Luka Debenjak via Tech-talk <[email protected]>
Sent: Tuesday, February 26, 2019 6:48 AM
To: [email protected]
Subject: quadEM Positions XY

Hello everyone,

This will be my first email to the Tech-Talk.
I am testing the Quad Electrometer AH501B with quadEM driver and would like to understand how the numbers for X and Y positions are calculated. According to the manual [1] the position is calculated as:

Position = Diff/Sum * PositionScale - PositionOffset.

But if I calculate the position manually from given Diff and Sum it does not match to what I get from the corresponding PV ($(P)$(R)Pos[X,Y]:MeanValue_RBV). Even in the example screenshot from the quadEM driver manual [2] the X and Y positions do not correspond to the calculation above, e.g. Position X: 2800.5 != -860.2/3181.4 * 12330.0 - 3606.7 = ?6940.5.

I am either doing something wrong or is the formula for Position incomplete. I would like to understand this, because we would like to use this Quad Electrometer to measure the beam position, so we need to understand the meaning of the X and Y Positions and how they are calculated.

Best regards,
Luka Debenjak

[1] http://cars9.uchicago.edu/software/epics/quadEMDoc.html
[2] http://cars9.uchicago.edu/software/epics/quadEM.png

Replies:
Re: quadEM Positions XY Luka Debenjak via Tech-talk
References:
quadEM Positions XY Luka Debenjak via Tech-talk

Navigate by Date:
Prev: Re: Can I configure CA Gateway to ignore boardcast Smith, Martin via Tech-talk
Next: Re: quadEM Positions XY Luka Debenjak via Tech-talk
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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: quadEM Positions XY Luka Debenjak via Tech-talk
Next: Re: quadEM Positions XY Luka Debenjak via Tech-talk
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  <20192020  2021  2022  2023  2024 
ANJ, 26 Feb 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·