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 = 251
sizeStates = 57
sizeConstants = 232
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[184] = "vcell in component cell_geometry (microliter)"
    legend_constants[200] = "Ageo in component cell_geometry (centimeter_squared)"
    legend_constants[202] = "Acap in component cell_geometry (centimeter_squared)"
    legend_constants[203] = "vmyo in component cell_geometry (microliter)"
    legend_constants[204] = "vnsr in component cell_geometry (microliter)"
    legend_constants[205] = "vjsr in component cell_geometry (microliter)"
    legend_constants[206] = "vss in component cell_geometry (microliter)"
    legend_constants[207] = "vsr in component cell_geometry (microliter)"
    legend_states[0] = "v in component membrane (millivolt)"
    legend_algebraic[22] = "vffrt in component membrane (coulomb_per_mole)"
    legend_algebraic[31] = "vfrt in component membrane (dimensionless)"
    legend_algebraic[54] = "INa in component INa (microA_per_microF)"
    legend_algebraic[56] = "INaL in component INaL (microA_per_microF)"
    legend_algebraic[62] = "Ito in component Ito (microA_per_microF)"
    legend_algebraic[143] = "ICaL in component ICaL (microA_per_microF)"
    legend_algebraic[145] = "ICaNa in component ICaL (microA_per_microF)"
    legend_algebraic[146] = "ICaK in component ICaL (microA_per_microF)"
    legend_algebraic[147] = "IKr in component IKr (microA_per_microF)"
    legend_algebraic[149] = "IKs in component IKs (microA_per_microF)"
    legend_algebraic[151] = "IK1 in component IK1 (microA_per_microF)"
    legend_algebraic[183] = "INaCa_i in component INaCa_i (microA_per_microF)"
    legend_algebraic[213] = "INaCa_ss in component INaCa_i (microA_per_microF)"
    legend_algebraic[232] = "INaK in component INaK (microA_per_microF)"
    legend_algebraic[235] = "INab in component INab (microA_per_microF)"
    legend_algebraic[234] = "IKb in component IKb (microA_per_microF)"
    legend_algebraic[239] = "IpCa in component IpCa (microA_per_microF)"
    legend_algebraic[237] = "ICab in component ICab (microA_per_microF)"
    legend_constants[12] = "pstim in component membrane (dimensionless)"
    legend_algebraic[8] = "Istim in component membrane (microA_per_microF)"
    legend_constants[13] = "i_Stim_Start in component membrane (millisecond)"
    legend_constants[14] = "i_Stim_End in component membrane (millisecond)"
    legend_constants[15] = "i_Stim_Amplitude in component membrane (microA_per_microF)"
    legend_constants[16] = "i_Stim_Period in component membrane (millisecond)"
    legend_constants[17] = "i_Stim_PulseDuration in component membrane (millisecond)"
    legend_constants[18] = "KmCaMK in component CaMK (millimolar)"
    legend_constants[19] = "aCaMK in component CaMK (per_millimolar_per_millisecond)"
    legend_constants[20] = "bCaMK in component CaMK (per_millisecond)"
    legend_constants[21] = "CaMKo in component CaMK (dimensionless)"
    legend_constants[22] = "KmCaM in component CaMK (millimolar)"
    legend_algebraic[37] = "CaMKb in component CaMK (millimolar)"
    legend_algebraic[39] = "CaMKa in component CaMK (millimolar)"
    legend_states[1] = "CaMKt in component CaMK (millimolar)"
    legend_states[2] = "cass in component intracellular_ions (millimolar)"
    legend_constants[23] = "cmdnmax_b in component intracellular_ions (millimolar)"
    legend_constants[173] = "cmdnmax in component intracellular_ions (millimolar)"
    legend_constants[24] = "kmcmdn in component intracellular_ions (millimolar)"
    legend_constants[25] = "trpnmax in component intracellular_ions (millimolar)"
    legend_constants[26] = "kmtrpn in component intracellular_ions (millimolar)"
    legend_constants[27] = "BSRmax in component intracellular_ions (millimolar)"
    legend_constants[28] = "KmBSR in component intracellular_ions (millimolar)"
    legend_constants[29] = "BSLmax in component intracellular_ions (millimolar)"
    legend_constants[30] = "KmBSL in component intracellular_ions (millimolar)"
    legend_constants[31] = "csqnmax in component intracellular_ions (millimolar)"
    legend_constants[32] = "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_constants[33] = "cansr in component intracellular_ions (millimolar)"
    legend_constants[34] = "cajsr in component intracellular_ions (millimolar)"
    legend_states[7] = "casr in component intracellular_ions (millimolar)"
    legend_states[8] = "cai in component intracellular_ions (millimolar)"
    legend_algebraic[238] = "JdiffNa in component diff (millimolar_per_millisecond)"
    legend_algebraic[240] = "Jdiff in component diff (millimolar_per_millisecond)"
    legend_algebraic[250] = "Jup in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[236] = "JdiffK in component diff (millimolar_per_millisecond)"
    legend_algebraic[245] = "Jrel in component ryr (millimolar_per_millisecond)"
    legend_constants[174] = "Jtr in component trans_flux (millimolar_per_millisecond)"
    legend_algebraic[249] = "Jleak in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[41] = "Bcai in component intracellular_ions (dimensionless)"
    legend_algebraic[45] = "Bcasr in component intracellular_ions (dimensionless)"
    legend_algebraic[43] = "Bcass in component intracellular_ions (dimensionless)"
    legend_constants[35] = "cm in component intracellular_ions (microF_per_centimeter_squared)"
    legend_constants[36] = "PKNa in component reversal_potentials (dimensionless)"
    legend_algebraic[48] = "ENa in component reversal_potentials (millivolt)"
    legend_algebraic[49] = "EK in component reversal_potentials (millivolt)"
    legend_algebraic[50] = "EKs in component reversal_potentials (millivolt)"
    legend_constants[37] = "EKshift in component reversal_potentials (millivolt)"
    legend_constants[38] = "btj in component INa (dimensionless)"
    legend_constants[39] = "bGNa in component INa (dimensionless)"
    legend_algebraic[0] = "mss in component INa (dimensionless)"
    legend_algebraic[15] = "tm in component INa (millisecond)"
    legend_constants[40] = "mssV1 in component INa (millivolt)"
    legend_constants[41] = "mssV2 in component INa (millivolt)"
    legend_constants[42] = "mtV1 in component INa (millivolt)"
    legend_constants[43] = "mtV2 in component INa (millivolt)"
    legend_constants[44] = "mtD1 in component INa (dimensionless)"
    legend_constants[45] = "mtD2 in component INa (dimensionless)"
    legend_constants[46] = "mtV3 in component INa (millivolt)"
    legend_constants[47] = "mtV4 in component INa (millivolt)"
    legend_states[9] = "m in component INa (dimensionless)"
    legend_algebraic[1] = "hss in component INa (dimensionless)"
    legend_algebraic[16] = "thf in component INa (millisecond)"
    legend_algebraic[17] = "ths in component INa (millisecond)"
    legend_constants[48] = "hssV1 in component INa (millivolt)"
    legend_constants[49] = "hssV2 in component INa (millivolt)"
    legend_constants[175] = "Ahs in component INa (dimensionless)"
    legend_constants[50] = "Ahf in component INa (dimensionless)"
    legend_states[10] = "hf in component INa (dimensionless)"
    legend_states[11] = "hs in component INa (dimensionless)"
    legend_algebraic[51] = "h in component INa (dimensionless)"
    legend_constants[51] = "GNa in component INa (milliS_per_microF)"
    legend_algebraic[18] = "jss in component INa (dimensionless)"
    legend_algebraic[26] = "tj in component INa (millisecond)"
    legend_states[12] = "j in component INa (dimensionless)"
    legend_algebraic[27] = "hssp in component INa (dimensionless)"
    legend_algebraic[33] = "thsp in component INa (millisecond)"
    legend_states[13] = "hsp in component INa (dimensionless)"
    legend_algebraic[52] = "hp in component INa (dimensionless)"
    legend_algebraic[34] = "tjp in component INa (millisecond)"
    legend_states[14] = "jp in component INa (dimensionless)"
    legend_algebraic[53] = "fINap in component INa (dimensionless)"
    legend_constants[52] = "bGnal in component INaL (dimensionless)"
    legend_constants[53] = "bthL in component INaL (dimensionless)"
    legend_algebraic[28] = "mLss in component INaL (dimensionless)"
    legend_algebraic[35] = "tmL in component INaL (millisecond)"
    legend_states[15] = "mL in component INaL (dimensionless)"
    legend_constants[176] = "thL in component INaL (millisecond)"
    legend_algebraic[2] = "hLss in component INaL (dimensionless)"
    legend_states[16] = "hL in component INaL (dimensionless)"
    legend_algebraic[3] = "hLssp in component INaL (dimensionless)"
    legend_constants[198] = "thLp in component INaL (millisecond)"
    legend_states[17] = "hLp in component INaL (dimensionless)"
    legend_constants[54] = "GNaL_b in component INaL (milliS_per_microF)"
    legend_constants[177] = "GNaL in component INaL (milliS_per_microF)"
    legend_algebraic[55] = "fINaLp in component INaL (dimensionless)"
    legend_constants[55] = "bGto in component Ito (dimensionless)"
    legend_constants[56] = "Gto_b in component Ito (milliS_per_microF)"
    legend_algebraic[4] = "ass in component Ito (dimensionless)"
    legend_algebraic[19] = "ta in component Ito (millisecond)"
    legend_states[18] = "a in component Ito (dimensionless)"
    legend_algebraic[5] = "iss in component Ito (dimensionless)"
    legend_algebraic[20] = "delta_epi in component Ito (dimensionless)"
    legend_algebraic[29] = "tiF_b in component Ito (millisecond)"
    legend_algebraic[36] = "tiS_b in component Ito (millisecond)"
    legend_algebraic[38] = "tiF in component Ito (millisecond)"
    legend_algebraic[40] = "tiS in component Ito (millisecond)"
    legend_algebraic[57] = "AiF in component Ito (dimensionless)"
    legend_algebraic[58] = "AiS in component Ito (dimensionless)"
    legend_states[19] = "iF in component Ito (dimensionless)"
    legend_states[20] = "iS in component Ito (dimensionless)"
    legend_algebraic[59] = "i in component Ito (dimensionless)"
    legend_algebraic[30] = "assp in component Ito (dimensionless)"
    legend_states[21] = "ap in component Ito (dimensionless)"
    legend_algebraic[42] = "dti_develop in component Ito (dimensionless)"
    legend_algebraic[44] = "dti_recover in component Ito (dimensionless)"
    legend_algebraic[46] = "tiFp in component Ito (millisecond)"
    legend_algebraic[47] = "tiSp in component Ito (millisecond)"
    legend_states[22] = "iFp in component Ito (dimensionless)"
    legend_states[23] = "iSp in component Ito (dimensionless)"
    legend_algebraic[60] = "ip in component Ito (dimensionless)"
    legend_constants[178] = "Gto in component Ito (milliS_per_microF)"
    legend_algebraic[61] = "fItop in component Ito (dimensionless)"
    legend_constants[57] = "EKshift in component Ito (millivolt)"
    legend_constants[179] = "r_down in component ICaL (dimensionless)"
    legend_algebraic[64] = "r_up in component ICaL (dimensionless)"
    legend_constants[58] = "undo_CDI in component ICaL (dimensionless)"
    legend_states[24] = "nca in component ICaL (dimensionless)"
    legend_algebraic[6] = "jncass in component ICaL (dimensionless)"
    legend_constants[59] = "tjnca in component ICaL (millisecond)"
    legend_states[25] = "jnca in component ICaL (dimensionless)"
    legend_algebraic[7] = "km2n in component ICaL (per_millisecond)"
    legend_constants[60] = "Kmn in component ICaL (millimolar)"
    legend_algebraic[21] = "anca in component ICaL (dimensionless)"
    legend_constants[61] = "k2n in component ICaL (per_millisecond)"
    legend_constants[62] = "kmn in component ICaL (millimolar)"
    legend_algebraic[65] = "dss in component ICaL (dimensionless)"
    legend_algebraic[66] = "td in component ICaL (millisecond)"
    legend_algebraic[67] = "alpha in component ICaL (dimensionless)"
    legend_algebraic[68] = "beta in component ICaL (dimensionless)"
    legend_algebraic[69] = "jcass_new in component ICaL (dimensionless)"
    legend_algebraic[70] = "jcass_VD in component ICaL (dimensionless)"
    legend_algebraic[71] = "jcass_CD in component ICaL (dimensionless)"
    legend_algebraic[72] = "jcass_VDp in component ICaL (dimensionless)"
    legend_algebraic[73] = "jcass_CDp in component ICaL (dimensionless)"
    legend_algebraic[74] = "tjca_new in component ICaL (dimensionless)"
    legend_algebraic[75] = "tjca_VD in component ICaL (dimensionless)"
    legend_algebraic[76] = "tjca_CD in component ICaL (dimensionless)"
    legend_algebraic[77] = "tjca_VDp in component ICaL (dimensionless)"
    legend_algebraic[78] = "tjca_CDp in component ICaL (dimensionless)"
    legend_algebraic[79] = "psi_VD in component ICaL (dimensionless)"
    legend_algebraic[80] = "psi_VDp in component ICaL (dimensionless)"
    legend_algebraic[81] = "psi_CD in component ICaL (dimensionless)"
    legend_algebraic[82] = "psi_CDp in component ICaL (dimensionless)"
    legend_algebraic[83] = "omega_VD in component ICaL (dimensionless)"
    legend_algebraic[84] = "omega_VDp in component ICaL (dimensionless)"
    legend_algebraic[85] = "omega_CD in component ICaL (dimensionless)"
    legend_algebraic[86] = "omega_CDp in component ICaL (dimensionless)"
    legend_algebraic[87] = "f1ss_0 in component ICaL (dimensionless)"
    legend_algebraic[88] = "tf1_0 in component ICaL (dimensionless)"
    legend_constants[180] = "ktaup in component ICaL (dimensionless)"
    legend_algebraic[89] = "gamma_VD in component ICaL (dimensionless)"
    legend_algebraic[90] = "delta_VD in component ICaL (dimensionless)"
    legend_algebraic[93] = "gamma_VDp in component ICaL (dimensionless)"
    legend_algebraic[94] = "delta_VDp in component ICaL (dimensionless)"
    legend_constants[63] = "kCDI in component ICaL (dimensionless)"
    legend_algebraic[95] = "gamma_CD in component ICaL (dimensionless)"
    legend_algebraic[96] = "delta_CD in component ICaL (dimensionless)"
    legend_algebraic[99] = "gamma_CDp in component ICaL (dimensionless)"
    legend_algebraic[100] = "delta_CDp in component ICaL (dimensionless)"
    legend_algebraic[91] = "tf1_VD in component ICaL (dimensionless)"
    legend_algebraic[97] = "tf1_CD in component ICaL (dimensionless)"
    legend_algebraic[92] = "f1ss_VD in component ICaL (dimensionless)"
    legend_algebraic[98] = "f1ss_CD in component ICaL (dimensionless)"
    legend_algebraic[101] = "tf2_new in component ICaL (dimensionless)"
    legend_algebraic[103] = "tf2_VD in component ICaL (dimensionless)"
    legend_algebraic[106] = "tf2_CD in component ICaL (dimensionless)"
    legend_algebraic[102] = "tf2_VDp in component ICaL (dimensionless)"
    legend_algebraic[109] = "tf2_CDp in component ICaL (dimensionless)"
    legend_algebraic[104] = "theta_VD in component ICaL (dimensionless)"
    legend_algebraic[112] = "theta_CD in component ICaL (dimensionless)"
    legend_algebraic[105] = "theta_VDp in component ICaL (dimensionless)"
    legend_algebraic[113] = "theta_CDp in component ICaL (dimensionless)"
    legend_algebraic[107] = "eta_VD in component ICaL (dimensionless)"
    legend_algebraic[108] = "eta_VDp in component ICaL (dimensionless)"
    legend_algebraic[114] = "eta_CD in component ICaL (dimensionless)"
    legend_algebraic[115] = "eta_CDp in component ICaL (dimensionless)"
    legend_algebraic[110] = "tf2post_VD in component ICaL (dimensionless)"
    legend_algebraic[116] = "tf2post_CD in component ICaL (dimensionless)"
    legend_algebraic[111] = "f2ss_VD in component ICaL (dimensionless)"
    legend_algebraic[117] = "f2ss_CD in component ICaL (dimensionless)"
    legend_algebraic[118] = "PhiCaL in component ICaL (coulomb_per_metre_3)"
    legend_algebraic[119] = "PhiCaNa in component ICaL (coulomb_per_metre_3)"
    legend_algebraic[120] = "PhiCaK in component ICaL (coulomb_per_metre_3)"
    legend_constants[208] = "PCa in component ICaL (dimensionless)"
    legend_constants[209] = "PCap in component ICaL (dimensionless)"
    legend_constants[210] = "PCaNa in component ICaL (dimensionless)"
    legend_constants[211] = "PCaK in component ICaL (dimensionless)"
    legend_constants[212] = "PCaNap in component ICaL (dimensionless)"
    legend_constants[213] = "PCaKp in component ICaL (dimensionless)"
    legend_constants[64] = "PCa_b in component ICaL (dimensionless)"
    legend_states[26] = "I1k in component ICaL (dimensionless)"
    legend_states[27] = "I2k in component ICaL (dimensionless)"
    legend_states[28] = "Ck in component ICaL (dimensionless)"
    legend_states[29] = "I1kp in component ICaL (dimensionless)"
    legend_states[30] = "I2kp in component ICaL (dimensionless)"
    legend_states[31] = "Ckp in component ICaL (dimensionless)"
    legend_states[32] = "I1Cak in component ICaL (dimensionless)"
    legend_states[33] = "I2Cak in component ICaL (dimensionless)"
    legend_states[34] = "CCak in component ICaL (dimensionless)"
    legend_states[35] = "I1Cakp in component ICaL (dimensionless)"
    legend_states[36] = "I2Cakp in component ICaL (dimensionless)"
    legend_states[37] = "CCakp in component ICaL (dimensionless)"
    legend_states[38] = "Ok in component ICaL (dimensionless)"
    legend_states[39] = "Okp in component ICaL (dimensionless)"
    legend_algebraic[121] = "OCak in component ICaL (dimensionless)"
    legend_algebraic[122] = "OCakp in component ICaL (dimensionless)"
    legend_algebraic[123] = "ICaL_VD in component ICaL (dimensionless)"
    legend_algebraic[124] = "ICaL_VDp in component ICaL (dimensionless)"
    legend_algebraic[126] = "ICaL_CD in component ICaL (dimensionless)"
    legend_algebraic[127] = "ICaL_CDp in component ICaL (dimensionless)"
    legend_algebraic[129] = "ICaNa_VD in component ICaL (dimensionless)"
    legend_algebraic[130] = "ICaNa_VDp in component ICaL (dimensionless)"
    legend_algebraic[131] = "ICaNa_CD in component ICaL (dimensionless)"
    legend_algebraic[132] = "ICaNa_CDp in component ICaL (dimensionless)"
    legend_algebraic[133] = "ICaK_VD in component ICaL (dimensionless)"
    legend_algebraic[134] = "ICaK_VDp in component ICaL (dimensionless)"
    legend_algebraic[135] = "ICaK_CD in component ICaL (dimensionless)"
    legend_algebraic[136] = "ICaK_CDp in component ICaL (dimensionless)"
    legend_algebraic[137] = "ICaLnp in component ICaL (dimensionless)"
    legend_algebraic[138] = "ICaLp in component ICaL (dimensionless)"
    legend_algebraic[125] = "ICaLVD in component ICaL (dimensionless)"
    legend_algebraic[128] = "ICaLCD in component ICaL (dimensionless)"
    legend_algebraic[139] = "ICaNanp in component ICaL (dimensionless)"
    legend_algebraic[140] = "ICaNap in component ICaL (dimensionless)"
    legend_algebraic[141] = "ICaKnp in component ICaL (dimensionless)"
    legend_algebraic[142] = "ICaKp in component ICaL (dimensionless)"
    legend_algebraic[63] = "fICaLp in component ICaL (dimensionless)"
    legend_constants[65] = "bGCaL in component ICaL (dimensionless)"
    legend_algebraic[144] = "gICaL in component ICaL (microF)"
    legend_constants[66] = "GKr_b in component IKr (milliS_per_microF)"
    legend_states[40] = "IC1 in component IKr (dimensionless)"
    legend_states[41] = "IC2 in component IKr (dimensionless)"
    legend_states[42] = "C1 in component IKr (dimensionless)"
    legend_states[43] = "C2 in component IKr (dimensionless)"
    legend_states[44] = "O in component IKr (dimensionless)"
    legend_states[45] = "IO in component IKr (dimensionless)"
    legend_states[46] = "IObound in component IKr (dimensionless)"
    legend_states[47] = "Obound in component IKr (dimensionless)"
    legend_states[48] = "Cbound in component IKr (dimensionless)"
    legend_states[49] = "D in component IKr (dimensionless)"
    legend_constants[181] = "GKr in component IKr (milliS_per_microF)"
    legend_constants[199] = "GKr_total in component IKr (milliS_per_microF)"
    legend_constants[67] = "A1 in component IKr (per_millisecond)"
    legend_constants[68] = "B1 in component IKr (per_millivolt)"
    legend_constants[69] = "q1 in component IKr (dimensionless)"
    legend_constants[70] = "A2 in component IKr (per_millisecond)"
    legend_constants[71] = "B2 in component IKr (per_millivolt)"
    legend_constants[72] = "q2 in component IKr (dimensionless)"
    legend_constants[73] = "A3 in component IKr (per_millisecond)"
    legend_constants[74] = "B3 in component IKr (per_millivolt)"
    legend_constants[75] = "q3 in component IKr (dimensionless)"
    legend_constants[76] = "A4 in component IKr (per_millisecond)"
    legend_constants[77] = "B4 in component IKr (per_millivolt)"
    legend_constants[78] = "q4 in component IKr (dimensionless)"
    legend_constants[79] = "A11 in component IKr (per_millisecond)"
    legend_constants[80] = "B11 in component IKr (per_millivolt)"
    legend_constants[81] = "q11 in component IKr (dimensionless)"
    legend_constants[82] = "A21 in component IKr (per_millisecond)"
    legend_constants[83] = "B21 in component IKr (per_millivolt)"
    legend_constants[84] = "q21 in component IKr (dimensionless)"
    legend_constants[85] = "A31 in component IKr (per_millisecond)"
    legend_constants[86] = "B31 in component IKr (per_millivolt)"
    legend_constants[87] = "q31 in component IKr (dimensionless)"
    legend_constants[88] = "A41 in component IKr (per_millisecond)"
    legend_constants[89] = "B41 in component IKr (per_millivolt)"
    legend_constants[90] = "q41 in component IKr (dimensionless)"
    legend_constants[91] = "A51 in component IKr (per_millisecond)"
    legend_constants[92] = "B51 in component IKr (per_millivolt)"
    legend_constants[93] = "q51 in component IKr (dimensionless)"
    legend_constants[94] = "A52 in component IKr (per_millisecond)"
    legend_constants[95] = "B52 in component IKr (per_millivolt)"
    legend_constants[96] = "q52 in component IKr (dimensionless)"
    legend_constants[97] = "A53 in component IKr (per_millisecond)"
    legend_constants[98] = "B53 in component IKr (per_millivolt)"
    legend_constants[99] = "q53 in component IKr (dimensionless)"
    legend_constants[100] = "A61 in component IKr (per_millisecond)"
    legend_constants[101] = "B61 in component IKr (per_millivolt)"
    legend_constants[102] = "q61 in component IKr (dimensionless)"
    legend_constants[103] = "A62 in component IKr (per_millisecond)"
    legend_constants[104] = "B62 in component IKr (per_millivolt)"
    legend_constants[105] = "q62 in component IKr (dimensionless)"
    legend_constants[106] = "A63 in component IKr (per_millisecond)"
    legend_constants[107] = "B63 in component IKr (per_millivolt)"
    legend_constants[108] = "q63 in component IKr (dimensionless)"
    legend_constants[109] = "Kmax in component IKr (dimensionless)"
    legend_constants[110] = "Ku in component IKr (per_millisecond)"
    legend_constants[111] = "n in component IKr (dimensionless)"
    legend_constants[112] = "halfmax in component IKr (dimensionless)"
    legend_constants[113] = "Kt in component IKr (per_millisecond)"
    legend_constants[114] = "Vhalf in component IKr (millivolt)"
    legend_constants[115] = "Temp in component IKr (kelvin)"
    legend_constants[116] = "bGKr in component IKr (dimensionless)"
    legend_constants[117] = "GKs_b in component IKs (milliS_per_microF)"
    legend_constants[118] = "bGKs in component IKs (milliS_per_microF)"
    legend_constants[119] = "EKshift in component IKs (millivolt)"
    legend_constants[182] = "GKs in component IKs (milliS_per_microF)"
    legend_algebraic[9] = "xs1ss in component IKs (dimensionless)"
    legend_algebraic[23] = "xs2ss in component IKs (dimensionless)"
    legend_algebraic[24] = "txs1 in component IKs (millisecond)"
    legend_constants[120] = "txs1_max in component IKs (millisecond)"
    legend_states[50] = "xs1 in component IKs (dimensionless)"
    legend_states[51] = "xs2 in component IKs (dimensionless)"
    legend_algebraic[148] = "KsCa in component IKs (dimensionless)"
    legend_algebraic[32] = "txs2 in component IKs (millisecond)"
    legend_constants[183] = "GK1 in component IK1 (milliS_per_microF)"
    legend_constants[121] = "GK1_b in component IK1 (milliS_per_microF)"
    legend_constants[122] = "bGK1 in component IK1 (dimensionless)"
    legend_constants[123] = "EKshift in component IK1 (millivolt)"
    legend_algebraic[10] = "xk1ss in component IK1 (dimensionless)"
    legend_algebraic[25] = "txk1 in component IK1 (millisecond)"
    legend_states[52] = "xk1 in component IK1 (dimensionless)"
    legend_algebraic[150] = "rk1 in component IK1 (millisecond)"
    legend_constants[124] = "kslope_rk1 in component IK1 (dimensionless)"
    legend_constants[125] = "kna1 in component INaCa_i (per_millisecond)"
    legend_constants[126] = "kna2 in component INaCa_i (per_millisecond)"
    legend_constants[127] = "kna3 in component INaCa_i (per_millisecond)"
    legend_constants[128] = "kasymm in component INaCa_i (dimensionless)"
    legend_constants[129] = "wna in component INaCa_i (dimensionless)"
    legend_constants[130] = "wca in component INaCa_i (dimensionless)"
    legend_constants[131] = "wnaca in component INaCa_i (dimensionless)"
    legend_constants[132] = "kcaon in component INaCa_i (per_millisecond)"
    legend_constants[133] = "kcaoff in component INaCa_i (per_millisecond)"
    legend_constants[134] = "qna in component INaCa_i (dimensionless)"
    legend_constants[135] = "qca in component INaCa_i (dimensionless)"
    legend_algebraic[153] = "hna in component INaCa_i (dimensionless)"
    legend_algebraic[152] = "hca in component INaCa_i (dimensionless)"
    legend_constants[136] = "KmCaAct in component INaCa_i (millimolar)"
    legend_constants[137] = "Gncx_b in component INaCa_i (milliS_per_microF)"
    legend_constants[138] = "bGncx in component INaCa_i (dimensionless)"
    legend_constants[220] = "Gncx in component INaCa_i (milliS_per_microF)"
    legend_algebraic[154] = "h1_i in component INaCa_i (dimensionless)"
    legend_algebraic[155] = "h2_i in component INaCa_i (dimensionless)"
    legend_algebraic[156] = "h3_i in component INaCa_i (dimensionless)"
    legend_algebraic[157] = "h4_i in component INaCa_i (dimensionless)"
    legend_algebraic[158] = "h5_i in component INaCa_i (dimensionless)"
    legend_algebraic[159] = "h6_i in component INaCa_i (dimensionless)"
    legend_algebraic[160] = "h7_i in component INaCa_i (dimensionless)"
    legend_algebraic[161] = "h8_i in component INaCa_i (dimensionless)"
    legend_algebraic[162] = "h9_i in component INaCa_i (dimensionless)"
    legend_constants[214] = "h10_i in component INaCa_i (dimensionless)"
    legend_constants[215] = "h11_i in component INaCa_i (dimensionless)"
    legend_constants[216] = "h12_i in component INaCa_i (dimensionless)"
    legend_constants[217] = "k1_i in component INaCa_i (dimensionless)"
    legend_constants[218] = "k2_i in component INaCa_i (dimensionless)"
    legend_algebraic[163] = "k3p_i in component INaCa_i (dimensionless)"
    legend_algebraic[164] = "k3pp_i in component INaCa_i (dimensionless)"
    legend_algebraic[165] = "k3_i in component INaCa_i (dimensionless)"
    legend_algebraic[168] = "k4_i in component INaCa_i (dimensionless)"
    legend_algebraic[166] = "k4p_i in component INaCa_i (dimensionless)"
    legend_algebraic[167] = "k4pp_i in component INaCa_i (dimensionless)"
    legend_constants[219] = "k5_i in component INaCa_i (dimensionless)"
    legend_algebraic[169] = "k6_i in component INaCa_i (dimensionless)"
    legend_algebraic[170] = "k7_i in component INaCa_i (dimensionless)"
    legend_algebraic[171] = "k8_i in component INaCa_i (dimensionless)"
    legend_algebraic[172] = "x1_i in component INaCa_i (dimensionless)"
    legend_algebraic[173] = "x2_i in component INaCa_i (dimensionless)"
    legend_algebraic[174] = "x3_i in component INaCa_i (dimensionless)"
    legend_algebraic[175] = "x4_i in component INaCa_i (dimensionless)"
    legend_algebraic[176] = "E1_i in component INaCa_i (dimensionless)"
    legend_algebraic[177] = "E2_i in component INaCa_i (dimensionless)"
    legend_algebraic[178] = "E3_i in component INaCa_i (dimensionless)"
    legend_algebraic[179] = "E4_i in component INaCa_i (dimensionless)"
    legend_algebraic[180] = "allo_i in component INaCa_i (dimensionless)"
    legend_algebraic[181] = "JncxNa_i in component INaCa_i (millimolar_per_millisecond)"
    legend_algebraic[182] = "JncxCa_i in component INaCa_i (millimolar_per_millisecond)"
    legend_algebraic[184] = "h1_ss in component INaCa_i (dimensionless)"
    legend_algebraic[185] = "h2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[186] = "h3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[187] = "h4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[188] = "h5_ss in component INaCa_i (dimensionless)"
    legend_algebraic[189] = "h6_ss in component INaCa_i (dimensionless)"
    legend_algebraic[190] = "h7_ss in component INaCa_i (dimensionless)"
    legend_algebraic[191] = "h8_ss in component INaCa_i (dimensionless)"
    legend_algebraic[192] = "h9_ss in component INaCa_i (dimensionless)"
    legend_constants[221] = "h10_ss in component INaCa_i (dimensionless)"
    legend_constants[222] = "h11_ss in component INaCa_i (dimensionless)"
    legend_constants[223] = "h12_ss in component INaCa_i (dimensionless)"
    legend_constants[224] = "k1_ss in component INaCa_i (dimensionless)"
    legend_constants[225] = "k2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[193] = "k3p_ss in component INaCa_i (dimensionless)"
    legend_algebraic[194] = "k3pp_ss in component INaCa_i (dimensionless)"
    legend_algebraic[195] = "k3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[198] = "k4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[196] = "k4p_ss in component INaCa_i (dimensionless)"
    legend_algebraic[197] = "k4pp_ss in component INaCa_i (dimensionless)"
    legend_constants[226] = "k5_ss in component INaCa_i (dimensionless)"
    legend_algebraic[199] = "k6_ss in component INaCa_i (dimensionless)"
    legend_algebraic[200] = "k7_ss in component INaCa_i (dimensionless)"
    legend_algebraic[201] = "k8_ss in component INaCa_i (dimensionless)"
    legend_algebraic[202] = "x1_ss in component INaCa_i (dimensionless)"
    legend_algebraic[203] = "x2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[204] = "x3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[205] = "x4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[206] = "E1_ss in component INaCa_i (dimensionless)"
    legend_algebraic[207] = "E2_ss in component INaCa_i (dimensionless)"
    legend_algebraic[208] = "E3_ss in component INaCa_i (dimensionless)"
    legend_algebraic[209] = "E4_ss in component INaCa_i (dimensionless)"
    legend_algebraic[210] = "allo_ss in component INaCa_i (dimensionless)"
    legend_algebraic[211] = "JncxNa_ss in component INaCa_i (millimolar_per_millisecond)"
    legend_algebraic[212] = "JncxCa_ss in component INaCa_i (millimolar_per_millisecond)"
    legend_constants[139] = "k1p in component INaK (per_millisecond)"
    legend_constants[140] = "k1m in component INaK (per_millisecond)"
    legend_constants[141] = "k2p in component INaK (per_millisecond)"
    legend_constants[142] = "k2m in component INaK (per_millisecond)"
    legend_constants[143] = "k3p in component INaK (per_millisecond)"
    legend_constants[144] = "k3m in component INaK (per_millisecond)"
    legend_constants[145] = "k4p in component INaK (per_millisecond)"
    legend_constants[146] = "k4m in component INaK (per_millisecond)"
    legend_constants[147] = "Knai0 in component INaK (millimolar)"
    legend_constants[148] = "Knao0 in component INaK (millimolar)"
    legend_constants[149] = "delta in component INaK (millivolt)"
    legend_constants[150] = "Kki in component INaK (per_millisecond)"
    legend_constants[151] = "Kko in component INaK (per_millisecond)"
    legend_constants[152] = "MgADP in component INaK (millimolar)"
    legend_constants[153] = "MgATP in component INaK (millimolar)"
    legend_constants[154] = "Kmgatp in component INaK (millimolar)"
    legend_constants[155] = "H in component INaK (millimolar)"
    legend_constants[156] = "eP in component INaK (dimensionless)"
    legend_constants[157] = "Khp in component INaK (millimolar)"
    legend_constants[158] = "Knap in component INaK (millimolar)"
    legend_constants[159] = "Kxkur in component INaK (millimolar)"
    legend_constants[160] = "Pnak_b in component INaK (milliS_per_microF)"
    legend_constants[230] = "Pnak in component INaK (milliS_per_microF)"
    legend_constants[161] = "bGnak in component INaK (dimensionless)"
    legend_algebraic[214] = "Knai in component INaK (millimolar)"
    legend_algebraic[215] = "Knao in component INaK (millimolar)"
    legend_algebraic[216] = "P in component INaK (dimensionless)"
    legend_algebraic[217] = "a1 in component INaK (dimensionless)"
    legend_constants[227] = "b1 in component INaK (dimensionless)"
    legend_constants[228] = "a2 in component INaK (dimensionless)"
    legend_algebraic[218] = "b2 in component INaK (dimensionless)"
    legend_algebraic[219] = "a3 in component INaK (dimensionless)"
    legend_algebraic[220] = "b3 in component INaK (dimensionless)"
    legend_constants[229] = "a4 in component INaK (dimensionless)"
    legend_algebraic[221] = "b4 in component INaK (dimensionless)"
    legend_algebraic[222] = "x1 in component INaK (dimensionless)"
    legend_algebraic[223] = "x2 in component INaK (dimensionless)"
    legend_algebraic[224] = "x3 in component INaK (dimensionless)"
    legend_algebraic[225] = "x4 in component INaK (dimensionless)"
    legend_algebraic[226] = "E1 in component INaK (dimensionless)"
    legend_algebraic[227] = "E2 in component INaK (dimensionless)"
    legend_algebraic[228] = "E3 in component INaK (dimensionless)"
    legend_algebraic[229] = "E4 in component INaK (dimensionless)"
    legend_algebraic[230] = "JnakNa in component INaK (millimolar_per_millisecond)"
    legend_algebraic[231] = "JnakK in component INaK (millimolar_per_millisecond)"
    legend_algebraic[233] = "xkb in component IKb (dimensionless)"
    legend_constants[162] = "GKb_b in component IKb (milliS_per_microF)"
    legend_constants[185] = "GKb in component IKb (milliS_per_microF)"
    legend_constants[163] = "PNab in component INab (milliS_per_microF)"
    legend_constants[164] = "PCab in component ICab (milliS_per_microF)"
    legend_constants[165] = "undo_ICab in component ICab (dimensionless)"
    legend_constants[166] = "GpCa in component IpCa (milliS_per_microF)"
    legend_constants[167] = "KmCap in component IpCa (millimolar)"
    legend_constants[168] = "RyRa1 in component ryr (micromolar)"
    legend_constants[169] = "RyRa2 in component ryr (micromolar)"
    legend_constants[186] = "RyRohalf in component ryr (micromolar)"
    legend_constants[187] = "RyRchalf in component ryr (micromolar)"
    legend_algebraic[241] = "RyRSRCass in component ryr (dimensionless)"
    legend_algebraic[11] = "RyRainfss in component ryr (micromolar)"
    legend_constants[188] = "RyRtauadapt in component ryr (millisecond)"
    legend_states[53] = "RyRa in component ryr (micromolar)"
    legend_algebraic[12] = "RyRoinfss in component ryr (dimensionless)"
    legend_constants[189] = "RyRtauact in component ryr (millisecond)"
    legend_algebraic[13] = "RyRcinfss in component ryr (dimensionless)"
    legend_states[54] = "RyRo in component ryr (dimensionless)"
    legend_constants[190] = "RyRtauinact in component ryr (millisecond)"
    legend_states[55] = "RyRc in component ryr (dimensionless)"
    legend_constants[201] = "RyRtauinactp in component ryr (millisecond)"
    legend_states[56] = "RyRcp in component ryr (dimensionless)"
    legend_algebraic[242] = "fJrelp in component ryr (dimensionless)"
    legend_algebraic[243] = "Jrelnp in component ryr (millimolar_per_millisecond)"
    legend_algebraic[244] = "Jrelp in component ryr (millimolar_per_millisecond)"
    legend_constants[170] = "g_irel_max in component ryr (millimolar_per_second)"
    legend_constants[191] = "g_irel_max_M in component ryr (per_second)"
    legend_constants[192] = "g_irel_max_p in component ryr (per_second)"
    legend_constants[193] = "upScale in component SERCA (dimensionless)"
    legend_algebraic[246] = "Jupnp in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[247] = "Jupp in component SERCA (millimolar_per_millisecond)"
    legend_algebraic[248] = "fJupp in component SERCA (dimensionless)"
    legend_constants[171] = "Jup_b in component SERCA (dimensionless)"
    legend_constants[172] = "cJup in component SERCA (dimensionless)"
    legend_constants[194] = "Vmax_SRCaP in component SERCA (millimolar_per_millisecond)"
    legend_constants[195] = "Kmf in component SERCA (millimolar)"
    legend_constants[196] = "Kmr in component SERCA (millimolar)"
    legend_constants[197] = "hillSRCaP in component SERCA (millimolar)"
    legend_algebraic[14] = "Jup2 in component SERCA (millimolar_per_millisecond)"
    legend_rates[0] = "d/dt v in component membrane (millivolt)"
    legend_rates[1] = "d/dt CaMKt in component CaMK (millimolar)"
    legend_rates[3] = "d/dt nai in component intracellular_ions (millimolar)"
    legend_rates[4] = "d/dt 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[8] = "d/dt cai in component intracellular_ions (millimolar)"
    legend_rates[2] = "d/dt cass in component intracellular_ions (millimolar)"
    legend_rates[7] = "d/dt casr in component intracellular_ions (millimolar)"
    legend_rates[9] = "d/dt m in component INa (dimensionless)"
    legend_rates[10] = "d/dt hf in component INa (dimensionless)"
    legend_rates[11] = "d/dt hs in component INa (dimensionless)"
    legend_rates[12] = "d/dt j in component INa (dimensionless)"
    legend_rates[13] = "d/dt hsp in component INa (dimensionless)"
    legend_rates[14] = "d/dt jp in component INa (dimensionless)"
    legend_rates[15] = "d/dt mL in component INaL (dimensionless)"
    legend_rates[16] = "d/dt hL in component INaL (dimensionless)"
    legend_rates[17] = "d/dt hLp in component INaL (dimensionless)"
    legend_rates[18] = "d/dt a in component Ito (dimensionless)"
    legend_rates[19] = "d/dt iF in component Ito (dimensionless)"
    legend_rates[20] = "d/dt iS in component Ito (dimensionless)"
    legend_rates[21] = "d/dt ap in component Ito (dimensionless)"
    legend_rates[22] = "d/dt iFp in component Ito (dimensionless)"
    legend_rates[23] = "d/dt iSp in component Ito (dimensionless)"
    legend_rates[25] = "d/dt jnca in component ICaL (dimensionless)"
    legend_rates[24] = "d/dt nca in component ICaL (dimensionless)"
    legend_rates[38] = "d/dt Ok in component ICaL (dimensionless)"
    legend_rates[27] = "d/dt I2k in component ICaL (dimensionless)"
    legend_rates[26] = "d/dt I1k in component ICaL (dimensionless)"
    legend_rates[28] = "d/dt Ck in component ICaL (dimensionless)"
    legend_rates[39] = "d/dt Okp in component ICaL (dimensionless)"
    legend_rates[30] = "d/dt I2kp in component ICaL (dimensionless)"
    legend_rates[29] = "d/dt I1kp in component ICaL (dimensionless)"
    legend_rates[31] = "d/dt Ckp in component ICaL (dimensionless)"
    legend_rates[33] = "d/dt I2Cak in component ICaL (dimensionless)"
    legend_rates[32] = "d/dt I1Cak in component ICaL (dimensionless)"
    legend_rates[34] = "d/dt CCak in component ICaL (dimensionless)"
    legend_rates[36] = "d/dt I2Cakp in component ICaL (dimensionless)"
    legend_rates[35] = "d/dt I1Cakp in component ICaL (dimensionless)"
    legend_rates[37] = "d/dt CCakp in component ICaL (dimensionless)"
    legend_rates[40] = "d/dt IC1 in component IKr (dimensionless)"
    legend_rates[41] = "d/dt IC2 in component IKr (dimensionless)"
    legend_rates[42] = "d/dt C1 in component IKr (dimensionless)"
    legend_rates[43] = "d/dt C2 in component IKr (dimensionless)"
    legend_rates[44] = "d/dt O in component IKr (dimensionless)"
    legend_rates[45] = "d/dt IO in component IKr (dimensionless)"
    legend_rates[46] = "d/dt IObound in component IKr (dimensionless)"
    legend_rates[47] = "d/dt Obound in component IKr (dimensionless)"
    legend_rates[48] = "d/dt Cbound in component IKr (dimensionless)"
    legend_rates[49] = "d/dt D in component IKr (dimensionless)"
    legend_rates[50] = "d/dt xs1 in component IKs (dimensionless)"
    legend_rates[51] = "d/dt xs2 in component IKs (dimensionless)"
    legend_rates[52] = "d/dt xk1 in component IK1 (dimensionless)"
    legend_rates[53] = "d/dt RyRa in component ryr (micromolar)"
    legend_rates[54] = "d/dt RyRo in component ryr (dimensionless)"
    legend_rates[55] = "d/dt RyRc in component ryr (dimensionless)"
    legend_rates[56] = "d/dt RyRcp 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] = 144
    constants[2] = 2.7
    constants[3] = 5.4
    constants[4] = 8314.0
    constants[5] = 310.0
    constants[6] = 96485.0
    constants[7] = 1.0
    constants[8] = 2.0
    constants[9] = 1.0
    constants[10] = 0.01
    constants[11] = 0.0011
    states[0] = -87
    constants[12] = 3
    constants[13] = 0
    constants[14] = 999000
    constants[15] = -53
    constants[16] = 1000
    constants[17] = 1
    constants[18] = 0.15
    constants[19] = 0.05
    constants[20] = 0.00068
    constants[21] = 0.05
    constants[22] = 0.0015
    states[1] = 0
    states[2] = 1.0e-04
    constants[23] = 0.05
    constants[24] = 0.00238
    constants[25] = 0.07
    constants[26] = 0.0005
    constants[27] = 0.047
    constants[28] = 0.00087
    constants[29] = 1.124
    constants[30] = 0.0087
    constants[31] = 1.0
    constants[32] = 0.8
    states[3] = 7
    states[4] = 7
    states[5] = 145
    states[6] = 145
    constants[33] = 1.50490908825974
    constants[34] = 0.821364973867864
    states[7] = 1.2
    states[8] = 1.0e-04
    constants[35] = 1
    constants[36] = 0.01833
    constants[37] = 8
    constants[38] = 1
    constants[39] = 0.27
    constants[40] = 39.57
    constants[41] = 9.871
    constants[42] = 11.64
    constants[43] = 34.77
    constants[44] = 6.765
    constants[45] = 8.552
    constants[46] = 77.42
    constants[47] = 5.955
    states[9] = 0
    constants[48] = 78.5
    constants[49] = 6.22
    constants[50] = 0.99
    states[10] = 1
    states[11] = 1
    constants[51] = 75
    states[12] = 1
    states[13] = 1
    states[14] = 1
    constants[52] = 2.8
    constants[53] = 1
    states[15] = 0
    states[16] = 1
    states[17] = 1
    constants[54] = 0.0075
    constants[55] = 1
    constants[56] = 0.02
    states[18] = 0
    states[19] = 1
    states[20] = 1
    states[21] = 0
    states[22] = 1
    states[23] = 1
    constants[57] = 8
    constants[58] = 0
    states[24] = 0
    constants[59] = 1
    states[25] = 1
    constants[60] = 0.05
    constants[61] = 1000
    constants[62] = 0.05
    constants[63] = 9
    constants[64] = 0.0001
    states[26] = 0
    states[27] = 0
    states[28] = 1
    states[29] = 0
    states[30] = 0
    states[31] = 1
    states[32] = 0
    states[33] = 0
    states[34] = 0
    states[35] = 0
    states[36] = 0
    states[37] = 0
    states[38] = 0
    states[39] = 0
    constants[65] = 1
    constants[66] = 0.046
    states[40] = 0.999637
    states[41] = 6.83208e-05
    states[42] = 1.80145e-08
    states[43] = 8.26619e-05
    states[44] = 0.00015551
    states[45] = 5.67623e-05
    states[46] = 0
    states[47] = 0
    states[48] = 0
    states[49] = 0
    constants[67] = 0.0264
    constants[68] = 4.631e-05
    constants[69] = 4.843
    constants[70] = 4.986e-06
    constants[71] = -0.004226
    constants[72] = 4.23
    constants[73] = 0.001214
    constants[74] = 0.008516
    constants[75] = 4.962
    constants[76] = 1.854e-05
    constants[77] = -0.04641
    constants[78] = 3.769
    constants[79] = 0.0007868
    constants[80] = 1.535e-08
    constants[81] = 4.942
    constants[82] = 5.455e-06
    constants[83] = -0.1688
    constants[84] = 4.156
    constants[85] = 0.005509
    constants[86] = 7.771e-09
    constants[87] = 4.22
    constants[88] = 0.001416
    constants[89] = -0.02877
    constants[90] = 1.459
    constants[91] = 0.4492
    constants[92] = 0.008595
    constants[93] = 5.0
    constants[94] = 0.3181
    constants[95] = 3.613e-08
    constants[96] = 4.663
    constants[97] = 0.149
    constants[98] = 0.004668
    constants[99] = 2.412
    constants[100] = 0.01241
    constants[101] = 0.1725
    constants[102] = 5.568
    constants[103] = 0.3226
    constants[104] = -0.0006575
    constants[105] = 5.0
    constants[106] = 0.008978
    constants[107] = -0.02215
    constants[108] = 5.682
    constants[109] = 0
    constants[110] = 0
    constants[111] = 1.0
    constants[112] = 1
    constants[113] = 3.5e-5
    constants[114] = 1.0
    constants[115] = 310.0
    constants[116] = 1.2
    constants[117] = 0.0034
    constants[118] = 2
    constants[119] = 8
    constants[120] = 817.3
    states[50] = 0
    states[51] = 0
    constants[121] = 0.1908
    constants[122] = 0.71
    constants[123] = 8
    states[52] = 1
    constants[124] = 1.09
    constants[125] = 15.0
    constants[126] = 5.0
    constants[127] = 88.12
    constants[128] = 12.5
    constants[129] = 60000
    constants[130] = 60000
    constants[131] = 5000
    constants[132] = 1500000
    constants[133] = 5000
    constants[134] = 0.5224
    constants[135] = 0.1670
    constants[136] = 150e-06
    constants[137] = 0.0008
    constants[138] = 2.4
    constants[139] = 949.5
    constants[140] = 182.4
    constants[141] = 687.2
    constants[142] = 39.4
    constants[143] = 1899.0
    constants[144] = 79300.0
    constants[145] = 639.0
    constants[146] = 40.0
    constants[147] = 9.073
    constants[148] = 27.78
    constants[149] = -0.1550
    constants[150] = 0.5
    constants[151] = 0.3582
    constants[152] = 0.05
    constants[153] = 9.8
    constants[154] = 1.698e-7
    constants[155] = 1e-7
    constants[156] = 4.2
    constants[157] = 1.698e-7
    constants[158] = 224.0
    constants[159] = 292.0
    constants[160] = 30
    constants[161] = 2
    constants[162] = 0.003
    constants[163] = 3.75e-10
    constants[164] = 2.5e-8
    constants[165] = 0
    constants[166] = 0.0005
    constants[167] = 0.0005
    constants[168] = 0.05
    constants[169] = 0.03
    states[53] = 0.03
    states[54] = 0
    states[55] = 1
    states[56] = 1
    constants[170] = 0.02
    constants[171] = 1
    constants[172] = 3.13
    constants[173] = custom_piecewise([equal(constants[0] , 1.00000), constants[23]*1.20000 , True, constants[23]])
    constants[174] = 0.00000
    constants[175] = 1.00000-constants[50]
    constants[176] = 200.000*constants[53]
    constants[177] = custom_piecewise([equal(constants[0] , 1.00000), constants[54]*constants[52]*0.700000 , True, constants[54]*constants[52]])
    constants[178] = custom_piecewise([equal(constants[0] , 1.00000), constants[55]*constants[56]*4.00000 , equal(constants[0] , 2.00000), constants[55]*constants[56]*4.00000 , True, constants[56]*constants[55]])
    constants[179] = 0.100000*(1.00000-constants[58])
    constants[180] = 2.50000
    constants[181] = custom_piecewise([equal(constants[0] , 1.00000), constants[66]*constants[116]*1.10000 , equal(constants[0] , 2.00000), constants[66]*constants[116]*0.800000 , True, constants[66]*constants[116]])
    constants[182] = custom_piecewise([equal(constants[0] , 1.00000), constants[118]*constants[117]*1.40000 , True, constants[118]*constants[117]])
    constants[183] = custom_piecewise([equal(constants[0] , 1.00000), constants[122]*constants[121]*1.20000 , equal(constants[0] , 2.00000), constants[122]*constants[121]*1.30000 , True, constants[122]*constants[121]])
    constants[184] = 1000.00*3.14160*constants[11]*constants[11]*constants[10]
    constants[185] = custom_piecewise([equal(constants[0] , 1.00000), constants[162]*0.600000 , True, constants[162]])
    constants[186] = 0.120000-(constants[168]-constants[169]/2.00000)
    constants[187] = 0.100000-(constants[168]-constants[169]/2.00000)
    constants[188] = 1000.00
    constants[189] = 1.87500/1.87500
    constants[190] = (2.00000*87.5000)/10.0000
    constants[191] = constants[170]*1.70000
    constants[192] = constants[170]*1.25000
    constants[193] = custom_piecewise([equal(constants[0] , 1.00000), 1.30000 , True, 1.00000])
    constants[194] = 1.00000*0.00531140
    constants[195] = 0.000246000
    constants[196] = 1.70000
    constants[197] = 1.78700
    constants[231] = 0.00000
    constants[198] = 3.00000*constants[176]
    constants[199] = constants[181]*(power(constants[3]/5.40000, 1.0/2))
    constants[200] = 2.00000*3.14160*constants[11]*constants[11]+2.00000*3.14160*constants[11]*constants[10]
    constants[201] = constants[190]*1.25000
    constants[202] = 2.00000*constants[200]
    constants[203] = 0.680000*constants[184]
    constants[204] = 0.0552000*constants[184]
    constants[205] = 0.00480000*constants[184]
    constants[206] = 0.0200000*constants[184]
    constants[207] = 0.950000*(constants[204]+constants[205])
    constants[208] = custom_piecewise([equal(constants[0] , 1.00000), constants[64]*0.900000*1.40000 , equal(constants[0] , 2.00000), constants[64]*0.900000*2.00000 , True, constants[64]*0.900000])
    constants[209] = 1.10000*constants[208]
    constants[210] = 0.00125000*constants[208]
    constants[211] = 0.000357400*constants[208]
    constants[212] = 0.00125000*constants[209]
    constants[213] = 0.000357400*constants[209]
    constants[214] = constants[128]+1.00000+(constants[1]/constants[125])*(1.00000+constants[1]/constants[126])
    constants[215] = (constants[1]*constants[1])/(constants[214]*constants[125]*constants[126])
    constants[216] = 1.00000/constants[214]
    constants[217] = constants[216]*constants[2]*constants[132]
    constants[218] = constants[133]
    constants[219] = constants[133]
    constants[220] = custom_piecewise([equal(constants[0] , 1.00000), constants[138]*constants[137]*1.20000 , equal(constants[0] , 2.00000), constants[138]*constants[137]*1.40000 , True, constants[138]*constants[137]])
    constants[221] = constants[128]+1.00000+(constants[1]/constants[125])*(1.00000+constants[1]/constants[126])
    constants[222] = (constants[1]*constants[1])/(constants[221]*constants[125]*constants[126])
    constants[223] = 1.00000/constants[221]
    constants[224] = constants[223]*constants[2]*constants[132]
    constants[225] = constants[133]
    constants[226] = constants[133]
    constants[227] = constants[140]*constants[152]
    constants[228] = constants[141]
    constants[229] = ((constants[145]*constants[153])/constants[154])/(1.00000+constants[153]/constants[154])
    constants[230] = custom_piecewise([equal(constants[0] , 1.00000), constants[161]*constants[160]*0.900000 , equal(constants[0] , 2.00000), constants[161]*constants[160]*0.700000 , True, constants[161]*constants[160]])
    return (states, constants)

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    rates[49] = constants[231]
    rates[40] = (-(constants[79]*exp(constants[80]*states[0])*states[40]*exp(((constants[115]-293.000)*log(constants[81]))/10.0000)-constants[82]*exp(constants[83]*states[0])*states[41]*exp(((constants[115]-293.000)*log(constants[84]))/10.0000))+constants[91]*exp(constants[92]*states[0])*states[42]*exp(((constants[115]-293.000)*log(constants[93]))/10.0000))-constants[100]*exp(constants[101]*states[0])*states[40]*exp(((constants[115]-293.000)*log(constants[102]))/10.0000)
    rates[41] = (((constants[79]*exp(constants[80]*states[0])*states[40]*exp(((constants[115]-293.000)*log(constants[81]))/10.0000)-constants[82]*exp(constants[83]*states[0])*states[41]*exp(((constants[115]-293.000)*log(constants[84]))/10.0000))-(constants[73]*exp(constants[74]*states[0])*states[41]*exp(((constants[115]-293.000)*log(constants[75]))/10.0000)-constants[76]*exp(constants[77]*states[0])*states[45]*exp(((constants[115]-293.000)*log(constants[78]))/10.0000)))+constants[94]*exp(constants[95]*states[0])*states[43]*exp(((constants[115]-293.000)*log(constants[96]))/10.0000))-constants[103]*exp(constants[104]*states[0])*states[41]*exp(((constants[115]-293.000)*log(constants[105]))/10.0000)
    rates[42] = -(constants[67]*exp(constants[68]*states[0])*states[42]*exp(((constants[115]-293.000)*log(constants[69]))/10.0000)-constants[70]*exp(constants[71]*states[0])*states[43]*exp(((constants[115]-293.000)*log(constants[72]))/10.0000))-(constants[91]*exp(constants[92]*states[0])*states[42]*exp(((constants[115]-293.000)*log(constants[93]))/10.0000)-constants[100]*exp(constants[101]*states[0])*states[40]*exp(((constants[115]-293.000)*log(constants[102]))/10.0000))
    rates[43] = ((constants[67]*exp(constants[68]*states[0])*states[42]*exp(((constants[115]-293.000)*log(constants[69]))/10.0000)-constants[70]*exp(constants[71]*states[0])*states[43]*exp(((constants[115]-293.000)*log(constants[72]))/10.0000))-(constants[85]*exp(constants[86]*states[0])*states[43]*exp(((constants[115]-293.000)*log(constants[87]))/10.0000)-constants[88]*exp(constants[89]*states[0])*states[44]*exp(((constants[115]-293.000)*log(constants[90]))/10.0000)))-(constants[94]*exp(constants[95]*states[0])*states[43]*exp(((constants[115]-293.000)*log(constants[96]))/10.0000)-constants[103]*exp(constants[104]*states[0])*states[41]*exp(((constants[115]-293.000)*log(constants[105]))/10.0000))
    rates[44] = ((constants[85]*exp(constants[86]*states[0])*states[43]*exp(((constants[115]-293.000)*log(constants[87]))/10.0000)-constants[88]*exp(constants[89]*states[0])*states[44]*exp(((constants[115]-293.000)*log(constants[90]))/10.0000))-(constants[97]*exp(constants[98]*states[0])*states[44]*exp(((constants[115]-293.000)*log(constants[99]))/10.0000)-constants[106]*exp(constants[107]*states[0])*states[45]*exp(((constants[115]-293.000)*log(constants[108]))/10.0000)))-(((constants[109]*constants[110]*exp(constants[111]*log(states[49])))/(exp(constants[111]*log(states[49]))+constants[112]))*states[44]-constants[110]*states[47])
    rates[45] = (((constants[73]*exp(constants[74]*states[0])*states[41]*exp(((constants[115]-293.000)*log(constants[75]))/10.0000)-constants[76]*exp(constants[77]*states[0])*states[45]*exp(((constants[115]-293.000)*log(constants[78]))/10.0000))+constants[97]*exp(constants[98]*states[0])*states[44]*exp(((constants[115]-293.000)*log(constants[99]))/10.0000))-constants[106]*exp(constants[107]*states[0])*states[45]*exp(((constants[115]-293.000)*log(constants[108]))/10.0000))-(((constants[109]*constants[110]*exp(constants[111]*log(states[49])))/(exp(constants[111]*log(states[49]))+constants[112]))*states[45]-((constants[110]*constants[97]*exp(constants[98]*states[0])*exp(((constants[115]-293.000)*log(constants[99]))/10.0000))/(constants[106]*exp(constants[107]*states[0])*exp(((constants[115]-293.000)*log(constants[108]))/10.0000)))*states[46])
    rates[46] = ((((constants[109]*constants[110]*exp(constants[111]*log(states[49])))/(exp(constants[111]*log(states[49]))+constants[112]))*states[45]-((constants[110]*constants[97]*exp(constants[98]*states[0])*exp(((constants[115]-293.000)*log(constants[99]))/10.0000))/(constants[106]*exp(constants[107]*states[0])*exp(((constants[115]-293.000)*log(constants[108]))/10.0000)))*states[46])+(constants[113]/(1.00000+exp(-(states[0]-constants[114])/6.78900)))*states[48])-constants[113]*states[46]
    rates[47] = ((((constants[109]*constants[110]*exp(constants[111]*log(states[49])))/(exp(constants[111]*log(states[49]))+constants[112]))*states[44]-constants[110]*states[47])+(constants[113]/(1.00000+exp(-(states[0]-constants[114])/6.78900)))*states[48])-constants[113]*states[47]
    rates[48] = -((constants[113]/(1.00000+exp(-(states[0]-constants[114])/6.78900)))*states[48]-constants[113]*states[47])-((constants[113]/(1.00000+exp(-(states[0]-constants[114])/6.78900)))*states[48]-constants[113]*states[46])
    algebraic[2] = 1.00000/(1.00000+exp((states[0]+87.6100)/7.48800))
    rates[16] = (algebraic[2]-states[16])/constants[176]
    algebraic[3] = 1.00000/(1.00000+exp((states[0]+93.8100)/7.48800))
    rates[17] = (algebraic[3]-states[17])/constants[198]
    algebraic[6] = 1.00000/(1.00000+exp((states[0]+19.5800+25.0000)/3.69600))
    rates[25] = (algebraic[6]-states[25])/constants[59]
    algebraic[11] = constants[168]-constants[169]/(1.00000+exp((1000.00*states[2]-0.0430000)/0.00820000))
    rates[53] = (algebraic[11]-states[53])/constants[188]
    algebraic[12] = 1.00000-1.00000/(1.00000+exp((1000.00*states[2]-(states[53]+constants[186]))/0.00300000))
    rates[54] = (algebraic[12]-states[54])/constants[189]
    algebraic[13] = 1.00000/(1.00000+exp((1000.00*states[2]-(states[53]+constants[187]))/0.00100000))
    rates[55] = (algebraic[13]-states[55])/constants[190]
    rates[56] = (algebraic[13]-states[56])/constants[201]
    algebraic[0] = 1.00000/(1.00000+exp(-(states[0]+constants[40])/constants[41]))
    algebraic[15] = 1.00000/(constants[44]*exp((states[0]+constants[42])/constants[43])+constants[45]*exp(-(states[0]+constants[46])/constants[47]))
    rates[9] = (algebraic[0]-states[9])/algebraic[15]
    algebraic[1] = 1.00000/(1.00000+exp((states[0]+constants[48])/constants[49]))
    algebraic[16] = 1.00000/(3.68600e-06*exp(-(states[0]+3.88750)/7.85790)+16.0000*exp((states[0]-0.496300)/9.18430))+0.0750000
    rates[10] = (algebraic[1]-states[10])/algebraic[16]
    algebraic[17] = 1.00000/(0.00979400*exp(-(states[0]+17.9500)/28.0500)+0.334300*exp((states[0]+5.73000)/56.6600))
    rates[11] = (algebraic[1]-states[11])/algebraic[17]
    algebraic[4] = 1.00000/(1.00000+exp(-((states[0]+constants[57])-14.3400)/14.8200))
    algebraic[19] = 1.05150/(1.00000/(1.20890*(1.00000+exp(-((states[0]+constants[57])-18.4099)/29.3814)))+3.50000/(1.00000+exp((states[0]+constants[57]+100.000)/29.3814)))
    rates[18] = (algebraic[4]-states[18])/algebraic[19]
    algebraic[7] = states[25]*150.000
    algebraic[21] = (1.00000-states[24])/(power(1.00000+constants[60]/states[2], 4.00000))
    rates[24] = algebraic[21]*constants[61]-states[24]*algebraic[7]
    algebraic[9] = 1.00000/(1.00000+exp(-(states[0]+11.6000+constants[119])/8.93200))
    algebraic[24] = 817.300+1.00000/(0.000232600*exp((states[0]+48.2800+constants[119])/17.8000)+0.00129200*exp(-(states[0]+210.000+constants[119])/230.000))
    rates[50] = (algebraic[9]-states[50])/algebraic[24]
    algebraic[10] = 1.00000/(1.00000+exp(-(states[0]+2.55380*constants[3]+144.590+constants[123])/(1.56920*constants[3]+3.81150)))
    algebraic[25] = 122.200/(exp(-(states[0]+constants[123]+127.200)/20.3600)+exp((states[0]+constants[123]+236.800)/69.3300))
    rates[52] = (algebraic[10]-states[52])/algebraic[25]
    algebraic[18] = algebraic[1]
    algebraic[26] = (4.85900+1.00000/(0.862800*exp(-(states[0]+116.726)/7.60050)+1.10960*exp((states[0]+6.27190)/9.03580)))*constants[38]
    rates[12] = (algebraic[18]-states[12])/algebraic[26]
    algebraic[30] = 1.00000/(1.00000+exp(-((states[0]+constants[57])-24.3400)/14.8200))
    rates[21] = (algebraic[30]-states[21])/algebraic[19]
    algebraic[23] = algebraic[9]
    algebraic[32] = 1.00000/(0.0100000*exp(((states[0]-50.0000)+constants[119])/20.0000)+0.0193000*exp(-(states[0]+66.5400+constants[119])/31.0000))
    rates[51] = (algebraic[23]-states[51])/algebraic[32]
    algebraic[37] = (constants[21]*(1.00000-states[1]))/(1.00000+constants[22]/states[2])
    rates[1] = constants[19]*algebraic[37]*(algebraic[37]+states[1])-constants[20]*states[1]
    algebraic[27] = 1.00000/(1.00000+exp((states[0]+84.7000)/6.22000))
    algebraic[33] = 3.00000*algebraic[17]
    rates[13] = (algebraic[27]-states[13])/algebraic[33]
    algebraic[34] = 1.46000*algebraic[26]
    rates[14] = (algebraic[18]-states[14])/algebraic[34]
    algebraic[28] = 1.00000/(1.00000+exp(-(states[0]+42.8500)/5.26400))
    algebraic[35] = algebraic[15]
    rates[15] = (algebraic[28]-states[15])/algebraic[35]
    algebraic[5] = 1.00000/(1.00000+exp((states[0]+constants[57]+43.9400)/5.71100))
    algebraic[20] = custom_piecewise([equal(constants[0] , 1.00000), 1.00000-0.950000/(1.00000+exp((states[0]+constants[57]+70.0000)/5.00000)) , True, 1.00000])
    algebraic[29] = 4.56200+1.00000/(0.393300*exp(-(states[0]+constants[57]+100.000)/100.000)+0.0800400*exp((states[0]+constants[57]+50.0000)/16.5900))
    algebraic[38] = algebraic[29]*algebraic[20]
    rates[19] = (algebraic[5]-states[19])/algebraic[38]
    algebraic[36] = 23.6200+1.00000/(0.00141600*exp(-(states[0]+constants[57]+96.5200)/59.0500)+1.78000e-08*exp((states[0]+constants[57]+114.100)/8.07900))
    algebraic[40] = algebraic[36]*algebraic[20]
    rates[20] = (algebraic[5]-states[20])/algebraic[40]
    algebraic[42] = 1.35400+0.000100000/(exp(((states[0]+constants[57])-167.400)/15.8900)+exp(-((states[0]+constants[57])-12.2300)/0.215400))
    algebraic[44] = 1.00000-0.500000/(1.00000+exp((states[0]+constants[57]+70.0000)/20.0000))
    algebraic[46] = algebraic[42]*algebraic[44]*algebraic[38]
    rates[22] = (algebraic[5]-states[22])/algebraic[46]
    algebraic[47] = algebraic[42]*algebraic[44]*algebraic[40]
    rates[23] = (algebraic[5]-states[23])/algebraic[47]
    algebraic[64] = ((constants[179]*states[24])/(1.00000-states[24]))*(1.00000-constants[58])
    algebraic[65] = 1.00000/(1.00000+exp(-(states[0]+3.94000)/4.23000))
    algebraic[66] = 0.600000+1.00000/(exp(-0.0500000*(states[0]+6.00000))+exp(0.0900000*(states[0]+14.0000)))
    algebraic[67] = algebraic[65]/algebraic[66]
    algebraic[68] = (1.00000-algebraic[65])/algebraic[66]
    algebraic[69] = 1.00000/(1.00000+exp((states[0]+19.5800)/3.69600))
    algebraic[70] = algebraic[69]
    algebraic[74] = 35.0000+350.000*exp(-(power(states[0]+20.0000, 2.00000))/(2.00000*100.000))
    algebraic[75] = algebraic[74]
    algebraic[79] = algebraic[70]/algebraic[75]
    algebraic[83] = (1.00000-algebraic[70])/algebraic[75]
    rates[28] = (((algebraic[68]*states[38]+algebraic[79]*states[27])-(algebraic[83]+algebraic[67])*states[28])-algebraic[64]*states[28])+constants[179]*states[34]
    algebraic[72] = algebraic[69]
    algebraic[77] = algebraic[74]
    algebraic[80] = algebraic[72]/algebraic[77]
    algebraic[84] = (1.00000-algebraic[72])/algebraic[77]
    rates[31] = (((algebraic[68]*states[39]+algebraic[80]*states[30])-(algebraic[84]+algebraic[67])*states[31])-algebraic[64]*states[31])+constants[179]*states[37]
    algebraic[87] = 0.800000/(1.00000+exp((states[0]+19.5800)/3.69600))+0.200000
    algebraic[88] = 1.00000*(70.0000+1.20000/(0.00450000*exp((states[0]+20.0000)/-50.0000)+0.00450000*exp((states[0]+30.0000)/10.0000)))
    algebraic[89] = (1.00000-algebraic[87])/algebraic[88]
    algebraic[90] = algebraic[87]/algebraic[88]
    algebraic[101] = 1.00000*(100.000+0.00000/(0.00350000*exp((states[0]+5.00000)/-84.0000)+0.00350000*exp((states[0]+5.00000)/4.00000)))
    algebraic[103] = algebraic[101]
    algebraic[104] = ((algebraic[67]*algebraic[89]*algebraic[79])/algebraic[103])/(algebraic[67]*algebraic[89]*algebraic[79]+algebraic[68]*algebraic[90]*algebraic[83])
    algebraic[107] = 1.00000/algebraic[103]-algebraic[104]
    rates[27] = (((algebraic[107]*states[26]+algebraic[83]*states[28])-(algebraic[104]+algebraic[79])*states[27])-algebraic[64]*states[27])+constants[179]*states[33]
    rates[26] = (((algebraic[104]*states[27]+algebraic[89]*states[38])-(algebraic[107]+algebraic[90])*states[26])-algebraic[64]*states[26])+constants[179]*states[32]
    algebraic[93] = algebraic[89]/constants[180]
    algebraic[94] = algebraic[90]/constants[180]
    algebraic[102] = algebraic[101]*constants[180]
    algebraic[105] = ((algebraic[67]*algebraic[93]*algebraic[80])/algebraic[102])/(algebraic[67]*algebraic[93]*algebraic[80]+algebraic[68]*algebraic[94]*algebraic[84])
    algebraic[108] = 1.00000/algebraic[102]-algebraic[105]
    rates[30] = (((algebraic[108]*states[29]+algebraic[84]*states[31])-(algebraic[105]+algebraic[80])*states[30])-algebraic[64]*states[30])+constants[179]*states[36]
    rates[29] = (((algebraic[105]*states[30]+algebraic[93]*states[39])-(algebraic[108]+algebraic[94])*states[29])-algebraic[64]*states[29])+constants[179]*states[35]
    algebraic[71] = algebraic[69]
    algebraic[76] = algebraic[74]
    algebraic[81] = algebraic[71]/algebraic[76]
    algebraic[85] = (1.00000-algebraic[71])/algebraic[76]
    algebraic[95] = algebraic[89]*constants[63]
    algebraic[96] = algebraic[90]*constants[63]
    algebraic[106] = algebraic[103]/constants[63]
    algebraic[112] = ((algebraic[67]*algebraic[95]*algebraic[81])/algebraic[106])/(algebraic[67]*algebraic[95]*algebraic[81]+algebraic[68]*algebraic[96]*algebraic[85])
    algebraic[114] = 1.00000/algebraic[106]-algebraic[112]
    rates[33] = (((algebraic[114]*states[32]+algebraic[85]*states[34])-(algebraic[112]+algebraic[81])*states[33])+algebraic[64]*states[27])-constants[179]*states[33]
    algebraic[73] = algebraic[69]
    algebraic[78] = algebraic[74]
    algebraic[82] = algebraic[73]/algebraic[78]
    algebraic[86] = (1.00000-algebraic[73])/algebraic[78]
    algebraic[99] = algebraic[93]*constants[63]
    algebraic[100] = algebraic[94]*constants[63]
    algebraic[109] = (algebraic[103]/constants[63])*constants[180]
    algebraic[113] = ((algebraic[67]*algebraic[99]*algebraic[82])/algebraic[109])/(algebraic[67]*algebraic[99]*algebraic[82]+algebraic[68]*algebraic[100]*algebraic[86])
    algebraic[115] = 1.00000/algebraic[109]-algebraic[113]
    rates[36] = (((algebraic[115]*states[35]+algebraic[86]*states[37])-(algebraic[113]+algebraic[82])*states[36])+algebraic[64]*states[30])-constants[179]*states[36]
    algebraic[121] = ((((((1.00000-states[34])-states[32])-states[33])-states[28])-states[26])-states[27])-states[38]
    rates[38] = (((algebraic[67]*states[28]+algebraic[90]*states[26])-(algebraic[68]+algebraic[89])*states[38])-algebraic[64]*states[38])+constants[179]*algebraic[121]
    rates[32] = (((algebraic[112]*states[33]+algebraic[95]*algebraic[121])-(algebraic[114]+algebraic[96])*states[32])+algebraic[64]*states[26])-constants[179]*states[32]
    rates[34] = (((algebraic[68]*algebraic[121]+algebraic[81]*states[33])-(algebraic[85]+algebraic[67])*states[34])+algebraic[64]*states[28])-constants[179]*states[34]
    algebraic[122] = ((((((1.00000-states[37])-states[35])-states[36])-states[31])-states[29])-states[30])-states[39]
    rates[39] = (((algebraic[67]*states[31]+algebraic[94]*states[29])-(algebraic[68]+algebraic[93])*states[39])-algebraic[64]*states[39])+constants[179]*algebraic[122]
    rates[35] = (((algebraic[113]*states[36]+algebraic[99]*algebraic[122])-(algebraic[115]+algebraic[100])*states[35])+algebraic[64]*states[29])-constants[179]*states[35]
    rates[37] = (((algebraic[68]*algebraic[122]+algebraic[82]*states[36])-(algebraic[86]+algebraic[67])*states[37])+algebraic[64]*states[31])-constants[179]*states[37]
    algebraic[49] = ((constants[4]*constants[5])/constants[6])*log(constants[3]/states[5])
    algebraic[57] = 1.00000/(1.00000+exp(((states[0]+constants[57])-213.600)/151.200))
    algebraic[58] = 1.00000-algebraic[57]
    algebraic[59] = algebraic[57]*states[19]+algebraic[58]*states[20]
    algebraic[60] = algebraic[57]*states[22]+algebraic[58]*states[23]
    algebraic[39] = algebraic[37]+states[1]
    algebraic[61] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[62] = constants[178]*(states[0]-algebraic[49])*((1.00000-algebraic[61])*states[18]*algebraic[59]+algebraic[61]*states[21]*algebraic[60])
    algebraic[147] = constants[199]*states[44]*(states[0]-algebraic[49])
    algebraic[50] = ((constants[4]*constants[5])/constants[6])*log((constants[3]+constants[36]*constants[1])/(states[5]+constants[36]*states[3]))
    algebraic[148] = 1.00000+0.600000/(1.00000+power(3.80000e-05/states[8], 1.40000))
    algebraic[149] = constants[182]*algebraic[148]*states[50]*states[51]*(states[0]-algebraic[50])
    algebraic[150] = 1.00000/(1.00000+exp((((states[0]+105.800)-2.60000*constants[3])+constants[123])/(constants[124]*9.49300)))
    algebraic[151] = constants[183]*(power(constants[3], 1.0/2))*algebraic[150]*states[52]*(states[0]-algebraic[49])
    algebraic[215] = constants[148]*exp(((1.00000-constants[149])*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[219] = (constants[143]*(power(constants[3]/constants[151], 2.00000)))/((power(1.00000+constants[1]/algebraic[215], 3.00000)+power(1.00000+constants[3]/constants[151], 2.00000))-1.00000)
    algebraic[216] = constants[156]/(1.00000+constants[155]/constants[157]+states[3]/constants[158]+states[5]/constants[159])
    algebraic[220] = (constants[144]*algebraic[216]*constants[155])/(1.00000+constants[153]/constants[154])
    algebraic[214] = constants[147]*exp((constants[149]*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[217] = (constants[139]*(power(states[3]/algebraic[214], 3.00000)))/((power(1.00000+states[3]/algebraic[214], 3.00000)+power(1.00000+states[5]/constants[150], 2.00000))-1.00000)
    algebraic[218] = (constants[142]*(power(constants[1]/algebraic[215], 3.00000)))/((power(1.00000+constants[1]/algebraic[215], 3.00000)+power(1.00000+constants[3]/constants[151], 2.00000))-1.00000)
    algebraic[221] = (constants[146]*(power(states[5]/constants[150], 2.00000)))/((power(1.00000+states[3]/algebraic[214], 3.00000)+power(1.00000+states[5]/constants[150], 2.00000))-1.00000)
    algebraic[222] = constants[229]*algebraic[217]*constants[228]+algebraic[218]*algebraic[221]*algebraic[220]+constants[228]*algebraic[221]*algebraic[220]+algebraic[220]*algebraic[217]*constants[228]
    algebraic[223] = algebraic[218]*constants[227]*algebraic[221]+algebraic[217]*constants[228]*algebraic[219]+algebraic[219]*constants[227]*algebraic[221]+constants[228]*algebraic[219]*algebraic[221]
    algebraic[224] = constants[228]*algebraic[219]*constants[229]+algebraic[220]*algebraic[218]*constants[227]+algebraic[218]*constants[227]*constants[229]+algebraic[219]*constants[229]*constants[227]
    algebraic[225] = algebraic[221]*algebraic[220]*algebraic[218]+algebraic[219]*constants[229]*algebraic[217]+algebraic[218]*constants[229]*algebraic[217]+algebraic[220]*algebraic[218]*algebraic[217]
    algebraic[226] = algebraic[222]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[227] = algebraic[223]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[230] = 3.00000*(algebraic[226]*algebraic[219]-algebraic[227]*algebraic[220])
    algebraic[228] = algebraic[224]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[229] = algebraic[225]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[231] = 2.00000*(algebraic[229]*constants[227]-algebraic[228]*algebraic[217])
    algebraic[232] = constants[230]*(constants[7]*algebraic[230]+constants[9]*algebraic[231])
    algebraic[233] = 1.00000/(1.00000+exp(-(states[0]-14.4800)/18.3400))
    algebraic[234] = constants[185]*algebraic[233]*(states[0]-algebraic[49])
    algebraic[8] = custom_piecewise([greater_equal(voi , constants[13]) & less_equal(voi , constants[14]) & less_equal((voi-constants[13])-floor((voi-constants[13])/constants[16])*constants[16] , constants[17]), constants[15] , True, 0.00000])
    algebraic[236] = (states[6]-states[5])/2.00000
    rates[5] = (-((algebraic[62]+algebraic[147]+algebraic[149]+algebraic[151]+algebraic[234]+algebraic[8])-2.00000*algebraic[232])*constants[35]*constants[202])/(constants[6]*constants[203])+(algebraic[236]*constants[206])/constants[203]
    algebraic[22] = (states[0]*constants[6]*constants[6])/(constants[4]*constants[5])
    algebraic[31] = (states[0]*constants[6])/(constants[4]*constants[5])
    algebraic[120] = (1.00000*algebraic[22]*(0.750000*states[6]*exp(1.00000*algebraic[31])-0.750000*constants[3]))/(exp(1.00000*algebraic[31])-1.00000)
    algebraic[133] = constants[211]*algebraic[120]*states[38]
    algebraic[135] = constants[211]*algebraic[120]*algebraic[121]
    algebraic[141] = algebraic[133]+algebraic[135]
    algebraic[134] = constants[213]*algebraic[120]*states[39]
    algebraic[136] = constants[213]*algebraic[120]*algebraic[122]
    algebraic[142] = algebraic[134]+algebraic[136]
    algebraic[63] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[146] = (algebraic[142]*algebraic[63]+algebraic[141]*(1.00000-algebraic[63]))*constants[65]
    rates[6] = (-algebraic[146]*constants[35]*constants[202])/(constants[6]*constants[206])-algebraic[236]
    algebraic[48] = ((constants[4]*constants[5])/constants[6])*log(constants[1]/states[3])
    algebraic[51] = constants[50]*states[10]+constants[175]*states[11]
    algebraic[52] = constants[50]*states[10]+constants[175]*states[13]
    algebraic[53] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[54] = constants[51]*constants[39]*(states[0]-algebraic[48])*(power(states[9], 3.00000))*((1.00000-algebraic[53])*algebraic[51]*states[12]+algebraic[53]*algebraic[52]*states[14])
    algebraic[55] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[56] = constants[177]*(states[0]-algebraic[48])*states[15]*((1.00000-algebraic[55])*states[16]+algebraic[55]*states[17])
    algebraic[180] = 1.00000/(1.00000+power(constants[136]/states[8], 2.00000))
    algebraic[153] = exp((constants[134]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[160] = 1.00000+(constants[1]/constants[127])*(1.00000+1.00000/algebraic[153])
    algebraic[161] = constants[1]/(constants[127]*algebraic[153]*algebraic[160])
    algebraic[164] = algebraic[161]*constants[131]
    algebraic[154] = 1.00000+(states[3]/constants[127])*(1.00000+algebraic[153])
    algebraic[155] = (states[3]*algebraic[153])/(constants[127]*algebraic[154])
    algebraic[167] = algebraic[155]*constants[131]
    algebraic[157] = 1.00000+(states[3]/constants[125])*(1.00000+states[3]/constants[126])
    algebraic[158] = (states[3]*states[3])/(algebraic[157]*constants[125]*constants[126])
    algebraic[170] = algebraic[158]*algebraic[155]*constants[129]
    algebraic[171] = algebraic[161]*constants[215]*constants[129]
    algebraic[162] = 1.00000/algebraic[160]
    algebraic[163] = algebraic[162]*constants[130]
    algebraic[165] = algebraic[163]+algebraic[164]
    algebraic[152] = exp((constants[135]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[156] = 1.00000/algebraic[154]
    algebraic[166] = (algebraic[156]*constants[130])/algebraic[152]
    algebraic[168] = algebraic[166]+algebraic[167]
    algebraic[159] = 1.00000/algebraic[157]
    algebraic[169] = algebraic[159]*states[8]*constants[132]
    algebraic[172] = constants[218]*algebraic[168]*(algebraic[170]+algebraic[169])+constants[219]*algebraic[170]*(constants[218]+algebraic[165])
    algebraic[173] = constants[217]*algebraic[170]*(algebraic[168]+constants[219])+algebraic[168]*algebraic[169]*(constants[217]+algebraic[171])
    algebraic[174] = constants[217]*algebraic[165]*(algebraic[170]+algebraic[169])+algebraic[171]*algebraic[169]*(constants[218]+algebraic[165])
    algebraic[175] = constants[218]*algebraic[171]*(algebraic[168]+constants[219])+algebraic[165]*constants[219]*(constants[217]+algebraic[171])
    algebraic[176] = algebraic[172]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[177] = algebraic[173]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[178] = algebraic[174]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[179] = algebraic[175]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[181] = (3.00000*(algebraic[179]*algebraic[170]-algebraic[176]*algebraic[171])+algebraic[178]*algebraic[167])-algebraic[177]*algebraic[164]
    algebraic[182] = algebraic[177]*constants[218]-algebraic[176]*constants[217]
    algebraic[183] = 0.800000*constants[220]*algebraic[180]*(constants[7]*algebraic[181]+constants[8]*algebraic[182])
    algebraic[235] = (constants[163]*algebraic[22]*(states[3]*exp(algebraic[31])-constants[1]))/(exp(algebraic[31])-1.00000)
    algebraic[238] = (states[4]-states[3])/2.00000
    rates[3] = (-(algebraic[54]+algebraic[56]+3.00000*algebraic[183]+3.00000*algebraic[232]+algebraic[235])*constants[202]*constants[35])/(constants[6]*constants[203])+(algebraic[238]*constants[206])/constants[203]
    algebraic[119] = (1.00000*algebraic[22]*(0.750000*states[4]*exp(1.00000*algebraic[31])-0.750000*constants[1]))/(exp(1.00000*algebraic[31])-1.00000)
    algebraic[129] = constants[210]*algebraic[119]*states[38]
    algebraic[131] = constants[210]*algebraic[119]*algebraic[121]
    algebraic[139] = algebraic[129]+algebraic[131]
    algebraic[130] = constants[212]*algebraic[119]*states[39]
    algebraic[132] = constants[212]*algebraic[119]*algebraic[122]
    algebraic[140] = algebraic[130]+algebraic[132]
    algebraic[145] = (algebraic[140]*algebraic[63]+algebraic[139]*(1.00000-algebraic[63]))*constants[65]
    algebraic[210] = 1.00000/(1.00000+power(constants[136]/states[2], 2.00000))
    algebraic[190] = 1.00000+(constants[1]/constants[127])*(1.00000+1.00000/algebraic[153])
    algebraic[191] = constants[1]/(constants[127]*algebraic[153]*algebraic[190])
    algebraic[194] = algebraic[191]*constants[131]
    algebraic[184] = 1.00000+(states[4]/constants[127])*(1.00000+algebraic[153])
    algebraic[185] = (states[4]*algebraic[153])/(constants[127]*algebraic[184])
    algebraic[197] = algebraic[185]*constants[131]
    algebraic[187] = 1.00000+(states[4]/constants[125])*(1.00000+states[4]/constants[126])
    algebraic[188] = (states[4]*states[4])/(algebraic[187]*constants[125]*constants[126])
    algebraic[200] = algebraic[188]*algebraic[185]*constants[129]
    algebraic[201] = algebraic[191]*constants[222]*constants[129]
    algebraic[192] = 1.00000/algebraic[190]
    algebraic[193] = algebraic[192]*constants[130]
    algebraic[195] = algebraic[193]+algebraic[194]
    algebraic[186] = 1.00000/algebraic[184]
    algebraic[196] = (algebraic[186]*constants[130])/algebraic[152]
    algebraic[198] = algebraic[196]+algebraic[197]
    algebraic[189] = 1.00000/algebraic[187]
    algebraic[199] = algebraic[189]*states[2]*constants[132]
    algebraic[202] = constants[225]*algebraic[198]*(algebraic[200]+algebraic[199])+constants[226]*algebraic[200]*(constants[225]+algebraic[195])
    algebraic[203] = constants[224]*algebraic[200]*(algebraic[198]+constants[226])+algebraic[198]*algebraic[199]*(constants[224]+algebraic[201])
    algebraic[204] = constants[224]*algebraic[195]*(algebraic[200]+algebraic[199])+algebraic[201]*algebraic[199]*(constants[225]+algebraic[195])
    algebraic[205] = constants[225]*algebraic[201]*(algebraic[198]+constants[226])+algebraic[195]*constants[226]*(constants[224]+algebraic[201])
    algebraic[206] = algebraic[202]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[207] = algebraic[203]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[208] = algebraic[204]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[209] = algebraic[205]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[211] = (3.00000*(algebraic[209]*algebraic[200]-algebraic[206]*algebraic[201])+algebraic[208]*algebraic[197])-algebraic[207]*algebraic[194]
    algebraic[212] = algebraic[207]*constants[225]-algebraic[206]*constants[224]
    algebraic[213] = 0.200000*constants[220]*algebraic[210]*(constants[7]*algebraic[211]+constants[8]*algebraic[212])
    rates[4] = (-(algebraic[145]+3.00000*algebraic[213])*constants[35]*constants[202])/(constants[6]*constants[206])-algebraic[238]
    algebraic[118] = (4.00000*algebraic[22]*(1.20000*states[2]*exp(2.00000*algebraic[31])-0.341000*constants[2]))/(exp(2.00000*algebraic[31])-1.00000)
    algebraic[123] = constants[208]*algebraic[118]*states[38]
    algebraic[126] = constants[208]*algebraic[118]*algebraic[121]
    algebraic[137] = algebraic[123]+algebraic[126]
    algebraic[124] = constants[209]*algebraic[118]*states[39]
    algebraic[127] = constants[209]*algebraic[118]*algebraic[122]
    algebraic[138] = algebraic[124]+algebraic[127]
    algebraic[143] = (algebraic[138]*algebraic[63]+algebraic[137]*(1.00000-algebraic[63]))*constants[65]
    algebraic[239] = (constants[166]*states[8])/(constants[167]+states[8])
    algebraic[237] = ((1.00000-constants[165])*constants[164]*16.0000*algebraic[22]*(1.20000*states[8]*exp(2.00000*algebraic[31])-0.341000*constants[2]))/(exp(2.00000*algebraic[31])-1.00000)
    rates[0] = -(algebraic[54]+algebraic[56]+algebraic[62]+algebraic[143]+algebraic[145]+algebraic[146]+algebraic[147]+algebraic[149]+algebraic[151]+algebraic[183]+algebraic[213]+algebraic[232]+algebraic[235]+algebraic[234]+algebraic[239]+algebraic[237]+algebraic[8])
    algebraic[240] = ((states[2]-states[8])*1.70000)/0.200000
    algebraic[242] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[241] = 1.00000-1.00000/(1.00000+exp((states[7]-0.300000)/0.100000))
    algebraic[243] = custom_piecewise([equal(constants[0] , 2.00000), constants[191]*algebraic[241]*states[54]*states[55]*(states[7]-states[2]) , True, constants[170]*algebraic[241]*states[54]*states[55]*(states[7]-states[2])])
    algebraic[244] = custom_piecewise([equal(constants[0] , 2.00000), constants[192]*1.70000*algebraic[241]*states[54]*states[56]*(states[7]-states[2]) , True, constants[192]*algebraic[241]*states[54]*states[56]*(states[7]-states[2])])
    algebraic[245] = (1.00000-algebraic[242])*algebraic[243]+algebraic[242]*algebraic[244]
    algebraic[43] = 1.00000/(1.00000+(constants[27]*constants[28])/(power(constants[28]+states[2], 2.00000))+(constants[29]*constants[30])/(power(constants[30]+states[2], 2.00000)))
    rates[2] = algebraic[43]*(((-(algebraic[143]-2.00000*algebraic[213])*constants[202])/(2.00000*constants[6]*constants[206])+(algebraic[245]*constants[207])/constants[206])-algebraic[240])
    algebraic[246] = (constants[193]*0.00437500*states[8])/(states[8]+0.000920000)
    algebraic[247] = (constants[193]*2.75000*0.00437500*states[8])/((states[8]+0.000920000)-0.000170000)
    algebraic[248] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[250] = constants[172]*((1.00000-algebraic[248])*algebraic[246]+algebraic[248]*algebraic[247])
    algebraic[249] = (0.0123000*states[7])/15.0000
    algebraic[41] = 1.00000/(1.00000+(constants[173]*constants[24])/(power(constants[24]+states[8], 2.00000))+(constants[25]*constants[26])/(power(constants[26]+states[8], 2.00000)))
    rates[8] = algebraic[41]*(((-((algebraic[239]+algebraic[237])-2.00000*algebraic[183])*constants[202])/(2.00000*constants[6]*constants[203])-(algebraic[250]*constants[207])/constants[203])+(algebraic[249]*constants[207])/constants[203]+(algebraic[240]*constants[206])/constants[203])
    algebraic[45] = 1.00000/(1.00000+(constants[31]*constants[32])/(power(constants[32]+states[7], 2.00000)))
    rates[7] = algebraic[45]*((algebraic[250]-algebraic[249])-algebraic[245])
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[2] = 1.00000/(1.00000+exp((states[0]+87.6100)/7.48800))
    algebraic[3] = 1.00000/(1.00000+exp((states[0]+93.8100)/7.48800))
    algebraic[6] = 1.00000/(1.00000+exp((states[0]+19.5800+25.0000)/3.69600))
    algebraic[11] = constants[168]-constants[169]/(1.00000+exp((1000.00*states[2]-0.0430000)/0.00820000))
    algebraic[12] = 1.00000-1.00000/(1.00000+exp((1000.00*states[2]-(states[53]+constants[186]))/0.00300000))
    algebraic[13] = 1.00000/(1.00000+exp((1000.00*states[2]-(states[53]+constants[187]))/0.00100000))
    algebraic[0] = 1.00000/(1.00000+exp(-(states[0]+constants[40])/constants[41]))
    algebraic[15] = 1.00000/(constants[44]*exp((states[0]+constants[42])/constants[43])+constants[45]*exp(-(states[0]+constants[46])/constants[47]))
    algebraic[1] = 1.00000/(1.00000+exp((states[0]+constants[48])/constants[49]))
    algebraic[16] = 1.00000/(3.68600e-06*exp(-(states[0]+3.88750)/7.85790)+16.0000*exp((states[0]-0.496300)/9.18430))+0.0750000
    algebraic[17] = 1.00000/(0.00979400*exp(-(states[0]+17.9500)/28.0500)+0.334300*exp((states[0]+5.73000)/56.6600))
    algebraic[4] = 1.00000/(1.00000+exp(-((states[0]+constants[57])-14.3400)/14.8200))
    algebraic[19] = 1.05150/(1.00000/(1.20890*(1.00000+exp(-((states[0]+constants[57])-18.4099)/29.3814)))+3.50000/(1.00000+exp((states[0]+constants[57]+100.000)/29.3814)))
    algebraic[7] = states[25]*150.000
    algebraic[21] = (1.00000-states[24])/(power(1.00000+constants[60]/states[2], 4.00000))
    algebraic[9] = 1.00000/(1.00000+exp(-(states[0]+11.6000+constants[119])/8.93200))
    algebraic[24] = 817.300+1.00000/(0.000232600*exp((states[0]+48.2800+constants[119])/17.8000)+0.00129200*exp(-(states[0]+210.000+constants[119])/230.000))
    algebraic[10] = 1.00000/(1.00000+exp(-(states[0]+2.55380*constants[3]+144.590+constants[123])/(1.56920*constants[3]+3.81150)))
    algebraic[25] = 122.200/(exp(-(states[0]+constants[123]+127.200)/20.3600)+exp((states[0]+constants[123]+236.800)/69.3300))
    algebraic[18] = algebraic[1]
    algebraic[26] = (4.85900+1.00000/(0.862800*exp(-(states[0]+116.726)/7.60050)+1.10960*exp((states[0]+6.27190)/9.03580)))*constants[38]
    algebraic[30] = 1.00000/(1.00000+exp(-((states[0]+constants[57])-24.3400)/14.8200))
    algebraic[23] = algebraic[9]
    algebraic[32] = 1.00000/(0.0100000*exp(((states[0]-50.0000)+constants[119])/20.0000)+0.0193000*exp(-(states[0]+66.5400+constants[119])/31.0000))
    algebraic[37] = (constants[21]*(1.00000-states[1]))/(1.00000+constants[22]/states[2])
    algebraic[27] = 1.00000/(1.00000+exp((states[0]+84.7000)/6.22000))
    algebraic[33] = 3.00000*algebraic[17]
    algebraic[34] = 1.46000*algebraic[26]
    algebraic[28] = 1.00000/(1.00000+exp(-(states[0]+42.8500)/5.26400))
    algebraic[35] = algebraic[15]
    algebraic[5] = 1.00000/(1.00000+exp((states[0]+constants[57]+43.9400)/5.71100))
    algebraic[20] = custom_piecewise([equal(constants[0] , 1.00000), 1.00000-0.950000/(1.00000+exp((states[0]+constants[57]+70.0000)/5.00000)) , True, 1.00000])
    algebraic[29] = 4.56200+1.00000/(0.393300*exp(-(states[0]+constants[57]+100.000)/100.000)+0.0800400*exp((states[0]+constants[57]+50.0000)/16.5900))
    algebraic[38] = algebraic[29]*algebraic[20]
    algebraic[36] = 23.6200+1.00000/(0.00141600*exp(-(states[0]+constants[57]+96.5200)/59.0500)+1.78000e-08*exp((states[0]+constants[57]+114.100)/8.07900))
    algebraic[40] = algebraic[36]*algebraic[20]
    algebraic[42] = 1.35400+0.000100000/(exp(((states[0]+constants[57])-167.400)/15.8900)+exp(-((states[0]+constants[57])-12.2300)/0.215400))
    algebraic[44] = 1.00000-0.500000/(1.00000+exp((states[0]+constants[57]+70.0000)/20.0000))
    algebraic[46] = algebraic[42]*algebraic[44]*algebraic[38]
    algebraic[47] = algebraic[42]*algebraic[44]*algebraic[40]
    algebraic[64] = ((constants[179]*states[24])/(1.00000-states[24]))*(1.00000-constants[58])
    algebraic[65] = 1.00000/(1.00000+exp(-(states[0]+3.94000)/4.23000))
    algebraic[66] = 0.600000+1.00000/(exp(-0.0500000*(states[0]+6.00000))+exp(0.0900000*(states[0]+14.0000)))
    algebraic[67] = algebraic[65]/algebraic[66]
    algebraic[68] = (1.00000-algebraic[65])/algebraic[66]
    algebraic[69] = 1.00000/(1.00000+exp((states[0]+19.5800)/3.69600))
    algebraic[70] = algebraic[69]
    algebraic[74] = 35.0000+350.000*exp(-(power(states[0]+20.0000, 2.00000))/(2.00000*100.000))
    algebraic[75] = algebraic[74]
    algebraic[79] = algebraic[70]/algebraic[75]
    algebraic[83] = (1.00000-algebraic[70])/algebraic[75]
    algebraic[72] = algebraic[69]
    algebraic[77] = algebraic[74]
    algebraic[80] = algebraic[72]/algebraic[77]
    algebraic[84] = (1.00000-algebraic[72])/algebraic[77]
    algebraic[87] = 0.800000/(1.00000+exp((states[0]+19.5800)/3.69600))+0.200000
    algebraic[88] = 1.00000*(70.0000+1.20000/(0.00450000*exp((states[0]+20.0000)/-50.0000)+0.00450000*exp((states[0]+30.0000)/10.0000)))
    algebraic[89] = (1.00000-algebraic[87])/algebraic[88]
    algebraic[90] = algebraic[87]/algebraic[88]
    algebraic[101] = 1.00000*(100.000+0.00000/(0.00350000*exp((states[0]+5.00000)/-84.0000)+0.00350000*exp((states[0]+5.00000)/4.00000)))
    algebraic[103] = algebraic[101]
    algebraic[104] = ((algebraic[67]*algebraic[89]*algebraic[79])/algebraic[103])/(algebraic[67]*algebraic[89]*algebraic[79]+algebraic[68]*algebraic[90]*algebraic[83])
    algebraic[107] = 1.00000/algebraic[103]-algebraic[104]
    algebraic[93] = algebraic[89]/constants[180]
    algebraic[94] = algebraic[90]/constants[180]
    algebraic[102] = algebraic[101]*constants[180]
    algebraic[105] = ((algebraic[67]*algebraic[93]*algebraic[80])/algebraic[102])/(algebraic[67]*algebraic[93]*algebraic[80]+algebraic[68]*algebraic[94]*algebraic[84])
    algebraic[108] = 1.00000/algebraic[102]-algebraic[105]
    algebraic[71] = algebraic[69]
    algebraic[76] = algebraic[74]
    algebraic[81] = algebraic[71]/algebraic[76]
    algebraic[85] = (1.00000-algebraic[71])/algebraic[76]
    algebraic[95] = algebraic[89]*constants[63]
    algebraic[96] = algebraic[90]*constants[63]
    algebraic[106] = algebraic[103]/constants[63]
    algebraic[112] = ((algebraic[67]*algebraic[95]*algebraic[81])/algebraic[106])/(algebraic[67]*algebraic[95]*algebraic[81]+algebraic[68]*algebraic[96]*algebraic[85])
    algebraic[114] = 1.00000/algebraic[106]-algebraic[112]
    algebraic[73] = algebraic[69]
    algebraic[78] = algebraic[74]
    algebraic[82] = algebraic[73]/algebraic[78]
    algebraic[86] = (1.00000-algebraic[73])/algebraic[78]
    algebraic[99] = algebraic[93]*constants[63]
    algebraic[100] = algebraic[94]*constants[63]
    algebraic[109] = (algebraic[103]/constants[63])*constants[180]
    algebraic[113] = ((algebraic[67]*algebraic[99]*algebraic[82])/algebraic[109])/(algebraic[67]*algebraic[99]*algebraic[82]+algebraic[68]*algebraic[100]*algebraic[86])
    algebraic[115] = 1.00000/algebraic[109]-algebraic[113]
    algebraic[121] = ((((((1.00000-states[34])-states[32])-states[33])-states[28])-states[26])-states[27])-states[38]
    algebraic[122] = ((((((1.00000-states[37])-states[35])-states[36])-states[31])-states[29])-states[30])-states[39]
    algebraic[49] = ((constants[4]*constants[5])/constants[6])*log(constants[3]/states[5])
    algebraic[57] = 1.00000/(1.00000+exp(((states[0]+constants[57])-213.600)/151.200))
    algebraic[58] = 1.00000-algebraic[57]
    algebraic[59] = algebraic[57]*states[19]+algebraic[58]*states[20]
    algebraic[60] = algebraic[57]*states[22]+algebraic[58]*states[23]
    algebraic[39] = algebraic[37]+states[1]
    algebraic[61] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[62] = constants[178]*(states[0]-algebraic[49])*((1.00000-algebraic[61])*states[18]*algebraic[59]+algebraic[61]*states[21]*algebraic[60])
    algebraic[147] = constants[199]*states[44]*(states[0]-algebraic[49])
    algebraic[50] = ((constants[4]*constants[5])/constants[6])*log((constants[3]+constants[36]*constants[1])/(states[5]+constants[36]*states[3]))
    algebraic[148] = 1.00000+0.600000/(1.00000+power(3.80000e-05/states[8], 1.40000))
    algebraic[149] = constants[182]*algebraic[148]*states[50]*states[51]*(states[0]-algebraic[50])
    algebraic[150] = 1.00000/(1.00000+exp((((states[0]+105.800)-2.60000*constants[3])+constants[123])/(constants[124]*9.49300)))
    algebraic[151] = constants[183]*(power(constants[3], 1.0/2))*algebraic[150]*states[52]*(states[0]-algebraic[49])
    algebraic[215] = constants[148]*exp(((1.00000-constants[149])*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[219] = (constants[143]*(power(constants[3]/constants[151], 2.00000)))/((power(1.00000+constants[1]/algebraic[215], 3.00000)+power(1.00000+constants[3]/constants[151], 2.00000))-1.00000)
    algebraic[216] = constants[156]/(1.00000+constants[155]/constants[157]+states[3]/constants[158]+states[5]/constants[159])
    algebraic[220] = (constants[144]*algebraic[216]*constants[155])/(1.00000+constants[153]/constants[154])
    algebraic[214] = constants[147]*exp((constants[149]*states[0]*constants[6])/(3.00000*constants[4]*constants[5]))
    algebraic[217] = (constants[139]*(power(states[3]/algebraic[214], 3.00000)))/((power(1.00000+states[3]/algebraic[214], 3.00000)+power(1.00000+states[5]/constants[150], 2.00000))-1.00000)
    algebraic[218] = (constants[142]*(power(constants[1]/algebraic[215], 3.00000)))/((power(1.00000+constants[1]/algebraic[215], 3.00000)+power(1.00000+constants[3]/constants[151], 2.00000))-1.00000)
    algebraic[221] = (constants[146]*(power(states[5]/constants[150], 2.00000)))/((power(1.00000+states[3]/algebraic[214], 3.00000)+power(1.00000+states[5]/constants[150], 2.00000))-1.00000)
    algebraic[222] = constants[229]*algebraic[217]*constants[228]+algebraic[218]*algebraic[221]*algebraic[220]+constants[228]*algebraic[221]*algebraic[220]+algebraic[220]*algebraic[217]*constants[228]
    algebraic[223] = algebraic[218]*constants[227]*algebraic[221]+algebraic[217]*constants[228]*algebraic[219]+algebraic[219]*constants[227]*algebraic[221]+constants[228]*algebraic[219]*algebraic[221]
    algebraic[224] = constants[228]*algebraic[219]*constants[229]+algebraic[220]*algebraic[218]*constants[227]+algebraic[218]*constants[227]*constants[229]+algebraic[219]*constants[229]*constants[227]
    algebraic[225] = algebraic[221]*algebraic[220]*algebraic[218]+algebraic[219]*constants[229]*algebraic[217]+algebraic[218]*constants[229]*algebraic[217]+algebraic[220]*algebraic[218]*algebraic[217]
    algebraic[226] = algebraic[222]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[227] = algebraic[223]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[230] = 3.00000*(algebraic[226]*algebraic[219]-algebraic[227]*algebraic[220])
    algebraic[228] = algebraic[224]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[229] = algebraic[225]/(algebraic[222]+algebraic[223]+algebraic[224]+algebraic[225])
    algebraic[231] = 2.00000*(algebraic[229]*constants[227]-algebraic[228]*algebraic[217])
    algebraic[232] = constants[230]*(constants[7]*algebraic[230]+constants[9]*algebraic[231])
    algebraic[233] = 1.00000/(1.00000+exp(-(states[0]-14.4800)/18.3400))
    algebraic[234] = constants[185]*algebraic[233]*(states[0]-algebraic[49])
    algebraic[8] = custom_piecewise([greater_equal(voi , constants[13]) & less_equal(voi , constants[14]) & less_equal((voi-constants[13])-floor((voi-constants[13])/constants[16])*constants[16] , constants[17]), constants[15] , True, 0.00000])
    algebraic[236] = (states[6]-states[5])/2.00000
    algebraic[22] = (states[0]*constants[6]*constants[6])/(constants[4]*constants[5])
    algebraic[31] = (states[0]*constants[6])/(constants[4]*constants[5])
    algebraic[120] = (1.00000*algebraic[22]*(0.750000*states[6]*exp(1.00000*algebraic[31])-0.750000*constants[3]))/(exp(1.00000*algebraic[31])-1.00000)
    algebraic[133] = constants[211]*algebraic[120]*states[38]
    algebraic[135] = constants[211]*algebraic[120]*algebraic[121]
    algebraic[141] = algebraic[133]+algebraic[135]
    algebraic[134] = constants[213]*algebraic[120]*states[39]
    algebraic[136] = constants[213]*algebraic[120]*algebraic[122]
    algebraic[142] = algebraic[134]+algebraic[136]
    algebraic[63] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[146] = (algebraic[142]*algebraic[63]+algebraic[141]*(1.00000-algebraic[63]))*constants[65]
    algebraic[48] = ((constants[4]*constants[5])/constants[6])*log(constants[1]/states[3])
    algebraic[51] = constants[50]*states[10]+constants[175]*states[11]
    algebraic[52] = constants[50]*states[10]+constants[175]*states[13]
    algebraic[53] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[54] = constants[51]*constants[39]*(states[0]-algebraic[48])*(power(states[9], 3.00000))*((1.00000-algebraic[53])*algebraic[51]*states[12]+algebraic[53]*algebraic[52]*states[14])
    algebraic[55] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[56] = constants[177]*(states[0]-algebraic[48])*states[15]*((1.00000-algebraic[55])*states[16]+algebraic[55]*states[17])
    algebraic[180] = 1.00000/(1.00000+power(constants[136]/states[8], 2.00000))
    algebraic[153] = exp((constants[134]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[160] = 1.00000+(constants[1]/constants[127])*(1.00000+1.00000/algebraic[153])
    algebraic[161] = constants[1]/(constants[127]*algebraic[153]*algebraic[160])
    algebraic[164] = algebraic[161]*constants[131]
    algebraic[154] = 1.00000+(states[3]/constants[127])*(1.00000+algebraic[153])
    algebraic[155] = (states[3]*algebraic[153])/(constants[127]*algebraic[154])
    algebraic[167] = algebraic[155]*constants[131]
    algebraic[157] = 1.00000+(states[3]/constants[125])*(1.00000+states[3]/constants[126])
    algebraic[158] = (states[3]*states[3])/(algebraic[157]*constants[125]*constants[126])
    algebraic[170] = algebraic[158]*algebraic[155]*constants[129]
    algebraic[171] = algebraic[161]*constants[215]*constants[129]
    algebraic[162] = 1.00000/algebraic[160]
    algebraic[163] = algebraic[162]*constants[130]
    algebraic[165] = algebraic[163]+algebraic[164]
    algebraic[152] = exp((constants[135]*states[0]*constants[6])/(constants[4]*constants[5]))
    algebraic[156] = 1.00000/algebraic[154]
    algebraic[166] = (algebraic[156]*constants[130])/algebraic[152]
    algebraic[168] = algebraic[166]+algebraic[167]
    algebraic[159] = 1.00000/algebraic[157]
    algebraic[169] = algebraic[159]*states[8]*constants[132]
    algebraic[172] = constants[218]*algebraic[168]*(algebraic[170]+algebraic[169])+constants[219]*algebraic[170]*(constants[218]+algebraic[165])
    algebraic[173] = constants[217]*algebraic[170]*(algebraic[168]+constants[219])+algebraic[168]*algebraic[169]*(constants[217]+algebraic[171])
    algebraic[174] = constants[217]*algebraic[165]*(algebraic[170]+algebraic[169])+algebraic[171]*algebraic[169]*(constants[218]+algebraic[165])
    algebraic[175] = constants[218]*algebraic[171]*(algebraic[168]+constants[219])+algebraic[165]*constants[219]*(constants[217]+algebraic[171])
    algebraic[176] = algebraic[172]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[177] = algebraic[173]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[178] = algebraic[174]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[179] = algebraic[175]/(algebraic[172]+algebraic[173]+algebraic[174]+algebraic[175])
    algebraic[181] = (3.00000*(algebraic[179]*algebraic[170]-algebraic[176]*algebraic[171])+algebraic[178]*algebraic[167])-algebraic[177]*algebraic[164]
    algebraic[182] = algebraic[177]*constants[218]-algebraic[176]*constants[217]
    algebraic[183] = 0.800000*constants[220]*algebraic[180]*(constants[7]*algebraic[181]+constants[8]*algebraic[182])
    algebraic[235] = (constants[163]*algebraic[22]*(states[3]*exp(algebraic[31])-constants[1]))/(exp(algebraic[31])-1.00000)
    algebraic[238] = (states[4]-states[3])/2.00000
    algebraic[119] = (1.00000*algebraic[22]*(0.750000*states[4]*exp(1.00000*algebraic[31])-0.750000*constants[1]))/(exp(1.00000*algebraic[31])-1.00000)
    algebraic[129] = constants[210]*algebraic[119]*states[38]
    algebraic[131] = constants[210]*algebraic[119]*algebraic[121]
    algebraic[139] = algebraic[129]+algebraic[131]
    algebraic[130] = constants[212]*algebraic[119]*states[39]
    algebraic[132] = constants[212]*algebraic[119]*algebraic[122]
    algebraic[140] = algebraic[130]+algebraic[132]
    algebraic[145] = (algebraic[140]*algebraic[63]+algebraic[139]*(1.00000-algebraic[63]))*constants[65]
    algebraic[210] = 1.00000/(1.00000+power(constants[136]/states[2], 2.00000))
    algebraic[190] = 1.00000+(constants[1]/constants[127])*(1.00000+1.00000/algebraic[153])
    algebraic[191] = constants[1]/(constants[127]*algebraic[153]*algebraic[190])
    algebraic[194] = algebraic[191]*constants[131]
    algebraic[184] = 1.00000+(states[4]/constants[127])*(1.00000+algebraic[153])
    algebraic[185] = (states[4]*algebraic[153])/(constants[127]*algebraic[184])
    algebraic[197] = algebraic[185]*constants[131]
    algebraic[187] = 1.00000+(states[4]/constants[125])*(1.00000+states[4]/constants[126])
    algebraic[188] = (states[4]*states[4])/(algebraic[187]*constants[125]*constants[126])
    algebraic[200] = algebraic[188]*algebraic[185]*constants[129]
    algebraic[201] = algebraic[191]*constants[222]*constants[129]
    algebraic[192] = 1.00000/algebraic[190]
    algebraic[193] = algebraic[192]*constants[130]
    algebraic[195] = algebraic[193]+algebraic[194]
    algebraic[186] = 1.00000/algebraic[184]
    algebraic[196] = (algebraic[186]*constants[130])/algebraic[152]
    algebraic[198] = algebraic[196]+algebraic[197]
    algebraic[189] = 1.00000/algebraic[187]
    algebraic[199] = algebraic[189]*states[2]*constants[132]
    algebraic[202] = constants[225]*algebraic[198]*(algebraic[200]+algebraic[199])+constants[226]*algebraic[200]*(constants[225]+algebraic[195])
    algebraic[203] = constants[224]*algebraic[200]*(algebraic[198]+constants[226])+algebraic[198]*algebraic[199]*(constants[224]+algebraic[201])
    algebraic[204] = constants[224]*algebraic[195]*(algebraic[200]+algebraic[199])+algebraic[201]*algebraic[199]*(constants[225]+algebraic[195])
    algebraic[205] = constants[225]*algebraic[201]*(algebraic[198]+constants[226])+algebraic[195]*constants[226]*(constants[224]+algebraic[201])
    algebraic[206] = algebraic[202]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[207] = algebraic[203]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[208] = algebraic[204]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[209] = algebraic[205]/(algebraic[202]+algebraic[203]+algebraic[204]+algebraic[205])
    algebraic[211] = (3.00000*(algebraic[209]*algebraic[200]-algebraic[206]*algebraic[201])+algebraic[208]*algebraic[197])-algebraic[207]*algebraic[194]
    algebraic[212] = algebraic[207]*constants[225]-algebraic[206]*constants[224]
    algebraic[213] = 0.200000*constants[220]*algebraic[210]*(constants[7]*algebraic[211]+constants[8]*algebraic[212])
    algebraic[118] = (4.00000*algebraic[22]*(1.20000*states[2]*exp(2.00000*algebraic[31])-0.341000*constants[2]))/(exp(2.00000*algebraic[31])-1.00000)
    algebraic[123] = constants[208]*algebraic[118]*states[38]
    algebraic[126] = constants[208]*algebraic[118]*algebraic[121]
    algebraic[137] = algebraic[123]+algebraic[126]
    algebraic[124] = constants[209]*algebraic[118]*states[39]
    algebraic[127] = constants[209]*algebraic[118]*algebraic[122]
    algebraic[138] = algebraic[124]+algebraic[127]
    algebraic[143] = (algebraic[138]*algebraic[63]+algebraic[137]*(1.00000-algebraic[63]))*constants[65]
    algebraic[239] = (constants[166]*states[8])/(constants[167]+states[8])
    algebraic[237] = ((1.00000-constants[165])*constants[164]*16.0000*algebraic[22]*(1.20000*states[8]*exp(2.00000*algebraic[31])-0.341000*constants[2]))/(exp(2.00000*algebraic[31])-1.00000)
    algebraic[240] = ((states[2]-states[8])*1.70000)/0.200000
    algebraic[242] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[241] = 1.00000-1.00000/(1.00000+exp((states[7]-0.300000)/0.100000))
    algebraic[243] = custom_piecewise([equal(constants[0] , 2.00000), constants[191]*algebraic[241]*states[54]*states[55]*(states[7]-states[2]) , True, constants[170]*algebraic[241]*states[54]*states[55]*(states[7]-states[2])])
    algebraic[244] = custom_piecewise([equal(constants[0] , 2.00000), constants[192]*1.70000*algebraic[241]*states[54]*states[56]*(states[7]-states[2]) , True, constants[192]*algebraic[241]*states[54]*states[56]*(states[7]-states[2])])
    algebraic[245] = (1.00000-algebraic[242])*algebraic[243]+algebraic[242]*algebraic[244]
    algebraic[43] = 1.00000/(1.00000+(constants[27]*constants[28])/(power(constants[28]+states[2], 2.00000))+(constants[29]*constants[30])/(power(constants[30]+states[2], 2.00000)))
    algebraic[246] = (constants[193]*0.00437500*states[8])/(states[8]+0.000920000)
    algebraic[247] = (constants[193]*2.75000*0.00437500*states[8])/((states[8]+0.000920000)-0.000170000)
    algebraic[248] = 1.00000/(1.00000+constants[18]/algebraic[39])
    algebraic[250] = constants[172]*((1.00000-algebraic[248])*algebraic[246]+algebraic[248]*algebraic[247])
    algebraic[249] = (0.0123000*states[7])/15.0000
    algebraic[41] = 1.00000/(1.00000+(constants[173]*constants[24])/(power(constants[24]+states[8], 2.00000))+(constants[25]*constants[26])/(power(constants[26]+states[8], 2.00000)))
    algebraic[45] = 1.00000/(1.00000+(constants[31]*constants[32])/(power(constants[32]+states[7], 2.00000)))
    algebraic[14] = (constants[194]*(power(states[8]/constants[195], constants[197])-power(states[7]/constants[196], constants[197])))/(1.00000+power(states[8]/constants[195], constants[197])+power(states[7]/constants[196], constants[197]))
    algebraic[91] = 1.00000/(algebraic[89]+algebraic[90])
    algebraic[92] = algebraic[89]/(algebraic[89]+algebraic[90])
    algebraic[97] = 1.00000/(algebraic[95]+algebraic[96])
    algebraic[98] = algebraic[95]/(algebraic[95]+algebraic[96])
    algebraic[110] = 1.00000/(algebraic[107]+algebraic[104])
    algebraic[111] = algebraic[107]/(algebraic[107]+algebraic[104])
    algebraic[116] = 1.00000/(algebraic[114]+algebraic[112])
    algebraic[117] = algebraic[114]/(algebraic[114]+algebraic[112])
    algebraic[125] = algebraic[123]*(1.00000-algebraic[63])+algebraic[124]*algebraic[63]
    algebraic[128] = algebraic[126]*(1.00000-algebraic[63])+algebraic[127]*algebraic[63]
    algebraic[144] = algebraic[143]/algebraic[118]
    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)