Software Tools for Evaluation of Measurement Models for Complex-valued Quantities in Accordance with Supplement 2 to the GUM Speaker: C.M.Tsui The Government of the Hong Kong Special Administrative Region Standards and Calibration Laboratory 36/F - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Software Tools for Evaluation of Measurement Models for Complex-valued Quantities in Accordance with Supplement 2 to the GUM Speaker: C.M.Tsui The Government of the Hong Kong Special Administrative Region Standards and Calibration Laboratory 36/F

Description:

Software Tools for Evaluation of Measurement Models for Complex-valued Quantities in Accordance with Supplement 2 to the GUM Speaker: C.M.Tsui – PowerPoint PPT presentation

Number of Views:270
Avg rating:3.0/5.0

less

Transcript and Presenter's Notes

Title: Software Tools for Evaluation of Measurement Models for Complex-valued Quantities in Accordance with Supplement 2 to the GUM Speaker: C.M.Tsui The Government of the Hong Kong Special Administrative Region Standards and Calibration Laboratory 36/F


1
Software Tools for Evaluation of Measurement
Models for Complex-valued Quantities in
Accordance with Supplement 2 to the GUMSpeaker
C.M.TsuiThe Government of the Hong Kong Special
Administrative RegionStandards and Calibration
Laboratory36/F Immigration Tower, 7 Gloucester
Road, Wanchai, Hong KongPhone (852) 2829 4850,
Fax (852) 2824 1302, Email cmtsui_at_itc.gov.hkAut
hors C.M.Tsui, Y.K.Yan, H.W. LiThe Government
of the Hong Kong Special Administrative
RegionStandards and Calibration Laboratory
2
Case 1 A Simple Case First
?
What are the standard uncertainties of output
quantities Y1 and Y2 ? And what is the
correlation between them ?
X1
Multivariate Measurement Model
Y1
  • Y1 X1 X3
  • Y2 X2 X3

X2
Y2
X3
Input quantities X1, X2, X3 are independent and
have Gaussian distribution with mean 0 and
standard uncertainties of 1.
3
Case 2 A little bit more complicated
?
X1
Measurement Model
Y1
  • Y1 X1 X3
  • Y2 X2 X3

X2
Y2
X3
Input quantities X1, X2 remain the same. X3 now
has rectangular distribution with mean 0 and
standard uncertainty of 3.
3 v3
0
4
Case 3 Complex Number Measurement Model
  • A simplified measurement model for the effective
    output voltage reflection coefficient (?) of a
    power splitter.
  • The 3-port S-parameter and ? are complex
    quantities.

5
A Short Demonstration First Dont Worry If You
Dont Know What I am Doing I Will Explain Shortly
6
Lets Try Some Variation
  • What happens if we change the measurement model
    from this
  • Y1 X1 X3
  • Y2 X2 X3
  • to that
  • Y1 X1 X3
  • Y2 X2 - X3

7
GUM and the Supplements
  • In 1993, the GUM was released. It defined the GUM
    Uncertainty Framework (GUF) for evaluation of
    measurement uncertainties.
  • There are limitations in the application of GUF.
    In 2008, Supplement 1 was published. It concerned
    with the propagation of probability distributions
    through a measurement model.
  • The conditions for valid application of the GUF
    are described in details in sections 5.7 and 5.8
    of Supplement 1. When these conditions cannot be
    met, a Monte Carlo method (MCM) should be used.

8
GUM and the Supplements
  • The GUM and Supplement 1 mainly deal with models
    having any number of input but only one output
    quantity.
  • In many real world measurement systems,
    especially when complex numbers are involved,
    there are more than 1 output. The output may be
    correlated. The coverage region is
    multidimensional and much more complicated than
    the univariate cases.
  • The GUM and Supplement 1 are inadequate for
    measurement models with multiple outputs. The new
    Supplement 2, deals with models having any number
    of input quantities and any number of output
    quantities.

9
The SCL software tools (1)
  • The SCL software tools support evaluation of
    complex valued measurement models in accordance
    with Supplement 2. Users only need to
  • encode the measurement model as a Visual Basic
    subroutine
  • specify parameters of uncertainty components,
    such as estimates, standard uncertainties and
    probability distribution function (PDF)
  • The software tools, written in Visual C and
    Visual Basic, are tightly integrated with
    Microsoft Excel which serves as front-end user
    interface.
  • Computational intensive routines that require
    faster execution speed were developed in Visual
    C and compiled into a Dynamic Link Library
    (DLL).

10
The SCL software tools (2)
  • The SCL software tools include two parts that can
    be used separately.
  • Simulator
  • User Defined Function
  • The simulator enable the users to vary the
    parameters of input quantities and the
    measurement model interactively. Users can
    experiment with different configurations of the
    measurement system and see the effects on the
    measurement uncertainties.
  • The user-defined function can be embedded in any
    Microsoft Excel worksheet like an ordinary
    function for GUF or MCM computation.

