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

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

def computeRates(voi, states, constants):
    rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
    rates[0] = (constants[561]-states[0])/constants[291]
    return(rates)

def computeAlgebraic(constants, states, voi):
    algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
    states = array(states)
    voi = array(voi)
    algebraic[0] = constants[293]-(constants[293]-1.00000)/(((constants[292]-1.00000)/(constants[292]-constants[293]))*(states[0]-1.00000)+1.00000)
    algebraic[1] = constants[288]-(constants[288]-1.00000)/(((constants[287]-1.00000)/(constants[287]-constants[288]))*(states[0]-1.00000)+1.00000)
    algebraic[2] = custom_piecewise([less(algebraic[1] , constants[287]), constants[287] , True, algebraic[1]])
    algebraic[3] = custom_piecewise([less(algebraic[0] , constants[292]), constants[292] , True, algebraic[0]])
    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)