/// <summary> /// This method retrieves a cummulative demand value from the meter and formats it according /// to the meter's formatting rules established in the meter's program /// </summary> /// <returns></returns> /// <remarks > /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 12/07/06 mah 8.00.00 N/A Created /// 01/30/07 KRC 8.00.09 Fix to handle type differences ///</remarks> protected string GetCumulativeValue(ref SCSDevice device) { String strValue; if (RegisterType == 0x00 || RegisterType == 0x02 || RegisterType == 0x03) { strValue = device.ReadFloatingBCDValue(device.TranslateDisplayAddress(this), 4); } else if (RegisterType == 0x07) { strValue = device.ReadFloatingBCDValue(device.TranslateDisplayAddress(this), 3); } else { strValue = ""; } if (strValue.Length > 0) { // Now that we have a value that we can display we need to format it to match // the display format currently configured in the meter strValue = FormatDisplayValue(strValue, device.CumulativeFormat); } return(strValue); }
/// <summary> /// This method is used to retrieve the current value of the display item. Note that /// this method does not cache any values. Therefore each time it is called, the meter /// will be interrogated to get the actual value that would be shown on the meter's display /// </summary> /// <remarks > /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 12/15/06 mah 8.00.00 N/A Created /// </remarks> protected void GetDisplayItemValue(ref SCSDevice device) { String strValue; switch (RegisterClass) { case SCSDisplayClass.EnergyValue: strValue = GetEnergyValue(ref device); break; case SCSDisplayClass.InstantaneousValue: int nAddress = device.TranslateDisplayAddress(this); if (nAddress != 0) { strValue = device.ReadFloatingPointValue(nAddress).ToString("######0.000", CultureInfo.InvariantCulture); if (strValue.Length > 0) { // Now that we have a value that we can display we need to format it to match // the display format currently configured in the meter strValue = FormatDisplayValue(strValue, device.DemandFormat); } } else { strValue = ""; } break; case SCSDisplayClass.DemandValue: strValue = GetDemandValue(ref device); break; case SCSDisplayClass.MaxDemandValue: strValue = GetMaxDemandValue(ref device); break; case SCSDisplayClass.CumulativeValue: strValue = GetCumulativeValue(ref device); break; case SCSDisplayClass.IntegerBCD: strValue = GetBCDValue(ref device); break; case SCSDisplayClass.DateValue: strValue = GetDateValue(ref device); break; case SCSDisplayClass.TimeValue: strValue = GetTimeValue(ref device); break; case SCSDisplayClass.ASCIIValue: strValue = GetAsciiValue(ref device); break; case SCSDisplayClass.FixedBCD: strValue = GetFixedBCDValue(ref device); break; case SCSDisplayClass.FloatingPointBCD: strValue = device.ReadFloatingBCDValue(device.TranslateDisplayAddress(this), 4); break; case SCSDisplayClass.TotalContinuousCumulativeValue: strValue = GetCCumValue(ref device); break; case SCSDisplayClass.BinaryValue: strValue = GetBinaryValue(ref device); break; case SCSDisplayClass.ExtendedBCDValue: strValue = GetFixedBCDValue(ref device); break; case SCSDisplayClass.TOUContinuousCumulativeValue: strValue = GetCCumValue(ref device); break; default: strValue = ""; break; } Value = strValue; }