Calibration of Electrical Fast Transient/ Burst Generators

Download Report

Transcript Calibration of Electrical Fast Transient/ Burst Generators

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 Immigration Tower, 7 Gloucester Road, Wanchai, Hong Kong
Phone: (852) 2829 4850, Fax: (852) 2824 1302, Email: [email protected]
Authors: C.M.Tsui, Y.K.Yan, H.W. Li
The Government of the Hong Kong Special Administrative Region
Standards and Calibration Laboratory
Case 1 : A Simple Case First
X1
What are the standard
uncertainties of output quantities
Y1 and Y2 ? And what is the
correlation between them ?
Multivariate
Measurement Model
X2
Y1
Y1 = X1 + X3
Y2 = X2 + X3
Y2
X3
Input quantities X1, X2, X3 are independent and
have Gaussian distribution with mean = 0 and
standard uncertainties of 1.
?
Case 2 : A little bit more
complicated
?
X1
Measurement
Model
X2
Y1
Y1 = X1 + X3
Y2 = X2 + X3
Y2
X3
0
3 √3
Input quantities X1, X2 remain the same.
X3 now has rectangular distribution with mean = 0
and standard uncertainty of 3.
Case 3 : Complex Number
Measurement Model

A simplified measurement model for the effective output
voltage reflection coefficient () of a power splitter.
S12 S 23
  S 22 
S13

The 3-port S-parameter and  are complex quantities.
A Short Demonstration First
Don’t Worry If You Don’t Know What I am
Doing
I Will Explain Shortly
Let’s 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
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.
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.
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).
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.
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.
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
Formulation (Setting up Input
Quantities and Assigning PDF)
G, T : std.dev
R,U,TR : semi-range T : DOF
CTP, TP : a
CTP, TP : b
PDF*
value
X1
G
0.000E+00
1.000E+00
X2
T
0.000E+00
1.000E+00
X3
R
0.000E+00
1.000E+00
X4
U
0.000E+00
1.000E+00
X5
TR
0.000E+00
1.000E+00
X6
CTP
-1.000E+00
1
0.3
X7
TP
-1.000E+00
1
0.5
X8
E
TP : b
CTP : d
5
1.000E+00
X9
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.
X10
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.
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.
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.
Summarizing
Method
y1
y2
u(y1)
u(y2)
r(y1, y2)
MCM
-0.004
0.001
3.161
3.161
0.900
GUF
0.000
0.000
3.162
3.162
0.900
Covariance matrix of output
obtained by MCM
Covariance matrix of output
obtained by GUF
9.995
8.996
10.000
9.000
8.996
9.995
9.000
10.000
0.140
8
0.120
6
0.100
4
0.080
Y2
2
0.060
0
-8
-5
-4
-2
0
0.040
-2
0.020
-4
0.000
-10
-6
2
4
6
8
-6
0
5
10
-8
Y1
Histogram of PDF for an
output quantity.
Contour of the joint PDF
for the output quantities
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 hyperrectangle.
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.
Case 3 : Complex Number
Measurement Model

A simplified measurement model for the effective output
voltage reflection coefficient () of a power splitter.
S12 S 23
  S 22 
S13

The 3-port S-parameter and  are complex quantities.
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
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.
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 = P+Q = (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)
Function to multiply
complex numbers
 From high school algebra, for complex number multiplication,
we have
(p + qi) (x + yi) = (px-qy) + (qx+py)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
Function to divide
complex numbers
 For complex number division, we have
(p  qi) (px  qy) (qx  py)
 2
 2
i
2
2
(x  yi) (x  y ) (x  y )
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
Representing
Complex Number Equation

Using the above functions, the following complex number
equation can be represented by a single Visual Basic
statement
S12 S 23
  S 22 
S13
VRC = cminus(S22, cdiv(cmul(S12, S23), S13))
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
The Input Quantities for Case 3
G, T : std.dev
R,U,TR : semi-range
CTP, TP : a
PDF*
value
s22 magnitude
G
0.24776
0.00337
s22 phase
G
4.88683
0.01392
s12 magnitude
G
0.49935
0.00340
s12 phase
G
4.78595
0.00835
s23 magnitude
G
0.24971
0.00170
s23 phase
G
4.85989
0.00842
s13 magnitude
G
0.49952
0.00340
s13 phase
G
4.79054
0.00835
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.
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.
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.
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.
User Defined Function
The syntax of the UDF is
=gum2(range, index, sim_mode, sim_par, conf_type, model_index)
range :
index :
sim_mode :
To point to the table of input quantities.
To specify the return parameter of the function
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.
User Defined Function
index
1
2
3
4
11
12
13
14
21
22
23
Computed by MCM
Computed by GUF
Return parameter
index Return parameter
expectation of measurand 1
101 expectation of measurand 1
standard uncertainty of measurand 102 standard uncertainty of measurand 1
1
low boundary of 95% confidence 103 effective degree of freedom of
interval of measurand 1
measurand 1
high boundary of 95% confidence 104 coverage factor of measurand 1
interval of measurand 1
expectation of measurand 2
105 expanded uncertainty of measurand
1
standard uncertainty of measurand 111 expectation of measurand 2
2
low boundary of 95% confidence 112 standard uncertainty of measurand 2
interval of measurand 2
high boundary of 95% confidence 113 effective degree of freedom of
interval of measurand 2
measurand 2
kp
114 coverage factor of measurand 2
kq
115 expanded uncertainty of measurand
2
correlation coefficient
121 correlation coefficient