(read/write)


For PCElement, get the value of a state variable by name. 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');

% requests for state variable Vd

myStVar = 'Vd';

myCode = 0;

myVd = DSSActiveElement.Variable(myStVar, myCode);

if myCode == 0

    disp([myStVar,' value: ', num2str(myVd)]);

else

    disp('The variable does not exist');

end;