/* Copyright 1996 ** by ** The Board of Trustees of the ** Leland Stanford Junior University. ** All rights reserved. ** ** ** Work supported by the U.S. Department of Energy under contract ** DE-AC03-76SF00515. ** ** Disclaimer Notice ** ** The items furnished herewith were developed under the sponsorship ** of the U.S. Government. Neither the U.S., nor the U.S. D.O.E., nor the ** Leland Stanford Junior University, nor their employees, makes any war- ** ranty, express or implied, or assumes any liability or responsibility ** for accuracy, completeness or usefulness of any information, apparatus, ** product or process disclosed, or represents that its use will not in- ** fringe privately-owned rights. Mention of any product, its manufactur- ** er, or suppliers shall not, nor is it intended to, imply approval, dis- ** approval, or fitness for any particular use. The U.S. and the Univer- ** sity at all times retain the right to use and disseminate the furnished ** items for any purpose whatsoever. Notice 91 02 01 */ /*============================================================================= Abs: Minor/Major warning bands for BIC calibration for use by EPICS subroutine records. Name: subInjband.c subInjband - calculation subInjbandInit - general initialization Proto: not required and not used. All functions called by the subroutine record get passed one argument: psub Pointer to the subroutine record data. Use: pointer In general, all functions read the Type: struct subRecord * input fields (a to l) and write to Acc: read/write the val field. Mech: reference 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). Auth: 12-Feb-1997, Ron Chestnut Rev: DD-MMM-YYYY, Reviewer's Name (.NE. Author's Name) ------------------------------------------------------------------------------- Mod: =============================================================================*/ #include "vxWorks.h" /* OK,ERROR */ #include "subRecord.h" /* for struct subRecord */ long subInjbandinit(struct subRecord *psub) { /* * 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(OK); } long subInjband(struct subRecord *psub) { /* * Inputs: A = SIMULATR:MPG:VAL FLOAT value (in units of 10^10) * B = Minor alarm band (a number like .1) * C = Major alarm band (a number like .2) * D = Magic value (218.) * Outputs: I = HIHI value for INJ_CAL (in microamperes) * J = HIGH * K = LOW * L = LOLO */ psub->val = psub->a * psub->d; psub->i = psub->val*(1.+psub->c); psub->j = psub->val*(1.+psub->b); psub->k = psub->val*(1.-psub->b); psub->l = psub->val*(1.-psub->c); return(OK); }