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

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

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    rates[2] = constants[559]
    rates[0] = (power((constants[1]*constants[0])/(500.000*constants[495]), constants[478])-states[0])/57600.0
    rates[1] = (power((constants[3]*constants[0])/(75.0000*constants[494]), constants[478])-states[1])/57600.0
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[0] = custom_piecewise([greater(states[2] , 1.00000), 1.00000 , True, states[2]])
    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)