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 92 entries in the algebraic variable array.
   There are a total of 29 entries in each of the rate and state variable arrays.
   There are a total of 74 entries in the constant variable array.
 */
/*
 * VOI is time in component Environment (ms).
 * CONSTANTS[0] is F in component Environment (C_per_mole).
 * CONSTANTS[1] is K_o in component Environment (mM).
 * CONSTANTS[2] is Ca_o in component Environment (mM).
 * CONSTANTS[3] is Na_o in component Environment (mM).
 * CONSTANTS[4] is Cl_o in component Environment (mM).
 * CONSTANTS[5] is FonRT in component Environment (per_mV).
 * STATES[0] is V in component cell (mV).
 * ALGEBRAIC[76] is INa in component INa (uA_per_uF).
 * ALGEBRAIC[10] is ICaL in component ICaL (uA_per_uF).
 * ALGEBRAIC[80] is IK1 in component IK1 (uA_per_uF).
 * ALGEBRAIC[84] is IKp in component IKp (uA_per_uF).
 * ALGEBRAIC[82] is IKs in component IKs (uA_per_uF).
 * ALGEBRAIC[81] is IKr in component IKr (uA_per_uF).
 * ALGEBRAIC[43] is IpCa in component IpCa (uA_per_uF).
 * ALGEBRAIC[44] is ICab in component ICab (uA_per_uF).
 * ALGEBRAIC[42] is INaCa in component INaCa (uA_per_uF).
 * ALGEBRAIC[35] is INaK in component INaK (uA_per_uF).
 * ALGEBRAIC[83] is Ito in component Ito (uA_per_uF).
 * ALGEBRAIC[47] is Ito2 in component Ito2 (uA_per_uF).
 * ALGEBRAIC[85] is IClb in component IClb (uA_per_uF).
 * ALGEBRAIC[86] is INal in component INal (uA_per_uF).
 * ALGEBRAIC[75] is caiont in component cell (uA_per_uF).
 * ALGEBRAIC[89] is naiont in component cell (uA_per_uF).
 * ALGEBRAIC[90] is kiont in component cell (uA_per_uF).
 * ALGEBRAIC[91] is clont in component cell (uA_per_uF).
 * CONSTANTS[6] is l in component cell (cm).
 * CONSTANTS[7] is a in component cell (cm).
 * CONSTANTS[62] is vcell in component cell (uL).
 * CONSTANTS[65] is ageo in component cell (cm2).
 * CONSTANTS[68] is Acap in component cell (uF).
 * CONSTANTS[69] is vmyo in component cell (uL).
 * CONSTANTS[66] is vmito in component cell (uL).
 * CONSTANTS[67] is vsr in component cell (uL).
 * CONSTANTS[70] is vnsr in component cell (uL).
 * CONSTANTS[71] is vjsr in component cell (uL).
 * CONSTANTS[72] is vss in component cell (uL).
 * CONSTANTS[73] is AF in component cell (uF_mole_per_C).
 * CONSTANTS[8] is stim_offset in component cell (ms).
 * CONSTANTS[9] is stim_period in component cell (ms).
 * CONSTANTS[10] is stim_duration in component cell (ms).
 * CONSTANTS[11] is stim_amplitude in component cell (uA_per_uF).
 * ALGEBRAIC[1] is i_Stim in component cell (uA_per_uF).
 * ALGEBRAIC[0] is past in component cell (ms).
 * ALGEBRAIC[51] is ENa in component reversal_potentials (mV).
 * CONSTANTS[12] is GNa in component INa (mS_per_uF).
 * ALGEBRAIC[2] is gNa in component INa (mS_per_uF).
 * STATES[1] is H in component INa (dimensionless).
 * STATES[2] is m in component INa (dimensionless).
 * STATES[3] is J in component INa (dimensionless).
 * ALGEBRAIC[7] is am in component INa (per_ms).
 * ALGEBRAIC[8] is bm in component INa (per_ms).
 * ALGEBRAIC[3] is ah in component INa (per_ms).
 * ALGEBRAIC[5] is bh in component INa (per_ms).
 * ALGEBRAIC[4] is aj in component INa (per_ms).
 * ALGEBRAIC[6] is bj in component INa (per_ms).
 * STATES[4] is Ca_ss in component Ca (mM).
 * STATES[5] is d in component ICaL (dimensionless).
 * STATES[6] is dp in component ICaL (dimensionless).
 * STATES[7] is f in component ICaL (dimensionless).
 * STATES[8] is fca in component ICaL (dimensionless).
 * STATES[9] is fca2 in component ICaL (dimensionless).
 * STATES[10] is f2 in component ICaL (dimensionless).
 * CONSTANTS[13] is pca in component ICaL (L_per_F_ms).
 * CONSTANTS[14] is gacai in component ICaL (dimensionless).
 * CONSTANTS[15] is gacao in component ICaL (dimensionless).
 * ALGEBRAIC[56] is CaMKactive in component Irel (dimensionless).
 * ALGEBRAIC[9] is ibarca in component ICaL (uA_per_uF).
 * ALGEBRAIC[11] is dss in component ICaL (dimensionless).
 * ALGEBRAIC[12] is taud in component ICaL (ms).
 * ALGEBRAIC[13] is fss in component ICaL (dimensionless).
 * ALGEBRAIC[14] is f2ss in component ICaL (dimensionless).
 * ALGEBRAIC[15] is tauf in component ICaL (ms).
 * ALGEBRAIC[16] is tauf2 in component ICaL (ms).
 * ALGEBRAIC[17] is dpss in component ICaL (dimensionless).
 * ALGEBRAIC[18] is fcass in component ICaL (dimensionless).
 * ALGEBRAIC[19] is fca2ss in component ICaL (dimensionless).
 * ALGEBRAIC[77] is taufca in component ICaL (ms).
 * ALGEBRAIC[20] is taufca2 in component ICaL (ms).
 * CONSTANTS[16] is tau_pow_calcium in component ICaL (ms).
 * ALGEBRAIC[52] is EK in component reversal_potentials (mV).
 * CONSTANTS[17] is GK1 in component IK1 (mS_per_uF).
 * ALGEBRAIC[78] is ak1 in component IK1 (per_ms).
 * ALGEBRAIC[79] is bk1 in component IK1 (per_ms).
 * CONSTANTS[18] is GKrMax in component IKr (mS_per_uF).
 * CONSTANTS[63] is gkr in component IKr (mS_per_uF).
 * ALGEBRAIC[21] is r in component IKr (dimensionless).
 * STATES[11] is xr in component IKr (dimensionless).
 * ALGEBRAIC[22] is xrss in component IKr (dimensionless).
 * ALGEBRAIC[23] is tauxr in component IKr (ms).
 * STATES[12] is Ca_i in component Ca (mM).
 * ALGEBRAIC[24] is gks in component IKs (mS_per_uF).
 * CONSTANTS[19] is gks_max in component IKs (mS_per_uF).
 * ALGEBRAIC[53] is EKs in component reversal_potentials (mV).
 * ALGEBRAIC[25] is xss in component IKs (dimensionless).
 * ALGEBRAIC[26] is tauxs in component IKs (ms).
 * STATES[13] is xs1 in component IKs (dimensionless).
 * STATES[14] is xs2 in component IKs (dimensionless).
 * CONSTANTS[20] is gitodv in component Ito (mS_per_uF).
 * ALGEBRAIC[27] is rv in component Ito (dimensionless).
 * ALGEBRAIC[28] is ay in component Ito (per_ms).
 * ALGEBRAIC[29] is by in component Ito (per_ms).
 * ALGEBRAIC[30] is ay2 in component Ito (per_ms).
 * ALGEBRAIC[31] is by2 in component Ito (per_ms).
 * ALGEBRAIC[32] is ay3 in component Ito (per_ms).
 * ALGEBRAIC[33] is by3 in component Ito (per_ms).
 * STATES[15] is ydv in component Ito (dimensionless).
 * STATES[16] is ydv2 in component Ito (dimensionless).
 * STATES[17] is zdv in component Ito (dimensionless).
 * CONSTANTS[21] is Cto in component Ito (mV).
 * STATES[18] is Na_i in component Na (mM).
 * CONSTANTS[22] is kmnai in component INaK (mM).
 * CONSTANTS[23] is kmko in component INaK (mM).
 * CONSTANTS[24] is ibarnak in component INaK (uA_per_uF).
 * CONSTANTS[64] is sigma in component INaK (dimensionless).
 * ALGEBRAIC[34] is fnak in component INaK (dimensionless).
 * ALGEBRAIC[36] is ca_i_NaCa in component INaCa (mM).
 * CONSTANTS[25] is KmCa in component INaCa (mM).
 * ALGEBRAIC[37] is allo in component INaCa (dimensionless).
 * CONSTANTS[26] is NCXmax in component INaCa (uA_per_uF).
 * CONSTANTS[27] is ksat in component INaCa (dimensionless).
 * CONSTANTS[28] is eta in component INaCa (dimensionless).
 * CONSTANTS[29] is KmNai in component INaCa (mM).
 * CONSTANTS[30] is KmNao in component INaCa (mM).
 * CONSTANTS[31] is KmCai in component INaCa (mM).
 * CONSTANTS[32] is KmCao in component INaCa (mM).
 * ALGEBRAIC[38] is num in component INaCa (mM4).
 * ALGEBRAIC[39] is denom1 in component INaCa (dimensionless).
 * ALGEBRAIC[40] is denom2 in component INaCa (mM4).
 * ALGEBRAIC[41] is denom3 in component INaCa (mM4).
 * CONSTANTS[33] is ibarpca in component IpCa (uA_per_uF).
 * CONSTANTS[34] is kmpca in component IpCa (mM).
 * CONSTANTS[35] is GCab in component ICab (L_per_F_ms).
 * STATES[19] is Cl_i in component Cl (mM).
 * CONSTANTS[36] is PCl in component Ito2 (L_per_F_ms).
 * STATES[20] is AA in component Ito2 (dimensionless).
 * ALGEBRAIC[45] is Ito2_max in component Ito2 (uA_per_uF).
 * ALGEBRAIC[46] is AAss in component Ito2 (dimensionless).
 * CONSTANTS[37] is Kmto2 in component Ito2 (mM).
 * ALGEBRAIC[54] is ECl in component reversal_potentials (mV).
 * CONSTANTS[38] is GClb in component IClb (mS_per_uF).
 * CONSTANTS[39] is GNaL in component INal (mS_per_uF).
 * STATES[21] is mL in component INal (dimensionless).
 * STATES[22] is hL in component INal (dimensionless).
 * ALGEBRAIC[48] is amL in component INal (per_ms).
 * ALGEBRAIC[49] is bmL in component INal (per_ms).
 * ALGEBRAIC[50] is hLss in component INal (dimensionless).
 * STATES[23] is K_i in component K (mM).
 * CONSTANTS[40] is prnak in component reversal_potentials (dimensionless).
 * STATES[24] is Ca_jsr in component Ca (mM).
 * ALGEBRAIC[87] is Grel in component Irel (per_ms).
 * ALGEBRAIC[59] is dro_inf in component Irel (dimensionless).
 * CONSTANTS[41] is dtau_rel_max in component Irel (ms).
 * ALGEBRAIC[60] is dtau_rel in component Irel (ms).
 * ALGEBRAIC[61] is ross in component Irel (dimensionless).
 * ALGEBRAIC[62] is riss in component Irel (dimensionless).
 * ALGEBRAIC[63] is tauri in component Irel (ms).
 * ALGEBRAIC[88] is irelcicr in component Irel (mM_per_ms).
 * CONSTANTS[42] is CaMK0 in component Irel (dimensionless).
 * CONSTANTS[43] is Km in component Irel (mM).
 * CONSTANTS[44] is KmCaMK in component Irel (dimensionless).
 * ALGEBRAIC[55] is CaMKbound in component Irel (dimensionless).
 * STATES[25] is CaMKtrap in component Irel (dimensionless).
 * STATES[26] is ro in component Irel (dimensionless).
 * STATES[27] is ri in component Irel (dimensionless).
 * ALGEBRAIC[57] is vg in component Irel (dimensionless).
 * ALGEBRAIC[58] is cafac in component Irel (dimensionless).
 * CONSTANTS[45] is dKmPLBmax in component Iup_Ileak (mM).
 * CONSTANTS[46] is dJupmax in component Iup_Ileak (dimensionless).
 * ALGEBRAIC[64] is dKmPLB in component Iup_Ileak (mM).
 * ALGEBRAIC[65] is dJup in component Iup_Ileak (dimensionless).
 * CONSTANTS[47] is iupmax in component Iup_Ileak (mM_per_ms).
 * CONSTANTS[48] is Kmup in component Iup_Ileak (mM).
 * CONSTANTS[49] is nsrmax in component Iup_Ileak (mM).
 * ALGEBRAIC[66] is iup in component Iup_Ileak (mM_per_ms).
 * ALGEBRAIC[67] is ileak in component Iup_Ileak (mM_per_ms).
 * STATES[28] is Ca_nsr in component Ca (mM).
 * ALGEBRAIC[68] is idiff in component Idiff_Itr (mM_per_ms).
 * ALGEBRAIC[69] is itr in component Idiff_Itr (mM_per_ms).
 * ALGEBRAIC[70] is CTNaCl in component Na (mM_per_ms).
 * CONSTANTS[50] is CTNaClmax in component Na (mM_per_ms).
 * ALGEBRAIC[71] is CTKCl in component K (mM_per_ms).
 * CONSTANTS[51] is CTKClmax in component K (mM_per_ms).
 * CONSTANTS[52] is kmt in component Ca (mM).
 * CONSTANTS[53] is kmc in component Ca (mM).
 * CONSTANTS[54] is tbar in component Ca (mM).
 * CONSTANTS[55] is cbar in component Ca (mM).
 * CONSTANTS[56] is kmcsqn in component Ca (mM).
 * CONSTANTS[57] is csqnbar in component Ca (mM).
 * ALGEBRAIC[72] is bcsqn in component Ca (dimensionless).
 * ALGEBRAIC[73] is bmyo in component Ca (dimensionless).
 * CONSTANTS[58] is BSRmax in component Ca (mM).
 * CONSTANTS[59] is KmBSR in component Ca (mM).
 * CONSTANTS[60] is BSLmax in component Ca (mM).
 * CONSTANTS[61] is KmBSL in component Ca (mM).
 * ALGEBRAIC[74] is bss in component Ca (dimensionless).
 * RATES[0] is d/dt V in component cell (mV).
 * RATES[1] is d/dt H in component INa (dimensionless).
 * RATES[2] is d/dt m in component INa (dimensionless).
 * RATES[3] is d/dt J in component INa (dimensionless).
 * RATES[5] is d/dt d in component ICaL (dimensionless).
 * RATES[6] is d/dt dp in component ICaL (dimensionless).
 * RATES[7] is d/dt f in component ICaL (dimensionless).
 * RATES[10] is d/dt f2 in component ICaL (dimensionless).
 * RATES[8] is d/dt fca in component ICaL (dimensionless).
 * RATES[9] is d/dt fca2 in component ICaL (dimensionless).
 * RATES[11] is d/dt xr in component IKr (dimensionless).
 * RATES[13] is d/dt xs1 in component IKs (dimensionless).
 * RATES[14] is d/dt xs2 in component IKs (dimensionless).
 * RATES[15] is d/dt ydv in component Ito (dimensionless).
 * RATES[16] is d/dt ydv2 in component Ito (dimensionless).
 * RATES[17] is d/dt zdv in component Ito (dimensionless).
 * RATES[20] is d/dt AA in component Ito2 (dimensionless).
 * RATES[21] is d/dt mL in component INal (dimensionless).
 * RATES[22] is d/dt hL in component INal (dimensionless).
 * RATES[26] is d/dt ro in component Irel (dimensionless).
 * RATES[27] is d/dt ri in component Irel (dimensionless).
 * RATES[25] is d/dt CaMKtrap in component Irel (dimensionless).
 * RATES[18] is d/dt Na_i in component Na (mM).
 * RATES[23] is d/dt K_i in component K (mM).
 * RATES[19] is d/dt Cl_i in component Cl (mM).
 * RATES[12] is d/dt Ca_i in component Ca (mM).
 * RATES[4] is d/dt Ca_ss in component Ca (mM).
 * RATES[28] is d/dt Ca_nsr in component Ca (mM).
 * RATES[24] is d/dt Ca_jsr in component Ca (mM).
 * There are a total of 7 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 96485;
CONSTANTS[1] = 4;
CONSTANTS[2] = 1.8;
CONSTANTS[3] = 150;
CONSTANTS[4] = 154.6;
CONSTANTS[5] = 0.0374358835078;
STATES[0] = -93.2932771154856;
CONSTANTS[6] = 0.01;
CONSTANTS[7] = 0.0011;
CONSTANTS[8] = 0;
CONSTANTS[9] = 1000;
CONSTANTS[10] = 1;
CONSTANTS[11] = -80;
CONSTANTS[12] = 8.25;
STATES[1] = 0.99765453819431;
STATES[2] = 0.000382187369845771;
STATES[3] = 0.998157020148849;
STATES[4] = 0.000225131045297696;
STATES[5] = 5.38067794749339e-7;
STATES[6] = 8.99805432294836;
STATES[7] = 0.999986839648304;
STATES[8] = 0.961568137796573;
STATES[9] = 0.854261813196152;
STATES[10] = 0.989081601403786;
CONSTANTS[13] = 0.000243;
CONSTANTS[14] = 1;
CONSTANTS[15] = 0.341;
CONSTANTS[16] = 10;
CONSTANTS[17] = 0.5;
CONSTANTS[18] = 0.0138542;
STATES[11] = 0.255981702631947;
STATES[12] = 0.000223768331231758;
CONSTANTS[19] = 0.00746925;
STATES[13] = 0.0147449166757808;
STATES[14] = 0.0147504787196957;
CONSTANTS[20] = 0.1805;
STATES[15] = 0.00894974857468432;
STATES[16] = 0.999992183094244;
STATES[17] = 0.787996527242362;
CONSTANTS[21] = 300;
STATES[18] = 17.9964119779802;
CONSTANTS[22] = 10;
CONSTANTS[23] = 1.5;
CONSTANTS[24] = 0.61875;
CONSTANTS[25] = 0.000125;
CONSTANTS[26] = 5.85;
CONSTANTS[27] = 0.27;
CONSTANTS[28] = 0.35;
CONSTANTS[29] = 12.3;
CONSTANTS[30] = 87.5;
CONSTANTS[31] = 0.0036;
CONSTANTS[32] = 1.3;
CONSTANTS[33] = 0.0575;
CONSTANTS[34] = 0.0005;
CONSTANTS[35] = 0.0000007980336;
STATES[19] = 20.1543792471096;
CONSTANTS[36] = 4e-7;
STATES[20] = 0.0014969201082975;
CONSTANTS[37] = 0.1502;
CONSTANTS[38] = 0.000225;
CONSTANTS[39] = 0.011;
STATES[21] = 0.000382187369845771;
STATES[22] = 0.488129650338831;
STATES[23] = 134.555737634453;
CONSTANTS[40] = 0.01833;
STATES[24] = 4.1270622547589;
CONSTANTS[41] = 10;
CONSTANTS[42] = 0.05;
CONSTANTS[43] = 0.0015;
CONSTANTS[44] = 0.15;
STATES[25] = 0.0971591072782679;
STATES[26] = -1.07543858779373e-32;
STATES[27] = 0.716604593002322;
CONSTANTS[45] = 0.00017;
CONSTANTS[46] = 0.75;
CONSTANTS[47] = 0.004375;
CONSTANTS[48] = 0.00092;
CONSTANTS[49] = 15;
STATES[28] = 4.14835141174613;
CONSTANTS[50] = 9.8443e-6;
CONSTANTS[51] = 7.0756e-6;
CONSTANTS[52] = 0.0005;
CONSTANTS[53] = 0.00238;
CONSTANTS[54] = 0.07;
CONSTANTS[55] = 0.05;
CONSTANTS[56] = 0.8;
CONSTANTS[57] = 10;
CONSTANTS[58] = 0.047;
CONSTANTS[59] = 0.00087;
CONSTANTS[60] = 1.124;
CONSTANTS[61] = 0.0087;
CONSTANTS[62] =  1000.00* 3.14159265358979*CONSTANTS[7]*CONSTANTS[7]*CONSTANTS[6];
CONSTANTS[63] =  CONSTANTS[18]* pow((CONSTANTS[1]/4.00000), 1.0 / 2);
CONSTANTS[64] = (exp(CONSTANTS[3]/67.3000) - 1.00000)/7.00000;
CONSTANTS[65] =  2.00000* 3.14159265358979*CONSTANTS[7]*CONSTANTS[7]+ 2.00000* 3.14159265358979*CONSTANTS[7]*CONSTANTS[6];
CONSTANTS[66] =  CONSTANTS[62]*0.260000;
CONSTANTS[67] =  CONSTANTS[62]*0.0600000;
CONSTANTS[68] =  CONSTANTS[65]*2.00000;
CONSTANTS[69] =  CONSTANTS[62]*0.680000;
CONSTANTS[70] =  CONSTANTS[62]*0.0552000;
CONSTANTS[71] =  CONSTANTS[62]*0.00480000;
CONSTANTS[72] =  CONSTANTS[62]*0.0200000;
CONSTANTS[73] = CONSTANTS[68]/CONSTANTS[0];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[10] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[11] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[16] = 0.1001;
RATES[17] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[22] = 0.1001;
RATES[26] = 0.1001;
RATES[27] = 0.1001;
RATES[25] = 0.1001;
RATES[18] = 0.1001;
RATES[23] = 0.1001;
RATES[19] = 0.1001;
RATES[12] = 0.1001;
RATES[4] = 0.1001;
RATES[28] = 0.1001;
RATES[24] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - (ALGEBRAIC[89]+ALGEBRAIC[90]+ALGEBRAIC[75]+ALGEBRAIC[91]);
resid[1] = RATES[1] -  ALGEBRAIC[3]*(1.00000 - STATES[1]) -  ALGEBRAIC[5]*STATES[1];
resid[2] = RATES[2] -  ALGEBRAIC[7]*(1.00000 - STATES[2]) -  ALGEBRAIC[8]*STATES[2];
resid[3] = RATES[3] -  ALGEBRAIC[4]*(1.00000 - STATES[3]) -  ALGEBRAIC[6]*STATES[3];
resid[4] = RATES[5] - (ALGEBRAIC[11] - STATES[5])/ALGEBRAIC[12];
resid[5] = RATES[6] - (ALGEBRAIC[17] - STATES[6])/CONSTANTS[16];
resid[6] = RATES[7] - (ALGEBRAIC[13] - STATES[7])/ALGEBRAIC[15];
resid[7] = RATES[10] - (ALGEBRAIC[14] - STATES[10])/ALGEBRAIC[16];
resid[8] = RATES[8] - (ALGEBRAIC[18] - STATES[8])/ALGEBRAIC[77];
resid[9] = RATES[9] - (ALGEBRAIC[19] - STATES[9])/ALGEBRAIC[20];
resid[10] = RATES[11] - (ALGEBRAIC[22] - STATES[11])/ALGEBRAIC[23];
resid[11] = RATES[13] - (ALGEBRAIC[25] - STATES[13])/ALGEBRAIC[26];
resid[12] = RATES[14] - ((ALGEBRAIC[25] - STATES[14])/ALGEBRAIC[26])/2.00000;
resid[13] = RATES[15] -  ALGEBRAIC[28]*(1.00000 - STATES[15]) -  ALGEBRAIC[29]*STATES[15];
resid[14] = RATES[16] -  ALGEBRAIC[30]*(1.00000 - STATES[16]) -  ALGEBRAIC[31]*STATES[16];
resid[15] = RATES[17] -  ALGEBRAIC[32]*(1.00000 - STATES[17]) -  ALGEBRAIC[33]*STATES[17];
resid[16] = RATES[20] - (ALGEBRAIC[46] - STATES[20])/1.00000;
resid[17] = RATES[21] -  ALGEBRAIC[48]*(1.00000 - STATES[21]) -  ALGEBRAIC[49]*STATES[21];
resid[18] = RATES[22] - (ALGEBRAIC[50] - STATES[22])/600.000;
resid[19] = RATES[26] - (ALGEBRAIC[61] - STATES[26])/3.00000;
resid[20] = RATES[27] - (ALGEBRAIC[62] - STATES[27])/ALGEBRAIC[63];
resid[21] = RATES[25] -  0.0500000*ALGEBRAIC[56]*(ALGEBRAIC[56] - STATES[25]) -  0.000680000*STATES[25];
resid[22] = RATES[18] - ( - ALGEBRAIC[89]*CONSTANTS[73])/CONSTANTS[69]+ALGEBRAIC[70];
resid[23] = RATES[23] - ( - ALGEBRAIC[90]*CONSTANTS[73])/CONSTANTS[69]+ALGEBRAIC[71];
resid[24] = RATES[19] - ( ALGEBRAIC[91]*CONSTANTS[73])/CONSTANTS[69]+ALGEBRAIC[70]+ALGEBRAIC[71];
resid[25] = RATES[12] -  ALGEBRAIC[73]*(( - ((ALGEBRAIC[44]+ALGEBRAIC[43]) -  2.00000*ALGEBRAIC[42])*CONSTANTS[73])/( CONSTANTS[69]*2.00000)+( (ALGEBRAIC[67] - ALGEBRAIC[66])*CONSTANTS[70])/CONSTANTS[69]+( ALGEBRAIC[68]*CONSTANTS[72])/CONSTANTS[69]);
resid[26] = RATES[4] -  ALGEBRAIC[74]*((( - ALGEBRAIC[10]*CONSTANTS[73])/( CONSTANTS[72]*2.00000)+( ALGEBRAIC[88]*CONSTANTS[71])/CONSTANTS[72]) - ALGEBRAIC[68]);
resid[27] = RATES[28] - (ALGEBRAIC[66] - ( ALGEBRAIC[69]*CONSTANTS[71])/CONSTANTS[70]) - ALGEBRAIC[67];
resid[28] = RATES[24] -  ALGEBRAIC[72]*(ALGEBRAIC[69] - ALGEBRAIC[88]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] = (CONDVAR[2]>=0.00000 ? 0.00000 :  0.135000*exp((80.0000+STATES[0])/- 6.80000));
ALGEBRAIC[4] = (CONDVAR[3]>=0.00000 ? 0.00000 : ( ( - 127140.*exp( 0.244400*STATES[0]) -  3.47400e-05*exp( - 0.0439100*STATES[0]))*1.00000*(STATES[0]+37.7800))/(1.00000+exp( 0.311000*(STATES[0]+79.2300))));
ALGEBRAIC[5] = (CONDVAR[4]>=0.00000 ? 1.00000/( 0.130000*(1.00000+exp((STATES[0]+10.6600)/- 11.1000))) :  3.56000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.350000*STATES[0]));
ALGEBRAIC[6] = (CONDVAR[5]>=0.00000 ? ( 0.300000*exp( - 2.53500e-07*STATES[0]))/(1.00000+exp( - 0.100000*(STATES[0]+32.0000))) : ( 0.121200*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400))));
ALGEBRAIC[7] = ( 0.320000*1.00000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300)));
ALGEBRAIC[8] =  0.0800000*exp(- STATES[0]/11.0000);
ALGEBRAIC[9] = ( CONSTANTS[13]*4.00000*(STATES[0] - 15.0000)*CONSTANTS[0]*CONSTANTS[5]*( CONSTANTS[14]*STATES[4]*exp( 2.00000*(STATES[0] - 15.0000)*CONSTANTS[5]) -  CONSTANTS[15]*CONSTANTS[2]))/(exp( 2.00000*(STATES[0] - 15.0000)*CONSTANTS[5]) - 1.00000);
ALGEBRAIC[10] =  pow(STATES[5], STATES[6])*STATES[7]*STATES[10]*STATES[8]*STATES[9]*ALGEBRAIC[9];
ALGEBRAIC[11] = 1.00000/(1.00000+exp(- (STATES[0] - 4.00000)/6.74000));
ALGEBRAIC[12] = 0.590000+( 0.800000*exp( 0.0520000*(STATES[0]+13.0000)))/(1.00000+exp( 0.132000*(STATES[0]+13.0000)));
ALGEBRAIC[13] = 0.700000/(1.00000+exp((STATES[0]+17.1200)/7.00000))+0.300000;
ALGEBRAIC[14] = 0.770000/(1.00000+exp((STATES[0]+17.1200)/7.00000))+0.230000;
ALGEBRAIC[15] = 1.00000/( 0.241100*exp(- pow( 0.0450000*(STATES[0] - 9.69140), 2.00000))+0.0529000);
ALGEBRAIC[16] = 1.00000/( 0.0423000*exp(- pow( 0.0590000*(STATES[0] - 18.5726), 2.00000))+0.00540000);
ALGEBRAIC[17] = 9.00000 - 8.00000/(1.00000+exp(- (STATES[0]+65.0000)/3.40000));
ALGEBRAIC[18] = 0.300000/(1.00000 - ALGEBRAIC[10]/0.0500000)+0.550000/(1.00000+STATES[4]/0.00300000)+0.150000;
ALGEBRAIC[19] = 1.00000/(1.00000 - ALGEBRAIC[10]/0.0100000);
ALGEBRAIC[20] = 300.000/(1.00000+exp((- ALGEBRAIC[10] - 0.175000)/0.0400000))+125.000;
ALGEBRAIC[22] = 1.00000/(1.00000+exp(- 2.18200 -  0.181900*STATES[0]));
ALGEBRAIC[23] = 43.0000+1.00000/(exp(- 5.49500+ 0.169100*STATES[0])+exp(- 7.67700 -  0.0128000*STATES[0]));
ALGEBRAIC[25] = 1.00000/(1.00000+exp(- (STATES[0] - 10.5000)/24.7000));
ALGEBRAIC[26] = 1.00000/(( 7.61000e-05*(STATES[0]+44.6000))/(1.00000 - exp( - 9.97000*(STATES[0]+44.6000)))+( 0.000360000*(STATES[0] - 0.550000))/(exp( 0.128000*(STATES[0] - 0.550000)) - 1.00000));
ALGEBRAIC[28] = ( 25.0000*exp((STATES[0] - 40.0000)/25.0000))/(1.00000+exp((STATES[0] - 40.0000)/25.0000));
ALGEBRAIC[29] = ( 25.0000*exp(- (STATES[0]+90.0000)/25.0000))/(1.00000+exp(- (STATES[0]+90.0000)/25.0000));
ALGEBRAIC[30] = 0.0300000/(1.00000+exp((STATES[0]+60.0000)/5.00000));
ALGEBRAIC[31] = ( 0.200000*exp((STATES[0]+25.0000)/5.00000))/(1.00000+exp((STATES[0]+25.0000)/5.00000));
ALGEBRAIC[32] = 0.00225000/(1.00000+exp((STATES[0]+60.0000)/5.00000));
ALGEBRAIC[33] = ( 0.100000*exp((STATES[0]+25.0000)/5.00000))/(1.00000+exp((STATES[0]+25.0000)/5.00000));
ALGEBRAIC[36] =  1.50000*STATES[12];
ALGEBRAIC[37] = 1.00000/(1.00000+pow(CONSTANTS[25]/ALGEBRAIC[36], 2.00000));
ALGEBRAIC[38] =  pow(STATES[18], 3.00000)*CONSTANTS[2]*exp( CONSTANTS[28]*STATES[0]*CONSTANTS[5]) -  pow(CONSTANTS[3], 3.00000)*ALGEBRAIC[36]*exp( (CONSTANTS[28] - 1.00000)*STATES[0]*CONSTANTS[5]);
ALGEBRAIC[39] = 1.00000+ CONSTANTS[27]*exp( (CONSTANTS[28] - 1.00000)*STATES[0]*CONSTANTS[5]);
ALGEBRAIC[40] =  CONSTANTS[32]*pow(STATES[18], 3.00000)+ pow(CONSTANTS[30], 3.00000)*ALGEBRAIC[36]+ pow(CONSTANTS[29], 3.00000)*CONSTANTS[2]*(1.00000+ALGEBRAIC[36]/CONSTANTS[31]);
ALGEBRAIC[41] =  CONSTANTS[31]*pow(CONSTANTS[3], 3.00000)*(1.00000+pow(STATES[18]/CONSTANTS[29], 3.00000))+ pow(STATES[18], 3.00000)*CONSTANTS[2]+ pow(CONSTANTS[3], 3.00000)*ALGEBRAIC[36];
ALGEBRAIC[42] = ( CONSTANTS[26]*ALGEBRAIC[37]*ALGEBRAIC[38])/( ALGEBRAIC[39]*(ALGEBRAIC[40]+ALGEBRAIC[41]));
ALGEBRAIC[43] = ( CONSTANTS[33]*STATES[12])/(CONSTANTS[34]+STATES[12]);
ALGEBRAIC[44] = ( CONSTANTS[35]*STATES[0]*CONSTANTS[0]*CONSTANTS[5]*( STATES[12]*exp( 2.00000*STATES[0]*CONSTANTS[5]) -  0.341000*CONSTANTS[2]))/(exp( 2.00000*STATES[0]*CONSTANTS[5]) - 1.00000);
ALGEBRAIC[46] = 1.00000/(1.00000+CONSTANTS[37]/STATES[4]);
ALGEBRAIC[48] = ( 0.320000*1.00000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300)));
ALGEBRAIC[49] =  0.0800000*exp(- STATES[0]/11.0000);
ALGEBRAIC[50] = 1.00000/(1.00000+exp((STATES[0]+91.0000)/6.10000));
ALGEBRAIC[55] = ( CONSTANTS[42]*(1.00000 - STATES[25]))/(1.00000+CONSTANTS[43]/STATES[4]);
ALGEBRAIC[56] = ALGEBRAIC[55]+STATES[25];
ALGEBRAIC[59] = pow(STATES[24], 1.90000)/(pow(STATES[24], 1.90000)+pow(( 49.2800*STATES[4])/(STATES[4]+0.00280000), 1.90000));
ALGEBRAIC[61] = ALGEBRAIC[59]/(pow(1.00000/ALGEBRAIC[10], 2.00000)+1.00000);
ALGEBRAIC[58] = 1.00000/(1.00000+exp((ALGEBRAIC[10]+0.0500000)/0.0150000));
ALGEBRAIC[62] = 1.00000/(1.00000+exp(((STATES[4] - 0.000400000)+ 0.00200000*ALGEBRAIC[58])/2.50000e-05));
ALGEBRAIC[60] = ( CONSTANTS[41]*ALGEBRAIC[56])/(CONSTANTS[44]+ALGEBRAIC[56]);
ALGEBRAIC[63] = 3.00000+ALGEBRAIC[60]+(350.000 - ALGEBRAIC[60])/(1.00000+exp(((STATES[4] - 0.00300000)+ 0.00300000*ALGEBRAIC[58])/0.000200000));
ALGEBRAIC[64] = ( CONSTANTS[45]*ALGEBRAIC[56])/(CONSTANTS[44]+ALGEBRAIC[56]);
ALGEBRAIC[65] = ( CONSTANTS[46]*ALGEBRAIC[56])/(CONSTANTS[44]+ALGEBRAIC[56]);
ALGEBRAIC[66] = ( (ALGEBRAIC[65]+1.00000)*CONSTANTS[47]*STATES[12])/((STATES[12]+CONSTANTS[48]) - ALGEBRAIC[64]);
ALGEBRAIC[67] = ( CONSTANTS[47]*STATES[28])/CONSTANTS[49];
ALGEBRAIC[68] = (STATES[4] - STATES[12])/0.200000;
ALGEBRAIC[69] = (STATES[28] - STATES[24])/120.000;
ALGEBRAIC[51] = log(CONSTANTS[3]/STATES[18])/CONSTANTS[5];
ALGEBRAIC[54] = - log(CONSTANTS[4]/STATES[19])/CONSTANTS[5];
ALGEBRAIC[70] = ( CONSTANTS[50]*pow(ALGEBRAIC[51] - ALGEBRAIC[54], 4.00000))/(pow(ALGEBRAIC[51] - ALGEBRAIC[54], 4.00000)+pow(87.8251, 4.00000));
ALGEBRAIC[52] = log(CONSTANTS[1]/STATES[23])/CONSTANTS[5];
ALGEBRAIC[71] = ( CONSTANTS[51]*(ALGEBRAIC[52] - ALGEBRAIC[54]))/((ALGEBRAIC[52] - ALGEBRAIC[54])+87.8251);
ALGEBRAIC[72] = 1.00000/(1.00000+( CONSTANTS[56]*CONSTANTS[57])/pow(STATES[24]+CONSTANTS[56], 2.00000));
ALGEBRAIC[73] = 1.00000/(1.00000+( CONSTANTS[55]*CONSTANTS[53])/pow(STATES[12]+CONSTANTS[53], 2.00000)+( CONSTANTS[52]*CONSTANTS[54])/pow(STATES[12]+CONSTANTS[52], 2.00000));
ALGEBRAIC[74] = 1.00000/(1.00000+( CONSTANTS[58]*CONSTANTS[59])/pow(CONSTANTS[59]+STATES[4], 2.00000)+( CONSTANTS[60]*CONSTANTS[61])/pow(CONSTANTS[61]+STATES[4], 2.00000));
ALGEBRAIC[75] = (ALGEBRAIC[10]+ALGEBRAIC[44]+ALGEBRAIC[43]) -  2.00000*ALGEBRAIC[42];
ALGEBRAIC[77] = ( 10.0000*ALGEBRAIC[56])/(0.150000+ALGEBRAIC[56])+1.00000/(1.00000+STATES[4]/0.00300000)+0.500000;
ALGEBRAIC[57] = 1.00000/(1.00000+exp((ALGEBRAIC[9]+13.0000)/5.00000));
ALGEBRAIC[87] =  3000.00*ALGEBRAIC[57];
ALGEBRAIC[88] =  ALGEBRAIC[87]*STATES[26]*STATES[27]*(STATES[24] - STATES[4]);
ALGEBRAIC[2] =  CONSTANTS[12]*STATES[2]*STATES[2]*STATES[2]*STATES[1]*STATES[3];
ALGEBRAIC[76] =  ALGEBRAIC[2]*(STATES[0] - ALGEBRAIC[51]);
ALGEBRAIC[34] = 1.00000/(1.00000+ 0.124500*exp( - 0.100000*STATES[0]*CONSTANTS[5])+ 0.0365000*CONSTANTS[64]*exp( - STATES[0]*CONSTANTS[5]));
ALGEBRAIC[35] = ( (( CONSTANTS[24]*ALGEBRAIC[34]*1.00000)/(1.00000+pow(CONSTANTS[22]/STATES[18], 2.00000)))*CONSTANTS[1])/(CONSTANTS[1]+CONSTANTS[23]);
ALGEBRAIC[86] =  CONSTANTS[39]*pow(STATES[21], 3.00000)*STATES[22]*(STATES[0] - ALGEBRAIC[51]);
ALGEBRAIC[89] = ALGEBRAIC[76]+ 3.00000*ALGEBRAIC[42]+ 3.00000*ALGEBRAIC[35]+ALGEBRAIC[86];
ALGEBRAIC[78] = 1.02000/(1.00000+exp( 0.238500*((STATES[0] - ALGEBRAIC[52]) - 59.2150)));
ALGEBRAIC[79] = ( 0.491240*exp( 0.0803200*((STATES[0] - ALGEBRAIC[52])+5.47600))+ 1.00000*exp( 0.0617500*((STATES[0] - ALGEBRAIC[52]) - 594.310)))/(1.00000+exp( - 0.514300*((STATES[0] - ALGEBRAIC[52])+4.75300)));
ALGEBRAIC[80] =  (( CONSTANTS[17]* pow((CONSTANTS[1]/4.00000), 1.0 / 2)*ALGEBRAIC[78])/(ALGEBRAIC[78]+ALGEBRAIC[79]))*(STATES[0] - ALGEBRAIC[52]);
ALGEBRAIC[84] = ( 0.00276000*(STATES[0] - ALGEBRAIC[52]))/(1.00000+exp((7.48800 - STATES[0])/5.98000));
ALGEBRAIC[24] =  CONSTANTS[19]*(1.00000+0.600000/(1.00000+pow(3.80000e-05/STATES[12], 1.40000)));
ALGEBRAIC[53] = log((CONSTANTS[1]+ CONSTANTS[40]*CONSTANTS[3])/(STATES[23]+ CONSTANTS[40]*STATES[18]))/CONSTANTS[5];
ALGEBRAIC[82] =  ALGEBRAIC[24]*STATES[13]*STATES[14]*(STATES[0] - ALGEBRAIC[53]);
ALGEBRAIC[21] = 1.00000/(1.00000+ 2.50000*exp( 0.100000*(STATES[0]+28.0000)));
ALGEBRAIC[81] =  CONSTANTS[63]*STATES[11]*ALGEBRAIC[21]*(STATES[0] - ALGEBRAIC[52]);
ALGEBRAIC[27] = (CONDVAR[6]<=0.00000 ? exp(STATES[0]/CONSTANTS[21]) : 1.00000);
ALGEBRAIC[83] =  CONSTANTS[20]*pow(STATES[15], 3.00000)*STATES[16]*STATES[17]*ALGEBRAIC[27]*(STATES[0] - ALGEBRAIC[52]);
ALGEBRAIC[0] =  floor(VOI/CONSTANTS[9])*CONSTANTS[9];
ALGEBRAIC[1] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? CONSTANTS[11] : 0.00000);
ALGEBRAIC[90] = ((ALGEBRAIC[81]+ALGEBRAIC[82]+ALGEBRAIC[80]+ALGEBRAIC[84]) -  2.00000*ALGEBRAIC[35])+ALGEBRAIC[83]+ 0.500000*ALGEBRAIC[1];
ALGEBRAIC[45] = ( CONSTANTS[36]*STATES[0]*CONSTANTS[0]*CONSTANTS[5]*(STATES[19] -  CONSTANTS[4]*exp( STATES[0]*CONSTANTS[5])))/(1.00000 - exp( STATES[0]*CONSTANTS[5]));
ALGEBRAIC[47] =  ALGEBRAIC[45]*STATES[20];
ALGEBRAIC[85] =  CONSTANTS[38]*(STATES[0] - ALGEBRAIC[54]);
ALGEBRAIC[91] = ALGEBRAIC[85]+ALGEBRAIC[47]+ 0.500000*ALGEBRAIC[1];
}
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[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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = (VOI - ALGEBRAIC[0]) - CONSTANTS[8];
CONDVAR[1] = (VOI - ALGEBRAIC[0]) - (CONSTANTS[8]+CONSTANTS[10]);
CONDVAR[2] = STATES[0] - - 40.0000;
CONDVAR[3] = STATES[0] - - 40.0000;
CONDVAR[4] = STATES[0] - - 40.0000;
CONDVAR[5] = STATES[0] - - 40.0000;
CONDVAR[6] = STATES[0] - 0.00000;
}