/// <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); } }