RawDcsRpsMonitorBlock.cxx File Reference

#include "RawData/RawDcsRpsMonitorBlock.h"
#include "MessageService/MsgService.h"
#include "MessageService/MsgFormat.h"
#include "RawData/RawBlockRegistry.h"
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Defines

#define RPS_PORT0_BIT0   0x01
#define RPS_MAINALARM   0x01
#define RPS_PORT0_BIT1   0x02
#define RPS_MAINWARN   0x02
#define RPS_PORT0_BIT2   0x04
#define RPS_VMONALARM   0x04
#define RPS_PORT0_BIT3   0x08
#define RPS_VMONWARN   0x08
#define RPS_PORT0_BIT4   0x10
#define RPS_EXTALARM   0x10
#define RPS_PORT0_BIT5   0x20
#define RPS_SMOKEALARM   0x20
#define RPS_PORT0_BIT6   0x40
#define RPS_VMONID_BIT0   0x40
#define RPS_PORT0_BIT7   0x80
#define RPS_FANFAIL   0x80
#define RPS_PORT1_BIT0   0x01
#define RPS_H2OFLOWWARN   0x01
#define RPS_PORT1_BIT1   0x02
#define RPS_H2OFLOWALARM   0x02
#define RPS_PORT1_BIT2   0x04
#define RPS_H2OTEMPWARN   0x04
#define RPS_PORT1_BIT3   0x08
#define RPS_H2OTEMPALARM   0x08
#define RPS_PORT1_BIT4   0x10
#define RPS_EXTTEMP   0x10
#define RPS_PORT1_BIT5   0x20
#define RPS_AIRTEMPDIFFWARN   0x20
#define RPS_PORT1_BIT6   0x40
#define RPS_VMONID_BIT1   0x40
#define RPS_PORT1_BIT7   0x80
#define RPS_AIRTEMPALARM   0x80
#define RPS_PORT2_BIT0   0x01
#define RPS_VMONID_BIT2   0x01
#define RPS_PORT2_BIT1   0x02
#define RPS_AIRFLOWOUT   0x02
#define RPS_PORT2_BIT2   0x04
#define RPS_AIRTEMPDIFFALARM   0x04
#define RPS_PORT2_BIT3   0x08
#define RPS_H2OLEAK   0x08
#define RPS_PORT2_BIT4   0x10
#define RPS_AIRTEMPWARN   0x10
#define RPS_PORT2_BIT5   0x20
#define RPS_HUMIDITY   0x20
#define RPS_PORT2_BIT6   0x40
#define RPS_VMONID_BIT3   0x40
#define RPS_PORT2_BIT7   0x80
#define RPS_AIRFLOWIN   0x80
#define RPS_PORT3_BIT0   0x01
#define RPS_ALARMSILENCE   0x01
#define RPS_PORT3_BIT1   0x02
#define RPS_CLEARDISPLAY   0x02
#define RPS_PORT3_BIT2   0x04
#define RPS_OUTPUTRESET   0x04
#define RPS_PORT3_BIT3   0x08
#define RPS_SMOKERESET   0x08
#define RPS_PORT3_BIT4   0x10
#define RPS_VACRESET   0x10
#define RPS_PORT3_BIT5   0x20
#define RPS_SYSRESET1   0x20
#define RPS_PORT3_BIT6   0x40
#define RPS_SYSRESET2   0x40
#define RPS_PORT3_BIT7   0x80
#define RPS_SYSRESET3   0x80

Enumerations

enum  EDcsRpsMonitorBlkPos { indx_size = 0, indx_checksum = 1, indx_blockid = 2, zzzz_last = 3 }
enum  rpsstatus { GREEN, YELLOW, RED, BLACK }

Functions

 CVSID ("$Id: RawDcsRpsMonitorBlock.cxx,v 1.9 2017/02/28 17:41:05 rhatcher Exp $")
 REGISTERRAWBLOCK (RawDcsRpsMonitorBlock, kMdBlockDcsRpsMonitor, kMdBlockSourceDcs)
rpsstatus rps_translate (unsigned char diodata[], char *linestring, unsigned short *vmon_id)

Variables

char initstring [1024]

Define Documentation

#define RPS_AIRFLOWIN   0x80
#define RPS_AIRFLOWOUT   0x02

Definition at line 49 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetIsError(), and rps_translate().

#define RPS_AIRTEMPALARM   0x80
#define RPS_AIRTEMPDIFFALARM   0x04
#define RPS_AIRTEMPDIFFWARN   0x20
#define RPS_AIRTEMPWARN   0x10
#define RPS_ALARMSILENCE   0x01

