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 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[27] is i_si in component secondary_inward_current (microA_per_cm2).
 * ALGEBRAIC[28] is i_K2 in component pacemaker_potassium_current (microA_per_cm2).
 * ALGEBRAIC[29] is i_x1 in component plateau_potassium_current1 (microA_per_cm2).
 * ALGEBRAIC[30] is i_x2 in component plateau_potassium_current2 (microA_per_cm2).
 * ALGEBRAIC[19] is i_qr in component transient_chloride_current (microA_per_cm2).
 * ALGEBRAIC[24] is i_K1 in component time_independent_outward_current (microA_per_cm2).
 * ALGEBRAIC[25] is i_Na_b in component sodium_background_current (microA_per_cm2).
 * ALGEBRAIC[26] 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[2] is beta_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[3] is alpha_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[4] 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[9] is d1 in component secondary_inward_current_d1_gate (dimensionless).
 * ALGEBRAIC[5] is alpha_d in component secondary_inward_current_d_gate (per_millisecond).
 * ALGEBRAIC[6] is beta_d in component secondary_inward_current_d_gate (per_millisecond).
 * ALGEBRAIC[7] is alpha_f in component secondary_inward_current_f_gate (per_millisecond).
 * ALGEBRAIC[8] is beta_f in component secondary_inward_current_f_gate (per_millisecond).
 * ALGEBRAIC[10] 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[11] is alpha_s in component pacemaker_potassium_current_s_gate (per_millisecond).
 * ALGEBRAIC[12] 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[13] is I_x1 in component plateau_potassium_current1 (microA_per_cm2).
 * STATES[6] is x1 in component plateau_potassium_current1_x1_gate (dimensionless).
 * ALGEBRAIC[14] is alpha_x1 in component plateau_potassium_current1_x1_gate (per_millisecond).
 * ALGEBRAIC[15] is beta_x1 in component plateau_potassium_current1_x1_gate (per_millisecond).
 * ALGEBRAIC[16] is I_x2 in component plateau_potassium_current2 (microA_per_cm2).
 * STATES[7] is x2 in component plateau_potassium_current2_x2_gate (dimensionless).
 * ALGEBRAIC[17] is alpha_x2 in component plateau_potassium_current2_x2_gate (per_millisecond).
 * ALGEBRAIC[18] 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[20] is alpha_q in component transient_chloride_current_q_gate (per_millisecond).
 * ALGEBRAIC[21] is beta_q in component transient_chloride_current_q_gate (per_millisecond).
 * ALGEBRAIC[22] is alpha_r in component transient_chloride_current_r_gate (per_millisecond).
 * ALGEBRAIC[23] 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).
 * There are a total of 0 condition variables.
 */
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;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 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[0]+ALGEBRAIC[27]+ALGEBRAIC[28]+ALGEBRAIC[29]+ALGEBRAIC[30]+ALGEBRAIC[19]+ALGEBRAIC[24]+ALGEBRAIC[25]+ALGEBRAIC[26])/CONSTANTS[0];
resid[1] = RATES[1] -  ALGEBRAIC[1]*(1.00000 - STATES[1]) -  ALGEBRAIC[2]*STATES[1];
resid[2] = RATES[2] -  ALGEBRAIC[3]*(1.00000 - STATES[2]) -  ALGEBRAIC[4]*STATES[2];
resid[3] = RATES[3] -  ALGEBRAIC[5]*(1.00000 - STATES[3]) -  ALGEBRAIC[6]*STATES[3];
resid[4] = RATES[4] -  ALGEBRAIC[7]*(1.00000 - STATES[4]) -  ALGEBRAIC[8]*STATES[4];
resid[5] = RATES[5] -  ALGEBRAIC[11]*(1.00000 - STATES[5]) -  ALGEBRAIC[12]*STATES[5];
resid[6] = RATES[6] -  ALGEBRAIC[14]*(1.00000 - STATES[6]) -  ALGEBRAIC[15]*STATES[6];
resid[7] = RATES[7] -  ALGEBRAIC[17]*(1.00000 - STATES[7]) -  ALGEBRAIC[18]*STATES[7];
resid[8] = RATES[8] -  ALGEBRAIC[20]*(1.00000 - STATES[8]) -  ALGEBRAIC[21]*STATES[8];
resid[9] = RATES[9] -  ALGEBRAIC[22]*(1.00000 - STATES[9]) -  ALGEBRAIC[23]*STATES[9];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[2]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[1] = ( 1.00000*(STATES[0]+47.0000))/(1.00000 - exp(- (STATES[0]+47.0000)/10.0000));
ALGEBRAIC[2] =  40.0000*exp( - 0.0560000*(STATES[0]+72.0000));
ALGEBRAIC[3] =  0.00850000*exp( - 0.184000*(STATES[0]+71.0000));
ALGEBRAIC[4] = 2.50000/(exp( - 0.0820000*(STATES[0]+10.0000))+1.00000);
ALGEBRAIC[5] = ( 0.00200000*(STATES[0]+40.0000))/(1.00000 - exp( - 0.100000*(STATES[0]+40.0000)));
ALGEBRAIC[6] =  0.0200000*exp( - 0.0888000*(STATES[0]+40.0000));
ALGEBRAIC[7] =  0.000987000*exp( - 0.0400000*(STATES[0]+60.0000));
ALGEBRAIC[8] = 0.0200000/(exp( - 0.0870000*(STATES[0]+26.0000))+1.00000);
ALGEBRAIC[11] = ( 0.00100000*(STATES[0] - CONSTANTS[7]))/(1.00000 - exp( - 0.200000*(STATES[0] - CONSTANTS[7])));
ALGEBRAIC[12] =  5.00000e-05*exp( - 0.0670000*(STATES[0] - CONSTANTS[7]));
ALGEBRAIC[14] = ( 0.000500000*exp((STATES[0]+50.0000)/12.1000))/(1.00000+exp((STATES[0]+50.0000)/17.5000));
ALGEBRAIC[15] = ( 0.00130000*exp(- (STATES[0]+20.0000)/16.6700))/(1.00000+exp(- (STATES[0]+20.0000)/25.0000));
ALGEBRAIC[17] = ( 0.000127000*1.00000)/(1.00000+exp(- (STATES[0]+19.0000)/5.00000));
ALGEBRAIC[18] = ( 0.000300000*exp(- (STATES[0]+20.0000)/16.6700))/(1.00000+exp(- (STATES[0]+20.0000)/25.0000));
ALGEBRAIC[19] =  CONSTANTS[9]*STATES[8]*STATES[9]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[20] = ( 0.00800000*STATES[0])/(1.00000 - exp( - 0.100000*STATES[0]));
ALGEBRAIC[21] =  0.0800000*exp( - 0.0888000*STATES[0]);
ALGEBRAIC[22] =  0.000180000*exp( - 0.0400000*(STATES[0]+80.0000));
ALGEBRAIC[23] = 0.0200000/(exp( - 0.0870000*(STATES[0]+26.0000))+1.00000);
ALGEBRAIC[10] = ( 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[24] = ALGEBRAIC[10]/2.80000+( 0.200000*(STATES[0] - CONSTANTS[10]))/(1.00000 - exp(- (STATES[0] - CONSTANTS[10])/25.0000));
ALGEBRAIC[25] =  CONSTANTS[11]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[26] =  CONSTANTS[12]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[9] = 1.00000/(1.00000+exp( - 0.150000*(STATES[0]+40.0000)));
ALGEBRAIC[27] =  CONSTANTS[3]*STATES[3]*STATES[4]*(STATES[0] - CONSTANTS[5])+ CONSTANTS[4]*ALGEBRAIC[9]*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[28] =  ALGEBRAIC[10]*STATES[5];
ALGEBRAIC[13] = ( 1.20000*(exp((STATES[0]+95.0000)/25.0000) - 1.00000))/exp((STATES[0]+45.0000)/25.0000);
ALGEBRAIC[29] =  STATES[6]*ALGEBRAIC[13];
ALGEBRAIC[16] = 25.0000+ 1.00000*0.385000*STATES[0];
ALGEBRAIC[30] =  STATES[7]*ALGEBRAIC[16];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}