Generated Code
The following is python code generated by the CellML API from this CellML file. (Back to language selection)
The raw code is available.
# Size of variable arrays:
sizeAlgebraic = 199
sizeStates = 46
sizeConstants = 146
from math import *
from numpy import *
def createLegends():
legend_states = [""] * sizeStates
legend_rates = [""] * sizeStates
legend_algebraic = [""] * sizeAlgebraic
legend_voi = ""
legend_constants = [""] * sizeConstants
legend_voi = "time in component environment (millisecond)"
legend_constants[0] = "nao in component extracellular (millimolar)"
legend_constants[1] = "cao in component extracellular (millimolar)"
legend_constants[2] = "ko in component extracellular (millimolar)"
legend_constants[3] = "R in component physical_constants (joule_per_kilomole_kelvin)"
legend_constants[4] = "T in component physical_constants (kelvin)"
legend_constants[5] = "F in component physical_constants (coulomb_per_mole)"
legend_constants[6] = "zna in component physical_constants (dimensionless)"
legend_constants[7] = "zca in component physical_constants (dimensionless)"
legend_constants[8] = "zk in component physical_constants (dimensionless)"
legend_constants[9] = "L in component cell_geometry (centimeter)"
legend_constants[10] = "rad in component cell_geometry (centimeter)"
legend_constants[11] = "greekpi in component cell_geometry (dimensionless)"
legend_constants[119] = "vcell in component cell_geometry (microliter)"
legend_constants[123] = "Ageo in component cell_geometry (centimeter_squared)"
legend_constants[124] = "Acap in component cell_geometry (centimeter_squared)"
legend_constants[125] = "vmyo in component cell_geometry (microliter)"
legend_constants[126] = "vnsr in component cell_geometry (microliter)"
legend_constants[127] = "vjsr in component cell_geometry (microliter)"
legend_constants[128] = "vcsr in component cell_geometry (microliter)"
legend_constants[130] = "vsl in component cell_geometry (microliter)"
legend_constants[129] = "vss in component cell_geometry (microliter)"
legend_states[0] = "v in component membrane (millivolt)"
legend_algebraic[36] = "vffrt in component membrane (coulomb_per_mole)"
legend_algebraic[44] = "vfrt in component membrane (dimensionless)"
legend_algebraic[63] = "INa in component INa (microA_per_microF)"
legend_algebraic[65] = "INaL in component INaL (microA_per_microF)"
legend_algebraic[66] = "Ito in component Ito (microA_per_microF)"
legend_algebraic[68] = "Isus in component Isus (microA_per_microF)"
legend_algebraic[79] = "ICaL in component ICaL (microA_per_microF)"
legend_algebraic[82] = "ICaT in component ICaT (microA_per_microF)"
legend_algebraic[80] = "ICaNa in component ICaL (microA_per_microF)"
legend_algebraic[81] = "ICaK in component ICaL (microA_per_microF)"
legend_algebraic[87] = "IKr in component IKr (microA_per_microF)"
legend_algebraic[89] = "IKs in component IKs (microA_per_microF)"
legend_algebraic[92] = "If in component If (microA_per_microF)"
legend_algebraic[94] = "IK1 in component IK1 (microA_per_microF)"
legend_algebraic[126] = "INaCa_i in component INaCa_i (microA_per_microF)"
legend_algebraic[156] = "INaCa_ss in component INaCa_i (microA_per_microF)"
legend_algebraic[175] = "INaK in component INaK (microA_per_microF)"
legend_algebraic[176] = "INab in component INab (microA_per_microF)"
legend_algebraic[182] = "IpCa in component IpCa (microA_per_microF)"
legend_algebraic[179] = "ICab in component ICab (microA_per_microF)"
legend_algebraic[15] = "Istim in component membrane (microA_per_microF)"
legend_constants[12] = "amp in component membrane (microA_per_microF)"
legend_constants[13] = "duration in component membrane (millisecond)"
legend_constants[14] = "KmCaMK in component CaMK (millimolar)"
legend_constants[15] = "aCaMK in component CaMK (per_millimolar_per_millisecond)"
legend_constants[16] = "bCaMK in component CaMK (per_millisecond)"
legend_constants[17] = "CaMKo in component CaMK (dimensionless)"
legend_constants[18] = "KmCaM in component CaMK (millimolar)"
legend_algebraic[49] = "CaMKb in component CaMK (millimolar)"
legend_algebraic[50] = "CaMKa in component CaMK (millimolar)"
legend_states[1] = "CaMKt in component CaMK (millimolar)"
legend_states[2] = "cass in component intracellular_ions (millimolar)"
legend_constants[19] = "BSRmax in component intracellular_ions (millimolar)"
legend_constants[20] = "KmBSR in component intracellular_ions (millimolar)"
legend_constants[21] = "BSLmax in component intracellular_ions (millimolar)"
legend_constants[22] = "KmBSL in component intracellular_ions (millimolar)"
legend_constants[23] = "csqnmax in component intracellular_ions (millimolar)"
legend_constants[24] = "kmcsqn in component intracellular_ions (millimolar)"
legend_constants[25] = "csqnmaxsl in component intracellular_ions (millimolar)"
legend_constants[26] = "cmdnmax in component intracellular_ions (millimolar)"
legend_constants[27] = "kmcmdn in component intracellular_ions (millimolar)"
legend_constants[28] = "cmdnmaxsl in component intracellular_ions (millimolar)"
legend_constants[29] = "trpnmax in component intracellular_ions (millimolar)"
legend_constants[30] = "kmtrpn in component intracellular_ions (millimolar)"
legend_constants[31] = "trpnmaxsl in component intracellular_ions (millimolar)"
legend_states[3] = "nai in component intracellular_ions (millimolar)"
legend_states[4] = "nasl in component intracellular_ions (millimolar)"
legend_states[5] = "nass in component intracellular_ions (millimolar)"
legend_states[6] = "ki in component intracellular_ions (millimolar)"
legend_states[7] = "kss in component intracellular_ions (millimolar)"
legend_states[8] = "ksl in component intracellular_ions (millimolar)"
legend_states[9] = "cai in component intracellular_ions (millimolar)"
legend_states[10] = "casl in component intracellular_ions (millimolar)"
legend_states[11] = "cansr in component intracellular_ions (millimolar)"
legend_states[12] = "cajsr in component intracellular_ions (millimolar)"
legend_states[13] = "cacsr in component intracellular_ions (millimolar)"
legend_algebraic[90] = "IfNa in component If (microA_per_microF)"
legend_algebraic[91] = "IfK in component If (microA_per_microF)"
legend_algebraic[178] = "JdiffNa in component diff (millimolar_per_millisecond)"
legend_algebraic[181] = "JgapNa in component diff (millimolar_per_millisecond)"
legend_algebraic[183] = "Jdiff in component diff (millimolar_per_millisecond)"
legend_algebraic[184] = "Jgap in component diff (millimolar_per_millisecond)"
legend_algebraic[177] = "JdiffK in component diff (millimolar_per_millisecond)"
legend_algebraic[180] = "JgapK in component diff (millimolar_per_millisecond)"
legend_algebraic[189] = "Jup1 in component SERCA (millimolar_per_millisecond)"
legend_algebraic[190] = "Jup2 in component SERCA (millimolar_per_millisecond)"
legend_states[14] = "Jrel1 in component ryr (millimolar_per_millisecond)"
legend_states[15] = "Jrel2 in component ryr (millimolar_per_millisecond)"
legend_algebraic[193] = "Jip3 in component IP3 (millimolar_per_millisecond)"
legend_algebraic[195] = "Jtr1 in component trans_flux (millimolar_per_millisecond)"
legend_algebraic[197] = "Jtr2 in component trans_flux (millimolar_per_millisecond)"
legend_algebraic[51] = "Bcai in component intracellular_ions (dimensionless)"
legend_algebraic[54] = "Bcajsr in component intracellular_ions (dimensionless)"
legend_algebraic[55] = "Bcacsr in component intracellular_ions (dimensionless)"
legend_algebraic[52] = "Bcass in component intracellular_ions (dimensionless)"
legend_algebraic[53] = "Bcasl in component intracellular_ions (dimensionless)"
legend_constants[32] = "cm in component intracellular_ions (microF_per_centimeter_squared)"
legend_constants[33] = "PKNa in component reversal_potentials (dimensionless)"
legend_algebraic[56] = "ENa in component reversal_potentials (millivolt)"
legend_algebraic[57] = "EK in component reversal_potentials (millivolt)"
legend_algebraic[58] = "ECa in component reversal_potentials (millivolt)"
legend_algebraic[59] = "EKs in component reversal_potentials (millivolt)"
legend_algebraic[0] = "mss in component INa (dimensionless)"
legend_algebraic[16] = "tm in component INa (millisecond)"
legend_constants[34] = "mssV1 in component INa (millivolt)"
legend_constants[35] = "mssV2 in component INa (millivolt)"
legend_constants[36] = "mtV1 in component INa (millivolt)"
legend_constants[37] = "mtV2 in component INa (millivolt)"
legend_constants[38] = "mtD1 in component INa (dimensionless)"
legend_constants[39] = "mtD2 in component INa (dimensionless)"
legend_constants[40] = "mtV3 in component INa (millivolt)"
legend_constants[41] = "mtV4 in component INa (millivolt)"
legend_states[16] = "m in component INa (dimensionless)"
legend_algebraic[1] = "hss in component INa (dimensionless)"
legend_algebraic[17] = "thf in component INa (millisecond)"
legend_algebraic[18] = "ths in component INa (millisecond)"
legend_constants[42] = "hssV1 in component INa (millivolt)"
legend_constants[43] = "hssV2 in component INa (millivolt)"
legend_constants[112] = "Ahs in component INa (dimensionless)"
legend_constants[44] = "Ahf in component INa (dimensionless)"
legend_states[17] = "hf in component INa (dimensionless)"
legend_states[18] = "hs in component INa (dimensionless)"
legend_algebraic[60] = "h in component INa (dimensionless)"
legend_constants[45] = "GNa in component INa (milliS_per_microF)"
legend_algebraic[19] = "jss in component INa (dimensionless)"
legend_algebraic[37] = "tj in component INa (millisecond)"
legend_states[19] = "j in component INa (dimensionless)"
legend_algebraic[38] = "hssp in component INa (dimensionless)"
legend_algebraic[45] = "thsp in component INa (millisecond)"
legend_states[20] = "hsp in component INa (dimensionless)"
legend_algebraic[61] = "hp in component INa (dimensionless)"
legend_algebraic[46] = "tjp in component INa (millisecond)"
legend_states[21] = "jp in component INa (dimensionless)"
legend_algebraic[62] = "fINap in component INa (dimensionless)"
legend_algebraic[39] = "mLss in component INaL (dimensionless)"
legend_algebraic[47] = "tmL in component INaL (millisecond)"
legend_states[22] = "mL in component INaL (dimensionless)"
legend_constants[46] = "thL in component INaL (millisecond)"
legend_algebraic[2] = "hLss in component INaL (dimensionless)"
legend_states[23] = "hL in component INaL (dimensionless)"
legend_algebraic[3] = "hLssp in component INaL (dimensionless)"
legend_constants[113] = "thLp in component INaL (millisecond)"
legend_states[24] = "hLp in component INaL (dimensionless)"
legend_constants[47] = "GNaL in component INaL (milliS_per_microF)"
legend_algebraic[64] = "fINaLp in component INaL (dimensionless)"
legend_algebraic[4] = "ass in component Ito (dimensionless)"
legend_algebraic[20] = "taua in component Ito (millisecond)"
legend_algebraic[5] = "iss in component Ito (dimensionless)"
legend_algebraic[21] = "tauis in component Ito (millisecond)"
legend_algebraic[22] = "tauif in component Ito (millisecond)"
legend_states[25] = "a in component Ito (dimensionless)"
legend_states[26] = "i1 in component Ito (dimensionless)"
legend_states[27] = "i2 in component Ito (dimensionless)"
legend_constants[48] = "Gto in component Ito (milliS_per_microF)"
legend_constants[49] = "Gsus in component Isus (milliS_per_microF)"
legend_algebraic[67] = "asus in component Isus (dimensionless)"
legend_constants[50] = "Kmn in component ICaL (millimolar)"
legend_constants[51] = "k2n in component ICaL (per_millisecond)"
legend_algebraic[6] = "dss in component ICaL (dimensionless)"
legend_states[28] = "d in component ICaL (dimensionless)"
legend_algebraic[7] = "fss in component ICaL (dimensionless)"
legend_constants[114] = "Aff in component ICaL (dimensionless)"
legend_constants[120] = "Afs in component ICaL (dimensionless)"
legend_states[29] = "ff in component ICaL (dimensionless)"
legend_states[30] = "fs in component ICaL (dimensionless)"
legend_algebraic[69] = "f in component ICaL (dimensionless)"
legend_algebraic[23] = "fcass in component ICaL (dimensionless)"
legend_algebraic[70] = "Afcaf in component ICaL (dimensionless)"
legend_algebraic[71] = "Afcas in component ICaL (dimensionless)"
legend_states[31] = "fcaf in component ICaL (dimensionless)"
legend_states[32] = "fcas in component ICaL (dimensionless)"
legend_algebraic[72] = "fca in component ICaL (dimensionless)"
legend_states[33] = "jca in component ICaL (dimensionless)"
legend_states[34] = "ffp in component ICaL (dimensionless)"
legend_algebraic[73] = "fp in component ICaL (dimensionless)"
legend_states[35] = "fcafp in component ICaL (dimensionless)"
legend_algebraic[74] = "fcap in component ICaL (dimensionless)"
legend_algebraic[8] = "km2n in component ICaL (per_millisecond)"
legend_algebraic[24] = "anca in component ICaL (dimensionless)"
legend_states[36] = "nca in component ICaL (dimensionless)"
legend_algebraic[75] = "PhiCaL in component ICaL (dimensionless)"
legend_algebraic[76] = "PhiCaNa in component ICaL (dimensionless)"
legend_algebraic[77] = "PhiCaK in component ICaL (dimensionless)"
legend_constants[52] = "PCa in component ICaL (dimensionless)"
legend_constants[115] = "PCap in component ICaL (dimensionless)"
legend_constants[116] = "PCaNa in component ICaL (dimensionless)"
legend_constants[117] = "PCaK in component ICaL (dimensionless)"
legend_constants[121] = "PCaNap in component ICaL (dimensionless)"
legend_constants[122] = "PCaKp in component ICaL (dimensionless)"
legend_algebraic[78] = "fICaLp in component ICaL (dimensionless)"
legend_algebraic[25] = "td in component ICaL (millisecond)"
legend_algebraic[26] = "tff in component ICaL (millisecond)"
legend_algebraic[27] = "tfs in component ICaL (millisecond)"
legend_algebraic[40] = "tfcaf in component ICaL (millisecond)"
legend_algebraic[41] = "tfcas in component ICaL (millisecond)"
legend_constants[118] = "tjca in component ICaL (millisecond)"
legend_algebraic[42] = "tffp in component ICaL (millisecond)"
legend_algebraic[48] = "tfcafp in component ICaL (millisecond)"
legend_constants[53] = "GCaT in component ICaT (milliS_per_microF)"
legend_algebraic[9] = "bss in component ICaT (dimensionless)"
legend_algebraic[10] = "gss in component ICaT (dimensionless)"
legend_algebraic[28] = "taub in component ICaT (millisecond)"
legend_algebraic[29] = "taug in component ICaT (millisecond)"
legend_states[37] = "b in component ICaT (dimensionless)"
legend_states[38] = "g in component ICaT (dimensionless)"
legend_constants[54] = "GKr in component IKr (milliS_per_microF)"
legend_algebraic[11] = "xrss in component IKr (dimensionless)"
legend_algebraic[30] = "txrf in component IKr (millisecond)"
legend_algebraic[31] = "txrs in component IKr (millisecond)"
legend_algebraic[83] = "Axrf in component IKr (dimensionless)"
legend_algebraic[84] = "Axrs in component IKr (dimensionless)"
legend_states[39] = "xrf in component IKr (dimensionless)"
legend_states[40] = "xrs in component IKr (dimensionless)"
legend_algebraic[85] = "xr in component IKr (dimensionless)"
legend_algebraic[86] = "rkr in component IKr (dimensionless)"
legend_constants[55] = "GKs in component IKs (milliS_per_microF)"
legend_algebraic[12] = "xs1ss in component IKs (dimensionless)"
legend_algebraic[32] = "xs2ss in component IKs (dimensionless)"
legend_algebraic[33] = "txs1 in component IKs (millisecond)"
legend_states[41] = "xs1 in component IKs (dimensionless)"
legend_states[42] = "xs2 in component IKs (dimensionless)"
legend_algebraic[88] = "KsCa in component IKs (dimensionless)"
legend_algebraic[43] = "txs2 in component IKs (millisecond)"
legend_constants[56] = "GfNa in component If (milliS_per_microF)"
legend_constants[57] = "GfK in component If (milliS_per_microF)"
legend_algebraic[13] = "yss in component If (dimensionless)"
legend_algebraic[34] = "tauy in component If (millisecond)"
legend_states[43] = "y in component If (dimensionless)"
legend_constants[58] = "GK1 in component IK1 (milliS_per_microF)"
legend_algebraic[14] = "xk1ss in component IK1 (dimensionless)"
legend_algebraic[35] = "txk1 in component IK1 (millisecond)"
legend_states[44] = "xk1 in component IK1 (dimensionless)"
legend_algebraic[93] = "rk1 in component IK1 (millisecond)"
legend_constants[59] = "kna1 in component INaCa_i (per_millisecond)"
legend_constants[60] = "kna2 in component INaCa_i (per_millisecond)"
legend_constants[61] = "kna3 in component INaCa_i (per_millisecond)"
legend_constants[62] = "kasymm in component INaCa_i (dimensionless)"
legend_constants[63] = "wna in component INaCa_i (dimensionless)"
legend_constants[64] = "wca in component INaCa_i (dimensionless)"
legend_constants[65] = "wnaca in component INaCa_i (dimensionless)"
legend_constants[66] = "kcaon in component INaCa_i (per_millisecond)"
legend_constants[67] = "kcaoff in component INaCa_i (per_millisecond)"
legend_constants[68] = "qna in component INaCa_i (dimensionless)"
legend_constants[69] = "qca in component INaCa_i (dimensionless)"
legend_algebraic[96] = "hna in component INaCa_i (dimensionless)"
legend_algebraic[95] = "hca in component INaCa_i (dimensionless)"
legend_constants[70] = "KmCaAct in component INaCa_i (millimolar)"
legend_constants[71] = "Gncx in component INaCa_i (milliS_per_microF)"
legend_algebraic[97] = "h1_i in component INaCa_i (dimensionless)"
legend_algebraic[98] = "h2_i in component INaCa_i (dimensionless)"
legend_algebraic[99] = "h3_i in component INaCa_i (dimensionless)"
legend_algebraic[100] = "h4_i in component INaCa_i (dimensionless)"
legend_algebraic[101] = "h5_i in component INaCa_i (dimensionless)"
legend_algebraic[102] = "h6_i in component INaCa_i (dimensionless)"
legend_algebraic[103] = "h7_i in component INaCa_i (dimensionless)"
legend_algebraic[104] = "h8_i in component INaCa_i (dimensionless)"
legend_algebraic[105] = "h9_i in component INaCa_i (dimensionless)"
legend_constants[131] = "h10_i in component INaCa_i (dimensionless)"
legend_constants[132] = "h11_i in component INaCa_i (dimensionless)"
legend_constants[133] = "h12_i in component INaCa_i (dimensionless)"
legend_constants[134] = "k1_i in component INaCa_i (dimensionless)"
legend_constants[135] = "k2_i in component INaCa_i (dimensionless)"
legend_algebraic[106] = "k3p_i in component INaCa_i (dimensionless)"
legend_algebraic[107] = "k3pp_i in component INaCa_i (dimensionless)"
legend_algebraic[108] = "k3_i in component INaCa_i (dimensionless)"
legend_algebraic[111] = "k4_i in component INaCa_i (dimensionless)"
legend_algebraic[109] = "k4p_i in component INaCa_i (dimensionless)"
legend_algebraic[110] = "k4pp_i in component INaCa_i (dimensionless)"
legend_constants[136] = "k5_i in component INaCa_i (dimensionless)"
legend_algebraic[112] = "k6_i in component INaCa_i (dimensionless)"
legend_algebraic[113] = "k7_i in component INaCa_i (dimensionless)"
legend_algebraic[114] = "k8_i in component INaCa_i (dimensionless)"
legend_algebraic[115] = "x1_i in component INaCa_i (dimensionless)"
legend_algebraic[116] = "x2_i in component INaCa_i (dimensionless)"
legend_algebraic[117] = "x3_i in component INaCa_i (dimensionless)"
legend_algebraic[118] = "x4_i in component INaCa_i (dimensionless)"
legend_algebraic[119] = "E1_i in component INaCa_i (dimensionless)"
legend_algebraic[120] = "E2_i in component INaCa_i (dimensionless)"
legend_algebraic[121] = "E3_i in component INaCa_i (dimensionless)"
legend_algebraic[122] = "E4_i in component INaCa_i (dimensionless)"
legend_algebraic[123] = "allo_i in component INaCa_i (dimensionless)"
legend_algebraic[124] = "JncxNa_i in component INaCa_i (millimolar_per_millisecond)"
legend_algebraic[125] = "JncxCa_i in component INaCa_i (millimolar_per_millisecond)"
legend_algebraic[127] = "h1_ss in component INaCa_i (dimensionless)"
legend_algebraic[128] = "h2_ss in component INaCa_i (dimensionless)"
legend_algebraic[129] = "h3_ss in component INaCa_i (dimensionless)"
legend_algebraic[130] = "h4_ss in component INaCa_i (dimensionless)"
legend_algebraic[131] = "h5_ss in component INaCa_i (dimensionless)"
legend_algebraic[132] = "h6_ss in component INaCa_i (dimensionless)"
legend_algebraic[133] = "h7_ss in component INaCa_i (dimensionless)"
legend_algebraic[134] = "h8_ss in component INaCa_i (dimensionless)"
legend_algebraic[135] = "h9_ss in component INaCa_i (dimensionless)"
legend_constants[137] = "h10_ss in component INaCa_i (dimensionless)"
legend_constants[138] = "h11_ss in component INaCa_i (dimensionless)"
legend_constants[139] = "h12_ss in component INaCa_i (dimensionless)"
legend_constants[140] = "k1_ss in component INaCa_i (dimensionless)"
legend_constants[141] = "k2_ss in component INaCa_i (dimensionless)"
legend_algebraic[136] = "k3p_ss in component INaCa_i (dimensionless)"
legend_algebraic[137] = "k3pp_ss in component INaCa_i (dimensionless)"
legend_algebraic[138] = "k3_ss in component INaCa_i (dimensionless)"
legend_algebraic[141] = "k4_ss in component INaCa_i (dimensionless)"
legend_algebraic[139] = "k4p_ss in component INaCa_i (dimensionless)"
legend_algebraic[140] = "k4pp_ss in component INaCa_i (dimensionless)"
legend_constants[142] = "k5_ss in component INaCa_i (dimensionless)"
legend_algebraic[142] = "k6_ss in component INaCa_i (dimensionless)"
legend_algebraic[143] = "k7_ss in component INaCa_i (dimensionless)"
legend_algebraic[144] = "k8_ss in component INaCa_i (dimensionless)"
legend_algebraic[145] = "x1_ss in component INaCa_i (dimensionless)"
legend_algebraic[146] = "x2_ss in component INaCa_i (dimensionless)"
legend_algebraic[147] = "x3_ss in component INaCa_i (dimensionless)"
legend_algebraic[148] = "x4_ss in component INaCa_i (dimensionless)"
legend_algebraic[149] = "E1_ss in component INaCa_i (dimensionless)"
legend_algebraic[150] = "E2_ss in component INaCa_i (dimensionless)"
legend_algebraic[151] = "E3_ss in component INaCa_i (dimensionless)"
legend_algebraic[152] = "E4_ss in component INaCa_i (dimensionless)"
legend_algebraic[153] = "allo_ss in component INaCa_i (dimensionless)"
legend_algebraic[154] = "JncxNa_ss in component INaCa_i (millimolar_per_millisecond)"
legend_algebraic[155] = "JncxCa_ss in component INaCa_i (millimolar_per_millisecond)"
legend_constants[72] = "k1p in component INaK (per_millisecond)"
legend_constants[73] = "k1m in component INaK (per_millisecond)"
legend_constants[74] = "k2p in component INaK (per_millisecond)"
legend_constants[75] = "k2m in component INaK (per_millisecond)"
legend_constants[76] = "k3p in component INaK (per_millisecond)"
legend_constants[77] = "k3m in component INaK (per_millisecond)"
legend_constants[78] = "k4p in component INaK (per_millisecond)"
legend_constants[79] = "k4m in component INaK (per_millisecond)"
legend_constants[80] = "Knai0 in component INaK (millimolar)"
legend_constants[81] = "Knao0 in component INaK (millimolar)"
legend_constants[82] = "delta in component INaK (millivolt)"
legend_constants[83] = "Kki in component INaK (per_millisecond)"
legend_constants[84] = "Kko in component INaK (per_millisecond)"
legend_constants[85] = "MgADP in component INaK (millimolar)"
legend_constants[86] = "MgATP in component INaK (millimolar)"
legend_constants[87] = "Kmgatp in component INaK (millimolar)"
legend_constants[88] = "H in component INaK (millimolar)"
legend_constants[89] = "eP in component INaK (dimensionless)"
legend_constants[90] = "Khp in component INaK (millimolar)"
legend_constants[91] = "Knap in component INaK (millimolar)"
legend_constants[92] = "Kxkur in component INaK (millimolar)"
legend_constants[93] = "Pnak in component INaK (milliS_per_microF)"
legend_algebraic[157] = "Knai in component INaK (millimolar)"
legend_algebraic[158] = "Knao in component INaK (millimolar)"
legend_algebraic[159] = "P in component INaK (dimensionless)"
legend_algebraic[160] = "a1 in component INaK (dimensionless)"
legend_constants[143] = "b1 in component INaK (dimensionless)"
legend_constants[144] = "a2 in component INaK (dimensionless)"
legend_algebraic[161] = "b2 in component INaK (dimensionless)"
legend_algebraic[162] = "a3 in component INaK (dimensionless)"
legend_algebraic[163] = "b3 in component INaK (dimensionless)"
legend_constants[145] = "a4 in component INaK (dimensionless)"
legend_algebraic[164] = "b4 in component INaK (dimensionless)"
legend_algebraic[165] = "x1 in component INaK (dimensionless)"
legend_algebraic[166] = "x2 in component INaK (dimensionless)"
legend_algebraic[167] = "x3 in component INaK (dimensionless)"
legend_algebraic[168] = "x4 in component INaK (dimensionless)"
legend_algebraic[169] = "E1 in component INaK (dimensionless)"
legend_algebraic[170] = "E2 in component INaK (dimensionless)"
legend_algebraic[171] = "E3 in component INaK (dimensionless)"
legend_algebraic[172] = "E4 in component INaK (dimensionless)"
legend_algebraic[173] = "JnakNa in component INaK (millimolar_per_millisecond)"
legend_algebraic[174] = "JnakK in component INaK (millimolar_per_millisecond)"
legend_constants[94] = "PNab in component INab (milliS_per_microF)"
legend_constants[95] = "PCab in component ICab (milliS_per_microF)"
legend_constants[96] = "GpCa in component IpCa (milliS_per_microF)"
legend_constants[97] = "KmCap in component IpCa (millimolar)"
legend_constants[98] = "sstau in component diff (millisecond)"
legend_constants[99] = "gaptau in component diff (millisecond)"
legend_algebraic[196] = "REL in component ryr (millimolar_per_millisecond)"
legend_algebraic[198] = "irelss in component ryr (millimolar_per_millisecond)"
legend_algebraic[185] = "ireltau in component ryr (dimensionless)"
legend_algebraic[192] = "REL2 in component ryr (millimolar_per_millisecond)"
legend_algebraic[194] = "irelss2 in component ryr (millimolar_per_millisecond)"
legend_algebraic[186] = "ireltau2 in component ryr (dimensionless)"
legend_constants[100] = "dqupcamkbar in component SERCA (dimensionless)"
legend_constants[101] = "dkmplbbar in component SERCA (dimensionless)"
legend_constants[102] = "kmup in component SERCA (dimensionless)"
legend_constants[103] = "nsrbar in component SERCA (dimensionless)"
legend_algebraic[187] = "dkmplb in component SERCA (dimensionless)"
legend_algebraic[188] = "dqupcamk in component SERCA (dimensionless)"
legend_constants[104] = "IP3 in component IP3 (dimensionless)"
legend_constants[105] = "k1 in component IP3 (dimensionless)"
legend_constants[106] = "k1a in component IP3 (dimensionless)"
legend_constants[107] = "k0 in component IP3 (dimensionless)"
legend_constants[108] = "k0a in component IP3 (dimensionless)"
legend_constants[109] = "k2 in component IP3 (dimensionless)"
legend_constants[110] = "k2a in component IP3 (dimensionless)"
legend_constants[111] = "tauip3 in component IP3 (millisecond)"
legend_algebraic[191] = "POip3 in component IP3 (dimensionless)"
legend_states[45] = "u in component IP3 (millimolar_per_millisecond)"
legend_rates[0] = "d/dt v in component membrane (millivolt)"
legend_rates[1] = "d/dt CaMKt in component CaMK (millimolar)"
legend_rates[3] = "d/dt nai in component intracellular_ions (millimolar)"
legend_rates[4] = "d/dt nasl in component intracellular_ions (millimolar)"
legend_rates[5] = "d/dt nass in component intracellular_ions (millimolar)"
legend_rates[6] = "d/dt ki in component intracellular_ions (millimolar)"
legend_rates[8] = "d/dt ksl in component intracellular_ions (millimolar)"
legend_rates[7] = "d/dt kss in component intracellular_ions (millimolar)"
legend_rates[9] = "d/dt cai in component intracellular_ions (millimolar)"
legend_rates[2] = "d/dt cass in component intracellular_ions (millimolar)"
legend_rates[10] = "d/dt casl in component intracellular_ions (millimolar)"
legend_rates[11] = "d/dt cansr in component intracellular_ions (millimolar)"
legend_rates[12] = "d/dt cajsr in component intracellular_ions (millimolar)"
legend_rates[13] = "d/dt cacsr in component intracellular_ions (millimolar)"
legend_rates[16] = "d/dt m in component INa (dimensionless)"
legend_rates[17] = "d/dt hf in component INa (dimensionless)"
legend_rates[18] = "d/dt hs in component INa (dimensionless)"
legend_rates[19] = "d/dt j in component INa (dimensionless)"
legend_rates[20] = "d/dt hsp in component INa (dimensionless)"
legend_rates[21] = "d/dt jp in component INa (dimensionless)"
legend_rates[22] = "d/dt mL in component INaL (dimensionless)"
legend_rates[23] = "d/dt hL in component INaL (dimensionless)"
legend_rates[24] = "d/dt hLp in component INaL (dimensionless)"
legend_rates[25] = "d/dt a in component Ito (dimensionless)"
legend_rates[26] = "d/dt i1 in component Ito (dimensionless)"
legend_rates[27] = "d/dt i2 in component Ito (dimensionless)"
legend_rates[28] = "d/dt d in component ICaL (dimensionless)"
legend_rates[29] = "d/dt ff in component ICaL (dimensionless)"
legend_rates[30] = "d/dt fs in component ICaL (dimensionless)"
legend_rates[31] = "d/dt fcaf in component ICaL (dimensionless)"
legend_rates[32] = "d/dt fcas in component ICaL (dimensionless)"
legend_rates[33] = "d/dt jca in component ICaL (dimensionless)"
legend_rates[34] = "d/dt ffp in component ICaL (dimensionless)"
legend_rates[35] = "d/dt fcafp in component ICaL (dimensionless)"
legend_rates[36] = "d/dt nca in component ICaL (dimensionless)"
legend_rates[37] = "d/dt b in component ICaT (dimensionless)"
legend_rates[38] = "d/dt g in component ICaT (dimensionless)"
legend_rates[39] = "d/dt xrf in component IKr (dimensionless)"
legend_rates[40] = "d/dt xrs in component IKr (dimensionless)"
legend_rates[41] = "d/dt xs1 in component IKs (dimensionless)"
legend_rates[42] = "d/dt xs2 in component IKs (dimensionless)"
legend_rates[43] = "d/dt y in component If (dimensionless)"
legend_rates[44] = "d/dt xk1 in component IK1 (dimensionless)"
legend_rates[14] = "d/dt Jrel1 in component ryr (millimolar_per_millisecond)"
legend_rates[15] = "d/dt Jrel2 in component ryr (millimolar_per_millisecond)"
legend_rates[45] = "d/dt u in component IP3 (millimolar_per_millisecond)"
return (legend_states, legend_algebraic, legend_voi, legend_constants)
def initConsts():
constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
constants[0] = 140
constants[1] = 1.8
constants[2] = 5.4
constants[3] = 8314
constants[4] = 310
constants[5] = 96485
constants[6] = 1
constants[7] = 2
constants[8] = 1
constants[9] = 0.0164
constants[10] = 0.00175
constants[11] = 3.14159265
states[0] = -86.6814002878592
constants[12] = -40
constants[13] = 1
constants[14] = 0.15
constants[15] = 0.05
constants[16] = 0.00068
constants[17] = 0.05
constants[18] = 0.0015
states[1] = 0.00505983330678751
states[2] = 0.000101777993438818
constants[19] = 0.019975
constants[20] = 0.00087
constants[21] = 0.4777
constants[22] = 0.0087
constants[23] = 2.88
constants[24] = 0.8
constants[25] = 1.2
constants[26] = 0.1125
constants[27] = 0.00238
constants[28] = 0.0125
constants[29] = 0.0315
constants[30] = 0.0005
constants[31] = 0.0035
states[3] = 8.23183964616932
states[4] = 8.23153516580562
states[5] = 8.23154325237268
states[6] = 143.767359809132
states[7] = 143.767768218104
states[8] = 143.767769906216
states[9] = 4.36004404734282e-5
states[10] = 0.000102004317781147
states[11] = 1.26350902016858
states[12] = 1.24811940209535
states[13] = 1.26516959198518
states[14] = 0.000108240945806962
states[15] = 1.25045800437317e-69
constants[32] = 1
constants[33] = 0.01833
constants[34] = 48.4264
constants[35] = 7.5653
constants[36] = 11.64
constants[37] = 34.77
constants[38] = 6.765
constants[39] = 8.552
constants[40] = 77.42
constants[41] = 5.955
states[16] = 0.00632661703915808
constants[42] = 78.5
constants[43] = 6.22
constants[44] = 0.99
states[17] = 0.788611739889677
states[18] = 0.788545979951331
constants[45] = 39.4572
states[19] = 0.790474358603666
states[20] = 0.579693514309867
states[21] = 0.790947058236417
states[22] = 0.000241925773627233
constants[46] = 200
states[23] = 0.463574582508218
states[24] = 0.240216198686475
constants[47] = 0.0189
states[25] = 0.000272851144435704
states[26] = 0.649604795721571
states[27] = 0.989965695822495
constants[48] = 0.192
constants[49] = 0.0301
constants[50] = 0.002
constants[51] = 1000
states[28] = 6.97735089296892e-9
states[29] = 0.999999968230738
states[30] = 0.926692153319136
states[31] = 0.99999996819573
states[32] = 0.999999905741936
states[33] = 0.999978907334662
states[34] = 0.999999968365903
states[35] = 0.999999968278239
states[36] = 0.00547252500964926
constants[52] = 7.7677e-5
constants[53] = 0.0754
states[37] = 0.000304250912559619
states[38] = 0.994214357917907
constants[54] = 0.0342
states[39] = 0.000331691184084272
states[40] = 0.568716473334161
constants[55] = 0.0029
states[41] = 0.191165248085394
states[42] = 0.000222677365291219
constants[56] = 0.0116
constants[57] = 0.0232
states[43] = 0.233119011214908
constants[58] = 0.0455
states[44] = 0.997084813729909
constants[59] = 15
constants[60] = 5
constants[61] = 88.12
constants[62] = 12.5
constants[63] = 60000
constants[64] = 60000
constants[65] = 5000
constants[66] = 1500000
constants[67] = 5000
constants[68] = 0.5224
constants[69] = 0.167
constants[70] = 0.00015
constants[71] = 0.00095709
constants[72] = 949.5
constants[73] = 182.4
constants[74] = 687.2
constants[75] = 39.4
constants[76] = 1899
constants[77] = 79300
constants[78] = 639
constants[79] = 40
constants[80] = 9.073
constants[81] = 27.78
constants[82] = -0.155
constants[83] = 0.5
constants[84] = 0.3582
constants[85] = 0.05
constants[86] = 9.8
constants[87] = 1.698e-7
constants[88] = 1e-7
constants[89] = 4.2
constants[90] = 1.698e-7
constants[91] = 224
constants[92] = 292
constants[93] = 32.4872
constants[94] = 9.375e-10
constants[95] = 2.5e-8
constants[96] = 0.0005
constants[97] = 0.0005
constants[98] = 0.2
constants[99] = 12
constants[100] = 0.75
constants[101] = 0.00017
constants[102] = 0.00028
constants[103] = 15
constants[104] = 0.0001
constants[105] = 150000
constants[106] = 16.5
constants[107] = 96000
constants[108] = 9.6
constants[109] = 1800
constants[110] = 0.21
constants[111] = 3.7
states[45] = 0.466236137183558
constants[112] = 1.00000-constants[44]
constants[113] = 3.00000*constants[46]
constants[114] = 0.600000
constants[115] = 1.10000*constants[52]
constants[116] = 0.00125000*constants[52]
constants[117] = 0.000357400*constants[52]
constants[118] = 75.0000
constants[119] = 1000.00*3.14159*constants[10]*constants[10]*constants[9]
constants[120] = 1.00000-constants[114]
constants[121] = 0.00125000*constants[115]
constants[122] = 0.000357400*constants[115]
constants[123] = 2.00000*constants[11]*constants[10]*constants[10]+2.00000*constants[11]*constants[10]*constants[9]
constants[124] = 2.00000*constants[123]
constants[125] = 0.600000*constants[119]
constants[126] = 0.0400000*constants[119]
constants[127] = 0.00200000*constants[119]
constants[128] = 0.00800000*constants[119]
constants[129] = 0.0200000*constants[119]
constants[130] = 0.150000*constants[119]
constants[131] = constants[62]+1.00000+(constants[0]/constants[59])*(1.00000+constants[0]/constants[60])
constants[132] = (constants[0]*constants[0])/(constants[131]*constants[59]*constants[60])
constants[133] = 1.00000/constants[131]
constants[134] = constants[133]*constants[1]*constants[66]
constants[135] = constants[67]
constants[136] = constants[67]
constants[137] = constants[62]+1.00000+(constants[0]/constants[59])*(1.00000+constants[0]/constants[60])
constants[138] = (constants[0]*constants[0])/(constants[137]*constants[59]*constants[60])
constants[139] = 1.00000/constants[137]
constants[140] = constants[139]*constants[1]*constants[66]
constants[141] = constants[67]
constants[142] = constants[67]
constants[143] = constants[73]*constants[85]
constants[144] = constants[74]
constants[145] = ((constants[78]*constants[86])/constants[87])/(1.00000+constants[86]/constants[87])
return (states, constants)
def computeRates(voi, states, constants):
rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
rates[45] = states[2]*constants[109]*(1.00000-states[45])-constants[110]*states[45]
algebraic[2] = 1.00000/(1.00000+exp((states[0]+87.6100)/7.48800))
rates[23] = (algebraic[2]-states[23])/constants[46]
algebraic[3] = 1.00000/(1.00000+exp((states[0]+93.8100)/7.48800))
rates[24] = (algebraic[3]-states[24])/constants[113]
algebraic[0] = 1.00000/(1.00000+exp(-(states[0]+constants[34])/constants[35]))
algebraic[16] = 1.00000/(constants[38]*exp((states[0]+constants[36])/constants[37])+constants[39]*exp(-(states[0]+constants[40])/constants[41]))
rates[16] = (algebraic[0]-states[16])/algebraic[16]
algebraic[1] = 1.00000/(1.00000+exp((states[0]+constants[42])/constants[43]))
algebraic[17] = 1.00000/(3.68600e-06*exp(-(states[0]+3.88750)/7.85790)+16.0000*exp((states[0]-0.496300)/9.18430))
rates[17] = (algebraic[1]-states[17])/algebraic[17]
algebraic[18] = 1.00000/(0.00979400*exp(-(states[0]+17.9500)/28.0500)+0.334300*exp((states[0]+5.73000)/56.6600))
rates[18] = (algebraic[1]-states[18])/algebraic[18]
algebraic[4] = 1.00000/(1.00000+exp((20.0000-states[0])/13.0000))
algebraic[20] = 1.05150/(1.00000/(1.20890*(1.00000+exp(-(states[0]-18.4099)/29.3814)))+3.50000/(1.00000+exp((states[0]+100.000)/29.3814)))
rates[25] = (algebraic[4]-states[25])/algebraic[20]
algebraic[5] = 1.00000/(1.00000+exp((27.0000+states[0])/13.0000))
algebraic[21] = 43.0000+1.00000/(0.00141600*exp(-(states[0]+96.5200)/59.0500)+1.78000e-08*exp((states[0]+114.100)/8.07900))
rates[26] = (algebraic[5]-states[26])/algebraic[21]
algebraic[22] = 6.16200+1.00000/(0.393300*exp(-(states[0]+100.000)/100.000)+0.0800400*exp((states[0]-8.00000)/8.59000))
rates[27] = (algebraic[5]-states[27])/algebraic[22]
algebraic[6] = 1.00000/(1.00000+exp(-(states[0]+3.94000+3.30000)/4.23000))
algebraic[25] = 0.600000+1.00000/(exp(-0.0500000*(states[0]+6.00000))+exp(0.0900000*(states[0]+14.0000)))
rates[28] = (algebraic[6]-states[28])/algebraic[25]
algebraic[7] = 1.00000/(1.00000+exp((states[0]+19.5800+3.30000)/3.69600))
algebraic[26] = 7.00000+1.00000/(0.00450000*exp(-(states[0]+20.0000+15.1900)/10.0000)+0.00450000*exp((states[0]+20.0000+15.1900)/10.0000))
rates[29] = (algebraic[7]-states[29])/algebraic[26]
algebraic[27] = 1000.00+1.00000/(3.50000e-05*exp(-(states[0]+5.00000+15.1900)/4.00000)+3.50000e-05*exp((states[0]+5.00000+15.1900)/6.00000))
rates[30] = (algebraic[7]-states[30])/algebraic[27]
algebraic[23] = algebraic[7]
rates[33] = (algebraic[23]-states[33])/constants[118]
algebraic[8] = states[33]*1.00000
algebraic[24] = 1.00000/(constants[51]/algebraic[8]+power(1.00000+constants[50]/states[2], 4.00000))
rates[36] = algebraic[24]*constants[51]-states[36]*algebraic[8]
algebraic[9] = 1.00000/(1.00000+exp(-(states[0]+30.0000)/7.00000))
algebraic[28] = 1.00000/(1.06800*exp((states[0]+16.3000)/30.0000)+1.06800*exp(-(states[0]+16.3000)/30.0000))
rates[37] = (algebraic[9]-states[37])/algebraic[28]
algebraic[10] = 1.00000/(1.00000+exp((states[0]+61.0000)/5.00000))
algebraic[29] = 1.00000/(0.0150000*exp((states[0]+71.7000)/15.4000)+0.0150000*exp(-(states[0]+71.7000)/83.3000))
rates[38] = (algebraic[10]-states[38])/algebraic[29]
algebraic[11] = 1.00000/(1.00000+exp(-(states[0]+8.33700)/6.78900))
algebraic[30] = 12.9800+1.00000/(0.365200*exp(((states[0]+17.6000)-31.6600)/3.86900)+4.12300e-05*exp(-((states[0]+17.6000)-47.7800)/20.3800))
rates[39] = (algebraic[11]-states[39])/algebraic[30]
algebraic[31] = 1.86500+1.00000/(0.0662900*exp(((states[0]+17.2000)-34.7000)/7.35500)+1.12800e-05*exp(-((states[0]+17.2000)-29.7400)/25.9400))
rates[40] = (algebraic[11]-states[40])/algebraic[31]
algebraic[12] = 1.00000/(1.00000+exp(-(states[0]+11.6000)/8.93200))
algebraic[33] = 817.300+1.00000/(0.000232600*exp((states[0]+48.2800)/17.8000)+0.00129200*exp(-(states[0]+210.000)/230.000))
rates[41] = (algebraic[12]-states[41])/algebraic[33]
algebraic[13] = 1.00000/(1.00000+exp((states[0]+87.0000)/9.50000))
algebraic[34] = 2000.00/(exp((states[0]+57.0000)/60.0000)+exp(-(states[0]+132.000)/10.0000))
rates[43] = (algebraic[13]-states[43])/algebraic[34]
algebraic[14] = 1.00000/(1.00000+exp(-(states[0]+2.55380*constants[2]+144.590)/(1.56920*constants[2]+3.81150)))
algebraic[35] = 122.200/(exp(-(states[0]+127.200)/20.3600)+exp((states[0]+236.800)/69.3300))
rates[44] = (algebraic[14]-states[44])/algebraic[35]
algebraic[19] = algebraic[1]
algebraic[37] = 4.85900+1.00000/(0.862800*exp(-(states[0]+116.726)/7.60050)+1.10960*exp((states[0]+6.27190)/9.03580))
rates[19] = (algebraic[19]-states[19])/algebraic[37]
algebraic[40] = 0.720000*(7.00000+1.00000/(0.0400000*exp(-((states[0]+15.1900)-4.00000)/7.00000)+0.0400000*exp(((states[0]+15.1900)-4.00000)/7.00000)))
rates[31] = (algebraic[23]-states[31])/algebraic[40]
algebraic[41] = 0.490000*(100.000+1.00000/(0.000120000*exp(-(states[0]+15.1900)/3.00000)+0.000120000*exp((states[0]+15.1900)/7.00000)))
rates[32] = (algebraic[23]-states[32])/algebraic[41]
algebraic[42] = 2.50000*algebraic[26]
rates[34] = (algebraic[7]-states[34])/algebraic[42]
algebraic[32] = algebraic[12]
algebraic[43] = 1.00000/(0.0100000*exp((states[0]-50.0000)/20.0000)+0.0193000*exp(-(states[0]+66.5400)/31.0000))
rates[42] = (algebraic[32]-states[42])/algebraic[43]
algebraic[49] = (constants[17]*(1.00000-states[1]))/(1.00000+constants[18]/states[2])
rates[1] = constants[15]*algebraic[49]*(algebraic[49]+states[1])-constants[16]*states[1]
algebraic[38] = 1.00000/(1.00000+exp((states[0]+84.7000)/6.22000))
algebraic[45] = 3.00000*algebraic[18]
rates[20] = (algebraic[38]-states[20])/algebraic[45]
algebraic[46] = 1.46000*algebraic[37]
rates[21] = (algebraic[19]-states[21])/algebraic[46]
algebraic[39] = 1.00000/(1.00000+exp(-(states[0]+42.8500)/5.26400))
algebraic[47] = algebraic[16]
rates[22] = (algebraic[39]-states[22])/algebraic[47]
algebraic[48] = 2.50000*algebraic[40]
rates[35] = (algebraic[23]-states[35])/algebraic[48]
algebraic[69] = constants[114]*states[29]+constants[120]*states[30]
algebraic[70] = 0.300000+0.600000/(1.00000+exp((states[0]-10.0000)/10.0000))
algebraic[71] = 1.00000-algebraic[70]
algebraic[72] = algebraic[70]*states[31]+algebraic[71]*states[32]
algebraic[73] = constants[114]*states[34]+constants[120]*states[30]
algebraic[74] = algebraic[70]*states[35]+algebraic[71]*states[32]
algebraic[36] = (states[0]*constants[5]*constants[5])/(constants[3]*constants[4])
algebraic[44] = (states[0]*constants[5])/(constants[3]*constants[4])
algebraic[77] = (1.00000*algebraic[36]*(0.750000*states[7]*exp(1.00000*algebraic[44])-0.750000*constants[2]))/(exp(1.00000*algebraic[44])-1.00000)
algebraic[50] = algebraic[49]+states[1]
algebraic[78] = 1.00000/(1.00000+constants[14]/algebraic[50])
algebraic[81] = (1.00000-algebraic[78])*constants[117]*algebraic[77]*states[28]*(algebraic[69]*(1.00000-states[36])+states[33]*algebraic[72]*states[36])+algebraic[78]*constants[122]*algebraic[77]*states[28]*(algebraic[73]*(1.00000-states[36])+states[33]*algebraic[74]*states[36])
algebraic[177] = (states[7]-states[8])/constants[98]
rates[7] = (-algebraic[81]*constants[32]*constants[124])/(constants[5]*constants[129])-algebraic[177]
algebraic[76] = (1.00000*algebraic[36]*(0.750000*states[5]*exp(1.00000*algebraic[44])-0.750000*constants[0]))/(exp(1.00000*algebraic[44])-1.00000)
algebraic[80] = (1.00000-algebraic[78])*constants[116]*algebraic[76]*states[28]*(algebraic[69]*(1.00000-states[36])+states[33]*algebraic[72]*states[36])+algebraic[78]*constants[121]*algebraic[76]*states[28]*(algebraic[73]*(1.00000-states[36])+states[33]*algebraic[74]*states[36])
algebraic[153] = 1.00000/(1.00000+power(constants[70]/states[2], 2.00000))
algebraic[96] = exp((constants[68]*states[0]*constants[5])/(constants[3]*constants[4]))
algebraic[133] = 1.00000+(constants[0]/constants[61])*(1.00000+1.00000/algebraic[96])
algebraic[134] = constants[0]/(constants[61]*algebraic[96]*algebraic[133])
algebraic[137] = algebraic[134]*constants[65]
algebraic[127] = 1.00000+(states[5]/constants[61])*(1.00000+algebraic[96])
algebraic[128] = (states[5]*algebraic[96])/(constants[61]*algebraic[127])
algebraic[140] = algebraic[128]*constants[65]
algebraic[130] = 1.00000+(states[5]/constants[59])*(1.00000+states[5]/constants[60])
algebraic[131] = (states[5]*states[5])/(algebraic[130]*constants[59]*constants[60])
algebraic[143] = algebraic[131]*algebraic[128]*constants[63]
algebraic[144] = algebraic[134]*constants[138]*constants[63]
algebraic[135] = 1.00000/algebraic[133]
algebraic[136] = algebraic[135]*constants[64]
algebraic[138] = algebraic[136]+algebraic[137]
algebraic[95] = exp((constants[69]*states[0]*constants[5])/(constants[3]*constants[4]))
algebraic[129] = 1.00000/algebraic[127]
algebraic[139] = (algebraic[129]*constants[64])/algebraic[95]
algebraic[141] = algebraic[139]+algebraic[140]
algebraic[132] = 1.00000/algebraic[130]
algebraic[142] = algebraic[132]*states[2]*constants[66]
algebraic[145] = constants[141]*algebraic[141]*(algebraic[143]+algebraic[142])+constants[142]*algebraic[143]*(constants[141]+algebraic[138])
algebraic[146] = constants[140]*algebraic[143]*(algebraic[141]+constants[142])+algebraic[141]*algebraic[142]*(constants[140]+algebraic[144])
algebraic[147] = constants[140]*algebraic[138]*(algebraic[143]+algebraic[142])+algebraic[144]*algebraic[142]*(constants[141]+algebraic[138])
algebraic[148] = constants[141]*algebraic[144]*(algebraic[141]+constants[142])+algebraic[138]*constants[142]*(constants[140]+algebraic[144])
algebraic[149] = algebraic[145]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[150] = algebraic[146]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[151] = algebraic[147]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[152] = algebraic[148]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[154] = (3.00000*(algebraic[152]*algebraic[143]-algebraic[149]*algebraic[144])+algebraic[151]*algebraic[140])-algebraic[150]*algebraic[137]
algebraic[155] = algebraic[150]*constants[141]-algebraic[149]*constants[140]
algebraic[156] = 0.200000*constants[71]*algebraic[153]*(constants[6]*algebraic[154]+constants[7]*algebraic[155])
algebraic[178] = (states[5]-states[4])/constants[98]
rates[5] = (-(algebraic[80]+3.00000*algebraic[156])*constants[32]*constants[124])/(constants[5]*constants[129])-algebraic[178]
algebraic[180] = (states[8]-states[6])/constants[99]
rates[6] = (algebraic[180]*constants[130])/constants[125]
algebraic[57] = ((constants[3]*constants[4])/constants[5])*log(constants[2]/states[8])
algebraic[66] = constants[48]*states[25]*states[26]*states[27]*(states[0]-algebraic[57])
algebraic[67] = 1.00000/(1.00000+exp(-(states[0]-12.0000)/16.0000))
algebraic[68] = constants[49]*algebraic[67]*(states[0]-algebraic[57])
algebraic[83] = 1.00000/(1.00000+exp((states[0]+54.8100)/38.2100))
algebraic[84] = 1.00000-algebraic[83]
algebraic[85] = algebraic[83]*states[39]+algebraic[84]*states[40]
algebraic[86] = ((1.00000/(1.00000+exp((states[0]+55.0000)/(0.320000*75.0000))))*1.00000)/(1.00000+exp((states[0]-10.0000)/(0.320000*30.0000)))
algebraic[87] = constants[54]*(power(constants[2]/5.40000, 1.0/2))*algebraic[85]*algebraic[86]*(states[0]-algebraic[57])
algebraic[59] = ((constants[3]*constants[4])/constants[5])*log((constants[2]+constants[33]*constants[0])/(states[8]+constants[33]*states[4]))
algebraic[88] = 1.00000+0.600000/(1.00000+power(3.80000e-05/states[10], 1.40000))
algebraic[89] = constants[55]*algebraic[88]*states[41]*states[42]*(states[0]-algebraic[59])
algebraic[93] = 1.00000/(1.00000+exp(((states[0]+116.000)-5.50000*constants[2])/11.0000))
algebraic[94] = constants[58]*2.32380*(power(constants[2]/5.40000, 1.0/2))*algebraic[93]*states[44]*(states[0]-algebraic[57])
algebraic[158] = constants[81]*exp(((1.00000-constants[82])*states[0]*constants[5])/(3.00000*constants[3]*constants[4]))
algebraic[162] = (constants[76]*(power(constants[2]/constants[84], 2.00000)))/((power(1.00000+constants[0]/algebraic[158], 3.00000)+power(1.00000+constants[2]/constants[84], 2.00000))-1.00000)
algebraic[159] = constants[89]/(1.00000+constants[88]/constants[90]+states[4]/constants[91]+states[8]/constants[92])
algebraic[163] = (constants[77]*algebraic[159]*constants[88])/(1.00000+constants[86]/constants[87])
algebraic[157] = constants[80]*exp((constants[82]*states[0]*constants[5])/(3.00000*constants[3]*constants[4]))
algebraic[160] = (constants[72]*(power(states[4]/algebraic[157], 3.00000)))/((power(1.00000+states[4]/algebraic[157], 3.00000)+power(1.00000+states[8]/constants[83], 2.00000))-1.00000)
algebraic[161] = (constants[75]*(power(constants[0]/algebraic[158], 3.00000)))/((power(1.00000+constants[0]/algebraic[158], 3.00000)+power(1.00000+constants[2]/constants[84], 2.00000))-1.00000)
algebraic[164] = (constants[79]*(power(states[8]/constants[83], 2.00000)))/((power(1.00000+states[4]/algebraic[157], 3.00000)+power(1.00000+states[8]/constants[83], 2.00000))-1.00000)
algebraic[165] = constants[145]*algebraic[160]*constants[144]+algebraic[161]*algebraic[164]*algebraic[163]+constants[144]*algebraic[164]*algebraic[163]+algebraic[163]*algebraic[160]*constants[144]
algebraic[166] = algebraic[161]*constants[143]*algebraic[164]+algebraic[160]*constants[144]*algebraic[162]+algebraic[162]*constants[143]*algebraic[164]+constants[144]*algebraic[162]*algebraic[164]
algebraic[167] = constants[144]*algebraic[162]*constants[145]+algebraic[163]*algebraic[161]*constants[143]+algebraic[161]*constants[143]*constants[145]+algebraic[162]*constants[145]*constants[143]
algebraic[168] = algebraic[164]*algebraic[163]*algebraic[161]+algebraic[162]*constants[145]*algebraic[160]+algebraic[161]*constants[145]*algebraic[160]+algebraic[163]*algebraic[161]*algebraic[160]
algebraic[169] = algebraic[165]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[170] = algebraic[166]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[173] = 3.00000*(algebraic[169]*algebraic[162]-algebraic[170]*algebraic[163])
algebraic[171] = algebraic[167]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[172] = algebraic[168]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[174] = 2.00000*(algebraic[172]*constants[143]-algebraic[171]*algebraic[160])
algebraic[175] = constants[93]*(constants[6]*algebraic[173]+constants[8]*algebraic[174])
algebraic[15] = custom_piecewise([less_equal(voi , constants[13]), constants[12] , True, 0.00000])
algebraic[91] = constants[57]*states[43]*states[43]*(states[0]-algebraic[57])
rates[8] = (-((algebraic[66]+algebraic[68]+algebraic[87]+algebraic[89]+algebraic[91]+algebraic[94]+algebraic[15])-2.00000*algebraic[175])*constants[32]*constants[124])/(constants[5]*constants[130])+(algebraic[177]*constants[129])/constants[130]+-algebraic[180]
algebraic[56] = ((constants[3]*constants[4])/constants[5])*log(constants[0]/states[4])
algebraic[60] = constants[44]*states[17]+constants[112]*states[18]
algebraic[61] = constants[44]*states[17]+constants[112]*states[20]
algebraic[62] = 1.00000/(1.00000+constants[14]/algebraic[50])
algebraic[63] = constants[45]*(states[0]-algebraic[56])*(power(states[16], 3.00000))*((1.00000-algebraic[62])*algebraic[60]*states[19]+algebraic[62]*algebraic[61]*states[21])
algebraic[64] = 1.00000/(1.00000+constants[14]/algebraic[50])
algebraic[65] = constants[47]*(states[0]-algebraic[56])*states[22]*((1.00000-algebraic[64])*states[23]+algebraic[64]*states[24])
algebraic[75] = (4.00000*algebraic[36]*(states[2]*exp(2.00000*algebraic[44])-0.341000*constants[1]))/(exp(2.00000*algebraic[44])-1.00000)
algebraic[79] = (1.00000-algebraic[78])*constants[52]*algebraic[75]*states[28]*(algebraic[69]*(1.00000-states[36])+states[33]*algebraic[72]*states[36])+algebraic[78]*constants[115]*algebraic[75]*states[28]*(algebraic[73]*(1.00000-states[36])+states[33]*algebraic[74]*states[36])
algebraic[58] = ((constants[3]*constants[4])/(2.00000*constants[5]))*log(constants[1]/states[10])
algebraic[82] = constants[53]*states[37]*states[38]*(states[0]-algebraic[58])
algebraic[90] = constants[56]*states[43]*states[43]*(states[0]-algebraic[56])
algebraic[92] = algebraic[90]+algebraic[91]
algebraic[123] = 1.00000/(1.00000+power(constants[70]/states[10], 2.00000))
algebraic[103] = 1.00000+(constants[0]/constants[61])*(1.00000+1.00000/algebraic[96])
algebraic[104] = constants[0]/(constants[61]*algebraic[96]*algebraic[103])
algebraic[107] = algebraic[104]*constants[65]
algebraic[97] = 1.00000+(states[4]/constants[61])*(1.00000+algebraic[96])
algebraic[98] = (states[4]*algebraic[96])/(constants[61]*algebraic[97])
algebraic[110] = algebraic[98]*constants[65]
algebraic[100] = 1.00000+(states[4]/constants[59])*(1.00000+states[4]/constants[60])
algebraic[101] = (states[4]*states[4])/(algebraic[100]*constants[59]*constants[60])
algebraic[113] = algebraic[101]*algebraic[98]*constants[63]
algebraic[114] = algebraic[104]*constants[132]*constants[63]
algebraic[105] = 1.00000/algebraic[103]
algebraic[106] = algebraic[105]*constants[64]
algebraic[108] = algebraic[106]+algebraic[107]
algebraic[99] = 1.00000/algebraic[97]
algebraic[109] = (algebraic[99]*constants[64])/algebraic[95]
algebraic[111] = algebraic[109]+algebraic[110]
algebraic[102] = 1.00000/algebraic[100]
algebraic[112] = algebraic[102]*states[10]*constants[66]
algebraic[115] = constants[135]*algebraic[111]*(algebraic[113]+algebraic[112])+constants[136]*algebraic[113]*(constants[135]+algebraic[108])
algebraic[116] = constants[134]*algebraic[113]*(algebraic[111]+constants[136])+algebraic[111]*algebraic[112]*(constants[134]+algebraic[114])
algebraic[117] = constants[134]*algebraic[108]*(algebraic[113]+algebraic[112])+algebraic[114]*algebraic[112]*(constants[135]+algebraic[108])
algebraic[118] = constants[135]*algebraic[114]*(algebraic[111]+constants[136])+algebraic[108]*constants[136]*(constants[134]+algebraic[114])
algebraic[119] = algebraic[115]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[120] = algebraic[116]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[121] = algebraic[117]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[122] = algebraic[118]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[124] = (3.00000*(algebraic[122]*algebraic[113]-algebraic[119]*algebraic[114])+algebraic[121]*algebraic[110])-algebraic[120]*algebraic[107]
algebraic[125] = algebraic[120]*constants[135]-algebraic[119]*constants[134]
algebraic[126] = 0.800000*constants[71]*algebraic[123]*(constants[6]*algebraic[124]+constants[7]*algebraic[125])
algebraic[176] = (constants[94]*algebraic[36]*(states[4]*exp(algebraic[44])-constants[0]))/(exp(algebraic[44])-1.00000)
algebraic[182] = (constants[96]*states[10])/(constants[97]+states[10])
algebraic[179] = (constants[95]*4.00000*algebraic[36]*(states[10]*exp(2.00000*algebraic[44])-0.341000*constants[1]))/(exp(2.00000*algebraic[44])-1.00000)
rates[0] = -(algebraic[63]+algebraic[65]+algebraic[66]+algebraic[68]+algebraic[79]+algebraic[82]+algebraic[80]+algebraic[81]+algebraic[87]+algebraic[89]+algebraic[92]+algebraic[94]+algebraic[126]+algebraic[156]+algebraic[175]+algebraic[176]+algebraic[182]+algebraic[179]+algebraic[15])
algebraic[181] = (states[4]-states[3])/constants[99]
rates[3] = (algebraic[181]*constants[130])/constants[125]
rates[4] = (-(algebraic[63]+algebraic[65]+3.00000*algebraic[126]+3.00000*algebraic[175]+algebraic[90]+algebraic[176])*constants[124]*constants[32])/(constants[5]*constants[130])+(algebraic[178]*constants[129])/constants[130]+-algebraic[181]
algebraic[183] = (states[2]-states[10])/constants[98]
algebraic[184] = (states[10]-states[9])/constants[99]
algebraic[187] = (constants[101]*algebraic[50])/(algebraic[50]+constants[14])
algebraic[188] = (constants[100]*algebraic[50])/(algebraic[50]+constants[14])
algebraic[189] = (0.000200000*(algebraic[188]+1.00000))/(1.00000+(constants[102]-algebraic[187])/states[10])-(0.00105000*states[11])/constants[103]
algebraic[53] = 1.00000/(1.00000+(constants[28]*constants[27])/(power(constants[27]+states[10], 2.00000))+(constants[31]*constants[30])/(power(constants[30]+states[10], 2.00000)))
rates[10] = algebraic[53]*(((-((algebraic[182]+algebraic[179]+algebraic[82])-2.00000*algebraic[126])*constants[32]*constants[124])/(2.00000*constants[5]*constants[130])-(algebraic[189]*constants[126])/constants[130])+-algebraic[184]+(algebraic[183]*constants[129])/constants[130])
algebraic[190] = (0.00260000*(algebraic[188]+1.00000))/(1.00000+(constants[102]-algebraic[187])/states[9])-(0.00420000*states[11])/constants[103]
algebraic[51] = 1.00000/(1.00000+(constants[26]*constants[27])/(power(constants[27]+states[9], 2.00000))+(constants[29]*constants[30])/(power(constants[30]+states[9], 2.00000)))
rates[9] = algebraic[51]*(((algebraic[184]*constants[130])/constants[125]+(states[15]*constants[128])/constants[125])-(algebraic[190]*constants[126])/constants[125])
algebraic[191] = (constants[111]*constants[104]*states[2]*(1.00000-states[45]))/((1.00000+(constants[104]*constants[107])/constants[108])*(1.00000+(states[2]*constants[105])/constants[106]))
algebraic[193] = 10.9200*algebraic[191]*(states[12]-states[2])
algebraic[52] = 1.00000/(1.00000+(constants[19]*constants[20])/(power(constants[20]+states[2], 2.00000))+(constants[21]*constants[22])/(power(constants[22]+states[2], 2.00000)))
rates[2] = algebraic[52]*(((-(algebraic[79]-2.00000*algebraic[156])*constants[32]*constants[124])/(2.00000*constants[5]*constants[129])+((states[14]+algebraic[193])*constants[127])/constants[129])-algebraic[183])
algebraic[192] = (algebraic[184]*constants[130])/constants[125]+(-algebraic[190]*constants[126])/constants[125]+(states[15]*constants[128])/constants[125]
algebraic[194] = custom_piecewise([greater(algebraic[192] , 0.00000), (91.0000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000)))*algebraic[192])/(1.00000+power(1.00000/states[13], 8.00000)) , True, 0.00000])
algebraic[186] = (6.00000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000))))/(1.00000+0.0123000/states[13])
rates[15] = (algebraic[194]-states[15])/algebraic[186]
algebraic[195] = (states[11]-states[12])/120.000
algebraic[54] = 1.00000/(1.00000+(constants[25]*constants[24])/(power(constants[24]+states[12], 2.00000)))
rates[12] = algebraic[54]*(algebraic[195]-(states[14]+algebraic[193]))
algebraic[197] = (states[11]-states[13])/120.000
rates[11] = (algebraic[189]+algebraic[190])-((algebraic[195]*constants[127])/constants[126]+(algebraic[197]*constants[128])/constants[126])
algebraic[55] = 1.00000/(1.00000+(constants[23]*constants[24])/(power(constants[24]+states[13], 2.00000)))
rates[13] = algebraic[55]*(algebraic[197]-states[15])
algebraic[196] = -((algebraic[79]*constants[124])/(constants[129]*constants[5]*2.00000)+(-(states[14]+algebraic[193])*constants[127])/constants[129]+algebraic[183])
algebraic[198] = custom_piecewise([greater(algebraic[196] , 0.00000), (15.0000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000)))*algebraic[196])/(1.00000+power(1.00000/states[12], 8.00000)) , True, 0.00000])
algebraic[185] = (2.00000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000))))/(1.00000+0.0123000/states[12])
rates[14] = (algebraic[198]-states[14])/algebraic[185]
return(rates)
def computeAlgebraic(constants, states, voi):
algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
states = array(states)
voi = array(voi)
algebraic[2] = 1.00000/(1.00000+exp((states[0]+87.6100)/7.48800))
algebraic[3] = 1.00000/(1.00000+exp((states[0]+93.8100)/7.48800))
algebraic[0] = 1.00000/(1.00000+exp(-(states[0]+constants[34])/constants[35]))
algebraic[16] = 1.00000/(constants[38]*exp((states[0]+constants[36])/constants[37])+constants[39]*exp(-(states[0]+constants[40])/constants[41]))
algebraic[1] = 1.00000/(1.00000+exp((states[0]+constants[42])/constants[43]))
algebraic[17] = 1.00000/(3.68600e-06*exp(-(states[0]+3.88750)/7.85790)+16.0000*exp((states[0]-0.496300)/9.18430))
algebraic[18] = 1.00000/(0.00979400*exp(-(states[0]+17.9500)/28.0500)+0.334300*exp((states[0]+5.73000)/56.6600))
algebraic[4] = 1.00000/(1.00000+exp((20.0000-states[0])/13.0000))
algebraic[20] = 1.05150/(1.00000/(1.20890*(1.00000+exp(-(states[0]-18.4099)/29.3814)))+3.50000/(1.00000+exp((states[0]+100.000)/29.3814)))
algebraic[5] = 1.00000/(1.00000+exp((27.0000+states[0])/13.0000))
algebraic[21] = 43.0000+1.00000/(0.00141600*exp(-(states[0]+96.5200)/59.0500)+1.78000e-08*exp((states[0]+114.100)/8.07900))
algebraic[22] = 6.16200+1.00000/(0.393300*exp(-(states[0]+100.000)/100.000)+0.0800400*exp((states[0]-8.00000)/8.59000))
algebraic[6] = 1.00000/(1.00000+exp(-(states[0]+3.94000+3.30000)/4.23000))
algebraic[25] = 0.600000+1.00000/(exp(-0.0500000*(states[0]+6.00000))+exp(0.0900000*(states[0]+14.0000)))
algebraic[7] = 1.00000/(1.00000+exp((states[0]+19.5800+3.30000)/3.69600))
algebraic[26] = 7.00000+1.00000/(0.00450000*exp(-(states[0]+20.0000+15.1900)/10.0000)+0.00450000*exp((states[0]+20.0000+15.1900)/10.0000))
algebraic[27] = 1000.00+1.00000/(3.50000e-05*exp(-(states[0]+5.00000+15.1900)/4.00000)+3.50000e-05*exp((states[0]+5.00000+15.1900)/6.00000))
algebraic[23] = algebraic[7]
algebraic[8] = states[33]*1.00000
algebraic[24] = 1.00000/(constants[51]/algebraic[8]+power(1.00000+constants[50]/states[2], 4.00000))
algebraic[9] = 1.00000/(1.00000+exp(-(states[0]+30.0000)/7.00000))
algebraic[28] = 1.00000/(1.06800*exp((states[0]+16.3000)/30.0000)+1.06800*exp(-(states[0]+16.3000)/30.0000))
algebraic[10] = 1.00000/(1.00000+exp((states[0]+61.0000)/5.00000))
algebraic[29] = 1.00000/(0.0150000*exp((states[0]+71.7000)/15.4000)+0.0150000*exp(-(states[0]+71.7000)/83.3000))
algebraic[11] = 1.00000/(1.00000+exp(-(states[0]+8.33700)/6.78900))
algebraic[30] = 12.9800+1.00000/(0.365200*exp(((states[0]+17.6000)-31.6600)/3.86900)+4.12300e-05*exp(-((states[0]+17.6000)-47.7800)/20.3800))
algebraic[31] = 1.86500+1.00000/(0.0662900*exp(((states[0]+17.2000)-34.7000)/7.35500)+1.12800e-05*exp(-((states[0]+17.2000)-29.7400)/25.9400))
algebraic[12] = 1.00000/(1.00000+exp(-(states[0]+11.6000)/8.93200))
algebraic[33] = 817.300+1.00000/(0.000232600*exp((states[0]+48.2800)/17.8000)+0.00129200*exp(-(states[0]+210.000)/230.000))
algebraic[13] = 1.00000/(1.00000+exp((states[0]+87.0000)/9.50000))
algebraic[34] = 2000.00/(exp((states[0]+57.0000)/60.0000)+exp(-(states[0]+132.000)/10.0000))
algebraic[14] = 1.00000/(1.00000+exp(-(states[0]+2.55380*constants[2]+144.590)/(1.56920*constants[2]+3.81150)))
algebraic[35] = 122.200/(exp(-(states[0]+127.200)/20.3600)+exp((states[0]+236.800)/69.3300))
algebraic[19] = algebraic[1]
algebraic[37] = 4.85900+1.00000/(0.862800*exp(-(states[0]+116.726)/7.60050)+1.10960*exp((states[0]+6.27190)/9.03580))
algebraic[40] = 0.720000*(7.00000+1.00000/(0.0400000*exp(-((states[0]+15.1900)-4.00000)/7.00000)+0.0400000*exp(((states[0]+15.1900)-4.00000)/7.00000)))
algebraic[41] = 0.490000*(100.000+1.00000/(0.000120000*exp(-(states[0]+15.1900)/3.00000)+0.000120000*exp((states[0]+15.1900)/7.00000)))
algebraic[42] = 2.50000*algebraic[26]
algebraic[32] = algebraic[12]
algebraic[43] = 1.00000/(0.0100000*exp((states[0]-50.0000)/20.0000)+0.0193000*exp(-(states[0]+66.5400)/31.0000))
algebraic[49] = (constants[17]*(1.00000-states[1]))/(1.00000+constants[18]/states[2])
algebraic[38] = 1.00000/(1.00000+exp((states[0]+84.7000)/6.22000))
algebraic[45] = 3.00000*algebraic[18]
algebraic[46] = 1.46000*algebraic[37]
algebraic[39] = 1.00000/(1.00000+exp(-(states[0]+42.8500)/5.26400))
algebraic[47] = algebraic[16]
algebraic[48] = 2.50000*algebraic[40]
algebraic[69] = constants[114]*states[29]+constants[120]*states[30]
algebraic[70] = 0.300000+0.600000/(1.00000+exp((states[0]-10.0000)/10.0000))
algebraic[71] = 1.00000-algebraic[70]
algebraic[72] = algebraic[70]*states[31]+algebraic[71]*states[32]
algebraic[73] = constants[114]*states[34]+constants[120]*states[30]
algebraic[74] = algebraic[70]*states[35]+algebraic[71]*states[32]
algebraic[36] = (states[0]*constants[5]*constants[5])/(constants[3]*constants[4])
algebraic[44] = (states[0]*constants[5])/(constants[3]*constants[4])
algebraic[77] = (1.00000*algebraic[36]*(0.750000*states[7]*exp(1.00000*algebraic[44])-0.750000*constants[2]))/(exp(1.00000*algebraic[44])-1.00000)
algebraic[50] = algebraic[49]+states[1]
algebraic[78] = 1.00000/(1.00000+constants[14]/algebraic[50])
algebraic[81] = (1.00000-algebraic[78])*constants[117]*algebraic[77]*states[28]*(algebraic[69]*(1.00000-states[36])+states[33]*algebraic[72]*states[36])+algebraic[78]*constants[122]*algebraic[77]*states[28]*(algebraic[73]*(1.00000-states[36])+states[33]*algebraic[74]*states[36])
algebraic[177] = (states[7]-states[8])/constants[98]
algebraic[76] = (1.00000*algebraic[36]*(0.750000*states[5]*exp(1.00000*algebraic[44])-0.750000*constants[0]))/(exp(1.00000*algebraic[44])-1.00000)
algebraic[80] = (1.00000-algebraic[78])*constants[116]*algebraic[76]*states[28]*(algebraic[69]*(1.00000-states[36])+states[33]*algebraic[72]*states[36])+algebraic[78]*constants[121]*algebraic[76]*states[28]*(algebraic[73]*(1.00000-states[36])+states[33]*algebraic[74]*states[36])
algebraic[153] = 1.00000/(1.00000+power(constants[70]/states[2], 2.00000))
algebraic[96] = exp((constants[68]*states[0]*constants[5])/(constants[3]*constants[4]))
algebraic[133] = 1.00000+(constants[0]/constants[61])*(1.00000+1.00000/algebraic[96])
algebraic[134] = constants[0]/(constants[61]*algebraic[96]*algebraic[133])
algebraic[137] = algebraic[134]*constants[65]
algebraic[127] = 1.00000+(states[5]/constants[61])*(1.00000+algebraic[96])
algebraic[128] = (states[5]*algebraic[96])/(constants[61]*algebraic[127])
algebraic[140] = algebraic[128]*constants[65]
algebraic[130] = 1.00000+(states[5]/constants[59])*(1.00000+states[5]/constants[60])
algebraic[131] = (states[5]*states[5])/(algebraic[130]*constants[59]*constants[60])
algebraic[143] = algebraic[131]*algebraic[128]*constants[63]
algebraic[144] = algebraic[134]*constants[138]*constants[63]
algebraic[135] = 1.00000/algebraic[133]
algebraic[136] = algebraic[135]*constants[64]
algebraic[138] = algebraic[136]+algebraic[137]
algebraic[95] = exp((constants[69]*states[0]*constants[5])/(constants[3]*constants[4]))
algebraic[129] = 1.00000/algebraic[127]
algebraic[139] = (algebraic[129]*constants[64])/algebraic[95]
algebraic[141] = algebraic[139]+algebraic[140]
algebraic[132] = 1.00000/algebraic[130]
algebraic[142] = algebraic[132]*states[2]*constants[66]
algebraic[145] = constants[141]*algebraic[141]*(algebraic[143]+algebraic[142])+constants[142]*algebraic[143]*(constants[141]+algebraic[138])
algebraic[146] = constants[140]*algebraic[143]*(algebraic[141]+constants[142])+algebraic[141]*algebraic[142]*(constants[140]+algebraic[144])
algebraic[147] = constants[140]*algebraic[138]*(algebraic[143]+algebraic[142])+algebraic[144]*algebraic[142]*(constants[141]+algebraic[138])
algebraic[148] = constants[141]*algebraic[144]*(algebraic[141]+constants[142])+algebraic[138]*constants[142]*(constants[140]+algebraic[144])
algebraic[149] = algebraic[145]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[150] = algebraic[146]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[151] = algebraic[147]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[152] = algebraic[148]/(algebraic[145]+algebraic[146]+algebraic[147]+algebraic[148])
algebraic[154] = (3.00000*(algebraic[152]*algebraic[143]-algebraic[149]*algebraic[144])+algebraic[151]*algebraic[140])-algebraic[150]*algebraic[137]
algebraic[155] = algebraic[150]*constants[141]-algebraic[149]*constants[140]
algebraic[156] = 0.200000*constants[71]*algebraic[153]*(constants[6]*algebraic[154]+constants[7]*algebraic[155])
algebraic[178] = (states[5]-states[4])/constants[98]
algebraic[180] = (states[8]-states[6])/constants[99]
algebraic[57] = ((constants[3]*constants[4])/constants[5])*log(constants[2]/states[8])
algebraic[66] = constants[48]*states[25]*states[26]*states[27]*(states[0]-algebraic[57])
algebraic[67] = 1.00000/(1.00000+exp(-(states[0]-12.0000)/16.0000))
algebraic[68] = constants[49]*algebraic[67]*(states[0]-algebraic[57])
algebraic[83] = 1.00000/(1.00000+exp((states[0]+54.8100)/38.2100))
algebraic[84] = 1.00000-algebraic[83]
algebraic[85] = algebraic[83]*states[39]+algebraic[84]*states[40]
algebraic[86] = ((1.00000/(1.00000+exp((states[0]+55.0000)/(0.320000*75.0000))))*1.00000)/(1.00000+exp((states[0]-10.0000)/(0.320000*30.0000)))
algebraic[87] = constants[54]*(power(constants[2]/5.40000, 1.0/2))*algebraic[85]*algebraic[86]*(states[0]-algebraic[57])
algebraic[59] = ((constants[3]*constants[4])/constants[5])*log((constants[2]+constants[33]*constants[0])/(states[8]+constants[33]*states[4]))
algebraic[88] = 1.00000+0.600000/(1.00000+power(3.80000e-05/states[10], 1.40000))
algebraic[89] = constants[55]*algebraic[88]*states[41]*states[42]*(states[0]-algebraic[59])
algebraic[93] = 1.00000/(1.00000+exp(((states[0]+116.000)-5.50000*constants[2])/11.0000))
algebraic[94] = constants[58]*2.32380*(power(constants[2]/5.40000, 1.0/2))*algebraic[93]*states[44]*(states[0]-algebraic[57])
algebraic[158] = constants[81]*exp(((1.00000-constants[82])*states[0]*constants[5])/(3.00000*constants[3]*constants[4]))
algebraic[162] = (constants[76]*(power(constants[2]/constants[84], 2.00000)))/((power(1.00000+constants[0]/algebraic[158], 3.00000)+power(1.00000+constants[2]/constants[84], 2.00000))-1.00000)
algebraic[159] = constants[89]/(1.00000+constants[88]/constants[90]+states[4]/constants[91]+states[8]/constants[92])
algebraic[163] = (constants[77]*algebraic[159]*constants[88])/(1.00000+constants[86]/constants[87])
algebraic[157] = constants[80]*exp((constants[82]*states[0]*constants[5])/(3.00000*constants[3]*constants[4]))
algebraic[160] = (constants[72]*(power(states[4]/algebraic[157], 3.00000)))/((power(1.00000+states[4]/algebraic[157], 3.00000)+power(1.00000+states[8]/constants[83], 2.00000))-1.00000)
algebraic[161] = (constants[75]*(power(constants[0]/algebraic[158], 3.00000)))/((power(1.00000+constants[0]/algebraic[158], 3.00000)+power(1.00000+constants[2]/constants[84], 2.00000))-1.00000)
algebraic[164] = (constants[79]*(power(states[8]/constants[83], 2.00000)))/((power(1.00000+states[4]/algebraic[157], 3.00000)+power(1.00000+states[8]/constants[83], 2.00000))-1.00000)
algebraic[165] = constants[145]*algebraic[160]*constants[144]+algebraic[161]*algebraic[164]*algebraic[163]+constants[144]*algebraic[164]*algebraic[163]+algebraic[163]*algebraic[160]*constants[144]
algebraic[166] = algebraic[161]*constants[143]*algebraic[164]+algebraic[160]*constants[144]*algebraic[162]+algebraic[162]*constants[143]*algebraic[164]+constants[144]*algebraic[162]*algebraic[164]
algebraic[167] = constants[144]*algebraic[162]*constants[145]+algebraic[163]*algebraic[161]*constants[143]+algebraic[161]*constants[143]*constants[145]+algebraic[162]*constants[145]*constants[143]
algebraic[168] = algebraic[164]*algebraic[163]*algebraic[161]+algebraic[162]*constants[145]*algebraic[160]+algebraic[161]*constants[145]*algebraic[160]+algebraic[163]*algebraic[161]*algebraic[160]
algebraic[169] = algebraic[165]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[170] = algebraic[166]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[173] = 3.00000*(algebraic[169]*algebraic[162]-algebraic[170]*algebraic[163])
algebraic[171] = algebraic[167]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[172] = algebraic[168]/(algebraic[165]+algebraic[166]+algebraic[167]+algebraic[168])
algebraic[174] = 2.00000*(algebraic[172]*constants[143]-algebraic[171]*algebraic[160])
algebraic[175] = constants[93]*(constants[6]*algebraic[173]+constants[8]*algebraic[174])
algebraic[15] = custom_piecewise([less_equal(voi , constants[13]), constants[12] , True, 0.00000])
algebraic[91] = constants[57]*states[43]*states[43]*(states[0]-algebraic[57])
algebraic[56] = ((constants[3]*constants[4])/constants[5])*log(constants[0]/states[4])
algebraic[60] = constants[44]*states[17]+constants[112]*states[18]
algebraic[61] = constants[44]*states[17]+constants[112]*states[20]
algebraic[62] = 1.00000/(1.00000+constants[14]/algebraic[50])
algebraic[63] = constants[45]*(states[0]-algebraic[56])*(power(states[16], 3.00000))*((1.00000-algebraic[62])*algebraic[60]*states[19]+algebraic[62]*algebraic[61]*states[21])
algebraic[64] = 1.00000/(1.00000+constants[14]/algebraic[50])
algebraic[65] = constants[47]*(states[0]-algebraic[56])*states[22]*((1.00000-algebraic[64])*states[23]+algebraic[64]*states[24])
algebraic[75] = (4.00000*algebraic[36]*(states[2]*exp(2.00000*algebraic[44])-0.341000*constants[1]))/(exp(2.00000*algebraic[44])-1.00000)
algebraic[79] = (1.00000-algebraic[78])*constants[52]*algebraic[75]*states[28]*(algebraic[69]*(1.00000-states[36])+states[33]*algebraic[72]*states[36])+algebraic[78]*constants[115]*algebraic[75]*states[28]*(algebraic[73]*(1.00000-states[36])+states[33]*algebraic[74]*states[36])
algebraic[58] = ((constants[3]*constants[4])/(2.00000*constants[5]))*log(constants[1]/states[10])
algebraic[82] = constants[53]*states[37]*states[38]*(states[0]-algebraic[58])
algebraic[90] = constants[56]*states[43]*states[43]*(states[0]-algebraic[56])
algebraic[92] = algebraic[90]+algebraic[91]
algebraic[123] = 1.00000/(1.00000+power(constants[70]/states[10], 2.00000))
algebraic[103] = 1.00000+(constants[0]/constants[61])*(1.00000+1.00000/algebraic[96])
algebraic[104] = constants[0]/(constants[61]*algebraic[96]*algebraic[103])
algebraic[107] = algebraic[104]*constants[65]
algebraic[97] = 1.00000+(states[4]/constants[61])*(1.00000+algebraic[96])
algebraic[98] = (states[4]*algebraic[96])/(constants[61]*algebraic[97])
algebraic[110] = algebraic[98]*constants[65]
algebraic[100] = 1.00000+(states[4]/constants[59])*(1.00000+states[4]/constants[60])
algebraic[101] = (states[4]*states[4])/(algebraic[100]*constants[59]*constants[60])
algebraic[113] = algebraic[101]*algebraic[98]*constants[63]
algebraic[114] = algebraic[104]*constants[132]*constants[63]
algebraic[105] = 1.00000/algebraic[103]
algebraic[106] = algebraic[105]*constants[64]
algebraic[108] = algebraic[106]+algebraic[107]
algebraic[99] = 1.00000/algebraic[97]
algebraic[109] = (algebraic[99]*constants[64])/algebraic[95]
algebraic[111] = algebraic[109]+algebraic[110]
algebraic[102] = 1.00000/algebraic[100]
algebraic[112] = algebraic[102]*states[10]*constants[66]
algebraic[115] = constants[135]*algebraic[111]*(algebraic[113]+algebraic[112])+constants[136]*algebraic[113]*(constants[135]+algebraic[108])
algebraic[116] = constants[134]*algebraic[113]*(algebraic[111]+constants[136])+algebraic[111]*algebraic[112]*(constants[134]+algebraic[114])
algebraic[117] = constants[134]*algebraic[108]*(algebraic[113]+algebraic[112])+algebraic[114]*algebraic[112]*(constants[135]+algebraic[108])
algebraic[118] = constants[135]*algebraic[114]*(algebraic[111]+constants[136])+algebraic[108]*constants[136]*(constants[134]+algebraic[114])
algebraic[119] = algebraic[115]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[120] = algebraic[116]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[121] = algebraic[117]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[122] = algebraic[118]/(algebraic[115]+algebraic[116]+algebraic[117]+algebraic[118])
algebraic[124] = (3.00000*(algebraic[122]*algebraic[113]-algebraic[119]*algebraic[114])+algebraic[121]*algebraic[110])-algebraic[120]*algebraic[107]
algebraic[125] = algebraic[120]*constants[135]-algebraic[119]*constants[134]
algebraic[126] = 0.800000*constants[71]*algebraic[123]*(constants[6]*algebraic[124]+constants[7]*algebraic[125])
algebraic[176] = (constants[94]*algebraic[36]*(states[4]*exp(algebraic[44])-constants[0]))/(exp(algebraic[44])-1.00000)
algebraic[182] = (constants[96]*states[10])/(constants[97]+states[10])
algebraic[179] = (constants[95]*4.00000*algebraic[36]*(states[10]*exp(2.00000*algebraic[44])-0.341000*constants[1]))/(exp(2.00000*algebraic[44])-1.00000)
algebraic[181] = (states[4]-states[3])/constants[99]
algebraic[183] = (states[2]-states[10])/constants[98]
algebraic[184] = (states[10]-states[9])/constants[99]
algebraic[187] = (constants[101]*algebraic[50])/(algebraic[50]+constants[14])
algebraic[188] = (constants[100]*algebraic[50])/(algebraic[50]+constants[14])
algebraic[189] = (0.000200000*(algebraic[188]+1.00000))/(1.00000+(constants[102]-algebraic[187])/states[10])-(0.00105000*states[11])/constants[103]
algebraic[53] = 1.00000/(1.00000+(constants[28]*constants[27])/(power(constants[27]+states[10], 2.00000))+(constants[31]*constants[30])/(power(constants[30]+states[10], 2.00000)))
algebraic[190] = (0.00260000*(algebraic[188]+1.00000))/(1.00000+(constants[102]-algebraic[187])/states[9])-(0.00420000*states[11])/constants[103]
algebraic[51] = 1.00000/(1.00000+(constants[26]*constants[27])/(power(constants[27]+states[9], 2.00000))+(constants[29]*constants[30])/(power(constants[30]+states[9], 2.00000)))
algebraic[191] = (constants[111]*constants[104]*states[2]*(1.00000-states[45]))/((1.00000+(constants[104]*constants[107])/constants[108])*(1.00000+(states[2]*constants[105])/constants[106]))
algebraic[193] = 10.9200*algebraic[191]*(states[12]-states[2])
algebraic[52] = 1.00000/(1.00000+(constants[19]*constants[20])/(power(constants[20]+states[2], 2.00000))+(constants[21]*constants[22])/(power(constants[22]+states[2], 2.00000)))
algebraic[192] = (algebraic[184]*constants[130])/constants[125]+(-algebraic[190]*constants[126])/constants[125]+(states[15]*constants[128])/constants[125]
algebraic[194] = custom_piecewise([greater(algebraic[192] , 0.00000), (91.0000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000)))*algebraic[192])/(1.00000+power(1.00000/states[13], 8.00000)) , True, 0.00000])
algebraic[186] = (6.00000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000))))/(1.00000+0.0123000/states[13])
algebraic[195] = (states[11]-states[12])/120.000
algebraic[54] = 1.00000/(1.00000+(constants[25]*constants[24])/(power(constants[24]+states[12], 2.00000)))
algebraic[197] = (states[11]-states[13])/120.000
algebraic[55] = 1.00000/(1.00000+(constants[23]*constants[24])/(power(constants[24]+states[13], 2.00000)))
algebraic[196] = -((algebraic[79]*constants[124])/(constants[129]*constants[5]*2.00000)+(-(states[14]+algebraic[193])*constants[127])/constants[129]+algebraic[183])
algebraic[198] = custom_piecewise([greater(algebraic[196] , 0.00000), (15.0000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000)))*algebraic[196])/(1.00000+power(1.00000/states[12], 8.00000)) , True, 0.00000])
algebraic[185] = (2.00000*(1.00000+(1.00000*1.00000)/(1.00000+power(0.280000/algebraic[50], 8.00000))))/(1.00000+0.0123000/states[12])
return algebraic
def custom_piecewise(cases):
"""Compute result of a piecewise function"""
return select(cases[0::2],cases[1::2])
def solve_model():
"""Solve model with ODE solver"""
from scipy.integrate import ode
# Initialise constants and state variables
(init_states, constants) = initConsts()
# Set timespan to solve over
voi = linspace(0, 10, 500)
# Construct ODE object to solve
r = ode(computeRates)
r.set_integrator('vode', method='bdf', atol=1e-06, rtol=1e-06, max_step=1)
r.set_initial_value(init_states, voi[0])
r.set_f_params(constants)
# Solve model
states = array([[0.0] * len(voi)] * sizeStates)
states[:,0] = init_states
for (i,t) in enumerate(voi[1:]):
if r.successful():
r.integrate(t)
states[:,i+1] = r.y
else:
break
# Compute algebraic variables
algebraic = computeAlgebraic(constants, states, voi)
return (voi, states, algebraic)
def plot_model(voi, states, algebraic):
"""Plot variables against variable of integration"""
import pylab
(legend_states, legend_algebraic, legend_voi, legend_constants) = createLegends()
pylab.figure(1)
pylab.plot(voi,vstack((states,algebraic)).T)
pylab.xlabel(legend_voi)
pylab.legend(legend_states + legend_algebraic, loc='best')
pylab.show()
if __name__ == "__main__":
(voi, states, algebraic) = solve_model()
plot_model(voi, states, algebraic)
