Description Usage Arguments Details Value Author(s) See Also Examples

Simulates failures, expansion, rehabilitation, and costs of a water supply pipe network. The simulation is stochastic.

1 2 | ```
simulate_network.period(statelist, n.years, expansion, rehabilitation,
prob.failure, income = 0, free.expansion = TRUE)
``` |

`statelist` |
a state list |

`n.years` |
number of years to simulate |

`expansion` |
either a scalar describing the number of pipes added
every year to expand the pipe network, or a vector of length |

`rehabilitation` |
a (combination of) rehabilitation strategy function(s). See details below. |

`prob.failure` |
a function describing the probability of a pipe failing in the next year given its age, number of previous failures, and the age at the last failure (if any). |

`income` |
either a scalar describing the annual income, or a vector of length |

`free.expansion` |
if |

The rehabilitation is defined by combining different simple replacement strategies.
See the example for how this can be done using the `mystrategy`

function input.

The failure behavior is defined by the function `prob.failure`

.
It calculates the probability of a pipe failing within the next year based on pipe age,
pipe age at the last failure, and the number of failures. Note, the model
makes the assumption that a pipe cannot fail more than once per year.

The costs are calculated as a function of the pipe diameter, assuming all pipes have a length of 100 meters.

an updated state list

Andreas Scheidegger

`simulate_network`

provides a slightly more convenient interface.

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 44 45 46 47 48 49 50 51 52 53 54 55 56 | ```
## -----------
## define model parameters
## Define the annual probability of a failure
prob.failure.exp <- function(age, age.last.failure, n.failure) {
if(n.failure==0){
return(1/30)
} else {
return(1/10)
}
}
## define a complicated (and probably useless) rehabilitation strategy
mystrategy <- . %>%
replace.n.highest.risk(n=2, prob.failure=prob.failure.exp) %>%
replace.more.failures.than(failures=5) %>%
replace.older.than(age=70, max.cost=2e6) %>%
replace.n.oldest(n=3) %>%
replace.n.random(n=2)
## This means: every year (if we have enough budget!), replace first the 2 pipes
## with the highest risk, then all pipes with more than 5 failures,
## then all pipes older then 70 years (up to costs of 2e6), then the 3
## oldest pipes remaining, and finally replace 2 randomly selected pipes.
## -----------
## run the simulation in steps
statelist <- initiate.network(inventory = 50, budget = 1e7)
statelist <- simulate_network.period(
statelist, # state list to update
n.years = 20, # run it for 20 years
expansion = 10, # build 10 pipes per year (if money is available)
rehabilitation = mystrategy, # use the strategy defined above
prob.failure = prob.failure.exp, # use the probability function defined above
income = 1e6 # the annual income
)
statelist <- simulate_network.period(
statelist, # state list to update
n.years = 10, # run it for 10 more years
expansion = 2, # now, build only 2 pipes per year (if money is available)
rehabilitation = mystrategy, # use the strategy defined above
prob.failure = prob.failure.exp, # use the probability function defined above
income = 1e6 # the annual income
)
## look at some results
## str(statelist)
## str(statelist$time.30)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.