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 = 325
sizeStates = 43
sizeConstants = 210
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 (minute)"
    legend_constants[0] = "MYOGRS in component temp_myogrs_and_pamk (dimensionless)"
    legend_constants[1] = "PAMK in component temp_myogrs_and_pamk (dimensionless)"
    legend_constants[2] = "PAMKRN in component temp_myogrs_and_pamk (dimensionless)"
    legend_algebraic[6] = "ANM in component general_angiotensin_multiplier (dimensionless)"
    legend_algebraic[84] = "CKE in component extracellular_K_concentration (monovalent_mEq_per_litre)"
    legend_algebraic[3] = "AMK in component aldosterone_effect_on_cell_membrane_K_transport (dimensionless)"
    legend_algebraic[5] = "AMNA in component aldosterone_effect_on_cell_membrane_Na_transport (dimensionless)"
    legend_algebraic[7] = "ANMAL in component angiotensin_control_of_aldosterone_secretion (dimensionless)"
    legend_constants[3] = "ANMALD in component aldosterone_parameter_values (dimensionless)"
    legend_algebraic[86] = "OSMAL in component osmotic_control_of_aldosterone_secretion (dimensionless)"
    legend_algebraic[98] = "AMR1 in component aldosterone_secretion (dimensionless)"
    legend_constants[4] = "AMKMUL in component aldosterone_parameter_values (dimensionless)"
    legend_constants[5] = "ALDINF in component aldosterone_parameter_values (dimensionless)"
    legend_constants[6] = "ALDKNS in component aldosterone_parameter_values (dimensionless)"
    legend_algebraic[90] = "AMRBSC in component aldosterone_secretion (dimensionless)"
    legend_algebraic[93] = "AMRT in component aldosterone_secretion (dimensionless)"
    legend_algebraic[96] = "AMR in component aldosterone_secretion (dimensionless)"
    legend_states[0] = "AMC in component aldosterone_concentration (dimensionless)"
    legend_constants[7] = "AMT in component aldosterone_parameter_values (minute)"
    legend_algebraic[1] = "AM in component general_aldosterone_multiplier (dimensionless)"
    legend_constants[8] = "AM1UL in component aldosterone_parameter_values (dimensionless)"
    legend_constants[9] = "AM1LL in component aldosterone_parameter_values (dimensionless)"
    legend_constants[10] = "AMCSNS in component aldosterone_parameter_values (dimensionless)"
    legend_constants[11] = "ALDMM in component aldosterone_parameter_values (dimensionless)"
    legend_algebraic[0] = "AM1 in component general_aldosterone_multiplier (dimensionless)"
    legend_constants[12] = "AMKM in component aldosterone_parameter_values (dimensionless)"
    legend_algebraic[2] = "AMKT in component aldosterone_effect_on_cell_membrane_K_transport (dimensionless)"
    legend_constants[13] = "AMNAM in component aldosterone_parameter_values (dimensionless)"
    legend_constants[14] = "AMNAUL in component aldosterone_parameter_values (dimensionless)"
    legend_constants[15] = "AMNALL in component aldosterone_parameter_values (dimensionless)"
    legend_algebraic[4] = "AMNAT in component aldosterone_effect_on_cell_membrane_Na_transport (dimensionless)"
    legend_algebraic[232] = "MDFLW in component proximal_tubular_and_macula_densa_flow (L_per_minute)"
    legend_algebraic[10] = "ANUVN in component angiotensin_effect_on_venous_constriction (dimensionless)"
    legend_algebraic[9] = "ANU in component angiotensin_effect_on_circulation (dimensionless)"
    legend_algebraic[268] = "ANGSCR in component instantaneous_angiotensin_formation (dimensionless)"
    legend_algebraic[262] = "MDFLW3 in component instantaneous_angiotensin_formation (L_per_minute)"
    legend_states[1] = "ANX1 in component time_delayed_angiotensin_formation (dimensionless)"
    legend_constants[16] = "ANXM in component angiotensin_parameter_values (dimensionless)"
    legend_constants[17] = "ANV in component angiotensin_parameter_values (minute)"
    legend_algebraic[275] = "ANX in component time_delayed_angiotensin_formation (dimensionless)"
    legend_algebraic[283] = "ANPR in component total_angiotensin_formation (dimensionless)"
    legend_constants[18] = "REK in component angiotensin_parameter_values (dimensionless)"
    legend_algebraic[276] = "ANPRT in component total_angiotensin_formation (dimensionless)"
    legend_algebraic[293] = "ANPR1 in component artificial_angiotensin_formation (dimensionless)"
    legend_constants[19] = "ANGKNS in component angiotensin_parameter_values (dimensionless)"
    legend_constants[20] = "ANGINF in component angiotensin_parameter_values (dimensionless)"
    legend_states[2] = "ANC in component angiotensin_concentration (dimensionless)"
    legend_constants[21] = "ANT in component angiotensin_parameter_values (minute)"
    legend_constants[22] = "ANMUL in component angiotensin_parameter_values (dimensionless)"
    legend_constants[23] = "ANMLL in component angiotensin_parameter_values (dimensionless)"
    legend_constants[24] = "ANCSNS in component angiotensin_parameter_values (dimensionless)"
    legend_constants[25] = "ANUM in component angiotensin_parameter_values (dimensionless)"
    legend_constants[26] = "ANULL in component angiotensin_parameter_values (dimensionless)"
    legend_algebraic[8] = "ANU1 in component angiotensin_effect_on_circulation (dimensionless)"
    legend_constants[27] = "ANUVM in component angiotensin_parameter_values (dimensionless)"
    legend_constants[28] = "Z12 in component angiotensin_parameter_values (dimensionless)"
    legend_algebraic[82] = "CNA in component extracellular_Na_concentration (monovalent_mEq_per_litre)"
    legend_algebraic[65] = "PA1 in component pressure_driving_autonomic_receptors (mmHg)"
    legend_algebraic[14] = "ADHMK in component ADH_effect_on_kidney (dimensionless)"
    legend_algebraic[12] = "ADHMV in component ADH_effect_on_nonrenal_vascular_resistance (dimensionless)"
    legend_states[3] = "ADHC in component ADH_in_blood (dimensionless)"
    legend_algebraic[87] = "ADHNA in component osmotic_control_of_ADH_secretion (dimensionless)"
    legend_constants[29] = "CNR in component antidiuretic_hormone_parameter_values (monovalent_mEq_per_litre)"
    legend_algebraic[83] = "ADHNA1 in component osmotic_control_of_ADH_secretion (dimensionless)"
    legend_algebraic[69] = "ADHPR in component pressure_control_of_ADH_secretion (dimensionless)"
    legend_constants[30] = "ADHPUL in component antidiuretic_hormone_parameter_values (mmHg)"
    legend_constants[31] = "ADHPAM in component antidiuretic_hormone_parameter_values (per_mmHg2)"
    legend_algebraic[67] = "ADHPA in component pressure_control_of_ADH_secretion (mmHg)"
    legend_algebraic[94] = "ADH in component total_ADH_secretion (dimensionless)"
    legend_constants[32] = "ADHINF in component antidiuretic_hormone_parameter_values (dimensionless)"
    legend_algebraic[91] = "ADH1 in component total_ADH_secretion (dimensionless)"
    legend_constants[33] = "ADHTC in component antidiuretic_hormone_parameter_values (minute)"
    legend_constants[34] = "ADHVUL in component antidiuretic_hormone_parameter_values (dimensionless)"
    legend_constants[35] = "ADHVLL in component antidiuretic_hormone_parameter_values (dimensionless)"
    legend_algebraic[11] = "ADHMV1 in component ADH_effect_on_nonrenal_vascular_resistance (dimensionless)"
    legend_constants[36] = "ADHKLL in component antidiuretic_hormone_parameter_values (dimensionless)"
    legend_constants[37] = "ADHKUL in component antidiuretic_hormone_parameter_values (dimensionless)"
    legend_algebraic[13] = "ADHMK1 in component ADH_effect_on_kidney (dimensionless)"
    legend_algebraic[47] = "PLA in component left_atrial_pressure (mmHg)"
    legend_algebraic[34] = "PRA in component right_atrial_pressure (mmHg)"
    legend_algebraic[16] = "ANPX in component ANP_effect_on_renal_afferent_arteriolar_resistance (dimensionless)"
    legend_algebraic[50] = "ANP in component total_ANP_secreted (dimensionless)"
    legend_algebraic[48] = "ANPL in component total_ANP_secreted (dimensionless)"
    legend_algebraic[35] = "ANPR2 in component total_ANP_secreted (dimensionless)"
    legend_algebraic[52] = "ANP1 in component ANP_into_circulation (dimensionless)"
    legend_constants[38] = "ANPKNS in component atrial_natriuretic_peptide_parameter_values (dimensionless)"
    legend_constants[39] = "ANPINF in component atrial_natriuretic_peptide_parameter_values (dimensionless)"
    legend_states[4] = "ANPC in component ANP_in_plasma (dimensionless)"
    legend_constants[40] = "ANPTC in component atrial_natriuretic_peptide_parameter_values (minute)"
    legend_constants[41] = "ANPXUL in component atrial_natriuretic_peptide_parameter_values (dimensionless)"
    legend_algebraic[15] = "ANPX1 in component ANP_effect_on_renal_afferent_arteriolar_resistance (dimensionless)"
    legend_algebraic[64] = "PA in component arterial_pressure_and_pressure_gradient (mmHg)"
    legend_algebraic[169] = "PO2ART in component arterial_PO2 (mmHg)"
    legend_algebraic[40] = "PPA in component pulmonary_vasculature_pressure (mmHg)"
    legend_algebraic[20] = "VVR in component autonomic_drive_on_target_organs_and_tissues (litre)"
    legend_algebraic[22] = "AUH in component autonomic_drive_on_target_organs_and_tissues (dimensionless)"
    legend_algebraic[23] = "AUR in component autonomic_drive_on_target_organs_and_tissues (dimensionless)"
    legend_algebraic[25] = "AUM in component autonomic_drive_on_target_organs_and_tissues (dimensionless)"
    legend_algebraic[24] = "AOM in component autonomic_drive_on_target_organs_and_tissues (dimensionless)"
    legend_algebraic[26] = "AVE in component autonomic_drive_on_target_organs_and_tissues (dimensionless)"
    legend_algebraic[19] = "AU in component actual_autonomic_stimulation (dimensionless)"
    legend_constants[42] = "CRRFLX in component autonomics_parameter_values (mmHg)"
    legend_constants[43] = "EXE in component autonomics_parameter_values (mmHg)"
    legend_algebraic[71] = "AUC in component chemoreceptors_effect_of_PA (dimensionless)"
    legend_constants[44] = "AUC1 in component autonomics_parameter_values (dimensionless)"
    legend_algebraic[173] = "AUC3 in component chemoreceptors_effect_of_art_PO2 (dimensionless)"
    legend_constants[45] = "O2CHMO in component autonomics_parameter_values (per_mmHg)"
    legend_algebraic[171] = "AUC2 in component chemoreceptors_effect_of_art_PO2 (dimensionless)"
    legend_algebraic[17] = "AU6C in component arterial_baroreceptor_reflex (dimensionless)"
    legend_constants[46] = "AUX in component autonomics_parameter_values (dimensionless)"
    legend_constants[47] = "AUK in component autonomics_parameter_values (per_minute)"
    legend_constants[48] = "BAROTC in component autonomics_parameter_values (minute)"
    legend_algebraic[66] = "AUB in component arterial_baroreceptor_reflex (dimensionless)"
    legend_algebraic[68] = "A1B in component arterial_baroreceptor_reflex (dimensionless)"
    legend_algebraic[70] = "AU6A in component arterial_baroreceptor_reflex (dimensionless)"
    legend_constants[49] = "AU4 in component arterial_baroreceptor_reflex (dimensionless)"
    legend_states[5] = "AU6 in component arterial_baroreceptor_reflex (dimensionless)"
    legend_algebraic[72] = "AUN in component CNS_ischemic_reflex (dimensionless)"
    legend_constants[50] = "AUN1 in component autonomics_parameter_values (dimensionless)"
    legend_algebraic[49] = "AULP in component autonomic_response_to_vasculature_pressure (dimensionless)"
    legend_constants[51] = "AULPM in component autonomics_parameter_values (dimensionless)"
    legend_constants[206] = "AUEX in component autonomic_response_to_exercise (dimensionless)"
    legend_constants[52] = "EXC in component autonomics_parameter_values (dimensionless)"
    legend_constants[53] = "EXCXP in component autonomics_parameter_values (dimensionless)"
    legend_algebraic[177] = "AUTTL in component total_autonomic_stimulation (dimensionless)"
    legend_algebraic[175] = "AUTTL1 in component total_autonomic_stimulation (dimensionless)"
    legend_constants[54] = "EXCML in component autonomics_parameter_values (dimensionless)"
    legend_constants[55] = "AUDMP in component autonomics_parameter_values (minute)"
    legend_constants[56] = "AUMAX in component autonomics_parameter_values (dimensionless)"
    legend_constants[57] = "AUMIN in component autonomics_parameter_values (dimensionless)"
    legend_constants[58] = "AUSLP in component autonomics_parameter_values (dimensionless)"
    legend_algebraic[180] = "DAU in component actual_autonomic_stimulation (per_minute)"
    legend_states[6] = "AU1 in component actual_autonomic_stimulation (dimensionless)"
    legend_algebraic[18] = "AUT in component actual_autonomic_stimulation (dimensionless)"
    legend_constants[59] = "VV9 in component autonomics_parameter_values (litre)"
    legend_constants[60] = "AUL in component autonomics_parameter_values (litre)"
    legend_constants[61] = "AUV in component autonomics_parameter_values (dimensionless)"
    legend_constants[62] = "AUS in component autonomics_parameter_values (dimensionless)"
    legend_constants[63] = "O2A in component autonomics_parameter_values (dimensionless)"
    legend_constants[64] = "AUM1 in component autonomics_parameter_values (dimensionless)"
    legend_constants[65] = "AUM2 in component autonomics_parameter_values (dimensionless)"
    legend_constants[66] = "AUY in component autonomics_parameter_values (dimensionless)"
    legend_algebraic[21] = "AUO in component autonomic_drive_on_target_organs_and_tissues (dimensionless)"
    legend_constants[67] = "MDMP in component autonomics_parameter_values (dimensionless)"
    legend_algebraic[81] = "VEC in component extracellular_fluid_volume (litre)"
    legend_algebraic[152] = "PPD in component concentration_of_protein_in_pulmonary_interstitium (gram_per_minute)"
    legend_algebraic[233] = "RVS in component venous_resistance (mmHg_minute_per_L)"
    legend_algebraic[149] = "DFP in component pulmonary_interstitial_free_fluid_volume (L_per_minute)"
    legend_algebraic[123] = "VPF in component pulmonary_interstitial_free_fluid_volume (litre)"
    legend_algebraic[234] = "BFN in component blood_flow_through_NM_NR_tissues (L_per_minute)"
    legend_algebraic[209] = "PVS in component venous_average_pressure (mmHg)"
    legend_algebraic[235] = "PC in component capillary_pressure (mmHg)"
    legend_algebraic[27] = "CPP in component plasma_protein_concentration (gram_per_L)"
    legend_algebraic[30] = "PPC in component plasma_colloid_osmotic_pressure (mmHg)"
    legend_states[7] = "VP in component plasma_volume (litre)"
    legend_algebraic[134] = "PGH in component hydrostatic_pressure_of_tissue_gel (mmHg)"
    legend_algebraic[132] = "PTC in component total_osmotic_pressure_of_tissue_gel (mmHg)"
    legend_algebraic[269] = "VTCPL in component plasma_leakage (L_per_minute)"
    legend_algebraic[277] = "VTC in component rate_of_fluid_out_of_capillaries (L_per_minute)"
    legend_constants[68] = "CFC in component capillary_dynamics_parameter_values (L_per_minute_per_mmHg)"
    legend_algebraic[139] = "VTL in component lymph_flow (L_per_minute)"
    legend_constants[69] = "TRPL in component capillary_dynamics_parameter_values (L_per_minute)"
    legend_algebraic[284] = "VPD in component plasma_volume (L_per_minute)"
    legend_states[8] = "PRP in component total_plasma_protein (gram)"
    legend_algebraic[29] = "DLP in component protein_destruction_and_formation (gram_per_minute)"
    legend_constants[70] = "CPR in component capillary_dynamics_parameter_values (gram_per_L)"
    legend_constants[71] = "LPPR in component capillary_dynamics_parameter_values (gram_per_minute)"
    legend_constants[72] = "LPDE in component capillary_dynamics_parameter_values (dimensionless)"
    legend_constants[73] = "LPK in component capillary_dynamics_parameter_values (L_per_minute)"
    legend_algebraic[28] = "CPPD in component protein_destruction_and_formation (gram_per_L)"
    legend_constants[74] = "PCR in component capillary_dynamics_parameter_values (mmHg)"
    legend_constants[75] = "CPK in component capillary_dynamics_parameter_values (L_per_minute_per_mmHg)"
    legend_constants[76] = "PCE in component capillary_dynamics_parameter_values (dimensionless)"
    legend_algebraic[263] = "PRCD in component plasma_leakage (mmHg)"
    legend_algebraic[127] = "CPI in component interstitial_protein_concentration (gram_per_L)"
    legend_algebraic[278] = "DPC in component protein_influx_into_interstitium (gram_per_minute)"
    legend_algebraic[140] = "DPL in component lymph_protein_flow (gram_per_minute)"
    legend_algebraic[285] = "DPP in component total_plasma_protein (gram_per_minute)"
    legend_algebraic[124] = "VTS in component total_systemic_fluid_volume (litre)"
    legend_algebraic[125] = "VTS1 in component interstitial_fluid_volume (litre)"
    legend_constants[77] = "TSSLML in component capillary_dynamics_parameter_values (dimensionless)"
    legend_constants[78] = "TSSLTC in component capillary_dynamics_parameter_values (per_minute)"
    legend_states[9] = "VTS2 in component interstitial_fluid_volume (litre)"
    legend_states[10] = "TSP in component total_interstitial_protein (gram)"
    legend_algebraic[286] = "DPI in component total_interstitial_protein (gram_per_minute)"
    legend_algebraic[129] = "PTCPR in component interstitial_colloid_osmotic_pressure (mmHg)"
    legend_algebraic[133] = "PTT in component total_tissue_pressure (mmHg)"
    legend_algebraic[130] = "CHY in component hydrostatic_pressure_of_tissue_gel (gram_per_L)"
    legend_constants[79] = "HYL in component capillary_dynamics_parameter_values (gram)"
    legend_constants[80] = "CMPTSS in component capillary_dynamics_parameter_values (dimensionless)"
    legend_constants[81] = "PGHF in component capillary_dynamics_parameter_values (L_mmHg_per_gram)"
    legend_algebraic[131] = "POSHYL in component total_osmotic_pressure_of_tissue_gel (mmHg)"
    legend_constants[82] = "GCOPF in component capillary_dynamics_parameter_values (per_mmHg)"
    legend_constants[83] = "VTSF in component capillary_dynamics_parameter_values (litre)"
    legend_algebraic[135] = "PIF in component interstial_free_fluid_pressure (mmHg)"
    legend_algebraic[137] = "PTS in component interstitial_solid_tissue_pressure (mmHg)"
    legend_constants[84] = "PLDF in component capillary_dynamics_parameter_values (mmHg)"
    legend_algebraic[136] = "PLD1 in component lymph_flow (mmHg)"
    legend_algebraic[138] = "PLD in component lymph_flow (mmHg)"
    legend_algebraic[126] = "VG in component interstitial_gel_volume (litre)"
    legend_algebraic[128] = "VIF in component interstitial_free_fluid_volume (litre)"
    legend_algebraic[100] = "AMM in component global_M_blood_flow_autoregulation_output (dimensionless)"
    legend_algebraic[112] = "ARM in component global_NM_blood_flow_autoregulation_output (dimensionless)"
    legend_algebraic[198] = "ATRRFB in component volume_effect_on_arteries (dimensionless)"
    legend_algebraic[205] = "ATRVFB in component volume_effect_on_unstressed_venous_volume (litre)"
    legend_algebraic[88] = "HMD in component heart_deterioration (dimensionless)"
    legend_states[11] = "HPL in component left_ventricular_hypertrophy (dimensionless)"
    legend_states[12] = "HPR in component right_ventricular_hypertrophy (dimensionless)"
    legend_algebraic[158] = "OSA in component arterial_PO2 (dimensionless)"
    legend_algebraic[264] = "RBF in component actual_renal_blood_flow (L_per_minute)"
    legend_algebraic[182] = "VIM in component blood_viscosity (dimensionless)"
    legend_states[13] = "VRC in component RBC_volume (litre)"
    legend_states[14] = "VV6 in component long_term_stress_relaxation (litre)"
    legend_states[15] = "VV7 in component short_term_stress_relaxation (litre)"
    legend_algebraic[215] = "BFM in component blood_flow_through_M_tissues (L_per_minute)"
    legend_algebraic[279] = "QAO in component systemic_blood_flow (L_per_minute)"
    legend_algebraic[168] = "QRO in component right_ventricular_output (L_per_minute)"
    legend_algebraic[164] = "QLO in component left_ventricular_output (L_per_minute)"
    legend_algebraic[44] = "RPA in component pulmonary_arterial_resistance (mmHg_minute_per_L)"
    legend_algebraic[53] = "RPV in component pulmonary_venous_resistance (mmHg_minute_per_L)"
    legend_algebraic[207] = "VVE in component venous_excess_volume (litre)"
    legend_states[16] = "VVS1 in component venous_blood_volume (litre)"
    legend_states[17] = "VAS1 in component arterial_blood_volume (litre)"
    legend_states[18] = "VLA1 in component left_atrial_blood_volume (litre)"
    legend_states[19] = "VPA1 in component pulmonary_vasculature_blood_volume (litre)"
    legend_states[20] = "VRA1 in component right_atrial_blood_volume (litre)"
    legend_algebraic[31] = "VBD in component total_blood_volume_change (litre)"
    legend_algebraic[212] = "QVO in component rate_of_blood_flow_from_veins_to_right_atrium (L_per_minute)"
    legend_algebraic[32] = "VRA in component right_atrial_blood_volume (litre)"
    legend_algebraic[214] = "DRA in component right_atrial_blood_volume (L_per_minute)"
    legend_algebraic[33] = "VRE in component right_atrial_pressure (litre)"
    legend_algebraic[36] = "PRA1 in component autonomic_stimulation_effect_on_right_atrial_pressure (mmHg)"
    legend_constants[85] = "HTAUML in component circulatory_dynamics_parameter_values (dimensionless)"
    legend_algebraic[160] = "RVM in component pressure_effect_on_right_ventricular_pumping (dimensionless)"
    legend_algebraic[159] = "PP2 in component pressure_effect_on_right_ventricular_pumping (mmHg)"
    legend_algebraic[58] = "QLN in component left_ventricular_output (L_per_minute)"
    legend_algebraic[165] = "HPEF in component pumping_effectiveness_of_right_ventricle (L_per_minute)"
    legend_constants[86] = "QRF in component circulatory_dynamics_parameter_values (L_per_minute)"
    legend_constants[87] = "HSR in component circulatory_dynamics_parameter_values (dimensionless)"
    legend_algebraic[37] = "QRN in component right_ventricular_output (dimensionless)"
    legend_algebraic[56] = "QPO in component rate_of_blood_flow_from_pulmonary_veins_to_left_atrium (L_per_minute)"
    legend_algebraic[38] = "VPA in component pulmonary_vasculature_blood_volume (litre)"
    legend_algebraic[170] = "DPA in component pulmonary_vasculature_blood_volume (L_per_minute)"
    legend_algebraic[39] = "VPE in component pulmonary_vasculature_pressure (litre)"
    legend_algebraic[41] = "PP1T in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)"
    legend_algebraic[42] = "PP1 in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)"
    legend_algebraic[43] = "CPA in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)"
    legend_algebraic[51] = "PL1 in component pulmonary_venous_resistance (mmHg)"
    legend_algebraic[54] = "RPT in component total_pulmonary_vascular_resistance (mmHg_minute_per_L)"
    legend_algebraic[55] = "PGL in component pressure_gradient_through_the_lungs (mmHg)"
    legend_algebraic[45] = "VLA in component left_atrial_blood_volume (litre)"
    legend_algebraic[166] = "DLA in component left_atrial_blood_volume (L_per_minute)"
    legend_algebraic[46] = "VLE in component left_atrial_pressure (litre)"
    legend_algebraic[57] = "PLA1 in component autonomic_stimulation_effect_on_left_atrial_pressure (mmHg)"
    legend_algebraic[162] = "LVM in component pumping_effectiveness_of_left_ventricle (dimensionless)"
    legend_algebraic[161] = "PA2 in component pumping_effectiveness_of_left_ventricle (mmHg)"
    legend_algebraic[163] = "QLOT in component left_ventricular_output (L_per_minute)"
    legend_constants[88] = "HSL in component circulatory_dynamics_parameter_values (dimensionless)"
    legend_algebraic[73] = "QLO1 in component left_ventricular_output (L_per_minute)"
    legend_algebraic[59] = "VVS in component venous_blood_volume (litre)"
    legend_algebraic[287] = "DVS in component venous_blood_volume (L_per_minute)"
    legend_algebraic[60] = "VVA in component angiotensin_induced_venous_constriction (litre)"
    legend_constants[89] = "ANY in component circulatory_dynamics_parameter_values (litre)"
    legend_algebraic[206] = "VVE1 in component venous_excess_volume (litre)"
    legend_constants[90] = "CV in component circulatory_dynamics_parameter_values (L_per_mmHg)"
    legend_algebraic[208] = "PVS1 in component venous_average_pressure (mmHg)"
    legend_algebraic[61] = "PR1 in component venous_outflow_pressure_into_heart (mmHg)"
    legend_constants[91] = "PR1LL in component circulatory_dynamics_parameter_values (mmHg)"
    legend_algebraic[210] = "RVG in component resistance_from_veins_to_right_atrium (mmHg_minute_per_L)"
    legend_algebraic[211] = "PGV in component rate_of_blood_flow_from_veins_to_right_atrium (mmHg)"
    legend_constants[92] = "CN7 in component circulatory_dynamics_parameter_values (dimensionless)"
    legend_constants[93] = "CN2 in component circulatory_dynamics_parameter_values (per_mmHg)"
    legend_constants[94] = "RVSM in component circulatory_dynamics_parameter_values (mmHg_minute_per_L)"
    legend_algebraic[236] = "CN3 in component venous_resistance (dimensionless)"
    legend_algebraic[237] = "RV1 in component venous_resistance (mmHg_minute_per_L)"
    legend_algebraic[238] = "NNRVR in component NM_NR_venous_resistance (mmHg_minute_per_L)"
    legend_algebraic[62] = "VAS in component arterial_blood_volume (litre)"
    legend_algebraic[288] = "DAS in component arterial_blood_volume (L_per_minute)"
    legend_algebraic[74] = "PAG in component arterial_pressure_and_pressure_gradient (mmHg)"
    legend_algebraic[63] = "VAE in component arterial_pressure_and_pressure_gradient (litre)"
    legend_algebraic[75] = "PAM in component pressure_effect_on_arterial_distention (dimensionless)"
    legend_constants[95] = "PAEX in component circulatory_dynamics_parameter_values (dimensionless)"
    legend_algebraic[200] = "R1 in component non_renal_systemic_arterial_resistance_multiplier (dimensionless)"
    legend_algebraic[202] = "NNRAR in component NM_NR_arterial_resistance (mmHg_minute_per_L)"
    legend_constants[96] = "RAR in component circulatory_dynamics_parameter_values (mmHg_minute_per_L)"
    legend_constants[97] = "RMULT1 in component circulatory_dynamics_parameter_values (dimensionless)"
    legend_algebraic[213] = "PGS in component pressure_gradient_from_arteries_to_veins (mmHg)"
    legend_algebraic[204] = "RSM in component M_systemic_resistance (mmHg_minute_per_L)"
    legend_constants[98] = "RAM in component circulatory_dynamics_parameter_values (mmHg_minute_per_L)"
    legend_algebraic[239] = "RSN in component total_NM_NR_systemic_resistance (mmHg_minute_per_L)"
    legend_algebraic[76] = "FISFLO in component blood_flow_through_AV_fistulas (L_per_minute)"
    legend_constants[99] = "FIS in component circulatory_dynamics_parameter_values (L_per_minute_per_mmHg)"
    legend_algebraic[270] = "SYSFLO in component systemic_blood_flow (L_per_minute)"
    legend_algebraic[289] = "RTP in component total_peripheral_resistance (mmHg_minute_per_L)"
    legend_states[21] = "TVD in component rate_of_fluid_intake (L_per_minute)"
    legend_algebraic[311] = "NOD in component actual_Na_excretion_rate (monovalent_mEq_per_minute)"
    legend_algebraic[187] = "STH in component effect_of_salt_appetite_stimulation_on_thirst (dimensionless)"
    legend_algebraic[315] = "KOD in component actual_K_excretion_rate (monovalent_mEq_per_minute)"
    legend_algebraic[324] = "VUD in component actual_urine_volume (L_per_minute)"
    legend_states[22] = "VTW in component total_body_water (litre)"
    legend_constants[100] = "NID in component electrolytes_parameter_values (monovalent_mEq_per_minute)"
    legend_constants[101] = "TRPL in component electrolytes_parameter_values (L_per_minute)"
    legend_algebraic[313] = "NED in component extracellular_Na_concentration (monovalent_mEq_per_minute)"
    legend_states[23] = "NAE in component extracellular_Na_concentration (monovalent_mEq)"
    legend_algebraic[77] = "AMK1 in component aldosterone_effect_on_cellular_K_distribution (dimensionless)"
    legend_constants[102] = "ALCLK in component electrolytes_parameter_values (dimensionless)"
    legend_algebraic[78] = "KE in component extracellular_K_concentration (monovalent_mEq)"
    legend_states[24] = "KTOT in component extracellular_K_concentration (monovalent_mEq)"
    legend_constants[103] = "KID in component electrolytes_parameter_values (monovalent_mEq_per_minute)"
    legend_algebraic[317] = "KTOTD in component extracellular_K_concentration (monovalent_mEq_per_minute)"
    legend_states[25] = "VIC in component intracellular_fluid_volume (litre)"
    legend_algebraic[80] = "CKI in component intracellular_K_concentration (monovalent_mEq_per_litre)"
    legend_algebraic[79] = "KI in component intracellular_K_concentration (monovalent_mEq)"
    legend_algebraic[89] = "VID in component intracellular_fluid_volume (L_per_minute)"
    legend_constants[104] = "VIDML in component electrolytes_parameter_values (litre2_per_monovalent_mEq_per_minute)"
    legend_algebraic[85] = "CCD in component intracellular_fluid_volume (monovalent_mEq_per_litre)"
    legend_algebraic[114] = "POT in component pressure_of_O2_in_NM_tissue_cells (mmHg)"
    legend_constants[105] = "HSL in component heart_hypertrophy_or_deterioration_parameter_values (dimensionless)"
    legend_constants[106] = "Z13 in component heart_hypertrophy_or_deterioration_parameter_values (dimensionless)"
    legend_constants[107] = "HSR in component heart_hypertrophy_or_deterioration_parameter_values (dimensionless)"
    legend_constants[108] = "DHDTR in component heart_hypertrophy_or_deterioration_parameter_values (per_mmHg_per_minute)"
    legend_states[26] = "HMD1 in component heart_deterioration (dimensionless)"
    legend_algebraic[116] = "DHM in component heart_deterioration (per_minute)"
    legend_algebraic[92] = "AUHR in component effect_of_autonomic_stimulation_on_HR (beats_per_minute)"
    legend_constants[207] = "PRHR in component effect_of_PRA_on_HR (beats_per_minute)"
    legend_constants[109] = "PR1LL in component HR_and_SV_parameter_values (mmHg)"
    legend_algebraic[95] = "HDHR in component effect_of_heart_deterioration_on_HR (dimensionless)"
    legend_algebraic[97] = "HR in component heart_rate (beats_per_minute)"
    legend_algebraic[167] = "SVO in component stroke_volume_output (litre)"
    legend_algebraic[102] = "PMO in component pressure_of_O2_in_M_tissue_cells (mmHg)"
    legend_algebraic[104] = "PDO in component M_autoregulatory_driving_force (mmHg)"
    legend_algebraic[106] = "POE in component M_ST_sensitivity_control (mmHg)"
    legend_constants[110] = "POM in component M_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_algebraic[99] = "AMM1 in component M_ST_time_delay_and_limit (dimensionless)"
    legend_constants[111] = "A4K in component M_autoregulatory_local_blood_flow_parameter_values (minute)"
    legend_constants[112] = "AMM4 in component M_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_states[27] = "AMM1T in component M_ST_time_delay_and_limit (dimensionless)"
    legend_algebraic[107] = "POF in component M_LT_sensitivity_control (mmHg)"
    legend_constants[113] = "POM2 in component M_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_states[28] = "AMM2 in component M_LT_time_delay (dimensionless)"
    legend_constants[114] = "A4K2 in component M_autoregulatory_local_blood_flow_parameter_values (minute)"
    legend_states[29] = "OVA in component O2_volume_of_arterial_blood (mL_per_L)"
    legend_algebraic[157] = "HM in component hematocrit_fraction (dimensionless)"
    legend_algebraic[229] = "RMO in component delivery_of_O2_to_M_tissues (mL_per_minute)"
    legend_algebraic[216] = "O2ARTM in component M_O2_blood_supply (mL_per_minute)"
    legend_algebraic[230] = "PVO in component M_venous_O2_content (mmHg)"
    legend_constants[115] = "EXC in component M_O2_delivery_parameter_values (dimensionless)"
    legend_constants[116] = "EXCXP2 in component M_O2_delivery_parameter_values (dimensionless)"
    legend_algebraic[231] = "OVS in component M_venous_O2_content (dimensionless)"
    legend_algebraic[105] = "MMO in component metabolic_O2_consumption_by_M_tissue (mL_per_minute)"
    legend_algebraic[103] = "P2O in component metabolic_O2_consumption_by_M_tissue (mmHg)"
    legend_constants[117] = "OMM in component M_O2_delivery_parameter_values (mL_per_minute)"
    legend_constants[118] = "PM5 in component M_O2_delivery_parameter_values (per_mmHg)"
    legend_algebraic[101] = "QOM in component volume_of_O2_in_M_tissue (mL)"
    legend_algebraic[261] = "DO2M in component volume_of_O2_in_M_tissue (mL_per_minute)"
    legend_states[30] = "QOM1 in component volume_of_O2_in_M_tissue (mL)"
    legend_constants[119] = "PK2 in component M_O2_delivery_parameter_values (mmHg_per_mL)"
    legend_algebraic[117] = "POD in component NM_autoregulatory_driving_force (mmHg)"
    legend_constants[120] = "POR in component NM_autoregulatory_local_blood_flow_parameter_values (mmHg)"
    legend_algebraic[119] = "POB in component NM_ST_sensitivity_control (mmHg)"
    legend_constants[121] = "POK in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_algebraic[108] = "AR1 in component NM_ST_time_delay_and_damping (dimensionless)"
    legend_constants[122] = "A1K in component NM_autoregulatory_local_blood_flow_parameter_values (minute)"
    legend_states[31] = "AR1T in component NM_ST_time_delay_and_damping (dimensionless)"
    legend_algebraic[120] = "POA in component NM_I_sensitivity_control (mmHg)"
    legend_constants[123] = "PON in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_algebraic[109] = "AR2 in component NM_I_time_delay_and_limit (dimensionless)"
    legend_constants[124] = "A2K in component NM_autoregulatory_local_blood_flow_parameter_values (minute)"
    legend_states[32] = "AR2T in component NM_I_time_delay_and_limit (dimensionless)"
    legend_algebraic[121] = "POC in component NM_LT_sensitivity_control (mmHg)"
    legend_constants[125] = "POZ in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_algebraic[110] = "AR3 in component NM_LT_time_delay_and_limit (dimensionless)"
    legend_constants[126] = "A3K in component NM_autoregulatory_local_blood_flow_parameter_values (minute)"
    legend_states[33] = "AR3T in component NM_LT_time_delay_and_limit (dimensionless)"
    legend_algebraic[111] = "ARM1 in component total_NM_autoregulation (dimensionless)"
    legend_constants[127] = "AUTOSN in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)"
    legend_algebraic[271] = "DOB in component delivery_of_O2_to_NM_tissues (mL_per_minute)"
    legend_algebraic[265] = "O2ARTN in component NM_O2_blood_supply (mL_per_minute)"
    legend_algebraic[272] = "POV in component NM_venous_O2_content (mmHg)"
    legend_algebraic[273] = "OSV in component NM_venous_O2_content (dimensionless)"
    legend_algebraic[118] = "MO2 in component O2_consumption_by_NM_tissue (mL_per_minute)"
    legend_constants[128] = "O2M in component NM_O2_delivery_parameter_values (mL_per_minute)"
    legend_algebraic[115] = "P1O in component O2_consumption_by_NM_tissue (mmHg)"
    legend_algebraic[113] = "QO2 in component volume_of_O2_in_NM_tissue (mL)"
    legend_algebraic[290] = "DO2N in component volume_of_O2_in_NM_tissue (mL_per_minute)"
    legend_algebraic[280] = "DO2N1 in component volume_of_O2_in_NM_tissue (mL_per_minute)"
    legend_states[34] = "QO2T in component volume_of_O2_in_NM_tissue (mL)"
    legend_algebraic[122] = "PCP in component pulmonary_capillary_pressure (mmHg)"
    legend_algebraic[144] = "POS in component colloid_osmotic_pressure_of_pulmonary_interstitium (mmHg)"
    legend_algebraic[141] = "PPI in component pulmonary_interstitial_fluid_pressure (mmHg)"
    legend_algebraic[145] = "PFI in component fluid_filtration_into_pulmonary_interstitium (L_per_minute)"
    legend_constants[129] = "CPF in component pulmonary_fluid_dynamics_parameter_values (L_per_minute_per_mmHg)"
    legend_algebraic[147] = "PLF in component lung_lymphatic_protein_flow (L_per_minute)"
    legend_algebraic[148] = "DFZ in component pulmonary_interstitial_free_fluid_volume (L_per_minute)"
    legend_states[35] = "VPF1 in component pulmonary_interstitial_free_fluid_volume (litre)"
    legend_algebraic[150] = "PPO in component lung_lymphatic_protein_flow (gram_per_minute)"
    legend_algebraic[146] = "PPN in component protein_leakage_into_pulmonary_interstitium (gram_per_minute)"
    legend_algebraic[143] = "CPN in component concentration_of_protein_in_pulmonary_interstitium (gram_per_L)"
    legend_algebraic[151] = "PPZ in component concentration_of_protein_in_pulmonary_interstitium (gram_per_minute)"
    legend_states[36] = "PPR1 in component concentration_of_protein_in_pulmonary_interstitium (gram)"
    legend_algebraic[142] = "PPR in component concentration_of_protein_in_pulmonary_interstitium (gram)"
    legend_algebraic[281] = "O2UTIL in component total_O2_utilization (mL_per_minute)"
    legend_algebraic[154] = "O2VAD2 in component progressive_chemoreceptor_adaptation_of_alveolar_ventilation (dimensionless)"
    legend_algebraic[176] = "O2VTS2 in component acute_chemoreceptor_adaptation_of_alveolar_ventilation (dimensionless)"
    legend_algebraic[291] = "ALVENT in component alveolar_ventilation (L_per_minute)"
    legend_constants[130] = "VNTSTM in component pulmonary_O2_uptake_parameter_values (dimensionless)"
    legend_algebraic[294] = "PO2ALV in component alveolar_PO2 (mmHg)"
    legend_constants[131] = "PO2AMB in component pulmonary_O2_uptake_parameter_values (mmHg)"
    legend_algebraic[296] = "O2DFS in component respiratory_O2_diffusion_into_capillaries (mL_per_minute)"
    legend_constants[132] = "PL2 in component pulmonary_O2_uptake_parameter_values (L_mL_per_minute_per_mmHg)"
    legend_constants[133] = "VPTISS in component pulmonary_O2_uptake_parameter_values (litre)"
    legend_algebraic[153] = "RSPDFC in component respiratory_O2_diffusion_into_capillaries (mL_per_minute_per_mmHg)"
    legend_algebraic[298] = "DOVA in component O2_volume_of_arterial_blood (mL_per_L_per_minute)"
    legend_algebraic[174] = "O2VTST in component acute_chemoreceptor_adaptation_of_alveolar_ventilation (dimensionless)"
    legend_algebraic[172] = "O2VTST1 in component acute_chemoreceptor_adaptation_of_alveolar_ventilation (dimensionless)"
    legend_algebraic[179] = "DO2VAD in component progressive_chemoreceptor_adaptation_of_alveolar_ventilation (per_minute)"
    legend_states[37] = "O2VAD1 in component progressive_chemoreceptor_adaptation_of_alveolar_ventilation (dimensionless)"
    legend_algebraic[156] = "HM1 in component hematocrit_fraction (dimensionless)"
    legend_algebraic[155] = "VB in component hematocrit_fraction (litre)"
    legend_algebraic[178] = "VIE in component viscosity_due_to_RBCs (dimensionless)"
    legend_constants[134] = "HMK in component red_cells_and_viscosity_parameter_values (dimensionless)"
    legend_constants[135] = "HKM in component red_cells_and_viscosity_parameter_values (dimensionless)"
    legend_algebraic[181] = "VIB in component blood_viscosity (dimensionless)"
    legend_algebraic[188] = "HM7 in component oxygen_stimulation (mmHg)"
    legend_constants[136] = "PO2AMB in component red_cells_and_viscosity_parameter_values (mmHg)"
    legend_constants[137] = "HM6 in component red_cells_and_viscosity_parameter_values (mmHg)"
    legend_constants[208] = "PO2AM1 in component oxygen_stimulation (mmHg)"
    legend_algebraic[184] = "HM3 in component oxygen_stimulation (mmHg)"
    legend_constants[209] = "HM4 in component oxygen_stimulation (mmHg)"
    legend_algebraic[186] = "HM5 in component oxygen_stimulation (mmHg)"
    legend_algebraic[190] = "RC1 in component RBC_production (L_per_minute)"
    legend_constants[138] = "HM8 in component red_cells_and_viscosity_parameter_values (L_per_minute_per_mmHg)"
    legend_constants[139] = "REK in component red_cells_and_viscosity_parameter_values (dimensionless)"
    legend_algebraic[193] = "RC2 in component RBC_destruction (L_per_minute)"
    legend_constants[140] = "RKC in component red_cells_and_viscosity_parameter_values (per_minute)"
    legend_constants[141] = "TRRBC in component red_cells_and_viscosity_parameter_values (L_per_minute)"
    legend_algebraic[196] = "RCD in component RBC_volume (L_per_minute)"
    legend_constants[142] = "SR in component stress_relaxation_parameter_values (dimensionless)"
    legend_constants[143] = "SRK in component stress_relaxation_parameter_values (minute)"
    legend_constants[144] = "SR2 in component stress_relaxation_parameter_values (dimensionless)"
    legend_constants[145] = "SRK2 in component stress_relaxation_parameter_values (minute)"
    legend_constants[146] = "ANMSLT in component thirst_drinking_and_salt_appetite_parameter_values (dimensionless)"
    legend_constants[147] = "Z10 in component thirst_drinking_and_salt_appetite_parameter_values (mmHg)"
    legend_constants[148] = "Z11 in component thirst_drinking_and_salt_appetite_parameter_values (per_mmHg2)"
    legend_algebraic[183] = "ANMSML in component effect_of_salt_appetite_stimulation_on_thirst (dimensionless)"
    legend_algebraic[185] = "STH1 in component effect_of_salt_appetite_stimulation_on_thirst (dimensionless)"
    legend_algebraic[191] = "AHCM in component effect_of_antidiuretic_hormone_on_thirst (dimensionless)"
    legend_constants[149] = "AHTHM in component thirst_drinking_and_salt_appetite_parameter_values (dimensionless)"
    legend_algebraic[194] = "ANMTH in component effect_of_angiotensin_on_thirst (dimensionless)"
    legend_constants[150] = "ANMTM in component thirst_drinking_and_salt_appetite_parameter_values (dimensionless)"
    legend_constants[151] = "DR in component thirst_drinking_and_salt_appetite_parameter_values (L_per_minute)"
    legend_constants[152] = "TVDDL in component thirst_drinking_and_salt_appetite_parameter_values (minute)"
    legend_algebraic[199] = "AHTH in component rate_of_fluid_intake (dimensionless)"
    legend_algebraic[197] = "AHTH1 in component rate_of_fluid_intake (dimensionless)"
    legend_algebraic[203] = "TVZ in component rate_of_fluid_intake (L_per_minute)"
    legend_algebraic[201] = "TVZ1 in component rate_of_fluid_intake (L_per_minute)"
    legend_algebraic[192] = "AHZ in component effect_of_pressure_on_volume_receptors (dimensionless)"
    legend_constants[153] = "AH10 in component volume_receptors_parameter_values (dimensionless)"
    legend_constants[154] = "AH9 in component volume_receptors_parameter_values (per_mmHg)"
    legend_algebraic[189] = "AHZ1 in component effect_of_pressure_on_volume_receptors (dimensionless)"
    legend_states[38] = "AHY in component time_dependent_volume_receptor_adaptation (dimensionless)"
    legend_constants[155] = "AH11 in component volume_receptors_parameter_values (minute)"
    legend_algebraic[195] = "AH7 in component total_volume_nervous_feedback (dimensionless)"
    legend_constants[156] = "ATRFBM in component volume_receptors_parameter_values (dimensionless)"
    legend_constants[157] = "ATRVM in component volume_receptors_parameter_values (litre)"
    legend_algebraic[217] = "PAR in component perfusion_pressure (mmHg)"
    legend_constants[158] = "GBL in component kidney_parameter_values (mmHg)"
    legend_constants[159] = "RAPRSP in component kidney_parameter_values (mmHg)"
    legend_constants[160] = "RFCDFT in component kidney_parameter_values (dimensionless)"
    legend_constants[161] = "RCDFPC in component kidney_parameter_values (dimensionless)"
    legend_constants[162] = "RCDFDP in component kidney_parameter_values (minute)"
    legend_states[39] = "PAR1 in component perfusion_pressure (mmHg)"
    legend_algebraic[240] = "RNAUG2 in component renal_autoregulatory_feedback_factor (dimensionless)"
    legend_constants[163] = "RNAUGN in component kidney_parameter_values (minute_per_L)"
    legend_constants[164] = "RNAULL in component kidney_parameter_values (dimensionless)"
    legend_constants[165] = "RNAUUL in component kidney_parameter_values (dimensionless)"
    legend_constants[166] = "RNAUAD in component kidney_parameter_values (per_minute)"
    legend_algebraic[241] = "RNAUG1 in component renal_autoregulatory_feedback_factor (dimensionless)"
    legend_algebraic[242] = "RNAUG1T in component renal_autoregulatory_feedback_factor (dimensionless)"
    legend_states[40] = "RNAUG3 in component renal_autoregulatory_feedback_factor (dimensionless)"
    legend_algebraic[219] = "AUMK in component autonomic_effect_on_AAR (dimensionless)"
    legend_constants[167] = "ARF in component kidney_parameter_values (dimensionless)"
    legend_algebraic[218] = "AUMKT in component autonomic_effect_on_AAR (dimensionless)"
    legend_algebraic[221] = "ANMAR in component angiotensin_effect_on_AAR (dimensionless)"
    legend_constants[168] = "ANMAM in component kidney_parameter_values (dimensionless)"
    legend_constants[169] = "ANMARL in component kidney_parameter_values (dimensionless)"
    legend_algebraic[220] = "ANMAR1 in component angiotensin_effect_on_AAR (dimensionless)"
    legend_algebraic[243] = "AAR1 in component AAR_calculation (mmHg_minute_per_L)"
    legend_constants[170] = "AARK in component kidney_parameter_values (mmHg_minute_per_L)"
    legend_algebraic[244] = "AAR in component atrial_natriuretic_peptide_effect_on_AAR (mmHg_minute_per_L)"
    legend_constants[171] = "ANPXAF in component kidney_parameter_values (mmHg_minute_per_L)"
    legend_constants[172] = "AARLL in component kidney_parameter_values (mmHg_minute_per_L)"
    legend_algebraic[245] = "AART in component atrial_natriuretic_peptide_effect_on_AAR (mmHg_minute_per_L)"
    legend_algebraic[222] = "AUMK2 in component autonomic_effect_on_EAR (dimensionless)"
    legend_constants[173] = "AUMK1 in component kidney_parameter_values (dimensionless)"
    legend_algebraic[223] = "ANMER in component angiotensin_effect_on_EAR (dimensionless)"
    legend_constants[174] = "ANMEM in component kidney_parameter_values (dimensionless)"
    legend_algebraic[246] = "RNAUG4 in component effect_of_renal_autoregulatory_feedback_on_EAR (dimensionless)"
    legend_constants[175] = "EFAFR in component kidney_parameter_values (dimensionless)"
    legend_algebraic[247] = "EAR in component EAR_calculation (mmHg_minute_per_L)"
    legend_constants[176] = "EARK in component kidney_parameter_values (mmHg_minute_per_L)"
    legend_constants[177] = "EARLL in component kidney_parameter_values (mmHg_minute_per_L)"
    legend_algebraic[248] = "EAR1 in component EAR_calculation (mmHg_minute_per_L)"
    legend_algebraic[249] = "RR in component total_renal_resistance (mmHg_minute_per_L)"
    legend_algebraic[250] = "RFN in component normal_renal_blood_flow (L_per_minute)"
    legend_constants[178] = "REK in component kidney_parameter_values (dimensionless)"
    legend_algebraic[251] = "GFN in component glomerular_filtration_rate (L_per_minute)"
    legend_algebraic[252] = "GLPC in component glomerular_colloid_osmotic_pressure (mmHg)"
    legend_constants[179] = "GPPD in component kidney_parameter_values (dimensionless)"
    legend_constants[180] = "GLPCA in component kidney_parameter_values (mmHg)"
    legend_algebraic[253] = "EFAFPR in component glomerular_colloid_osmotic_pressure (dimensionless)"
    legend_algebraic[254] = "EFAFPR1 in component glomerular_colloid_osmotic_pressure (dimensionless)"
    legend_algebraic[255] = "GLP in component glomerular_pressure (mmHg)"
    legend_algebraic[256] = "APD in component glomerular_pressure (mmHg)"
    legend_algebraic[266] = "GFR in component glomerular_filtration_rate (L_per_minute)"
    legend_constants[181] = "PXTP in component kidney_parameter_values (mmHg)"
    legend_constants[182] = "GFLC in component kidney_parameter_values (L_per_minute_per_mmHg)"
    legend_constants[183] = "GFNLL in component kidney_parameter_values (L_per_minute)"
    legend_algebraic[257] = "PFL in component glomerular_filtration_rate (mmHg)"
    legend_algebraic[258] = "GFN1 in component glomerular_filtration_rate (L_per_minute)"
    legend_constants[184] = "MDFL1 in component kidney_parameter_values (dimensionless)"
    legend_algebraic[259] = "PTFL in component proximal_tubular_and_macula_densa_flow (L_per_minute)"
    legend_algebraic[260] = "MDFLWT in component proximal_tubular_and_macula_densa_flow (L_per_minute)"
    legend_algebraic[274] = "RTSPPC in component renal_tissue_osmotic_pressure (mmHg)"
    legend_constants[185] = "RTPPR in component kidney_parameter_values (dimensionless)"
    legend_constants[186] = "RTPPRS in component kidney_parameter_values (mmHg)"
    legend_algebraic[267] = "RTSPPC1 in component renal_tissue_osmotic_pressure (mmHg)"
    legend_algebraic[318] = "UROD in component actual_urea_excretion_rate (mOsm_per_minute)"
    legend_states[41] = "PLUR in component glomerular_urea_concentration (mOsm)"
    legend_constants[187] = "URFORM in component kidney_parameter_values (mOsm_per_minute)"
    legend_algebraic[224] = "PLURC in component plasma_urea_concentration (mOsm_per_litre)"
    legend_algebraic[282] = "RCPRS in component peritubular_capillary_pressure (mmHg)"
    legend_constants[188] = "RFABX in component kidney_parameter_values (dimensionless)"
    legend_constants[189] = "RVRS in component kidney_parameter_values (mmHg_minute_per_L)"
    legend_algebraic[300] = "RFABD in component peritubular_capillary_reabsorption_factor (dimensionless)"
    legend_constants[190] = "RTSPRS in component kidney_parameter_values (mmHg)"
    legend_constants[191] = "RABSC in component kidney_parameter_values (per_mmHg)"
    legend_constants[192] = "RFABDP in component kidney_parameter_values (dimensionless)"
    legend_constants[193] = "RFABDM in component kidney_parameter_values (dimensionless)"
    legend_algebraic[292] = "RABSPR in component peritubular_capillary_reabsorption_factor (mmHg)"
    legend_algebraic[295] = "RFAB1 in component peritubular_capillary_reabsorption_factor (dimensionless)"
    legend_algebraic[297] = "RFAB in component peritubular_capillary_reabsorption_factor (dimensionless)"
    legend_algebraic[299] = "RFABD1 in component peritubular_capillary_reabsorption_factor (dimensionless)"
    legend_algebraic[301] = "DTNAI in component distal_tubular_Na_delivery (monovalent_mEq_per_minute)"
    legend_algebraic[303] = "DTNARA in component Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)"
    legend_constants[194] = "DTNAR in component kidney_parameter_values (monovalent_mEq_per_minute)"
    legend_constants[195] = "DIURET in component kidney_parameter_values (dimensionless)"
    legend_constants[196] = "AHMNAR in component kidney_parameter_values (dimensionless)"
    legend_constants[197] = "DTNARL in component kidney_parameter_values (monovalent_mEq_per_minute)"
    legend_algebraic[302] = "DTNARA1 in component Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)"
    legend_algebraic[226] = "DTNANG in component angiotensin_induced_Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)"
    legend_constants[198] = "ANMNAM in component kidney_parameter_values (dimensionless)"
    legend_algebraic[225] = "DTNANG1 in component angiotensin_induced_Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)"
    legend_algebraic[304] = "DTKI in component distal_tubular_K_delivery (monovalent_mEq_per_minute)"
    legend_algebraic[305] = "RFABK in component effect_of_physical_forces_on_distal_K_reabsorption (monovalent_mEq_per_minute)"
    legend_constants[199] = "RFABKM in component kidney_parameter_values (monovalent_mEq_per_minute)"
    legend_algebraic[307] = "MDFLK in component effect_of_fluid_flow_on_distal_K_reabsorption (monovalent_mEq_per_minute)"
    legend_constants[200] = "MDFLKM in component kidney_parameter_values (monovalent_mEq_per_litre)"
    legend_algebraic[306] = "MDFLK1 in component effect_of_fluid_flow_on_distal_K_reabsorption (monovalent_mEq_per_minute)"
    legend_algebraic[314] = "KODN in component normal_K_excretion (monovalent_mEq_per_minute)"
    legend_algebraic[323] = "VUDN in component normal_urine_volume (L_per_minute)"
    legend_states[42] = "DTKA in component K_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)"
    legend_algebraic[308] = "DTKSC in component K_secretion_from_distal_tubules (monovalent_mEq_per_minute)"
    legend_constants[201] = "ANMKEM in component kidney_parameter_values (dimensionless)"
    legend_constants[202] = "ANMKEL in component kidney_parameter_values (dimensionless)"
    legend_constants[203] = "CKEEX in component kidney_parameter_values (dimensionless)"
    legend_algebraic[227] = "ANMKE1 in component K_secretion_from_distal_tubules (dimensionless)"
    legend_algebraic[228] = "ANMKE in component K_secretion_from_distal_tubules (dimensionless)"
    legend_algebraic[310] = "NODN in component normal_Na_excretion (monovalent_mEq_per_minute)"
    legend_algebraic[309] = "NODN1 in component normal_Na_excretion (monovalent_mEq_per_minute)"
    legend_algebraic[312] = "KODN1 in component normal_K_excretion (monovalent_mEq_per_minute)"
    legend_algebraic[316] = "DTURI in component normal_urea_excretion (mOsm_per_minute)"
    legend_algebraic[319] = "OSMOPN1 in component normal_osmolar_and_water_excretion (mOsm_per_minute)"
    legend_algebraic[320] = "OSMOPN in component normal_osmolar_and_water_excretion (mOsm_per_minute)"
    legend_algebraic[321] = "OSMOP1T in component normal_urine_volume (mOsm_per_minute)"
    legend_algebraic[322] = "OSMOP1 in component normal_urine_volume (mOsm_per_minute)"
    legend_constants[204] = "RNAGTC in component kidney_parameter_values (minute)"
    legend_constants[205] = "GFNDMP in component kidney_parameter_values (dimensionless)"
    legend_rates[0] = "d/dt AMC in component aldosterone_concentration (dimensionless)"
    legend_rates[1] = "d/dt ANX1 in component time_delayed_angiotensin_formation (dimensionless)"
    legend_rates[2] = "d/dt ANC in component angiotensin_concentration (dimensionless)"
    legend_rates[3] = "d/dt ADHC in component ADH_in_blood (dimensionless)"
    legend_rates[4] = "d/dt ANPC in component ANP_in_plasma (dimensionless)"
    legend_rates[5] = "d/dt AU6 in component arterial_baroreceptor_reflex (dimensionless)"
    legend_rates[6] = "d/dt AU1 in component actual_autonomic_stimulation (dimensionless)"
    legend_rates[7] = "d/dt VP in component plasma_volume (litre)"
    legend_rates[8] = "d/dt PRP in component total_plasma_protein (gram)"
    legend_rates[9] = "d/dt VTS2 in component interstitial_fluid_volume (litre)"
    legend_rates[10] = "d/dt TSP in component total_interstitial_protein (gram)"
    legend_rates[20] = "d/dt VRA1 in component right_atrial_blood_volume (litre)"
    legend_rates[19] = "d/dt VPA1 in component pulmonary_vasculature_blood_volume (litre)"
    legend_rates[18] = "d/dt VLA1 in component left_atrial_blood_volume (litre)"
    legend_rates[16] = "d/dt VVS1 in component venous_blood_volume (litre)"
    legend_rates[17] = "d/dt VAS1 in component arterial_blood_volume (litre)"
    legend_rates[23] = "d/dt NAE in component extracellular_Na_concentration (monovalent_mEq)"
    legend_rates[24] = "d/dt KTOT in component extracellular_K_concentration (monovalent_mEq)"
    legend_rates[25] = "d/dt VIC in component intracellular_fluid_volume (litre)"
    legend_rates[22] = "d/dt VTW in component total_body_water (litre)"
    legend_rates[11] = "d/dt HPL in component left_ventricular_hypertrophy (dimensionless)"
    legend_rates[12] = "d/dt HPR in component right_ventricular_hypertrophy (dimensionless)"
    legend_rates[26] = "d/dt HMD1 in component heart_deterioration (dimensionless)"
    legend_rates[27] = "d/dt AMM1T in component M_ST_time_delay_and_limit (dimensionless)"
    legend_rates[28] = "d/dt AMM2 in component M_LT_time_delay (dimensionless)"
    legend_rates[30] = "d/dt QOM1 in component volume_of_O2_in_M_tissue (mL)"
    legend_rates[31] = "d/dt AR1T in component NM_ST_time_delay_and_damping (dimensionless)"
    legend_rates[32] = "d/dt AR2T in component NM_I_time_delay_and_limit (dimensionless)"
    legend_rates[33] = "d/dt AR3T in component NM_LT_time_delay_and_limit (dimensionless)"
    legend_rates[34] = "d/dt QO2T in component volume_of_O2_in_NM_tissue (mL)"
    legend_rates[35] = "d/dt VPF1 in component pulmonary_interstitial_free_fluid_volume (litre)"
    legend_rates[36] = "d/dt PPR1 in component concentration_of_protein_in_pulmonary_interstitium (gram)"
    legend_rates[29] = "d/dt OVA in component O2_volume_of_arterial_blood (mL_per_L)"
    legend_rates[37] = "d/dt O2VAD1 in component progressive_chemoreceptor_adaptation_of_alveolar_ventilation (dimensionless)"
    legend_rates[13] = "d/dt VRC in component RBC_volume (litre)"
    legend_rates[15] = "d/dt VV7 in component short_term_stress_relaxation (litre)"
    legend_rates[14] = "d/dt VV6 in component long_term_stress_relaxation (litre)"
    legend_rates[21] = "d/dt TVD in component rate_of_fluid_intake (L_per_minute)"
    legend_rates[38] = "d/dt AHY in component time_dependent_volume_receptor_adaptation (dimensionless)"
    legend_rates[39] = "d/dt PAR1 in component perfusion_pressure (mmHg)"
    legend_rates[40] = "d/dt RNAUG3 in component renal_autoregulatory_feedback_factor (dimensionless)"
    legend_rates[41] = "d/dt PLUR in component glomerular_urea_concentration (mOsm)"
    legend_rates[42] = "d/dt DTKA in component K_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)"
    return (legend_states, legend_algebraic, legend_voi, legend_constants)

