/// <summary> /// Gets the channel object with the selected channel number /// </summary> /// <param name="ChannelNumber">The number of the channel to get</param> /// <returns> /// The ANSILoadProfileChannel object of the selected channel if it is in use, or null /// if the channel is not in use. /// </returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 10/02/06 RCG 7.40.00 N/A Created public ANSILoadProfileChannel GetChannel(int ChannelNumber) { ANSILoadProfileChannel SelectedChannel = null; foreach (ANSILoadProfileChannel Channel in Channels) { if (Channel.ChannelNumber == ChannelNumber) { SelectedChannel = Channel; } } return SelectedChannel; }
/// <summary> /// Reads the status LIDs from the meter and creates the channel objects /// </summary> /// <returns>The PSEM response code.</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 10/02/06 RCG 7.40.00 N/A Created // 04/10/07 KRC 8.00.27 2864 Fixing LID read to get Pulse Weights supported by all versions private PSEMResponse ReadChannelStatus() { PSEMResponse Result; int iTotalChannels = NumberOfChannels; LID[] PulseWidthLIDs = new LID[iTotalChannels]; LID[] QuantityLIDs = new LID[iTotalChannels]; List<object> lstObjPulseWidthData = null; List<object> listObjQuantityData = null; m_ChannelsList.Clear(); // Set up the LIDs for reading for (uint uiChannel = 0; uiChannel < iTotalChannels; uiChannel++) { QuantityLIDs[uiChannel] = new LID(m_LIDs.LP_CHAN_1_QUANTITY.lidValue + uiChannel); PulseWidthLIDs[uiChannel] = new LID(m_LIDs.LP_CHAN_1_INT_PULSE_WT.lidValue + uiChannel); } // Read the LIDs Result = m_LIDRetriever.RetrieveMulitpleLIDs(QuantityLIDs, out listObjQuantityData); if (Result == PSEMResponse.Ok) { Result = m_LIDRetriever.RetrieveMulitpleLIDs(PulseWidthLIDs, out lstObjPulseWidthData); } if (Result == PSEMResponse.Ok) { // Create the Channel Status objects from the data for (int iChannel = 1; iChannel <= iTotalChannels; iChannel++) { ANSILoadProfileChannel ChannelStatus = new ANSILoadProfileChannel(); ChannelStatus.ChannelNumber = iChannel; ChannelStatus.QuantityLID = (UInt32)listObjQuantityData[iChannel - 1]; // We are getting the integer config value for the pulse weight, so we need to scale it to get the real value. ChannelStatus.PulseWeight = Convert.ToSingle(lstObjPulseWidthData[iChannel - 1], CultureInfo.InvariantCulture) * m_fltLPPulseWeightMultiplier; m_ChannelsList.Add(ChannelStatus); } m_bIsChannelStatusCached = true; } return Result; }