Campbell Scientific CR9000X Measurement and Control System User Manual

Page 371

Advertising
background image

Section 9. Program Control Instructions

'\\\\\\\\\\\\\\\\\\\\ DECLARE VARIABLES /////////////////////////////

SlotConfigure(9050,9060)

Const Reps = 3

'Set program to measure 3 strain gauges

Const BrConfig = -4

'Block1 gauge code for Full bridge strain, Bending

Dim

I

'Declare I as a variable

Public NumAvg, CalFileLoaded, Flag(8)

'Variables that are arguments in the Zero Function

Public ModeZero, ZeroReps, Index0,RepS
Public RawmVperV(Reps)
Public ZeroMvperV(Reps)

'Variables that are arguments in the Shunt Function

Public ModeShunt, KnownRes(Reps), IndexS
Public MeasureVar_uS(Reps)
Public GF_Adj(Reps), GF_Raw(Reps)

'---------------------------- Tables----------------------------

DataTable(Table1,True,-1)

'Trigger, auto size

DataInterval(0,50,mSec,100)

Average(Reps,MeasureVar_uS(),IEEE4,False)
EndTable
DataTable(CalHist,NewFieldCal,50)

SampleFieldCal

EndTable

'\\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////

BeginProg
NumAvg = 10

'Initialize the number of values to average for the calibrations

IndexS =

1

'Initialize shunt Index to 1

Index0

= 1

'Initialize zero index to 1

Zeroreps = Reps

'Initialize ZeroReps to full size of array

RepS = 1

'Initialize RepS to 1 (FieldCalStrain Shunt operation)

'Set Gage Factors

GF_Raw(1) = 2.1 : GF_Raw(2) = 2.1 : GF_Raw(3) = 2.13

For

I = 1

To

Reps

'Initialize the Adj Gage Factors to the raw GF value

GF_Adj(I) = GF_Raw(I)

'The adj Gage factors are used in the calculation of uStrain

Next

I

' If a calibration has been done, the following will load the zero or Adjusted GF from the Calibration file

CalFileLoaded

=

LoadFieldCal(1)

Scan(10,mSec,100,0)

BrFull(RawmvperV(),Reps,mV50,4,1,5,1,1,5000,True,True,40,100,1,0)
StrainCalc(MeasureVar_uS(),Reps,RawmvperV(),ZeroMvperV(),BrConfig,GF_Adj(),0)

'Strain calculation

If

Flag(8) then

ZeroReps = Reps

'Set Reps to zero complete measurement array

Index0

= 1

'Verify that the index is at the beginning of the array

ModeZero = 1

'Set the Mode for the zero function to 1 to start the zero process

Flag(8)

= 0

'Set the zero flag back to low

Endif

'FieldCalStrain(Zeroing,Mvar, reps, GF_adj,Zeromv_V, ModeVar,KnownVar,index,Numavg,GF_Raw,uS)

FIELDCALSTRAIN

(10,RawmvperV(),ZeroReps,0,ZeroMvperV(),ModeZero,0,index0,NumAvg,0,MeasureVar_uS())

'FieldCalStrain(Shunt,Mvar, reps,GF,Zerooffset, ModeVar, KnownVar,index,Numavg,GF_Raw,uStrain)

FIELDCALSTRAIN

(43,MeasureVar_uS(),RepS,GF_Adj(),0,ModeShunt,KnownRes,IndexS,NumAvg,GF_Raw(),0)

CallTable Table1

CallTable CalHist
Next Scan

EndProg

9-41

Advertising