def initConsts():
    constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
    constants[0] = 1.0
    constants[1] = 1.0
    constants[2] = 1.0
    constants[3] = 2.5
    constants[4] = 12
    constants[5] = 0
    constants[6] = 0
    states[0] = 1.0
    constants[7] = 60
    constants[8] = 5
    constants[9] = 0
    constants[10] = 0.65
    constants[11] = 2.5
    constants[12] = 0.5
    constants[13] = 0.8
    constants[14] = 15
    constants[15] = 0.04
    states[1] = 0.0
    constants[16] = 0
    constants[17] = 5000
    constants[18] = 1
    constants[19] = 0
    constants[20] = 0
    states[2] = 0.859476
    constants[21] = 12
    constants[22] = 1.8
    constants[23] = 0.7
    constants[24] = 0.4
    constants[25] = 6
    constants[26] = 0.8
    constants[27] = 0
    constants[28] = 5
    states[3] = 1.0
    constants[29] = 139
    constants[30] = 85
    constants[31] = 0.3
    constants[32] = 0
    constants[33] = 15
    constants[34] = 2.5
    constants[35] = 0.93617
    constants[36] = 0.2
    constants[37] = 5
    constants[38] = 0
    constants[39] = 0
    states[4] = 1.0
    constants[40] = 4
    constants[41] = 10
    constants[42] = 0
    constants[43] = 0
    constants[44] = 0.3
    constants[45] = 0.01
    constants[46] = 1
    constants[47] = 0.004
    constants[48] = 0.16
    constants[49] = -0.060024
    states[5] = 1.00132
    constants[50] = 0.5
    constants[51] = 0
    constants[52] = 1
    constants[53] = 1.0
    constants[54] = 0.01
    constants[55] = 0.3
    constants[56] = 5.0
    constants[57] = 0.4
    constants[58] = 1.5
    states[6] = 1.00007
    constants[59] = 2.51
    constants[60] = 1.5
    constants[61] = 0.55
    constants[62] = 1
    constants[63] = 0.1
    constants[64] = 3
    constants[65] = 1
    constants[66] = 0
    constants[67] = 0
    states[7] = 3.00449
    constants[68] = 0.01167
    constants[69] = 0
    states[8] = 216.243
    constants[70] = 40
    constants[71] = 0.03
    constants[72] = 8
    constants[73] = 2.728e-14
    constants[74] = 15
    constants[75] = 0.000253
    constants[76] = 1
    constants[77] = 0.15
    constants[78] = 0.005
    states[9] = 0.0
    states[10] = 279.945
    constants[79] = 60
    constants[80] = 2
    constants[81] = -2
    constants[82] = 0.8092
    constants[83] = 6
    constants[84] = 4.2
    states[11] = 1.00163
    states[12] = 1.00237
    states[13] = 2.00439
    states[14] = 0.0101913
    states[15] = 0.00366525
    states[16] = 3.28246
    states[17] = 0.862514
    states[18] = 0.379883
    states[19] = 0.38131
    states[20] = 0.100043
    constants[85] = 0.4
    constants[86] = 0.15
    constants[87] = 1
    constants[88] = 1
    constants[89] = -0.2
    constants[90] = 0.1
    constants[91] = 0
    constants[92] = 0.2
    constants[93] = 0.0212
    constants[94] = 1
    constants[95] = 2
    constants[96] = 30.52
    constants[97] = 1
    constants[98] = 96.3
    constants[99] = 0
    states[21] = 0.000980838
    states[22] = 39.8952
    constants[100] = 0.1
    constants[101] = 0
    states[23] = 2109.91
    constants[102] = 0.3
    states[24] = 3622.54
    constants[103] = 0.08
    states[25] = 25.0404
    constants[104] = 0.01
    constants[105] = 1
    constants[106] = 0.625
    constants[107] = 1
    constants[108] = 0.05
    states[26] = 1.0
    constants[109] = 0
    constants[110] = 0.04
    constants[111] = 0.1
    constants[112] = 0.005
    states[27] = 1.00269
    constants[113] = 2
    states[28] = 1.09071
    constants[114] = 40000
    states[29] = 204.497
    constants[115] = 1
    constants[116] = 0.17
    constants[117] = 57.1
    constants[118] = 30
    states[30] = 48.0839
    constants[119] = 0.79167
    constants[120] = 35
    constants[121] = 0.1
    constants[122] = 0.5
    states[31] = 1.02127
    constants[123] = 0.1
    constants[124] = 60
    states[32] = 1.01179
    constants[125] = 2
    constants[126] = 40000
    states[33] = 1.1448
    constants[127] = 0.9
    constants[128] = 164
    states[34] = 72.2362
    constants[129] = 0.0003
    states[35] = 0.0123238
    states[36] = 0.419998
    constants[130] = 1
    constants[131] = 150
    constants[132] = 1.8
    constants[133] = 0.0175
    states[37] = 2.368e-07
    constants[134] = 90
    constants[135] = 0.53333
    constants[136] = 150
    constants[137] = 1850
    constants[138] = 4.714e-08
    constants[139] = 1
    constants[140] = 5.8e-06
    constants[141] = 0
    constants[142] = 1
    constants[143] = 5
    constants[144] = 1
    constants[145] = 10000
    constants[146] = 2
    constants[147] = 45
    constants[148] = 0.01
    constants[149] = 2
    constants[150] = 1.5
    constants[151] = 0
    constants[152] = 30
    constants[153] = 0.333
    constants[154] = 1
    states[38] = 0.301963
    constants[155] = 1000
    constants[156] = 0
    constants[157] = 0
    constants[158] = 0
    constants[159] = 0
    constants[160] = 0
    constants[161] = 0
    constants[162] = 2000
    states[39] = 103.525
    constants[163] = 0.6
    constants[164] = 0.3
    constants[165] = 10
    constants[166] = 0
    states[40] = 0.0
    constants[167] = 0.5
    constants[168] = 1.4
    constants[169] = 0.86
    constants[170] = 1
    constants[171] = 1.5
    constants[172] = 4
    constants[173] = 0.3
    constants[174] = 1.6
    constants[175] = 0
    constants[176] = 1
    constants[177] = 24
    constants[178] = 1
    constants[179] = 1.0
    constants[180] = 1.0
    constants[181] = 8
    constants[182] = 0.0208333
    constants[183] = 0.001
    constants[184] = 10
    constants[185] = 0.9
    constants[186] = 15.2
    states[41] = 159.549
    constants[187] = 0.24
    constants[188] = 0.8
    constants[189] = 19.167
    constants[190] = 6
    constants[191] = 0.5
    constants[192] = 1
    constants[193] = 0.3
    constants[194] = 0.675
    constants[195] = 1
    constants[196] = 0.3
    constants[197] = 1e-06
    constants[198] = 1
    constants[199] = 0.03
    constants[200] = 0.667
    states[42] = 0.0367573
    constants[201] = 2
    constants[202] = 0.3
    constants[203] = 4
    constants[204] = 15
    constants[205] = 3
    constants[206] = power(constants[52], constants[53])
    constants[207] = (power(constants[109], 0.500000))*5.00000
    constants[208] = custom_piecewise([greater(constants[136] , 80.0000), 80.0000 , True, constants[136]])
    constants[209] = constants[136]-40.0000
    return (states, constants)

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    algebraic[31] = ((((((states[7]+states[13])-states[16])-states[17])-states[18])-states[19])-states[20])/2.00000
    algebraic[45] = states[18]+algebraic[31]*0.128000
    algebraic[46] = algebraic[45]-0.380000
    algebraic[47] = algebraic[46]/0.0100000
    algebraic[48] = custom_piecewise([less((algebraic[47]-1.00000)*1.00000 , 0.00000), 0.00000 , True, (algebraic[47]-1.00000)*1.00000])
    algebraic[32] = states[20]+algebraic[31]*0.0574000
    algebraic[33] = algebraic[32]-0.100000
    algebraic[34] = algebraic[33]/0.00500000
    algebraic[35] = custom_piecewise([less((algebraic[34]+1.00000)*2.00000 , 0.00000), 0.00000 , True, (algebraic[34]+1.00000)*2.00000])
    algebraic[50] = (algebraic[48]+algebraic[35])/3.00000
    algebraic[52] = custom_piecewise([greater(constants[38] , 0.00000), constants[38] , True, algebraic[50]+constants[39]])
    rates[4] = (algebraic[52]-states[4])/constants[40]
    algebraic[62] = states[17]+algebraic[31]*0.261000
    algebraic[63] = algebraic[62]-0.495000
    algebraic[64] = algebraic[63]/0.00355000
    rates[39] = ((100.000+(algebraic[64]-100.000)*constants[161])-states[39])/constants[162]
    algebraic[65] = custom_piecewise([greater(constants[42] , 1.00000e-07), constants[42] , True, algebraic[64]-constants[43]])
    algebraic[66] = custom_piecewise([less(algebraic[65] , 160.000) & greater_equal(algebraic[65] , 80.0000), 0.0166670*(160.000-algebraic[65]) , less(algebraic[65] , 80.0000), 1.33360 , True, 0.00000])
    algebraic[68] = (algebraic[66]-1.00000)*constants[46]+1.00000
    algebraic[70] = algebraic[68]-constants[49]
    rates[5] = (algebraic[70]-states[5])/constants[48]
    algebraic[81] = states[22]-states[25]
    algebraic[82] = states[23]/algebraic[81]
    algebraic[0] = constants[8]-(constants[8]-1.00000)/(((constants[9]-1.00000)/(constants[9]-constants[8]))*(states[0]-1.00000)*constants[10]+1.00000)
    algebraic[1] = (algebraic[0]-1.00000)*constants[11]+1.00000
    algebraic[2] = (algebraic[1]-1.00000)*constants[12]+1.00000
    algebraic[3] = custom_piecewise([less(algebraic[2] , 0.200000), 0.200000 , True, algebraic[2]])
    algebraic[77] = (algebraic[3]-1.00000)*constants[102]+1.00000
    algebraic[78] = (states[24]-3000.00)/(algebraic[77]*9.33330)
    algebraic[79] = states[24]-algebraic[78]
    algebraic[80] = algebraic[79]/states[25]
    algebraic[85] = algebraic[80]-algebraic[82]
    algebraic[89] = algebraic[85]*constants[104]
    rates[25] = algebraic[89]
    algebraic[83] = (algebraic[82]-constants[29])/(142.000-constants[29])
    algebraic[87] = custom_piecewise([less(algebraic[83] , 0.00000), 0.00000 , True, algebraic[83]])
    algebraic[67] = custom_piecewise([greater(algebraic[65] , constants[30]), constants[30] , True, algebraic[65]])
    algebraic[69] = (power(constants[30]-algebraic[67], 2.00000))*constants[31]
    algebraic[91] = algebraic[87]+algebraic[69]+constants[32]
    algebraic[94] = custom_piecewise([less(algebraic[91] , 0.00000), 0.00000 , True, algebraic[91]])
    rates[3] = (algebraic[94]-states[3])/constants[33]
    algebraic[6] = constants[22]-(constants[22]-1.00000)/(((constants[23]-1.00000)/(constants[23]-constants[22]))*(states[2]-1.00000)*constants[24]+1.00000)
    algebraic[7] = (algebraic[6]-1.00000)*constants[3]+1.00000
    algebraic[84] = algebraic[78]/algebraic[81]
    algebraic[86] = (algebraic[84]-3.30000)/1.00000
    algebraic[90] = algebraic[7]*0.909000*algebraic[86]
    algebraic[93] = (algebraic[90]-1.00000)*constants[4]+1.00000
    algebraic[96] = custom_piecewise([less(algebraic[93] , 0.00000), 0.00000 , True, algebraic[93]])
    algebraic[98] = custom_piecewise([greater(constants[6] , 0.00000), constants[6] , True, algebraic[96]+constants[5]])
    rates[0] = (algebraic[98]-states[0])/constants[7]
    algebraic[101] = custom_piecewise([less(states[30] , 0.000100000), 0.000100000 , True, states[30]])
    algebraic[102] = constants[119]*algebraic[101]
    algebraic[104] = algebraic[102]-38.0000
    algebraic[106] = algebraic[104]*constants[110]+1.00000
    rates[27] = (algebraic[106]*1.00000-states[27])/constants[111]
    algebraic[107] = constants[113]*algebraic[104]+1.00000
    rates[28] = (algebraic[107]*1.00000-states[28])/constants[114]
    algebraic[113] = custom_piecewise([less(states[34] , 0.00000), 0.00000 , True, states[34]])
    algebraic[114] = algebraic[113]*0.486110
    algebraic[116] = (algebraic[114]-10.0000)*constants[108]
    rates[26] = algebraic[116]
    algebraic[117] = algebraic[114]-constants[120]
    algebraic[119] = algebraic[117]*constants[121]+1.00000
    rates[31] = (algebraic[119]*1.00000-states[31])/constants[122]
    algebraic[120] = constants[123]*algebraic[117]+1.00000
    rates[32] = (algebraic[120]*1.00000-states[32])/constants[124]
    algebraic[121] = constants[125]*algebraic[117]+1.00000
    rates[33] = (algebraic[121]*1.00000-states[33])/constants[126]
    algebraic[123] = custom_piecewise([less(states[35] , 0.00100000), 0.00100000 , True, states[35]])
    algebraic[124] = (algebraic[81]-states[7])-algebraic[123]
    rates[9] = ((algebraic[124]-12.0000)*constants[77]-states[9])*constants[78]
    algebraic[27] = states[8]/states[7]
    algebraic[30] = 0.280000*algebraic[27]+0.00190000*(power(algebraic[27], 2.00000))
    algebraic[38] = states[19]+algebraic[31]*0.155000
    algebraic[39] = algebraic[38]-0.306250
    algebraic[40] = algebraic[39]/0.00480000
    algebraic[41] = 0.0260000*algebraic[40]
    algebraic[42] = custom_piecewise([less(algebraic[41] , 1.00000e-05), 1.00000e-05 , True, algebraic[41]])
    algebraic[43] = power(algebraic[42], 0.500000)
    algebraic[44] = 1.00000/algebraic[43]
    algebraic[51] = algebraic[47]+18.0000
    algebraic[53] = 1.00000/(algebraic[51]*0.0357000)
    algebraic[122] = ((algebraic[40]-algebraic[47])*algebraic[53])/(algebraic[53]+algebraic[44])+algebraic[47]
    algebraic[142] = custom_piecewise([less(states[36] , 0.0250000), 0.0250000 , True, states[36]])
    algebraic[143] = algebraic[142]/algebraic[123]
    algebraic[144] = algebraic[143]*0.400000
    algebraic[141] = 2.00000-0.150000/algebraic[123]
    algebraic[145] = (((algebraic[122]-algebraic[141])+algebraic[144])-algebraic[30])*constants[129]
    algebraic[147] = (algebraic[141]+11.0000)*0.000300000
    algebraic[148] = algebraic[145]-algebraic[147]
    algebraic[149] = algebraic[148]
    rates[35] = algebraic[149]
    algebraic[150] = algebraic[147]*algebraic[143]
    algebraic[146] = (algebraic[27]-algebraic[143])*0.000225000
    algebraic[151] = algebraic[146]-algebraic[150]
    algebraic[152] = algebraic[151]
    rates[36] = algebraic[152]
    algebraic[18] = constants[56]-(constants[56]-1.00000)/exp(constants[58]*(states[6]-1.00000))
    algebraic[19] = custom_piecewise([less(algebraic[18] , constants[57]), constants[57] , True, algebraic[18]])
    algebraic[21] = algebraic[19]-1.00000
    algebraic[22] = algebraic[21]*constants[61]+1.00000
    algebraic[88] = custom_piecewise([greater(states[26] , 1.00000), 1.00000 , True, states[26]])
    algebraic[57] = (algebraic[47]+4.00000)*(constants[85]*(algebraic[19]-1.00000)+1.00000)-4.00000
    algebraic[58] = custom_piecewise([less_equal(algebraic[57] , -2.00000), 0.0100000 , greater(algebraic[57] , -2.00000) & less_equal(algebraic[57] , 1.00000), 0.0100000+((3.60000-0.0100000)*(algebraic[57]--2.00000))/(1.00000--2.00000) , greater(algebraic[57] , 1.00000) & less_equal(algebraic[57] , 5.00000), 3.60000+((9.40000-3.60000)*(algebraic[57]-1.00000))/(5.00000-1.00000) , greater(algebraic[57] , 5.00000) & less_equal(algebraic[57] , 8.00000), 9.40000+((11.6000-9.40000)*(algebraic[57]-5.00000))/(8.00000-5.00000) , greater(algebraic[57] , 8.00000) & less_equal(algebraic[57] , 12.0000), 11.6000+((13.5000-11.6000)*(algebraic[57]-8.00000))/(12.0000-8.00000) , True, 13.5000])
    algebraic[155] = states[7]+states[13]
    algebraic[156] = states[13]/algebraic[155]
    algebraic[157] = 100.000*algebraic[156]
    algebraic[158] = (states[29]/algebraic[157])/5.25000
    algebraic[161] = algebraic[64]/(algebraic[22]*algebraic[158])
    algebraic[162] = custom_piecewise([less_equal(algebraic[161] , 0.00000), 1.04000 , greater(algebraic[161] , 0.00000) & less_equal(algebraic[161] , 60.0000), 1.04000+((1.02500-1.04000)*(algebraic[161]-0.00000))/(60.0000-0.00000) , greater(algebraic[161] , 60.0000) & less_equal(algebraic[161] , 125.000), 1.02500+((0.970000-1.02500)*(algebraic[161]-60.0000))/(125.000-60.0000) , greater(algebraic[161] , 125.000) & less_equal(algebraic[161] , 160.000), 0.970000+((0.880000-0.970000)*(algebraic[161]-125.000))/(160.000-125.000) , greater(algebraic[161] , 160.000) & less_equal(algebraic[161] , 200.000), 0.880000+((0.590000-0.880000)*(algebraic[161]-160.000))/(200.000-160.000) , greater(algebraic[161] , 200.000) & less_equal(algebraic[161] , 240.000), 0.590000+((0.00000-0.590000)*(algebraic[161]-200.000))/(240.000-200.000) , True, 0.00000])
    algebraic[163] = algebraic[162]*algebraic[58]*algebraic[22]*constants[88]*algebraic[88]*states[11]
    algebraic[73] = (algebraic[47]-algebraic[64])/3.00000
    algebraic[164] = custom_piecewise([greater(algebraic[73] , 0.00000), algebraic[163]+algebraic[73] , True, algebraic[163]])
    algebraic[54] = algebraic[53]+algebraic[44]
    algebraic[55] = algebraic[40]-algebraic[47]
    algebraic[56] = algebraic[55]/algebraic[54]
    algebraic[166] = algebraic[56]-algebraic[164]
    rates[18] = algebraic[166]
    algebraic[159] = (algebraic[40]/algebraic[22])/algebraic[158]
    algebraic[160] = custom_piecewise([less_equal(algebraic[159] , 0.00000), 1.06000 , greater(algebraic[159] , 0.00000) & less_equal(algebraic[159] , 32.0000), 1.06000+((0.970000-1.06000)*(algebraic[159]-0.00000))/(32.0000-0.00000) , greater(algebraic[159] , 32.0000) & less_equal(algebraic[159] , 38.4000), 0.970000+((0.930000-0.970000)*(algebraic[159]-32.0000))/(38.4000-32.0000) , greater(algebraic[159] , 38.4000) & less_equal(algebraic[159] , 48.0000), 0.930000+((0.800000-0.930000)*(algebraic[159]-38.4000))/(48.0000-38.4000) , greater(algebraic[159] , 48.0000) & less_equal(algebraic[159] , 60.8000), 0.800000+((0.460000-0.800000)*(algebraic[159]-48.0000))/(60.8000-48.0000) , greater(algebraic[159] , 60.8000) & less_equal(algebraic[159] , 72.0000), 0.460000+((0.00000-0.460000)*(algebraic[159]-60.8000))/(72.0000-60.8000) , True, 0.00000])
    algebraic[165] = (1.00000-constants[86])*algebraic[22]*algebraic[160]*constants[87]*algebraic[88]*states[12]+(constants[86]*algebraic[164])/algebraic[58]
    algebraic[36] = (algebraic[34]+8.00000)*(constants[85]*(algebraic[19]-1.00000)+1.00000)-8.00000
    algebraic[37] = custom_piecewise([less_equal(algebraic[36] , -8.00000), 0.00000 , greater(algebraic[36] , -8.00000) & less_equal(algebraic[36] , -6.00000), 0.00000+((0.750000-0.00000)*(algebraic[36]--8.00000))/(-6.00000--8.00000) , greater(algebraic[36] , -6.00000) & less_equal(algebraic[36] , -2.00000), 0.750000+((2.60000-0.750000)*(algebraic[36]--6.00000))/(-2.00000--6.00000) , greater(algebraic[36] , -2.00000) & less_equal(algebraic[36] , 4.00000), 2.60000+((9.80000-2.60000)*(algebraic[36]--2.00000))/(4.00000--2.00000) , greater(algebraic[36] , 4.00000) & less_equal(algebraic[36] , 12.0000), 9.80000+((13.5000-9.80000)*(algebraic[36]-4.00000))/(12.0000-4.00000) , True, 13.5000])
    algebraic[168] = algebraic[37]*algebraic[165]
    algebraic[170] = algebraic[168]-algebraic[56]
    rates[19] = algebraic[170]
    algebraic[169] = custom_piecewise([greater(algebraic[158] , 1.00000), 114.000+(algebraic[158]-1.00000)*6667.00 , greater(algebraic[158] , 0.936000) & less_equal(algebraic[158] , 1.00000), 74.0000+(algebraic[158]-0.936000)*625.000 , greater(algebraic[158] , 0.800000) & less_equal(algebraic[158] , 0.936000), 46.0000+(algebraic[158]-0.800000)*205.882 , True, algebraic[158]*57.5000])
    algebraic[172] = (algebraic[169]-67.0000)/30.0000
    algebraic[174] = custom_piecewise([greater(algebraic[172] , 1.00000), 1.00000 , less(algebraic[172] , 0.600000), 0.600000 , True, algebraic[172]])
    algebraic[176] = 1.00000/algebraic[174]
    algebraic[179] = ((algebraic[176]-1.00000)*3.00000-states[37])*0.000500000
    rates[37] = algebraic[179]
    algebraic[71] = custom_piecewise([less(algebraic[65] , 80.0000) & greater_equal(algebraic[65] , 40.0000), 0.00500000*(80.0000-algebraic[65])*constants[44] , less(algebraic[65] , 40.0000), 0.200000*constants[44] , True, 0.00000])
    algebraic[171] = custom_piecewise([less(algebraic[169] , 80.0000) & greater_equal(algebraic[169] , 40.0000), constants[45]*(80.0000-algebraic[169]) , less(algebraic[169] , 40.0000), constants[45]*40.0000 , True, 0.00000])
    algebraic[173] = algebraic[71]+algebraic[171]
    algebraic[17] = states[5]
    algebraic[72] = custom_piecewise([less(algebraic[65] , 40.0000), 0.0400000*(40.0000-algebraic[65])*constants[50] , True, 0.00000])
    algebraic[49] = (15.0000/(algebraic[47]+algebraic[34]+algebraic[40])-1.00000)*constants[51]+1.00000
    algebraic[175] = (constants[206]*algebraic[49]*(algebraic[173]+algebraic[17]+algebraic[72])-1.00000)*constants[54]+1.00000
    algebraic[177] = custom_piecewise([less(algebraic[175] , 0.00000), 0.00000 , True, algebraic[175]])
    algebraic[180] = (algebraic[177]-states[6])/constants[55]
    rates[6] = algebraic[180]
    algebraic[189] = (power(fabs(algebraic[34]), constants[153]))*constants[154]
    algebraic[192] = custom_piecewise([less(algebraic[34] , 0.00000), -algebraic[189] , True, algebraic[189]])
    rates[38] = (algebraic[192]-states[38])/constants[155]
    algebraic[184] = (constants[208]-40.0000)*algebraic[157]
    algebraic[186] = custom_piecewise([less(algebraic[184]+constants[209] , 0.00000), 0.00000 , True, algebraic[184]+constants[209]])
    algebraic[188] = constants[137]-algebraic[186]
    algebraic[190] = custom_piecewise([less(algebraic[188]*constants[138]*constants[139]+5.00000e-06 , 0.00000), 0.00000 , True, algebraic[188]*constants[138]*constants[139]+5.00000e-06])
    algebraic[178] = algebraic[157]/((constants[134]-algebraic[157])*constants[135])
    algebraic[181] = algebraic[178]+1.50000
    algebraic[182] = 0.333300*algebraic[181]
    algebraic[193] = states[13]*constants[140]*algebraic[182]
    algebraic[196] = (algebraic[190]-algebraic[193])+constants[141]
    rates[13] = algebraic[196]
    algebraic[194] = (algebraic[6]-1.00000)*constants[150]*0.00100000
    algebraic[183] = (algebraic[6]-1.00000)*constants[146]+1.00000
    algebraic[185] = (power(constants[147]-algebraic[114], 2.00000))*constants[148]*algebraic[183]
    algebraic[187] = custom_piecewise([less(algebraic[185] , 0.800000), 0.800000 , greater(algebraic[185] , 8.00000), 8.00000 , True, algebraic[185]])
    algebraic[191] = (states[3]-1.00000)*constants[149]+1.00000
    algebraic[197] = algebraic[191]*algebraic[187]*0.00100000
    algebraic[199] = custom_piecewise([less(algebraic[197] , 0.00000), 0.00000 , True, algebraic[197]])
    algebraic[201] = (algebraic[194]+algebraic[199])*1.00000
    algebraic[203] = custom_piecewise([less(algebraic[201] , 0.00000), 0.00000 , True, algebraic[201]])
    rates[21] = ((algebraic[203]+constants[151])-states[21])/constants[152]
    algebraic[20] = (constants[59]-algebraic[19]*constants[60])+constants[60]
    algebraic[195] = algebraic[192]-states[38]
    algebraic[205] = algebraic[195]*constants[157]
    algebraic[59] = states[16]+algebraic[31]*0.398600
    algebraic[8] = (algebraic[6]-1.00000)*constants[25]+1.00000
    algebraic[9] = custom_piecewise([less(algebraic[8] , constants[26]), constants[26] , True, algebraic[8]])
    algebraic[60] = (algebraic[9]-1.00000)*constants[89]
    algebraic[206] = ((((algebraic[59]-algebraic[20])-algebraic[60])-states[15])-states[14])-algebraic[205]
    algebraic[207] = custom_piecewise([less(algebraic[206] , 0.000100000), 0.000100000 , True, algebraic[206]])
    rates[15] = ((algebraic[207]-0.740000)*constants[142]-states[15])/constants[143]
    rates[14] = ((algebraic[207]-0.740000)*constants[144]-states[14])/constants[145]
    algebraic[208] = 3.70000+(algebraic[207]-0.740000)/constants[90]
    algebraic[209] = custom_piecewise([less(algebraic[208] , 0.000100000), 0.000100000 , True, algebraic[208]])
    algebraic[210] = 0.740000/(power(algebraic[209]/(algebraic[182]*3.70000), 0.500000))
    algebraic[61] = custom_piecewise([less(algebraic[34] , constants[91]), constants[91] , True, algebraic[34]])
    algebraic[211] = algebraic[209]-algebraic[61]
    algebraic[212] = algebraic[211]/algebraic[210]
    algebraic[214] = algebraic[212]-algebraic[168]
    rates[20] = algebraic[214]
    algebraic[213] = algebraic[64]-algebraic[209]
    algebraic[99] = custom_piecewise([less(states[27] , constants[112]), constants[112] , True, states[27]])
    algebraic[100] = algebraic[99]*states[28]
    algebraic[11] = constants[34]-(constants[34]-1.00000)/(((constants[35]-1.00000)/(constants[35]-constants[34]))*(states[3]-1.00000)+1.00000)
    algebraic[12] = custom_piecewise([less(algebraic[11] , constants[35]), constants[35] , True, algebraic[11]])
    algebraic[25] = power(algebraic[21]*constants[64]+1.00000, constants[65])
    algebraic[198] = algebraic[195]*constants[156]+1.00000
    algebraic[75] = power(algebraic[64]/100.000, constants[95])
    algebraic[200] = ((algebraic[9]*algebraic[12]*algebraic[25]*algebraic[182]*constants[1])/algebraic[75])/algebraic[198]
    algebraic[204] = constants[98]*algebraic[100]*algebraic[200]*constants[0]*constants[97]
    algebraic[215] = algebraic[213]/algebraic[204]
    algebraic[216] = states[29]*algebraic[215]
    rootfind_0(voi, constants, rates, states, algebraic)
    algebraic[24] = algebraic[21]*constants[63]+1.00000
    algebraic[103] = custom_piecewise([greater(algebraic[102] , 38.0000), 38.0000 , True, algebraic[102]])
    algebraic[105] = algebraic[24]*constants[117]*constants[115]*(1.00000-(power(38.0001-algebraic[103], 3.00000))/54872.0)
    algebraic[261] = algebraic[229]-algebraic[105]
    rates[30] = algebraic[261]
    algebraic[10] = (algebraic[9]-1.00000)*constants[27]+1.00000
    algebraic[15] = constants[41]-constants[41]/(0.555556*(1.00000+states[4]))
    algebraic[16] = custom_piecewise([less(algebraic[15] , -1.00000), -1.00000 , True, algebraic[15]])
    algebraic[26] = algebraic[21]*constants[66]+1.00000
    algebraic[108] = custom_piecewise([less(states[31] , 0.500000), 0.500000 , True, states[31]])
    algebraic[109] = custom_piecewise([less(states[32] , 0.500000), 0.500000 , True, states[32]])
    algebraic[110] = custom_piecewise([less(states[33] , 0.300000), 0.300000 , True, states[33]])
    algebraic[111] = algebraic[108]*algebraic[109]*algebraic[110]
    algebraic[112] = (algebraic[111]-1.00000)*constants[127]+1.00000
    algebraic[202] = constants[96]*algebraic[112]*algebraic[200]*constants[0]*constants[97]
    algebraic[217] = custom_piecewise([greater(constants[159] , 0.00000) & less_equal(constants[160] , 0.00000), constants[159] , greater(constants[160] , 0.00000), states[39] , True, algebraic[64]-constants[158]])
    algebraic[218] = (algebraic[25]-1.00000)*constants[167]+1.00000
    algebraic[219] = custom_piecewise([less(algebraic[218] , 0.800000), 0.800000 , True, algebraic[218]])
    algebraic[220] = (algebraic[6]-1.00000)*constants[168]+1.00000
    algebraic[221] = custom_piecewise([less(algebraic[220] , constants[169]), constants[169] , True, algebraic[220]])
    algebraic[222] = (algebraic[219]-1.00000)*constants[173]+1.00000
    algebraic[223] = (algebraic[6]-1.00000)*constants[174]+1.00000
    rootfind_1(voi, constants, rates, states, algebraic)
    rates[40] = (algebraic[240]-1.00000)*constants[166]
    algebraic[262] = algebraic[232]
    algebraic[268] = custom_piecewise([greater(algebraic[262] , 1.00000), 1.00000/(1.00000+(algebraic[262]-1.00000)*72.0000) , True, 10.0000-9.00000/(1.00000+(1.00000-algebraic[262])*8.00000)])
    algebraic[275] = (algebraic[268]-1.00000)*constants[16]
    rates[1] = (algebraic[275]-states[1])/constants[17]
    algebraic[74] = algebraic[64]-algebraic[34]
    algebraic[76] = algebraic[74]*constants[99]
    algebraic[264] = constants[178]*algebraic[250]
    algebraic[270] = algebraic[215]+algebraic[234]+algebraic[264]
    algebraic[279] = algebraic[270]+algebraic[76]
    rates[11] = (power((algebraic[64]*algebraic[279])/(500.000*constants[105]), constants[106])-states[11])/57600.0
    rates[12] = (power((algebraic[40]*algebraic[279])/(75.0000*constants[107]), constants[106])-states[12])/57600.0
    algebraic[125] = algebraic[124]-states[9]
    algebraic[133] = (power((algebraic[125]-constants[83])/constants[83], 2.00000))*1.00000
    algebraic[130] = power((constants[79]/algebraic[124])/5.00000, constants[80])
    algebraic[134] = algebraic[130]*constants[81]+algebraic[133]
    algebraic[127] = states[10]/algebraic[124]
    algebraic[129] = 0.280000*algebraic[127]+0.00190000*(power(algebraic[127], 2.00000))
    algebraic[131] = algebraic[130]*2.00000
    algebraic[132] = algebraic[131]*algebraic[129]*constants[82]
    algebraic[263] = custom_piecewise([less(algebraic[235]-constants[74] , 0.00000), 0.00000 , True, algebraic[235]-constants[74]])
    algebraic[269] = power(algebraic[263]*constants[75], constants[76])
    algebraic[277] = (((algebraic[235]-algebraic[30])-algebraic[134])+algebraic[132])*constants[68]+algebraic[269]
    algebraic[135] = algebraic[134]-algebraic[131]
    algebraic[136] = (algebraic[135]+constants[84])-algebraic[133]
    algebraic[138] = custom_piecewise([greater(algebraic[136] , 7.00000), 7.00000 , True, algebraic[136]])
    algebraic[139] = custom_piecewise([less(algebraic[138] , 0.00000), 0.00000 , True, algebraic[138]*0.0200000])
    algebraic[284] = ((algebraic[139]-algebraic[277])-algebraic[149])+constants[69]
    rates[7] = algebraic[284]
    algebraic[28] = custom_piecewise([less(algebraic[27]-constants[70] , 0.00000), 0.00000 , True, algebraic[27]-constants[70]])
    algebraic[29] = constants[71]-(power(algebraic[28], constants[72]))*constants[73]
    algebraic[278] = algebraic[269]*algebraic[27]+(algebraic[27]-algebraic[127])*0.00104000
    algebraic[140] = algebraic[127]*algebraic[139]
    algebraic[285] = (((algebraic[29]+algebraic[140])-algebraic[278])-algebraic[152])+constants[69]*72.0000
    rates[8] = algebraic[285]
    algebraic[286] = algebraic[278]-algebraic[140]
    rates[10] = algebraic[286]
    algebraic[287] = algebraic[279]-algebraic[212]
    rates[16] = algebraic[287]
    algebraic[288] = algebraic[164]-algebraic[279]
    rates[17] = algebraic[288]
    algebraic[265] = states[29]*algebraic[234]
    rootfind_2(voi, constants, rates, states, algebraic)
    algebraic[115] = custom_piecewise([greater(algebraic[114] , 35.0000), 35.0000 , True, algebraic[114]])
    algebraic[118] = algebraic[24]*constants[128]*(1.00000-(power(35.0001-algebraic[115], 3.00000))/42875.0)
    algebraic[280] = algebraic[271]-algebraic[118]
    algebraic[290] = custom_piecewise([less(algebraic[113] , 6.00000) & less(algebraic[280] , 0.00000), algebraic[280]*0.100000 , True, algebraic[280]])
    rates[34] = algebraic[290]
    algebraic[276] = (algebraic[268]+states[1])*constants[18]
    algebraic[283] = custom_piecewise([less(algebraic[276] , 1.00000e-05), 1.00000e-05 , True, algebraic[276]])
    algebraic[293] = custom_piecewise([greater(constants[19] , 0.00000), constants[19] , True, algebraic[283]+constants[20]])
    rates[2] = (algebraic[293]-states[2])/constants[21]
    algebraic[281] = algebraic[271]+algebraic[229]
    algebraic[154] = states[37]+1.00000
    algebraic[291] = algebraic[281]*constants[130]*0.0266670*algebraic[176]*algebraic[154]
    algebraic[294] = constants[131]-(algebraic[281]/algebraic[291])/0.761000
    algebraic[153] = constants[132]/(constants[133]+algebraic[123])
    algebraic[296] = (algebraic[294]-algebraic[169])*algebraic[153]
    algebraic[298] = (algebraic[296]-algebraic[281])/(algebraic[168]*1.00000)
    rates[29] = algebraic[298]
    algebraic[301] = algebraic[232]*algebraic[82]*0.00616190
    algebraic[4] = (algebraic[1]-1.00000)*constants[13]+1.00000
    algebraic[5] = custom_piecewise([less(algebraic[4] , constants[15]), constants[15] , greater(algebraic[4] , constants[14]), constants[14] , True, algebraic[4]])
    algebraic[13] = constants[37]-(constants[37]-1.00000)/(((constants[36]-1.00000)/(constants[36]-constants[37]))*(states[3]-1.00000)+1.00000)
    algebraic[14] = custom_piecewise([less(algebraic[13] , constants[36]), constants[36] , True, algebraic[13]])
    algebraic[267] = algebraic[252]*constants[185]-constants[186]
    algebraic[274] = custom_piecewise([less(algebraic[267] , 1.00000), 1.00000 , True, algebraic[267]])
    algebraic[282] = ((algebraic[250]-1.20000)*constants[188]+1.20000)*constants[189]
    algebraic[292] = ((algebraic[252]+constants[190])-algebraic[282])-algebraic[274]
    algebraic[295] = algebraic[292]*constants[191]
    algebraic[297] = algebraic[295]
    algebraic[299] = (algebraic[297]-1.00000)*constants[193]+1.00000
    algebraic[300] = custom_piecewise([less(algebraic[299] , 0.000100000), 0.000100000 , True, algebraic[299]])
    algebraic[302] = ((algebraic[5]*algebraic[300]*constants[194])/constants[195])*((algebraic[14]-1.00000)*constants[196]+1.00000)
    algebraic[303] = custom_piecewise([less(algebraic[302] , constants[197]), constants[197] , True, algebraic[302]])
    algebraic[225] = ((algebraic[6]-1.00000)*constants[198]+1.00000)*0.100000
    algebraic[226] = custom_piecewise([less(algebraic[225] , 0.00000), 0.00000 , True, algebraic[225]])
    algebraic[309] = (algebraic[301]-algebraic[303])-algebraic[226]
    algebraic[310] = custom_piecewise([less(algebraic[309] , 1.00000e-08), 1.00000e-08 , True, algebraic[309]])
    algebraic[311] = algebraic[310]*constants[178]
    algebraic[313] = (constants[100]*algebraic[187]-algebraic[311])+constants[101]*142.000
    rates[23] = algebraic[313]
    algebraic[304] = (algebraic[301]*algebraic[84])/algebraic[82]
    algebraic[305] = (algebraic[300]-1.00000)*constants[199]
    algebraic[306] = (algebraic[232]-1.00000)*constants[200]+1.00000
    algebraic[307] = custom_piecewise([less(algebraic[306] , 0.100000), 0.100000 , True, algebraic[306]])
    algebraic[227] = (algebraic[6]-1.00000)*constants[201]+1.00000
    algebraic[228] = custom_piecewise([less(algebraic[227] , constants[202]), constants[202] , True, algebraic[227]])
    algebraic[308] = ((power(algebraic[84]/4.40000, constants[203]))*algebraic[3]*0.0800000*algebraic[307])/algebraic[228]
    algebraic[312] = ((algebraic[304]+algebraic[308])-states[42])-algebraic[305]
    algebraic[314] = custom_piecewise([less(algebraic[312] , 0.00000), 0.00000 , True, algebraic[312]])
    algebraic[315] = algebraic[314]*constants[178]
    algebraic[317] = constants[103]-algebraic[315]
    rates[24] = algebraic[317]
    algebraic[224] = states[41]/states[22]
    algebraic[316] = (power(algebraic[251], 2.00000))*algebraic[224]*3.84000
    algebraic[318] = algebraic[316]*constants[178]
    rates[41] = constants[187]-algebraic[318]
    algebraic[319] = algebraic[316]+2.00000*(algebraic[310]+algebraic[314])
    algebraic[320] = custom_piecewise([greater(algebraic[319] , 0.600000), 0.600000 , True, algebraic[319]])
    algebraic[321] = algebraic[319]-0.600000
    algebraic[322] = custom_piecewise([less(algebraic[321] , 0.00000), 0.00000 , True, algebraic[321]])
    algebraic[323] = algebraic[320]/(600.000*algebraic[14])+algebraic[322]/360.000
    rates[42] = ((algebraic[314]/algebraic[323])*0.000451800-states[42])*1.00000
    algebraic[324] = algebraic[323]*constants[178]
    rates[22] = states[21]-algebraic[324]
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[31] = ((((((states[7]+states[13])-states[16])-states[17])-states[18])-states[19])-states[20])/2.00000
    algebraic[45] = states[18]+algebraic[31]*0.128000
    algebraic[46] = algebraic[45]-0.380000
    algebraic[47] = algebraic[46]/0.0100000
    algebraic[48] = custom_piecewise([less((algebraic[47]-1.00000)*1.00000 , 0.00000), 0.00000 , True, (algebraic[47]-1.00000)*1.00000])
    algebraic[32] = states[20]+algebraic[31]*0.0574000
    algebraic[33] = algebraic[32]-0.100000
    algebraic[34] = algebraic[33]/0.00500000
    algebraic[35] = custom_piecewise([less((algebraic[34]+1.00000)*2.00000 , 0.00000), 0.00000 , True, (algebraic[34]+1.00000)*2.00000])
    algebraic[50] = (algebraic[48]+algebraic[35])/3.00000
    algebraic[52] = custom_piecewise([greater(constants[38] , 0.00000), constants[38] , True, algebraic[50]+constants[39]])
    algebraic[62] = states[17]+algebraic[31]*0.261000
    algebraic[63] = algebraic[62]-0.495000
    algebraic[64] = algebraic[63]/0.00355000
    algebraic[65] = custom_piecewise([greater(constants[42] , 1.00000e-07), constants[42] , True, algebraic[64]-constants[43]])
    algebraic[66] = custom_piecewise([less(algebraic[65] , 160.000) & greater_equal(algebraic[65] , 80.0000), 0.0166670*(160.000-algebraic[65]) , less(algebraic[65] , 80.0000), 1.33360 , True, 0.00000])
    algebraic[68] = (algebraic[66]-1.00000)*constants[46]+1.00000
    algebraic[70] = algebraic[68]-constants[49]
    algebraic[81] = states[22]-states[25]
    algebraic[82] = states[23]/algebraic[81]
    algebraic[0] = constants[8]-(constants[8]-1.00000)/(((constants[9]-1.00000)/(constants[9]-constants[8]))*(states[0]-1.00000)*constants[10]+1.00000)
    algebraic[1] = (algebraic[0]-1.00000)*constants[11]+1.00000
    algebraic[2] = (algebraic[1]-1.00000)*constants[12]+1.00000
    algebraic[3] = custom_piecewise([less(algebraic[2] , 0.200000), 0.200000 , True, algebraic[2]])
    algebraic[77] = (algebraic[3]-1.00000)*constants[102]+1.00000
    algebraic[78] = (states[24]-3000.00)/(algebraic[77]*9.33330)
    algebraic[79] = states[24]-algebraic[78]
    algebraic[80] = algebraic[79]/states[25]
    algebraic[85] = algebraic[80]-algebraic[82]
    algebraic[89] = algebraic[85]*constants[104]
    algebraic[83] = (algebraic[82]-constants[29])/(142.000-constants[29])
    algebraic[87] = custom_piecewise([less(algebraic[83] , 0.00000), 0.00000 , True, algebraic[83]])
    algebraic[67] = custom_piecewise([greater(algebraic[65] , constants[30]), constants[30] , True, algebraic[65]])
    algebraic[69] = (power(constants[30]-algebraic[67], 2.00000))*constants[31]
    algebraic[91] = algebraic[87]+algebraic[69]+constants[32]
    algebraic[94] = custom_piecewise([less(algebraic[91] , 0.00000), 0.00000 , True, algebraic[91]])
    algebraic[6] = constants[22]-(constants[22]-1.00000)/(((constants[23]-1.00000)/(constants[23]-constants[22]))*(states[2]-1.00000)*constants[24]+1.00000)
    algebraic[7] = (algebraic[6]-1.00000)*constants[3]+1.00000
    algebraic[84] = algebraic[78]/algebraic[81]
    algebraic[86] = (algebraic[84]-3.30000)/1.00000
    algebraic[90] = algebraic[7]*0.909000*algebraic[86]
    algebraic[93] = (algebraic[90]-1.00000)*constants[4]+1.00000
    algebraic[96] = custom_piecewise([less(algebraic[93] , 0.00000), 0.00000 , True, algebraic[93]])
    algebraic[98] = custom_piecewise([greater(constants[6] , 0.00000), constants[6] , True, algebraic[96]+constants[5]])
    algebraic[101] = custom_piecewise([less(states[30] , 0.000100000), 0.000100000 , True, states[30]])
    algebraic[102] = constants[119]*algebraic[101]
    algebraic[104] = algebraic[102]-38.0000
    algebraic[106] = algebraic[104]*constants[110]+1.00000
    algebraic[107] = constants[113]*algebraic[104]+1.00000
    algebraic[113] = custom_piecewise([less(states[34] , 0.00000), 0.00000 , True, states[34]])
    algebraic[114] = algebraic[113]*0.486110
    algebraic[116] = (algebraic[114]-10.0000)*constants[108]
    algebraic[117] = algebraic[114]-constants[120]
    algebraic[119] = algebraic[117]*constants[121]+1.00000
    algebraic[120] = constants[123]*algebraic[117]+1.00000
    algebraic[121] = constants[125]*algebraic[117]+1.00000
    algebraic[123] = custom_piecewise([less(states[35] , 0.00100000), 0.00100000 , True, states[35]])
    algebraic[124] = (algebraic[81]-states[7])-algebraic[123]
    algebraic[27] = states[8]/states[7]
    algebraic[30] = 0.280000*algebraic[27]+0.00190000*(power(algebraic[27], 2.00000))
    algebraic[38] = states[19]+algebraic[31]*0.155000
    algebraic[39] = algebraic[38]-0.306250
    algebraic[40] = algebraic[39]/0.00480000
    algebraic[41] = 0.0260000*algebraic[40]
    algebraic[42] = custom_piecewise([less(algebraic[41] , 1.00000e-05), 1.00000e-05 , True, algebraic[41]])
    algebraic[43] = power(algebraic[42], 0.500000)
    algebraic[44] = 1.00000/algebraic[43]
    algebraic[51] = algebraic[47]+18.0000
    algebraic[53] = 1.00000/(algebraic[51]*0.0357000)
    algebraic[122] = ((algebraic[40]-algebraic[47])*algebraic[53])/(algebraic[53]+algebraic[44])+algebraic[47]
    algebraic[142] = custom_piecewise([less(states[36] , 0.0250000), 0.0250000 , True, states[36]])
    algebraic[143] = algebraic[142]/algebraic[123]
    algebraic[144] = algebraic[143]*0.400000
    algebraic[141] = 2.00000-0.150000/algebraic[123]
    algebraic[145] = (((algebraic[122]-algebraic[141])+algebraic[144])-algebraic[30])*constants[129]
    algebraic[147] = (algebraic[141]+11.0000)*0.000300000
    algebraic[148] = algebraic[145]-algebraic[147]
    algebraic[149] = algebraic[148]
    algebraic[150] = algebraic[147]*algebraic[143]
    algebraic[146] = (algebraic[27]-algebraic[143])*0.000225000
    algebraic[151] = algebraic[146]-algebraic[150]
    algebraic[152] = algebraic[151]
    algebraic[18] = constants[56]-(constants[56]-1.00000)/exp(constants[58]*(states[6]-1.00000))
    algebraic[19] = custom_piecewise([less(algebraic[18] , constants[57]), constants[57] , True, algebraic[18]])
    algebraic[21] = algebraic[19]-1.00000
    algebraic[22] = algebraic[21]*constants[61]+1.00000
    algebraic[88] = custom_piecewise([greater(states[26] , 1.00000), 1.00000 , True, states[26]])
    algebraic[57] = (algebraic[47]+4.00000)*(constants[85]*(algebraic[19]-1.00000)+1.00000)-4.00000
    algebraic[58] = custom_piecewise([less_equal(algebraic[57] , -2.00000), 0.0100000 , greater(algebraic[57] , -2.00000) & less_equal(algebraic[57] , 1.00000), 0.0100000+((3.60000-0.0100000)*(algebraic[57]--2.00000))/(1.00000--2.00000) , greater(algebraic[57] , 1.00000) & less_equal(algebraic[57] , 5.00000), 3.60000+((9.40000-3.60000)*(algebraic[57]-1.00000))/(5.00000-1.00000) , greater(algebraic[57] , 5.00000) & less_equal(algebraic[57] , 8.00000), 9.40000+((11.6000-9.40000)*(algebraic[57]-5.00000))/(8.00000-5.00000) , greater(algebraic[57] , 8.00000) & less_equal(algebraic[57] , 12.0000), 11.6000+((13.5000-11.6000)*(algebraic[57]-8.00000))/(12.0000-8.00000) , True, 13.5000])
    algebraic[155] = states[7]+states[13]
    algebraic[156] = states[13]/algebraic[155]
    algebraic[157] = 100.000*algebraic[156]
    algebraic[158] = (states[29]/algebraic[157])/5.25000
    algebraic[161] = algebraic[64]/(algebraic[22]*algebraic[158])
    algebraic[162] = custom_piecewise([less_equal(algebraic[161] , 0.00000), 1.04000 , greater(algebraic[161] , 0.00000) & less_equal(algebraic[161] , 60.0000), 1.04000+((1.02500-1.04000)*(algebraic[161]-0.00000))/(60.0000-0.00000) , greater(algebraic[161] , 60.0000) & less_equal(algebraic[161] , 125.000), 1.02500+((0.970000-1.02500)*(algebraic[161]-60.0000))/(125.000-60.0000) , greater(algebraic[161] , 125.000) & less_equal(algebraic[161] , 160.000), 0.970000+((0.880000-0.970000)*(algebraic[161]-125.000))/(160.000-125.000) , greater(algebraic[161] , 160.000) & less_equal(algebraic[161] , 200.000), 0.880000+((0.590000-0.880000)*(algebraic[161]-160.000))/(200.000-160.000) , greater(algebraic[161] , 200.000) & less_equal(algebraic[161] , 240.000), 0.590000+((0.00000-0.590000)*(algebraic[161]-200.000))/(240.000-200.000) , True, 0.00000])
    algebraic[163] = algebraic[162]*algebraic[58]*algebraic[22]*constants[88]*algebraic[88]*states[11]
    algebraic[73] = (algebraic[47]-algebraic[64])/3.00000
    algebraic[164] = custom_piecewise([greater(algebraic[73] , 0.00000), algebraic[163]+algebraic[73] , True, algebraic[163]])
    algebraic[54] = algebraic[53]+algebraic[44]
    algebraic[55] = algebraic[40]-algebraic[47]
    algebraic[56] = algebraic[55]/algebraic[54]
    algebraic[166] = algebraic[56]-algebraic[164]
    algebraic[159] = (algebraic[40]/algebraic[22])/algebraic[158]
    algebraic[160] = custom_piecewise([less_equal(algebraic[159] , 0.00000), 1.06000 , greater(algebraic[159] , 0.00000) & less_equal(algebraic[159] , 32.0000), 1.06000+((0.970000-1.06000)*(algebraic[159]-0.00000))/(32.0000-0.00000) , greater(algebraic[159] , 32.0000) & less_equal(algebraic[159] , 38.4000), 0.970000+((0.930000-0.970000)*(algebraic[159]-32.0000))/(38.4000-32.0000) , greater(algebraic[159] , 38.4000) & less_equal(algebraic[159] , 48.0000), 0.930000+((0.800000-0.930000)*(algebraic[159]-38.4000))/(48.0000-38.4000) , greater(algebraic[159] , 48.0000) & less_equal(algebraic[159] , 60.8000), 0.800000+((0.460000-0.800000)*(algebraic[159]-48.0000))/(60.8000-48.0000) , greater(algebraic[159] , 60.8000) & less_equal(algebraic[159] , 72.0000), 0.460000+((0.00000-0.460000)*(algebraic[159]-60.8000))/(72.0000-60.8000) , True, 0.00000])
    algebraic[165] = (1.00000-constants[86])*algebraic[22]*algebraic[160]*constants[87]*algebraic[88]*states[12]+(constants[86]*algebraic[164])/algebraic[58]
    algebraic[36] = (algebraic[34]+8.00000)*(constants[85]*(algebraic[19]-1.00000)+1.00000)-8.00000
    algebraic[37] = custom_piecewise([less_equal(algebraic[36] , -8.00000), 0.00000 , greater(algebraic[36] , -8.00000) & less_equal(algebraic[36] , -6.00000), 0.00000+((0.750000-0.00000)*(algebraic[36]--8.00000))/(-6.00000--8.00000) , greater(algebraic[36] , -6.00000) & less_equal(algebraic[36] , -2.00000), 0.750000+((2.60000-0.750000)*(algebraic[36]--6.00000))/(-2.00000--6.00000) , greater(algebraic[36] , -2.00000) & less_equal(algebraic[36] , 4.00000), 2.60000+((9.80000-2.60000)*(algebraic[36]--2.00000))/(4.00000--2.00000) , greater(algebraic[36] , 4.00000) & less_equal(algebraic[36] , 12.0000), 9.80000+((13.5000-9.80000)*(algebraic[36]-4.00000))/(12.0000-4.00000) , True, 13.5000])
    algebraic[168] = algebraic[37]*algebraic[165]
    algebraic[170] = algebraic[168]-algebraic[56]
    algebraic[169] = custom_piecewise([greater(algebraic[158] , 1.00000), 114.000+(algebraic[158]-1.00000)*6667.00 , greater(algebraic[158] , 0.936000) & less_equal(algebraic[158] , 1.00000), 74.0000+(algebraic[158]-0.936000)*625.000 , greater(algebraic[158] , 0.800000) & less_equal(algebraic[158] , 0.936000), 46.0000+(algebraic[158]-0.800000)*205.882 , True, algebraic[158]*57.5000])
    algebraic[172] = (algebraic[169]-67.0000)/30.0000
    algebraic[174] = custom_piecewise([greater(algebraic[172] , 1.00000), 1.00000 , less(algebraic[172] , 0.600000), 0.600000 , True, algebraic[172]])
    algebraic[176] = 1.00000/algebraic[174]
    algebraic[179] = ((algebraic[176]-1.00000)*3.00000-states[37])*0.000500000
    algebraic[71] = custom_piecewise([less(algebraic[65] , 80.0000) & greater_equal(algebraic[65] , 40.0000), 0.00500000*(80.0000-algebraic[65])*constants[44] , less(algebraic[65] , 40.0000), 0.200000*constants[44] , True, 0.00000])
    algebraic[171] = custom_piecewise([less(algebraic[169] , 80.0000) & greater_equal(algebraic[169] , 40.0000), constants[45]*(80.0000-algebraic[169]) , less(algebraic[169] , 40.0000), constants[45]*40.0000 , True, 0.00000])
    algebraic[173] = algebraic[71]+algebraic[171]
    algebraic[17] = states[5]
    algebraic[72] = custom_piecewise([less(algebraic[65] , 40.0000), 0.0400000*(40.0000-algebraic[65])*constants[50] , True, 0.00000])
    algebraic[49] = (15.0000/(algebraic[47]+algebraic[34]+algebraic[40])-1.00000)*constants[51]+1.00000
    algebraic[175] = (constants[206]*algebraic[49]*(algebraic[173]+algebraic[17]+algebraic[72])-1.00000)*constants[54]+1.00000
    algebraic[177] = custom_piecewise([less(algebraic[175] , 0.00000), 0.00000 , True, algebraic[175]])
    algebraic[180] = (algebraic[177]-states[6])/constants[55]
    algebraic[189] = (power(fabs(algebraic[34]), constants[153]))*constants[154]
    algebraic[192] = custom_piecewise([less(algebraic[34] , 0.00000), -algebraic[189] , True, algebraic[189]])
    algebraic[184] = (constants[208]-40.0000)*algebraic[157]
    algebraic[186] = custom_piecewise([less(algebraic[184]+constants[209] , 0.00000), 0.00000 , True, algebraic[184]+constants[209]])
    algebraic[188] = constants[137]-algebraic[186]
    algebraic[190] = custom_piecewise([less(algebraic[188]*constants[138]*constants[139]+5.00000e-06 , 0.00000), 0.00000 , True, algebraic[188]*constants[138]*constants[139]+5.00000e-06])
    algebraic[178] = algebraic[157]/((constants[134]-algebraic[157])*constants[135])
    algebraic[181] = algebraic[178]+1.50000
    algebraic[182] = 0.333300*algebraic[181]
    algebraic[193] = states[13]*constants[140]*algebraic[182]
    algebraic[196] = (algebraic[190]-algebraic[193])+constants[141]
    algebraic[194] = (algebraic[6]-1.00000)*constants[150]*0.00100000
    algebraic[183] = (algebraic[6]-1.00000)*constants[146]+1.00000
    algebraic[185] = (power(constants[147]-algebraic[114], 2.00000))*constants[148]*algebraic[183]
    algebraic[187] = custom_piecewise([less(algebraic[185] , 0.800000), 0.800000 , greater(algebraic[185] , 8.00000), 8.00000 , True, algebraic[185]])
    algebraic[191] = (states[3]-1.00000)*constants[149]+1.00000
    algebraic[197] = algebraic[191]*algebraic[187]*0.00100000
    algebraic[199] = custom_piecewise([less(algebraic[197] , 0.00000), 0.00000 , True, algebraic[197]])
    algebraic[201] = (algebraic[194]+algebraic[199])*1.00000
    algebraic[203] = custom_piecewise([less(algebraic[201] , 0.00000), 0.00000 , True, algebraic[201]])
    algebraic[20] = (constants[59]-algebraic[19]*constants[60])+constants[60]
    algebraic[195] = algebraic[192]-states[38]
    algebraic[205] = algebraic[195]*constants[157]
    algebraic[59] = states[16]+algebraic[31]*0.398600
    algebraic[8] = (algebraic[6]-1.00000)*constants[25]+1.00000
    algebraic[9] = custom_piecewise([less(algebraic[8] , constants[26]), constants[26] , True, algebraic[8]])
    algebraic[60] = (algebraic[9]-1.00000)*constants[89]
    algebraic[206] = ((((algebraic[59]-algebraic[20])-algebraic[60])-states[15])-states[14])-algebraic[205]
    algebraic[207] = custom_piecewise([less(algebraic[206] , 0.000100000), 0.000100000 , True, algebraic[206]])
    algebraic[208] = 3.70000+(algebraic[207]-0.740000)/constants[90]
    algebraic[209] = custom_piecewise([less(algebraic[208] , 0.000100000), 0.000100000 , True, algebraic[208]])
    algebraic[210] = 0.740000/(power(algebraic[209]/(algebraic[182]*3.70000), 0.500000))
    algebraic[61] = custom_piecewise([less(algebraic[34] , constants[91]), constants[91] , True, algebraic[34]])
    algebraic[211] = algebraic[209]-algebraic[61]
    algebraic[212] = algebraic[211]/algebraic[210]
    algebraic[214] = algebraic[212]-algebraic[168]
    algebraic[213] = algebraic[64]-algebraic[209]
    algebraic[99] = custom_piecewise([less(states[27] , constants[112]), constants[112] , True, states[27]])
    algebraic[100] = algebraic[99]*states[28]
    algebraic[11] = constants[34]-(constants[34]-1.00000)/(((constants[35]-1.00000)/(constants[35]-constants[34]))*(states[3]-1.00000)+1.00000)
    algebraic[12] = custom_piecewise([less(algebraic[11] , constants[35]), constants[35] , True, algebraic[11]])
    algebraic[25] = power(algebraic[21]*constants[64]+1.00000, constants[65])
    algebraic[198] = algebraic[195]*constants[156]+1.00000
    algebraic[75] = power(algebraic[64]/100.000, constants[95])
    algebraic[200] = ((algebraic[9]*algebraic[12]*algebraic[25]*algebraic[182]*constants[1])/algebraic[75])/algebraic[198]
    algebraic[204] = constants[98]*algebraic[100]*algebraic[200]*constants[0]*constants[97]
    algebraic[215] = algebraic[213]/algebraic[204]
    algebraic[216] = states[29]*algebraic[215]
    algebraic[24] = algebraic[21]*constants[63]+1.00000
    algebraic[103] = custom_piecewise([greater(algebraic[102] , 38.0000), 38.0000 , True, algebraic[102]])
    algebraic[105] = algebraic[24]*constants[117]*constants[115]*(1.00000-(power(38.0001-algebraic[103], 3.00000))/54872.0)
    algebraic[261] = algebraic[229]-algebraic[105]
    algebraic[10] = (algebraic[9]-1.00000)*constants[27]+1.00000
    algebraic[15] = constants[41]-constants[41]/(0.555556*(1.00000+states[4]))
    algebraic[16] = custom_piecewise([less(algebraic[15] , -1.00000), -1.00000 , True, algebraic[15]])
    algebraic[26] = algebraic[21]*constants[66]+1.00000
    algebraic[108] = custom_piecewise([less(states[31] , 0.500000), 0.500000 , True, states[31]])
    algebraic[109] = custom_piecewise([less(states[32] , 0.500000), 0.500000 , True, states[32]])
    algebraic[110] = custom_piecewise([less(states[33] , 0.300000), 0.300000 , True, states[33]])
    algebraic[111] = algebraic[108]*algebraic[109]*algebraic[110]
    algebraic[112] = (algebraic[111]-1.00000)*constants[127]+1.00000
    algebraic[202] = constants[96]*algebraic[112]*algebraic[200]*constants[0]*constants[97]
    algebraic[217] = custom_piecewise([greater(constants[159] , 0.00000) & less_equal(constants[160] , 0.00000), constants[159] , greater(constants[160] , 0.00000), states[39] , True, algebraic[64]-constants[158]])
    algebraic[218] = (algebraic[25]-1.00000)*constants[167]+1.00000
    algebraic[219] = custom_piecewise([less(algebraic[218] , 0.800000), 0.800000 , True, algebraic[218]])
    algebraic[220] = (algebraic[6]-1.00000)*constants[168]+1.00000
    algebraic[221] = custom_piecewise([less(algebraic[220] , constants[169]), constants[169] , True, algebraic[220]])
    algebraic[222] = (algebraic[219]-1.00000)*constants[173]+1.00000
    algebraic[223] = (algebraic[6]-1.00000)*constants[174]+1.00000
    algebraic[262] = algebraic[232]
    algebraic[268] = custom_piecewise([greater(algebraic[262] , 1.00000), 1.00000/(1.00000+(algebraic[262]-1.00000)*72.0000) , True, 10.0000-9.00000/(1.00000+(1.00000-algebraic[262])*8.00000)])
    algebraic[275] = (algebraic[268]-1.00000)*constants[16]
    algebraic[74] = algebraic[64]-algebraic[34]
    algebraic[76] = algebraic[74]*constants[99]
    algebraic[264] = constants[178]*algebraic[250]
    algebraic[270] = algebraic[215]+algebraic[234]+algebraic[264]
    algebraic[279] = algebraic[270]+algebraic[76]
    algebraic[125] = algebraic[124]-states[9]
    algebraic[133] = (power((algebraic[125]-constants[83])/constants[83], 2.00000))*1.00000
    algebraic[130] = power((constants[79]/algebraic[124])/5.00000, constants[80])
    algebraic[134] = algebraic[130]*constants[81]+algebraic[133]
    algebraic[127] = states[10]/algebraic[124]
    algebraic[129] = 0.280000*algebraic[127]+0.00190000*(power(algebraic[127], 2.00000))
    algebraic[131] = algebraic[130]*2.00000
    algebraic[132] = algebraic[131]*algebraic[129]*constants[82]
    algebraic[263] = custom_piecewise([less(algebraic[235]-constants[74] , 0.00000), 0.00000 , True, algebraic[235]-constants[74]])
    algebraic[269] = power(algebraic[263]*constants[75], constants[76])
    algebraic[277] = (((algebraic[235]-algebraic[30])-algebraic[134])+algebraic[132])*constants[68]+algebraic[269]
    algebraic[135] = algebraic[134]-algebraic[131]
    algebraic[136] = (algebraic[135]+constants[84])-algebraic[133]
    algebraic[138] = custom_piecewise([greater(algebraic[136] , 7.00000), 7.00000 , True, algebraic[136]])
    algebraic[139] = custom_piecewise([less(algebraic[138] , 0.00000), 0.00000 , True, algebraic[138]*0.0200000])
    algebraic[284] = ((algebraic[139]-algebraic[277])-algebraic[149])+constants[69]
    algebraic[28] = custom_piecewise([less(algebraic[27]-constants[70] , 0.00000), 0.00000 , True, algebraic[27]-constants[70]])
    algebraic[29] = constants[71]-(power(algebraic[28], constants[72]))*constants[73]
    algebraic[278] = algebraic[269]*algebraic[27]+(algebraic[27]-algebraic[127])*0.00104000
    algebraic[140] = algebraic[127]*algebraic[139]
    algebraic[285] = (((algebraic[29]+algebraic[140])-algebraic[278])-algebraic[152])+constants[69]*72.0000
    algebraic[286] = algebraic[278]-algebraic[140]
    algebraic[287] = algebraic[279]-algebraic[212]
    algebraic[288] = algebraic[164]-algebraic[279]
    algebraic[265] = states[29]*algebraic[234]
    algebraic[115] = custom_piecewise([greater(algebraic[114] , 35.0000), 35.0000 , True, algebraic[114]])
    algebraic[118] = algebraic[24]*constants[128]*(1.00000-(power(35.0001-algebraic[115], 3.00000))/42875.0)
    algebraic[280] = algebraic[271]-algebraic[118]
    algebraic[290] = custom_piecewise([less(algebraic[113] , 6.00000) & less(algebraic[280] , 0.00000), algebraic[280]*0.100000 , True, algebraic[280]])
    algebraic[276] = (algebraic[268]+states[1])*constants[18]
    algebraic[283] = custom_piecewise([less(algebraic[276] , 1.00000e-05), 1.00000e-05 , True, algebraic[276]])
    algebraic[293] = custom_piecewise([greater(constants[19] , 0.00000), constants[19] , True, algebraic[283]+constants[20]])
    algebraic[281] = algebraic[271]+algebraic[229]
    algebraic[154] = states[37]+1.00000
    algebraic[291] = algebraic[281]*constants[130]*0.0266670*algebraic[176]*algebraic[154]
    algebraic[294] = constants[131]-(algebraic[281]/algebraic[291])/0.761000
    algebraic[153] = constants[132]/(constants[133]+algebraic[123])
    algebraic[296] = (algebraic[294]-algebraic[169])*algebraic[153]
    algebraic[298] = (algebraic[296]-algebraic[281])/(algebraic[168]*1.00000)
    algebraic[301] = algebraic[232]*algebraic[82]*0.00616190
    algebraic[4] = (algebraic[1]-1.00000)*constants[13]+1.00000
    algebraic[5] = custom_piecewise([less(algebraic[4] , constants[15]), constants[15] , greater(algebraic[4] , constants[14]), constants[14] , True, algebraic[4]])
    algebraic[13] = constants[37]-(constants[37]-1.00000)/(((constants[36]-1.00000)/(constants[36]-constants[37]))*(states[3]-1.00000)+1.00000)
    algebraic[14] = custom_piecewise([less(algebraic[13] , constants[36]), constants[36] , True, algebraic[13]])
    algebraic[267] = algebraic[252]*constants[185]-constants[186]
    algebraic[274] = custom_piecewise([less(algebraic[267] , 1.00000), 1.00000 , True, algebraic[267]])
    algebraic[282] = ((algebraic[250]-1.20000)*constants[188]+1.20000)*constants[189]
    algebraic[292] = ((algebraic[252]+constants[190])-algebraic[282])-algebraic[274]
    algebraic[295] = algebraic[292]*constants[191]
    algebraic[297] = algebraic[295]
    algebraic[299] = (algebraic[297]-1.00000)*constants[193]+1.00000
    algebraic[300] = custom_piecewise([less(algebraic[299] , 0.000100000), 0.000100000 , True, algebraic[299]])
    algebraic[302] = ((algebraic[5]*algebraic[300]*constants[194])/constants[195])*((algebraic[14]-1.00000)*constants[196]+1.00000)
    algebraic[303] = custom_piecewise([less(algebraic[302] , constants[197]), constants[197] , True, algebraic[302]])
    algebraic[225] = ((algebraic[6]-1.00000)*constants[198]+1.00000)*0.100000
    algebraic[226] = custom_piecewise([less(algebraic[225] , 0.00000), 0.00000 , True, algebraic[225]])
    algebraic[309] = (algebraic[301]-algebraic[303])-algebraic[226]
    algebraic[310] = custom_piecewise([less(algebraic[309] , 1.00000e-08), 1.00000e-08 , True, algebraic[309]])
    algebraic[311] = algebraic[310]*constants[178]
    algebraic[313] = (constants[100]*algebraic[187]-algebraic[311])+constants[101]*142.000
    algebraic[304] = (algebraic[301]*algebraic[84])/algebraic[82]
    algebraic[305] = (algebraic[300]-1.00000)*constants[199]
    algebraic[306] = (algebraic[232]-1.00000)*constants[200]+1.00000
    algebraic[307] = custom_piecewise([less(algebraic[306] , 0.100000), 0.100000 , True, algebraic[306]])
    algebraic[227] = (algebraic[6]-1.00000)*constants[201]+1.00000
    algebraic[228] = custom_piecewise([less(algebraic[227] , constants[202]), constants[202] , True, algebraic[227]])
    algebraic[308] = ((power(algebraic[84]/4.40000, constants[203]))*algebraic[3]*0.0800000*algebraic[307])/algebraic[228]
    algebraic[312] = ((algebraic[304]+algebraic[308])-states[42])-algebraic[305]
    algebraic[314] = custom_piecewise([less(algebraic[312] , 0.00000), 0.00000 , True, algebraic[312]])
    algebraic[315] = algebraic[314]*constants[178]
    algebraic[317] = constants[103]-algebraic[315]
    algebraic[224] = states[41]/states[22]
    algebraic[316] = (power(algebraic[251], 2.00000))*algebraic[224]*3.84000
    algebraic[318] = algebraic[316]*constants[178]
    algebraic[319] = algebraic[316]+2.00000*(algebraic[310]+algebraic[314])
    algebraic[320] = custom_piecewise([greater(algebraic[319] , 0.600000), 0.600000 , True, algebraic[319]])
    algebraic[321] = algebraic[319]-0.600000
    algebraic[322] = custom_piecewise([less(algebraic[321] , 0.00000), 0.00000 , True, algebraic[321]])
    algebraic[323] = algebraic[320]/(600.000*algebraic[14])+algebraic[322]/360.000
    algebraic[324] = algebraic[323]*constants[178]
    algebraic[23] = algebraic[21]*constants[62]+1.00000
    algebraic[92] = 72.0000*algebraic[23]
    algebraic[95] = (algebraic[88]-1.00000)*0.500000+1.00000
    algebraic[97] = (algebraic[92]+constants[207])*algebraic[95]
    algebraic[126] = custom_piecewise([less_equal(algebraic[124] , 0.00000), 0.00000 , greater(algebraic[124] , 0.00000) & less_equal(algebraic[124] , 12.0000), 0.00000+((11.4000-0.00000)*(algebraic[124]-0.00000))/(12.0000-0.00000) , greater(algebraic[124] , 12.0000) & less_equal(algebraic[124] , 15.0000), 11.4000+((14.0000-11.4000)*(algebraic[124]-12.0000))/(15.0000-12.0000) , greater(algebraic[124] , 15.0000) & less_equal(algebraic[124] , 18.0000), 14.0000+((16.0000-14.0000)*(algebraic[124]-15.0000))/(18.0000-15.0000) , greater(algebraic[124] , 18.0000) & less_equal(algebraic[124] , 21.0000), 16.0000+((17.3000-16.0000)*(algebraic[124]-18.0000))/(21.0000-18.0000) , greater(algebraic[124] , 21.0000) & less_equal(algebraic[124] , 24.0000), 17.3000+((18.0000-17.3000)*(algebraic[124]-21.0000))/(24.0000-21.0000) , True, 18.0000])
    algebraic[128] = algebraic[124]-algebraic[126]
    algebraic[137] = algebraic[133]-algebraic[135]
    algebraic[167] = algebraic[164]/algebraic[97]
    algebraic[266] = algebraic[251]*constants[178]
    algebraic[289] = algebraic[74]/algebraic[279]
    return algebraic

