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 31 entries in the algebraic variable array.
   There are a total of 10 entries in each of the rate and state variable arrays.
   There are a total of 13 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is C in component membrane (microF_per_cm2).
 * ALGEBRAIC[0] is i_Na in component fast_sodium_current (microA_per_cm2).
 * ALGEBRAIC[20] is i_si in component secondary_inward_current (microA_per_cm2).
 * ALGEBRAIC[22] is i_K2 in component pacemaker_potassium_current (microA_per_cm2).
 * ALGEBRAIC[24] is i_x1 in component plateau_potassium_current1 (microA_per_cm2).
 * ALGEBRAIC[26] is i_x2 in component plateau_potassium_current2 (microA_per_cm2).
 * ALGEBRAIC[27] is i_qr in component transient_chloride_current (microA_per_cm2).
 * ALGEBRAIC[28] is i_K1 in component time_independent_outward_current (microA_per_cm2).
 * ALGEBRAIC[29] is i_Na_b in component sodium_background_current (microA_per_cm2).
 * ALGEBRAIC[30] is i_Cl_b in component chloride_background_current (microA_per_cm2).
 * CONSTANTS[1] is E_Na in component fast_sodium_current (millivolt).
 * CONSTANTS[2] is g_Na in component fast_sodium_current (milliS_per_cm2).
 * STATES[1] is m in component fast_sodium_current_m_gate (dimensionless).
 * STATES[2] is h in component fast_sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[1] is alpha_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[11] is beta_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[2] is alpha_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[12] is beta_h in component fast_sodium_current_h_gate (per_millisecond).
 * CONSTANTS[3] is g_si in component secondary_inward_current (milliS_per_cm2).
 * CONSTANTS[4] is g_si_ in component secondary_inward_current (milliS_per_cm2).
 * CONSTANTS[5] is E_si in component secondary_inward_current (millivolt).
 * STATES[3] is d in component secondary_inward_current_d_gate (dimensionless).
 * STATES[4] is f in component secondary_inward_current_f_gate (dimensionless).
 * ALGEBRAIC[10] is d1 in component secondary_inward_current_d1_gate (dimensionless).
 * ALGEBRAIC[3] is alpha_d in component secondary_inward_current_d_gate (per_millisecond).
 * ALGEBRAIC[13] is beta_d in component secondary_inward_current_d_gate (per_millisecond).
 * ALGEBRAIC[4] is alpha_f in component secondary_inward_current_f_gate (per_millisecond).
 * ALGEBRAIC[14] is beta_f in component secondary_inward_current_f_gate (per_millisecond).
 * ALGEBRAIC[21] is I_K2 in component pacemaker_potassium_current (microA_per_cm2).
 * CONSTANTS[6] is E_K in component pacemaker_potassium_current (millivolt).
 * STATES[5] is s in component pacemaker_potassium_current_s_gate (dimensionless).
 * ALGEBRAIC[5] is alpha_s in component pacemaker_potassium_current_s_gate (per_millisecond).
 * ALGEBRAIC[15] is beta_s in component pacemaker_potassium_current_s_gate (per_millisecond).
 * CONSTANTS[7] is E_s in component pacemaker_potassium_current_s_gate (millivolt).
 * ALGEBRAIC[23] is I_x1 in component plateau_potassium_current1 (microA_per_cm2).
 * STATES[6] is x1 in component plateau_potassium_current1_x1_gate (dimensionless).
 * ALGEBRAIC[6] is alpha_x1 in component plateau_potassium_current1_x1_gate (per_millisecond).
 * ALGEBRAIC[16] is beta_x1 in component plateau_potassium_current1_x1_gate (per_millisecond).
 * ALGEBRAIC[25] is I_x2 in component plateau_potassium_current2 (microA_per_cm2).
 * STATES[7] is x2 in component plateau_potassium_current2_x2_gate (dimensionless).
 * ALGEBRAIC[7] is alpha_x2 in component plateau_potassium_current2_x2_gate (per_millisecond).
 * ALGEBRAIC[17] is beta_x2 in component plateau_potassium_current2_x2_gate (per_millisecond).
 * CONSTANTS[8] is E_Cl in component transient_chloride_current (millivolt).
 * CONSTANTS[9] is g_qr in component transient_chloride_current (milliS_per_cm2).
 * STATES[8] is q in component transient_chloride_current_q_gate (dimensionless).
 * STATES[9] is r in component transient_chloride_current_r_gate (dimensionless).
 * ALGEBRAIC[8] is alpha_q in component transient_chloride_current_q_gate (per_millisecond).
 * ALGEBRAIC[18] is beta_q in component transient_chloride_current_q_gate (per_millisecond).
 * ALGEBRAIC[9] is alpha_r in component transient_chloride_current_r_gate (per_millisecond).
 * ALGEBRAIC[19] is beta_r in component transient_chloride_current_r_gate (per_millisecond).
 * CONSTANTS[10] is E_K1 in component time_independent_outward_current (millivolt).
 * CONSTANTS[11] is g_Nab in component sodium_background_current (milliS_per_cm2).
 * CONSTANTS[12] is g_Clb in component chloride_background_current (milliS_per_cm2).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt m in component fast_sodium_current_m_gate (dimensionless).
 * RATES[2] is d/dt h in component fast_sodium_current_h_gate (dimensionless).
 * RATES[3] is d/dt d in component secondary_inward_current_d_gate (dimensionless).
 * RATES[4] is d/dt f in component secondary_inward_current_f_gate (dimensionless).
 * RATES[5] is d/dt s in component pacemaker_potassium_current_s_gate (dimensionless).
 * RATES[6] is d/dt x1 in component plateau_potassium_current1_x1_gate (dimensionless).
 * RATES[7] is d/dt x2 in component plateau_potassium_current2_x2_gate (dimensionless).
 * RATES[8] is d/dt q in component transient_chloride_current_q_gate (dimensionless).
 * RATES[9] is d/dt r in component transient_chloride_current_r_gate (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -78.041367;
CONSTANTS[0] = 10;
CONSTANTS[1] = 40;
CONSTANTS[2] = 150;
STATES[1] = 0.02566853;
STATES[2] = 0.78656359;
CONSTANTS[3] = 0.8;
CONSTANTS[4] = 0.04;
CONSTANTS[5] = 70;
STATES[3] = 0.00293135;
STATES[4] = 0.80873917;
CONSTANTS[6] = -110;
STATES[5] = 0.75473994;
CONSTANTS[7] = -52;
STATES[6] = 0.02030289;
STATES[7] = 0.0176854;
CONSTANTS[8] = -70;
CONSTANTS[9] = 2.5;
STATES[8] = 3.11285794;
STATES[9] = 0.13500116;
CONSTANTS[10] = -30;
CONSTANTS[11] = 0.105;
CONSTANTS[12] = 0.01;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = ( 1.00000*(STATES[0]+47.0000))/(1.00000 - exp(- (STATES[0]+47.0000)/10.0000));
ALGEBRAIC[11] =  40.0000*exp( - 0.0560000*(STATES[0]+72.0000));
RATES[1] =  ALGEBRAIC[1]*(1.00000 - STATES[1]) -  ALGEBRAIC[11]*STATES[1];
ALGEBRAIC[2] =  0.00850000*exp( - 0.184000*(STATES[0]+71.0000));
ALGEBRAIC[12] = 2.50000/(exp( - 0.0820000*(STATES[0]+10.0000))+1.00000);
RATES[2] =  ALGEBRAIC[2]*(1.00000 - STATES[2]) -  ALGEBRAIC[12]*STATES[2];
ALGEBRAIC[3] = ( 0.00200000*(STATES[0]+40.0000))/(1.00000 - exp( - 0.100000*(STATES[0]+40.0000)));
ALGEBRAIC[13] =  0.0200000*exp( - 0.0888000*(STATES[0]+40.0000));
RATES[3] =  ALGEBRAIC[3]*(1.00000 - STATES[3]) -  ALGEBRAIC[13]*STATES[3];
ALGEBRAIC[4] =  0.000987000*exp( - 0.0400000*(STATES[0]+60.0000));
ALGEBRAIC[14] = 0.0200000/(exp( - 0.0870000*(STATES[0]+26.0000))+1.00000);
RATES[4] =  ALGEBRAIC[4]*(1.00000 - STATES[4]) -  ALGEBRAIC[14]*STATES[4];
ALGEBRAIC[5] = ( 0.00100000*(STATES[0] - CONSTANTS[7]))/(1.00000 - exp( - 0.200000*(STATES[0] - CONSTANTS[7])));
ALGEBRAIC[15] =  5.00000e-05*exp( - 0.0670000*(STATES[0] - CONSTANTS[7]));
RATES[5] =  ALGEBRAIC[5]*(1.00000 - STATES[5]) -  ALGEBRAIC[15]*STATES[5];
ALGEBRAIC[6] = ( 0.000500000*exp((STATES[0]+50.0000)/12.1000))/(1.00000+exp((STATES[0]+50.0000)/17.5000));
ALGEBRAIC[16] = ( 0.00130000*exp(- (STATES[0]+20.0000)/16.6700))/(1.00000+exp(- (STATES[0]+20.0000)/25.0000));
RATES[6] =  ALGEBRAIC[6]*(1.00000 - STATES[6]) -  ALGEBRAIC[16]*STATES[6];
ALGEBRAIC[7] = ( 0.000127000*1.00000)/(1.00000+exp(- (STATES[0]+19.0000)/5.00000));
ALGEBRAIC[17] = ( 0.000300000*exp(- (STATES[0]+20.0000)/16.6700))/(1.00000+exp(- (STATES[0]+20.0000)/25.0000));
RATES[7] =  ALGEBRAIC[7]*(1.00000 - STATES[7]) -  ALGEBRAIC[17]*STATES[7];
ALGEBRAIC[8] = ( 0.00800000*STATES[0])/(1.00000 - exp( - 0.100000*STATES[0]));
ALGEBRAIC[18] =  0.0800000*exp( - 0.0888000*STATES[0]);
RATES[8] =  ALGEBRAIC[8]*(1.00000 - STATES[8]) -  ALGEBRAIC[18]*STATES[8];
ALGEBRAIC[9] =  3.30000e-05*exp(- STATES[0]/17.0000);
ALGEBRAIC[19] = 0.0330000/(exp(- (STATES[0]+30.0000)/8.00000)+1.00000);
RATES[9] =  ALGEBRAIC[9]*(1.00000 - STATES[9]) -  ALGEBRAIC[19]*STATES[9];
ALGEBRAIC[0] =  CONSTANTS[2]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[10] = 1.00000/(1.00000+exp( - 0.150000*(STATES[0]+40.0000)));
ALGEBRAIC[20] =  CONSTANTS[3]*STATES[3]*STATES[4]*(STATES[0] - CONSTANTS[5])+ CONSTANTS[4]*ALGEBRAIC[10]*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[21] = ( 2.80000*(exp((STATES[0] - CONSTANTS[6])/25.0000) - 1.00000))/(exp((STATES[0]+60.0000)/12.5000)+exp((STATES[0]+60.0000)/25.0000));
ALGEBRAIC[22] =  ALGEBRAIC[21]*STATES[5];
ALGEBRAIC[23] = ( 1.20000*(exp((STATES[0]+95.0000)/25.0000) - 1.00000))/exp((STATES[0]+45.0000)/25.0000);
ALGEBRAIC[24] =  STATES[6]*ALGEBRAIC[23];
ALGEBRAIC[25] = 25.0000+ 1.00000*0.385000*STATES[0];
ALGEBRAIC[26] =  STATES[7]*ALGEBRAIC[25];
ALGEBRAIC[27] =  CONSTANTS[9]*STATES[8]*STATES[9]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[28] = ALGEBRAIC[21]/2.80000+( 0.200000*(STATES[0] - CONSTANTS[10]))/(1.00000 - exp(- (STATES[0] - CONSTANTS[10])/25.0000));
ALGEBRAIC[29] =  CONSTANTS[11]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[30] =  CONSTANTS[12]*(STATES[0] - CONSTANTS[8]);
RATES[0] = - (ALGEBRAIC[0]+ALGEBRAIC[20]+ALGEBRAIC[22]+ALGEBRAIC[24]+ALGEBRAIC[26]+ALGEBRAIC[27]+ALGEBRAIC[28]+ALGEBRAIC[29]+ALGEBRAIC[30])/CONSTANTS[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = ( 1.00000*(STATES[0]+47.0000))/(1.00000 - exp(- (STATES[0]+47.0000)/10.0000));
ALGEBRAIC[11] =  40.0000*exp( - 0.0560000*(STATES[0]+72.0000));
ALGEBRAIC[2] =  0.00850000*exp( - 0.184000*(STATES[0]+71.0000));
ALGEBRAIC[12] = 2.50000/(exp( - 0.0820000*(STATES[0]+10.0000))+1.00000);
ALGEBRAIC[3] = ( 0.00200000*(STATES[0]+40.0000))/(1.00000 - exp( - 0.100000*(STATES[0]+40.0000)));
ALGEBRAIC[13] =  0.0200000*exp( - 0.0888000*(STATES[0]+40.0000));
ALGEBRAIC[4] =  0.000987000*exp( - 0.0400000*(STATES[0]+60.0000));
ALGEBRAIC[14] = 0.0200000/(exp( - 0.0870000*(STATES[0]+26.0000))+1.00000);
ALGEBRAIC[5] = ( 0.00100000*(STATES[0] - CONSTANTS[7]))/(1.00000 - exp( - 0.200000*(STATES[0] - CONSTANTS[7])));
ALGEBRAIC[15] =  5.00000e-05*exp( - 0.0670000*(STATES[0] - CONSTANTS[7]));
ALGEBRAIC[6] = ( 0.000500000*exp((STATES[0]+50.0000)/12.1000))/(1.00000+exp((STATES[0]+50.0000)/17.5000));
ALGEBRAIC[16] = ( 0.00130000*exp(- (STATES[0]+20.0000)/16.6700))/(1.00000+exp(- (STATES[0]+20.0000)/25.0000));
ALGEBRAIC[7] = ( 0.000127000*1.00000)/(1.00000+exp(- (STATES[0]+19.0000)/5.00000));
ALGEBRAIC[17] = ( 0.000300000*exp(- (STATES[0]+20.0000)/16.6700))/(1.00000+exp(- (STATES[0]+20.0000)/25.0000));
ALGEBRAIC[8] = ( 0.00800000*STATES[0])/(1.00000 - exp( - 0.100000*STATES[0]));
ALGEBRAIC[18] =  0.0800000*exp( - 0.0888000*STATES[0]);
ALGEBRAIC[9] =  3.30000e-05*exp(- STATES[0]/17.0000);
ALGEBRAIC[19] = 0.0330000/(exp(- (STATES[0]+30.0000)/8.00000)+1.00000);
ALGEBRAIC[0] =  CONSTANTS[2]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[10] = 1.00000/(1.00000+exp( - 0.150000*(STATES[0]+40.0000)));
ALGEBRAIC[20] =  CONSTANTS[3]*STATES[3]*STATES[4]*(STATES[0] - CONSTANTS[5])+ CONSTANTS[4]*ALGEBRAIC[10]*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[21] = ( 2.80000*(exp((STATES[0] - CONSTANTS[6])/25.0000) - 1.00000))/(exp((STATES[0]+60.0000)/12.5000)+exp((STATES[0]+60.0000)/25.0000));
ALGEBRAIC[22] =  ALGEBRAIC[21]*STATES[5];
ALGEBRAIC[23] = ( 1.20000*(exp((STATES[0]+95.0000)/25.0000) - 1.00000))/exp((STATES[0]+45.0000)/25.0000);
ALGEBRAIC[24] =  STATES[6]*ALGEBRAIC[23];
ALGEBRAIC[25] = 25.0000+ 1.00000*0.385000*STATES[0];
ALGEBRAIC[26] =  STATES[7]*ALGEBRAIC[25];
ALGEBRAIC[27] =  CONSTANTS[9]*STATES[8]*STATES[9]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[28] = ALGEBRAIC[21]/2.80000+( 0.200000*(STATES[0] - CONSTANTS[10]))/(1.00000 - exp(- (STATES[0] - CONSTANTS[10])/25.0000));
ALGEBRAIC[29] =  CONSTANTS[11]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[30] =  CONSTANTS[12]*(STATES[0] - CONSTANTS[8]);
}