beautypg.com

Campbell Scientific CR9000X Measurement and Control System User Manual

Page 204

background image

Section 6. Data Table Declarations and Output Processing Instructions

Histogram4D ( BinSelect, DataType, DisableVar, Bins1, Bins2, Bins3,

Bins4, Form, WtVal, LowLim1, UpLim1, LowLim2, UpLim2, LowLim3,
UpLim3, LowLim4, UpLim4)

Processes input data as either a standard histogram (frequency distribution) or a
weighted value histogram of up to 4 dimensions. For a 2-D histogram, enter 1
for the Bins2 and Bins3 parameters. For a 3-D histogram, enter 1 for the Bins4
parameter.

The description of the Histogram instruction also applies to the Histogram4D
instruction. The difference is that the Histogram4D instruction allows up to
four bin select inputs (dimensions). The bin select values are specified as
variable array. Each of the bin select values has its own range and number of
bins.

Output: For a 4Dim histogram with # of Bins in each dimension as follows:

# of Bins in first Dimension (Bins1) = B1
# of Bins in second Dimension (Bins2) = B2
# of Bins in third Dimension (Bins3) = B3
# of Bins in fourth Dimension (Bins4) = B4

The total number of bins is the product of the number of bins in each dimension
(B1 x B2 x B3 x B4). The output would be arranged sequentially in the order:

[Bin(1,1,1,1), Bin(1,1,1,2), … Bin(1,1,1,B4), Bin(1,1,2,1), Bin(1,1,2,2), ...
Bin(1,1,2,B4), Bin(1,1,3,1), Bin(1,1,3,2) ... Bin(1,1,3,B4) ... Bin(1,1,B3,1),
Bin(1,1,B3,2), ... Bin(1,1,B3,B4), Bin(1,2,1,1), Bin(1,2,1,2), ...
Bin(1,2,1,B4), Bin(1,2,2,1), ... Bin(1,2,2,B4), Bin(1,2,3,1), Bin(1,2,3,2), ...
Bin(1,2,B3,1), Bin(1,2,B3,2) ... Bin(1,2,B3,B4), Bin(1,3,1,1), Bin(1,3,1,2), ...
Bin(1,B2,B3,B4), Bin(2,1,1,1), ... Bin(B1,B2,B3,B4).

So if B1 = B2 = B3 = B4 = 2 (2 Bins in each dimension) then the output order
would be:

Bin(1,1,1,1), Bin(1,1,1,2), Bin(1,1,2,1), Bin(1,1,2,2),
Bin(1,2,1,1), Bin(1,2,1,2), Bin(1,2,2,1), Bin(1,2,2,2),
Bin(2,1,1,1), Bin(2,1,1,2), Bin(2,1,2,1), Bin(2,1,2,2),
Bin(2,2,1,1), Bin(2,2,1,2), Bin(2,2,2,1), Bin(2,2,2,2)

Histogram4D Output Example

Public mAmps
Public Volts
Dim Bin(2)
Units Bin = Percent
DataTable ("HIST4D",1,100)

'Output Table

DataInterval(0,1,Sec,100)

HISTOGRAM4D

(Bin(), IEEE4, 0, 2, 4, 0, 0, 001, 100, 12, 14, -25, 3000, 0, 0, 0, 0)

EndTable
BeginProg
Scan (1, mSec,0,0)
Battery(Volts, 0)

'main battery volts

Battery(mAmps, 1)

'main battery current

Bin(1) = Volts
Bin(2) = mAmps
CallTable HIST4D
Next Scan
EndProg

6-20