def ctmc_switch(alpha_sp, mu_esw, plambda_esw): switch = relpy.CTMC("switch") switch.add_trans("UP", "DN", plambda_esw) switch.add_trans("DN", "RP", alpha_sp) switch.add_trans("RP", "UP", mu_esw) switch.add_reward("UP", relpy.Const(1)) return switch
def ctmc_processor(alpha_sp, mu_cpu, plambda_cpu): processor = relpy.CTMC("processor") processor.add_trans("UP", "D1", (relpy.Const(2) * plambda_cpu)) processor.add_trans("D1", "RP", alpha_sp) processor.add_trans("RP", "UP", mu_cpu) processor.add_reward("UP", relpy.Const(1)) return processor
def ctmc_nic(alpha_sp, mu_nic, plambda_nic): nic = relpy.CTMC("nic") nic.add_trans("UP", "DN", plambda_nic) nic.add_trans("DN", "RP", alpha_sp) nic.add_trans("RP", "UP", mu_nic) nic.add_reward("UP", relpy.Const(1)) return nic
def ctmc_base(alpha_sp, mu_base, plambda_base): base = relpy.CTMC("base") base.add_trans("UP", "DN", plambda_base) base.add_trans("DN", "RP", alpha_sp) base.add_trans("RP", "UP", mu_base) base.add_reward("UP", relpy.Const(1)) return base
def ctmc_memory(alpha_sp, mu_mem, plambda_mem): memory = relpy.CTMC("memory") memory.add_trans("UP", "D1", (relpy.Const(4) * plambda_mem)) memory.add_trans("D1", "RP", alpha_sp) memory.add_trans("RP", "UP", mu_mem) memory.add_reward("UP", relpy.Const(1)) return memory
def ctmc_OS(alpha_sp, b_os, beta_os, delta_os, mu_os, plambda_os): OS = relpy.CTMC("OS") OS.add_trans("UP", "DN", plambda_os) OS.add_trans("DN", "DT", delta_os) OS.add_trans("DT", "UP", (b_os * beta_os)) OS.add_trans("DT", "DW", ((relpy.Const(1) - b_os) * beta_os)) OS.add_trans("DW", "RP", alpha_sp) OS.add_trans("RP", "UP", mu_os) OS.add_reward("UP", relpy.Const(1)) return OS
def ctmc_midplane(alpha_sp, c_mp, mu_mp, plambda_mp): midplane = relpy.CTMC("midplane") midplane.add_trans("UP", "DN", (c_mp * plambda_mp)) midplane.add_trans("UP", "U1", ((relpy.Const(1) - c_mp) * plambda_mp)) midplane.add_trans("U1", "RP", alpha_sp) midplane.add_trans("RP", "UP", mu_mp) midplane.add_trans("DN", "RP", alpha_sp) midplane.add_reward("UP", relpy.Const(1)) midplane.add_reward("U1", relpy.Const(1)) return midplane
def ctmc_cooling(alpha_sp, mu_2c, mu_c, plambda_c): cooling = relpy.CTMC("cooling") cooling.add_trans("UP", "U1", (relpy.Const(2) * plambda_c)) cooling.add_trans("U1", "RP", alpha_sp) cooling.add_trans("U1", "DN", plambda_c) cooling.add_trans("DN", "DW", alpha_sp) cooling.add_trans("RP", "UP", mu_c) cooling.add_trans("RP", "DW", plambda_c) cooling.add_trans("DW", "UP", mu_2c) cooling.add_reward("UP", relpy.Const(1)) cooling.add_reward("U1", relpy.Const(1)) cooling.add_reward("RP", relpy.Const(1)) return cooling
def ctmc_disk(alpha_sp, chi_hd, mu_2hd, mu_hd, plambda_hd): disk = relpy.CTMC("disk") disk.add_trans("UP", "U1", (relpy.Const(2) * plambda_hd)) disk.add_trans("U1", "RP", alpha_sp) disk.add_trans("RP", "CP", mu_hd) disk.add_trans("CP", "DW", plambda_hd) disk.add_trans("U1", "DN", plambda_hd) disk.add_trans("DN", "DW", alpha_sp) disk.add_trans("CP", "UP", chi_hd) disk.add_trans("DW", "UP", mu_2hd) disk.add_reward("UP", relpy.Const(1)) disk.add_reward("U1", relpy.Const(1)) disk.add_reward("CP", relpy.Const(1)) return disk
def ctmc_power(alpha_sp, c_ps, mu_2ps, mu_ps, plambda_ps): power = relpy.CTMC("power") power.add_trans("UP", "U1", ((relpy.Const(2) * c_ps) * plambda_ps)) power.add_trans("UP", "DN", ((relpy.Const(2) * (relpy.Const(1) - c_ps)) * plambda_ps)) power.add_trans("U1", "RP", alpha_sp) power.add_trans("U1", "DN", plambda_ps) power.add_trans("DN", "DW", alpha_sp) power.add_trans("RP", "UP", mu_ps) power.add_trans("RP", "DW", plambda_ps) power.add_trans("DW", "UP", mu_2ps) power.add_reward("UP", relpy.Const(1)) power.add_reward("U1", relpy.Const(1)) power.add_reward("RP", relpy.Const(1)) return power
def ctmc_pxy_pairup(pxy_b, pxy_beta_m, pxy_c, pxy_d, pxy_delta1, pxy_delta2, pxy_delta_m, pxy_e, pxy_gamma, pxy_mu, pxy_phi, pxy_q, pxy_r, pxy_rou_a, pxy_rou_m): pxy_pairup = relpy.CTMC("pxy_pairup") pxy_pairup.add_trans("2U", "UO", (relpy.Const(2) * pxy_gamma)) pxy_pairup.add_trans("UO", "1D", (pxy_d * pxy_delta1)) pxy_pairup.add_trans("UO", "2D", (pxy_e * pxy_delta2)) pxy_pairup.add_trans("UO", "1N", ((relpy.Const(1) - pxy_d) * pxy_delta1)) pxy_pairup.add_trans("1N", "2D", (pxy_e * pxy_delta2)) pxy_pairup.add_trans("1N", "UN", ((relpy.Const(1) - pxy_e) * pxy_delta2)) pxy_pairup.add_trans("UO", "2N", ((relpy.Const(1) - pxy_e) * pxy_delta2)) pxy_pairup.add_trans("2N", "UN", ((relpy.Const(1) - pxy_d) * pxy_delta1)) pxy_pairup.add_trans("2N", "1D2N", (pxy_d * pxy_delta1)) pxy_pairup.add_trans("1D", "SO", (pxy_c * pxy_phi)) pxy_pairup.add_trans("1D", "SN", ((relpy.Const(1) - pxy_c) * pxy_phi)) pxy_pairup.add_trans("SO", "UA", (pxy_e * pxy_delta2)) pxy_pairup.add_trans("SO", "UR", ((relpy.Const(1) - pxy_e) * pxy_delta2)) pxy_pairup.add_trans("SN", "UC", (pxy_e * pxy_delta2)) pxy_pairup.add_trans("SN", "US", ((relpy.Const(1) - pxy_e) * pxy_delta2)) pxy_pairup.add_trans("2D", "1D2D", pxy_delta1) pxy_pairup.add_trans("1D2D", "UA", (pxy_c * pxy_phi)) pxy_pairup.add_trans("1D2D", "UC", ((relpy.Const(1) - pxy_c) * pxy_phi)) pxy_pairup.add_trans("UA", "UR", ((relpy.Const(1) - pxy_q) * pxy_rou_a)) pxy_pairup.add_trans("UA", "2U", (pxy_q * pxy_rou_a)) pxy_pairup.add_trans("UR", "2U", (pxy_r * pxy_rou_m)) pxy_pairup.add_trans("UR", "UB", ((relpy.Const(1) - pxy_r) * pxy_rou_m)) pxy_pairup.add_trans("UB", "2U", pxy_beta_m) pxy_pairup.add_trans("UC", "US", ((relpy.Const(1) - pxy_q) * pxy_rou_a)) pxy_pairup.add_trans("UC", "2U", (pxy_q * pxy_rou_a)) pxy_pairup.add_trans("US", "2U", (pxy_r * pxy_rou_m)) pxy_pairup.add_trans("US", "UT", ((relpy.Const(1) - pxy_r) * pxy_rou_m)) pxy_pairup.add_trans("UT", "2U", (pxy_b * pxy_beta_m)) pxy_pairup.add_trans("UT", "RP", ((relpy.Const(1) - pxy_b) * pxy_beta_m)) pxy_pairup.add_trans("RP", "2U", pxy_mu) pxy_pairup.add_trans("UN", "MD", pxy_delta_m) pxy_pairup.add_trans("MD", "1D2N", pxy_delta1) pxy_pairup.add_trans("1D2N", "UR", (pxy_c * pxy_phi)) pxy_pairup.add_trans("1D2N", "US", ((relpy.Const(1) - pxy_c) * pxy_phi)) pxy_pairup.add_init("2U", relpy.Const(1)) return pxy_pairup
def ctmc_pairup(b, beta_m, c, d, delta1, delta2, delta_m, e, gamma, mu, phi, q, r, rou_a, rou_m): pairup = relpy.CTMC("pairup") pairup.add_trans("2U", "UO", (relpy.Const(2) * gamma)) pairup.add_trans("UO", "1D", (d * delta1)) pairup.add_trans("UO", "2D", (e * delta2)) pairup.add_trans("UO", "1N", ((relpy.Const(1) - d) * delta1)) pairup.add_trans("1N", "2D", (e * delta2)) pairup.add_trans("1N", "UN", ((relpy.Const(1) - e) * delta2)) pairup.add_trans("UO", "2N", ((relpy.Const(1) - e) * delta2)) pairup.add_trans("2N", "UN", ((relpy.Const(1) - d) * delta1)) pairup.add_trans("2N", "1D2N", (d * delta1)) pairup.add_trans("1D", "FS", (c * phi)) pairup.add_trans("1D", "FN", ((relpy.Const(1) - c) * phi)) pairup.add_trans("S", "UA", (e * delta2)) pairup.add_trans("S", "UR", ((relpy.Const(1) - e) * delta2)) pairup.add_trans("N", "UC", (e * delta2)) pairup.add_trans("N", "US", ((relpy.Const(1) - e) * delta2)) pairup.add_trans("2D", "1D2D", delta1) pairup.add_trans("1D2D", "UA", (c * phi)) pairup.add_trans("1D2D", "UC", ((relpy.Const(1) - c) * phi)) pairup.add_trans("UA", "UR", ((relpy.Const(1) - q) * rou_a)) pairup.add_trans("UA", "2U", (q * rou_a)) pairup.add_trans("UR", "2U", (r * rou_m)) pairup.add_trans("UR", "UB", ((relpy.Const(1) - r) * rou_m)) pairup.add_trans("UB", "2U", beta_m) pairup.add_trans("UC", "US", ((relpy.Const(1) - q) * rou_a)) pairup.add_trans("UC", "2U", (q * rou_a)) pairup.add_trans("US", "2U", (r * rou_m)) pairup.add_trans("US", "UT", ((relpy.Const(1) - r) * rou_m)) pairup.add_trans("UT", "2U", (b * beta_m)) pairup.add_trans("UT", "RP", ((relpy.Const(1) - b) * beta_m)) pairup.add_trans("RP", "2U", mu) pairup.add_trans("UN", "MD", delta_m) pairup.add_trans("MD", "1D2N", delta1) pairup.add_trans("1D2N", "UR", (c * phi)) pairup.add_trans("1D2N", "US", ((relpy.Const(1) - c) * phi)) pairup.add_init("2U", relpy.Const(1)) return pairup
def ctmc_proxy(pxy_b, pxy_beta_m, pxy_d, pxy_delta1, pxy_delta2, pxy_delta_m, pxy_e, pxy_gamma, pxy_mu, pxy_q, pxy_r, pxy_rou_a, pxy_rou_m): proxy = relpy.CTMC("proxy") proxy.add_trans("UP", "UO", pxy_gamma) proxy.add_trans("UO", "UA", (pxy_e * pxy_delta2)) proxy.add_trans("UO", "1N", ((relpy.Const(1) - pxy_d) * pxy_delta1)) proxy.add_trans("UO", "2N", ((relpy.Const(1) - pxy_e) * pxy_delta2)) proxy.add_trans("1N", "UA", (pxy_e * pxy_delta2)) proxy.add_trans("1N", "UN", ((relpy.Const(1) - pxy_e) * pxy_delta2)) proxy.add_trans("2N", "UR", (pxy_d * pxy_delta1)) proxy.add_trans("2N", "UN", ((relpy.Const(1) - pxy_d) * pxy_delta1)) proxy.add_trans("UA", "UR", ((relpy.Const(1) - pxy_q) * pxy_rou_a)) proxy.add_trans("UR", "UB", ((relpy.Const(1) - pxy_r) * pxy_rou_m)) proxy.add_trans("UB", "RE", ((relpy.Const(1) - pxy_b) * pxy_beta_m)) proxy.add_trans("UO", "1D", (pxy_d * pxy_delta1)) proxy.add_trans("1D", "UA", (pxy_e * pxy_delta2)) proxy.add_trans("1D", "UR", ((relpy.Const(1) - pxy_e) * pxy_delta2)) proxy.add_trans("UN", "UR", pxy_delta_m) proxy.add_trans("UA", "UP", (pxy_q * pxy_rou_a)) proxy.add_trans("UR", "UP", (pxy_r * pxy_rou_m)) proxy.add_trans("UB", "UP", (pxy_b * pxy_beta_m)) proxy.add_trans("RE", "UP", pxy_mu) proxy.add_reward("UP", relpy.Const(1)) return proxy
def ctmc_appserver(b, beta_m, d, delta1, delta2, delta_m, e, gamma, mu, q, r, rou_a, rou_m): appserver = relpy.CTMC("appserver") appserver.add_trans("UP", "UO", gamma) appserver.add_trans("UO", "UA", (e * delta2)) appserver.add_trans("UO", "1D", (d * delta1)) appserver.add_trans("UO", "1N", ((relpy.Const(1) - d) * delta1)) appserver.add_trans("UO", "2N", ((relpy.Const(1) - e) * delta2)) appserver.add_trans("1N", "UA", (e * delta2)) appserver.add_trans("1N", "UN", ((relpy.Const(1) - e) * delta2)) appserver.add_trans("2N", "UR", (d * delta1)) appserver.add_trans("2N", "UN", ((relpy.Const(1) - d) * delta1)) appserver.add_trans("1D", "UA", (e * delta2)) appserver.add_trans("1D", "UR", ((relpy.Const(1) - e) * delta2)) appserver.add_trans("UA", "UR", ((relpy.Const(1) - q) * rou_a)) appserver.add_trans("UR", "UB", ((relpy.Const(1) - r) * rou_m)) appserver.add_trans("UB", "RE", ((relpy.Const(1) - b) * beta_m)) appserver.add_trans("UN", "UR", delta_m) appserver.add_trans("UA", "UP", (q * rou_a)) appserver.add_trans("UR", "UP", (r * rou_m)) appserver.add_trans("UB", "UP", (b * beta_m)) appserver.add_trans("RE", "UP", mu) appserver.add_reward("UP", relpy.Const(1)) return appserver