rating_table_gp demonstrates an interpolation table using general purpose variables


The interpolation table uses an ‘alpha’ value to compute a ‘beta’ value.

For discharge computations, this would be a rating table where ‘alpha’ is stage and ‘beta’ is discharge.

General Purpose (GP) variables are used to store the table. The table ends when the next GP variable value is lower than the previous

The interpolation table is stored in GP Value variables. ‘GP1 Value’ and ‘GP2 Value’ hold the alpha and beta values for the first table entry. (GP3, GP4) have the second (alpha, beta) table entry. With 32 GP variables available, we can hold up to 16 (alpha, beta) pairs:

table = ((GP1, GP2),
         (GP3, GP4),
         (GP5, GP6),
         (GP7, GP8),
         (GP9, GP10),
         (GP11, GP12),
         (GP13, GP14),
         (GP29, GP30),
         (GP31, GP32))

Please note that each subsequent alpha value MUST be greater than the previous. If it is not, the system will stop loading the table. Keep the unused parts of the GP Variables at 0.0.

To improve performance, we will load the table from setup whenever recording is started. This means that the station needs either a reboot, or to be stopped and started after changing the GP variables.


writes default values to the table table must have at least two entries


returns True if the provided general purpose variable index is valid


Returns the customer set Value of the general purpose variable.

Parameters:gp_index (int) – A number between 1 and gp_count
Returns:the Value of the specified p
Return type:float

Load the table from GP setup. Associate this with a script that runs when recording is started.


Given the value alpha, this script will find the closest (alpha, beta) pair in the table that is less than the alpha reading, and then perform a linear interpolation on the beta values on either side of the alpha value to determine the correct beta value.

User will need to define the values for the interpolation table based on their application using General Purpose variables which will get loaded into global table.

There are two basic ways configure this script, depending on whether you want both the alpha and beta readings, or just the beta reading.

If you just want the beta reading, attach this function to the alpha measurement. If you want both, setup the alpha reading normally, and then setup a second meta measurement. Have the meta index the alpha reading and have the meta connect to this script function.