# findUpstreamBuses

Finds all buses upstream of the busName

## Contents

- Syntax
- Description
- Inputs
- Outputs
- Example

## Syntax

    upstreamBuses = findUpstreamBuses(DSSCircObj,busName);
    upstreamBuses = findUpstreamBuses(DSSCircObj,busName, _'PropertyName'_ ,PropertyValue);

## Description

Function to get all the bus names for buses that are upstream of the busName. The upstream buses are defined as buses that are closer to the substation on the electrical path to busName.

## Inputs

- `DSSCircObj` - link to OpenDSS active circuit and command text (from DSSStartup)
- `busName` - string of the bus name to start search upstream
- `Properties` - optional properties as one or more name-value pairs in any order
- -- `'Lines'` - Structure of the circuit lines from getLineInfo. If no input is given, the structure is filled from the most current power flow solution in DSSCircObj COM.
- -- `'Transformers'` - Structure of the circuit transformers from getTransformerInfo. If no input is given, the structure is filled from the most current power flow solution in DSSCircObj COM.

## Outputs

- `upstreamBuses` is a cell array of the bus names upstream from busName

## Example

Returns upstream buses

    [DSSCircObj, DSSText, gridpvPath] = DSSStartup;
    DSSText.command = ['Compile "' gridpvPath 'ExampleCircuit\master_Ckt24.dss"'];
    DSSText.command = 'solve';
    upstreamBuses = findUpstreamBuses(DSSCircObj,'n292286')
    %

    upstreamBuses =

      Columns 1 through 6

        'n292286'    'n292300'    'n283640'    'n283641'    'n283648'    'n283663'

      Columns 7 through 11

        'n283672'    'n1386726'    'n1386727'    'n283677'    'n283680'

      Columns 12 through 17

        'n283682'    'n283661'    'n283639'    'n283622'    'n283615'    'n283609'

      Columns 18 through 22

        'n283606'    'n283602'    'n283575'    '05410'    'subxfmr_lsb'