/****************************************************************************/
/* Copyright 1994 to 1995 MBARI                                             */
/****************************************************************************/
/* Summary  : PDU Microcontroller Board Application definitions             */
/* Filename : pdu.h                                                         */
/* Author   : Douglas Au                                                    */
/* Project  : Tiburon ROV                                                   */
/* Version  : Version 1.0                                                   */
/* Created  : 05/17/95                                                      */
/* Modified : 05/17/95                                                      */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/* $Header: /usr/tiburon/.cvsroot/micro/h/pdu.h,v 1.1.1.1 1997/05/02 17:15:40 pean Exp $
 * $Log: pdu.h,v $
 * Revision 1.1.1.1  1997/05/02 17:15:40  pean
 * Initial release of the microcontroller software after Tiburon
 * Moolpool Dive to test IView, Lapboxes, modified Power can
 * GF/5V using bus capacitance mode.
 *
 *
*/
/****************************************************************************/
#define WATTAGE_WARN_THRESH    22000    /* Wattage Warn Threshold Watts     */
#define WATTAGE_ALARM_THRESH   25000    /* Wattage Alarm Threshold Watts    */
#define WATTAGE_HYSTERESIS      2000    /* Wattage Hyteresis  Watts         */
#define MAX_WATTAGE_VALUE     120000    /* Maximum Wattage Measurement      */

#define AMPERAGE_WARN_THRESH      80    /* Amperage Warn Threshold Amps     */
#define AMPERAGE_ALARM_THRESH     87    /* Amperage Alarm Threshold Amps    */
#define AMPERAGE_HYSTERESIS        5    /* Amperage Hysteresis Amps         */
#define MAX_AMPERAGE_VALUE       120    /* Maximum Amperage Value Amps      */

#define OUT_OF_PHASE_WARN_THRESH  20    /* 20% out of phase warning         */
#define OUT_OF_PHASE_ALARM_THRESH 25    /* 25% out of phase alarm           */
#define OUT_OF_PHASE_HYSTERESIS    3    /*                                  */
#define MAX_OUT_OF_PHASE_VALUE    99    /* Maximum Out of Phase %           */


#define VOLTAGE_WARN_THRESH      121    /* Voltage Warn Thresh Volts        */
#define VOLTAGE_ALARM_THRESH     130    /* Voltage Alarm Thresh Volts       */
#define VOLTAGE_HYSTERESIS         3    /* Voltage Hysteresis Volts         */
#define MAX_VOLTAGE_VALUE        200    /* Maximum Voltage Value Vac        */

#define VOLTAGE_MIN_WARN_THRESH  105    /* Voltage Min Warn Thresh Volts    */
#define VOLTAGE_MIN_ALARM_THRESH 100    /* Voltage Min Alarm Thresh Volts   */


#define MICRO_TEMP_WARN_THRESH    60    /* Temperature Warn Threshold degs  */
#define MICRO_TEMP_ALARM_THRESH   70    /* Temperature Alarm Threshold degs */
#define TRANS_TEMP_WARN_THRESH    85    /* Temperature Warn Threshold degs  */
#define TRANS_TEMP_ALARM_THRESH  100    /* Temperature Alarm Threshold degs */
#define TEMPERATURE_HYSTERESIS     5    /* Temeprature Alarm Hystesis degs  */
#define MAX_TEMP_VALUE           120    /* Maximum temperature measurement  */

                                            /* *** Micro A/D Channels ***   */
#define TOTAL_WATTS_CHAN            0   /* Total Watts sensor               */
#define AMPS_PHASE3_CHAN            1   /* Amps Phase 3 sensor              */
#define AMPS_PHASE2_CHAN            2   /* Amps Phase 2 sensor              */
#define AMPS_PHASE1_CHAN            3   /* Amps Phase 1 sensor              */
#define VOLTAGE_CHAN                4   /* Voltage sensor                   */
#define GROUND_FAULT_CHAN           5   /* Ground Fault sensor              */
#define MICRO_TEMP_CHAN             6   /* Micro Temperature sensor         */
#define TRANS_TEMP_CHAN             7   /* Transformer Temperature sensor   */

#define PDU_GF_ADVISORY_LEVEL     500
#define PDU_GF_WARNING_LEVEL     1000
#define PDU_GF_CRITICAL_LEVEL    4000
#define PDU_GF_TEST_LEVEL        3000/*Extrn. Ground Fault Level (microamps)*/

#define GET_WATTAGE                0x01 /* Get Total Watts Sensor Value     */
#define GET_WATTAGE_ALARM_STATUS   0x02 /* Get Total Watts Alarm Status     */
#define GET_WATTAGE_THRESH         0x03 /* Get Total Watts Alarm Threshold  */
#define SET_WATTAGE_THRESH         0x04 /* Set Total Watts Alarm Threshold  */


