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

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

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    algebraic[0] = constants[0]+states[0]
    algebraic[1] = states[0]/algebraic[0]
    algebraic[2] = 100.000*algebraic[1]
    algebraic[6] = (constants[555]-40.0000)*algebraic[2]
    algebraic[7] = custom_piecewise([less(algebraic[6]+constants[556] , 0.00000), 0.00000 , True, algebraic[6]+constants[556]])
    algebraic[8] = constants[387]-algebraic[7]
    algebraic[9] = custom_piecewise([less(algebraic[8]*constants[388]*constants[431]+5.00000e-06 , 0.00000), 0.00000 , True, algebraic[8]*constants[388]*constants[431]+5.00000e-06])
    algebraic[3] = algebraic[2]/((constants[493]-algebraic[2])*constants[495])
    algebraic[4] = algebraic[3]+1.50000
    algebraic[5] = 0.333300*algebraic[4]
    algebraic[10] = states[0]*constants[436]*algebraic[5]
    algebraic[11] = (algebraic[9]-algebraic[10])+constants[505]
    rates[0] = algebraic[11]
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[0] = constants[0]+states[0]
    algebraic[1] = states[0]/algebraic[0]
    algebraic[2] = 100.000*algebraic[1]
    algebraic[6] = (constants[555]-40.0000)*algebraic[2]
    algebraic[7] = custom_piecewise([less(algebraic[6]+constants[556] , 0.00000), 0.00000 , True, algebraic[6]+constants[556]])
    algebraic[8] = constants[387]-algebraic[7]
    algebraic[9] = custom_piecewise([less(algebraic[8]*constants[388]*constants[431]+5.00000e-06 , 0.00000), 0.00000 , True, algebraic[8]*constants[388]*constants[431]+5.00000e-06])
    algebraic[3] = algebraic[2]/((constants[493]-algebraic[2])*constants[495])
    algebraic[4] = algebraic[3]+1.50000
    algebraic[5] = 0.333300*algebraic[4]
    algebraic[10] = states[0]*constants[436]*algebraic[5]
    algebraic[11] = (algebraic[9]-algebraic[10])+constants[505]
    return algebraic

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

def solve_model():
    """Solve model with ODE solver"""
    from scipy.integrate import ode
    # Initialise constants and state variables
    (init_states, constants) = initConsts()

    # Set timespan to solve over
    voi = linspace(0, 10, 500)

    # Construct ODE object to solve
    r = ode(computeRates)
    r.set_integrator('vode', method='bdf', atol=1e-06, rtol=1e-06, max_step=1)
    r.set_initial_value(init_states, voi[0])
    r.set_f_params(constants)

    # Solve model
    states = array([[0.0] * len(voi)] * sizeStates)
    states[:,0] = init_states
    for (i,t) in enumerate(voi[1:]):
        if r.successful():
            r.integrate(t)
            states[:,i+1] = r.y
        else:
            break

    # Compute algebraic variables
    algebraic = computeAlgebraic(constants, states, voi)
    return (voi, states, algebraic)

def plot_model(voi, states, algebraic):
    """Plot variables against variable of integration"""
    import pylab
    (legend_states, legend_algebraic, legend_voi, legend_constants) = createLegends()
    pylab.figure(1)
    pylab.plot(voi,vstack((states,algebraic)).T)
    pylab.xlabel(legend_voi)
    pylab.legend(legend_states + legend_algebraic, loc='best')
    pylab.show()

if __name__ == "__main__":
    (voi, states, algebraic) = solve_model()
    plot_model(voi, states, algebraic)