Loading...
HomeMy WebLinkAbout20230705IPC to Staff PR 4 Attachment - Function_LOLP.pdf% Programmed by Andres Valdepena Delgado 2020 % Email ‐ avaldepenadelgado@idahopower.com   % Input Description: % GENERATOR_CAPACITIES vector with capacity of each generator                                             [N x 1] (double) % GENERATOR_OUTAGE the corresponding Equivalent Forced Outage Rate on Demand  (EFORd) for each generator   [N x 1] (double) % Load vector with load values for the system  % Output Description: % Returns the LOLP for each hour  function [LOLP States] = MYLOLP(Outages,Capacities,Load)     Outage_Table = Outage_Prob_Table(Capacities,Outages); % Call OutageProbTable to calculate the outage probability table with the given EFOR and Capacity values     Capacity_In = Outage_Table(:,1); % Define the Capacity in from the Outage Table     Capacity_Out = max(Capacity_In) ‐ Capacity_In; % Calculate the Capacity out     Individual_probability = Outage_Table(:,2); % Define the individual probability     Cumulative_probability = cumsum(Individual_probability); % Calculate the  cumulative probability of the outage table     Capacity_In = flip(Capacity_In); % Flip the Capacity In vector     Capacity_Out = flip(Capacity_Out); % Flip the Capacity Out vector     Individual_probability = flip(Individual_probability); % Flip the Individual  Probability vector     Cumulative_probability = flip(Cumulative_probability); % Flip the cumulative  probability vector     Outage_Table = [Capacity_In Capacity_Out Individual_probability  Cumulative_probability]; % Create a new Outage Table with the flipped vectors     % This part of the code calculates what is the index of the nearest     % capacity input      A1 = Load' ‐ Capacity_In;      A1(A1<0) = 0;     A2 = logical(A1);     for j = 1:length(Load)         Indx(:,j) = find(A2(:,j),1,'first');     end     LOLP = Cumulative_probability(Indx);     States = Outage_Table; end