• Antelope Release 5.9 Mac OS X 10.13.2 2019-05-01

 

NAME

buhistory_create, buhistory_free, buhistory_free_tag, buhistory_free_history, buhistory_get_history, buhistory_add, buhistory_get_points, buhistory_eval, buhistory_maxmin - BRTT time history utility

SYNOPSIS


#include "brttutil.h"

BUHistory *
buhistory_create(int maxnp, char *tag, char *filename, char *handle)

int
buhistory_free (char *handle)

int
buhistory_free_tag (char *tag)

BUHistory *
buhistory_get_history (char *handle)

void
buhistory_free_history (BUHistory *history)

int
buhistory_add(char *handle, double time, double value)

int
buhistory_get_points (char *handle, int *npts,
                            double **tpts, double **ypts)

int
buhistory_eval(char *handle, double time, double *value)

int
buhistory_maxmin (char *handle, double *tmin,
                double *tmax, double *vmin, double *vmax)

These subroutines create and manipulate generic BRTT utility time history objects (aka buhistory objects). A buhistory object can be used to build up a scalar function of time in a crude ring buffer fashion. The time history object is initially sized so that the oldest data values that cannot fit within the fixed maximum size are automatically discarded. This provides a simple mechanism for composing fixed size time dependent functions from real time data.

buhistory_create will create a buhistory object and return a pointer to the object, or NULL if there is an error. maxnp specifies the maximum number of history points in the object buffer. If not NULL, filename can be used to specify a file name that is used to house time history state information. tag can be used to specify a character string tag associated with the new object. An object handle is returned in handle and this handle is used for most subsequent calls to the new object.

buhistory_free will free the resources associated with the buhistory object referenced by handle.

buhistory_free_tag will free the resources associated with all of the buhistory objects whose tag is tag.

buhistory_free_history will free the resources associated with the buhistory object pointer history.

buhistory_get_history will return the buhistory object pointer referenced by handle.

buhistory_add will add a time point, specified by epochal time and value, to a buhistory object referenced by handle.

buhistory_get_points returns all of the npts time history points in the buhistory object referenced by handle. The npts epoch time values are returned in a dynamically allocated array referenced by tpts and the npts data values are returned in a dynamically allocated array referenced by ypts These two arrays are always dynamically allocated, regardless of the entry values of tpts and ypts, and should be freed by the user when they are no longer needed.

buhistory_eval causes the data value, corresponding to the single time epochal time value, to be returned in value for the buhistory object referenced by handle. Linear interpolation is used to evaluate the data value for a time value that is not exactly equal to one of the history points.

buhistory_maxmin returns minimum and maximum time and data values in tmin, tmax, vmin, vmax for the buhistory object referenced by handle.

LIBRARY

-lbrttutil

AUTHOR

Danny Harvey
Printer icon