U.S. Department of Commerce

National Bureau of Standards

NBS MEASUREMENT SERVICES

special Publication 25(K26

NBS PHASE ANGLE

CALIBRATION SERVICES

R. S. Turgei, J. M. Mulrow, and D. F. Vecchia
INTTRODUCING THE CENTER FOR ELECTRONICS AND ELECTRICAL ENGINEERING

The Center for Electronics and Electrical Engineering (CEEE) is the component of the

National Bureau of Standards charged with providing Bureau activities and services

supporting electrotechnology. In response to identified and anticipated needs, Center

programs provide national reference standards, measurement methods, supporting theory and

data, and traceability to national standards. Beneficiaries are U.S. industry, other

Government organizations, the academic community, and society at large. In fiscal year

1987, the Center calibrated nearly a thousand transfer standards for some 200 customers.

The Center is organized into four technical divisions, with the Electrosystems and

Semiconductor Electronics Divisions at Gaithersburg, Maryland and the Electromagnetic

Fields and Electromagnetic Technology Divisions at Boulder, Colorado. The Center

provides measurement research and services for:

o Conducted electrical signals and energy in the Electrosystems Division:

dielectrics for advanced power systems

conducted electromagnetic interference

waveform synthesis

- signal acquisition and processing

automatic test equipment

calibration/testing strategies

o Radiofrequency signals and interference in the Electromagnetic Fields Division:

radiofrequency to millimeter-wave electromagnetic fields and signals

general microwave and millimeter-wave instruments, components

microwave and millimeter-wave noise

microwave and millimeter-wave antenna systems

radiated electromagnetic interference; electromagnetic compatibility

monolithic microwave/millimeter-wave integrated circuits materials properties measurements at high frequencies

o Lightwaves, cryogenics, and magnetics in the Electromagnetic Technology

Division:

- optical fibers; integrated electro-optics

superconducting materials

- superconducting electronics

- magnetic materials

o Semiconductor Electronics, in the Semiconductor Electronics Division:

semiconductor materials, such as silicon and gallium arsenide

semiconductor materials modification

semiconductor devices

integrated-circuit test structures for rapid process assessment

For information, contact the Center at 1 -301 -975-2220 or write to: The Center for Electronics and Electrical Engineering, Metrology Building Room B-358, National Bureau of Standards, Gaithersburg, MD 20899.
NBS MEASUREMENT SERVICES:

NBS Phase Angle Calibration Services

R. S. Turgel

Electrosystems Division

Center for Electronics and Electrical Engineering

National Engineering Laboratory

National Bureau of Standards

Gaithersburg, MD 20899

J. M. Mulrow and D. F. Vecchia

Statistical Engineering Division

Center for Applied Mathematics

National Engineering Laboratory

National Bureau of Standards

Boulder, CO 80303

May 1988

U.S. DEPARTMENT OF COMMERCE, C. William Verity, Secretary

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Director
Library of Congress Catalog Card Number: 88-600501

National Bureau of Standards Special Publication 250-26

Natl. Bur. Stand. (U.S.), Spec. Publ. 250-26, 114 pages (May 1988)

CODEN: XNBSAV

U.S. GOVERNMENT PRINTING OFFICE

WASHINGTON: 1988

For sale by the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402-9325
PREFACE

Calibrations and related measurement services of the National Bureau of Standards (NBS) provide the means for industry, government agencies, academia,

and others to relate the measurements they make to national standards and, by

extension, to the measurement systems of other countries throughout the world.

It is of crucial importance to improving U.S. productivity, efficiency, and quality

-- in short our competitive stance - that measurements of appropriate accuracy can be made at all stages of product development, production, and marketing and

that it is possible to refer the results of these measurements to each other in a meaningful way. NBS services provide essential support for satisfying these

needs, as well as measurement needs arising from societal concerns such as

health, safety, natural resources, and defense. The requirements of NBS clientele range from the highest levels of accuracy realizable from advanced science and

technology to the practical levels of accuracy needed to support routine

production. A reference-level measurement may be the result of days of painstaking individual effort or may be provided by a semi-automatic measuring

system in minutes. The variation in customer needs and hence in NBS services

responsive to those needs is great.

The more than 300 different calibration services, measurement assurance

services, and special tests that are offered by NBS are described in NBS Special

Publication 250, NBS Calibration Services Users Guide. The Guide provides

essential technical details of NBS calibration and related measurement sen/ices,

such as levels of accuracy provided by NBS and the requirements to be met by

customers' transfer standards. It also provides information needed for placing

orders for these services and identifies technical and administrative contacts for each service.

Technical descriptions in the Users Guide are intended to be restricted to the

material needed by a potential customer to decide if a given service will meet

that customer's needs. Frequently, a customer may be interested in more

detailed and extensive information, such as the way in which the errors associated with a measurement are assessed. Beginning in 1987, NBS established a Special Publication 250 series which supplements the Guide. Each publication

in this series provides a detailed technical description of a specific NBS

calibration service, or closely related set of services, and includes:

o specifications for the service

o design philosophy and theory

o description of NBS measurement system used to provide service

o NBS operational procedures

o measurement uncertainty assessment, including error budget,

identification of systematic and random errors

o NBS internal quality control procedures

Special Publication 250-26, NBS Phase Angle Calibration Services, describes

special-test service offered under NBS Test Number 551 1 0S by the Electronic

Instrumentation and Metrology Group in the Electrosystems Division. Service

551 1 0S is part of a series of services offered by the Division that are intended

to support the application of modern electronic techniques to measurement

problems.
List of Tables

page

Table 1. Estimated Phase Angle Uncertainty 4

Table A-1 Critical Values ^a/l^^^ °f Student's t Distribution 21

List of Figures

Figure 1. Diagram of the calibration curve for a phase meter 5

Figure 2A. Differences Between Measured Phase Angles and Corresponding

NBS Values, Plotted Against NBS Values (Example 1) 8

Figure 2B. Differences Between Measured Phase Angles and Corresponding

NBS Values, Plotted Against NBS Values (Example 2) 8

Figure 3A. Measured Phase Angles Plotted Against Corresponding NBS

Values (Example 3) 9

Figure 3B. Differences Between Measured Phase Angles and Corresponding

NBS Values, Plotted Against NBS Values (Example 3) 9

Figure 4. Calibration curve for a phase meter with corresponding

confidence bands 13

Figure 5. Changes in calibration curve from repetition to repetition . . 19

vi
NBS PHASE ANGLE CALIBRATION SERVICE

Abstract

The National Bureau of Standards (NBS) offers a calibration service for audio - frequency phase meters.

The calibrations are based on a phase angle standard

developed at NBS that generates two sinusoidal signals

displaced relative to one another by a precisely known

phase angle over a frequency range of 2 hertz to 50

kilohertz. The signal amplitudes are independently

adjustable on each channel from 0.5 volts to 100 volts.

The angular resolution is better than 0.002° at the low

end of the frequency range and decreases to 0.005° at

the high end. The uncertainty of the phase angle

between the two signals generated by the standard varies

from 0.005° to 0.04°, depending on frequency and

amp 1 i tude

Using the phase angle standard, phase meter readings are obtained at selected test points. From the calibration

data, the phase meter response characteristic is

determined and is compared to that of an ideal meter

having a linear characteristic. If the phase meter

response conforms to the linear model, a straight- line

calibration curve is derived from the data and serves to

calculate corrected readings. From the statistical

parameters associated with the calibration curve, it is

possible to estimate the limits of offset between the

calibrated meter and the calibration standard. By

extension, the uncertainty of readings of the phase

meter in the user's laboratory can be estimated.

Key Words: Calibration, Calibration Curve, Linear Model, Phase Meter, Phase

Standard, Uncertainty.

vii

1 . INTRODUCTION

The measurement of phase angle is important in many applications

encompassing diverse areas such as power systems, navigation, satellite

tracking, and servo circuit design. Modern phase meters are capable of

resolution of 0.01 degrees, so that the process of checking their calibration

is far from trivial.

Phase angles, like voltage ratio, are dimensionless quantities and, in

theory at least, can be reproduced at any time without reference to physical

standards. In practice, however, doing so is a difficult task and prone to

cumulative errors. It is, therefore, highly desirable and convenient to use

a phase angle standard for phase meter calibrations to assure consistency of

measurements

The National Bureau of Standards (NBS) is providing a calibration service

for audio frequency phase meters to make consistent and traceable phase

measurement possible. This Technical Note describes the phase meter

calibration procedure used at NBS and provides some of the statistical

background for evaluating the accuracy of the calibrations

2. DESCRIPTION OF SERVICE

NBS provides phase meter calibrations over a frequency range from 2 Hz to

50 kHz. The nominal frequency resolution of the test signal is 1 Hz up to

5 kHz and 10 Hz from 5 to 50 kHz. The frequency stability of the signal

provided is of the order of 10 parts per million, and the accuracy of the

frequency is limited by the synthesizer adjustment as described in [1]. The

phase angle of the standard is insensitive to the exact frequency value and is

not affected by frequency drifts.

The amplitudes of the two signals applied to the phase meter can be

varied independently over a useful range from 0.5 to 100 volts, or 0.5 to 5 amperes with a special transconductance amplifier [2]. Since phase meters

are generally not very sensitive to amplitude, no attempt is made to regulate

the magnitude of the output voltages (or currents) precisely. The amplitude

values are adjusted to within a few tenths of a percent, but should be

regarded as nominal values only.

3. DESIGN PHILOSOPHY

Phase meter calibrations can be carried out by comparing the reading of

the phase meter under test with that of a reference phase meter. For such a procedure to be valid, the signal source, although uncalibrated , must be well

characterized. Frequency and phase stability, as well as spectral purity, of

the test signals must have sufficiently tight tolerances so that the waveform

will not influence the response of the phase meter. Rather than develop such

a precision phase meter and a suitable signal source, it seemed preferable to

1
combine their attributes and develop a phase-calibrated signal source. The

reasons for choosing this particular implementation, which is embodied in the

NBS Phase Angle Standard, are discussed in [1].

4. DESCRIPTION OF THE SYSTEM

The NBS Phase Angle Standard, described in detail in [1] , [3] , [4] , and [5]

is a signal source that provides two sinusoidal voltage outputs displaced

relative to each other by a known phase angle. To calibrate a phase meter,

the meter is generally connected directly to the two outputs of the Phase

Angle Standard. If one of the inputs to the phase meter requires a current, a specially designed transconductance amplifier [2] is connected between the

Phase Angle Standard and the phase meter to be calibrated. The amplifier

furnishes a current proportional to the Phase Angle Standard output voltage

with a known and generally negligible additional phase offset. Further

details can be found in [1] and [3].

5. CALIBRATION PROCEDURE

The calibration procedure is controlled from an instrument controller via

a General Purpose Interface Bus (GPIB)-^. If the instrument under test is also

bus compatible, then the calibration can proceed almost completely

automatically. In most cases, however, the phase meter output will have to be

read from its own display and manually entered into the controller (computer)

Wherever possible, a second precision phase meter, used as a check

standard, is connected in parallel with the instrument under test. Since the

characteristics of the check standard are well-known, the measurement results

obtained from it provide additional reassurance that the system is operating

properly. The indicated phase angles are then recorded from the readouts of

the phase meter under test and the check standard meter. The readings are entered into a computer (instrument controller) keyboard, or transferred

directly to the controller via the GPIB, if provided.

The usual procedure consists of selecting 12 phase angles spanning the

interval from 0° to 360° (or other intervals specifically requested by the

customer) for each set of input voltage (current) and frequency conditions.

Normally, four replicate readings are taken at each selected phase angle. The

order of measurements is chosen at random such that one set of 12 phase angle

measurements is completed before the next one is started and is arranged so that the same angle is never measured twice in succession. Because some phase

meters have appreciable settling times, a variable delay is provided by the

controller between setting the Phase Angle Standard and recording the reading.

If the delay required to obtain consistent readings is longer than five

seconds, the time interval is reported in the calibration report.

IEEE Standard 488-1978

2
All readings are recorded on magnetic tape or disk, whether entered

manually or automatically via the bus. For the purposes of calculation,

angles lying between 359 and 361 degrees are converted to corresponding values

in the range of -1 to +1 degrees. On phase meters having more than one readout range, readings are taken on the 0 to 360 degree range whenever

possible

Each specified set of conditions of frequency and input voltages or currents is designated as a "Range," and phase angle data for each Range are treated independently. An exception is made if it is deemed necessary to

retest a Range and if the results of both sets of measurements appear to come from the same (statistical) population. In that case the results of both

Ranges are combined.

Immediately after completing the set of readings on a particular Range, a plot of differences between the phase meter readings and the corresponding

phase angle settings on the Phase Angle Standard is obtained. This plot helps

in checking for outliers or possible errors in the data entered. By

superimposing a similar plot of the differences obtained from the check

standard, similarities between the two sets of data can be examined.

Normally, these two sets can be expected to be uncorrelated , and any obvious

similarity may indicate an equipment malfunction.

After all the calibration data have been collected and have been given a preliminary check, as indicated above, the statistical procedures outlined

below are applied to the data.

6. SYSTEMATIC ERRORS IN PHASE ANGLE STANDARD

The uncertainty of the phase angle between the two output signals

generated by the Phase Angle Standard is a function of frequency as well as signal amplitude. The values of estimated uncertainty components are shown in

Table 1 . The values in this table are based on experimental data reported in

[3] and measurements made during the development of the system. These values

apply only for the Phase Angle Standard itself. For those calibrations

requiring an output voltage in excess of 100 volts rms or an output current

instead of a voltage, external amplifiers must be used. The phase shifts

caused by these amplifiers, which may be of the order of degrees, must be

compensated by an adjustment of the Phase Angle Standard. While the phase

shifts in the external amplifiers are relatively stable with time, they do

lead to an increased uncertainty of the phase angle of the system. The

additional uncertainty component is assigned on the basis of phase stability

determined by monitoring the system output with a bridge circuit [1]. The

bridge circuit measures the phase error at a nominal 180-degree phase angle.

Typically, for test parameters of 120 V, 5 A, and 60 Hz, the sum of the

systematic uncertainty components due to the external amplifiers is increased

to 0.025 degrees.

3
Table 1. Estimated Phase Angle Uncertainty

60 Hz 400 Hz 5 kHz 15 kHz 30 kHz 50 kHz

(Units of Millidegrees)

Auto-Zero Corr.* 1 2 5 6 12 20

Linearity 2 2 3 10 15 20

7:1 Voltage Ratio 1 2 3 10 20 40

*The uncertainty due to frequency adjustment is included.

The correction determined by the auto -zero procedure can be verified

experimentally from time- to- time using the bridge technique described in [1]

and [2]. Experience gained so far seems to indicate that the residual error after the auto-zero correction is applied will not vary by more than one or two millidegrees over periods of a month or so. Stability of the auto-zero

correction itself can be ascertained easily by noting the value for the

correction displayed on the readout of the Phase Angle Standard. The value

determined is recorded with the phase meter calibration data to obtain a history of the performance of the standard.

7. CALIBRATION CURVE

As outlined above, calibration of phase meters is achieved by

intercomparison of readings from the phase meter under test with the

corresponding values assigned to the NBS Phase Angle Standard. A functional

relationship is then established between the phase meter measurements and the

phase angle values of the standard, and the corrected readings of the user's

phase meter are derived based on this functional relationship.

An illustration of such a simple relationship is shown in Figure 1, where

the solid straight line represents the calibration curve fitted to all

measurements. To make measurements with the user's phase meter, the observed

values are related to the NBS values by means of the calibration curve which

brings the corrected measurement results into close agreement with the

standard. Schematically, for a future phase meter value, y, a dotted line is

drawn through y parallel to the x-axis. At the point where it intersects the

calibration curve, another dotted line is drawn parallel to the y-axis, and

its point of intersection with the x-axis, x, is the corresponding calibrated

value relative to NBS. The reader is referred to reference [6] for a more detailed discussion on the use of linear calibration curves.

4
30 90 150 210 270 330

NBS Value x , Degrees

Figure 1 . Diagram of the calibration curve for a phase meter

7.1 Simple Linear Model

The procedures and analyses discussed below are appropriate for

calibrating phase meters that have an essentially linear response

characteristic. A phase meter that has a linear response relative to the NBS

Phase Angle Standard will exhibit the following behavior. An observed phase

angle, y, will be related to the phase angle, x, assigned to the signals

generated by the NBS Phase Angle Standard, plus random noise which in the

linear expression is designated by a term, e.

y = a + bx + e

For an ideal meter the slope, b, will equal 1, the intercept, a, will

equal zero, and the scatter of random measurement errors will be sufficiently

small for the measurement system.

To examine the relationship between the values of the NBS Phase Angle

Standard and the observations from an actual user's phase meter, the observed

phase angles are first fitted to a simple linear function of the NBS values,

and then the adequacy of the straight- line fit is tested. If the linearity is

acceptable, the statistical significance of differences of the estimated slope

and intercept from their respective ideal values is checked.

If these statistical tests show that the user's phase meter offset is not

negligible, thus indicating a need for correction of the phase meter readings,

the fitted curve becomes the calibration curve for the user's phase meter.

The uncertainty of the corrected values obtained from the calibration curve is

then estimated using the procedure discussed below in sections 7.5 and 7.6.

5
' 7.2 Least Squares Fit

Given phase meter measurements yj^j corresponding to NBS phase angle

values X , where i is the index of the selected phase angle and j denotes the

repetition, a simple model to describe the phase meter behavior is given by:

/ i = 1 , . . . , k

yij = a + b Xi + eij , | j = 1, .... n

where the random measurement errors, Sj^j , are typically assumed to have a Gaussian distribution with mean value zero and standard deviation a, to be

estimated.

Using a caret (^) to denote estimated parameter values, the

squares estimates of the slope and intercept are:

k n

.1, .1 (Yij-y) (xi-x)

1=1 j = l

leastb =

n y (xi-x)2

1=1

where

y =

y - b X

k n

.1, .1, yij

nk

and X =

k

The residuals from the fit are:

yij - a - b Xi , and the residual standard deviation, which estimates a, is

s =

k n

1=1 j=l ij

nk-2

Two sample data sets will be used to illustrate the phase meter

calibration computations. Figures 2A and 2B show examples of data from two

meters. The plots are of the differences (yij-Xj^) versus x^ . For Example 1,

three repetitions (n=3) of the phase meter measurements were obtained at 12

phase angle settings (k=12) on the NBS Phase Angle Standard. For Example 2,

four repetitions (n=4) of the phase meter measurements were obtained at the same 12 phase angle settings (k=12) as in Example 1. Also, note that if the

phase meter is in agreement with the NBS standard, the plot of the differences

6
should be randomly distributed about a horizontal line through zero as in

Figure 2B . Thus the phase angle measurements in Figure 2A show that a slope

of the calibration curve different from one (b 1) will be necessary to

correct the phase meter readings.

Plotting the differences between the observed phase angles and the

corresponding NBS values against the NBS values will disclose any aberrant or systematic behavior of the user's phase meter. For example, oscillatory

behavior of the data would suggest that the simple linear relationship does

not represent the system. Example 3, shown in Figures 3A and 3B, illustrates

this type of behavior. Figure 3A is a plot of y vs . x, and no noticeable

nonlinearities are apparent. The same data are replotted in Figure 3B as the

(y-x) differences vs. x, and a nonlinear pattern is now apparent. A

statistical test for detecting such nonlinearity is discussed below.

7
0.10

0.05 -

cm ^ 0.00 - X

I

-0.05 -

-0.10

30 90 150 210 270

NBS Value x , Degrees

330

Figure 2A. Differences Between Measured Phase Angles and Corresponding NBS

Values, Plotted Against NBS Values (Example 1).

C3fl 0) Q

X

I

0.10

0.05 -

0.00 -

-0.05 -

-0.10

30 90 150 210 270

NBS Value x , Degrees

330

Figure 2B. Differences Between Measured Phase Angles and Corresponding NBS

Values, Plotted Against NBS Values (Example 2).

8
30 90 150 210 270

NBS Value x , Degrees

330

Figure 3A. Measured Phase Angles Plotted Against Corresponding NBS Values

(Example 3)

-0.10

-0.15

-0.20 30 90 150 210

NBS Value x , Degrees

270 330

Figure 3B. Differences Between Measured Phase Angles and Corresponding NBS

Values, Plotted Against NBS Values (Example 3).

9
7.3 Test of Model Adequacy

Before proceeding with the tests for the slope and intercept, it is

confirmed that a simple linear function is adequate to relate phase meter

measurements to the assigned values of the NBS Phase Angle Standard. A plot

of the deviations from the linear fit provides insight into the model

adequacy. A formal statistical test to decide whether or not a simple linear

function of the phase meter measurements is an appropriate calibration curve

is based on the information in the repeated measurements at each phase angle

(see [7], page 33). The lack-of -f it test is obtained when the fitted value

for each phase angle,

