TableInterpolation
(Function Library)
Description: |
Given a graph described by a CSV file containing X and Y values, this function will interpolate a Y value for any provided X value within the range of the graph. |
Returns: | Numeric |
Usage: | Script or steady state. |
Function Groups: | Oil & Gas |
Related to: | ShellTemperatureCorrection |
Format: | TableInterpolation(FileName, Input, Mode[, ErrorTag]) |
Parameters: |
FileName | ||||||||||||||||
Required text. The path and name of the CSV file containing X and Y values for a graph. | ||||||||||||||||
Input | ||||||||||||||||
Required numeric. An X value, for which this function will return an interpolated Y value. This value must be within the range of X values found in the given CSV file. | ||||||||||||||||
Mode | ||||||||||||||||
Required numeric. Sets the type of interpolation to use. Set to 0 for linear interpolation. Set to 1 to return the Y value associated with the closest X value. |
||||||||||||||||
ErrorTag | ||||||||||||||||
Optional tag object. If provided, this must be an analog tag (typically an I/O tag in Analog mode). The value of that tag will be set according as follows:
|
Comments: |
This function will read a table from a CSV file at the specified location and perform the selected type of interpolation for the Input value, returning the result. Returns Invalid if a result cannot be found. Each line of the CSV file must contain two values: The X and Y coordinates for a point on the graph. No header should be included. The data must be sorted from top to bottom within the file in order by ascending X values. An optional error tag can be provided for which an error value will be set. |