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 69 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).
 * CONSTANTS[6] is tissue in component Environment (dimensionless).
 * 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[7] is l in component cell (cm).
 * CONSTANTS[8] is a in component cell (cm).
 * CONSTANTS[56] is vcell in component cell (uL).
 * CONSTANTS[60] is ageo in component cell (cm2).
 * CONSTANTS[63] is Acap in component cell (uF).
 * CONSTANTS[64] is vmyo in component cell (uL).
 * CONSTANTS[61] is vmito in component cell (uL).
 * CONSTANTS[62] is vsr in component cell (uL).
 * CONSTANTS[65] is vnsr in component cell (uL).
 * CONSTANTS[66] is vjsr in component cell (uL).
 * CONSTANTS[67] is vss in component cell (uL).
 * CONSTANTS[68] is AF in component cell (uF_mole_per_C).
 * CONSTANTS[9] is stim_offset in component cell (ms).
 * CONSTANTS[10] is stim_period in component cell (ms).
 * CONSTANTS[11] is stim_duration in component cell (ms).
 * CONSTANTS[12] 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[57] 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).
 * ALGEBRAIC[52] is EK in component reversal_potentials (mV).
 * ALGEBRAIC[78] is ak1 in component IK1 (per_ms).
 * ALGEBRAIC[79] is bk1 in component IK1 (per_ms).
 * CONSTANTS[58] 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).
 * 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[16] 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).
 * STATES[18] is Na_i in component Na (mM).
 * CONSTANTS[17] is kmnai in component INaK (mM).
 * CONSTANTS[18] is kmko in component INaK (mM).
 * CONSTANTS[19] is ibarnak in component INaK (uA_per_uF).
 * CONSTANTS[59] 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[20] is KmCa in component INaCa (mM).
 * ALGEBRAIC[37] is allo in component INaCa (dimensionless).
 * CONSTANTS[21] is NCXmax in component INaCa (uA_per_uF).
 * CONSTANTS[22] is ksat in component INaCa (dimensionless).
 * CONSTANTS[23] is eta in component INaCa (dimensionless).
 * CONSTANTS[24] is KmNai in component INaCa (mM).
 * CONSTANTS[25] is KmNao in component INaCa (mM).
 * CONSTANTS[26] is KmCai in component INaCa (mM).
 * CONSTANTS[27] 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[28] is ibarpca in component IpCa (uA_per_uF).
 * CONSTANTS[29] is kmpca in component IpCa (mM).
 * STATES[19] is Cl_i in component Cl (mM).
 * CONSTANTS[30] 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[31] is Kmto2 in component Ito2 (mM).
 * ALGEBRAIC[54] is ECl in component reversal_potentials (mV).
 * CONSTANTS[32] is GClb in component IClb (mS_per_uF).
 * CONSTANTS[33] 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[34] 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[35] 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[36] is CaMK0 in component Irel (dimensionless).
 * CONSTANTS[37] is Km in component Irel (mM).
 * CONSTANTS[38] 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[39] is dKmPLBmax in component Iup_Ileak (mM).
 * CONSTANTS[40] 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[41] is iupmax in component Iup_Ileak (mM_per_ms).
 * CONSTANTS[42] is Kmup in component Iup_Ileak (mM).
 * CONSTANTS[43] 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[44] is CTNaClmax in component Na (mM_per_ms).
 * ALGEBRAIC[71] is CTKCl in component K (mM_per_ms).
 * CONSTANTS[45] is CTKClmax in component K (mM_per_ms).
 * CONSTANTS[46] is kmt in component Ca (mM).
 * CONSTANTS[47] is kmc in component Ca (mM).
 * CONSTANTS[48] is tbar in component Ca (mM).
 * CONSTANTS[49] is cbar in component Ca (mM).
 * CONSTANTS[50] is kmcsqn in component Ca (mM).
 * CONSTANTS[51] is csqnbar in component Ca (mM).
 * ALGEBRAIC[72] is bcsqn in component Ca (dimensionless).
 * ALGEBRAIC[73] is bmyo in component Ca (dimensionless).
 * CONSTANTS[52] is BSRmax in component Ca (mM).
 * CONSTANTS[53] is KmBSR in component Ca (mM).
 * CONSTANTS[54] is BSLmax in component Ca (mM).
 * CONSTANTS[55] 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 6 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 96485;
