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 35 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[12] is i_K_Ca in component K_Ca_current (picoA).
 * ALGEBRAIC[5] is i_K_ATP in component K_ATP_current (picoA).
 * ALGEBRAIC[16] is i_CRAC in component CRAC_current (picoA).
 * ALGEBRAIC[11] is i_Ca in component Ca_current_total (picoA).
 * ALGEBRAIC[18] 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[4] 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[8] 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[7] 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[10] is i_Ca_s in component slow_Ca_current (picoA).
 * CONSTANTS[11] is g_Ca_s in component slow_Ca_current (picoS).
 * ALGEBRAIC[9] 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 j in component slow_Ca_channel_j_gate (dimensionless).
 * ALGEBRAIC[3] is jm_infinity in component slow_Ca_channel_j_gate (dimensionless).
 * CONSTANTS[14] is Vj in component slow_Ca_channel_j_gate (millivolt).
 * ALGEBRAIC[6] 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[14] is r_infinity in component CRAC_r_gate (dimensionless).
 * CONSTANTS[20] is Ca_er_bar in component CRAC_r_gate (micromolar).
 * CONSTANTS[21] is g_leak in component leak_current (picoS).
 * ALGEBRAIC[13] is J_er_p in component ER_parameters (micromolar_per_millisecond).
 * CONSTANTS[22] is IP3 in component ER_parameters (micromolar).
 * CONSTANTS[23] is kerp in component ER_parameters (micromolar).
 * CONSTANTS[24] is verp in component ER_parameters (micromolar_per_millisecond).
 * CONSTANTS[25] is dact in component ER_parameters (micromolar).
 * CONSTANTS[26] is dinh in component ER_parameters (micromolar).
 * CONSTANTS[27] is dip3 in component ER_parameters (micromolar).
 * ALGEBRAIC[15] is a_infinity in component ER_parameters (dimensionless).
 * CONSTANTS[34] is b_infinity in component ER_parameters (dimensionless).
 * ALGEBRAIC[17] is h_infinity in component ER_parameters (dimensionless).
 * ALGEBRAIC[19] is O in component ER_parameters (per_millisecond).
 * ALGEBRAIC[22] is J_er_tot in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[21] is J_er_IP3 in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[20] 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[28] is perl in component Ca_equations (per_millisecond).
 * CONSTANTS[29] is lambda_er in component Ca_equations (dimensionless).
 * CONSTANTS[30] is sigma_er in component Ca_equations (dimensionless).
 * CONSTANTS[31] is k_Ca in component Ca_membrane_flux (per_millisecond).
 * CONSTANTS[32] is gamma in component Ca_membrane_flux (micromolar_per_millisecond_picoA).
 * CONSTANTS[33] is f in component Ca_membrane_flux (dimensionless).
 * 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] = 9;
