%% Calculate Dissipated Power Losses for the Entire Simulation Time
% This example shows how to calculate instantaneous losses based on the 
% power dissipated and return the time series data for all time steps in 
% the entire simulation time using the |ee_getPowerLossTimeSeries| function.
%
% Open the model. At the MATLAB&reg; command prompt, enter:
model = 'ee_solar_inverter'; 
open_system(model) 
%%
% This example model has data logging enabled. Run the simulation and 
% create the simulation log variable.
sim(model) 
%%
%
% The simulation log variable |simlog_ee_solar_inverter| is saved in your 
% current workspace.
%
% Calculate dissipated power losses and return the time series data in cell
% array.
lossesCell = ee_getPowerLossTimeSeries(simlog_ee_solar_inverter)
%%
% View the time series data. From the workspace, open the |lossesCell| cell
% array, then open the 77180x3 |double| numeric array for the 
% |ee_solar_inverter.Diode1|.
%
% The first two columns contain the interval start and end time. The third 
% column contains the power loss data.
%
% Plot the data.
plot(lossesCell{1, 2}(:,end))
title('Dissipated Power')
xlabel('Time Interval')
ylabel('Power (W)')



%%
% Copyright 2017 The MathWorks, Inc.