A A A yj[ = a + b Xj[ , i = 1 , . . . , k

is compared to the average of the repeat measurements at corresponding phase

angles:

n

Yi

.1. yij

n

Close agreement between the fitted values and these averages is evidence that

the simple linear function is reasonable. Using the F statistic as a criterion, the calibration data are not consistent with a straight line model

if:

where

F' > F {k-2, k(n-l)}

2 0-01 ' ^ ^

' Se

1 k n _ 2 = k(^) .1^ (yij - yi )

and F(^{k-2, k(n-l)} is the upper one-percent point (for a = 0.01) of the F

distribution with k-2 degrees of freedom in the numerator and k(n-l) degrees

of freedom in the denominator (see [7], page 37). Use of a small significance

level (a = 0.01) in the lack-of-fit test implies that we are only interested

in detecting very substantial departures from linearity in the phase meter

under test.

Generally, in statistical tests a convention exists in using a of 0.05,

0.01 or smaller. Alternatively, because the selection of a particular a level

is somewhat arbitrary, it is common to report an attained significance level

corresponding to the calculated value of a test statistic. A computed

significance level near zero corresponds to a high degree of confidence that

10
the associated hypothesis is not tenable. For instance, in the lack- of- fit

test, a computed significance level for F' of 0.004 would lead to the

conclusion that the observed departure from linearity was statistically

significant at the 0.004 level of probability.

7.4 Tests of Slope and Intercept

If the linear model is found to be adequate, the next step is to

determine the test statistics, tj^ and t2 , to check if the intercept a is zero and if the slope b

tl =

where

S(a) =

is one

AaS(a)

The test statistics are as follows [7, page 26]

Ab - 1

k

ill

. 2

n X (Xi-x)2

1=1

t2 =

S(b)

and S(b) = nk ^ (xi-x)2

i=l

A value of 1 1^^ | > tQ,y2(rik-2) indicates that the intercept is significantly

different from zero, and a value of lt2l > t(^/2(^^"2) indicates that the slope

is significantly different from one . The value of t(^/2('^^"2) can be found in

a table of Student's t distribution, where a is the significance level of the

test (typically, a = 0.05) and (k-2) is the number of degrees of freedom in

the residual standard deviation (see, for example, Appendix A).

Alternatively, attained significance levels can be computed using each

calculated value of ti or t2 . Computed significance levels near zero correspond to high confidence in asserting that the intercept and slope are significantly different from zero and one, respectively. For example, a computed significance level for t2 of 0.05 or less indicates that the slope is

probably different from one.

2 The parameters a and b are tested separately so that the nature of

systematic offset (relative to the standard) can be ascertained. If the

intercept differs appreciably from zero, but the slope is not

significantly different from its ideal value, a simple additive constant

would be sufficient to reduce this source of error. If the slope is

significantly different from its ideal value, then there is a need to

calculate individual corrections for every data point. However, the use

of these two separate t- tests is not optimal if we actually wish to test

simultaneously if a = 0 and b = 1. See [7, page 94] for a discussion of

the best statistical procedure for simultaneous evaluation of the slope

and intercept.

11
7.5 Offset in Corrected Values

The following procedure can be thought of as a determination of the

practical, rather than the statistical, significance of the offset of a phase

meter from the NBS assigned values. For example, tests on the slope and

intercept may be statistically significant, but the consequences of ignoring

one or both of these can be practically insignificant relative to the required

accuracy or resolution of the phase meter.

To assess the overall disagreement between the user's phase meter and the

NBS assigned values, statistical confidence limits can be computed for the

offset (systematic error) in the expected reading of the phase meter relative

to the NBS value. The term "expected reading" may be thought of either as the

value produced by the phase meter in the absence of random measurement errors

or, equivalently , as the limiting mean of a large number of repeat

measurements corresponding to a fixed phase angle. For phase meters having a linear response relative to the NBS Phase Angle Standard, the expected reading

at a given phase angle x, denoted by E(y|x), is:

E(y|x) = a + bx.

Then, the offset between the phase meter and the NBS standard at phase angle x

is given by: :

Ax = E(y|x) - X = a + (b - l)x. (1)

Note that A^ is actually the systematic offset of an uncorrected reading on

the phase meter. As we show below, with the calibration data obtained

following the procedure described in section 5 and the computations given in

section 7.2, the user can account for part or all of the offset by applying

various corrections to the readings and then computing "bounds to offset,"

that depend on the respective corrections that are considered. These bounds

represent a component of the overall measurement uncertainty.

In the calibration report, limits to offset from the NBS Phase Angle

Standard are listed for phase meter corrections at three levels of complexity:

(1) NO CORRECTION: use the observed reading;

(2) CONSTANT CORRECTION: add a constant to the observed reading;

(3) FULL CORRECTION: use the complete calibration curve correction.

When the required accuracy of the phase meter is specified a priori, the

computed limits to offset for levels (1) and (2) may be used for comparison to

decide if a simple correction (or no correction) is sufficient to achieve the

user's required accuracy. Error limits associated with the full correction

represent the smallest bound to offset that is available and are non-zero only

because of the random uncertainty in the calibration data used to compute the

estimated calibration curve.

It is clear from equation (1) that the offset in a phase meter reading

depends on the particular phase angle x that is measured. In general,

however, we require the error limits over the whole range of the calibration
curve, not merely for the expected offset corresponding to a single phase

angle. Therefore, the initial step toward estimating offsets for any phase

angle x is to compute statistical confidence bands appropriate for the whole

calibration curve over the entire range from 0° to 360° (or other intervals

requested by the customer). For the straight line as a whole, confidence

curves [7, page 31] are given by the equations:

and

i(xt) = a + bxt - R(xt)

A A u(xj-) = a + bx^- + R(xt)

(2)

where

R(xt) = s 72 F^.^^ (2, k-2)

nk

(XfX) —fc ~

n E (Xj^-x)

i-1

(3)

In the equations, Xj- denotes the "true," or NBS , phase angle (0° < x^- < 360°)

and F is an appropriate upper percentage point of the F distribution (as an illustration we have used the upper 5 percent point)

Figure 4 is a diagram of a calibration curve with the corresponding

confidence bands sketched about it. For any given phase angle setting of the

NBS Phase Angle Standard, the true reading on the phase meter is expected to

_i I I , I I I , I 1 i_

30 DO 150 210 270 330

NBS Value x , Degrees

Figure 4. Calibration curve for a phase meter with corresponding confid&nce

bands

be situated within the bands. Note that distance between the curves, d(x^) =

13
u(xt) - i(X|-), is different for each value of x^, but the largest distance

occurs at x^- = 0° or x^ = 360°

To estimate the offset of a phase meter, the calculations for each level

of correction involve simple algebraic expressions derived from equation (2)

by determining the limiting values for the whole calibration curve. For

convenience, the largest value of the estimated offset over the whole range of

X is listed in the calibration report. Thus, the computed limit in each case should be interpreted as an upper bound to offset over the whole range of

phase angles measured.

LEVEL 1. NO CORRECTION: Offset in Uncorrected Values.

Lower and upper limits to the offset in a phase meter reading y^-

corresponding to a "true" phase angle x^, when there are no corrections

applied to y^ , are given by:

A A L(xt) = a + ( b - l)xt - R(xt)

and ^ ^ U(xt) = a + ( b - l)xt; + R(xt)

where RCx^) is given in equation (3). The largest limits occur at either

x^ = 0° or X|- = 360°. (If another interval is requested by the customer, the

endpoints of that interval are substituted for 0° and 360° where appropriate.)

The magnitude of the largest estimated offset for uncorrected values is:

^LEVELi = "maximum of { |L(0°)| , |U(0°)| , |L(360°)| , |U(360°)| } . (4)

A The value of ^^zveli estimated upper bound to the offset between an uncorrected phase meter reading and the corresponding NBS assigned value. If

y denotes a phase meter reading and x denotes the associated "corrected"-^

value derived from y to bring a reading into agreement with the NBS Phase

Angle Standard, then taking x = y indicates that no correction is applied.

Other levels of correction in the discussion below are indicated by similar

equations. Thus, x = y + A indicates that a constant correction is applied,

and X = By + A indicates that a linear correction is applied, where A and B are computed constants.

To decide if the agreement of an uncorrected phase meter reading with the

corresponding phase angle supplied by the NBS standard is acceptable for

practical purposes, \eveli "*^y compared to an a priori accuracy

specification, S, if given. Then, provided \eveli - ^> it is sufficient to

let X = y to bring the result of the measurement into the desired agreement

with the standard. However, it is important to note that this comparison

ignores random measurement error in the phase meter reading. A procedure for

including the user's limits to random error in a combined uncertainty estimate

is given in section 7.6.

3 X represents an estimate of the value the Phase Angle Standard would have

to be set to in order to make the phase meter read a value y.

14
LEVEL 2 . CONSTANT CORRECTION: Offset in (y + A2)

If we ignore the possible difference in the slope of the calibration

curve from its ideal value {b = 1 ; therefore, we set B2 (= ^/h^ = 1). but

correct for the displacement of the line, estimated by A2 = x - y, then the

corrected phase meter reading is given by:

X = y + (x - y) = y + A2

where x and y are the sample means from the calibration data (see section

7.1). Lower- and upper-limits on the offset in a measurement corrected this

way are

L(xt) = (a + A2) + (b - l)xt - R(xt)

and ^ , (5)

U(xt:) = (a + A2) + (b - l)xt + R(xt)

where RCx^) is defined in equation (3). Note that the limits are calculated

simply by adding A2 to the corresponding limits for uncorrected values.

A An estimated upper bound, magnitude of the offset in

values corrected by adding A2 = (x - y) to observed readings is obtained from

equation (4), but substituting the new limits at 0° and 360° given above in

equation (5). The value ^level2 ^® compared to an a priori limit 5, if

appropriate

LEVEL 3. FULL CORRECTION: Offset in (B3-y + A3).

If no correction, or a constant correction, is deemed inadequate to bring

the phase meter reading into agreement with the NBS standard, then the full

calibration curve should be used for correction. To estimate the phase angle

of the NBS standard that corresponds to the phase meter reading, y, the

following equation is used:

A y - a X = —

b = B3y + A3

A A A A where B3 = 1/b, A3 = - a/b, and a, b are the least-squares estimates of the

intercept and slope obtained from the fitted calibration curve. Lower and

upper limits on the offset in a measurement corrected via the calibration

curve are

R(xt) R(xt)

L(xt) = - — and U(xt) = + —

h b

where RCx^) is given in equation (3) . An estimated upper bound to the
magnitude of the offset is

^LEVELS = maximum of { lR(0°)/b| , |R(360°)/b| ) .

Results of the calculations discussed in this section are illustrated in

two sample Reports of Calibration given in Appendix B. In the first example,

a comparison of the three offsets suggests that a full correction is probably

appropriate for the phase meter under test. Offsets for the phase meter in

the second example show that very little is gained by correcting observed

measurements

7 .6 Calculation of Phase Meter Uncertainty

Regardless of the type of correction applied to phase meter readings, the

procedure described above provides only one component of the overall

uncertainty in a corrected measurement. That is, the computed bound A may be

thought of as an estimate of the possible offset, or systematic error, in a phase meter reading relative to the NBS standard if the random error in the

phase meter could be made negligible . Statistical methods are used to obtain

A because the functional relationship between a phase meter and the NBS

standard is not known exactly, but is estimated by a series of repeated

measurements (so the calibration curve has an associated imprecision)

To estimate the overall uncertainty in a phase meter reading, information

obtained by the user about the variability of repeated measurements on the

phase meter may be combined with the estimated offset as follows. Data

obtained from the user's measurement process may be used to compute an estimate, Sp , of the standard deviation of phase meter random errors under

normal laboratory test conditions. Then a bound, E, to the overall

disagreement between phase meter readings and the NBS assigned values for each

type of phase meter correction may be calculated by:

(1) NO CORRECTION: ^LEVELl ~ ^LEVELl + Sp- ta/2('^p)

(2) CONSTANT CORRECTION: '^LEVELa ~ ^LEVEL2 + Sp- tQ/2(^p)

(3) FULL CORRECTION: ^LEVELS ~ ^LEVELS + B-s p- ta/2(^p)

where respective values of A are given in Section 7.5, B = 1/b is computed

from the estimated slope of the calibration curve, and i/p is the degrees of

freedom associated with Sp . Tabled values from the Student's t distribution

for a = 0.05 and a = 0.01 may be found in Appendix A. When sufficient data is

used to compute Sp , e.g., if i/p > 30, then for a = 0.05, t is approximately

equal to 2.00.

The standard deviation that is used to calculate the phase meter

uncertainty must have sufficient degrees of freedom to provide a realistic

measure of phase meter precision. As a general rule, 15 degrees of freedom is

a minimum for the initial computation of the standard deviation. As more repeat measurements are obtained, the standard deviation may be recomputed to

take advantage of the increased data base, and assuming that the measurement

procedure is stable, this will assure a more reliable value of the estimated

16
standard deviation.

A standard deviation based on as few as two data points can be combined

with other similar estimates that have been obtained on separate occasions or at different phase angles to calculate what is called a "pooled" standard

deviation. If the individual standard deviations are s^ , S2, with

degrees of freedom ui, 1/2, J^k' respectively, then the pooled standard

deviation is:

1 h

^1^1^ + U2S2^ + . . . + i^ic^k^

j^l + 1/2 + . . . + i^k

The degrees of freedom associated with Sp is i^p = i/]^ + i/2 + • • + i^k- Each of the individual standard deviations is assumed to be calculated from

the usual formula for the estimated standard deviation,

S2 = I (Yi - y)V(n - 1)

with (n-1) degrees of freedom. The sequence of repeat measurements

Yi ' 72 ' • •

• . Yn used to calculate an individual may be obtained by taking n independent readings on the phase meter for any fixed input signal. Estimates

for various phase angles may be combined using the formula above.

8. LIMITATIONS OF THE CALIBRATION CURVE

Phase meters are normally designed to have a linear response

characteristic, and the data obtained from them are sufficiently repeatable to

make the steps outlined above for obtaining a linear calibration curve and

estimation of error limits a valid procedure. In isolated cases, however, the

assumptions underlying this procedure do not hold. The significant sources of

error that may cause this condition are summarized below.

8.1 Lack of Precision

Lack of precision is the inability to repeat measurements accurately with

the same phase meter under similar operating conditions which therefore

increases the random error in the measurement. The calibration curve,

however, is designed to reduce the systematic error and so cannot help to

reduce the random error component. To obtain better precision, it is usually

necessary to improve the physical components of the measurement system or their interaction.

8.2 Nonlinearity of the Calibration Curve

The assumption of linearity is essential for the calibration procedure

described to be valid. A possible source of a nonlinear systematic error is

the cross coupling of input signals within the phase meter. An example is

shown in Figure 3B. If a portion of one of the input signals is coupled to

the other through a mutual inductance, the resulting phase error will be

17
greatest when the coupled signal component is out of phase, at a nominal phase

angle of 0° or 180° and least when the coupled component is in phase at 90°

and 270° as shown in the figure.

Another type of nonlinearity can arise if the digital readout of the

phase meter is not linear. The calibration curve could then be represented by

a second or third order polynomial. In practice, however, it is more likely

that such nonlinearities are small and masked by the random error of the

meter.

8.3 Differences Among Repetitions

Several repeat measurements are made at each phase angle during a calibration. As mentioned, a set of readings is taken in a random order at

all selected phase angles before a repeat set is started. When significant

changes are apparent from set to set, possibly indicating short-term drifts, a calibration curve will not yield satisfactory results. Errors of this type can be checked by plotting differences between observed and standard phase

angles for each set, as shown in Figure 5 (where there are no major visible

changes) . A formal statistical test for differences in calibration curves can

be found in [6, page 43].

18
0.05 I • I

• I

•

1

' 1• r

30 90 150 210 270 330

NBS Value x , Degrees

Figure 5. Changes in calibration curve from repetition to repetition

19
9. REFERENCES

Turgel, R. S.; Oldham, N. M. ; Stenbakken, G. N. ; Kibalo , T. H.; "NBS

Phase Angle Calibration Standard," Nat. Bur. Stand. (U.S.) Technical Note

1144, July 1981.

Laug, 0. B.,"A Wide-Band Transconductance Amplifier for Current

Calibrations," IEEE Transactions on Instrumentation and Measurement,

IM-34, No. 4, December 1985.

Turgel, R. S.; "NBS 50 kHz Phase Angle Calibration Standard," Nat. Bur.

Stand. (U.S.) Technical Note 1220, April 1986.

Turgel, R. S . ; Oldham, N. M. ; "High-Precision Audio -Frequency Phase

Calibration Standard," IEEE Trans . Instrum. Meas . , vol. IM-27, no. 4,

December 1978.

Turgel, R. S.; "A Precision Phase Angle Calibration Standard for

Frequencies up to 50 kHz," IEEE Trans . Instrum. Meas., vol. IM-34, no. 4,

December 1985.

Croarkin, C. M. ; Varner, R. N.; "Measurement Assurance for Dimensional

Measurement on Integrated- Circuit Photomasks," Nat. Bur. Stand. (U.S.)

Technical Note 1164, August 1982.

Draper, N. R. ; Smith, H.; Applied Regression Analysis, 2nd Edition,

Wiley and Sons Inc., New York, 1981.

20
APPENDIX A. Critical values of Student's t Distribution

Table A-1

Critical Values ^(^f^^^^ °f Student's t Distribution

V a==0.05 a==0.01 u a==0.05 a=0.01

2 4. 303 9. 925 62 1 . 999 2.657

4 2. 776 4. 604 64 1 . 998 2.655

6 2. 447 3. 707 66 1 . 997 2 . 652

8 2306 3355 68 1 . 995 2.650

10 2228 3. 169 70 1 . 994 2 . 648

12 2. 179 3. 055 72 1. 993 2.646

14 2. 145 2. 977 74 1 . 993 2.644

16 2., 120 2. 921 76 1 .,992 2.642

18 2., 101 2. 878 78 1 .,991 2.640

20 2

,086 2

, 845 80 1 ,, 990 2.639

22 2.074 2, 819 82 1 ,, 989 2.637

24 2,,064 2,, 797 84 1 .,989 2.636

26 2.,056 2,.779 86 1 ,.988 2.634

28 2..048 2,.763 88 1 ,.987 2.633

30 2,.042 2,.750 90 1 ,.987 2.632

32 2,.037 2,.738 92 1 .986 2.630

34 2,.032 2 .728 94 1 .985 2.629

36 2 .028 2 .719 96 1 .984 2.628

38 2 .024 2 .712 98 1 .983 2.627

40 2 .021 2 .704 100 1 .983 2.626

42 2 .018 2 . 698 102 1 .983 2.625

44 2 .015 2 .692 104 1 .982 2.624

46 2 .013 2 .687 106 1 .982 2.623

48 2 .011 2 .682 108 1 .981 2.622

50 2 .009 2 .678 110 1 .981 2.621

52 2 .007 2 .674 112 1 .981 2.620

54 2 .005 2 .670 114 1 .981 2.620

56 2 .003 2 .667 116 1 .981 2.619

58 2 .002 2 .663 118 1 .980 2.618

60 2 .000 2 .660 120 1 .980 2.617

00 1 .960 2.576

V = niimber of degrees of freedom in the total standard deviation.

21
APPENDIX B. Sample Calibration Reports

The results of an NBS calibration are reported to the customer in a form

similar to the examples shown in this appendix. There is some variation in

the way the test is conducted and the results are reported depending on the

design of the phase meter being calibrated.

The report identifies the customer, the instrument (by make, model, and

serial number), the customer order number, the date, and ambient temperature

during the test. For each set of current, voltage, and frequency conditions,

the report provides an equation which can be used to correct the phase meter

readings and lists in the appendix to the reort the estimated limit to offset

from the NBS Phase Angle Standard that is associated with corrected values.

Summary tables for each set of test conditions give adjusted values obtained

from the correction equation for selected values of phase meter readings.

Additional tables show the actual unprocessed calibration data. Coefficients

and statistical parameters associated with the correction equation

(calibration curve) are given in an appendix.

The data are taken using a computer program named "0CAL6." This program

allows the operator to specify the phase angles test points , the number of

readings at each, and all of the housekeeping information needed to document

the measurement. This information includes the test date, file name under

which the information and calibration data are stored on disk or tape, as well

as the make, model, and serial number of the instrument under test and of the

check standard phase meter (if used). While the calibration parameters

associated with the calibration curve and the corrections derived from it are not stored, these can be recalculated by the program from the stored data, if

needed.

A second program named "REPORT" calculates and formats the data and

prints the calibration report using some of the subprograms associated with

"(^CAL6. "

Two sample Reports of Calibration are shown in this appendix. In the

first example, a comparison of the estimated offsets associated with

uncorrected, partially corrected, and fully corrected phase meter readings

(see section 7.5) suggests that a full correction is probably appropriate for

the phase meter under test. Offsets for the phase meter in the second example

show that very little is gained by correcting observed measurements. In fact,

the summary table of adjusted values is suppressed in the calibration report

since the adjustment obtained from the full correction equation is less than

0.01° for any observed reading on the phase meter.

22
U.S. DEPARTMENT OF COMMERCE

NATIONAL BUREAU OF STANDARDS

GAITHERSBURG, MD 20809

REPORT OF CALIBRATION

Phase Meter

Model , Serial No.

Submitted by

P. 0. box

The phase meter was tested in April 1987 using the NBS Phase Angle Calibration

Standard.^ The ambient temperature was 23 ± 2° C. The phase meter under

test, as well as the Phase Angle Calibration Standard, were under power for more than 3 hours before readings were taken.

For the specified current, voltage, and frequency conditions, three readings were taken at 12 test points (phase angles) selected in a random order. The

NBS Phase Angle Standard was set to the desired phase angle, and the digital

readout of the phase meter under test was read and recorded. The time

constant in the response of the phase meter required a timed delay of 30

seconds before taking readings to obtain consistent results.

No adjustments of the phase meter were made at any time. The range switch

provided on the phase meter was operated so that readings fell into an interval from -1 to 359 degrees wherever possible. Readings in the interval

from 359 to 360 degrees were converted to an interval from - 1 to 0 degrees for

purposes of computation.

During the tests the test signal frequencies was maintained at constant values

with a frequency stability better than 10 parts per million and with an uncertainty of less than ±0.01 Hz if below 5 kHz and ±0.1 Hz from 5 to 50 kHz.

4 NBS Technical Notes 1144 (July 1981) and 1220 (April 1986)

23
Phase Meter

Model

Serial No.

- 2 -

The systematic uncertainty in the value of the NBS Phase Angle Standard is

estimated to be less than 0.003 degrees at the currents, voltages, and

frequencies used in this test. For the present data, based on replication

readings, the limit to offset from the values provided by the NBS Phase Angle

Calibration Standard for a corrected phase angle using the equation below, is

estimated to be less than 0.020 degrees. The overall uncertainty of corrected

phase angle measurements depends on the variability of repeat measurements on

the phase meter under normal laboratory test conditions. The estimated

standard deviation of repeat measurements at NBS was 0.022 degrees. Under

similar operating conditions, the overall disagreement between a corrected

phase meter reading and the NBS standard would be estimated to be less than

0.064 degrees^.

For the Director

National Engineering Laboratory

Barry A. Bell, Group Leader Test No. 722- -87

Electronic Instrumentation and Metrology Order No.

Electrosystems Division Date: April, 1987

5 NBS Technical Note XXXX, p. yy

24
Phase Meter

Model

Serial No.

- 3

-

Reference Signal Voltage:

Variable Phase Signal Voltage:

Frequency:

30.00 V

30,00 V

60 Hz

Corrected Phase Angle:* x'= - 0.019407 + 1.000251 y

Table of Corrected Phase Angles (x') in Degrees'

OBSERVED

PHASE ANGLE

(Degrees)

CORRECTED

PHASE ANGLE

(Degrees)

OBSERVED

PHASE ANGLE

(Degrees)

CORRECTED

PHASE ANGLE

(Degrees)

0 -0.02 180 180.03

10 9.98 190 190.03

20 19.99 200 200.03

30 29.99 210 210.03

40 39.99 220 220.04

50 49.99 230 230.04

60 60.00 240 240.04

70 70.00 250 250.04

80 80.00 260 260.05

90 90.00 270 270.05

100 100.01 280 280.05

110 110.01 290 290.05

120 120.01 300 300.06

130 130.01 310 310.06

140 140.02 320 320.06

150 150.02 330 330.06

160 160.02 340 340.07

170 170.02 350 350.07

* Calculated values based on linear model (see appendix)

722- -87 25
Phase Meter

Model

Serial No

Unprocessed Calibration Data for Range:

Reference Signal Voltage: 30.00 V

Variable Phase Signal Voltage: 30.00 V

Frequency: 60 Hz

NBS STANDARD METER UNDER TEST NBS STANDARD METER UNDER TEST

(Degrees) (Degrees) (Degrees) (Degrees)

0. 00 0. 03 180. 00 179. 97

0. 00 0. 02 180. 00 179 98

0. 00 0 01 180. 00 179 95

30 00 30 03 210 00 209 95

30 00 30 01 210 00 209 97

30 00 30 01 210 00 209 98

60 00 59 99 240 00 239 94

60 00 60 01 240 00 239 96

60 00 60 01 240 00 239 96

90 00 90 01 270 00 269 99

90 00 90 01 270 00 269 .96

90 00 89 96 270 00 269 .86

120 00 119 .99 300 00 299 .94

120 00 119 .98 300 00 299 .96

120 .00 120 .00 300 00 299 .92

150 .00 150 .00 330 00 329 95

150 .00 149 .99 330 00 329 96

150 .00 149 .99 330 00 329 96

722- •87 26
Phase Meter

Model

Serial No.

- 5 -

Appendix

The calibration of this phase meter provides an equation to correct the

reading obtained from the phase meter so that the result of the measurement

will be close in agreement with the corresponding value supplied by the NBS

Phase Angle Standard. These corrections are calculated from the unprocessed

calibration data obtained during the test, which are shown on separate pages.

Because random fluctuations tend to mask the limiting mean of the phase

meter response at any particular test point, the corrections calculated are based on predicted values. These values are obtained by fitting the

unprocessed data (y) for each set of current, voltage, and frequency

conditions to an equation which models the average response of the phase meter

to phase angles (x) supplied by the NBS standard.

Reference Signal Voltage:

Variable Phase Signal Voltage:

Frequency

30.00 V

30.00 V

60 Hz

Predicted value y' = 0.019402 + 0.999749

Standard errors of coefficients (0.006952) (0.000036)

Significance levels^ (0.009) (0.000)

(degrees)

(degrees)

Residual standard deviation

Lack- of - fit

Significance level''

s = 0.022188

F'= 0.466

(0.895)

2s = 0.04436 (degrees)

Estimated limits of systematic offset from NBS:

without corrections (x' = y) 0.091 (degrees)

with a constant correction (x' = y + 0.262) 0.070 (degrees)

using the fitted linear equation (see above) 0.020 (degrees)

Significance levels are derived using statistical tests (Student's

t-distribution) to decide if the intercept and slope of the fitted

straight line are different from their ideal values, zero and one,

respectively. A level near zero (less than or equal to 0.05) shows that

the associated parameter is probably different from the ideal value.

The significance level of F' is associated with an objective statistical

test for the adequacy of a linear model relating the user's phase meter

response and the NBS assigned values. Significance levels near zero

(less than or equal to 0.01) indicate that the assumption of a straight

line as a model for the phase meter response may be incorrect. However,

if the variability of the repeat readings is of the same order as the

resolution of the meter, and the data points are therefore not normally

distributed, the table of values on which this test is based are not

applicable

722 87 27
U.S. DEPARTMENT OF COMMERCE

NATIONAL BUREAU OF STANDARDS

GAITHERSBURG, MD 20899

REPORT OF CALIBRATION

Phase Meter

Model , Serial No,

Submitted by

Street

The phase meter was tested in August 1982 using the NBS Phase Angle

Calibration Standard.^ The ambient temperature was 23 ± 2" C. The phase

meter under test, as well as the Phase Angle Calibration Standard, were under

power for more than 3 hours before readings were taken.

For the specified current, voltage, and frequency conditions, four readings

were taken at 12 test points (phase angles) selected in a random order. The

NBS Phase Angle Standard was set to the desired phase angle, and the digital

readout of the phase meter under test was read and recorded. The time

constant in the response of the phase meter required a timed delay of 30

seconds before taking readings to obtain consistent results.

No adjustments of the phase meter were made at any time. The range switch

provided on the phase meter was operated so that readings fell into an interval from -1 to 359 degrees wherever possible. Readings in the interval

from 359 to 360 degrees were converted to an interval from - 1 to 0 degrees for

purposes of computation.

During the tests the test signal frequencies was maintained at constant values

with a frequency stability better than 10 parts per million and with an uncertainty of less than ±0.01 Hz if below 5 kHz and ±0.1 Hz from 5 to 50 kHz.

NBS Technical Notes 1144 (July 1981) and 1220 (April 1986)

28
Phase Meter

Model

Serial No.

- 2

-

The systematic uncertainty in the value of the NBS Phase Angle Standard is

estimated to be less than 0.004 degrees at the currents, voltages, and

frequencies used in this test. For the present data, based on replication

readings, the limit to offset from the values provided by the NBS Phase Angle

Calibration Standard for a corrected phase angle using the equation below, is

estimated to be less than 0.011 degrees. The overall uncertainty of corrected

phase angle measurements depends on the variability of repeat measurements on

the phase meter under normal laboratory test conditions. The estimated

standard deviation of repeat measurements at NBS was 0.008 degrees. Under

similar operating conditions, the overall disagreement between a corrected

phase meter reading and the NBS standard would be estimated to be less than

0.027 degrees^.

For the Director

National Engineering Laboratory

Barry A. Bell, Group Leader Test No. 722- -82

Electronic Instrumentation and Metrology Order No.

Electrosystems Division Date: August, 1982

NBS Technical Note XXXX, p. yy

29
Phase Meter

Model

Serial No.

- 3 -

Reference Signal Voltage:

Variable Phase Signal Voltage:

Frequency:

5.00 V

100.00 V

60 Hz

No correction is needed to bring the observed phase angle reading into

agreement with the NBS standard.

722- -82 30
Phase Meter

Model

Serial No.

Unprocessed Calibration Data for Range:

Reference Signal Voltage: 5 . 00 V

Variable Phase Signal Voltage: 100.00 V

Frequency: 60 Hz

NBS STANDARD

(Degrees)

METER UNDER TEST

(Degrees)

NBS STANDARD

(Degrees)

METER UNDER TEST

(Degrees)

0. 00 0. 00 180. 00 179. 99

0. 00 0. 00 180. 00 179. 99

0.,00 0. 01 180. 00 180. 01

0.,00 0.,00 180.,00 179. 99

30.,00 29. 99 210.,00 210.,00

30,,00 30.,00 210,.00 210.,01

30,,00 29,.99 210,,00 210,,00

30..00 30,,00 210,.00 210,.01

60,.00 60,.00 240,.00 240,.01

60,.00 60,.00 240,.00 240,.01

60,.00 60,.01 240 .00 240,.00

60 .00 59,.99 240 .00 240,.01

90 .00 89 .98 270 .00 270 .00

90 .00 89 .99 270 .00 269 .99

90 .00 90 .00 270 .00 270 .00

90 .00 90 .00 270 .00 270 .02

120 .00 119 .99 300 .00 300 .01

120 .00 120 .00 300 .00 300 .00

120 .00 120 .00 300 .00 300 .00

120 .00 120 .01 300 .00 300 .00

150 .00 150 .01 330 .00 330 .00

150 .00 150 .01 330 .00 330 .00

150 .00 150 .00 330 .00 330,.01

150 .00 149 .98 330 .00 329 .99

722- -82 31
Phase Meter

Model

Serial No.

- 5 -

Appendix

The calibration of this phase meter provides an equation to correct the

reading obtained from the phase meter so that the result of the measurement

will be close in agreement with the corresponding value supplied by the NBS

standard. These corrections are calculated from the unprocessed calibration

data obtained during the test, which are shown on separate pages.

Because random fluctuations tend to mask the limiting mean of the phase

meter response at any particular test point, the corrections calculated are based on predicted values. These values are obtained by fitting the

unprocessed data (y) for each set of current, voltage, and frequency

conditions to an equation which models the average response of the phase meter

to phase angles (x) supplied by the NBS standard.

Reference Signal Voltage: 5 . 00 V

Variable Phase Signal Voltage: 100.00 V

Frequency: 60 Hz

Predicted value y' = - 0.002581 + 1.000020 • x (degrees)

Standard errors of coefficients (0.002324) (0.000012) (degrees)

Significance levels^*^ (0.273) (0.100)

Residual standard deviation s = 0.008548 2s = 0.01708 (degrees)

Lack-of-fit F'= 0.811

Significance level^^ (0.620)

Estimated limits of systematic offset from NBS:

without corrections (x' = y) 0.011 (degrees)

with a constant correction (x' = y + 0.262) 0.010 (degrees)

using the fitted linear equation (see above) 0.007 (degrees)

' Significance levels are derived using statistical tests (Student's

t-distribution) to decide if the intercept and slope of the fitted

straight line are different from their ideal values, zero and one,

respectively. A level near zero (less than or equal to 0.05) shows that

the associated parameter is probably different from the ideal value.

The significance level of F' is associated with an objective statistical

test for the adequacy of a linear model relating the user's phase meter

response and the NBS assigned values. Significance levels near zero

(less than or equal to 0.01) indicate that the assumption of a straight

line as a model for the phase meter response may be incorrect. However,

if the variability of the repeat readings is of the same order as the

resolution of the meter, and the data points are therefore not normally

distributed, the table of values on which this test is based are not

applicable

722- ...,.-82 32
APPENDIX C

Computer Program for Phase Meter Calibration

A computer program has been developed to implement the procedures and

calculations given in this NBS Technical Note. The program sets the NBS Phase

Standard to the desired operating conditions and records the readings of the

phase meter under test. The computer (instrument controller) can receive the

readings directly from the phase meter, if the meter has a GPIB interface,

otherwise the digital display of the phase meter is read and the data are entered manually via the keyboard. The data can be stored on disk for future

recall, and after all the data for a range have been collected, the program

attempts to fit the data to a straight line, using the phase angle settings of

the NBS standard as an independent variable. Finally, the corrected phase

meter readings and the statistical parameters resulting from the fit are printed out as the calibration report using the second section of the program.

This appendix contains a complete listing of the main program sections

and the sub-programs which are written in BASIC for the Hewlett-Packard-'-'^

Model 85 configured with 32K of RAM, the Advanced Programming ROM, the Mass

Storage ROM, and the I/O ROM. The code may require modification if the

program is to be used on another computer. Minor modification may also be

required to interface to a different phase angle standard, or if a printer

other than the Qume Sprint 11 Plus with a RS-232-C Model 1 Interface^2 is

used.

The listing incorporates two main programs. The first program called

"<^CAL6" controls the operation of the NBS Phase Angle Standard, the test

procedure, and performs the statistical analysis. The second program, called

"REPORT," formats and prints the calibration report. The structure of these

two programs is shown in figures C-1 and C-2. The programs invoke various

subprograms which comprise the remainder of the listing. Because of the

limited memory available, the subprograms are swapped in and out of memory as needed. Despite the memory limitation, the programs contain many explanatory

comments which will assist in understanding the program procedures. Lists of cross references and descriptions of variables are also provided.

To calibrate a phase meter several steps have to be followed. First, the

Phase Meter Calibration Program ((^CAL6) is loaded and run. Then, a new test

is initialized by selecting the "New Test" option in the menu. This step

includes entering administrative information about the customer and the phase

meter to be tested. Next, using the "Test Points" selection from the main

menu, the range parameters and the phase angles to be tested are set up.

Using the "Enter Data" option more information about the number of readings

per test point, the time allowed for the meter to settle, the peripheral bus

addresses, etc. are set up. The actual calibration data is then taken either

fully automatically using the GPIB or entered manually for test points

selected in a random order by the program.

To describe the system discussed adequately, commercial equipment and

parts are identified by the manufacturer's name and model number. In no case does such identification imply a recommendation or endorsement by

the National Bureau of Standards, nor does it imply that the material or equipment identified is necessarily the best available for the purpose.

33
After all the readings for one range have been taken, the data are stored

with the "Save" selection from the menu. An optional error plot can then be

obtained to check for outliers or errors in data entry. If the data i.eem

satisfactory, the "Fit" option can be used to provide statistical information

on how well the data fit the linear model. Corrected phase meter readings are then calculated using the linear equation.

To print the calibration report, the program "REPORT" is loaded and run. This program recovers the calibration data from the disk storage and

calculates the numerical information needed. The report can then be printed

with a format that allows some flexibility by exercising options from the menu.

ACKNOWLEDGEMENT.

The authors would like to thank Mr. Joseph E. Lapp for his thorough

revision of the computer programs which made the programs run more efficiently

and for the addition of explanatory comments throughout the code so that it

could be followed more easily.

34
o

4-) CD -M

03

S- a> J2

00

n3

(13 -M >

fO o o

-t-> o

^-

-o

fT3 +-> ra -M -a U

OJ O)o O -l-> U 00

+-> oo 00

<D -M o

Q. M

O) o

00

u

00o O O

-M

4-> <D

U

C r— O) 1- JD SS_ n3 Q. -M ou

oo -M U

13 -r- O -M

00 -M -r- C -M

•r- fO

S_ +-> CL OO

00

-a

OJ2

OJ OJ c

£Z o

-o

QJ fO

S- +-> o IT3 +-> o(/) -M -o to

O) o 4-> 2

4->

-t-> 00

0) rO 4-5

00

OJCD (13

(O (O u o

SOJ OJ cn (13 c o P= n3 4-J i_ x: 00 o o =5 l+- U

S-OJ 00

4-> QJE oOJ (O

(O s-

•4-)

00

O c

S- o

Oi

s_ rvg 4-> o u

-M

O cu 00 -M s_

13 i- (a

CO

S03 -o

CLC

Z3 03

+->

+-> to

QJ00 OJ

00

03 -C

CL o

QJE 03

03 -M

S- 03 CDQ O

QO I 03

OJ ••- S_ r—

13 03

>>

u s-

+-> -M c

QJ Eo 03

4-> -(-> 13 03

03

>^

-Me

QJ

(C E +-> f3

35
to

M

U

:3

X o -M

(/) -a

-(-> c

4-> CDQ.

s- -t-> Q.

10

C/1 4-> co O o

4-> QJ

u

q; JD SS- fO S- CL 4-> ou

c:o

-M •r— +j o 4-> u

i_ zs O D c CL O

Ol SS- +J

D. c

+J

S-o

Q. CL

re

-l-> O) 4-> 00

tes

S-o

MCU +-> S- ^

13

O

-l-J +-> U E

13 *'

S- S-

-•-) D_ oo

+-> E S- fO O

i- CL

CD O) O Dc: S- do

+-> 1 n3 o icu •r- S13cr)<_)

•f—

Ll_

-M +J

•r—s T3

4-> CD U CD

CD fO

S- Si_ CD o > u

-M c

"r— o 2 •r—

+-> CD

4-> >

(_> sCD

S- •ru

s-oo o

CD>

•r— c

+-> o

a}

S- SCD -M ra +J to E

•r— sCD c o

M- E •p— n3 oCD rO

S- -t-> o

+-> -o

CO

•*-> "O to

CD o +->

36
100

105

110

115

120

This program sets the date and time and dispatches the user from the main menu to the calibration routines. JUL 87

Phase Meter Calibration Program

125 ON KEY# 1,"MENU" GOTO 225

130 OPTION BASE 1@ INTEGER Bl ( 100) ,B2( 100)

135 COM C$[60],R(10,4),C(100,8),D(100,8),A(5),T0$[100]

140 DIM I2$[20],I3$[20],M1$[160],M2$[40],Z(1)

145 SARRAY M1$,M2$,T0$ @ C$[60]=" "

165 ! R(1,1)=0 to skip prompt concerning saving of previous file.

170 R(1,1)=0 @ CLEAR @ DISP "Phase Meter Calibration Program" (a DISP

175 DISP " < kl > returns you to menu." (a DISP

180 CALL "QUERY" ( "Enter date (MM/DD/YYYY) . " ,R , Y,D$ ) @ ON R GOTO 185,200,225

185 DISP 0 CALL "QUERY" ( "Enter time (HH :MM :SS) . " ,R, Y,T$ ) 190 ON R GOTO 195,185,225

195 D=VAL(D$[9,10])*1000+MDY(D$)-MDY("12/31/"&VAL$(VAL(D$[7,10])-1)) (3 SETTIME H MS(T$),D

200 ! Sl$=date; TIME$=time

205 S$=DATE$ @ S1$=S$[4,6]&S$[7,8]&"/19"&S$[1 ,2] (3 M=2

210 ! 215 ! Main menu.

220 ! 225 SLET Ml$( 1) = "Stored File"

230 SLET Ml$( 2) = "New File"

235 SLET Ml$( 3) = "Edit File"

240 SLET Ml$( 5) = "Range List"

245 SLET Ml$( 6) = "Test Data"

250 SLET Ml$( 7) = "Check Data"

255 SLET Ml$( 9) = "Enter Data"

260 SLET Ml$( 10) = "Test Points

265 SLET Ml.$ = "Init Check"

270 SLET Ml$ :i2) = "Find Fit"

275 SLET Ml$ :i3) = "Plot Test"

280 SLET Ml$ :i4) = "Plot Check"

285 SLET Ml$ :i5) = "Save Data"

290 CLEAR 0 C=0 (? K0=0 0 CALL "MENU" ( M,M1$,C ) @ M=15

295 ON C GOTO 315,345,385,100,395,430,450,100,485.520,525,580,610,635,655

300 ! 305 ! Load stored file.

310 ! 315 GOSUB 680 0 ON R GOTO 225,320,225

320 CALL "LOAD" ( C$,A( ) ,R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,DO$,TO$ ) 325 SCRATCHSUB "LOAD" @ GOTO 225

330 ! 335 ! Start new file.

340 ! 345 GOSUB 680 0 ON R GOTO 225,350,225

350 CALL "INITAR" ( A() ,B1 ( ) ,B2( ) ,C( , ) ,D( , ) ,R( , ) ,T0$ ) 0 SCRATCHSUB "INITAR"

355 C$=" " 0 C$[60]=" " 0 C$[2]=C$

360 CLEAR 0 CALL "HEADER" ( C$,S1$,R1 ,R( , ) ,1 ,N1 ,M0,T0$,D0$ ) 365 SCRATCHSUB "HEADER" 0 GOTO 225

150 ! 155 ! Prompt user for date and time.

160 !

37
370 ! 375 ! Edit header, ranges, auto-zero data, test data, and check data.

380 ! 385 CALL "EDITFI" ( C$ , A( )

, Bl () ,B2() ,C ( , ), D( , ) ,DO$,MO, N$, R ( , )

, Sl$, T0$ ) 390 SCRATCHSUB "EDITFI" ? GOTO 225

395 ! 400 ! List range parameters.

405 ! 410 DISP "Range R(,)" @ DISP (3 FOR A=l TO 8

415 DISP USING 420 ; A,R ( A , 1 ) ,R ( A, 2) , R (A , 3) ,R (A ,4) (3 NEXT A

420 IMAGE 3D,2X,3D,2X,3D.D,2X,3D.D,2X,5D

425 DISP @ DISP "Press <CONT> to continue." 0 PAUSE (? GOTO 225

430 ! 435 ! Observe test data.

440 ! 445 CALL "DATA" ( D(,),B1(),N$ ) @ SCRATCHSUB "DATA" @ GOTO 225

450 ! 455 ! Observe check data.

460 ! 465 CALL "DATA" ( C(,),B2(),N$ ) (3 SCRATCHSUB "DATA" 0 GOTO 225

470 ! 475 ! Begin or continue test.

480 ! 485 CALL "GET_PARAMS" ( R ,A( )

, Tl ,T0$, Al , A2 , A3 ,F 2,F3, 1 2$, I 3$, P2, P3 ) 490 SCRATCHSUB "GET_PARAMS" @ IF FLAG(5) THEN GOTO 225

495 CALL "GET_DATA" ( R ,B1 ( )

, B2 ( ) ,T1 , Al ,A2 , A3,F2 , F3 , 1 2$, 1 3$, P2, P3, S1$,D0$ ,Z ) 500 SCRATCHSUB "GET_DATA" @ IF Z=l THEN 225

505 ! 510 ! Initialize ranges.

515 ! 520 CALL "GETRNG" ( A( ) , C( , ) ,D ( , ) ,R ( , ) ,B1 ( ) ,B2 () ) 0 SCRATCHSUB "GETRNG" (3 GOTO

225

525 ! 530 ! Initialize check standard.

535 ! 540 CLEAR @ DISP "Is a check standard being used for this test?"

545 CALL "YESNO" ( R )

(3 ON R GOTO 555,550,225

550 CFLAG 1 0 GOTO 225

555 SFLAG 1 0 CALL "HEADER" ( C$,S1$,R1 ,R( , ) ,2,N1 ,MO,TO$,DO$ ) 560 SCRATCHSUB "HEADER" @ GOTO 225

565 ! 570 ! Invoke fit routines.

575 ! 580 ALPHA 1 0 CLEAR (3 C=0 0 K0=0

585 SLET M2$(l) = "Fit Test Data" 0 SLET M2$(2) = "Fit Check Data"

590 CALL "MENU" ( 2,M2$,C ) 0 ON C GOTO 595,600

595 CALL "FIT" ( C$,R( , ) ,D( , ) ,B1 ( ) ,S1$,T0$,D0$, 1 ) 0 GOTO 605

600 CALL "FIT" ( C$,R( , ) ,C( , ) ,B2( ) ,S1$,T0$,D0$,0 ) 605 SCRATCHSUB "FIT" 0 GOTO 225

610 ! 615 ! Plot test data. ^ " < 620 ! 625 CALL "PLOT" ( C$,D( , ) ,R( , ) ,B1 ( ) ,R1 ,S1$, 1 ,TO$,DO$ ) 630 SCRATCHSUB "HEADER" 0 SCRATCHSUB "PLOT" 0 GOTO 225

38
635 ! 640 ! Plot check data.

645 ! 650 CALL "PLOT" ( C$,C( , ) ,R( , ) ,B2( ) ,R1 ,S1$,0,T0$,D0$ ) (3 GOTO 630

655 ! 660 ! Save file.

665 ! 670 CALL "STORE" ( C$,A( ) ,R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,DO$,TO$ ) 675 SCRATCHSUB "STORE" (3 GOTO 225

680 ! 685 ! Warn user about pending loss of data.

690 ! 695 ! Skip warning if no data has been entered.

700 IF R(1,1)=0 THEN R=2 @ RETURN

705 CLEAR (3 DISP "Should previous file be saved?"

710 CALL "YESNO" ( R ) @ RETURN

39
VAR OCCURS IN L INE

Bl (

130 ,350 5 385

f t J J 625

130 , 320 1 -JO J 465 , 495 n 3 J , 520 ,600

650 ,670

c $ 135 ,145 ,320 ,355

355 ,355 , 355 , 360

385 ,555 ,595 ,600

625 ,650 ,670

R (.) 135 ,170 ,320 ,350

360 ,385 ,415 ,415

415 ,415 ,520 ,555

595 ,600 ,625 ,650

670 ,700

C (,) 135 ,320 , 350 , 385 465 ,520 ,600 ,650

670

D (.1 135 ,320 , 350 , 385 445 ,520 ,595 ,625

670

135 , 320 ,350 ,385

485 , 520 ,670

T0$ 135 1 45 ,320 , 350

360 , 385 , 4fiS TO J , J J J J J J , U C J 670

lev I ?? 1 40 485

I 3$ 140 , 485 , H J J Ml$ 140 , 145 ,225 ,230

235 ,240 245 ,250

255 ,260 ,265 ,270

275 ,280 ,285 ,290

M2$ 140 ,145 ,585 ,585

590

z n 140

R 180 ,180 , 185 , 190

315 345 ,485 ,495

545 J t J S45 7nn 71 n

Y 1 ou , i O 3

i ou , -I'D

i O J

1 Q"^

L. <J J , u U J , ^ U U SI $ 205 , 360

555 , 595 ,600 , 625

650 M 205 ,290 ,290

e 290 ,290 ,295 ,580

590 , 590

KO 290 ,580

00$ 320 ,360 , 385 ,495 555 ,595 ,600 ,625

650 ,670

Rl 360 ,555 ,625 ,650

Nl 360 ,555 MO 360 ,385 ,555

N $ 385 ,445 ,465

A 410 ,415 ,415 ,415

41415 ,415

71 HO J , H7 J Al 485 , 495

A2 485 ',495 A3 485 ,495

F2 485 ,495

F3 485 ,495

P2 485 ,495

P3 485 ,495

Z 495 ,500

no. of readings at each point of the test meter

no. of readings at each point of the check meter

this string contains information about the test that is extracted from the table of contents. CS[1 ,30]=customer name; C$[31,40]=

test date; C$[41 ,50]=serial no.; C$[60]=folder no. array of parameters for each of the 8 ranges. R(r,l)=no. of first test point of range;

R(r,2)=reference channel voltage (or current if negative); R(r,3)=variable channel voltage or

current; R(r,4)=frequency

check meter data. 1st subscript=point no.; C(p,l)=ideal reading; C(p,2-7)=repeat readings;

C(p,8)=average of readings

test meter data, (described in C(,) above)

A(1)=next available test point; A(2)=present range;

A(3)=no. of readings to take; A(4)=reading on. array of strings containing meter information.

T0$(1 ) ,T0$(2),T0$(3)=manufacturer, model, serial

no. of test meter; T0$(4) ,T0$( 5) ,T0$(6)=

manufacturer, model, serial no. of check meter. instructions to set up test meter for auto reading.

instructions to set up check meter for auto reading.

array of strings of main menu options

array of strings of fit menu options, used to select whether to fit test or check data,

dummy array

used for two purposes; gives information about

user's reply and is a temporary register for

the present range. dummy variable

string into which user enters the date

string into which user enters the time

Julian value of date

string copy of Julian date

mm/dd/yyyy format of date

no. of options in menu passed to MENU routine

no. of selected menu option

unused variable

date of test, loaded tests may have dates

differing from the present date

dummy variable

dummy variable

dummy variable

dummy string

loop control

WAIT between readings

address of phase standard

address of test meter

address of check meter

test meter multiplier for automatic readings

check meter multiplier for automatic readings

position of reading in test meter input

position of reading in check meter input

flag to abort test for main menu

40
100 SUB "A-ZERO" (A,R,D(,),F)

105 ! 110 ! This program takes auto-zero samples to find the span and

115 ! average. At user's request it will record the span and

120 ! the last correction. JUL 87

125 ! 130 ! INPUT: D(,)=data, F=flag to skip initial prompt.

135 ! 140 OPTION BASE 1(3 SFLAG 5 (3 IF F THEN GOTO 155

145 CLEAR (3 DISP "Do you want an auto-zero sample?" 0 CALL "YESNO" ( K ) 150 ON K GOTO 155,240,245

155 CLEAR @ S=D(92,R) 0 DISP USING "D,30A" ; S," of 4 samples have been taken."

160 ! L=smallest correction, H=highest corr., T=sum of corrs.,

165 ! C=no. of corrs. in T. 170 L = 361 @ H=-361 @ T,C=0 @ S=S+1 (3 IF S=5 THEN S=l

175 DISP USING "41A,D,A" ; "Next stored sample will occupy position ",S,"." 0 D ISP

180 ! Do auto-zero.

185 D$="LRFAQLFQLFFQR" 0 Q=3 0 CALL "TALK" ( A,D$,Q ) 190 IF QO-1 THEN DISP "Auto-zero was UNSUCCESSFUL." 0 WAIT 1500 0 GOTO 145

195 Q=VAL(D$[8,16]) 0 L=MIN(L,Q) 0 H=MAX(H,Q) 0 T=T+Q 0 C=C+1

200 DISP USING 205 ; H-L,T/C 0 DISP

205 IMAGE "running span =",2DZ.3D / "running average =",2DZ.3D

210 ! Increase sample size on user request.

215 DISP "Do you want another reading?" 0 CALL "YESNO" ( K ) 0 ON K GOTO 185,225

,245

220 ! 225 DISP 0 DISP "Do you want to store this" 0 DISP " sample?"

230 CALL "YESNO" ( K ) 0 ON K GOTO 235,145,245

235 D(92,R)=S 0 D(92+R , S*2-l ) =H-L 0 D(92+R,S*2)=Q

240 CFLAG 5 245 SCRATCHSUB "TALK" 0 SUBEXIT

VAR OCCURS IN LINE

A 100 ,185

R 100 ,155 ,235 ,235

235

D (,) 100 ,155 ,235 ,235

235

F 100 ,140

K 145 ,150 ,215 ,215

230 ,230

S 155 ,155 ,170 ,170

170 ,170 ,175 ,235

235 ,235

L 170 ,195 ,195 ,200

235

H 170 ,195 ,195 ,200

235

T 170 ,195 ,195 ,200

C 170 ,195 ,195 ,200

D $ 185 ,185 ,195

Q 185 ,185 ,190 ,195

195 ,195 ,195 ,235

address of phase standard

present range

test meter data. (see main program xref)

flag to skip "Do you want an auto-zero?" prompt

reply to yes or no prompt

no. of samples taken

smallest auto-zero correction

highest auto-zero correction

sum of corrections in present sample

no. of auto-zeros taken for sample

correction read from standard

multi-purpose variable. passes no. of queries

to TALK and returns with -1 if TALK succeeded

on line 195 Q is the read correction

41
100 SUB "CHKRNG" (Z,A(),R(,))

105 ! 110 ! This program will delete the present range if its test

115 ! points overflow the data arrays. JUL 87

120 ! 125 OPTION BASE 1 130 Z=l @ IF A(l)<=91 THEN SUBEXIT

135 Z=0 (B A(1)=R(A(2),1) (3 R ( A( 2) , 2) ,R( A(2) , 3 ), R ( A( 2) , 4) =0

140 CLEAR (3 DISP "Maximum number of test points reached. RANGE DELETED."

145 DISP 0 DISP "Press <CONT>." (3 PAUSE

150 SUBEXIT

VAR OCCURS IN LINE

Z 100 ,130 ,135 set if there isn't room for the range

A ( ) 100 ,130 ,135 ,135 A(l)=next available test point; A(2)=present

135 ,135 ,135 range

R (,) 100 ,135 ,135 ,135 array of range parameters, (see xref in

135 main program)

4?.
100 SUB "DATA" (D( , ) ,B( ) ,N$) ! JUL 87

105 ! 110 ! This program displays phase angle and auto-zero data.

115 ! 120 N$="" (3 OPTION BASE l(a DIM M$[40]

125 ! 130 ! Have user select which data to see. 135 ! 140 SARRAY M$ @ SLET M$(l) = "Angle Data" @ SLET M$(2) = "Auto-Zero Data"

145 CALL "MENU" ( 2,M$,C ) @ IF C=2 THEN 345

150 ! 155 ! View phase angle data.

160 ! 165 ! Prompt user for test points to see. 170 CLEAR (3 CALL "QUERY" ( "Enter first test point to be seen." ,C,A2,Z$ ) 175 IF A2<1 OR A2>91 THEN DISP "Data out of range." @ DISP @ GOTO 170

180 ON C GOTO 190,170,185

185 N$=CHR$(128) @ SUBEXIT

190 DISP @ CALL "QUERY" ( "Enter last test point to be seen. " ,C,A3,Z$ ) 195 IF A3<1 OR A3>91 THEN DISP "Data out of range." (a DISP @ GOTO 190

200 ON C GOTO 215,190,205

205 N$=CHR$(128) (3 SUBEXIT

210 ! Function to keep angle within range of -1 to 359.

215 DEF FND(X) = X-360*(X>359 AND X<361)

220 ! Now show the data.

225 S=0 0 N=0

230 FOR A=A2 TO A3

235 IF B(A)=0 THEN DISP USING 240 ; A;D(A,1) @ GOTO 285

240 IMAGE /3D, IX, 3D. 3D," *** NO DATA ***"

245 DISP USING 250 ; A;D(A, 1) ;B(A) ;D(A,8) ;D{A,2) ;D(A,3) ;D(A,4) ;D(A,5) ;D(A,6) ;D(A

.7)

250 IMAGE /3D,1X,3D.3D,2X,3D,2X,3D.3D,2(/3X,2(3D.3D,3X),3D.3D)

255 D8=FND(D(A,8))

260 IF B(A)<2 THEN 285

265 FOR B=a TO B(A)+1

270 S=S+(FND(D(A,B))-D8)®2

275 NEXT B 280 N=N+B(A)-1

285 NEXT A @ IF N=0 THEN 315

290 ! Show the statistical info.

295 DISP USING 300 ; SQR(S/N)

300 IMAGE //"standard deviation = ",DZ.4D/"[repl ication]"

305 DISP USING 310 ; 3*SQR(S/N),N

310 IMAGE " 3s= ",17DZ.4D/" degrees of freedom = ",5D

315 DISP (3 DISP (3 DISP "Press <CONT> to continue."

320 PAUSE

325 SUBEND

330 ! 335 ! Display auto-zero info for a given range.

340 ! 345 CLEAR (3 CALL "QUERY" ( "Enter range to exami ne. " ,C,R,Z$ ) 350 IF R<1 OR R>8 THEN 345

43
355 ON C GOTO 360,345,185

360 IF D(92,R)=0 THEN DISP (3 DISP "NO DATA AVAILABLE FOR THAT RANGE" @ WAIT 2000

(3 GOTO 185

365 CLEAR @ DISP USING 370 ; R 370 IMAGE / "Range ",D," Auto-Zero Data" //" Sample Span Final Corn." //

375 FOR 1 = 1 TO 4 (a DISP USING 380 ; I ,D(92+R, 1*2-1 ) ,D(92+R, 1*2) (3 NEXT I @ GOTO

315

380 IMAGE 5D,7DZ.3D,5DZ.3D

VAR OCCURS IN LINE

D (,) 100 ,235 ,245 ,245 any meter data. (see main program xref)

245 ,245 ,245 ,245

245 ,245 255 ,270 ' ,,, 360 ,375 ,375

B (.) 100 ,235 ,245 ,260 no. of readings at each point of either

265 ,280 meter

N $ 100 ,120 185 ,205 contains CHR$(128) to request main menu

M $ 120 ,140 ,140 ,140 array of strings of menu options

145

C 145 ,145 ,170 ,180 contains no. of menu option selected or

190 ,200 ,345 ,355 value of user's request on QUERY

A2 170 ,175 ,175 ,230 '1.. first test point to be seen

Z $ 170 ,190 345 dummy s tr ing

A3 190 ,195 ,,195 ,230 last test point to be seen

S 225 ,270 ,270 ,295 standard deviation

305

N 225 ,280 , 280 ,285 no. of readings used to calculate deviation

295 ,305 ,305

A 230 ,235 ,235 ,235 test point no. and loop control

245 ;245 ,245 ,245

245 ,245 , 245 ,245

245 ,245 ,255 ,260

265 ,270 280 ,285

D8 255 ,270 average reading at point A

B 265 ,270 ,275 reading no. loop control

R 345 ,350 ,350 ,360 range no. 365 ,375 ,375

I 375 ,375 ,375 ,375 . loop control

375

44
100 SUB "EDIT" (R(,),D(,),B(),N$,J)

105 ! 110 ! This program allows the user to change ranges and test and

115 ! check data. JUL 87

120 ! 125 ! INPUT: J=l to edit ranges; J=2 to edit data points.

130 ! 135 OPTION BASE 1 140 N=0

145 ON J GOTO 165,230

150 ! 155 ! Edit user-specified range.

160 ! 165 CLEAR @ CALL "QUERY" ( "Enter range to be edi ted. " , X,R , Y$ ) 170 ON X GOTO 175,165,275

175 IF R<1 OR R>8 THEN 165

180 CLEAR @ GOSUB 285

185 DISP (a DISP "Make corrections, then press <CONT> to continue." @ PAUSE

190 IMAGE A,"(",2D,",",D ,")= ",M2DZ.2D

195 CLEAR (3 GOSUB 285

200 IMAGE /,"Are data OK now?"

205 DISP USING 200 ; 210 CALL "YESNO" { X )

(a ON X GOTO 275, 175,275

215 ! 220 ! Edit user-specified data point.

225 ! 230 CLEAR (3 DISP "Enter data point to be edited." (3 IF N#0 THEN DISP N;" is the

default."

235 CALL "QUERY" ( "",X,N,Y$ ) 240 ON X GOTO 245,230,275

245 IF N<1 OR N>91 THEN 230

250 GOSUB 320

255 DISP @ DISP "Make corrections, then press <CONT> to continue." (a PAUSE

260 CLEAR (3 GOSUB 320

265 DISP USING 200 ; 270 CALL "Y-ESNO" ( X ) P ON X GOTO 275,230,275

275 SUBEXIT

280 ! 285 ! Routine to display range information.

290 ! 295 FOR 1=1 TO 4

300 DISP USING 190 ; "R" ,R, I ,R(R, I

)

305 NEXT I 310 RETURN

315 ! 320 ! Routine to display data points.

325 ! 330 S=0

335 FOR 1=1 TO 8

340 IF I>1 AND I<=B(N)+1 THEN S=S+D(N , I )-360* (D(N, I

) >359 AND D(N,I)<361)

345 IF 1=8 AND B(N)<>0 THEN D(N,8)=S/B(N)

350 DISP USING 190 ; "D" ,N, I ,D(N, I

)

355 NEXT I 360 IF B(N)<>0 THEN D(N,8)=S/B(N)

365 DISP USING 370 ; N,B(N)

370 IMAGE "B(",DD,")= ",2D

375 RETURN

380 SUBEND

45
VAR OCCURS IN LINE

R (.) 100 ,300

D (,) 100 ,340 ,340 ,340

345 ,350 ,360

B (,) 100 ,340 ,345 ,345

360 ,360 ,365

N $ 100

J 100 ,145

N 140 ,230 ,230 ,235

245 ,245 ,340 ,340

340 ,340 ,345 ,345

345 ,350 ,350 ,360

360 ,360 ,365 ,365

X 165 ,170 ,210 ,210

235 ,240 ,270 ,270

R 165 ,175 ,175 ,300

300

Y $ 165 ,235

I 295 ,300 ,300 ,305

335 ,340 ,340 ,340

340 ,340 ,345 ,350

350 ,355

S 330 ,340 ,340 ,345

360

array of range parameters. (see main program)

test or check meter data. (see main program

xref

)

no. of readings at each point of test or check

meter

unused

J=l to edit ranges; J=2 to edit data

no. of data point to edit

numerical value of the user's request

range no.

dummy string

loop control

sum of readings at a data point

(•<: 0

46
100 SUB "EDITFI" (C$.A( ) ,B1 ( ) ,B2( ) .C( , ) ,D( , ) ,DO$,MO,N$,R( , ) ,S1$,T0$) ! JUL 87

105 ! 110 ! This program dispatches control to the routines that allow

115 ! the user to edit test data and information. JUL 87

120 ! 125 OPTION BASE 1(9 DIM M$[80]

130 ! 135 ! Have user select data to change.

140 ! 145 SARRAY M$ (3 SLET M$(l) = "Edit Header" 0 SLET M$(2) = "Edit Range"

150 SLET M$(3) = "Edit Test Data" @ SLET M$(4) = "Edit Check Data"

155 SLET M$(6) = "Main Menu" @ CALL "MENU" ( 6,M$,R ) @ ON R GOTO 160,175,180,18

5,100,190

160 CALL "HEADER" ( C$, S1$,A(2) ,R( , )

, 1 , 1 ,M0,T0$,D0$ ) 0 WAIT 1500

165 CALL "HEADER" ( C$,S1$,A(2) ,R( , ) ,2,0,M0,T0$,D0$ ) 170 CALL "HEADER" ( C$ , Sl$, A(2) , R ( , ) , 3, 1 ,MO,TO$,DO$ ) 0 GOTO 190

175 CALL "EDIT" ( R( , ) ,D( , ) ,B1 ( ) ,N$, 1 ) 0 GOTO 190

180 CALL "EDIT" ( R( , ) ,D( , ) ,B1 ( )

, N$, 2 ) 0 GOTO 190

185 CALL "EDIT" ( R( , ) ,C( , ) ,B2( ) ,N$,2 ) 190 SCRATCHSUB "HEADER" 0 SCRATCHSUB "EDIT" 0 SUBEND

VAR OCCURS IN LINE

C $ 100 , 160 ,165 ,170 test info from TOC (see main program xref)

A ( ) 100 160 ,165 ,170 A(2)=no. of present range

Bl(,) 100 , 175 ,180 readings/test point (see main program xref)

B2(.) 100 ,185 readings/check point (see main program xref)

c (.) 100 , 185 check meter data, (see main program xref)

D (.) 100 ,175 ,180 test meter data (see main program xref)

D0$ 100 ,160 ,165 ,170 test date

MO 100 ,160 ,165 ,170 dummy variable

N $ 100 ,175 ,180 ,185 dummy string

R (.) 100 ,160 ,165 ,170 array of range parameters (see main program

175 • ,180 ,185 xref)

Sl$ 100 ,160 ,165 ,170 present date

T0$ 100 ,160 ,165 ,170 test and check meter info (see main program)

M $ 125 ,145 ,145 ,145 array of strings of menu options

150 ,150 ,155 ,155

R 155 ,155 selected menu option

47
100 SUB "ENTER" (R ( , ) ,D( , ) ,B1 ( )

, S( )

, N, K, A,B , X, Y ,S ,S1 , S2 ,T1 , T2 ,F1 ,R1

)

105

"ENTER" computes fitted intercept a-hat, fitted slope b-hat,

standard deviation of readings s, goodness of fit F', intercept

test statistic tl and slope test statistic t2 for the data

of the range or ranges that the user specifies, last modified

6-30-87, 2:51.

INPUT: R(,)=ranges, D(,)=test or check data, Bl()=no. of readings

at test points, S( )=i ntermediate sums; OUTPUT: N=nl<, K=k,

A=a-hat, B=b-hat, X=av. ideal reading, Y=av. actual reading,

S=s, Sl=S(a-hat), S2=S(b-hat), Tl=tl, T2=t2, F1=F', Rl=last

range specified

110

115

120

125

130

135

140

145

150

155

160

165

170 OPTION BASE 1(3 DIM Cl(lO)

175 SCRATCHSUB "READAT"

180 ! 185 ! store ranges to process in Cl()

190 ! 195 CLEAR 0 CALL "QUERY" ( "Enter no. of ranges to combine. ",R,L,Z$ ) 200 IF L<1 OR L>8 THEN 195

205 ON R GOTO 210,195,405

210 FOR C=T TO L 215 CLEAR (3 CALL "QUERY" ( "Enter range. " ,R ,R1 , Z$ ) 220 IF RKl OR Rl>8 THEN 215

225 ON R GOTO 230,215,405

230 IF R(R1,2)=0 THEN DISP "Data not present for range ";R1 ELSE GOTO 240

235 WAIT 2000 (a GOTO 195

240 C1(C)=R1 @ NEXT C

' 245 ! 250 CLEAR @ DISP "Computing -- please wait."

255 ! FND(Z)=Z changed to values between -1 and 159 inclusive

260 DEF FND(Z) = Z-360*(Z>359 AND Z<361)

265 S(1),S(2),S(3),S(4),S(5),S(6),S(7),S(8),S(9),N,K=0

270 ! 275 ! loop to find averages

280 i. ^ 285 ! S(l)=njx; S(2)=n^x 2; x=ideal reading

290 ! S(3)= y; y=actual reading

295 FOR C=l TO L 0 R1=C1(C) @ FOR I=R(R1,1) TO R(R1 + 1,1)-1 0 K=K+1 (3 FOR J=2 TO

B1(I)+1

300 S(1)=S(1)+D(I,1) @ S(2)=S(2)+D(I,1)*D(I,1) @ S( 3) =S( 3)+FND(D( I , J ) ) @ N=N+1 (3 NEXT J (3 NEXT I 305 NEXT C (3 X=S(1)/N @ Y=S(3)/N

310

315 loop to find b-hat and a-hat

320

325

330

S(4)= ^(y-Y)(x-X); S(5)=n^(x-X) 2 S(6)=SSE= i:[y-(av. X at point)]"2

335 FOR C = l TO L (3 R1=C1(C) 0 FOR I=R(R1,1) TO R(R1 + 1,1)-1 (3 FOR J = 2 TO B1(I) + 1 340 S(4)=S(4)+(FND(D(I,J))-Y)*(D(I,1)-X) @ S(5)=S(5)+(D( I

, 1 )-Xr 2 345 S(6) = S(6) + (FND(D(I,J))-D(I,8) r2 @ NEXT J 0 NEXT I @ NEXT C (3 B = S(4)/S(5) 0

A=Y-B*X

48
350 ! 355 ! loop to find SSR

360 ! 365 ! S(7)=SSR= ^[y-(fitted y)]''2

370 FOR C=l TO L @ RJ=C1(C) @ FOR I=R(R1,1) TO R(R1+1,1)-1 0 FOR J=2 TO B1(I)+1

375 S(7)=S(7)+(FND(D(I ,J))-(A+B*D(I,1)))^2 0 NEXT J 0 NEXT I 0 NEXT C

380 ! 385 ! compute s, S(a-hat), S(b-hat), tl, t2, F' 390 ! 395 S=SQR(S(7)/(N-2))

400 S1=SQR(S(2)/(N*S(5)))*S 0 S2=SQR(1/S(5) )*S

405 T1=ABS(A/S1) 0 T2=ABS{ (B-1 )/S2) 0 F1=ABS( (N-K)/(K-2)*(S(7)-S(6) )/S(6)

)

410 SUBEND

49
VAR OCCURS IN LINE

R (0 100 ,230 ,295 ,295 array of range parameters. (see main program

335 ,335 ,370 ,370 xref

)

D (,) 100 , 300 ,300 ,300 test or check data. (see main program xref)

300 ,340 ,340 ,340

345 ,345 ,375 ,375

Bl( ) 100 ,295 ,335 ,370 , readings/data point (see main program xref)

s ( ) 100 , 265 ,265 ,265 array of intermediate sums. S(l)=n2^x;

265 ,265 ,265 ,265 S(2)=nlx'^2 (x=ideal reading); S(3)=22y (y=

265 ,265 ,300 ,300 actual reading); S (4)=I2(y-Y) (x-X)

300 ,300 ,300 ,300 S(5)=nl(x-X)^2; S (6) = SSE=IHy- (av . x at

305 ,305 ,340 ,340 point)]'^2; S (7 ) = SSR=22[y- (fitted y)]^2

340 ,340 ,345 ,345

345 ,345 ,375 ,375

395 ,400 ,400 ,400

405 ,405 ,405

N 100 ,265 ,300 ,300 nk (no. or readings at each test point times

305 ,305 ,395 ,400 no. of test points)

405

K 100 ,265 ,295 ,295 no. of test points

405 ,405

A 100 ,345 ,375 ,405 a (fitted y-mtercept)

B 100 , 345 ,345 ,375 "0 (fitted slope)

405

X 100 ,305 ,340 ,340 average ideal reading

345

Y 100 ,305 ,340 ,345 average actual reading

S 100 ,395 ,400 ,400 standard deviation

SI 100 ,400 ,405 S(a)

S2 100 ,400 ,405 SC&)

Tl 100 ,405 tl

12 100 ,405 t2

Fl 100 ,405 F' Rl 100 ,215 ,220 ,220 range no. 230 ',230 ,240 ,295

295 ,295 ,335 ,335

335 ,370 ,370 ,370

Cl() 170 ,240 ,295 ,335 list of range numbers to use in calculations

370

R 195 ,205 ,215 ,225 numerical value of user's request

L 195 ,200 ,200 ,210 no. of ranges to combine

295 ,335 ,370

Z $ 195 ,215 dummy string

c 210 ,240 ,240 ,295 Cl() subscript loop control

295 ,305 ,335 ,335

345 ,370 ,370 ,375

I 295 ,295 ,300 ,300 data point no. loop control

300 ,300 ,300 ,335

335 ,340 ,340 ,340

345 ,345 ,345 ,370

370 ,375 ,375 ,375

J 295 ,300 ,300 ,335 reading no. loop control

340 ,345 ,345 ,370

375 ,375

50
100 SUB "FIT" (C$.R(,),D(,),B1(),S1$,T0$,D0$,H1)

105 ! 110 ! This program dispatches control to various programs that

115 ! analyze data. JUL 87

120 ! 125 OPTION BASE 1 ! JUL 07-87

130 SCRATCHSUB "READAT"

135 SCRATCHSUB "ENTER"

140 DIM S(10)

145 DIM M3$[109]

150 SARRAY M3$ @ GOTO 260

155 ! 160 ! Allow user to select a function.

165 ! 170 ALPHA 1

(a CLEAR

175 C=0 (3 M=10

180 SLET M3$(l) = "Enter Range"

185 SLET M3$(3) = "Print Header"

190 SLET M3$(4) = "Print Par"

195 SLET M3$(5) = "Print Data"

200 SLET M3$(7) = "Reg. Est. " 205 SLET M3$(8) = "Sel . Est. " 210 SLET M3$(10) = "Main Menu"

215 CALL "MENU" ( M,M3$,C ) 220 SCRATCHSUB "MENU"

225 SCRATCHSUB "DATA"

230 SCRATCHSUB "PLOT"

235 SCRATCHSUB "HEADER"

240 ON C GOTO 260,100,400,270,365,100,305,335,100,440

245 ! 250 ! Enter range and calculate fit.

255 ! 260 CALL "ENTER" ( R( , ) ,D{ , ) ,B1 ( ) ,S{ ) ,N,K,A,B,X,Y,S,S1 ,S2,T1 ,T2,F1 ,R1 ) 265 SCRATCHSUB "ENTER" @ GOTO 170

270 DISP "P'lease wait..." (3 GOSUB 420

275 CALL "STAT" ( S ( ), N,K,A, B , X, Y,S ,S1 ,S2,T ,T1 ,T2,F , Fl , 1 ) 280 SCRATCHSUB "STAT"

285 GOTO 170

290 ! 295 ! Print regular fit estimates of phase angle.

300 ! 305 CALL "REG" ( A,B ) 310 SCRATCHSUB "REG"

315 GOTO 170

320 ! 325 ! Print fit estimates for selected phase angles.

330 ! 335 CALL "SEL" ( A,B ) 340 SCRATCHSUB "SEL"

345 GOTO 170

51
350 ! 355 ! Print all data.

360 ! 365 DISP "Please wait..." (a GOSUB 420

370 CALL "PDATA" ( R( , ) ,D( , ) ,B1( ) ,A,B,R1 ) 375 SCRATCHSUB "PDATA"

380 GOTO 170

385 ! 390 ! Print the header.

395 ! 400 GOSUB 420 (9 GOTO 170

405 ! 410 ! Routine to print the header.

415 ! 420 CALL "HEADER" ( C$, Sl$, Rl ,R ( , )

, 3, HI ,MO,TO$ , D0$ ) 425 SCRATCHSUB "HEADER"

430 RETURN

435 ! 440 SUBEND

VAR OCCURS IN L INE

C $ 100 ,420

R f ) 100 ,260 ,370 ,420

D ( ) 100 ,260 370

Bl ( ) 100 ,260 370

Sl$ 100 ,420

TO^ 100 420

nni u u 4> 1 no 4?n

n I 100 ,420

s 0 140 ,260 ,275

M3$ 145 ,150 ,180 ,185

190 ,195 ,200 ,205

210 •,215

C 175 ,215 ,240

M 175 ,215

N 260 ,275

K 260 ,275

A 260 ,275 ,305 ,335

370

B 260 ,275 ,305 ,335

370

X 260 ,275

Y 260 ,275

S 260 ,275

SI 260 ,275

S2 260 ,275

Tl 260 ,275

12 260 ,275

Fl 260 ,275

Rl 260 ,370 ,420

T 275

F 275

MO 420

test info from TOC (see main program xref)

range parameters (see main program xref)

test or check data, (see main program xref)

readings/data point (see main program xref)

present date

test and check meter info (see main program)

test date

set if fitting test data

intermediate sums, (see ENTER xref)

array of strings of menu options

selected menu option

no. of options in menu

nk (see ENTER xref)

no. of data points ^ (fitted y-intercept)

b (fitted slope)

average ideal reading

average actual reading

standard deviation

S(|)

S(b)

tl

t2

F'range no. Student's t upper 1% point of F distribution

dummy variable

52
100 SUB "F_TABL" (A,V1,V2,F)

105

This program calculates the F-statistic through a binary

search of table values figured in the INV F program. JUL 87

150

160

165

170

175

110

115

120

125

130

135

140

145 F1,F2=1

INPUT: A=upper percent points; VI , V2=degrees of freedom in

numerator, denominator. JUL 87

Fl,F2=low, high approximations for F.

Find a too high approximation for F. 155 CALL "INV F" ( F2,V1,V2,P ) @ IF P>A THEN F1 = F2 (9 F2 = F2*2 0 GOTO 155

F=value halfway between the too high and too low values.

P=resultant % points. If P is too low then F is too high,

so change too high value to F. If P is too high then F is too low, so change too low value to F. 180 F=(Fl+F2)/2 (3 CALL "INV_F" ( F,V1,V2,P )

(9 IF P-A<-.001 THEN F2 = F @ GOTO 180

185 IF P-A>.001 THEN F1=F (3 GOTO 180

190 ! P is just right, within an accuracy of .001.

195 SCRATCHSUB "INV F" @ SUBEND

VAR OCCURS IN LINE

A 100 ,155 ,180 ,185

VI 100 ,155 ,180

V2 100 ,155 ,180

F 100 ,180 ,180 ,180

185

Fl 145 ,155 ,180 ,185

F2 145 ^155 ,155 ,155

155 ,180 ,180

P 155 ,155 ,180 ,180

185

upper percentage points

degrees of freedom in numerator

degrees of freedom in denominator

F-statistic

low approximation for F high approximation for F

percentage points corresponding to F

53
100 SUB "GET_DATA" (R,B1 ( ) ,B2( ) ,T1 ,A1 ,A2,A3,F2,F3,I2$,I3$,P2,P3,S1$,D0$,Z)

105 ! 110 ! "GET_DATA" initializes the standard phase meter to a given

115 ! range, optionally records auto-zero sample data, automatically

120 ! selects and sets the meter to each angle of the test, and

125 ! records the read or user-entered angles of the meters. JUL 87

130 ! 135 OPTION BASE 1 140 COM C$[60],R(10,4),C(100,8),D(100,8),A(5),T0$[100]

145 DIM I$[20]

150 ! 155 ! Function to reduce voltage over 100 by factor of 40 to

160 ! compensate for the standard's step-up.

165 ! 170 DEF FNV$(Q)

175 Q=ABS(R(R,Q)) (3 IF Q>100 THEN Q=Q/40

180 FNV$=VAL$(Q) @ FN END

185 ! 190 ! Function to keep angles within range of -1 to 359.

195 ! 200 DEF FND(Q) = Q-360*(Q>359 AND Q<361)

205 ! 210 ! Set the standard and the phase meters that are to be read

215 ! automatically. Also display the range parameters for the

220 ! user to verify.

225 ! 230 CLEAR @ IF FLAG(2) THEN OUTPUT A2 ;I2$

235 IF FLAG(3) THEN OUTPUT A3 ;I3$

240 CALL "TALK" ( Al ,"LRC"&VAL$(R(R,4) )&".D0"&FNV$(2)&".000D1"&FNV$(3)&".000CQD0

QD1Q",3 ) 245 WAIT 4000

250 ! 255 ! Allow user to take auto-zero samples.

260 ! 265 CFLAG 5* @ CALL "A-ZERO" ( Al ,A(2) ,D( , ) ,0 ) 270 SCRATCHSUB "A-ZERO" @ IF FLAG(5) THEN 720

275 ! 280 ! Get ready to get phase meter data.

285 ! 290 CALL "HEADER" ( C$,S1$,A(2) ,R( , ) ,3,1 ,M0,T0$,D0$ )

(a SCRATCHSUB "HEADER"

295 ! A(4)=no. of readings already taken.

300 A(4)=0 @ FOR I=R(A(2),1) TO R(A(2)+1 , 1 )-l @ A(4)=A(4)+B1 (

I

) 0 NEXT I 305 ! Sl=no. of test points in range, Il=last test point taken.

310 S1=R(A(2) + 1,1)-R(A(2),1) (a 11=0

315

320 ! Head of loop to get phase meter data.

325

330

335

Increment no. of readings, and exit if average no. of

readings S2= wanted no. of readings.

340 A(4)=A(4) + 1 0 S2=INT((A(4)-1)/S1) 0 IF S2>=A(3) THEN Z=0 (a GOTO 725

345 ! Find a reading that hasn't been taken and doesn't repeat

54
350 ! the last angle. I is the test point of that reading.

355 I = IP(S1*RND)+R(A(2),1) (3 IF B1(I)>S2 THEN 355

360 IF 1=11 THEN 355 ELSE 11=1

365 ! 370 ! Show the present test point.

375 ! 380 PRINT USING 390 ; I ,B1 ( I ) ,D( 1 , 1 )

, A(4)

385 CLEAR (3 DISP Sl$;" ";TIME$ 0 DISP USING 390 ; I , Bl (

I ) ,D ( T, 1 ) , A( 4

) -A( 3 ) *S1

390 IMAGE "TEST PT" , 3D , "-" ,D , X, "PHASE" ,M3D. 3D , 2X,M2D

395 ! 400 ! Set and retrieve phase angle.

405 ! 410 CALL "TALK" ( Al , " A"&VAL $(D( I

, 1

) +. 0001 )&"LRAQ" , 1 ) 415 ! 420 ! Wait for meter(s) to settle.

425 ! 430 ON KYBD K, "A"&CHR$( 128) GOTO 730 0 ON TIMER# 1,T1 GOTO 445

435 FOR T2=l TO 180 @ WAIT 1000 (3 BEEP 20,2

440 NEXT T2 (3 DISP "Timing failure. Press <CONT>." (3 PAUSE

445 OFF TIMER# 1 @ OFF KYBD

450 IF NOT FLAG(2) OR FLAG(1 )>FLAG(3) THEN BEEP 100,80 @ BEEP 50,80 @ BEEP 25,10

0

455 ! 460 ! Get automatic readings.

465 ! 470 IF FLAG(2) THEN A=A2 @ F=F2 @ P=P2 @ Z$="TEST" (3 GOSUB 675 ca D2=Q

475 IF FLAG(3) THEN A=A3 (3 F=F3 @ P=P3 (3 Z$="CHECK" 0 GOSUB 675 @ D3=Q

480 ! 485 ! Get test meter reading from user. 490 ! 495 IF FLAG(2) THEN 535

500 CALL "QUERY" ( "Enter test data. " ,R,D2,Z$ ) 505 IF Z$[1,1]="A" THEN 730

510 ON R GOTO 515,495,720

515 Q=D2 (3 GOSUB 760 (3 ON Y GOTO 500,535,720

520 ! 525 ! Store test reading and new average, and update reading count.

530 ! 535 D(I,B1(I)+2)=D2 (3 Q=0

540 FOR K=2 TO 7 @ Q=Q+FND(D( I ,K) ) @ NEXT K 545 B1(I)=B1(I)+1 (3 D(I,8)=Q/B1(I)

550 ! 555 ! Get check meter reading.

560 ! 565 IF NOT FLAG(l) THEN 340

570 IF FLAG(3) THEN 635

575 CALL "QUERY" ( "Enter check data. " ,R ,D3,Z$ ) 580 IF Z$[1,1]<>"A" THEN 610

585 ! Erase last test point so that test and check data will correspond.

590 B1(I)=B1(I)-1 0 D(I,Bl(I)+2)=0

595 IF NOT B1(I) THEN D(I,8)=0 0 GOTO 730

600 Q=Q+FND(D(I,K)) 0 NEXT K

55
605 D(I,8)=Q/B1(I) @ GOTO 730

610 ON R GOTO 615,575,720

615 Q=D3 (3 GOSUB 760 0 ON Y GOTO 575,635,720

620 ! 625 ! Store check reading and new average, and update reading count.

630 ! 635 C(I,B2(I)+2)=D3 (3 Q=0

640 FOR K=2 TO 7 @ Q=Q+FND(C( I ,K) ) @ NEXT K 645 B2(I)=B2(I ) + l

(B C( 1 ,8) =Q/B2( I ) (3 GOTO 340

650 ! 655 ! This routine reads a meter and returns the result in Q.

660 ! It is internal to avoid the delay caused by the initial

665 ! the initial loading of a CALLed program.

670 ! 675 SET TIMEOUT 7;5000 (3 ON TIMEOUT 7 GOTO 695

680 ENTER A ; Z$@ Q=VAL (Z$[P] )*F

685 IF ABS(FND(Q)-D(I ,1))>1 THEN PRINT " **** INCONSISTENT DATA ****" 690 RETURN

695 CLEAR 0 DISP "No response from ";Z$;" meter."

700 DISP 70, 100 (3 BEEP 100, 150 (3 BEEP 70,150

705 DISP (3 DISP "Do you want to try again?"

710 CALL "YESNO" ( Y ) (3 ON Y GOTO 675,720,720

715 ! 720 Z=l

725 SCRATCHSUB "TALK" (3 SUBEXIT

730 IF K=128 THEN 720

735 SCRATCHSUB "TALK" 0 CALL "A-ZERO" ( A1,2,D(,),1 ) 740 SCRATCHSUB "A-ZERO" 0 IF FLAG(5) THEN 720 ELSE 385

745 ! 750 ! This routine checks to see whether the data is consistent.

755 ! 760 IF ABS(FND(Q)-D(I,1))<=1 THEN Y=2 0 RETURN

765 BEEP 70,100 0 BEEP 100,150 0 BEEP 70,150

770 DISP 0-DISP "The data is inconsistent." 0 DISP

775 DISP "Do you want to change the data?" 0 CALL "YESNO" ( Y ) 780 IF Y=2 THEN 685 ELSE DISP 0 RETURN

56
VAR OCCURS IN LINE

R 100 .175 ,240 ,500 no. of range to fill

510 ,575 ,610

Bl(.) 100 ,300 ,355 ,380 no. of readings at each point of test meter

385 ,535 ,545 ,545

545 ,590 ,590 ,590

595 ,605

B2(.) 100 645

,635 ,645 ,645 no. of readings at each point of check meter

Tl 100 ,430 WAIT between readings

Al 100 735 .240 ,265 ,410 bus address of phase standard

A2 100 ,230 ,470 bus address of test meter

A3 100 ,235 ,475 bus address of check meter

F2 100 ,470 test meter automatic reading multiplier

F3 100 ,475 check meter automatic reading multiplier

12$ 100 ,230 instructions to setup test meter for auto reading

13$ 100 ,235 instructions to setup check meter for auto reading

P2 100 ,470 position of reading in test meter input

P3 100 ,475 position of reading in check meter input

Sl$ 100 ,290 ,385 present date

D0$ 100 ,290 date of test

Z 100 ,340 ,720 set when aborting to main menu

c $ 140 ,290 test info from TOC (see main program xref)

R (J 140 ,175 ,240 ,290 array of range parameters (see main program xref)

300 ,300 ,310 ,310

355

c (.) 140 ,635 ,640 ,645 check meter data, (see main program xref)

D (.) 140 ,265 ,380 ,385 test meter data, (see main program xref)

410 ,535 ,540 ,545

590 ,595 ,600 ,605

685 ,735 ,760

A ( ) 140 ,265 ,290 ,300 A(l)=next available test point; A(2)=present

300 ,300 ,300 ,300 range; A(3)=no. of readings to take; 310 ,310 ,340 ,340 A(A)=reading on. 340 ,340 ,355 ,380

385 ,385

T0$ 140 ,290 test and check meter info (see main program xref)

I $ 145 unused

MO 290 dummy variable

I 300 ,300 ,300 ,355 no. of data point being taken

355 ,360 ,360 ,380

380 ,380 ,385 ,385 385 ,410 ,535 ,535

540 ,545 ,545 ,545 545 ,590 ,590 ,590

590 ,595 ,595 ,600

605 ,605 ,635 ,635

640 ,645 ,645 ,645

645 ,685 ,760

SI 310 ,340 ,355 ,385 no. of test points in range

11 310 ,360 ,360 last test point taken

S2 340 ,340 ,355 average no. of readings taken in each data point

K 430 ,540 ,540 ,540 multi-purpose variable, contains value of 600 ,600 ,640 ,640 interrupting programmed key. also is a loop

640 ,730 control

T2 435 ,440 loop control for ticking during wait between readings

A 470 .475 ,680 bus address of test or check meter

F 470 ,475 ,680 reading multiplier for test or check meter

P 470 ,475 ,680 position of reading in test or check meter input

z $ 470 ,475 ,500 ,505 multi-purpose variable.

575 ,580 ,680 ,680

695

D2 470 ,500 ,515 ,535 test meter reading

Q 470 ,475 ,515 ,535 multi-purpose variable. contains test or check

540 ,540 ,545 ,600 meter reading. also is sura of readings at a 600 ,605 ,615 ,635 test point.

640 ,640 ,645 ,680

685 ,760 D3 475 ,575 ,615 ,635 check meter reading

Y 515 ,615 ,710 ,710 multi-purpose variable. numerical value of user's

760 ,775 ,780 request. also describes action to take on encountering inconsistent data

57
100 SUB "GET_PARAMS" (R , A( ) ,T1 , T0$ , Al , A2 , A3, F2 ,F3 , 1 2$, I 3$, P2 ,P3)

105

This program prompts the user for the parameters needed

to conduct a test and take data. JUL 87

INPUT: TO$()=test and check meter info; OUTPUT: R,A(2)=range

to fill; A( 3) =readi ngs/poi nt ; T1=WAIT time between readings;

Al,A2,A3=bus address for standard, test meter, check meter;

F2,F3=factor by which automatic meter readings are multiplied;

1 2$, 1 3$=i nstructi on code to query test, check meter; P2,P3=

byte of beginning of reading in string returned by test,

check meter; FLAG(2) ,FLAG(3)=1 if test, check meter is to

be read; FLAG(5)=1 if user requests main menu.

110

115

120

125

130

135

140

145

150

155

160

165

170 OPTION BASE 1@ DIM I$[20],M$[400]

175 INTEGER F(10),L(10)

180 ! 185 CLEAR @ DISP "Enter range you want to fill."

190 CALL "QUERY" ( " Range "&VAL$( A(2) )&" is the default. ",R,Z,Z$ ) 195 ON R GOTO 200,210,565

200 A(2)=Z @ IF Z<1 OR Z>8 THEN A(2)=l @ GOTO 185

205 ! 210 CLEAR @ R=A(2) @ IF A(3)=0 THEN A(3)=4

215 DISP "Specify 1 to 6 readings per"

220 CALL "QUERY" ( " testpoint. "&VAL$( A( 3) )&" is the default. ",Y,Z,Z$ ) 225 DISP (3 ON Y GOTO 230,240,565

230 IF Z<1 OR Z>6 THEN 215 ELSE A(3)=Z

235 ! 240 Tl=20 @ DISP "Specify wait of at least 2"

245 CALL "QUERY" ( " seconds. 20 is the def aul t

. "

, Y,T1 ,Z$ ) 247 ON Y GOTO 250,250,565

250 IF TK2 THEN 240 ELSE T1=T1*1000-1999

255 ! 260 ! Get meter query instructions from disk.

265 ! 270 ON ERROR GOTO 285 @ ASSIGN# 1 TO "METERS :D700" 0 OFF ERROR

275 READ# 1 ; N,M$ , F ( ) ,L ( )@ GOTO 300

280 ! The file doesn't exijt yet, so make it.

285 OFF ERROR (3 CREATE "METERS : D700" , 3, 256

290 FOR 1 = 1 TO 10 @ F(I),L(I) = 1 @ NEXT I (9 M$[400]=" " (3 N=0

295 ASSIGN# 1 TO "METERS :D700" (3 PRINT# 1 ; N,M$,F(),L()

300 ASSIGN# 1 TO * 305 ! 310 ! Get bus addresses from user and see if readings are to be

315 ! taken via bus. If user wants automatic reading then see 320 ! whether the querying instructions for the meter(s) is(are)

325 ! already stored on disk. If not then get the info and add

330 ! it to the METERS file.

335 ! 340 CLEAR 0 DISP "Enter address of PHASE STANDARD."

345 Al = l (3 CALL "QUERY" ( "

1 is the def aul t

. " , Y,A1 ,Z$ ) 347 ON Y GOTO 350,350,565

350 A1=A1 + 716 @ IF AK717 OR Al>731 THEN 340
355 ! Initialize FLAGs. 2 and 3 are described at the beginning of

360 ! this program. 4 will be set by end of prompts if additions

365 ! are made to the meter info file.

370 CFLAG 2 @ CFLAG 3 @ CFLAG 4

372 A2,A,M,P=0

375 F=2 @ I$="TEST" & GOSUB 430 @ A2=A @ F2=M 0 I2$=I$ @ P2=P

380 ! FLAG(1)=1 if test will use a check meter.

385 IF FLAG(l) THEN F = 3 (3 I$="CHECK" @ GOSUB 430 @ A3=A @ F3-M (3 I3$ = I$ @ P3=P

390 ! 395 ! Save additions to METERS, if any.

400 ! 405 IF FLAG(4) THEN ASSIGN# 1 TO "METERS :D700" PRINT# 1 ; N,M$,F(),L() (3 ASSIG

N# 1 TO * 410 CFLAG 5 @ SUBEXIT

415 ! 420 ! This info gathering routine is called once per meter.

425 ! 430 CLEAR (3 DISP "Do you want the "&I$&" meter to" @ DISP " be read via bus?"

435 SFLAG F @ CALL "YESNO" ( Y )

(3 ON Y GOTO 445,440,565

440 CFLAG F (3 RETURN

445 ! 450 CLEAR @ CALL "QUERY" ( "Enter address of "&I$&" meter. " , Y, A,Z$ ) 455 ON Y GOTO 460,450,565

460 A=A+700 (3 IF A<700 OR A>731 OR A=A1-16 OR A=A2 THEN 450

465 ! See whether METERS already has info about this meter.

470 I=F*3-5 (3 I$[1,10]=GET$(T0$(I)) @ I $[1 1 , 20]=GET$(T0$( I + l

)

)

475 FOR L=l TO 361 STEP 40 0 IF M$[L ,L+19]=I$ THEN 545

480 NEXT L 485 ! Meter not found. Prompt user for info.

490 DISP @ CALL "QUERY" ( "Enter the instruction code for setting up this mete

r.",Y,Z,I$ ) 495 ON Y GOTO 500,490,565

500 DISP @ DISP "At which byte of the returned"

505 CALL "QUERY" ( " string does the reading begi n?" , Y, P,Z$ ) 510 ON Y GOTO 515,500,565

515 DISP @ DISP "By what factor must the reading" 0 M=l

520 CALL "QUERY" ( " be adjusted. 1 is the def aul t

. "

, Y,M,Z$ ) 525 ON Y GOTO 530,530,565

530 L=N*40+1 (3 N=N+1 (3 F(N)=M @ L(N)=P @ M$[L ,L+9]=GET$(T0$( I

)

)

535 M$[L+10,L+19]=GET$(T0$(I+1)) (3 M$[L+20,L + 39] = I$ 0 SFLAG 4 0 RETURN

540 ! Meter found. Copy info.

545 FOR I=L+39 TO L+20 STEP -1 0 IF M$[I,I]<>" " THEN 555

550 NEXT I 555 I$=M$[L+20,I] 0 I=INT(L-l)/40+l 0 M=F(I) 0 P=L(I) 0 RETURN

560 ! 565 SFLAG 5 0 SUBEND

59
VAR OCCURS IN LINE

R 100 ,190 ,195 ,210

A ( ) 100 ,190 ,200 ,200

210 ,210 ,210 ,220

230

Tl 100 ,240 ,245 ,250

250 ,250

T0$ 100 ,470 ,470 ,530

535

Al 100 ,345 ,345 ,350

350 ,3^0 ,350 ,460

A2 100 ,372 ,375 ,460

A3 100 ,385

F2 100 ,375

F3 100 ,385

12$ 100 ,375

13$ 100 ,385

P2 100 ,375

P3 100 ,385

I $ 170 ,375 ,375 ,385

385 ,430 ,450 ,470

470 ,475 ,490 ,535

555

M $ 170 ,275 ,290 ,295

405 ,475 ,530 ,535

535 ,545 ,555

F 0 175 ,275 ,290 ,295

405 ,530 ,555

L 0 175 ,275 ,290 ,295

405 ,530 ,555

Z 190 ,200 ,200 ,200

220 ,230 ,230 ,230

490

z $ 190 ,220 ,245 ,345

450 ,505 ,520

Y 220 - ,225 ,245 ,247

345 ,347 ,435 ,435

450 ,455 ,490 ,495

505 ,510 ,520 ,525

N 275 ,290 ,295 ,405

530 ,530 ,530 ,530

530

I 290 ,290 ,290 ,290

470 ,470 ,470 ,530

535 ,545 ,545 ,545

550 ,555 ,555 ,555

555

A 372 ,375 ,385 ,450

460 ,460 ,460 ,460

460 ,460

M 372 ,375 ,385 ,515

520 ,530 ,555

P 372 ,375 ,385 ,505

530 ,555

F 375 ,385 ,435 ,440

470

L 475

530 ,530 ,530 ,535

535 ,535 ,535 ,545

no. of range to fill

A(2)=present range; A(3)=no. of readings to

take

VMIT between readings

test and check meter info (see main program

xref

)

bus address of phase standard

bus address of test meter

bus address of check meter

test meter automatic reading multiplier

check meter automatic reading multiplier

instructions to set up test meter

instructions to set up check meter

position of reading in test meter input

position of reading in check meter input

multi-purpose string, initially contains the

type of meter being set up. returning from

the routine at line 420 it contains the

instructions to set up the given meter.

meter information string. M$[o ,o+9]=manufacturer; M$[o+10,o+19]=model no.; M$[o+20 ,o+39]=

instruction string to set up meter

array of automatic reading multipliers —

gives multiplier for each meter in METERS file

array of positions of readings in meter input —

gives position for each meter in METERS file

user's numerical input

dummy string

numerical value of user's request

number of meters in the METERS file

multi-purpose variable. serves as loop control,

and in lines 470, 530, and 535, as an index

into the T0$() array

address of meter to be considered in the routine

at line 420

test or check meter reading multiplier, used to

adjust readings that are taken via bus

position of reading in test or check meter input

flag to set if meter considered by routine at

line 420 is to be read automatically

location in M$ of information about meter being

considered

60
100 SUB "GETRNG" (A{ ) ,C ( , ) ,D ( , )

, R( , )

, Bl ( )

, B2 ()

)

105

This program initializes ranges and ideal readings for

their data. AUG 87

Determine range to set up.

110

115

120

125

130

135 OPTION BASE 1 140 ! 145 ! Find a free range, if any.

150 A(2)=0 (3 IF R(1,1)=0 THEN A(l) = l 155 IF A(2)=8 THEN CLEAR @ DISP "No free ranges." 0 WAIT 2000 @ SUBEXIT

160 A(2)=A(2)+1 0 IF R(A(2),2)<>0 THEN 155

165 A(1)=R(A(2),1)

170 ! Automatically use range 1 i f no ranges have been used.

175 IF A(2)=l THEN GOTO 265

180 ! See if user wants to restart a range.

185 CLEAR (3 DISP "Enter range to setup."

190 CALL "QUERY" ( " Range "&VAL$(A(2) )&" is the default. " ,Y,R,Z$ ) 195 ON Y GOTO 200,265,440

200 IF R<1 OR R>8 THEN 185

205 A(2)=R @ A(1)=R(A(2),1)

210 ! Parameters can be changed without changing readings.

215 DISP @ DISP "Do you want to discard old data?"

220 CALL "YESNO" ( R ) 0 ON R GOTO 230,150,440

225 ! zero test points of range

230 FOR J=R(A(2),1) TO R(A( 2)+l , 1

) -1

235 B1(J),B2(J)=0

240 FOR K=2 TO 8 0 D(J,K) ,C(J,K)=0 @ NEXT K (3 NEXT J 245 SUBEND

250 ! 255 ! Prompt user for parameters.

260 ! 265 CLEAR (3 DISP "PARAMETERS FOR RANGE" ;A(2)

270 DISP (3 CALL "QUERY" ( "Enter reference channel ." ,R,R1 ,Z$ ) 275 ON R GOTO 280,265,440

280 DISP (3 CALL "QUERY" ( "Enter variable channel ." ,R , VI ,Z$ ) 285 ON R GOTO 290,280,440

290 DISP @ CALL "QUERY" ( "Enter f requency

. " ,R,F1 ,Z$ ) 295 ON R GOTO 300,290,440

300 R(A(2),2)=R1 (3 R(A(2),3)=V1 (3 R(A(2),4)=F1 (3 R ( A( 2 )

, 1 ) =A( 1

)

305 CLEAR @ DISP "Do you want to test points at regular intervals?"

310 CALL "YESNO" ( Y ) 0 ON Y GOTO 315,390,440

315 CLEAR (3 CALL "QUERY" ( "Enter starting phase angl e

. " ,R , S ,Z$ ) 320 ON R GOTO 325,315,440

325 DISP @ CALL "QUERY" ( "Enter ending phase angl e.

" ,R ,E , Z$ ) 330 ON R GOTO 335,325,440

335 DISP @ CALL "QUERY" ( "Enter angle i ncrement . " ,R , I

, Z$ ) 340 ON R GOTO 345,335,440

345 N0=A(1)+INT((E-S)/I)+1 0 IF N0>91 THEN A(l)=92 0 GOSUB 435

61
350 ! 355 ! Automatically set ideal readings.

360 ! 365 FOR N = S TO E STEP I 0 D(A(1),1)=S @ C(A(1),1)=S (3 S = S+I

370 A(1)=A(1)+1 @ R(A(2)+1,1)=A(1) @ NEXT N 0 GOTO 440

375 ! 380 ! Manually set ideal readings.

385 ! 390 CLEAR @ DISP "Enter phase angle, N (new range) or E (end)."

395 DISP A(l) @ CALL "QUERY" ( "",R,Z,S$ ) (3 ON R GOTO 405,395,440

400 A(2)=A(2)+1 0 GOTO 175

405 IF S$[1,1]="E" THEN 440

410 GOSUB 435 @ D( A( 1 ), 1

) =VAL ( S$) 0 C ( A( 1 )

, 1

) =VAL (S$)

415 A(1)=A(1)+1 0 R(A(2)+1,1)=A(1) @ GOTO 395

420 ! 425 ! Abort range entry if has too many test points.

430 ! 435 CALL "CHKRNG" ( Z,A(),R(,) )

(3 IF Z THEN RETURN

440 SCRATCHSUB "CHKRNG" (3 SUBEXIT

62
VAR OCCURS IN LINE

A ( ) 100 ,150 ,150 ,155

160 ,160 ,160 ,165

165 ,175 ,190 ,205

205 ,205 ,230 ,230

265 ,300 ,300 ,300

300 ,300 ,345 ,345

365 ,365 ,370 ,370

370 ,370 ,395 ,400

400 ,410 ,410 ,415

415 ,415 ,415 ,435

c (.) 100 ,240 ,365 ,410

D (,) 100 ,240 ,365 ,410

R (0 100 ,150 ,160 ,165

205 ,230 ,230 ,300

300 ,300 ,300 ,370

415 ,435

Bl( ) 100 ,235

B2{ ) 100 ,235

Y 190 ,195 ,310 ,310

R 190 ,200 ,200 ,205

220 ,220 ,270 ,275

280 ,285 ,290 ,295

315 ,320 ,325 ,330

335 ,340 ,395 ,395

z $ 190 ,270 ,280 ,290

315 ,325 ,335

J 230 ,235 ,235 ,240

240 ,240

K 240 ,240 ,240 ,240

Rl 270 ,300

VI 280 ,300

Fl 290 ,300

S 315 ,345 ,365 ,365

365 ,365 ,365

E 325 ,345 ,365

I 335 ,345 ,365 ,365

NO 345 ,345

N 365 ,370

Z 395 ,435 ,435

s $ 395 ,405 ,410 ,410

A(l)=next available test point; A(2)=present

range no.

check meter data, (see main program xref)

test meter data, (see main program xref)

array of range parameters (see main program

xref)

no. of readings at each point of test meter

no. of readings at each point of check meter

information about user's request

no. of range to set up

dummy string

data point no. loop control

reading no. loop control

reference channel voltage (see main program)

variable channel voltage (see main program)

frequency

starting phase angle

ending phase angle

angle increment

estimated last data point in range

phase angle loop control

dummy variable and return to menu flag

user's reply to query

63
100 SUB "HEADER" (C$,S1$,R1 ,R( , ) ,N0,N1 ,MO,TO$,DO$)

105 ! 110 ! This program handles all header interaction. On entry,

115 ! N0=1 to edit the test meter header, 2 to edit the check

120 ! meter header, and 3 to print the existing headers. AUG 87

125 ! 130 OPTION BASE 1 135 DIM P$[75],Z$[30]

140 SARRAY P$

145 SLET P$(l) = "Manufacturer " 150 SLET P$(2) = "Model #"

155 SLET P$(3) = "Serial #"

160 SLET P$(4) = "Enter " 165 SLET P$(5) = "Test Date " 170 ON NO GOTO 175,180,400

175 1=0 @ GOTO 200

180 1=3

185 ! 190 ! Edit the test or check meter header.

195 ! 200 ON ERROR GOTO 210

205 IF D0$<>"" THEN 215

210 OFF ERROR (a D0$=S1$

215 CLEAR (3 IF 1 = 3 THEN DISP "Check Standard Data:" ELSE DISP "Test Instrument D ata:"

220 ! Show the header.

225 DISP 0 IF NOT I THEN DISP C$[l,30] @ DISP 0 DISP "Folder #: ";C$[51,60]

230 DISP GET$(P$(5)) ;D0$

235 FOR K=l TO 3 240 DISP GET$(P$(K));GET$(TO$(K+I)) (3 NEXT K 245 DISP @ DISP "Is the information correct?" @ CALL "YESNO" ( R ) @ ON R GOTO 3

80,255,375

250 ! Get the customer.

255 IF I THEN 300 ELSE Z$=C$[1,30] @ GOSUB 510

260 CALL "QUERY" ( "Enter customer ." ,R ,Z,Z$ ) 265 ON R GOTO 270,280,375

270 C$[1,30]=Z$

275 ! Get the folder #.

280 Z$=C$[51,60] @ GOSUB 510 (3 CALL "QUERY" ( "Enter folder #.",R,Z,Z$ ) 285 ON R GOTO 290,300,375 o ,u 'i 290 C$[51,60]=Z$

295 ! Get the test date.

300 Z$=DO$ (3 GOSUB 510 (3 CALL "QUERY" ( GET$(P$(4) )&GET$(P$(5) ) ,R,Z,Z$ ) 305 ON R GOTO 310,320,375

310 D0$=Z$

315 ! Get the manufacturer.

320 Z$=GET$(T0$(I+1)) 0 GOSUB 510 @ CALL "QUERY" ( GET$(P$(4) )&GET$(P$( 1) ),R,Z,T

9$ ) 325 ON R GOTO 330,340,375

330 SLET T0$(I+1) = T9$

335 ! Get the model #.

340 Z$=GET$(T0$(I + 2)) (3 GOSUB 510 @ CALL "QUERY" ( GET$( P$( 4) )&GET$ (P$( 2) ) ,R ,Z ,T

9$ ) 345 ON R GOTO 350,360,375

350 SLET T0$(I+2) = T9$

64
355 ! Get the serial #.

360 Z$=GET$(T0$(I+3)) (3 GOSUB 510 (a CALL "QUERY" ( GET$(P$(4) )&GET$(P$(3) ) ,R,Z,T

9$ ) 365 ON R GOTO 370,215,375

370 SLET T0$(I+3) = T9$ (3 GOTO 215

375 M0=1 0 SUBEXIT

380 M0=0 (a SUBEXIT

385 ! 390 ! Print the header.

395 ! 400 IF Nl THEN I 1$=CHR$(0)&" " @ I2$=" " ELSE Il$=" " @ I 2$=CHR$(0)&" " 405 PRINT (a PRINT (9 PRINT

410 PRINT Sl$;" ";TIME$

415 PRINT GET$(P$(5))&D0$

420 PRINT @ PRINT C$[l,30] @ PRINT

425 IF GET$(T0$(1))=" " THEN 445

430 PRINT @ PRINT 1 1$ ;GET$ (T0$( 1 )

)

435 PRINT TAB(4);GET$(P$(2));GET$(T0$(2))

440 PRINT TAB(4);GET$(P$(3));GET$(T0${3))

445 IF GET$(T0$(4))=" " THEN 465

450 PRINT (a PRINT I2$;GET$(T0$(4)

)

455 PRINT TAB(4);GET$(P$(2));GET$(T0$(5))

460 PRINT TAB(4);GET$(P$(3));GET$(T0$(6))

465 PRINT 0 PRINT ? IF R1>0 THEN PRINT "RANGE";R1 ELSE SUBEND

470 V$="Voltage:"

475 I$="Current :" 480 IF R(R1,2)<0 THEN X$=I$ ELSE X$=V$

485 IF R(R1,3)<0 THEN Y$=I$ ELSE Y$=V$

490 PRINT USING 495 ; X$,ABS(R(R1 ,2) )

, Y$,ABS(R(R1 , 3) ) ,R(R1 ,4)

495 IMAGE "Reference ",8A,3D.2D/"Variable " ,8A,3D. 2D/"Frequency : " ,7X,5D

500 PRINT (a PRINT

5C5 SUBEND

510 CLEAR 0 ON ERROR GOTO 520

515 IF Z$[l,2]<>" " THEN DISP "No input implies ";Z$ @ DISP

520 OFF ERR'OR (3 RETURN

65
VAR OCCURS IN LINE

C $ 100 , 225 ,225 ,255

270 280 ,290 ,420

Sl$ 100 210 ,410

Rl 100 , 465 ,465 ,480

485 , 490 ,490 ,490

R (,) 100 , 480 ,485 ,490

490 , 490

NO 100 , 170

Nl 100 , 400

MO 100 , 375 ,380

T0$ 100 , 240 ,320 ,330

340 , 350 ,360 ,370

425 430 ,435 ,440

445 , 450 ,455 ,460

D0$ 100 , 205 ,210 ,230

300 . 310 ,415

P $ 135 140 ,145 ,150

155 ,160 ,165 ,230

240 ,300 ,300 ,320

320 ,340 ,340 ,360

360 ,415 ,435 ,440

455 ,460

z $ 135 ,255 ,260 ,270

280 ,280 ,290 ,300

300 ,310 ,320 ,340

360 ,515 ,515

I 175 ,180 ,215 ,225

240 ,255 ,320 ,330

340 ,350 ,360 ,370

K 235 ,240 ,240 ,240

R 245 ,245 ,260 ,265

280 ,285 ,300 ,305

320 - ,325 ,340 ,345

360 ,365

Z 260 ,280 ,300 ,320

340 ,360

T9$ 320 ,330 ,340 ,350

360 ,370

11$ 400 ,400 ,430

12$ 400 ,400 ,450

V $ 470 ,480 ,485

I $ 475 ,480 ,485

X $ 480 ,480 ,490

Y $ 485 ,485 ,490

test info from TOC (see main program xref)

present date

range no. (used when printing the header)

array of range parameters (see main program

xref)

tells program what to do (see lines 110-120)

set if printout should point to check meter

set if user requests an abort to main menu

test and check meter information (see main

program xref)

date of test

array of strings of menu options

user's input

offset into T0$() used to point to either

the test or the check meter information

loop control

information about user's request (see QUERY

xref)

dummy variable

user's input

space pads or points to test meter in printout

space pads or points to check meter in printout

contains "Voltage:"

contains "Current:"

reference channel units

variable channel units

66
100 SUB "INITAR" (A( )

, Bl ( ), B2( ) ,C ( , ) ,D ( , ) ,R( , )

, T0$

)

105 1 110 ! This program initializes all data arrays to zero. JUL 87

115 ! 120 OPTION BASE 1(3 CLEAR (a DISP "Program is being initialized."

125 FOR 1=1 TO 6 @ SLET TO$(I) = " " @ NEXT I 130 FOR 1 = 1 TO 100 (a B1(I)=0 (3 B2(I)=0 (3 NEXT I (3 FOR 1 = 1 TO 5 0 A(I)=0 (3 NEXT I

135 CALL "ZERO" ( "ranges" , 10,4, R( , ) ) @ CALL "ZERO" ( "test data "

, 100 , 8 , D ( , ) ) 140 CALL "ZERO" ( "check data" ,100,8, C( , ) ) @ SCRATCHSUB "ZERO"

145 BEEP 70,100 (3 BEEP 85,150

150 DISP "Initialization completed." (3 WAIT 1500 (3 SUBEND

VAR OCCURS IN LINE

A ( ) 100 ,130 test info array (see main program xref)

Bl( ) 100 ,130 no. of readings at each point of test meter

B2( ) 100 ,130 no. of readings at each point of check meter

c (,) 100 ,140 check meter data. (see main program xref)

D (,) 100 ,135 test meter data. (see main program xref)

R (,) 100 ,135 range parameters. (see main program xref)

T0$ 100 ,125 test and check meter info (see main program)

I 125 ,125 ,125 ,130 loop control

130 ,130 ,130 ,130

130 ,130

67
360 SUB "INV_F" (F,V1,V2,P)

361 ! 362 ! This program calculates the upper % points for the F 363 ! statistic F with degrees of freedom VI in the numerator

364 ! and V2 in the denominator.

365 X=1/(V1/V2*F+1) @ Y=l-X @ P1,P2=1 0 U1=V1 (? U2=V2

370 IF VI MOD 2#0 THEN 372 ELSE 375

372 IF V2 MOD 2=0 THEN 390 ELSE 400

375 IF V2 MOD 2=0 THEN 377 ELSE 380

377 IF V2>=V1 THEN 390

380 FOR 7=1 TO Vl/2-1 (a P1=P1* ( . 5/Z*Y*U2) (? P2=P2+P1 0 U2=U2+2 0 NEXT Z 385 P=X^ (V2*.5)*P2 @ GOTO 450

390 FOR Z=l TO V2/2-1 @ P1=P1* ( . 5/Z*X*Ul ) @ P2=P2+P1 (a Ul=Ul+2 0 NEXT Z 395 P=l-Y (V1*.5)*P2 0 GOTO 450

400 X2=ATN(SQR(F*V1/V2)) 0 X=SIN(X2) 0 Y=C0S(X2) 0 P2=Y 0 P1-=Y

405 IF V2=l THEN 420

410 FOR Z=2 TO V2-3 STEP 2 0 P1=P1*Y*Y*Z/ (Z+1 ) 0 P2=P2+P1 0 NEXT Z 415 P2=P2*X 0 X2=X2+P2

420 P2=l 0 Pl=l 0 IF Vl=l THEN 445

425 FOR Z=2 TO V2-1 STEP 2 0 P1=P1*Z/(Z-1 ) 0 NEXT Z 430 P1=P1*Y^V2*X 0 P3,P2=1 0 U2=V2+1

435 FOR Z=3 TO Vl-2 STEP 2 0 P3=P3*U2*X*X/Z 0 P2=P2+P3 0 U2=U2+2 0 NEXT Z 440 X2=X2-P2*P1

445 P=1-X2*2/PI

450 REM

455 ! PRINT P 460 SUBEND

68
VAR OCCURS IN LINE

F statistic

degrees of freedom in numerator

degrees of freedom in denominator

upper percentage points

435 ,440

Ul 365 ,390 ,390 ,390

U2 365 ,380 ,380 ,380

430 ,435 ,435 ,435

z 380 ,380 ,380 ,390

390 ,390 ,410 ,410

410 ,410 ,425 ,425

425 ,425 ,435 ,435

435

X2 400 ;400 ,400 ,415

415 ,440 ,440 ,445

P3 430 ,435 ,435 ,435

F 360 ,365 ,400

VI 360 ,365 ,365 ,370

377 ,380 ,395 ,400

420 ,435

V2 360 ,365 ,365 ,372

375 ,377 ,385 ,390

400 ,405 ,410 ,425

430 ,430

P 360 ,385 ,395 ,445

X 365 ,365 ,385 ,390

400 ,415 ,430 ,435

435

Y 365 ,380 ,395 ,400

400 ,400 ,410 ,410

430

PI 365 ,380 ,380 ,380

390 ,390 ,390 ,400

410 ,410 ,410 ,420

425 ,425 ,430 ,430

440

P2 365 ,380 ,380 ,385

390 ,390 ,395 ,400

410 ,410 ,415 ,415

415 ,420 ,430 ,435

69
100 SUB "INV_T" (F,T,P)

105 ! 110 ! This program calculates the Student's T statistic for P 115 ! % points with F degrees of freedom.

120 ! 125 ! from TECHNOMETRICS Vol.8, No. 2, May 1964, "Approximation

130 ! to the Cumulative t-Di stri buti on " by C.Y. Kramer.

135 ! 140 ! DISP USING "2A,4X,A,5X,A" ; "df","t",""

145 Cl=. 503226 0 Dl=-. 06082

150 C2=-. 044928 0 D2=. 585243

155 C3=. 112057 0 D3=-. 208977

160 04=1.94979 0 D4=. 025489

165 C5=-5. 917356 (3 D5=. 082228

170 C6=-7. 549051 (3 D6=-. 276747

175 07 = 11.311627 (3 D7 = . 080726

180 C8=-. 399205 @ D8=. 011192

185 C9=5. 48717

190 IF T<2 THEN 200

195 P=C1+C2/F+C3/F 2+C4/(F*T ^2)+C5/(F ^2*T '2)+C6/(F*T"3)+C7/(F^2*T' 3)+C8/T^ 4+C9/(

F*T®4)-.5 (9 GOTO 205

200 P=D1+D2*T+D3*T 7+D4*T 3+D5/F+D6*T/F+D7*T^2/F+D8*T/F' 2-.

205 P=ABS(P)*1.005

210 SUBEND

VAR OCCURS IN LINE

F 100 , 195 ,195 ,195

195 195 ,195 ,195

200 200 ,200 ,200

T 100 190 ,195 ,195

195 195 ,195 ,195

200 ,200 ,200 ,200

200 * ,200

P 100

205

,195 ,200 ,205

CI 145 ,195

Dl 145 ,200

C2 150 ,195

02 150 ,200

C3 155 ,195

03 155 ,200

C4 160 ,195

04 160 ,200

C5 165 ,195

05 165 ,200

C6 170 ,195

06 170 ,200

C7 175 ,195 ,195 ,195

07 175 ,200

C8 180 ,195

08 180 ,200

C9 185 ,195

degrees of freedom

Student's t statistic

percentage points

70
100 SUB "LOAD" (C$,A(),R(,),D(,),C(,),B1(),B2(),D0$,T0$)

105 ! 110 ! Have user select a test to load and then load it. AUG 87

115 ! 120 OPTION BASE 10 Q$=".CALDAT" 0 DIM L( 16) ,S$[30],T$[960]

125 1=0

130 ! 135 ! Allow user to search tests for specific info.

140 ! 145 CLEAR @ DISP "Enter a search specific or hit"

150 CALL "QUERY" ( " END LINE for the full tabl e

. " ,R ,D , S$ ) 155 ! 160 ! Load the TOC.

165 ! 170 ON ERROR GOTO 315 (9 ASSIGN# 1 TO "CONTENTS"&Q$ 0 OFF ERROR

175 READ# 1 ; N,L(),T$@ IF N=0 THEN 320

180 ! 185 ! Search for a specific, if requested.

190 ! 195 ON R GOTO 200,260,335

200 IF I=N THEN P=0 @ GOTO 210

205 1=1*60+1 0 P=POS(T$[I],S$)

210 IF NOT P THEN DISP @ DISP "Specific not found." @ WAIT 2000 @ GOTO 125

215 P=P+I-1 0 I=INT((P+59)/60)

220 CLEAR @ DISP "You are about to LOAD:" 0 DISP 0 L=I*60-59

225 DISP USING 230 ; T$[L ,L+29],T$[L+30,L+39],T$[L+50,L+59], I ,T$[L+40,L+49]

230 IMAGE X,30A / X,11A, "Folder # ",10A / X,"0 TEST-" ,D , 3X, "Seri al # ",10A

235 DISP 0 DISP "Is this correct?" 0 CALL "YESNO" ( R ) 240 ON R GOTO 280,200,145

245 ! 250 ! Allow user to select a test from the full table.

255 ! 260 CALL "SELECT" ( I,N,L(),T$ ) 0 SCRATCHSUB "SELECT" 0 IF NOT I THEN 335

265 ! 270 ! Load the chosen test.

275 ! 280 CRT OFF 0 ASSIGN# 1 TO "TEST-"&VAL$( L

( I ) )&Q$

285 READ# 1 ; A( ) ,R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,D0$

290 FOR P=l TO 6 0 READ# 1 ; Z$0 SLET TO$(P) = Z$ 0 NEXT P 295 C$=T$[I*60-59,I*60] 0 CLEAR 0 CRT ON 0 SUBEXIT

300 ! 305 ! Display problem messages.

310 ! 315 DISP "Can't find data disk." 0 GOTO 325

320 DISP "There are no tests on the data disk."

325 CRT ON 0 WAIT 2000

330 ! 335 SUBEND

71
VAR OCCURS I^1 LINE

C $ 100 ,295 test info from TOC (see main program xref)

A ( ) 100 ,285 test info array (see main program xref)

R (.) 100 ,285 range parameters (see main program xref)

D (,) 100 ,285 test meter data, (see main program xref)

c (,) 100 ,285 check meter data, (see main program xref)

Bl( ) 100 ,285 - no. of readings at each point of test meter

B2( ) 100 ,285 no. of readings at each point of check meter

D0$ 100 ,285 date of test

T0$ 100 ,290 test and check meter info (see main program)

Q $ 120 ,170 ,280 contains "CALDAT" -- saves some memory

L 0 120 ,175 , 260 ,280 file name numbers, (see STORE xref)

S $ 120 ,150 ,205 string for which to search in TOC

T $ 120 ,175 ,205 ,225 table of contents (TOC) file, (see STORE)

225 ,225 ,225 ,260

295

I 125 ,200 ,205 ,205 no. of test in T$ under consideration, also

205 ,215 ,215 ,220 is a loop control

225 ,260 ,260 ,280

295 ,295

R 150 ,195 ,235 ,240 information about user's reply

D 150 dummy variable

N 175 ,175 ,200 ,260 no. of elements (tests) in TOC

P 200 ,205 ,210 ,215 position of search specific in T$. also is

215 ,215 , 290 , 290 a loop control

290

L

O O A 220 o o c

, 225 o o c, 225 o o c ,225 position of beginning of test information for

225 ,225 ,225 ,225 the test under consideration

225

z $ 290 ,290 intermediate string used to transfer meter

info
100 SUB "MENU" (R,A$,P)

105 ! 110 ! This program has the user select an option from among a 115 ! list of options. JUL 87

120 ! 125 DIM L$[10]

130 ! 135 ! Show the menu.

140 ! 145 ALPHA 1 (9 CLEAR @ P=0 @ K0=0

150 FOR 1=1 TO R 155 DISP USING "10X,15A" ; GET$(A$(I))

160 NEXT I 165 ! 170 ! Act on key.

175 ! 180 ON KYBD K0,CHR$(32)&CHR$(143)&CHR$(154)&CHR$(161)&CHR$(162) GOTO 195

185 GOTO 210

190 GOTO 190

195 IF K0=143 OR K0=154 THEN 200 ELSE GOTO 210

200 CLEAR @ IF P=0 THEN 145

205 SUBEXIT

210 IF K0=161 THEN P=(P+R-2) MOD R+1 ELSE P=P MOD R+1

215 OFF CURSOR @ ALPHA P,8 (3 AREAD L$ ON CURSOR

220 IF L$[4,5]=" " THEN 210

225 GOTO 190 @ SUBEND

VAR OCCURS IN LINE

R 100 ,150 ,210 ,210 no. of options in menu

A $

P

L $

KO

210

100 ,155

100 -, 145 ,200 ,210

210 ,210 ,210 ,215

125 ,215 ,220

145 ,180 ,195 ,195

210

150 ,155 ,160 menu option no. loop control

array of strings of menu options

cursor row and menu option no.

used to see if cursor isn't on an option

programmed key that the user presses

73
100 SUB "PDATA" (R( , ) ,D( , ) ,B1 ( ) ,A,B ,R1

)

105 ! 110 ! This program prints raw data to the internal printer.

115 ! 120 OPTION BASE 1 125 PRINT (a PRINT " (I) Y(I) YHAT RESIDUALS"

130 PRINT "DEGREES DEGREES DEGREES MILLIDEG"

135 PRINT

140 FOR I2=R(R1,1) TO R(R1+1,1)-1

145 FOR J2=2 TO B1(I2)+1

150 Y=B*D(I2,1)+A

155 PRINT USING 160 ; D( 1 2 , 1 )

, D( 1 2, J2) , Y , (D( 1 2 , J2) -Y-360* (D ( 1 2, J2) >359 AND D(I2,

J2)<361))*1000

160 IMAGE 3DZ.2D,4DZ.3D,4DZ.3D,M3DZ.D

165 NEXT J2 0 NEXT 12

170 PRINT 0 PRINT

175 SUBEND -

'

VAR OCCURS IN LINE

D (,)

100

100

155

100

100

100

100

140

155

165

145

155

150

140

150

155

145

150

150

140

145

155

,140

,155 ,155

,155

range parameters (see main program xref)

test or check meter data (see main program)

Bl( ) no. of readings at each point of test meter

a: (fitted y-intercept) ^ (fitted slope)

range no. data point no. loop control

A

BRl

12

,140

,150 ,155

,155 ,155

J2 155

165

155

,155 ,155 reading no. loop control

Y ,155 fitted angle

74
100 SUB "PGHEAD" (T0$) ! JUL 87

105 ! 110 ! This program prints the page heading to the Qume printer.

115 ! 120 OPTION BASE 1? T=13 @ CONTROL 10,3 ; 150 PRINTER IS 10,92

125 CLEAR (a CALL "QUERY" ( "Enter page number. " ,R,P,Z$ ) 130 ON R GOTO 135,125,155

135 FOR 1 = 1 TO 4 (a PRINT @ NEXT I 140 PRINT TAB(T) ;"Phase Meter " ;TAB( 35+T );"-"; P

; "-" 145 PRINT TAB(T);GET$(T0$(1));" Model " ;GET$(T0$(2)

)

150 PRINT TAB(T) ;"Serial No. " ;GET$(T0$(3) ) @ PRINT

155 SUBEND

VAR OCCURS IN LINE

T0$ 100 ,145 ,145 ,150 test and check meter info (see main program)

T 120 ,140 ,140 ,145 constant tab offset used to save memory

150

R

PZ $

125 ,130

125 .140

125

135 ,135

information about user's reply

page no. dummy string

loop control

75
100 SUB "PLOT" (C$,D(,),R(,),B(),R1,S1$,N1,T0$,D0$)

105 ! 110 ! This program graphs data for visual analysis. JUL 87

115 ! 120 OPTION BASE 1 125 DIM M2$[100]

130 SARRAY M2$

135 ! 140 ! Have user select method of graphing.

145 ! 150 ALPHA 1 @ CLEAR

155 C=0 @ M=5

160 SLET M2$(l) = "Plot Data"

165 SLET M2$(2) = "Print Plot"

170 SLET M2$(3) = "Overlay"

175 SLET M2$(5) = "Main Menu"

180 CALL "MENU" ( M,M2$,C ) 185 ON C GOTO 205,195,220,100,610

190 ! Print plot.

195 SFLAG 3 0 GOTO 210

200 ! Plot data on a new screen.

205 CFLAG 3

210 PEN 1 @ GCLEAR @ CFLAG 2 @ GOTO 240

215 ! Overlay.

220 SFLAG 2 225 ! 230 ! Prompt user for parameters for this graph.

235 ! 240 CLEAR (3 CALL "QUERY" ( "Enter range. ", R ,R1 , Z$ ) 245 IF RKl OR Rl>8 THEN 240

250 ON R GOTO 260,240,155

255 ! 260 C=0 0 M=2 0 CFLAG 44

265 SLET M2$(l) = "Avg. Data"

270 SLET M2'$(2) = "All Data"

275 CALL "MENU" ( M,M2$,C ) 280 ON C GOTO 295,285

285 SFLAG 44

290 ! 295 CALL "QUERY" ( "Enter representation symbol .", R , Z , S$ ) 300 R1=(R1-1) MOD 10+1

305 IF R(R1,2)=0 THEN 155

310 ! 315 CALL "QUERY" ( "Enter scale of correcti on. " ,R,C1 ,Z$ ) 320 ON R GOTO 340,315,155

325 ! 330 1 Set up the graphics display if this isn't an overlay.

335 I 340 IF FLAG(2) THEN 415

345 SCALE -10, 360, -CI , CI

350 XAXIS 0,10 0 YAXIS 0,.2*C1

355 FOR A=30 TO 360 STEP 30

360 MOVE A,.1*C1

365 LDIR 90 0 LABEL VAL$(A)

370 MOVE A, .05*01 0 IDRAW 0,-(.l*Cl)

76
375 NEXT A

380 FOR Y=-(.8*C1) TO .8*C1 STEP .2*C1

385 IF Y=0 OR Y=.2*C1 THEN 395

390 MOVE 20,Y-.05*C1 0 LDIR 0 (3 LABEL VAL$(Y)

395 NEXT Y 400 ! 405 ! Graph average readings.

410 ! 415 IF FLAG(44) THEN 460

420 FOR I=R(R1,1) TO R(R1+1,1)-1

425 X=D(I,1)-1.46 @ Y1=-(D(I,8)-D(I,1)+.013*C1)

430 MOVE X,Y1 (a LABEL S$ (3 ! PLOT CORRECTION

435 NEXT I 440 GOTO 485

445 ! 450 ! Graph every reading.

455 ! 460 FOR I=R(R1,1) TO R(R1+1,1)-1

465 FOR J=2 TO B(I)+1

470 X=D(I,1)-1.46 0 Y1=-(D(I,J)-D(I,1)+.013*C1)+360*(D(I,J)>359 AND D(I,J)<361)

475 MOVE X,Y1 (3 LABEL S$ @ ! PLOT CORRECTION

480 NEXT J @ NEXT I 485 ! 490 ! Wait for user to press <CONT>.

495 ! 500 PAUSE

505 ! 510 ! Allow user to see display as a line graph of averages.

515 ! 520 DISP "Connect the averages?" @ CALL "YESNO" ( R ) (3 ON R GOTO 525, 575. 155

525 Z=0

530 FOR I=R(R1,1) TO R(R1+1,1)-1

535 X=D(I,1) (3 Y1=-(D(I,8)-X)

540 IF Z=0 THEN MOVE X,Y1 ELSE DRAW X,Y1

545 Z=Z+1 • 550 NEXT I 555 PENUP

560 ! 565 ! Copy the graph to the printer if appropriate.

570 ! 575 IF FLAG(3) THEN 580 ELSE GOTO 595

580 CALL "HEADER" ( C$,S1$,R1 ,R( , )

, 3,N1 ,MO,TO$,DO$ ) 585 PRINT @ PRINT TAB(13) ;"CORRECTION" @ PRINT

590 GRAPH @ COPY

595 PAUSE

600 GOTO 155

605 ! 610 SUBEND

77
VAR OCCURS IN LINE

c $ 100 ,580

D (,) 100 ,425 ,425 ,425

470 ,470 470 470

470 535 535

R ( ) 100 , 305 ,420 , 420

460 ,460 ,530 ,530

580

100 ,465

Rl 100 , 240 ,245 ,245

300 ,300 ,305 ,420

420 ,460 ,460 , 530

530 ,580

$1$ 100 ,580

Nl 100 ,580

T0$ 100 ,580

DOS\j i\f 100 ,580

M2$ 125 ,130 ,160 ,165

170 ,175 ,180 ,265

270 ,275

c 155 ,180 ,185 ,260

275 ,280

M 155 ,180 ,260 ,275

R 240 ,250 ,295 ,315

320 ,520 ,520

Z $ 240 ,315

z 295 , 525 ,540 ,545

545

S' $ 295 ,430 ,475

CI 315 ,345 ,345 ,350

360 ,370 ,370 , 380

380 ,380 ,385 390

425 ,470

A 355 ,360 ,365 ,370

375

Y 380 ,*385 ,385 ,390

390 ,395

I 420 ,425 ,425 ,425

435 ,460 ,465 ,470

470 ,470 ,470 ,470

480 ,530 ,535 ,535

550

X 425 ,430 ,470 ,475

535 ,535 ,540 ,540

Yl 425 ,430 ,470 ,475

535 ,540 ,540

J 465 ,470 ,470 ,470

480

MO 580

test info from TOC (see main program xref)

test or check meter data (see main program

xref )

array of range parameters (see main program

xref)

readings/data point of test or check meter

range no.

present date

Nl is set to point to test meter in printout

test and check meter info (see main program)

test date

array of strings of menu options

no. of selected menu option

no. of options in menu

info about user's input

dummy string

used as dummy variable and as flag cleared to

start and set to continue drawing a line

contains symbol to represent data

scale of correction

phase angle loop control

angle offset loop control

data point no. loop control

phase angle x coordinate

offset y coordinate

reading no. loop control

dummy variable

78
100 SUB "QUERY" (Q$,R,N,I$) ! JUL 87

105 OPTION BASE 1(3 DIM T$[30]

110 LINPUT Q$,T$ (3 IF T$ = "" THEN R=2 0 SUBEXIT

115 IF T$[1,1]=CHR$(128) THEN R = 3 (3 SUBEXIT

120 ON ERROR GOTO 125 (3 N=VAL(T$)

125 OFF ERROR (3 R = l @ I$=T$ @ SUBEND

VAR OCCURS IN LINE

Q $ 100 ,110

R 100 ,110 ,115 ,125

N 100 ,120

I $ 100 ,125

T $ 105 ,110 ,110 ,115

120 ,125

contains question to ask user l=expected response; 2=no input; 3=main menu

value of user's input

inputted string (changed only if input exists)

actual input

79
100 SUB "RANGE" (R(,))

105 ! 110 ! This program display the list of ranges.

115 ! 120 OPTION BASE 1 125 DISP "RANGE R(,)" (a DISP

130 FOR A=l TO 8

135 DISP USING 140 ; A,R (A , 1 )

, R( A, 2) ,R ( A, 3) , R( A,4)

140 IMAGE 3D,2X,3D,2X,3D.D,2X,3D.D,2X,5D

145 NEXT A

150 DISP @ DISP "PRESS <CONT> TO CONTINUE"

155 PAUSE

160 SUBEND

VAR OCCURS IN LINE

R (,) 100 ,135 ,135 ,135

135

A 130 ,135 ,135 ,135

135 ,135 ,145

array of range parameters (see main

program xref)

range no. loop control

80
100 SUB "REG" (A,B) ! FEB 13-86

105 ! 110 ! Print estimated fit for angles at regular intervals. JUL 87

115 ! 120 OPTION BASE 1 125 ! 130 ! Prompt user for parameters.

135 ! 140 CLEAR @ CALL "QUERY" ( "Enter starting phase angle. " ,R,S9,Z$ ) 145 ON R GOTO 150,100,220

150 CALL "QUERY" ( "Enter ending phase angle." ,R,E9,Z$ ) 155 ON R GOTO 160,150,220

160 CALL "QUERY" ( "Enter size of i ncrement . " ,R , 1 9 ,Z$ ) 165 ON R GOTO 185,160,220

170 ! 175 ! Print the angles and their fits.

180 ! 185 PRINT 0 PRINT " OBSERVED CORRECTED"

190 PRINT " DEGREES DEGREES" @ PRINT

195 FOR Y=S9 TO E9 STEP 19

200 X=(Y-A)/3

205 PRINT USING "2(2X,M3DZ. 3D) " ; Y,X

210 NEXT Y 215 PRINT 0 PRINT

220 SUBEND

VAR OCCURS IN LINE

A 100 ,200 a (fitted y-intercept)

B 100 ,200 K (fitted slope)

R 140 ,145 ,150 ,155 information about user's reply

S9

Z $

E9

19

YX

160 ,165

140 ^195 starting phase angle

dummy string

ending phase angle

angle increment

fitted reading

meter reading

140 ,150 ,160

150 ,195

160 ,195

195 ,200 ,205 ,210

200 ,205

81
Calibration Report Program

This program displays the main menu and dispatches control

to the various report printing routines. AUG 87

100

105

110

115

120

125 OPTION BASE 10 INTEGER Bl (100) ,B2( 100)

130 COM R(10,4),C(100,8),D(100,8),A(5),T0$[100]

135 DIM C$[60],M4$[140],M5$[26],Z(1),N$[20]

140 ! 145 ! Display the main menu.

150 ! 155 SARRAY M4$,M5$,T0$ (3 L=0

160 SLET M4$(l) = "Read File"

165 SLET M4$(3) = "Page Header"

170 SLET M4$(4) = "Introduction"

175 SLET M4$(5) = "Fitted Data"

180 SLET M4$(6) = "Average Data"

185 SLET M4$(7) = "Raw Data"

190 SLET M4$(8) = "Appendix"

195 SLET M4$(9) = "Test Folder"

200 SLET M4$(ll) = "Range List"

205 C=0 (a M=ll (3 CALL "MENU" ( M,M4$,C ) 210 ON C GOTO 230,100,330,350,370,395,420,445,480,100,510

215 ! 220 ! Load a test.

225 ! 230 CALL "LOAD" ( C$ , A( ) , R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,D0$ ,T0$ ) (3 SCRATCHSUB "LOAD"

235 ! N$=folder # without the trailing blanks.

240 FOR 1=60 TO 51 STEP -1 (a IF C$[I,I]<>" " THEN 255

245 NEXT I

(a 1 = 51

250 ! Get the folder # if it isn't already known.

255 N$=C$[51,I] @ IF N$[l,l]<>" " THEN 290

260 CLEAR (a CALL "QUERY" ( "Enter test folder number. " ,R,Z,N$ ) 265 ON R GOTO 290,260,160

270 ! Get date if it is in wrong format.

275 CLEAR (a DISP "Old date ";D0$;" is in" @ DISP " wrong format."

280 DISP (a CALL "QUERY" ( "Enter date (MM/DD/YYYY) . " ,R,Z,DO$ ) 285 OFF ERROR (a ON R GOTO 290,275,160

290 ON ERROR GOTO 275 (a Z=VAL(DO$) (a OFF ERROR

295 C$[31,40]=D0$ @ C$[51,60]=N$

300 ! Save changes.

305 CALL "STORE" ( C$,A( ) ,R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,DO$,TO$ ) 310 SCRATCHSUB "STORE" (a GOTO 160

315 ! 320 ! Print the page header.

325 ! 330 GOSUB 530 @ GOTO 160

335 ! 340 I Print the report introduction.

345 ! 350 CALL "RPTINTRO" ( D0$,T0$,N$ ) @ SCRATCHSUB "RPTINTRO" (a GOTO 160

355 ! 360 ! Print a list of fitted data for angles of regular intervals.

365 ! 370 GOSUB 530 (a GOSUB 550 @ GOSUB 560

375 CALL "RPTFIT" ( R( , ) ,S( ) ,R1 ,A,B,L ) @ SCRATCHSUB "RPTFIT" @ GOTO 480

82
380 ! 385 ! Print the list of average readings for each test point.

390 ! 395 GOSUB 530 (a CALL "RPTAVG" ( R( , ) ,D( , ) ,M( ) ,R5,R1 ,L ) 400 SCRATCHSUB "RPTAVG" @ GOTO 480

405 ! 410 ! Print the list of all test meter readings that were taken.

415 ! 420 GOSUB 530 (3 CALL "RPTRAW" ( R( , ) ,D( , ) ,B1( ) ,R1 ,L ) 425 SCRATCHSUB "RPTRAW" @ GOTO 480

430 ! 435 ! Print the statistical info of this calibration (appendix).

440 ! 445 GOSUB 530 @ GOSUB 550 (a GOSUB 560

450 CALL "RPTAPP" ( R( , ) ,S( ) ,N,K,A,B,X, Y,S,S1 ,S2,T1 ,T2,F1 ,R1 ,L ) 455 SCRATCHSUB "RPTAPP"

460 ! 465 ! Print the folder # at the bottom of the page.

470 ! 475 ! L=# of lines printed by last program CALL.

480 IF L>54 THEN 490

485 FOR I=L TO 54 @ PRINT @ NEXT I 490 PRINT (3 PRINT TAB(13) ;"722/" ;N$;"-" ;D0$[LEN(D0$)-1] 0 GOTO 160

495 ! 500 ! Display the list of ranges.

505 ! 510 CALL "RANGE" ( R(,) ) 0 SCRATCHSUB "RANGE" (3 GOTO 160

515 ! 520 ! Routine to print the page header.

525 ! 530 L=6 (a CALL "PGHEAD" ( T0$ ) @ SCRATCHSUB "PGHEAD" @ RETURN

535 ! 540 ! Routine to fit the data and estimate the goodnes of the fit.

545 ! 550 CALL "E-NTER" ( R( , ) ,D( , ) ,B1 ( ) ,S( ),N,K,A,B,X,Y,S,S1 ,S2,T1,T2,F1 ,R1 ) 555 SCRATCHSUB "ENTER" @ RETURN

560 CALL "STAT" ( S( ), N,K,A,B , X, Y, S ,S1 ,S2 J ,T1 , T2,F , Fl ,0 ) 565 SCRATCHSUB "STAT" @ RETURN

83
VAR OCCURS IN LINE

Bl() 125

550

,230 ,305 ,420

B2() 125 ,230 ,305

R (,) 130 ,230 ,305 ,375

395

550

,420 ,450 ,510

c (,) 130 ,230 ,305

D (,) 130 ,230 ,305 ,395

420 ,550

A ( ) 130 ,230 ,305

T0$ 130

350

,155

,530

,230 ,305

C $ 135 ,230 ,240 ,255

295 ,295 ,305

M4$ 135 ,155 ,160 ,165

170 ,175 ,180 ,185

190 ,195 ,200 ,205

M5$ 135 ,155

z 0 135

N $ 135 ,255 ,255 ,260

295 ,350 ,490

L 155 ,375 ,395 ,420

450 ,480 ,485 ,530

C 205 ,205 ,210

M 205 ,205

D0$ 230 ,275 ,280 ,290

295 ,305 ,350 ,490

490

I 240 ,240 ,240 ,245

245 ,255 ,485 ,485

R 260 ,265 ,280 ,285

Z 260 ,280 ,290

s 0 375 ,450 ,550 ,560

Rl 375

550

,395 ,420 ,450

A 375 ,450 ,550 ,560

B 375 ,450 ,550 ,560

M 0 395

R5 395

N 450 ,550 ,560

K 450 ,550 ,560

X 450 ,550 ,560

Y 450 ,550 ,560

s 450 ,550 ,560

SI 450 ,550 ,560

S2 450 ,550 ,560

Tl 450 ,550 ,560

T2 450 ,550 ,560

Fl 450 ,550 ,560

T 560

F 560

no. of readings at each point of test meter

no. of readings at each point of check meter

array of range parameters (see main program

xref

)

check meter data, (see main program xref)

test meter data, (see main program xref)

test info array (see main program xref)

test and check meter info array (see main

program xref)

test info from TOC (see main program xref)

array of strings of menu options

unused

unused

contains folder no.

no. of lines printed on page so far

selected menu option

no. of menu options in menu

test date

loop control

information about user's reply

dummy variable

intermediate sums (see ENTER xref)

range no.

a" (fitted y-intercept)

(fitted slope)

dummy array

dummy variable

nk (see ENTER xref)

k (no. of data points in range)

average ideal reading

average actual reading

standard deviation

SC^)

s(^)

tl

t2

F'Student's t upper 1% point of F distribution

84
100 SUB "RPTAPP" (R(,) ,S(),N,K,A,B,X,Y,S,S1,S2,T1,T2,F1,R1,L)

105 ! 110 ! This program prints the statistical info of the, cal i brati on

115 ! which forms the appendix in the test report. JUL 87

120 ! 125 OPTION BASE 1? CONTROL 10,3 ; 150 PRINTER IS 10,92 (3 T = 13 ? DIM T$[79]

130 ! 135 ! Print the title and the first two paragraphs.

140 ! 145 PRINT TAB(47);CHR$(27);"IAppendix";CHR$(27);"J" (3 PRINT

150 FOR 1 = 1 TO 12 (9 READ T$(3 PRINT TAB(T);T$ (3 NEXT I 155 DATA " The calibration of this phase meter provides an equation to corre

ct the"

160 DATA "reading obtained from the phase meter so that the result of the measur

ement

165 DATA "will be close in agreement with the corresponding value supplied by th

e NBS"

170 DATA "standard. These corrections are calculated from the unprocessed calib

rati on"

175 DATA "data obtained during the test, which are shown on separate pages."," "

180 DATA " Because random fluctuations tend to mask the limiting mean of the

phase"

185 DATA "meter response at any particular test point, the corrections calculate

d are"

190 DATA "based on predicted values. These values are obtained by fitting the"

195 DATA "unprocessed data (y) for each set of current, voltage, and frequency"

200 DATA "conditions to an equation which models the average response of the pha

se meter"

205 DATA "to phase angles (x) supplied by the NBS standard."

210 ! 215 ! Print the parameters of this range and the statistics.

220 ! 225 CALL "RPTRNG" ( R(,),R1 ) @ SCRATCHSUB "RPTRNG"

230 Sl$=" @ S2$=" +" (3 IF A<0 THEN Sl$="-"

235 IF B<0 THEN S2$=" -" 240 D$="(degrees)" @ PRINT USING 285 ; S1$,ABS(A) ,S2$,ABS(B) ,D$ 0 PRINT USING 29

0 ' SI S2 D$

245 CALL "INV_T" ( N-2,T1,A1 ) 0 CALL "INV_T" ( N-2,T2,A2 ) 0 SCRATCHSUB "INV_T"

250 PRINT USING 295 ; CHR$(27)&"D3"&CHR$(27)&"U" ,ABS(A1*2) ,ABS(A2*2) 0 PRINT

255 PRINT USING 300 ; S,S*2,D$ 0 PRINT USING 305 ; Fl 0 CALL "INV_F" ( F1,K-2,NK, A2 ) 260 SCRATCHSUB "1NV_F" 0 PRINT USING 310 ; CHR$(27)&"D4"&CHR$(27)&"U" ,A2 0 PRINT

265 PRINT TAB(T) ;"Estimated limits of phase offset from NBS standard:" 0 PRINT

270 Sl$="+" 0 IF X<Y THEN Sl$="-"

275 PRINT USING 315 ; S(8),D$ 0 PRINT USING 320 ; S1$,ABS(X-Y) ,S(9) ,D$

280 PRINT USING 325 ; S(10),D$ 0 PRINT

285 IMAGE 12X, "Predi cted val ue" , 9X, "y ' = ",A,DZ.6D,3A,2DZ.6D," x",12X,9A

290 IMAGE 12X, "Standard errors ", 15X, "(", Z. 6D, " ) ( "

, Z. 6D, "

) "

, 13X , 9A

295 IMAGE 12X, "Si gni f i cance 1 evel s" , 5A,10X, "

( " ,Z. 3D, "

) " ,6X, "

( " ,Z. 3D, "

)

300 IMAGE 12X, "Residual standard devi ati on" ,8X, "s =",DZ.6D," 2s =" ,DZ.5D,4X,9A

85
305 IMAGE 12X,"Lacl<-of-fit",24X,"F'=",DZ.3D

310 IMAGE 12X, "Significance 1 evel " , 5A, 19X, "

( " ,Z. 3D, "

)

315 IMAGE 17X, "without correcti ons" ,8X, " (x ' = y)",12X,3DZ.3D,6X,9A

320 IMAGE 17X,"with a constant correction (x' =y ",A,DZ.3D,")",4X,3DZ.3D,6X,9A

325 IMAGE 17X, "using the fitted linear equation (see above) ",3DZ.3D,6X,9A

330 ! 335 ! Print the footnotes.

340 ! 345 PRINT TAB(T);CHR$(27);"I";TAB(36);CHR$(27);"J" @ PRINT

350 PRINT CHR$(27) ;"C12" ;CHR$(27) ;"D3";CHR$(27) ;"U";

355 FOR 1 = 1 TO 6 (3 READ T$(3 PRINT CHR$(27) ;"C17" ;T$ (3 NEXT I 360 DATA "Significance levels are derived using the statistical t-tests to decid

e"

365 DATA "if the intercept and slope of the fitted straight line are different f rom"

370 DATA "their ideal values, zero and one respectively. A level near zero (les

s"

375 DATA "than or equal to 0.05) shows that the associated parameter is probably

II380 DATA "different from the ideal value."," " 385 PRINT CHR$(27);"C12";CHR$(27);"D4";CHR$(27);"U";

390 FOR 1 = 1 TO 8 (3 READ T$@ PRINT CHR$(27) ;"C17" ;T$ (3 NEXT I 395 DATA "The significance level of F' is associated with an objective statistic

al"

400 DATA "test for the adequacy of a linear model relating the user's phase mete

r"

405 DATA "response and the NBS assigned values. Significance levels near zero ( less"

410 DATA "than or equal to 0.01) indicate that the assumption of a straight line

as a"

415 DATA "model for the phase meter response may be incorrect. However, if the"

420 DATA "variability of the repeat readings is of the same order as the resolut

ion"

425 DATA "of the meter, and the data points are therefore not normally distribut

ed,"

430 DATA "the table of values on which this test is based are not applicable."

435 ! 440 L=55 @ SUBEND

86
VAR OCCURS I^ 1 T M C LINE

R (.)

inn lUU

s ( ) 100 O "7 C

, 2/b O "7 fT , 275 O O A, 280

N 100 , 245 , 245 o f" r~ ,255

K 100 o c c ,255

AA 100 o 0 n

, 240

B 100 O 0 c

, Jb , ^40

X 100 o 7 n O "7 C

, 2/5

Y 100 O "7 C ,Z/b

S 100 , 2bb ,255

SI 100 o /I n

, 240

S2 100 o /I n 11 100 O /I c T O 12 100 O /I c

r 1 100 o c c

, dbb o c c, ^ibb

Rl 100 o o c

L 100 /I /I n 1 IOC 1

1 c n

, 1 bU 0£r c

, 2Db O /I c, J4b

1 $

IOC

, IbO 1 c r\ , 1 bO o c c

, ibb

o c c o n n

, jyo , 390

TI ICO IbO 1 c n

, 1 bO o c c, obb o c c, ibb

o nn jyo 0 o n

, oyo

51$ o 0 n COU o on o /I n, i:40 o "7 n ,2/0

CIKJ O 7 C C O tf* 52$ O0f\ o o c

, dob , 240

D $

o /I n

, 240 o c c

, 2bb

275 ,275 , coU

Al 245 ,250

A2 245 ,250 ,255 ,260

range parameters (see main program xref)

intermediate sums (see ENTER xref)

nk (see ENTER xref)

k (no. of data points in range) ^

(fitted y-intercept)

b (fitted slope)

average ideal reading

average actual reading

standard deviation

s(S)

ti

t2

F'

range no.

no. of lines printed by this program

constant tab offset used to save memory

text read from data statements

loop control

contains sign of on lines 230-240 and sign

of uncorrected offset

contains sign of b

contains "(degrees)" — saves memory

% points for statistic tl

% points for statistic t2

87
100 SUB "RPTAVG" (R( , ) ,D( , ) ,M( ) ,R5,R1 ,L ) ! July 1987

105 ! 110 ! This program prints the average readings for each test

115 ! point. JUL 87

120 ! 125 OPTION BASE 1 130 ! 135 ! This function rounds X to the thousandths place.

140 ! 145 DEF FNP(X) = SGN( X) *ABS( I NT( X*1000+. 5) /lOOO)

150 ! 155 ! Prompt user for range.

160 ! 165 CLEAR (a CALL "QUERY" ( "Enter range. " ,R,R1 ,Z$ ) 170 ON R GOTO 175,165,280

175 IF R(R1,2)=0 THEN DISP "Data not present for range ";R1 ELSE GOTO 200

180 DISP (3 DISP "Press <C0NT> to continue." (? PAUSE @ GOTO 280

185 ! 190 ! Print the range parameters and the table column labels.

195 ! 200 PRINT @ PRINT (3 CALL "RPTRNG" ( R(,),R1 ) 0 SCRATCHSUB "RPTRNG" ? PRINT

205 PRINT TAB(13) ;"Phase Angle of NBS" ;TAB(42) ; "Average Readi ng" ;TAB(69) ;"Correc

tion"

210 PRINT TAB(18) ;"Standard";TAB(42);"of Phase Meter* [Add to Phase Meter Rea

dings]"

215 PRINT TAB(18) ;"(Degrees)";TAB(45);"(Degrees)";TAB(70) ;"(Degrees)"

220 ! 225 ! Print the list of average readings.

230 ! 235 PRINT (a N=21 0 FOR X=R(R1,1) TO R(R1 + 1,1)-1

240 PRINT USING 245 ; D( X , 1 ) ,D( X ,8) ,FNP (D( X, 1 ) )-FNP (D( X,8)

)

245 IMAGE 12X, 6X, 2DZ. 3D, 20X, 2DZ . 3D, 1 7X, 2DZ. 3D

250 N = N+1 (a NEXT X 255 ! 260 ! Print the footnote.

265 ! 270 FOR I=N TO 54 @ PRINT @ NEXT I 275 PRINT TAB(13);"* Average of four readings." (3 L = 52

280 SUBEND

VAR OCCURS IN LINE

R (.) 100 ,175 ,200 ,235 array of range parameters (see main program

235 xref

)

D (.) 100 ,240 ,240 ,240 any meter data. (see main program xref)

240

M ( ) 100 unused

R5 100 unused

Rl 100 ,165 ,175 ,175 range no. 200 ,235 ,235

L 100 ,275 no. of lines printed by this program

R 165 ,170 information about user's reply

Z $' 165 dummy string

N 235 ,250 ,250 ,270 no. of lines printed by end of table

X 235 ,240 ,240 ,240 data point no. loop control

240 ,250

I 270 ,270 loop control

88
100 SUB "RPTFIT" (R( , )

, S{ ) ,R1 . A,B ,L

)

105 ! 110 ! This program prints a list of fitted angles for angles

115 ! read on the meter. JUL 87

120 ! 125 OPTION BASE 1 130 ! 135 ! Query user for necessity of fit.

140 ! 145 CLEAR (3 DISP "Limits to Offset:" @ DISP (3 DISP USING 150 ; S(8) , S(9 ) , S( 1 0) 0

DISP

150 IMAGE " no correcti on" ,8DZ. 30/ " constant correction", 2DZ. 30/ " full corr ection" ,6DZ.3D

155 DISP "Is correction needed?" @ CALL "YESNO" ( R ) @ ON R GOTO 175,445,455

160 ! 165 ! Prompt user for info about this list.

170 ! 175 CALL "QUERY" { "Enter starting phase angl e.

" ,R ,A1 ,Z$ ) 180 ON R GOTO 190,175,455

185 ! 190 CALL "QUERY" ( "Enter ending phase angl e.

" ,R,A2,Z$ ) 195 ON R GOTO 205,190,455

200 ! 205 CALL "QUERY" ( "Enter angle i ncrement . " ,R , 1 1 ,Z$ ) 210 ON R GOTO 220,205,455

215 ! 220 CALL "QUERY" ( "Enter decimals of accuracy ." ,R,D,Z$ ) 225 ON R GOTO 230,220,455

230 IF D<1 OR D>3 THEN 220

235 ! 240 ! Print the fit equation, the range, and the table header.

245 ! 250 Sl$=" " (3 S2$=" +" @ IF -(A/B)<0 THEN Sl$="-"

255 IF B<0 THEN S2$=" -" 260 GOSUB C75 (3 PRINT USING 265 ; S1$,ABS(A/B) ,S2$,ABS(1/B) (3 PRINT (3 PRINT (3 PR

INT

265 IMAGE 12X, "Corrected Phase Angle:* x'= ",A,DZ.6D,2A,DZ.6D," y"

270 PRINT TAB(28) ;"Table of Corrected Phase Angles (x'j in Degrees" ;CHR$(27) ;"D*

";CHR$(27) ;"U"

275 FOR 1 = 1 TO 4 (3 PRINT (3 NEXT I @ PRINT USING 280

280 IMAGE 21 X, "OBSERVED", 7X, "CORRECTED", 12X, "OBSERVED", 7X, "CORRECTED"

285 T$="PHASE ANGLE" @ PRINT TAB(21 ) ;T$;TAB(36) ;T$;TAB(57) ;T$;TAB(72) ;T$

290 T$="(Degrees)" (3 PRINT TAB(22) ;T$;TAB(37) ;T$;TAB(58) ;T$;TAB(73) ;T$ (3 PRINT @

PRINT

295 ! 300 ! Print the table. Dl=span of degrees for half of table,

305 ! used to print table in two columns.

310 ! 315 L = 31 (3 Dl = INT((A2-Al)/Il/2+l)*Il @ FOR I=A1 TO Al+Dl-Il STEP II 320 L=L+1 (3 Y1 = 1/B*I-A/B (3 IF I+D1>A2 THEN 365

325 Y2=1/B*(I+D1)-A/B

330 ON D GOTO 335,345,355

335 PRINT USING 340 ; I,Y1,I+D1,Y2 (3 GOTO 400

340 IMAGE 25DZ.D,11DZ.2D,18DZ.D,11DZ.2D

345 PRINT USING 350 ; I,Y1,I+D1,Y2 0 GOTO 400

350 IMAGE 24DZ.2D,11DZ.3D,16DZ.2D,11DZ.3D

89
355 PRINT USING 360 ; I,Y1,I+D1,Y2 (3 GOTO 400

360 IMAGE 24DZ.3D,10DZ.3D,16DZ.3D,10DZ.3D

365 ON D GOTO 370,380,390

370 PRINT USING 375 ; I,Y1 (a GOTO 400

375 IMAGE 25DZ.D , 1 IDZ. 2D

380 PRINT USING 385 ; I,Y1 @ GOTO 400

385 IMAGE 24DZ. 2D, IIDZ. 3D

390 PRINT USING 395 ; I,Y1 (a GOTO 400

395 IMAGE 24DZ. 3D, lODZ. 3D

400 NEXT I 405 ! 410 ! Print the footnote.

415 ! 420 PRINT @ PRINT 0 PRINT TAB(24);"* Calculated values based on linear model (se

e appendix)"

425 GOTO 455

430 ! 435 ! Print notice that fit is unnecessary.

440 ! 445 GOSUB 475 (9 PRINT TAB(13);"No correction is needed to bring the observed pha

se angle"

450 PRINT " reading into" @ PRINT TAB( 13) -."agreement with the NBS standard." @ L = 16

455 SUBEND

460 ! 465 ! Routine to print range parameters.

470 ! 475 PRINT (a PRINT 0 CALL "RPTRNG" ( R(,),R1 ) @ SCRATCHSUB "RPTRNG"

480 PRINT @ RETURN

90
VAR OCCURS IN LINE

R {.) 100 , 475 range parameters (see main program xref)

s ( ) 100 , 145 ,145 ,145 intermediate suras (see ENTER xref)

Rl 100 , 475 range no. A 100 , 250 ,260 ,320 a (fitted y-intercept)

325

B 100 , 250 ,255 ,260 b (fitted slope)

260 , 320 ,320 ,325

325

L 100 , 315 ,320 ,320 no. of lines printed by this program

450

R 155 , 155 ,175 ,180 information about user's reply

190 , 195 ,205 ,210

220 , 225

Al 175 , 315 ,315 ,315 starting phase angle

z $ 175 , 190 ,205 ,220 dummy string

A2 190 , 315 ,320 ending phase angle

11 205 , 315 ,315 ,315 angle increment

315

D 220 , 230 ,230 ,330 decimals of accuracy

365

Sl$ 250 ,250 ,260 contains sign of y-intercept

S2$ 250 ,255 ,260 contains sign of slope

I 275 ,275 ,315 ,320 multi-purpose loop control

320 ,325 ,335 ,335

345 ,345 ,355 ,355

370 ,380 ,390 ,400

T $ 285 ,285 ,285 ,285 constant text — used to save memory

285 ,290 ,290 ,290

290 ,290

Dl 315 ,315 ,320 ,325 span of degrees for half of the table

335 ,345 ,355

Yl 320 ,335 ,345 ,355 left column corrected angle

370 ,380 ,390

Y2 325 • ,335 ,345 ,355 right column corrected angle
100 SUB "RPTRAW" (R( , ) ,D( , ) ,B1 ( ) ,R1 ,L

)

105 ! 110 ! This program prints a table of all the readings in a 115 ! given range. JUL 87

120 ! 125 OPTION BASE 1 130 ! 135 ! Prompt user for info about this table.

140 ! 145 CLEAR 0 CALL "QUERY" ( "Enter range. " ,R ,R1 ,Z$ ) 150 ON R GOTO 160,145,390

155 ! 160 CALL "QUERY" ( "Enter decimals of accuracy ." ,R,D,Z$ ) 165 ON R GOTO 170,160,390

170 IF D<1 OR D>3 THEN 160

175 ! 180 ! Print title, range parameters, and table header.

185 ! 190 PRINT 0 PRINT g PRINT TAB ( 1 3)

; "Unprocessed Calibration Data for Range:"

195 CALL "RPTRNG" { R(,),R1 ) 0 PRINT (a PRINT (a PRINT

200 PRINT TAB(19);"NBS STANDARD METER UNDER TEST NBS STANDARD METER UND

ER TEST"

205 T$="(degrees)" @ PRINT TAB(20) ;T$;TAB(37) ;T$;TAB(57) ;T$;TAB(74) ;T$ (3 PRINT

210 ! 215 ! Initialize the pointers needed to print the table,

220 ! 225 ! N=total # of readings.

230 N=0 (3 FOR 1 = 1 TO R(R1 + 1,1)-1 @ N=N+B1(I) 0 NEXT I 235 ! Kl ,K2=present left, right column test point #; J1,J2=

240 ! present reading in test point of left, right column;

245 ! L=# of rows in table.

250 ! Point K1,K2,J1,J2 to beginning of the requested range.

255 Kl=l 0 K2=l 0 J1=0 0 J2=0 0 L=INT (N/2+. 5) 0 FOR 1=1 TO L 260 J2=J2+1 0 IF J2>B1(K2) THEN K2=K2+1 0 J2=l

265 NEXT I 270 ! 3,v»a*:iUv (ffflylon

275 ! Print the table.

280 ! 285 FOR 1=1 TO L 290 J1=J1+1 0 IF J1>B1(K1) THEN K1=K1+1 0 Jl=l

295 J2=J2+1 0 IF J2>B1(K2) THEN K2=K2+1 0 J2=l

300 IF I=L AND N/2<>INT(N/2) THEN 340

305 ON D GOTO 310,320,330

310 PRINT USING 315 ; D( Kl , 1 ) ,D(K1 , Jl ) ,D (K2, 1 ) ,D(K2, J2) 0 GOTO 375

315 IMAGE 22DZ.3D,13DZ.D,16DZ.3D,13DZ.D

320 PRINT USING 325 ; D(K1 , 1 ) ,D(K1 ,J1 ) ,D(K2, 1 ) ,D(K2,J2) 0 GOTO 375

325 IMAGE 22DZ.3D,12DZ.2D,16DZ.3D,12DZ.2D

330 PRINT USING 335 ; D(K1 , 1 ) ,D(K1 ,J1 ) ,D(K2,1 ) ,D(K2, J2) 0 GOTO 375

335 IMAGE 22DZ. 3D , 12DZ. 3D , 15DZ. 3D , 12DZ. 3D

340 ON D GOTO 345,355,365

345 PRINT USING 350 ; D(K1 , 1 )

, D( Kl , J 1

) 0 GOTO 375

350 IMAGE 22DZ.3D,13DZ.D

92
355 PRINT USING 360 ; D(K1 , 1 ) ,D (Kl , Jl ) @ GOTO 375

360 IMAGE 22DZ.3D,12DZ.2D

365 PRINT USING 370 ; D( Kl , 1 )

, D (Kl , J 1

) (3 GOTO 375

370 IMAGE 22DZ.3D,12DZ.3D

375 NEXT I 380 ! 385 L=L+19

390 SUBEND

VAR OCCURS IN LINE

R (.) 100 ,195 ,230

D (.) 100 ,310 ,310 ,310

310 ,320 ,320 ,320

320 ,330 ,330 ,330

330 ,345 ,345 ,355

355 ,365 ,365

Bl( ) 100 ,230 ,260 ,290

295

Rl 100 ,145 ,195 ,230

L 100 ,255 ,255 ,285

300 ,385 ,385

R 145 ,150 ,160 ,165

z $ 145 ,160

D 160 ,170 ,170 ,305

340

T $ 205 ,205 ,205 ,205

205

N 230 , 230 , 230 ,255

300 ,300

I 230 , 230 , 230 255

265 ,285 , 300 375

Kl 255 ,290 , 290 . 290

310 ,310 , 320 , 320

330 ,330 , 345 , 345

355 ,355 , 365 , 365

K2 255 ,260 , 260 , 260

295 ,295 , 295 , 310

310 ,320 , 320 , 330

330

Jl 255 ,290 , 290 , 290

290 ,310 , 320 , 330

345 ,355 , 365

J2 255 ,260 , 260 , 260

260 ,295 , 295 , 295

295 ,310 , 320 , 330

range parameters (see main program xref)

test or check meter data. (see main

program xref)

no. of readings at each point of test or check meter

range no.

no. of lines printed by this program

information about user's reply

dummy string

decimals of accuracy

constant text used to save memory

total no. of readings

loop control

left column test point no.

right column test point no,

left column reading no.

right column reading no,

93
100 SUB "RPTRNG" (R(,),R1)

105 OPTION BASE 1 110 Tl$ = " Voltage: " @ T2$=" Current: " (a T3$=T1$

115 Ul$=" V" (3 U2$=" A" (3 U3$=U1$

120 IF R(R1,2)<0 THEN T1$=T2$ (P U1$=U2$

125 IF R(R1,3)>0 THEN T2$=T3$ (9 U2$=U3$

130 T3$="Frequency :" (a U3$=" Hz" (a F=R(R1,4) @ IF F> = 1000 THEN F=F/1000 0 U3$="

kHz"

135 F1=F @ 1=1

140 IF F1<>INT(F1) THEN 1 = 1 + 1 @ F1 = F1*10 (3 GOTO 140

145 PRINT (3 PRINT USING 150 ; T1$,ABS(R(R1 ,2) ) ,U1$ @ PRINT USING 155 ; T2$,ABS(R

(R1,3)),U2$

150 IMAGE 12X, "Reference SignarM0A,12DZ.2D,2A

155 IMAGE 12X, "Variable Phase Signal", 10A,7DZ. 2D, 2A

160 ON I GOTO 165,175,185,195

165 PRINT USING 170 ; T3$,F,U3$ @ GOTO 205

170 IMAGE 12X,10A,29X,3D,4A

175 PRINT USING 180 ; T3$,F,U3$ (3 GOTO 205

180 IMAGE 12X,10A,26X,3DZ.D,4A

185 PRINT USING 190 ; T3$,F,U3$ @ GOTO 205

190 IMAGE 12X,10A,25X,3DZ.2D,4A

195 PRINT USING 200 ; T3$,F,U3$

200 IMAGE 12X,10A,24X,3DZ.3D,4A

205 PRINT 0 SUBEND

VAR OCCURS IN LINE

R (.) 100 ,120 , 125 ,130

145 ,145

Rl 100 ,120 ,125 ,130

145 ,145

Tl$ 110 ^110 ,120 ,145

T2$ 110 ,120 ,125 ,145

T3$ 110 ,125 ,130 ,145

145 ,165 ,165 ,175

175 ,185 ,185 ,195

195

Ul$ 115 ,115 ,120 ,145

U2$ 115 ,120 ,125 ,145

U3$ 115 ,125 ,130 ,130

165 ,175 ,185 ,195

F 130 ,130 ,130 ,130

135 ,165 ,175 ,185

195

Fl 135 ,140 ,140 ,140

140

I 135 ,140 ,140 ,160

array of range parameters (see main program

xref ) range no.

reference signal units

variable signal units

multi-purpose string. on lines 110-125 it

contains " Voltage: ". from line 130 it

contains "Frequency:"

abbreviated reference signal units

abbreviated variable signal units

abbreviated units for units of T3$

frequency

used to determine digits in frequency after

the decimal

no. of digits after decimal +1

94
100 SUB "SEL" (A,B)

105 ! 110 ! This program prints the fitted angles for selected test

115 ! meter angles. JUL 87

120 ! 125 OPTION BASE 1 130 ! 135 ! Print the table header.

140 ! 145 PRINT 0 PRINT " OBSERVED CORRECTED"

150 PRINT " DEGREES DEGREES" @ PRINT

155 ! 160 ! Loop to get angle from user and find its fitted value.

165 ! 170 CLEAR @ DISP "ENTER PHASE ANGLE"

175 DISP (3 DISP (3 DISP "Press <1<1> to quit."

180 CALL "QUERY" ( "",R,Y,Z$ ) 185 ON R GOTO 190,170,205

190 X=(Y-A)/B

195 PRINT USING "2(2X,M3DZ.3D) " ; Y,X

200 GOTO 170

205 PRINT (3 PRINT

210 SUBEND

VAR OCCURS IN LINE

A 100 ,190

B 100 ,190

R 180 ,185

Y 180 ,190 ,195

Z $ 180

X 190 ,195

(fitted y-intercept) ^ (fitted slope)

information about user's reply

observed degrees

dummy string

corrected degrees

95
100 SUB "SELECT" (I,N,L(),T$)

105 ! 110 ! This program has the user select a test from the TOC.

115 ! AUG 87

120 ! 125 OPTION BASE 1 130 ! 135 ! Clear all 4 screens.

140 ! 145 FOR 1 = 1 TO 49 STEP 16 0 OFF CURSOR @ ALPHA I (3 CLEAR (3 NEXT I @ ALPHA 1 @ CR

T OFF

150 ! 155 ! Show table of contents (TOC).

160 ! 165 FOR P=l TO N*60-59 STEP 60

170 DISP USING 175 ; T$[P , P+29]J$[P+30, P+39], T$[P+50, P+59], VAL$(L ( I NT (P/60) + l )

)

,T$[P+40,P+49]

175 IMAGE X,30A / X, 1 lA , "Fol der # ",10A /

" @ TEST-" ,4A, "Seri al # ",10A //

180 NEXT P 185 ! 190 ! Wait for user to press a key.

195 ! 200 1 = 1 (3 K$=CHR$(128)&CHR$(154)&CHR$(161)&CHR$(162)&CHR$(32)

205 OFF CURSOR @ ALPHA 1*4-3

210 ON CURSOR (3 CRT ON (3 ON KYBD K,K$ GOTO 220

215 GOTO 215

220 ON POS(K$,CHR$(K)) GOTO 310,330,240,270,270

225 ! 230 ! <Cursor up> moves cursor to previous test.

235 ! 240 1=1-1

245 IF Kl THEN I=N 0 GOTO 285

250 IF FP(I/4) THEN 205 ELSE 285

255 ! 260 ! <Curs£)r down> and <Space bar> move cursor to next test.

265 ! 270 1=1+1

275 IF I->N THEN 1 = 1 280 IF FP((I-l)/4) THEN 205

285 Q=INT((I-1)/4)*16 @ OFF CURSOR (3 CRT OFF @ ALPHA ABS(49-Q) @ ALPHA Q+1 @ GOT

0 205

290 GOTO 205

295 ! 300 ! <kl> aborts selection.

305 ! 310 1=0

315 ! 320 ! END LINE selects a test.

325 ! 330 SUBEND

96
VAR OCCURS IN LINE

I 100 , 145 ,145 ,145

200 ,205 ,240 ,240

245 ,245 ,250 ,270

270 ,275 ,275 ,280

285 ,310

N 100 ,165 ,245 ,275

100 ,170

T $ 100 ,170 ,170 ,170

170

p 165 ,170 ,170 ,170

170 ,170 ,170 ,170

170 ,170 ,180

K $ 200 ,210 ,220

K 210 ,220

Q 285 ,285 ,285

multi-purpose variable, used as a loop

control and as the no. of the element of

T$ to which the cursor points

no. of elements (tests) in TOC

file name numbers, (see STORE xref)

table of contents (TOC) file, contains an array of elements in format of C$

points to beginning of a test in TOC T$

string of programmed keys

programmed key that the user presses

no. of logical lines before top of screen

97
100 SUB "STAT" (S(),N,K,A,B,X,Y,S,S1,S2,T,T1,T2,F,F1,0)

105

"STAT" determines the applicability of the linear model,

determines the significance of differences between fitted

and standard intercepts and slopes, determines the limit

to the offset for each level of correction, and prints the

values of various variables used in the calculations if

requested, last modified 7-07-87, 11:28.

INPUT: S( )=i ntermedi ate sums, N=nk, K=k , A=a-hat, B=b-hat,

X=av. ideal reading, Y=av. actual reading, S=s , Sl=S(a-hat),

S2=S(b-hat), Tl=tl, T2=t2, F1=F', O=printout flag (1 is print);

OUTPUT: T=Student's t, F=upper 1% point of F distribution

110

115

120

125

130

135

140

145

150

155

160

165

170 OPTION BASE 1 175 SCRATCHSUB "ENTER"

180 DIM X(4),A$[2]

185 X(1),X(2)=0 @ X(3),X(4)=360

190 Q,I=1

195 ! 200 ! determine applicability of linear model

205 ! 210 CALL "F_TABL" ( .01,K-2,N-K,F ) (3 IF NOT 0 THEN 240

215 PRINT "Linear model is ";@ IF F1>=F THEN PRINT "not "; 220 PRINT "applicable." @ PRINT

225 ! 230 ! calculate Student 's T 235 ! 240 DEF FNZ(Al) = 4.932*( (1-A1)©.14-A1®. 14)

245 Al = .025 @ Nl = N-2 ! ,nl<-2

250 T=SQR(N1*EXP(FNZ(A1) '2*(N1-1.5)/(N1-1) 2)-Nl)*.991 + .00006*Nl @ IF NOT 0 THEN

310

255 ! 260 ! determine significance of differences between fitted and

265 ! standard intercepts and slopes

270 ! 275 PRINT "Intercept is";@ IF T1<=T THEN PRINT " not";

280 GOSUB 590 @ PRINT "zero." @ PRINT

285 PRINT "Slope is";0 IF T2<=T THEN PRINT " not";

290 GOSUB 590 @ PRINT "one." (9 PRINT

295 ! 300 ! function to calculate R(xt)

305 ! 310 DEF FNR

315 IF Q=l THEN X1=X ELSE X1=Y

320 FNR=S*SQR(2*F2*(1/N+(X(I)-X1) "2/S(5)))

325 FN END

330 ! 335 ! function to calculate maximum L(xt) and U(xt)

340 ! 345 DEF FNL(A2)

350 L9=0

355 FOR 1=1 TO 4

360 L=A+A2+(B-l)*X(I)+(-l) T*FNR

365 L9=MAX(L9,ABS(L)) (9 NEXT I 370 FNL=L9

375 FN END

98
380 ! 385 ! calculate limit to offset at each level

390 ! 395 CALL "F_TABL" ( .05,2,N-2,F2 ) 0 SCRATCHSUB "F_TABL"

400 ! no correction

405 L1=FNL(0)

410 ! constant correction

415 L2=FNL(X-Y)

420 ! full correction

425 Q,L3=0

430 FOR 1=1 TO 4

435 L = FNR/B (3 L3=MAX(L3,ABS(L )

440 NEXT I 445 ! 450 S(8)=L1 @ S(9)=L2 (P S(10)=L3 @ IF NOT 0 THEN SUBEND

455 ! 460 ! function to round to lOOOths place accuracy

465 ! 470 DEF FND(X) = SGN(X)*INT(ABS(X*1000)+. 5)/1000

475 ! 480 ! print values of various variables

485 ! 490 IF B<0-THEN A$="-" ELSE A$=" + " (a

! A$=sign of slope

495 PRINT USING 500 ; A,A$,ABS(B)

500 IMAGE "Predicted'7"y=",MZ.6D,2X,A,2X,Z.6D," x"/

505 PRINT USING 510 ; N,N/K,K,X,Y,T

510 IMAGE "N=",3D/"n=",3D.3D/"k=",3D/"X=",4D.3D/"Y=",4D.3D/"t[.025,nk-2]=",2D.4D

//

515 CALL "INV_T" ( N-2J1,A1 ) @ A$="a =

" 520 PRINT USING 525 ; A$,A,A$,S1 ,A$,T1 ,A$,ABS(2*A1

)

525 IMAGE 2A ,MDZ. 6D/"s " , 2A ,DZ . 6D/"t "

, 2A,DZ. 30/" "

, 2A ,DZ. 3D//

530 CALL "INV_T" ( N-2,T2,A2 ) 0 A$="b="

535 PRINT USING 525 ; A$,B,A$,S2,A$,T2,A$,ABS(2*A2)

540 PRINT USING 545 ; S,F1,SQR(S(7)-S(6) ) ,SQR(S(6) ) ,F

545 IMAGE "^=" ,MDZ.6D/"F1=" ,MDZ. 3D/"[SL]=" ,MDZ. 30/ "[SE]=" ,MDZ. 30/ "F[. 01 (k-2 , k

(

n-l))]=",MDZ.3D

550 CALL "INV_F" ( Fl ,K-2,N-K,A2 ) (9 PRINT USING 555 ; A2 0 SCRATCHSUB "INV_F"

555 IMAGE "Level of si gni f i cance" ,MZ. 3D

560 PRINT USING 565 ; "Ll=" , L 1

, "L2=" , L 2, "L 3=" ,L

565 IMAGE 3(3A,MZ.3D/)

570 SUBEND

575 1 580 ! this subroutine saves memory, and this line makes up for it

585 ! 590 "PRINT " significantly" 0 PRINT " different from ";@ RETURN

99
VAR OCCURS IN LINE

s ( ) 100 ,320 ,450 ,450 intermediate sums (see ENTER xref)

450 ,540 ,540 ,540

N 100 ,210 , 245 ,320 nk (see ENTER xref)

395 ,505 ,505 ,515

530 , 550

K 100 ,210 ,210 , 505 k (no. of test points in range)

505 ,550 ,550

A 100 , 360 ,49b con

ci (fitted y-intercept)

B 100 , 360 , 435 , 490 ^ (fitted slope)

495 ,535

X 100 ,315 ,415 , 505 ideal readings, average of

Y 100 ,315 Air" ,415 , 505 average of actual readings

S 100 ,320 ,540 standard deviation

SI 100 ,520

S2 100 ,535 s(^)

T 100 ,250 ,275

o r\ r" ,285 students t statistic

505

Tl 100 ,275 ,515 , 520 tl

T2 100 ,285 ,530 ,535 t2

F 100 ,210 ,215 , 540 F statistic that determines model applicabili

Fl 100 ,215 ,540 ,550 F' 0 100 ,210 ,250 ,450 set to print results to internal printer

X 0 180 ,185 ,185 , 185 array of lower and upper limit degrees

185 ,320 ,360

A $ 180 ,490 ,490 ,495 multi-purpose string.

515 ,520 , 520 ,520

520 ,530 ,535 ,535

535 ,535

Q 190 ,315 ,425 set when finding R(xt) for avg. ideal reading

I 190 ,320 ,355 ,360 index into X() and loop control

360 ,365 ,430 ,440

Al 245 .,250 ,515 ,520 percentage points for tl

Nl 245 *,250 ,250 ,250 degrees of freedom nk-2

250 ,250

XI 315 ,315 ,320 average of ideal or actual reading

F2 320 ,395 F statistic for limit to offsets

L9 350 ,365 ,365 ,370 greatest offset

L 360 ,365 ,435 ,435 offset for limit X(I)

LI zinc; ,560 offset for no correction

415 ,450 offset for constant correction

L3 425 ,435 ,435 ,450 offset for full correction

560

A2 530 ,535 ,550 ,550 percentage points for t2

100
100 SUB "STORE" (C$,A( ) ,R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,DO$,TO$)

105 ! 110 ! This program saves data and updates the table of contents (TOC). AUG 87

115 ! 120 OPTION BASE 1(9 DIM L (16) ,T$[960]

125 C$[31,40]=D0$ @ C$[41,50]=GET$(T0${3)) (3 Ql$=" .CALDAT" @ Q2$="C0NTENTS"&Q1$

130 ! 135 ! Verify that info should be saved.

140 ! 145 CLEAR (3 DISP "You are about to SAVE data for" (3 DISP

150 DISP USING 155 ; C$[l , 30] , D0$ ,C$[51 ] ,C$[41 , 50] @ DISP

155 IMAGE X,30A / X , 1 1 A , "Fol der # ",10A / X,"(a ?" ,8X, "Seri al # ",10A

160 DISP "Is this correct?" (3 CALL "YESNO" ( R ) @ ON R GOTO 180,460,460

165 ! 170 ! Retrieve TOC. If there is no TOC then make one.

175 ! 180 ON ERROR GOTO 315 (3 ASSIGN# 1 TO Q2$ @ OFF ERROR 0 READ# 1 ; N,L(),T$

185 ! 190 ! Overwrite test if it already exists.

195 ! 200 P=P0S(T$,C$[1,50]) (3 I = INT(P/60) + l (3 IF NOT P THEN 230

205 CLEAR @ DISP "This test is already on disk. Do you want to overwrite it"?"

210 CALL "YESNO" ( R ) @ ON R GOTO 430,460,460

215 ! 220 ! Allow user to overwrite an existing test.

225 ! 230 CLEAR @ DISP "Do you want to overwrite an existing test?"

235 CALL "YESNO" ( R )

(3 ON R GOTO 240,295,460

240 CLEAR (3 DISP "You are about to select the test you want to overwrite..."

245 DISP (3 OFF CURSOR

250 WAIT 2000 @ CALL "SELECT" ( I,N,L(),T$ ) (3 IF NOT I THEN 230

255 P=I*60-59 @ CLEAR @ DISP "You are about to OVERWRITE" @ DISP

260 DISP USING 265 ; T$[P,P+29],T$[P+30,P+39],T$[P+50,P+59], I ,T$[P+40,P+49]

265 IMAGE X,30A / X , 1 lA, "Fol der # ",10A / X,"0 TEST-" ,D, 3X, "Seri al # ",10A

270 DISP (3 DISP "Is this correct?" (3 CALL "YESNO" ( R ) 275 ON R GOTO 430,230,460

280 ! 285 ! See if there is room in TOC for new test.

290 ! 295 IF N<16 THEN 375 ELSE CLEAR @ DISP "The data disk is full." (3 GOTO 320

300 ! 305 ! Initialize disk and TOC with user's permission.

310 ! 315 OFF ERROR (3 CLEAR (3 DISP "You don't have an initialized data disk in eithe

r drive."

320 DISP (3 DISP "Do you want to initialize the disk in drive 1 (right drive)?"

325 CALL "YESNO" ( R )

(3 ON R GOTO 330,460,460

330 DISP @ DISP "All information now on the disk in drive 1 will be lost. Are

you sure?"

335 CALL "YESNO" ( R )

(3 ON R GOTO 340,460,460

340 CLEAR 0 DISP "Initializing. Please wait."

345 INITIALIZE Ql$[2], " :D701"

350 FOR 1 = 1 TO 16 (3 L(I)=0 (3 NEXT I @ T$[960] = "

" 355 CREATE Q2$,5,256 0 ASSIGN# 1 TO Q2$ (3 N=0

101
360 ! 365 ! Make room for test in alphabetical index.

370 ! 375 FOR P=l TO 841 STEP 60 (3 IF C$[l , 50]<T$[P, P+49] OR T$[P,P+3]=" " THEN 385

380 NEXT P 385 FOR J=841 TO P STEP -60 (a I = I NT (J/60) + 1 P L(I + 1)=L(I)

390 T$[J+60,J+119]=T$[J] @ NEXT J 395 ! 400 ! Create a file for the test data.

405 ! 410 N=N+1 0 L(1)=N @ CREATE "TEST-"&VAL$(N)&Q1$,65, 256

415 ! 420 ! Update TOC and test file.

425 ! 430 CRT OFF @ T$[P, P+59]=C$ (3 ASSIGN# 1 TO Q2$ 0 PR1NT# 1 ; N,L(),T$

435 ASSIGNS 1 TO "TEST-"&VAL$(L (

I ) )&Q1$

440 PRINT# 1 ; A( ) ,R( , ) ,D( , ) ,C( , ) ,B1 ( ) ,B2( ) ,D0$

445 FOR 1 = 1 TO 6 @ Q$=GET$(TO$( I

)

) (3 PRINT# 1 ; Q$ @ NEXT I 450 ASSIGNS 1 TO * (3 CLEAR @ CRT ON

455 ! 460 SUBEND

102
VAK OCCURS IN 1 T M C r t c $ lUU 1 OK I db 1 oc

, 1 bU

1 c n 1 c n

, I bU onn , dUU 0 7 1; , J / b 4 jU

A ( j 1 UU /I /I n 44U

R ( . j i UU , /I /I n 44U

D ( ,

)

i UU , 44U

1 nn i UU J /I /in 44U

D 1 / \ Dl ( j

1 nn I UU J /144U4 n DO/ \

I )

1 nn I UU ]/I /I n 44U

D0$ 1 nn i UU 3 1 0 c; i ^1 b

1 c n

, I bU A A n, 44U

T A d*

1 u$ 1 nn 1 UU , 1 0 c; 1 d b

/I /I c

, 44b

1 on i (CU J 1 on i oU o c n

, ^bU "3 c n

, obU

T Q C Job 3

"3 Q C Job , 41

/ton

, 4oU

/I "5 C T $

1 on 1 <iU , 1 on i oU onn o c n

C(^n cDU Ofin ocn ocn

T c^n JDU , J / b , o / b oon , oyu

4oU /I Qn

, 4 JU

n 1 <t 1 ^ J

1 OR "3/1 R

, j4b /1 1 n

, 4 i U

/I "5 1; Q2$ IOC ion , ioU 3 C C

, jbb 0 c c

, obb

/I Tn 4 jU

nK 1 DU , i DU o 1 n o 1 n

O "3 C 0 T c

, ^ Jb o 7 n Old

0 9 C "3 0 c 0 "3 C

, 0 ob 0 o c, J jb

M 1 on loU ocn

, iibU one 0 c c; , Jbb

/1 1 n 41/1 1 n

, 4 i U , 41L) /1 1 n, 41U

/I Tn 4oU

n

V onn ^lUU onn , (lUU onn , dUU 0 1; c;

, coo

o^^n

, cDU o c n oc n

o<cn o(;n

, ilDU oc n

, dOU oc n, COU

"3 7 C "3 7 C

, 0 / b

0 7 1; , 0 / b0 7 C

, o/b

"3 7 C j/b . Ton , ooU o o c

, J8b /ion, 4iU

/I T n 4oU

TI onn dUU ocn , ^ibU o c n o c c

, dbb

o(;n dbU Ten , obU 0 c n

, obU 0 c n

, JbU

"3 Q C Job "3 Q C

, oob 0 o c, oob /1 1 n, 41 U

•t O J 445 A A C

, 44b /I /I c ,44b

1u 385 ,385

390 ,390

Q $ 445 ,445

test info from TOC (see main program xref)

test information (see main program xref)

range parameters (see main program xref)

test meter data, (see main program xref)

check meter data (see main program xref)

no. of readings at each point of test meter

no. of readings at each point of check meter

date of test

test and check meter info (see main program)

array of file name numbers, subscript

corresponds to the alphabetical element no.

table of contents (TOC) file, contains an array of elements in format of C$

contains ".CALDAT" and is used to save memory

contains "CONTENTS. CALDAT" and is used to save memory

information about user's reply

no. of tests in the TOC

position of test in TOC T$

index no. of test

loop control

intermediate string for copying T0$() to disk

103
100 SUB "TALK" (A,D$,Q)

105

This program is the software interface between the HP and

the standard. JUL 87

INPUT: A=bus address, D$=key sequence, Q=no. of queries;

OUTPUT: D$=last ENTERed info, Q=-l if successful.

ON INTR tells HP where to go when standard has data to send

and program isn't in the process of ENTERing it.

110

115

120

125

130

135

140

145

150

155 ON INTR 7 GOTO 280 @ DIM I$[20]

160 ! 165 ! Have HP SUBEXIT if 5 seconds elapse before the standard

170 ! completes a handshake (i.e. acknowledges data it said it

175 ! could acknowledge).

180 ! 185 SET TIMEOUT 7;5000 @ ON TIMEOUT 7 GOTO 335 (3 I$="ERROR"

190 ! 195 ! Send request. WAIT 1500 is needed because interrupt must

200 ! be requested before it's enabled. (HP quirk?)

205 ! 210 OUTPUT A USING "K" ; D$ @ RESET 7 @ WAIT 1500

215 ! 220 ! Head of loop that shows all queried info.

225 ! 230 Q=Q-1 0 IF Q=-l THEN ON ERROR GOTO 335 @ D$=I$ (3 GOTO 335

235 ! 240 ! Wait for standard to interrupt. If a minute passes without

245 ! interrupt then abort wait and warn user.

250 ! 255 ON TIMER# 1,60000 GOTO 310 (3 ENABLE INTR 7;8

260 GOTO 260

265 ! 270 ! Get data if no problems.

275 ! 280 OFF- TIMER# 1 (3 IF SP0LL(A)=117 THEN ABORTIO 7 @ RESET 7 (3 GOTO 280

285 IF SP0LL(A)>90 THEN DISP "Bus Error. ";0 GOTO 320

290 ENTER A USING "#%K" ; I$(3 DISP 1$ (3 GOTO 230

295 ! 300 ! Warn user about DC offset or lengthy auto-zero.

305 ! 310 OFF TIMER# 1 (3 DISP (3 DISP "Phase standard malfunction." (3 DISP

315 BEEP 70,100 (3 BEEP 100,150 0 BEEP 70,150

320 DISP "Press <CONT> when ready." @ PAUSE

325 CLEAR 7 @ RESET 7 330 ! 335 OFF ERROR (3 ABORTIO 7 @ SUBEXIT

104
VAR OCCURS IN LINE

A 100 ,210 ,280 ,285 address of phase standard

290

D $ 100 ,210 ,230 instruction string for standard

Q 100 ,230 ,230 ,230 no. of queries to ENTER

1 $ 155 ,185 ,230 ,290 string ENTERed from standard

290

105
100 SUB "YESNO" (R)

105 ! 110 ! This program has the user select 'yes' or 'no' by acting

115 ! on keys Y and N. JUL 87

120 ! 125 OPTION BASE 10 OFF CURSOR (3 ON KYBD K, "YyNn"SCHR$( 128) GOTO 135

130 GOTO 130

135 OFF KYBD

140 R=P0S("YN"&CHR$(128)&"yn",CHR$(K)) 0 IF R>3 THEN R=R-3

145 ON R GOTO 150,155,165

150 OISP "Yes." @ GOTO 160

155 DISP "No."

160 OFF CURSOR 0 WAIT 1500

165 ON CURSOR

170 SUBEND

VAR OCCURS IN LINE

R 100 ,140 ,140 ,140 user's reply. l=yes; 2=no; 3=abort and

140 ,145 to the main menu

K 125 ,140 programmed key that the user enters

106
100 SUB "ZERO" (Z$,I1,J1,A(,))

105 ! 110 ! This program zeros A(l to II, 1 to Jl). JUL 87

115 ! 120 OPTION BASE 1@ DISP " zeroing ";Z$

125 FOR 1 = 1 TO II (3 IF NOT (I MOD 10) THEN BEEP 20,2

130 FOR J = l TO Jl-3 STEP 4 (? A( I , J )

, A( I , J + 1 ) , A( I , J + 2) , A( I , J + 3) -0 (3 NEXT J 135 NEXT I (3 SUBEND

VAR OCCURS IN LINE

Z $ 100 ,120 text name of array being zeroed

II 100 ,125 size of 1st dimension of array A(,)

Jl 100 ,130 size of 2nd dimension of array A(,)

A (,) 100 ,130 ,130 ,130 array to clear to zeros

130

I 125 ,125 ,130 ,130 1st dimension loop control

130 ,130 ,135

J 130 ,130 ,130 ,130 2nd dimension loop control

130 ,130

107
NBS-n4A (REV. 2-8C) U.S. DEPT. OF COMM.

BIBLIOGRAPHIC DATA

SHEET (See instructions)

1. PUBLICATION OR

REPORT NO.

NBS/SP-250/26

2. Performing Organ. Report No 3. Publication Date May 1988

4. TITLE AND SUBTITLE

NBS MEASUREMENT SERVICES:

NBS Phase Angle Calibration Services

5. AUTHOR(S)

R. S. Turgel, J. M. Mulrow and D. F. Vecchia

6. PERFORMING ORGANIZATION (If joint or other than NBS. see in struct/on s)

NATIONAL BUREAU OF STANDARDS

U.S. DEPARTMENT OF COMMERCE

GAITHERSBURG, MD 20899

7. Contract/Grant No.

8. Type of Report & Period Covered

Final

9. SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street. City, State, ZIP)

Same as item 6

.

10. SUPPLEMENTARY NOTES

Library of Congress Catalog Card Number 88-600501

I I Document describes a computer program; SF-185, FlPS Software Summary, is attached.

11. ABSTRACT (/A 200-word or less (actual summary of most si gnificant information. If document includes a si gnijicant

bibliography or literature survey, mention it here) T^lie National Bureau of Standards (NBS) offers a calibration service for audio-frequency phase meters. The calibrations are based on a phase angle standard developed at NBS that generates two sinusoidal signals, over a frequency range of 2 hertz to 50 kilohertz, displaced relative to one another by a precisely known phase angle. The signal amplitudes are independently adjustable on each channel from 0.5 volts to 100 volts. The angular resolution is better than 0.002° at the

low end of the frequency range and decreases to 0.005° at the high end. The uncertainty of the phase angle between the two signals generated by the standard varies from

0.005° to 0.04° depending on frequency and amplitude.

Using the phase angle standard, phase meter readings are obtained at selected test

points. From the calibration data, the phase meter response characteristic is determinec

and is compared to that of an ideal meter having a linear characteristic. If the phase

meter response conforms to the linear model, a straight-line calibration curve is derived from the data and serves to calculate corrected readings. From the statistical

parameters associated with the calibration curve, it is possible to estimate the limits

of offset between the calibrated meter and the calibration standard. By extension, the

uncertainty of readings of the phase meter in the user's laboratory can be estimated.

12. KEY WORDS (Six to twelve entries; alphabetical order; capitalize only proper names; and separate key words by semicolons)

calibration; calibration curve; linear model; phase meter; phase standard;

uncertainty

13. AVAILABILITY

g3 Unlimited

I I For Official Distribution. Do Not Release to NTIS

Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C.

20402.

Order From National Technical Information Service (NTIS). Springfield, VA. 22161

14. NO. OF

PRINTED PAGES

114

15. Price

USCOMM-DC 6043-P80
THE SP 250 SERIES ON NBS MEASUREMENT SERVICES*

SP 250-1 Spectral Radiance Calibrations SN003-003-02792-6 $3.50

SP 250-2 Far Ultraviolet Detector Standards SN003-003-0281(H) $4.25

SP 250-3 Radiometric Standards In the Vacuum

Ultraviolet SN003-003-02806-1 $6.50

SP 250-4 Fricke Dosimetry In Higli-Energy Electron Beams

SN003-003-02816-9 $2.75

SP 250-5 Alpha-Partlde Calibrations SN003-003-02823-1 $2.00

SP 250-6 Regular Spectral Transmittance SN003-003-02805-3 $3.25

SP 250-7 Radiance Temperature Calibrations SN003-003-02827-^ $2.25

SP 250-8 Spectral Reflectance SN003-003-02812-6 $7.00

SP 250-9 Calibration of Beta-Partide-Emitting

Opiithalmic Applicators

SN003-003-02817-7 $2.00

SP 250-10 Radioactivity Calibrations witfi the "A-k" Gamma Ionization Chamber, and Other

Radioactivity Calibration Capabilities

SN003-003-02824-0 $2.25

SP 250-1 1 Dosimetry for High-Dose Applications

SP 250-12 Neutron Personnel Dosimetry

SN003-003-O2811-8 $2.50

SP 250-13 Activation Foil Inadiation with Californium Rssion Sources

SP 250-14 Activation Foil Inadiation by Reactor Cavity

Rssion Sources SP 250-15 Photometric Calibrations SN003-003-02835-5 $4.25

SP 250-16 Calibration of X-Ray and Gamma-Ray

Measuring instruments

SP 250-17 The NBS Photodetector Spectral Response

Calibration Transfer Program

SP 250-18 Neutron Source Strength Calibrations

SP 250-19 Calibration of Gamma-Ray-Emitting

Brachytherapy Sources

SP 250-20 Spectral Irradlance Calibrations SN003-003-02829-1 $5.50

SP 250-21 Calibration of Beta-Partlde

Radiation Instrumentation

SP 250-22 Platinum Resistance Thermometer

Calibrations SN003-003-O2831-2 $17.00

SP 250-23 Liquid-in-Glass Thermometer

Calibration Service

SP 250-24 Standard Cell Calibrations SN003-003-02825-8 $2.75

SP 250-25 Calibration Sen/lce for Inductive Voltage Dividers

SP 250-26 Phase Angle Calibrations

SP 250-27 AC-DC Difference Calibrations

SP 250-28 Solid-state DC Voltage Standard Calibrations SN003-003-02842-8 $2.00

SP 250-29 Traceable Frequency Calibrations SN003-003-02844-4 $2.25

SP 250-30 GOES Satellite Time Code Dissemination:

Description and Operation

SN003-003-02845-2 $2.75

SP 250-31 Mass Calibrations at the National Bureau

of Standards SP 250-32 A Calibration Sen^ice for 30 MHz

Attenuation and Phase Shift SP 250-33 A Calibration Service for Voltage Transformers and High-Voltage Capacitors

* Those entries containing a stock numtier (003-003 ) and price can be purchased from the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402. GPO will accept checks, money orders, VISA, and Mastercharge. For more information, or to place an order, call (202)783-3238. Be sure to use the stock number In all orders. Titles without stock numbers are In preparation.
U.S. Department of Commerce

National Bureau of Standards

Gaithersburg, MD 20899

Official Business

Penalty for Private Use $300

Stimulating America s Progress 1913-1988