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 = 152
sizeStates = 56
sizeConstants = 150
from math import *
from numpy import *

def createLegends():
    legend_states = [""] * sizeStates
    legend_rates = [""] * sizeStates
    legend_algebraic = [""] * sizeAlgebraic
    legend_voi = ""
    legend_constants = [""] * sizeConstants
    legend_constants[0] = "kappa_1a in component BG_parameters (fmol_per_sec)"
    legend_constants[1] = "kappa_1b in component BG_parameters (fmol_per_sec)"
    legend_constants[2] = "kappa_2a in component BG_parameters (fmol_per_sec)"
    legend_constants[3] = "kappa_2b in component BG_parameters (fmol_per_sec)"
    legend_constants[4] = "kappa_3a in component BG_parameters (fmol_per_sec)"
    legend_constants[5] = "kappa_3b in component BG_parameters (fmol_per_sec)"
    legend_constants[6] = "kappa_4a in component BG_parameters (fmol_per_sec)"
    legend_constants[7] = "kappa_4b in component BG_parameters (fmol_per_sec)"
    legend_constants[8] = "kappa_5 in component BG_parameters (fmol_per_sec)"
    legend_constants[9] = "kappa_6 in component BG_parameters (fmol_per_sec)"
    legend_constants[10] = "kappa_7 in component BG_parameters (fmol_per_sec)"
    legend_constants[11] = "kappa_GiAC in component BG_parameters (fmol_per_sec)"
    legend_constants[12] = "kappa_Rswitch_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[13] = "kappa_LRswitch_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[14] = "kappa_C_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[15] = "kappa_R_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[16] = "kappa_L_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[17] = "kappa_Act1_Gs in component BG_parameters (fmol_per_sec)"
    legend_constants[18] = "kappa_Act2_Gs in component BG_parameters (fmol_per_sec)"
    legend_constants[19] = "kappa_Hyd_Gs in component BG_parameters (fmol_per_sec)"
    legend_constants[20] = "kappa_Reassoc_Gs in component BG_parameters (fmol_per_sec)"
    legend_constants[21] = "kappa_InternR_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[22] = "kappa_InternLR_B1 in component BG_parameters (fmol_per_sec)"
    legend_constants[23] = "kappa_Rswitch_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[24] = "kappa_LRswitch_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[25] = "kappa_C_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[26] = "kappa_R_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[27] = "kappa_L_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[28] = "kappa_Act1_Gi in component BG_parameters (fmol_per_sec)"
    legend_constants[29] = "kappa_Act2_Gi in component BG_parameters (fmol_per_sec)"
    legend_constants[30] = "kappa_Hyd_Gi in component BG_parameters (fmol_per_sec)"
    legend_constants[31] = "kappa_Reassoc_Gi in component BG_parameters (fmol_per_sec)"
    legend_constants[32] = "kappa_InternR_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[33] = "kappa_InternLR_M2 in component BG_parameters (fmol_per_sec)"
    legend_constants[34] = "K_ATP in component BG_parameters (per_fmol)"
    legend_constants[35] = "K_cAMP in component BG_parameters (per_fmol)"
    legend_constants[36] = "K_AC in component BG_parameters (per_fmol)"
    legend_constants[37] = "K_AC_ATP in component BG_parameters (per_fmol)"
    legend_constants[38] = "K_Gsa_GTP_AC in component BG_parameters (per_fmol)"
    legend_constants[39] = "K_Gsa_GTP_AC_ATP in component BG_parameters (per_fmol)"
    legend_constants[40] = "K_FSK_AC in component BG_parameters (per_fmol)"
    legend_constants[41] = "K_FSK_AC_ATP in component BG_parameters (per_fmol)"
    legend_constants[42] = "K_PDE in component BG_parameters (per_fmol)"
    legend_constants[43] = "K_PDE_cAMP in component BG_parameters (per_fmol)"
    legend_constants[44] = "K_five_AMP in component BG_parameters (per_fmol)"
    legend_constants[45] = "K_IBMX in component BG_parameters (per_fmol)"
    legend_constants[46] = "K_PDEinh in component BG_parameters (per_fmol)"
    legend_constants[47] = "K_Gsa_GTP in component BG_parameters (per_fmol)"
    legend_constants[48] = "K_FSK in component BG_parameters (per_fmol)"
    legend_constants[49] = "K_Gia_GTP in component BG_parameters (per_fmol)"
    legend_constants[50] = "K_ACinh in component BG_parameters (per_fmol)"
    legend_constants[51] = "K_PPi in component BG_parameters (per_fmol)"
    legend_constants[52] = "K_RB1_inactive in component BG_parameters (per_fmol)"
    legend_constants[53] = "K_L_RB1_inactive in component BG_parameters (per_fmol)"
    legend_constants[54] = "K_LB1 in component BG_parameters (per_fmol)"
    legend_constants[55] = "K_RB1 in component BG_parameters (per_fmol)"
    legend_constants[56] = "K_Gs in component BG_parameters (per_fmol)"
    legend_constants[57] = "K_RB1_Gs in component BG_parameters (per_fmol)"
    legend_constants[58] = "K_L_RB1 in component BG_parameters (per_fmol)"
    legend_constants[59] = "K_L_RB1_Gs in component BG_parameters (per_fmol)"
    legend_constants[60] = "K_Gsbetagamma in component BG_parameters (per_fmol)"
    legend_constants[61] = "K_Gsa_GDP in component BG_parameters (per_fmol)"
    legend_constants[62] = "K_GTP in component BG_parameters (per_fmol)"
    legend_constants[63] = "K_GDP in component BG_parameters (per_fmol)"
    legend_constants[64] = "K_Pi in component BG_parameters (per_fmol)"
    legend_constants[65] = "K_RB1_tag in component BG_parameters (per_fmol)"
    legend_constants[66] = "K_L_RB1_tag in component BG_parameters (per_fmol)"
    legend_constants[67] = "K_RB1_GRKArr in component BG_parameters (per_fmol)"
    legend_constants[68] = "K_L_RB1_GRKArr in component BG_parameters (per_fmol)"
    legend_constants[69] = "K_GRKArr in component BG_parameters (per_fmol)"
    legend_constants[70] = "K_RM2_inactive in component BG_parameters (per_fmol)"
    legend_constants[71] = "K_L_RM2_inactive in component BG_parameters (per_fmol)"
    legend_constants[72] = "K_LM2 in component BG_parameters (per_fmol)"
    legend_constants[73] = "K_RM2 in component BG_parameters (per_fmol)"
    legend_constants[74] = "K_Gi in component BG_parameters (per_fmol)"
    legend_constants[75] = "K_RM2_Gi in component BG_parameters (per_fmol)"
    legend_constants[76] = "K_L_RM2 in component BG_parameters (per_fmol)"
    legend_constants[77] = "K_L_RM2_Gi in component BG_parameters (per_fmol)"
    legend_constants[78] = "K_Gibetagamma in component BG_parameters (per_fmol)"
    legend_constants[79] = "K_Gia_GDP in component BG_parameters (per_fmol)"
    legend_constants[80] = "K_RM2_tag in component BG_parameters (per_fmol)"
    legend_constants[81] = "K_L_RM2_tag in component BG_parameters (per_fmol)"
    legend_constants[82] = "K_RM2_GRKArr in component BG_parameters (per_fmol)"
    legend_constants[83] = "K_L_RM2_GRKArr in component BG_parameters (per_fmol)"
    legend_voi = "time in component environment (second)"
    legend_constants[84] = "vol_myo in component environment (pL)"
    legend_constants[85] = "freq in component environment (dimensionless)"
    legend_constants[86] = "stimSt1 in component environment (second)"
    legend_constants[87] = "stimDur1 in component environment (second)"
    legend_constants[88] = "tRamp1 in component environment (second)"
    legend_constants[89] = "stimMag1 in component environment (fmol)"
    legend_constants[90] = "stimHolding1 in component environment (fmol)"
    legend_constants[148] = "m1 in component environment (fmol_per_sec)"
    legend_constants[91] = "stimSt2 in component environment (second)"
    legend_constants[92] = "stimDur2 in component environment (second)"
    legend_constants[93] = "tRamp2 in component environment (second)"
    legend_constants[94] = "stimMag2 in component environment (fmol)"
    legend_constants[95] = "stimHolding2 in component environment (fmol)"
    legend_constants[149] = "m2 in component environment (fmol_per_sec)"
    legend_constants[96] = "q_ATP_init in component environment (fmol)"
    legend_constants[97] = "q_AC_init in component environment (fmol)"
    legend_constants[98] = "q_cAMP_init in component environment (fmol)"
    legend_constants[99] = "q_AC_ATP_init in component environment (fmol)"
    legend_constants[100] = "q_FSK_init in component environment (fmol)"
    legend_constants[101] = "q_FSK_AC_init in component environment (fmol)"
    legend_constants[102] = "q_FSK_AC_ATP_init in component environment (fmol)"
    legend_constants[103] = "q_Gsa_GTP_init in component environment (fmol)"
    legend_constants[104] = "q_Gsa_GTP_AC_init in component environment (fmol)"
    legend_constants[105] = "q_Gsa_GTP_AC_ATP_init in component environment (fmol)"
    legend_constants[106] = "q_PDE_init in component environment (fmol)"
    legend_constants[107] = "q_PDEinh_init in component environment (fmol)"
    legend_constants[108] = "q_PDE_cAMP_init in component environment (fmol)"
    legend_constants[109] = "q_IBMX_init in component environment (fmol)"
    legend_constants[110] = "q_five_AMP_init in component environment (fmol)"
    legend_constants[111] = "q_Gia_GTP_init in component environment (fmol)"
    legend_constants[112] = "q_ACinh_init in component environment (fmol)"
    legend_constants[113] = "q_PPi_init in component environment (fmol)"
    legend_constants[114] = "q_RB1_inactive_init in component environment (fmol)"
    legend_constants[115] = "q_L_RB1_inactive_init in component environment (fmol)"
    legend_algebraic[0] = "q_LB1_init in component environment (fmol)"
    legend_constants[116] = "q_RB1_init in component environment (fmol)"
    legend_constants[117] = "q_Gs_init in component environment (fmol)"
    legend_constants[118] = "q_RB1_Gs_init in component environment (fmol)"
    legend_constants[119] = "q_L_RB1_init in component environment (fmol)"
    legend_constants[120] = "q_L_RB1_Gs_init in component environment (fmol)"
    legend_constants[121] = "q_Gsbetagamma_init in component environment (fmol)"
    legend_constants[122] = "q_Gsa_GDP_init in component environment (fmol)"
    legend_constants[123] = "q_GTP_init in component environment (fmol)"
    legend_constants[124] = "q_GDP_init in component environment (fmol)"
    legend_constants[125] = "q_Pi_init in component environment (fmol)"
    legend_constants[126] = "q_RB1_tag_init in component environment (fmol)"
    legend_constants[127] = "q_L_RB1_tag_init in component environment (fmol)"
    legend_constants[128] = "q_RB1_GRKArr_init in component environment (fmol)"
    legend_constants[129] = "q_L_RB1_GRKArr_init in component environment (fmol)"
    legend_constants[130] = "q_GRKArr_init in component environment (fmol)"
    legend_constants[131] = "q_RM2_inactive_init in component environment (fmol)"
    legend_constants[132] = "q_L_RM2_inactive_init in component environment (fmol)"
    legend_algebraic[1] = "q_LM2_init in component environment (fmol)"
    legend_constants[133] = "q_RM2_init in component environment (fmol)"
    legend_constants[134] = "q_Gi_init in component environment (fmol)"
    legend_constants[135] = "q_RM2_Gi_init in component environment (fmol)"
    legend_constants[136] = "q_L_RM2_init in component environment (fmol)"
    legend_constants[137] = "q_L_RM2_Gi_init in component environment (fmol)"
    legend_constants[138] = "q_Gibetagamma_init in component environment (fmol)"
    legend_constants[139] = "q_Gia_GDP_init in component environment (fmol)"
    legend_constants[140] = "q_RM2_tag_init in component environment (fmol)"
    legend_constants[141] = "q_L_RM2_tag_init in component environment (fmol)"
    legend_constants[142] = "q_RM2_GRKArr_init in component environment (fmol)"
    legend_constants[143] = "q_L_RM2_GRKArr_init in component environment (fmol)"
    legend_algebraic[58] = "LB1_T in component environment (fmol)"
    legend_algebraic[59] = "RB1_T in component environment (fmol)"
    legend_algebraic[43] = "Gs_T in component environment (fmol)"
    legend_algebraic[16] = "adenosine_T in component environment (fmol)"
    legend_algebraic[2] = "q_ATP in component environment (fmol)"
    legend_algebraic[3] = "q_cAMP in component environment (fmol)"
    legend_algebraic[4] = "q_AC in component environment (fmol)"
    legend_algebraic[5] = "q_AC_ATP in component environment (fmol)"
    legend_algebraic[6] = "q_Gsa_GTP_AC in component environment (fmol)"
    legend_algebraic[7] = "q_Gsa_GTP_AC_ATP in component environment (fmol)"
    legend_algebraic[8] = "q_FSK_AC in component environment (fmol)"
    legend_algebraic[9] = "q_FSK_AC_ATP in component environment (fmol)"
    legend_algebraic[10] = "q_PDE in component environment (fmol)"
    legend_algebraic[13] = "q_PDE_cAMP in component environment (fmol)"
    legend_algebraic[14] = "q_five_AMP in component environment (fmol)"
    legend_algebraic[17] = "q_IBMX in component environment (fmol)"
    legend_algebraic[18] = "q_PDEinh in component environment (fmol)"
    legend_algebraic[19] = "q_Gsa_GTP in component environment (fmol)"
    legend_algebraic[20] = "q_FSK in component environment (fmol)"
    legend_algebraic[22] = "q_Gia_GTP in component environment (fmol)"
    legend_algebraic[23] = "q_ACinh in component environment (fmol)"
    legend_algebraic[25] = "q_PPi in component environment (fmol)"
    legend_algebraic[24] = "q_RB1_inactive in component environment (fmol)"
    legend_algebraic[26] = "q_L_RB1_inactive in component environment (fmol)"
    legend_algebraic[27] = "q_LB1 in component environment (fmol)"
    legend_algebraic[29] = "q_RB1 in component environment (fmol)"
    legend_algebraic[31] = "q_Gs in component environment (fmol)"
    legend_algebraic[33] = "q_RB1_Gs in component environment (fmol)"
    legend_algebraic[35] = "q_L_RB1 in component environment (fmol)"
    legend_algebraic[37] = "q_L_RB1_Gs in component environment (fmol)"
    legend_algebraic[39] = "q_Gsbetagamma in component environment (fmol)"
    legend_algebraic[41] = "q_Gsa_GDP in component environment (fmol)"
    legend_algebraic[44] = "q_GTP in component environment (fmol)"
    legend_algebraic[46] = "q_GDP in component environment (fmol)"
    legend_algebraic[48] = "q_Pi in component environment (fmol)"
    legend_algebraic[50] = "q_RB1_tag in component environment (fmol)"
    legend_algebraic[52] = "q_L_RB1_tag in component environment (fmol)"
    legend_algebraic[54] = "q_RB1_GRKArr in component environment (fmol)"
    legend_algebraic[56] = "q_L_RB1_GRKArr in component environment (fmol)"
    legend_algebraic[60] = "q_GRKArr in component environment (fmol)"
    legend_algebraic[62] = "q_RM2_inactive in component environment (fmol)"
    legend_algebraic[65] = "q_L_RM2_inactive in component environment (fmol)"
    legend_algebraic[68] = "q_LM2 in component environment (fmol)"
    legend_algebraic[71] = "q_RM2 in component environment (fmol)"
    legend_algebraic[74] = "q_Gi in component environment (fmol)"
    legend_algebraic[77] = "q_RM2_Gi in component environment (fmol)"
    legend_algebraic[80] = "q_L_RM2 in component environment (fmol)"
    legend_algebraic[85] = "q_L_RM2_Gi in component environment (fmol)"
    legend_algebraic[89] = "q_Gibetagamma in component environment (fmol)"
    legend_algebraic[93] = "q_Gia_GDP in component environment (fmol)"
    legend_algebraic[97] = "q_RM2_tag in component environment (fmol)"
    legend_algebraic[99] = "q_L_RM2_tag in component environment (fmol)"
    legend_algebraic[101] = "q_RM2_GRKArr in component environment (fmol)"
    legend_algebraic[103] = "q_L_RM2_GRKArr in component environment (fmol)"
    legend_states[0] = "q_ATP in component cAMP (fmol)"
    legend_states[1] = "q_cAMP in component cAMP (fmol)"
    legend_states[2] = "q_AC in component cAMP (fmol)"
    legend_states[3] = "q_AC_ATP in component cAMP (fmol)"
    legend_states[4] = "q_Gsa_GTP_AC in component cAMP (fmol)"
    legend_states[5] = "q_Gsa_GTP_AC_ATP in component cAMP (fmol)"
    legend_states[6] = "q_FSK_AC in component cAMP (fmol)"
    legend_states[7] = "q_FSK_AC_ATP in component cAMP (fmol)"
    legend_states[8] = "q_PDE in component cAMP (fmol)"
    legend_states[9] = "q_PDE_cAMP in component cAMP (fmol)"
    legend_states[10] = "q_five_AMP in component cAMP (fmol)"
    legend_states[11] = "q_IBMX in component cAMP (fmol)"
    legend_states[12] = "q_PDEinh in component cAMP (fmol)"
    legend_states[13] = "q_Gsa_GTP in component cAMP (fmol)"
    legend_states[14] = "q_FSK in component cAMP (fmol)"
    legend_states[15] = "q_Gia_GTP in component cAMP (fmol)"
    legend_states[16] = "q_ACinh in component cAMP (fmol)"
    legend_states[17] = "q_PPi in component cAMP (fmol)"
    legend_states[18] = "q_RB1_inactive in component GPCR_B1AR_reduced (fmol)"
    legend_states[19] = "q_L_RB1_inactive in component GPCR_B1AR_reduced (fmol)"
    legend_states[20] = "q_LB1 in component GPCR_B1AR_reduced (fmol)"
    legend_states[21] = "q_RB1 in component GPCR_B1AR_reduced (fmol)"
    legend_states[22] = "q_Gs in component GPCR_B1AR_reduced (fmol)"
    legend_states[23] = "q_RB1_Gs in component GPCR_B1AR_reduced (fmol)"
    legend_states[24] = "q_L_RB1 in component GPCR_B1AR_reduced (fmol)"
    legend_states[25] = "q_L_RB1_Gs in component GPCR_B1AR_reduced (fmol)"
    legend_states[26] = "q_Gsa_GTP in component GPCR_B1AR_reduced (fmol)"
    legend_states[27] = "q_Gsbetagamma in component GPCR_B1AR_reduced (fmol)"
    legend_states[28] = "q_Gsa_GDP in component GPCR_B1AR_reduced (fmol)"
    legend_states[29] = "q_GTP in component GPCR_B1AR_reduced (fmol)"
    legend_states[30] = "q_GDP in component GPCR_B1AR_reduced (fmol)"
    legend_states[31] = "q_Pi in component GPCR_B1AR_reduced (fmol)"
    legend_states[32] = "q_RB1_tag in component GPCR_B1AR_reduced (fmol)"
    legend_states[33] = "q_L_RB1_tag in component GPCR_B1AR_reduced (fmol)"
    legend_states[34] = "q_RB1_GRKArr in component GPCR_B1AR_reduced (fmol)"
    legend_states[35] = "q_L_RB1_GRKArr in component GPCR_B1AR_reduced (fmol)"
    legend_states[36] = "q_GRKArr in component GPCR_B1AR_reduced (fmol)"
    legend_states[37] = "q_RM2_inactive in component GPCR_M2_reduced (fmol)"
    legend_states[38] = "q_L_RM2_inactive in component GPCR_M2_reduced (fmol)"
    legend_states[39] = "q_LM2 in component GPCR_M2_reduced (fmol)"
    legend_states[40] = "q_RM2 in component GPCR_M2_reduced (fmol)"
    legend_states[41] = "q_Gi in component GPCR_M2_reduced (fmol)"
    legend_states[42] = "q_RM2_Gi in component GPCR_M2_reduced (fmol)"
    legend_states[43] = "q_L_RM2 in component GPCR_M2_reduced (fmol)"
    legend_states[44] = "q_L_RM2_Gi in component GPCR_M2_reduced (fmol)"
    legend_states[45] = "q_Gia_GTP in component GPCR_M2_reduced (fmol)"
    legend_states[46] = "q_Gibetagamma in component GPCR_M2_reduced (fmol)"
    legend_states[47] = "q_Gia_GDP in component GPCR_M2_reduced (fmol)"
    legend_states[48] = "q_GTP in component GPCR_M2_reduced (fmol)"
    legend_states[49] = "q_GDP in component GPCR_M2_reduced (fmol)"
    legend_states[50] = "q_Pi in component GPCR_M2_reduced (fmol)"
    legend_states[51] = "q_RM2_tag in component GPCR_M2_reduced (fmol)"
    legend_states[52] = "q_L_RM2_tag in component GPCR_M2_reduced (fmol)"
    legend_states[53] = "q_RM2_GRKArr in component GPCR_M2_reduced (fmol)"
    legend_states[54] = "q_L_RM2_GRKArr in component GPCR_M2_reduced (fmol)"
    legend_states[55] = "q_GRKArr in component GPCR_M2_reduced (fmol)"
    legend_constants[144] = "R in component constants (J_per_K_per_mol)"
    legend_constants[145] = "T in component constants (kelvin)"
    legend_constants[146] = "F in component constants (C_per_mol)"
    legend_algebraic[69] = "v1a in component cAMP (fmol_per_sec)"
    legend_algebraic[72] = "v1b in component cAMP (fmol_per_sec)"
    legend_algebraic[75] = "v2a in component cAMP (fmol_per_sec)"
    legend_algebraic[78] = "v2b in component cAMP (fmol_per_sec)"
    legend_algebraic[81] = "v3a in component cAMP (fmol_per_sec)"
    legend_algebraic[83] = "v3b in component cAMP (fmol_per_sec)"
    legend_algebraic[86] = "v4a in component cAMP (fmol_per_sec)"
    legend_algebraic[90] = "v4b in component cAMP (fmol_per_sec)"
    legend_algebraic[94] = "v5 in component cAMP (fmol_per_sec)"
    legend_algebraic[87] = "v6 in component cAMP (fmol_per_sec)"
    legend_algebraic[91] = "v7 in component cAMP (fmol_per_sec)"
    legend_algebraic[95] = "vGiAC in component cAMP (fmol_per_sec)"
    legend_algebraic[28] = "mu_ATP in component cAMP (J_per_mol)"
    legend_algebraic[32] = "mu_AC in component cAMP (J_per_mol)"
    legend_algebraic[30] = "mu_cAMP in component cAMP (J_per_mol)"
    legend_algebraic[34] = "mu_AC_ATP in component cAMP (J_per_mol)"
    legend_algebraic[57] = "mu_FSK in component cAMP (J_per_mol)"
    legend_algebraic[40] = "mu_FSK_AC in component cAMP (J_per_mol)"
    legend_algebraic[42] = "mu_FSK_AC_ATP in component cAMP (J_per_mol)"
    legend_algebraic[55] = "mu_Gsa_GTP in component cAMP (J_per_mol)"
    legend_algebraic[36] = "mu_Gsa_GTP_AC in component cAMP (J_per_mol)"
    legend_algebraic[38] = "mu_Gsa_GTP_AC_ATP in component cAMP (J_per_mol)"
    legend_algebraic[45] = "mu_PDE in component cAMP (J_per_mol)"
    legend_algebraic[53] = "mu_PDEinh in component cAMP (J_per_mol)"
    legend_algebraic[47] = "mu_PDE_cAMP in component cAMP (J_per_mol)"
    legend_algebraic[51] = "mu_IBMX in component cAMP (J_per_mol)"
    legend_algebraic[49] = "mu_five_AMP in component cAMP (J_per_mol)"
    legend_algebraic[61] = "mu_Gia_GTP in component cAMP (J_per_mol)"
    legend_algebraic[63] = "mu_ACinh in component cAMP (J_per_mol)"
    legend_algebraic[66] = "mu_PPi in component cAMP (J_per_mol)"
    legend_constants[147] = "vol in component cAMP (pL)"
    legend_algebraic[11] = "ATP_T in component cAMP (fmol)"
    legend_algebraic[12] = "AC_T in component cAMP (fmol)"
    legend_algebraic[21] = "Gs_T in component cAMP (fmol)"
    legend_algebraic[15] = "cAMP_T in component cAMP (fmol)"
    legend_algebraic[64] = "mu_RB1_inactive in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[67] = "mu_L_RB1_inactive in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[70] = "mu_LB1 in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[73] = "mu_RB1 in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[76] = "mu_Gs in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[79] = "mu_RB1_Gs in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[82] = "mu_L_RB1 in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[84] = "mu_L_RB1_Gs in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[88] = "mu_Gsa_GTP in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[92] = "mu_Gsbetagamma in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[96] = "mu_Gsa_GDP in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[98] = "mu_GTP in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[100] = "mu_GDP in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[102] = "mu_Pi in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[104] = "mu_RB1_tag in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[106] = "mu_L_RB1_tag in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[108] = "mu_RB1_GRKArr in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[110] = "mu_L_RB1_GRKArr in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[112] = "mu_GRKArr in component GPCR_B1AR_reduced (J_per_mol)"
    legend_algebraic[114] = "v_Rswitch_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[116] = "v_LRswitch_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[118] = "v_C_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[121] = "v_R_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[119] = "v_L_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[124] = "v_Act1_Gs in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[126] = "v_Act2_Gs in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[128] = "v_Hyd_Gs in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[131] = "v_Reassoc_Gs in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[129] = "v_InternR_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[132] = "v_InternLR_B1 in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[122] = "v_Rsynthesis in component GPCR_B1AR_reduced (fmol_per_sec)"
    legend_algebraic[105] = "mu_RM2_inactive in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[107] = "mu_L_RM2_inactive in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[109] = "mu_LM2 in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[111] = "mu_RM2 in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[113] = "mu_Gi in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[115] = "mu_RM2_Gi in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[117] = "mu_L_RM2 in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[120] = "mu_L_RM2_Gi in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[123] = "mu_Gia_GTP in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[125] = "mu_Gibetagamma in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[127] = "mu_Gia_GDP in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[130] = "mu_GTP in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[133] = "mu_GDP in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[134] = "mu_Pi in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[135] = "mu_RM2_tag in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[136] = "mu_L_RM2_tag in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[137] = "mu_RM2_GRKArr in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[138] = "mu_L_RM2_GRKArr in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[139] = "mu_GRKArr in component GPCR_M2_reduced (J_per_mol)"
    legend_algebraic[140] = "v_Rswitch_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[141] = "v_LRswitch_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[142] = "v_C_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[143] = "v_R_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[144] = "v_L_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[145] = "v_Act1_Gi in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[146] = "v_Act2_Gi in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[148] = "v_Hyd_Gi in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[150] = "v_Reassoc_Gi in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[149] = "v_InternR_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[151] = "v_InternLR_M2 in component GPCR_M2_reduced (fmol_per_sec)"
    legend_algebraic[147] = "v_Rsynthesis in component GPCR_M2_reduced (fmol_per_sec)"
    legend_rates[0] = "d/dt q_ATP in component cAMP (fmol)"
    legend_rates[2] = "d/dt q_AC in component cAMP (fmol)"
    legend_rates[3] = "d/dt q_AC_ATP in component cAMP (fmol)"
    legend_rates[1] = "d/dt q_cAMP in component cAMP (fmol)"
    legend_rates[14] = "d/dt q_FSK in component cAMP (fmol)"
    legend_rates[6] = "d/dt q_FSK_AC in component cAMP (fmol)"
    legend_rates[7] = "d/dt q_FSK_AC_ATP in component cAMP (fmol)"
    legend_rates[13] = "d/dt q_Gsa_GTP in component cAMP (fmol)"
    legend_rates[4] = "d/dt q_Gsa_GTP_AC in component cAMP (fmol)"
    legend_rates[5] = "d/dt q_Gsa_GTP_AC_ATP in component cAMP (fmol)"
    legend_rates[9] = "d/dt q_PDE_cAMP in component cAMP (fmol)"
    legend_rates[8] = "d/dt q_PDE in component cAMP (fmol)"
    legend_rates[11] = "d/dt q_IBMX in component cAMP (fmol)"
    legend_rates[12] = "d/dt q_PDEinh in component cAMP (fmol)"
    legend_rates[10] = "d/dt q_five_AMP in component cAMP (fmol)"
    legend_rates[15] = "d/dt q_Gia_GTP in component cAMP (fmol)"
    legend_rates[16] = "d/dt q_ACinh in component cAMP (fmol)"
    legend_rates[17] = "d/dt q_PPi in component cAMP (fmol)"
    legend_rates[18] = "d/dt q_RB1_inactive in component GPCR_B1AR_reduced (fmol)"
    legend_rates[19] = "d/dt q_L_RB1_inactive in component GPCR_B1AR_reduced (fmol)"
    legend_rates[20] = "d/dt q_LB1 in component GPCR_B1AR_reduced (fmol)"
    legend_rates[21] = "d/dt q_RB1 in component GPCR_B1AR_reduced (fmol)"
    legend_rates[22] = "d/dt q_Gs in component GPCR_B1AR_reduced (fmol)"
    legend_rates[23] = "d/dt q_RB1_Gs in component GPCR_B1AR_reduced (fmol)"
    legend_rates[24] = "d/dt q_L_RB1 in component GPCR_B1AR_reduced (fmol)"
    legend_rates[25] = "d/dt q_L_RB1_Gs in component GPCR_B1AR_reduced (fmol)"
    legend_rates[26] = "d/dt q_Gsa_GTP in component GPCR_B1AR_reduced (fmol)"
    legend_rates[27] = "d/dt q_Gsbetagamma in component GPCR_B1AR_reduced (fmol)"
    legend_rates[28] = "d/dt q_Gsa_GDP in component GPCR_B1AR_reduced (fmol)"
    legend_rates[29] = "d/dt q_GTP in component GPCR_B1AR_reduced (fmol)"
    legend_rates[30] = "d/dt q_GDP in component GPCR_B1AR_reduced (fmol)"
    legend_rates[31] = "d/dt q_Pi in component GPCR_B1AR_reduced (fmol)"
    legend_rates[32] = "d/dt q_RB1_tag in component GPCR_B1AR_reduced (fmol)"
    legend_rates[33] = "d/dt q_L_RB1_tag in component GPCR_B1AR_reduced (fmol)"
    legend_rates[34] = "d/dt q_RB1_GRKArr in component GPCR_B1AR_reduced (fmol)"
    legend_rates[35] = "d/dt q_L_RB1_GRKArr in component GPCR_B1AR_reduced (fmol)"
    legend_rates[36] = "d/dt q_GRKArr in component GPCR_B1AR_reduced (fmol)"
    legend_rates[37] = "d/dt q_RM2_inactive in component GPCR_M2_reduced (fmol)"
    legend_rates[38] = "d/dt q_L_RM2_inactive in component GPCR_M2_reduced (fmol)"
    legend_rates[39] = "d/dt q_LM2 in component GPCR_M2_reduced (fmol)"
    legend_rates[40] = "d/dt q_RM2 in component GPCR_M2_reduced (fmol)"
    legend_rates[41] = "d/dt q_Gi in component GPCR_M2_reduced (fmol)"
    legend_rates[42] = "d/dt q_RM2_Gi in component GPCR_M2_reduced (fmol)"
    legend_rates[43] = "d/dt q_L_RM2 in component GPCR_M2_reduced (fmol)"
    legend_rates[44] = "d/dt q_L_RM2_Gi in component GPCR_M2_reduced (fmol)"
    legend_rates[45] = "d/dt q_Gia_GTP in component GPCR_M2_reduced (fmol)"
    legend_rates[46] = "d/dt q_Gibetagamma in component GPCR_M2_reduced (fmol)"
    legend_rates[47] = "d/dt q_Gia_GDP in component GPCR_M2_reduced (fmol)"
    legend_rates[48] = "d/dt q_GTP in component GPCR_M2_reduced (fmol)"
    legend_rates[49] = "d/dt q_GDP in component GPCR_M2_reduced (fmol)"
    legend_rates[50] = "d/dt q_Pi in component GPCR_M2_reduced (fmol)"
    legend_rates[51] = "d/dt q_RM2_tag in component GPCR_M2_reduced (fmol)"
    legend_rates[52] = "d/dt q_L_RM2_tag in component GPCR_M2_reduced (fmol)"
    legend_rates[53] = "d/dt q_RM2_GRKArr in component GPCR_M2_reduced (fmol)"
    legend_rates[54] = "d/dt q_L_RM2_GRKArr in component GPCR_M2_reduced (fmol)"
    legend_rates[55] = "d/dt q_GRKArr in component GPCR_M2_reduced (fmol)"
    return (legend_states, legend_algebraic, legend_voi, legend_constants)

