For PCElements only, gets/sets the value for the active state variable for the active circuit element. If there is no state variable active this will trigger an error message. 


% Create DSS object

DSSObject = actxserver('OpenDSSEngine.DSS')

if ~DSSObject.Start(0),

                    disp('Unable to start openDSS');



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


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

mySVNames = DSSActiveElement.AllVariableNames;

% requests for state variable Pshaft

myStVar = 'PShaft';

Value = 1.23;

DSSActiveElement.VariableName = myStVar;

DSSActiveElement.VariableValue = Value;

mynewVal = DSSActiveElement.VariableValue;