(read/write)


For PCElement, get the value of a state variable by index. If Code > 0 Then no variable by this name or the active circuit element is not a PCelement.


Example


% Create DSS object

DSSObject = actxserver('OpenDSSEngine.DSS')

if ~DSSObject.Start(0),

                    disp('Unable to start openDSS');

                    return

end;

DSSText = DSSObject.Text;

DSSCircuit = DSSObject.ActiveCircuit;

DSSLines = DSSCircuit.Lines;

% Compile a model        

DSSText.Command = 'Compile C:\myPath\myModel.dss';

DSSActiveElement = DSSCircuit.ActiveCktElement;

% Activates the generator located in this model

DSSCircuit.SetActiveElement('Generator.G1');

% gets the names of all the state variables of the active element

mySVNames = DSSActiveElement.AllVariableNames;

% requests for state variable Vd (3)

myStVIdx = 3;

myCode = 0;

myVd = DSSActiveElement.Variablei(myStVIdx, myCode);

if myCode == 0

    disp([mySVNames{myStVIdx},' value: ', num2str(myVd)]);

else

    disp('The variable does not exist');

end;