The AC power distribution unit (AC PDU) supplies AC power to payloads connected to AC PDU power outlets. You can read the current sensor on the AC power outlet to monitor the AC power supply on each outlet. Outlets are grouped as power banks. Each power bank can be turned off (TurnOffPowerBankAsync()) and on (TurnOnPowerBankAsync()) individually. To get the current state of a power bank use GetPowerBankStateAsync(). The electric current measured at each power outlet can be read independently by accessing the IOutletSensor objects stored in each power bank (IPowerBank).

Note AC PDU control and sensor readings are only accessible when the ATECCGEN2 rack is in the Running power state. When the rack is not in the Running power state, attempting to read a sensor returns Double.NaN and attempting to enable or disable a power bank triggers an exception.
Note A payload that discharges slowly can cause the AC PDU bank state detection circuitry to report that the bank is on. Add a delay in cases where you call GetPowerBankStateAsync() after TurnOffPowerBankAsync() while connected to a payload that discharges slowly.

Reading All Outlet Sensors on All AC Power Distribution Unit Banks

IAteCoreSession ateCoreSession; 
try 
{ 
	// To create an object of IAteCoreSession. 
	ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password); 
	// Get the objects of ACPDU component 
	IACPowerDistributionUnit[] acPowerDistributionUnits = ateCoreSession.ACPowerDistributionUnits; 
 
	foreach (var acPowerDistributionUnit in acPowerDistributionUnits) 
	{ 
		// Print some of the properties of the component 
		Console.WriteLine("AC power distribution unit name: {0}", acPowerDistributionUnit.Name); 
		Console.WriteLine("AC power distribution unit location: {0}", acPowerDistributionUnit.Location); 
		Console.WriteLine("AC power distribution unit vendor name: {0}", acPowerDistributionUnit.VendorName); 
		Console.WriteLine("AC power distribution unit model name: {0}", acPowerDistributionUnit.ModelName); 
		Console.WriteLine("AC power distribution unit serial number: {0}", acPowerDistributionUnit.SerialNumber); 
		Console.WriteLine("AC power distribution unit firmware version: {0}", acPowerDistributionUnit.FirmwareVersion); 
 
		foreach (var powerBank in acPowerDistributionUnit.PowerBanks) 
		{ 
			if (await powerBank.GetPowerBankState() == PowerState.On) 
			{ 
				Console.WriteLine(powerBank.BankNumber); 
 
				foreach (var outletCurrentSensor in powerBank.OutletCurrentSensors) 
				{ 
					Console.WriteLine("Outlet number: {0}", outletCurrentSensor.OutletNumber); 
					Console.WriteLine("Current sensor reading: {0} A", await outletCurrentSensor.ReadSensorAsync()); 
				} 
			} 
		} 
	} 
} 
catch(Exception ex) 
{ 
	Console.WriteLine(ex.Message); //Print the exception message. 
} 
finally 
{ 
	if (ateCoreSession != null) 
	{ 
		// To close the session. 
		ateCoreSession.Dispose(); 
	} 
}