?? availability.m
字號:
MTBF1= input('Enter the First Mean time Between Failure in hours ');
MTBF2= input('Enter the Second Mean time Between Failure in hours ');
MTBF3= input('Enter the Third Mean time Between Failure in hours ');
MTBF4= input('Enter the Fourth Mean time Between Failure in hours ');
MTTRs = input('Enter the Mean time To Repair in hours For Calculating Serviceability ') ;
MTTR = linspace(0,1000,100);
%Availability
%%% Availability = (MTBF/(MTBF+MTTR)) * 100%
%% MTBF is mean time between failure
%% MTTR is mean time to repair
%% MTBF is the Inverse of ?
%% ? is the Failure Rate
%% MTBF = 1/?
%% MTTR is directly Proportional to Message Latency
%% MTTR ~ 8d
%% d is the message latency in time
%% Failure Rate
%% ? is calculated as the Percentage of failed nodes within WSN
for i=1:100
a1(i)=MTTR(i)+MTBF1;
end
for i=1:100
av1(i)=MTBF1/a1(i);
end
for i=1:100
a2(i)=MTTR(i)+MTBF2;
end
for i=1:100
av2(i)=MTBF2/a2(i);
end
for i=1:100
a3(i)=MTTR(i)+MTBF3;
end
for i=1:100
av3(i)=MTBF3/a3(i);
end
for i=1:100
a4(i)=MTTR(i)+MTBF4;
end
for i=1:100
av4(i)=MTBF4/a4(i);
end
av = [ av1 av2 av3 av4];
MTTR= [ MTTR MTTR MTTR MTTR];
subplot(2,2,1);
plot(MTTR,av);
%% Reliability
%%R(t) = exp(-?t)
%% ? is Failure Rate (Inverse of MTBF)
%% t is the length of time the system must function
%% R(t) is reliability over time t
t = linspace(0,10000,1000);
for i=1:1000
rel(i)= exp(-(t(i)/MTBF1));
end
subplot(2,2,2);
plot(t,rel);
%%Serviceability
t1 = linspace(0,100,1000);
for i=1:1000
ser(i)= exp(-(t1(i)/MTTRs));
end
subplot(2,2,3)
plot(t1,ser);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -