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 16 entries in the algebraic variable array.
   There are a total of 5 entries in each of the rate and state variable arrays.
   There are a total of 35 entries in the constant variable array.
 */
/*
 * VOI is time in component time_s (second).
 * ALGEBRAIC[9] is V in component Vm (mV).
 * ALGEBRAIC[0] is p1 in component Vm (mV_per_s).
 * ALGEBRAIC[1] is p2 in component Vm (mV).
 * ALGEBRAIC[2] is t0 in component Vm (second).
 * CONSTANTS[0] is tss in component Vm (second).
 * CONSTANTS[1] is Nai in component control_para (mM).
 * CONSTANTS[2] is inhPump in component control_para (dimensionless).
 * CONSTANTS[3] is K_Cahalf in component control_para (mV).
 * STATES[0] is Cai in component Cai (mM).
 * ALGEBRAIC[15] is J_VOCC in component J_VOCC (mM_per_s).
 * ALGEBRAIC[3] is J_CaPump in component J_CaPump (mM_per_s).
 * ALGEBRAIC[12] is J_NaCa in component J_NaCa (mM_per_s).
 * ALGEBRAIC[5] is stress in component CB4HM (dimensionless).
 * ALGEBRAIC[6] is phosphorylation in component CB4HM (dimensionless).
 * CONSTANTS[4] is R in component constants (J_per_K_mol).
 * CONSTANTS[5] is F in component constants (C_per_mmol).
 * CONSTANTS[6] is T in component model_para (kelvin).
 * CONSTANTS[7] is Nao in component model_para (mM).
 * CONSTANTS[8] is Cao in component model_para (mM).
 * CONSTANTS[9] is V_cell in component model_para (fm3).
 * CONSTANTS[10] is V_Cahalf in component model_para (mV).
 * CONSTANTS[11] is g_mCa in component model_para (nS).
 * CONSTANTS[12] is V_pmax in component model_para (mM_per_s).
 * CONSTANTS[13] is n in component model_para (dimensionless).
 * CONSTANTS[14] is K_ph in component model_para (mM).
 * CONSTANTS[15] is K_NaCa in component model_para (mM).
 * CONSTANTS[16] is G_NaCa in component model_para (mM_per_s_mV).
 * CONSTANTS[17] is Cai_init in component initials (mM).
 * CONSTANTS[18] is n_M in component model_para (dimensionless).
 * CONSTANTS[19] is Ca_halfMLCK in component model_para (mM).
 * CONSTANTS[20] is M_init in component initials (dimensionless).
 * CONSTANTS[21] is Mp_init in component initials (dimensionless).
 * CONSTANTS[22] is AM_init in component initials (dimensionless).
 * CONSTANTS[23] is AMp_init in component initials (dimensionless).
 * CONSTANTS[24] is K_7 in component model_para (per_s).
 * CONSTANTS[25] is K_2 in component model_para (per_s).
 * CONSTANTS[26] is K_3 in component model_para (per_s).
 * ALGEBRAIC[10] is rho_vCa in component J_VOCC (dimensionless).
 * CONSTANTS[27] is Nai in component model_para (mM).
 * CONSTANTS[28] is K_Cahalf in component model_para (mV).
 * CONSTANTS[29] is inhPump in component model_para (dimensionless).
 * CONSTANTS[30] is z_Ca in component E_Ca (dimensionless).
 * ALGEBRAIC[8] is E in component Nernst_potential (mV).
 * CONSTANTS[31] is z_Na in component E_Na (dimensionless).
 * CONSTANTS[32] is E in component Nernst_potential (mV).
 * ALGEBRAIC[14] is I in component Ionic_currents (pA).
 * ALGEBRAIC[11] is V_mNaCa in component J_NaCa (mV).
 * ALGEBRAIC[7] is K_1 in component K_1 (per_s).
 * CONSTANTS[33] is K_4 in component CB4HM (per_s).
 * CONSTANTS[34] is K_5 in component CB4HM (per_s).
 * ALGEBRAIC[13] is K_6 in component CB4HM (per_s).
 * ALGEBRAIC[4] is norm in component CB4HM (dimensionless).
 * STATES[1] is M in component CB4HM (dimensionless).
 * STATES[2] is Mp in component CB4HM (dimensionless).
 * STATES[3] is AM in component CB4HM (dimensionless).
 * STATES[4] is AMp in component CB4HM (dimensionless).
 * RATES[0] is d/dt Cai in component Cai (mM).
 * RATES[1] is d/dt M in component CB4HM (dimensionless).
 * RATES[2] is d/dt Mp in component CB4HM (dimensionless).
 * RATES[3] is d/dt AM in component CB4HM (dimensionless).
 * RATES[4] is d/dt AMp in component CB4HM (dimensionless).
 * There are a total of 69 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0;
CONSTANTS[1] = 2.9836;
CONSTANTS[2] = 1;
CONSTANTS[3] = 11;
CONSTANTS[4] = 8.314;
CONSTANTS[5] = 96.48534;
CONSTANTS[6] = 310;
CONSTANTS[7] = 140;
CONSTANTS[8] = 2;
CONSTANTS[9] = 21;
CONSTANTS[10] = -27;
CONSTANTS[11] = 0.046842;
CONSTANTS[12] = 5.1449e-4;
CONSTANTS[13] = 1.9015;
CONSTANTS[14] = 0.6e-3;
CONSTANTS[15] = 7e-3;
CONSTANTS[16] = 5.7297e-5;
CONSTANTS[17] = 0.1e-6;
CONSTANTS[18] = 8.7613;
CONSTANTS[19] = 256.98e-6;
CONSTANTS[20] = 1;
CONSTANTS[21] = 0;
CONSTANTS[22] = 0;
CONSTANTS[23] = 0;
CONSTANTS[24] = 0.0378;
CONSTANTS[25] = 1.2387;
CONSTANTS[26] = 0.1419;
CONSTANTS[27] = 2.9836;
CONSTANTS[28] = 11;
CONSTANTS[29] = 1;
CONSTANTS[30] = 2;
CONSTANTS[31] = 1;
CONSTANTS[32] =  (( CONSTANTS[4]*CONSTANTS[6])/( CONSTANTS[31]*CONSTANTS[5]))*log(CONSTANTS[7]/CONSTANTS[1]);
CONSTANTS[33] = CONSTANTS[26]/4.00000;
CONSTANTS[34] = CONSTANTS[25];
STATES[0] = CONSTANTS[17];
STATES[1] = CONSTANTS[20];
STATES[2] = CONSTANTS[21];
STATES[3] = CONSTANTS[22];
STATES[4] = CONSTANTS[23];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 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[15]+ CONSTANTS[2]*ALGEBRAIC[3]+ALGEBRAIC[12];
resid[1] = RATES[1] - ( - ALGEBRAIC[7]*STATES[1])/ALGEBRAIC[4]+( CONSTANTS[25]*STATES[2])/ALGEBRAIC[4]+( CONSTANTS[24]*STATES[3])/ALGEBRAIC[4];
resid[2] = RATES[2] - (( CONSTANTS[33]*STATES[4])/ALGEBRAIC[4]+( ALGEBRAIC[7]*STATES[1])/ALGEBRAIC[4]) - ( (CONSTANTS[25]+CONSTANTS[26])*STATES[2])/ALGEBRAIC[4];
resid[3] = RATES[3] - ( CONSTANTS[34]*STATES[4])/ALGEBRAIC[4] - ( (ALGEBRAIC[13]+CONSTANTS[24])*STATES[3])/ALGEBRAIC[4];
resid[4] = RATES[4] - (( CONSTANTS[26]*STATES[2])/ALGEBRAIC[4]+( ALGEBRAIC[13]*STATES[3])/ALGEBRAIC[4]) - ( (CONSTANTS[33]+CONSTANTS[34])*STATES[4])/ALGEBRAIC[4];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[5] = STATES[4]+STATES[3];
ALGEBRAIC[6] = STATES[4]+STATES[2];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] = ( - CONSTANTS[12]*pow(STATES[0], CONSTANTS[13]))/(pow(CONSTANTS[14], CONSTANTS[13])+pow(STATES[0], CONSTANTS[13]));
ALGEBRAIC[4] = STATES[1]+STATES[2]+STATES[3]+STATES[4];
ALGEBRAIC[7] =  (pow(STATES[0], CONSTANTS[18])/(pow(CONSTANTS[19], CONSTANTS[18])+pow(STATES[0], CONSTANTS[18])))*1.00000;
ALGEBRAIC[0] = (CONDVAR[0]<0.00000 ? 0.00000 : CONDVAR[1]>=0.00000&&CONDVAR[2]<0.00000 ? 0.250800 : CONDVAR[3]>=0.00000&&CONDVAR[4]<0.00000 ? - 4.29660 : CONDVAR[5]>=0.00000&&CONDVAR[6]<0.00000 ? 3.62830 : CONDVAR[7]>=0.00000&&CONDVAR[8]<0.00000 ? 6.71270 : CONDVAR[9]>=0.00000&&CONDVAR[10]<0.00000 ? 3.61510 : CONDVAR[11]>=0.00000&&CONDVAR[12]<0.00000 ? - 6.84810 : CONDVAR[13]>=0.00000&&CONDVAR[14]<0.00000 ? - 0.0369000 : CONDVAR[15]>=0.00000&&CONDVAR[16]<0.00000 ? - 66.1632 : CONDVAR[17]>=0.00000&&CONDVAR[18]<0.00000 ? - 1.44560 : CONDVAR[19]>=0.00000&&CONDVAR[20]<0.00000 ? - 0.155700 : CONDVAR[21]>=0.00000&&CONDVAR[22]<0.00000 ? - 0.0623000 : 0.00000);
ALGEBRAIC[1] = (CONDVAR[23]<0.00000 ? - 63.0930 : CONDVAR[24]>=0.00000&&CONDVAR[25]<0.00000 ? - 63.0930 : CONDVAR[26]>=0.00000&&CONDVAR[27]<0.00000 ? - 60.7620 : CONDVAR[28]>=0.00000&&CONDVAR[29]<0.00000 ? - 65.2270 : CONDVAR[30]>=0.00000&&CONDVAR[31]<0.00000 ? - 60.7870 : CONDVAR[32]>=0.00000&&CONDVAR[33]<0.00000 ? - 18.5270 : CONDVAR[34]>=0.00000&&CONDVAR[35]<0.00000 ? - 13.2450 : CONDVAR[36]>=0.00000&&CONDVAR[37]<0.00000 ? - 27.7300 : CONDVAR[38]>=0.00000&&CONDVAR[39]<0.00000 ? - 28.9850 : CONDVAR[40]>=0.00000&&CONDVAR[41]<0.00000 ? - 49.5750 : CONDVAR[42]>=0.00000&&CONDVAR[43]<0.00000 ? - 58.3060 : CONDVAR[44]>=0.00000&&CONDVAR[45]<0.00000 ? - 61.4480 : - 63.4110);
ALGEBRAIC[2] = (CONDVAR[46]<0.00000 ? 0.00000 : CONDVAR[47]>=0.00000&&CONDVAR[48]<0.00000 ? 0.474200 : CONDVAR[49]>=0.00000&&CONDVAR[50]<0.00000 ? 9.76840 : CONDVAR[51]>=0.00000&&CONDVAR[52]<0.00000 ? 10.8076 : CONDVAR[53]>=0.00000&&CONDVAR[54]<0.00000 ? 12.0313 : CONDVAR[55]>=0.00000&&CONDVAR[56]<0.00000 ? 18.3268 : CONDVAR[57]>=0.00000&&CONDVAR[58]<0.00000 ? 19.7879 : CONDVAR[59]>=0.00000&&CONDVAR[60]<0.00000 ? 21.9031 : CONDVAR[61]>=0.00000&&CONDVAR[62]<0.00000 ? 55.9040 : CONDVAR[63]>=0.00000&&CONDVAR[64]<0.00000 ? 56.2151 : CONDVAR[65]>=0.00000&&CONDVAR[66]<0.00000 ? 62.2548 : CONDVAR[67]>=0.00000&&CONDVAR[68]<0.00000 ? 82.4299 : 0.00000);
ALGEBRAIC[9] =  ALGEBRAIC[0]*((VOI - ALGEBRAIC[2]) - CONSTANTS[0])+ALGEBRAIC[1];
ALGEBRAIC[8] =  (( CONSTANTS[4]*CONSTANTS[6])/( CONSTANTS[30]*CONSTANTS[5]))*log(CONSTANTS[8]/STATES[0]);
ALGEBRAIC[11] =  3.00000*CONSTANTS[32] -  2.00000*ALGEBRAIC[8];
ALGEBRAIC[12] =  (( CONSTANTS[16]*STATES[0])/(STATES[0]+CONSTANTS[15]))*(ALGEBRAIC[9] - ALGEBRAIC[11]);
ALGEBRAIC[13] = ALGEBRAIC[7];
ALGEBRAIC[10] = 1.00000/(1.00000+exp((CONSTANTS[10] - ALGEBRAIC[9])/CONSTANTS[3]));
ALGEBRAIC[14] =  CONSTANTS[11]*ALGEBRAIC[10]*(ALGEBRAIC[9] - ALGEBRAIC[8]);
ALGEBRAIC[15] = - ALGEBRAIC[14]/( 2.00000*CONSTANTS[9]*CONSTANTS[5]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = (VOI - CONSTANTS[0]) - 0.474200;
CONDVAR[1] = (VOI - CONSTANTS[0]) - 0.474200;
CONDVAR[2] = (VOI - CONSTANTS[0]) - 9.76840;
CONDVAR[3] = (VOI - CONSTANTS[0]) - 9.76840;
CONDVAR[4] = (VOI - CONSTANTS[0]) - 10.8076;
CONDVAR[5] = (VOI - CONSTANTS[0]) - 10.8076;
CONDVAR[6] = (VOI - CONSTANTS[0]) - 12.0313;
CONDVAR[7] = (VOI - CONSTANTS[0]) - 12.0313;
CONDVAR[8] = (VOI - CONSTANTS[0]) - 18.3268;
CONDVAR[9] = (VOI - CONSTANTS[0]) - 18.3268;
CONDVAR[10] = (VOI - CONSTANTS[0]) - 19.7879;
CONDVAR[11] = (VOI - CONSTANTS[0]) - 19.7879;
CONDVAR[12] = (VOI - CONSTANTS[0]) - 21.9031;
CONDVAR[13] = (VOI - CONSTANTS[0]) - 21.9031;
CONDVAR[14] = (VOI - CONSTANTS[0]) - 55.9040;
CONDVAR[15] = (VOI - CONSTANTS[0]) - 55.9040;
CONDVAR[16] = (VOI - CONSTANTS[0]) - 56.2152;
CONDVAR[17] = (VOI - CONSTANTS[0]) - 56.2152;
CONDVAR[18] = (VOI - CONSTANTS[0]) - 62.2548;
CONDVAR[19] = (VOI - CONSTANTS[0]) - 62.2548;
CONDVAR[20] = (VOI - CONSTANTS[0]) - 82.4301;
CONDVAR[21] = (VOI - CONSTANTS[0]) - 82.4301;
CONDVAR[22] = (VOI - CONSTANTS[0]) - 113.961;
CONDVAR[23] = (VOI - CONSTANTS[0]) - 0.474200;
CONDVAR[24] = (VOI - CONSTANTS[0]) - 0.474200;
CONDVAR[25] = (VOI - CONSTANTS[0]) - 9.76840;
CONDVAR[26] = (VOI - CONSTANTS[0]) - 9.76840;
CONDVAR[27] = (VOI - CONSTANTS[0]) - 10.8076;
CONDVAR[28] = (VOI - CONSTANTS[0]) - 10.8076;
CONDVAR[29] = (VOI - CONSTANTS[0]) - 12.0313;
CONDVAR[30] = (VOI - CONSTANTS[0]) - 12.0313;
CONDVAR[31] = (VOI - CONSTANTS[0]) - 18.3268;
CONDVAR[32] = (VOI - CONSTANTS[0]) - 18.3268;
CONDVAR[33] = (VOI - CONSTANTS[0]) - 19.7879;
CONDVAR[34] = (VOI - CONSTANTS[0]) - 19.7879;
CONDVAR[35] = (VOI - CONSTANTS[0]) - 21.9031;
CONDVAR[36] = (VOI - CONSTANTS[0]) - 21.9031;
CONDVAR[37] = (VOI - CONSTANTS[0]) - 55.9040;
CONDVAR[38] = (VOI - CONSTANTS[0]) - 55.9040;
CONDVAR[39] = (VOI - CONSTANTS[0]) - 56.2152;
CONDVAR[40] = (VOI - CONSTANTS[0]) - 56.2152;
CONDVAR[41] = (VOI - CONSTANTS[0]) - 62.2548;
CONDVAR[42] = (VOI - CONSTANTS[0]) - 62.2548;
CONDVAR[43] = (VOI - CONSTANTS[0]) - 82.4301;
CONDVAR[44] = (VOI - CONSTANTS[0]) - 82.4301;
CONDVAR[45] = (VOI - CONSTANTS[0]) - 113.961;
CONDVAR[46] = (VOI - CONSTANTS[0]) - 0.474200;
CONDVAR[47] = (VOI - CONSTANTS[0]) - 0.474200;
CONDVAR[48] = (VOI - CONSTANTS[0]) - 9.76840;
CONDVAR[49] = (VOI - CONSTANTS[0]) - 9.76840;
CONDVAR[50] = (VOI - CONSTANTS[0]) - 10.8076;
CONDVAR[51] = (VOI - CONSTANTS[0]) - 10.8076;
CONDVAR[52] = (VOI - CONSTANTS[0]) - 12.0313;
CONDVAR[53] = (VOI - CONSTANTS[0]) - 12.0313;
CONDVAR[54] = (VOI - CONSTANTS[0]) - 18.3268;
CONDVAR[55] = (VOI - CONSTANTS[0]) - 18.3268;
CONDVAR[56] = (VOI - CONSTANTS[0]) - 19.7879;
CONDVAR[57] = (VOI - CONSTANTS[0]) - 19.7879;
CONDVAR[58] = (VOI - CONSTANTS[0]) - 21.9031;
CONDVAR[59] = (VOI - CONSTANTS[0]) - 21.9031;
CONDVAR[60] = (VOI - CONSTANTS[0]) - 55.9040;
CONDVAR[61] = (VOI - CONSTANTS[0]) - 55.9040;
CONDVAR[62] = (VOI - CONSTANTS[0]) - 56.2151;
CONDVAR[63] = (VOI - CONSTANTS[0]) - 56.2151;
CONDVAR[64] = (VOI - CONSTANTS[0]) - 62.2548;
CONDVAR[65] = (VOI - CONSTANTS[0]) - 62.2548;
CONDVAR[66] = (VOI - CONSTANTS[0]) - 82.4301;
CONDVAR[67] = (VOI - CONSTANTS[0]) - 82.4301;
CONDVAR[68] = (VOI - CONSTANTS[0]) - 113.961;
}