Generating time series for generator ON or OFF
I don't know of any method, but here are some small improvements:

(1) You want mix to be TTF and TTR intertwined. An easy, vectorized way to do that is:

mix &lt;- c(rbind(TTF,TTR))


(2) You want sw to be an alternating vector of the capacity and 0. This can be vectorized as well:

cap &lt;- 400
sw &lt;- rep(c(cap,0), length(TTF))


(3) Next, simply find the index which is the first value above 8736 and rep that:

final &lt;- 8736
ind &lt;- which.max(cumsum(mix) &gt; final)
out &lt;- rep(sw[1:ind], round(mix)[1:ind])[1:final]


So full code would be:

MTTF &lt;- 2940
MTTR &lt;- 60
final &lt;- 8736
cap &lt;- 400
TTF &lt;--MTTF*log(runif(100))
TTR &lt;--MTTR*log(runif(100))

mix &lt;- c(rbind(TTF,TTR))
sw &lt;- rep(c(cap,0), length(TTF))
ind &lt;- which.max(cumsum(mix) &gt; final)
out &lt;- rep(sw[1:ind], round(mix)[1:ind])[1:final]