Generated Code

The following is c code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 24 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 37 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is Cm in component membrane (femtoF).
 * ALGEBRAIC[1] is i_K in component K_current (picoA).
 * ALGEBRAIC[11] is i_K_Ca in component K_Ca_current (picoA).
 * ALGEBRAIC[4] is i_K_ATP in component K_ATP_current (picoA).
 * ALGEBRAIC[15] is i_CRAC in component CRAC_current (picoA).
 * ALGEBRAIC[10] is i_Ca in component Ca_current_total (picoA).
 * ALGEBRAIC[17] is i_leak in component leak_current (picoA).
 * CONSTANTS[1] is V_K in component K_current (millivolt).
 * CONSTANTS[2] is g_K in component K_current (picoS).
 * STATES[1] is n in component K_channel_n_gate (dimensionless).
 * ALGEBRAIC[0] is n_infinity in component K_channel_n_gate (dimensionless).
 * ALGEBRAIC[3] is tau_n in component K_channel_n_gate (millisecond).
 * CONSTANTS[3] is Vn in component K_channel_n_gate (millivolt).
 * CONSTANTS[4] is Sn in component K_channel_n_gate (millivolt).
 * CONSTANTS[5] is lambda_n in component K_channel_n_gate (dimensionless).
 * CONSTANTS[6] is g_K_ATP in component K_ATP_current (picoS).
 * ALGEBRAIC[7] is i_Ca_f in component fast_Ca_current (picoA).
 * CONSTANTS[7] is V_Ca in component fast_Ca_current (millivolt).
 * CONSTANTS[8] is g_Ca_f in component fast_Ca_current (picoS).
 * ALGEBRAIC[6] is m_f_infinity in component fast_Ca_channel_m_gate (dimensionless).
 * CONSTANTS[9] is Vm_f in component fast_Ca_channel_m_gate (millivolt).
 * CONSTANTS[10] is Sm_f in component fast_Ca_channel_m_gate (millivolt).
 * ALGEBRAIC[9] is i_Ca_s in component slow_Ca_current (picoA).
 * CONSTANTS[11] is g_Ca_s in component slow_Ca_current (picoS).
 * ALGEBRAIC[8] is m_s_infinity in component slow_Ca_channel_m_gate (dimensionless).
 * STATES[2] is jm in component slow_Ca_channel_j_gate (dimensionless).
 * CONSTANTS[12] is Vm_s in component slow_Ca_channel_m_gate (millivolt).
 * CONSTANTS[13] is Sm_s in component slow_Ca_channel_m_gate (millivolt).
 * ALGEBRAIC[2] is jm_infinity in component slow_Ca_channel_j_gate (dimensionless).
 * CONSTANTS[14] is Vj in component slow_Ca_channel_j_gate (millivolt).
 * ALGEBRAIC[5] is tau_j in component slow_Ca_channel_j_gate (millisecond).
 * CONSTANTS[15] is Sj in component slow_Ca_channel_j_gate (millivolt).
 * CONSTANTS[16] is g_K_Ca in component K_Ca_current (picoS).
 * STATES[3] is Ca_i in component Ca_equations (micromolar).
 * CONSTANTS[17] is kdkca in component K_Ca_current (micromolar).
 * CONSTANTS[18] is g_CRAC in component CRAC_current (picoS).
 * CONSTANTS[19] is V_CRAC in component CRAC_current (millivolt).
 * STATES[4] is Ca_er in component Ca_equations (micromolar).
 * ALGEBRAIC[13] is r_infinity in component CRAC_r_gate (dimensionless).
 * CONSTANTS[20] is Ca_er_bar in component CRAC_r_gate (micromolar).
 * CONSTANTS[21] is sloper in component CRAC_r_gate (micromolar).
 * CONSTANTS[22] is g_leak in component leak_current (picoS).
 * ALGEBRAIC[12] is J_er_p in component ER_parameters (micromolar_per_millisecond).
 * CONSTANTS[23] is IP3 in component ER_parameters (micromolar).
 * CONSTANTS[24] is kerp in component ER_parameters (micromolar).
 * CONSTANTS[25] is verp in component ER_parameters (micromolar_per_millisecond).
 * CONSTANTS[26] is dact in component ER_parameters (micromolar).
 * CONSTANTS[27] is dinh in component ER_parameters (micromolar).
 * CONSTANTS[28] is dip3 in component ER_parameters (micromolar).
 * ALGEBRAIC[14] is a_infinity in component ER_parameters (dimensionless).
 * CONSTANTS[36] is b_infinity in component ER_parameters (dimensionless).
 * ALGEBRAIC[16] is h_infinity in component ER_parameters (dimensionless).
 * ALGEBRAIC[18] is O in component ER_parameters (per_millisecond).
 * ALGEBRAIC[21] is J_er_tot in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[20] is J_er_IP3 in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[19] is J_er_leak in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[23] is J_mem_tot in component Ca_membrane_flux (micromolar_per_millisecond).
 * CONSTANTS[29] is perl in component Ca_equations (per_millisecond).
 * CONSTANTS[30] is lambda_er in component Ca_equations (dimensionless).
 * CONSTANTS[31] is sigma_er in component Ca_equations (dimensionless).
 * CONSTANTS[32] is kmp in component Ca_membrane_flux (micromolar).
 * CONSTANTS[33] is vmp in component Ca_membrane_flux (micromolar).
 * CONSTANTS[34] is gamma in component Ca_membrane_flux (micromolar_per_picoA).
 * ALGEBRAIC[22] is Jmp in component Ca_membrane_flux (micromolar).
 * CONSTANTS[35] is f in component Ca_membrane_flux (per_millisecond).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt n in component K_channel_n_gate (dimensionless).
 * RATES[2] is d/dt jm in component slow_Ca_channel_j_gate (dimensionless).
 * RATES[4] is d/dt Ca_er in component Ca_equations (micromolar).
 * RATES[3] is d/dt Ca_i in component Ca_equations (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -61;
CONSTANTS[0] = 6158;
CONSTANTS[1] = -70;
CONSTANTS[2] = 3900;
STATES[1] = 0.0005;
CONSTANTS[3] = -15;
CONSTANTS[4] = 6;
CONSTANTS[5] = 1.85;
CONSTANTS[6] = 150;
CONSTANTS[7] = 100;
CONSTANTS[8] = 810;
CONSTANTS[9] = -20;
CONSTANTS[10] = 7.5;
CONSTANTS[11] = 510;
STATES[2] = 0.12;
CONSTANTS[12] = -16;
CONSTANTS[13] = 10;
CONSTANTS[14] = -53;
CONSTANTS[15] = 2;
CONSTANTS[16] = 1200;
STATES[3] = 0.11;
CONSTANTS[17] = 0.55;
CONSTANTS[18] = 75;
CONSTANTS[19] = 0;
STATES[4] = 60;
CONSTANTS[20] = 40;
CONSTANTS[21] = 3;
CONSTANTS[22] = 0;
CONSTANTS[23] = 0;
CONSTANTS[24] = 0.09;
CONSTANTS[25] = 0.24;
CONSTANTS[26] = 0.35;
CONSTANTS[27] = 0.4;
CONSTANTS[28] = 0.2;
CONSTANTS[29] = 0.003;
CONSTANTS[30] = 250;
CONSTANTS[31] = 1;
CONSTANTS[32] = 0.35;
CONSTANTS[33] = 0.08;
CONSTANTS[34] = 0.000003607;
CONSTANTS[35] = 0.01;
CONSTANTS[36] = CONSTANTS[23]/(CONSTANTS[23]+CONSTANTS[28]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 1.00000/(1.00000+exp((CONSTANTS[3] - STATES[0])/CONSTANTS[4]));
ALGEBRAIC[3] = 9.09000/(1.00000+exp((STATES[0] - CONSTANTS[3])/CONSTANTS[4]));
RATES[1] = ( CONSTANTS[5]*(ALGEBRAIC[0] - STATES[1]))/ALGEBRAIC[3];
ALGEBRAIC[2] = 1.00000 - 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[14])/CONSTANTS[15]));
ALGEBRAIC[5] = 50000.0/(exp((STATES[0] - CONSTANTS[14])/4.00000)+exp((CONSTANTS[14] - STATES[0])/4.00000))+1500.00;
RATES[2] = (ALGEBRAIC[2] - STATES[2])/ALGEBRAIC[5];
ALGEBRAIC[1] =  CONSTANTS[2]*STATES[1]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[11] =  (( CONSTANTS[16]*pow(STATES[3], 5.00000))/(pow(STATES[3], 5.00000)+pow(CONSTANTS[17], 5.00000)))*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[4] =  CONSTANTS[6]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[13] = 1.00000/(1.00000+exp((STATES[4] - CONSTANTS[20])/CONSTANTS[21]));
ALGEBRAIC[15] =  CONSTANTS[18]*ALGEBRAIC[13]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[7] =  CONSTANTS[8]*ALGEBRAIC[6]*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[8] = 1.00000/(1.00000+exp((CONSTANTS[12] - STATES[0])/CONSTANTS[13]));
ALGEBRAIC[9] =  CONSTANTS[11]*ALGEBRAIC[8]*(1.00000 - STATES[2])*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[10] = ALGEBRAIC[7]+ALGEBRAIC[9];
ALGEBRAIC[17] =  CONSTANTS[22]*(STATES[0] - CONSTANTS[19]);
RATES[0] = - (ALGEBRAIC[10]+ALGEBRAIC[1]+ALGEBRAIC[4]+ALGEBRAIC[11]+ALGEBRAIC[15]+ALGEBRAIC[17])/CONSTANTS[0];
ALGEBRAIC[12] = ( CONSTANTS[25]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[24], 2.00000));
ALGEBRAIC[14] = 1.00000/(1.00000+CONSTANTS[26]/STATES[3]);
ALGEBRAIC[16] = 1.00000/(1.00000+STATES[3]/CONSTANTS[27]);
ALGEBRAIC[18] =  pow(ALGEBRAIC[14], 3.00000)*pow(CONSTANTS[36], 3.00000)*pow(ALGEBRAIC[16], 3.00000)*1.00000;
ALGEBRAIC[20] =  ALGEBRAIC[18]*(STATES[4] - STATES[3]);
ALGEBRAIC[19] =  CONSTANTS[29]*(STATES[4] - STATES[3]);
ALGEBRAIC[21] = (ALGEBRAIC[19]+ALGEBRAIC[20]) - ALGEBRAIC[12];
RATES[4] = - ALGEBRAIC[21]/( CONSTANTS[30]*CONSTANTS[31]);
ALGEBRAIC[22] = ( CONSTANTS[33]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[32], 2.00000));
ALGEBRAIC[23] =  - CONSTANTS[35]*( CONSTANTS[34]*ALGEBRAIC[10]+ALGEBRAIC[22]);
RATES[3] = ALGEBRAIC[21]/CONSTANTS[30]+ALGEBRAIC[23];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 1.00000/(1.00000+exp((CONSTANTS[3] - STATES[0])/CONSTANTS[4]));
ALGEBRAIC[3] = 9.09000/(1.00000+exp((STATES[0] - CONSTANTS[3])/CONSTANTS[4]));
ALGEBRAIC[2] = 1.00000 - 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[14])/CONSTANTS[15]));
ALGEBRAIC[5] = 50000.0/(exp((STATES[0] - CONSTANTS[14])/4.00000)+exp((CONSTANTS[14] - STATES[0])/4.00000))+1500.00;
ALGEBRAIC[1] =  CONSTANTS[2]*STATES[1]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[11] =  (( CONSTANTS[16]*pow(STATES[3], 5.00000))/(pow(STATES[3], 5.00000)+pow(CONSTANTS[17], 5.00000)))*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[4] =  CONSTANTS[6]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[13] = 1.00000/(1.00000+exp((STATES[4] - CONSTANTS[20])/CONSTANTS[21]));
ALGEBRAIC[15] =  CONSTANTS[18]*ALGEBRAIC[13]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[7] =  CONSTANTS[8]*ALGEBRAIC[6]*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[8] = 1.00000/(1.00000+exp((CONSTANTS[12] - STATES[0])/CONSTANTS[13]));
ALGEBRAIC[9] =  CONSTANTS[11]*ALGEBRAIC[8]*(1.00000 - STATES[2])*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[10] = ALGEBRAIC[7]+ALGEBRAIC[9];
ALGEBRAIC[17] =  CONSTANTS[22]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[12] = ( CONSTANTS[25]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[24], 2.00000));
ALGEBRAIC[14] = 1.00000/(1.00000+CONSTANTS[26]/STATES[3]);
ALGEBRAIC[16] = 1.00000/(1.00000+STATES[3]/CONSTANTS[27]);
ALGEBRAIC[18] =  pow(ALGEBRAIC[14], 3.00000)*pow(CONSTANTS[36], 3.00000)*pow(ALGEBRAIC[16], 3.00000)*1.00000;
ALGEBRAIC[20] =  ALGEBRAIC[18]*(STATES[4] - STATES[3]);
ALGEBRAIC[19] =  CONSTANTS[29]*(STATES[4] - STATES[3]);
ALGEBRAIC[21] = (ALGEBRAIC[19]+ALGEBRAIC[20]) - ALGEBRAIC[12];
ALGEBRAIC[22] = ( CONSTANTS[33]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[32], 2.00000));
ALGEBRAIC[23] =  - CONSTANTS[35]*( CONSTANTS[34]*ALGEBRAIC[10]+ALGEBRAIC[22]);
}