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 = 134
sizeStates = 51
sizeConstants = 388
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 time (dimensionless)"
    legend_algebraic[1] = "Istim in component stimulus_current (dimensionless)"
    legend_constants[0] = "stimPeriod in component stimulus_current (dimensionless)"
    legend_constants[1] = "stimDuration in component stimulus_current (dimensionless)"
    legend_constants[2] = "stimCurrent in component stimulus_current (dimensionless)"
    legend_constants[3] = "clamp_ATPi in component parameters (dimensionless)"
    legend_constants[4] = "clamp_ATPi_cyto in component parameters (dimensionless)"
    legend_constants[5] = "Faraday in component parameters (C_per_mmol)"
    legend_constants[6] = "R in component parameters (J_per_mol_per_K)"
    legend_constants[7] = "T in component parameters (K)"
    legend_constants[8] = "LHospitalThreshold in component parameters (mV)"
    legend_constants[9] = "kt_2 in component parameters (dimensionless)"
    legend_constants[10] = "kf_2 in component parameters (dimensionless)"
    legend_constants[11] = "kf_3 in component parameters (dimensionless)"
    legend_constants[12] = "keq in component parameters (dimensionless)"
    legend_constants[13] = "CRT_cyto in component parameters (mM)"
    legend_constants[14] = "CRT_mito in component parameters (mM)"
    legend_constants[15] = "VATPase_cyto in component parameters (dimensionless)"
    legend_constants[16] = "Acap in component parameters (cm2)"
    legend_constants[17] = "AcCoA in component parameters (mM)"
    legend_constants[18] = "aL in component parameters (dimensionless)"
    legend_constants[19] = "b in component parameters (dimensionless)"
    legend_constants[20] = "bL in component parameters (dimensionless)"
    legend_constants[21] = "C_m in component parameters (uF_per_cm2)"
    legend_constants[22] = "Cao in component parameters (mM)"
    legend_constants[23] = "CIK in component parameters (mM)"
    legend_constants[24] = "Cm in component parameters (mM)"
    legend_constants[25] = "CMDNtot in component parameters (mM)"
    legend_constants[26] = "Cmito in component parameters (mM_per_mV)"
    legend_constants[27] = "CPN in component parameters (mM)"
    legend_constants[28] = "CoA in component parameters (mM)"
    legend_constants[29] = "CSQNtot in component parameters (mM)"
    legend_constants[30] = "DpH in component parameters (pH_units)"
    legend_constants[31] = "Dpsio in component parameters (mV)"
    legend_constants[32] = "eta in component parameters (dimensionless)"
    legend_constants[33] = "EtCS in component parameters (mM)"
    legend_constants[34] = "EtID in component parameters (mM)"
    legend_constants[35] = "EtKG in component parameters (mM)"
    legend_constants[36] = "EtMD in component parameters (mM)"
    legend_constants[37] = "EtSDH in component parameters (mM)"
    legend_constants[38] = "FAD in component parameters (mM)"
    legend_constants[39] = "FADH2 in component parameters (mM)"
    legend_constants[40] = "fL in component parameters (per_ms)"
    legend_constants[41] = "fm in component parameters (dimensionless)"
    legend_constants[42] = "fprime in component parameters (per_ms)"
    legend_constants[43] = "g in component parameters (dimensionless)"
    legend_constants[44] = "G_Cab in component parameters (mS_per_cm2)"
    legend_constants[45] = "G_Kp in component parameters (mS_per_cm2)"
    legend_constants[46] = "G_Na in component parameters (mS_per_cm2)"
    legend_constants[47] = "G_Nab in component parameters (mS_per_cm2)"
    legend_constants[48] = "gh in component parameters (mM_per_ms_per_mV)"
    legend_constants[49] = "gL in component parameters (per_ms)"
    legend_constants[50] = "GLU in component parameters (mM)"
    legend_constants[51] = "gprime in component parameters (per_ms)"
    legend_constants[52] = "H in component parameters (mM)"
    legend_constants[53] = "hm in component parameters (dimensionless)"
    legend_constants[54] = "HTRPNtot in component parameters (mM)"
    legend_constants[55] = "ICahalf in component parameters (uA_per_cm2)"
    legend_constants[56] = "INaKmax in component parameters (uA_per_cm2)"
    legend_constants[57] = "IpCamax in component parameters (uA_per_cm2)"
    legend_constants[58] = "KAATeq in component parameters (dimensionless)"
    legend_constants[59] = "KaCa in component parameters (mM)"
    legend_constants[60] = "KACOeq in component parameters (dimensionless)"
    legend_constants[61] = "kact in component parameters (mM)"
    legend_constants[62] = "KADP in component parameters (mM)"
    legend_constants[63] = "kaminus in component parameters (per_ms)"
    legend_constants[64] = "kaplus in component parameters (per_mM4_per_ms)"
    legend_constants[65] = "kbminus in component parameters (per_ms)"
    legend_constants[66] = "kbplus in component parameters (per_mM3_per_ms)"
    legend_constants[67] = "Kca in component parameters (mM)"
    legend_constants[68] = "kcminus in component parameters (per_ms)"
    legend_constants[69] = "kcnsASP in component parameters (per_ms)"
    legend_constants[70] = "kcplus in component parameters (per_ms)"
    legend_constants[71] = "KCS in component parameters (per_ms)"
    legend_constants[72] = "kf1 in component parameters (dimensionless)"
    legend_constants[73] = "kfAAT in component parameters (per_ms)"
    legend_constants[74] = "kfACO in component parameters (per_ms)"
    legend_constants[75] = "Kfb in component parameters (mM)"
    legend_constants[76] = "kfFH in component parameters (per_ms)"
    legend_constants[77] = "KFHeq in component parameters (dimensionless)"
    legend_constants[78] = "kfSL in component parameters (per_mM_per_ms)"
    legend_constants[79] = "kh_1 in component parameters (mM)"
    legend_constants[80] = "kh_2 in component parameters (mM)"
    legend_constants[81] = "Kh1 in component parameters (mM)"
    legend_constants[82] = "Kh2 in component parameters (mM)"
    legend_constants[83] = "Kh3 in component parameters (mM)"
    legend_constants[84] = "Kh4 in component parameters (mM)"
    legend_constants[85] = "khtrpn_minus in component parameters (per_ms)"
    legend_constants[86] = "khtrpn_plus in component parameters (per_mM_per_ms)"
    legend_constants[87] = "Ki_AM in component parameters (mM)"
    legend_constants[88] = "Ki_prime_SR in component parameters (mM)"
    legend_constants[89] = "Ki_SR in component parameters (mM)"
    legend_constants[90] = "Ki1AD_NaK in component parameters (mM)"
    legend_constants[91] = "KiADP_CaP in component parameters (mM)"
    legend_constants[92] = "kIDH in component parameters (per_ms)"
    legend_constants[93] = "KidhNADH in component parameters (mM)"
    legend_constants[94] = "KiFUM in component parameters (mM)"
    legend_constants[95] = "Kioaa in component parameters (mM)"
    legend_constants[96] = "KiOxaa in component parameters (mM)"
    legend_constants[97] = "kKGDH in component parameters (per_ms)"
    legend_constants[98] = "kltrpn_plus in component parameters (per_mM_per_ms)"
    legend_constants[99] = "kltrpn_minus in component parameters (per_ms)"
    legend_constants[100] = "Km1AT_NaK in component parameters (mM)"
    legend_constants[101] = "Km1ATP_CaP in component parameters (mM)"
    legend_constants[102] = "Km2ATP_CaP in component parameters (mM)"
    legend_constants[103] = "KmAcCoA in component parameters (mM)"
    legend_constants[104] = "Kmal in component parameters (mM)"
    legend_constants[105] = "KmATP_AM in component parameters (mM)"
    legend_constants[106] = "KmATP_SR in component parameters (mM)"
    legend_constants[107] = "KmCMDN in component parameters (mM)"
    legend_constants[108] = "KmCa in component parameters (mM)"
    legend_constants[109] = "KmCSQN in component parameters (mM)"
    legend_constants[110] = "kMDH in component parameters (per_ms)"
    legend_constants[111] = "Kmg in component parameters (mM)"
    legend_constants[112] = "KmIDNAD in component parameters (mM)"
    legend_constants[113] = "Kmiso in component parameters (mM)"
    legend_constants[114] = "KmKG in component parameters (mM)"
    legend_constants[115] = "KmKGNAD in component parameters (mM)"
    legend_constants[116] = "KmKo in component parameters (mM)"
    legend_constants[117] = "KmmNAD in component parameters (mM)"
    legend_constants[118] = "KmNa in component parameters (mM)"
    legend_constants[119] = "KmNai in component parameters (mM)"
    legend_constants[120] = "KmnsCa in component parameters (mM)"
    legend_constants[121] = "KmOaa in component parameters (mM)"
    legend_constants[122] = "KmpCa in component parameters (mM)"
    legend_constants[123] = "KmSucc in component parameters (mM)"
    legend_constants[124] = "Kna in component parameters (mM)"
    legend_constants[125] = "kNaCa in component parameters (uA_per_cm2)"
    legend_constants[126] = "Knca in component parameters (mM)"
    legend_constants[127] = "Ko in component parameters (mM)"
    legend_constants[128] = "Koff in component parameters (dimensionless)"
    legend_constants[129] = "Krb in component parameters (mM)"
    legend_constants[130] = "kres in component parameters (dimensionless)"
    legend_constants[131] = "kresf in component parameters (dimensionless)"
    legend_constants[132] = "ksat in component parameters (dimensionless)"
    legend_constants[133] = "kSDH in component parameters (per_ms)"
    legend_constants[134] = "KSLeq in component parameters (dimensionless)"
    legend_constants[135] = "KSR in component parameters (dimensionless)"
    legend_constants[136] = "ktrans in component parameters (mM)"
    legend_constants[137] = "kTrop_pn in component parameters (per_ms)"
    legend_constants[138] = "L in component parameters (dimensionless)"
    legend_constants[139] = "LTRPNtot in component parameters (mM)"
    legend_constants[140] = "mcoop in component parameters (dimensionless)"
    legend_constants[141] = "Mg in component parameters (mM)"
    legend_constants[142] = "n in component parameters (dimensionless)"
    legend_constants[143] = "na in component parameters (dimensionless)"
    legend_constants[144] = "Nao in component parameters (mM)"
    legend_constants[145] = "ncoop in component parameters (dimensionless)"
    legend_constants[146] = "Nfb in component parameters (dimensionless)"
    legend_constants[147] = "nID in component parameters (dimensionless)"
    legend_constants[148] = "nKG in component parameters (dimensionless)"
    legend_constants[149] = "Nrb in component parameters (dimensionless)"
    legend_constants[150] = "omega in component parameters (per_ms)"
    legend_constants[151] = "p1 in component parameters (dimensionless)"
    legend_constants[152] = "p2 in component parameters (dimensionless)"
    legend_constants[153] = "p3 in component parameters (dimensionless)"
    legend_constants[154] = "pa in component parameters (per_ms)"
    legend_constants[155] = "pb in component parameters (per_ms)"
    legend_constants[156] = "pc1 in component parameters (per_ms)"
    legend_constants[157] = "pc2 in component parameters (per_ms)"
    legend_constants[158] = "PCa in component parameters (cm_per_s)"
    legend_constants[159] = "Pi in component parameters (mM)"
    legend_constants[160] = "PK in component parameters (cm_per_s)"
    legend_constants[161] = "PnsK in component parameters (cm_per_s)"
    legend_constants[162] = "PnsNa in component parameters (cm_per_s)"
    legend_constants[163] = "r1 in component parameters (dimensionless)"
    legend_constants[164] = "r2 in component parameters (dimensionless)"
    legend_constants[165] = "r3 in component parameters (dimensionless)"
    legend_constants[166] = "ra in component parameters (per_ms)"
    legend_constants[167] = "rb in component parameters (per_ms)"
    legend_constants[168] = "rc1 in component parameters (per_ms)"
    legend_constants[169] = "rc2 in component parameters (per_ms)"
    legend_constants[170] = "rhoF1 in component parameters (mM)"
    legend_constants[171] = "rhoREF in component parameters (mM)"
    legend_constants[172] = "rhoREN in component parameters (mM)"
    legend_constants[173] = "tautr in component parameters (ms)"
    legend_constants[174] = "tauxfer in component parameters (ms)"
    legend_constants[175] = "V_AM_scaler in component parameters (dimensionless)"
    legend_constants[176] = "V_AM_max in component parameters (mM_per_ms)"
    legend_constants[177] = "v1 in component parameters (per_ms)"
    legend_constants[178] = "VJSR in component parameters (uL)"
    legend_constants[179] = "vmaxf in component parameters (per_ms)"
    legend_constants[180] = "vmaxr in component parameters (per_ms)"
    legend_constants[181] = "VmDT in component parameters (mM_per_ms)"
    legend_constants[182] = "VmNC in component parameters (mM_per_ms)"
    legend_constants[183] = "Vmuni in component parameters (mM_per_ms)"
    legend_constants[184] = "Vmyo in component parameters (uL)"
    legend_constants[185] = "VNSR in component parameters (uL)"
    legend_constants[186] = "VSS in component parameters (uL)"
    legend_constants[187] = "zeta in component parameters (N_per_mm2)"
    legend_constants[188] = "f_xb in component parameters (per_ms)"
    legend_constants[189] = "SL in component parameters (um)"
    legend_constants[190] = "gmin_xb in component parameters (per_ms)"
    legend_constants[191] = "zNa in component parameters (dimensionless)"
    legend_constants[192] = "zK in component parameters (dimensionless)"
    legend_constants[193] = "zCa in component parameters (dimensionless)"
    legend_constants[194] = "one in component parameters (dimensionless)"
    legend_constants[195] = "p_KNa in component parameters (dimensionless)"
    legend_constants[196] = "ATPi_initial in component initial_values (dimensionless)"
    legend_constants[197] = "V_initial in component initial_values (dimensionless)"
    legend_constants[198] = "C1_RyR_initial in component initial_values (dimensionless)"
    legend_constants[199] = "C2_RyR_initial in component initial_values (dimensionless)"
    legend_constants[200] = "O2_RyR_initial in component initial_values (dimensionless)"
    legend_constants[201] = "mNa_initial in component initial_values (dimensionless)"
    legend_constants[202] = "hNa_initial in component initial_values (dimensionless)"
    legend_constants[203] = "jNa_initial in component initial_values (dimensionless)"
    legend_constants[204] = "xKs_initial in component initial_values (dimensionless)"
    legend_constants[205] = "Open_initial in component initial_values (dimensionless)"
    legend_constants[206] = "OCa_initial in component initial_values (dimensionless)"
    legend_constants[207] = "yCa_initial in component initial_values (dimensionless)"
    legend_constants[208] = "Ki_initial in component initial_values (dimensionless)"
    legend_constants[209] = "Nai_initial in component initial_values (dimensionless)"
    legend_constants[210] = "Cai_initial in component initial_values (dimensionless)"
    legend_constants[211] = "ADPm_initial in component initial_values (dimensionless)"
    legend_constants[212] = "Dpsi_initial in component initial_values (dimensionless)"
    legend_constants[213] = "NADH_initial in component initial_values (dimensionless)"
    legend_constants[214] = "Oaa_initial in component initial_values (dimensionless)"
    legend_constants[215] = "AKG_initial in component initial_values (dimensionless)"
    legend_constants[216] = "SCoA_initial in component initial_values (dimensionless)"
    legend_constants[217] = "Succ_initial in component initial_values (dimensionless)"
    legend_constants[218] = "FUM_initial in component initial_values (dimensionless)"
    legend_constants[219] = "MAL_initial in component initial_values (dimensionless)"
    legend_constants[220] = "ISOC_initial in component initial_values (dimensionless)"
    legend_constants[221] = "Cam_initial in component initial_values (dimensionless)"
    legend_constants[222] = "CaNSR_initial in component initial_values (dimensionless)"
    legend_constants[223] = "CaJSR_initial in component initial_values (dimensionless)"
    legend_constants[224] = "CaSS_initial in component initial_values (dimensionless)"
    legend_constants[225] = "N1_initial in component initial_values (dimensionless)"
    legend_constants[226] = "P0_initial in component initial_values (dimensionless)"
    legend_constants[227] = "P1_initial in component initial_values (dimensionless)"
    legend_constants[228] = "P2_initial in component initial_values (dimensionless)"
    legend_constants[229] = "P3_initial in component initial_values (dimensionless)"
    legend_constants[230] = "LTRPNCa_initial in component initial_values (dimensionless)"
    legend_constants[231] = "HTRPNCa_initial in component initial_values (dimensionless)"
    legend_constants[232] = "C1_initial in component initial_values (dimensionless)"
    legend_constants[233] = "CCa0_initial in component initial_values (dimensionless)"
    legend_constants[234] = "C0_initial in component initial_values (dimensionless)"
    legend_constants[235] = "C2_initial in component initial_values (dimensionless)"
    legend_constants[236] = "CCa1_initial in component initial_values (dimensionless)"
    legend_constants[237] = "C3_initial in component initial_values (dimensionless)"
    legend_constants[238] = "CCa2_initial in component initial_values (dimensionless)"
    legend_constants[239] = "C4_initial in component initial_values (dimensionless)"
    legend_constants[240] = "CCa3_initial in component initial_values (dimensionless)"
    legend_constants[241] = "CCa4_initial in component initial_values (dimensionless)"
    legend_constants[242] = "CrPi_mito_initial in component initial_values (dimensionless)"
    legend_constants[243] = "CrPi_cyto_initial in component initial_values (dimensionless)"
    legend_constants[244] = "ATPi_cyto_initial in component initial_values (dimensionless)"
    legend_constants[245] = "ASP_initial in component initial_values (dimensionless)"
    legend_constants[246] = "N0_initial in component initial_values (dimensionless)"
    legend_constants[247] = "Vtotal in component computed_constants (uL)"
    legend_constants[303] = "Vmito in component computed_constants (uL)"
    legend_constants[248] = "f_01 in component computed_constants (per_ms)"
    legend_constants[304] = "f_12 in component computed_constants (per_ms)"
    legend_constants[312] = "f_23 in component computed_constants (per_ms)"
    legend_constants[316] = "g0_01 in component computed_constants (per_ms)"
    legend_constants[321] = "g0_12 in component computed_constants (per_ms)"
    legend_constants[326] = "g0_23 in component computed_constants (per_ms)"
    legend_constants[329] = "paths in component computed_constants (per_ms3)"
    legend_constants[332] = "P1max in component computed_constants (dimensionless)"
    legend_constants[338] = "P2max in component computed_constants (dimensionless)"
    legend_constants[343] = "P3max in component computed_constants (dimensionless)"
    legend_constants[345] = "Fmax in component computed_constants (dimensionless)"
    legend_constants[347] = "fnormmax in component computed_constants (dimensionless)"
    legend_constants[249] = "SLnorm in component computed_constants (dimensionless)"
    legend_constants[250] = "Ktrop_Ca in component computed_constants (mM)"
    legend_constants[305] = "Ktrop_half in component computed_constants (dimensionless)"
    legend_constants[251] = "Ntrop in component computed_constants (dimensionless)"
    legend_constants[349] = "fnormmax2 in component computed_constants (dimensionless)"
    legend_constants[351] = "La in component computed_constants (um)"
    legend_constants[353] = "Lm_prime in component computed_constants (um)"
    legend_constants[355] = "Lz in component computed_constants (um)"
    legend_constants[357] = "Lb in component computed_constants (um)"
    legend_constants[359] = "Lm in component computed_constants (um)"
    legend_constants[330] = "mod_factor in component computed_constants (dimensionless)"
    legend_constants[333] = "g_01_mod in component computed_constants (per_ms)"
    legend_constants[334] = "g_12_mod in component computed_constants (per_ms)"
    legend_constants[335] = "g_23_mod in component computed_constants (per_ms)"
    legend_constants[336] = "g_01_off in component computed_constants (per_ms)"
    legend_constants[339] = "g_01_off_mod in component computed_constants (per_ms)"
    legend_constants[301] = "RT_over_F in component computed_constants (mV)"
    legend_constants[252] = "G_Ks in component computed_constants (mS_per_cm2)"
    legend_constants[310] = "G_K1 in component computed_constants (mS_per_cm2)"
    legend_constants[253] = "inv_5p98 in component computed_constants (dimensionless)"
    legend_constants[314] = "FaradayE3 in component computed_constants (C_per_mol)"
    legend_constants[254] = "Cao_341 in component computed_constants (mM)"
    legend_constants[255] = "ICamax_LHospital in component computed_constants (uA_per_cm2)"
    legend_constants[256] = "Pca_4En3 in component computed_constants (cm_per_ms)"
    legend_constants[319] = "F_over_RT in component computed_constants (per_mV)"
    legend_constants[257] = "inv_ICahalf in component computed_constants (cm2_per_uA)"
    legend_constants[317] = "PKFe3 in component computed_constants (C_cm_per_s_per_mol)"
    legend_constants[324] = "sigma in component computed_constants (dimensionless)"
    legend_constants[258] = "inv_KmNai in component computed_constants (per_mM)"
    legend_constants[327] = "INaKmax_Ko_Ko_KmKo in component computed_constants (uA_per_cm2)"
    legend_constants[331] = "inv_Ki1AD_NaK in component computed_constants (per_mM)"
    legend_constants[259] = "eta_1 in component computed_constants (dimensionless)"
    legend_constants[260] = "Nao_p3 in component computed_constants (mM2)"
    legend_constants[261] = "KmCa_Cao in component computed_constants (mM3_cm2_per_uA)"
    legend_constants[306] = "KmCa_Cao_ksat in component computed_constants (mM3_cm2_per_uA)"
    legend_constants[262] = "inv_KiADP_CaP in component computed_constants (mM)"
    legend_constants[263] = "KmnsCa_p3 in component computed_constants (mM3)"
    legend_constants[318] = "V_AM_scaler_max_1_f_01_12_23 in component computed_constants (mM_per_ms4)"
    legend_constants[264] = "KmATP_AM_Ki_AM in component computed_constants (dimensionless)"
    legend_constants[307] = "DmuH_Constant in component computed_constants (mV)"
    legend_constants[265] = "VCS_C1 in component computed_constants (mM_per_ms)"
    legend_constants[266] = "one_inv_KACOeq in component computed_constants (dimensionless)"
    legend_constants[267] = "VIDH_Constant in component computed_constants (dimensionless)"
    legend_constants[268] = "kIDH_EtID in component computed_constants (mM_per_ms)"
    legend_constants[269] = "inv_KADP in component computed_constants (per_mM)"
    legend_constants[270] = "inv_KaCa in component computed_constants (per_mM)"
    legend_constants[271] = "inv_KidhNADH in component computed_constants (per_mM)"
    legend_constants[272] = "KmKGNAD_KmIDNAD in component computed_constants (dimensionless)"
    legend_constants[273] = "Mg_Kmg_1 in component computed_constants (dimensionless)"
    legend_constants[308] = "Mg_Kmg_1_Kca in component computed_constants (mM)"
    legend_constants[274] = "kKGDH_EtKG in component computed_constants (mM_per_ms)"
    legend_constants[275] = "CoA_KSLeq in component computed_constants (mM)"
    legend_constants[276] = "kSDH_EtSDH in component computed_constants (mM_per_ms)"
    legend_constants[277] = "KmSucc_KiFUM in component computed_constants (dimensionless)"
    legend_constants[278] = "inv_KiOxaa in component computed_constants (per_mM)"
    legend_constants[279] = "kfFH_KFHeq in component computed_constants (per_ms)"
    legend_constants[280] = "kMDH_Fh_EtMD in component computed_constants (mM_per_ms)"
    legend_constants[281] = "Kmal_Kioaa in component computed_constants (dimensionless)"
    legend_constants[282] = "VAAT_Constant in component computed_constants (mM_per_ms)"
    legend_constants[283] = "kcnsASP_KAATeq_kfAAT in component computed_constants (dimensionless)"
    legend_constants[284] = "KfAAT_GLU in component computed_constants (per_ms_per_mM)"
    legend_constants[285] = "KfAAT_KAATeq in component computed_constants (per_ms)"
    legend_constants[286] = "kres_sq_KmIDNAD in component computed_constants (per_mM)"
    legend_constants[337] = "exp_6_FRT_Dpsio in component computed_constants (dimensionless)"
    legend_constants[342] = "FRT_6_g in component computed_constants (per_mV)"
    legend_constants[344] = "ra_rc1_exp_6_FRT_Dpsio in component computed_constants (per_ms)"
    legend_constants[346] = "r1_exp_6_FRT_Dpsio in component computed_constants (dimensionless)"
    legend_constants[348] = "rhoREN_ra_rc1_exp_6_FRT_Dpsio in component computed_constants (mM_per_ms)"
    legend_constants[350] = "rhoREN_rc2 in component computed_constants (mM_per_ms)"
    legend_constants[352] = "rhoREN_ra in component computed_constants (mM_per_ms)"
    legend_constants[354] = "rhoRen_6_ra in component computed_constants (mM_per_ms)"
    legend_constants[356] = "rhoRen_6_ra_rb in component computed_constants (mM_per_ms)"
    legend_constants[358] = "AREF in component computed_constants (mV)"
    legend_constants[360] = "exp_AREF_FRT in component computed_constants (dimensionless)"
    legend_constants[361] = "ra_rc2_exp_AREF_FRT in component computed_constants (per_ms)"
    legend_constants[362] = "VFO_C1 in component computed_constants (per_ms)"
    legend_constants[364] = "ra_exp_AREF_FRT in component computed_constants (per_ms)"
    legend_constants[367] = "ra_rb in component computed_constants (per_ms)"
    legend_constants[369] = "VFO_VHFe_C1 in component computed_constants (per_ms)"
    legend_constants[370] = "r2_r3_exp_AREF_FRT in component computed_constants (dimensionless)"
    legend_constants[371] = "exp_3_FRT_Dpsio in component computed_constants (dimensionless)"
    legend_constants[372] = "FRT_3 in component computed_constants (per_mV)"
    legend_constants[287] = "kf1_Pi in component computed_constants (mM)"
    legend_constants[373] = "VATPase_C1 in component computed_constants (per_ms)"
    legend_constants[374] = "pa_pb_3 in component computed_constants (per_ms)"
    legend_constants[375] = "pa_300 in component computed_constants (per_ms)"
    legend_constants[376] = "p1_exp_3_FRT_Dpsio in component computed_constants (dimensionless)"
    legend_constants[322] = "hm_F_over_RT in component computed_constants (per_mV)"
    legend_constants[288] = "VmDT_75 in component computed_constants (mM_per_ms)"
    legend_constants[289] = "VmDT_20 in component computed_constants (mM_per_ms)"
    legend_constants[290] = "inv_Kfb in component computed_constants (per_mM)"
    legend_constants[291] = "inv_Krb in component computed_constants (per_mM)"
    legend_constants[292] = "inv_tautr in component computed_constants (per_ms)"
    legend_constants[293] = "inv_tauxfer in component computed_constants (per_ms)"
    legend_constants[377] = "KmATP_SR_Ki_SR in component computed_constants (dimensionless)"
    legend_constants[378] = "inv_Ki_prime_SR in component computed_constants (per_mM)"
    legend_constants[365] = "alpha_SL_fnormmax2 in component computed_constants (dimensionless)"
    legend_constants[366] = "alpha_SL_fnormmax in component computed_constants (dimensionless)"
    legend_constants[313] = "inv_LTRPNtot_Ktrop_half in component computed_constants (per_mM)"
    legend_constants[309] = "kTrop_pn_f_01 in component computed_constants (per_ms)"
    legend_constants[340] = "kTrop_pn_f_12_g_01_mod in component computed_constants (per_ms)"
    legend_constants[341] = "f_23_g_12_mod in component computed_constants (per_ms)"
    legend_constants[294] = "CMDNtot_KmCMDN in component computed_constants (mM2)"
    legend_constants[295] = "CSQNtot_KmCSQN in component computed_constants (mM2)"
    legend_constants[296] = "inv_ktrans in component computed_constants (per_mM)"
    legend_constants[297] = "inv_kact in component computed_constants (per_mM)"
    legend_constants[298] = "Vmuni_ktrans in component computed_constants (per_ms)"
    legend_constants[323] = "FRT2 in component computed_constants (per_mV)"
    legend_constants[299] = "b_05 in component computed_constants (dimensionless)"
    legend_constants[379] = "Acap_Vmyo_F in component computed_constants (mmol_per_C_per_cm)"
    legend_constants[380] = "Acap_VSS_F in component computed_constants (mmol_per_C_per_cm)"
    legend_constants[381] = "VJSR_VSS in component computed_constants (dimensionless)"
    legend_constants[382] = "Vmyo_VSS in component computed_constants (dimensionless)"
    legend_constants[383] = "Vmyo_VNSR in component computed_constants (dimensionless)"
    legend_constants[384] = "VJSR_VNSR in component computed_constants (dimensionless)"
    legend_constants[385] = "inv_C_m in component computed_constants (cm2_per_uF)"
    legend_constants[302] = "inv_bL in component computed_constants (dimensionless)"
    legend_constants[386] = "inv_Cmito in component computed_constants (mV_per_mM)"
    legend_constants[387] = "two_b in component computed_constants (dimensionless)"
    legend_constants[300] = "inv_keq in component computed_constants (dimensionless)"
    legend_constants[368] = "zeta_alpha_SL_fnormmax in component computed_constants (N_per_mm2)"
    legend_constants[363] = "alpha_SL in component computed_constants (dimensionless)"
    legend_algebraic[7] = "ADP in component model_2 (dimensionless)"
    legend_states[0] = "ATPi in component model_2 (dimensionless)"
    legend_algebraic[15] = "inv_ATPi in component model_2 (dimensionless)"
    legend_algebraic[19] = "VF_over_RT in component model_2 (dimensionless)"
    legend_states[1] = "V in component model_2 (dimensionless)"
    legend_algebraic[22] = "exp_VF_over_RT in component model_2 (dimensionless)"
    legend_algebraic[25] = "VFsq_over_RT in component model_2 (dimensionless)"
    legend_algebraic[27] = "exp2VFRT in component model_2 (dimensionless)"
    legend_algebraic[29] = "O1_RyR in component model_2 (dimensionless)"
    legend_states[2] = "C1_RyR in component model_2 (dimensionless)"
    legend_states[3] = "C2_RyR in component model_2 (dimensionless)"
    legend_states[4] = "O2_RyR in component model_2 (dimensionless)"
    legend_algebraic[0] = "V_30 in component model_2 (dimensionless)"
    legend_algebraic[124] = "V_E_K in component model_2 (dimensionless)"
    legend_algebraic[121] = "INa in component model_2 (dimensionless)"
    legend_states[5] = "mNa in component model_2 (dimensionless)"
    legend_states[6] = "hNa in component model_2 (dimensionless)"
    legend_states[7] = "jNa in component model_2 (dimensionless)"
    legend_algebraic[133] = "IKs in component model_2 (dimensionless)"
    legend_states[8] = "xKs in component model_2 (dimensionless)"
    legend_algebraic[125] = "K1Alpha in component model_2 (dimensionless)"
    legend_algebraic[126] = "K1Beta in component model_2 (dimensionless)"
    legend_algebraic[127] = "K1_inf in component model_2 (dimensionless)"
    legend_algebraic[128] = "IK1 in component model_2 (dimensionless)"
    legend_algebraic[122] = "INab in component model_2 (dimensionless)"
    legend_algebraic[129] = "IKp in component model_2 (dimensionless)"
    legend_algebraic[31] = "ICamax in component model_2 (dimensionless)"
    legend_algebraic[33] = "ICaK in component model_2 (dimensionless)"
    legend_states[9] = "Open in component model_2 (dimensionless)"
    legend_states[10] = "OCa in component model_2 (dimensionless)"
    legend_states[11] = "yCa in component model_2 (dimensionless)"
    legend_states[12] = "Ki in component model_2 (dimensionless)"
    legend_algebraic[35] = "ICa in component model_2 (dimensionless)"
    legend_algebraic[37] = "NaiP1p5 in component model_2 (dimensionless)"
    legend_states[13] = "Nai in component model_2 (dimensionless)"
    legend_algebraic[39] = "INaK in component model_2 (dimensionless)"
    legend_algebraic[41] = "exp_eta_VF_over_RT in component model_2 (dimensionless)"
    legend_algebraic[43] = "exp_eta1_VF_over_RT in component model_2 (dimensionless)"
    legend_algebraic[45] = "INaCa in component model_2 (dimensionless)"
    legend_states[14] = "Cai in component model_2 (dimensionless)"
    legend_algebraic[131] = "ICab in component model_2 (dimensionless)"
    legend_algebraic[47] = "IpCa in component model_2 (dimensionless)"
    legend_algebraic[49] = "CaiP3 in component model_2 (dimensionless)"
    legend_algebraic[51] = "common in component model_2 (dimensionless)"
    legend_algebraic[53] = "InsNa in component model_2 (dimensionless)"
    legend_algebraic[55] = "InsK in component model_2 (dimensionless)"
    legend_algebraic[57] = "InsCa in component model_2 (dimensionless)"
    legend_algebraic[59] = "V_AM in component model_2 (dimensionless)"
    legend_algebraic[61] = "ATPm in component model_2 (dimensionless)"
    legend_states[15] = "ADPm in component model_2 (dimensionless)"
    legend_algebraic[63] = "DmuH in component model_2 (dimensionless)"
    legend_states[16] = "Dpsi in component model_2 (dimensionless)"
    legend_algebraic[65] = "NAD in component model_2 (dimensionless)"
    legend_states[17] = "NADH in component model_2 (dimensionless)"
    legend_algebraic[67] = "KmIDNAD_NAD in component model_2 (dimensionless)"
    legend_algebraic[68] = "exp_FRT_6_g_DmuH in component model_2 (dimensionless)"
    legend_algebraic[69] = "FRT2_Dpsi in component model_2 (dimensionless)"
    legend_algebraic[70] = "VCS in component model_2 (dimensionless)"
    legend_states[18] = "Oaa in component model_2 (dimensionless)"
    legend_algebraic[71] = "VACO in component model_2 (dimensionless)"
    legend_states[19] = "AKG in component model_2 (dimensionless)"
    legend_states[20] = "SCoA in component model_2 (dimensionless)"
    legend_states[21] = "Succ in component model_2 (dimensionless)"
    legend_states[22] = "FUM in component model_2 (dimensionless)"
    legend_states[23] = "MAL in component model_2 (dimensionless)"
    legend_states[24] = "ISOC in component model_2 (dimensionless)"
    legend_algebraic[72] = "Fa in component model_2 (dimensionless)"
    legend_states[25] = "Cam in component model_2 (dimensionless)"
    legend_algebraic[73] = "Fi in component model_2 (dimensionless)"
    legend_algebraic[74] = "VIDH in component model_2 (dimensionless)"
    legend_algebraic[75] = "a__1 in component model_2 (dimensionless)"
    legend_algebraic[76] = "VKGDH in component model_2 (dimensionless)"
    legend_algebraic[77] = "VSL in component model_2 (dimensionless)"
    legend_algebraic[78] = "VSDH in component model_2 (dimensionless)"
    legend_algebraic[79] = "VFH in component model_2 (dimensionless)"
    legend_algebraic[80] = "VMDH in component model_2 (dimensionless)"
    legend_algebraic[81] = "VAAT in component model_2 (dimensionless)"
    legend_algebraic[82] = "AREN in component model_2 (dimensionless)"
    legend_algebraic[83] = "denominator1 in component model_2 (dimensionless)"
    legend_algebraic[86] = "denominator2 in component model_2 (dimensionless)"
    legend_algebraic[90] = "denominator3 in component model_2 (dimensionless)"
    legend_algebraic[84] = "VNO in component model_2 (dimensionless)"
    legend_algebraic[85] = "VHNe in component model_2 (dimensionless)"
    legend_algebraic[87] = "VHFe in component model_2 (dimensionless)"
    legend_algebraic[88] = "exp_3FRT_DmuH in component model_2 (dimensionless)"
    legend_algebraic[89] = "AF1 in component model_2 (dimensionless)"
    legend_algebraic[91] = "VATPase in component model_2 (dimensionless)"
    legend_algebraic[92] = "Vhu in component model_2 (dimensionless)"
    legend_algebraic[93] = "ATPi_ADP in component model_2 (dimensionless)"
    legend_algebraic[94] = "ADPm_ATPm in component model_2 (dimensionless)"
    legend_algebraic[95] = "VANT in component model_2 (dimensionless)"
    legend_algebraic[96] = "Vhleak in component model_2 (dimensionless)"
    legend_algebraic[2] = "MAlpha in component model_2 (dimensionless)"
    legend_algebraic[8] = "MBeta in component model_2 (dimensionless)"
    legend_algebraic[13] = "inv_MBeta_MAlpha in component model_2 (dimensionless)"
    legend_algebraic[17] = "tmNa in component model_2 (dimensionless)"
    legend_algebraic[3] = "HAlpha in component model_2 (dimensionless)"
    legend_algebraic[9] = "HBeta in component model_2 (dimensionless)"
    legend_algebraic[4] = "JAlpha in component model_2 (dimensionless)"
    legend_algebraic[10] = "JBeta in component model_2 (dimensionless)"
    legend_algebraic[97] = "fb in component model_2 (dimensionless)"
    legend_algebraic[98] = "rb in component model_2 (per_ms)"
    legend_states[26] = "CaNSR in component model_2 (dimensionless)"
    legend_algebraic[99] = "Jup in component model_2 (dimensionless)"
    legend_algebraic[101] = "Jrel in component model_2 (dimensionless)"
    legend_states[27] = "CaJSR in component model_2 (dimensionless)"
    legend_states[28] = "CaSS in component model_2 (dimensionless)"
    legend_algebraic[102] = "Jtr in component model_2 (dimensionless)"
    legend_algebraic[105] = "Jxfer in component model_2 (dimensionless)"
    legend_algebraic[108] = "P1_N1_P2_P3 in component model_2 (dimensionless)"
    legend_states[29] = "N1 in component model_2 (dimensionless)"
    legend_states[30] = "P0 in component model_2 (dimensionless)"
    legend_states[31] = "P1 in component model_2 (dimensionless)"
    legend_states[32] = "P2 in component model_2 (dimensionless)"
    legend_states[33] = "P3 in component model_2 (dimensionless)"
    legend_algebraic[24] = "N1_differential in component model_2 (dimensionless)"
    legend_algebraic[11] = "P0_differential in component model_2 (dimensionless)"
    legend_algebraic[14] = "P1_differential in component model_2 (dimensionless)"
    legend_algebraic[18] = "P2_differential in component model_2 (dimensionless)"
    legend_algebraic[21] = "P3_differential in component model_2 (dimensionless)"
    legend_algebraic[111] = "FN_Ca in component model_2 (dimensionless)"
    legend_algebraic[109] = "force_norm in component model_2 (dimensionless)"
    legend_algebraic[110] = "force in component model_2 (dimensionless)"
    legend_algebraic[5] = "kTrop_np in component model_2 (dimensionless)"
    legend_states[34] = "LTRPNCa in component model_2 (dimensionless)"
    legend_states[35] = "HTRPNCa in component model_2 (dimensionless)"
    legend_algebraic[112] = "LTRPNCa_differential in component model_2 (dimensionless)"
    legend_algebraic[113] = "HTRPNCa_differential in component model_2 (dimensionless)"
    legend_algebraic[114] = "Jtrpn in component model_2 (dimensionless)"
    legend_algebraic[106] = "beta_SS in component model_2 (dimensionless)"
    legend_algebraic[107] = "beta_JSR in component model_2 (dimensionless)"
    legend_algebraic[115] = "beta_i in component model_2 (dimensionless)"
    legend_algebraic[116] = "Cai_ktrans_plus1 in component model_2 (dimensionless)"
    legend_algebraic[117] = "Cai_ktrans_plus1_p3 in component model_2 (dimensionless)"
    legend_algebraic[118] = "Vuni in component model_2 (dimensionless)"
    legend_algebraic[119] = "VnaCa in component model_2 (dimensionless)"
    legend_algebraic[6] = "alpha in component model_2 (dimensionless)"
    legend_algebraic[12] = "beta in component model_2 (dimensionless)"
    legend_algebraic[16] = "alpha_prime in component model_2 (dimensionless)"
    legend_algebraic[20] = "beta_prime in component model_2 (dimensionless)"
    legend_algebraic[23] = "C0_to_C1 in component model_2 (dimensionless)"
    legend_algebraic[26] = "C1_to_C2 in component model_2 (dimensionless)"
    legend_algebraic[28] = "C2_to_C3 in component model_2 (dimensionless)"
    legend_algebraic[30] = "C3_to_C4 in component model_2 (dimensionless)"
    legend_algebraic[32] = "CCa0_to_CCa1 in component model_2 (dimensionless)"
    legend_algebraic[34] = "CCa1_to_CCa2 in component model_2 (dimensionless)"
    legend_algebraic[36] = "CCa2_to_CCa3 in component model_2 (dimensionless)"
    legend_algebraic[38] = "CCa3_to_CCa4 in component model_2 (dimensionless)"
    legend_algebraic[40] = "C1_to_C0 in component model_2 (dimensionless)"
    legend_algebraic[42] = "C2_to_C1 in component model_2 (dimensionless)"
    legend_algebraic[44] = "C3_to_C2 in component model_2 (dimensionless)"
    legend_algebraic[46] = "C4_to_C3 in component model_2 (dimensionless)"
    legend_algebraic[48] = "CCa1_to_CCa0 in component model_2 (dimensionless)"
    legend_algebraic[50] = "CCa2_to_CCa1 in component model_2 (dimensionless)"
    legend_algebraic[52] = "CCa3_to_CCa2 in component model_2 (dimensionless)"
    legend_algebraic[54] = "CCa4_to_CCa3 in component model_2 (dimensionless)"
    legend_algebraic[56] = "gamma in component model_2 (dimensionless)"
    legend_algebraic[58] = "C0_to_CCa0 in component model_2 (dimensionless)"
    legend_algebraic[60] = "C1_to_CCa1 in component model_2 (dimensionless)"
    legend_algebraic[62] = "C2_to_CCa2 in component model_2 (dimensionless)"
    legend_algebraic[64] = "C3_to_CCa3 in component model_2 (dimensionless)"
    legend_algebraic[66] = "C4_to_CCa4 in component model_2 (dimensionless)"
    legend_constants[311] = "CCa0_to_C0 in component model_2 (dimensionless)"
    legend_constants[315] = "CCa1_to_C1 in component model_2 (dimensionless)"
    legend_constants[320] = "CCa2_to_C2 in component model_2 (dimensionless)"
    legend_constants[325] = "CCa3_to_C3 in component model_2 (dimensionless)"
    legend_constants[328] = "CCa4_to_C4 in component model_2 (dimensionless)"
    legend_states[36] = "C1 in component model_2 (dimensionless)"
    legend_states[37] = "CCa0 in component model_2 (dimensionless)"
    legend_states[38] = "C0 in component model_2 (dimensionless)"
    legend_states[39] = "C2 in component model_2 (dimensionless)"
    legend_states[40] = "CCa1 in component model_2 (dimensionless)"
    legend_states[41] = "C3 in component model_2 (dimensionless)"
    legend_states[42] = "CCa2 in component model_2 (dimensionless)"
    legend_states[43] = "C4 in component model_2 (dimensionless)"
    legend_states[44] = "CCa3 in component model_2 (dimensionless)"
    legend_states[45] = "CCa4 in component model_2 (dimensionless)"
    legend_algebraic[100] = "Vt_CRP2 in component model_2 (dimensionless)"
    legend_states[46] = "CrPi_mito in component model_2 (dimensionless)"
    legend_states[47] = "CrPi_cyto in component model_2 (dimensionless)"
    legend_algebraic[103] = "VCK_cyto in component model_2 (dimensionless)"
    legend_states[48] = "ATPi_cyto in component model_2 (dimensionless)"
    legend_algebraic[104] = "VCK_mito in component model_2 (dimensionless)"
    legend_states[49] = "ASP in component model_2 (dimensionless)"
    legend_states[50] = "N0 in component model_2 (dimensionless)"
    legend_algebraic[123] = "reversal_potential in component EK (dimensionless)"
    legend_algebraic[120] = "reversal_potential in component ENa (dimensionless)"
    legend_algebraic[132] = "reversal_potential in component EKs (dimensionless)"
    legend_algebraic[130] = "reversal_potential in component ECa (dimensionless)"
    legend_rates[5] = "d/dt mNa in component model_2 (dimensionless)"
    legend_rates[6] = "d/dt hNa in component model_2 (dimensionless)"
    legend_rates[7] = "d/dt jNa in component model_2 (dimensionless)"
    legend_rates[8] = "d/dt xKs in component model_2 (dimensionless)"
    legend_rates[30] = "d/dt P0 in component model_2 (dimensionless)"
    legend_rates[31] = "d/dt P1 in component model_2 (dimensionless)"
    legend_rates[32] = "d/dt P2 in component model_2 (dimensionless)"
    legend_rates[33] = "d/dt P3 in component model_2 (dimensionless)"
    legend_rates[29] = "d/dt N1 in component model_2 (dimensionless)"
    legend_rates[50] = "d/dt N0 in component model_2 (dimensionless)"
    legend_rates[34] = "d/dt LTRPNCa in component model_2 (dimensionless)"
    legend_rates[35] = "d/dt HTRPNCa in component model_2 (dimensionless)"
    legend_rates[13] = "d/dt Nai in component model_2 (dimensionless)"
    legend_rates[12] = "d/dt Ki in component model_2 (dimensionless)"
    legend_rates[14] = "d/dt Cai in component model_2 (dimensionless)"
    legend_rates[28] = "d/dt CaSS in component model_2 (dimensionless)"
    legend_rates[27] = "d/dt CaJSR in component model_2 (dimensionless)"
    legend_rates[26] = "d/dt CaNSR in component model_2 (dimensionless)"
    legend_rates[1] = "d/dt V in component model_2 (dimensionless)"
    legend_rates[2] = "d/dt C1_RyR in component model_2 (dimensionless)"
    legend_rates[4] = "d/dt O2_RyR in component model_2 (dimensionless)"
    legend_rates[3] = "d/dt C2_RyR in component model_2 (dimensionless)"
    legend_rates[38] = "d/dt C0 in component model_2 (dimensionless)"
    legend_rates[36] = "d/dt C1 in component model_2 (dimensionless)"
    legend_rates[39] = "d/dt C2 in component model_2 (dimensionless)"
    legend_rates[41] = "d/dt C3 in component model_2 (dimensionless)"
    legend_rates[43] = "d/dt C4 in component model_2 (dimensionless)"
    legend_rates[9] = "d/dt Open in component model_2 (dimensionless)"
    legend_rates[37] = "d/dt CCa0 in component model_2 (dimensionless)"
    legend_rates[40] = "d/dt CCa1 in component model_2 (dimensionless)"
    legend_rates[42] = "d/dt CCa2 in component model_2 (dimensionless)"
    legend_rates[44] = "d/dt CCa3 in component model_2 (dimensionless)"
    legend_rates[45] = "d/dt CCa4 in component model_2 (dimensionless)"
    legend_rates[11] = "d/dt yCa in component model_2 (dimensionless)"
    legend_rates[10] = "d/dt OCa in component model_2 (dimensionless)"
    legend_rates[46] = "d/dt CrPi_mito in component model_2 (dimensionless)"
    legend_rates[47] = "d/dt CrPi_cyto in component model_2 (dimensionless)"
    legend_rates[0] = "d/dt ATPi in component model_2 (dimensionless)"
    legend_rates[48] = "d/dt ATPi_cyto in component model_2 (dimensionless)"
    legend_rates[25] = "d/dt Cam in component model_2 (dimensionless)"
    legend_rates[15] = "d/dt ADPm in component model_2 (dimensionless)"
    legend_rates[16] = "d/dt Dpsi in component model_2 (dimensionless)"
    legend_rates[17] = "d/dt NADH in component model_2 (dimensionless)"
    legend_rates[24] = "d/dt ISOC in component model_2 (dimensionless)"
    legend_rates[19] = "d/dt AKG in component model_2 (dimensionless)"
    legend_rates[20] = "d/dt SCoA in component model_2 (dimensionless)"
    legend_rates[21] = "d/dt Succ in component model_2 (dimensionless)"
    legend_rates[22] = "d/dt FUM in component model_2 (dimensionless)"
    legend_rates[23] = "d/dt MAL in component model_2 (dimensionless)"
    legend_rates[18] = "d/dt Oaa in component model_2 (dimensionless)"
    legend_rates[49] = "d/dt ASP in component model_2 (dimensionless)"
    return (legend_states, legend_algebraic, legend_voi, legend_constants)

