DNx-AI-208 Analog Input Layer
29
Tel: 508-921-4600
www.ueidaq.com
Vers:
4.6
Date: November 2013
File:
AI-208 App B.fm
© Copyright 2009
United Electronic Industries, Inc.
B.5
Shunt
Calibration in
C++
The following is an example of C++ code used for performing shunt calibration
of strain gauges.
// Create session for measurement with excitation
set to 10V
CUeiSession session;
CUeiAIVExChannel* pChannel =
session.CreateAIVexChannel( “pdna://192.168.100.2/
Dev0/Ai0”, -0.015, 0.015, UeiSensorQuarterBridge,
10.0, false, UeiAIChannelInputModeDifferential );
Session. ConfigureTimingForSimpleIO();
CueiAnalogScaledReader
reader(session.GetDataStream());
double voltageWithoutShunt, voltageWithShunt
// Take one measurement without shunt resistor
session.Start();
reader.ReadSingleScan(&voltageWithoutShunt);
session.Stop();
// Turn on shunt calibration for the first channel,
shunt branch R4
// and program the shunt resistance to 100kOhms
pChannel->EnableShuntCalibration(true);
pChannel->SetShuntLocation(UeiShuntLocationR4);
pChannel->SetShuntResistance(100000.0);
// Take one measurement with shunt resistance
enabled
session.Start();
reader.ReadSingleScan(&voltageWithShunt);
Session.Stop();
// Retrieve the global shunt resistance for the
first channel and
// the actual excitation voltage.
double Rs = pChannel->GetActualShuntResistance();
double Vex = pChannel->GetExcitationVoltage();
// Assume all gauge resistances are 330 Ohms
double Rgage = 330;
// calculate actual and theoretical offset caused
by shunt.