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 = 62
sizeStates = 5
sizeConstants = 584
from math import *
from numpy import *

def createLegends():
    legend_states = [""] * sizeStates
    legend_rates = [""] * sizeStates
    legend_algebraic = [""] * sizeAlgebraic
    legend_voi = ""
    legend_constants = [""] * sizeConstants
    legend_constants[0] = "ANU in component input_values (dimensionless)"
    legend_constants[1] = "ADHMV in component input_values (dimensionless)"
    legend_constants[2] = "PAMK in component input_values (dimensionless)"
    legend_constants[3] = "ATRRFB in component input_values (dimensionless)"
    legend_constants[4] = "MYOGRS in component input_values (dimensionless)"
    legend_constants[5] = "ARM in component input_values (dimensionless)"
    legend_constants[6] = "VIM in component input_values (dimensionless)"
    legend_constants[7] = "AVE in component input_values (dimensionless)"
    legend_constants[8] = "ANUVN in component input_values (dimensionless)"
    legend_constants[9] = "PC in component input_values (mmHg)"
    legend_constants[10] = "RBF in component input_values (L_per_minute)"
    legend_constants[11] = "VVR in component input_values (litre)"
    legend_constants[12] = "VV6 in component input_values (litre)"
    legend_constants[13] = "VV7 in component input_values (litre)"
    legend_constants[14] = "ATRVFB in component input_values (litre)"
    legend_constants[15] = "VP in component input_values (litre)"
    legend_constants[16] = "VRC in component input_values (litre)"
    legend_constants[17] = "HPR in component input_values (dimensionless)"
    legend_constants[18] = "HMD in component input_values (dimensionless)"
    legend_constants[19] = "AUH in component input_values (dimensionless)"
    legend_constants[20] = "OSA in component input_values (dimensionless)"
    legend_constants[21] = "HPL in component input_values (dimensionless)"
    legend_constants[22] = "AMM in component input_values (dimensionless)"
    legend_constants[23] = "AUM in component input_values (dimensionless)"
    legend_constants[24] = "AU in component input_values (dimensionless)"
    legend_voi = "time in component environment (minute)"
    legend_constants[25] = "A1K in component parameter_values (minute)"
    legend_constants[26] = "A2K in component parameter_values (minute)"
    legend_constants[27] = "A3K in component parameter_values (minute)"
    legend_constants[28] = "A4K in component parameter_values (minute)"
    legend_constants[29] = "A4K2 in component parameter_values (minute)"
    legend_constants[30] = "AARK in component parameter_values (mmHg_minute_per_L)"
    legend_constants[31] = "AARLL in component parameter_values (mmHg_minute_per_L)"
    legend_constants[32] = "ADHINF in component parameter_values (dimensionless)"
    legend_constants[33] = "ADHKLL in component parameter_values (dimensionless)"
    legend_constants[34] = "ADHKUL in component parameter_values (dimensionless)"
    legend_constants[35] = "ADHPAM in component parameter_values (per_mmHg2)"
    legend_constants[36] = "ADHPUL in component parameter_values (mmHg)"
    legend_constants[37] = "ADHTC in component parameter_values (minute)"
    legend_constants[38] = "ADHVLL in component parameter_values (dimensionless)"
    legend_constants[39] = "ADHVUL in component parameter_values (dimensionless)"
    legend_constants[40] = "AH10 in component parameter_values (dimensionless)"
    legend_constants[41] = "AH11 in component parameter_values (minute)"
    legend_constants[42] = "AH9 in component parameter_values (per_mmHg)"
    legend_constants[43] = "AHMNAR in component parameter_values (dimensionless)"
    legend_constants[44] = "AHTHM in component parameter_values (dimensionless)"
    legend_constants[45] = "ALCLK in component parameter_values (dimensionless)"
    legend_constants[46] = "ALDINF in component parameter_values (dimensionless)"
    legend_constants[47] = "ALDKNS in component parameter_values (dimensionless)"
    legend_constants[48] = "ALDMM in component parameter_values (dimensionless)"
    legend_constants[49] = "AM1LL in component parameter_values (dimensionless)"
    legend_constants[50] = "AM1UL in component parameter_values (dimensionless)"
    legend_constants[51] = "AMCSNS in component parameter_values (dimensionless)"
    legend_constants[52] = "AMKM in component parameter_values (dimensionless)"
    legend_constants[53] = "AMKMUL in component parameter_values (dimensionless)"
    legend_constants[54] = "AMM1LM in component parameter_values (dimensionless)"
    legend_constants[55] = "AMM4 in component parameter_values (dimensionless)"
    legend_constants[56] = "AMNALL in component parameter_values (dimensionless)"
    legend_constants[57] = "AMNAM in component parameter_values (dimensionless)"
    legend_constants[58] = "AMNAUL in component parameter_values (dimensionless)"
    legend_constants[59] = "AMT in component parameter_values (minute)"
    legend_constants[60] = "ANCSNS in component parameter_values (dimensionless)"
    legend_constants[61] = "ANGINF in component parameter_values (dimensionless)"
    legend_constants[62] = "ANGKNS in component parameter_values (dimensionless)"
    legend_constants[63] = "ANMALD in component parameter_values (dimensionless)"
    legend_constants[64] = "ANMAM in component parameter_values (dimensionless)"
    legend_constants[65] = "ANMARL in component parameter_values (dimensionless)"
    legend_constants[66] = "ANMEM in component parameter_values (dimensionless)"
    legend_constants[67] = "ANMKEL in component parameter_values (dimensionless)"
    legend_constants[68] = "ANMKEM in component parameter_values (dimensionless)"
    legend_constants[69] = "ANMLL in component parameter_values (dimensionless)"
    legend_constants[70] = "ANMNAM in component parameter_values (dimensionless)"
    legend_constants[71] = "ANMSLT in component parameter_values (dimensionless)"
    legend_constants[72] = "ANMTM in component parameter_values (dimensionless)"
    legend_constants[73] = "ANMUL in component parameter_values (dimensionless)"
    legend_constants[74] = "ANPTC in component parameter_values (minute)"
    legend_constants[75] = "ANPXAF in component parameter_values (mmHg_minute_per_L)"
    legend_constants[76] = "ANPXUL in component parameter_values (dimensionless)"
    legend_constants[77] = "ANT in component parameter_values (minute)"
    legend_constants[78] = "ANULL in component parameter_values (dimensionless)"
    legend_constants[79] = "ANUM in component parameter_values (dimensionless)"
    legend_constants[80] = "ANUVM in component parameter_values (dimensionless)"
    legend_constants[81] = "ANV in component parameter_values (minute)"
    legend_constants[82] = "ANXM in component parameter_values (dimensionless)"
    legend_constants[83] = "ANY in component parameter_values (litre)"
    legend_constants[84] = "AR1LM in component parameter_values (dimensionless)"
    legend_constants[85] = "AR2LM in component parameter_values (dimensionless)"
    legend_constants[86] = "ARF in component parameter_values (dimensionless)"
    legend_constants[87] = "AUC1 in component parameter_values (dimensionless)"
    legend_constants[88] = "AUDMP in component parameter_values (minute)"
    legend_constants[89] = "AUK in component parameter_values (per_minute)"
    legend_constants[90] = "AUL in component parameter_values (litre)"
    legend_constants[91] = "AULPM in component parameter_values (dimensionless)"
    legend_constants[92] = "AUM1 in component parameter_values (dimensionless)"
    legend_constants[93] = "AUM2 in component parameter_values (dimensionless)"
    legend_constants[94] = "AUMAX in component parameter_values (dimensionless)"
    legend_constants[95] = "AUMIN in component parameter_values (dimensionless)"
    legend_constants[96] = "AUMK1 in component parameter_values (dimensionless)"
    legend_constants[97] = "AUN1 in component parameter_values (dimensionless)"
    legend_constants[98] = "AURG in component parameter_values (dimensionless)"
    legend_constants[99] = "AUS in component parameter_values (dimensionless)"
    legend_constants[100] = "AUSLP in component parameter_values (dimensionless)"
    legend_constants[101] = "AUTO in component parameter_values (dimensionless)"
    legend_constants[102] = "AUTOGN in component parameter_values (dimensionless)"
    legend_constants[103] = "AUTOSN in component parameter_values (dimensionless)"
    legend_constants[104] = "AUX in component parameter_values (dimensionless)"
    legend_constants[105] = "BAROTC in component parameter_values (minute)"
    legend_constants[106] = "CFC in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[107] = "CKEEX in component parameter_values (dimensionless)"
    legend_constants[108] = "CMPTSS in component parameter_values (dimensionless)"
    legend_constants[109] = "CN2 in component parameter_values (per_mmHg)"
    legend_constants[110] = "CN7 in component parameter_values (dimensionless)"
    legend_constants[111] = "CNR in component parameter_values (monovalent_mEq_per_litre)"
    legend_constants[112] = "CPF in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[113] = "CPK in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[114] = "CPR in component parameter_values (gram_per_L)"
    legend_constants[115] = "CV in component parameter_values (L_per_mmHg)"
    legend_constants[116] = "CRRFLX in component parameter_values (mmHg)"
    legend_constants[117] = "DIURET in component parameter_values (dimensionless)"
    legend_constants[118] = "DHDTR in component parameter_values (per_mmHg_per_minute)"
    legend_constants[119] = "DTNAR in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[120] = "DTNARL in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[121] = "EARK in component parameter_values (mmHg_minute_per_L)"
    legend_constants[122] = "EARLL in component parameter_values (mmHg_minute_per_L)"
    legend_constants[123] = "EFAFR in component parameter_values (dimensionless)"
    legend_constants[124] = "EXC in component parameter_values (dimensionless)"
    legend_constants[125] = "EXCML in component parameter_values (dimensionless)"
    legend_constants[126] = "EXCXP in component parameter_values (dimensionless)"
    legend_constants[127] = "EXCXP2 in component parameter_values (dimensionless)"
    legend_constants[128] = "EXE in component parameter_values (mmHg)"
    legend_constants[129] = "GCOPF in component parameter_values (per_mmHg)"
    legend_constants[130] = "GFLC in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[131] = "GFNDMP in component parameter_values (dimensionless)"
    legend_constants[132] = "GFNLL in component parameter_values (L_per_minute)"
    legend_constants[133] = "GPPD in component parameter_values (dimensionless)"
    legend_constants[134] = "HM6 in component parameter_values (mmHg)"
    legend_constants[135] = "HM8 in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[136] = "HTAUML in component parameter_values (dimensionless)"
    legend_constants[137] = "KORGN in component parameter_values (dimensionless)"
    legend_constants[138] = "KORNER in component parameter_values (dimensionless)"
    legend_constants[139] = "KORREN in component parameter_values (dimensionless)"
    legend_constants[140] = "KORTC in component parameter_values (minute)"
    legend_constants[141] = "LPDE in component parameter_values (dimensionless)"
    legend_constants[142] = "LPK in component parameter_values (L_per_minute)"
    legend_constants[143] = "LPPR in component parameter_values (gram_per_minute)"
    legend_constants[144] = "MDFL1 in component parameter_values (dimensionless)"
    legend_constants[145] = "MDFLKM in component parameter_values (monovalent_mEq_per_litre)"
    legend_constants[146] = "MDFLW2 in component parameter_values (dimensionless)"
    legend_constants[147] = "MDFLWX in component parameter_values (dimensionless)"
    legend_constants[148] = "MDMP in component parameter_values (dimensionless)"
    legend_constants[149] = "O2A in component parameter_values (dimensionless)"
    legend_constants[150] = "O2CHMO in component parameter_values (per_mmHg)"
    legend_constants[151] = "OMM in component parameter_values (mL_per_minute)"
    legend_constants[152] = "PA4 in component parameter_values (dimensionless)"
    legend_constants[153] = "PAEX in component parameter_values (dimensionless)"
    legend_constants[154] = "PCE in component parameter_values (dimensionless)"
    legend_constants[155] = "PCR in component parameter_values (mmHg)"
    legend_constants[156] = "PR1LL in component parameter_values (mmHg)"
    legend_constants[157] = "PGHF in component parameter_values (L_mmHg_per_gram)"
    legend_constants[158] = "PK2 in component parameter_values (mmHg_per_mL)"
    legend_constants[159] = "PL2 in component parameter_values (L_mL_per_minute_per_mmHg)"
    legend_constants[160] = "PLDF in component parameter_values (mmHg)"
    legend_constants[161] = "PM5 in component parameter_values (per_mmHg)"
    legend_constants[162] = "PO2ADV in component parameter_values (dimensionless)"
    legend_constants[163] = "POK in component parameter_values (dimensionless)"
    legend_constants[164] = "POM in component parameter_values (dimensionless)"
    legend_constants[165] = "POM2 in component parameter_values (dimensionless)"
    legend_constants[166] = "PON in component parameter_values (dimensionless)"
    legend_constants[167] = "POR in component parameter_values (mmHg)"
    legend_constants[168] = "POZ in component parameter_values (dimensionless)"
    legend_constants[169] = "PXTP in component parameter_values (mmHg)"
    legend_constants[170] = "QAOLM in component parameter_values (dimensionless)"
    legend_constants[171] = "QRF in component parameter_values (L_per_minute)"
    legend_constants[172] = "RABSC in component parameter_values (per_mmHg)"
    legend_constants[173] = "RAM in component parameter_values (mmHg_minute_per_L)"
    legend_constants[174] = "RAPRSP in component parameter_values (mmHg)"
    legend_constants[175] = "RAR in component parameter_values (mmHg_minute_per_L)"
    legend_constants[176] = "RCDFDP in component parameter_values (minute)"
    legend_constants[177] = "RCDFPC in component parameter_values (dimensionless)"
    legend_constants[178] = "REK in component parameter_values (dimensionless)"
    legend_constants[179] = "RFABKM in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[180] = "RFABDM in component parameter_values (dimensionless)"
    legend_constants[181] = "RFABDP in component parameter_values (dimensionless)"
    legend_constants[182] = "RFCDFT in component parameter_values (dimensionless)"
    legend_constants[183] = "RKC in component parameter_values (per_minute)"
    legend_constants[184] = "RNAGTC in component parameter_values (minute)"
    legend_constants[185] = "RNAUAD in component parameter_values (per_minute)"
    legend_constants[186] = "RPS in component parameter_values (dimensionless)"
    legend_constants[187] = "RTPPR in component parameter_values (dimensionless)"
    legend_constants[188] = "RTPPRS in component parameter_values (mmHg)"
    legend_constants[189] = "RTSPRS in component parameter_values (mmHg)"
    legend_constants[190] = "RVRS in component parameter_values (mmHg_minute_per_L)"
    legend_constants[191] = "RVSM in component parameter_values (mmHg_minute_per_L)"
    legend_constants[192] = "SR in component parameter_values (dimensionless)"
    legend_constants[193] = "SR2 in component parameter_values (dimensionless)"
    legend_constants[194] = "SRK in component parameter_values (minute)"
    legend_constants[195] = "SRK2 in component parameter_values (minute)"
    legend_constants[196] = "STA in component parameter_values (dimensionless)"
    legend_constants[197] = "TENSGN in component parameter_values (dimensionless)"
    legend_constants[198] = "TENSTC in component parameter_values (minute)"
    legend_constants[199] = "TIMETR in component parameter_values (minute)"
    legend_constants[200] = "TRNSFS in component parameter_values (dimensionless)"
    legend_constants[201] = "TRPL in component parameter_values (L_per_minute)"
    legend_constants[202] = "TSSLML in component parameter_values (dimensionless)"
    legend_constants[203] = "TSSLTC in component parameter_values (per_minute)"
    legend_constants[204] = "TVDDL in component parameter_values (minute)"
    legend_constants[205] = "U in component parameter_values (dimensionless)"
    legend_constants[206] = "VID1 in component parameter_values (L_per_minute)"
    legend_constants[207] = "VIDML in component parameter_values (litre2_per_monovalent_mEq_per_minute)"
    legend_constants[208] = "VNTSTM in component parameter_values (dimensionless)"
    legend_constants[209] = "VP1 in component parameter_values (dimensionless)"
    legend_constants[210] = "VPTISS in component parameter_values (litre)"
    legend_constants[211] = "VTSF in component parameter_values (litre)"
    legend_constants[212] = "VV9 in component parameter_values (litre)"
    legend_constants[213] = "X in component parameter_values (dimensionless)"
    legend_constants[214] = "Z in component parameter_values (dimensionless)"
    legend_constants[215] = "Z4 in component parameter_values (dimensionless)"
    legend_constants[216] = "Z5 in component parameter_values (dimensionless)"
    legend_constants[217] = "Z6 in component parameter_values (dimensionless)"
    legend_constants[218] = "Z7 in component parameter_values (dimensionless)"
    legend_constants[219] = "Z10 in component parameter_values (mmHg)"
    legend_constants[220] = "Z11 in component parameter_values (per_mmHg2)"
    legend_constants[221] = "Z12 in component parameter_values (dimensionless)"
    legend_constants[222] = "Z13 in component parameter_values (dimensionless)"
    legend_constants[223] = "Z14 in component parameter_values (dimensionless)"
    legend_constants[224] = "Z16 in component parameter_values (dimensionless)"
    legend_constants[225] = "Z18 in component parameter_values (dimensionless)"
    legend_constants[226] = "Z19 in component parameter_values (dimensionless)"
    legend_constants[227] = "KID in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[228] = "URFORM in component parameter_values (mOsm_per_minute)"
    legend_constants[229] = "AUV in component parameter_values (dimensionless)"
    legend_constants[230] = "AUY in component parameter_values (dimensionless)"
    legend_constants[231] = "O2M in component parameter_values (mL_per_minute)"
    legend_constants[232] = "NID in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[233] = "ATRFBM in component parameter_values (dimensionless)"
    legend_constants[234] = "GBL in component parameter_values (mmHg)"
    legend_constants[235] = "RNAUGN in component parameter_values (minute_per_L)"
    legend_constants[236] = "RNAULL in component parameter_values (dimensionless)"
    legend_constants[237] = "RNAUUL in component parameter_values (dimensionless)"
    legend_constants[238] = "HSR in component parameter_values (dimensionless)"
    legend_constants[239] = "HSL in component parameter_values (dimensionless)"
    legend_constants[240] = "HMK in component parameter_values (dimensionless)"
    legend_constants[241] = "PO2AMB in component parameter_values (mmHg)"
    legend_constants[242] = "HKM in component parameter_values (dimensionless)"
    legend_constants[243] = "DR in component parameter_values (L_per_minute)"
    legend_constants[244] = "ANPKNS in component parameter_values (dimensionless)"
    legend_constants[245] = "RMULT1 in component parameter_values (dimensionless)"
    legend_constants[246] = "GLPCA in component parameter_values (mmHg)"
    legend_constants[247] = "RFN in component parameter_values (L_per_minute)"
    legend_constants[248] = "RFABX in component parameter_values (dimensionless)"
    legend_constants[249] = "ANPINF in component parameter_values (dimensionless)"
    legend_constants[250] = "FIS in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[251] = "CPPD in component parameter_values (gram_per_L)"
    legend_constants[252] = "TRRBC in component parameter_values (L_per_minute)"
    legend_constants[253] = "HYL in component parameter_values (gram)"
    legend_constants[254] = "ATRVM in component parameter_values (litre)"
    legend_constants[255] = "ADHC_init in component state_variables (dimensionless)"
    legend_constants[256] = "AHY_init in component state_variables (dimensionless)"
    legend_constants[257] = "AMC_init in component state_variables (dimensionless)"
    legend_constants[258] = "AMM1T_init in component state_variables (dimensionless)"
    legend_constants[259] = "AMM2_init in component state_variables (dimensionless)"
    legend_constants[260] = "ANC_init in component state_variables (dimensionless)"
    legend_constants[261] = "ANPC_init in component state_variables (dimensionless)"
    legend_constants[262] = "ANX1_init in component state_variables (dimensionless)"
    legend_constants[263] = "AR1T_init in component state_variables (dimensionless)"
    legend_constants[264] = "AR2T_init in component state_variables (dimensionless)"
    legend_constants[265] = "AR3T_init in component state_variables (dimensionless)"
    legend_constants[266] = "AU1_init in component state_variables (dimensionless)"
    legend_constants[267] = "AU4_init in component state_variables (dimensionless)"
    legend_constants[268] = "AU6_init in component state_variables (dimensionless)"
    legend_constants[269] = "DTKA_init in component state_variables (monovalent_mEq_per_minute)"
    legend_constants[270] = "HMD1_init in component state_variables (dimensionless)"
    legend_constants[271] = "HPL_init in component state_variables (dimensionless)"
    legend_constants[272] = "HPR_init in component state_variables (dimensionless)"
    legend_constants[273] = "KTOT_init in component state_variables (monovalent_mEq)"
    legend_constants[274] = "NAE_init in component state_variables (monovalent_mEq)"
    legend_constants[275] = "O2VAD1_init in component state_variables (dimensionless)"
    legend_constants[276] = "OSV_init in component state_variables (dimensionless)"
    legend_constants[277] = "OVA_init in component state_variables (mL_per_L)"
    legend_constants[278] = "OVS_init in component state_variables (dimensionless)"
    legend_constants[279] = "PAR1_init in component state_variables (mmHg)"
    legend_constants[280] = "PC_init in component state_variables (mmHg)"
    legend_constants[281] = "PLUR_init in component state_variables (mOsm)"
    legend_constants[282] = "PPR1_init in component state_variables (gram)"
    legend_constants[283] = "PRP_init in component state_variables (gram)"
    legend_constants[284] = "QO2T_init in component state_variables (mL)"
    legend_constants[285] = "QOM1_init in component state_variables (mL)"
    legend_constants[286] = "RNAUG3_init in component state_variables (dimensionless)"
    legend_constants[287] = "TSP_init in component state_variables (gram)"
    legend_constants[288] = "TVD_init in component state_variables (L_per_minute)"
    legend_constants[289] = "VAS1_init in component state_variables (litre)"
    legend_constants[290] = "VIC_init in component state_variables (litre)"
    legend_constants[291] = "VLA1_init in component state_variables (litre)"
    legend_constants[292] = "VPA1_init in component state_variables (litre)"
    legend_constants[293] = "VPF1_init in component state_variables (litre)"
    legend_constants[294] = "VP_init in component state_variables (litre)"
    legend_constants[295] = "VRA1_init in component state_variables (litre)"
    legend_constants[296] = "VRC_init in component state_variables (litre)"
    legend_constants[297] = "VTS2_init in component state_variables (litre)"
    legend_constants[298] = "VTW_init in component state_variables (litre)"
    legend_constants[299] = "VV6_init in component state_variables (litre)"
    legend_constants[300] = "VV7_init in component state_variables (litre)"
    legend_constants[301] = "VVS1_init in component state_variables (litre)"
    legend_algebraic[54] = "BFM in component blood_flow_through_M_tissues (L_per_minute)"
    legend_algebraic[55] = "BFN in component blood_flow_through_NM_NR_tissues (L_per_minute)"
    legend_algebraic[36] = "PA in component arterial_pressure_and_pressure_gradient (mmHg)"
    legend_algebraic[17] = "PLA in component left_atrial_pressure (mmHg)"
    legend_algebraic[8] = "PPA in component pulmonary_vasculature_pressure (mmHg)"
    legend_algebraic[3] = "PRA in component right_atrial_pressure (mmHg)"
    legend_algebraic[29] = "PVS in component venous_average_pressure (mmHg)"
    legend_algebraic[58] = "QAO in component systemic_blood_flow (L_per_minute)"
    legend_algebraic[41] = "QLO in component left_ventricular_output (L_per_minute)"
    legend_algebraic[45] = "QRO in component right_ventricular_output (L_per_minute)"
    legend_algebraic[14] = "RPA in component pulmonary_arterial_resistance (mmHg_minute_per_L)"
    legend_algebraic[19] = "RPV in component pulmonary_venous_resistance (mmHg_minute_per_L)"
    legend_constants[582] = "RVS in component venous_resistance (mmHg_minute_per_L)"
    legend_algebraic[27] = "VVE in component venous_excess_volume (litre)"
    legend_constants[302] = "A1K in component parameter_values (minute)"
    legend_constants[303] = "A2K in component parameter_values (minute)"
    legend_constants[304] = "A3K in component parameter_values (minute)"
    legend_constants[305] = "A4K in component parameter_values (minute)"
    legend_constants[306] = "A4K2 in component parameter_values (minute)"
    legend_constants[307] = "AARK in component parameter_values (mmHg_minute_per_L)"
    legend_constants[308] = "AARLL in component parameter_values (mmHg_minute_per_L)"
    legend_constants[309] = "ADHINF in component parameter_values (dimensionless)"
    legend_constants[310] = "ADHKLL in component parameter_values (dimensionless)"
    legend_constants[311] = "ADHKUL in component parameter_values (dimensionless)"
    legend_constants[312] = "ADHPAM in component parameter_values (per_mmHg2)"
    legend_constants[313] = "ADHPUL in component parameter_values (mmHg)"
    legend_constants[314] = "ADHTC in component parameter_values (minute)"
    legend_constants[315] = "ADHVLL in component parameter_values (dimensionless)"
    legend_constants[316] = "ADHVUL in component parameter_values (dimensionless)"
    legend_constants[317] = "AH10 in component parameter_values (dimensionless)"
    legend_constants[318] = "AH11 in component parameter_values (minute)"
    legend_constants[319] = "AH9 in component parameter_values (per_mmHg)"
    legend_constants[320] = "AHMNAR in component parameter_values (dimensionless)"
    legend_constants[321] = "AHTHM in component parameter_values (dimensionless)"
    legend_constants[322] = "ALCLK in component parameter_values (dimensionless)"
    legend_constants[323] = "ALDINF in component parameter_values (dimensionless)"
    legend_constants[324] = "ALDKNS in component parameter_values (dimensionless)"
    legend_constants[325] = "ALDMM in component parameter_values (dimensionless)"
    legend_constants[326] = "AM1LL in component parameter_values (dimensionless)"
    legend_constants[327] = "AM1UL in component parameter_values (dimensionless)"
    legend_constants[328] = "AMCSNS in component parameter_values (dimensionless)"
    legend_constants[329] = "AMKM in component parameter_values (dimensionless)"
    legend_constants[330] = "AMKMUL in component parameter_values (dimensionless)"
    legend_constants[331] = "AMM1LM in component parameter_values (dimensionless)"
    legend_constants[332] = "AMM4 in component parameter_values (dimensionless)"
    legend_constants[333] = "AMNALL in component parameter_values (dimensionless)"
    legend_constants[334] = "AMNAM in component parameter_values (dimensionless)"
    legend_constants[335] = "AMNAUL in component parameter_values (dimensionless)"
    legend_constants[336] = "AMT in component parameter_values (minute)"
    legend_constants[337] = "ANCSNS in component parameter_values (dimensionless)"
    legend_constants[338] = "ANGINF in component parameter_values (dimensionless)"
    legend_constants[339] = "ANGKNS in component parameter_values (dimensionless)"
    legend_constants[340] = "ANMALD in component parameter_values (dimensionless)"
    legend_constants[341] = "ANMAM in component parameter_values (dimensionless)"
    legend_constants[342] = "ANMARL in component parameter_values (dimensionless)"
    legend_constants[343] = "ANMEM in component parameter_values (dimensionless)"
    legend_constants[344] = "ANMKEL in component parameter_values (dimensionless)"
    legend_constants[345] = "ANMKEM in component parameter_values (dimensionless)"
    legend_constants[346] = "ANMLL in component parameter_values (dimensionless)"
    legend_constants[347] = "ANMNAM in component parameter_values (dimensionless)"
    legend_constants[348] = "ANMSLT in component parameter_values (dimensionless)"
    legend_constants[349] = "ANMTM in component parameter_values (dimensionless)"
    legend_constants[350] = "ANMUL in component parameter_values (dimensionless)"
    legend_constants[351] = "ANPTC in component parameter_values (minute)"
    legend_constants[352] = "ANPXAF in component parameter_values (mmHg_minute_per_L)"
    legend_constants[353] = "ANPXUL in component parameter_values (dimensionless)"
    legend_constants[354] = "ANT in component parameter_values (minute)"
    legend_constants[355] = "ANULL in component parameter_values (dimensionless)"
    legend_constants[356] = "ANUM in component parameter_values (dimensionless)"
    legend_constants[357] = "ANUVM in component parameter_values (dimensionless)"
    legend_constants[358] = "ANV in component parameter_values (minute)"
    legend_constants[359] = "ANXM in component parameter_values (dimensionless)"
    legend_constants[360] = "ANY in component parameter_values (litre)"
    legend_constants[361] = "AR1LM in component parameter_values (dimensionless)"
    legend_constants[362] = "AR2LM in component parameter_values (dimensionless)"
    legend_constants[363] = "ARF in component parameter_values (dimensionless)"
    legend_constants[364] = "AUC1 in component parameter_values (dimensionless)"
    legend_constants[365] = "AUDMP in component parameter_values (minute)"
    legend_constants[366] = "AUK in component parameter_values (per_minute)"
    legend_constants[367] = "AUL in component parameter_values (litre)"
    legend_constants[368] = "AULPM in component parameter_values (dimensionless)"
    legend_constants[369] = "AUM1 in component parameter_values (dimensionless)"
    legend_constants[370] = "AUM2 in component parameter_values (dimensionless)"
    legend_constants[371] = "AUMAX in component parameter_values (dimensionless)"
    legend_constants[372] = "AUMIN in component parameter_values (dimensionless)"
    legend_constants[373] = "AUMK1 in component parameter_values (dimensionless)"
    legend_constants[374] = "AUN1 in component parameter_values (dimensionless)"
    legend_constants[375] = "AURG in component parameter_values (dimensionless)"
    legend_constants[376] = "AUS in component parameter_values (dimensionless)"
    legend_constants[377] = "AUSLP in component parameter_values (dimensionless)"
    legend_constants[378] = "AUTO in component parameter_values (dimensionless)"
    legend_constants[379] = "AUTOGN in component parameter_values (dimensionless)"
    legend_constants[380] = "AUTOSN in component parameter_values (dimensionless)"
    legend_constants[381] = "AUX in component parameter_values (dimensionless)"
    legend_constants[382] = "BAROTC in component parameter_values (minute)"
    legend_constants[383] = "CFC in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[384] = "CKEEX in component parameter_values (dimensionless)"
    legend_constants[385] = "CMPTSS in component parameter_values (dimensionless)"
    legend_constants[386] = "CN2 in component parameter_values (per_mmHg)"
    legend_constants[387] = "CN7 in component parameter_values (dimensionless)"
    legend_constants[388] = "CNR in component parameter_values (monovalent_mEq_per_litre)"
    legend_constants[389] = "CPF in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[390] = "CPK in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[391] = "CPR in component parameter_values (gram_per_L)"
    legend_constants[392] = "CV in component parameter_values (L_per_mmHg)"
    legend_constants[393] = "CRRFLX in component parameter_values (mmHg)"
    legend_constants[394] = "DIURET in component parameter_values (dimensionless)"
    legend_constants[395] = "DHDTR in component parameter_values (per_mmHg_per_minute)"
    legend_constants[396] = "DTNAR in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[397] = "DTNARL in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[398] = "EARK in component parameter_values (mmHg_minute_per_L)"
    legend_constants[399] = "EARLL in component parameter_values (mmHg_minute_per_L)"
    legend_constants[400] = "EFAFR in component parameter_values (dimensionless)"
    legend_constants[401] = "EXC in component parameter_values (dimensionless)"
    legend_constants[402] = "EXCML in component parameter_values (dimensionless)"
    legend_constants[403] = "EXCXP in component parameter_values (dimensionless)"
    legend_constants[404] = "EXCXP2 in component parameter_values (dimensionless)"
    legend_constants[405] = "EXE in component parameter_values (mmHg)"
    legend_constants[406] = "GCOPF in component parameter_values (per_mmHg)"
    legend_constants[407] = "GFLC in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[408] = "GFNDMP in component parameter_values (dimensionless)"
    legend_constants[409] = "GFNLL in component parameter_values (L_per_minute)"
    legend_constants[410] = "GPPD in component parameter_values (dimensionless)"
    legend_constants[411] = "HM6 in component parameter_values (mmHg)"
    legend_constants[412] = "HM8 in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[413] = "HTAUML in component parameter_values (dimensionless)"
    legend_constants[414] = "KORGN in component parameter_values (dimensionless)"
    legend_constants[415] = "KORNER in component parameter_values (dimensionless)"
    legend_constants[416] = "KORREN in component parameter_values (dimensionless)"
    legend_constants[417] = "KORTC in component parameter_values (minute)"
    legend_constants[418] = "LPDE in component parameter_values (dimensionless)"
    legend_constants[419] = "LPK in component parameter_values (L_per_minute)"
    legend_constants[420] = "LPPR in component parameter_values (gram_per_minute)"
    legend_constants[421] = "MDFL1 in component parameter_values (dimensionless)"
    legend_constants[422] = "MDFLKM in component parameter_values (monovalent_mEq_per_litre)"
    legend_constants[423] = "MDFLW2 in component parameter_values (dimensionless)"
    legend_constants[424] = "MDFLWX in component parameter_values (dimensionless)"
    legend_constants[425] = "MDMP in component parameter_values (dimensionless)"
    legend_constants[426] = "O2A in component parameter_values (dimensionless)"
    legend_constants[427] = "O2CHMO in component parameter_values (per_mmHg)"
    legend_constants[428] = "OMM in component parameter_values (mL_per_minute)"
    legend_constants[429] = "PA4 in component parameter_values (dimensionless)"
    legend_constants[430] = "PAEX in component parameter_values (dimensionless)"
    legend_constants[431] = "PCE in component parameter_values (dimensionless)"
    legend_constants[432] = "PCR in component parameter_values (mmHg)"
    legend_constants[433] = "PR1LL in component parameter_values (mmHg)"
    legend_constants[434] = "PGHF in component parameter_values (L_mmHg_per_gram)"
    legend_constants[435] = "PK2 in component parameter_values (mmHg_per_mL)"
    legend_constants[436] = "PL2 in component parameter_values (L_mL_per_minute_per_mmHg)"
    legend_constants[437] = "PLDF in component parameter_values (mmHg)"
    legend_constants[438] = "PM5 in component parameter_values (per_mmHg)"
    legend_constants[439] = "PO2ADV in component parameter_values (dimensionless)"
    legend_constants[440] = "POK in component parameter_values (dimensionless)"
    legend_constants[441] = "POM in component parameter_values (dimensionless)"
    legend_constants[442] = "POM2 in component parameter_values (dimensionless)"
    legend_constants[443] = "PON in component parameter_values (dimensionless)"
    legend_constants[444] = "POR in component parameter_values (mmHg)"
    legend_constants[445] = "POZ in component parameter_values (dimensionless)"
    legend_constants[446] = "PXTP in component parameter_values (mmHg)"
    legend_constants[447] = "QAOLM in component parameter_values (dimensionless)"
    legend_constants[448] = "QRF in component parameter_values (L_per_minute)"
    legend_constants[449] = "RABSC in component parameter_values (per_mmHg)"
    legend_constants[450] = "RAM in component parameter_values (mmHg_minute_per_L)"
    legend_constants[451] = "RAPRSP in component parameter_values (mmHg)"
    legend_constants[452] = "RAR in component parameter_values (mmHg_minute_per_L)"
    legend_constants[453] = "RCDFDP in component parameter_values (minute)"
    legend_constants[454] = "RCDFPC in component parameter_values (dimensionless)"
    legend_constants[455] = "REK in component parameter_values (dimensionless)"
    legend_constants[456] = "RFABKM in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[457] = "RFABDM in component parameter_values (dimensionless)"
    legend_constants[458] = "RFABDP in component parameter_values (dimensionless)"
    legend_constants[459] = "RFCDFT in component parameter_values (dimensionless)"
    legend_constants[460] = "RKC in component parameter_values (per_minute)"
    legend_constants[461] = "RNAGTC in component parameter_values (minute)"
    legend_constants[462] = "RNAUAD in component parameter_values (per_minute)"
    legend_constants[463] = "RPS in component parameter_values (dimensionless)"
    legend_constants[464] = "RTPPR in component parameter_values (dimensionless)"
    legend_constants[465] = "RTPPRS in component parameter_values (mmHg)"
    legend_constants[466] = "RTSPRS in component parameter_values (mmHg)"
    legend_constants[467] = "RVRS in component parameter_values (mmHg_minute_per_L)"
    legend_constants[468] = "RVSM in component parameter_values (mmHg_minute_per_L)"
    legend_constants[469] = "SR in component parameter_values (dimensionless)"
    legend_constants[470] = "SR2 in component parameter_values (dimensionless)"
    legend_constants[471] = "SRK in component parameter_values (minute)"
    legend_constants[472] = "SRK2 in component parameter_values (minute)"
    legend_constants[473] = "STA in component parameter_values (dimensionless)"
    legend_constants[474] = "TENSGN in component parameter_values (dimensionless)"
    legend_constants[475] = "TENSTC in component parameter_values (minute)"
    legend_constants[476] = "TIMETR in component parameter_values (minute)"
    legend_constants[477] = "TRNSFS in component parameter_values (dimensionless)"
    legend_constants[478] = "TRPL in component parameter_values (L_per_minute)"
    legend_constants[479] = "TSSLML in component parameter_values (dimensionless)"
    legend_constants[480] = "TSSLTC in component parameter_values (per_minute)"
    legend_constants[481] = "TVDDL in component parameter_values (minute)"
    legend_constants[482] = "U in component parameter_values (dimensionless)"
    legend_constants[483] = "VID1 in component parameter_values (L_per_minute)"
    legend_constants[484] = "VIDML in component parameter_values (litre2_per_monovalent_mEq_per_minute)"
    legend_constants[485] = "VNTSTM in component parameter_values (dimensionless)"
    legend_constants[486] = "VP1 in component parameter_values (dimensionless)"
    legend_constants[487] = "VPTISS in component parameter_values (litre)"
    legend_constants[488] = "VTSF in component parameter_values (litre)"
    legend_constants[489] = "VV9 in component parameter_values (litre)"
    legend_constants[490] = "X in component parameter_values (dimensionless)"
    legend_constants[491] = "Z in component parameter_values (dimensionless)"
    legend_constants[492] = "Z4 in component parameter_values (dimensionless)"
    legend_constants[493] = "Z5 in component parameter_values (dimensionless)"
    legend_constants[494] = "Z6 in component parameter_values (dimensionless)"
    legend_constants[495] = "Z7 in component parameter_values (dimensionless)"
    legend_constants[496] = "Z10 in component parameter_values (mmHg)"
    legend_constants[497] = "Z11 in component parameter_values (per_mmHg2)"
    legend_constants[498] = "Z12 in component parameter_values (dimensionless)"
    legend_constants[499] = "Z13 in component parameter_values (dimensionless)"
    legend_constants[500] = "Z14 in component parameter_values (dimensionless)"
    legend_constants[501] = "Z16 in component parameter_values (dimensionless)"
    legend_constants[502] = "Z18 in component parameter_values (dimensionless)"
    legend_constants[503] = "Z19 in component parameter_values (dimensionless)"
    legend_constants[504] = "KID in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[505] = "URFORM in component parameter_values (mOsm_per_minute)"
    legend_constants[506] = "AUV in component parameter_values (dimensionless)"
    legend_constants[507] = "AUY in component parameter_values (dimensionless)"
    legend_constants[508] = "O2M in component parameter_values (mL_per_minute)"
    legend_constants[509] = "NID in component parameter_values (monovalent_mEq_per_minute)"
    legend_constants[510] = "ATRFBM in component parameter_values (dimensionless)"
    legend_constants[511] = "GBL in component parameter_values (mmHg)"
    legend_constants[512] = "RNAUGN in component parameter_values (minute_per_L)"
    legend_constants[513] = "RNAULL in component parameter_values (dimensionless)"
    legend_constants[514] = "RNAUUL in component parameter_values (dimensionless)"
    legend_constants[515] = "HSR in component parameter_values (dimensionless)"
    legend_constants[516] = "HSL in component parameter_values (dimensionless)"
    legend_constants[517] = "HMK in component parameter_values (dimensionless)"
    legend_constants[518] = "PO2AMB in component parameter_values (mmHg)"
    legend_constants[519] = "HKM in component parameter_values (dimensionless)"
    legend_constants[520] = "DR in component parameter_values (L_per_minute)"
    legend_constants[521] = "ANPKNS in component parameter_values (dimensionless)"
    legend_constants[522] = "RMULT1 in component parameter_values (dimensionless)"
    legend_constants[523] = "GLPCA in component parameter_values (mmHg)"
    legend_constants[524] = "RFN in component parameter_values (L_per_minute)"
    legend_constants[525] = "RFABX in component parameter_values (dimensionless)"
    legend_constants[526] = "ANPINF in component parameter_values (dimensionless)"
    legend_constants[527] = "FIS in component parameter_values (L_per_minute_per_mmHg)"
    legend_constants[528] = "CPPD in component parameter_values (gram_per_L)"
    legend_constants[529] = "TRRBC in component parameter_values (L_per_minute)"
    legend_constants[530] = "HYL in component parameter_values (gram)"
    legend_constants[531] = "ATRVM in component parameter_values (litre)"
    legend_constants[532] = "ADHC_init in component state_variables (dimensionless)"
    legend_constants[533] = "AHY_init in component state_variables (dimensionless)"
    legend_constants[534] = "AMC_init in component state_variables (dimensionless)"
    legend_constants[535] = "AMM1T_init in component state_variables (dimensionless)"
    legend_constants[536] = "AMM2_init in component state_variables (dimensionless)"
    legend_constants[537] = "ANC_init in component state_variables (dimensionless)"
    legend_constants[538] = "ANPC_init in component state_variables (dimensionless)"
    legend_constants[539] = "ANX1_init in component state_variables (dimensionless)"
    legend_constants[540] = "AR1T_init in component state_variables (dimensionless)"
    legend_constants[541] = "AR2T_init in component state_variables (dimensionless)"
    legend_constants[542] = "AR3T_init in component state_variables (dimensionless)"
    legend_constants[543] = "AU1_init in component state_variables (dimensionless)"
    legend_constants[544] = "AU4_init in component state_variables (dimensionless)"
    legend_constants[545] = "AU6_init in component state_variables (dimensionless)"
    legend_constants[546] = "DTKA_init in component state_variables (monovalent_mEq_per_minute)"
    legend_constants[547] = "HMD1_init in component state_variables (dimensionless)"
    legend_constants[548] = "HPL_init in component state_variables (dimensionless)"
    legend_constants[549] = "HPR_init in component state_variables (dimensionless)"
    legend_constants[550] = "KTOT_init in component state_variables (monovalent_mEq)"
    legend_constants[551] = "NAE_init in component state_variables (monovalent_mEq)"
    legend_constants[552] = "O2VAD1_init in component state_variables (dimensionless)"
    legend_constants[553] = "OSV_init in component state_variables (dimensionless)"
    legend_constants[554] = "OVA_init in component state_variables (mL_per_L)"
    legend_constants[555] = "OVS_init in component state_variables (dimensionless)"
    legend_constants[556] = "PAR1_init in component state_variables (mmHg)"
    legend_constants[557] = "PC_init in component state_variables (mmHg)"
    legend_constants[558] = "PLUR_init in component state_variables (mOsm)"
    legend_constants[559] = "PPR1_init in component state_variables (gram)"
    legend_constants[560] = "PRP_init in component state_variables (gram)"
    legend_constants[561] = "QO2T_init in component state_variables (mL)"
    legend_constants[562] = "QOM1_init in component state_variables (mL)"
    legend_constants[563] = "RNAUG3_init in component state_variables (dimensionless)"
    legend_constants[564] = "TSP_init in component state_variables (gram)"
    legend_constants[565] = "TVD_init in component state_variables (L_per_minute)"
    legend_constants[566] = "VAS1_init in component state_variables (litre)"
    legend_constants[567] = "VIC_init in component state_variables (litre)"
    legend_constants[568] = "VLA1_init in component state_variables (litre)"
    legend_constants[569] = "VPA1_init in component state_variables (litre)"
    legend_constants[570] = "VPF1_init in component state_variables (litre)"
    legend_constants[571] = "VP_init in component state_variables (litre)"
    legend_constants[572] = "VRA1_init in component state_variables (litre)"
    legend_constants[573] = "VRC_init in component state_variables (litre)"
    legend_constants[574] = "VTS2_init in component state_variables (litre)"
    legend_constants[575] = "VTW_init in component state_variables (litre)"
    legend_constants[576] = "VV6_init in component state_variables (litre)"
    legend_constants[577] = "VV7_init in component state_variables (litre)"
    legend_constants[578] = "VVS1_init in component state_variables (litre)"
    legend_states[0] = "VVS1 in component venous_blood_volume (litre)"
    legend_states[1] = "VAS1 in component arterial_blood_volume (litre)"
    legend_states[2] = "VLA1 in component left_atrial_blood_volume (litre)"
    legend_states[3] = "VPA1 in component pulmonary_vasculature_blood_volume (litre)"
    legend_states[4] = "VRA1 in component right_atrial_blood_volume (litre)"
    legend_algebraic[0] = "VBD in component total_blood_volume_change (litre)"
    legend_algebraic[33] = "QVO in component rate_of_blood_flow_from_veins_to_right_atrium (L_per_minute)"
    legend_algebraic[1] = "VRA in component right_atrial_blood_volume (litre)"
    legend_algebraic[47] = "DRA in component right_atrial_blood_volume (L_per_minute)"
    legend_algebraic[2] = "VRE in component right_atrial_pressure (litre)"
    legend_algebraic[4] = "PRA1 in component autonomic_stimulation_effect_on_right_atrial_pressure (mmHg)"
    legend_algebraic[10] = "RVM in component pressure_effect_on_right_ventricular_pumping (dimensionless)"
    legend_algebraic[9] = "PP2 in component pressure_effect_on_right_ventricular_pumping (mmHg)"
    legend_algebraic[24] = "QLN in component left_ventricular_output (L_per_minute)"
    legend_algebraic[42] = "HPEF in component pumping_effectiveness_of_right_ventricle (L_per_minute)"
    legend_algebraic[5] = "QRN in component right_ventricular_output (dimensionless)"
    legend_algebraic[22] = "QPO in component rate_of_blood_flow_from_pulmonary_veins_to_left_atrium (L_per_minute)"
    legend_algebraic[6] = "VPA in component pulmonary_vasculature_blood_volume (litre)"
    legend_algebraic[48] = "DPA in component pulmonary_vasculature_blood_volume (L_per_minute)"
    legend_algebraic[7] = "VPE in component pulmonary_vasculature_pressure (litre)"
    legend_algebraic[11] = "PP1T in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)"
    legend_algebraic[12] = "PP1 in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)"
    legend_algebraic[13] = "CPA in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)"
    legend_algebraic[18] = "PL1 in component pulmonary_venous_resistance (mmHg)"
    legend_algebraic[20] = "RPT in component total_pulmonary_vascular_resistance (mmHg_minute_per_L)"
    legend_algebraic[21] = "PGL in component pressure_gradient_through_the_lungs (mmHg)"
    legend_algebraic[15] = "VLA in component left_atrial_blood_volume (litre)"
    legend_algebraic[43] = "DLA in component left_atrial_blood_volume (L_per_minute)"
    legend_algebraic[16] = "VLE in component left_atrial_pressure (litre)"
    legend_algebraic[23] = "PLA1 in component autonomic_stimulation_effect_on_left_atrial_pressure (mmHg)"
    legend_algebraic[38] = "LVM in component pumping_effectiveness_of_left_ventricle (dimensionless)"
    legend_algebraic[37] = "PA2 in component pumping_effectiveness_of_left_ventricle (mmHg)"
    legend_algebraic[39] = "QLOT in component left_ventricular_output (L_per_minute)"
    legend_algebraic[40] = "QLO1 in component left_ventricular_output (L_per_minute)"
    legend_algebraic[25] = "VVS in component venous_blood_volume (litre)"
    legend_algebraic[59] = "DVS in component venous_blood_volume (L_per_minute)"
    legend_constants[579] = "VVA in component angiotensin_induced_venous_constriction (litre)"
    legend_algebraic[26] = "VVE1 in component venous_excess_volume (litre)"
    legend_algebraic[28] = "PVS1 in component venous_average_pressure (mmHg)"
    legend_algebraic[30] = "PR1 in component venous_outflow_pressure_into_heart (mmHg)"
    legend_algebraic[31] = "RVG in component resistance_from_veins_to_right_atrium (mmHg_minute_per_L)"
    legend_algebraic[32] = "PGV in component rate_of_blood_flow_from_veins_to_right_atrium (mmHg)"
    legend_constants[580] = "CN3 in component venous_resistance (dimensionless)"
    legend_constants[581] = "RV1 in component venous_resistance (mmHg_minute_per_L)"
    legend_constants[583] = "NNRVR in component NM_NR_venous_resistance (mmHg_minute_per_L)"
    legend_algebraic[34] = "VAS in component arterial_blood_volume (litre)"
    legend_algebraic[60] = "DAS in component arterial_blood_volume (L_per_minute)"
    legend_algebraic[44] = "PAG in component arterial_pressure_and_pressure_gradient (mmHg)"
    legend_algebraic[35] = "VAE in component arterial_pressure_and_pressure_gradient (litre)"
    legend_algebraic[46] = "PAM in component pressure_effect_on_arterial_distention (dimensionless)"
    legend_algebraic[49] = "R1 in component non_renal_systemic_arterial_resistance_multiplier (dimensionless)"
    legend_algebraic[50] = "NNRAR in component NM_NR_arterial_resistance (mmHg_minute_per_L)"
    legend_algebraic[51] = "PGS in component pressure_gradient_from_arteries_to_veins (mmHg)"
    legend_algebraic[52] = "RSM in component M_systemic_resistance (mmHg_minute_per_L)"
    legend_algebraic[53] = "RSN in component total_NM_NR_systemic_resistance (mmHg_minute_per_L)"
    legend_algebraic[56] = "FISFLO in component blood_flow_through_AV_fistulas (L_per_minute)"
    legend_algebraic[57] = "SYSFLO in component systemic_blood_flow (L_per_minute)"
    legend_algebraic[61] = "RTP in component total_peripheral_resistance (mmHg_minute_per_L)"
    legend_rates[4] = "d/dt VRA1 in component right_atrial_blood_volume (litre)"
    legend_rates[3] = "d/dt VPA1 in component pulmonary_vasculature_blood_volume (litre)"
    legend_rates[2] = "d/dt VLA1 in component left_atrial_blood_volume (litre)"
    legend_rates[0] = "d/dt VVS1 in component venous_blood_volume (litre)"
    legend_rates[1] = "d/dt VAS1 in component arterial_blood_volume (litre)"
    return (legend_states, legend_algebraic, legend_voi, legend_constants)

