protected ConfigurationResult ConfigureExtendedSelfRead(AMIConfigureDevice ConfigureDevice) { ConfigurationResult Result = ConfigurationResult.SUCCESS; ConfigurationError ConfigError = ConfigurationError.GENERAL_ERROR; if (Table00.IsTableUsed(2265) && (Table00.DeviceClass.ToUpper().Equals(ITRD_DEVICE_CLASS) || Table00.DeviceClass.ToUpper().Equals(ITRE_DEVICE_CLASS) || Table00.DeviceClass.ToUpper().Equals(ITRF_DEVICE_CLASS) || Table00.DeviceClass.ToUpper().Equals(ITRJ_DEVICE_CLASS) || Table00.DeviceClass.ToUpper().Equals(ITRK_DEVICE_CLASS))) { ConfigError = ConfigureDevice.WriteTableByElementRange( CentronTblEnum.MfgTbl217SelfReadTwoLogicalIdentifier, new int[1] { 0 }, CentronTblEnum.MfgTbl217SelfReadTwoLogicalIdentifierQualifier, new int[1] { ConfigureDevice.GetFieldArrayLastIndex(CentronTblEnum.MfgTbl217SelfReadTwoLogicalIdentifierQualifier) }); } else { ConfigError = ConfigurationError.OPERATION_NOT_POSSIBLE; } // Translate to the ItronDevice ConfigurationResult error code since // the factory is using ConfigurationError and we do not want to always // rely on having the version in AMIConfiguration.dll Result = TranslateConfigError(ConfigError); return(Result); }
/// <summary> /// Configures the meter instrumentation profile config block /// with the specified program /// </summary> /// <param name="ConfigureDevice">AMIConfigureDevice object with the correct table set already loaded</param> /// <returns></returns> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 03/06/12 JKW Created - Lithium /// protected ConfigurationResult ConfigureInstrumentationProfile(AMIConfigureDevice ConfigureDevice) { ConfigurationResult Result = ConfigurationResult.SUCCESS; ConfigurationError ConfigError = ConfigurationError.GENERAL_ERROR; if (Table00.IsTableUsed(2265)) { ConfigError = ConfigureDevice.WriteTableByElementRange( CentronTblEnum.MfgTbl217InstrumentationProfileIntervalLength, null, CentronTblEnum.MfgTbl217InstrumentationProfilePulseWeightSetTwo, new int[1] { ConfigureDevice.GetFieldArrayLastIndex(CentronTblEnum.MfgTbl217InstrumentationProfilePulseWeightSetTwo) }); } else { ConfigError = ConfigurationError.OPERATION_NOT_POSSIBLE; } // Translate to the ItronDevice ConfigurationResult error code since // the factory is using ConfigurationError and we do not want to always // rely on having the version in AMIConfiguration.dll Result = TranslateConfigError(ConfigError); return(Result); }
/// <summary> /// Configures the meter instrumentation profile config block /// with the specified program /// </summary> /// <param name="sProgramName">The path to the program file</param> /// <param name="configItems"></param> /// <returns></returns> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 03/06/12 JKW Created - Lithium /// public ConfigurationResult PartialConfiguration(string sProgramName, BlocksForPartialConfiguration configItems) { ConfigurationResult Result = ConfigurationResult.SUCCESS; AMIConfigureDevice ConfigureDevice = new AMIConfigureDevice(m_PSEM); // Load the EDL file into the table set Result = TranslateConfigError(ConfigureDevice.LoadEDLFileToTableSet(sProgramName)); // check each flag within the enumeration reconfiguring the blocks specified if (Result == ConfigurationResult.SUCCESS && configItems.HasFlag(BlocksForPartialConfiguration.InstrumentationProfile)) { Result = ConfigureInstrumentationProfile(ConfigureDevice); } if (Result == ConfigurationResult.SUCCESS && configItems.HasFlag(BlocksForPartialConfiguration.ExtendedEnergyAndLoadProfile)) { Result = ConfigureNonBillingEnergyandLoadProfile(ConfigureDevice); } if (Result == ConfigurationResult.SUCCESS && configItems.HasFlag(BlocksForPartialConfiguration.ExtendedVoltageMonitoring)) { Result = ConfigureVoltageMonitoring(ConfigureDevice); } if (Result == ConfigurationResult.SUCCESS && configItems.HasFlag(BlocksForPartialConfiguration.ExtendedSelfRead)) { Result = ConfigureExtendedSelfRead(ConfigureDevice); } return(Result); }
protected ConfigurationResult ConfigureNonBillingEnergyandLoadProfile(AMIConfigureDevice ConfigureDevice) { ConfigurationResult Result = ConfigurationResult.SUCCESS; ConfigurationError ConfigError = ConfigurationError.GENERAL_ERROR; if (Table00.IsTableUsed(2265) && (Table00.DeviceClass.ToUpper().Equals(ITRE_DEVICE_CLASS) || Table00.DeviceClass.ToUpper().Equals(ITRF_DEVICE_CLASS)) || (Table00.DeviceClass.ToUpper().Equals(ITRK_DEVICE_CLASS))) { ConfigError = ConfigureDevice.WriteTableByElementRange( CentronTblEnum.MfgTbl217NonBillableEnergyId, new int[1] { 0 }, CentronTblEnum.MfgTbl217NonBillableEnergyId, new int[1] { ConfigureDevice.GetFieldArrayLastIndex(CentronTblEnum.MfgTbl217NonBillableEnergyId) }); if (ConfigError == ConfigurationError.SUCCESS) { ConfigError = ConfigureDevice.WriteTableByElementRange( CentronTblEnum.MfgTbl217NonBillingLoadProfileIntervalLength, null, CentronTblEnum.MfgTbl217NonBillingLoadProfilePulseWeightSetTwo, new int[1] { ConfigureDevice.GetFieldArrayLastIndex(CentronTblEnum.MfgTbl217NonBillingLoadProfilePulseWeightSetTwo) }); } } else { ConfigError = ConfigurationError.OPERATION_NOT_POSSIBLE; } // Translate to the ItronDevice ConfigurationResult error code since // the factory is using ConfigurationError and we do not want to always // rely on having the version in AMIConfiguration.dll Result = TranslateConfigError(ConfigError); return(Result); }
/// <summary> /// Configures the meter VM tables with the specified program. Reads /// table 0 to see which VM tables are supported /// (101, 102, 105, 106 = Lithium, 101, 102 = pre-Lithium) /// </summary> /// <param name="ConfigureDevice">AMIConfigureDevice object with the correct table set already loaded</param> /// <returns></returns> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 03/06/12 JKW Created - Lithium /// protected ConfigurationResult ConfigureVoltageMonitoring(AMIConfigureDevice ConfigureDevice) { ConfigurationResult Result = ConfigurationResult.SUCCESS; ConfigurationError ConfigError = ConfigurationError.GENERAL_ERROR; ConfigureDevice.IsCanadian = IsCanadian; // pre-Lithium only uses 2149 + 2150 if (Table00.IsTableUsed(2149) && Table00.IsTableUsed(2150)) { ConfigError = ConfigureDevice.WriteTable(2149); if (ConfigError == ConfigurationError.SUCCESS) { ConfigError = ConfigureDevice.WriteTable(2150); } } // Lithium uses 2153 + 2154 if (Table00.IsTableUsed(2153) && Table00.IsTableUsed(2154)) { ConfigError = ConfigureDevice.WriteTable(2153); if (ConfigError == ConfigurationError.SUCCESS) { ConfigError = ConfigureDevice.WriteTable(2154); } } // Translate to the ItronDevice ConfigurationResult error code since // the factory is using ConfigurationError and we do not want to always // rely on having the version in AMIConfiguration.dll Result = TranslateConfigError(ConfigError); return(Result); }
public ConfigurationError Logon(ushort usUserID, String strUserName, string strPassword, string strSerialPort, uint uiBaudRate) { PSEMResponse PSEMResult = new PSEMResponse(); // Set up the serial port if (!m_SerialPort.IsOpen) { try { // Open the Serial Port m_SerialPort.OpenPort(strSerialPort); } #region SerialPort Open catch statements catch (InvalidOperationException) { // The port is already open return(ConfigurationError.UNABLE_TO_OPEN_PORT); } catch (ArgumentException) { // The port name is invalid return(ConfigurationError.UNABLE_TO_OPEN_PORT); } catch (IOException) { // The port is in an invalid state return(ConfigurationError.UNABLE_TO_OPEN_PORT); } catch (UnauthorizedAccessException) { // Port access was denied return(ConfigurationError.UNABLE_TO_OPEN_PORT); } #endregion // Log on to the meter try { PSEMResult = m_PSEM.Identify(); if (PSEMResult == PSEMResponse.Ok) { PSEMResult = m_PSEM.Negotiate(512, 254, uiBaudRate); } if (PSEMResult == PSEMResponse.Ok) { PSEMResult = m_PSEM.Logon(strUserName, usUserID); } if (PSEMResult == PSEMResponse.Ok) { PSEMResult = m_PSEM.Security(strPassword); } if (PSEMResult != PSEMResponse.Ok) { // TODO: Add additional error translations // Translate the PSEM error code return(AMIConfigureDevice.InterpretPSEMResult(PSEMResult)); } } catch (TimeOutException) { // The meter has timed out so return an error m_SerialPort.ClosePort(); return(ConfigurationError.TIMEOUT); } } else { // The serial port is already open so we can not continue logging on return(ConfigurationError.UNABLE_TO_OPEN_PORT); } return(ConfigurationError.SUCCESS); }
/// <summary> /// Creates Instance of AMIConfirguration Device /// </summary> /// Revison History: // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 23/12/19 MMD N/A Created public virtual void CreateInstance(CPSEM m_PSEM) { m_ConfigureDevice = new AMIConfigureDevice(m_PSEM); }
public ConfigurationResult Configure(string sProgramName, PromptForData PFData) #endif { ConfigurationResult Result = ConfigurationResult.SUCCESS; AMIConfigureDevice ConfigureDevice = new AMIConfigureDevice(m_PSEM); ConfigurationError ConfigError = ConfigurationError.GENERAL_ERROR; ProcedureResultCodes ProcResult = ProcedureResultCodes.UNRECOGNIZED_PROC; // Set up the progress bar event handlers ConfigureDevice.ShowProgressEvent += this.ShowProgressEvent; ConfigureDevice.StepProgressEvent += this.StepProgressEvent; ConfigureDevice.HideProgressEvent += this.HideProgressEvent; ConfigureDevice.IsCanadian = IsCanadian; // We always need to set the Prompt for data so we should just use what is // currently in the meter. ConfigureDevice.UnitID = PFData.UnitID; ConfigureDevice.CustomerSerialNumber = PFData.SerialNumber; ConfigureDevice.InitialDateTime = PFData.InitialDateTime; // If the meter uses Base Backed Values we need to configure the base energies if (UsesBaseBackedValues || ConfigureBaseEnergiesSupported) { ProcResult = ConfigureBase(sProgramName); if (ProcResult != ProcedureResultCodes.COMPLETED) { switch (ProcResult) { case ProcedureResultCodes.DEVICE_SETUP_CONFLICT: { Result = ConfigurationResult.INVALID_CONFIG; break; } case ProcedureResultCodes.NO_AUTHORIZATION: { Result = ConfigurationResult.SECURITY_ERROR; break; } case ProcedureResultCodes.UNRECOGNIZED_PROC: { Result = ConfigurationResult.UNSUPPORTED_FUNCTION; break; } default: { Result = ConfigurationResult.ERROR; break; } } } } if (Result == ConfigurationResult.SUCCESS) { ConfigError = ConfigureDevice.Configure(sProgramName); // Translate to the ItronDevice ConfigurationResult error code since // the factory is using ConfigurationError and we do not want to always // rely on having the version in AMIConfiguration.dll Result = TranslateConfigError(ConfigError); } return(Result); }