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 = 200
sizeStates = 49
sizeConstants = 206
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] = "celltype in component environment (dimensionless)"
    legend_constants[1] = "nao in component extracellular (millimolar)"
    legend_constants[2] = "cao in component extracellular (millimolar)"
    legend_constants[3] = "ko in component extracellular (millimolar)"
    legend_constants[4] = "R in component physical_constants (joule_per_kilomole_kelvin)"
    legend_constants[5] = "T in component physical_constants (kelvin)"
    legend_constants[6] = "F in component physical_constants (coulomb_per_mole)"
    legend_constants[7] = "zna in component physical_constants (dimensionless)"
    legend_constants[8] = "zca in component physical_constants (dimensionless)"
    legend_constants[9] = "zk in component physical_constants (dimensionless)"
    legend_constants[10] = "L in component cell_geometry (centimeter)"
    legend_constants[11] = "rad in component cell_geometry (centimeter)"
    legend_constants[162] = "vcell in component cell_geometry (microliter)"
    legend_constants[177] = "Ageo in component cell_geometry (centimeter_squared)"
    legend_constants[183] = "Acap in component cell_geometry (centimeter_squared)"
    legend_constants[184] = "vmyo in component cell_geometry (microliter)"
    legend_constants[185] = "vnsr in component cell_geometry (microliter)"
    legend_constants[186] = "vjsr in component cell_geometry (microliter)"
    legend_constants[187] = "vss in component cell_geometry (microliter)"
    legend_states[0] = "v in component membrane (millivolt)"
    legend_algebraic[12] = "vfrt in component membrane (dimensionless)"
    legend_constants[169] = "ffrt in component membrane (coulomb_per_mole_millivolt)"
    legend_constants[149] = "frt in component membrane (per_millivolt)"
    legend_algebraic[58] = "INa in component INa (microA_per_microF)"
    legend_algebraic[60] = "INaL in component INaL (microA_per_microF)"
    legend_algebraic[66] = "Ito in component Ito (microA_per_microF)"
    legend_algebraic[83] = "ICaL in component ICaL (microA_per_microF)"
    legend_algebraic[84] = "ICaNa in component ICaL (microA_per_microF)"
    legend_algebraic[87] = "ICaK in component ICaL (microA_per_microF)"
    legend_algebraic[90] = "IKr in component IKr (microA_per_microF)"
    legend_algebraic[96] = "IKs in component IKs (microA_per_microF)"
    legend_algebraic[98] = "IK1 in component IK1 (microA_per_microF)"
    legend_algebraic[130] = "INaCa_i in component INaCa_i (microA_per_microF)"
    legend_algebraic[160] = "INaCa_ss in component INaCa_i (microA_per_microF)"
    legend_algebraic[179] = "INaK in component INaK (microA_per_microF)"
    legend_algebraic[185] = "INab in component INab (microA_per_microF)"
    legend_algebraic[181] = "IKb in component IKb (microA_per_microF)"
    legend_algebraic[190] = "IpCa in component IpCa (microA_per_microF)"
    legend_algebraic[189] = "ICab in component ICab (microA_per_microF)"
    legend_algebraic[0] = "Istim in component membrane (microA_per_microF)"
    legend_constants[12] = "i_Stim_Start in component membrane (millisecond)"
    legend_constants[13] = "i_Stim_End in component membrane (millisecond)"
    legend_constants[14] = "i_Stim_Amplitude in component membrane (microA_per_microF)"
    legend_constants[15] = "i_Stim_Period in component membrane (millisecond)"
    legend_constants[16] = "i_Stim_PulseDuration in component membrane (millisecond)"
    legend_constants[17] = "KmCaMK in component CaMK (millimolar)"
    legend_constants[18] = "aCaMK in component CaMK (per_millimolar_per_millisecond)"
    legend_constants[19] = "bCaMK in component CaMK (per_millisecond)"
    legend_constants[20] = "CaMKo in component CaMK (dimensionless)"
    legend_constants[21] = "KmCaM in component CaMK (millimolar)"
    legend_algebraic[36] = "CaMKb in component CaMK (millimolar)"
    legend_algebraic[42] = "CaMKa in component CaMK (millimolar)"
    legend_states[1] = "CaMKt in component CaMK (millimolar)"
    legend_states[2] = "cass in component intracellular_ions (millimolar)"
    legend_constants[22] = "cmdnmax_b in component intracellular_ions (millimolar)"
    legend_constants[150] = "cmdnmax in component intracellular_ions (millimolar)"
    legend_constants[23] = "kmcmdn in component intracellular_ions (millimolar)"
    legend_constants[24] = "trpnmax in component intracellular_ions (millimolar)"
    legend_constants[25] = "kmtrpn in component intracellular_ions (millimolar)"
    legend_constants[26] = "BSRmax in component intracellular_ions (millimolar)"
    legend_constants[27] = "KmBSR in component intracellular_ions (millimolar)"
    legend_constants[28] = "BSLmax in component intracellular_ions (millimolar)"
    legend_constants[29] = "KmBSL in component intracellular_ions (millimolar)"
    legend_constants[30] = "csqnmax in component intracellular_ions (millimolar)"
    legend_constants[31] = "kmcsqn in component intracellular_ions (millimolar)"
    legend_states[3] = "nai in component intracellular_ions (millimolar)"
    legend_states[4] = "nass in component intracellular_ions (millimolar)"
    legend_states[5] = "ki in component intracellular_ions (millimolar)"
    legend_states[6] = "kss in component intracellular_ions (millimolar)"
    legend_states[7] = "cansr in component intracellular_ions (millimolar)"
    legend_states[8] = "cajsr in component intracellular_ions (millimolar)"
    legend_states[9] = "cai in component intracellular_ions (millimolar)"
    legend_algebraic[187] = "JdiffNa in component diff (millimolar_per_millisecond)"
    legend_algebraic[191] = "Jdiff in component diff (millimolar_per_millisecond)"
    legend_algebraic[198] = "Jup in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[183] = "JdiffK in component diff (millimolar_per_millisecond)"
    legend_algebraic[193] = "Jrel in component ryr (millimolar_per_millisecond)"
    legend_algebraic[199] = "Jtr in component trans_flux (millimolar_per_millisecond)"
    legend_algebraic[44] = "Bcai in component intracellular_ions (dimensionless)"
    legend_algebraic[48] = "Bcajsr in component intracellular_ions (dimensionless)"
    legend_algebraic[46] = "Bcass 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[50] = "ENa in component reversal_potentials (millivolt)"
    legend_algebraic[53] = "EK in component reversal_potentials (millivolt)"
    legend_algebraic[54] = "EKs in component reversal_potentials (millivolt)"
    legend_algebraic[1] = "mss in component INa (dimensionless)"
    legend_algebraic[13] = "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[10] = "m in component INa (dimensionless)"
    legend_algebraic[2] = "hss in component INa (dimensionless)"
    legend_algebraic[14] = "thf in component INa (millisecond)"
    legend_algebraic[15] = "ths in component INa (millisecond)"
    legend_constants[42] = "hssV1 in component INa (millivolt)"
    legend_constants[43] = "hssV2 in component INa (millivolt)"
    legend_constants[151] = "Ahs in component INa (dimensionless)"
    legend_constants[44] = "Ahf in component INa (dimensionless)"
    legend_states[11] = "hf in component INa (dimensionless)"
    legend_states[12] = "hs in component INa (dimensionless)"
    legend_algebraic[55] = "h in component INa (dimensionless)"
    legend_constants[45] = "GNa in component INa (milliS_per_microF)"
    legend_constants[46] = "shift_INa_inact in component INa (millivolt)"
    legend_algebraic[16] = "jss in component INa (dimensionless)"
    legend_algebraic[27] = "tj in component INa (millisecond)"
    legend_states[13] = "j in component INa (dimensionless)"
    legend_algebraic[28] = "hssp in component INa (dimensionless)"
    legend_algebraic[37] = "thsp in component INa (millisecond)"
    legend_states[14] = "hsp in component INa (dimensionless)"
    legend_algebraic[56] = "hp in component INa (dimensionless)"
    legend_algebraic[38] = "tjp in component INa (millisecond)"
    legend_states[15] = "jp in component INa (dimensionless)"
    legend_algebraic[57] = "fINap in component INa (dimensionless)"
    legend_algebraic[29] = "mLss in component INaL (dimensionless)"
    legend_algebraic[39] = "tmL in component INaL (millisecond)"
    legend_states[16] = "mL in component INaL (dimensionless)"
    legend_constants[47] = "thL in component INaL (millisecond)"
    legend_algebraic[3] = "hLss in component INaL (dimensionless)"
    legend_states[17] = "hL in component INaL (dimensionless)"
    legend_algebraic[4] = "hLssp in component INaL (dimensionless)"
    legend_constants[152] = "thLp in component INaL (millisecond)"
    legend_states[18] = "hLp in component INaL (dimensionless)"
    legend_constants[48] = "GNaL_b in component INaL (milliS_per_microF)"
    legend_constants[153] = "GNaL in component INaL (milliS_per_microF)"
    legend_algebraic[59] = "fINaLp in component INaL (dimensionless)"
    legend_constants[49] = "Gto_b in component Ito (milliS_per_microF)"
    legend_algebraic[5] = "ass in component Ito (dimensionless)"
    legend_algebraic[17] = "ta in component Ito (millisecond)"
    legend_states[19] = "a in component Ito (dimensionless)"
    legend_algebraic[6] = "iss in component Ito (dimensionless)"
    legend_algebraic[18] = "delta_epi in component Ito (dimensionless)"
    legend_algebraic[30] = "tiF_b in component Ito (millisecond)"
    legend_algebraic[40] = "tiS_b in component Ito (millisecond)"
    legend_algebraic[43] = "tiF in component Ito (millisecond)"
    legend_algebraic[45] = "tiS in component Ito (millisecond)"
    legend_algebraic[61] = "AiF in component Ito (dimensionless)"
    legend_algebraic[62] = "AiS in component Ito (dimensionless)"
    legend_states[20] = "iF in component Ito (dimensionless)"
    legend_states[21] = "iS in component Ito (dimensionless)"
    legend_algebraic[63] = "i in component Ito (dimensionless)"
    legend_algebraic[31] = "assp in component Ito (dimensionless)"
    legend_states[22] = "ap in component Ito (dimensionless)"
    legend_algebraic[47] = "dti_develop in component Ito (dimensionless)"
    legend_algebraic[49] = "dti_recover in component Ito (dimensionless)"
    legend_algebraic[51] = "tiFp in component Ito (millisecond)"
    legend_algebraic[52] = "tiSp in component Ito (millisecond)"
    legend_states[23] = "iFp in component Ito (dimensionless)"
    legend_states[24] = "iSp in component Ito (dimensionless)"
    legend_algebraic[64] = "ip in component Ito (dimensionless)"
    legend_constants[154] = "Gto in component Ito (milliS_per_microF)"
    legend_algebraic[65] = "fItop in component Ito (dimensionless)"
    legend_constants[50] = "Kmn in component ICaL (millimolar)"
    legend_constants[51] = "k2n in component ICaL (per_millisecond)"
    legend_constants[52] = "PCa_b in component ICaL (dimensionless)"
    legend_algebraic[7] = "dss in component ICaL (dimensionless)"
    legend_states[25] = "d in component ICaL (dimensionless)"
    legend_algebraic[8] = "fss in component ICaL (dimensionless)"
    legend_constants[155] = "Aff in component ICaL (dimensionless)"
    legend_constants[170] = "Afs in component ICaL (dimensionless)"
    legend_states[26] = "ff in component ICaL (dimensionless)"
    legend_states[27] = "fs in component ICaL (dimensionless)"
    legend_algebraic[67] = "f in component ICaL (dimensionless)"
    legend_algebraic[19] = "fcass in component ICaL (dimensionless)"
    legend_algebraic[68] = "Afcaf in component ICaL (dimensionless)"
    legend_algebraic[69] = "Afcas in component ICaL (dimensionless)"
    legend_states[28] = "fcaf in component ICaL (dimensionless)"
    legend_states[29] = "fcas in component ICaL (dimensionless)"
    legend_algebraic[70] = "fca in component ICaL (dimensionless)"
    legend_states[30] = "jca in component ICaL (dimensionless)"
    legend_states[31] = "ffp in component ICaL (dimensionless)"
    legend_algebraic[71] = "fp in component ICaL (dimensionless)"
    legend_states[32] = "fcafp in component ICaL (dimensionless)"
    legend_algebraic[72] = "fcap in component ICaL (dimensionless)"
    legend_algebraic[9] = "km2n in component ICaL (per_millisecond)"
    legend_algebraic[20] = "anca in component ICaL (dimensionless)"
    legend_states[33] = "nca in component ICaL (dimensionless)"
    legend_algebraic[75] = "PhiCaL in component ICaL (dimensionless)"
    legend_algebraic[78] = "PhiCaNa in component ICaL (dimensionless)"
    legend_algebraic[81] = "PhiCaK in component ICaL (dimensionless)"
    legend_constants[156] = "PCa in component ICaL (dimensionless)"
    legend_constants[171] = "PCap in component ICaL (dimensionless)"
    legend_constants[172] = "PCaNa in component ICaL (dimensionless)"
    legend_constants[173] = "PCaK in component ICaL (dimensionless)"
    legend_constants[181] = "PCaNap in component ICaL (dimensionless)"
    legend_constants[182] = "PCaKp in component ICaL (dimensionless)"
    legend_algebraic[82] = "fICaLp in component ICaL (dimensionless)"
    legend_algebraic[21] = "td in component ICaL (millisecond)"
    legend_algebraic[22] = "tff in component ICaL (millisecond)"
    legend_algebraic[23] = "tfs in component ICaL (millisecond)"
    legend_algebraic[32] = "tfcaf in component ICaL (millisecond)"
    legend_algebraic[33] = "tfcas in component ICaL (millisecond)"
    legend_constants[157] = "tjca in component ICaL (millisecond)"
    legend_algebraic[34] = "tffp in component ICaL (millisecond)"
    legend_algebraic[41] = "tfcafp in component ICaL (millisecond)"
    legend_constants[158] = "v0 in component ICaL (millivolt)"
    legend_algebraic[73] = "A_1 in component ICaL (dimensionless)"
    legend_constants[174] = "B_1 in component ICaL (per_millivolt)"
    legend_algebraic[74] = "U_1 in component ICaL (dimensionless)"
    legend_algebraic[76] = "A_2 in component ICaL (dimensionless)"
    legend_constants[175] = "B_2 in component ICaL (per_millivolt)"
    legend_algebraic[77] = "U_2 in component ICaL (dimensionless)"
    legend_algebraic[79] = "A_3 in component ICaL (dimensionless)"
    legend_constants[176] = "B_3 in component ICaL (per_millivolt)"
    legend_algebraic[80] = "U_3 in component ICaL (dimensionless)"
    legend_constants[53] = "GKr_b in component IKr (milliS_per_microF)"
    legend_states[34] = "IC1 in component IKr (dimensionless)"
    legend_states[35] = "IC2 in component IKr (dimensionless)"
    legend_states[36] = "C1 in component IKr (dimensionless)"
    legend_states[37] = "C2 in component IKr (dimensionless)"
    legend_states[38] = "O in component IKr (dimensionless)"
    legend_states[39] = "IO in component IKr (dimensionless)"
    legend_states[40] = "IObound in component IKr (dimensionless)"
    legend_states[41] = "Obound in component IKr (dimensionless)"
    legend_states[42] = "Cbound in component IKr (dimensionless)"
    legend_states[43] = "D in component IKr (dimensionless)"
    legend_constants[159] = "GKr in component IKr (milliS_per_microF)"
    legend_constants[54] = "A1 in component IKr (per_millisecond)"
    legend_constants[55] = "B1 in component IKr (per_millivolt)"
    legend_constants[56] = "q1 in component IKr (dimensionless)"
    legend_constants[57] = "A2 in component IKr (per_millisecond)"
    legend_constants[58] = "B2 in component IKr (per_millivolt)"
    legend_constants[59] = "q2 in component IKr (dimensionless)"
    legend_constants[60] = "A3 in component IKr (per_millisecond)"
    legend_constants[61] = "B3 in component IKr (per_millivolt)"
    legend_constants[62] = "q3 in component IKr (dimensionless)"
    legend_constants[63] = "A4 in component IKr (per_millisecond)"
    legend_constants[64] = "B4 in component IKr (per_millivolt)"
    legend_constants[65] = "q4 in component IKr (dimensionless)"
    legend_constants[66] = "A11 in component IKr (per_millisecond)"
    legend_constants[67] = "B11 in component IKr (per_millivolt)"
    legend_constants[68] = "q11 in component IKr (dimensionless)"
    legend_constants[69] = "A21 in component IKr (per_millisecond)"
    legend_constants[70] = "B21 in component IKr (per_millivolt)"
    legend_constants[71] = "q21 in component IKr (dimensionless)"
    legend_constants[72] = "A31 in component IKr (per_millisecond)"
    legend_constants[73] = "B31 in component IKr (per_millivolt)"
    legend_constants[74] = "q31 in component IKr (dimensionless)"
    legend_constants[75] = "A41 in component IKr (per_millisecond)"
    legend_constants[76] = "B41 in component IKr (per_millivolt)"
    legend_constants[77] = "q41 in component IKr (dimensionless)"
    legend_constants[78] = "A51 in component IKr (per_millisecond)"
    legend_constants[79] = "B51 in component IKr (per_millivolt)"
    legend_constants[80] = "q51 in component IKr (dimensionless)"
    legend_constants[81] = "A52 in component IKr (per_millisecond)"
    legend_constants[82] = "B52 in component IKr (per_millivolt)"
    legend_constants[83] = "q52 in component IKr (dimensionless)"
    legend_constants[84] = "A53 in component IKr (per_millisecond)"
    legend_constants[85] = "B53 in component IKr (per_millivolt)"
    legend_constants[86] = "q53 in component IKr (dimensionless)"
    legend_constants[87] = "A61 in component IKr (per_millisecond)"
    legend_constants[88] = "B61 in component IKr (per_millivolt)"
    legend_constants[89] = "q61 in component IKr (dimensionless)"
    legend_constants[90] = "A62 in component IKr (per_millisecond)"
    legend_constants[91] = "B62 in component IKr (per_millivolt)"
    legend_constants[92] = "q62 in component IKr (dimensionless)"
    legend_constants[93] = "A63 in component IKr (per_millisecond)"
    legend_constants[94] = "B63 in component IKr (per_millivolt)"
    legend_constants[95] = "q63 in component IKr (dimensionless)"
    legend_constants[96] = "Kmax in component IKr (dimensionless)"
    legend_constants[97] = "Ku in component IKr (per_millisecond)"
    legend_constants[98] = "n in component IKr (dimensionless)"
    legend_constants[99] = "halfmax in component IKr (dimensionless)"
    legend_constants[100] = "Kt in component IKr (per_millisecond)"
    legend_constants[101] = "Vhalf in component IKr (millivolt)"
    legend_constants[102] = "Temp in component IKr (dimensionless)"
    legend_constants[103] = "GKs_b in component IKs (milliS_per_microF)"
    legend_constants[160] = "GKs in component IKs (milliS_per_microF)"
    legend_algebraic[10] = "xs1ss in component IKs (dimensionless)"
    legend_algebraic[24] = "xs2ss in component IKs (dimensionless)"
    legend_algebraic[25] = "txs1 in component IKs (millisecond)"
    legend_constants[104] = "txs1_max in component IKs (millisecond)"
    legend_states[44] = "xs1 in component IKs (dimensionless)"
    legend_states[45] = "xs2 in component IKs (dimensionless)"
    legend_algebraic[93] = "KsCa in component IKs (dimensionless)"
    legend_algebraic[35] = "txs2 in component IKs (millisecond)"
    legend_constants[161] = "GK1 in component IK1 (milliS_per_microF)"
    legend_constants[105] = "GK1_b in component IK1 (milliS_per_microF)"
    legend_algebraic[11] = "xk1ss in component IK1 (dimensionless)"
    legend_algebraic[26] = "txk1 in component IK1 (millisecond)"
    legend_states[46] = "xk1 in component IK1 (dimensionless)"
    legend_algebraic[97] = "rk1 in component IK1 (millisecond)"
    legend_constants[106] = "kna1 in component INaCa_i (per_millisecond)"
    legend_constants[107] = "kna2 in component INaCa_i (per_millisecond)"
    legend_constants[108] = "kna3 in component INaCa_i (per_millisecond)"
    legend_constants[109] = "kasymm in component INaCa_i (dimensionless)"
    legend_constants[110] = "wna in component INaCa_i (dimensionless)"
    legend_constants[111] = "wca in component INaCa_i (dimensionless)"
    legend_constants[112] = "wnaca in component INaCa_i (dimensionless)"
    legend_constants[113] = "kcaon in component INaCa_i (per_millisecond)"
    legend_constants[114] = "kcaoff in component INaCa_i (per_millisecond)"
    legend_constants[115] = "qna in component INaCa_i (dimensionless)"
    legend_constants[116] = "qca in component INaCa_i (dimensionless)"
    legend_algebraic[100] = "hna in component INaCa_i (dimensionless)"
    legend_algebraic[99] = "hca in component INaCa_i (dimensionless)"
    legend_constants[117] = "KmCaAct in component INaCa_i (millimolar)"
    legend_constants[118] = "Gncx_b in component INaCa_i (milliS_per_microF)"
    legend_constants[194] = "Gncx in component INaCa_i (milliS_per_microF)"
    legend_algebraic[101] = "h1_i in component INaCa_i (dimensionless)"
    legend_algebraic[102] = "h2_i in component INaCa_i (dimensionless)"
    legend_algebraic[103] = "h3_i in component INaCa_i (dimensionless)"
    legend_algebraic[104] = "h4_i in component INaCa_i (dimensionless)"
    legend_algebraic[105] = "h5_i in component INaCa_i (dimensionless)"
    legend_algebraic[106] = "h6_i in component INaCa_i (dimensionless)"
    legend_algebraic[107] = "h7_i in component INaCa_i (dimensionless)"
    legend_algebraic[108] = "h8_i in component INaCa_i (dimensionless)"
    legend_algebraic[109] = "h9_i in component INaCa_i (dimensionless)"
    legend_constants[188] = "h10_i in component INaCa_i (dimensionless)"
    legend_constants[189] = "h11_i in component INaCa_i (dimensionless)"
    legend_constants[190] = "h12_i in component INaCa_i (dimensionless)"
    legend_constants[191] = "k1_i in component INaCa_i (dimensionless)"
    legend_constants[192] = "k2_i in component INaCa_i (dimensionless)"
    legend_algebraic[110] = "k3p_i in component INaCa_i (dimensionless)"
    legend_algebraic[111] = "k3pp_i in component INaCa_i (dimensionless)"
    legend_algebraic[112] = "k3_i in component INaCa_i (dimensionless)"
    legend_algebraic[115] = "k4_i in component INaCa_i (dimensionless)"
    legend_algebraic[113] = "k4p_i in component INaCa_i (dimensionless)"
    legend_algebraic[114] = "k4pp_i in component INaCa_i (dimensionless)"
    legend_constants[193] = "k5_i in component INaCa_i (dimensionless)"
    legend_algebraic[116] = "k6_i in component INaCa_i (dimensionless)"
    legend_algebraic[117] = "k7_i in component INaCa_i (dimensionless)"
    legend_algebraic[118] = "k8_i in component INaCa_i (dimensionless)"
    legend_algebraic[119] = "x1_i in component INaCa_i (dimensionless)"
    legend_algebraic[120] = "x2_i in component INaCa_i (dimensionless)"
    legend_algebraic[121] = "x3_i in component INaCa_i (dimensionless)"
    legend_algebraic[122] = "x4_i in component INaCa_i (dimensionless)"
    legend_algebraic[123] = "E1_i in component INaCa_i (dimensionless)"
    legend_algebraic[124] = "E2_i in component INaCa_i (dimensionless)"
    legend_algebraic[125] = "E3_i in component INaCa_i (dimensionless)"
    legend_algebraic[126] = "E4_i in component INaCa_i (dimensionless)"
    legend_algebraic[127] = "allo_i in component INaCa_i (dimensionless)"
    legend_algebraic[128] = "JncxNa_i in component INaCa_i (millimolar_per_millisecond)"
    legend_algebraic[129] = "JncxCa_i in component INaCa_i (millimolar_per_millisecond)"
    legend_algebraic[131] = "h1_ss in component INaCa_i (dimensionless)"
    legend_algebraic[132] = "h2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[133] = "h3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[134] = "h4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[135] = "h5_ss in component INaCa_i (dimensionless)"
    legend_algebraic[136] = "h6_ss in component INaCa_i (dimensionless)"
    legend_algebraic[137] = "h7_ss in component INaCa_i (dimensionless)"
    legend_algebraic[138] = "h8_ss in component INaCa_i (dimensionless)"
    legend_algebraic[139] = "h9_ss in component INaCa_i (dimensionless)"
    legend_constants[195] = "h10_ss in component INaCa_i (dimensionless)"
    legend_constants[196] = "h11_ss in component INaCa_i (dimensionless)"
    legend_constants[197] = "h12_ss in component INaCa_i (dimensionless)"
    legend_constants[198] = "k1_ss in component INaCa_i (dimensionless)"
    legend_constants[199] = "k2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[140] = "k3p_ss in component INaCa_i (dimensionless)"
    legend_algebraic[141] = "k3pp_ss in component INaCa_i (dimensionless)"
    legend_algebraic[142] = "k3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[145] = "k4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[143] = "k4p_ss in component INaCa_i (dimensionless)"
    legend_algebraic[144] = "k4pp_ss in component INaCa_i (dimensionless)"
    legend_constants[200] = "k5_ss in component INaCa_i (dimensionless)"
    legend_algebraic[146] = "k6_ss in component INaCa_i (dimensionless)"
    legend_algebraic[147] = "k7_ss in component INaCa_i (dimensionless)"
    legend_algebraic[148] = "k8_ss in component INaCa_i (dimensionless)"
    legend_algebraic[149] = "x1_ss in component INaCa_i (dimensionless)"
    legend_algebraic[150] = "x2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[151] = "x3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[152] = "x4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[153] = "E1_ss in component INaCa_i (dimensionless)"
    legend_algebraic[154] = "E2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[155] = "E3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[156] = "E4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[157] = "allo_ss in component INaCa_i (dimensionless)"
    legend_algebraic[158] = "JncxNa_ss in component INaCa_i (millimolar_per_millisecond)"
    legend_algebraic[159] = "JncxCa_ss in component INaCa_i (millimolar_per_millisecond)"
    legend_constants[119] = "k1p in component INaK (per_millisecond)"
    legend_constants[120] = "k1m in component INaK (per_millisecond)"
    legend_constants[121] = "k2p in component INaK (per_millisecond)"
    legend_constants[122] = "k2m in component INaK (per_millisecond)"
    legend_constants[123] = "k3p in component INaK (per_millisecond)"
    legend_constants[124] = "k3m in component INaK (per_millisecond)"
    legend_constants[125] = "k4p in component INaK (per_millisecond)"
    legend_constants[126] = "k4m in component INaK (per_millisecond)"
    legend_constants[127] = "Knai0 in component INaK (millimolar)"
    legend_constants[128] = "Knao0 in component INaK (millimolar)"
    legend_constants[129] = "delta in component INaK (millivolt)"
    legend_constants[130] = "Kki in component INaK (per_millisecond)"
    legend_constants[131] = "Kko in component INaK (per_millisecond)"
    legend_constants[132] = "MgADP in component INaK (millimolar)"
    legend_constants[133] = "MgATP in component INaK (millimolar)"
    legend_constants[134] = "Kmgatp in component INaK (millimolar)"
    legend_constants[135] = "H in component INaK (millimolar)"
    legend_constants[136] = "eP in component INaK (dimensionless)"
    legend_constants[137] = "Khp in component INaK (millimolar)"
    legend_constants[138] = "Knap in component INaK (millimolar)"
    legend_constants[139] = "Kxkur in component INaK (millimolar)"
    legend_constants[140] = "Pnak_b in component INaK (milliS_per_microF)"
    legend_constants[204] = "Pnak in component INaK (milliS_per_microF)"
    legend_algebraic[161] = "Knai in component INaK (millimolar)"
    legend_algebraic[162] = "Knao in component INaK (millimolar)"
    legend_algebraic[163] = "P in component INaK (dimensionless)"
    legend_algebraic[164] = "a1 in component INaK (dimensionless)"
    legend_constants[201] = "b1 in component INaK (dimensionless)"
    legend_constants[202] = "a2 in component INaK (dimensionless)"
    legend_algebraic[165] = "b2 in component INaK (dimensionless)"
    legend_algebraic[166] = "a3 in component INaK (dimensionless)"
    legend_algebraic[167] = "b3 in component INaK (dimensionless)"
    legend_constants[203] = "a4 in component INaK (dimensionless)"
    legend_algebraic[168] = "b4 in component INaK (dimensionless)"
    legend_algebraic[169] = "x1 in component INaK (dimensionless)"
    legend_algebraic[170] = "x2 in component INaK (dimensionless)"
    legend_algebraic[171] = "x3 in component INaK (dimensionless)"
    legend_algebraic[172] = "x4 in component INaK (dimensionless)"
    legend_algebraic[173] = "E1 in component INaK (dimensionless)"
    legend_algebraic[174] = "E2 in component INaK (dimensionless)"
    legend_algebraic[175] = "E3 in component INaK (dimensionless)"
    legend_algebraic[176] = "E4 in component INaK (dimensionless)"
    legend_algebraic[177] = "JnakNa in component INaK (millimolar_per_millisecond)"
    legend_algebraic[178] = "JnakK in component INaK (millimolar_per_millisecond)"
    legend_algebraic[180] = "xkb in component IKb (dimensionless)"
    legend_constants[141] = "GKb_b in component IKb (milliS_per_microF)"
    legend_constants[163] = "GKb in component IKb (milliS_per_microF)"
    legend_constants[142] = "PNab in component INab (milliS_per_microF)"
    legend_algebraic[182] = "A in component INab (microA_per_microF)"
    legend_constants[178] = "B in component INab (per_millivolt)"
    legend_constants[164] = "v0 in component INab (millivolt)"
    legend_algebraic[184] = "U in component INab (dimensionless)"
    legend_constants[143] = "PCab in component ICab (milliS_per_microF)"
    legend_algebraic[186] = "A in component ICab (microA_per_microF)"
    legend_constants[179] = "B in component ICab (per_millivolt)"
    legend_constants[165] = "v0 in component ICab (millivolt)"
    legend_algebraic[188] = "U in component ICab (dimensionless)"
    legend_constants[144] = "GpCa in component IpCa (milliS_per_microF)"
    legend_constants[145] = "KmCap in component IpCa (millimolar)"
    legend_constants[146] = "bt in component ryr (millisecond)"
    legend_constants[166] = "a_rel in component ryr (millisecond)"
    legend_algebraic[88] = "Jrel_inf in component ryr (dimensionless)"
    legend_algebraic[94] = "tau_rel in component ryr (millisecond)"
    legend_algebraic[89] = "Jrel_infp in component ryr (dimensionless)"
    legend_algebraic[86] = "Jrel_temp in component ryr (dimensionless)"
    legend_algebraic[95] = "tau_relp in component ryr (millisecond)"
    legend_states[47] = "Jrelnp in component ryr (dimensionless)"
    legend_states[48] = "Jrelp in component ryr (dimensionless)"
    legend_constants[167] = "btp in component ryr (millisecond)"
    legend_constants[180] = "a_relp in component ryr (millisecond)"
    legend_algebraic[85] = "Jrel_inf_temp in component ryr (dimensionless)"
    legend_algebraic[192] = "fJrelp in component ryr (dimensionless)"
    legend_constants[147] = "Jrel_scaling_factor in component ryr (dimensionless)"
    legend_algebraic[91] = "tau_rel_temp in component ryr (millisecond)"
    legend_algebraic[92] = "tau_relp_temp in component ryr (millisecond)"
    legend_constants[168] = "upScale in component SERCA (dimensionless)"
    legend_algebraic[194] = "Jupnp in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[195] = "Jupp in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[196] = "fJupp in component SERCA (dimensionless)"
    legend_algebraic[197] = "Jleak in component SERCA (millimolar_per_millisecond)"
    legend_constants[148] = "Jup_b in component SERCA (dimensionless)"
    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 nass in component intracellular_ions (millimolar)"
    legend_rates[5] = "d/dt ki in component intracellular_ions (millimolar)"
    legend_rates[6] = "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[7] = "d/dt cansr in component intracellular_ions (millimolar)"
    legend_rates[8] = "d/dt cajsr in component intracellular_ions (millimolar)"
    legend_rates[10] = "d/dt m in component INa (dimensionless)"
    legend_rates[11] = "d/dt hf in component INa (dimensionless)"
    legend_rates[12] = "d/dt hs in component INa (dimensionless)"
    legend_rates[13] = "d/dt j in component INa (dimensionless)"
    legend_rates[14] = "d/dt hsp in component INa (dimensionless)"
    legend_rates[15] = "d/dt jp in component INa (dimensionless)"
    legend_rates[16] = "d/dt mL in component INaL (dimensionless)"
    legend_rates[17] = "d/dt hL in component INaL (dimensionless)"
    legend_rates[18] = "d/dt hLp in component INaL (dimensionless)"
    legend_rates[19] = "d/dt a in component Ito (dimensionless)"
    legend_rates[20] = "d/dt iF in component Ito (dimensionless)"
    legend_rates[21] = "d/dt iS in component Ito (dimensionless)"
    legend_rates[22] = "d/dt ap in component Ito (dimensionless)"
    legend_rates[23] = "d/dt iFp in component Ito (dimensionless)"
    legend_rates[24] = "d/dt iSp in component Ito (dimensionless)"
    legend_rates[25] = "d/dt d in component ICaL (dimensionless)"
    legend_rates[26] = "d/dt ff in component ICaL (dimensionless)"
    legend_rates[27] = "d/dt fs in component ICaL (dimensionless)"
    legend_rates[28] = "d/dt fcaf in component ICaL (dimensionless)"
    legend_rates[29] = "d/dt fcas in component ICaL (dimensionless)"
    legend_rates[30] = "d/dt jca in component ICaL (dimensionless)"
    legend_rates[31] = "d/dt ffp in component ICaL (dimensionless)"
    legend_rates[32] = "d/dt fcafp in component ICaL (dimensionless)"
    legend_rates[33] = "d/dt nca in component ICaL (dimensionless)"
    legend_rates[34] = "d/dt IC1 in component IKr (dimensionless)"
    legend_rates[35] = "d/dt IC2 in component IKr (dimensionless)"
    legend_rates[36] = "d/dt C1 in component IKr (dimensionless)"
    legend_rates[37] = "d/dt C2 in component IKr (dimensionless)"
    legend_rates[38] = "d/dt O in component IKr (dimensionless)"
    legend_rates[39] = "d/dt IO in component IKr (dimensionless)"
    legend_rates[40] = "d/dt IObound in component IKr (dimensionless)"
    legend_rates[41] = "d/dt Obound in component IKr (dimensionless)"
    legend_rates[42] = "d/dt Cbound in component IKr (dimensionless)"
    legend_rates[43] = "d/dt D in component IKr (dimensionless)"
    legend_rates[44] = "d/dt xs1 in component IKs (dimensionless)"
    legend_rates[45] = "d/dt xs2 in component IKs (dimensionless)"
    legend_rates[46] = "d/dt xk1 in component IK1 (dimensionless)"
    legend_rates[47] = "d/dt Jrelnp in component ryr (dimensionless)"
    legend_rates[48] = "d/dt Jrelp in component ryr (dimensionless)"
    return (legend_states, legend_algebraic, legend_voi, legend_constants)

