Generated Code
The following is c_ida code generated by the CellML API from this CellML file. (Back to language selection)
The raw code is available.
/* There are a total of 96 entries in the algebraic variable array. There are a total of 32 entries in each of the rate and state variable arrays. There are a total of 108 entries in the constant variable array. */ /* * VOI is t in component lpc (s). * CONSTANTS[0] is Vlvrd in component lpc (mL). * CONSTANTS[1] is Vlvrs in component lpc (mL). * CONSTANTS[2] is Vrvrd in component lpc (mL). * CONSTANTS[3] is Vrvrs in component lpc (mL). * CONSTANTS[4] is Vlard in component lpc (mL). * CONSTANTS[5] is Vlars in component lpc (mL). * CONSTANTS[6] is Vrard in component lpc (mL). * CONSTANTS[7] is Vrars in component lpc (mL). * CONSTANTS[8] is Rra in component lpc (resistance). * CONSTANTS[9] is Rla in component lpc (resistance). * CONSTANTS[10] is PRint in component lpc (s). * CONSTANTS[11] is Emaxlv in component lpc (elastance). * CONSTANTS[12] is Eminlv in component lpc (elastance). * CONSTANTS[13] is Emaxrv in component lpc (elastance). * CONSTANTS[14] is Eminrv in component lpc (elastance). * CONSTANTS[15] is Emaxra in component lpc (elastance). * CONSTANTS[16] is Eminra in component lpc (elastance). * CONSTANTS[17] is Emaxla in component lpc (elastance). * CONSTANTS[18] is Eminla in component lpc (elastance). * CONSTANTS[19] is Pbs in component lpc (mmHg). * CONSTANTS[20] is Vmyo in component lpc (mL). * CONSTANTS[21] is TsvK in component lpc (s). * CONSTANTS[22] is TsaK in component lpc (s). * CONSTANTS[23] is HR in component lpc (ratepm). * ALGEBRAIC[10] is Elv in component lpc (elastance). * ALGEBRAIC[8] is Erv in component lpc (elastance). * ALGEBRAIC[7] is Era in component lpc (elastance). * ALGEBRAIC[9] is Ela in component lpc (elastance). * ALGEBRAIC[44] is Vlvr in component lpc (mL). * ALGEBRAIC[47] is Vrvr in component lpc (mL). * ALGEBRAIC[43] is Vlar in component lpc (mL). * ALGEBRAIC[46] is Vrar in component lpc (mL). * ALGEBRAIC[66] is Fra in component lpc (flow). * ALGEBRAIC[86] is Frv in component lpc (flow). * ALGEBRAIC[83] is Fla in component lpc (flow). * ALGEBRAIC[84] is Flv in component lpc (flow). * ALGEBRAIC[59] is Pra in component lpc (mmHg). * ALGEBRAIC[60] is Prac in component lpc (mmHg). * ALGEBRAIC[61] is Prv in component lpc (mmHg). * ALGEBRAIC[62] is Prvc in component lpc (mmHg). * ALGEBRAIC[55] is Pla in component lpc (mmHg). * ALGEBRAIC[75] is Plac in component lpc (mmHg). * ALGEBRAIC[56] is Plv in component lpc (mmHg). * ALGEBRAIC[76] is Plvc in component lpc (mmHg). * STATES[0] is Vra in component lpc (mL). * STATES[1] is Vrv in component lpc (mL). * STATES[2] is Vla in component lpc (mL). * STATES[3] is Vlv in component lpc (mL). * CONSTANTS[24] is COutput in component lpc (flow). * CONSTANTS[103] is SV in component lpc (mL). * ALGEBRAIC[11] is P_QRSwave in component lpc (mV). * CONSTANTS[105] is Tsv in component lpc (s). * CONSTANTS[107] is Tsa in component lpc (s). * ALGEBRAIC[2] is trela in component lpc (s). * ALGEBRAIC[1] is trelv in component lpc (s). * CONSTANTS[25] is Rav in component lpc (resistance). * CONSTANTS[26] is Raop in component lpc (resistance). * CONSTANTS[27] is Rcrb in component lpc (resistance). * CONSTANTS[28] is Raod in component lpc (resistance). * CONSTANTS[29] is Rtaop in component lpc (resistance). * CONSTANTS[30] is Rtaod in component lpc (resistance). * CONSTANTS[31] is Rsap in component lpc (resistance). * CONSTANTS[32] is Rsc in component lpc (resistance). * CONSTANTS[33] is Rsv in component lpc (resistance). * CONSTANTS[34] is Rsao in component lpc (resistance). * CONSTANTS[35] is Caop in component lpc (capacitance). * CONSTANTS[36] is Caod in component lpc (capacitance). * CONSTANTS[37] is Csap in component lpc (capacitance). * CONSTANTS[38] is Csc in component lpc (capacitance). * CONSTANTS[39] is Laop in component lpc (inductance). * CONSTANTS[40] is Laod in component lpc (inductance). * CONSTANTS[41] is Kc in component lpc (mmHg). * CONSTANTS[42] is Do in component lpc (mL). * CONSTANTS[43] is Vsa_o in component lpc (mL). * CONSTANTS[44] is Vsa_max in component lpc (mL). * CONSTANTS[45] is Kp1 in component lpc (mmHg). * CONSTANTS[46] is Kp2 in component lpc (mmHgmlm2). * CONSTANTS[47] is Kr in component lpc (resistance). * CONSTANTS[48] is tau_p in component lpc (perml). * CONSTANTS[49] is Kv in component lpc (mmHg). * CONSTANTS[50] is Vmax_sv in component lpc (mL). * CONSTANTS[51] is D2 in component lpc (mmHg). * CONSTANTS[52] is K1 in component lpc (dimensionless). * CONSTANTS[53] is K2 in component lpc (mmHg). * CONSTANTS[54] is KR in component lpc (resistance). * CONSTANTS[55] is Ro in component lpc (resistance). * CONSTANTS[56] is Vo in component lpc (mL). * CONSTANTS[57] is Vmax_vc in component lpc (mL). * CONSTANTS[58] is Vmin_vc in component lpc (mL). * CONSTANTS[59] is COtau in component lpc (s). * CONSTANTS[60] is Pplc in component lpc (mmHg). * CONSTANTS[61] is Px2 in component lpc (mmHg). * CONSTANTS[62] is Vx8 in component lpc (mL). * CONSTANTS[63] is Vx75 in component lpc (mL). * CONSTANTS[64] is Vx1 in component lpc (mL). * CONSTANTS[65] is Px1 in component lpc (mmHg). * CONSTANTS[66] is F_vaso in component lpc (dimensionless). * ALGEBRAIC[39] is Rvc in component lpc (resistance). * ALGEBRAIC[38] is Rsa in component lpc (resistance). * ALGEBRAIC[12] is Paop in component lpc (mmHg). * STATES[4] is Paopc in component lpc (mmHg). * ALGEBRAIC[70] is Paod in component lpc (mmHg). * ALGEBRAIC[54] is Paodc in component lpc (mmHg). * ALGEBRAIC[29] is Psa_a in component lpc (mmHg). * ALGEBRAIC[30] is Psa_p in component lpc (mmHg). * ALGEBRAIC[63] is Psa in component lpc (mmHg). * ALGEBRAIC[31] is Psap in component lpc (mmHg). * ALGEBRAIC[32] is Psc in component lpc (mmHg). * ALGEBRAIC[33] is Psv in component lpc (mmHg). * ALGEBRAIC[36] is Pvc in component lpc (mmHg). * ALGEBRAIC[37] is Pvcc in component lpc (mmHg). * STATES[5] is MAP in component lpc (mmHg). * STATES[6] is Faop in component lpc (flowLm). * STATES[7] is Faod in component lpc (flow). * ALGEBRAIC[68] is Fsap in component lpc (flow). * ALGEBRAIC[67] is Fsa in component lpc (flow). * ALGEBRAIC[52] is Fsc in component lpc (flow). * ALGEBRAIC[53] is Fsv in component lpc (flow). * ALGEBRAIC[69] is Fvc in component lpc (flow). * ALGEBRAIC[65] is Fcrb in component lpc (flow). * STATES[8] is Vaop in component lpc (mL). * STATES[9] is Vaod in component lpc (mL). * STATES[10] is Vsa in component lpc (mL). * STATES[11] is Vsap in component lpc (mL). * STATES[12] is Vsc in component lpc (mL). * STATES[13] is Vsv in component lpc (mL). * STATES[14] is Vvc in component lpc (mL). * ALGEBRAIC[48] is Vtot in component lpc (mL). * ALGEBRAIC[40] is SysArtVol in component lpc (mL). * ALGEBRAIC[41] is SysVenVol in component lpc (mL). * ALGEBRAIC[34] is PulArtVol in component lpc (mL). * ALGEBRAIC[35] is PulVenVol in component lpc (mL). * ALGEBRAIC[64] is VBcirc in component lpc (mL). * CONSTANTS[104] is Ppl in component lpc (mmHg). * CONSTANTS[67] is Rpuv in component lpc (resistance). * CONSTANTS[68] is Rtpap in component lpc (resistance). * CONSTANTS[69] is Rtpad in component lpc (resistance). * CONSTANTS[70] is Rpap in component lpc (resistance). * CONSTANTS[71] is Rpad in component lpc (resistance). * CONSTANTS[72] is Rps in component lpc (resistance). * CONSTANTS[73] is Rpa in component lpc (resistance). * CONSTANTS[74] is Rpc in component lpc (resistance). * CONSTANTS[75] is Rpv in component lpc (resistance). * CONSTANTS[76] is Ctpap in component lpc (capacitance). * CONSTANTS[77] is Ctpad in component lpc (capacitance). * CONSTANTS[78] is Cpa in component lpc (capacitance). * CONSTANTS[79] is Cpc in component lpc (capacitance). * CONSTANTS[80] is Cpv in component lpc (capacitance). * CONSTANTS[81] is Lpa in component lpc (inductance). * CONSTANTS[82] is Lpad in component lpc (inductance). * ALGEBRAIC[78] is Ppapc in component lpc (mmHg). * ALGEBRAIC[77] is Ppapc1 in component lpc (mmHg). * ALGEBRAIC[24] is Ppapc2 in component lpc (mmHg). * ALGEBRAIC[90] is Ppap in component lpc (mmHg). * STATES[30] is Ppad in component lpc (mmHg). * STATES[31] is Ppadc in component lpc (mmHg). * ALGEBRAIC[22] is Ppa in component lpc (mmHg). * ALGEBRAIC[23] is Ppac in component lpc (mmHg). * ALGEBRAIC[25] is Ppc in component lpc (mmHg). * ALGEBRAIC[26] is Ppcc in component lpc (mmHg). * ALGEBRAIC[27] is Ppv in component lpc (mmHg). * ALGEBRAIC[28] is Ppvc in component lpc (mmHg). * STATES[15] is Vpap in component lpc (mL). * STATES[16] is Vpad in component lpc (mL). * STATES[17] is Vpa in component lpc (mL). * STATES[18] is Vpc in component lpc (mL). * STATES[19] is Vpv in component lpc (mL). * STATES[20] is Fpap in component lpc (flowLm). * STATES[21] is Fpad in component lpc (flow). * ALGEBRAIC[51] is Fps in component lpc (flow). * ALGEBRAIC[49] is Fpa in component lpc (flow). * ALGEBRAIC[50] is Fpc in component lpc (flow). * ALGEBRAIC[85] is Fpv in component lpc (flow). * CONSTANTS[83] is K_pcd in component lpc (mmHg). * CONSTANTS[84] is phi_pcd in component lpc (mL). * CONSTANTS[85] is Vpcd_o in component lpc (mL). * CONSTANTS[86] is perifl in component lpc (mL). * ALGEBRAIC[57] is Ppcd in component lpc (mmHg). * ALGEBRAIC[58] is Ppcdc in component lpc (mmHg). * ALGEBRAIC[45] is Vpcd in component lpc (mL). * CONSTANTS[87] is Rcorao in component lpc (resistance). * CONSTANTS[88] is Rcorea in component lpc (resistance). * CONSTANTS[89] is Rcorla in component lpc (resistance). * CONSTANTS[90] is Rcorsa in component lpc (resistance). * CONSTANTS[91] is Rcorcap in component lpc (resistance). * CONSTANTS[92] is Rcorsv in component lpc (resistance). * CONSTANTS[93] is Rcorlv in component lpc (resistance). * CONSTANTS[94] is Rcorev in component lpc (resistance). * CONSTANTS[95] is Ccorao in component lpc (capacitance). * CONSTANTS[96] is Ccorea in component lpc (capacitance). * CONSTANTS[97] is Ccorla in component lpc (capacitance). * CONSTANTS[98] is Ccorsa in component lpc (capacitance). * CONSTANTS[99] is Ccorcap in component lpc (capacitance). * CONSTANTS[100] is Ccorsv in component lpc (capacitance). * CONSTANTS[101] is Ccorlv in component lpc (capacitance). * CONSTANTS[102] is Ccorev in component lpc (capacitance). * ALGEBRAIC[87] is Pcorisfc in component lpc (mmHg). * ALGEBRAIC[14] is Pcoraoc in component lpc (mmHg). * ALGEBRAIC[71] is Pcoreac in component lpc (mmHg). * ALGEBRAIC[88] is Pcorlac in component lpc (mmHg). * ALGEBRAIC[89] is Pcorsac in component lpc (mmHg). * ALGEBRAIC[93] is Pcorcapc in component lpc (mmHg). * ALGEBRAIC[74] is Pcorsvc in component lpc (mmHg). * ALGEBRAIC[73] is Pcorlvc in component lpc (mmHg). * ALGEBRAIC[72] is Pcorevc in component lpc (mmHg). * ALGEBRAIC[13] is Pcorao in component lpc (mmHg). * ALGEBRAIC[16] is Pcorea in component lpc (mmHg). * ALGEBRAIC[18] is Pcorla in component lpc (mmHg). * ALGEBRAIC[20] is Pcorsa in component lpc (mmHg). * ALGEBRAIC[15] is Pcorcap in component lpc (mmHg). * ALGEBRAIC[21] is Pcorsv in component lpc (mmHg). * ALGEBRAIC[19] is Pcorlv in component lpc (mmHg). * ALGEBRAIC[17] is Pcorev in component lpc (mmHg). * STATES[22] is Vcorao in component lpc (mL). * STATES[23] is Vcorea in component lpc (mL). * STATES[24] is Vcorla in component lpc (mL). * STATES[25] is Vcorsa in component lpc (mL). * STATES[26] is Vcorcap in component lpc (mL). * STATES[27] is Vcorsv in component lpc (mL). * STATES[28] is Vcorlv in component lpc (mL). * STATES[29] is Vcorev in component lpc (mL). * ALGEBRAIC[42] is Vcorcirc in component lpc (mL). * ALGEBRAIC[79] is Fcorao in component lpc (flow). * ALGEBRAIC[91] is Fcorea in component lpc (flow). * ALGEBRAIC[92] is Fcorla in component lpc (flow). * ALGEBRAIC[95] is Fcorsa in component lpc (flow). * ALGEBRAIC[94] is Fcorcap in component lpc (flow). * ALGEBRAIC[82] is Fcorsv in component lpc (flow). * ALGEBRAIC[81] is Fcorlv in component lpc (flow). * ALGEBRAIC[80] is Fcorev in component lpc (flow). * ALGEBRAIC[0] is beattime in component lpc (s). * ALGEBRAIC[3] is yla in component lpc (dimensionless). * ALGEBRAIC[4] is yra in component lpc (dimensionless). * ALGEBRAIC[5] is ylv in component lpc (dimensionless). * ALGEBRAIC[6] is yrv in component lpc (dimensionless). * CONSTANTS[106] is hrf in component lpc (Hz). * RATES[7] is d/dt Faod in component lpc (flow). * RATES[6] is d/dt Faop in component lpc (flowLm). * RATES[21] is d/dt Fpad in component lpc (flow). * RATES[20] is d/dt Fpap in component lpc (flowLm). * RATES[5] is d/dt MAP in component lpc (mmHg). * RATES[4] is d/dt Paopc in component lpc (mmHg). * RATES[8] is d/dt Vaop in component lpc (mL). * RATES[16] is d/dt Vpad in component lpc (mL). * RATES[9] is d/dt Vaod in component lpc (mL). * RATES[22] is d/dt Vcorao in component lpc (mL). * RATES[26] is d/dt Vcorcap in component lpc (mL). * RATES[23] is d/dt Vcorea in component lpc (mL). * RATES[29] is d/dt Vcorev in component lpc (mL). * RATES[24] is d/dt Vcorla in component lpc (mL). * RATES[28] is d/dt Vcorlv in component lpc (mL). * RATES[25] is d/dt Vcorsa in component lpc (mL). * RATES[27] is d/dt Vcorsv in component lpc (mL). * RATES[2] is d/dt Vla in component lpc (mL). * RATES[3] is d/dt Vlv in component lpc (mL). * RATES[17] is d/dt Vpa in component lpc (mL). * RATES[15] is d/dt Vpap in component lpc (mL). * RATES[18] is d/dt Vpc in component lpc (mL). * RATES[19] is d/dt Vpv in component lpc (mL). * RATES[0] is d/dt Vra in component lpc (mL). * RATES[1] is d/dt Vrv in component lpc (mL). * RATES[10] is d/dt Vsa in component lpc (mL). * RATES[11] is d/dt Vsap in component lpc (mL). * RATES[12] is d/dt Vsc in component lpc (mL). * RATES[13] is d/dt Vsv in component lpc (mL). * RATES[14] is d/dt Vvc in component lpc (mL). * There are a total of 18 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 72; CONSTANTS[1] = 23; CONSTANTS[2] = 103; CONSTANTS[3] = 53; CONSTANTS[4] = 10; CONSTANTS[5] = 8; CONSTANTS[6] = 10; CONSTANTS[7] = 8; CONSTANTS[8] = 0.001; CONSTANTS[9] = 0.001; CONSTANTS[10] = 0.12; CONSTANTS[11] = 5.6; CONSTANTS[12] = 0.186874659; CONSTANTS[13] = 0.67; CONSTANTS[14] = 0.1041640922; CONSTANTS[15] = 0.1091675077; CONSTANTS[16] = 0.0992431888; CONSTANTS[17] = 0.1446191772; CONSTANTS[18] = 0.1314719793; CONSTANTS[19] = 0; CONSTANTS[20] = 238; CONSTANTS[21] = 0.35; CONSTANTS[22] = 0.2; CONSTANTS[23] = 77; STATES[0] = 78.2537; STATES[1] = 167.4806; STATES[2] = 85.9126; STATES[3] = 125.360568; CONSTANTS[24] = 108.56912706; CONSTANTS[25] = 1e-4; CONSTANTS[26] = 1e-4; CONSTANTS[27] = 6.8284472205; CONSTANTS[28] = 0.025; CONSTANTS[29] = 0.2; CONSTANTS[30] = 0.3; CONSTANTS[31] = 0.025; CONSTANTS[32] = 0.1545054945; CONSTANTS[33] = 0.1381298227; CONSTANTS[34] = 0.5508058134; CONSTANTS[35] = 0.3445734208; CONSTANTS[36] = 1.4544677036; CONSTANTS[37] = 1.4843409851; CONSTANTS[38] = 7.9822364317; CONSTANTS[39] = 3.5e-4; CONSTANTS[40] = 3.5e-4; CONSTANTS[41] = 497.7852450367; CONSTANTS[42] = 50; CONSTANTS[43] = 485.7624931891; CONSTANTS[44] = 577.7106000108; CONSTANTS[45] = 0.03; CONSTANTS[46] = 0.05; CONSTANTS[47] = 0.01; CONSTANTS[48] = 0.1; CONSTANTS[49] = 21.83; CONSTANTS[50] = 3379.545; CONSTANTS[51] = -5; CONSTANTS[52] = 0.0968305478; CONSTANTS[53] = 0.4; CONSTANTS[54] = 0.001; CONSTANTS[55] = 0.025; CONSTANTS[56] = 129.6486; CONSTANTS[57] = 350.5314; CONSTANTS[58] = 50.010747; CONSTANTS[59] = 15; CONSTANTS[60] = -5.6; CONSTANTS[61] = 2; CONSTANTS[62] = 8; CONSTANTS[63] = 75; CONSTANTS[64] = 1; CONSTANTS[65] = 1; CONSTANTS[66] = 0.5; STATES[4] = 87.93968; STATES[5] = 90.6179; STATES[6] = 0.698577; STATES[7] = 23.5957; STATES[8] = 31.1705; STATES[9] = 138.4476; STATES[10] = 519.7915; STATES[11] = 129.6439; STATES[12] = 256.8555; STATES[13] = 2961.6507; STATES[14] = 232.46638962; CONSTANTS[67] = 1e-4; CONSTANTS[68] = 0.05; CONSTANTS[69] = 0.05; CONSTANTS[70] = 1e-4; CONSTANTS[71] = 0.03; CONSTANTS[72] = 4.2958026137; CONSTANTS[73] = 0.0565149137; CONSTANTS[74] = 0.0309026688; CONSTANTS[75] = 1e-4; CONSTANTS[76] = 1.5365929068; CONSTANTS[77] = 2.6893667388; CONSTANTS[78] = 3.1321449506; CONSTANTS[79] = 7.7147; CONSTANTS[80] = 27.87028922; CONSTANTS[81] = 1.801907e-4; CONSTANTS[82] = 1.932239e-4; STATES[15] = 33.1398; STATES[16] = 60.11203897; STATES[17] = 58.926; STATES[18] = 107.57022; STATES[19] = 293.0398; STATES[20] = 1.2282; STATES[21] = 57.1876; CONSTANTS[83] = 1; CONSTANTS[84] = 40; CONSTANTS[85] = 785; CONSTANTS[86] = 15; CONSTANTS[87] = 2.642367; CONSTANTS[88] = 2.642367; CONSTANTS[89] = 5.073345; CONSTANTS[90] = 5.073345; CONSTANTS[91] = 4.227788; CONSTANTS[92] = 0.4932479; CONSTANTS[93] = 0.4932479; CONSTANTS[94] = 0.4932479; CONSTANTS[95] = 0.13; CONSTANTS[96] = 0.05507; CONSTANTS[97] = 0.09129; CONSTANTS[98] = 0.15602; CONSTANTS[99] = 1.8; CONSTANTS[100] = 0.58155; CONSTANTS[101] = 0.68372; CONSTANTS[102] = 0.832299; STATES[22] = 2.76087; STATES[23] = 4.41135; STATES[24] = 4.992799; STATES[25] = 4.22047; STATES[26] = 8.55228; STATES[27] = 7.8362; STATES[28] = 8.213955; STATES[29] = 8.76758; CONSTANTS[103] = (CONSTANTS[24]/CONSTANTS[23])*60.0000; CONSTANTS[104] = CONSTANTS[60] - CONSTANTS[19]; CONSTANTS[105] = CONSTANTS[21]* pow((( 1.00000*1.00000)/CONSTANTS[23]), 1.0 / 2)*7.74597; CONSTANTS[106] = 60.0000/CONSTANTS[23]; CONSTANTS[107] = CONSTANTS[22]* pow((1.00000/CONSTANTS[23]), 1.0 / 2)*7.74597; STATES[30] = 0.1001; STATES[31] = 0.1001; RATES[7] = 0.1001; RATES[6] = 0.1001; RATES[21] = 0.1001; RATES[20] = 0.1001; RATES[5] = 0.1001; RATES[4] = 0.1001; RATES[8] = 0.1001; RATES[16] = 0.1001; RATES[9] = 0.1001; RATES[22] = 0.1001; RATES[26] = 0.1001; RATES[23] = 0.1001; RATES[29] = 0.1001; RATES[24] = 0.1001; RATES[28] = 0.1001; RATES[25] = 0.1001; RATES[27] = 0.1001; RATES[2] = 0.1001; RATES[3] = 0.1001; RATES[17] = 0.1001; RATES[15] = 0.1001; RATES[18] = 0.1001; RATES[19] = 0.1001; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[10] = 0.1001; RATES[11] = 0.1001; RATES[12] = 0.1001; RATES[13] = 0.1001; RATES[14] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[7] - ((ALGEBRAIC[54] - STATES[7]*CONSTANTS[28]) - ALGEBRAIC[31])/CONSTANTS[40]; resid[1] = RATES[6] - (((STATES[4] - STATES[6]*CONSTANTS[26]*16.6667) - ALGEBRAIC[54])/CONSTANTS[39])*0.0600000; resid[2] = RATES[21] - ((STATES[31] - ALGEBRAIC[23]) - STATES[21]*CONSTANTS[71])/CONSTANTS[82]; resid[3] = RATES[20] - (((ALGEBRAIC[78] - STATES[31]) - STATES[20]*CONSTANTS[70]*16.6667)/CONSTANTS[81])*0.0600000; resid[4] = RATES[5] - (ALGEBRAIC[63] - STATES[5])/CONSTANTS[59]; resid[5] = RATES[4] - (((ALGEBRAIC[84] - RATES[8]) - STATES[6]*16.6667) - ALGEBRAIC[79])*(1.00000/CONSTANTS[95]+( (CONSTANTS[61]/1.00000)*exp(STATES[22]/CONSTANTS[64]))/pow(exp(STATES[22]/CONSTANTS[64]) - 1.00000, 2.00000)); resid[6] = STATES[30] - STATES[31] - CONSTANTS[60]; resid[7] = STATES[31] - ( RATES[16]*CONSTANTS[69]+CONSTANTS[60]+STATES[16]/CONSTANTS[77]) - ( CONSTANTS[61]*1.00000)/(exp(STATES[16]/CONSTANTS[62]) - 1.00000); resid[8] = RATES[9] - ((STATES[6] - STATES[7]*0.0600000) - ALGEBRAIC[65]*0.0600000)*16.6667; resid[9] = RATES[8] - ((STATES[4] - STATES[8]/CONSTANTS[35])+( CONSTANTS[61]*1.00000)/(exp(STATES[8]/CONSTANTS[62]) - 1.00000))/CONSTANTS[29]; resid[10] = RATES[22] - ((ALGEBRAIC[84] - RATES[8]) - STATES[6]*16.6667) - ALGEBRAIC[79]; resid[11] = RATES[26] - ALGEBRAIC[95] - ALGEBRAIC[94]; resid[12] = RATES[23] - ALGEBRAIC[79] - ALGEBRAIC[91]; resid[13] = RATES[29] - ALGEBRAIC[81] - ALGEBRAIC[80]; resid[14] = RATES[24] - ALGEBRAIC[91] - ALGEBRAIC[92]; resid[15] = RATES[28] - ALGEBRAIC[82] - ALGEBRAIC[81]; resid[16] = RATES[25] - ALGEBRAIC[92] - ALGEBRAIC[95]; resid[17] = RATES[27] - ALGEBRAIC[94] - ALGEBRAIC[82]; resid[18] = RATES[2] - ALGEBRAIC[85] - ALGEBRAIC[83]; resid[19] = RATES[3] - ALGEBRAIC[83] - ALGEBRAIC[84]; resid[20] = RATES[17] - (STATES[21] - ALGEBRAIC[51]) - ALGEBRAIC[49]; resid[21] = RATES[16] - (STATES[20] - STATES[21]*0.0600000)*16.6667; resid[22] = RATES[15] - ALGEBRAIC[86] - STATES[20]*16.6667; resid[23] = RATES[18] - ALGEBRAIC[49] - ALGEBRAIC[50]; resid[24] = RATES[19] - (ALGEBRAIC[50]+ALGEBRAIC[51]) - ALGEBRAIC[85]; resid[25] = RATES[0] - (ALGEBRAIC[69] - ALGEBRAIC[66])+ALGEBRAIC[80]; resid[26] = RATES[1] - ALGEBRAIC[66] - ALGEBRAIC[86]; resid[27] = RATES[10] - ALGEBRAIC[68] - ALGEBRAIC[67]; resid[28] = RATES[11] - STATES[7] - ALGEBRAIC[68]; resid[29] = RATES[12] - ALGEBRAIC[67] - ALGEBRAIC[52]; resid[30] = RATES[13] - ALGEBRAIC[52] - ALGEBRAIC[53]; resid[31] = RATES[14] - (ALGEBRAIC[53]+ALGEBRAIC[65]) - ALGEBRAIC[69]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[11] = (CONDVAR[12]>0.00000&&CONDVAR[13]<0.00000 ? 5.00000 : CONDVAR[14]>0.00000&&CONDVAR[15]<0.00000 ? 10.0000 : 0.00000); ALGEBRAIC[12] = STATES[4] - CONSTANTS[60]; ALGEBRAIC[13] = ALGEBRAIC[12]; ALGEBRAIC[34] = STATES[15]+STATES[16]+STATES[17]; ALGEBRAIC[35] = STATES[19]; ALGEBRAIC[40] = STATES[8]+STATES[9]+STATES[10]+STATES[11]; ALGEBRAIC[41] = STATES[13]+STATES[14]; ALGEBRAIC[48] = STATES[0]+STATES[1]+STATES[15]+STATES[16]+STATES[17]+STATES[18]+STATES[19]+STATES[2]+STATES[3]+STATES[8]+STATES[9]+STATES[10]+STATES[11]+STATES[12]+STATES[13]+STATES[14]+CONSTANTS[86]+ALGEBRAIC[42]; ALGEBRAIC[64] = ALGEBRAIC[48] - CONSTANTS[86]; ALGEBRAIC[70] = ALGEBRAIC[54] - CONSTANTS[19]; ALGEBRAIC[90] = ALGEBRAIC[78] - CONSTANTS[60]; } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[22] = STATES[17]/CONSTANTS[78] - ( CONSTANTS[61]*1.00000)/(exp(STATES[17]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[23] = ALGEBRAIC[22]+CONSTANTS[60]; ALGEBRAIC[31] = STATES[11]/CONSTANTS[37] - ( CONSTANTS[61]*1.00000)/(exp(STATES[11]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[25] = STATES[18]/CONSTANTS[79] - ( CONSTANTS[61]*1.00000)/(exp(STATES[18]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[26] = ALGEBRAIC[25]+CONSTANTS[60]; ALGEBRAIC[49] = (ALGEBRAIC[23] - ALGEBRAIC[26])/CONSTANTS[73]; ALGEBRAIC[27] = STATES[19]/CONSTANTS[80] - ( CONSTANTS[61]*1.00000)/(exp(STATES[19]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[28] = ALGEBRAIC[27]+CONSTANTS[60]; ALGEBRAIC[50] = (ALGEBRAIC[26] - ALGEBRAIC[28])/CONSTANTS[74]; ALGEBRAIC[51] = (ALGEBRAIC[23] - ALGEBRAIC[28])/CONSTANTS[72]; ALGEBRAIC[32] = STATES[12]/CONSTANTS[38] - ( CONSTANTS[61]*1.00000)/(exp(STATES[12]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[33] = CONSTANTS[49]*arbitrary_log(CONSTANTS[50]/STATES[13] - 0.990000, 10)*- 1.00000; ALGEBRAIC[52] = (ALGEBRAIC[32] - ALGEBRAIC[33])/CONSTANTS[32]; ALGEBRAIC[36] = (CONDVAR[17]>0.00000 ? (CONSTANTS[51]+ CONSTANTS[53]*exp(CONSTANTS[56]/CONSTANTS[58])+( CONSTANTS[52]*(STATES[14] - CONSTANTS[56]))/1.00000) - CONSTANTS[61]/(exp(STATES[14]/CONSTANTS[62]) - 1.00000) : (CONSTANTS[51]+ CONSTANTS[53]*exp(STATES[14]/CONSTANTS[58])) - CONSTANTS[61]/(exp(STATES[14]/CONSTANTS[62]) - 1.00000)); ALGEBRAIC[37] = ALGEBRAIC[36]+CONSTANTS[60]; ALGEBRAIC[53] = (ALGEBRAIC[33] - ALGEBRAIC[37])/CONSTANTS[33]; ALGEBRAIC[54] = ((((( CONSTANTS[30]*CONSTANTS[27]*STATES[6] - CONSTANTS[30]*CONSTANTS[27]*STATES[7]*0.0600000)+ (( STATES[9]*CONSTANTS[27])/CONSTANTS[36])*0.0600000) - (( CONSTANTS[27]*CONSTANTS[61])/(exp(STATES[9]/CONSTANTS[62]) - 1.00000))*0.0600000)+ ALGEBRAIC[37]*CONSTANTS[30]*0.0600000)/(CONSTANTS[27]+CONSTANTS[30]))*16.6667; ALGEBRAIC[29] = CONSTANTS[41]*arbitrary_log((STATES[10] - CONSTANTS[43])/CONSTANTS[42]+1.00000, 10); ALGEBRAIC[30] = CONSTANTS[45]*exp( CONSTANTS[48]*(STATES[10] - CONSTANTS[43]))+ CONSTANTS[46]*pow(STATES[10] - CONSTANTS[43], 2.00000); ALGEBRAIC[63] = CONSTANTS[66]*ALGEBRAIC[29]+ (1.00000 - CONSTANTS[66])*ALGEBRAIC[30]; ALGEBRAIC[65] = (ALGEBRAIC[54] - ALGEBRAIC[37])/CONSTANTS[27]; ALGEBRAIC[0] = VOI - floor(VOI/CONSTANTS[106])*CONSTANTS[106]; ALGEBRAIC[2] = ALGEBRAIC[0]; ALGEBRAIC[3] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? (1.00000 - cos(( 3.14159265358979*ALGEBRAIC[2])/CONSTANTS[107]))/2.00000 : CONDVAR[2]<0.00000&&CONDVAR[3]>=0.00000 ? (1.00000+cos(( 2.00000* 3.14159265358979*(ALGEBRAIC[2] - CONSTANTS[107]))/CONSTANTS[107]))/2.00000 : 0.00000); ALGEBRAIC[4] = ALGEBRAIC[3]; ALGEBRAIC[7] = (CONSTANTS[15] - CONSTANTS[16])*ALGEBRAIC[4]+CONSTANTS[16]; ALGEBRAIC[46] = (1.00000 - ALGEBRAIC[4])*(CONSTANTS[6] - CONSTANTS[7])+CONSTANTS[7]; ALGEBRAIC[59] = (STATES[0] - ALGEBRAIC[46])*ALGEBRAIC[7] - ( CONSTANTS[61]*1.00000)/(exp(STATES[0]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[42] = STATES[22]+STATES[23]+STATES[24]+STATES[25]+STATES[26]+STATES[27]+STATES[28]+STATES[29]; ALGEBRAIC[45] = STATES[1]+STATES[0]+STATES[3]+STATES[2]+CONSTANTS[86]+CONSTANTS[20]+ALGEBRAIC[42]; ALGEBRAIC[57] = CONSTANTS[83]*exp((ALGEBRAIC[45] - CONSTANTS[85])/CONSTANTS[84]) - ( CONSTANTS[61]*1.00000)/(exp(ALGEBRAIC[45]/CONSTANTS[63]) - 1.00000); ALGEBRAIC[58] = ALGEBRAIC[57]+CONSTANTS[60]; ALGEBRAIC[60] = ALGEBRAIC[59]+ALGEBRAIC[58]; ALGEBRAIC[1] = ALGEBRAIC[0] - CONSTANTS[10]; ALGEBRAIC[5] = (CONDVAR[4]>=0.00000&&CONDVAR[5]<=0.00000 ? (1.00000 - cos(( 3.14159265358979*ALGEBRAIC[1])/CONSTANTS[105]))/2.00000 : CONDVAR[6]<0.00000&&CONDVAR[7]>=0.00000 ? (1.00000+cos(( 2.00000* 3.14159265358979*(ALGEBRAIC[1] - CONSTANTS[105]))/CONSTANTS[105]))/2.00000 : 0.00000); ALGEBRAIC[6] = ALGEBRAIC[5]; ALGEBRAIC[8] = (CONSTANTS[13] - CONSTANTS[14])*ALGEBRAIC[6]+CONSTANTS[14]; ALGEBRAIC[47] = (1.00000 - ALGEBRAIC[6])*(CONSTANTS[2] - CONSTANTS[3])+CONSTANTS[3]; ALGEBRAIC[61] = (STATES[1] - ALGEBRAIC[47])*ALGEBRAIC[8] - ( CONSTANTS[61]*1.00000)/(exp(STATES[1]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[62] = ALGEBRAIC[61]+ALGEBRAIC[58]; ALGEBRAIC[66] = (CONDVAR[10]>0.00000 ? (ALGEBRAIC[60] - ALGEBRAIC[62])/CONSTANTS[8] : 0.00000); ALGEBRAIC[38] = CONSTANTS[34]+ CONSTANTS[47]*exp( 4.00000*CONSTANTS[66])+ CONSTANTS[47]*pow(CONSTANTS[44]/STATES[10], 2.00000); ALGEBRAIC[67] = (ALGEBRAIC[63] - ALGEBRAIC[32])/ALGEBRAIC[38]; ALGEBRAIC[68] = (ALGEBRAIC[31] - ALGEBRAIC[63])/CONSTANTS[31]; ALGEBRAIC[39] = CONSTANTS[54]*pow(CONSTANTS[57]/STATES[14], 2.00000)+CONSTANTS[55]; ALGEBRAIC[69] = (ALGEBRAIC[37] - ALGEBRAIC[60])/ALGEBRAIC[39]; ALGEBRAIC[77] = ((((( CONSTANTS[67]*STATES[15])/CONSTANTS[76] - ( CONSTANTS[67]*CONSTANTS[61]*1.00000)/(exp(STATES[15]/CONSTANTS[62]) - 1.00000))+ ALGEBRAIC[62]*CONSTANTS[68]) - CONSTANTS[67]*CONSTANTS[68]*STATES[20]*16.6667)+ CONSTANTS[60]*CONSTANTS[67])/(CONSTANTS[68]+CONSTANTS[67]); ALGEBRAIC[24] = ((STATES[15]/CONSTANTS[76]+CONSTANTS[60]) - CONSTANTS[68]*STATES[20]*16.6667) - ( CONSTANTS[61]*1.00000)/(exp(STATES[15]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[78] = (CONDVAR[16]>0.00000 ? ALGEBRAIC[77] : ALGEBRAIC[24]); ALGEBRAIC[14] = STATES[4]; ALGEBRAIC[16] = STATES[23]/CONSTANTS[96] - ( CONSTANTS[65]*1.00000)/(exp(STATES[23]/CONSTANTS[64]) - 1.00000); ALGEBRAIC[71] = ALGEBRAIC[16]+ALGEBRAIC[58]; ALGEBRAIC[79] = (ALGEBRAIC[14] - ALGEBRAIC[71])/CONSTANTS[87]; ALGEBRAIC[17] = STATES[29]/CONSTANTS[102] - ( CONSTANTS[61]*1.00000)/(exp(STATES[29]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[72] = ALGEBRAIC[17]+ALGEBRAIC[58]; ALGEBRAIC[80] = (ALGEBRAIC[72] - ALGEBRAIC[60])/CONSTANTS[94]; ALGEBRAIC[19] = STATES[28]/CONSTANTS[101] - ( CONSTANTS[65]*1.00000)/(exp(STATES[28]/CONSTANTS[64]) - 1.00000); ALGEBRAIC[73] = ALGEBRAIC[19]+ALGEBRAIC[58]; ALGEBRAIC[81] = (ALGEBRAIC[73] - ALGEBRAIC[72])/CONSTANTS[93]; ALGEBRAIC[21] = STATES[27]/CONSTANTS[100] - ( CONSTANTS[65]*1.00000)/(exp(STATES[27]/CONSTANTS[64]) - 1.00000); ALGEBRAIC[74] = ALGEBRAIC[21]+ALGEBRAIC[58]; ALGEBRAIC[82] = (ALGEBRAIC[74] - ALGEBRAIC[73])/CONSTANTS[92]; ALGEBRAIC[9] = (CONSTANTS[17] - CONSTANTS[18])*ALGEBRAIC[3]+CONSTANTS[18]; ALGEBRAIC[43] = (1.00000 - ALGEBRAIC[3])*(CONSTANTS[4] - CONSTANTS[5])+CONSTANTS[5]; ALGEBRAIC[55] = (STATES[2] - ALGEBRAIC[43])*ALGEBRAIC[9] - ( CONSTANTS[61]*1.00000)/(exp(STATES[2]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[75] = ALGEBRAIC[55]+ALGEBRAIC[58]; ALGEBRAIC[10] = (CONSTANTS[11] - CONSTANTS[12])*ALGEBRAIC[5]+CONSTANTS[12]; ALGEBRAIC[44] = (1.00000 - ALGEBRAIC[5])*(CONSTANTS[0] - CONSTANTS[1])+CONSTANTS[1]; ALGEBRAIC[56] = (STATES[3] - ALGEBRAIC[44])*ALGEBRAIC[10] - ( CONSTANTS[61]*1.00000)/(exp(STATES[3]/CONSTANTS[62]) - 1.00000); ALGEBRAIC[76] = ALGEBRAIC[56]+ALGEBRAIC[58]; ALGEBRAIC[83] = (CONDVAR[8]>0.00000 ? (ALGEBRAIC[75] - ALGEBRAIC[76])/CONSTANTS[9] : 0.00000); ALGEBRAIC[84] = (CONDVAR[9]>0.00000 ? (ALGEBRAIC[76] - STATES[4])/CONSTANTS[25] : 0.00000); ALGEBRAIC[85] = (ALGEBRAIC[28] - ALGEBRAIC[75])/CONSTANTS[75]; ALGEBRAIC[86] = (CONDVAR[11]>0.00000 ? (ALGEBRAIC[62] - ALGEBRAIC[78])/CONSTANTS[67] : 0.00000); ALGEBRAIC[87] = fabs((ALGEBRAIC[76] - ALGEBRAIC[58])/2.00000); ALGEBRAIC[18] = STATES[24]/CONSTANTS[97] - ( CONSTANTS[65]*1.00000)/(exp(STATES[24]/CONSTANTS[64]) - 1.00000); ALGEBRAIC[88] = ALGEBRAIC[18]+ALGEBRAIC[87]; ALGEBRAIC[91] = (ALGEBRAIC[71] - ALGEBRAIC[88])/CONSTANTS[88]; ALGEBRAIC[20] = STATES[25]/CONSTANTS[98] - ( CONSTANTS[65]*1.00000)/(exp(STATES[25]/CONSTANTS[64]) - 1.00000); ALGEBRAIC[89] = ALGEBRAIC[20]+ALGEBRAIC[87]; ALGEBRAIC[92] = (ALGEBRAIC[88] - ALGEBRAIC[89])/CONSTANTS[89]; ALGEBRAIC[15] = STATES[26]/CONSTANTS[99] - ( CONSTANTS[65]*1.00000)/(exp(STATES[26]/CONSTANTS[64]) - 1.00000); ALGEBRAIC[93] = ALGEBRAIC[15]+ALGEBRAIC[87]; ALGEBRAIC[94] = (ALGEBRAIC[93] - ALGEBRAIC[74])/CONSTANTS[91]; ALGEBRAIC[95] = (ALGEBRAIC[89] - ALGEBRAIC[93])/CONSTANTS[90]; } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; SI[5] = 1.0; SI[6] = 1.0; SI[7] = 1.0; SI[8] = 1.0; SI[9] = 1.0; SI[10] = 1.0; SI[11] = 1.0; SI[12] = 1.0; SI[13] = 1.0; SI[14] = 1.0; SI[30] = 0.0; SI[31] = 0.0; SI[15] = 1.0; SI[16] = 1.0; SI[17] = 1.0; SI[18] = 1.0; SI[19] = 1.0; SI[20] = 1.0; SI[21] = 1.0; SI[22] = 1.0; SI[23] = 1.0; SI[24] = 1.0; SI[25] = 1.0; SI[26] = 1.0; SI[27] = 1.0; SI[28] = 1.0; SI[29] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = ALGEBRAIC[2] - 0.00000; CONDVAR[1] = ALGEBRAIC[2] - CONSTANTS[107]; CONDVAR[2] = ALGEBRAIC[2] - 1.50000*CONSTANTS[107]; CONDVAR[3] = ALGEBRAIC[2] - CONSTANTS[107]; CONDVAR[4] = ALGEBRAIC[1] - 0.00000; CONDVAR[5] = ALGEBRAIC[1] - CONSTANTS[105]; CONDVAR[6] = ALGEBRAIC[1] - 1.50000*CONSTANTS[105]; CONDVAR[7] = ALGEBRAIC[1] - CONSTANTS[105]; CONDVAR[8] = ALGEBRAIC[75] - ALGEBRAIC[76]; CONDVAR[9] = ALGEBRAIC[76] - STATES[4]; CONDVAR[10] = ALGEBRAIC[60] - ALGEBRAIC[62]; CONDVAR[11] = ALGEBRAIC[62] - ALGEBRAIC[78]; CONDVAR[12] = VOI - ALGEBRAIC[0]; CONDVAR[13] = VOI - (ALGEBRAIC[0]+0.0200000); CONDVAR[14] = VOI - (ALGEBRAIC[0]+CONSTANTS[10]); CONDVAR[15] = VOI - (ALGEBRAIC[0]+CONSTANTS[10]+0.0200000); CONDVAR[16] = ALGEBRAIC[62] - ALGEBRAIC[77]; CONDVAR[17] = STATES[14] - CONSTANTS[56]; }