initialGuess0 = None
def rootfind_0(voi, constants, rates, states, algebraic):
    """Calculate values of algebraic variables for DAE"""
    from scipy.optimize import fsolve
    global initialGuess0
    if initialGuess0 is None: initialGuess0 = ones(3)*0.1
    if not iterable(voi):
        soln = fsolve(residualSN_0, initialGuess0, args=(algebraic, voi, constants, rates, states), xtol=1E-6)
        initialGuess0 = soln
        algebraic[229] = soln[0]
        algebraic[230] = soln[1]
        algebraic[231] = soln[2]
    else:
        for (i,t) in enumerate(voi):
            soln = fsolve(residualSN_0, initialGuess0, args=(algebraic[:,i], voi[i], constants, rates[:i], states[:,i]), xtol=1E-6)
            initialGuess0 = soln
            algebraic[229][i] = soln[0]
            algebraic[230][i] = soln[1]
            algebraic[231][i] = soln[2]

def residualSN_0(algebraicCandidate, algebraic, voi, constants, rates, states):
    resid = array([0.0] * 3)
    algebraic[229] = algebraicCandidate[0]
    algebraic[230] = algebraicCandidate[1]
    algebraic[231] = algebraicCandidate[2]
    resid[0] = (algebraic[231]-(algebraic[216]-algebraic[229])/(algebraic[157]*5.25000*algebraic[215]))
    resid[1] = (algebraic[230]-57.1400*algebraic[231]*(power(constants[115], constants[116])))
    resid[2] = (algebraic[229]-(algebraic[230]-algebraic[102])*constants[118]*algebraic[215])
    return resid

