/* ============================================================= Abs: EPICS Subroutine Device Support for polynomial conversion Name: subDBpoly.c subDBpolyInit - Initialize record (two passes) subDBpoly - Process record Proto: None Auth: 20-Feb-2001, K. Luchini (LUCHINI) Rev : dd-mmm-yyyy, Reviewer's Name (USERNAME) ------------------------------------------------------------- Mod: dd-mmm-yyyy, First Lastname (USERNAME): Comments ============================================================= */ /* Include Files */ #include "vxWorks.h" /* OK,ERROR */ #include "subRecord.h" /* for struct subRecord */ #include "dbAccess.h" /* for database access */ /*==================================================== Abs: Initialize Caen V265 record Name: subDBpolyInit Args: rec_ps Record information Type: struct Use: struct subRecord * Acc: read-write Mech: By reference Rem: This function is called at iocInit during device support initiaization. Although, this function does nothing, it is required for all subroutine record device support. Side: None Ret: long OK - Successful operation =======================================================*/ long subDBpolyInit(struct subRecord *rec_ps) { return(OK); } /*==================================================== Abs: Convert data to engineering units Name: convert Args: rec_ps Record information Type: struct Use: struct subRecord * Acc: read-write Mech: By reference Rem: This function uses a polynomial conversion A - Offset B - value of polynomial's 1st derivative at L. C - Coefficient to the 2nd degree poly term D - Coefficient to the 3rd degree poly term E - Coefficient to the 4th degree poly term INPL - Point at which polynomial is to be evaluated VAL - value of polynomial at INPL VAL = (e * (L**4)) + (d* (L**3)) + (c* (L**2)) + (b*L) + a Side: None Ret: None =======================================================*/ long subDBpoly(struct subRecord *rec_ps) { double x = rec_ps->l; x = rec_ps->a + x*(rec_ps->b + x*(rec_ps->c + x*(rec_ps->d + x*rec_ps->e))); rec_ps->val = x; return(OK); }