コード例 #1
0
ファイル: OpenWayBasicPoly.cs プロジェクト: lenloe1/Stuff
        /// <summary>
        /// Gets the current LED Quantity
        /// </summary>
        /// <returns>The currently pulsing quantity or null if the procedure fails.</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 03/07/11 RCG 2.50.06 N/A    Created

        public LEDQuantity GetCurrentPolyLEDQuantity()
        {
            LEDQuantity          CurrentQuantity = null;
            ProcedureResultCodes Result          = ProcedureResultCodes.UNRECOGNIZED_PROC;

            byte[]           ProcResponse   = null;
            byte[]           ProcParam      = new byte[] { 0x00, 0x00, 0x00, 0x80, 0x00, 0x00 };
            MemoryStream     ResponseStream = null;
            PSEMBinaryReader ResponseReader = null;

            Result = ExecuteProcedure(Procedures.POLY_LED_RECONFIGURE, ProcParam, out ProcResponse);

            if (Result == ProcedureResultCodes.COMPLETED && ProcResponse != null && ProcResponse.Length >= 4)
            {
                ResponseStream = new MemoryStream(ProcResponse);
                ResponseReader = new PSEMBinaryReader(ResponseStream);

                CurrentQuantity = new LEDQuantity(ResponseReader.ReadUInt32());
            }

            return(CurrentQuantity);
        }
コード例 #2
0
ファイル: OpenWayBasicPoly.cs プロジェクト: lenloe1/Stuff
        /// <summary>
        /// Reconfigures the LED Quantity on a Polyphase meter.
        /// </summary>
        /// <param name="quantity">The quantity to reconfigure.</param>
        /// <param name="pulseWeight">The pulse weight to use. Note: The pulse weight will be divided by 40 to get the actual value.</param>
        /// <returns>The result of the procedure call.</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 03/07/11 RCG 2.50.06 N/A    Created

        public ProcedureResultCodes ReconfigurePolyLEDQuantity(LEDQuantity quantity, ushort pulseWeight)
        {
            ProcedureResultCodes Result = ProcedureResultCodes.UNRECOGNIZED_PROC;

            byte[]           ProcResponse    = null;
            MemoryStream     ParameterStream = new MemoryStream(new byte[6]);
            PSEMBinaryWriter ParameterWriter = new PSEMBinaryWriter(ParameterStream);

            ParameterWriter.Write(quantity.QuantityID);

            if (VersionChecker.CompareTo(FWRevision, VERSION_HYDROGEN_3_10) == 0)
            {
                // 3.10 builds had a bug in this procedure so we need to set this based on the Meter Class
                ParameterWriter.Write(CalculatePulseWeightValueForLEDReconfigureBug(pulseWeight));
            }
            else
            {
                ParameterWriter.Write(pulseWeight);
            }

            Result = ExecuteProcedure(Procedures.POLY_LED_RECONFIGURE, ParameterStream.ToArray(), out ProcResponse);

            return(Result);
        }