def initConsts():
    constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
    constants[0] = 7.05076e+06
    constants[1] = 0.00147213
    constants[2] = 186465
    constants[3] = 0.0503158
    constants[4] = 2.50455e+08
    constants[5] = 2.91227e-17
    constants[6] = 30352.7
    constants[7] = 0.116741
    constants[8] = 833.759
    constants[9] = 4236.98
    constants[10] = 569102
    constants[11] = 1052.47
    constants[12] = 93.1496
    constants[13] = 0.00202063
    constants[14] = 1459.71
    constants[15] = 31664.5
    constants[16] = 0.00057588
    constants[17] = 0.00326844
    constants[18] = 37.7371
    constants[19] = 0.0787034
    constants[20] = 0.00156706
    constants[21] = 0.00130092
    constants[22] = 15.0203
    constants[23] = 271.765
    constants[24] = 0.0101296
    constants[25] = 7036.75
    constants[26] = 262283
    constants[27] = 0.111426
    constants[28] = 0.00270806
    constants[29] = 1.32138
    constants[30] = 0.48875
    constants[31] = 0.00258927
    constants[32] = 0.000652343
    constants[33] = 0.318306
    constants[34] = 6.60544e-05
    constants[35] = 0.0166528
    constants[36] = 1.68744
    constants[37] = 3.94935
    constants[38] = 6.86096
    constants[39] = 4.91084
    constants[40] = 0.0510801
    constants[41] = 0.0998184
    constants[42] = 1.67186
    constants[43] = 1.24505
    constants[44] = 0.0166528
    constants[45] = 0.020208
    constants[46] = 34.8659
    constants[47] = 0.295487
    constants[48] = 1.99992e-05
    constants[49] = 0.0475823
    constants[50] = 27.6205
    constants[51] = 0.000115307
    constants[52] = 3.12076
    constants[53] = 143865
    constants[54] = 4702.09
    constants[55] = 0.0312076
    constants[56] = 0.185505
    constants[57] = 6.57187
    constants[58] = 0.00143865
    constants[59] = 0.000569194
    constants[60] = 9.19376
    constants[61] = 70.9724
    constants[62] = 0.629469
    constants[63] = 5.92518e-07
    constants[64] = 1.51286e-06
    constants[65] = 1.35735
    constants[66] = 0.000117561
    constants[67] = 0.00223456
    constants[68] = 1.93537e-07
    constants[69] = 4785.64
    constants[70] = 1.06966
    constants[71] = 28697.8
    constants[72] = 70.9007
    constants[73] = 0.0106966
    constants[74] = 0.11227
    constants[75] = 1.23934
    constants[76] = 0.000286978
    constants[77] = 0.00253994
    constants[78] = 34.5537
    constants[79] = 11.4287
    constants[80] = 2.70687
    constants[81] = 0.00554752
    constants[82] = 0.00445621
    constants[83] = 9.13266e-06
    constants[84] = 34.4
    constants[85] = 500
    constants[86] = 3.5e-4
    constants[87] = 0.25e-4
    constants[88] = 1.8e-4
    constants[89] = 1e1
    constants[90] = 1e-5
    constants[91] = 7e-4
    constants[92] = 0.25e-4
    constants[93] = 1.8e-4
    constants[94] = 1e1
    constants[95] = 1e-5
    constants[96] = 190
    constants[97] = 1.889E-03
    constants[98] = 1e-18
    constants[99] = 1e-18
    constants[100] = 3.800E-05
    constants[101] = 1e-18
    constants[102] = 1e-18
    constants[103] = 1e-18
    constants[104] = 1e-18
    constants[105] = 1e-18
    constants[106] = 1.482E-03
    constants[107] = 1e-18
    constants[108] = 1e-18
    constants[109] = 3.80E-02
    constants[110] = 1e-18
    constants[111] = 1e-18
    constants[112] = 1e-18
    constants[113] = 1e-18
    constants[114] = 0.0004579000
    constants[115] = 1e-18
    constants[116] = 1e-18
    constants[117] = 0.1455400000
    constants[118] = 1e-18
    constants[119] = 1e-18
    constants[120] = 1e-18
    constants[121] = 1e-18
    constants[122] = 1e-18
    constants[123] = 2.2
    constants[124] = 1.1
    constants[125] = 570
    constants[126] = 1e-18
    constants[127] = 1e-18
    constants[128] = 1e-18
    constants[129] = 1e-18
    constants[130] = 1e-8
    constants[131] = 0.00072
    constants[132] = 1e-18
    constants[133] = 1e-18
    constants[134] = 0.00836
    constants[135] = 1e-18
    constants[136] = 1e-18
    constants[137] = 1e-18
    constants[138] = 1e-18
    constants[139] = 1e-18
    constants[140] = 1e-18
    constants[141] = 1e-18
    constants[142] = 1e-18
    constants[143] = 1e-18
    states[0] = 1e-16
    states[1] = 1e-16
    states[2] = 1e-16
    states[3] = 1e-16
    states[4] = 1e-16
    states[5] = 1e-16
    states[6] = 1e-16
    states[7] = 1e-16
    states[8] = 1e-16
    states[9] = 1e-16
    states[10] = 1e-16
    states[11] = 1e-16
    states[12] = 1e-16
    states[13] = 1e-16
    states[14] = 1e-16
    states[15] = 1e-16
    states[16] = 1e-16
    states[17] = 1e-16
    states[18] = 1e-16
    states[19] = 1e-16
    states[20] = 1e-16
    states[21] = 1e-16
    states[22] = 1e-16
    states[23] = 1e-16
    states[24] = 1e-16
    states[25] = 1e-16
    states[26] = 1e-16
    states[27] = 1e-16
    states[28] = 1e-16
    states[29] = 1e-16
    states[30] = 1e-16
    states[31] = 1e-16
    states[32] = 1e-16
    states[33] = 1e-16
    states[34] = 1e-16
    states[35] = 1e-16
    states[36] = 1e-16
    states[37] = 1e-16
    states[38] = 1e-16
    states[39] = 1e-16
    states[40] = 1e-16
    states[41] = 1e-16
    states[42] = 1e-16
    states[43] = 1e-16
    states[44] = 1e-16
    states[45] = 1e-16
    states[46] = 1e-16
    states[47] = 1e-16
    states[48] = 1e-16
    states[49] = 1e-16
    states[50] = 1e-16
    states[51] = 1e-16
    states[52] = 1e-16
    states[53] = 1e-16
    states[54] = 1e-16
    states[55] = 1e-16
    constants[144] = 8.31
    constants[145] = 310
    constants[146] = 96485
    constants[147] = 38.0
    constants[148] = constants[89]/constants[88]
    constants[149] = constants[94]/constants[93]
    return (states, constants)

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    algebraic[2] = constants[96]+states[0]
    algebraic[28] = constants[144]*constants[145]*log(constants[34]*algebraic[2])
    algebraic[4] = constants[97]+states[2]
    algebraic[32] = constants[144]*constants[145]*log(constants[36]*algebraic[4])
    algebraic[5] = constants[99]+states[3]
    algebraic[34] = constants[144]*constants[145]*log(constants[37]*algebraic[5])
    algebraic[69] = constants[0]*(exp((algebraic[32]+algebraic[28])/(constants[144]*constants[145]))-exp(algebraic[34]/(constants[144]*constants[145])))
    algebraic[3] = constants[98]+states[1]
    algebraic[30] = constants[144]*constants[145]*log(constants[35]*algebraic[3])
    algebraic[25] = constants[113]+states[17]
    algebraic[66] = constants[144]*constants[145]*log(constants[51]*algebraic[25])
    algebraic[72] = constants[1]*(exp(algebraic[34]/(constants[144]*constants[145]))-exp((algebraic[32]+algebraic[30]+algebraic[66])/(constants[144]*constants[145])))
    rates[3] = algebraic[69]-algebraic[72]
    algebraic[6] = constants[104]+states[4]
    algebraic[36] = constants[144]*constants[145]*log(constants[38]*algebraic[6])
    algebraic[7] = constants[105]+states[5]
    algebraic[38] = constants[144]*constants[145]*log(constants[39]*algebraic[7])
    algebraic[75] = constants[2]*(exp((algebraic[36]+algebraic[28])/(constants[144]*constants[145]))-exp(algebraic[38]/(constants[144]*constants[145])))
    algebraic[78] = constants[3]*(exp(algebraic[38]/(constants[144]*constants[145]))-exp((algebraic[36]+algebraic[30]+algebraic[66])/(constants[144]*constants[145])))
    rates[5] = algebraic[75]-algebraic[78]
    algebraic[8] = constants[101]+states[6]
    algebraic[40] = constants[144]*constants[145]*log(constants[40]*algebraic[8])
    algebraic[9] = constants[102]+states[7]
    algebraic[42] = constants[144]*constants[145]*log(constants[41]*algebraic[9])
    algebraic[81] = constants[4]*(exp((algebraic[40]+algebraic[28])/(constants[144]*constants[145]))-exp(algebraic[42]/(constants[144]*constants[145])))
    rates[0] = (-algebraic[69]-algebraic[81])-algebraic[75]
    algebraic[83] = constants[5]*(exp(algebraic[42]/(constants[144]*constants[145]))-exp((algebraic[40]+algebraic[30]+algebraic[66])/(constants[144]*constants[145])))
    rates[7] = algebraic[81]-algebraic[83]
    algebraic[10] = constants[106]+states[8]
    algebraic[45] = constants[144]*constants[145]*log(constants[42]*algebraic[10])
    algebraic[13] = constants[108]+states[9]
    algebraic[47] = constants[144]*constants[145]*log(constants[43]*algebraic[13])
    algebraic[86] = constants[6]*(exp((algebraic[45]+algebraic[30])/(constants[144]*constants[145]))-exp(algebraic[47]/(constants[144]*constants[145])))
    rates[1] = (algebraic[72]+algebraic[83]+algebraic[78])-algebraic[86]
    algebraic[19] = constants[103]+states[13]+states[26]
    algebraic[55] = constants[144]*constants[145]*log(constants[47]*algebraic[19])
    algebraic[87] = constants[9]*(exp((algebraic[32]+algebraic[55])/(constants[144]*constants[145]))-exp(algebraic[36]/(constants[144]*constants[145])))
    rates[13] = -algebraic[87]
    rates[4] = (algebraic[87]-algebraic[75])+algebraic[78]
    algebraic[20] = constants[100]+states[14]
    algebraic[57] = constants[144]*constants[145]*log(constants[48]*algebraic[20])
    algebraic[91] = constants[10]*(exp((algebraic[57]+algebraic[32])/(constants[144]*constants[145]))-exp(algebraic[40]/(constants[144]*constants[145])))
    rates[14] = -algebraic[91]
    rates[6] = (algebraic[91]+algebraic[83])-algebraic[81]
    algebraic[14] = constants[110]+states[10]
    algebraic[49] = constants[144]*constants[145]*log(constants[44]*algebraic[14])
    algebraic[90] = constants[7]*(exp(algebraic[47]/(constants[144]*constants[145]))-exp((algebraic[45]+algebraic[49])/(constants[144]*constants[145])))
    rates[9] = algebraic[86]-algebraic[90]
    rates[10] = algebraic[90]
    algebraic[22] = constants[111]+states[15]+states[45]
    algebraic[61] = constants[144]*constants[145]*log(constants[49]*algebraic[22])
    algebraic[23] = constants[112]+states[16]
    algebraic[63] = constants[144]*constants[145]*log(constants[50]*algebraic[23])
    algebraic[95] = constants[11]*(exp((algebraic[32]+algebraic[61])/(constants[144]*constants[145]))-exp(algebraic[63]/(constants[144]*constants[145])))
    rates[2] = (((algebraic[72]-algebraic[69])-algebraic[87])-algebraic[91])-algebraic[95]
    algebraic[18] = constants[107]+states[12]
    algebraic[53] = constants[144]*constants[145]*log(constants[46]*algebraic[18])
    algebraic[17] = constants[109]+states[11]
    algebraic[51] = constants[144]*constants[145]*log(constants[45]*algebraic[17])
    algebraic[94] = constants[8]*(exp((algebraic[45]+algebraic[51])/(constants[144]*constants[145]))-exp(algebraic[53]/(constants[144]*constants[145])))
    rates[8] = (algebraic[90]-algebraic[86])-algebraic[94]
    rates[11] = -algebraic[94]
    rates[12] = algebraic[94]
    rates[15] = -algebraic[95]
    rates[16] = algebraic[95]
    rates[17] = algebraic[95]
    algebraic[26] = constants[115]+states[19]
    algebraic[67] = constants[144]*constants[145]*log(constants[53]*algebraic[26])
    algebraic[35] = constants[119]+states[24]
    algebraic[82] = constants[144]*constants[145]*log(constants[58]*algebraic[35])
    algebraic[116] = constants[13]*(exp(algebraic[67]/(constants[144]*constants[145]))-exp(algebraic[82]/(constants[144]*constants[145])))
    algebraic[24] = constants[114]+states[18]
    algebraic[64] = constants[144]*constants[145]*log(constants[52]*algebraic[24])
    algebraic[0] = custom_piecewise([less(voi , constants[86]) & greater(voi , constants[86]-constants[88]), constants[90]+constants[148]*((voi-constants[86])+constants[88]) , greater_equal(voi , constants[86]) & less(voi , constants[86]+constants[87]), constants[89]+constants[90] , less(voi , constants[86]+constants[88]+constants[87]) & greater_equal(voi , constants[86]+constants[87]), constants[90]+-constants[148]*(((voi-constants[86])-constants[88])-constants[87]) , True, constants[90]])
    algebraic[27] = algebraic[0]+states[20]
    algebraic[70] = constants[144]*constants[145]*log(constants[54]*algebraic[27])
    algebraic[119] = constants[16]*(exp((algebraic[64]+algebraic[70])/(constants[144]*constants[145]))-exp(algebraic[67]/(constants[144]*constants[145])))
    rates[19] = -algebraic[116]+algebraic[119]
    rates[20] = -algebraic[119]
    algebraic[29] = constants[116]+states[21]
    algebraic[73] = constants[144]*constants[145]*log(constants[55]*algebraic[29])
    algebraic[114] = constants[12]*(exp(algebraic[64]/(constants[144]*constants[145]))-exp(algebraic[73]/(constants[144]*constants[145])))
    algebraic[31] = constants[117]+states[22]
    algebraic[76] = constants[144]*constants[145]*log(constants[56]*algebraic[31])
    algebraic[33] = constants[118]+states[23]
    algebraic[79] = constants[144]*constants[145]*log(constants[57]*algebraic[33])
    algebraic[118] = constants[14]*(exp((algebraic[73]+algebraic[76])/(constants[144]*constants[145]))-exp(algebraic[79]/(constants[144]*constants[145])))
    rates[21] = algebraic[114]-algebraic[118]
    algebraic[122] = algebraic[114]+algebraic[119]
    rates[18] = (-algebraic[114]-algebraic[119])+1.00000*algebraic[122]
    algebraic[37] = constants[120]+states[25]
    algebraic[84] = constants[144]*constants[145]*log(constants[59]*algebraic[37])
    algebraic[121] = constants[15]*(exp((algebraic[82]+algebraic[76])/(constants[144]*constants[145]))-exp(algebraic[84]/(constants[144]*constants[145])))
    rates[24] = algebraic[116]-algebraic[121]
    algebraic[88] = constants[144]*constants[145]*log(constants[47]*algebraic[19])
    algebraic[39] = constants[121]+states[27]
    algebraic[92] = constants[144]*constants[145]*log(constants[60]*algebraic[39])
    algebraic[44] = constants[123]+states[29]+states[48]
    algebraic[98] = constants[144]*constants[145]*log(constants[62]*algebraic[44])
    algebraic[46] = constants[124]+states[30]+states[49]
    algebraic[100] = constants[144]*constants[145]*log(constants[63]*algebraic[46])
    algebraic[50] = constants[126]+states[32]
    algebraic[104] = constants[144]*constants[145]*log(constants[65]*algebraic[50])
    algebraic[124] = constants[17]*(exp((algebraic[79]+algebraic[98])/(constants[144]*constants[145]))-exp((algebraic[88]+algebraic[92]+algebraic[104]+algebraic[100])/(constants[144]*constants[145])))
    rates[23] = algebraic[118]-algebraic[124]
    algebraic[52] = constants[127]+states[33]
    algebraic[106] = constants[144]*constants[145]*log(constants[66]*algebraic[52])
    algebraic[126] = constants[18]*(exp((algebraic[84]+algebraic[98])/(constants[144]*constants[145]))-exp((algebraic[88]+algebraic[92]+algebraic[106]+algebraic[100])/(constants[144]*constants[145])))
    rates[25] = algebraic[121]-algebraic[126]
    rates[29] = -algebraic[124]-algebraic[126]
    rates[30] = algebraic[124]+algebraic[126]
    algebraic[41] = constants[122]+states[28]
    algebraic[96] = constants[144]*constants[145]*log(constants[61]*algebraic[41])
    algebraic[48] = constants[125]+states[31]+states[50]
    algebraic[102] = constants[144]*constants[145]*log(constants[64]*algebraic[48])
    algebraic[128] = constants[19]*(exp(algebraic[88]/(constants[144]*constants[145]))-exp((algebraic[96]+algebraic[102])/(constants[144]*constants[145])))
    rates[26] = (algebraic[124]+algebraic[126])-algebraic[128]
    rates[31] = algebraic[128]
    algebraic[54] = constants[128]+states[34]
    algebraic[108] = constants[144]*constants[145]*log(constants[67]*algebraic[54])
    algebraic[60] = constants[130]+states[36]+states[55]
    algebraic[112] = constants[144]*constants[145]*log(constants[69]*algebraic[60])
    algebraic[129] = constants[21]*(exp((algebraic[104]+algebraic[112])/(constants[144]*constants[145]))-exp(algebraic[108]/(constants[144]*constants[145])))
    rates[32] = algebraic[124]-algebraic[129]
    rates[34] = algebraic[129]
    algebraic[131] = constants[20]*(exp((algebraic[96]+algebraic[92])/(constants[144]*constants[145]))-exp(algebraic[76]/(constants[144]*constants[145])))
    rates[22] = (-algebraic[118]-algebraic[121])+algebraic[131]
    rates[27] = (algebraic[124]+algebraic[126])-algebraic[131]
    rates[28] = algebraic[128]-algebraic[131]
    algebraic[56] = constants[129]+states[35]
    algebraic[110] = constants[144]*constants[145]*log(constants[68]*algebraic[56])
    algebraic[132] = constants[22]*(exp((algebraic[106]+algebraic[112])/(constants[144]*constants[145]))-exp(algebraic[110]/(constants[144]*constants[145])))
    rates[33] = algebraic[126]-algebraic[132]
    rates[35] = algebraic[132]
    rates[36] = -algebraic[129]-algebraic[132]
    algebraic[65] = constants[132]+states[38]
    algebraic[107] = constants[144]*constants[145]*log(constants[71]*algebraic[65])
    algebraic[80] = constants[136]+states[43]
    algebraic[117] = constants[144]*constants[145]*log(constants[76]*algebraic[80])
    algebraic[141] = constants[24]*(exp(algebraic[107]/(constants[144]*constants[145]))-exp(algebraic[117]/(constants[144]*constants[145])))
    rates[38] = -algebraic[141]
    algebraic[62] = constants[131]+states[37]
    algebraic[105] = constants[144]*constants[145]*log(constants[70]*algebraic[62])
    algebraic[71] = constants[133]+states[40]
    algebraic[111] = constants[144]*constants[145]*log(constants[73]*algebraic[71])
    algebraic[140] = constants[23]*(exp(algebraic[105]/(constants[144]*constants[145]))-exp(algebraic[111]/(constants[144]*constants[145])))
    algebraic[1] = custom_piecewise([less(voi , constants[91]) & greater(voi , constants[91]-constants[93]), constants[95]+constants[149]*((voi-constants[91])+constants[93]) , greater_equal(voi , constants[91]) & less(voi , constants[91]+constants[92]), constants[94]+constants[95] , less(voi , constants[91]+constants[93]+constants[92]) & greater_equal(voi , constants[91]+constants[92]), constants[95]+-constants[149]*(((voi-constants[91])-constants[93])-constants[92]) , True, constants[95]])
    algebraic[68] = algebraic[1]+states[39]
    algebraic[109] = constants[144]*constants[145]*log(constants[72]*algebraic[68])
    algebraic[144] = constants[27]*(exp((algebraic[105]+algebraic[109])/(constants[144]*constants[145]))-exp(algebraic[107]/(constants[144]*constants[145])))
    rates[37] = -algebraic[140]-algebraic[144]
    rates[39] = -algebraic[144]
    algebraic[74] = constants[134]+states[41]
    algebraic[113] = constants[144]*constants[145]*log(constants[74]*algebraic[74])
    algebraic[77] = constants[135]+states[42]
    algebraic[115] = constants[144]*constants[145]*log(constants[75]*algebraic[77])
    algebraic[142] = constants[25]*(exp((algebraic[111]+algebraic[113])/(constants[144]*constants[145]))-exp(algebraic[115]/(constants[144]*constants[145])))
    algebraic[123] = constants[144]*constants[145]*log(constants[49]*algebraic[22])
    algebraic[89] = constants[138]+states[46]
    algebraic[125] = constants[144]*constants[145]*log(constants[78]*algebraic[89])
    algebraic[130] = constants[144]*constants[145]*log(constants[62]*algebraic[44])
    algebraic[133] = constants[144]*constants[145]*log(constants[63]*algebraic[46])
    algebraic[97] = constants[140]+states[51]
    algebraic[135] = constants[144]*constants[145]*log(constants[80]*algebraic[97])
    algebraic[145] = constants[28]*(exp((algebraic[115]+algebraic[130])/(constants[144]*constants[145]))-exp((algebraic[123]+algebraic[125]+algebraic[135]+algebraic[133])/(constants[144]*constants[145])))
    rates[42] = algebraic[142]-algebraic[145]
    algebraic[85] = constants[137]+states[44]
    algebraic[120] = constants[144]*constants[145]*log(constants[77]*algebraic[85])
    algebraic[143] = constants[26]*(exp((algebraic[117]+algebraic[113])/(constants[144]*constants[145]))-exp(algebraic[120]/(constants[144]*constants[145])))
    rates[43] = (algebraic[141]-algebraic[143])+algebraic[144]
    algebraic[147] = (algebraic[142])+algebraic[144]
    rates[40] = (algebraic[140]-algebraic[142])+1.00000*algebraic[147]
    algebraic[99] = constants[141]+states[52]
    algebraic[136] = constants[144]*constants[145]*log(constants[81]*algebraic[99])
    algebraic[146] = constants[29]*(exp((algebraic[120]+algebraic[130])/(constants[144]*constants[145]))-exp((algebraic[123]+algebraic[125]+algebraic[136]+algebraic[133])/(constants[144]*constants[145])))
    rates[44] = algebraic[143]-algebraic[146]
    rates[48] = -algebraic[145]-algebraic[146]
    rates[49] = algebraic[145]+algebraic[146]
    algebraic[93] = constants[139]+states[47]
    algebraic[127] = constants[144]*constants[145]*log(constants[79]*algebraic[93])
    algebraic[134] = constants[144]*constants[145]*log(constants[64]*algebraic[48])
    algebraic[148] = constants[30]*(exp(algebraic[123]/(constants[144]*constants[145]))-exp((algebraic[127]+algebraic[134])/(constants[144]*constants[145])))
    rates[45] = (algebraic[145]+algebraic[146])-algebraic[148]
    rates[50] = algebraic[148]
    algebraic[101] = constants[142]+states[53]
    algebraic[137] = constants[144]*constants[145]*log(constants[82]*algebraic[101])
    algebraic[139] = constants[144]*constants[145]*log(constants[69]*algebraic[60])
    algebraic[149] = constants[32]*(exp((algebraic[135]+algebraic[139])/(constants[144]*constants[145]))-exp(algebraic[137]/(constants[144]*constants[145])))
    rates[51] = algebraic[145]-algebraic[149]
    rates[53] = algebraic[149]
    algebraic[150] = constants[31]*(exp((algebraic[127]+algebraic[125])/(constants[144]*constants[145]))-exp(algebraic[113]/(constants[144]*constants[145])))
    rates[41] = (-algebraic[142]-algebraic[143])+algebraic[150]
    rates[46] = (algebraic[145]+algebraic[146])-algebraic[150]
    rates[47] = algebraic[148]-algebraic[150]
    algebraic[103] = constants[143]+states[54]
    algebraic[138] = constants[144]*constants[145]*log(constants[83]*algebraic[103])
    algebraic[151] = constants[33]*(exp((algebraic[136]+algebraic[139])/(constants[144]*constants[145]))-exp(algebraic[138]/(constants[144]*constants[145])))
    rates[52] = algebraic[146]-algebraic[151]
    rates[54] = algebraic[151]
    rates[55] = -algebraic[149]-algebraic[151]
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[2] = constants[96]+states[0]
    algebraic[28] = constants[144]*constants[145]*log(constants[34]*algebraic[2])
    algebraic[4] = constants[97]+states[2]
    algebraic[32] = constants[144]*constants[145]*log(constants[36]*algebraic[4])
    algebraic[5] = constants[99]+states[3]
    algebraic[34] = constants[144]*constants[145]*log(constants[37]*algebraic[5])
    algebraic[69] = constants[0]*(exp((algebraic[32]+algebraic[28])/(constants[144]*constants[145]))-exp(algebraic[34]/(constants[144]*constants[145])))
    algebraic[3] = constants[98]+states[1]
    algebraic[30] = constants[144]*constants[145]*log(constants[35]*algebraic[3])
    algebraic[25] = constants[113]+states[17]
    algebraic[66] = constants[144]*constants[145]*log(constants[51]*algebraic[25])
    algebraic[72] = constants[1]*(exp(algebraic[34]/(constants[144]*constants[145]))-exp((algebraic[32]+algebraic[30]+algebraic[66])/(constants[144]*constants[145])))
    algebraic[6] = constants[104]+states[4]
    algebraic[36] = constants[144]*constants[145]*log(constants[38]*algebraic[6])
    algebraic[7] = constants[105]+states[5]
    algebraic[38] = constants[144]*constants[145]*log(constants[39]*algebraic[7])
    algebraic[75] = constants[2]*(exp((algebraic[36]+algebraic[28])/(constants[144]*constants[145]))-exp(algebraic[38]/(constants[144]*constants[145])))
    algebraic[78] = constants[3]*(exp(algebraic[38]/(constants[144]*constants[145]))-exp((algebraic[36]+algebraic[30]+algebraic[66])/(constants[144]*constants[145])))
    algebraic[8] = constants[101]+states[6]
    algebraic[40] = constants[144]*constants[145]*log(constants[40]*algebraic[8])
    algebraic[9] = constants[102]+states[7]
    algebraic[42] = constants[144]*constants[145]*log(constants[41]*algebraic[9])
    algebraic[81] = constants[4]*(exp((algebraic[40]+algebraic[28])/(constants[144]*constants[145]))-exp(algebraic[42]/(constants[144]*constants[145])))
    algebraic[83] = constants[5]*(exp(algebraic[42]/(constants[144]*constants[145]))-exp((algebraic[40]+algebraic[30]+algebraic[66])/(constants[144]*constants[145])))
    algebraic[10] = constants[106]+states[8]
    algebraic[45] = constants[144]*constants[145]*log(constants[42]*algebraic[10])
    algebraic[13] = constants[108]+states[9]
    algebraic[47] = constants[144]*constants[145]*log(constants[43]*algebraic[13])
    algebraic[86] = constants[6]*(exp((algebraic[45]+algebraic[30])/(constants[144]*constants[145]))-exp(algebraic[47]/(constants[144]*constants[145])))
    algebraic[19] = constants[103]+states[13]+states[26]
    algebraic[55] = constants[144]*constants[145]*log(constants[47]*algebraic[19])
    algebraic[87] = constants[9]*(exp((algebraic[32]+algebraic[55])/(constants[144]*constants[145]))-exp(algebraic[36]/(constants[144]*constants[145])))
    algebraic[20] = constants[100]+states[14]
    algebraic[57] = constants[144]*constants[145]*log(constants[48]*algebraic[20])
    algebraic[91] = constants[10]*(exp((algebraic[57]+algebraic[32])/(constants[144]*constants[145]))-exp(algebraic[40]/(constants[144]*constants[145])))
    algebraic[14] = constants[110]+states[10]
    algebraic[49] = constants[144]*constants[145]*log(constants[44]*algebraic[14])
    algebraic[90] = constants[7]*(exp(algebraic[47]/(constants[144]*constants[145]))-exp((algebraic[45]+algebraic[49])/(constants[144]*constants[145])))
    algebraic[22] = constants[111]+states[15]+states[45]
    algebraic[61] = constants[144]*constants[145]*log(constants[49]*algebraic[22])
    algebraic[23] = constants[112]+states[16]
    algebraic[63] = constants[144]*constants[145]*log(constants[50]*algebraic[23])
    algebraic[95] = constants[11]*(exp((algebraic[32]+algebraic[61])/(constants[144]*constants[145]))-exp(algebraic[63]/(constants[144]*constants[145])))
    algebraic[18] = constants[107]+states[12]
    algebraic[53] = constants[144]*constants[145]*log(constants[46]*algebraic[18])
    algebraic[17] = constants[109]+states[11]
    algebraic[51] = constants[144]*constants[145]*log(constants[45]*algebraic[17])
    algebraic[94] = constants[8]*(exp((algebraic[45]+algebraic[51])/(constants[144]*constants[145]))-exp(algebraic[53]/(constants[144]*constants[145])))
    algebraic[26] = constants[115]+states[19]
    algebraic[67] = constants[144]*constants[145]*log(constants[53]*algebraic[26])
    algebraic[35] = constants[119]+states[24]
    algebraic[82] = constants[144]*constants[145]*log(constants[58]*algebraic[35])
    algebraic[116] = constants[13]*(exp(algebraic[67]/(constants[144]*constants[145]))-exp(algebraic[82]/(constants[144]*constants[145])))
    algebraic[24] = constants[114]+states[18]
    algebraic[64] = constants[144]*constants[145]*log(constants[52]*algebraic[24])
    algebraic[0] = custom_piecewise([less(voi , constants[86]) & greater(voi , constants[86]-constants[88]), constants[90]+constants[148]*((voi-constants[86])+constants[88]) , greater_equal(voi , constants[86]) & less(voi , constants[86]+constants[87]), constants[89]+constants[90] , less(voi , constants[86]+constants[88]+constants[87]) & greater_equal(voi , constants[86]+constants[87]), constants[90]+-constants[148]*(((voi-constants[86])-constants[88])-constants[87]) , True, constants[90]])
    algebraic[27] = algebraic[0]+states[20]
    algebraic[70] = constants[144]*constants[145]*log(constants[54]*algebraic[27])
    algebraic[119] = constants[16]*(exp((algebraic[64]+algebraic[70])/(constants[144]*constants[145]))-exp(algebraic[67]/(constants[144]*constants[145])))
    algebraic[29] = constants[116]+states[21]
    algebraic[73] = constants[144]*constants[145]*log(constants[55]*algebraic[29])
    algebraic[114] = constants[12]*(exp(algebraic[64]/(constants[144]*constants[145]))-exp(algebraic[73]/(constants[144]*constants[145])))
    algebraic[31] = constants[117]+states[22]
    algebraic[76] = constants[144]*constants[145]*log(constants[56]*algebraic[31])
    algebraic[33] = constants[118]+states[23]
    algebraic[79] = constants[144]*constants[145]*log(constants[57]*algebraic[33])
    algebraic[118] = constants[14]*(exp((algebraic[73]+algebraic[76])/(constants[144]*constants[145]))-exp(algebraic[79]/(constants[144]*constants[145])))
    algebraic[122] = algebraic[114]+algebraic[119]
    algebraic[37] = constants[120]+states[25]
    algebraic[84] = constants[144]*constants[145]*log(constants[59]*algebraic[37])
    algebraic[121] = constants[15]*(exp((algebraic[82]+algebraic[76])/(constants[144]*constants[145]))-exp(algebraic[84]/(constants[144]*constants[145])))
    algebraic[88] = constants[144]*constants[145]*log(constants[47]*algebraic[19])
    algebraic[39] = constants[121]+states[27]
    algebraic[92] = constants[144]*constants[145]*log(constants[60]*algebraic[39])
    algebraic[44] = constants[123]+states[29]+states[48]
    algebraic[98] = constants[144]*constants[145]*log(constants[62]*algebraic[44])
    algebraic[46] = constants[124]+states[30]+states[49]
    algebraic[100] = constants[144]*constants[145]*log(constants[63]*algebraic[46])
    algebraic[50] = constants[126]+states[32]
    algebraic[104] = constants[144]*constants[145]*log(constants[65]*algebraic[50])
    algebraic[124] = constants[17]*(exp((algebraic[79]+algebraic[98])/(constants[144]*constants[145]))-exp((algebraic[88]+algebraic[92]+algebraic[104]+algebraic[100])/(constants[144]*constants[145])))
    algebraic[52] = constants[127]+states[33]
    algebraic[106] = constants[144]*constants[145]*log(constants[66]*algebraic[52])
    algebraic[126] = constants[18]*(exp((algebraic[84]+algebraic[98])/(constants[144]*constants[145]))-exp((algebraic[88]+algebraic[92]+algebraic[106]+algebraic[100])/(constants[144]*constants[145])))
    algebraic[41] = constants[122]+states[28]
    algebraic[96] = constants[144]*constants[145]*log(constants[61]*algebraic[41])
    algebraic[48] = constants[125]+states[31]+states[50]
    algebraic[102] = constants[144]*constants[145]*log(constants[64]*algebraic[48])
    algebraic[128] = constants[19]*(exp(algebraic[88]/(constants[144]*constants[145]))-exp((algebraic[96]+algebraic[102])/(constants[144]*constants[145])))
    algebraic[54] = constants[128]+states[34]
    algebraic[108] = constants[144]*constants[145]*log(constants[67]*algebraic[54])
    algebraic[60] = constants[130]+states[36]+states[55]
    algebraic[112] = constants[144]*constants[145]*log(constants[69]*algebraic[60])
    algebraic[129] = constants[21]*(exp((algebraic[104]+algebraic[112])/(constants[144]*constants[145]))-exp(algebraic[108]/(constants[144]*constants[145])))
    algebraic[131] = constants[20]*(exp((algebraic[96]+algebraic[92])/(constants[144]*constants[145]))-exp(algebraic[76]/(constants[144]*constants[145])))
    algebraic[56] = constants[129]+states[35]
    algebraic[110] = constants[144]*constants[145]*log(constants[68]*algebraic[56])
    algebraic[132] = constants[22]*(exp((algebraic[106]+algebraic[112])/(constants[144]*constants[145]))-exp(algebraic[110]/(constants[144]*constants[145])))
    algebraic[65] = constants[132]+states[38]
    algebraic[107] = constants[144]*constants[145]*log(constants[71]*algebraic[65])
    algebraic[80] = constants[136]+states[43]
    algebraic[117] = constants[144]*constants[145]*log(constants[76]*algebraic[80])
    algebraic[141] = constants[24]*(exp(algebraic[107]/(constants[144]*constants[145]))-exp(algebraic[117]/(constants[144]*constants[145])))
    algebraic[62] = constants[131]+states[37]
    algebraic[105] = constants[144]*constants[145]*log(constants[70]*algebraic[62])
    algebraic[71] = constants[133]+states[40]
    algebraic[111] = constants[144]*constants[145]*log(constants[73]*algebraic[71])
    algebraic[140] = constants[23]*(exp(algebraic[105]/(constants[144]*constants[145]))-exp(algebraic[111]/(constants[144]*constants[145])))
    algebraic[1] = custom_piecewise([less(voi , constants[91]) & greater(voi , constants[91]-constants[93]), constants[95]+constants[149]*((voi-constants[91])+constants[93]) , greater_equal(voi , constants[91]) & less(voi , constants[91]+constants[92]), constants[94]+constants[95] , less(voi , constants[91]+constants[93]+constants[92]) & greater_equal(voi , constants[91]+constants[92]), constants[95]+-constants[149]*(((voi-constants[91])-constants[93])-constants[92]) , True, constants[95]])
    algebraic[68] = algebraic[1]+states[39]
    algebraic[109] = constants[144]*constants[145]*log(constants[72]*algebraic[68])
    algebraic[144] = constants[27]*(exp((algebraic[105]+algebraic[109])/(constants[144]*constants[145]))-exp(algebraic[107]/(constants[144]*constants[145])))
    algebraic[74] = constants[134]+states[41]
    algebraic[113] = constants[144]*constants[145]*log(constants[74]*algebraic[74])
    algebraic[77] = constants[135]+states[42]
    algebraic[115] = constants[144]*constants[145]*log(constants[75]*algebraic[77])
    algebraic[142] = constants[25]*(exp((algebraic[111]+algebraic[113])/(constants[144]*constants[145]))-exp(algebraic[115]/(constants[144]*constants[145])))
    algebraic[123] = constants[144]*constants[145]*log(constants[49]*algebraic[22])
    algebraic[89] = constants[138]+states[46]
    algebraic[125] = constants[144]*constants[145]*log(constants[78]*algebraic[89])
    algebraic[130] = constants[144]*constants[145]*log(constants[62]*algebraic[44])
    algebraic[133] = constants[144]*constants[145]*log(constants[63]*algebraic[46])
    algebraic[97] = constants[140]+states[51]
    algebraic[135] = constants[144]*constants[145]*log(constants[80]*algebraic[97])
    algebraic[145] = constants[28]*(exp((algebraic[115]+algebraic[130])/(constants[144]*constants[145]))-exp((algebraic[123]+algebraic[125]+algebraic[135]+algebraic[133])/(constants[144]*constants[145])))
    algebraic[85] = constants[137]+states[44]
    algebraic[120] = constants[144]*constants[145]*log(constants[77]*algebraic[85])
    algebraic[143] = constants[26]*(exp((algebraic[117]+algebraic[113])/(constants[144]*constants[145]))-exp(algebraic[120]/(constants[144]*constants[145])))
    algebraic[147] = (algebraic[142])+algebraic[144]
    algebraic[99] = constants[141]+states[52]
    algebraic[136] = constants[144]*constants[145]*log(constants[81]*algebraic[99])
    algebraic[146] = constants[29]*(exp((algebraic[120]+algebraic[130])/(constants[144]*constants[145]))-exp((algebraic[123]+algebraic[125]+algebraic[136]+algebraic[133])/(constants[144]*constants[145])))
    algebraic[93] = constants[139]+states[47]
    algebraic[127] = constants[144]*constants[145]*log(constants[79]*algebraic[93])
    algebraic[134] = constants[144]*constants[145]*log(constants[64]*algebraic[48])
    algebraic[148] = constants[30]*(exp(algebraic[123]/(constants[144]*constants[145]))-exp((algebraic[127]+algebraic[134])/(constants[144]*constants[145])))
    algebraic[101] = constants[142]+states[53]
    algebraic[137] = constants[144]*constants[145]*log(constants[82]*algebraic[101])
    algebraic[139] = constants[144]*constants[145]*log(constants[69]*algebraic[60])
    algebraic[149] = constants[32]*(exp((algebraic[135]+algebraic[139])/(constants[144]*constants[145]))-exp(algebraic[137]/(constants[144]*constants[145])))
    algebraic[150] = constants[31]*(exp((algebraic[127]+algebraic[125])/(constants[144]*constants[145]))-exp(algebraic[113]/(constants[144]*constants[145])))
    algebraic[103] = constants[143]+states[54]
    algebraic[138] = constants[144]*constants[145]*log(constants[83]*algebraic[103])
    algebraic[151] = constants[33]*(exp((algebraic[136]+algebraic[139])/(constants[144]*constants[145]))-exp(algebraic[138]/(constants[144]*constants[145])))
    algebraic[11] = algebraic[2]+algebraic[5]+algebraic[9]+algebraic[7]
    algebraic[12] = algebraic[4]+algebraic[5]+algebraic[8]+algebraic[9]+algebraic[6]+algebraic[7]
    algebraic[15] = algebraic[3]+algebraic[13]+states[10]
    algebraic[16] = algebraic[3]+algebraic[13]+algebraic[14]+algebraic[2]+algebraic[5]+algebraic[7]+algebraic[9]
    algebraic[21] = algebraic[19]+algebraic[6]+algebraic[7]
    algebraic[43] = algebraic[31]+algebraic[33]+algebraic[37]+algebraic[19]+algebraic[41]
    algebraic[58] = algebraic[26]+algebraic[27]+algebraic[37]+algebraic[35]+algebraic[52]+algebraic[56]
    algebraic[59] = algebraic[24]+algebraic[26]+algebraic[29]+algebraic[33]+algebraic[35]+algebraic[37]+algebraic[50]+algebraic[52]+algebraic[54]+algebraic[56]
    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)