35 lines
680 B
Matlab
35 lines
680 B
Matlab
function [A, MTTF, MTBF] = evaluate_SR(nm,n,lambdaB,lambdaR,muB,muR)
|
|
|
|
%% model definition
|
|
% notice: here last state is the system failed state
|
|
[Q,pi0] = CTMC_SR(lambdaB,lambdaR,muB,muR);
|
|
|
|
%% solution of the availability model
|
|
tildeQ = Q;
|
|
tildeQ(:,end) = ones(3,1);
|
|
|
|
en = zeros(1,3);
|
|
en(end) = 1;
|
|
|
|
% steady-state probability vector
|
|
pi = (tildeQ')\(en');
|
|
|
|
% availability = MTTF/MTBF
|
|
A = sum(pi(1:end-1));
|
|
|
|
%% solution of the reliability model
|
|
hatQ = Q(1:end-1,1:end-1);
|
|
|
|
hatpi0 = pi0(1:end-1);
|
|
|
|
tau = -(hatQ')\(hatpi0');
|
|
|
|
MTTF = (tau')*ones(2,1);
|
|
|
|
%% evaluate MTBF
|
|
MTBF = MTTF/A;
|
|
|
|
%% closed formula for Availability
|
|
% Asys = 1 - (1-muB/(muB+lambdaB))^2*(1-muR/(muR+lambdaR))^2;
|
|
|
|
end |