Section 7. Installation
248
Array Assigned Expression: Fill Array Dimension
'Example: Fill Array Dimension
Public
A(3)
Public
B(3,2)
Public
C(4,3,2)
Public
Da(3,2) = {1,1,1,1,1,1}
Public
Db(3,2)
Public
DMultiplier(3) = {10,100,1000}
Public
DOffset(3) = {1,2,3}
BeginProg
Scan
(1,Sec,0,0)
A() = 1
'set all elements of 1D array or first dimension to 1
B(1,1)() = 100
'set B(1,1) and B(1,2) to 100
B(-2,1)() = 200
'set B(2,1) and B(3,1) to 200
B(-2,2)() = 300
'set B(2,2) and B(3,2) to 300
C(1,-1,1)() = A()
'copy A(1), A(2), and A(3) into C(1,1,1), C(1,2,1), and C(1,3,1),
'respectively
C(2,-1,1)() = A() * 1.8 + 32
'scale and then copy A(1), A(2), and A(3) into C(2,1,1),
'C(2,2,1), and C(2,3,1), respectively
'scale the first column of Da by corresponding multiplier and offset
'copy the result into the first column of Db
'then set second column of Db to NAN
Db(-1,1)() = Da(-1,1)() * DMultiplier() + DOffset()
Db(-1,2)() = NAN
NextScan
EndProg
7.7.4 Data Output: Calculating Running Average
The
AvgRun()
instruction calculates a running average of a measurement or
calculated value. A running average (
Dest
) is the average of the last N values
where N is the number of values, as expressed in the running-average equation:
where X
N
is the most recent value of the source variable and X
N-1
is the previous
value (X
1
is the oldest value included in the average, i.e., N-1 values back from
the most recent). NANs are ignored in the processing of
AvgRun()
unless all
values in the population are NAN.
AvgRun()
uses high-precision math, so a 32-bit extension of the mantissa is saved
and used internally resulting in 56 bits of precision.
Summary of Contents for CR6 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 76: ...Section 5 Overview 76 FIGURE 20 Half Bridge Wiring Example Wind Vane Potentiometer ...
Page 80: ...Section 5 Overview 80 FIGURE 23 Pulse Input Wiring Example Anemometer ...
Page 136: ......
Page 454: ...Section 8 Operation 454 FIGURE 104 Narrow Sweep High Noise ...
Page 459: ...Section 8 Operation 459 FIGURE 106 Vibrating Wire Sensor Calibration Report ...
Page 535: ...Section 8 Operation 535 8 11 2 Data Display FIGURE 121 CR1000KD Displaying Data ...
Page 537: ...Section 8 Operation 537 FIGURE 123 CR1000KD Real Time Custom ...
Page 538: ...Section 8 Operation 538 8 11 2 3 Final Storage Data FIGURE 124 CR1000KD Final Storage Data ...
Page 539: ...Section 8 Operation 539 8 11 3 Run Stop Program FIGURE 125 CR1000KD Run Stop Program ...
Page 541: ...Section 8 Operation 541 FIGURE 127 CR1000KD File Edit ...
Page 546: ......
Page 552: ......
Page 610: ...Section 11 Glossary 610 FIGURE 137 Relationships of Accuracy Precision and Resolution ...
Page 612: ......
Page 648: ......
Page 650: ......
Page 688: ......
Page 689: ......