#define GET_AMPS_PHASE3              0x05 /* Get Amps Phase3 Sensor Value   */
#define GET_AMPS_PHASE3_ALARM_STATUS 0x06 /* Get Amps Phase3 Alarm Status   */
#define GET_AMPS_PHASE3_THRESH       0x07 /* Get Amps Phase3 Alarm Threshold*/
#define SET_AMPS_PHASE3_THRESH       0x08 /* Set Amps Phase3 Alarm Threshold*/

#define GET_AMPS_PHASE2              0x09 /* Get Amps Phase2 Sensor Value   */
#define GET_AMPS_PHASE2_ALARM_STATUS 0x0A /* Get Amps Phase2 Alarm Status   */
#define GET_AMPS_PHASE2_THRESH       0x0B /* Get Amps Phase2 Alarm Threshold*/
#define SET_AMPS_PHASE2_THRESH       0x0C /* Set Amps Phase2 Alarm Threshold*/

#define GET_AMPS_PHASE1              0x0D /* Get Amps Phase1 Sensor Value   */
#define GET_AMPS_PHASE1_ALARM_STATUS 0x0E /* Get Amps Phase1 Alarm Status   */
#define GET_AMPS_PHASE1_THRESH       0x0F /* Get Amps Phase1 Alarm Threshold*/
#define SET_AMPS_PHASE1_THRESH       0x10 /* Set Amps Phase1 Alarm Threshold*/

#define GET_VOLTAGE                0x11 /* Get Voltage Sensor Value         */
#define GET_VOLTAGE_ALARM_STATUS   0x12 /* Get Voltage Alarm Status         */
#define GET_VOLTAGE_THRESH         0x13 /* Get Voltage Alarm Threshold      */
#define SET_VOLTAGE_THRESH         0x14 /* Set Voltage Alarm Threshold      */

#define GET_OUT_OF_PHASE_VALUE        0x15
#define GET_OUT_OF_PHASE_ALARM_STATUS 0x16
#define GET_OUT_OF_PHASE_THRESH       0x17
#define SET_OUT_OF_PHASE_THRESH       0x18

#define GET_MICRO_TEMPERATURE        0x19 /* Get Micro Temp Sensor Value    */
#define GET_MICRO_TEMP_ALARM_STATUS  0x1A /* Get Micro Temp Alarm Status    */
#define GET_MICRO_TEMP_THRESH        0x1B /* Get Micro Temp Alarm Threshold */
#define SET_MICRO_TEMP_THRESH        0x1C /* Set Micro Temp Alarm Threshold */

#define GET_TRANS_TEMPERATURE        0x1D /* Get Trans Temp Sensor Value    */
#define GET_TRANS_TEMP_ALARM_STATUS  0x1E /* Get Trans Temp Alarm Status    */
#define GET_TRANS_TEMP_THRESH        0x1F /* Get Trans Temp Alarm Threshold */
#define SET_TRANS_TEMP_THRESH        0x20 /* Set Trans Temp Alarm Threshold */

#define GET_VOLTAGE_MIN_ALARM_STATUS 0x24 /* Get Minimum Volts Alarm Status */
#define GET_VOLTAGE_MIN_THRESH       0x25 /* Get Min Volts Alarm Threshold  */
#define SET_VOLTAGE_MIN_THRESH       0x26 /* Set Min Volts Alarm Threshold  */

                                     /* PDU Micro Applic Service Requests   */
#define WATTAGE_ALARM_SRQ                APPLIC_SRQ_BASE | 0x01
#define OUT_OF_PHASE_ALARM_SRQ           APPLIC_SRQ_BASE | 0x02
#define AMPS_PHASE3_ALARM_SRQ            APPLIC_SRQ_BASE | 0x03
#define AMPS_PHASE2_ALARM_SRQ            APPLIC_SRQ_BASE | 0x04
#define AMPS_PHASE1_ALARM_SRQ            APPLIC_SRQ_BASE | 0x05
#define VOLTAGE_ALARM_SRQ                APPLIC_SRQ_BASE | 0x06
#define MICRO_TEMP_ALARM_SRQ             APPLIC_SRQ_BASE | 0x08
#define TRANS_TEMP_ALARM_SRQ             APPLIC_SRQ_BASE | 0x09

#define VOLTAGE_MIN_ALARM_SRQ            APPLIC_SRQ_BASE | 0x0E

#define NELEMENTS(array)   /* number of elements in an array     */                      (sizeof (array) / sizeof ((array) [0]))

























