This is a new version of interp, that requires the additional macro, Q, and that is easier to use.

This interpolation software relies on the aSub record in EPICS base.

The following fields of the aSub record have the following functions in this software:
VALA[] independent variable
VALB[] dependent variable 1
VALC[] dependent variable 2
A new value of independent variable, for interp or adding entry
VALN number of entries
F interpolation order (1: linear; >1: polynomial)
G mode (0: Interpolate; 1: Add Entry; 2: Clear All)
B new value for dependent variable 1 array (used if mode is "Add Entry")
C new value for dependent variable 2 array (used if mode is "Add Entry")
VALE successful interpolation (VALE==1)
VALF interpolation result for dependent variable 1
VALG interpolation result for dependent variable 2
NOVA max number of entries in a array - limits table size
NOVB max number of entries in b array - limits table size
NOVC max number of entries in c array - limits table size
H array of new values of independent variable, for interp
VALH array of interpolation results for dependent variable 1
VALI array of interpolation results for dependent variable 2
NOH max number of entries in h array, will be coerced to <= novh, novi
NOVH max number of entries in valh array
NOVI max number of entries in vali array

Note: the code uses only n entries, where n = MIN(NOVA, NOVB, NOVC)

Here's how you use it:

Load VALA, VALB, VALC arrays such that VALB[i] = y1(VALA[i]) and VALC[i] = y2(VALA[i]), where y1 and y2 are the functions you want to interpolate, and VALA]] increases with its array index. You can do this in several ways:

  1. with a channel-access client, such as BURT or caput. This works only at run time.
  2. by editing the file autosave writes when it's told to save according to 'interpNew_settings.req', and then using autosave/restore to load that file. This works only at boot time.
  3. by selecting "Data Entry" from the "More" menu, specifying x, y1, and y2 values, and pressing "Add Entry". This works only at run time.

If you load the arrays by method (1) or (2), make sure you do all of the following:

  1. set VALE to the number of meaningful points in the VALA, VALB, VALC arrays.
  2. load arrays into VALA, VALB, and VALC
  3. Make sure VALA[] is monotonically increasing with its array index

The supplied database adds a sort of user interface to the software described above. The user writes to $(P)interp_x, and the database sends this value to the aSub record, which interpolates and, if successful, writes to $(P)interp_y1 and $(P)interp_y2. If the user has specified output-link fields $(P)interp_y1.OUT or $(P)interp_y2.OUT, then the new values will be written to the PV's named in those links.


To use BURT to load and save the VALA, VALB, and VALC arrays, make a burt request file for your loaded copy of the interp database:

xxx:interp.VALA
xxx:interp.VALB
xxx:interp.VALC

Then make a load file using burtrb:

burtrb -f interp.req -o interp.load

This will produce an output file that might look something like this:

--- Start BURT header
Time:     Thu Dec  9 17:17:48 2010
Login ID: mooney (Tim Mooney)
Eff  UID: 597
Group ID: 104
Keywords: 
Comments: 
Type:     Absolute
Directory /home/oxygen4/MOONEY/epics/synApps/support/xxx/xxxApp/op/burt
Req File: interp.req
--- End BURT header
xxx:interp.VALA 2000 0.000000000000000e+00 0.000000000000000e+00 ...
xxx:interp.VALB 2000 0.000000000000000e+00 0.000000000000000e+00 ...
xxx:interp.VALC 2000 0.000000000000000e+00 0.000000000000000e+00 ...
---end file interp.load---

You can edit this file to change the array values. Note that the first number ("2000") on the line beginning "xxx:interp.VALA" is the number of array values specified on the rest of the line. (I've chopped the line off after two array values in this example.)

Beginning with calc 2.10, you can also interpolate using an array of values to produce arrays of results. Instead of writing a scalar to A and getting scalars VALF and VALG, you set the mode to "Array Interpolate", write an array to H, and get arrays VALH and VALI. Tim Mooney