Module de distribution d’alimentation (PDP)

The CTRE Power Distribution Panel (PDP) and Rev Power Distribution Hub (PDH) can use their CAN connectivity to communicate a wealth of status information regarding the robot’s power use to the roboRIO, for use in user code. This has the capability to report current temperature, the bus voltage, the total robot current draw, the total robot energy use, and the individual current draw of each device power channel. This data can be used for a number of advanced control techniques, such as motor torque limiting and brownout avoidance.

Création d’un objet PowerDistribution

To use the either Power Distribution module, create an instance of the PowerDistribution class (Java, C++, Python). With no arguments, the Power Distribution object will be detected, and must use CAN ID of 0 for CTRE or 1 for REV. If the CAN ID is non-default, additional constructors are available to specify the CAN ID and type.

PowerDistribution examplePD = new PowerDistribution();
PowerDistribution examplePD = new PowerDistribution(0, ModuleType.kCTRE);
PowerDistribution examplePD = new PowerDistribution(1, ModuleType.kRev);
PowerDistribution examplePD{};
PowerDistribution examplePD{0, frc::PowerDistribution::ModuleType::kCTRE};
PowerDistribution examplePD{1, frc::PowerDistribution::ModuleType::kRev};
from wpilib import PowerDistribution

examplePD = PowerDistribution()
examplePD = PowerDistribution(0, PowerDistribution.ModuleType.kCTRE)
examplePD = PowerDistribution(1, PowerDistribution.ModuleType.kRev)

Remarque : il n’est pas nécessaire de créer un objet PowerDistribution, sauf si vous avez besoin d’en lire des valeurs. La carte fonctionnera et alimentera tous les canaux même si l’objet n’est jamais créé.

Avertissement

Pour activer l’enregistrement de la tension et du courant dans l’application Driver Station, l’ID CAN du panneau de distribution d’alimentation CTRE doit être configuré avec la valeur 0, et pour le concentrateur de distribution d’alimentation REV, il doit être configuré avec la valeur 1.

Lecture de la tension sur le système électrique

32    // Get the voltage going into the PDP, in Volts.
33    // The PDP returns the voltage in increments of 0.05 Volts.
34    double voltage = m_pdp.getVoltage();
35    SmartDashboard.putNumber("Voltage", voltage);
28    // Get the voltage going into the PDP, in Volts.
29    // The PDP returns the voltage in increments of 0.05 Volts.
30    double voltage = m_pdp.GetVoltage();
31    frc::SmartDashboard::PutNumber("Voltage", voltage);
34        # Get the voltage going into the PDP, in Volts.
35        # The PDP returns the voltage in increments of 0.05 Volts.
36        voltage = self.pdp.getVoltage()
37        wpilib.SmartDashboard.putNumber("Voltage", voltage)

La surveillance de la tension du système électrique peut être utile (entre autres) pour détecter quand la batterie du robot faiblit, et que la tension actuelle s’approche de la tension minimale d’opération. Des mesures de prévention peuvent être alors prises pour éviter la panne incontrôlée du robot. Voir le document roboRIO Brownouts pour plus d’informations.

Lecture de la température

37    // Retrieves the temperature of the PDP, in degrees Celsius.
38    double temperatureCelsius = m_pdp.getTemperature();
39    SmartDashboard.putNumber("Temperature", temperatureCelsius);
33    // Retrieves the temperature of the PDP, in degrees Celsius.
34    double temperatureCelsius = m_pdp.GetTemperature();
35    frc::SmartDashboard::PutNumber("Temperature", temperatureCelsius);
39        # Retrieves the temperature of the PDP, in degrees Celsius.
40        temperatureCelsius = self.pdp.getTemperature()
41        wpilib.SmartDashboard.putNumber("Temperature", temperatureCelsius)

La surveillance de la température peut être utile pour détecter si le robot a consommé trop d’énergie et doit être mis à l’arrêt pendant un certain temps, ou encore, s’il y a un court-circuit ou un autre problème de câblage qui crée un surchauffement.

Lecture du courant total, de la puissance et de l’énergie