initialGuess1 = None
def rootfind_1(voi, constants, rates, states, algebraic):
    """Calculate values of algebraic variables for DAE"""
    from scipy.optimize import fsolve
    global initialGuess1
    if initialGuess1 is None: initialGuess1 = ones(29)*0.1
    if not iterable(voi):
        soln = fsolve(residualSN_1, initialGuess1, args=(algebraic, voi, constants, rates, states), xtol=1E-6)
        initialGuess1 = soln
        algebraic[232] = soln[0]
        algebraic[233] = soln[1]
        algebraic[234] = soln[2]
        algebraic[235] = soln[3]
        algebraic[236] = soln[4]
        algebraic[237] = soln[5]
        algebraic[238] = soln[6]
        algebraic[239] = soln[7]
        algebraic[240] = soln[8]
        algebraic[241] = soln[9]
        algebraic[242] = soln[10]
        algebraic[243] = soln[11]
        algebraic[244] = soln[12]
        algebraic[245] = soln[13]
        algebraic[246] = soln[14]
        algebraic[247] = soln[15]
        algebraic[248] = soln[16]
        algebraic[249] = soln[17]
        algebraic[250] = soln[18]
        algebraic[251] = soln[19]
        algebraic[252] = soln[20]
        algebraic[253] = soln[21]
        algebraic[254] = soln[22]
        algebraic[255] = soln[23]
        algebraic[256] = soln[24]
        algebraic[257] = soln[25]
        algebraic[258] = soln[26]
        algebraic[259] = soln[27]
        algebraic[260] = soln[28]
    else:
        for (i,t) in enumerate(voi):
            soln = fsolve(residualSN_1, initialGuess1, args=(algebraic[:,i], voi[i], constants, rates[:i], states[:,i]), xtol=1E-6)
            initialGuess1 = soln
            algebraic[232][i] = soln[0]
            algebraic[233][i] = soln[1]
            algebraic[234][i] = soln[2]
            algebraic[235][i] = soln[3]
            algebraic[236][i] = soln[4]
            algebraic[237][i] = soln[5]
            algebraic[238][i] = soln[6]
            algebraic[239][i] = soln[7]
            algebraic[240][i] = soln[8]
            algebraic[241][i] = soln[9]
            algebraic[242][i] = soln[10]
            algebraic[243][i] = soln[11]
            algebraic[244][i] = soln[12]
            algebraic[245][i] = soln[13]
            algebraic[246][i] = soln[14]
            algebraic[247][i] = soln[15]
            algebraic[248][i] = soln[16]
            algebraic[249][i] = soln[17]
            algebraic[250][i] = soln[18]
            algebraic[251][i] = soln[19]
            algebraic[252][i] = soln[20]
            algebraic[253][i] = soln[21]
            algebraic[254][i] = soln[22]
            algebraic[255][i] = soln[23]
            algebraic[256][i] = soln[24]
            algebraic[257][i] = soln[25]
            algebraic[258][i] = soln[26]
            algebraic[259][i] = soln[27]
            algebraic[260][i] = soln[28]

