# DSSStartup

Function for starting OpenDSS and linking to MATLAB

## Contents

- Syntax
- Description
- Inputs
- Outputs
- Example

## Syntax

    [DSSCircObj, DSSText, gridpvPath] = DSSStartup;

## Description

Function to start up OpenDSS in the background and bring the program handle into MATLAB to allow control of OpenDSS from MATLAB through the COM interface. This function only needs to be executed once per MATLAB session. The same handle to OpenDSS can be used the rest of the session. Note: the OpenDSS session started through the COM interface is separate from the executable program, so the active circuits and parameters can be different between the COM and visual executable.

## Inputs

- none

## Outputs

- `DSSCircObj` is the handle to the object in the OpenDSS program containing the circuit object as well as the text object used to the send commands to OpenDSS. Note: CircuitObj will be empty until Text.command = 'compile example.dss' is done to load in an active circuit into the OpenDSS workspace.
- `DSSText` can be used to send commands to OpenDSS through Text.command; it can also be called with CircuitObj.Text.command.
- `gridpvPath` is a string containing the toolbox location

## Example

Initiating OpenDSS from MATLAB:

    [DSSCircObj, DSSText, gridpvPath] = DSSStartup
    %

    DSSCircObj =

    	COM.OpenDSSEngine_DSS

    DSSText =

    	Interface.OpenDSS_Engine.IText

    gridpvPath =

    C:\Users\mjreno\Dropbox\OpenDSS_ToolBox\GridPV\