RVCLoadACStatus2() { Rev.DataPage =1; Rev.Priority =6; Rev.DataLength =8; Rev.PDUFormat =0xff; Rev.PDUSpecific = 0xAC; //Rev.Data[0] = 0x09 or 0x89 //depending on which line, i think //----------------------- // bytes 1-2. peak voltage. //----------------------- itemp = voltage; itemp = itemp *20; itemp2 = itemp>>8; Rev.Data[2] = itemp2; itemp &= 0x00ff; Rev.Data[1] = itemp; //----------------------- // bytes 3-4. peak current. //----------------------- itemp = current; itemp = itemp + 1600; itemp = itemp *20; itemp2 = itemp>>8; Rev.Data[4] = itemp2; itemp &= 0x00ff; Rev.Data[3] = itemp; //----------------------- // bytes 5-6 ground current //----------------------- itemp = current; itemp = itemp + 1600; itemp = itemp *20; itemp2 = itemp>>8; Rev.Data[6] = itemp2; itemp &= 0x00ff; Rev.Data[5] = itemp; } unsigned char RVCLoadACStatus3(unsigned char which) { Rev.DataPage =1; Rev.Priority =6; Rev.DataLength =8; Rev.PDUFormat =0xff; Rev.PDUSpecific = 0xAB; for (i=0;i<8;i++) { Rev.Data[i]= 0x00; } //------------------ // leg reporting //------------------ if (which == 0) { Rev.Data[0] = 0x11; Rev.Data[7] = 0x91; } else { Rev.Data[0] = 0x91; Rev.Data[7] = 0x11; } //------------------ // PHASE // byte 1: BITS 2 to 5 0010b = out of phase // 0001b = in phase //------------------ if (i == ATS_SINGLEPHASE) { Rev.Data[1] |= 0x0004; } else { Rev.Data[1] |= 0x0008; } //----------------------- // bytes 2-3: power reporting. //----------------------- itemp = voltage * current; itemp2 = itemp>>8; Rev.Data[3] = itemp2; itemp &= 0x00ff; Rev.Data[2] = itemp; for (i=4;i<8;i++) { Rev.Data[i]= 0xFF; } } RVCLoadACStatus1() { Rev.DataPage =1; Rev.Priority =6; Rev.DataLength =8; Rev.PDUFormat =0xff; Rev.PDUSpecific = 0xAD; //------------------ // leg reporting //------------------ Rev.Data[0] = which; if (which == 0) { Rev.Data[0] = 0x09; } else { Rev.Data[0] = 0x89; } //------------------ // NORMAL VALUES // byte 1 & 2: rms VOLTAGE = 120 * 20 = 2400 = 960h // byte 3 & 4: rms current = 10Amps * 20 = 200 = 00c8h // byte 5 & 6: frequency = 60hz * 128 = 7680 = 1e00h // byte 7: faults reporting = 0x00 none //------------------ itemp = voltage; itemp = itemp * 20; itemp2 = itemp>>8; Rev.Data[2] = itemp2; itemp &= 0x00ff; Rev.Data[1] = itemp; itemp = current; itemp = itemp + 1600; itemp = itemp * 20; itemp2 = itemp>>8; Rev.Data[4] = itemp2; itemp &= 0x00ff; Rev.Data[3] = itemp; itemp = frequency; itemp = itemp * 128; itemp2 = itemp>>8; Rev.Data[6] = itemp2; itemp &= 0x00ff; Rev.Data[5] = itemp; faults = 0; if ((allFaults & FAULT_OPENGROUND)!= 0) { faults |= 0x01; } if ((allFaults & FAULT_OPENNEUTRAL)!= 0) { faults |= 0x04; } if ((allFaults & FAULT_REVPOL)!= 0) { faults |= 0x10; } Rev.Data[7] = faults; } RVCATSStatus() { Rev.DataPage =1; Rev.Priority =6; Rev.DataLength =8; Rev.PDUFormat =0xff; Rev.PDUSpecific = 0xAA; for (i=0;i<8;i++) { Rev.Data[i] = 0x00; } //------------------ // valid instance //------------------ Rev.Data[0] = 0x00; //------------------ // byte 1: 0x00 shore power, 0x01 generator power //------------------ if (AtsLogicGetSource() == ATS_SOURCEGEN) { Rev.Data[1] = 0x00; } else { Rev.Data[1] = 0x01; } Rev.Data[0]= 0x01; //instance ... nonzero Rev.Data[2] = 0x00; } RVCDM1() { Rev.DataPage =0; Rev.Priority =6; Rev.DataLength =8; Rev.PDUFormat =0xfe; Rev.PDUSpecific = 0xca; for (i=0;i<8;i++) { Rev.Data[i] = 0xff; } Rev.Data[0] = 0x05; Rev.Data[1] = 0x4F; if (dm1fault != 0) { Rev.Data[0] = 0x10; Rev.Data[1] = 0x4F; Rev.Data[2] = 0x00; Rev.Data[3] = 0x00; Rev.Data[4] = 0xbf; Rev.Data[5] = 0xff; Rev.Data[6] = 0xff; } } RVCLoadACStatus4() { Rev.DataPage =1; Rev.Priority =6; Rev.DataLength =8; Rev.PDUFormat =0xff; Rev.PDUSpecific = 0x85; for (i=0;i<8;i++) { Rev.Data[i] = 0; } if (which == 0) { Rev.Data[0] = 0x09; } else { Rev.Data[0] = 0x89; } //------------------ // NORMAL VALUES // //------------------------------------------------------------------ if(which == 0) { if ( (allFaults & FAULT_LINE1_LOW)!= 0) { Rev.Data[1] = 2; } if ( (allFaults & FAULT_LINE1_HIGH)!= 0) { Rev.Data[1] = 3; } if ( (allFaults & FAULT_LINE1OPEN)!= 0) { Rev.Data[1] = 5; } } else { if ( (allFaults & FAULT_LINE2_LOW)!= 0) { Rev.Data[1] = 2; } if ( (allFaults & FAULT_LINE2_HIGH)!= 0) { Rev.Data[1] = 3; } if ( (allFaults & FAULT_LINE2OPEN)!= 0) { Rev.Data[1] = 6; } } //------------------------------------------------------------------- faults = 0; if ((allFaults & FAULT_SURGEFUSE)!= 0) { faults |= 0x01; } if ((allFaults & FAULT_HIGHFREQ)!= 0) { faults |= 0x04; } if ((allFaults & FAULT_LOWFREQ)!= 0) { faults |= 0x10; } Rev.Data[2] = faults; } #endif