CONSTANTS[1] = 5.4;
CONSTANTS[2] = 1.8;
CONSTANTS[3] = 140;
CONSTANTS[4] = 100;
CONSTANTS[5] = 0.0374358835078;
CONSTANTS[6] = 0;
STATES[0] = -85.781844107117;
CONSTANTS[7] = 0.01;
CONSTANTS[8] = 0.0011;
CONSTANTS[9] = 0;
CONSTANTS[10] = 1e3;
CONSTANTS[11] = 3;
CONSTANTS[12] = -20;
STATES[1] = 0.987317750543;
STATES[2] = 0.001356538159;
STATES[3] = 0.991924983076;
STATES[4] = 0.00012271265;
STATES[5] = 0.00000164013;
STATES[6] = 8.98230672628;
STATES[7] = 0.999961508634;
STATES[8] = 0.97836624923;
STATES[9] = 0.893052931249;
STATES[10] = 0.992234519148;
CONSTANTS[13] = 2.43e-4;
CONSTANTS[14] = 1;
CONSTANTS[15] = 0.341;
STATES[11] = 0.00000724074;
STATES[12] = 0.00012131666;
STATES[13] = 0.019883138161;
STATES[14] = 0.019890650554;
CONSTANTS[16] = 0.095;
STATES[15] = 0.013970786703;
STATES[16] = 0.99996472752;
STATES[17] = 0.829206149767;
STATES[18] = 12.972433387269;
CONSTANTS[17] = 10;
CONSTANTS[18] = 1.5;
CONSTANTS[19] = 0.61875;
CONSTANTS[20] = 1.25e-4;
CONSTANTS[21] = 4.05;
CONSTANTS[22] = 0.27;
CONSTANTS[23] = 0.35;
CONSTANTS[24] = 12.3;
CONSTANTS[25] = 87.5;
CONSTANTS[26] = 0.0036;
CONSTANTS[27] = 1.3;
CONSTANTS[28] = 0.0575;
CONSTANTS[29] = 0.5e-3;
STATES[19] = 15.59207157178;
CONSTANTS[30] = 4e-7;
STATES[20] = 0.000816605172;
CONSTANTS[31] = 0.1502;
CONSTANTS[32] = 2.25e-4;
CONSTANTS[33] = 65e-4;
STATES[21] = 0.001356538159;
STATES[22] = 0.26130711759;
STATES[23] = 135.469546216758;
CONSTANTS[34] = 0.01833;
STATES[24] = 1.737580994071;
CONSTANTS[35] = 10;
CONSTANTS[36] = 0.05;
CONSTANTS[37] = 0.0015;
CONSTANTS[38] = 0.15;
STATES[25] = 0.021123704774;
STATES[26] = 0;
STATES[27] = 0.862666650318;
CONSTANTS[39] = 0.00017;
CONSTANTS[40] = 0.75;
CONSTANTS[41] = 0.004375;
CONSTANTS[42] = 0.00092;
CONSTANTS[43] = 15;
STATES[28] = 1.832822335168;
CONSTANTS[44] = 9.8443e-6;
CONSTANTS[45] = 7.0756e-6;
CONSTANTS[46] = 0.5e-3;
CONSTANTS[47] = 2.38e-3;
CONSTANTS[48] = 70e-3;
CONSTANTS[49] = 50e-3;
CONSTANTS[50] = 0.8;
CONSTANTS[51] = 10;
CONSTANTS[52] = 0.047;
CONSTANTS[53] = 0.00087;
CONSTANTS[54] = 1.124;
CONSTANTS[55] = 0.0087;
CONSTANTS[56] =  1000.00* 3.14159265358979*CONSTANTS[8]*CONSTANTS[8]*CONSTANTS[7];
CONSTANTS[57] = (CONSTANTS[6]==0.00000 ? 11.5000 :  4.00000*11.5000);
CONSTANTS[58] =  0.0138542* pow((CONSTANTS[1]/5.40000), 1.0 / 2);
CONSTANTS[59] = (exp(CONSTANTS[3]/67.3000) - 1.00000)/7.00000;
CONSTANTS[60] =  2.00000* 3.14159265358979*CONSTANTS[8]*CONSTANTS[8]+ 2.00000* 3.14159265358979*CONSTANTS[8]*CONSTANTS[7];
CONSTANTS[61] =  CONSTANTS[56]*0.260000;
CONSTANTS[62] =  CONSTANTS[56]*0.0600000;
CONSTANTS[63] =  CONSTANTS[60]*2.00000;
CONSTANTS[64] =  CONSTANTS[56]*0.680000;
CONSTANTS[65] =  CONSTANTS[56]*0.0552000;
CONSTANTS[66] =  CONSTANTS[56]*0.00480000;
CONSTANTS[67] =  CONSTANTS[56]*0.0200000;
CONSTANTS[68] = CONSTANTS[63]/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])/10.0000;
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[68])/CONSTANTS[64]+ALGEBRAIC[70];
resid[23] = RATES[23] - ( - ALGEBRAIC[90]*CONSTANTS[68])/CONSTANTS[64]+ALGEBRAIC[71];
resid[24] = RATES[19] - ( ALGEBRAIC[91]*CONSTANTS[68])/CONSTANTS[64]+ALGEBRAIC[70]+ALGEBRAIC[71];
resid[25] = RATES[12] -  ALGEBRAIC[73]*(( - ((ALGEBRAIC[44]+ALGEBRAIC[43]) -  2.00000*ALGEBRAIC[42])*CONSTANTS[68])/( CONSTANTS[64]*2.00000)+( (ALGEBRAIC[67] - ALGEBRAIC[66])*CONSTANTS[65])/CONSTANTS[64]+( ALGEBRAIC[68]*CONSTANTS[67])/CONSTANTS[64]);
resid[26] = RATES[4] -  ALGEBRAIC[74]*((( - ALGEBRAIC[10]*CONSTANTS[68])/( CONSTANTS[67]*2.00000)+( ALGEBRAIC[88]*CONSTANTS[66])/CONSTANTS[67]) - ALGEBRAIC[68]);
resid[27] = RATES[28] - (ALGEBRAIC[66] - ( ALGEBRAIC[69]*CONSTANTS[66])/CONSTANTS[65]) - 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] = (CONSTANTS[6]==0.00000 ?  pow(STATES[5], STATES[6])*STATES[7]*STATES[10]*STATES[8]*STATES[9]*ALGEBRAIC[9] :  STATES[5]*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(- (STATES[0]+10.0850)/4.25000));
ALGEBRAIC[23] = 1.00000/(( 0.000600000*(STATES[0] - 1.73840))/(1.00000 - exp( - 0.136000*(STATES[0] - 1.73840)))+( 0.000300000*(STATES[0]+38.3608))/(exp( 0.152200*(STATES[0]+38.3608)) - 1.00000));
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.00260000/(1.00000+exp((STATES[0]+61.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[20]/ALGEBRAIC[36], 2.00000));
ALGEBRAIC[38] =  pow(STATES[18], 3.00000)*CONSTANTS[2]*exp( CONSTANTS[23]*STATES[0]*CONSTANTS[5]) -  pow(CONSTANTS[3], 3.00000)*ALGEBRAIC[36]*exp( (CONSTANTS[23] - 1.00000)*STATES[0]*CONSTANTS[5]);
ALGEBRAIC[39] = 1.00000+ CONSTANTS[22]*exp( (CONSTANTS[23] - 1.00000)*STATES[0]*CONSTANTS[5]);
ALGEBRAIC[40] =  CONSTANTS[27]*pow(STATES[18], 3.00000)+ pow(CONSTANTS[25], 3.00000)*ALGEBRAIC[36]+ pow(CONSTANTS[24], 3.00000)*CONSTANTS[2]*(1.00000+ALGEBRAIC[36]/CONSTANTS[26]);
ALGEBRAIC[41] =  CONSTANTS[26]*pow(CONSTANTS[3], 3.00000)*(1.00000+pow(STATES[18]/CONSTANTS[24], 3.00000))+ pow(STATES[18], 3.00000)*CONSTANTS[2]+ pow(CONSTANTS[3], 3.00000)*ALGEBRAIC[36];
ALGEBRAIC[42] = ( CONSTANTS[21]*ALGEBRAIC[37]*ALGEBRAIC[38])/( ALGEBRAIC[39]*(ALGEBRAIC[40]+ALGEBRAIC[41]));
ALGEBRAIC[43] = ( CONSTANTS[28]*STATES[12])/(CONSTANTS[29]+STATES[12]);
ALGEBRAIC[44] = ( 1.99508e-07*4.00000*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[31]/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[36]*(1.00000 - STATES[25]))/(1.00000+CONSTANTS[37]/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[35]*ALGEBRAIC[56])/(CONSTANTS[38]+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[39]*ALGEBRAIC[56])/(CONSTANTS[38]+ALGEBRAIC[56]);
ALGEBRAIC[65] = ( CONSTANTS[40]*ALGEBRAIC[56])/(CONSTANTS[38]+ALGEBRAIC[56]);
ALGEBRAIC[66] = ( (ALGEBRAIC[65]+1.00000)*CONSTANTS[41]*STATES[12])/((STATES[12]+CONSTANTS[42]) - ALGEBRAIC[64]);
ALGEBRAIC[67] = ( CONSTANTS[41]*STATES[28])/CONSTANTS[43];
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[44]*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[45]*(ALGEBRAIC[52] - ALGEBRAIC[54]))/((ALGEBRAIC[52] - ALGEBRAIC[54])+87.8251);
ALGEBRAIC[72] = 1.00000/(1.00000+( CONSTANTS[50]*CONSTANTS[51])/pow(STATES[24]+CONSTANTS[50], 2.00000));
ALGEBRAIC[73] = 1.00000/(1.00000+( CONSTANTS[49]*CONSTANTS[47])/pow(STATES[12]+CONSTANTS[47], 2.00000)+( CONSTANTS[46]*CONSTANTS[48])/pow(STATES[12]+CONSTANTS[46], 2.00000));
ALGEBRAIC[74] = 1.00000/(1.00000+( CONSTANTS[52]*CONSTANTS[53])/pow(CONSTANTS[53]+STATES[4], 2.00000)+( CONSTANTS[54]*CONSTANTS[55])/pow(CONSTANTS[55]+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] = (CONSTANTS[6]==0.00000 ? 1.00000/(1.00000+exp((ALGEBRAIC[9]+13.0000)/5.00000)) : 1.00000);
ALGEBRAIC[87] =  3000.00*ALGEBRAIC[57];
ALGEBRAIC[88] =  ALGEBRAIC[87]*STATES[26]*STATES[27]*(STATES[24] - STATES[4]);
ALGEBRAIC[2] =  CONSTANTS[57]*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[59]*exp( - STATES[0]*CONSTANTS[5]));
ALGEBRAIC[35] = ( (( CONSTANTS[19]*ALGEBRAIC[34]*1.00000)/(1.00000+pow(CONSTANTS[17]/STATES[18], 2.00000)))*CONSTANTS[1])/(CONSTANTS[1]+CONSTANTS[18]);
ALGEBRAIC[86] =  CONSTANTS[33]*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] =  (( 0.500000* pow((CONSTANTS[1]/5.40000), 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] =  0.0224077*(1.00000+0.600000/(1.00000+pow(3.80000e-05/STATES[12], 1.40000)));
ALGEBRAIC[53] = log((CONSTANTS[1]+ CONSTANTS[34]*CONSTANTS[3])/(STATES[23]+ CONSTANTS[34]*STATES[18]))/CONSTANTS[5];
ALGEBRAIC[82] =  ALGEBRAIC[24]*STATES[13]*STATES[14]*(STATES[0] - ALGEBRAIC[53]);
ALGEBRAIC[21] = 1.00000/(1.00000+exp((STATES[0]+10.0000)/15.4000));
ALGEBRAIC[81] =  CONSTANTS[58]*STATES[11]*ALGEBRAIC[21]*(STATES[0] - ALGEBRAIC[52]);
ALGEBRAIC[27] = exp(STATES[0]/300.000);
ALGEBRAIC[83] =  CONSTANTS[16]*pow(STATES[15], 3.00000)*STATES[16]*STATES[17]*ALGEBRAIC[27]*(STATES[0] - ALGEBRAIC[52]);
ALGEBRAIC[0] =  floor(VOI/CONSTANTS[10])*CONSTANTS[10];
ALGEBRAIC[1] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? CONSTANTS[12] : 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[30]*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[32]*(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[9];
CONDVAR[1] = (VOI - ALGEBRAIC[0]) - (CONSTANTS[9]+CONSTANTS[11]);
CONDVAR[2] = STATES[0] - - 40.0000;
CONDVAR[3] = STATES[0] - - 40.0000;
CONDVAR[4] = STATES[0] - - 40.0000;
CONDVAR[5] = STATES[0] - - 40.0000;
}