# getCapacitorInfo

Gets the information for all capacitors in the circuit

## Contents

- Syntax
- Description
- Inputs
- Outputs
- Example

## Syntax

    Capacitors = getCapacitorInfo(DSSCircObj);
    Capacitors = getCapacitorInfo(DSSCircObj, capacitorNames);

## Description

Function to get the information about the capacitors in the circuit and return a structure with the information. If the optional input of capacitorNames is filled, the function returns information for the specified subset of capacitors, excluding the miscellaneous and additional parameters mentioned in the outputs below.

## Inputs

- `DSSCircObj` - link to OpenDSS active circuit and command text (from DSSStartup)
- `capacitorNames` - optional cell array of capacitor names to get information for

## Outputs

`Capacitors` is a structure with all the parameters for the capacitors in the active circuit. Fields are:

- name - The capacitor name.
- busName - Name of the associated bus.
- numPhases - Number of phases associated with the capacitor bank.
- enabled - {1|0} indicates whether this element is enabled in the simulation.
- coordinates - Coordinates for the capacitor's bus, obtained from getBusInfo.
- distance - Line distance from the capacitor's bus to the substation, obtained from getBusInfo.
- current - average phase current
- phaseVoltages - Value of voltage magnitudes calculated from the complex voltage returned by OpenDSS. Length is always 3, returning 0 for phases not on the bus
- phaseVoltagesPU - Per-unit value of voltage magnitudes calculated from the complex per-unit voltage returned by OpenDSS. Length is always 3, returning 0 for phases not on the bus.
- voltage, voltagePU, voltagePhasorPU, phaseVoltages, phaseVoltagePhasors, ... phaseVoltagePhasorsPU, phaseVoltagesLL, phaseVoltagesLLPU, voltageLL, voltageLLPU - voltages and voltage phasors
- seqVoltages, cplxVoltages, seqCurrents, cplxSeqCurrents - zero, positive, and negative sequence voltages and currents magnitude or complex phasors
- phasePowerReal - 3-element array of the real components of each phase's complex power injected by generator. Phases that are not present will return 0.
- phasePowerReactive - 3-element array of the imaginary components of each phase's complex power injected by generator. Phases that are not present will return 0.
- powerReal - Total phasePowerReal.
- powerReactive - Total phasePowerReactive.
- losses - total real and imaginary power losses
- phaseLosses - real and imaginary power losses
- switching - {1|0} 1 if CapControl lists the capacitor as one of its elements, 0 otherwise.
- kvar - Total kvar, if one step, or ARRAY of kvar ratings for each step. Evenly divided among phases.
- isDelta - {1|0} 1 is it connected via delta connection, 0 otherwise.
- kV - For 2, 3-phase, kV phase-phase. Otherwise specify actual cap rating.
- capControl - Name of the CapControl element controlling the capacitor if the capacitor is being controlled.
- controlMode - Mode of control if the capacitor is being controlled.
- monitoredObj, monitoredTerm, CTratio, PTratio, onSetting, offSetting, Vmax, Vmin, useVoltOverride, delay, delayOff, deadTime - Settings from the CapControl

## Example

Returns capacitor information in the circuit

    [DSSCircObj, DSSText, gridpvPath] = DSSStartup;
    DSSText.command = ['Compile "' gridpvPath 'ExampleCircuit\master_Ckt24.dss"'];
    DSSText.command = 'solve';
    Capacitors = getCapacitorInfo(DSSCircObj) %Get information for all capacitors
    Capacitors = getCapacitorInfo(DSSCircObj,DSSCircObj.ActiveCircuit.Capacitors.AllNames) %Get information for all capacitors
    Capacitors = getCapacitorInfo(DSSCircObj, {'cap_g2101ae7400'}) %Get information for one capacitor
    Capacitors = getCapacitorInfo(DSSCircObj, [{'cap_g2100pl6500'};{'cap_g2100fk7800'}]); %Get information for two capacitors
    %

    Capacitors =

    3x1 struct array with fields:

        name
        busName
        numPhases
        enabled
        coordinates
        distance
        current
        voltage
        voltagePU
        voltagePhasorPU
        phaseVoltages
        phaseVoltagesPU
        phaseVoltagePhasors
        phaseVoltagePhasorsPU
        phaseVoltagesLL
        phaseVoltagesLLPU
        voltageLL
        voltageLLPU
        seqVoltages
        cplxSeqVoltages
        seqCurrents
        cplxSeqCurrents
        phasePowerReal
        phasePowerReactive
        powerReal
        powerReactive
        losses
        phaseLosses
        switching
        kvar
        isDelta
        kV

    Capacitors =

    3x1 struct array with fields:

        name
        busName
        numPhases
        enabled
        coordinates
        distance
        current
        voltage
        voltagePU
        voltagePhasorPU
        phaseVoltages
        phaseVoltagesPU
        phaseVoltagePhasors
        phaseVoltagePhasorsPU
        phaseVoltagesLL
        phaseVoltagesLLPU
        voltageLL
        voltageLLPU
        seqVoltages
        cplxSeqVoltages
        seqCurrents
        cplxSeqCurrents
        phasePowerReal
        phasePowerReactive
        powerReal
        powerReactive
        losses
        phaseLosses
        switching
        kvar
        isDelta
        kV

    Capacitors =

                         name: 'cap_g2101ae7400'
                      busName: 'n284062'
                    numPhases: 3
                      enabled: 1
                  coordinates: [31.6512 -80.9620]
                     distance: 5.4491
                      current: 20.4556
                      voltage: 2.0289e+04
                    voltagePU: 1.0186
              voltagePhasorPU: -0.0021 + 0.0017i
                phaseVoltages: [2.0204e+04 2.0281e+04 2.0383e+04]
              phaseVoltagesPU: [1.0143 1.0182 1.0233]
          phaseVoltagePhasors: [1x3 double]
        phaseVoltagePhasorsPU: [1x3 double]
              phaseVoltagesLL: [3.5026e+04 3.5198e+04 3.5203e+04]
            phaseVoltagesLLPU: [1.0153 1.0202 1.0204]
                    voltageLL: 3.5142e+04
                  voltageLLPU: 1.0186
                  seqVoltages: [53.4248 2.0289e+04 66.8601 0 0 0]
              cplxSeqVoltages: [1x12 double]
                  seqCurrents: [0.0539 20.4556 0.0674 0.0539 20.4556 0.0674]
              cplxSeqCurrents: [1x12 double]
               phasePowerReal: [0 0 -7.2760e-15]
           phasePowerReactive: [-411.5546 -414.6802 -418.8809]
                    powerReal: -7.2760e-15
                powerReactive: -1.2451e+03
                       losses: -7.2760e-15 - 1.2451e+03i
                  phaseLosses: [1x3 double]
                    switching: 0
                         kvar: 1200
                      isDelta: 0
                           kV: 34.5000