def residualSN_1(algebraicCandidate, algebraic, voi, constants, rates, states):
    resid = array([0.0] * 29)
    algebraic[232] = algebraicCandidate[0]
    algebraic[233] = algebraicCandidate[1]
    algebraic[234] = algebraicCandidate[2]
    algebraic[235] = algebraicCandidate[3]
    algebraic[236] = algebraicCandidate[4]
    algebraic[237] = algebraicCandidate[5]
    algebraic[238] = algebraicCandidate[6]
    algebraic[239] = algebraicCandidate[7]
    algebraic[240] = algebraicCandidate[8]
    algebraic[241] = algebraicCandidate[9]
    algebraic[242] = algebraicCandidate[10]
    algebraic[243] = algebraicCandidate[11]
    algebraic[244] = algebraicCandidate[12]
    algebraic[245] = algebraicCandidate[13]
    algebraic[246] = algebraicCandidate[14]
    algebraic[247] = algebraicCandidate[15]
    algebraic[248] = algebraicCandidate[16]
    algebraic[249] = algebraicCandidate[17]
    algebraic[250] = algebraicCandidate[18]
    algebraic[251] = algebraicCandidate[19]
    algebraic[252] = algebraicCandidate[20]
    algebraic[253] = algebraicCandidate[21]
    algebraic[254] = algebraicCandidate[22]
    algebraic[255] = algebraicCandidate[23]
    algebraic[256] = algebraicCandidate[24]
    algebraic[257] = algebraicCandidate[25]
    algebraic[258] = algebraicCandidate[26]
    algebraic[259] = algebraicCandidate[27]
    algebraic[260] = algebraicCandidate[28]
    resid[0] = (algebraic[235]-(algebraic[233]*1.70000*algebraic[234]+algebraic[209]))
    resid[1] = (algebraic[236]-((algebraic[235]-17.0000)*constants[92]+17.0000)*constants[93])
    resid[2] = (algebraic[237]-constants[94]/algebraic[236])
    resid[3] = (algebraic[233]-algebraic[26]*algebraic[237]*algebraic[182]*algebraic[10])
    resid[4] = (algebraic[238]-algebraic[233]*1.79000)
    resid[5] = (algebraic[239]-(algebraic[202]+algebraic[238]))
    resid[6] = (algebraic[234]-algebraic[213]/algebraic[239])
    resid[7] = (algebraic[242]-((algebraic[232]-1.00000)*constants[163]+1.00000))
    resid[8] = (algebraic[241]-(custom_piecewise([less(algebraic[242] , constants[164]), constants[164] , greater(algebraic[242] , constants[165]), constants[165] , True, algebraic[242]])))
    resid[9] = (algebraic[240]-(algebraic[241]-states[40]))
    resid[10] = (algebraic[243]-constants[170]*constants[2]*algebraic[219]*algebraic[240]*algebraic[221]*40.0000*constants[0])
    resid[11] = (algebraic[245]-((algebraic[243]-algebraic[16]*constants[171])+constants[171]))
    resid[12] = (algebraic[244]-(custom_piecewise([less(algebraic[245] , constants[172]), constants[172] , True, algebraic[245]])))
    resid[13] = (algebraic[246]-((algebraic[240]-1.00000)*constants[175]+1.00000))
    resid[14] = (algebraic[248]-43.3330*constants[176]*algebraic[223]*algebraic[246]*constants[0]*algebraic[222])
    resid[15] = (algebraic[247]-(custom_piecewise([less(algebraic[248] , constants[177]), constants[177] , True, algebraic[248]])))
    resid[16] = (algebraic[249]-(algebraic[244]+algebraic[247]))
    resid[17] = (algebraic[250]-algebraic[217]/algebraic[249])
    resid[18] = (algebraic[254]-(algebraic[250]*(1.00000-algebraic[156]))/(algebraic[250]*(1.00000-algebraic[156])-algebraic[251]))
    resid[19] = (algebraic[253]-(custom_piecewise([less(algebraic[254] , 1.00000), 1.00000 , True, algebraic[254]])))
    resid[20] = (algebraic[252]-(custom_piecewise([greater(constants[180] , 0.00000), (power(algebraic[253], 1.35000))*algebraic[30]*0.980000 , True, algebraic[30]+4.00000])))
    resid[21] = (algebraic[256]-algebraic[244]*algebraic[250])
    resid[22] = (algebraic[255]-(algebraic[217]-algebraic[256]))
    resid[23] = (algebraic[257]-((algebraic[255]-algebraic[252])-constants[181]))
    resid[24] = (algebraic[258]-algebraic[257]*constants[182])
    resid[25] = (algebraic[251]-(custom_piecewise([less(algebraic[258] , constants[183]), constants[183] , True, algebraic[258]])))
    resid[26] = (algebraic[259]-algebraic[251]*8.00000)
    resid[27] = (algebraic[260]-((algebraic[259]-1.00000)*constants[184]+1.00000))
    resid[28] = (algebraic[232]-(custom_piecewise([less(algebraic[260] , 0.00000), 0.00000 , True, algebraic[260]])))
    return resid

