/// <summary> /// Reads the Max Demand LID and set the value into the Demand Measurement /// </summary> /// <exception cref="PSEMException">Exception on read</exception> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 09/22/06 KRC 7.36 Created // private void ReadTOUMaxDemand() { PSEMResponse PSEMResult = PSEMResponse.Ok; byte[] Data = null; LID[] arLids = new LID[m_uiTOURates]; if (m_uiTOURates > 0) { arLids = BuildDemandTOULIDArray(TOUBaseMaxDemandLID); // Retrieve TOU Demand LIDs PSEMResult = m_ANSIDevice.m_lidRetriever.RetrieveMulitpleLIDs(arLids, out Data); if (PSEMResponse.Ok == PSEMResult) { for (uint uiCount = 0; uiCount < m_uiTOURates; uiCount++) { // Demand Values are stored in the meter as Singles, but we are going // to deal with all data as double m_TOUMaxDemandMeasurements.Add(new DemandMeasurement( (double)m_ANSIDevice.m_lidRetriever.DataReader.ReadSingle(), arLids[uiCount].lidDescription)); } } else { throw new PSEMException(PSEMException.PSEMCommands.PSEM_READ, PSEMResult, "Error Reading TOU Demand Quantities; Base LID = " + TOUBaseMaxDemandLID.ToString()); } } }
/// <summary> /// Reads the Max Demand LID and set the value into the Demand Measurement /// </summary> /// <exception cref="PSEMException">Exception on read</exception> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 09/27/06 KRC 7.35 Created // 05/15/08 mrj 1.50.25 Bug itron00107508, set date to UTC // private void ReadTOOTotalMaxDemand() { PSEMResponse PSEMResult = PSEMResponse.Ok; byte[] Data = null; uint uiMeterSeconds; DateTime dtTOODemand = m_ANSIDevice.UTCMeterReferenceTime; LID TOOMaxDemandLID = m_ANSIDevice.CreateLID((TotalMaxDemandLID.lidValue & (uint)DefinedLIDs.WhichDemandFormat.WHICH_FORMAT_MASK_OUT) | (uint)DefinedLIDs.WhichDemandFormat.TOO_DATA); PSEMResult = m_ANSIDevice.m_lidRetriever.RetrieveLID(TOOMaxDemandLID, out Data); if (PSEMResponse.Ok == PSEMResult) { uiMeterSeconds = m_ANSIDevice.m_lidRetriever.DataReader.ReadUInt32(); // Add the seconds to the reference time dtTOODemand = dtTOODemand.AddSeconds((double)uiMeterSeconds); // Covert the time to Local (if needed - Method checks firmware version) dtTOODemand = m_ANSIDevice.GetLocalDeviceTime(dtTOODemand); m_MaxDemandMeasurement.TimeOfOccurrence = dtTOODemand; } else { throw new PSEMException(PSEMException.PSEMCommands.PSEM_READ, PSEMResult, "Error Reading Time of Occurence Value; LID = " + TOOMaxDemandLID.ToString()); } }
/// <summary> /// Reads the TOU Energy LIDs and set the value into the Measurement List /// </summary> /// <exception cref="PSEMException">Exception on read</exception> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 09/22/06 KRC 7.35 Created // private void ReadTOUEnergy() { PSEMResponse PSEMResult = PSEMResponse.Ok; byte[] Data = null; LID[] arLids = new LID[m_uiTOURates]; if (m_uiTOURates > 0) { arLids = BuildEnergyTOULIDArray(TOUBaseEnergyLID); // Retrieve the TOU LID's PSEMResult = m_ANSIDevice.m_lidRetriever.RetrieveMulitpleLIDs(arLids, out Data); if (PSEMResponse.Ok == PSEMResult) { for (uint uiCount = 0; uiCount < m_uiTOURates; uiCount++) { // This adds the value and the Description at the same time. m_TOUEnergyMeasurements.Add(new Measurement( m_ANSIDevice.m_lidRetriever.DataReader.ReadDouble(), arLids[uiCount].lidDescription)); } } else { throw new PSEMException(PSEMException.PSEMCommands.PSEM_READ, PSEMResult, "Error Reading TOU Energy Quantities; Base LID = " + TOUBaseEnergyLID.ToString()); } } }
/* private void GetRecords() * { * cmd = new SqlCommand("select * from Lec_details", con); * DataTable dt = new DataTable(); * * con.Open(); * * SqlDataReader sdr = cmd.ExecuteReader(); * dt.Load(sdr); * con.Close(); * * dataGridView1.DataSource = dt; * }*/ private void button2_Click(object sender, EventArgs e) { sql = "delete from Lec_details where LecturerID = @LecturerID "; con.Open(); cmd = new SqlCommand(sql, con); state(); cmd.Parameters.AddWithValue("@LecturerID", LID.Text); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Data Delete Successfully!!"); Showdata(); lvl.SelectedIndex = -1; center.SelectedIndex = -1; lecName.Clear(); LID.Clear(); faculty.SelectedIndex = -1; depart.SelectedIndex = -1; building.SelectedIndex = -1; }
/// <summary> /// This method does the work of writing a lid to table 2049 and reading /// the results from table 2050. /// </summary> /// <remarks> /// It is up to the calling method to translate the data. This method /// always sets the mode to DataOnly. /// /// Also, it is up to the calling method to perform the PSEM wait. /// </remarks> /// <param name="lid">The requested LID</param> /// <param name="eMode">Request Mode</param> /// <param name="data">The data returned from the device</param> /// <returns>PSEMResponse returned from the device</returns> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 05/23/06 mrj 7.30.00 N/A Created /// 09/27/06 KRC 7.35.00 N/A Add RequestMode /// public PSEMResponse RetrieveLID(LID lid, RequestMode eMode, out byte[] data) { LID[] lids = new LID[1]; lids[0] = lid; return(RetrieveMulitpleLIDs(lids, eMode, out data)); }
/// <summary> /// Gets a LID value for the specified rate. /// </summary> /// <param name="originalLID">The original LID that should be changed.</param> /// <param name="iRate">The rate to change to (0 = A, 1 = B, etc)</param> /// <returns>The resulting LID</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 05/18/09 RCG 2.20.05 Created private LID GetDemandLIDForRate(LID originalLID, int iRate) { uint uiNewLIDNumber; // Clear the current rate value; uiNewLIDNumber = originalLID.lidValue & ~(uint)DefinedLIDs.TOU_Data.TOU_DATA_MASK; // Set the new value switch (iRate) { case 0: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_A; break; } case 1: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_B; break; } case 2: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_C; break; } case 3: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_D; break; } case 4: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_E; break; } case 5: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_F; break; } case 6: { uiNewLIDNumber |= (uint)DefinedLIDs.TOU_Data.RATE_G; break; } } return(CreateLID(uiNewLIDNumber)); }
/// <summary> /// Write LID /// </summary> /// <param name="lid">The Lid to Write</param> /// <param name="fltValue">The float value to write to the meter</param> /// <returns>PSEMResponse</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/05/06 KRC 8.00.14 N/A Created // public PSEMResponse WriteLID(LID lid, Single fltValue) { byte[] Data = new byte[LID_LENGTH + sizeof(float)]; Data.Initialize(); MemoryStream DataStream = new MemoryStream(Data); PSEMBinaryWriter DataWriter = new PSEMBinaryWriter(DataStream); DataWriter.Write(lid.lidValue); DataWriter.Write(fltValue); PSEMResponse Result = m_PSEM.FullWrite(LID_WRITE_TABLE, Data); return(Result); }
/// <summary> /// Write LID /// </summary> /// <param name="lid">The Lid to Write</param> /// <param name="dblValue">The double value to write to the meter</param> /// <returns>PSEMResponse</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/05/06 KRC 8.00.14 N/A Created // public PSEMResponse WriteLID(LID lid, Double dblValue) { byte[] Data = new byte[LID_LENGTH + sizeof(double)]; Data.Initialize(); MemoryStream DataStream = new MemoryStream(Data); PSEMBinaryWriter DataWriter = new PSEMBinaryWriter(DataStream); DataStream.Position = 0; DataWriter.Write(lid.lidValue); DataWriter.Write(dblValue); PSEMResponse Result = m_PSEM.FullWrite(LID_WRITE_TABLE, DataStream.ToArray()); return(Result); }
/// <summary> /// Builds the TOU TOO LID Array to be retrieved /// </summary> /// <param name="BaseTOULID">Base LID to append Rates to</param> /// <returns>LID[] - Array of TOU LIDs to retrieve</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 09/27/06 KRC 7.35.00 N/A Created // private LID[] BuildTOOTOULIDArray(LID BaseTOULID) { uint[] auiRates = { (uint)DefinedLIDs.TOU_Data.RATE_A, (uint)DefinedLIDs.TOU_Data.RATE_B, (uint)DefinedLIDs.TOU_Data.RATE_C, (uint)DefinedLIDs.TOU_Data.RATE_D, (uint)DefinedLIDs.TOU_Data.RATE_E, (uint)DefinedLIDs.TOU_Data.RATE_F, (uint)DefinedLIDs.TOU_Data.RATE_G }; LID[] arLids = new LID[m_uiTOURates]; for (uint uiIndex = 0; uiIndex < m_uiTOURates; uiIndex++) { arLids[uiIndex] = m_ANSIDevice.CreateLID(BaseTOULID.lidValue | auiRates[uiIndex]); } return(arLids); }
/// <summary> /// Reads the TOO for the TOU Demand LIDs and set the value into the Demand Measurement /// </summary> /// <exception cref="PSEMException">Exception on read</exception> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 09/27/06 KRC 7.36 Created // 12/01/06 jrf 8.00 The dtTOOTOUDemand must be reset to the // MeterReferenceTime for each TOU rate. // 05/15/08 mrj 1.50.25 Bug itron00107508, set date to UTC // private void ReadTOOTOUMaxDemand() { PSEMResponse PSEMResult = PSEMResponse.Ok; byte[] Data = null; LID[] arLids = new LID[m_uiTOURates]; DateTime dtTOOTOUDemand = m_ANSIDevice.UTCMeterReferenceTime; uint uiMeterSeconds = 0; if (true == m_ANSIDevice.ValidateDemand(TotalMaxDemandLID) && m_uiTOURates > 0) { // Calculate the Base LID for the TOO of the TOU LID LID TOOTOUBaseMaxDemandLID = m_ANSIDevice.CreateLID((TOUBaseMaxDemandLID.lidValue & (uint)DefinedLIDs.WhichDemandFormat.WHICH_FORMAT_MASK_OUT) | (uint)DefinedLIDs.WhichDemandFormat.TOO_DATA); arLids = BuildTOOTOULIDArray(TOOTOUBaseMaxDemandLID); // Retrieve TOU Demand LIDs PSEMResult = m_ANSIDevice.m_lidRetriever.RetrieveMulitpleLIDs(arLids, out Data); PSEMBinaryReader TOOValues = m_ANSIDevice.m_lidRetriever.DataReader; if (PSEMResponse.Ok == PSEMResult) { for (uint uiCount = 0; uiCount < m_uiTOURates; uiCount++) { // Reset to reference time dtTOOTOUDemand = m_ANSIDevice.UTCMeterReferenceTime; uiMeterSeconds = TOOValues.ReadUInt32(); // Add the seconds to the reference time dtTOOTOUDemand = dtTOOTOUDemand.AddSeconds((double)uiMeterSeconds); // Now convert to Local Time (Handles cases where Time is in UTC) dtTOOTOUDemand = m_ANSIDevice.GetLocalDeviceTime(dtTOOTOUDemand); m_TOUMaxDemandMeasurements[(int)uiCount].TimeOfOccurrence = dtTOOTOUDemand; } } else { throw new PSEMException(PSEMException.PSEMCommands.PSEM_READ, PSEMResult, "Error Reading TOU TOO Values; Base LID = " + TOOTOUBaseMaxDemandLID.ToString()); } } }
/// <summary> /// Gets the text string for the specified Bubble Up LID /// </summary> /// <param name="uiLID">The bubble-up LID to get the string for.</param> /// <returns>The string associated with the LID value.</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 03/05/12 JJJ 2.60.xx N/A Created // 02/13/14 jrf 3.50.32 442686 Improved to use LID class to decipher numeric LID. public static string GetBubbleUpLIDString(UInt32 uiLID) { string strLid = null; try { LID BubbleUpLID = new LID(uiLID); strLid = BubbleUpLID.lidDescription; } catch { strLid = "Unknown Quantity"; } return(strLid); }
/// <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; }
/// <summary> /// Retrieve LID /// </summary> /// <param name="lid">The LID to retrieve</param> /// <param name="eMode">The request mode</param> /// <param name="objValue">an object containing the data associated with the LID</param> /// <returns>PSEMResponse</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/05/06 KRC 7.36.00 N/A Created // public PSEMResponse RetrieveLID(LID lid, RequestMode eMode, out object objValue) { PSEMResponse Result; objValue = null; LID[] lids = new LID[1]; lids[0] = lid; List <object> objValues; Result = RetrieveMulitpleLIDs(lids, eMode, out objValues); if (PSEMResponse.Ok == Result) { objValue = objValues[0]; } return(Result); }
private void button1_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled) && lecName.Text == "" || lvl.Text == "" || LID.Text == "" || center.Text == "" || faculty.Text == "" || depart.Text == "" || building.Text == "") { MessageBox.Show("Please fill out the Empty Field(s)", "Unable to Submit", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } else { sql = "update Lec_details set Lecturer_Name = @Lecturer_Name,Level = @Level,LecturerID = @LecturerID,Center = @Center,Faculty = @Faculty,Department = @Department,Building = @Building where LecturerID = @LecturerID "; con.Open(); cmd = new SqlCommand(sql, con); state(); cmd.Parameters.AddWithValue("@Lecturer_Name", lecName.Text); cmd.Parameters.AddWithValue("@Level", lvl.Text); cmd.Parameters.AddWithValue("@LecturerID", LID.Text); cmd.Parameters.AddWithValue("@Center", center.Text); cmd.Parameters.AddWithValue("@Faculty", faculty.Text); cmd.Parameters.AddWithValue("@Department", depart.Text); cmd.Parameters.AddWithValue("@Building", building.Text); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Data Update Successfully!!"); Showdata(); lecName.Clear(); lvl.SelectedIndex = -1; LID.Clear(); center.SelectedIndex = -1; faculty.SelectedIndex = -1; depart.SelectedIndex = -1; building.SelectedIndex = -1; } }
/// <summary> /// Determines the channel name for each of the channels. /// </summary> /// <param name="setDataSelection">The data set to determine the names for.</param> /// <returns>The list of channel names.</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 10/03/08 RCG 2.00.00 N/A Created // 12/12/11 RCG 2.53.20 Modified for Extended LP and IP support private List <string> DetermineChannelNames(LPSetDataSelection setDataSelection) { List <string> ChannelNames = new List <string>(); foreach (uint CurrentLID in setDataSelection.SourceLIDs) { uint ModifiedLID = CurrentLID; if ((CurrentLID & (uint)DefinedLIDs.BaseLIDs.COMPONENT_MASK) == (uint)DefinedLIDs.BaseLIDs.ENERGY_DATA) { // The source LID numbers are for the raw values we need them to be secondary for this // to work correctly. ModifiedLID = (CurrentLID & (uint)DefinedLIDs.WhichEnergyFormat.WHICH_FORMAT_MASK_OUT) | (uint)DefinedLIDs.WhichEnergyFormat.SECONDARY_DATA; } LID ChannelLid = CreateLID(ModifiedLID); ChannelNames.Add(ChannelLid.lidDescription); } return(ChannelNames); }
/// <summary> /// Gets the Demand Reset Coincident Values for the specified Demand Reset. /// </summary> /// <param name="uiIndex">The index of the Demand Reset to get.</param> /// <returns>The list of coincidents.</returns> /// protected override List <Quantity> DRCoincidentValues(uint uiIndex) { List <Quantity> Coincidents = new List <Quantity>(); if (uiIndex == 0) { for (int iIndex = 0; iIndex < Table21.NumberOfCoincidentValues; iIndex++) { byte bySelection = Table22.CoincidentSelection[iIndex]; byte byDemandSelection = Table22.CoincidentDemandAssocations[iIndex]; LID CoincidentLID = CreateLID(Table14.SourceIDs[bySelection]); Quantity CoincQuantity = new Quantity(CoincidentLID.lidDescription); RegisterDataRecord DataRecord = Table25.DemandResetRegisterData; // Add the total values CoincQuantity.TotalMaxDemand = new DemandMeasurement(DataRecord.TotalDataBlock.Coincidents[iIndex].Coincidents[0], CoincidentLID.lidDescription); CoincQuantity.TotalMaxDemand.TimeOfOccurrence = DataRecord.TotalDataBlock.Demands[byDemandSelection].TimeOfOccurances[0]; if (Table21.NumberOfTiers > 0) { CoincQuantity.TOUMaxDemand = new List <DemandMeasurement>(); // Add the rate values for (int iRateIndex = 0; iRateIndex < Table21.NumberOfTiers; iRateIndex++) { LID RateLID = GetDemandLIDForRate(CoincidentLID, iRateIndex); CoincQuantity.TOUMaxDemand.Add(new DemandMeasurement(DataRecord.TierDataBlocks[iRateIndex].Coincidents[iIndex].Coincidents[0], RateLID.lidDescription)); CoincQuantity.TOUMaxDemand[iRateIndex].TimeOfOccurrence = DataRecord.TierDataBlocks[iRateIndex].Demands[byDemandSelection].TimeOfOccurances[0]; } } Coincidents.Add(CoincQuantity); } } return(Coincidents); }
private void CallEwsWithRetries(LID lid, Func <BaseResponseMessageType> delegateEwsCall, Func <ResponseMessageType, int, bool> responseMessageProcessor, Func <ResponseMessageType, int, bool> responseErrorProcessor) { ExDateTime t = ExDateTime.UtcNow.Add((this.CallTimeout < EwsAuditClient.TotalRetryTimeWindow) ? EwsAuditClient.TotalRetryTimeWindow : this.CallTimeout); bool flag = false; Exception ex = null; int num = -1; do { if (flag) { this.WaitBeforeRetry(num); } ex = null; flag = false; num++; try { DiagnosticContext.TraceDword((LID)57532U, (uint)num); BaseResponseMessageType baseResponseMessageType; using (DiagnosticContext.TraceLatency(lid)) { baseResponseMessageType = delegateEwsCall(); } int i = 0; while (i < baseResponseMessageType.ResponseMessages.Items.Length) { ResponseMessageType responseMessageType = baseResponseMessageType.ResponseMessages.Items[i]; if (responseMessageProcessor != null && responseMessageProcessor(responseMessageType, i)) { DiagnosticContext.TraceLocation((LID)32956U); if (this.IsTraceEnabled(TraceType.DebugTrace)) { this.Tracer.TraceDebug(0L, "Successfully executed EWS call"); break; } break; } else { if (responseMessageType.ResponseClass == ResponseClassType.Error) { DiagnosticContext.TraceDwordAndString((LID)33100U, (uint)responseMessageType.ResponseCode, responseMessageType.ResponseCode.ToString()); if (responseMessageType.ResponseCode == ResponseCodeType.ErrorCrossSiteRequest) { if (this.IsTraceEnabled(TraceType.DebugTrace)) { this.Tracer.TraceDebug(0L, "Crosssite request error , recreate exchange binding and reset the url caches"); } flag = true; this.RefreshUrl(true); break; } if (!EwsAuditClient.TransientServiceErrors.Contains(responseMessageType.ResponseCode)) { if (responseErrorProcessor == null || !responseErrorProcessor(responseMessageType, i)) { if (this.IsTraceEnabled(TraceType.ErrorTrace)) { this.Tracer.TraceError <string, string, string>(0L, "Permanent error encountered: {0}, {1}, {2}", responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString()); } DiagnosticContext.TraceLocation((LID)65212U); throw new AuditLogServiceException(responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString()); } DiagnosticContext.TraceLocation((LID)48828U); if (this.IsTraceEnabled(TraceType.DebugTrace)) { this.Tracer.TraceDebug(0L, "Error encountered, but was handled by error callback: {0}, {1}, {2}, response index={3}", new object[] { responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString(), i }); } } else { DiagnosticContext.TraceLocation((LID)40636U); flag = true; ex = new AuditLogServiceException(responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString()); if (this.IsTraceEnabled(TraceType.DebugTrace)) { this.Tracer.TraceDebug(0L, "Transient error encountered, will attempt to retry, Exception: " + ex); } } } i++; } } } catch (CommunicationException ex2) { DiagnosticContext.TraceLocation((LID)57020U); ex = ex2; flag = true; } catch (TimeoutException ex3) { DiagnosticContext.TraceLocation((LID)44732U); ex = ex3; flag = false; } catch (SoapException ex4) { DiagnosticContext.TraceLocation((LID)61116U); ex = ex4; flag = false; } catch (WebException ex5) { DiagnosticContext.TraceLocation((LID)36540U); ex = ex5; flag = false; } catch (IOException ex6) { DiagnosticContext.TraceLocation((LID)52924U); ex = ex6; flag = false; } catch (InvalidOperationException ex7) { DiagnosticContext.TraceLocation((LID)46780U); ex = ex7; flag = false; } catch (LocalizedException ex8) { DiagnosticContext.TraceLocation((LID)63164U); ex = ex8; flag = false; } }while (flag && t > ExDateTime.UtcNow); if (ex != null) { if (this.IsTraceEnabled(TraceType.ErrorTrace)) { this.Tracer.TraceError <int, Exception>(0L, "Failed to make EWS call to audit log, Total attempts made {0}, Exception: {1} ", num, ex); } DiagnosticContext.TraceLocation((LID)38588U); throw this.GetSpecificException(ex); } }
/// <summary> /// Constructor /// </summary> /// <param name="LID"></param> /// <param name="Qualifier"></param> public SR2InstQuantity(uint LID, byte Qualifier) { m_LID = new LID(LID); m_Qualifier = Qualifier; }
/// <summary> /// Default Constructor /// </summary> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 10/02/06 RCG 7.40.00 N/A Created public ANSILoadProfileChannel() { m_QuantityLID = new LID(0); }
/// <summary> /// Reads the LIDs and fills in the measurements for the instantaneous /// quantity. /// </summary> /// <exception cref="Exception">Thrown if Read fails</exception>\ /// <remarks> /// </remarks> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 02/14/07 mrj 8.00.12 Created // 06/09/11 jrf 2.51.10 173353 Making changes required due to update to Instantaneous Quantity class. // internal void ReadQuantity() { PSEMResponse Result; List <object> lstQuantityData = null; LID[] QuantityLIDs; //Check to see if this quantity supports the aggregate quantity if (m_AggregateLID == null) { QuantityLIDs = new LID[3]; } else { QuantityLIDs = new LID[4]; QuantityLIDs[3] = m_AggregateLID; } //Set the phase quantity to the array QuantityLIDs[0] = m_PhaseALID; QuantityLIDs[1] = m_PhaseBLID; QuantityLIDs[2] = m_PhaseCLID; //Read the LIDs Result = m_ANSIDevice.m_lidRetriever.RetrieveMulitpleLIDs(QuantityLIDs, out lstQuantityData); if (Result == PSEMResponse.Ok && null != lstQuantityData && lstQuantityData.Count >= 3) { MostRecentMeasurementsPerPhase = new List <DemandMeasurement>(); if (TypeCode.Single == m_PhaseALID.lidType) { //Create the measurements with the data. Adding phases A, B and C. MostRecentMeasurementsPerPhase.Add(new DemandMeasurement((double)((float)lstQuantityData[0]), m_PhaseALID.lidDescription)); MostRecentMeasurementsPerPhase.Add(new DemandMeasurement((double)((float)lstQuantityData[1]), m_PhaseBLID.lidDescription)); MostRecentMeasurementsPerPhase.Add(new DemandMeasurement((double)((float)lstQuantityData[2]), m_PhaseCLID.lidDescription)); if (lstQuantityData.Count == 4) { //Adding the aggregate value MostRecentMeasurement = new DemandMeasurement((double)((float)lstQuantityData[3]), m_AggregateLID.lidDescription); } } else if (TypeCode.Double == m_PhaseALID.lidType) { //Create the measurements with the data. Adding phases A, B and C. MostRecentMeasurementsPerPhase.Add(new DemandMeasurement((double)lstQuantityData[0], m_PhaseALID.lidDescription)); MostRecentMeasurementsPerPhase.Add(new DemandMeasurement((double)lstQuantityData[1], m_PhaseBLID.lidDescription)); MostRecentMeasurementsPerPhase.Add(new DemandMeasurement((double)lstQuantityData[2], m_PhaseCLID.lidDescription)); if (lstQuantityData.Count == 4) { //Adding the aggregate value MostRecentMeasurement = new DemandMeasurement((double)lstQuantityData[3], m_AggregateLID.lidDescription); } } } else { throw (new PSEMException(PSEMException.PSEMCommands.PSEM_READ, Result, "Error reading instantaneous quantity")); } }
/// <summary> /// Constructor for Display Item that can be called while reading Table 2048 /// </summary> /// <param name="Lid">The LID for the given Display Item</param> /// <param name="strDisplayID">The Display ID for the given Display Item</param> /// <param name="usFormat">The Format Code for the given display item</param> /// <param name="byDim">The Dimension of the given display item</param> /// <param name="FWVersion">The Firmware Version of the meter we are talking to</param> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 03/29/07 KRC 8.00.22 N/A Adding support for SENTINEL specific display item behavior // internal SENTINELDisplayItem(LID Lid, string strDisplayID, ushort usFormat, byte byDim, float FWVersion) : base(Lid, strDisplayID, usFormat, byDim) { m_FWVersion = FWVersion; }
/// <summary> /// Gets the list of Energies required by the program. /// </summary> /// <param name="programFile">The path to the program file</param> /// <returns>The list of required energies</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 03/22/11 RCG 2.50.12 N/A Created // 10/15/14 jrf 4.00.73 539220 Made method public for use in QC Tool. public override List <BaseEnergies> GetRequiredEnergiesFromProgram(string programFile) { List <BaseEnergies> RequiredEnergies = new List <BaseEnergies>(); XmlReader Reader; XmlReaderSettings ReaderSettings = new XmlReaderSettings(); // Create the CentronTables object to read the file ReaderSettings.ConformanceLevel = ConformanceLevel.Fragment; ReaderSettings.IgnoreWhitespace = true; ReaderSettings.IgnoreComments = true; ReaderSettings.CheckCharacters = false; Reader = XmlReader.Create(programFile, ReaderSettings); CentronTables ProgramTables = new CentronTables(); ProgramTables.LoadEDLFile(Reader); // Get the energy configuration for (int iIndex = 0; iIndex < NumberOfSupportedEnergies; iIndex++) { object objValue = null; int[] Indicies = new int[] { iIndex }; if (ProgramTables.IsCached((long)CentronTblEnum.MFGTBL0_ENERGY_LID, Indicies)) { ProgramTables.GetValue(CentronTblEnum.MFGTBL0_ENERGY_LID, Indicies, out objValue); // We need to add the Secondary Energy Base value to the byte returned to get the // actual LID value LID EnergyLid = CreateLID(SEC_ENERGY_LID_BASE + (byte)objValue); switch (EnergyLid.lidQuantity) { case DefinedLIDs.WhichOneEnergyDemand.WH_DELIVERED: { if (RequiredEnergies.Contains(BaseEnergies.PolyWhDel) == false) { RequiredEnergies.Add(BaseEnergies.PolyWhDel); } break; } case DefinedLIDs.WhichOneEnergyDemand.WH_RECEIVED: { if (RequiredEnergies.Contains(BaseEnergies.PolyWhRec) == false) { RequiredEnergies.Add(BaseEnergies.PolyWhRec); } break; } case DefinedLIDs.WhichOneEnergyDemand.WH_UNI: case DefinedLIDs.WhichOneEnergyDemand.WH_NET: { if (RequiredEnergies.Contains(BaseEnergies.PolyWhDel) == false) { RequiredEnergies.Add(BaseEnergies.PolyWhDel); } if (RequiredEnergies.Contains(BaseEnergies.PolyWhRec) == false) { RequiredEnergies.Add(BaseEnergies.PolyWhRec); } break; } case DefinedLIDs.WhichOneEnergyDemand.VAH_DEL_ARITH: { if (RequiredEnergies.Contains(BaseEnergies.PolyVAhArithDel) == false) { RequiredEnergies.Add(BaseEnergies.PolyVAhArithDel); } break; } case DefinedLIDs.WhichOneEnergyDemand.VAH_REC_ARITH: { if (RequiredEnergies.Contains(BaseEnergies.PolyVAhArithRec) == false) { RequiredEnergies.Add(BaseEnergies.PolyVAhArithRec); } break; } case DefinedLIDs.WhichOneEnergyDemand.VAH_DEL_VECT: { if (RequiredEnergies.Contains(BaseEnergies.PolyVAhVectDel) == false) { RequiredEnergies.Add(BaseEnergies.PolyVAhVectDel); } break; } case DefinedLIDs.WhichOneEnergyDemand.VAH_REC_VECT: { if (RequiredEnergies.Contains(BaseEnergies.PolyVAhVectRec) == false) { RequiredEnergies.Add(BaseEnergies.PolyVAhVectRec); } break; } case DefinedLIDs.WhichOneEnergyDemand.VAH_LAG: { if (RequiredEnergies.Contains(BaseEnergies.PolyVAhLag) == false) { RequiredEnergies.Add(BaseEnergies.PolyVAhLag); } break; } case DefinedLIDs.WhichOneEnergyDemand.VARH_DEL: { if (RequiredEnergies.Contains(BaseEnergies.PolyVarhDel) == false) { RequiredEnergies.Add(BaseEnergies.PolyVarhDel); } break; } case DefinedLIDs.WhichOneEnergyDemand.VARH_REC: { if (RequiredEnergies.Contains(BaseEnergies.PolyVarhRec) == false) { RequiredEnergies.Add(BaseEnergies.PolyVarhRec); } break; } case DefinedLIDs.WhichOneEnergyDemand.VARH_NET: { if (RequiredEnergies.Contains(BaseEnergies.PolyVarhDel) == false) { RequiredEnergies.Add(BaseEnergies.PolyVarhDel); } if (RequiredEnergies.Contains(BaseEnergies.PolyVarhRec) == false) { RequiredEnergies.Add(BaseEnergies.PolyVarhRec); } break; } case DefinedLIDs.WhichOneEnergyDemand.VARH_Q1: { if (RequiredEnergies.Contains(BaseEnergies.PolyVarhQ1) == false) { RequiredEnergies.Add(BaseEnergies.PolyVarhQ1); } break; } case DefinedLIDs.WhichOneEnergyDemand.VARH_Q4: { if (RequiredEnergies.Contains(BaseEnergies.PolyVarhQ4) == false) { RequiredEnergies.Add(BaseEnergies.PolyVarhQ4); } break; } } } } ProgramTables = null; Reader.Close(); return(RequiredEnergies); }
/// <summary> /// Constructor /// </summary> /// <param name="quantity">The configure quantity</param> /// <param name="qualifier">The qualifier used to determine if the quantity should be listed</param> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------- ------------------------------------------- // 01/27/12 RCG 2.53.35 TRQ3448 Created public ExtendedSelfReadConfigRecord(LID quantity, ExtendedSelfReadQualifier qualifier) { m_Quantity = quantity; m_Qualifier = qualifier; }
/// <summary> /// Constructor for Display Item that can be called while reading Table 2048 /// </summary> /// <param name="Lid">The LID for the given Display Item</param> /// <param name="strDisplayID">The Display ID for the given Display Item</param> /// <param name="usFormat">The Format Code for the given display item</param> /// <param name="byDim">The Dimension of the given display item</param> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- -------- ------ --------------------------------------- // 04/02/08 RCG 10.00.00 Created public OpenWayDisplayItem(LID Lid, string strDisplayID, ushort usFormat, byte byDim) : base(Lid, strDisplayID, usFormat, byDim) { }
/// <summary> /// Retrieve LID /// </summary> /// <param name="lid">The Lid to Retrieve</param> /// <param name="objValue">an object containing the data associated with the LID</param> /// <returns>PSEMResponse</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/05/06 KRC 7.36.00 N/A Created // public PSEMResponse RetrieveLID(LID lid, out object objValue) { return(RetrieveLID(lid, RequestMode.DataOnly, out objValue)); }
/// <summary> /// Constructor /// </summary> /// <param name="uiLID">The LID of measure.</param> /// <param name="dblValue">The value measured.</param> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 01/09/12 jrf 2.53.27 TREQ2904 Created // public ExtendedCurrentEntryRecord(UInt32 uiLID, double dblValue) { m_LID = new LID(uiLID); m_dlbValue = dblValue; }