2

I am trying to learn DES with R for solving maintenance optimization problem. However, I am getting very confused if it is actually a good tool for this.

As an initial trial, I have posted here a very simple problem where a component is functioning at state 0 and failed at state 1 as in image. Both failure and repair times are exponentially distributed with associated rates $\lambda$ and $\mu$ respectively.

My objective is to find the unavailability of the system which is the amount of time system spends on failure state (1) as in image.

I set up the model with simmer as follows (Reproducible):

library(simmer)
library(simmer.plot)
library(magrittr)

set.seed(1234)
env.fr <- simmer("FailureRepair")

lambda <- 1/1000
mu <- 1/10

traj <- trajectory() %>%
  seize("Repairman") %>%
  timeout(function() rexp(1, mu)) %>%
  release("Repairman")

env.fr %>%
  add_resource("Repairman", queue_size = Inf) %>%
  add_generator("failure", traj, function() rexp(1, lambda)) %>%
  run(until = 10000000)

Can anyone help to verify if this representation is correct and how can I calculate the time spent in any of these states?

One component failure and repair system

pjs
  • 18,696
  • 4
  • 27
  • 56
Rel_Ai
  • 581
  • 2
  • 11

1 Answers1

1

I am fairly confident that my representation is correct for the problem I posted.

Regarding the calculation of unavailability, as this is a 1 component system with no time loss when switching between failure and repair, unavailability can be easily calculated using "activity_time". This is the time when resource was occupied.

env.fr <- simmer("FailureRepair")

MTTF <- 1000
MTTR <- 10

lambda <- 1/MTTF # Failure rate
mu <- 1/MTTR # Repair rate

traj <- trajectory() %>%
  seize("Repairman") %>%
  timeout(function() rexp(1, mu)) %>%
  release("Repairman")

env.fr %>%
  add_resource("Repairman", queue_size = Inf) %>%
  add_generator("failure", traj, function() rexp(1, lambda)) %>%
  run(until = 1000000)


# Calculations of unavailability
aggregate(cbind(server, queue) ~ resource, get_mon_resources(env.fr), mean)

a <- env.fr %>% get_mon_arrivals()

uSim <- sum(a$activity_time)/1000000 # Calculating unavailability from the simulation 

uAnaly <- MTTR/(MTTF + MTTR) # Analytical solution

Rel_Ai
  • 581
  • 2
  • 11