# getGeneratorInfo

Gets the information for all generators in the circuit

## Contents

- Syntax
- Description
- Inputs
- Outputs
- Example

## Syntax

    Generators = getGeneratorInfo(DSSCircObj);
    Generators = getGeneratorInfo(DSSCircObj, generatorNames);

## Description

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

## Inputs

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

## Outputs

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

- name - Name of the generator.
- busName - Name of the associated bus.
- numPhases - Number of phases associated with the generator.
- enabled - {1|0} indicates whether this element is enabled in the simulation.
- nodes - the connection nodes at the bus
- current - average phase current output
- coordinates - Coordinates for the bus
- distance - Line distance from the bus to the substation
- 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
- 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.
- seqVoltages, cplxVoltages, seqCurrents, cplxSeqCurrents - zero, positive, and negative sequence voltages and currents magnitude or complex phasors
- losses - total real and imaginary power losses
- phaseLosses - real and imaginary power losses
- kW, kvar, kva - Rated power of the generator
- kV - Rated voltage.
- PF - Rate power factor of the generator.

## Example

Returns generator information in the circuit

    [DSSCircObj, DSSText, gridpvPath] = DSSStartup;
    DSSText.command = ['Compile "' gridpvPath 'ExampleCircuit\master_Ckt24.dss"'];
    DSSText.command = ['Compile "' gridpvPath 'ExampleCircuit\Ckt24_Generators_Distributed_7_5.dss"'];
    DSSText.command = 'solve';
    Generators = getGeneratorInfo(DSSCircObj) %Get information for all generators
    Generators = getGeneratorInfo(DSSCircObj,DSSCircObj.ActiveCircuit.Generators.AllNames) %Get information for all generators
    Generators = getGeneratorInfo(DSSCircObj, {'pvn312429_1_2_3'}) %Get information for one generator
    Generators = getGeneratorInfo(DSSCircObj, [{'pvn300557_3'};{'pvn300587_2'}]); %Get information for two generators
    %

    Generators =

    99x1 struct array with fields:

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

    Generators =

    99x1 struct array with fields:

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

    Generators =

                         name: 'pvn312429_1_2_3'
                      busName: 'n312429.1.2.3'
                    numPhases: 3
                      enabled: 1
                        nodes: [1 2 3]
                      current: 5.3630
                  coordinates: [31.6376 -80.8964]
                     distance: 6.2216
                      voltage: 2.0456e+04
                    voltagePU: 1.0270
              voltagePhasorPU: -0.0022 + 0.0053i
                phaseVoltages: [2.0382e+04 2.0420e+04 2.0565e+04]
              phaseVoltagesPU: [1.0233 1.0252 1.0325]
          phaseVoltagePhasors: [1x3 double]
        phaseVoltagePhasorsPU: [1x3 double]
              phaseVoltagesLL: [3.5412e+04 3.5388e+04 3.5491e+04]
            phaseVoltagesLLPU: [1.0264 1.0257 1.0287]
                    voltageLL: 3.5430e+04
                  voltageLLPU: 1.0270
               phasePowerReal: [-109.7033 -109.7034 -109.7032]
           phasePowerReactive: [-0.0018 -0.0015 -0.0012]
                    powerReal: -329.1099
                powerReactive: -0.0044
                 numTerminals: 1
                       losses: -3.2911e+02 - 4.4094e-03i
                  phaseLosses: [1x3 double]
                  seqVoltages: [113.4341 2.0456e+04 36.2038]
              cplxSeqVoltages: [1x6 double]
                  seqCurrents: [0.0093 5.3630 0.0297]
              cplxSeqCurrents: [0.0092 0.0016 -4.2845 3.2256 -0.0296 0.0034]
                    seqPowers: [1x6 double]
                           kV: 34.5000
                           kW: 329.1100
                         kvar: 0
                           PF: 1