Applies To:
  • CitectSCADA 1.00 1.01 1.10 1.11 1.20 2.00 2.01 3.00

Question: I have used the automatic scaling mode with TrnSetScale function and the scales seem to have been set arbitrarily. Can you explain how it works?  

The parameters of TrnSetScale function are :
hAn: animation point where the trend is displayed
hPen: all pens -1
pen in focus 0
pen number 1 to 8
percentage: default scales -2
auto scales -1
zero scale 0
full scale 100

If you would like to set the automatic scales for an individual pen, it works as follows: The minimum and maximum values of currently displayed trend data points are determined ( Note that <na> and <gated> values are excluded when the minimum and maximum values are determined). Say, minVal and maxVal are minimum and maximum values, respectively. We do the following calculations to get the Full and Zero scales.

diff = maxVal - minVal
Full Scale = maxVal + (10% x diff)
Zero Scale = minVal - (10% x diff).

If you select all pens then the minimum and maximum values of all pens that are currently displayed are calculated. If we call these values minValOfAllPens and maxValOfAllPens then Full and Zero scales of each pen are calculated:

diff = maxValofAllPens - minValOfAllPens
Full Scale = maxValOfAllPens + (10% x diff)
Zero Scale = minValOfAllPens - (10% x diff).

Once the Full and Zero scales are calculated the trend display is refreshed to display the new scale values

See Q1477 for problems with this function.