11
The 3 Stages of Uncertainty Evaluation
  • Formulation
  • Define input X and output Y.
  • Establish mathematical relationship between X and
    Y (i.e. the measurement model)
  • Propagation
  • Obtain PDF of Y from X through the measurement
    model.
  • Summarizing
  • The expectation, covariance matrix and coverage
    region of Y are obtained from PDF of Y.

12
Formulation (setting up measurement model)
  • Section 9.2 of Supplement 2 describes the
    following additive measurement model.
  • Y1 X1 X3
  • Y2 X2 X3
  • Public Static Sub model(x() As Double, y() As
    Double)
  • y(1) x(1) x(3)
  • y(2) x(2) x(3)
  • End Sub

13
Formulation (Setting up Input Quantities and
Assigning PDF)
The following PDF types are supported CTP -
curvilinear trapezoid E - exponential G -
Gaussian R - rectangular TP - trapezoidal TR -
triangular T - student-t U - arc sine.
14
Propagation
  • 3 ways to propagate the distributions.
  • Analytical method (impractical for most real
    world measurement systems)
  • First order Taylor series approximation of the
    measurement model (GUF)
  • Numerical method (MCM)
  • The SCL software tools support the second and
    third methods.

15
Propagation (First order Taylor series
approximation)
  • the input quantities are characterized by
  • a vector representing the estimates of the input
    quantities x (x1, xN)T
  • a covariance matrix Ux containing the covariance
    of the input quantities.
  • Measurement model denoted by Y f(X),
  • Estimate y f(x).
  • Covariance matrix Uy CxUxCxT
  • Cx is the sensitivity matrix. The entry at row i
    and column j of Cx is given by the partial
    derivative ?fi/?xj.

16
Propagation (MCM)
  • The idea of MCM is to make large number of draws
    from the PDF of the input quantities and to
    derive the output quantities for each draw. The
    larger is the number of draws, the more reliable
    are the results. The trade-off is a longer
    computation time.
  • There are two ways to select the number of Monte
    Carlo trials. A fixed number can be chosen
    beforehand. Alternatively an adaptive algorithm
    may be used to determine the number of trials
    on-the-fly based on the stability of the
    simulated output.

17
Summarizing
Histogram of PDF for an output quantity.
Contour of the joint PDF for the output
quantities
18
Summarizing (coverage region)
  • It is not easy to determine the multidimensional
    coverage regions for vector output quantities.
  • Supplement 2 considers only two types of coverage
    regions for multivariate cases hyper-ellipse and
    hyper-rectangle.
  • They are characterized by two sets of quantities
    the covariance matrix for the output quantities
    and a scalar parameter (kp for hyper-ellipse and
    kq for hyper-rectangle) which determines the
    volume under the PDF corresponding to the
    coverage probability.

19
Case 3 Complex Number Measurement Model
  • A simplified measurement model for the effective
    output voltage reflection coefficient (?) of a
    power splitter.
  • The 3-port S-parameter and ? are complex
    quantities.

20
Visual Basic User Defined Data Type
  • It is quite easy to represent complex numbers in
    Visual Basic by means of the user defined data
    type.
  • The following declares a user defined data type
    called Complex (actually you can give it any
    name you like), variable r is the real part and i
    is the imaginary part
  • Type Complex
  • r As Double
  • i As Double
  • End Type

21
Declare a Variable as Complex Quantity
  • Suppose the variable x(1) stores the magnitude of
    a complex number and x(2) stores the phase.
  • We can declare a variable S22 as complex data
    type and initialize its real and imaginary parts
    as follows
  • Dim S22 As Complex
  • S22.r x(1) Cos(x(2))
  • S22.i x(1) Sin(x(2))
  • From now on you can treat S22 as a single item.

22
Function to add complex numbers
  • Next, we can define function to manipulate
    complex numbers. The following is a function to
    add two complex numbers
  • Public Function cadd(a As Complex, b As Complex)
    As Complex
  • cadd.r a.r b.r
  • cadd.i a.i b.i
  • End Function
  • The following is an example of using the cadd
    function.
  • R PQ (1 i)(3 2i) 4 I
  • Dim P As Complex, Q As Complex, R As Complex
  • P.r 1 P.i -1
  • Q.r 3 Q.i 2
  • R cadd(P, Q)

23
Function to multiply complex numbers
  • From high school algebra, for complex number
    multiplication, we have
  • (p qi) (x yi) (px-qy) (qxpy)i
  • Public Function cmul(a As Complex, b As Complex)
    As Complex
  • cmul.r a.r b.r - a.i b.i
  • cmul.i a.r b.i a.i b.r
  • End Function
  •  

