14 program access to data tables, 2 arrays of multipliers and offsets for sensor, Calibration -30 – Campbell Scientific PC400 Datalogger Support Software User Manual

Page 192: 14 program access to data tables -30

Advertising
background image

Section 9. Datalogger Program Creation with CRBasic Editor

DataTable(Name, TrigVar, Size)
DataTable(Temp, TC(1)>100, 5000)

Entering the trigger as the expression, TC(1)>100, will cause the trigger to be
true and data to be stored whenever the temperature TC(1) is greater than 100.

9.4.13.2 Arrays of Multipliers and Offsets for Sensor Calibration

If variable arrays are used for the multiplier and offset parameters in
measurements that use repetitions, the instruction will automatically step
through the multiplier and offset arrays as it steps through the channels. This
allows a single measurement instruction to measure a series of individually
calibrated sensors, applying the correct calibration to each sensor. If the
multiplier and offset are not arrays, the same multiplier and offset are used for
each repetition.

VoltSE(Dest,Reps,Range,SEChan,Delay, Integ,Mult,Offset)

'Calibration factors:
Mult(1)=0.123 : Offset(1)= 0.23
Mult(2)=0.115 : Offset(2)= 0.234
Mult(3)=0.114 : Offset(3)= 0.224
VoltSE(Pressure(),3,mV1000,6,1,1,100,Mult(),Offset()

Note that one exception to this is when the Multiplier or Offset points to an

index into the array, then the instruction will not advance to the next Multiplier

or Offset but use the same for each repetition. For instance in the above

example, if Mult(2) and Offset(2) were used, the instruction would use 0.115

and 0.234 for the Multiplier and Offset, respectively, for each repetition. To

force the instruction to advance through the Multiplier and Offset arrays while

still specifying an index into the array, use the syntax Mult(2)() and

Offset(2)().

9.4.14 Program Access to Data Tables

Data stored in a table can be accessed from within the program. The format
used is:

Tablename.Fieldname(fieldname index,records back)

Where Tablename is the name of the table in which the desired value is stored.
Fieldname is the name of the field in the table. The fieldname is always an
array even if it consists of only one variable; the fieldname index must always
be specified. Records back is the number of records back in the data table from
the current time (1 is the most recent record stored, 2 is the record stored prior
to the most recent). For example, the expression:

Tdiff=Temp.TC_Avg(1,1)–Temp.TC_Avg(1,101)

could be used in the example program to calculate the change in the 10 ms
average temperature of the first thermocouple between the most recent average
and the one that occurred a second (100 x 10 ms) earlier.

In addition to accessing the data actually output in a table, there are some
pseudo fields related to the data table that can be retrieved:

9-30

Advertising