Güç Dağıtım Modülü - Power Distribution Module

CTRE Güç dağıtım Modülü - Power Distribution Panel (PDP) ve Rev Güç Dağıtım Merkezi - Power Distribution Hub (PDH) CAN bağlanabilirlikleri sayesinde robotun güç kullanımına dair bol miktarda durum bilgisini kullanıcı kodunda kullanım için roboRIO’ya iletebilmektedir. Bu durum, anlık sıcaklık, veri yolu voltaj, robotun çektiği toplam akım, toplam robot enerji tüketimi ve her bir cihaz güç kanalından çekilen akıma dair bilgilendirmeye olanak tanımaktadır. Bu veriler, voltaj azalmasından kaçınmayı sınırlayan motor :term:`tork`u gibi, birçok gelişmiş kontrol yöntemleri için kullanılabilmektedir.

Güç Dağıtım Nesnesi Oluşturmak

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)

Nesneden değerlerin okunması gerekmedikçe Güç Dağıtım nesnesinin oluşturulması gerekli değildir. Pano, nesne hiç oluşturulmamış olsa bile, çalışacak ve tüm kanallara güç aktarabilecektir.

Veriyolu Voltajının Okunması

    // Get the voltage going into the PDP, in Volts.
    // The PDP returns the voltage in increments of 0.05 Volts.
    double voltage = m_pdp.getVoltage();
    SmartDashboard.putNumber("Voltage", voltage);
    // Get the voltage going into the PDP, in Volts.
    // The PDP returns the voltage in increments of 0.05 Volts.
    double voltage = m_pdp.GetVoltage();
    frc::SmartDashboard::PutNumber("Voltage", voltage);
        # Get the voltage going into the PDP, in Volts.
        # The PDP returns the voltage in increments of 0.05 Volts.
        voltage = self.pdp.getVoltage()
        wpilib.SmartDashboard.putNumber("Voltage", voltage)

Veriyolu voltajının izlenmesi (diğer şeylerin yanı sıra) ani bir voltaj düşüklüğünü kontrollü bir şekilde önlemek için robotun bu ani düşüşe yakınlığını tespit etmek için yararlı olabilmektedir. Daha fazla bilgi için bkz. roboRIO Brownouts document.

Sıcaklığın Okunması

    // Retrieves the temperature of the PDP, in degrees Celsius.
    double temperatureCelsius = m_pdp.getTemperature();
    SmartDashboard.putNumber("Temperature", temperatureCelsius);
    // Retrieves the temperature of the PDP, in degrees Celsius.
    double temperatureCelsius = m_pdp.GetTemperature();
    frc::SmartDashboard::PutNumber("Temperature", temperatureCelsius);
        # Retrieves the temperature of the PDP, in degrees Celsius.
        temperatureCelsius = self.pdp.getTemperature()
        wpilib.SmartDashboard.putNumber("Temperature", temperatureCelsius)

Sıcaklığın izlenmesi, robotun aşırı miktarda güç çekip çekmediğini ve bir süredir kapatılması gerekip gerekmediğini ya da kısa devre veya başka bir kablolama sorunu olup olmadığını tespit etmek için yararlı olabilmektedir.

Anlık Akım, Güç ve Enerjinin Okuması

    // Get the total current of all channels.
    double totalCurrent = m_pdp.getTotalCurrent();
    SmartDashboard.putNumber("Total Current", totalCurrent);

    // Get the total power of all channels.
    // Power is the bus voltage multiplied by the current with the units Watts.
    double totalPower = m_pdp.getTotalPower();
    SmartDashboard.putNumber("Total Power", totalPower);

    // Get the total energy of all channels.
    // Energy is the power summed over time with units Joules.
    double totalEnergy = m_pdp.getTotalEnergy();
    SmartDashboard.putNumber("Total Energy", totalEnergy);
    // Get the total current of all channels.
    double totalCurrent = m_pdp.GetTotalCurrent();
    frc::SmartDashboard::PutNumber("Total Current", totalCurrent);

    // Get the total power of all channels.
    // Power is the bus voltage multiplied by the current with the units Watts.
    double totalPower = m_pdp.GetTotalPower();
    frc::SmartDashboard::PutNumber("Total Power", totalPower);

    // Get the total energy of all channels.
    // Energy is the power summed over time with units Joules.
    double totalEnergy = m_pdp.GetTotalEnergy();
    frc::SmartDashboard::PutNumber("Total Energy", totalEnergy);
        # Get the total current of all channels.
        totalCurrent = self.pdp.getTotalCurrent()
        wpilib.SmartDashboard.putNumber("Total Current", totalCurrent)

        # Get the total power of all channels.
        # Power is the bus voltage multiplied by the current with the units Watts.
        totalPower = self.pdp.getTotalPower()
        wpilib.SmartDashboard.putNumber("Total Power", totalPower)

        # Get the total energy of all channels.
        # Energy is the power summed over time with units Joules.
        totalEnergy = self.pdp.getTotalEnergy()
        wpilib.SmartDashboard.putNumber("Total Energy", totalEnergy)

Anlık akım, güç ve enerjinin izlenmesi; hem ani voltaj düşüklüklerini önlemekte hem de düzeneğin gerekli eylemleri yerine getirecek miktarda enerjiye erişebilmesini sağlamak için aküden ne kadar güç alındığını izlemek adına faydalı olabilmektedir. Güç, Watt ile gösterilen, veri yolu voltajının akım değeriyle çarpımıdır. Enerji, Jul ile gösterilen, gücün belirli bir zaman içerisindeki toplamıdır.

Her Bir Kanal Akımının Okunması

PDP/PDH kullanıcıların cihazın her bir güç kanalından çektiği akımın izlenmesine olanak tanımaktadır. (0-15) 16 PDP kanalı veya (0-23) 24 PDH kanalından herhangi birinin akım değerini okuyabilirsiniz.

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

Cihazın çektiği her bir akımın izlenmesi, kısa devreleri veya durmuş motorları tespit etmek için faydalı olabilmektedir.

Değiştirilebilir (PDH) Kanalının Kullanımı

REV PDH özel devrelerin kontrolü için açılıp kapanabilen bir kanala sahiptir.

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