コード例 #3
0
        /// <summary>
        /// Checks to see if the item matches and then creates a ProgramValidationItem if it does not.
        /// </summary>
        /// <param name="item">The item to validate</param>
        /// <param name="meterTables">The table structure for the meter.</param>
        /// <param name="programTables">The table structure for the program.</param>
        /// <returns>Returns the ProgramValidationItem for the value if the items do not match, and null if the values match.</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 05/23/07 RCG	8.10.05		   Created
        // 03/26/12 AF  2.53.52 196102 Added the missing LED pulse weights
        // 04/19/12 jrf 2.53.56 195674 Modified to only check legacy voltage monitoring items when config is pre-Lithium.
        // 12/18/13 jrf 3.50.16 TQ9560 Refactored retreival of a CentronTables value into its own method.
        //
        protected override ProgramValidationItem ValidateItem(EDLValidationItem item, CentronTables meterTables, CentronTables programTables)
        {
            bool bItemsMatch         = false;
            bool bCheckedInBaseClass = false;

            string strDisplayMeterValue   = "";
            string strDisplayProgramValue = "";

            object objMeterValue;
            object objProgramValue;

            ProgramValidationItem InvalidItem = null;

            // Get the values
            objMeterValue = GetTableValue(item, meterTables);

            objProgramValue = GetTableValue(item, programTables);

            switch (item.Item)
            {
            case (long)CentronTblEnum.MFGTBL102_VH_LOW_THRESHOLD:
            case (long)CentronTblEnum.MFGTBL102_VH_HIGH_THRESHOLD:
            case (long)CentronTblEnum.MFGTBL102_RMS_VOLT_LOW_THRESHOLD:
            case (long)CentronTblEnum.MFGTBL102_RMS_VOLT_HIGH_THRESHOLD:
            {
                if (objMeterValue != null)
                {
                    strDisplayMeterValue = objMeterValue.ToString() + "%";
                }

                if (objProgramValue != null)
                {
                    strDisplayProgramValue = objProgramValue.ToString() + "%";
                }

                // Compare the values
                if (strDisplayMeterValue == strDisplayProgramValue)
                {
                    bItemsMatch = true;
                }
                else if (true == IsConfigVersionEqualOrGreaterThan(CE_VERSION_LITHIUM_3_9, programTables))
                {
                    //Ignoring comparison if values do not match and program's CE version is Lithium or greater
                    bItemsMatch = true;
                }

                break;
            }

            case (long)CentronTblEnum.MFGTBL0_BLINK_MISSING_PHASES:
            {
                bool bMeterValue;
                bool bProgramValue;

                if (objMeterValue != null)
                {
                    bMeterValue = (bool)objMeterValue;

                    if (bMeterValue)
                    {
                        strDisplayMeterValue = "Blink Phase Indicator";
                    }
                    else
                    {
                        strDisplayMeterValue = "Turn Off Phase Indicator";
                    }
                }

                if (objProgramValue != null)
                {
                    bProgramValue = (bool)objProgramValue;

                    if (bProgramValue)
                    {
                        strDisplayProgramValue = "Blink Phase Indicator";
                    }
                    else
                    {
                        strDisplayProgramValue = "Turn Off Phase Indicator";
                    }
                }

                if (strDisplayProgramValue == strDisplayMeterValue)
                {
                    bItemsMatch = true;
                }

                break;
            }

            case (long)CentronTblEnum.MFGTBL121_PULSE_OUTPUT1_QUANTITY_NORMAL:
            case (long)CentronTblEnum.MFGTBL121_PULSE_OUTPUT1_QUANTITY_TEST:
            {
                LEDQuantity MeterQuantity   = null;
                LEDQuantity ProgramQuantity = null;

                if (objMeterValue != null)
                {
                    MeterQuantity        = new LEDQuantity((uint)objMeterValue);
                    strDisplayMeterValue = MeterQuantity.Description;
                }

                if (objProgramValue != null)
                {
                    ProgramQuantity        = new LEDQuantity((uint)objProgramValue);
                    strDisplayProgramValue = ProgramQuantity.Description;
                }

                if (strDisplayMeterValue == strDisplayProgramValue)
                {
                    bItemsMatch = true;
                }

                break;
            }

            case (long)CentronTblEnum.MFGTBL121_FORM_1S_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_2S_C200_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_2S_C320_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_3S_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_4S_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_9S_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_12S_C200_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_12S_C320_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_16S_C200_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_16S_C320_PULSE_WEIGHT:
            case (long)CentronTblEnum.MFGTBL121_FORM_45S_PULSE_WEIGHT:
            {
                float fMeterValue   = 0.0f;
                float fProgramValue = 0.0f;

                if (objMeterValue != null)
                {
                    fMeterValue          = (ushort)objMeterValue * 0.025f;
                    strDisplayMeterValue = fMeterValue.ToString("F3", CultureInfo.CurrentCulture);
                }

                if (objProgramValue != null)
                {
                    fProgramValue          = (ushort)objProgramValue * 0.025f;
                    strDisplayProgramValue = fProgramValue.ToString("F3", CultureInfo.CurrentCulture);
                }

                if (fMeterValue == fProgramValue)
                {
                    bItemsMatch = true;
                }

                break;
            }

            default:
            {
                InvalidItem         = base.ValidateItem(item, meterTables, programTables);
                bCheckedInBaseClass = true;
                break;
            }
            }

            if (bItemsMatch == false && bCheckedInBaseClass == false)
            {
                // There is a mismatch so add the item.
                InvalidItem = new ProgramValidationItem(item.Category, item.Name, strDisplayProgramValue, strDisplayMeterValue);
            }

            return(InvalidItem);
        }