24
Function to divide complex numbers
  •  
  • For complex number division, we have
  • Public Function cdiv(a As Complex, b As Complex)
    As Complex
  • Dim D As Double
  • D b.r b.r b.i b.i
  • cdiv.r (a.r b.r a.i b.i) / D
  • cdiv.i (a.i b.r - a.r b.i) / D
  • End Function

25
Representing Complex Number Equation
  • Using the above functions, the following complex
    number equation can be represented by a single
    Visual Basic statement
  • VRC cminus(S22, cdiv(cmul(S12, S23), S13))

26
Putting All Together
Type Complex r As Double i As
Double End Type Public Static Sub model(x() As
Double, y() As Double) ' X(1) s22 magnitude
X(2) s22 phase ' X(3) s12 magnitude
X(4) s12 phase ' X(5) s23 magnitude
X(6) s23 phase ' X(7) s13 magnitude
X(8) s13 phase Dim S22 As Complex, S12 As
Complex, S23 As Complex, S13 As Complex Dim VRC
As Complex S22.r x(1) Cos(x(2)) S22.i x(1)
Sin(x(2)) S12.r x(3) Cos(x(4)) S12.i
x(3) Sin(x(4)) S23.r x(5) Cos(x(6)) S23.i
x(5) Sin(x(6)) S13.r x(7) Cos(x(8))
S13.i x(7) Sin(x(8)) VRC cminus(S22,
cdiv(cmul(S12, S23), S13)) y(1) VRC.r y(2)
VRC.i End Sub
27
The Input Quantities for Case 3
  • Many people think it will be more appropriate to
    treat the magnitude and phase, rather than the
    real and imaginary parts, of S-parameter measured
    by a network analyzer as independent and use them
    as input quantities to a measurement model.

28
Some Considerations in Encoding Complex Quantity
Models (1)
  • There are commonly two ways to represent a
    complex quantity either in terms of its real and
    imaginary parts or in polar form by its magnitude
    and phase.
  • It is recommended that the output quantities of
    the model should be in terms of real and
    imaginary parts.
  • The reason is that in the summarizing stage of
    MCM, statistical analysis is applied to the MCM
    trials.
  • It is known that statistical analysis on complex
    quantities will produce different results
    depending on whether the inputs to the
    statistical analysis are represented in polar
    form or not.

29
Some Considerations in Encoding Complex Quantity
Models (2)
  • Potential problems in statistical analysis on
    polar form
  • The transformation between rectangular and polar
    form is non-linear.
  • The real and imaginary axes extend to plus and
    minus infinity while the magnitude is always
    non-negative.
  • The phase is cyclical in nature.
  • To avoid these problems, the output quantities of
    the measurement model should be in terms of real
    and imaginary parts.
  • Results should only be converted into polar form
    after statistical analysis.

30
User Defined Function
  • The second part of the SCL software tools is an
    Excel user-defined function (UDF) that can be
    embedded in any Excel worksheet for GUF or MCM
    computation.
  • An Excel UDF behaves just like other Excel
    built-in functions. It takes arguments and
    returns a value. An Excel UDF will be executed
    whenever any value in its argument list changes.
    Re-calculation is automatic.
  • A drawback of Excel UDF is that if it takes a
    long time to execute, such as when running MCM
    for a large number of trials on a complicated
    measurement model, Microsoft Excel will appear
    frozen.

31
User Defined Function
The syntax of the UDF is gum2(range, index,
sim_mode, sim_par, conf_type, model_index) range
To point to the table of input
quantities. index To specify the return
parameter of the function sim_mode Enter 1 to
select adaptive simulation mode. Enter 2 to
select fixed sample size simulation mode sim_par
Enter number of significant digits (1 or 2)
for adaptive simulation mode. Enter the number of
trials for fixed sample size simulation mode.
  conf_type Optional parameter. Enter 1 to
select symmetrical coverage interval type. Enter
2 to select shortest coverage interval type. This
is for compatibility with Supplement 1 to the
GUM. model_index Optional parameter for future
expansion.
32
User Defined Function
Computed by MCM Computed by MCM Computed by GUF Computed by GUF
index Return parameter index Return parameter
1 expectation of measurand 1 101 expectation of measurand 1
2 standard uncertainty of measurand 1 102 standard uncertainty of measurand 1
3 low boundary of 95 confidence interval of measurand 1 103 effective degree of freedom of measurand 1
4 high boundary of 95 confidence interval of measurand 1 104 coverage factor of measurand 1
11 expectation of measurand 2 105 expanded uncertainty of measurand 1
12 standard uncertainty of measurand 2 111 expectation of measurand 2
13 low boundary of 95 confidence interval of measurand 2 112 standard uncertainty of measurand 2
14 high boundary of 95 confidence interval of measurand 2 113 effective degree of freedom of measurand 2
21 kp 114 coverage factor of measurand 2
22 kq 115 expanded uncertainty of measurand 2
23 correlation coefficient 121 correlation coefficient
Write a Comment
User Comments (0)
About PowerShow.com