/// <summary> /// Identifies the PSU vendor at each psu slot using the modelnumber API of the PsuBase class /// (Assumes all PSU vendors implement the MFR_MODEL Pmbus command) /// Based on the model number, we bind the Psu class object to the corresponding child (vendor) class object /// </summary> private void PsuInitialize() { for (uint psuIndex = 0; psuIndex < MaxPsuCount; psuIndex++) { PsuModelNumberPacket modelNumberPacket = new PsuModelNumberPacket(); modelNumberPacket = ChassisState.Psu[psuIndex].GetPsuModel(); string psuModelNumber = modelNumberPacket.ModelNumber; PsuModel model = ChassisState.ConvertPsuModelNumberToPsuModel(psuModelNumber); switch (model) { case PsuModel.Delta: ChassisState.Psu[psuIndex] = new DeltaPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Delta Psu identified at slot-{0}", psuIndex + 1); break; case PsuModel.Emerson: ChassisState.Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Emerson Psu identified at slot-{0}", psuIndex + 1); break; default: ChassisState.Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1)); Tracer.WriteInfo("Unidentified PSU at slot-{0}", psuIndex + 1); break; } } }
/// <summary> /// Identifies the PSU vendor at each psu slot using the modelnumber API of the PsuBase class /// (Assumes all PSU vendors implement the MFR_MODEL Pmbus command) /// Based on the model number, we bind the Psu class object to the corresponding child (vendor) class object /// </summary> private static void PsuInitialize() { for (uint psuIndex = 0; psuIndex < ConfigLoaded.NumPsus; psuIndex++) { // Initially create instance of the base class // Later.. based on the psu model number, we create the appropriate psu class object Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1)); PsuModelNumberPacket modelNumberPacket = new PsuModelNumberPacket(); modelNumberPacket = Psu[psuIndex].GetPsuModel(); string psuModelNumber = modelNumberPacket.ModelNumber; PsuModel model = ConvertPsuModelNumberToPsuModel(psuModelNumber); switch (model) { case PsuModel.Delta: Psu[psuIndex] = new DeltaPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Delta PSU identified at slot-{0}, Model Number: {1}", psuIndex + 1, psuModelNumber); break; case PsuModel.EmersonWithLes: Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1), true); Tracer.WriteInfo("Emerson with LES PSU identified at slot-{0}, Model Number: {1}", psuIndex + 1, psuModelNumber); break; case PsuModel.EmersonNonLes: Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1), false); Tracer.WriteInfo("Emerson non-LES PSU identified at slot-{0}, Model Number: {1}", psuIndex + 1, psuModelNumber); break; default: // Unknown PSUs if (ConfigLoaded.ForceEmersonPsu) { // Force to Emerson PSU without LES to enable FW update methods in the EmersonPsu class to be called. // This is useful when a previous FW update did not complete successfully. // The PSU stays in bootloader mode and does not recognize the // MFR_MODEL command and will return all 0xFFs for this command. Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1), false); Tracer.WriteWarning("Forcing PSU instantiation to Emerson non-LES PSU at slot-{0}, Model Number: {1}", psuIndex + 1, psuModelNumber); } else { Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1)); Tracer.WriteInfo("Unidentified PSU at slot-{0}, Model Number: {1}. Default to base PSU class.", psuIndex + 1, psuModelNumber); } break; } // Enable/disable Battery Extended Operation Mode Psu[psuIndex].SetBatteryExtendedOperationMode(ConfigLoaded.DatasafeOperationsEnabled ? true: false); } }
/// <summary> /// Attempts to retrieve the Psu Model Number. This method /// calls down to the Chassis Manager with SendReceive /// </summary> private PsuModelNumberPacket GetPsuModel(byte psuId) { // Initialize return packet PsuModelNumberPacket returnPacket = new PsuModelNumberPacket(); returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.ModelNumber = ""; try { PsuModelResponse myResponse = new PsuModelResponse(); myResponse = (PsuModelResponse)this.SendReceive(this.PsuDeviceType, this.PsuId, new PsuRequest((byte)PmBusCommand.MFR_MODEL, (byte)PmBusResponseLength.MFR_MODEL), typeof(PsuModelResponse)); // check for completion code if (myResponse.CompletionCode != 0) { returnPacket.CompletionCode = (CompletionCode)myResponse.CompletionCode; } else { returnPacket.CompletionCode = CompletionCode.Success; if (myResponse.PsuModelNumber != null) { byte[] inModelNumber = myResponse.PsuModelNumber; byte[] outModelNumber = null; PmBus.PsuModelNumberParser(ref inModelNumber, out outModelNumber); returnPacket.ModelNumber = System.BitConverter.ToString(outModelNumber, 0); } else { returnPacket.ModelNumber = ""; } } } catch (System.Exception ex) { returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.ModelNumber = ""; Tracer.WriteError(this.PsuId, DeviceType.Psu, ex); } return(returnPacket); }
/// <summary> /// Attempts to retrieve the Psu Model Number. This method /// calls down to the Chassis Manager with SendReceive /// </summary> private PsuModelNumberPacket GetPsuModel(byte psuId) { // Initialize return packet PsuModelNumberPacket returnPacket = new PsuModelNumberPacket(); returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.ModelNumber = ""; try { PsuModelResponse myResponse = new PsuModelResponse(); myResponse = (PsuModelResponse)this.SendReceive(this.PsuDeviceType, this.PsuId, new PsuRequest((byte)PmBusCommand.MFR_MODEL,(byte)PmBusResponseLength.MFR_MODEL), typeof(PsuModelResponse)); // check for completion code if (myResponse.CompletionCode != 0) { returnPacket.CompletionCode = (CompletionCode)myResponse.CompletionCode; } else { returnPacket.CompletionCode = CompletionCode.Success; if (myResponse.PsuModelNumber != null) { byte[] inModelNumber = myResponse.PsuModelNumber; byte[] outModelNumber = null; PmBus.PsuModelNumberParser(ref inModelNumber, out outModelNumber); returnPacket.ModelNumber = System.BitConverter.ToString(outModelNumber, 0); } else { returnPacket.ModelNumber = ""; } } } catch (System.Exception ex) { returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.ModelNumber = ""; Tracer.WriteError(this.PsuId, DeviceType.Psu, ex); } return returnPacket; }
/// <summary> /// Identifies the PSU vendor at each psu slot using the modelnumber API of the PsuBase class /// (Assumes all PSU vendors implement the MFR_MODEL Pmbus command) /// Based on the model number, we bind the Psu class object to the corresponding child (vendor) class object /// </summary> private static void PsuInitialize() { for (uint psuIndex = 0; psuIndex < ConfigLoaded.NumPsus; psuIndex++) { // Initially create instance of the base class // Later.. based on the psu model number, we create the appropriate psu class object Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1)); PsuModelNumberPacket modelNumberPacket = new PsuModelNumberPacket(); modelNumberPacket = Psu[psuIndex].GetPsuModel(); string psuModelNumber = modelNumberPacket.ModelNumber; PsuModel model = ConvertPsuModelNumberToPsuModel(psuModelNumber); switch (model) { case PsuModel.Delta: Psu[psuIndex] = new DeltaPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Delta Psu identified at slot-{0}, Model Number: {1}", psuIndex + 1, psuModelNumber); break; case PsuModel.Emerson: Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Emerson Psu identified at slot-{0}, Model Number: {1}", psuIndex + 1, psuModelNumber); break; default: // Default to Emerson PSU to enable FW update methods in the EmersonPsu class to be called. // This is useful when previous FW update did not complete successfully and the PSU // is not returning valid MFR_MODEL Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Unidentified PSU at slot-{0}, Model Number: {1}. Default to Emerson PSU.", psuIndex + 1, psuModelNumber); break; } } }
/// <summary> /// Identifies the PSU vendor at each psu slot using the modelnumber API of the PsuBase class /// (Assumes all PSU vendors implement the MFR_MODEL Pmbus command) /// Based on the model number, we bind the Psu class object to the corresponding child (vendor) class object /// </summary> private void PsuInitialize() { for (uint psuIndex = 0; psuIndex < MaxPsuCount; psuIndex++) { PsuModelNumberPacket modelNumberPacket = new PsuModelNumberPacket(); modelNumberPacket = ChassisState.Psu[psuIndex].GetPsuModel(); string psuModelNumber = modelNumberPacket.ModelNumber; PsuModel model = ChassisState.ConvertPsuModelNumberToPsuModel(psuModelNumber); switch (model) { case PsuModel.Delta: ChassisState.Psu[psuIndex] = new DeltaPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Delta Psu identified at slot-{0}", psuIndex+1); break; case PsuModel.Emerson: ChassisState.Psu[psuIndex] = new EmersonPsu((byte)(psuIndex + 1)); Tracer.WriteInfo("Emerson Psu identified at slot-{0}", psuIndex+1); break; default: ChassisState.Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1)); Tracer.WriteInfo("Unidentified PSU at slot-{0}", psuIndex+1); break; } } }