Definition at line 64 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_CLEARDISPLAY   0x02

Definition at line 66 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_EXTALARM   0x10
#define RPS_EXTTEMP   0x10
#define RPS_FANFAIL   0x80
#define RPS_H2OFLOWALARM   0x02
#define RPS_H2OFLOWWARN   0x01
#define RPS_H2OLEAK   0x08

Definition at line 53 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetIsError(), and rps_translate().

#define RPS_H2OTEMPALARM   0x08

Definition at line 36 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetIsError(), and rps_translate().

#define RPS_H2OTEMPWARN   0x04

Definition at line 34 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetIsWarning(), and rps_translate().

#define RPS_HUMIDITY   0x20
#define RPS_MAINALARM   0x01

Definition at line 13 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetIsError(), and rps_translate().

#define RPS_MAINWARN   0x02

Definition at line 15 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetIsWarning(), and rps_translate().

#define RPS_OUTPUTRESET   0x04

Definition at line 68 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_PORT0_BIT0   0x01

Definition at line 12 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT1   0x02

Definition at line 14 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT2   0x04

Definition at line 16 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT3   0x08

Definition at line 18 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT4   0x10

Definition at line 20 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT5   0x20

Definition at line 22 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT6   0x40

Definition at line 24 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT0_BIT7   0x80

Definition at line 26 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT0   0x01

Definition at line 29 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT1   0x02

Definition at line 31 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT2   0x04

Definition at line 33 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT3   0x08

Definition at line 35 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT4   0x10

Definition at line 37 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT5   0x20

Definition at line 39 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT6   0x40

Definition at line 41 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT1_BIT7   0x80

Definition at line 43 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT0   0x01

Definition at line 46 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT1   0x02

Definition at line 48 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT2   0x04

Definition at line 50 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT3   0x08

Definition at line 52 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT4   0x10

Definition at line 54 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT5   0x20

Definition at line 56 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT6   0x40

Definition at line 58 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT2_BIT7   0x80

Definition at line 60 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT0   0x01

Definition at line 63 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT1   0x02

Definition at line 65 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT2   0x04

Definition at line 67 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT3   0x08

Definition at line 69 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT4   0x10

Definition at line 71 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT5   0x20

Definition at line 73 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT6   0x40

Definition at line 75 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_PORT3_BIT7   0x80

Definition at line 77 of file RawDcsRpsMonitorBlock.cxx.

#define RPS_SMOKEALARM   0x20
#define RPS_SMOKERESET   0x08

Definition at line 70 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_SYSRESET1   0x20

Definition at line 74 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_SYSRESET2   0x40

Definition at line 76 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_SYSRESET3   0x80

Definition at line 78 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_VACRESET   0x10

Definition at line 72 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_VMONALARM   0x04
#define RPS_VMONID_BIT0   0x40

Definition at line 25 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_VMONID_BIT1   0x40

Definition at line 42 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_VMONID_BIT2   0x01

Definition at line 47 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_VMONID_BIT3   0x40

Definition at line 59 of file RawDcsRpsMonitorBlock.cxx.

Referenced by rps_translate().

#define RPS_VMONWARN   0x08

Enumeration Type Documentation

Enumerator:
indx_size 
indx_checksum 
indx_blockid 
zzzz_last 

Definition at line 93 of file RawDcsRpsMonitorBlock.cxx.

00093                           {
00094    indx_size      = 0,
00095    indx_checksum  = 1,
00096    indx_blockid   = 2,
00097    zzzz_last      = 3
00098 };

enum rpsstatus
Enumerator:
GREEN 
YELLOW 
RED 
BLACK 

Definition at line 100 of file RawDcsRpsMonitorBlock.cxx.

00100              {                      /* Operational status of RPS */
00101         GREEN,                            /* Green is all OK */
00102         YELLOW,                           /* Yellow is warning */
00103         RED,                              /* Red is alarm */
00104         BLACK                             /* Black is no net connection */
00105 } rpsstatus;


Function Documentation

CVSID ( "$Id: RawDcsRpsMonitorBlock.  cxx,
v 1.9 2017/02/28 17:41:05 rhatcher Exp $"   
)
REGISTERRAWBLOCK ( RawDcsRpsMonitorBlock  ,
kMdBlockDcsRpsMonitor  ,
kMdBlockSourceDcs   
)
rpsstatus rps_translate ( unsigned char  diodata[],
char *  linestring,
unsigned short *  vmon_id 
)