CONSTANTS[20] = 3;
CONSTANTS[21] = 0;
CONSTANTS[22] = 0;
CONSTANTS[23] = 0.1;
CONSTANTS[24] = 0.24;
CONSTANTS[25] = 0.1;
CONSTANTS[26] = 0.4;
CONSTANTS[27] = 0.2;
CONSTANTS[28] = 0.02;
CONSTANTS[29] = 250;
CONSTANTS[30] = 5;
CONSTANTS[31] = 0.07;
CONSTANTS[32] = 0.000003607;
CONSTANTS[33] = 0.01;
CONSTANTS[34] = CONSTANTS[22]/(CONSTANTS[22]+CONSTANTS[27]);
}
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[4] = 9.09000/(1.00000+exp((STATES[0] - CONSTANTS[3])/CONSTANTS[4]));
RATES[1] = ( CONSTANTS[5]*(ALGEBRAIC[0] - STATES[1]))/ALGEBRAIC[4];
ALGEBRAIC[3] = 1.00000 - 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[14])/CONSTANTS[15]));
ALGEBRAIC[6] = 50000.0/(exp((STATES[0] - CONSTANTS[14])/4.00000)+exp((CONSTANTS[14] - STATES[0])/4.00000))+1500.00;
RATES[2] = (ALGEBRAIC[3] - STATES[2])/ALGEBRAIC[6];
ALGEBRAIC[1] =  CONSTANTS[2]*STATES[1]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[12] =  (( CONSTANTS[16]*pow(STATES[3], 5.00000))/(pow(STATES[3], 5.00000)+pow(CONSTANTS[17], 5.00000)))*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[5] =  CONSTANTS[6]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[14] = 1.00000/(1.00000+exp( 1.00000*(STATES[4] - CONSTANTS[20])));
ALGEBRAIC[16] =  CONSTANTS[18]*ALGEBRAIC[14]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[7] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[8] =  CONSTANTS[8]*ALGEBRAIC[7]*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[9] = 1.00000/(1.00000+exp((CONSTANTS[12] - STATES[0])/CONSTANTS[13]));
ALGEBRAIC[10] =  CONSTANTS[11]*ALGEBRAIC[9]*(1.00000 - STATES[2])*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[11] = ALGEBRAIC[8]+ALGEBRAIC[10];
ALGEBRAIC[18] =  CONSTANTS[21]*(STATES[0] - CONSTANTS[19]);
RATES[0] = - (ALGEBRAIC[11]+ALGEBRAIC[1]+ALGEBRAIC[5]+ALGEBRAIC[12]+ALGEBRAIC[16]+ALGEBRAIC[18])/CONSTANTS[0];
ALGEBRAIC[13] = ( CONSTANTS[24]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[23], 2.00000));
ALGEBRAIC[15] = 1.00000/(1.00000+CONSTANTS[25]/STATES[3]);
ALGEBRAIC[17] = 1.00000/(1.00000+STATES[3]/CONSTANTS[26]);
ALGEBRAIC[19] =  pow(ALGEBRAIC[15], 3.00000)*pow(CONSTANTS[34], 3.00000)*pow(ALGEBRAIC[17], 3.00000)*1.00000;
ALGEBRAIC[21] =  ALGEBRAIC[19]*(STATES[4] - STATES[3]);
ALGEBRAIC[20] =  CONSTANTS[28]*(STATES[4] - STATES[3]);
ALGEBRAIC[22] = (ALGEBRAIC[20]+ALGEBRAIC[21]) - ALGEBRAIC[13];
RATES[4] = - ALGEBRAIC[22]/( CONSTANTS[29]*CONSTANTS[30]);
ALGEBRAIC[23] =  - CONSTANTS[33]*( CONSTANTS[32]*ALGEBRAIC[11]+ CONSTANTS[31]*STATES[3]);
RATES[3] = ALGEBRAIC[22]/CONSTANTS[29]+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[4] = 9.09000/(1.00000+exp((STATES[0] - CONSTANTS[3])/CONSTANTS[4]));
ALGEBRAIC[3] = 1.00000 - 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[14])/CONSTANTS[15]));
ALGEBRAIC[6] = 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[12] =  (( CONSTANTS[16]*pow(STATES[3], 5.00000))/(pow(STATES[3], 5.00000)+pow(CONSTANTS[17], 5.00000)))*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[5] =  CONSTANTS[6]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[14] = 1.00000/(1.00000+exp( 1.00000*(STATES[4] - CONSTANTS[20])));
ALGEBRAIC[16] =  CONSTANTS[18]*ALGEBRAIC[14]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[7] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[8] =  CONSTANTS[8]*ALGEBRAIC[7]*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[9] = 1.00000/(1.00000+exp((CONSTANTS[12] - STATES[0])/CONSTANTS[13]));
ALGEBRAIC[10] =  CONSTANTS[11]*ALGEBRAIC[9]*(1.00000 - STATES[2])*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[11] = ALGEBRAIC[8]+ALGEBRAIC[10];
ALGEBRAIC[18] =  CONSTANTS[21]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[13] = ( CONSTANTS[24]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[23], 2.00000));
ALGEBRAIC[15] = 1.00000/(1.00000+CONSTANTS[25]/STATES[3]);
ALGEBRAIC[17] = 1.00000/(1.00000+STATES[3]/CONSTANTS[26]);
ALGEBRAIC[19] =  pow(ALGEBRAIC[15], 3.00000)*pow(CONSTANTS[34], 3.00000)*pow(ALGEBRAIC[17], 3.00000)*1.00000;
ALGEBRAIC[21] =  ALGEBRAIC[19]*(STATES[4] - STATES[3]);
ALGEBRAIC[20] =  CONSTANTS[28]*(STATES[4] - STATES[3]);
ALGEBRAIC[22] = (ALGEBRAIC[20]+ALGEBRAIC[21]) - ALGEBRAIC[13];
ALGEBRAIC[23] =  - CONSTANTS[33]*( CONSTANTS[32]*ALGEBRAIC[11]+ CONSTANTS[31]*STATES[3]);
ALGEBRAIC[2] = 1.00000 - STATES[2];
}