def initConsts():
    constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
    constants[0] = 4e3
    constants[1] = 0.5
    constants[2] = -100.0
    constants[3] = 0.0
    constants[4] = 0.0
    constants[5] = 96.5
    constants[6] = 8.314
    constants[7] = 310.0
    constants[8] = 1e-7
    constants[9] = 2.0e-3
    constants[10] = 1.4e-4
    constants[11] = 1.33e-6
    constants[12] = 0.0095
    constants[13] = 25.0
    constants[14] = 25.0
    constants[15] = 1.0E-5
    constants[16] = 1.534E-4
    constants[17] = 1.0
    constants[18] = 2.0
    constants[19] = 0.5
    constants[20] = 2.0
    constants[21] = 1.0
    constants[22] = 2.0
    constants[23] = 1.0
    constants[24] = 1.5
    constants[25] = 50E-3
    constants[26] = 1.812E-3
    constants[27] = 10.0
    constants[28] = 0.02
    constants[29] = 35.0
    constants[30] = -0.6
    constants[31] = 50.0
    constants[32] = 0.35
    constants[33] = 0.4
    constants[34] = 0.109
    constants[35] = 0.5
    constants[36] = 0.154
    constants[37] = 0.5
    constants[38] = 0.01
    constants[39] = 1.24
    constants[40] = 0.3
    constants[41] = 0.0003
    constants[42] = 0.0
    constants[43] = 0.85
    constants[44] = 0.003217
    constants[45] = 0.00828
    constants[46] = 12.8
    constants[47] = 0.000545
    constants[48] = 2.0E-7
    constants[49] = 2.0
    constants[50] = 10.0
    constants[51] = 0.0
    constants[52] = 2.5E-5
    constants[53] = 0.5
    constants[54] = 140E-3
    constants[55] = -0.4583
    constants[56] = 3.147
    constants[57] = 0.575
    constants[58] = 6.6
    constants[59] = 0.0005
    constants[60] = 2.22
    constants[61] = 0.00038
    constants[62] = 0.62
    constants[63] = 0.576
    constants[64] = 1.215E10
    constants[65] = 1.930
    constants[66] = 4.05E6
    constants[67] = 0.00127
    constants[68] = 0.0008
    constants[69] = 1.5E-6
    constants[70] = 0.10
    constants[71] = 0.5
    constants[72] = 1.71E6
    constants[73] = 6.44E-4
    constants[74] = 0.0125
    constants[75] = 0.00024
    constants[76] = 0.00332
    constants[77] = 1.0
    constants[78] = 0.005
    constants[79] = 8.1E-5
    constants[80] = 5.98E-5
    constants[81] = 1.131E-5
    constants[82] = 26.7
    constants[83] = 6.68E-9
    constants[84] = 5.62E-6
    constants[85] = 3.3E-4
    constants[86] = 100.0
    constants[87] = 0.26
    constants[88] = 5.1
    constants[89] = 0.14
    constants[90] = 0.1
    constants[91] = 1.0
    constants[92] = 0.05
    constants[93] = 0.19
    constants[94] = 1.3
    constants[95] = 0.0031
    constants[96] = 0.15
    constants[97] = 7.5E-2
    constants[98] = 100.0
    constants[99] = 40E-3
    constants[100] = 0.008
    constants[101] = 0.012
    constants[102] = 0.23
    constants[103] = 0.0126
    constants[104] = 1.493
    constants[105] = 0.03
    constants[106] = 0.01
    constants[107] = 2.38E-3
    constants[108] = 1.38
    constants[109] = 0.8
    constants[110] = 0.111
    constants[111] = 0.0308
    constants[112] = 0.923
    constants[113] = 1.52
    constants[114] = 1.94
    constants[115] = 38.7
    constants[116] = 1.5
    constants[117] = 0.2244
    constants[118] = 87.5
    constants[119] = 10.0
    constants[120] = 0.0012
    constants[121] = 0.00064
    constants[122] = 0.0005
    constants[123] = 0.03
    constants[124] = 9.4
    constants[125] = 9000.0
    constants[126] = 3.75E-4
    constants[127] = 5.4
    constants[128] = 0.0399
    constants[129] = 1.64269
    constants[130] = 1.35E18
    constants[131] = 5.765E13
    constants[132] = 0.1
    constants[133] = 0.005
    constants[134] = 3.115
    constants[135] = 2.5
    constants[136] = 0.019
    constants[137] = 0.04
    constants[138] = 110.0
    constants[139] = 70E-3
    constants[140] = 3.0
    constants[141] = 0.4
    constants[142] = 3.0
    constants[143] = 2.8
    constants[144] = 140.0
    constants[145] = 4.0
    constants[146] = 1.4
    constants[147] = 2.0
    constants[148] = 1.2
    constants[149] = 1.0
    constants[150] = 0.01
    constants[151] = 1.346E-8
    constants[152] = 7.739E-7
    constants[153] = 6.65E-15
    constants[154] = 1.656E-8
    constants[155] = 3.373E-10
    constants[156] = 9.651E-17
    constants[157] = 4.585E-17
    constants[158] = 0.00124
    constants[159] = 2.0
    constants[160] = 1.11E-11
    constants[161] = 0.0
    constants[162] = 1.75E-7
    constants[163] = 2.077E-18
    constants[164] = 1.728E-9
    constants[165] = 1.059E-26
    constants[166] = 6.394E-13
    constants[167] = 1.762E-16
    constants[168] = 2.656E-22
    constants[169] = 8.632E-30
    constants[170] = 0.05
    constants[171] = 3.75E-4
    constants[172] = 1.0E-1
    constants[173] = 0.574713
    constants[174] = 9.09091
    constants[175] = 15.0
    constants[176] = 0.00048
    constants[177] = 3.6
    constants[178] = 0.16E-6
    constants[179] = 0.29892E-3
    constants[180] = 0.31793E-3
    constants[181] = 0.015
    constants[182] = 0.625E-4
    constants[183] = 0.0275
    constants[184] = 25.84E-6
    constants[185] = 1.4E-6
    constants[186] = 0.495E-9
    constants[187] = 0.1
    constants[188] = 0.05
    constants[189] = 2.15
    constants[190] = 0.1
    constants[191] = 1
    constants[192] = 1
    constants[193] = 2
    constants[194] = 1
    constants[195] = 0.01833
    constants[196] = 7.98691
    constants[197] = -86.4154
    constants[198] = 0.748798
    constants[199] = 0.250904
    constants[200] = 3.5175e-10
    constants[201] = 0.0327969
    constants[202] = 0.988991
    constants[203] = 0.992918
    constants[204] = 0.000127552
    constants[205] = 6.96577e-24
    constants[206] = 0
    constants[207] = 0.941505
    constants[208] = 148.065
    constants[209] = 7.51215
    constants[210] = 6.71512e-05
    constants[211] = 0.0258454
    constants[212] = 164.073
    constants[213] = 7.76311
    constants[214] = 1.08962e-07
    constants[215] = 0.000610554
    constants[216] = 0.247364
    constants[217] = 0.000394005
    constants[218] = 0.0191924
    constants[219] = 0.00925885
    constants[220] = 0.496682
    constants[221] = 0.000137836
    constants[222] = 0.255288
    constants[223] = 0.255138
    constants[224] = 8.25461e-05
    constants[225] = 5.71121e-05
    constants[226] = 6.63724e-05
    constants[227] = 5.73114e-05
    constants[228] = 0.000106992
    constants[229] = 9.31884e-05
    constants[230] = 0.0100663
    constants[231] = 0.133453
    constants[232] = 1.04295e-05
    constants[233] = 0.00156783
    constants[234] = 0.998424
    constants[235] = 4.08551e-11
    constants[236] = 6.55103e-08
    constants[237] = 7.11287e-17
    constants[238] = 1.02648e-12
    constants[239] = 4.64382e-23
    constants[240] = 7.14846e-18
    constants[241] = 1.86682e-23
    constants[242] = 19.4385
    constants[243] = 19.4302
    constants[244] = 7.97824
    constants[245] = 0.0502614
    constants[246] = 0.999618
    states[0] = 7.98691
    states[1] = -86.4154
    states[2] = 0.748798
    states[3] = 0.250904
    states[4] = 3.5175e-10
    states[5] = 0.0327969
    states[6] = 0.988991
    states[7] = 0.992918
    states[8] = 0.000127552
    states[9] = 6.96577e-24
    states[10] = 0
    states[11] = 0.941505
    states[12] = 148.065
    states[13] = 7.51215
    states[14] = 6.71512e-05
    states[15] = 0.0258454
    states[16] = 164.073
    states[17] = 7.76311
    states[18] = 1.08962e-07
    states[19] = 0.000610554
    states[20] = 0.247364
    states[21] = 0.000394005
    states[22] = 0.0191924
    states[23] = 0.00925885
    states[24] = 0.496682
    states[25] = 0.000137836
    states[26] = 0.255288
    states[27] = 0.255138
    states[28] = 8.25461e-05
    states[29] = 5.71121e-05
    states[30] = 6.63724e-05
    states[31] = 5.73114e-05
    states[32] = 0.000106992
    states[33] = 9.31884e-05
    states[34] = 0.0100663
    states[35] = 0.133453
    states[36] = 1.04295e-05
    states[37] = 0.00156783
    states[38] = 0.998424
    states[39] = 4.08551e-11
    states[40] = 6.55103e-08
    states[41] = 7.11287e-17
    states[42] = 1.02648e-12
    states[43] = 4.64382e-23
    states[44] = 7.14846e-18
    states[45] = 1.86682e-23
    states[46] = 19.4385
    states[47] = 19.4302
    states[48] = 7.97824
    states[49] = 0.0502614
    states[50] = 0.999618
    constants[247] = (constants[184]+constants[178]+constants[185]+constants[186])/0.640000
    constants[248] = 3.00000*constants[188]
    constants[249] = (constants[189]-1.70000)/0.600000
    constants[250] = constants[99]/constants[98]
    constants[251] = 3.50000*constants[189]-2.00000
    constants[252] = 0.282000*(power(constants[127]/5.40000, 1.0/2))
    constants[253] = 1.00000/5.98000
    constants[254] = constants[22]*341.000
    constants[255] = 2.00000*constants[158]*1000.00*constants[5]*(1.00000-341.000*constants[22])
    constants[256] = 4.00000*0.00100000*constants[158]
    constants[257] = 1.00000/constants[55]
    constants[258] = 1.00000/constants[119]
    constants[259] = constants[32]-1.00000
    constants[260] = (power(constants[144], 3.00000))/constants[22]
    constants[261] = (constants[108]+constants[22])*((power(constants[118], 3.00000)+power(constants[144], 3.00000))/(constants[125]*constants[22]))
    constants[262] = 1.00000/constants[91]
    constants[263] = power(constants[120], 3.00000)
    constants[264] = constants[105]/constants[87]
    constants[265] = (constants[71]*constants[33]*constants[17])/(constants[103]+constants[17])
    constants[266] = 1.00000+1.00000/constants[60]
    constants[267] = 1.00000+constants[52]/constants[79]+constants[80]/constants[52]
    constants[268] = constants[92]*constants[34]
    constants[269] = 1.00000/constants[62]
    constants[270] = 1.00000/constants[59]
    constants[271] = 1.00000/constants[93]
    constants[272] = constants[115]/constants[112]
    constants[273] = constants[141]/constants[111]+1.00000
    constants[274] = constants[97]*constants[35]
    constants[275] = constants[28]/constants[134]
    constants[276] = constants[133]*constants[37]
    constants[277] = constants[123]/constants[94]
    constants[278] = 1.00000/constants[96]
    constants[279] = constants[76]/constants[77]
    constants[280] = (power(1.00000/(1.00000+constants[83]/constants[52]+constants[83]*(constants[84]/(power(constants[52], 2.00000)))), 2.00000))*(1.00000/(1.00000+constants[52]/constants[81]+(power(constants[52], 2.00000))/(constants[81]*constants[82]))+constants[128])*constants[110]*constants[36]
    constants[281] = constants[104]/constants[95]
    constants[282] = constants[73]*constants[50]*constants[69]*(constants[58]/constants[73])
    constants[283] = constants[69]*(constants[58]/constants[73])
    constants[284] = constants[73]*constants[50]
    constants[285] = constants[73]/constants[58]
    constants[286] = constants[130]*(constants[130]/constants[112])
    constants[287] = constants[72]/constants[159]
    constants[288] = 0.750000*constants[181]
    constants[289] = 20.0000*constants[181]
    constants[290] = 1.00000/constants[75]
    constants[291] = 1.00000/constants[129]
    constants[292] = 1.00000/constants[173]
    constants[293] = 1.00000/constants[174]
    constants[294] = constants[25]*constants[107]
    constants[295] = constants[29]*constants[109]
    constants[296] = 1.00000/constants[136]
    constants[297] = 1.00000/constants[61]
    constants[298] = constants[183]/constants[136]
    constants[299] = constants[19]*0.500000
    constants[300] = 1.00000/constants[12]
    constants[301] = (constants[6]*constants[7])/constants[5]
    constants[302] = 1.00000/constants[20]
    constants[303] = constants[247]*0.360000
    constants[304] = 10.0000*constants[188]
    constants[305] = 1.00000/(1.00000+constants[250]/(1.70000/1000.00+((0.900000/1000.00-1.70000/1000.00)/(2.30000-1.70000))*(constants[189]-1.70000)))
    constants[306] = constants[261]*constants[132]
    constants[307] = -2.30300*constants[301]*constants[30]
    constants[308] = constants[273]/constants[67]
    constants[309] = -constants[137]-constants[248]
    constants[310] = 0.750000*(power(constants[127]/5.40000, 1.0/2))
    constants[311] = constants[150]
    constants[312] = 7.00000*constants[188]
    constants[313] = 1.00000/(constants[139]*constants[305])
    constants[314] = 1000.00*constants[5]
    constants[315] = constants[311]*constants[302]
    constants[316] = 1.00000*constants[190]
    constants[317] = constants[314]*constants[160]
    constants[318] = constants[175]*(constants[176]/(constants[248]+constants[304]+constants[312]))
    constants[319] = 1.00000/constants[301]
    constants[320] = constants[315]*constants[302]
    constants[321] = 2.00000*constants[190]
    constants[322] = constants[53]*constants[319]
    constants[323] = 2.00000*constants[319]
    constants[324] = 0.0365000*((exp(constants[144]/67.3000)-1.00000)/7.00000)
    constants[325] = constants[320]*constants[302]
    constants[326] = 3.00000*constants[190]
    constants[327] = constants[56]*(constants[127]/(constants[127]+constants[116]))
    constants[328] = constants[325]*constants[302]
    constants[329] = constants[316]*constants[321]*constants[326]+constants[248]*constants[321]*constants[326]+constants[248]*constants[304]*constants[326]+constants[248]*constants[304]*constants[312]
    constants[330] = 1.00000+(2.30000-constants[189])/(power((2.30000-1.70000)/1.00000, 1.60000))
    constants[331] = 1.00000/constants[90]
    constants[332] = (constants[248]*(2.00000*constants[190])*(3.00000*constants[190]))/constants[329]
    constants[333] = constants[316]*constants[330]
    constants[334] = constants[321]*constants[330]
    constants[335] = constants[326]*constants[330]
    constants[336] = 30.0000/1000.00
    constants[337] = exp(6.00000*constants[31]*constants[319])
    constants[338] = (constants[248]*constants[304]*(3.00000*constants[190]))/constants[329]
    constants[339] = constants[336]*constants[330]
    constants[340] = -(constants[137]+constants[304]+constants[333])
    constants[341] = -(constants[312]+constants[334])
    constants[342] = 6.00000*constants[43]*constants[319]
    constants[343] = (constants[248]*constants[304]*constants[312])/constants[329]
    constants[344] = constants[166]+constants[168]*constants[337]
    constants[345] = constants[332]+2.00000*constants[338]+3.00000*constants[343]
    constants[346] = constants[163]*constants[337]
    constants[347] = constants[345]/3.00000
    constants[348] = 0.500000*constants[172]*constants[344]
    constants[349] = constants[332]+constants[338]+constants[343]
    constants[350] = 0.500000*constants[172]*constants[169]
    constants[351] = 1.00000
    constants[352] = 0.500000*constants[172]*constants[166]
    constants[353] = 1.50000
    constants[354] = 6.00000*constants[172]*constants[166]
    constants[355] = 0.100000
    constants[356] = 6.00000*constants[172]*(constants[166]+constants[167])
    constants[357] = 0.100000
    constants[358] = constants[301]*log(constants[131]*(power(constants[39]/constants[38], 1.0/2)), 10)
    constants[359] = constants[353]-constants[357]
    constants[360] = exp(constants[358]*constants[319])
    constants[361] = 0.500000*(constants[166]+constants[169]*constants[360])
    constants[362] = (constants[166]+constants[168]*constants[337])*constants[360]*0.500000
    constants[363] = custom_piecewise([less(constants[189] , 2.20000), amin(vstack(1.00000, ((constants[189]-2.00000*constants[351])+(constants[353]-constants[355]))/constants[359]),0) , True, 1.00000-(constants[189]-2.20000)/constants[359]])
    constants[364] = 4.00000*constants[166]*constants[360]
    constants[365] = constants[363]/constants[349]
    constants[366] = constants[363]/(constants[347]*3.00000)
    constants[367] = 4.00000*(constants[166]+constants[167])
    constants[368] = constants[187]*constants[366]
    constants[369] = (1.00000+constants[163]*constants[360])*constants[337]
    constants[370] = constants[164]+constants[165]*constants[360]
    constants[371] = exp(3.00000*constants[31]*constants[319])
    constants[372] = 3.00000*constants[319]
    constants[373] = 100.000*constants[154]+constants[156]*constants[371]
    constants[374] = 3.00000*(constants[154]+constants[155])
    constants[375] = 300.000*constants[154]
    constants[376] = constants[151]*constants[371]
    constants[377] = constants[106]/constants[89]
    constants[378] = 1.00000/constants[88]
    constants[379] = constants[16]/(constants[184]*constants[5]*1000.00)
    constants[380] = constants[16]/(2.00000*constants[186]*constants[5]*1000.00)
    constants[381] = constants[178]/constants[186]
    constants[382] = constants[184]/constants[186]
    constants[383] = constants[184]/constants[185]
    constants[384] = constants[178]/constants[185]
    constants[385] = 1.00000/constants[21]
    constants[386] = 1.00000/constants[26]
    constants[387] = 2.00000*constants[19]
    return (states, constants)

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    rates[9] = constants[40]*states[43]-constants[49]*states[9]
    rates[11] = (1.00000/(1.00000+exp((states[1]+55.0000)*(1.00000/7.50000)))+(0.500000/(1.00000+exp((21.0000-states[1])*(1.00000/6.00000)))-states[11]))/(20.0000+600.000/(1.00000+exp((states[1]+30.0000)*(1.00000/9.50000))))
    rates[10] = constants[42]*states[45]-constants[51]*states[10]
    algebraic[0] = states[1]+30.0000
    rates[8] = 7.19000e-05*(algebraic[0]/(1.00000-exp(-0.148000*algebraic[0])))*(1.00000-states[8])-0.000131000*(algebraic[0]/(exp(0.0687000*algebraic[0])-1.00000))*states[8]
    algebraic[3] = custom_piecewise([less(states[1] , -40.0000), (0.135000*exp(-80.0000/6.80000))*exp((-1.00000/6.80000)*states[1]) , True, 0.00000])
    algebraic[9] = custom_piecewise([less(states[1] , -40.0000), 3.56000*exp(0.0790000*states[1])+310000.*exp(0.350000*states[1]) , True, 1.00000/(0.130000+(0.130000*exp(-(10.6600/11.1000)))*exp(states[1]*(-1.00000/11.1000)))])
    rates[6] = algebraic[3]*(1.00000-states[6])-algebraic[9]*states[6]
    algebraic[4] = custom_piecewise([less(states[1] , -40.0000), (-127140.*exp(0.244400*states[1])-3.47400e-05*exp(-0.0439100*states[1]))*((states[1]+37.7800)/(1.00000+exp(0.311000*(states[1]+79.2300)))) , True, 0.00000])
    algebraic[10] = custom_piecewise([less(states[1] , -40.0000), 0.121200*(exp(-0.0105200*states[1])/(1.00000+exp(-0.137800*(states[1]+40.1400)))) , True, 0.300000*(exp(-2.53500e-07*states[1])/(1.00000+exp(-0.100000*states[1]-3.20000)))])
    rates[7] = algebraic[4]*(1.00000-states[7])-algebraic[10]*states[7]
    algebraic[5] = constants[137]*(power(states[34]*constants[313], constants[251]))
    algebraic[11] = constants[309]*states[30]+algebraic[5]*states[50]+constants[333]*states[31]
    rates[30] = algebraic[11]
    algebraic[14] = constants[340]*states[31]+algebraic[5]*states[29]+constants[248]*states[30]+constants[334]*states[32]
    rates[31] = algebraic[14]
    algebraic[2] = custom_piecewise([equal(states[1] , -47.1300), 3.20000 , True, 0.320000*((states[1]+47.1300)/(1.00000-exp(-0.100000*(states[1]+47.1300))))])
    algebraic[8] = 0.0800000*exp(-(states[1]*(1.00000/11.0000)))
    algebraic[13] = 1.00000/(algebraic[8]+algebraic[2])
    algebraic[17] = custom_piecewise([less(algebraic[13] , 0.0300000), algebraic[2]*algebraic[13] , True, states[5]])
    rates[5] = algebraic[2]*(1.00000-algebraic[17])-algebraic[8]*algebraic[17]
    algebraic[18] = constants[341]*states[32]+constants[304]*states[31]+constants[335]*states[33]
    rates[32] = algebraic[18]
    algebraic[21] = -(constants[335]*states[33])+constants[312]*states[32]
    rates[33] = algebraic[21]
    algebraic[24] = constants[137]*states[31]-(algebraic[5]+constants[339])*states[29]
    rates[29] = algebraic[24]
    rates[50] = -algebraic[11]-(algebraic[14]+algebraic[18]+algebraic[21]+algebraic[24])
    algebraic[29] = 1.00000-(states[2]+states[3]+states[4])
    rates[2] = -(constants[64]*(power(states[28], constants[145]))*states[2])+constants[63]*algebraic[29]
    rates[4] = constants[66]*(power(states[28], constants[140]))*algebraic[29]-constants[65]*states[4]
    rates[3] = constants[70]*algebraic[29]-constants[68]*states[3]
    algebraic[6] = 0.400000*exp((states[1]+2.00000)*0.100000)
    algebraic[23] = 4.00000*algebraic[6]
    algebraic[12] = 0.0500000*exp((states[1]+2.00000)*(-1.00000/13.0000))
    algebraic[40] = algebraic[12]
    algebraic[56] = 0.187500*states[28]
    algebraic[58] = algebraic[56]
    rates[38] = algebraic[40]*states[36]+(constants[311]*states[37]-(algebraic[23]+algebraic[58])*states[38])
    algebraic[16] = constants[18]*algebraic[6]
    algebraic[32] = 4.00000*algebraic[16]
    algebraic[20] = algebraic[12]*constants[302]
    algebraic[48] = algebraic[20]
    rates[37] = algebraic[48]*states[40]+(algebraic[58]*states[38]-(algebraic[32]+constants[311])*states[37])
    algebraic[26] = 3.00000*algebraic[6]
    algebraic[42] = 2.00000*algebraic[12]
    algebraic[60] = constants[18]*algebraic[58]
    rates[36] = algebraic[23]*states[38]+algebraic[42]*states[39]+(constants[315]*states[40]-(algebraic[40]+algebraic[26]+algebraic[60])*states[36])
    algebraic[34] = 3.00000*algebraic[16]
    algebraic[50] = 2.00000*algebraic[20]
    rates[40] = algebraic[32]*states[37]+algebraic[50]*states[42]+(algebraic[60]*states[36]-(algebraic[48]+algebraic[34]+constants[315])*states[40])
    algebraic[28] = 2.00000*algebraic[6]
    algebraic[44] = 3.00000*algebraic[12]
    algebraic[62] = constants[18]*algebraic[60]
    rates[39] = algebraic[26]*states[36]+algebraic[44]*states[41]+(constants[320]*states[42]-(algebraic[42]+algebraic[28]+algebraic[62])*states[39])
    algebraic[36] = 2.00000*algebraic[16]
    algebraic[52] = 3.00000*algebraic[20]
    rates[42] = algebraic[34]*states[40]+algebraic[52]*states[44]+(algebraic[62]*states[39]-(algebraic[50]+algebraic[36]+constants[320])*states[42])
    algebraic[30] = algebraic[6]
    algebraic[46] = 4.00000*algebraic[12]
    algebraic[64] = constants[18]*algebraic[62]
    rates[41] = algebraic[28]*states[39]+algebraic[46]*states[43]+(constants[325]*states[44]-(algebraic[44]+algebraic[30]+algebraic[64])*states[41])
    algebraic[38] = algebraic[16]
    algebraic[54] = 4.00000*algebraic[20]
    rates[44] = algebraic[36]*states[42]+algebraic[54]*states[45]+(algebraic[64]*states[41]-(algebraic[52]+algebraic[38]+constants[325])*states[44])
    algebraic[66] = constants[18]*algebraic[64]
    rates[43] = algebraic[30]*states[41]+constants[49]*states[9]+(constants[328]*states[45]-(algebraic[46]+constants[40]+algebraic[66])*states[43])
    rates[45] = algebraic[38]*states[44]+constants[51]*states[10]+(algebraic[66]*states[43]-(algebraic[54]+constants[42]+constants[328])*states[45])
    algebraic[71] = constants[74]*(constants[23]-(states[19]+states[20]+states[21]+states[22]+states[23]+states[18]+states[24]*constants[266]))
    algebraic[65] = constants[27]-states[17]
    algebraic[67] = constants[112]/algebraic[65]
    algebraic[72] = 1.00000/((1.00000+states[15]*constants[269])*(1.00000+states[25]*constants[270]))
    algebraic[73] = 1.00000+states[17]*constants[271]
    algebraic[74] = constants[268]/(constants[267]+algebraic[67]*algebraic[73]+(power(constants[113]/states[24], constants[147]))*algebraic[72]*(1.00000+algebraic[67]*algebraic[73]))
    rates[24] = algebraic[71]-algebraic[74]
    algebraic[75] = constants[273]+constants[308]*states[25]
    algebraic[76] = constants[274]*(algebraic[75]/(algebraic[75]+power(constants[114]/states[19], constants[148])+constants[272]*algebraic[67]))
    algebraic[61] = constants[24]-states[15]
    algebraic[77] = constants[78]*(states[20]*states[15]-constants[275]*states[21]*algebraic[61])
    rates[20] = algebraic[76]-algebraic[77]
    algebraic[78] = constants[276]*(states[21]/(states[21]+(constants[123]+constants[277]*states[22])*(1.00000+constants[278]*states[18])))
    rates[21] = algebraic[77]-algebraic[78]
    algebraic[79] = constants[76]*states[22]-constants[279]*states[23]
    rates[22] = algebraic[78]-algebraic[79]
    algebraic[80] = constants[280]*states[23]*(algebraic[65]/((states[23]+constants[104]+states[18]*constants[281])*(constants[117]+algebraic[65])))
    rates[23] = algebraic[79]-algebraic[80]
    algebraic[81] = constants[282]*(states[18]/(constants[283]+states[19]))
    rates[19] = algebraic[74]+(algebraic[81]-algebraic[76])
    algebraic[70] = constants[265]*(states[18]/(states[18]+constants[121]))
    rates[18] = algebraic[80]-(algebraic[70]+algebraic[81])
    rates[49] = algebraic[81]-constants[69]*states[49]
    algebraic[63] = constants[307]+states[16]
    algebraic[68] = exp(constants[342]*algebraic[63])
    algebraic[82] = power(states[17]*constants[286]*algebraic[67], 1.0/2)
    algebraic[83] = 1.00000/((constants[337]+constants[346]*algebraic[82])+(constants[164]+constants[165]*algebraic[82])*algebraic[68])
    algebraic[84] = ((constants[348]+constants[350]*algebraic[68])*algebraic[82]-constants[352]*algebraic[68])*algebraic[83]
    rates[17] = -algebraic[84]+algebraic[74]+algebraic[76]+algebraic[80]
    algebraic[88] = exp(constants[372]*algebraic[63])
    algebraic[89] = constants[287]*(algebraic[61]/states[15])
    algebraic[90] = -(constants[170]/(constants[371]+constants[376]*algebraic[89]+(constants[152]+constants[153]*algebraic[89])*algebraic[88]))
    algebraic[91] = ((constants[373]+constants[157]*algebraic[88])*algebraic[89]-constants[154]*algebraic[88])*algebraic[90]
    algebraic[7] = 8.00000-states[0]
    algebraic[93] = states[0]/algebraic[7]
    algebraic[94] = states[15]/algebraic[61]
    algebraic[95] = (constants[288]-constants[289]*algebraic[93]*algebraic[94]*exp(-(constants[319]*states[16])))/((1.00000+(10.0000/9.00000)*algebraic[93]*exp(-(constants[322]*states[16])))*(1.00000+18.0000*algebraic[94]))
    rates[15] = algebraic[95]-(algebraic[91]+algebraic[77])
    algebraic[15] = 1.00000/states[0]
    algebraic[97] = power(states[14]*constants[290], constants[146])
    algebraic[98] = power(states[26]*constants[291], constants[149])
    algebraic[99] = constants[135]*((constants[179]*algebraic[97]-constants[180]*algebraic[98])/((1.00000+algebraic[97]+algebraic[98])*(algebraic[15]*(constants[106]+algebraic[7]*constants[377])+(1.00000+algebraic[7]*constants[378]))))
    algebraic[102] = (states[26]-states[27])*constants[292]
    rates[26] = algebraic[99]*constants[383]-algebraic[102]*constants[384]
    algebraic[100] = constants[9]*(states[46]-states[47])
    algebraic[104] = constants[11]*((constants[14]-states[46])*states[0]-states[46]*algebraic[7]*constants[300])
    rates[46] = algebraic[104]-algebraic[100]
    algebraic[103] = constants[10]*((constants[13]-states[47])*states[48]-states[47]*(8.00000-states[48])*constants[300])
    rates[47] = algebraic[100]+algebraic[103]
    algebraic[19] = states[1]*constants[319]
    algebraic[22] = exp(algebraic[19])
    algebraic[37] = power(states[13]*states[13]*states[13], 1.0/2)
    algebraic[39] = constants[327]*(algebraic[37]/((algebraic[37]+power(constants[119]*constants[119]*constants[119], 1.0/2))*(1.00000+0.124500*exp(-0.100000*algebraic[19])+constants[324]/algebraic[22])*(1.00000+(constants[100]*algebraic[15])*(1.00000+algebraic[7]*constants[331]))))
    algebraic[47] = constants[57]*(states[14]/(constants[122]+states[14]))*(1.00000/(1.00000+(constants[101]*algebraic[15])*(1.00000+algebraic[7]*constants[262]))+1.00000/(1.00000+constants[102]*algebraic[15]))
    algebraic[59] = constants[318]*((constants[248]*states[30]+constants[304]*states[31]+constants[312]*states[32])/(1.00000+algebraic[15]*(constants[105]+constants[264]*algebraic[7])))
    rates[0] = (1.00000-constants[3])*(0.615000*algebraic[95]-(algebraic[59]+0.500000*algebraic[99]+6.37100e-05*(algebraic[39]+algebraic[47])+algebraic[104]))
    rates[48] = (1.00000-constants[4])*(-algebraic[103]-constants[15])
    algebraic[25] = constants[314]*algebraic[19]
    algebraic[27] = algebraic[22]*algebraic[22]
    algebraic[31] = custom_piecewise([less(fabs(states[1]) , constants[8]), constants[256]*(algebraic[27]-constants[254])*(0.500000-0.0200000*states[1]) , True, constants[256]*algebraic[25]*((algebraic[27]-constants[254])/(algebraic[27]-1.00000))])
    algebraic[35] = 6.00000*algebraic[31]*states[11]*states[9]
    algebraic[101] = constants[177]*(algebraic[29]+states[4])*(states[27]-states[28])
    algebraic[105] = (states[28]-states[14])*constants[293]
    algebraic[106] = 1.00000/(1.00000+constants[294]/((states[28]+constants[107])*(states[28]+constants[107])))
    rates[28] = algebraic[106]*(algebraic[101]*constants[381]-(algebraic[105]*constants[382]+algebraic[35]*constants[380]))
    algebraic[107] = 1.00000/(1.00000+constants[295]/((states[27]+constants[109])*(states[27]+constants[109])))
    rates[27] = algebraic[107]*(algebraic[102]-algebraic[101])
    algebraic[108] = states[31]+states[29]+states[32]+states[33]
    algebraic[111] = constants[365]*algebraic[108]
    algebraic[112] = constants[98]*states[14]*(constants[139]-states[34])-(constants[99]*states[34])*(1.00000-(2.00000/3.00000)*algebraic[111])
    rates[34] = algebraic[112]
    algebraic[113] = constants[86]*states[14]*(constants[54]-states[35])-constants[85]*states[35]
    rates[35] = algebraic[113]
    algebraic[69] = constants[323]*(states[16]-91.0000)
    algebraic[116] = 1.00000+states[14]*constants[296]
    algebraic[117] = algebraic[116]*algebraic[116]*algebraic[116]
    algebraic[118] = constants[298]*states[14]*algebraic[69]*(algebraic[117]/((algebraic[117]*algebraic[116]+constants[138]/(power(1.00000+states[14]*constants[297], constants[143])))*(1.00000-exp(-algebraic[69]))))
    algebraic[119] = constants[182]*exp(constants[299]*algebraic[69])*(states[25]/(states[14]*(power(1.00000+constants[124]/states[13], constants[142]))*(1.00000+constants[126]/states[25])))
    rates[25] = constants[41]*(algebraic[118]-algebraic[119])
    algebraic[85] = (constants[354]*algebraic[82]-constants[356]*algebraic[68])*algebraic[83]
    algebraic[86] = constants[171]/(constants[369]+constants[370]*algebraic[68])
    algebraic[87] = (constants[364]-constants[367]*algebraic[68])*algebraic[86]
    algebraic[92] = (constants[375]+(constants[375]*algebraic[89]-constants[374]*algebraic[88]))*algebraic[90]
    algebraic[96] = constants[48]*algebraic[63]
    rates[16] = -(((-algebraic[85]-algebraic[87])+algebraic[92]+algebraic[95]+algebraic[96]+constants[387]*algebraic[119]+2.00000*algebraic[118])*constants[386])
    algebraic[120] = ((constants[6]*constants[7])/(constants[191]*constants[5]))*log(constants[144]/states[13])
    algebraic[121] = constants[46]*states[5]*states[5]*states[5]*states[6]*states[7]*(states[1]-algebraic[120])
    algebraic[122] = constants[47]*(states[1]-algebraic[120])
    algebraic[41] = exp(constants[32]*algebraic[19])
    algebraic[43] = algebraic[41]/algebraic[22]
    algebraic[45] = (algebraic[41]*states[13]*states[13]*states[13]-algebraic[43]*constants[260]*states[14])/(constants[261]+constants[306]*algebraic[43])
    algebraic[49] = states[14]*states[14]*states[14]
    algebraic[51] = custom_piecewise([less(fabs(states[1]) , constants[8]), 0.750000*algebraic[49]*((1.00000-0.0200000*states[1])/(algebraic[49]+constants[263])) , True, 0.750000*algebraic[49]*(algebraic[25]/((algebraic[22]-1.00000)*(algebraic[49]+constants[263])))])
    algebraic[53] = constants[162]*algebraic[51]*(states[13]*algebraic[22]-constants[144])
    rates[13] = -((algebraic[121]+algebraic[122]+algebraic[53]+3.00000*(algebraic[45]+algebraic[39]))*constants[379])-algebraic[119]*0.615000
    algebraic[130] = ((constants[6]*constants[7])/(constants[193]*constants[5]))*log(constants[22]/states[14])
    algebraic[131] = constants[44]*(states[1]-algebraic[130])
    algebraic[114] = algebraic[112]+algebraic[113]
    algebraic[115] = 1.00000/(1.00000+constants[294]/((states[14]+constants[107])*(states[14]+constants[107])))
    rates[14] = algebraic[115]*((algebraic[105]-(algebraic[99]+algebraic[114]+0.250000*constants[379]*((algebraic[131]-2.00000*algebraic[45])+algebraic[47])))+(algebraic[119]-algebraic[118])*0.615000)
    algebraic[1] = custom_piecewise([less( voi % constants[0] , constants[1]), constants[2] , True, 0.00000])
    algebraic[132] = ((constants[6]*constants[7])/(constants[192]*constants[5]))*log((constants[194]*constants[127]+constants[195]*constants[144])/(constants[194]*states[12]+constants[195]*states[13]))
    algebraic[133] = constants[252]*states[8]*states[8]*((states[1]-algebraic[132])/(1.00000+exp((states[1]-40.0000)/40.0000)))
    algebraic[123] = ((constants[6]*constants[7])/(constants[192]*constants[5]))*log(constants[127]/states[12])
    algebraic[124] = states[1]-algebraic[123]
    algebraic[125] = 1.02000/(1.00000+exp(0.238500*(algebraic[124]-59.2150)))
    algebraic[126] = (0.491200*exp(0.0803200*(algebraic[124]+5.47600))+exp(0.0617500*(algebraic[124]-594.310)))/(1.00000+exp(-0.514300*((states[1]-algebraic[123])+4.75300)))
    algebraic[127] = algebraic[125]/(algebraic[125]+algebraic[126])
    algebraic[128] = constants[310]*algebraic[127]*algebraic[124]
    algebraic[129] = constants[45]*(algebraic[124]/(1.00000+exp((7.48800-states[1])*constants[253])))
    algebraic[33] = custom_piecewise([less(fabs(states[1]) , constants[8]), constants[317]*(states[9]+states[10])*states[11]*(states[12]*algebraic[27]-constants[127])*((0.500000-0.0200000*states[1])/(1.00000+algebraic[31]*constants[257])) , True, constants[317]*(states[9]+states[10])*states[11]*(states[12]*algebraic[27]-constants[127])*(algebraic[19]/((algebraic[27]-1.00000)*(1.00000+algebraic[31]*constants[257])))])
    algebraic[55] = constants[161]*algebraic[51]*(states[12]*algebraic[22]-constants[127])
    rates[12] = -((algebraic[55]+algebraic[133]+algebraic[128]+algebraic[129]+algebraic[33]+(algebraic[1]-2.00000*algebraic[39]))*constants[379])
    algebraic[57] = algebraic[53]+algebraic[55]
    rates[1] = -(constants[385]*(algebraic[121]+algebraic[35]+algebraic[33]+algebraic[133]+algebraic[128]+algebraic[129]+algebraic[45]+algebraic[39]+algebraic[57]+algebraic[47]+algebraic[131]+algebraic[122]+algebraic[1]))
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[0] = states[1]+30.0000
    algebraic[3] = custom_piecewise([less(states[1] , -40.0000), (0.135000*exp(-80.0000/6.80000))*exp((-1.00000/6.80000)*states[1]) , True, 0.00000])
    algebraic[9] = custom_piecewise([less(states[1] , -40.0000), 3.56000*exp(0.0790000*states[1])+310000.*exp(0.350000*states[1]) , True, 1.00000/(0.130000+(0.130000*exp(-(10.6600/11.1000)))*exp(states[1]*(-1.00000/11.1000)))])
    algebraic[4] = custom_piecewise([less(states[1] , -40.0000), (-127140.*exp(0.244400*states[1])-3.47400e-05*exp(-0.0439100*states[1]))*((states[1]+37.7800)/(1.00000+exp(0.311000*(states[1]+79.2300)))) , True, 0.00000])
    algebraic[10] = custom_piecewise([less(states[1] , -40.0000), 0.121200*(exp(-0.0105200*states[1])/(1.00000+exp(-0.137800*(states[1]+40.1400)))) , True, 0.300000*(exp(-2.53500e-07*states[1])/(1.00000+exp(-0.100000*states[1]-3.20000)))])
    algebraic[5] = constants[137]*(power(states[34]*constants[313], constants[251]))
    algebraic[11] = constants[309]*states[30]+algebraic[5]*states[50]+constants[333]*states[31]
    algebraic[14] = constants[340]*states[31]+algebraic[5]*states[29]+constants[248]*states[30]+constants[334]*states[32]
    algebraic[2] = custom_piecewise([equal(states[1] , -47.1300), 3.20000 , True, 0.320000*((states[1]+47.1300)/(1.00000-exp(-0.100000*(states[1]+47.1300))))])
    algebraic[8] = 0.0800000*exp(-(states[1]*(1.00000/11.0000)))
    algebraic[13] = 1.00000/(algebraic[8]+algebraic[2])
    algebraic[17] = custom_piecewise([less(algebraic[13] , 0.0300000), algebraic[2]*algebraic[13] , True, states[5]])
    algebraic[18] = constants[341]*states[32]+constants[304]*states[31]+constants[335]*states[33]
    algebraic[21] = -(constants[335]*states[33])+constants[312]*states[32]
    algebraic[24] = constants[137]*states[31]-(algebraic[5]+constants[339])*states[29]
    algebraic[29] = 1.00000-(states[2]+states[3]+states[4])
    algebraic[6] = 0.400000*exp((states[1]+2.00000)*0.100000)
    algebraic[23] = 4.00000*algebraic[6]
    algebraic[12] = 0.0500000*exp((states[1]+2.00000)*(-1.00000/13.0000))
    algebraic[40] = algebraic[12]
    algebraic[56] = 0.187500*states[28]
    algebraic[58] = algebraic[56]
    algebraic[16] = constants[18]*algebraic[6]
    algebraic[32] = 4.00000*algebraic[16]
    algebraic[20] = algebraic[12]*constants[302]
    algebraic[48] = algebraic[20]
    algebraic[26] = 3.00000*algebraic[6]
    algebraic[42] = 2.00000*algebraic[12]
    algebraic[60] = constants[18]*algebraic[58]
    algebraic[34] = 3.00000*algebraic[16]
    algebraic[50] = 2.00000*algebraic[20]
    algebraic[28] = 2.00000*algebraic[6]
    algebraic[44] = 3.00000*algebraic[12]
    algebraic[62] = constants[18]*algebraic[60]
    algebraic[36] = 2.00000*algebraic[16]
    algebraic[52] = 3.00000*algebraic[20]
    algebraic[30] = algebraic[6]
    algebraic[46] = 4.00000*algebraic[12]
    algebraic[64] = constants[18]*algebraic[62]
    algebraic[38] = algebraic[16]
    algebraic[54] = 4.00000*algebraic[20]
    algebraic[66] = constants[18]*algebraic[64]
    algebraic[71] = constants[74]*(constants[23]-(states[19]+states[20]+states[21]+states[22]+states[23]+states[18]+states[24]*constants[266]))
    algebraic[65] = constants[27]-states[17]
    algebraic[67] = constants[112]/algebraic[65]
    algebraic[72] = 1.00000/((1.00000+states[15]*constants[269])*(1.00000+states[25]*constants[270]))
    algebraic[73] = 1.00000+states[17]*constants[271]
    algebraic[74] = constants[268]/(constants[267]+algebraic[67]*algebraic[73]+(power(constants[113]/states[24], constants[147]))*algebraic[72]*(1.00000+algebraic[67]*algebraic[73]))
    algebraic[75] = constants[273]+constants[308]*states[25]
    algebraic[76] = constants[274]*(algebraic[75]/(algebraic[75]+power(constants[114]/states[19], constants[148])+constants[272]*algebraic[67]))
    algebraic[61] = constants[24]-states[15]
    algebraic[77] = constants[78]*(states[20]*states[15]-constants[275]*states[21]*algebraic[61])
    algebraic[78] = constants[276]*(states[21]/(states[21]+(constants[123]+constants[277]*states[22])*(1.00000+constants[278]*states[18])))
    algebraic[79] = constants[76]*states[22]-constants[279]*states[23]
    algebraic[80] = constants[280]*states[23]*(algebraic[65]/((states[23]+constants[104]+states[18]*constants[281])*(constants[117]+algebraic[65])))
    algebraic[81] = constants[282]*(states[18]/(constants[283]+states[19]))
    algebraic[70] = constants[265]*(states[18]/(states[18]+constants[121]))
    algebraic[63] = constants[307]+states[16]
    algebraic[68] = exp(constants[342]*algebraic[63])
    algebraic[82] = power(states[17]*constants[286]*algebraic[67], 1.0/2)
    algebraic[83] = 1.00000/((constants[337]+constants[346]*algebraic[82])+(constants[164]+constants[165]*algebraic[82])*algebraic[68])
    algebraic[84] = ((constants[348]+constants[350]*algebraic[68])*algebraic[82]-constants[352]*algebraic[68])*algebraic[83]
    algebraic[88] = exp(constants[372]*algebraic[63])
    algebraic[89] = constants[287]*(algebraic[61]/states[15])
    algebraic[90] = -(constants[170]/(constants[371]+constants[376]*algebraic[89]+(constants[152]+constants[153]*algebraic[89])*algebraic[88]))
    algebraic[91] = ((constants[373]+constants[157]*algebraic[88])*algebraic[89]-constants[154]*algebraic[88])*algebraic[90]
    algebraic[7] = 8.00000-states[0]
    algebraic[93] = states[0]/algebraic[7]
    algebraic[94] = states[15]/algebraic[61]
    algebraic[95] = (constants[288]-constants[289]*algebraic[93]*algebraic[94]*exp(-(constants[319]*states[16])))/((1.00000+(10.0000/9.00000)*algebraic[93]*exp(-(constants[322]*states[16])))*(1.00000+18.0000*algebraic[94]))
    algebraic[15] = 1.00000/states[0]
    algebraic[97] = power(states[14]*constants[290], constants[146])
    algebraic[98] = power(states[26]*constants[291], constants[149])
    algebraic[99] = constants[135]*((constants[179]*algebraic[97]-constants[180]*algebraic[98])/((1.00000+algebraic[97]+algebraic[98])*(algebraic[15]*(constants[106]+algebraic[7]*constants[377])+(1.00000+algebraic[7]*constants[378]))))
    algebraic[102] = (states[26]-states[27])*constants[292]
    algebraic[100] = constants[9]*(states[46]-states[47])
    algebraic[104] = constants[11]*((constants[14]-states[46])*states[0]-states[46]*algebraic[7]*constants[300])
    algebraic[103] = constants[10]*((constants[13]-states[47])*states[48]-states[47]*(8.00000-states[48])*constants[300])
    algebraic[19] = states[1]*constants[319]
    algebraic[22] = exp(algebraic[19])
    algebraic[37] = power(states[13]*states[13]*states[13], 1.0/2)
    algebraic[39] = constants[327]*(algebraic[37]/((algebraic[37]+power(constants[119]*constants[119]*constants[119], 1.0/2))*(1.00000+0.124500*exp(-0.100000*algebraic[19])+constants[324]/algebraic[22])*(1.00000+(constants[100]*algebraic[15])*(1.00000+algebraic[7]*constants[331]))))
    algebraic[47] = constants[57]*(states[14]/(constants[122]+states[14]))*(1.00000/(1.00000+(constants[101]*algebraic[15])*(1.00000+algebraic[7]*constants[262]))+1.00000/(1.00000+constants[102]*algebraic[15]))
    algebraic[59] = constants[318]*((constants[248]*states[30]+constants[304]*states[31]+constants[312]*states[32])/(1.00000+algebraic[15]*(constants[105]+constants[264]*algebraic[7])))
    algebraic[25] = constants[314]*algebraic[19]
    algebraic[27] = algebraic[22]*algebraic[22]
    algebraic[31] = custom_piecewise([less(fabs(states[1]) , constants[8]), constants[256]*(algebraic[27]-constants[254])*(0.500000-0.0200000*states[1]) , True, constants[256]*algebraic[25]*((algebraic[27]-constants[254])/(algebraic[27]-1.00000))])
    algebraic[35] = 6.00000*algebraic[31]*states[11]*states[9]
    algebraic[101] = constants[177]*(algebraic[29]+states[4])*(states[27]-states[28])
    algebraic[105] = (states[28]-states[14])*constants[293]
    algebraic[106] = 1.00000/(1.00000+constants[294]/((states[28]+constants[107])*(states[28]+constants[107])))
    algebraic[107] = 1.00000/(1.00000+constants[295]/((states[27]+constants[109])*(states[27]+constants[109])))
    algebraic[108] = states[31]+states[29]+states[32]+states[33]
    algebraic[111] = constants[365]*algebraic[108]
    algebraic[112] = constants[98]*states[14]*(constants[139]-states[34])-(constants[99]*states[34])*(1.00000-(2.00000/3.00000)*algebraic[111])
    algebraic[113] = constants[86]*states[14]*(constants[54]-states[35])-constants[85]*states[35]
    algebraic[69] = constants[323]*(states[16]-91.0000)
    algebraic[116] = 1.00000+states[14]*constants[296]
    algebraic[117] = algebraic[116]*algebraic[116]*algebraic[116]
    algebraic[118] = constants[298]*states[14]*algebraic[69]*(algebraic[117]/((algebraic[117]*algebraic[116]+constants[138]/(power(1.00000+states[14]*constants[297], constants[143])))*(1.00000-exp(-algebraic[69]))))
    algebraic[119] = constants[182]*exp(constants[299]*algebraic[69])*(states[25]/(states[14]*(power(1.00000+constants[124]/states[13], constants[142]))*(1.00000+constants[126]/states[25])))
    algebraic[85] = (constants[354]*algebraic[82]-constants[356]*algebraic[68])*algebraic[83]
    algebraic[86] = constants[171]/(constants[369]+constants[370]*algebraic[68])
    algebraic[87] = (constants[364]-constants[367]*algebraic[68])*algebraic[86]
    algebraic[92] = (constants[375]+(constants[375]*algebraic[89]-constants[374]*algebraic[88]))*algebraic[90]
    algebraic[96] = constants[48]*algebraic[63]
    algebraic[120] = ((constants[6]*constants[7])/(constants[191]*constants[5]))*log(constants[144]/states[13])
    algebraic[121] = constants[46]*states[5]*states[5]*states[5]*states[6]*states[7]*(states[1]-algebraic[120])
    algebraic[122] = constants[47]*(states[1]-algebraic[120])
    algebraic[41] = exp(constants[32]*algebraic[19])
    algebraic[43] = algebraic[41]/algebraic[22]
    algebraic[45] = (algebraic[41]*states[13]*states[13]*states[13]-algebraic[43]*constants[260]*states[14])/(constants[261]+constants[306]*algebraic[43])
    algebraic[49] = states[14]*states[14]*states[14]
    algebraic[51] = custom_piecewise([less(fabs(states[1]) , constants[8]), 0.750000*algebraic[49]*((1.00000-0.0200000*states[1])/(algebraic[49]+constants[263])) , True, 0.750000*algebraic[49]*(algebraic[25]/((algebraic[22]-1.00000)*(algebraic[49]+constants[263])))])
    algebraic[53] = constants[162]*algebraic[51]*(states[13]*algebraic[22]-constants[144])
    algebraic[130] = ((constants[6]*constants[7])/(constants[193]*constants[5]))*log(constants[22]/states[14])
    algebraic[131] = constants[44]*(states[1]-algebraic[130])
    algebraic[114] = algebraic[112]+algebraic[113]
    algebraic[115] = 1.00000/(1.00000+constants[294]/((states[14]+constants[107])*(states[14]+constants[107])))
    algebraic[1] = custom_piecewise([less( voi % constants[0] , constants[1]), constants[2] , True, 0.00000])
    algebraic[132] = ((constants[6]*constants[7])/(constants[192]*constants[5]))*log((constants[194]*constants[127]+constants[195]*constants[144])/(constants[194]*states[12]+constants[195]*states[13]))
    algebraic[133] = constants[252]*states[8]*states[8]*((states[1]-algebraic[132])/(1.00000+exp((states[1]-40.0000)/40.0000)))
    algebraic[123] = ((constants[6]*constants[7])/(constants[192]*constants[5]))*log(constants[127]/states[12])
    algebraic[124] = states[1]-algebraic[123]
    algebraic[125] = 1.02000/(1.00000+exp(0.238500*(algebraic[124]-59.2150)))
    algebraic[126] = (0.491200*exp(0.0803200*(algebraic[124]+5.47600))+exp(0.0617500*(algebraic[124]-594.310)))/(1.00000+exp(-0.514300*((states[1]-algebraic[123])+4.75300)))
    algebraic[127] = algebraic[125]/(algebraic[125]+algebraic[126])
    algebraic[128] = constants[310]*algebraic[127]*algebraic[124]
    algebraic[129] = constants[45]*(algebraic[124]/(1.00000+exp((7.48800-states[1])*constants[253])))
    algebraic[33] = custom_piecewise([less(fabs(states[1]) , constants[8]), constants[317]*(states[9]+states[10])*states[11]*(states[12]*algebraic[27]-constants[127])*((0.500000-0.0200000*states[1])/(1.00000+algebraic[31]*constants[257])) , True, constants[317]*(states[9]+states[10])*states[11]*(states[12]*algebraic[27]-constants[127])*(algebraic[19]/((algebraic[27]-1.00000)*(1.00000+algebraic[31]*constants[257])))])
    algebraic[55] = constants[161]*algebraic[51]*(states[12]*algebraic[22]-constants[127])
    algebraic[57] = algebraic[53]+algebraic[55]
    algebraic[109] = constants[366]*(algebraic[108]+states[32]+states[33]+states[33])
    algebraic[110] = constants[368]*(algebraic[108]+states[32]+states[33]+states[33])
    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)