Tag

(Engine-Level Function)

Description: Returns a Tag value, which works like (and in place of) a Normalize value.
Returns: Tag
Usage: Steady State only.
Function Groups: Graphics,  Generic Math,  Variable
Related to: Normalize | Rotate | Scale | Trajectory
Format: Tag(Value, LowInput, HighInput, LowScale, HighScale, Mode, Freq)
Parameters:  
Value
Required. Any numeric expression to be normalized.
LowInput
Required. Any numeric expression, which represents the lowest normal input value of Value. This is not a limit.
HighInput
Required. Any numeric expression, which represents the highest normal input value of Value. This is not a limit.
LowScale
Required. Any numeric expression, which represents the lowest normal scaled value of Value. This is not a limit.
HighScale
Required. Any numeric expression, which represents the highest normal scaled value of Value. This is not a limit.
Mode
Required. Any numeric expression that specifies how this I/O tag is to be simulated. If the application isn't simulating I/O, this parameter is ignored, but must be present and valid.
Freq
Required. Any numeric expression that specifies the frequency at which the simulation runs. This applies only if this tag is simulated, and only if the Mode specifies a cyclic simulation, however, this parameter must always be present and valid.
Comments: This function scales an expression from the low and high input range to between low and high values. The return value is a Normalize value.
If a Tag value is used in an expression, it will return the scaled value.

Example:

pumpFlow = Tag(rawPumpFlow, 0, 4095, 0, 150);

This sets the variable pumpFlow to a Tag value. The variable rawPumpFlow is scaled from between 0 to 4095, to between 0 and 150. This Tag value might be used to scale a rectangle (to show a bar graph of the pump flow), as shown:

GUIRectangle(0, 100, 100, 0 { Rectangle bounding box },
             1, 1, 1, pumpFlow, 1 { Scale top of bar only },
             0, 0 { No trajectory, rotation },
             1, 0 { Visible; reserved },
             0, 0, 0 { No focus, selection },
             12, 15 { Lt red, white outline });

The variable pumpFlow could also be reused in other expressions, graphics functions, rotations, or trajectories.