Tag Ramp Function- This function will
increment a Tag by the amount defined by PerCentInc
PARAMETERS ---
sTag =
The Tag name as a String
PercentInc
= the amount to increment as a percentage
of range
Return
Value: 0 if completed OK or an error code.
INT
FUNCTION
TagRamp(String sTag, Real PerCentInc)
Real rZero, rFull, rRange,
rNewValue;
rZero
= TagGetProperty(sTag, "EngUnitsLow", 0);
rFull
= TagGetProperty(sTag, "EngUnitsHigh", 0);
rRange
= rFull - rZero;
IF rRange =
0 THEN
Return 274;
ELSE
rNewValue
= StrToReal(TagRead(sTag, 0)) + (rRange *
PerCentInc / 100) ;
IF rZero <=
rNewValue AND rNewValue <= rFull THEN
TagWrite(sTag,
rNewValue, 0);
ELSE
Return 257;
END
END
Return 0;
END
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.