# getBusInfo

Gets the information for all Bus in busNames

## Contents

- Syntax
- Description
- Inputs
- Outputs
- Example

## Syntax

    Buses = getBusInfo(DSSCircObj);
    Buses = getBusInfo(DSSCircObj,busNames);
    Buses = getBusInfo(DSSCircObj,busNames,forceFindCoords);

## Description

Function to get the information for buses in the OpenDSS circuit. If optional input busNames contains a cell array, the function will return a structure for each busName, otherwise Buses will contain all buses in the circuit.

## Inputs

- `DSSCircObj` - link to OpenDSS active circuit and command text (from DSSStartup)
- `busNames` - optional cell array of bus names to get information for
- `forceFindCoords` - optional input to force the function to try to find the coordinates for the busNames by searching for other connected buses that do have coordinates

## Outputs

`Buses` is a structure with all the parameters for the buses in busNames. Fields are:

- name - The busname acquired from the busNames input.
- numPhases - Returns the number of nodes on the bus.
- nodes - Returns the nodes at the bus.
- voltageAngle - Average difference in angle from each voltage phase to a standard reference frame.
- voltage - Average voltage magnitude of all phases
- voltagePU - Average per unit voltage magnitude of all phases.
- 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.
- distance - Line distance from the bus to the substation.
- kVBase - The bus's base voltage in kV.
- seqVoltages - Sequence voltage magnitude for zero, positive, negative.
- cplxSeqVoltages - Sequence voltage phasors with real and imaginary zero, real and imaginary positive, and real and imaginary negative.
- ZscMatrix - The impedance matrix for the phases at the bus in pairs of real and imaginary numbers combined into one row.
- Zsc1 - The short circuit positive-sequence real and imaginary impedance
- Zsc0 - The short circuit zero-sequence real and imaginary impedance
- YscMatrix - The admittance matrix for the phases at the bus in pairs of real and imaginary numbers combined into one row.
- coordinates - Returns coordinates stored in OpenDSS for the active bus. If coordinates do not exist and forceFindCoords is 1, it returns coordinates of the coordinates of the nearest upstream element.

## Example

Returns bus information

    [DSSCircObj, DSSText, gridpvPath] = DSSStartup;
    DSSText.command = ['Compile "' gridpvPath 'ExampleCircuit\master_Ckt24.dss"'];
    DSSText.command = 'solve';
    Buses = getBusInfo(DSSCircObj) %Get information for all buses
    Buses = getBusInfo(DSSCircObj,{'N1311915'}) %Get information for one bus
    %

    Buses =

    6058x1 struct array with fields:

        name
        numPhases
        nodes
        voltageAngle
        voltage
        voltagePU
        phaseVoltages
        phaseVoltagesPU
        distance
        kVBase
        seqVoltages
        cplxSeqVoltages
        ZscMatrix
        Zsc1
        Zsc0
        YscMatrix
        coordinates

    Buses =

                   name: 'N1311915'
              numPhases: 1
                  nodes: 1
           voltageAngle: 0.6600
                voltage: 2.0362e+04
              voltagePU: 1.0223
          phaseVoltages: [2.0362e+04 0 0]
        phaseVoltagesPU: [1.0223 0 0]
               distance: 2.3813
                 kVBase: 19.9186
            seqVoltages: [-1 -1 -1]
        cplxSeqVoltages: [-1 -1 -1 -1 -1 -1]
              ZscMatrix: 0
                   Zsc1: [0 0]
                   Zsc0: [0 0]
              YscMatrix: 0
            coordinates: [31.6145 -80.9461]