# Variables
Rsys = 0.99 #Minimum Acceptable System Reliabilty
n = 15.; #Number of identical Components
# Calculations
q = (1-Rsys)/n; #Probability of component failure
Ri = 1-q; #Approximate value of the component reliability
# Results
print 'The Approximate Value of The component reliability is %g'%(Ri)
# Variables
L = 4.; #Total Length of the cable
Lov = 3.; #Length of Overhead Cable
Lu = L-Lov; #Length of Underground Cable
Nct = 2.; #Number of circuit terminations
T = 10.; #No of years for which the record is shown
Fov = 2.; # Faults Per Mile of the Over Head Cable
Fu = 1.; #Faults Per Mile of The Underground cable
Ct = 0.3/100 # Cable Termination Fault Rate
#Repair Time
Tov = 3.; #Over Head
Tu = 28.; #Underground
Tct = 3.; #Cable Termination
# Calculations
lamdaFDR = (Lov*Fov/T)+(Lu*Fu/T)+(2*Ct); #Total Annual Fault Rate
rFDR = ((Tov*Lov*Fov/T)+(Tu*Lu*Fu/T)+(2*Ct*Tct))/lamdaFDR; #Annual Fault Restoration Time
mFDR = 8760-rFDR; #Annual Mean Time of Failure
UFDR = rFDR*100/(rFDR+mFDR); #Unavailability of Feeder
AFDR = 100-UFDR; #Availability of Feeder
# Results
print 'a) The Total Annual Fault Rate is %g faults per year'%(lamdaFDR)
print 'b) The Annual Fault Restoration Time is %g hours per fault per year'%(rFDR)
print 'c) Unavailability of the feeder is %g percent'%(UFDR)
print 'd) Availability of the feeder is %g percent'%(AFDR)
import math
# Variables
#Annual average Fault rates
Fm = 0.08;
Fl = 0.2;
#Average Repair Times
Rm = 3.5; #Main
Rl = 1.5; #Lateral
Rs = 0.75; #Manual Sections
# Dismath.tances of the Lateral Feeders of A,B, and C respectively
Lla = 2.;
Llb = 1.5;
Llc = 1.5;
# Dismath.tances of the Main Feeders of A,B, and C respectively
Lma = 1.;
Lmb = 1.;
Lmc = 1.;
# Calculations
TFm = (Lma*Fm)+(Lmc*Fm)+(Lmb*Fm); #Annual Fault of the Main Sections
def SusInt(y):
return TFm+(Fl*y)
#Sustained Interruption Rates for A,B and C
IrA = SusInt(Lla);
IrB = SusInt(Llb);
IrC = SusInt(Llc);
#Annual Repair time for A,B and C
rA = ((Lma*Fm*Rm)+(Lmb*Fm*Rs)+(Lmc*Fm*Rs)+(Lla*Fl*Rl))/IrA;
rB = ((Lma*Fm*Rm)+(Lmb*Fm*Rm)+(Lmc*Fm*Rs)+(Llb*Fl*Rl))/IrB;
rC = ((Lma*Fm*Rm)+(Lmb*Fm*Rm)+(Lmc*Fm*Rm)+(Llc*Fl*Rl))/IrC;
# Results
print 'i The Annual Sustained Interruption Rates for:'
print 'Customer A : %g faults per year'%(IrA)
print 'Customer B : %g faults per year'%(IrB)
print 'Customer C : %g faults per year'%(IrC)
print 'ii The Average Annual Repair Time Restoration Time for:'
print 'Customer A : %g hours per fault per year'%(rA)
print 'Customer A : %g hours per fault per year'%(rB)
print 'Customer A : %g hours per fault per year'%(rC)
import math
# Variables
Ri = 0.85;
def relp(y,z):
return 1-((1-(Ri**y))**z) #Equal Parallel Combination
def rels(y,z):
return (1-((1-Ri)**y))**z #Equal Series Combination
# Calculations
#Case 1: 4 elements in series
Req1 = rels(1,4);
#Case 2: Two Comination of 4 elements in series, parallel to each other
Req2 = relp(4,2);
#Case 3 : ((two elements in series) #(two elements in series))in series with ((two elements in series) #(two elements in series))
#Two Segments
R1 = relp(2,2);
R2 = relp(2,2);
Req3 = R1*R2;
#Case 4 : (two elements in parallel)in series with ((three elements in series) #(three elements in series))
#Two Segments
R1 = relp(1,2);
R2 = relp(3,2);
Req4 = R1*R2;
#Case 5, 4 groups of (2 elements in parallel) connected in series to each other
Req5 = rels(2,4);
# Results
print 'The Equivalent System reliability for:'
print 'a) Configuration A : %g'%(Req1)
print 'b) Configuration B : %g'%(Req2)
print 'c) Configuration C : %g'%(Req3)
print 'd) Configuration D : %g'%(Req4)
print 'e) Configuration E : %g'%(Req5)
import math
#To Design the system to meet the given Equivalent System Reliability
#Page 614
# Variables
#Individual System Reliabilities
Ra = 0.8;
Rb = 0.95;
Rc = 0.99;
Rd = 0.90;
Re = 0.65;
# Calculations
#When All Are Connected in Series
Req = Ra*Rb*Rc*Rd*Re; #Equivalent System Reliability
Rr = 0.8; #Required
Rae = Rr/(Rb*Rc*Rd);
#Since Connecting the elements in parallel will increase their reliability
def rel(Ri,y,):
return (1-((1-Ri)**y)) #Equal Only Parallel Combination
#Since Connecting the elements in parallel will increase their reliability
#Conditions to Find The Number of Elements to be used
for i in range(1,11):
L = i; #Number of Time Element A is used
R1 = rel(Ra,i);
X = R1-Rae;
if(abs(X)+X == 0):
continue;
else:
break;
for i in range(1,11):
M = i; #Number of Time Element E is used
R2 = rel(Re,i);
X = R2-Rae;
if(abs(X)+X == 0):
continue;
else:
break;
print 'a) The Equivalent system Reliability is %g'%(Req)
print 'b) One Each of B,C and D all connected in series are connected in serieswith the series combination of XComination of\
%g elements of A, \nAll Connected in Parallel)and YComination of %g elements of E, \nAll Connected in Parallel) to\
achieve %g Equivalent System Realibility'%(L,M,Rr)
import math
#To Find The Probability on the reliability of transformers
#Page 614
# Variables
#Reliabilities of The Three Transformers
Pa = 0.9;
Pb = 0.95;
Pc = 0.99;
#Faliures of Three Transformers
Qa = 1-Pa;
Qb = 1-Pb;
Qc = 1-Pc;
# Calculations
#Probability of NO Transformer Failing
Pnf = Pa*Pb*Pc;
PfA = Qa*Pb*Pc #Probability of Transformer A Failing
PfB = Pa*Qb*Pc #Probability of Transformer B Failing
PfC = Pa*Pb*Qc #Probability of Transformer C Failing
PfAB = Qa*Qb*Pc #Probability of Transformer A and B Failing
PfBC = Pa*Qb*Qc #Probability of Transformer B and C Failing
PfCA = Qa*Pb*Qc #Probability of Transformer C and A Failing
Pf = Qa*Qb*Qc; #Probability of All Transformers failing
# Results
print 'a) Probability of No Transformer Failing is %g'%(Pnf)
print 'b'
print 'Probability of Transformer A Failing is %g'%(PfA)
print 'Probability of Transformer B Failing is %g'%(PfB)
print 'Probability of Transformer C Failing is %g'%(PfC)
print 'c'
print 'Probability of Transformers A and B Failing is %g'%(PfAB)
print 'Probability of Transformers B and C Failing is %g'%(PfBC)
print 'Probability of Transformers C and A Failing is %g'%(PfCA)
print 'd) Probability of All Three Transformers Failing is %g'%(Pf)
import math
#To Determine Probabilities Using Markovian Principle
#Page 619
# Variables
#Conditional Probabilites Present Future
Pdd = 2./100; #Down Down
Pud = 5./100; #Up Down
Pdu = 1-Pdd; #Down up
Puu = 1-Pud; #Up Up
# Calculations
P = [[Pdd,Pdu],[Pud,Puu]]; #Transition Matrix
# Results
print 'a The Conditional Probabilites for'
print 'Transformers Down in Present and Down in Future is %g'%(Pdd)
print 'Transformers Down in Present and Up in Future is %g'%(Pdd)
print 'Transformers Up in Present and Down in Future is %g'%(Pdd)
print 'Transformers Up in Present and Up in Future is %g'%(Pdd)
print 'b The Transition Matrix is',
print (P)
print 'c The Transition Diagram can be viewed with the result file attached to this code'
import math
#To Determine the Conditional Outage Probabilites
#Page 620
# Calculations
#Conditional Outage Probabilites From The Table Given
P11 = 40./100;
P12 = 30./100;
P13 = 30./100;
P21 = 20./100;
P22 = 50./100;
P23 = 30./100;
P31 = 25./100;
P32 = 25./100;
P33 = 50./100;
#Transition Matrix
P = [[P11,P12,P13],[P21,P22,P23],[P31,P32,P33]];
print "a The Conditional Outage Probabilites for:"
print "Presently Outaged Feeder is 1, Next Outaged Feeder is 1 is %g"%(P11)
print "Presently Outaged Feeder is 1, Next Outaged Feeder is 2 is %g"%(P12)
print "Presently Outaged Feeder is 1, Next Outaged Feeder is 3 is %g"%(P13)
print "Presently Outaged Feeder is 2, Next Outaged Feeder is 1 is %g"%(P21)
print "Presently Outaged Feeder is 2, Next Outaged Feeder is 2 is %g"%(P22)
print "Presently Outaged Feeder is 2, Next Outaged Feeder is 3 is %g"%(P23)
print "Presently Outaged Feeder is 3, Next Outaged Feeder is 1 is %g"%(P31)
print "Presently Outaged Feeder is 3, Next Outaged Feeder is 2 is %g"%(P32)
print "Presently Outaged Feeder is 3, Next Outaged Feeder is 3 is %g"%(P33)
print "b Transition Matrix is"
print (P)
print "c The Transition figure is print layed in the result file attached to this code"
import math
from numpy import array
# Variables
P = array([[0.6,0.4],[0.3,0.7]]); #One Step Transition Matrix
Po = array([0.8,0.2]); #Initial State Probability Vector
# Calculations
#Funtion to determine the Vector of State Probability
def VSP(y):
return (Po*(P**y))
P1 = VSP(1); #Vector of State Probability at Time t1
P4 = VSP(4); #Vector of State Probability at Time t4
P8 = VSP(8); #Vector of State Probability at Time t8
# Results
print 'a The Vector of State Probability at time t1 is',
print (P1)
print 'a The Vector of State Probability at time t4 is',
print (P4)
print 'a The Vector of State Probability at time t8 is',
print (P8)