/*============================================================================= Abs: This file contains all subroutine support for Plasma Oven Filename: deltaSub.c Rem: All functions called by the subroutine record get passed one argument: Functions: Description ------------ ---------------------------- deltaInit General Initialization deltaDegFLimits Calc DegF alarm and warning limits from DegC All functions return a long integer. 0 = OK, -1 = ERROR. The subroutine record ignores the status returned by the Init routines. For the calculation routines, the record status (STAT) is set to SOFT_ALARM (unless it is already set to LINK_ALARM due to severity maximization) and the severity (SEVR) is set to psub->brsv (BRSV - set by the user in the database though it is expected to be invalid) Side: Place all functions called by the subroutine records in the file deltaSub.dbd Auth: dd-mmm-yyyy, Author's Name (USERNAME) Rev: dd-mmm-yyyy, Reviewer's Name (USERNAME) -------------------------------------------------------------- Mod: mmm-yyyy, First Lastname (USERNAME): comments ==============================================================*/ #include "copyright_SLAC.h" /* Header files */ #include "debugPrint.h" #ifdef DEBUG_PRINT #include int psControlSubFlag = DP_INFO; #endif #include /* for calloc */ #include /* for DBADDR */ #include /* for struct genSubRecord */ #include /* for struct subRecord */ #include /* for epicsExport */ #include /* for epicsRegisterFunction */ #include /* NO_ALARM, INVALID_ALARM */ #include /* for S_rec_outMem */ #include /* for S_dev_noDeviceFound */ #include /* for recGblRecordError() */ #include /* for DBF_DOUBLE */ #ifndef SUCCESS #define SUCCESS 0 #endif #ifndef ERROR #define ERROR -1 #endif /* prototypes */ static long deltaInit(genSubRecord *sub_ps); static long deltaDegFLimits(genSubRecord *sub_ps); /*============================================================================= Name: deltaInit Abs: General initialization for genSub record Args: Type Name Access Description ------------------- ----------- ---------- ---------------------------- genSubRecord * sub_ps read/write pointer to subroutine record Rem: Side: None Ret: long 0 - Successful (always) ==============================================================================*/ static long deltaInit(genSubRecord *sub_ps) { long status=SUCCESS; /* * General purpose initialization required since all subroutine records * require a non-NULL init routine even if no initialization is required. * Note that most subroutines in this file use this routine as an init * routine. If init logic is needed for a specific subroutine, create a * new routine for it - don't modify this one. */ return(status); } /*============================================================================= Name: deltaDegFLimits Abs: Calculate alarm and warning limits from deltas. Args: Type Name Access Description ------------------- ----------- ---------- ---------------------------- genSubRecord * sub_ps read/write pointer to subroutine record Input: -------- INPA = :M_CH_SIG.HIGH in DegC INPB = :M_CH_SIG.LOW in DegC INPC = :M_CH_SIG.HIHI in DegC INPD = :M_CH_SIG.LOLO in DegC Formula: x = value in celsius y = value in farenheit y = (1.8*x)+32 example device: APC:LI20:EX01:M3_CH4_SIG Outputs: --------- OUTA = :TEMP.HIGH in DegF OUTB = :TEMP.LOW in DegF OUTC = :TEMP.HIHI in DegF OUTD = :TEMP.LOLO in DegF Rem: Calculate Farenheit alarm and warning limits based on celcius alarm limit inputs. Side: None Ret: long 0 - Successful (always) ==============================================================================*/ static long deltaDegFLimits(genSubRecord *sub_ps) { long status = SUCCESS; *(double *)sub_ps->vala = (*(double *)sub_ps->a * 1.8) + 32; *(double *)sub_ps->valb = (*(double *)sub_ps->b * 1.8) + 32; *(double *)sub_ps->valc = (*(double *)sub_ps->c * 1.8) + 32; *(double *)sub_ps->vald = (*(double *)sub_ps->d * 1.8) + 32; return(status); } epicsRegisterFunction(deltaInit); epicsRegisterFunction(deltaDegFLimits); /* Note - when adding a funciton, also add to deltaSub.dbd */ /* End of file */