-
Notifications
You must be signed in to change notification settings - Fork 0
/
Model3-etaK
43 lines (29 loc) · 768 Bytes
/
Model3-etaK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#Cost of the minimal repair
cmin<-100
#Partial renewal cost
cpr<-500
#overhaul cost
cov<-10000
#Shape parameter of Weibull distribution
beta<-1.5
#time
T<-1
#Empty list for cost per unit time
etalist = c()
#Empty list for number of partial renewal
Klist = c()
i<-0
for(K in seq(0, 6, by = 0.01)) {
Klist[i] <-K
part=(exp(beta*K)-1)/(exp(beta)-1)
#Define cumulative hazard rate of Weibull distribution
HT[i]<--pweibull(T, 1, 1.5, log.p = TRUE, lower.tail = FALSE)
#Average cost per unit time
etaK<-((HT*part*cmin)+(K-1)*cpr+cov)/K*T
etalist[i]<-etaK
i<-i+1
}
y<-min(etalist)
x<-Klist[which.min(etalist)]
plot(cbind(Klist,etalist),type = "l",xlab= "Number of partial renewal (K)",ylab="Cost per unit time")
points(cbind(x,y),col="red")