def initConsts():
    constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
    constants[0] = 0
    constants[1] = 140
    constants[2] = 1.8
    constants[3] = 5.4
    constants[4] = 8314
    constants[5] = 310
    constants[6] = 96485
    constants[7] = 1
    constants[8] = 2
    constants[9] = 1
    constants[10] = 0.01
    constants[11] = 0.0011
    states[0] = -88.00190465
    constants[12] = 10
    constants[13] = 100000000000000000
    constants[14] = -80
    constants[15] = 1000
    constants[16] = 0.5
    constants[17] = 0.15
    constants[18] = 0.05
    constants[19] = 0.00068
    constants[20] = 0.05
    constants[21] = 0.0015
    states[1] = 0.0125840447
    states[2] = 8.49e-05
    constants[22] = 0.05
    constants[23] = 0.00238
    constants[24] = 0.07
    constants[25] = 0.0005
    constants[26] = 0.047
    constants[27] = 0.00087
    constants[28] = 1.124
    constants[29] = 0.0087
    constants[30] = 10
    constants[31] = 0.8
    states[3] = 7.268004498
    states[4] = 7.268089977
    states[5] = 144.6555918
    states[6] = 144.6555651
    states[7] = 1.619574538
    states[8] = 1.571234014
    states[9] = 8.6e-05
    constants[32] = 1
    constants[33] = 0.01833
    constants[34] = 39.57
    constants[35] = 9.871
    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[10] = 0.007344121102
    constants[42] = 82.9
    constants[43] = 6.086
    constants[44] = 0.99
    states[11] = 0.6981071913
    states[12] = 0.6980895801
    constants[45] = 75
    constants[46] = 0
    states[13] = 0.6979908432
    states[14] = 0.4549485525
    states[15] = 0.6979245865
    states[16] = 0.0001882617273
    constants[47] = 200
    states[17] = 0.5008548855
    states[18] = 0.2693065357
    constants[48] = 0.019957499999999975
    constants[49] = 0.02
    states[19] = 0.001001097687
    states[20] = 0.9995541745
    states[21] = 0.5865061736
    states[22] = 0.0005100862934
    states[23] = 0.9995541823
    states[24] = 0.6393399482
    constants[50] = 0.002
    constants[51] = 1000
    constants[52] = 0.0001007
    states[25] = 2.34e-9
    states[26] = 0.9999999909
    states[27] = 0.9102412777
    states[28] = 0.9999999909
    states[29] = 0.9998046777
    states[30] = 0.9999738312
    states[31] = 0.9999999909
    states[32] = 0.9999999909
    states[33] = 0.002749414044
    constants[53] = 0.04658545454545456
    states[34] = 0.999637
    states[35] = 6.83208e-05
    states[36] = 1.80145e-08
    states[37] = 8.26619e-05
    states[38] = 0.00015551
    states[39] = 5.67623e-05
    states[40] = 0
    states[41] = 0
    states[42] = 0
    states[43] = 0
    constants[54] = 0.0264
    constants[55] = 4.631E-05
    constants[56] = 4.843
    constants[57] = 4.986E-06
    constants[58] = -0.004226
    constants[59] = 4.23
    constants[60] = 0.001214
    constants[61] = 0.008516
    constants[62] = 4.962
    constants[63] = 1.854E-05
    constants[64] = -0.04641
    constants[65] = 3.769
    constants[66] = 0.0007868
    constants[67] = 1.535E-08
    constants[68] = 4.942
    constants[69] = 5.455E-06
    constants[70] = -0.1688
    constants[71] = 4.156
    constants[72] = 0.005509
    constants[73] = 7.771E-09
    constants[74] = 4.22
    constants[75] = 0.001416
    constants[76] = -0.02877
    constants[77] = 1.459
    constants[78] = 0.4492
    constants[79] = 0.008595
    constants[80] = 5
    constants[81] = 0.3181
    constants[82] = 3.613E-08
    constants[83] = 4.663
    constants[84] = 0.149
    constants[85] = 0.004668
    constants[86] = 2.412
    constants[87] = 0.01241
    constants[88] = 0.1725
    constants[89] = 5.568
    constants[90] = 0.3226
    constants[91] = -0.0006575
    constants[92] = 5
    constants[93] = 0.008978
    constants[94] = -0.02215
    constants[95] = 5.682
    constants[96] = 0
    constants[97] = 0
    constants[98] = 1
    constants[99] = 1
    constants[100] = 0
    constants[101] = 1
    constants[102] = 37
    constants[103] = 0.006358000000000001
    constants[104] = 817.3
    states[44] = 0.2707758025
    states[45] = 0.0001928503426
    constants[105] = 0.3239783999999998
    states[46] = 0.9967597594
    constants[106] = 15
    constants[107] = 5
    constants[108] = 88.12
    constants[109] = 12.5
    constants[110] = 6e4
    constants[111] = 6e4
    constants[112] = 5e3
    constants[113] = 1.5e6
    constants[114] = 5e3
    constants[115] = 0.5224
    constants[116] = 0.167
    constants[117] = 150e-6
    constants[118] = 0.0008
    constants[119] = 949.5
    constants[120] = 182.4
    constants[121] = 687.2
    constants[122] = 39.4
    constants[123] = 1899
    constants[124] = 79300
    constants[125] = 639
    constants[126] = 40
    constants[127] = 9.073
    constants[128] = 27.78
    constants[129] = -0.155
    constants[130] = 0.5
    constants[131] = 0.3582
    constants[132] = 0.05
    constants[133] = 9.8
    constants[134] = 1.698e-7
    constants[135] = 1e-7
    constants[136] = 4.2
    constants[137] = 1.698e-7
    constants[138] = 224
    constants[139] = 292
    constants[140] = 30
    constants[141] = 0.003
    constants[142] = 3.75e-10
    constants[143] = 2.5e-8
    constants[144] = 0.0005
    constants[145] = 0.0005
    constants[146] = 4.75
    states[47] = 2.5e-7
    states[48] = 3.12e-7
    constants[147] = 1.0
    constants[148] = 1.0
    constants[149] = constants[6]/(constants[4]*constants[5])
    constants[150] = custom_piecewise([equal(constants[0] , 1.00000), constants[22]*1.30000 , True, constants[22]])
    constants[151] = 1.00000-constants[44]
    constants[152] = 3.00000*constants[47]
    constants[153] = custom_piecewise([equal(constants[0] , 1.00000), constants[48]*0.600000 , True, constants[48]])
    constants[154] = custom_piecewise([equal(constants[0] , 1.00000), constants[49]*4.00000 , equal(constants[0] , 2.00000), constants[49]*4.00000 , True, constants[49]])
    constants[155] = 0.600000
    constants[156] = custom_piecewise([equal(constants[0] , 1.00000), constants[52]*1.20000 , equal(constants[0] , 2.00000), constants[52]*2.50000 , True, constants[52]])
    constants[157] = 75.0000
    constants[158] = 0.00000
    constants[159] = custom_piecewise([equal(constants[0] , 1.00000), constants[53]*1.30000 , equal(constants[0] , 2.00000), constants[53]*0.800000 , True, constants[53]])
    constants[160] = custom_piecewise([equal(constants[0] , 1.00000), constants[103]*1.40000 , True, constants[103]])
    constants[161] = custom_piecewise([equal(constants[0] , 1.00000), constants[105]*1.20000 , equal(constants[0] , 2.00000), constants[105]*1.30000 , True, constants[105]])
    constants[162] = 1000.00*3.14000*constants[11]*constants[11]*constants[10]
    constants[163] = custom_piecewise([equal(constants[0] , 1.00000), constants[141]*0.600000 , True, constants[141]])
    constants[164] = 0.00000
    constants[165] = 0.00000
    constants[166] = 0.500000*constants[146]
    constants[167] = 1.25000*constants[146]
    constants[168] = custom_piecewise([equal(constants[0] , 1.00000), 1.30000 , True, 1.00000])
    constants[205] = 0.00000
    constants[169] = constants[6]*constants[149]
    constants[170] = 1.00000-constants[155]
    constants[171] = 1.10000*constants[156]
    constants[172] = 0.00125000*constants[156]
    constants[173] = 0.000357400*constants[156]
    constants[174] = 2.00000*constants[149]
    constants[175] = constants[149]
    constants[176] = constants[149]
    constants[177] = 2.00000*3.14000*constants[11]*constants[11]+2.00000*3.14000*constants[11]*constants[10]
    constants[178] = constants[149]
    constants[179] = 2.00000*constants[149]
    constants[180] = 0.500000*constants[167]
    constants[181] = 0.00125000*constants[171]
    constants[182] = 0.000357400*constants[171]
    constants[183] = 2.00000*constants[177]
    constants[184] = 0.680000*constants[162]
    constants[185] = 0.0552000*constants[162]
    constants[186] = 0.00480000*constants[162]
    constants[187] = 0.0200000*constants[162]
    constants[188] = constants[109]+1.00000+(constants[1]/constants[106])*(1.00000+constants[1]/constants[107])
    constants[189] = (constants[1]*constants[1])/(constants[188]*constants[106]*constants[107])
    constants[190] = 1.00000/constants[188]
    constants[191] = constants[190]*constants[2]*constants[113]
    constants[192] = constants[114]
    constants[193] = constants[114]
    constants[194] = custom_piecewise([equal(constants[0] , 1.00000), constants[118]*1.10000 , equal(constants[0] , 2.00000), constants[118]*1.40000 , True, constants[118]])
    constants[195] = constants[109]+1.00000+(constants[1]/constants[106])*(1.00000+constants[1]/constants[107])
    constants[196] = (constants[1]*constants[1])/(constants[195]*constants[106]*constants[107])
    constants[197] = 1.00000/constants[195]
    constants[198] = constants[197]*constants[2]*constants[113]
    constants[199] = constants[114]
    constants[200] = constants[114]
    constants[201] = constants[120]*constants[132]
    constants[202] = constants[121]
    constants[203] = ((constants[125]*constants[133])/constants[134])/(1.00000+constants[133]/constants[134])
    constants[204] = custom_piecewise([equal(constants[0] , 1.00000), constants[140]*0.900000 , equal(constants[0] , 2.00000), constants[140]*0.700000 , True, constants[140]])
    return (states, constants)

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    rates[43] = constants[205]
    rates[34] = (-(constants[66]*exp(constants[67]*states[0])*states[34]*exp(((constants[102]-20.0000)*log(constants[68]))/10.0000)-constants[69]*exp(constants[70]*states[0])*states[35]*exp(((constants[102]-20.0000)*log(constants[71]))/10.0000))+constants[78]*exp(constants[79]*states[0])*states[36]*exp(((constants[102]-20.0000)*log(constants[80]))/10.0000))-constants[87]*exp(constants[88]*states[0])*states[34]*exp(((constants[102]-20.0000)*log(constants[89]))/10.0000)
    rates[35] = (((constants[66]*exp(constants[67]*states[0])*states[34]*exp(((constants[102]-20.0000)*log(constants[68]))/10.0000)-constants[69]*exp(constants[70]*states[0])*states[35]*exp(((constants[102]-20.0000)*log(constants[71]))/10.0000))-(constants[60]*exp(constants[61]*states[0])*states[35]*exp(((constants[102]-20.0000)*log(constants[62]))/10.0000)-constants[63]*exp(constants[64]*states[0])*states[39]*exp(((constants[102]-20.0000)*log(constants[65]))/10.0000)))+constants[81]*exp(constants[82]*states[0])*states[37]*exp(((constants[102]-20.0000)*log(constants[83]))/10.0000))-constants[90]*exp(constants[91]*states[0])*states[35]*exp(((constants[102]-20.0000)*log(constants[92]))/10.0000)
    rates[36] = -(constants[54]*exp(constants[55]*states[0])*states[36]*exp(((constants[102]-20.0000)*log(constants[56]))/10.0000)-constants[57]*exp(constants[58]*states[0])*states[37]*exp(((constants[102]-20.0000)*log(constants[59]))/10.0000))-(constants[78]*exp(constants[79]*states[0])*states[36]*exp(((constants[102]-20.0000)*log(constants[80]))/10.0000)-constants[87]*exp(constants[88]*states[0])*states[34]*exp(((constants[102]-20.0000)*log(constants[89]))/10.0000))
    rates[37] = ((constants[54]*exp(constants[55]*states[0])*states[36]*exp(((constants[102]-20.0000)*log(constants[56]))/10.0000)-constants[57]*exp(constants[58]*states[0])*states[37]*exp(((constants[102]-20.0000)*log(constants[59]))/10.0000))-(constants[72]*exp(constants[73]*states[0])*states[37]*exp(((constants[102]-20.0000)*log(constants[74]))/10.0000)-constants[75]*exp(constants[76]*states[0])*states[38]*exp(((constants[102]-20.0000)*log(constants[77]))/10.0000)))-(constants[81]*exp(constants[82]*states[0])*states[37]*exp(((constants[102]-20.0000)*log(constants[83]))/10.0000)-constants[90]*exp(constants[91]*states[0])*states[35]*exp(((constants[102]-20.0000)*log(constants[92]))/10.0000))
    rates[38] = ((constants[72]*exp(constants[73]*states[0])*states[37]*exp(((constants[102]-20.0000)*log(constants[74]))/10.0000)-constants[75]*exp(constants[76]*states[0])*states[38]*exp(((constants[102]-20.0000)*log(constants[77]))/10.0000))-(constants[84]*exp(constants[85]*states[0])*states[38]*exp(((constants[102]-20.0000)*log(constants[86]))/10.0000)-constants[93]*exp(constants[94]*states[0])*states[39]*exp(((constants[102]-20.0000)*log(constants[95]))/10.0000)))-(((constants[96]*constants[97]*exp(constants[98]*log(states[43])))/(exp(constants[98]*log(states[43]))+constants[99]))*states[38]-constants[97]*states[41])
    rates[39] = (((constants[60]*exp(constants[61]*states[0])*states[35]*exp(((constants[102]-20.0000)*log(constants[62]))/10.0000)-constants[63]*exp(constants[64]*states[0])*states[39]*exp(((constants[102]-20.0000)*log(constants[65]))/10.0000))+constants[84]*exp(constants[85]*states[0])*states[38]*exp(((constants[102]-20.0000)*log(constants[86]))/10.0000))-constants[93]*exp(constants[94]*states[0])*states[39]*exp(((constants[102]-20.0000)*log(constants[95]))/10.0000))-(((constants[96]*constants[97]*exp(constants[98]*log(states[43])))/(exp(constants[98]*log(states[43]))+constants[99]))*states[39]-((constants[97]*constants[84]*exp(constants[85]*states[0])*exp(((constants[102]-20.0000)*log(constants[86]))/10.0000))/(constants[93]*exp(constants[94]*states[0])*exp(((constants[102]-20.0000)*log(constants[95]))/10.0000)))*states[40])
    rates[40] = ((((constants[96]*constants[97]*exp(constants[98]*log(states[43])))/(exp(constants[98]*log(states[43]))+constants[99]))*states[39]-((constants[97]*constants[84]*exp(constants[85]*states[0])*exp(((constants[102]-20.0000)*log(constants[86]))/10.0000))/(constants[93]*exp(constants[94]*states[0])*exp(((constants[102]-20.0000)*log(constants[95]))/10.0000)))*states[40])+(constants[100]/(1.00000+exp(-(states[0]-constants[101])/6.78900)))*states[42])-constants[100]*states[40]
    rates[41] = ((((constants[96]*constants[97]*exp(constants[98]*log(states[43])))/(exp(constants[98]*log(states[43]))+constants[99]))*states[38]-constants[97]*states[41])+(constants[100]/(1.00000+exp(-(states[0]-constants[101])/6.78900)))*states[42])-constants[100]*states[41]
    rates[42] = -((constants[100]/(1.00000+exp(-(states[0]-constants[101])/6.78900)))*states[42]-constants[100]*states[41])-((constants[100]/(1.00000+exp(-(states[0]-constants[101])/6.78900)))*states[42]-constants[100]*states[40])
    algebraic[3] = 1.00000/(1.00000+exp((states[0]+87.6100)/7.48800))
    rates[17] = (algebraic[3]-states[17])/constants[47]
    algebraic[4] = 1.00000/(1.00000+exp((states[0]+93.8100)/7.48800))
    rates[18] = (algebraic[4]-states[18])/constants[152]
    algebraic[1] = 1.00000/(1.00000+exp(-(states[0]+constants[34])/constants[35]))
    algebraic[13] = 1.00000/(constants[38]*exp((states[0]+constants[36])/constants[37])+constants[39]*exp(-(states[0]+constants[40])/constants[41]))
    rates[10] = (algebraic[1]-states[10])/algebraic[13]
    algebraic[2] = 1.00000/(1.00000+exp(((states[0]+constants[42])-constants[46])/constants[43]))
    algebraic[14] = 1.00000/(1.43200e-05*exp(-((states[0]+1.19600)-constants[46])/6.28500)+6.14900*exp(((states[0]+0.509600)-constants[46])/20.2700))
    rates[11] = (algebraic[2]-states[11])/algebraic[14]
    algebraic[15] = 1.00000/(0.00979400*exp(-((states[0]+17.9500)-constants[46])/28.0500)+0.334300*exp(((states[0]+5.73000)-constants[46])/56.6600))
    rates[12] = (algebraic[2]-states[12])/algebraic[15]
    algebraic[5] = 1.00000/(1.00000+exp(-(states[0]-14.3400)/14.8200))
    algebraic[17] = 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[19] = (algebraic[5]-states[19])/algebraic[17]
    algebraic[7] = 1.00000/(1.00000+exp(-(states[0]+3.94000)/4.23000))
    algebraic[21] = 0.600000+1.00000/(exp(-0.0500000*(states[0]+6.00000))+exp(0.0900000*(states[0]+14.0000)))
    rates[25] = (algebraic[7]-states[25])/algebraic[21]
    algebraic[8] = 1.00000/(1.00000+exp((states[0]+19.5800)/3.69600))
    algebraic[22] = 7.00000+1.00000/(0.00450000*exp(-(states[0]+20.0000)/10.0000)+0.00450000*exp((states[0]+20.0000)/10.0000))
    rates[26] = (algebraic[8]-states[26])/algebraic[22]
    algebraic[23] = 1000.00+1.00000/(3.50000e-05*exp(-(states[0]+5.00000)/4.00000)+3.50000e-05*exp((states[0]+5.00000)/6.00000))
    rates[27] = (algebraic[8]-states[27])/algebraic[23]
    algebraic[19] = algebraic[8]
    rates[30] = (algebraic[19]-states[30])/constants[157]
    algebraic[9] = states[30]*1.00000
    algebraic[20] = 1.00000/(constants[51]/algebraic[9]+power(1.00000+constants[50]/states[2], 4.00000))
    rates[33] = algebraic[20]*constants[51]-states[33]*algebraic[9]
    algebraic[10] = 1.00000/(1.00000+exp(-(states[0]+11.6000)/8.93200))
    algebraic[25] = constants[104]+1.00000/(0.000232600*exp((states[0]+48.2800)/17.8000)+0.00129200*exp(-(states[0]+210.000)/230.000))
    rates[44] = (algebraic[10]-states[44])/algebraic[25]
    algebraic[11] = 1.00000/(1.00000+exp(-(states[0]+2.55380*constants[3]+144.590)/(1.56920*constants[3]+3.81150)))
    algebraic[26] = 122.200/(exp(-(states[0]+127.200)/20.3600)+exp((states[0]+236.800)/69.3300))
    rates[46] = (algebraic[11]-states[46])/algebraic[26]
    algebraic[36] = (constants[20]*(1.00000-states[1]))/(1.00000+constants[21]/states[2])
    rates[1] = constants[18]*algebraic[36]*(algebraic[36]+states[1])-constants[19]*states[1]
    algebraic[16] = algebraic[2]
    algebraic[27] = 2.03800+1.00000/(0.0213600*exp(-((states[0]+100.600)-constants[46])/8.28100)+0.305200*exp(((states[0]+0.994100)-constants[46])/38.4500))
    rates[13] = (algebraic[16]-states[13])/algebraic[27]
    algebraic[31] = 1.00000/(1.00000+exp(-(states[0]-24.3400)/14.8200))
    rates[22] = (algebraic[31]-states[22])/algebraic[17]
    algebraic[32] = 7.00000+1.00000/(0.0400000*exp(-(states[0]-4.00000)/7.00000)+0.0400000*exp((states[0]-4.00000)/7.00000))
    rates[28] = (algebraic[19]-states[28])/algebraic[32]
    algebraic[33] = 100.000+1.00000/(0.000120000*exp(-states[0]/3.00000)+0.000120000*exp(states[0]/7.00000))
    rates[29] = (algebraic[19]-states[29])/algebraic[33]
    algebraic[34] = 2.50000*algebraic[22]
    rates[31] = (algebraic[8]-states[31])/algebraic[34]
    algebraic[24] = algebraic[10]
    algebraic[35] = 1.00000/(0.0100000*exp((states[0]-50.0000)/20.0000)+0.0193000*exp(-(states[0]+66.5400)/31.0000))
    rates[45] = (algebraic[24]-states[45])/algebraic[35]
    algebraic[28] = 1.00000/(1.00000+exp(((states[0]+89.1000)-constants[46])/6.08600))
    algebraic[37] = 3.00000*algebraic[15]
    rates[14] = (algebraic[28]-states[14])/algebraic[37]
    algebraic[38] = 1.46000*algebraic[27]
    rates[15] = (algebraic[16]-states[15])/algebraic[38]
    algebraic[29] = 1.00000/(1.00000+exp(-(states[0]+42.8500)/5.26400))
    algebraic[39] = algebraic[13]
    rates[16] = (algebraic[29]-states[16])/algebraic[39]
    algebraic[41] = 2.50000*algebraic[32]
    rates[32] = (algebraic[19]-states[32])/algebraic[41]
    algebraic[6] = 1.00000/(1.00000+exp((states[0]+43.9400)/5.71100))
    algebraic[18] = custom_piecewise([equal(constants[0] , 1.00000), 1.00000-0.950000/(1.00000+exp((states[0]+70.0000)/5.00000)) , True, 1.00000])
    algebraic[30] = 4.56200+1.00000/(0.393300*exp(-(states[0]+100.000)/100.000)+0.0800400*exp((states[0]+50.0000)/16.5900))
    algebraic[43] = algebraic[30]*algebraic[18]
    rates[20] = (algebraic[6]-states[20])/algebraic[43]
    algebraic[40] = 23.6200+1.00000/(0.00141600*exp(-(states[0]+96.5200)/59.0500)+1.78000e-08*exp((states[0]+114.100)/8.07900))
    algebraic[45] = algebraic[40]*algebraic[18]
    rates[21] = (algebraic[6]-states[21])/algebraic[45]
    algebraic[47] = 1.35400+0.000100000/(exp((states[0]-167.400)/15.8900)+exp(-(states[0]-12.2300)/0.215400))
    algebraic[49] = 1.00000-0.500000/(1.00000+exp((states[0]+70.0000)/20.0000))
    algebraic[51] = algebraic[47]*algebraic[49]*algebraic[43]
    rates[23] = (algebraic[6]-states[23])/algebraic[51]
    algebraic[52] = algebraic[47]*algebraic[49]*algebraic[45]
    rates[24] = (algebraic[6]-states[24])/algebraic[52]
    algebraic[67] = constants[155]*states[26]+constants[170]*states[27]
    algebraic[68] = 0.300000+0.600000/(1.00000+exp((states[0]-10.0000)/10.0000))
    algebraic[69] = 1.00000-algebraic[68]
    algebraic[70] = algebraic[68]*states[28]+algebraic[69]*states[29]
    algebraic[71] = constants[155]*states[31]+constants[170]*states[27]
    algebraic[72] = algebraic[68]*states[32]+algebraic[69]*states[29]
    algebraic[12] = states[0]*constants[149]
    algebraic[73] = (4.00000*constants[169]*(states[2]*exp(2.00000*algebraic[12])-0.341000*constants[2]))/constants[174]
    algebraic[74] = constants[174]*(states[0]-constants[158])
    algebraic[75] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[74]) & less_equal(algebraic[74] , 1.00000e-07), algebraic[73]*(1.00000-0.500000*algebraic[74]) , True, (algebraic[73]*algebraic[74])/(exp(algebraic[74])-1.00000)])
    algebraic[42] = algebraic[36]+states[1]
    algebraic[82] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[83] = (1.00000-algebraic[82])*constants[156]*algebraic[75]*states[25]*(algebraic[67]*(1.00000-states[33])+states[30]*algebraic[70]*states[33])+algebraic[82]*constants[171]*algebraic[75]*states[25]*(algebraic[71]*(1.00000-states[33])+states[30]*algebraic[72]*states[33])
    algebraic[85] = (constants[166]*-algebraic[83])/(1.00000+1.00000*(power(1.50000/states[8], 8.00000)))
    algebraic[88] = custom_piecewise([equal(constants[0] , 2.00000), algebraic[85]*1.70000 , True, algebraic[85]])
    algebraic[91] = constants[146]/(1.00000+0.0123000/states[8])
    algebraic[94] = custom_piecewise([less(algebraic[91] , 0.00100000), 0.00100000 , True, algebraic[91]])
    rates[47] = (algebraic[88]-states[47])/algebraic[94]
    algebraic[86] = (constants[180]*-algebraic[83])/(1.00000+power(1.50000/states[8], 8.00000))
    algebraic[89] = custom_piecewise([equal(constants[0] , 2.00000), algebraic[86]*1.70000 , True, algebraic[86]])
    algebraic[92] = constants[167]/(1.00000+0.0123000/states[8])
    algebraic[95] = custom_piecewise([less(algebraic[92] , 0.00100000), 0.00100000 , True, algebraic[92]])
    rates[48] = (algebraic[89]-states[48])/algebraic[95]
    algebraic[53] = ((constants[4]*constants[5])/constants[6])*log(constants[3]/states[5])
    algebraic[61] = 1.00000/(1.00000+exp((states[0]-213.600)/151.200))
    algebraic[62] = 1.00000-algebraic[61]
    algebraic[63] = algebraic[61]*states[20]+algebraic[62]*states[21]
    algebraic[64] = algebraic[61]*states[23]+algebraic[62]*states[24]
    algebraic[65] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[66] = constants[154]*(states[0]-algebraic[53])*((1.00000-algebraic[65])*states[19]*algebraic[63]+algebraic[65]*states[22]*algebraic[64])
    algebraic[90] = constants[159]*(power(constants[3]/5.40000, 1.0/2))*states[38]*(states[0]-algebraic[53])
    algebraic[54] = ((constants[4]*constants[5])/constants[6])*log((constants[3]+constants[33]*constants[1])/(states[5]+constants[33]*states[3]))
    algebraic[93] = 1.00000+0.600000/(1.00000+power(3.80000e-05/states[9], 1.40000))
    algebraic[96] = constants[160]*algebraic[93]*states[44]*states[45]*(states[0]-algebraic[54])
    algebraic[97] = 1.00000/(1.00000+exp(((states[0]+105.800)-2.60000*constants[3])/9.49300))
    algebraic[98] = constants[161]*(power(constants[3], 1.0/2))*algebraic[97]*states[46]*(states[0]-algebraic[53])
    algebraic[162] = constants[128]*exp(((1.00000-constants[129])*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[166] = (constants[123]*(power(constants[3]/constants[131], 2.00000)))/((power(1.00000+constants[1]/algebraic[162], 3.00000)+power(1.00000+constants[3]/constants[131], 2.00000))-1.00000)
    algebraic[163] = constants[136]/(1.00000+constants[135]/constants[137]+states[3]/constants[138]+states[5]/constants[139])
    algebraic[167] = (constants[124]*algebraic[163]*constants[135])/(1.00000+constants[133]/constants[134])
    algebraic[161] = constants[127]*exp((constants[129]*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[164] = (constants[119]*(power(states[3]/algebraic[161], 3.00000)))/((power(1.00000+states[3]/algebraic[161], 3.00000)+power(1.00000+states[5]/constants[130], 2.00000))-1.00000)
    algebraic[165] = (constants[122]*(power(constants[1]/algebraic[162], 3.00000)))/((power(1.00000+constants[1]/algebraic[162], 3.00000)+power(1.00000+constants[3]/constants[131], 2.00000))-1.00000)
    algebraic[168] = (constants[126]*(power(states[5]/constants[130], 2.00000)))/((power(1.00000+states[3]/algebraic[161], 3.00000)+power(1.00000+states[5]/constants[130], 2.00000))-1.00000)
    algebraic[169] = constants[203]*algebraic[164]*constants[202]+algebraic[165]*algebraic[168]*algebraic[167]+constants[202]*algebraic[168]*algebraic[167]+algebraic[167]*algebraic[164]*constants[202]
    algebraic[170] = algebraic[165]*constants[201]*algebraic[168]+algebraic[164]*constants[202]*algebraic[166]+algebraic[166]*constants[201]*algebraic[168]+constants[202]*algebraic[166]*algebraic[168]
    algebraic[171] = constants[202]*algebraic[166]*constants[203]+algebraic[167]*algebraic[165]*constants[201]+algebraic[165]*constants[201]*constants[203]+algebraic[166]*constants[203]*constants[201]
    algebraic[172] = algebraic[168]*algebraic[167]*algebraic[165]+algebraic[166]*constants[203]*algebraic[164]+algebraic[165]*constants[203]*algebraic[164]+algebraic[167]*algebraic[165]*algebraic[164]
    algebraic[173] = algebraic[169]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[174] = algebraic[170]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[177] = 3.00000*(algebraic[173]*algebraic[166]-algebraic[174]*algebraic[167])
    algebraic[175] = algebraic[171]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[176] = algebraic[172]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[178] = 2.00000*(algebraic[176]*constants[201]-algebraic[175]*algebraic[164])
    algebraic[179] = constants[204]*(constants[7]*algebraic[177]+constants[9]*algebraic[178])
    algebraic[180] = 1.00000/(1.00000+exp(-(states[0]-14.4800)/18.3400))
    algebraic[181] = constants[163]*algebraic[180]*(states[0]-algebraic[53])
    algebraic[0] = custom_piecewise([greater_equal(voi , constants[12]) & less_equal(voi , constants[13]) & less_equal((voi-constants[12])-floor((voi-constants[12])/constants[15])*constants[15] , constants[16]), constants[14] , True, 0.00000])
    algebraic[183] = (states[6]-states[5])/2.00000
    rates[5] = (-((algebraic[66]+algebraic[90]+algebraic[96]+algebraic[98]+algebraic[181]+algebraic[0])-2.00000*algebraic[179])*constants[32]*constants[183])/(constants[6]*constants[184])+(algebraic[183]*constants[187])/constants[184]
    algebraic[79] = (0.750000*constants[169]*(states[6]*exp(algebraic[12])-constants[3]))/constants[176]
    algebraic[80] = constants[176]*(states[0]-constants[158])
    algebraic[81] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[80]) & less_equal(algebraic[80] , 1.00000e-07), algebraic[79]*(1.00000-0.500000*algebraic[80]) , True, (algebraic[79]*algebraic[80])/(exp(algebraic[80])-1.00000)])
    algebraic[87] = (1.00000-algebraic[82])*constants[173]*algebraic[81]*states[25]*(algebraic[67]*(1.00000-states[33])+states[30]*algebraic[70]*states[33])+algebraic[82]*constants[182]*algebraic[81]*states[25]*(algebraic[71]*(1.00000-states[33])+states[30]*algebraic[72]*states[33])
    rates[6] = (-algebraic[87]*constants[32]*constants[183])/(constants[6]*constants[187])-algebraic[183]
    algebraic[50] = ((constants[4]*constants[5])/constants[6])*log(constants[1]/states[3])
    algebraic[55] = constants[44]*states[11]+constants[151]*states[12]
    algebraic[56] = constants[44]*states[11]+constants[151]*states[14]
    algebraic[57] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[58] = constants[45]*(states[0]-algebraic[50])*(power(states[10], 3.00000))*((1.00000-algebraic[57])*algebraic[55]*states[13]+algebraic[57]*algebraic[56]*states[15])
    algebraic[59] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[60] = constants[153]*(states[0]-algebraic[50])*states[16]*((1.00000-algebraic[59])*states[17]+algebraic[59]*states[18])
    algebraic[127] = 1.00000/(1.00000+power(constants[117]/states[9], 2.00000))
    algebraic[100] = exp((constants[115]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[107] = 1.00000+(constants[1]/constants[108])*(1.00000+1.00000/algebraic[100])
    algebraic[108] = constants[1]/(constants[108]*algebraic[100]*algebraic[107])
    algebraic[111] = algebraic[108]*constants[112]
    algebraic[101] = 1.00000+(states[3]/constants[108])*(1.00000+algebraic[100])
    algebraic[102] = (states[3]*algebraic[100])/(constants[108]*algebraic[101])
    algebraic[114] = algebraic[102]*constants[112]
    algebraic[104] = 1.00000+(states[3]/constants[106])*(1.00000+states[3]/constants[107])
    algebraic[105] = (states[3]*states[3])/(algebraic[104]*constants[106]*constants[107])
    algebraic[117] = algebraic[105]*algebraic[102]*constants[110]
    algebraic[118] = algebraic[108]*constants[189]*constants[110]
    algebraic[109] = 1.00000/algebraic[107]
    algebraic[110] = algebraic[109]*constants[111]
    algebraic[112] = algebraic[110]+algebraic[111]
    algebraic[99] = exp((constants[116]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[103] = 1.00000/algebraic[101]
    algebraic[113] = (algebraic[103]*constants[111])/algebraic[99]
    algebraic[115] = algebraic[113]+algebraic[114]
    algebraic[106] = 1.00000/algebraic[104]
    algebraic[116] = algebraic[106]*states[9]*constants[113]
    algebraic[119] = constants[192]*algebraic[115]*(algebraic[117]+algebraic[116])+constants[193]*algebraic[117]*(constants[192]+algebraic[112])
    algebraic[120] = constants[191]*algebraic[117]*(algebraic[115]+constants[193])+algebraic[115]*algebraic[116]*(constants[191]+algebraic[118])
    algebraic[121] = constants[191]*algebraic[112]*(algebraic[117]+algebraic[116])+algebraic[118]*algebraic[116]*(constants[192]+algebraic[112])
    algebraic[122] = constants[192]*algebraic[118]*(algebraic[115]+constants[193])+algebraic[112]*constants[193]*(constants[191]+algebraic[118])
    algebraic[123] = algebraic[119]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[124] = algebraic[120]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[125] = algebraic[121]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[126] = algebraic[122]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[128] = (3.00000*(algebraic[126]*algebraic[117]-algebraic[123]*algebraic[118])+algebraic[125]*algebraic[114])-algebraic[124]*algebraic[111]
    algebraic[129] = algebraic[124]*constants[192]-algebraic[123]*constants[191]
    algebraic[130] = 0.800000*constants[194]*algebraic[127]*(constants[7]*algebraic[128]+constants[8]*algebraic[129])
    algebraic[182] = (constants[142]*constants[169]*(states[3]*exp(algebraic[12])-constants[1]))/constants[178]
    algebraic[184] = constants[178]*(states[0]-constants[164])
    algebraic[185] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[184]) & less_equal(algebraic[184] , 1.00000e-07), algebraic[182]*(1.00000-0.500000*algebraic[184]) , True, (algebraic[182]*algebraic[184])/(exp(algebraic[184])-1.00000)])
    algebraic[187] = (states[4]-states[3])/2.00000
    rates[3] = (-(algebraic[58]+algebraic[60]+3.00000*algebraic[130]+3.00000*algebraic[179]+algebraic[185])*constants[183]*constants[32])/(constants[6]*constants[184])+(algebraic[187]*constants[187])/constants[184]
    algebraic[76] = (0.750000*constants[169]*(states[4]*exp(algebraic[12])-constants[1]))/constants[175]
    algebraic[77] = constants[175]*(states[0]-constants[158])
    algebraic[78] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[77]) & less_equal(algebraic[77] , 1.00000e-07), algebraic[76]*(1.00000-0.500000*algebraic[77]) , True, (algebraic[76]*algebraic[77])/(exp(algebraic[77])-1.00000)])
    algebraic[84] = (1.00000-algebraic[82])*constants[172]*algebraic[78]*states[25]*(algebraic[67]*(1.00000-states[33])+states[30]*algebraic[70]*states[33])+algebraic[82]*constants[181]*algebraic[78]*states[25]*(algebraic[71]*(1.00000-states[33])+states[30]*algebraic[72]*states[33])
    algebraic[157] = 1.00000/(1.00000+power(constants[117]/states[2], 2.00000))
    algebraic[137] = 1.00000+(constants[1]/constants[108])*(1.00000+1.00000/algebraic[100])
    algebraic[138] = constants[1]/(constants[108]*algebraic[100]*algebraic[137])
    algebraic[141] = algebraic[138]*constants[112]
    algebraic[131] = 1.00000+(states[4]/constants[108])*(1.00000+algebraic[100])
    algebraic[132] = (states[4]*algebraic[100])/(constants[108]*algebraic[131])
    algebraic[144] = algebraic[132]*constants[112]
    algebraic[134] = 1.00000+(states[4]/constants[106])*(1.00000+states[4]/constants[107])
    algebraic[135] = (states[4]*states[4])/(algebraic[134]*constants[106]*constants[107])
    algebraic[147] = algebraic[135]*algebraic[132]*constants[110]
    algebraic[148] = algebraic[138]*constants[196]*constants[110]
    algebraic[139] = 1.00000/algebraic[137]
    algebraic[140] = algebraic[139]*constants[111]
    algebraic[142] = algebraic[140]+algebraic[141]
    algebraic[133] = 1.00000/algebraic[131]
    algebraic[143] = (algebraic[133]*constants[111])/algebraic[99]
    algebraic[145] = algebraic[143]+algebraic[144]
    algebraic[136] = 1.00000/algebraic[134]
    algebraic[146] = algebraic[136]*states[2]*constants[113]
    algebraic[149] = constants[199]*algebraic[145]*(algebraic[147]+algebraic[146])+constants[200]*algebraic[147]*(constants[199]+algebraic[142])
    algebraic[150] = constants[198]*algebraic[147]*(algebraic[145]+constants[200])+algebraic[145]*algebraic[146]*(constants[198]+algebraic[148])
    algebraic[151] = constants[198]*algebraic[142]*(algebraic[147]+algebraic[146])+algebraic[148]*algebraic[146]*(constants[199]+algebraic[142])
    algebraic[152] = constants[199]*algebraic[148]*(algebraic[145]+constants[200])+algebraic[142]*constants[200]*(constants[198]+algebraic[148])
    algebraic[153] = algebraic[149]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[154] = algebraic[150]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[155] = algebraic[151]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[156] = algebraic[152]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[158] = (3.00000*(algebraic[156]*algebraic[147]-algebraic[153]*algebraic[148])+algebraic[155]*algebraic[144])-algebraic[154]*algebraic[141]
    algebraic[159] = algebraic[154]*constants[199]-algebraic[153]*constants[198]
    algebraic[160] = 0.200000*constants[194]*algebraic[157]*(constants[7]*algebraic[158]+constants[8]*algebraic[159])
    rates[4] = (-(algebraic[84]+3.00000*algebraic[160])*constants[32]*constants[183])/(constants[6]*constants[187])-algebraic[187]
    algebraic[190] = (constants[144]*states[9])/(constants[145]+states[9])
    algebraic[186] = (constants[143]*4.00000*constants[169]*(states[9]*exp(2.00000*algebraic[12])-0.341000*constants[2]))/constants[179]
    algebraic[188] = constants[179]*(states[0]-constants[165])
    algebraic[189] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[188]) & less_equal(algebraic[188] , 1.00000e-07), algebraic[186]*(1.00000-0.500000*algebraic[188]) , True, (algebraic[186]*algebraic[188])/(exp(algebraic[188])-1.00000)])
    rates[0] = -(algebraic[58]+algebraic[60]+algebraic[66]+algebraic[83]+algebraic[84]+algebraic[87]+algebraic[90]+algebraic[96]+algebraic[98]+algebraic[130]+algebraic[160]+algebraic[179]+algebraic[185]+algebraic[181]+algebraic[190]+algebraic[189]+algebraic[0])
    algebraic[191] = (states[2]-states[9])/0.200000
    algebraic[192] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[193] = constants[147]*((1.00000-algebraic[192])*states[47]+algebraic[192]*states[48])
    algebraic[46] = 1.00000/(1.00000+(constants[26]*constants[27])/(power(constants[27]+states[2], 2.00000))+(constants[28]*constants[29])/(power(constants[29]+states[2], 2.00000)))
    rates[2] = algebraic[46]*(((-(algebraic[83]-2.00000*algebraic[160])*constants[32]*constants[183])/(2.00000*constants[6]*constants[187])+(algebraic[193]*constants[186])/constants[187])-algebraic[191])
    algebraic[194] = (constants[168]*0.00437500*states[9])/(states[9]+0.000920000)
    algebraic[195] = (constants[168]*2.75000*0.00437500*states[9])/((states[9]+0.000920000)-0.000170000)
    algebraic[196] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[197] = (0.00393750*states[7])/15.0000
    algebraic[198] = constants[148]*(((1.00000-algebraic[196])*algebraic[194]+algebraic[196]*algebraic[195])-algebraic[197])
    algebraic[44] = 1.00000/(1.00000+(constants[150]*constants[23])/(power(constants[23]+states[9], 2.00000))+(constants[24]*constants[25])/(power(constants[25]+states[9], 2.00000)))
    rates[9] = algebraic[44]*(((-((algebraic[190]+algebraic[189])-2.00000*algebraic[130])*constants[32]*constants[183])/(2.00000*constants[6]*constants[184])-(algebraic[198]*constants[185])/constants[184])+(algebraic[191]*constants[187])/constants[184])
    algebraic[199] = (states[7]-states[8])/100.000
    rates[7] = algebraic[198]-(algebraic[199]*constants[186])/constants[185]
    algebraic[48] = 1.00000/(1.00000+(constants[30]*constants[31])/(power(constants[31]+states[8], 2.00000)))
    rates[8] = algebraic[48]*(algebraic[199]-algebraic[193])
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[3] = 1.00000/(1.00000+exp((states[0]+87.6100)/7.48800))
    algebraic[4] = 1.00000/(1.00000+exp((states[0]+93.8100)/7.48800))
    algebraic[1] = 1.00000/(1.00000+exp(-(states[0]+constants[34])/constants[35]))
    algebraic[13] = 1.00000/(constants[38]*exp((states[0]+constants[36])/constants[37])+constants[39]*exp(-(states[0]+constants[40])/constants[41]))
    algebraic[2] = 1.00000/(1.00000+exp(((states[0]+constants[42])-constants[46])/constants[43]))
    algebraic[14] = 1.00000/(1.43200e-05*exp(-((states[0]+1.19600)-constants[46])/6.28500)+6.14900*exp(((states[0]+0.509600)-constants[46])/20.2700))
    algebraic[15] = 1.00000/(0.00979400*exp(-((states[0]+17.9500)-constants[46])/28.0500)+0.334300*exp(((states[0]+5.73000)-constants[46])/56.6600))
    algebraic[5] = 1.00000/(1.00000+exp(-(states[0]-14.3400)/14.8200))
    algebraic[17] = 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[7] = 1.00000/(1.00000+exp(-(states[0]+3.94000)/4.23000))
    algebraic[21] = 0.600000+1.00000/(exp(-0.0500000*(states[0]+6.00000))+exp(0.0900000*(states[0]+14.0000)))
    algebraic[8] = 1.00000/(1.00000+exp((states[0]+19.5800)/3.69600))
    algebraic[22] = 7.00000+1.00000/(0.00450000*exp(-(states[0]+20.0000)/10.0000)+0.00450000*exp((states[0]+20.0000)/10.0000))
    algebraic[23] = 1000.00+1.00000/(3.50000e-05*exp(-(states[0]+5.00000)/4.00000)+3.50000e-05*exp((states[0]+5.00000)/6.00000))
    algebraic[19] = algebraic[8]
    algebraic[9] = states[30]*1.00000
    algebraic[20] = 1.00000/(constants[51]/algebraic[9]+power(1.00000+constants[50]/states[2], 4.00000))
    algebraic[10] = 1.00000/(1.00000+exp(-(states[0]+11.6000)/8.93200))
    algebraic[25] = constants[104]+1.00000/(0.000232600*exp((states[0]+48.2800)/17.8000)+0.00129200*exp(-(states[0]+210.000)/230.000))
    algebraic[11] = 1.00000/(1.00000+exp(-(states[0]+2.55380*constants[3]+144.590)/(1.56920*constants[3]+3.81150)))
    algebraic[26] = 122.200/(exp(-(states[0]+127.200)/20.3600)+exp((states[0]+236.800)/69.3300))
    algebraic[36] = (constants[20]*(1.00000-states[1]))/(1.00000+constants[21]/states[2])
    algebraic[16] = algebraic[2]
    algebraic[27] = 2.03800+1.00000/(0.0213600*exp(-((states[0]+100.600)-constants[46])/8.28100)+0.305200*exp(((states[0]+0.994100)-constants[46])/38.4500))
    algebraic[31] = 1.00000/(1.00000+exp(-(states[0]-24.3400)/14.8200))
    algebraic[32] = 7.00000+1.00000/(0.0400000*exp(-(states[0]-4.00000)/7.00000)+0.0400000*exp((states[0]-4.00000)/7.00000))
    algebraic[33] = 100.000+1.00000/(0.000120000*exp(-states[0]/3.00000)+0.000120000*exp(states[0]/7.00000))
    algebraic[34] = 2.50000*algebraic[22]
    algebraic[24] = algebraic[10]
    algebraic[35] = 1.00000/(0.0100000*exp((states[0]-50.0000)/20.0000)+0.0193000*exp(-(states[0]+66.5400)/31.0000))
    algebraic[28] = 1.00000/(1.00000+exp(((states[0]+89.1000)-constants[46])/6.08600))
    algebraic[37] = 3.00000*algebraic[15]
    algebraic[38] = 1.46000*algebraic[27]
    algebraic[29] = 1.00000/(1.00000+exp(-(states[0]+42.8500)/5.26400))
    algebraic[39] = algebraic[13]
    algebraic[41] = 2.50000*algebraic[32]
    algebraic[6] = 1.00000/(1.00000+exp((states[0]+43.9400)/5.71100))
    algebraic[18] = custom_piecewise([equal(constants[0] , 1.00000), 1.00000-0.950000/(1.00000+exp((states[0]+70.0000)/5.00000)) , True, 1.00000])
    algebraic[30] = 4.56200+1.00000/(0.393300*exp(-(states[0]+100.000)/100.000)+0.0800400*exp((states[0]+50.0000)/16.5900))
    algebraic[43] = algebraic[30]*algebraic[18]
    algebraic[40] = 23.6200+1.00000/(0.00141600*exp(-(states[0]+96.5200)/59.0500)+1.78000e-08*exp((states[0]+114.100)/8.07900))
    algebraic[45] = algebraic[40]*algebraic[18]
    algebraic[47] = 1.35400+0.000100000/(exp((states[0]-167.400)/15.8900)+exp(-(states[0]-12.2300)/0.215400))
    algebraic[49] = 1.00000-0.500000/(1.00000+exp((states[0]+70.0000)/20.0000))
    algebraic[51] = algebraic[47]*algebraic[49]*algebraic[43]
    algebraic[52] = algebraic[47]*algebraic[49]*algebraic[45]
    algebraic[67] = constants[155]*states[26]+constants[170]*states[27]
    algebraic[68] = 0.300000+0.600000/(1.00000+exp((states[0]-10.0000)/10.0000))
    algebraic[69] = 1.00000-algebraic[68]
    algebraic[70] = algebraic[68]*states[28]+algebraic[69]*states[29]
    algebraic[71] = constants[155]*states[31]+constants[170]*states[27]
    algebraic[72] = algebraic[68]*states[32]+algebraic[69]*states[29]
    algebraic[12] = states[0]*constants[149]
    algebraic[73] = (4.00000*constants[169]*(states[2]*exp(2.00000*algebraic[12])-0.341000*constants[2]))/constants[174]
    algebraic[74] = constants[174]*(states[0]-constants[158])
    algebraic[75] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[74]) & less_equal(algebraic[74] , 1.00000e-07), algebraic[73]*(1.00000-0.500000*algebraic[74]) , True, (algebraic[73]*algebraic[74])/(exp(algebraic[74])-1.00000)])
    algebraic[42] = algebraic[36]+states[1]
    algebraic[82] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[83] = (1.00000-algebraic[82])*constants[156]*algebraic[75]*states[25]*(algebraic[67]*(1.00000-states[33])+states[30]*algebraic[70]*states[33])+algebraic[82]*constants[171]*algebraic[75]*states[25]*(algebraic[71]*(1.00000-states[33])+states[30]*algebraic[72]*states[33])
    algebraic[85] = (constants[166]*-algebraic[83])/(1.00000+1.00000*(power(1.50000/states[8], 8.00000)))
    algebraic[88] = custom_piecewise([equal(constants[0] , 2.00000), algebraic[85]*1.70000 , True, algebraic[85]])
    algebraic[91] = constants[146]/(1.00000+0.0123000/states[8])
    algebraic[94] = custom_piecewise([less(algebraic[91] , 0.00100000), 0.00100000 , True, algebraic[91]])
    algebraic[86] = (constants[180]*-algebraic[83])/(1.00000+power(1.50000/states[8], 8.00000))
    algebraic[89] = custom_piecewise([equal(constants[0] , 2.00000), algebraic[86]*1.70000 , True, algebraic[86]])
    algebraic[92] = constants[167]/(1.00000+0.0123000/states[8])
    algebraic[95] = custom_piecewise([less(algebraic[92] , 0.00100000), 0.00100000 , True, algebraic[92]])
    algebraic[53] = ((constants[4]*constants[5])/constants[6])*log(constants[3]/states[5])
    algebraic[61] = 1.00000/(1.00000+exp((states[0]-213.600)/151.200))
    algebraic[62] = 1.00000-algebraic[61]
    algebraic[63] = algebraic[61]*states[20]+algebraic[62]*states[21]
    algebraic[64] = algebraic[61]*states[23]+algebraic[62]*states[24]
    algebraic[65] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[66] = constants[154]*(states[0]-algebraic[53])*((1.00000-algebraic[65])*states[19]*algebraic[63]+algebraic[65]*states[22]*algebraic[64])
    algebraic[90] = constants[159]*(power(constants[3]/5.40000, 1.0/2))*states[38]*(states[0]-algebraic[53])
    algebraic[54] = ((constants[4]*constants[5])/constants[6])*log((constants[3]+constants[33]*constants[1])/(states[5]+constants[33]*states[3]))
    algebraic[93] = 1.00000+0.600000/(1.00000+power(3.80000e-05/states[9], 1.40000))
    algebraic[96] = constants[160]*algebraic[93]*states[44]*states[45]*(states[0]-algebraic[54])
    algebraic[97] = 1.00000/(1.00000+exp(((states[0]+105.800)-2.60000*constants[3])/9.49300))
    algebraic[98] = constants[161]*(power(constants[3], 1.0/2))*algebraic[97]*states[46]*(states[0]-algebraic[53])
    algebraic[162] = constants[128]*exp(((1.00000-constants[129])*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[166] = (constants[123]*(power(constants[3]/constants[131], 2.00000)))/((power(1.00000+constants[1]/algebraic[162], 3.00000)+power(1.00000+constants[3]/constants[131], 2.00000))-1.00000)
    algebraic[163] = constants[136]/(1.00000+constants[135]/constants[137]+states[3]/constants[138]+states[5]/constants[139])
    algebraic[167] = (constants[124]*algebraic[163]*constants[135])/(1.00000+constants[133]/constants[134])
    algebraic[161] = constants[127]*exp((constants[129]*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[164] = (constants[119]*(power(states[3]/algebraic[161], 3.00000)))/((power(1.00000+states[3]/algebraic[161], 3.00000)+power(1.00000+states[5]/constants[130], 2.00000))-1.00000)
    algebraic[165] = (constants[122]*(power(constants[1]/algebraic[162], 3.00000)))/((power(1.00000+constants[1]/algebraic[162], 3.00000)+power(1.00000+constants[3]/constants[131], 2.00000))-1.00000)
    algebraic[168] = (constants[126]*(power(states[5]/constants[130], 2.00000)))/((power(1.00000+states[3]/algebraic[161], 3.00000)+power(1.00000+states[5]/constants[130], 2.00000))-1.00000)
    algebraic[169] = constants[203]*algebraic[164]*constants[202]+algebraic[165]*algebraic[168]*algebraic[167]+constants[202]*algebraic[168]*algebraic[167]+algebraic[167]*algebraic[164]*constants[202]
    algebraic[170] = algebraic[165]*constants[201]*algebraic[168]+algebraic[164]*constants[202]*algebraic[166]+algebraic[166]*constants[201]*algebraic[168]+constants[202]*algebraic[166]*algebraic[168]
    algebraic[171] = constants[202]*algebraic[166]*constants[203]+algebraic[167]*algebraic[165]*constants[201]+algebraic[165]*constants[201]*constants[203]+algebraic[166]*constants[203]*constants[201]
    algebraic[172] = algebraic[168]*algebraic[167]*algebraic[165]+algebraic[166]*constants[203]*algebraic[164]+algebraic[165]*constants[203]*algebraic[164]+algebraic[167]*algebraic[165]*algebraic[164]
    algebraic[173] = algebraic[169]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[174] = algebraic[170]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[177] = 3.00000*(algebraic[173]*algebraic[166]-algebraic[174]*algebraic[167])
    algebraic[175] = algebraic[171]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[176] = algebraic[172]/(algebraic[169]+algebraic[170]+algebraic[171]+algebraic[172])
    algebraic[178] = 2.00000*(algebraic[176]*constants[201]-algebraic[175]*algebraic[164])
    algebraic[179] = constants[204]*(constants[7]*algebraic[177]+constants[9]*algebraic[178])
    algebraic[180] = 1.00000/(1.00000+exp(-(states[0]-14.4800)/18.3400))
    algebraic[181] = constants[163]*algebraic[180]*(states[0]-algebraic[53])
    algebraic[0] = custom_piecewise([greater_equal(voi , constants[12]) & less_equal(voi , constants[13]) & less_equal((voi-constants[12])-floor((voi-constants[12])/constants[15])*constants[15] , constants[16]), constants[14] , True, 0.00000])
    algebraic[183] = (states[6]-states[5])/2.00000
    algebraic[79] = (0.750000*constants[169]*(states[6]*exp(algebraic[12])-constants[3]))/constants[176]
    algebraic[80] = constants[176]*(states[0]-constants[158])
    algebraic[81] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[80]) & less_equal(algebraic[80] , 1.00000e-07), algebraic[79]*(1.00000-0.500000*algebraic[80]) , True, (algebraic[79]*algebraic[80])/(exp(algebraic[80])-1.00000)])
    algebraic[87] = (1.00000-algebraic[82])*constants[173]*algebraic[81]*states[25]*(algebraic[67]*(1.00000-states[33])+states[30]*algebraic[70]*states[33])+algebraic[82]*constants[182]*algebraic[81]*states[25]*(algebraic[71]*(1.00000-states[33])+states[30]*algebraic[72]*states[33])
    algebraic[50] = ((constants[4]*constants[5])/constants[6])*log(constants[1]/states[3])
    algebraic[55] = constants[44]*states[11]+constants[151]*states[12]
    algebraic[56] = constants[44]*states[11]+constants[151]*states[14]
    algebraic[57] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[58] = constants[45]*(states[0]-algebraic[50])*(power(states[10], 3.00000))*((1.00000-algebraic[57])*algebraic[55]*states[13]+algebraic[57]*algebraic[56]*states[15])
    algebraic[59] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[60] = constants[153]*(states[0]-algebraic[50])*states[16]*((1.00000-algebraic[59])*states[17]+algebraic[59]*states[18])
    algebraic[127] = 1.00000/(1.00000+power(constants[117]/states[9], 2.00000))
    algebraic[100] = exp((constants[115]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[107] = 1.00000+(constants[1]/constants[108])*(1.00000+1.00000/algebraic[100])
    algebraic[108] = constants[1]/(constants[108]*algebraic[100]*algebraic[107])
    algebraic[111] = algebraic[108]*constants[112]
    algebraic[101] = 1.00000+(states[3]/constants[108])*(1.00000+algebraic[100])
    algebraic[102] = (states[3]*algebraic[100])/(constants[108]*algebraic[101])
    algebraic[114] = algebraic[102]*constants[112]
    algebraic[104] = 1.00000+(states[3]/constants[106])*(1.00000+states[3]/constants[107])
    algebraic[105] = (states[3]*states[3])/(algebraic[104]*constants[106]*constants[107])
    algebraic[117] = algebraic[105]*algebraic[102]*constants[110]
    algebraic[118] = algebraic[108]*constants[189]*constants[110]
    algebraic[109] = 1.00000/algebraic[107]
    algebraic[110] = algebraic[109]*constants[111]
    algebraic[112] = algebraic[110]+algebraic[111]
    algebraic[99] = exp((constants[116]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[103] = 1.00000/algebraic[101]
    algebraic[113] = (algebraic[103]*constants[111])/algebraic[99]
    algebraic[115] = algebraic[113]+algebraic[114]
    algebraic[106] = 1.00000/algebraic[104]
    algebraic[116] = algebraic[106]*states[9]*constants[113]
    algebraic[119] = constants[192]*algebraic[115]*(algebraic[117]+algebraic[116])+constants[193]*algebraic[117]*(constants[192]+algebraic[112])
    algebraic[120] = constants[191]*algebraic[117]*(algebraic[115]+constants[193])+algebraic[115]*algebraic[116]*(constants[191]+algebraic[118])
    algebraic[121] = constants[191]*algebraic[112]*(algebraic[117]+algebraic[116])+algebraic[118]*algebraic[116]*(constants[192]+algebraic[112])
    algebraic[122] = constants[192]*algebraic[118]*(algebraic[115]+constants[193])+algebraic[112]*constants[193]*(constants[191]+algebraic[118])
    algebraic[123] = algebraic[119]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[124] = algebraic[120]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[125] = algebraic[121]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[126] = algebraic[122]/(algebraic[119]+algebraic[120]+algebraic[121]+algebraic[122])
    algebraic[128] = (3.00000*(algebraic[126]*algebraic[117]-algebraic[123]*algebraic[118])+algebraic[125]*algebraic[114])-algebraic[124]*algebraic[111]
    algebraic[129] = algebraic[124]*constants[192]-algebraic[123]*constants[191]
    algebraic[130] = 0.800000*constants[194]*algebraic[127]*(constants[7]*algebraic[128]+constants[8]*algebraic[129])
    algebraic[182] = (constants[142]*constants[169]*(states[3]*exp(algebraic[12])-constants[1]))/constants[178]
    algebraic[184] = constants[178]*(states[0]-constants[164])
    algebraic[185] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[184]) & less_equal(algebraic[184] , 1.00000e-07), algebraic[182]*(1.00000-0.500000*algebraic[184]) , True, (algebraic[182]*algebraic[184])/(exp(algebraic[184])-1.00000)])
    algebraic[187] = (states[4]-states[3])/2.00000
    algebraic[76] = (0.750000*constants[169]*(states[4]*exp(algebraic[12])-constants[1]))/constants[175]
    algebraic[77] = constants[175]*(states[0]-constants[158])
    algebraic[78] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[77]) & less_equal(algebraic[77] , 1.00000e-07), algebraic[76]*(1.00000-0.500000*algebraic[77]) , True, (algebraic[76]*algebraic[77])/(exp(algebraic[77])-1.00000)])
    algebraic[84] = (1.00000-algebraic[82])*constants[172]*algebraic[78]*states[25]*(algebraic[67]*(1.00000-states[33])+states[30]*algebraic[70]*states[33])+algebraic[82]*constants[181]*algebraic[78]*states[25]*(algebraic[71]*(1.00000-states[33])+states[30]*algebraic[72]*states[33])
    algebraic[157] = 1.00000/(1.00000+power(constants[117]/states[2], 2.00000))
    algebraic[137] = 1.00000+(constants[1]/constants[108])*(1.00000+1.00000/algebraic[100])
    algebraic[138] = constants[1]/(constants[108]*algebraic[100]*algebraic[137])
    algebraic[141] = algebraic[138]*constants[112]
    algebraic[131] = 1.00000+(states[4]/constants[108])*(1.00000+algebraic[100])
    algebraic[132] = (states[4]*algebraic[100])/(constants[108]*algebraic[131])
    algebraic[144] = algebraic[132]*constants[112]
    algebraic[134] = 1.00000+(states[4]/constants[106])*(1.00000+states[4]/constants[107])
    algebraic[135] = (states[4]*states[4])/(algebraic[134]*constants[106]*constants[107])
    algebraic[147] = algebraic[135]*algebraic[132]*constants[110]
    algebraic[148] = algebraic[138]*constants[196]*constants[110]
    algebraic[139] = 1.00000/algebraic[137]
    algebraic[140] = algebraic[139]*constants[111]
    algebraic[142] = algebraic[140]+algebraic[141]
    algebraic[133] = 1.00000/algebraic[131]
    algebraic[143] = (algebraic[133]*constants[111])/algebraic[99]
    algebraic[145] = algebraic[143]+algebraic[144]
    algebraic[136] = 1.00000/algebraic[134]
    algebraic[146] = algebraic[136]*states[2]*constants[113]
    algebraic[149] = constants[199]*algebraic[145]*(algebraic[147]+algebraic[146])+constants[200]*algebraic[147]*(constants[199]+algebraic[142])
    algebraic[150] = constants[198]*algebraic[147]*(algebraic[145]+constants[200])+algebraic[145]*algebraic[146]*(constants[198]+algebraic[148])
    algebraic[151] = constants[198]*algebraic[142]*(algebraic[147]+algebraic[146])+algebraic[148]*algebraic[146]*(constants[199]+algebraic[142])
    algebraic[152] = constants[199]*algebraic[148]*(algebraic[145]+constants[200])+algebraic[142]*constants[200]*(constants[198]+algebraic[148])
    algebraic[153] = algebraic[149]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[154] = algebraic[150]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[155] = algebraic[151]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[156] = algebraic[152]/(algebraic[149]+algebraic[150]+algebraic[151]+algebraic[152])
    algebraic[158] = (3.00000*(algebraic[156]*algebraic[147]-algebraic[153]*algebraic[148])+algebraic[155]*algebraic[144])-algebraic[154]*algebraic[141]
    algebraic[159] = algebraic[154]*constants[199]-algebraic[153]*constants[198]
    algebraic[160] = 0.200000*constants[194]*algebraic[157]*(constants[7]*algebraic[158]+constants[8]*algebraic[159])
    algebraic[190] = (constants[144]*states[9])/(constants[145]+states[9])
    algebraic[186] = (constants[143]*4.00000*constants[169]*(states[9]*exp(2.00000*algebraic[12])-0.341000*constants[2]))/constants[179]
    algebraic[188] = constants[179]*(states[0]-constants[165])
    algebraic[189] = custom_piecewise([less_equal(-1.00000e-07 , algebraic[188]) & less_equal(algebraic[188] , 1.00000e-07), algebraic[186]*(1.00000-0.500000*algebraic[188]) , True, (algebraic[186]*algebraic[188])/(exp(algebraic[188])-1.00000)])
    algebraic[191] = (states[2]-states[9])/0.200000
    algebraic[192] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[193] = constants[147]*((1.00000-algebraic[192])*states[47]+algebraic[192]*states[48])
    algebraic[46] = 1.00000/(1.00000+(constants[26]*constants[27])/(power(constants[27]+states[2], 2.00000))+(constants[28]*constants[29])/(power(constants[29]+states[2], 2.00000)))
    algebraic[194] = (constants[168]*0.00437500*states[9])/(states[9]+0.000920000)
    algebraic[195] = (constants[168]*2.75000*0.00437500*states[9])/((states[9]+0.000920000)-0.000170000)
    algebraic[196] = 1.00000/(1.00000+constants[17]/algebraic[42])
    algebraic[197] = (0.00393750*states[7])/15.0000
    algebraic[198] = constants[148]*(((1.00000-algebraic[196])*algebraic[194]+algebraic[196]*algebraic[195])-algebraic[197])
    algebraic[44] = 1.00000/(1.00000+(constants[150]*constants[23])/(power(constants[23]+states[9], 2.00000))+(constants[24]*constants[25])/(power(constants[25]+states[9], 2.00000)))
    algebraic[199] = (states[7]-states[8])/100.000
    algebraic[48] = 1.00000/(1.00000+(constants[30]*constants[31])/(power(constants[31]+states[8], 2.00000)))
    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)