Definition at line 298 of file RawDcsRpsMonitorBlock.cxx.

References GREEN, RED, RPS_AIRFLOWIN, RPS_AIRFLOWOUT, RPS_AIRTEMPALARM, RPS_AIRTEMPDIFFALARM, RPS_AIRTEMPDIFFWARN, RPS_AIRTEMPWARN, RPS_ALARMSILENCE, RPS_CLEARDISPLAY, RPS_EXTALARM, RPS_EXTTEMP, RPS_FANFAIL, RPS_H2OFLOWALARM, RPS_H2OFLOWWARN, RPS_H2OLEAK, RPS_H2OTEMPALARM, RPS_H2OTEMPWARN, RPS_HUMIDITY, RPS_MAINALARM, RPS_MAINWARN, RPS_OUTPUTRESET, RPS_SMOKEALARM, RPS_SMOKERESET, RPS_SYSRESET1, RPS_SYSRESET2, RPS_SYSRESET3, RPS_VACRESET, RPS_VMONALARM, RPS_VMONID_BIT0, RPS_VMONID_BIT1, RPS_VMONID_BIT2, RPS_VMONID_BIT3, RPS_VMONWARN, and YELLOW.

Referenced by RawDcsRpsMonitorBlock::GetRpsString().

00299                                                   {
00300 
00301   /* note linestring bounds not checked here! */
00302 
00303   int vmon_set = 0;
00304   rpsstatus status = GREEN;
00305 
00306 //  *vmon_id = 0;
00307 
00308   /* reset string */
00309   linestring[0] = '\0';
00310 
00311   /* Check each port */
00312   /* status flag is greater of two evils */
00313 
00314   if (diodata[0] || diodata[1] || diodata[2]) {
00315     strcat(linestring," Alarms/warnings set: ");
00316     /* port 0 */
00317     if (diodata[0] & RPS_MAINALARM) {
00318       strcat(linestring,"(Main Alarm) ");
00319       status = RED;
00320     }
00321     if (diodata[0] & RPS_MAINWARN) {
00322       strcat(linestring,"(Main Warn) ");
00323       if (!status) status = YELLOW;
00324     }
00325     if (diodata[0] & RPS_VMONALARM) {
00326       strcat(linestring,"(Vmon Alarm) ");
00327       vmon_set = 1;
00328       status = RED;
00329     }
00330     if (diodata[0] & RPS_VMONWARN) {
00331       strcat(linestring,"(Vmon Warn) ");
00332       vmon_set = 1;
00333       if (!status) status = YELLOW;
00334     }
00335     if (diodata[0] & RPS_EXTALARM) {
00336       strcat(linestring,"(External Alarm) ");
00337       status = RED;
00338     }
00339     if (diodata[0] & RPS_SMOKEALARM) {
00340       strcat(linestring,"(Smoke Alarm) ");
00341       status = RED;
00342     }
00343     if (diodata[0] & RPS_VMONID_BIT0) 
00344       *vmon_id |= 0x01;
00345     if (diodata[0] & RPS_FANFAIL) {
00346       strcat(linestring,"(Fan Failure) ");
00347       if (!status) status = YELLOW;
00348     }
00349 
00350     /* port 1 */
00351     if (diodata[1] & RPS_H2OFLOWWARN) {
00352       strcat(linestring,"(H2O Flow Warn) ");
00353       if (!status) status = YELLOW;
00354     }
00355     if (diodata[1] & RPS_H2OFLOWALARM) { 
00356       strcat(linestring,"(H2O Flow Alarm) ");
00357       status = RED;
00358     }
00359     if (diodata[1] & RPS_H2OTEMPWARN) {
00360       strcat(linestring,"(H2O Temp Warn) ");
00361      if (!status) status = YELLOW;
00362     }
00363     if (diodata[1] & RPS_H2OTEMPALARM) {
00364       strcat(linestring,"(H2O Temp Alarm) ");
00365       status = RED;
00366     }
00367     if (diodata[1] & RPS_EXTTEMP) {
00368       strcat(linestring,"(External Temp) ");
00369       status = RED;
00370     }
00371     if (diodata[1] & RPS_AIRTEMPDIFFWARN) {
00372       strcat(linestring,"(Air Temp Diff Warn) ");
00373       if (!status) status = YELLOW;
00374     }
00375     if (diodata[1] & RPS_VMONID_BIT1) 
00376       *vmon_id |= 0x02;
00377     if (diodata[1] & RPS_AIRTEMPALARM) {
00378       strcat(linestring,"(Air Temp Alarm) ");
00379       status = RED;
00380     }
00381 
00382     /* port 2 */
00383     if (diodata[2] & RPS_VMONID_BIT2) 
00384       *vmon_id |= 0x04;
00385     if (diodata[2] & RPS_AIRFLOWOUT) {
00386       strcat(linestring,"(Air Flow Out) ");
00387       status = RED;
00388     }
00389     if (diodata[2] & RPS_AIRTEMPDIFFALARM)
00390       strcat(linestring,"(Air Temp Diff Alarm) ");
00391     if (diodata[2] & RPS_H2OLEAK) {
00392       strcat(linestring,"(H2O Leak) ");
00393       status = RED;
00394     }
00395     if (diodata[2] & RPS_AIRTEMPWARN) {
00396       strcat(linestring,"(Air Temp Warn) ");
00397       if (!status) status = YELLOW;
00398     }
00399     if (diodata[2] & RPS_HUMIDITY) {
00400       strcat(linestring,"(Humidity) ");
00401       if (!status) status = YELLOW;
00402     }
00403     if (diodata[2] & RPS_VMONID_BIT3)
00404       *vmon_id |= 0x08;
00405     if (diodata[2] & RPS_AIRFLOWIN) {
00406       strcat(linestring,"(Air Flow In) ");
00407       status = RED;
00408     }
00409    
00410     /* decode VMONID */
00411     if (vmon_set) {
00412 //      strcat(linestring,"\n Problem VDC Channel:");
00413 
00414       /* worry here - a fresh alarm on top of a warning (and possibly 
00415          other permutations) sets the new bits on top the old, making it 
00416          hard to tell what happened.  How to fix? How to trap?  Need to
00417          play with this and map out exactly what happens bitwise, then
00418          consult with BiRa */
00419 
00420       /* first 3 bits encode channel */
00421       switch (*vmon_id & 0x7) {
00422       case 0 : strcat(linestring,"(+3.3V "); break;   /* 000 */
00423       case 1 : strcat(linestring,"(+5V "); break;     /* 001 */
00424       case 2 : strcat(linestring,"(+12V "); break;    /* 010 */
00425       case 3 : strcat(linestring,"(-12V "); break;    /* 011 */
00426       case 4 : strcat(linestring,"(+6V "); break;     /* 100 */
00427       case 5 : strcat(linestring,"(-6V "); break;     /* 101 */
00428       case 6 : strcat(linestring,"(+5VExt "); break;  /* 110 */
00429       case 7 : strcat(linestring,"(-5VExt "); break;  /* 111 */
00430       default: fprintf(stderr,"Case statement fallthru in rps_translate.c.  If you see me it is a bug!!\n");
00431       }
00432       /* last bit encodes under or over */
00433       if (*vmon_id & 0x8) {
00434         strcat(linestring,"Over) ");
00435       } else {
00436         strcat(linestring,"Under) ");
00437       }
00438     }
00439   }
00440 
00441   /* port 3 */
00442   if (diodata[3]) {
00443     strcat(linestring,"\n Overrides set: ");
00444     if (diodata[3] & RPS_ALARMSILENCE)
00445       strcat(linestring,"(Alarm Silenced) ");
00446     if (diodata[3] & RPS_CLEARDISPLAY)
00447       strcat(linestring,"(Display Cleared) ");
00448     if (diodata[3] & RPS_OUTPUTRESET)
00449       strcat(linestring,"(Output Reset) ");
00450     if (diodata[3] & RPS_SMOKERESET) 
00451       strcat(linestring,"(Smoke Det Reset) ");
00452     if (diodata[3] & RPS_VACRESET)
00453       strcat(linestring,"(AC Relay Held On) ");
00454     if (diodata[3] & RPS_SYSRESET1)
00455       strcat(linestring,"(System Reset bit1 on) ");
00456     if (diodata[3] & RPS_SYSRESET2)
00457       strcat(linestring,"(System Reset bit2 on) ");
00458     if (diodata[3] & RPS_SYSRESET3)
00459       strcat(linestring,"(System Reset bit3 on) ");
00460   }
00461   
00462   strcat(linestring,"\n");
00463 
00464   return(status);
00465 }


Variable Documentation

char initstring[1024]

Definition at line 109 of file RawDcsRpsMonitorBlock.cxx.

Referenced by RawDcsRpsMonitorBlock::GetRpsString().


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1