library(CARMS)

# usage carms.make<-function(title, diagram_grid=c(12,12),...)
Pa3FR<-carms.make(title="Parallel    Different failure and repair rates", diagram_grid=c(15,12))
#usage carms.state<-function(x, prob,  name, size=4, h2w=21/24, position, plot.color=NULL,  description="")
Pa3FR<-carms.state(Pa3FR, prob=1, name="111", size=4, h2w=18/19, position=c(2,7) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="011", size=4, h2w=18/19, position=c(5,2) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="101", size=4, h2w=18/19, position=c(5,7) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="110", size=4, h2w=18/19, position=c(5,12) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="001", size=4, h2w=18/19, position=c(8,2) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="010", size=4, h2w=18/19, position=c(8,7) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="100", size=4, h2w=18/19, position=c(8,12) )
Pa3FR<-carms.state(Pa3FR, prob=0, name="000", size=4, h2w=18/19, position=c(11,7) )


# carms.base(x, value, time_units=NULL, base_label=NULL, description="")
Pa3FR<-carms.base(Pa3FR, 1e-1, time_units="hours", description="lambda 1")
Pa3FR<-carms.base(Pa3FR, 2e-1, description="lambda 2")
Pa3FR<-carms.base(Pa3FR, 3e-1, description="lambda 3")
Pa3FR<-carms.base(Pa3FR, 1, description="mu 1")
Pa3FR<-carms.base(Pa3FR, 2, description="mu 2")
Pa3FR<-carms.base(Pa3FR, 3, description="mu 3")

# carms.arrow(x, from, to, rate, arc=0.35, arrow.position=0.5, label="")
Pa3FR<-carms.arrow(Pa3FR, from=1, to=2, rate="b1", arc=.25, label="lam 1")
Pa3FR<-carms.arrow(Pa3FR, from=2, to=1, rate="b4", arc=.05, label="mu 1")
Pa3FR<-carms.arrow(Pa3FR, from=1, to=3, rate="b2", arc=.2, label="lam 2")
Pa3FR<-carms.arrow(Pa3FR, from=3, to=1, rate="b5", arc=.2, label="mu 2")
Pa3FR<-carms.arrow(Pa3FR, from=1, to=4, rate="b3", arc=.05, label="lam 3")
Pa3FR<-carms.arrow(Pa3FR, from=4, to=1, rate="b6", arc=.25, label="mu 3")
Pa3FR<-carms.arrow(Pa3FR, from=2, to=5, rate="b2", arc=.25, label="lam 2")
Pa3FR<-carms.arrow(Pa3FR, from=5, to=2, rate="b5", arc=-.05, label="mu 2")
Pa3FR<-carms.arrow(Pa3FR, from=2, to=6, rate="b3", arc=.15, label="lam 3")
Pa3FR<-carms.arrow(Pa3FR, from=6, to=2, rate="b6", arc=.15, label="mu 3")
Pa3FR<-carms.arrow(Pa3FR, from=3, to=5, rate="b1", arc=.15, label="lam 1")
Pa3FR<-carms.arrow(Pa3FR, from=5, to=3, rate="b4", arc=.15, label="mu 1")
Pa3FR<-carms.arrow(Pa3FR, from=3, to=7, rate="b3", arc=.15, label="lam 3")
Pa3FR<-carms.arrow(Pa3FR, from=7, to=3, rate="b6", arc=.15, label="mu 3")
Pa3FR<-carms.arrow(Pa3FR, from=4, to=6, rate="b1", arc=.15, label="lam 1")
Pa3FR<-carms.arrow(Pa3FR, from=6, to=4, rate="b4", arc=.15, label="mu 1")
Pa3FR<-carms.arrow(Pa3FR, from=4, to=7, rate="b2", arc=-.05, label="lam 2")
Pa3FR<-carms.arrow(Pa3FR, from=7, to=4, rate="b5", arc=.35, label="mu 2")
Pa3FR<-carms.arrow(Pa3FR, from=5, to=8, rate="b3", arc=.3, label="lam 3")
Pa3FR<-carms.arrow(Pa3FR, from=8, to=5, rate="b6", arc=.05, label="mu 3")
Pa3FR<-carms.arrow(Pa3FR, from=6, to=8, rate="b2", arc=.2, label="lam 2")
Pa3FR<-carms.arrow(Pa3FR, from=8, to=6, rate="b5", arc=.2, label="mu 2")
Pa3FR<-carms.arrow(Pa3FR, from=7, to=8, rate="b1", arc=.05, label="lam 1")
Pa3FR<-carms.arrow(Pa3FR, from=8, to=7, rate="b4", arc=.3, label="mu 1")
	dev.new(width=15, height=10, unit="in")
	diagram(Pa3FR)
# usage: simulate.carms(x, solution, mission_time, intervals=50, cycles=2000)
Pa3FR<-simulate.carms(Pa3FR, "rk", mission_time=2, intervals=50)

plot(Pa3FR)
