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 11 entries in the algebraic variable array.
   There are a total of 4 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[0] is Cai in component Cai (mM).
 * CONSTANTS[0] is V in component control_para (mV).
 * CONSTANTS[1] is M_init in component control_para (dimensionless).
 * CONSTANTS[2] is Mp_init in component control_para (dimensionless).
 * ALGEBRAIC[8] is J_VOCC in component J_VOCC (mM_per_s).
 * ALGEBRAIC[1] is J_CaPump in component J_CaPump (mM_per_s).
 * ALGEBRAIC[10] is J_NaCa in component J_NaCa (mM_per_s).
 * CONSTANTS[33] is rho_vCa in component J_VOCC (dimensionless).
 * ALGEBRAIC[5] is K_1 in component K_1 (per_s).
 * ALGEBRAIC[3] is stress in component CB4HM (dimensionless).
 * ALGEBRAIC[4] is phosphorylation in component CB4HM (dimensionless).
 * CONSTANTS[3] is R in component constants (J_per_K_mol).
 * CONSTANTS[4] is F in component constants (C_per_mmol).
 * CONSTANTS[5] is T in component model_para (kelvin).
 * CONSTANTS[6] is Nai in component model_para (mM).
 * 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 K_Cahalf in component model_para (mV).
 * CONSTANTS[12] is g_mCa in component model_para (nS).
 * CONSTANTS[13] is V_pmax in component model_para (mM_per_s).
 * CONSTANTS[14] is n in component model_para (dimensionless).
 * CONSTANTS[15] is K_ph in component model_para (mM).
 * CONSTANTS[16] is K_NaCa in component model_para (mM).
 * CONSTANTS[17] is G_NaCa in component model_para (mM_per_s_mV).
 * CONSTANTS[18] is n_M in component model_para (dimensionless).
 * CONSTANTS[19] is Ca_halfMLCK in component model_para (mM).
 * CONSTANTS[20] is inhPump in component model_para (dimensionless).
 * CONSTANTS[21] is AM_init in component initials (dimensionless).
 * CONSTANTS[22] is AMp_init in component initials (dimensionless).
 * CONSTANTS[23] is K_7 in component model_para (per_s).
 * CONSTANTS[24] is K_2 in component model_para (per_s).
 * CONSTANTS[25] is K_3 in component model_para (per_s).
 * CONSTANTS[26] is K_4 in component model_para (per_s).
 * CONSTANTS[27] is K_5 in component model_para (per_s).
 * CONSTANTS[28] is M_init in component initials (dimensionless).
 * CONSTANTS[29] is Mp_init in component initials (dimensionless).
 * CONSTANTS[30] is Cai_init in component initials (mM).
 * CONSTANTS[31] is z_Ca in component E_Ca (dimensionless).
 * ALGEBRAIC[6] is E in component Nernst_potential (mV).
 * CONSTANTS[32] is z_Na in component E_Na (dimensionless).
 * CONSTANTS[34] is E in component Nernst_potential (mV).
 * ALGEBRAIC[7] is I in component Ionic_currents (pA).
 * ALGEBRAIC[9] is V_mNaCa in component J_NaCa (mV).
 * ALGEBRAIC[2] is norm in component CB4HM (dimensionless).
 * STATES[0] is M in component CB4HM (dimensionless).
 * STATES[1] is Mp in component CB4HM (dimensionless).
 * STATES[2] is AM in component CB4HM (dimensionless).
 * STATES[3] is AMp in component CB4HM (dimensionless).
 * RATES[0] is d/dt M in component CB4HM (dimensionless).
 * RATES[1] is d/dt Mp in component CB4HM (dimensionless).
 * RATES[2] is d/dt AM in component CB4HM (dimensionless).
 * RATES[3] is d/dt AMp in component CB4HM (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = -80;
CONSTANTS[1] = 1;
CONSTANTS[2] = 0;
CONSTANTS[3] = 8.314;
CONSTANTS[4] = 96.48534;
CONSTANTS[5] = 310;
CONSTANTS[6] = 2.9836;
CONSTANTS[7] = 140;
CONSTANTS[8] = 2;
CONSTANTS[9] = 21;
CONSTANTS[10] = -27;
CONSTANTS[11] = 11;
CONSTANTS[12] = 0.046842;
CONSTANTS[13] = 5.1449e-4;
CONSTANTS[14] = 1.9015;
CONSTANTS[15] = 0.6e-3;
CONSTANTS[16] = 7e-3;
CONSTANTS[17] = 5.7297e-5;
CONSTANTS[18] = 8.7613;
CONSTANTS[19] = 256.98e-6;
CONSTANTS[20] = 1;
CONSTANTS[21] = 0;
CONSTANTS[22] = 0;
CONSTANTS[23] = 0.0378;
CONSTANTS[24] = 1.2387;
CONSTANTS[25] = 0.1419;
CONSTANTS[26] = 0.035475;
CONSTANTS[27] = 1.2387;
CONSTANTS[28] = 1;
CONSTANTS[29] = 0;
CONSTANTS[30] = 0.1e-6;
CONSTANTS[31] = 2;
CONSTANTS[32] = 1;
CONSTANTS[33] = 1.00000/(1.00000+exp((CONSTANTS[10] - CONSTANTS[0])/CONSTANTS[11]));
CONSTANTS[34] =  (( CONSTANTS[3]*CONSTANTS[5])/( CONSTANTS[32]*CONSTANTS[4]))*log(CONSTANTS[7]/CONSTANTS[6]);
STATES[0] = CONSTANTS[1];
STATES[1] = CONSTANTS[2];
STATES[2] = CONSTANTS[21];
STATES[3] = CONSTANTS[22];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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[5]*STATES[0])/ALGEBRAIC[2]+( CONSTANTS[24]*STATES[1])/ALGEBRAIC[2]+( CONSTANTS[23]*STATES[2])/ALGEBRAIC[2];
resid[1] = RATES[1] - (( CONSTANTS[26]*STATES[3])/ALGEBRAIC[2]+( ALGEBRAIC[5]*STATES[0])/ALGEBRAIC[2]) - ( (CONSTANTS[24]+CONSTANTS[25])*STATES[1])/ALGEBRAIC[2];
resid[2] = RATES[2] - ( CONSTANTS[27]*STATES[3])/ALGEBRAIC[2] - ( (ALGEBRAIC[5]+CONSTANTS[23])*STATES[2])/ALGEBRAIC[2];
resid[3] = RATES[3] - (( CONSTANTS[25]*STATES[1])/ALGEBRAIC[2]+( ALGEBRAIC[5]*STATES[2])/ALGEBRAIC[2]) - ( (CONSTANTS[26]+CONSTANTS[27])*STATES[3])/ALGEBRAIC[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = ( - CONSTANTS[13]*pow(ALGEBRAIC[0], CONSTANTS[14]))/(pow(CONSTANTS[15], CONSTANTS[14])+pow(ALGEBRAIC[0], CONSTANTS[14]));
ALGEBRAIC[3] = STATES[3]+STATES[2];
ALGEBRAIC[4] = STATES[3]+STATES[1];
ALGEBRAIC[6] =  (( CONSTANTS[3]*CONSTANTS[5])/( CONSTANTS[31]*CONSTANTS[4]))*log(CONSTANTS[8]/ALGEBRAIC[0]);
ALGEBRAIC[7] =  CONSTANTS[12]*CONSTANTS[33]*(CONSTANTS[0] - ALGEBRAIC[6]);
ALGEBRAIC[8] = - ALGEBRAIC[7]/( 2.00000*CONSTANTS[9]*CONSTANTS[4]);
ALGEBRAIC[9] =  3.00000*CONSTANTS[34] -  2.00000*ALGEBRAIC[6];
ALGEBRAIC[10] =  (( CONSTANTS[17]*ALGEBRAIC[0])/(ALGEBRAIC[0]+CONSTANTS[16]))*(CONSTANTS[0] - ALGEBRAIC[9]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = STATES[0]+STATES[1]+STATES[2]+STATES[3];
ALGEBRAIC[0] =  340.700*1.00000e-06+ 71.3100*1.00000e-06*log(VOI+0.0500000);
ALGEBRAIC[5] =  (pow(ALGEBRAIC[0], CONSTANTS[18])/(pow(CONSTANTS[19], CONSTANTS[18])+pow(ALGEBRAIC[0], CONSTANTS[18])))*1.00000;
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}