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 = 146 sizeStates = 41 sizeConstants = 99 from math import * from numpy import * def createLegends(): legend_states = [""] * sizeStates legend_rates = [""] * sizeStates legend_algebraic = [""] * sizeAlgebraic legend_voi = "" legend_constants = [""] * sizeConstants legend_voi = "time in component environment (millisecond)" legend_states[0] = "Vm in component membrane (millivolt)" legend_constants[0] = "R in component membrane (coulomb_millivolt_per_kelvin_millimole)" legend_constants[1] = "T in component membrane (kelvin)" legend_constants[2] = "F in component membrane (coulomb_per_millimole)" legend_constants[3] = "Cm in component membrane (picoF)" legend_algebraic[110] = "i_tot in component membrane (picoA)" legend_algebraic[94] = "i_I in component membrane (picoA)" legend_algebraic[49] = "i_Na in component sodium_current (picoA)" legend_algebraic[54] = "i_Ca_L in component L_type_Ca_channel (picoA)" legend_algebraic[58] = "i_Ca_T in component T_type_Ca_channel (picoA)" legend_algebraic[80] = "i_K1 in component time_independent_potassium_current (picoA)" legend_algebraic[81] = "i_Kr in component rapid_time_dependent_potassium_current (picoA)" legend_algebraic[65] = "i_st in component st_channel (picoA)" legend_algebraic[69] = "i_ha in component ha_channel (picoA)" legend_algebraic[82] = "i_KACh in component ACh_dependent_potassium_current (picoA)" legend_algebraic[108] = "i_NaK in component sodium_potassium_pump (picoA)" legend_algebraic[99] = "i_NaCa in component sodium_calcium_exchanger (picoA)" legend_algebraic[85] = "i_bNSC in component background_NSC_current (picoA)" legend_algebraic[93] = "i_Cab in component background_Cab_current (picoA)" legend_algebraic[86] = "i_Kpl in component background_Kpl_current (picoA)" legend_algebraic[90] = "i_lCa in component background_lCa_current (picoA)" legend_algebraic[92] = "i_KATP in component background_KATP_current (picoA)" legend_constants[4] = "Nao in component external_ion_concentrations (millimolar)" legend_constants[5] = "Cao in component external_ion_concentrations (millimolar)" legend_constants[6] = "Ko in component external_ion_concentrations (millimolar)" legend_states[1] = "Nai in component internal_ion_concentrations (millimolar)" legend_algebraic[27] = "Cai in component internal_ion_concentrations (millimolar)" legend_states[2] = "Ki in component internal_ion_concentrations (millimolar)" legend_constants[7] = "Vi in component internal_ion_concentrations (micrometre3)" legend_algebraic[111] = "i_net_Na in component internal_ion_concentrations (picoA)" legend_algebraic[112] = "i_net_K in component internal_ion_concentrations (picoA)" legend_algebraic[101] = "i_net_Ca in component internal_ion_concentrations (picoA)" legend_algebraic[44] = "i_Na_Na in component sodium_current (picoA)" legend_algebraic[52] = "i_CaL_Na in component L_type_Ca_channel (picoA)" legend_algebraic[60] = "i_st_Na in component st_channel (picoA)" legend_algebraic[67] = "i_ha_Na in component ha_channel (picoA)" legend_algebraic[84] = "i_bNSC_Na in component background_NSC_current (picoA)" legend_algebraic[89] = "i_lCa_Na in component background_lCa_current (picoA)" legend_algebraic[47] = "i_Na_K in component sodium_current (picoA)" legend_algebraic[53] = "i_CaL_K in component L_type_Ca_channel (picoA)" legend_algebraic[63] = "i_st_K in component st_channel (picoA)" legend_algebraic[68] = "i_ha_K in component ha_channel (picoA)" legend_algebraic[83] = "i_bNSC_K in component background_NSC_current (picoA)" legend_algebraic[88] = "i_lCa_K in component background_lCa_current (picoA)" legend_algebraic[51] = "i_CaL_Ca in component L_type_Ca_channel (picoA)" legend_algebraic[131] = "i_RyR in component RyR_channel (picoA)" legend_algebraic[120] = "i_SR_U in component SR_calcium_pump (picoA)" legend_algebraic[125] = "i_SR_L in component SR_L_current (picoA)" legend_algebraic[145] = "dCaidt in component NL_model (millimolar_per_millisecond)" legend_constants[8] = "CMDN_max in component internal_ion_concentrations (millimolar)" legend_constants[9] = "K_mCMDN in component internal_ion_concentrations (millimolar)" legend_states[3] = "Ca_Total in component internal_ion_concentrations (millimolar)" legend_algebraic[0] = "b1 in component internal_ion_concentrations (millimolar)" legend_algebraic[14] = "c1 in component internal_ion_concentrations (millimolar2)" legend_algebraic[31] = "CF_Na in component constant_field_equations (millimolar)" legend_algebraic[36] = "CF_Ca in component constant_field_equations (millimolar)" legend_algebraic[41] = "CF_K in component constant_field_equations (millimolar)" legend_states[4] = "ATPi in component ATP_production (millimolar)" legend_algebraic[122] = "dATPdt in component NL_model (millimolar_per_millisecond)" legend_constants[10] = "ProducingRate_Max in component ATP_production (per_millisecond)" legend_constants[11] = "Adenosine_Total in component ATP_production (millimolar)" legend_constants[12] = "P_Na in component sodium_current (picoA_per_millimolar)" legend_states[5] = "p_AP_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_states[6] = "y in component sodium_current_ultra_slow_gate (dimensionless)" legend_algebraic[1] = "p_RI_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_states[7] = "p_RP_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_states[8] = "p_AI_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_algebraic[15] = "k_RP_AP in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[28] = "k_AP_RP in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[42] = "k_RI_AI in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[37] = "k_AI_RI in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[32] = "k_AP_AI in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_constants[13] = "k_AI_AP in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[45] = "k_RP_RI in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[48] = "k_RI_RP in component sodium_current_voltage_dependent_gate (per_millisecond)" legend_algebraic[2] = "alpha_y in component sodium_current_ultra_slow_gate (per_millisecond)" legend_algebraic[16] = "beta_y in component sodium_current_ultra_slow_gate (per_millisecond)" legend_algebraic[50] = "p_open_CaL in component L_type_Ca_channel (dimensionless)" legend_algebraic[56] = "CaDiadic in component L_type_Ca_channel_Ca_dependent_gate (picoA)" legend_constants[14] = "P_CaL in component L_type_Ca_channel (picoA_per_millimolar)" legend_states[9] = "p_AP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_states[10] = "p_U in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_states[11] = "p_UCa in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_states[12] = "y in component L_type_Ca_channel_ultra_slow_gate (dimensionless)" legend_algebraic[3] = "p_RI_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_states[13] = "p_RP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_states[14] = "p_AI_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_algebraic[17] = "k_RP_AP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[29] = "k_AP_RP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[33] = "k_RI_AI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[38] = "k_AI_RI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_constants[15] = "k_AP_AI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_constants[16] = "k_AI_AP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[43] = "k_RP_RI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[46] = "k_RI_RP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[55] = "iCaL in component L_type_Ca_channel_Ca_dependent_gate (picoA)" legend_algebraic[57] = "Cacm in component L_type_Ca_channel_Ca_dependent_gate (millimolar)" legend_algebraic[66] = "p_CCa in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_states[15] = "p_C in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_constants[17] = "k_CCa_UCa in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_constants[18] = "k_UCa_CCa in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_constants[19] = "k_C_U in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_constants[20] = "k_U_C in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_constants[89] = "k_UCa_U in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_constants[21] = "k_U_UCa in component L_type_Ca_channel_Ca_dependent_gate (per_millimolar_millisecond)" legend_constants[22] = "k_CCa_C in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_constants[23] = "k_C_CCa in component L_type_Ca_channel_Ca_dependent_gate (per_millimolar_millisecond)" legend_algebraic[59] = "CaEffC in component L_type_Ca_channel_Ca_dependent_gate (millimolar)" legend_algebraic[61] = "CaEffU in component L_type_Ca_channel_Ca_dependent_gate (millimolar)" legend_algebraic[64] = "k_UUCa_Ca in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_algebraic[62] = "k_CCCa_Ca in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond)" legend_algebraic[4] = "alpha_y in component L_type_Ca_channel_ultra_slow_gate (per_millisecond)" legend_algebraic[18] = "beta_y in component L_type_Ca_channel_ultra_slow_gate (per_millisecond)" legend_constants[24] = "P_CaT in component T_type_Ca_channel (picoA_per_millimolar)" legend_states[16] = "y1 in component T_type_Ca_channel_y1_gate (dimensionless)" legend_states[17] = "y2 in component T_type_Ca_channel_y2_gate (dimensionless)" legend_algebraic[5] = "alpha_y1 in component T_type_Ca_channel_y1_gate (per_millisecond)" legend_algebraic[19] = "beta_y1 in component T_type_Ca_channel_y1_gate (per_millisecond)" legend_algebraic[6] = "alpha_y2 in component T_type_Ca_channel_y2_gate (per_millisecond)" legend_algebraic[20] = "beta_y2 in component T_type_Ca_channel_y2_gate (per_millisecond)" legend_states[18] = "y1 in component st_channel_y1_gate (dimensionless)" legend_states[19] = "y2 in component st_channel_y2_gate (dimensionless)" legend_states[20] = "y3 in component st_channel_y3_gate (dimensionless)" legend_constants[25] = "P_st_Na in component st_channel (picoA_per_millimolar)" legend_constants[26] = "P_st_K in component st_channel (picoA_per_millimolar)" legend_algebraic[7] = "alpha_y1 in component st_channel_y1_gate (per_millisecond)" legend_algebraic[21] = "beta_y1 in component st_channel_y1_gate (per_millisecond)" legend_algebraic[34] = "alpha_y2 in component st_channel_y2_gate (per_millisecond)" legend_algebraic[39] = "beta_y2 in component st_channel_y2_gate (per_millisecond)" legend_algebraic[8] = "alpha_y3 in component st_channel_y3_gate (per_millisecond)" legend_algebraic[22] = "beta_y3 in component st_channel_y3_gate (per_millisecond)" legend_states[21] = "C1 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_states[22] = "C2 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_constants[27] = "P_ha_Na in component ha_channel (picoA_per_millimolar)" legend_constants[28] = "P_ha_K in component ha_channel (picoA_per_millimolar)" legend_states[23] = "O1 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_states[24] = "O2 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_algebraic[9] = "O3 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_algebraic[23] = "alpha in component ha_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[30] = "beta in component ha_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[35] = "mu in component ha_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[40] = "lambda in component ha_channel_voltage_dependent_gate (per_millisecond)" legend_algebraic[70] = "E_K in component time_independent_potassium_current (millivolt)" legend_constants[90] = "g_K1 in component time_independent_potassium_current (nanoS)" legend_constants[29] = "P_K1_0 in component time_independent_potassium_current (nanoS_per_picoF)" legend_algebraic[74] = "fO in component time_independent_potassium_current (dimensionless)" legend_algebraic[75] = "fO2 in component time_independent_potassium_current (dimensionless)" legend_algebraic[77] = "fO3 in component time_independent_potassium_current (dimensionless)" legend_algebraic[79] = "fO4 in component time_independent_potassium_current (dimensionless)" legend_algebraic[73] = "fB in component time_independent_potassium_current (dimensionless)" legend_algebraic[71] = "mu in component time_independent_potassium_current (per_millisecond)" legend_algebraic[72] = "lambda in component time_independent_potassium_current (per_millisecond)" legend_states[25] = "y in component time_independent_potassium_current_y_gate (dimensionless)" legend_algebraic[76] = "alpha_y in component time_independent_potassium_current_y_gate (per_millisecond)" legend_algebraic[78] = "beta_y in component time_independent_potassium_current_y_gate (per_millisecond)" legend_constants[91] = "g_Kr in component rapid_time_dependent_potassium_current (nanoS)" legend_constants[30] = "P_Kr in component rapid_time_dependent_potassium_current (nanoS_per_picoF)" legend_states[26] = "y1 in component rapid_time_dependent_potassium_current_y1_gate (dimensionless)" legend_states[27] = "y2 in component rapid_time_dependent_potassium_current_y2_gate (dimensionless)" legend_states[28] = "y3 in component rapid_time_dependent_potassium_current_y3_gate (dimensionless)" legend_algebraic[10] = "alpha_y1 in component rapid_time_dependent_potassium_current_y1_gate (per_millisecond)" legend_algebraic[24] = "beta_y1 in component rapid_time_dependent_potassium_current_y1_gate (per_millisecond)" legend_algebraic[11] = "alpha_y2 in component rapid_time_dependent_potassium_current_y2_gate (per_millisecond)" legend_algebraic[25] = "beta_y2 in component rapid_time_dependent_potassium_current_y2_gate (per_millisecond)" legend_algebraic[12] = "alpha_y3 in component rapid_time_dependent_potassium_current_y3_gate (per_millisecond)" legend_algebraic[26] = "beta_y3 in component rapid_time_dependent_potassium_current_y3_gate (per_millisecond)" legend_states[29] = "y in component ACh_dependent_potassium_current_y_gate (dimensionless)" legend_constants[31] = "g_ACh in component ACh_dependent_potassium_current (nanoS)" legend_constants[92] = "alpha_y in component ACh_dependent_potassium_current_y_gate (per_millisecond)" legend_algebraic[13] = "beta_y in component ACh_dependent_potassium_current_y_gate (per_millisecond)" legend_constants[32] = "ACh in component ACh_dependent_potassium_current_y_gate (millimolar)" legend_constants[33] = "Km_ACh in component ACh_dependent_potassium_current_y_gate (millimolar)" legend_constants[34] = "P_bNSC in component background_NSC_current (picoA_per_millimolar)" legend_constants[93] = "P_Kpl in component background_Kpl_current (nanoS_per_millimolar)" legend_constants[35] = "P_lCa in component background_lCa_current (picoA_per_millimolar)" legend_algebraic[87] = "p_open in component background_lCa_current (dimensionless)" legend_algebraic[91] = "p_open in component background_KATP_current (dimensionless)" legend_constants[94] = "gamma in component background_KATP_current (nanoS)" legend_constants[36] = "P_KATP in component background_KATP_current (nanoS_per_picoF)" legend_constants[37] = "N in component background_KATP_current (picoF)" legend_constants[38] = "P_Cab in component background_Cab_current (picoA_per_millimolar)" legend_constants[95] = "p_E2Na in component sodium_calcium_exchanger (dimensionless)" legend_algebraic[95] = "p_E1Na in component sodium_calcium_exchanger (dimensionless)" legend_algebraic[96] = "p_E1Ca in component sodium_calcium_exchanger (dimensionless)" legend_constants[98] = "p_E2Ca in component sodium_calcium_exchanger (dimensionless)" legend_algebraic[97] = "k1 in component sodium_calcium_exchanger (per_millisecond)" legend_algebraic[98] = "k2 in component sodium_calcium_exchanger (per_millisecond)" legend_constants[39] = "k3 in component sodium_calcium_exchanger (per_millisecond)" legend_constants[40] = "k4 in component sodium_calcium_exchanger (per_millisecond)" legend_constants[41] = "Km_Nai in component sodium_calcium_exchanger (millimolar)" legend_constants[42] = "Km_Nao in component sodium_calcium_exchanger (millimolar)" legend_constants[43] = "Km_Cai in component sodium_calcium_exchanger (millimolar)" legend_constants[44] = "Km_Cao in component sodium_calcium_exchanger (millimolar)" legend_states[30] = "y in component sodium_calcium_exchanger_y_gate (dimensionless)" legend_constants[45] = "P_NaCa in component sodium_calcium_exchanger (picoA_per_picoF)" legend_constants[46] = "Partition in component sodium_calcium_exchanger (dimensionless)" legend_algebraic[100] = "alpha_y in component sodium_calcium_exchanger_y_gate (per_millisecond)" legend_algebraic[102] = "beta_y in component sodium_calcium_exchanger_y_gate (per_millisecond)" legend_algebraic[107] = "p_E2Na in component sodium_potassium_pump (dimensionless)" legend_algebraic[103] = "p_E1Na in component sodium_potassium_pump (dimensionless)" legend_algebraic[104] = "p_E1K in component sodium_potassium_pump (dimensionless)" legend_algebraic[109] = "p_E2K in component sodium_potassium_pump (dimensionless)" legend_algebraic[105] = "k1 in component sodium_potassium_pump (per_millisecond)" legend_constants[47] = "k2 in component sodium_potassium_pump (per_millisecond)" legend_constants[48] = "k3 in component sodium_potassium_pump (per_millisecond)" legend_constants[49] = "k4 in component sodium_potassium_pump (per_millisecond)" legend_constants[50] = "Km_Nai in component sodium_potassium_pump (millimolar)" legend_constants[51] = "Km_Nao in component sodium_potassium_pump (millimolar)" legend_constants[52] = "Km_Ki in component sodium_potassium_pump (millimolar)" legend_constants[53] = "Km_Ko in component sodium_potassium_pump (millimolar)" legend_constants[54] = "Km_ATP in component sodium_potassium_pump (millimolar)" legend_algebraic[106] = "Nao_Eff in component sodium_potassium_pump (millimolar)" legend_states[31] = "y in component sodium_potassium_pump_y_gate (dimensionless)" legend_constants[55] = "P_NaK in component sodium_potassium_pump (picoA_per_picoF)" legend_algebraic[114] = "alpha_y in component sodium_potassium_pump_y_gate (per_millisecond)" legend_algebraic[116] = "beta_y in component sodium_potassium_pump_y_gate (per_millisecond)" legend_algebraic[115] = "p_E2Ca in component SR_calcium_pump (dimensionless)" legend_algebraic[113] = "p_E1Ca in component SR_calcium_pump (dimensionless)" legend_algebraic[117] = "p_E1 in component SR_calcium_pump (dimensionless)" legend_algebraic[118] = "p_E2 in component SR_calcium_pump (dimensionless)" legend_constants[56] = "k1 in component SR_calcium_pump (per_millisecond)" legend_algebraic[119] = "k2 in component SR_calcium_pump (per_millisecond)" legend_constants[57] = "k3 in component SR_calcium_pump (per_millisecond)" legend_constants[58] = "k4 in component SR_calcium_pump (per_millisecond)" legend_constants[59] = "Km_CaSR in component SR_calcium_pump (millimolar)" legend_constants[60] = "Km_CaCyto in component SR_calcium_pump (millimolar)" legend_constants[61] = "Km_ATP in component SR_calcium_pump (millimolar)" legend_constants[62] = "i_max in component SR_calcium_pump (picoA)" legend_states[32] = "Caup in component Ca_concentrations_in_SR (millimolar)" legend_states[33] = "y in component SR_calcium_pump_y_gate (dimensionless)" legend_algebraic[121] = "alpha_y in component SR_calcium_pump_y_gate (per_millisecond)" legend_algebraic[123] = "beta_y in component SR_calcium_pump_y_gate (per_millisecond)" legend_constants[63] = "P_RyR in component RyR_channel (picoA_per_millimolar)" legend_algebraic[124] = "k1 in component RyR_channel (per_millisecond)" legend_algebraic[129] = "k2 in component RyR_channel (per_millisecond)" legend_algebraic[130] = "k3 in component RyR_channel (per_millisecond)" legend_constants[64] = "k4 in component RyR_channel (per_millisecond)" legend_states[34] = "p_open_RyR in component RyR_channel (dimensionless)" legend_states[35] = "p_close_RyR in component RyR_channel (dimensionless)" legend_algebraic[128] = "Carel in component Ca_concentrations_in_SR (millimolar)" legend_constants[65] = "Diadid_Factor in component RyR_channel (per_picoA_millisecond)" legend_algebraic[132] = "i_SR_T in component SR_T_current (picoA)" legend_constants[66] = "P_SR_T in component SR_T_current (picoA_per_millimolar)" legend_constants[67] = "P_SR_L in component SR_L_current (picoA_per_millimolar)" legend_states[36] = "Ca_Total in component Ca_concentrations_in_SR (millimolar)" legend_constants[68] = "V_rel in component Ca_concentrations_in_SR (micrometre3)" legend_constants[69] = "V_up in component Ca_concentrations_in_SR (micrometre3)" legend_constants[70] = "CSQN_max in component Ca_concentrations_in_SR (millimolar)" legend_constants[71] = "K_mCSQN in component Ca_concentrations_in_SR (millimolar)" legend_algebraic[126] = "b1 in component Ca_concentrations_in_SR (millimolar)" legend_algebraic[127] = "c1 in component Ca_concentrations_in_SR (millimolar2)" legend_constants[96] = "EffFraction in component NL_model (dimensionless)" legend_states[37] = "pCa in component NL_model (dimensionless)" legend_states[38] = "pCaCB in component NL_model (dimensionless)" legend_states[39] = "pCB in component NL_model (dimensionless)" legend_algebraic[135] = "p in component NL_model (dimensionless)" legend_constants[72] = "T_t in component NL_model (millimolar)" legend_algebraic[139] = "Q_a in component NL_model (per_millisecond)" legend_algebraic[137] = "Q_b in component NL_model (per_millisecond)" legend_algebraic[141] = "Q_r in component NL_model (per_millisecond)" legend_algebraic[142] = "Q_d in component NL_model (per_millisecond)" legend_algebraic[143] = "Q_d1 in component NL_model (per_millisecond)" legend_algebraic[144] = "Q_d2 in component NL_model (per_millisecond)" legend_constants[73] = "Y_1 in component NL_model (per_millimolar_millisecond)" legend_constants[74] = "Y_2 in component NL_model (per_millisecond)" legend_constants[75] = "Y_3 in component NL_model (per_millisecond)" legend_constants[76] = "Y_4 in component NL_model (per_millisecond)" legend_constants[77] = "Y_d in component NL_model (millisecond_per_micrometre2)" legend_constants[78] = "Z_1 in component NL_model (per_millisecond)" legend_constants[79] = "Z_2 in component NL_model (per_millisecond)" legend_constants[80] = "Z_3 in component NL_model (per_millimolar_millisecond)" legend_algebraic[133] = "h in component NL_model (micrometre)" legend_constants[81] = "L_a in component NL_model (micrometre)" legend_constants[82] = "L in component NL_model (micrometre)" legend_algebraic[138] = "ForceCB in component NL_model (mN_per_mm2)" legend_states[40] = "X in component NL_model (micrometre)" legend_algebraic[136] = "NewCBF in component NL_model (mN_per_mm2_micrometre)" legend_algebraic[134] = "CBBound in component NL_model (millimolar)" legend_constants[83] = "KForceEC in component NL_model (mN_per_mm2_micrometre5)" legend_constants[84] = "ZeroForceEL in component NL_model (micrometre)" legend_constants[85] = "KForceLinearEc in component NL_model (mN_per_mm2_micrometre)" legend_constants[86] = "ForceFactor in component NL_model (mN_per_mm2_micrometre_millimolar)" legend_constants[97] = "ForceEcomp in component NL_model (mN_per_mm2)" legend_constants[87] = "B in component NL_model (per_millisecond)" legend_constants[88] = "h_c in component NL_model (micrometre)" legend_algebraic[140] = "ForceExt in component NL_model (mN_per_mm2)" legend_rates[0] = "d/dt Vm in component membrane (millivolt)" legend_rates[1] = "d/dt Nai in component internal_ion_concentrations (millimolar)" legend_rates[2] = "d/dt Ki in component internal_ion_concentrations (millimolar)" legend_rates[3] = "d/dt Ca_Total in component internal_ion_concentrations (millimolar)" legend_rates[4] = "d/dt ATPi in component ATP_production (millimolar)" legend_rates[7] = "d/dt p_RP_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_rates[5] = "d/dt p_AP_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_rates[8] = "d/dt p_AI_Na in component sodium_current_voltage_dependent_gate (dimensionless)" legend_rates[6] = "d/dt y in component sodium_current_ultra_slow_gate (dimensionless)" legend_rates[13] = "d/dt p_RP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_rates[9] = "d/dt p_AP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_rates[14] = "d/dt p_AI_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless)" legend_rates[10] = "d/dt p_U in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_rates[11] = "d/dt p_UCa in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_rates[15] = "d/dt p_C in component L_type_Ca_channel_Ca_dependent_gate (dimensionless)" legend_rates[12] = "d/dt y in component L_type_Ca_channel_ultra_slow_gate (dimensionless)" legend_rates[16] = "d/dt y1 in component T_type_Ca_channel_y1_gate (dimensionless)" legend_rates[17] = "d/dt y2 in component T_type_Ca_channel_y2_gate (dimensionless)" legend_rates[18] = "d/dt y1 in component st_channel_y1_gate (dimensionless)" legend_rates[19] = "d/dt y2 in component st_channel_y2_gate (dimensionless)" legend_rates[20] = "d/dt y3 in component st_channel_y3_gate (dimensionless)" legend_rates[23] = "d/dt O1 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_rates[24] = "d/dt O2 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_rates[21] = "d/dt C1 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_rates[22] = "d/dt C2 in component ha_channel_voltage_dependent_gate (dimensionless)" legend_rates[25] = "d/dt y in component time_independent_potassium_current_y_gate (dimensionless)" legend_rates[26] = "d/dt y1 in component rapid_time_dependent_potassium_current_y1_gate (dimensionless)" legend_rates[27] = "d/dt y2 in component rapid_time_dependent_potassium_current_y2_gate (dimensionless)" legend_rates[28] = "d/dt y3 in component rapid_time_dependent_potassium_current_y3_gate (dimensionless)" legend_rates[29] = "d/dt y in component ACh_dependent_potassium_current_y_gate (dimensionless)" legend_rates[30] = "d/dt y in component sodium_calcium_exchanger_y_gate (dimensionless)" legend_rates[31] = "d/dt y in component sodium_potassium_pump_y_gate (dimensionless)" legend_rates[33] = "d/dt y in component SR_calcium_pump_y_gate (dimensionless)" legend_rates[34] = "d/dt p_open_RyR in component RyR_channel (dimensionless)" legend_rates[35] = "d/dt p_close_RyR in component RyR_channel (dimensionless)" legend_rates[36] = "d/dt Ca_Total in component Ca_concentrations_in_SR (millimolar)" legend_rates[32] = "d/dt Caup in component Ca_concentrations_in_SR (millimolar)" legend_rates[40] = "d/dt X in component NL_model (micrometre)" legend_rates[37] = "d/dt pCa in component NL_model (dimensionless)" legend_rates[38] = "d/dt pCaCB in component NL_model (dimensionless)" legend_rates[39] = "d/dt pCB in component NL_model (dimensionless)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; states[0] = -42.987671350068005 constants[0] = 8.3143 constants[1] = 310 constants[2] = 96.4867 constants[3] = 32 constants[4] = 139.99977217549068 constants[5] = 1.7999668787634697 constants[6] = 5.399964171929831 states[1] = 4.6808027298969925 states[2] = 139.22099524072777 constants[7] = 2513.25 constants[8] = 0.05 constants[9] = 0.00238 states[3] = 0.003834100516470642 states[4] = 4.929308214702568 constants[10] = 0.003 constants[11] = 5 constants[12] = 12 states[5] = 5.9898633533987405e-5 states[6] = 0.02691630436856424 states[7] = 2.2262336890623873e-4 states[8] = 0.9715915109181413 constants[13] = 8.75e-5 constants[14] = 2112 states[9] = 0.010773205742759775 states[10] = 0.018412749759150325 states[11] = 2.0870506374005444e-4 states[12] = 0.8256168329801671 states[13] = 0.42833044151885075 states[14] = 0.5607106503080197 constants[15] = 0.004 constants[16] = 0.001 states[15] = 0.05040310692927668 constants[17] = 0.0003 constants[18] = 0.35 constants[19] = 0.143 constants[20] = 0.35 constants[21] = 6.954 constants[22] = 0.0042 constants[23] = 6.954 constants[24] = 612 states[16] = 0.04679297803939428 states[17] = 0.004220636800632867 states[18] = 0.5375825176280309 states[19] = 0.3404904569858008 states[20] = 0.5596860236041188 constants[25] = 0.236 constants[26] = 0.138 states[21] = 0.9999616586460943 states[22] = 3.757612529902994e-5 constants[27] = 1.821 constants[28] = 7.7286 states[23] = 7.531035735927369e-7 states[24] = 1.1957124194086763e-8 constants[29] = 0.003125 states[25] = 0.54434573606543 constants[30] = 0.1045 states[26] = 0.7520936568166604 states[27] = 0.6128486629679218 states[28] = 0.6786243213825371 states[29] = 0.018249236601344903 constants[31] = 4.32 constants[32] = 0 constants[33] = 0.0042 constants[34] = 0.152 constants[35] = 0.44 constants[36] = 0.0236 constants[37] = 1000 constants[38] = 0.008 constants[39] = 1 constants[40] = 1 constants[41] = 8.75 constants[42] = 87.5 constants[43] = 0.00138 constants[44] = 1.38 states[30] = 0.9218642754061908 constants[45] = 6.81 constants[46] = 0.32 constants[47] = 0.04 constants[48] = 0.01 constants[49] = 0.165 constants[50] = 4.05 constants[51] = 69.8 constants[52] = 32.88 constants[53] = 0.258 constants[54] = 0.094 states[31] = 0.6755031143352256 constants[55] = 21 constants[56] = 0.01 constants[57] = 1 constants[58] = 0.01 constants[59] = 0.08 constants[60] = 0.0008 constants[61] = 0.1 constants[62] = 4875 states[32] = 3.539652240305415 states[33] = 0.8709732600283433 constants[63] = 1860 constants[64] = 0.000849 states[34] = 0.011424172905335395 states[35] = 0.007354039651246729 constants[65] = -3 constants[66] = 11.58 constants[67] = 13.77 states[36] = 5.185011336959393 constants[68] = 1.50795 constants[69] = 3.769875 constants[70] = 10 constants[71] = 0.8 states[37] = 0.24298053499618683 states[38] = 0.02896443650702234 states[39] = 0.0020275353474589783 constants[72] = 0.007 constants[73] = 39 constants[74] = 0.0039 constants[75] = 0.03 constants[76] = 0.12 constants[77] = 0.027 constants[78] = 0.03 constants[79] = 0.0039 constants[80] = 1560 constants[81] = 1.17 constants[82] = 0.9602399999150041 states[40] = 0.9552449999150041 constants[83] = 140000 constants[84] = 0.97 constants[85] = 200 constants[86] = 1800000 constants[87] = 1.2 constants[88] = 0.005 constants[89] = (constants[22]*constants[19]*constants[21]*constants[18])/(constants[20]*constants[23]*constants[17]) constants[90] = constants[29]*constants[3]*(power(constants[6]/5.40000, 0.400000)) constants[91] = constants[30]*constants[3]*(power(constants[6]/5.40000, 0.200000)) constants[92] = custom_piecewise([equal(constants[32] , 0.00000), 0.000247500 , True, 0.0123200/(1.00000+constants[33]/constants[32])+0.000247500]) constants[93] = 0.00700000*(power(constants[6]/5.40000, 0.160000)) constants[94] = constants[36]*constants[37]*(power(constants[6]/1.00000, 0.240000)) constants[95] = 1.00000/(1.00000+(power(constants[42]/constants[4], 3.00000))*(1.00000+constants[5]/constants[44])) constants[96] = exp(-20.0000*(power(constants[82]-constants[81], 2.00000))) constants[97] = constants[83]*(power(constants[84]-constants[82], 5.00000))+constants[85]*(constants[84]-constants[82]) constants[98] = 1.00000/(1.00000+(constants[44]/constants[5])*(1.00000+power(constants[4]/constants[42], 3.00000))) return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic algebraic[13] = 0.0100000*exp(0.0133000*(states[0]+40.0000)) rates[29] = constants[92]*(1.00000-states[29])-algebraic[13]*states[29] algebraic[2] = 1.00000/(9.00000e+09*exp(states[0]/5.00000)+8000.00*exp(states[0]/100.000)) algebraic[16] = 1.00000/(0.0140000*exp(-states[0]/5.00000)+4000.00*exp(-states[0]/100.000)) rates[6] = algebraic[2]*(1.00000-states[6])-algebraic[16]*states[6] algebraic[4] = 1.00000/(250000.*exp(states[0]/9.00000)+58.0000*exp(states[0]/65.0000)) algebraic[18] = 1.00000/(1800.00*exp(-states[0]/14.0000)+66.0000*exp(-states[0]/65.0000)) rates[12] = algebraic[4]*(1.00000-states[12])-algebraic[18]*states[12] algebraic[5] = 1.00000/(0.0190000*exp(-states[0]/5.60000)+0.820000*exp(-states[0]/250.000)) algebraic[19] = 1.00000/(40.0000*exp(states[0]/6.30000)+1.50000*exp(states[0]/10000.0)) rates[16] = algebraic[5]*(1.00000-states[16])-algebraic[19]*states[16] algebraic[6] = 1.00000/(62000.0*exp(states[0]/10.1000)+30.0000*exp(states[0]/3000.00)) algebraic[20] = 1.00000/(0.000600000*exp(-states[0]/6.70000)+1.20000*exp(-states[0]/25.0000)) rates[17] = algebraic[6]*(1.00000-states[17])-algebraic[20]*states[17] algebraic[7] = 1.00000/(0.150000*exp(-states[0]/11.0000)+0.200000*exp(-states[0]/700.000)) algebraic[21] = 1.00000/(16.0000*exp(states[0]/8.00000)+15.0000*exp(states[0]/50.0000)) rates[18] = algebraic[7]*(1.00000-states[18])-algebraic[21]*states[18] algebraic[8] = 1.00000/(400000.*exp(states[0]/9.00000)+60.0000*exp(states[0]/65.0000)) algebraic[22] = 1.00000/(700.000*exp(-states[0]/14.0000)+60.0000*exp(-states[0]/65.0000)) rates[20] = algebraic[8]*(1.00000-states[20])-algebraic[22]*states[20] algebraic[10] = 1.00000/(20.0000*exp(-states[0]/11.5000)+5.00000*exp(-states[0]/300.000)) algebraic[24] = 1.00000/(160.000*exp(states[0]/28.0000)+200.000*exp(states[0]/1000.00))+1.00000/(2500.00*exp(states[0]/20.0000)) rates[26] = algebraic[10]*(1.00000-states[26])-algebraic[24]*states[26] algebraic[11] = 1.00000/(200.000*exp(-states[0]/13.0000)+20.0000*exp(-states[0]/300.000)) algebraic[25] = 1.00000/(1600.00*exp(states[0]/28.0000)+2000.00*exp(states[0]/1000.00))+1.00000/(10000.0*exp(states[0]/20.0000)) rates[27] = algebraic[11]*(1.00000-states[27])-algebraic[25]*states[27] algebraic[12] = 1.00000/(10.0000*exp(states[0]/17.0000)+2.50000*exp(states[0]/300.000)) algebraic[26] = 1.00000/(0.350000*exp(-states[0]/17.0000)+2.00000*exp(-states[0]/150.000)) rates[28] = algebraic[12]*(1.00000-states[28])-algebraic[26]*states[28] algebraic[17] = 1.00000/(0.270000*exp(-states[0]/5.90000)+1.50000*exp(-states[0]/65.0000)) algebraic[29] = 1.00000/(480.000*exp(states[0]/7.00000)+2.20000*exp(states[0]/65.0000)) rates[9] = (states[13]*algebraic[17]+states[14]*constants[16])-states[9]*(algebraic[29]+constants[15]) algebraic[23] = 1.00000/(3500.00*exp(states[0]/16.8000)+0.300000*exp(states[0]/400.000)) algebraic[30] = 1.00000/(4.00000*exp(-states[0]/14.0000)+2.00000*exp(-states[0]/400.000)) rates[23] = (algebraic[23]*states[22]+algebraic[30]*states[24])-(algebraic[23]+algebraic[30])*states[23] algebraic[9] = (((1.00000-states[21])-states[22])-states[23])-states[24] rates[24] = (algebraic[23]*states[23]+algebraic[30]*algebraic[9])-(algebraic[23]+algebraic[30])*states[24] algebraic[15] = 1.00000/(0.102700*exp(-states[0]/8.00000)+0.250000*exp(-states[0]/50.0000)) algebraic[28] = 1.00000/(26.0000*exp(states[0]/17.0000)+0.0200000*exp(states[0]/800.000)) algebraic[32] = 1.00000/(0.800000*exp(-states[0]/400.000)) rates[5] = (states[7]*algebraic[15]+states[8]*constants[13])-states[5]*(algebraic[28]+algebraic[32]) algebraic[3] = ((1.00000-states[9])-states[13])-states[14] algebraic[33] = 1.00000/(0.00180000*exp(-states[0]/7.40000)+2.00000*exp(-states[0]/100.000)) algebraic[38] = 1.00000/(2.20000e+06*exp(states[0]/7.40000)+11.0000*exp(states[0]/100.000)) rates[14] = (algebraic[3]*algebraic[33]+states[9]*constants[15])-states[14]*(algebraic[38]+constants[16]) algebraic[34] = 1.00000/(3100.00*exp(states[0]/13.0000)+700.000*exp(states[0]/70.0000)) algebraic[0] = (constants[8]-states[3])+constants[9] algebraic[14] = constants[9]*states[3] algebraic[27] = (power(power(algebraic[0], 2.00000)+4.00000*algebraic[14], 1.0/2)-algebraic[0])/2.00000 algebraic[39] = 1.00000/(95.0000*exp(-states[0]/10.0000)+50.0000*exp(-states[0]/700.000))+(algebraic[27]*2.50000)/(1.00000+exp(-states[0]/5.00000)) rates[19] = algebraic[34]*(1.00000-states[19])-algebraic[39]*states[19] algebraic[35] = 1.00000/(4.50000e+07*exp(states[0]/8.00000)+500.000*exp(states[0]/200.000)) algebraic[40] = 1.00000/(10.5000*exp(-states[0]/16.4000)+0.400000*exp(-states[0]/400.000)) rates[21] = algebraic[40]*states[22]-algebraic[35]*states[21] rates[22] = (algebraic[35]*states[21]+algebraic[30]*states[23])-(algebraic[23]+algebraic[40])*states[22] algebraic[1] = ((1.00000-states[7])-states[5])-states[8] algebraic[42] = 1.00000/(0.000102700*exp(-states[0]/8.00000)+5.00000*exp(-states[0]/400.000)) algebraic[37] = 1.00000/(1300.00*exp(states[0]/20.0000)+0.0400000*exp(states[0]/800.000)) rates[8] = (algebraic[1]*algebraic[42]+states[5]*algebraic[32])-states[8]*(algebraic[37]+constants[13]) algebraic[43] = 0.0400000/(1.00000+(constants[16]*algebraic[29]*algebraic[33])/(constants[15]*algebraic[17]*algebraic[38])) algebraic[46] = 0.0400000-algebraic[43] rates[13] = (states[9]*algebraic[29]+algebraic[3]*algebraic[46])-states[13]*(algebraic[43]+algebraic[17]) algebraic[45] = 0.0100000/(1.00000+(constants[13]*algebraic[28]*algebraic[42])/(algebraic[32]*algebraic[15]*algebraic[37])) algebraic[48] = 0.0100000-algebraic[45] rates[7] = (states[5]*algebraic[28]+algebraic[1]*algebraic[48])-states[7]*(algebraic[45]+algebraic[15]) algebraic[36] = custom_piecewise([equal(states[0] , 0.00000), -constants[5] , True, (((2.00000*constants[2]*states[0])/(constants[0]*constants[1]))*(algebraic[27]-constants[5]*exp((-2.00000*constants[2]*states[0])/(constants[0]*constants[1]))))/(1.00000-exp((-2.00000*constants[2]*states[0])/(constants[0]*constants[1])))]) algebraic[55] = 0.0676000*algebraic[36] algebraic[57] = algebraic[27]-0.300000*algebraic[55] algebraic[59] = algebraic[57]*states[9] algebraic[61] = algebraic[59]+algebraic[27]*(1.00000-states[9]) algebraic[64] = constants[21]*algebraic[61] rates[10] = (states[15]*constants[19]+states[11]*constants[89])-states[10]*(algebraic[64]+constants[20]) algebraic[66] = ((1.00000-states[15])-states[10])-states[11] rates[11] = (states[10]*algebraic[64]+algebraic[66]*constants[17])-states[11]*(constants[18]+constants[89]) rates[15] = (algebraic[66]*constants[22]+states[10]*constants[20])-states[15]*(constants[19]+constants[23]*algebraic[57]*states[9]) algebraic[70] = ((constants[0]*constants[1])/constants[2])*log(constants[6]/states[2]) algebraic[76] = 1.00000/(8000.00*exp(((states[0]-algebraic[70])-97.0000)/8.50000)+7.00000*exp(((states[0]-algebraic[70])-97.0000)/300.000)) algebraic[71] = (0.750000*exp(0.0350000*((states[0]-algebraic[70])-10.0000)))/(1.00000+exp(0.0150000*((states[0]-algebraic[70])-140.000))) algebraic[72] = (3.00000*exp(-0.0480000*((states[0]-algebraic[70])-10.0000))*(1.00000+exp(0.0640000*((states[0]-algebraic[70])-38.0000))))/(1.00000+exp(0.0300000*((states[0]-algebraic[70])-70.0000))) algebraic[74] = algebraic[72]/(algebraic[71]+algebraic[72]) algebraic[78] = ((power(algebraic[74], 4.00000))*1.00000)/(0.000140000*exp(-((states[0]-algebraic[70])-97.0000)/9.10000)+0.200000*exp(-((states[0]-algebraic[70])-97.0000)/500.000)) rates[25] = algebraic[76]*(1.00000-states[25])-algebraic[78]*states[25] algebraic[98] = 1.00000*exp(((constants[46]-1.00000)*constants[2]*states[0])/(constants[0]*constants[1])) algebraic[100] = algebraic[98]*constants[95]+constants[40]*constants[98] algebraic[95] = 1.00000/(1.00000+(power(constants[41]/states[1], 3.00000))*(1.00000+algebraic[27]/constants[43])) algebraic[96] = 1.00000/(1.00000+(constants[43]/algebraic[27])*(1.00000+power(states[1]/constants[41], 3.00000))) algebraic[97] = 1.00000*exp((constants[46]*constants[2]*states[0])/(constants[0]*constants[1])) algebraic[102] = algebraic[97]*algebraic[95]+constants[39]*algebraic[96] rates[30] = algebraic[100]*(1.00000-states[30])-algebraic[102]*states[30] algebraic[31] = custom_piecewise([equal(states[0] , 0.00000), -constants[4] , True, (((constants[2]*states[0])/(constants[0]*constants[1]))*(states[1]-constants[4]*exp((-constants[2]*states[0])/(constants[0]*constants[1]))))/(1.00000-exp((-constants[2]*states[0])/(constants[0]*constants[1])))]) algebraic[84] = constants[34]*algebraic[31] algebraic[41] = custom_piecewise([equal(states[0] , 0.00000), states[2] , True, (((constants[2]*states[0])/(constants[0]*constants[1]))*(states[2]-constants[6]*exp((-constants[2]*states[0])/(constants[0]*constants[1]))))/(1.00000-exp((-constants[2]*states[0])/(constants[0]*constants[1])))]) algebraic[83] = 0.400000*constants[34]*algebraic[41] algebraic[85] = algebraic[83]+algebraic[84] algebraic[93] = constants[38]*algebraic[36] algebraic[86] = custom_piecewise([equal(states[0] , -3.00000), constants[93]*algebraic[41]*13.0077 , True, (constants[93]*algebraic[41]*(states[0]+3.00000))/(1.00000-exp(-(states[0]+3.00000)/13.0000))]) algebraic[87] = 1.00000/(1.00000+power(0.00120000/algebraic[27], 3.00000)) algebraic[89] = constants[35]*algebraic[31]*algebraic[87] algebraic[88] = constants[35]*algebraic[41]*algebraic[87] algebraic[90] = algebraic[88]+algebraic[89] algebraic[91] = 0.800000/(1.00000+power(states[4]/0.100000, 2.00000)) algebraic[92] = constants[94]*(states[0]-algebraic[70])*algebraic[91] algebraic[94] = algebraic[85]+algebraic[93]+algebraic[86]+algebraic[90]+algebraic[92] algebraic[44] = constants[12]*algebraic[31]*states[5]*states[6] algebraic[47] = 0.100000*constants[12]*algebraic[41]*states[5]*states[6] algebraic[49] = algebraic[44]+algebraic[47] algebraic[50] = (states[9]*(states[10]+states[11])*states[12])/(1.00000+power(1.40000/states[4], 3.00000)) algebraic[52] = 1.85000e-05*constants[14]*algebraic[31]*algebraic[50] algebraic[53] = 0.000365000*constants[14]*algebraic[41]*algebraic[50] algebraic[51] = constants[14]*algebraic[36]*algebraic[50] algebraic[54] = algebraic[52]+algebraic[51]+algebraic[53] algebraic[58] = constants[24]*algebraic[36]*states[16]*states[17] algebraic[73] = algebraic[71]/(algebraic[71]+algebraic[72]) algebraic[75] = 2.00000*(power(algebraic[74], 2.00000))*(power(algebraic[73], 2.00000)) algebraic[77] = (8.00000/3.00000)*(power(algebraic[74], 3.00000))*algebraic[73] algebraic[79] = power(algebraic[74], 4.00000) algebraic[80] = constants[90]*(states[0]-algebraic[70])*(algebraic[79]+algebraic[77]+algebraic[75])*states[25] algebraic[81] = constants[91]*(states[0]-algebraic[70])*(0.600000*states[26]+0.400000*states[27])*states[28] algebraic[60] = constants[25]*algebraic[31]*states[18]*states[19]*states[20] algebraic[63] = constants[26]*algebraic[41]*states[18]*states[19]*states[20] algebraic[65] = algebraic[60]+algebraic[63] algebraic[67] = constants[27]*algebraic[31]*((1.00000-states[21])-states[22]) algebraic[68] = constants[28]*algebraic[41]*((1.00000-states[21])-states[22]) algebraic[69] = algebraic[67]+algebraic[68] algebraic[82] = ((constants[31]*(states[0]-algebraic[70]))/(1.00000+exp((states[0]+20.0000)/20.0000)))*states[29] algebraic[106] = constants[4]*exp((-0.820000*constants[2]*states[0])/(constants[0]*constants[1])) algebraic[107] = 1.00000/(1.00000+(power(constants[51]/algebraic[106], 1.06000))*(1.00000+power(constants[6]/constants[53], 1.12000))) algebraic[103] = 1.00000/(1.00000+(power(constants[50]/states[1], 1.06000))*(1.00000+power(states[2]/constants[52], 1.12000))) algebraic[105] = 0.370000/(1.00000+constants[54]/states[4]) algebraic[108] = constants[55]*constants[3]*1.00000*(algebraic[105]*algebraic[103]*states[31]-constants[47]*algebraic[107]*(1.00000-states[31])) algebraic[99] = constants[45]*constants[3]*1.00000*(algebraic[97]*algebraic[95]*states[30]-algebraic[98]*constants[95]*(1.00000-states[30])) algebraic[110] = algebraic[49]+algebraic[54]+algebraic[58]+algebraic[80]+algebraic[81]+algebraic[94]+algebraic[108]+algebraic[99]+algebraic[65]+algebraic[69]+algebraic[82] rates[0] = -algebraic[110]/constants[3] algebraic[111] = algebraic[44]+algebraic[52]+algebraic[60]+algebraic[67]+algebraic[84]+algebraic[89]+3.00000*algebraic[108]+3.00000*algebraic[99] rates[1] = -algebraic[111]/(constants[2]*constants[7]) algebraic[112] = (algebraic[80]+algebraic[81]+algebraic[92]+algebraic[82]+algebraic[47]+algebraic[53]+algebraic[63]+algebraic[68]+algebraic[83]+algebraic[88]+algebraic[86])-2.00000*algebraic[108] rates[2] = -algebraic[112]/(constants[2]*constants[7]) algebraic[109] = 1.00000/(1.00000+(power(constants[53]/constants[6], 1.12000))*(1.00000+power(algebraic[106]/constants[51], 1.06000))) algebraic[114] = constants[47]*algebraic[107]+constants[49]*algebraic[109] algebraic[104] = 1.00000/(1.00000+(power(constants[52]/states[2], 1.12000))*(1.00000+power(states[1]/constants[50], 1.06000))) algebraic[116] = algebraic[105]*algebraic[103]+constants[48]*algebraic[104] rates[31] = algebraic[114]*(1.00000-states[31])-algebraic[116]*states[31] algebraic[115] = 1.00000/(1.00000+constants[60]/algebraic[27]) algebraic[113] = 1.00000/(1.00000+constants[59]/states[32]) algebraic[119] = 1.00000/(1.00000+constants[61]/states[4]) algebraic[120] = constants[62]*1.00000*(constants[56]*algebraic[113]*states[33]-algebraic[119]*algebraic[115]*(1.00000-states[33])) algebraic[122] = -0.400000*states[38]*constants[72] rates[4] = ((constants[10]*(constants[11]-states[4])+algebraic[122])-algebraic[108]/(constants[2]*constants[7]))+algebraic[120]/(4.00000*constants[2]*constants[7]) algebraic[118] = 1.00000-algebraic[115] algebraic[121] = algebraic[119]*algebraic[115]+constants[58]*algebraic[118] algebraic[117] = 1.00000-algebraic[113] algebraic[123] = constants[56]*algebraic[113]+constants[57]*algebraic[117] rates[33] = algebraic[121]*(1.00000-states[33])-algebraic[123]*states[33] algebraic[56] = algebraic[55]*algebraic[50] algebraic[124] = 280000.*(power(algebraic[27]/1.00000, 2.00000))+constants[65]*algebraic[56] algebraic[126] = (constants[70]-states[36])+constants[71] algebraic[127] = constants[71]*states[36] algebraic[128] = (power(power(algebraic[126], 2.00000)+4.00000*algebraic[127], 1.0/2)-algebraic[126])/2.00000 algebraic[129] = 0.0800000/(1.00000+0.360000/algebraic[128]) rates[34] = states[35]*algebraic[124]-states[34]*algebraic[129] algebraic[130] = 0.000377000*(power(algebraic[128]/1.00000, 2.00000)) rates[35] = algebraic[130]*(1.00000-(states[34]+states[35]))-(algebraic[124]+constants[64])*states[35] algebraic[131] = constants[63]*(algebraic[128]-algebraic[27])*states[34] algebraic[132] = constants[66]*(states[32]-algebraic[128]) rates[36] = (algebraic[132]-algebraic[131])/(2.00000*constants[2]*constants[68]) algebraic[125] = constants[67]*(states[32]-algebraic[27]) rates[32] = ((-algebraic[120]-algebraic[132])-algebraic[125])/(2.00000*constants[2]*constants[69]) algebraic[139] = constants[74]*states[37]*constants[96]-constants[79]*states[38] algebraic[135] = ((1.00000-states[37])-states[38])-states[39] algebraic[137] = constants[73]*algebraic[27]*algebraic[135]-constants[78]*states[37] rates[37] = algebraic[137]-algebraic[139] algebraic[133] = constants[82]-states[40] rates[40] = constants[87]*(algebraic[133]-constants[88]) algebraic[141] = constants[75]*states[38]-constants[80]*states[39]*algebraic[27] algebraic[144] = constants[77]*(power(rates[40], 2.00000))*states[38] rates[38] = (algebraic[139]-algebraic[141])-algebraic[144] algebraic[142] = constants[76]*states[39] algebraic[143] = constants[77]*(power(rates[40], 2.00000))*states[39] rates[39] = (algebraic[141]-algebraic[142])-algebraic[143] algebraic[101] = (algebraic[51]+algebraic[58]+algebraic[93])-2.00000*algebraic[99] algebraic[145] = constants[72]*((algebraic[144]+algebraic[141])-algebraic[137]) rates[3] = -(((algebraic[101]-algebraic[120])-algebraic[131])-algebraic[125])/(2.00000*constants[2]*constants[7])+algebraic[145] return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[13] = 0.0100000*exp(0.0133000*(states[0]+40.0000)) algebraic[2] = 1.00000/(9.00000e+09*exp(states[0]/5.00000)+8000.00*exp(states[0]/100.000)) algebraic[16] = 1.00000/(0.0140000*exp(-states[0]/5.00000)+4000.00*exp(-states[0]/100.000)) algebraic[4] = 1.00000/(250000.*exp(states[0]/9.00000)+58.0000*exp(states[0]/65.0000)) algebraic[18] = 1.00000/(1800.00*exp(-states[0]/14.0000)+66.0000*exp(-states[0]/65.0000)) algebraic[5] = 1.00000/(0.0190000*exp(-states[0]/5.60000)+0.820000*exp(-states[0]/250.000)) algebraic[19] = 1.00000/(40.0000*exp(states[0]/6.30000)+1.50000*exp(states[0]/10000.0)) algebraic[6] = 1.00000/(62000.0*exp(states[0]/10.1000)+30.0000*exp(states[0]/3000.00)) algebraic[20] = 1.00000/(0.000600000*exp(-states[0]/6.70000)+1.20000*exp(-states[0]/25.0000)) algebraic[7] = 1.00000/(0.150000*exp(-states[0]/11.0000)+0.200000*exp(-states[0]/700.000)) algebraic[21] = 1.00000/(16.0000*exp(states[0]/8.00000)+15.0000*exp(states[0]/50.0000)) algebraic[8] = 1.00000/(400000.*exp(states[0]/9.00000)+60.0000*exp(states[0]/65.0000)) algebraic[22] = 1.00000/(700.000*exp(-states[0]/14.0000)+60.0000*exp(-states[0]/65.0000)) algebraic[10] = 1.00000/(20.0000*exp(-states[0]/11.5000)+5.00000*exp(-states[0]/300.000)) algebraic[24] = 1.00000/(160.000*exp(states[0]/28.0000)+200.000*exp(states[0]/1000.00))+1.00000/(2500.00*exp(states[0]/20.0000)) algebraic[11] = 1.00000/(200.000*exp(-states[0]/13.0000)+20.0000*exp(-states[0]/300.000)) algebraic[25] = 1.00000/(1600.00*exp(states[0]/28.0000)+2000.00*exp(states[0]/1000.00))+1.00000/(10000.0*exp(states[0]/20.0000)) algebraic[12] = 1.00000/(10.0000*exp(states[0]/17.0000)+2.50000*exp(states[0]/300.000)) algebraic[26] = 1.00000/(0.350000*exp(-states[0]/17.0000)+2.00000*exp(-states[0]/150.000)) algebraic[17] = 1.00000/(0.270000*exp(-states[0]/5.90000)+1.50000*exp(-states[0]/65.0000)) algebraic[29] = 1.00000/(480.000*exp(states[0]/7.00000)+2.20000*exp(states[0]/65.0000)) algebraic[23] = 1.00000/(3500.00*exp(states[0]/16.8000)+0.300000*exp(states[0]/400.000)) algebraic[30] = 1.00000/(4.00000*exp(-states[0]/14.0000)+2.00000*exp(-states[0]/400.000)) algebraic[9] = (((1.00000-states[21])-states[22])-states[23])-states[24] algebraic[15] = 1.00000/(0.102700*exp(-states[0]/8.00000)+0.250000*exp(-states[0]/50.0000)) algebraic[28] = 1.00000/(26.0000*exp(states[0]/17.0000)+0.0200000*exp(states[0]/800.000)) algebraic[32] = 1.00000/(0.800000*exp(-states[0]/400.000)) algebraic[3] = ((1.00000-states[9])-states[13])-states[14] algebraic[33] = 1.00000/(0.00180000*exp(-states[0]/7.40000)+2.00000*exp(-states[0]/100.000)) algebraic[38] = 1.00000/(2.20000e+06*exp(states[0]/7.40000)+11.0000*exp(states[0]/100.000)) algebraic[34] = 1.00000/(3100.00*exp(states[0]/13.0000)+700.000*exp(states[0]/70.0000)) algebraic[0] = (constants[8]-states[3])+constants[9] algebraic[14] = constants[9]*states[3] algebraic[27] = (power(power(algebraic[0], 2.00000)+4.00000*algebraic[14], 1.0/2)-algebraic[0])/2.00000 algebraic[39] = 1.00000/(95.0000*exp(-states[0]/10.0000)+50.0000*exp(-states[0]/700.000))+(algebraic[27]*2.50000)/(1.00000+exp(-states[0]/5.00000)) algebraic[35] = 1.00000/(4.50000e+07*exp(states[0]/8.00000)+500.000*exp(states[0]/200.000)) algebraic[40] = 1.00000/(10.5000*exp(-states[0]/16.4000)+0.400000*exp(-states[0]/400.000)) algebraic[1] = ((1.00000-states[7])-states[5])-states[8] algebraic[42] = 1.00000/(0.000102700*exp(-states[0]/8.00000)+5.00000*exp(-states[0]/400.000)) algebraic[37] = 1.00000/(1300.00*exp(states[0]/20.0000)+0.0400000*exp(states[0]/800.000)) algebraic[43] = 0.0400000/(1.00000+(constants[16]*algebraic[29]*algebraic[33])/(constants[15]*algebraic[17]*algebraic[38])) algebraic[46] = 0.0400000-algebraic[43] algebraic[45] = 0.0100000/(1.00000+(constants[13]*algebraic[28]*algebraic[42])/(algebraic[32]*algebraic[15]*algebraic[37])) algebraic[48] = 0.0100000-algebraic[45] algebraic[36] = custom_piecewise([equal(states[0] , 0.00000), -constants[5] , True, (((2.00000*constants[2]*states[0])/(constants[0]*constants[1]))*(algebraic[27]-constants[5]*exp((-2.00000*constants[2]*states[0])/(constants[0]*constants[1]))))/(1.00000-exp((-2.00000*constants[2]*states[0])/(constants[0]*constants[1])))]) algebraic[55] = 0.0676000*algebraic[36] algebraic[57] = algebraic[27]-0.300000*algebraic[55] algebraic[59] = algebraic[57]*states[9] algebraic[61] = algebraic[59]+algebraic[27]*(1.00000-states[9]) algebraic[64] = constants[21]*algebraic[61] algebraic[66] = ((1.00000-states[15])-states[10])-states[11] algebraic[70] = ((constants[0]*constants[1])/constants[2])*log(constants[6]/states[2]) algebraic[76] = 1.00000/(8000.00*exp(((states[0]-algebraic[70])-97.0000)/8.50000)+7.00000*exp(((states[0]-algebraic[70])-97.0000)/300.000)) algebraic[71] = (0.750000*exp(0.0350000*((states[0]-algebraic[70])-10.0000)))/(1.00000+exp(0.0150000*((states[0]-algebraic[70])-140.000))) algebraic[72] = (3.00000*exp(-0.0480000*((states[0]-algebraic[70])-10.0000))*(1.00000+exp(0.0640000*((states[0]-algebraic[70])-38.0000))))/(1.00000+exp(0.0300000*((states[0]-algebraic[70])-70.0000))) algebraic[74] = algebraic[72]/(algebraic[71]+algebraic[72]) algebraic[78] = ((power(algebraic[74], 4.00000))*1.00000)/(0.000140000*exp(-((states[0]-algebraic[70])-97.0000)/9.10000)+0.200000*exp(-((states[0]-algebraic[70])-97.0000)/500.000)) algebraic[98] = 1.00000*exp(((constants[46]-1.00000)*constants[2]*states[0])/(constants[0]*constants[1])) algebraic[100] = algebraic[98]*constants[95]+constants[40]*constants[98] algebraic[95] = 1.00000/(1.00000+(power(constants[41]/states[1], 3.00000))*(1.00000+algebraic[27]/constants[43])) algebraic[96] = 1.00000/(1.00000+(constants[43]/algebraic[27])*(1.00000+power(states[1]/constants[41], 3.00000))) algebraic[97] = 1.00000*exp((constants[46]*constants[2]*states[0])/(constants[0]*constants[1])) algebraic[102] = algebraic[97]*algebraic[95]+constants[39]*algebraic[96] algebraic[31] = custom_piecewise([equal(states[0] , 0.00000), -constants[4] , True, (((constants[2]*states[0])/(constants[0]*constants[1]))*(states[1]-constants[4]*exp((-constants[2]*states[0])/(constants[0]*constants[1]))))/(1.00000-exp((-constants[2]*states[0])/(constants[0]*constants[1])))]) algebraic[84] = constants[34]*algebraic[31] algebraic[41] = custom_piecewise([equal(states[0] , 0.00000), states[2] , True, (((constants[2]*states[0])/(constants[0]*constants[1]))*(states[2]-constants[6]*exp((-constants[2]*states[0])/(constants[0]*constants[1]))))/(1.00000-exp((-constants[2]*states[0])/(constants[0]*constants[1])))]) algebraic[83] = 0.400000*constants[34]*algebraic[41] algebraic[85] = algebraic[83]+algebraic[84] algebraic[93] = constants[38]*algebraic[36] algebraic[86] = custom_piecewise([equal(states[0] , -3.00000), constants[93]*algebraic[41]*13.0077 , True, (constants[93]*algebraic[41]*(states[0]+3.00000))/(1.00000-exp(-(states[0]+3.00000)/13.0000))]) algebraic[87] = 1.00000/(1.00000+power(0.00120000/algebraic[27], 3.00000)) algebraic[89] = constants[35]*algebraic[31]*algebraic[87] algebraic[88] = constants[35]*algebraic[41]*algebraic[87] algebraic[90] = algebraic[88]+algebraic[89] algebraic[91] = 0.800000/(1.00000+power(states[4]/0.100000, 2.00000)) algebraic[92] = constants[94]*(states[0]-algebraic[70])*algebraic[91] algebraic[94] = algebraic[85]+algebraic[93]+algebraic[86]+algebraic[90]+algebraic[92] algebraic[44] = constants[12]*algebraic[31]*states[5]*states[6] algebraic[47] = 0.100000*constants[12]*algebraic[41]*states[5]*states[6] algebraic[49] = algebraic[44]+algebraic[47] algebraic[50] = (states[9]*(states[10]+states[11])*states[12])/(1.00000+power(1.40000/states[4], 3.00000)) algebraic[52] = 1.85000e-05*constants[14]*algebraic[31]*algebraic[50] algebraic[53] = 0.000365000*constants[14]*algebraic[41]*algebraic[50] algebraic[51] = constants[14]*algebraic[36]*algebraic[50] algebraic[54] = algebraic[52]+algebraic[51]+algebraic[53] algebraic[58] = constants[24]*algebraic[36]*states[16]*states[17] algebraic[73] = algebraic[71]/(algebraic[71]+algebraic[72]) algebraic[75] = 2.00000*(power(algebraic[74], 2.00000))*(power(algebraic[73], 2.00000)) algebraic[77] = (8.00000/3.00000)*(power(algebraic[74], 3.00000))*algebraic[73] algebraic[79] = power(algebraic[74], 4.00000) algebraic[80] = constants[90]*(states[0]-algebraic[70])*(algebraic[79]+algebraic[77]+algebraic[75])*states[25] algebraic[81] = constants[91]*(states[0]-algebraic[70])*(0.600000*states[26]+0.400000*states[27])*states[28] algebraic[60] = constants[25]*algebraic[31]*states[18]*states[19]*states[20] algebraic[63] = constants[26]*algebraic[41]*states[18]*states[19]*states[20] algebraic[65] = algebraic[60]+algebraic[63] algebraic[67] = constants[27]*algebraic[31]*((1.00000-states[21])-states[22]) algebraic[68] = constants[28]*algebraic[41]*((1.00000-states[21])-states[22]) algebraic[69] = algebraic[67]+algebraic[68] algebraic[82] = ((constants[31]*(states[0]-algebraic[70]))/(1.00000+exp((states[0]+20.0000)/20.0000)))*states[29] algebraic[106] = constants[4]*exp((-0.820000*constants[2]*states[0])/(constants[0]*constants[1])) algebraic[107] = 1.00000/(1.00000+(power(constants[51]/algebraic[106], 1.06000))*(1.00000+power(constants[6]/constants[53], 1.12000))) algebraic[103] = 1.00000/(1.00000+(power(constants[50]/states[1], 1.06000))*(1.00000+power(states[2]/constants[52], 1.12000))) algebraic[105] = 0.370000/(1.00000+constants[54]/states[4]) algebraic[108] = constants[55]*constants[3]*1.00000*(algebraic[105]*algebraic[103]*states[31]-constants[47]*algebraic[107]*(1.00000-states[31])) algebraic[99] = constants[45]*constants[3]*1.00000*(algebraic[97]*algebraic[95]*states[30]-algebraic[98]*constants[95]*(1.00000-states[30])) algebraic[110] = algebraic[49]+algebraic[54]+algebraic[58]+algebraic[80]+algebraic[81]+algebraic[94]+algebraic[108]+algebraic[99]+algebraic[65]+algebraic[69]+algebraic[82] algebraic[111] = algebraic[44]+algebraic[52]+algebraic[60]+algebraic[67]+algebraic[84]+algebraic[89]+3.00000*algebraic[108]+3.00000*algebraic[99] algebraic[112] = (algebraic[80]+algebraic[81]+algebraic[92]+algebraic[82]+algebraic[47]+algebraic[53]+algebraic[63]+algebraic[68]+algebraic[83]+algebraic[88]+algebraic[86])-2.00000*algebraic[108] algebraic[109] = 1.00000/(1.00000+(power(constants[53]/constants[6], 1.12000))*(1.00000+power(algebraic[106]/constants[51], 1.06000))) algebraic[114] = constants[47]*algebraic[107]+constants[49]*algebraic[109] algebraic[104] = 1.00000/(1.00000+(power(constants[52]/states[2], 1.12000))*(1.00000+power(states[1]/constants[50], 1.06000))) algebraic[116] = algebraic[105]*algebraic[103]+constants[48]*algebraic[104] algebraic[115] = 1.00000/(1.00000+constants[60]/algebraic[27]) algebraic[113] = 1.00000/(1.00000+constants[59]/states[32]) algebraic[119] = 1.00000/(1.00000+constants[61]/states[4]) algebraic[120] = constants[62]*1.00000*(constants[56]*algebraic[113]*states[33]-algebraic[119]*algebraic[115]*(1.00000-states[33])) algebraic[122] = -0.400000*states[38]*constants[72] algebraic[118] = 1.00000-algebraic[115] algebraic[121] = algebraic[119]*algebraic[115]+constants[58]*algebraic[118] algebraic[117] = 1.00000-algebraic[113] algebraic[123] = constants[56]*algebraic[113]+constants[57]*algebraic[117] algebraic[56] = algebraic[55]*algebraic[50] algebraic[124] = 280000.*(power(algebraic[27]/1.00000, 2.00000))+constants[65]*algebraic[56] algebraic[126] = (constants[70]-states[36])+constants[71] algebraic[127] = constants[71]*states[36] algebraic[128] = (power(power(algebraic[126], 2.00000)+4.00000*algebraic[127], 1.0/2)-algebraic[126])/2.00000 algebraic[129] = 0.0800000/(1.00000+0.360000/algebraic[128]) algebraic[130] = 0.000377000*(power(algebraic[128]/1.00000, 2.00000)) algebraic[131] = constants[63]*(algebraic[128]-algebraic[27])*states[34] algebraic[132] = constants[66]*(states[32]-algebraic[128]) algebraic[125] = constants[67]*(states[32]-algebraic[27]) algebraic[139] = constants[74]*states[37]*constants[96]-constants[79]*states[38] algebraic[135] = ((1.00000-states[37])-states[38])-states[39] algebraic[137] = constants[73]*algebraic[27]*algebraic[135]-constants[78]*states[37] algebraic[133] = constants[82]-states[40] algebraic[141] = constants[75]*states[38]-constants[80]*states[39]*algebraic[27] algebraic[144] = constants[77]*(power(rates[40], 2.00000))*states[38] algebraic[142] = constants[76]*states[39] algebraic[143] = constants[77]*(power(rates[40], 2.00000))*states[39] algebraic[101] = (algebraic[51]+algebraic[58]+algebraic[93])-2.00000*algebraic[99] algebraic[145] = constants[72]*((algebraic[144]+algebraic[141])-algebraic[137]) algebraic[62] = constants[23]*algebraic[59] algebraic[134] = constants[72]*(states[38]+states[39]) algebraic[136] = constants[86]*algebraic[134] algebraic[138] = algebraic[136]*algebraic[133] algebraic[140] = -constants[97]+algebraic[138] 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)