ActorStatus
(read only)
This property returns an array of doubles containing the status of all existing actors in % for the active simulation job. 1 = the actor is done and waiting for instructions, 0 = the actor is busy.
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;
% Handler for Parallel processing functions
DSSParallel = DSSCircuit.Parallel;
% Gets the number of CPUs this PC has
CPUs = DSSParallel.NumCPUs;
% By default one actor is created, if you want more than one
% parallel instance you will have to create them. Try to leave at least
% One CPU available to handle the rest of windows, otherwise will block everything
disp('Creating Actors');
DSSText.Command = 'compile "C:\Program Files\OpenDSS\EPRITestCircuits\ckt5\Master_ckt5.DSS"';
DSSText.Command = 'set maxiterations=1000 maxcontroliter=1000'; % Just in case
DSSCircuit.Solution.Solve(); % Solves Actor 1
DSSText.Command = ['Clone ',int2str(CPUs-2)]; %Creates the other actors
DSSText.Command = 'set ActiveActor=*'; %activates all actors to send commands concurrently
DSSText.Command = 'set mode=Time stepsize=1h number=16000';
% to send commands to each actor separately you need to select each actor independently
% Go back to actor 1
DSSParallel.ActiveActor = 1;
% Assigns CPU 0 to actor 1
DSSParallel.ActorCPU = 0;
% Activates the parallel features
DSSParallel.ActiveParallel = 1;
% Now the actors are solved
DSSCircuit.Solution.SolveAll;
pause(0.1);
BoolStatus = 0;
while BoolStatus == 0,
ActorStatus = DSSParallel.ActorStatus;
BoolStatus = all(ActorStatus & 1); %Checks if everybody has ended
ActorProgress = DSSParallel.ActorProgress;
clc;
for i=1:CPUs-1,
fprintf('Actor %i Progress(%%) @ CPU %i : %i\n',i,i-1,ActorProgress(i));
end;
pause(0.5); % A little wait to not saturate the Processor
end;
disp('Simulation finished by all the actors');