initialGuess2 = None
def rootfind_2(voi, constants, rates, states, algebraic):
    """Calculate values of algebraic variables for DAE"""
    from scipy.optimize import fsolve
    global initialGuess2
    if initialGuess2 is None: initialGuess2 = ones(3)*0.1
    if not iterable(voi):
        soln = fsolve(residualSN_2, initialGuess2, args=(algebraic, voi, constants, rates, states), xtol=1E-6)
        initialGuess2 = soln
        algebraic[271] = soln[0]
        algebraic[272] = soln[1]
        algebraic[273] = soln[2]
    else:
        for (i,t) in enumerate(voi):
            soln = fsolve(residualSN_2, initialGuess2, args=(algebraic[:,i], voi[i], constants, rates[:i], states[:,i]), xtol=1E-6)
            initialGuess2 = soln
            algebraic[271][i] = soln[0]
            algebraic[272][i] = soln[1]
            algebraic[273][i] = soln[2]

def residualSN_2(algebraicCandidate, algebraic, voi, constants, rates, states):
    resid = array([0.0] * 3)
    algebraic[271] = algebraicCandidate[0]
    algebraic[272] = algebraicCandidate[1]
    algebraic[273] = algebraicCandidate[2]
    resid[0] = (algebraic[273]-(algebraic[265]-algebraic[271])/(algebraic[157]*5.25000*algebraic[234]))
    resid[1] = (algebraic[272]-algebraic[273]*57.1400)
    resid[2] = (algebraic[271]-(algebraic[272]-algebraic[114])*12.8570*algebraic[234])
    return resid

def custom_piecewise(cases):
    """Compute result of a piecewise function"""
    return select(cases[0::2],cases[1::2])

def gcd(A, B):
    """Greatest common divisor"""
    if (iterable(A) and iterable(B)):
        x = [];
        for (a,b) in zip(A,B):
            assert (int(a) == a) and (int(b) == b)
            a = int(a); b = int(b)
            while a:
                a,b = b % a, a
            x.append(b)
        return x
    else:
        while A:
            A,B = B % A, A
        return b

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)