41    // Get the total current of all channels.
42    double totalCurrent = m_pdp.getTotalCurrent();
43    SmartDashboard.putNumber("Total Current", totalCurrent);
44
45    // Get the total power of all channels.
46    // Power is the bus voltage multiplied by the current with the units Watts.
47    double totalPower = m_pdp.getTotalPower();
48    SmartDashboard.putNumber("Total Power", totalPower);
49
50    // Get the total energy of all channels.
51    // Energy is the power summed over time with units Joules.
52    double totalEnergy = m_pdp.getTotalEnergy();
53    SmartDashboard.putNumber("Total Energy", totalEnergy);
37    // Get the total current of all channels.
38    double totalCurrent = m_pdp.GetTotalCurrent();
39    frc::SmartDashboard::PutNumber("Total Current", totalCurrent);
40
41    // Get the total power of all channels.
42    // Power is the bus voltage multiplied by the current with the units Watts.
43    double totalPower = m_pdp.GetTotalPower();
44    frc::SmartDashboard::PutNumber("Total Power", totalPower);
45
46    // Get the total energy of all channels.
47    // Energy is the power summed over time with units Joules.
48    double totalEnergy = m_pdp.GetTotalEnergy();
49    frc::SmartDashboard::PutNumber("Total Energy", totalEnergy);
43        # Get the total current of all channels.
44        totalCurrent = self.pdp.getTotalCurrent()
45        wpilib.SmartDashboard.putNumber("Total Current", totalCurrent)
46
47        # Get the total power of all channels.
48        # Power is the bus voltage multiplied by the current with the units Watts.
49        totalPower = self.pdp.getTotalPower()
50        wpilib.SmartDashboard.putNumber("Total Power", totalPower)
51
52        # Get the total energy of all channels.
53        # Energy is the power summed over time with units Joules.
54        totalEnergy = self.pdp.getTotalEnergy()
55        wpilib.SmartDashboard.putNumber("Total Energy", totalEnergy)

La surveillance du courant total, de la puissance et de l’énergie peut être utile pour contrôler la quantité d’énergie tirée de la batterie, à la fois pour prévenir les pannes de courant et pour s’assurer que les mécanismes disposent d’une puissance suffisante pour effectuer les actions requises. La puissance est obtenue en multipliant la tension du bus par le courant et pour unité le Watt. L’énergie est la puissance additionnée dans le temps et a pour unité le Joule.

Lecture des courants des canaux individuels

Le PDP/PDH permet également aux utilisateurs de lire le courant consommé par les canaux d’alimentation de chaque composant. Vous pouvez lire le courant de n’importe lequel des 16 canaux du PDP (0-15) ou des 24 canaux du PDH (0-23).

26    // Get the current going through channel 7, in Amperes.
27    // The PDP returns the current in increments of 0.125A.
28    // At low currents the current readings tend to be less accurate.
29    double current7 = m_pdp.getCurrent(7);
30    SmartDashboard.putNumber("Current Channel 7", current7);
22    // Get the current going through channel 7, in Amperes.
23    // The PDP returns the current in increments of 0.125A.
24    // At low currents the current readings tend to be less accurate.
25    double current7 = m_pdp.GetCurrent(7);
26    frc::SmartDashboard::PutNumber("Current Channel 7", current7);
28        # Get the current going through channel 7, in Amperes.
29        # The PDP returns the current in increments of 0.125A.
30        # At low currents the current readings tend to be less accurate.
31        current7 = self.pdp.getCurrent(7)
32        wpilib.SmartDashboard.putNumber("Current Channel 7", current7)

La surveillance de la consommation de courant de chaque dispositif peut être utile pour détecter les courts-circuits ou les moteurs bloqués.

Utilisation du canal commutable (PDH)

Le REV PDH est pourvu d’un canal qui peut être activé ou désactivé pour contrôler des circuits personnalisés.

examplePD.setSwitchableChannel(true);
examplePD.setSwitchableChannel(false);
examplePD.SetSwitchableChannel(true);
examplePD.SetSwitchableChannel(false);
examplePD.setSwitchableChannel(True)
examplePD.setSwitchableChannel(False)