beautypg.com

MTS Series 793 User Manual

Page 364

background image

2 lbs)

// Declare variables
real savedValues[3];
real output;
real newValue;
real leftDiff, rightDiff;

// do calculations
newValue = "Aux Input B" ; // noisy signal
shift(savedValues, newValue);
leftDiff = fabs(savedValues[1] - savedValues[2]);
rightDiff = fabs(savedValues[0] - savedValues[1]);

// if the rate of change on the left and right of the center point is larger,
// then don't use the center point
if ((leftDiff > "maxChange") && (rightDiff > "maxChange"))

output = (savedValues[0] +savedValues[2])/2;

else

output = savedValues[1];

"Aux Input B" = output;

Five-Point Running Average of a Noisy Signal

Creating a running average in time can "clean up" noisy signals. Some testers use multiple transducers to
measure the same value. Some examples include multiple extensometers to measure Strain, or two clip
gages transducers to measure length. This calculation simply averages two different input signals. A simple
example is shown below.

// This is a simple average of 5 points.
// Assuming 2048 Hz update, this is about 0.0025 sec of data.

real savedValues[5];
shift(savedValues, "Aux Input A");
"Aux Input B" = avg(savedValues, 5);

Peak/Valley Reversal Counter

Sometimes a "cycle" consists of multiple small segments. If a cycle contains many segments, and especially
if a cycle contains a variable number of segments, it might be easier to count peaks and valleys rather than
count segments to determine a "cycle count." The calculation below looks for reversals and increments a
counter. The calculation returns the counter value. It can be "zeroed" by changing the "Counteroffset."

// calculated signal that increments a counter
// when a peak or valley is detected
// Uses a calculation parameter called "sensitivity"
// subtracts a offset called "Counteroffset"

real newPoint;
real candidatePeak;
real candidateValley;
real outputPeak;
real outputValley;
real output;
real sensitivity;
int peakFlag; // 1 = false
newPoint = "Channel 1 externalcommand";
sensitivity = "sensitivity" ;

if (peakFlag == 0) {

if (newPoint < candidateValley)

candidateValley = newPoint;

364 MTS Series 793 Control Software

Calculated Signals