def initConsts():
    constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
    constants[0] = 0.925271
    constants[1] = 1.0
    constants[2] = 1.0
    constants[3] = 1.0
    constants[4] = 1.0
    constants[5] = 1.16463
    constants[6] = 1.00076
    constants[7] = 1.0
    constants[8] = 1.0
    constants[9] = 16.9144
    constants[10] = 1.22057
    constants[11] = 2.50967
    constants[12] = 0.0101913
    constants[13] = 0.00366525
    constants[14] = 0.0
    constants[15] = 3.00449
    constants[16] = 2.00439
    constants[17] = 1.00237
    constants[18] = 1.0
    constants[19] = 1.00012
    constants[20] = 0.97287
    constants[21] = 1.00163
    constants[22] = 1.0
    constants[23] = 1.00066
    constants[24] = 1.00022
    constants[25] = 0.5
    constants[26] = 60
    constants[27] = 40000
    constants[28] = 0.1
    constants[29] = 40000
    constants[30] = 1
    constants[31] = 4
    constants[32] = 0
    constants[33] = 0.2
    constants[34] = 5
    constants[35] = 0.3
    constants[36] = 85
    constants[37] = 15
    constants[38] = 0.93617
    constants[39] = 2.5
    constants[40] = 0.333
    constants[41] = 1000
    constants[42] = 1
    constants[43] = 0.3
    constants[44] = 2
    constants[45] = 0.3
    constants[46] = 0
    constants[47] = 0
    constants[48] = 2.5
    constants[49] = 0
    constants[50] = 5
    constants[51] = 0.65
    constants[52] = 0.5
    constants[53] = 12
    constants[54] = 0.005
    constants[55] = 0.005
    constants[56] = 0.04
    constants[57] = 0.8
    constants[58] = 15
    constants[59] = 60
    constants[60] = 0.4
    constants[61] = 0
    constants[62] = 0
    constants[63] = 2.5
    constants[64] = 1.4
    constants[65] = 0.86
    constants[66] = 1.6
    constants[67] = 0.3
    constants[68] = 2
    constants[69] = 0.7
    constants[70] = 1
    constants[71] = 2
    constants[72] = 1.5
    constants[73] = 1.8
    constants[74] = 4
    constants[75] = 1.5
    constants[76] = 10
    constants[77] = 12
    constants[78] = 0.8
    constants[79] = 6
    constants[80] = 0
    constants[81] = 5000
    constants[82] = 0
    constants[83] = -0.2
    constants[84] = 0.005
    constants[85] = 0.005
    constants[86] = 0.5
    constants[87] = 0.3
    constants[88] = 0.3
    constants[89] = 0.004
    constants[90] = 1.5
    constants[91] = 0
    constants[92] = 3
    constants[93] = 1
    constants[94] = 5.0
    constants[95] = 0.4
    constants[96] = 0.3
    constants[97] = 0.5
    constants[98] = 1.0
    constants[99] = 1
    constants[100] = 1.5
    constants[101] = 0
    constants[102] = 7
    constants[103] = 0.9
    constants[104] = 1
    constants[105] = 0.16
    constants[106] = 0.01167
    constants[107] = 4
    constants[108] = 2
    constants[109] = 0.0212
    constants[110] = 0.2
    constants[111] = 139
    constants[112] = 0.0003
    constants[113] = 0.000253
    constants[114] = 40
    constants[115] = 0.1
    constants[116] = 0
    constants[117] = 1
    constants[118] = 0.05
    constants[119] = 0.675
    constants[120] = 1e-06
    constants[121] = 1
    constants[122] = 24
    constants[123] = 0
    constants[124] = 1
    constants[125] = 0.01
    constants[126] = 1.0
    constants[127] = 0.17
    constants[128] = 0
    constants[129] = 0.8092
    constants[130] = 0.0208333
    constants[131] = 3
    constants[132] = 0.001
    constants[133] = 1.0
    constants[134] = 1850
    constants[135] = 4.714e-08
    constants[136] = 0.4
    constants[137] = 1
    constants[138] = 0
    constants[139] = 0
    constants[140] = 10000
    constants[141] = 8
    constants[142] = 2.728e-14
    constants[143] = 0.03
    constants[144] = 10
    constants[145] = 0.667
    constants[146] = 0.005
    constants[147] = 0.01
    constants[148] = 0
    constants[149] = 0.1
    constants[150] = 0.01
    constants[151] = 57.1
    constants[152] = 1
    constants[153] = 2
    constants[154] = 1
    constants[155] = 15
    constants[156] = 0
    constants[157] = -2
    constants[158] = 0.79167
    constants[159] = 1.8
    constants[160] = 4.2
    constants[161] = 30
    constants[162] = 0.001
    constants[163] = 0.1
    constants[164] = 0.04
    constants[165] = 2
    constants[166] = 0.1
    constants[167] = 35
    constants[168] = 2
    constants[169] = 8
    constants[170] = 0.2
    constants[171] = 0.15
    constants[172] = 0.5
    constants[173] = 96.3
    constants[174] = 0
    constants[175] = 30.52
    constants[176] = 2000
    constants[177] = 0
    constants[178] = 1
    constants[179] = 0.03
    constants[180] = 0.3
    constants[181] = 1
    constants[182] = 0
    constants[183] = 5.8e-06
    constants[184] = 15
    constants[185] = 0
    constants[186] = 0
    constants[187] = 0.9
    constants[188] = 15.2
    constants[189] = 6
    constants[190] = 19.167
    constants[191] = 1
    constants[192] = 1
    constants[193] = 1
    constants[194] = 5
    constants[195] = 10000
    constants[196] = 0
    constants[197] = 0
    constants[198] = 0.05
    constants[199] = 0
    constants[200] = 0
    constants[201] = 0
    constants[202] = 0.15
    constants[203] = 0.005
    constants[204] = 30
    constants[205] = 4
    constants[206] = 0.01
    constants[207] = 0.01
    constants[208] = 1
    constants[209] = 0.01
    constants[210] = 0.0175
    constants[211] = 6
    constants[212] = 2.51
    constants[213] = 4
    constants[214] = 1
    constants[215] = 0.5
    constants[216] = 0.3
    constants[217] = 20
    constants[218] = 5
    constants[219] = 45
    constants[220] = 0.01
    constants[221] = 5
    constants[222] = 0.625
    constants[223] = 5
    constants[224] = 5
    constants[225] = 5
    constants[226] = 5
    constants[227] = 0.08
    constants[228] = 0.24
    constants[229] = 0.55
    constants[230] = 0
    constants[231] = 164
    constants[232] = 0.1
    constants[233] = 0
    constants[234] = 0
    constants[235] = 0.6
    constants[236] = 0.3
    constants[237] = 10
    constants[238] = 1
    constants[239] = 1
    constants[240] = 90
    constants[241] = 150
    constants[242] = 0.53333
    constants[243] = 0
    constants[244] = 0
    constants[245] = 1
    constants[246] = 1.0
    constants[247] = 1.22057
    constants[248] = 0.8
    constants[249] = 0
    constants[250] = 0
    constants[251] = 31.9719
    constants[252] = 0
    constants[253] = 60
    constants[254] = 0
    constants[255] = 1.0
    constants[256] = 0.301963
    constants[257] = 1.0
    constants[258] = 1.00269
    constants[259] = 1.09071
    constants[260] = 0.859476
    constants[261] = 1.0
    constants[262] = 0
    constants[263] = 1.02127
    constants[264] = 1.01179
    constants[265] = 1.1448
    constants[266] = 1.00007
    constants[267] = -0.060024
    constants[268] = 1.00132
    constants[269] = 0.0367573
    constants[270] = 1
    constants[271] = 1.00163
    constants[272] = 1.00237
    constants[273] = 3622.54
    constants[274] = 2109.91
    constants[275] = 2.368e-07
    constants[276] = 0.694163
    constants[277] = 204.497
    constants[278] = 0.699673
    constants[279] = 103.525
    constants[280] = 16.9144
    constants[281] = 159.549
    constants[282] = 0.419998
    constants[283] = 216.243
    constants[284] = 72.2362
    constants[285] = 48.0839
    constants[286] = 0
    constants[287] = 279.945
    constants[288] = 0.000980838
    constants[289] = 0.862514
    constants[290] = 25.0404
    constants[291] = 0.379883
    constants[292] = 0.38131
    constants[293] = 0.0123238
    constants[294] = 3.00449
    constants[295] = 0.100043
    constants[296] = 2.00439
    constants[297] = 0
    constants[298] = 39.8952
    constants[299] = 0.0101913
    constants[300] = 0.00366525
    constants[301] = 3.28246
    constants[302] = 0.5
    constants[303] = 60
    constants[304] = 40000
    constants[305] = 0.1
    constants[306] = 40000
    constants[307] = 1
    constants[308] = 4
    constants[309] = 0
    constants[310] = 0.2
    constants[311] = 5
    constants[312] = 0.3
    constants[313] = 85
    constants[314] = 15
    constants[315] = 0.93617
    constants[316] = 2.5
    constants[317] = 0.333
    constants[318] = 1000
    constants[319] = 1
    constants[320] = 0.3
    constants[321] = 2
    constants[322] = 0.3
    constants[323] = 0
    constants[324] = 0
    constants[325] = 2.5
    constants[326] = 0
    constants[327] = 5
    constants[328] = 0.65
    constants[329] = 0.5
    constants[330] = 12
    constants[331] = 0.005
    constants[332] = 0.005
    constants[333] = 0.04
    constants[334] = 0.8
    constants[335] = 15
    constants[336] = 60
    constants[337] = 0.4
    constants[338] = 0
    constants[339] = 0
    constants[340] = 2.5
    constants[341] = 1.4
    constants[342] = 0.86
    constants[343] = 1.6
    constants[344] = 0.3
    constants[345] = 2
    constants[346] = 0.7
    constants[347] = 1
    constants[348] = 2
    constants[349] = 1.5
    constants[350] = 1.8
    constants[351] = 4
    constants[352] = 1.5
    constants[353] = 10
    constants[354] = 12
    constants[355] = 0.8
    constants[356] = 6
    constants[357] = 0
    constants[358] = 5000
    constants[359] = 0
    constants[360] = -0.2
    constants[361] = 0.005
    constants[362] = 0.005
    constants[363] = 0.5
    constants[364] = 0.3
    constants[365] = 0.3
    constants[366] = 0.004
    constants[367] = 1.5
    constants[368] = 0
    constants[369] = 3
    constants[370] = 1
    constants[371] = 5.0
    constants[372] = 0.4
    constants[373] = 0.3
    constants[374] = 0.5
    constants[375] = 1.0
    constants[376] = 1
    constants[377] = 1.5
    constants[378] = 0
    constants[379] = 7
    constants[380] = 0.9
    constants[381] = 1
    constants[382] = 0.16
    constants[383] = 0.01167
    constants[384] = 4
    constants[385] = 2
    constants[386] = 0.0212
    constants[387] = 0.2
    constants[388] = 139
    constants[389] = 0.0003
    constants[390] = 0.000253
    constants[391] = 40
    constants[392] = 0.1
    constants[393] = 0
    constants[394] = 1
    constants[395] = 0.05
    constants[396] = 0.675
    constants[397] = 1e-06
    constants[398] = 1
    constants[399] = 24
    constants[400] = 0
    constants[401] = 1
    constants[402] = 0.01
    constants[403] = 1.0
    constants[404] = 0.17
    constants[405] = 0
    constants[406] = 0.8092
    constants[407] = 0.0208333
    constants[408] = 3
    constants[409] = 0.001
    constants[410] = 1.0
    constants[411] = 1850
    constants[412] = 4.714e-08
    constants[413] = 0.4
    constants[414] = 1
    constants[415] = 0
    constants[416] = 0
    constants[417] = 10000
    constants[418] = 8
    constants[419] = 2.728e-14
    constants[420] = 0.03
    constants[421] = 10
    constants[422] = 0.667
    constants[423] = 0.005
    constants[424] = 0.01
    constants[425] = 0
    constants[426] = 0.1
    constants[427] = 0.01
    constants[428] = 57.1
    constants[429] = 1
    constants[430] = 2
    constants[431] = 1
    constants[432] = 15
    constants[433] = 0
    constants[434] = -2
    constants[435] = 0.79167
    constants[436] = 1.8
    constants[437] = 4.2
    constants[438] = 30
    constants[439] = 0.001
    constants[440] = 0.1
    constants[441] = 0.04
    constants[442] = 2
    constants[443] = 0.1
    constants[444] = 35
    constants[445] = 2
    constants[446] = 8
    constants[447] = 0.2
    constants[448] = 0.15
    constants[449] = 0.5
    constants[450] = 96.3
    constants[451] = 0
    constants[452] = 30.52
    constants[453] = 2000
    constants[454] = 0
    constants[455] = 1
    constants[456] = 0.03
    constants[457] = 0.3
    constants[458] = 1
    constants[459] = 0
    constants[460] = 5.8e-06
    constants[461] = 15
    constants[462] = 0
    constants[463] = 0
    constants[464] = 0.9
    constants[465] = 15.2
    constants[466] = 6
    constants[467] = 19.167
    constants[468] = 1
    constants[469] = 1
    constants[470] = 1
    constants[471] = 5
    constants[472] = 10000
    constants[473] = 0
    constants[474] = 0
    constants[475] = 0.05
    constants[476] = 0
    constants[477] = 0
    constants[478] = 0
    constants[479] = 0.15
    constants[480] = 0.005
    constants[481] = 30
    constants[482] = 4
    constants[483] = 0.01
    constants[484] = 0.01
    constants[485] = 1
    constants[486] = 0.01
    constants[487] = 0.0175
    constants[488] = 6
    constants[489] = 2.51
    constants[490] = 4
    constants[491] = 1
    constants[492] = 0.5
    constants[493] = 0.3
    constants[494] = 20
    constants[495] = 5
    constants[496] = 45
    constants[497] = 0.01
    constants[498] = 5
    constants[499] = 0.625
    constants[500] = 5
    constants[501] = 5
    constants[502] = 5
    constants[503] = 5
    constants[504] = 0.08
    constants[505] = 0.24
    constants[506] = 0.55
    constants[507] = 0
    constants[508] = 164
    constants[509] = 0.1
    constants[510] = 0
    constants[511] = 0
    constants[512] = 0.6
    constants[513] = 0.3
    constants[514] = 10
    constants[515] = 1
    constants[516] = 1
    constants[517] = 90
    constants[518] = 150
    constants[519] = 0.53333
    constants[520] = 0
    constants[521] = 0
    constants[522] = 1
    constants[523] = 1.0
    constants[524] = 1.22057
    constants[525] = 0.8
    constants[526] = 0
    constants[527] = 0
    constants[528] = 31.9719
    constants[529] = 0
    constants[530] = 60
    constants[531] = 0
    constants[532] = 1.0
    constants[533] = 0.301963
    constants[534] = 1.0
    constants[535] = 1.00269
    constants[536] = 1.09071
    constants[537] = 0.859476
    constants[538] = 1.0
    constants[539] = 0
    constants[540] = 1.02127
    constants[541] = 1.01179
    constants[542] = 1.1448
    constants[543] = 1.00007
    constants[544] = -0.060024
    constants[545] = 1.00132
    constants[546] = 0.0367573
    constants[547] = 1
    constants[548] = 1.00163
    constants[549] = 1.00237
    constants[550] = 3622.54
    constants[551] = 2109.91
    constants[552] = 2.368e-07
    constants[553] = 0.694163
    constants[554] = 204.497
    constants[555] = 0.699673
    constants[556] = 103.525
    constants[557] = 16.9144
    constants[558] = 159.549
    constants[559] = 0.419998
    constants[560] = 216.243
    constants[561] = 72.2362
    constants[562] = 48.0839
    constants[563] = 0
    constants[564] = 279.945
    constants[565] = 0.000980838
    constants[566] = 0.862514
    constants[567] = 25.0404
    constants[568] = 0.379883
    constants[569] = 0.38131
    constants[570] = 0.0123238
    constants[571] = 3.00449
    constants[572] = 0.100043
    constants[573] = 2.00439
    constants[574] = 0
    constants[575] = 39.8952
    constants[576] = 0.0101913
    constants[577] = 0.00366525
    constants[578] = 3.28246
    constants[579] = (constants[0]-1.00000)*constants[360]
    constants[580] = ((constants[9]-17.0000)*constants[387]+17.0000)*constants[386]
    constants[581] = constants[468]/constants[580]
    constants[582] = constants[7]*constants[581]*constants[6]*constants[8]
    constants[583] = constants[582]*1.79000
    states[0] = constants[578]
    states[1] = constants[566]
    states[2] = constants[568]
    states[3] = constants[569]
    states[4] = constants[572]
    return (states, constants)

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    algebraic[0] = ((((((constants[15]+constants[16])-states[0])-states[1])-states[2])-states[3])-states[4])/2.00000
    algebraic[15] = states[2]+algebraic[0]*0.128000
    algebraic[16] = algebraic[15]-0.380000
    algebraic[17] = algebraic[16]/0.0100000
    algebraic[23] = (algebraic[17]+4.00000)*(constants[413]*(constants[24]-1.00000)+1.00000)-4.00000
    algebraic[24] = custom_piecewise([less_equal(algebraic[23] , -2.00000), 0.0100000 , greater(algebraic[23] , -2.00000) & less_equal(algebraic[23] , 1.00000), 0.0100000+((3.60000-0.0100000)*(algebraic[23]--2.00000))/(1.00000--2.00000) , greater(algebraic[23] , 1.00000) & less_equal(algebraic[23] , 5.00000), 3.60000+((9.40000-3.60000)*(algebraic[23]-1.00000))/(5.00000-1.00000) , greater(algebraic[23] , 5.00000) & less_equal(algebraic[23] , 8.00000), 9.40000+((11.6000-9.40000)*(algebraic[23]-5.00000))/(8.00000-5.00000) , greater(algebraic[23] , 8.00000) & less_equal(algebraic[23] , 12.0000), 11.6000+((13.5000-11.6000)*(algebraic[23]-8.00000))/(12.0000-8.00000) , True, 13.5000])
    algebraic[34] = states[1]+algebraic[0]*0.261000
    algebraic[35] = algebraic[34]-0.495000
    algebraic[36] = algebraic[35]/0.00355000
    algebraic[37] = algebraic[36]/(constants[19]*constants[20])
    algebraic[38] = custom_piecewise([less_equal(algebraic[37] , 0.00000), 1.04000 , greater(algebraic[37] , 0.00000) & less_equal(algebraic[37] , 60.0000), 1.04000+((1.02500-1.04000)*(algebraic[37]-0.00000))/(60.0000-0.00000) , greater(algebraic[37] , 60.0000) & less_equal(algebraic[37] , 125.000), 1.02500+((0.970000-1.02500)*(algebraic[37]-60.0000))/(125.000-60.0000) , greater(algebraic[37] , 125.000) & less_equal(algebraic[37] , 160.000), 0.970000+((0.880000-0.970000)*(algebraic[37]-125.000))/(160.000-125.000) , greater(algebraic[37] , 160.000) & less_equal(algebraic[37] , 200.000), 0.880000+((0.590000-0.880000)*(algebraic[37]-160.000))/(200.000-160.000) , greater(algebraic[37] , 200.000) & less_equal(algebraic[37] , 240.000), 0.590000+((0.00000-0.590000)*(algebraic[37]-200.000))/(240.000-200.000) , True, 0.00000])
    algebraic[39] = algebraic[38]*algebraic[24]*constants[19]*constants[516]*constants[18]*constants[21]
    algebraic[40] = (algebraic[17]-algebraic[36])/3.00000
    algebraic[41] = custom_piecewise([greater(algebraic[40] , 0.00000), algebraic[39]+algebraic[40] , True, algebraic[39]])
    algebraic[6] = states[3]+algebraic[0]*0.155000
    algebraic[7] = algebraic[6]-0.306250
    algebraic[8] = algebraic[7]/0.00480000
    algebraic[11] = 0.0260000*algebraic[8]
    algebraic[12] = custom_piecewise([less(algebraic[11] , 1.00000e-05), 1.00000e-05 , True, algebraic[11]])
    algebraic[13] = power(algebraic[12], 0.500000)
    algebraic[14] = 1.00000/algebraic[13]
    algebraic[18] = algebraic[17]+18.0000
    algebraic[19] = 1.00000/(algebraic[18]*0.0357000)
    algebraic[20] = algebraic[19]+algebraic[14]
    algebraic[21] = algebraic[8]-algebraic[17]
    algebraic[22] = algebraic[21]/algebraic[20]
    algebraic[43] = algebraic[22]-algebraic[41]
    rates[2] = algebraic[43]
    algebraic[9] = (algebraic[8]/constants[19])/constants[20]
    algebraic[10] = custom_piecewise([less_equal(algebraic[9] , 0.00000), 1.06000 , greater(algebraic[9] , 0.00000) & less_equal(algebraic[9] , 32.0000), 1.06000+((0.970000-1.06000)*(algebraic[9]-0.00000))/(32.0000-0.00000) , greater(algebraic[9] , 32.0000) & less_equal(algebraic[9] , 38.4000), 0.970000+((0.930000-0.970000)*(algebraic[9]-32.0000))/(38.4000-32.0000) , greater(algebraic[9] , 38.4000) & less_equal(algebraic[9] , 48.0000), 0.930000+((0.800000-0.930000)*(algebraic[9]-38.4000))/(48.0000-38.4000) , greater(algebraic[9] , 48.0000) & less_equal(algebraic[9] , 60.8000), 0.800000+((0.460000-0.800000)*(algebraic[9]-48.0000))/(60.8000-48.0000) , greater(algebraic[9] , 60.8000) & less_equal(algebraic[9] , 72.0000), 0.460000+((0.00000-0.460000)*(algebraic[9]-60.8000))/(72.0000-60.8000) , True, 0.00000])
    algebraic[42] = (1.00000-constants[448])*constants[19]*algebraic[10]*constants[515]*constants[18]*constants[17]+(constants[448]*algebraic[41])/algebraic[24]
    algebraic[1] = states[4]+algebraic[0]*0.0574000
    algebraic[2] = algebraic[1]-0.100000
    algebraic[3] = algebraic[2]/0.00500000
    algebraic[4] = (algebraic[3]+8.00000)*(constants[413]*(constants[24]-1.00000)+1.00000)-8.00000
    algebraic[5] = custom_piecewise([less_equal(algebraic[4] , -8.00000), 0.00000 , greater(algebraic[4] , -8.00000) & less_equal(algebraic[4] , -6.00000), 0.00000+((0.750000-0.00000)*(algebraic[4]--8.00000))/(-6.00000--8.00000) , greater(algebraic[4] , -6.00000) & less_equal(algebraic[4] , -2.00000), 0.750000+((2.60000-0.750000)*(algebraic[4]--6.00000))/(-2.00000--6.00000) , greater(algebraic[4] , -2.00000) & less_equal(algebraic[4] , 4.00000), 2.60000+((9.80000-2.60000)*(algebraic[4]--2.00000))/(4.00000--2.00000) , greater(algebraic[4] , 4.00000) & less_equal(algebraic[4] , 12.0000), 9.80000+((13.5000-9.80000)*(algebraic[4]-4.00000))/(12.0000-4.00000) , True, 13.5000])
    algebraic[45] = algebraic[5]*algebraic[42]
    algebraic[25] = states[0]+algebraic[0]*0.398600
    algebraic[26] = ((((algebraic[25]-constants[11])-constants[579])-constants[13])-constants[12])-constants[14]
    algebraic[27] = custom_piecewise([less(algebraic[26] , 0.000100000), 0.000100000 , True, algebraic[26]])
    algebraic[28] = 3.70000+(algebraic[27]-0.740000)/constants[392]
    algebraic[29] = custom_piecewise([less(algebraic[28] , 0.000100000), 0.000100000 , True, algebraic[28]])
    algebraic[31] = 0.740000/(power(algebraic[29]/(constants[6]*3.70000), 0.500000))
    algebraic[30] = custom_piecewise([less(algebraic[3] , constants[433]), constants[433] , True, algebraic[3]])
    algebraic[32] = algebraic[29]-algebraic[30]
    algebraic[33] = algebraic[32]/algebraic[31]
    algebraic[47] = algebraic[33]-algebraic[45]
    rates[4] = algebraic[47]
    algebraic[48] = algebraic[45]-algebraic[22]
    rates[3] = algebraic[48]
    algebraic[44] = algebraic[36]-algebraic[3]
    algebraic[56] = algebraic[44]*constants[527]
    algebraic[51] = algebraic[36]-algebraic[29]
    algebraic[46] = power(algebraic[36]/100.000, constants[430])
    algebraic[49] = ((constants[0]*constants[1]*constants[23]*constants[6]*constants[2])/algebraic[46])/constants[3]
    algebraic[52] = constants[450]*constants[22]*algebraic[49]*constants[4]*constants[522]
    algebraic[54] = algebraic[51]/algebraic[52]
    algebraic[50] = constants[452]*constants[5]*algebraic[49]*constants[4]*constants[522]
    algebraic[53] = algebraic[50]+constants[583]
    algebraic[55] = algebraic[51]/algebraic[53]
    algebraic[57] = algebraic[54]+algebraic[55]+constants[10]
    algebraic[58] = algebraic[57]+algebraic[56]
    algebraic[59] = algebraic[58]-algebraic[33]
    rates[0] = algebraic[59]
    algebraic[60] = algebraic[41]-algebraic[58]
    rates[1] = algebraic[60]
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[0] = ((((((constants[15]+constants[16])-states[0])-states[1])-states[2])-states[3])-states[4])/2.00000
    algebraic[15] = states[2]+algebraic[0]*0.128000
    algebraic[16] = algebraic[15]-0.380000
    algebraic[17] = algebraic[16]/0.0100000
    algebraic[23] = (algebraic[17]+4.00000)*(constants[413]*(constants[24]-1.00000)+1.00000)-4.00000
    algebraic[24] = custom_piecewise([less_equal(algebraic[23] , -2.00000), 0.0100000 , greater(algebraic[23] , -2.00000) & less_equal(algebraic[23] , 1.00000), 0.0100000+((3.60000-0.0100000)*(algebraic[23]--2.00000))/(1.00000--2.00000) , greater(algebraic[23] , 1.00000) & less_equal(algebraic[23] , 5.00000), 3.60000+((9.40000-3.60000)*(algebraic[23]-1.00000))/(5.00000-1.00000) , greater(algebraic[23] , 5.00000) & less_equal(algebraic[23] , 8.00000), 9.40000+((11.6000-9.40000)*(algebraic[23]-5.00000))/(8.00000-5.00000) , greater(algebraic[23] , 8.00000) & less_equal(algebraic[23] , 12.0000), 11.6000+((13.5000-11.6000)*(algebraic[23]-8.00000))/(12.0000-8.00000) , True, 13.5000])
    algebraic[34] = states[1]+algebraic[0]*0.261000
    algebraic[35] = algebraic[34]-0.495000
    algebraic[36] = algebraic[35]/0.00355000
    algebraic[37] = algebraic[36]/(constants[19]*constants[20])
    algebraic[38] = custom_piecewise([less_equal(algebraic[37] , 0.00000), 1.04000 , greater(algebraic[37] , 0.00000) & less_equal(algebraic[37] , 60.0000), 1.04000+((1.02500-1.04000)*(algebraic[37]-0.00000))/(60.0000-0.00000) , greater(algebraic[37] , 60.0000) & less_equal(algebraic[37] , 125.000), 1.02500+((0.970000-1.02500)*(algebraic[37]-60.0000))/(125.000-60.0000) , greater(algebraic[37] , 125.000) & less_equal(algebraic[37] , 160.000), 0.970000+((0.880000-0.970000)*(algebraic[37]-125.000))/(160.000-125.000) , greater(algebraic[37] , 160.000) & less_equal(algebraic[37] , 200.000), 0.880000+((0.590000-0.880000)*(algebraic[37]-160.000))/(200.000-160.000) , greater(algebraic[37] , 200.000) & less_equal(algebraic[37] , 240.000), 0.590000+((0.00000-0.590000)*(algebraic[37]-200.000))/(240.000-200.000) , True, 0.00000])
    algebraic[39] = algebraic[38]*algebraic[24]*constants[19]*constants[516]*constants[18]*constants[21]
    algebraic[40] = (algebraic[17]-algebraic[36])/3.00000
    algebraic[41] = custom_piecewise([greater(algebraic[40] , 0.00000), algebraic[39]+algebraic[40] , True, algebraic[39]])
    algebraic[6] = states[3]+algebraic[0]*0.155000
    algebraic[7] = algebraic[6]-0.306250
    algebraic[8] = algebraic[7]/0.00480000
    algebraic[11] = 0.0260000*algebraic[8]
    algebraic[12] = custom_piecewise([less(algebraic[11] , 1.00000e-05), 1.00000e-05 , True, algebraic[11]])
    algebraic[13] = power(algebraic[12], 0.500000)
    algebraic[14] = 1.00000/algebraic[13]
    algebraic[18] = algebraic[17]+18.0000
    algebraic[19] = 1.00000/(algebraic[18]*0.0357000)
    algebraic[20] = algebraic[19]+algebraic[14]
    algebraic[21] = algebraic[8]-algebraic[17]
    algebraic[22] = algebraic[21]/algebraic[20]
    algebraic[43] = algebraic[22]-algebraic[41]
    algebraic[9] = (algebraic[8]/constants[19])/constants[20]
    algebraic[10] = custom_piecewise([less_equal(algebraic[9] , 0.00000), 1.06000 , greater(algebraic[9] , 0.00000) & less_equal(algebraic[9] , 32.0000), 1.06000+((0.970000-1.06000)*(algebraic[9]-0.00000))/(32.0000-0.00000) , greater(algebraic[9] , 32.0000) & less_equal(algebraic[9] , 38.4000), 0.970000+((0.930000-0.970000)*(algebraic[9]-32.0000))/(38.4000-32.0000) , greater(algebraic[9] , 38.4000) & less_equal(algebraic[9] , 48.0000), 0.930000+((0.800000-0.930000)*(algebraic[9]-38.4000))/(48.0000-38.4000) , greater(algebraic[9] , 48.0000) & less_equal(algebraic[9] , 60.8000), 0.800000+((0.460000-0.800000)*(algebraic[9]-48.0000))/(60.8000-48.0000) , greater(algebraic[9] , 60.8000) & less_equal(algebraic[9] , 72.0000), 0.460000+((0.00000-0.460000)*(algebraic[9]-60.8000))/(72.0000-60.8000) , True, 0.00000])
    algebraic[42] = (1.00000-constants[448])*constants[19]*algebraic[10]*constants[515]*constants[18]*constants[17]+(constants[448]*algebraic[41])/algebraic[24]
    algebraic[1] = states[4]+algebraic[0]*0.0574000
    algebraic[2] = algebraic[1]-0.100000
    algebraic[3] = algebraic[2]/0.00500000
    algebraic[4] = (algebraic[3]+8.00000)*(constants[413]*(constants[24]-1.00000)+1.00000)-8.00000
    algebraic[5] = custom_piecewise([less_equal(algebraic[4] , -8.00000), 0.00000 , greater(algebraic[4] , -8.00000) & less_equal(algebraic[4] , -6.00000), 0.00000+((0.750000-0.00000)*(algebraic[4]--8.00000))/(-6.00000--8.00000) , greater(algebraic[4] , -6.00000) & less_equal(algebraic[4] , -2.00000), 0.750000+((2.60000-0.750000)*(algebraic[4]--6.00000))/(-2.00000--6.00000) , greater(algebraic[4] , -2.00000) & less_equal(algebraic[4] , 4.00000), 2.60000+((9.80000-2.60000)*(algebraic[4]--2.00000))/(4.00000--2.00000) , greater(algebraic[4] , 4.00000) & less_equal(algebraic[4] , 12.0000), 9.80000+((13.5000-9.80000)*(algebraic[4]-4.00000))/(12.0000-4.00000) , True, 13.5000])
    algebraic[45] = algebraic[5]*algebraic[42]
    algebraic[25] = states[0]+algebraic[0]*0.398600
    algebraic[26] = ((((algebraic[25]-constants[11])-constants[579])-constants[13])-constants[12])-constants[14]
    algebraic[27] = custom_piecewise([less(algebraic[26] , 0.000100000), 0.000100000 , True, algebraic[26]])
    algebraic[28] = 3.70000+(algebraic[27]-0.740000)/constants[392]
    algebraic[29] = custom_piecewise([less(algebraic[28] , 0.000100000), 0.000100000 , True, algebraic[28]])
    algebraic[31] = 0.740000/(power(algebraic[29]/(constants[6]*3.70000), 0.500000))
    algebraic[30] = custom_piecewise([less(algebraic[3] , constants[433]), constants[433] , True, algebraic[3]])
    algebraic[32] = algebraic[29]-algebraic[30]
    algebraic[33] = algebraic[32]/algebraic[31]
    algebraic[47] = algebraic[33]-algebraic[45]
    algebraic[48] = algebraic[45]-algebraic[22]
    algebraic[44] = algebraic[36]-algebraic[3]
    algebraic[56] = algebraic[44]*constants[527]
    algebraic[51] = algebraic[36]-algebraic[29]
    algebraic[46] = power(algebraic[36]/100.000, constants[430])
    algebraic[49] = ((constants[0]*constants[1]*constants[23]*constants[6]*constants[2])/algebraic[46])/constants[3]
    algebraic[52] = constants[450]*constants[22]*algebraic[49]*constants[4]*constants[522]
    algebraic[54] = algebraic[51]/algebraic[52]
    algebraic[50] = constants[452]*constants[5]*algebraic[49]*constants[4]*constants[522]
    algebraic[53] = algebraic[50]+constants[583]
    algebraic[55] = algebraic[51]/algebraic[53]
    algebraic[57] = algebraic[54]+algebraic[55]+constants[10]
    algebraic[58] = algebraic[57]+algebraic[56]
    algebraic[59] = algebraic[58]-algebraic[33]
    algebraic[60] = algebraic[41]-algebraic[58]
    algebraic[61] = algebraic[44]/algebraic[58]
    return algebraic

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)