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 21 entries in the algebraic variable array.
   There are a total of 11 entries in each of the rate and state variable arrays.
   There are a total of 20 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 (picoF).
 * CONSTANTS[1] is i_app in component membrane (picoA).
 * ALGEBRAIC[8] is i_Na in component sodium_current (picoA).
 * ALGEBRAIC[14] is i_Ca_L in component L_type_calcium_current (picoA).
 * ALGEBRAIC[15] is i_Ca_T in component T_type_calcium_current (picoA).
 * ALGEBRAIC[16] is i_K_dr in component delayed_rectifier_K_channel_current (picoA).
 * ALGEBRAIC[17] is i_M in component M_like_K_current (picoA).
 * ALGEBRAIC[19] is i_ir in component inward_rectifier_K_current (picoA).
 * ALGEBRAIC[20] is i_d in component inward_leak_current (picoA).
 * CONSTANTS[2] is g_Na in component sodium_current (nanoS).
 * CONSTANTS[3] is V_Na in component sodium_current (millivolt).
 * ALGEBRAIC[0] is O in component sodium_current (dimensionless).
 * STATES[1] is A in component A (dimensionless).
 * CONSTANTS[4] is k1 in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[5] is k1_ in component reaction_constants (first_order_rate_constant).
 * ALGEBRAIC[1] is alpha in component reaction_constants (first_order_rate_constant).
 * ALGEBRAIC[9] is beta in component reaction_constants (first_order_rate_constant).
 * STATES[2] is D in component D (dimensionless).
 * STATES[3] is A_ in component A_ (dimensionless).
 * CONSTANTS[19] is a in component reaction_constants (dimensionless).
 * STATES[4] is D_ in component D_ (dimensionless).
 * CONSTANTS[6] is k2 in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[7] is k2_ in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[8] is V_Ca in component L_type_calcium_current (millivolt).
 * CONSTANTS[9] is g_Ca_L in component L_type_calcium_current (nanoS).
 * STATES[5] is m in component L_type_calcium_current_m_gate (dimensionless).
 * ALGEBRAIC[2] is m_infinity in component L_type_calcium_current_m_gate (dimensionless).
 * ALGEBRAIC[10] is tau_m in component L_type_calcium_current_m_gate (millisecond).
 * CONSTANTS[10] is Vh in component L_type_calcium_current_m_gate (millivolt).
 * CONSTANTS[11] is g_Ca_T in component T_type_calcium_current (nanoS).
 * STATES[6] is m in component T_type_calcium_current_m_gate (dimensionless).
 * STATES[7] is h in component T_type_calcium_current_h_gate (dimensionless).
 * ALGEBRAIC[3] is m_infinity in component T_type_calcium_current_m_gate (dimensionless).
 * ALGEBRAIC[11] is tau_m in component T_type_calcium_current_m_gate (millisecond).
 * ALGEBRAIC[4] is h_infinity in component T_type_calcium_current_h_gate (dimensionless).
 * CONSTANTS[12] is tau_h in component T_type_calcium_current_h_gate (millisecond).
 * CONSTANTS[13] is V_K in component delayed_rectifier_K_channel_current (millivolt).
 * CONSTANTS[14] is g_K_dr in component delayed_rectifier_K_channel_current (nanoS).
 * STATES[8] is n in component delayed_rectifier_K_channel_current_n_gate (dimensionless).
 * STATES[9] is h in component delayed_rectifier_K_channel_current_h_gate (dimensionless).
 * ALGEBRAIC[5] is n_infinity in component delayed_rectifier_K_channel_current_n_gate (dimensionless).
 * ALGEBRAIC[12] is tau_n in component delayed_rectifier_K_channel_current_n_gate (millisecond).
 * ALGEBRAIC[6] is h_infinity in component delayed_rectifier_K_channel_current_h_gate (dimensionless).
 * CONSTANTS[15] is tau_h in component delayed_rectifier_K_channel_current_h_gate (millisecond).
 * CONSTANTS[16] is g_M in component M_like_K_current (nanoS).
 * STATES[10] is n in component M_like_K_current_n_gate (dimensionless).
 * ALGEBRAIC[7] is n_infinity in component M_like_K_current_n_gate (dimensionless).
 * ALGEBRAIC[13] is tau_n in component M_like_K_current_n_gate (millisecond).
 * CONSTANTS[17] is g_ir in component inward_rectifier_K_current (nanoS).
 * ALGEBRAIC[18] is n_infinity in component inward_rectifier_K_current_n_gate (dimensionless).
 * CONSTANTS[18] is g_d in component inward_leak_current (nanoS).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt A in component A (dimensionless).
 * RATES[3] is d/dt A_ in component A_ (dimensionless).
 * RATES[2] is d/dt D in component D (dimensionless).
 * RATES[4] is d/dt D_ in component D_ (dimensionless).
 * RATES[5] is d/dt m in component L_type_calcium_current_m_gate (dimensionless).
 * RATES[6] is d/dt m in component T_type_calcium_current_m_gate (dimensionless).
 * RATES[7] is d/dt h in component T_type_calcium_current_h_gate (dimensionless).
 * RATES[8] is d/dt n in component delayed_rectifier_K_channel_current_n_gate (dimensionless).
 * RATES[9] is d/dt h in component delayed_rectifier_K_channel_current_h_gate (dimensionless).
 * RATES[10] is d/dt n in component M_like_K_current_n_gate (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -60;
CONSTANTS[0] = 14;
CONSTANTS[1] = 15;
CONSTANTS[2] = 60;
CONSTANTS[3] = 60;
STATES[1] = 1;
CONSTANTS[4] = 0.3;
CONSTANTS[5] = 0.03;
STATES[2] = 0;
STATES[3] = 0;
STATES[4] = 0;
CONSTANTS[6] = 0.001;
CONSTANTS[7] = 0.01;
CONSTANTS[8] = 100;
CONSTANTS[9] = 1.3;
STATES[5] = 0;
CONSTANTS[10] = 40;
CONSTANTS[11] = 0.94;
STATES[6] = 0;
STATES[7] = 0;
CONSTANTS[12] = 22;
CONSTANTS[13] = -80;
CONSTANTS[14] = 20;
STATES[8] = 0;
STATES[9] = 0;
CONSTANTS[15] = 1000;
CONSTANTS[16] = 4;
STATES[10] = 0;
CONSTANTS[17] = 1.71;
CONSTANTS[18] = 0.044;
CONSTANTS[19] =  pow((( CONSTANTS[4]*CONSTANTS[7])/( CONSTANTS[5]*CONSTANTS[6])), 1.0 / 2);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = 1.00000/(1.00000+exp((STATES[0]+86.4000)/4.70000));
RATES[7] = (ALGEBRAIC[4] - STATES[7])/CONSTANTS[12];
ALGEBRAIC[6] = 0.700000/(1.00000+exp(- (STATES[0]+35.0000)/10.0000))+0.300000;
RATES[9] = (ALGEBRAIC[6] - STATES[9])/CONSTANTS[15];
ALGEBRAIC[1] = 10.0000/(1.00000+exp(- (STATES[0]+6.00000)/10.0000));
ALGEBRAIC[9] = 10.0000/(1.00000+exp((STATES[0]+54.4000)/4.60000));
RATES[1] = ( ALGEBRAIC[1]*STATES[2]+ CONSTANTS[5]*STATES[3]) - ( ALGEBRAIC[9]*STATES[1]+ CONSTANTS[4]*STATES[1]);
RATES[3] = ( ALGEBRAIC[1]*CONSTANTS[19]*STATES[4]+ CONSTANTS[4]*STATES[1]) - ( (ALGEBRAIC[9]/CONSTANTS[19])*STATES[3]+ CONSTANTS[5]*STATES[3]);
RATES[2] = ( ALGEBRAIC[9]*STATES[1]+ CONSTANTS[7]*STATES[4]) - ( ALGEBRAIC[1]*STATES[2]+ CONSTANTS[6]*STATES[2]);
RATES[4] = ( (ALGEBRAIC[9]/CONSTANTS[19])*STATES[3]+ CONSTANTS[6]*STATES[2]) - ( ALGEBRAIC[1]*CONSTANTS[19]*STATES[4]+ CONSTANTS[7]*STATES[4]);
ALGEBRAIC[2] = 1.00000/(1.00000+exp(- (STATES[0] - CONSTANTS[10])/12.0000));
ALGEBRAIC[10] = 5.00000/(exp((STATES[0]+15.0000)/25.0000)+exp(- (STATES[0]+15.0000)/25.0000));
RATES[5] = (ALGEBRAIC[2] - STATES[5])/ALGEBRAIC[10];
ALGEBRAIC[3] = 1.00000/(1.00000+exp(- (STATES[0] - 56.1000)/10.0000));
ALGEBRAIC[11] = 7.00000/(exp((STATES[0]+50.0000)/9.00000)+exp(- (STATES[0]+50.0000)/9.00000))+0.800000;
RATES[6] = (ALGEBRAIC[3] - STATES[6])/ALGEBRAIC[11];
ALGEBRAIC[5] = 1.00000/(1.00000+exp(- (STATES[0]+25.0000)/15.0000));
ALGEBRAIC[12] = 15.0000/(exp((STATES[0]+30.0000)/15.0000)+exp(- (STATES[0]+30.0000)/15.0000))+1.00000;
RATES[8] = (ALGEBRAIC[5] - STATES[8])/ALGEBRAIC[12];
ALGEBRAIC[7] = 1.00000/(1.00000+exp(- (STATES[0]+37.0000)/4.00000));
ALGEBRAIC[13] = 80.0000/(exp((STATES[0]+30.0000)/15.0000)+exp(- (STATES[0]+30.0000)/15.0000));
RATES[10] = (ALGEBRAIC[7] - STATES[10])/ALGEBRAIC[13];
ALGEBRAIC[0] = pow(STATES[1], 3.00000);
ALGEBRAIC[8] =  CONSTANTS[2]*ALGEBRAIC[0]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[14] =  CONSTANTS[9]*pow(STATES[5], 2.00000)*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[15] =  CONSTANTS[11]*pow(STATES[6], 2.00000)*STATES[7]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[16] =  CONSTANTS[14]*pow(STATES[8], 4.00000)*STATES[9]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[17] =  CONSTANTS[16]*STATES[10]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[18] = ( 0.800000*1.00000)/(1.00000+exp((STATES[0]+80.0000)/12.0000))+0.200000;
ALGEBRAIC[19] =  CONSTANTS[17]*ALGEBRAIC[18]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[20] =  CONSTANTS[18]*(STATES[0] - CONSTANTS[8]);
RATES[0] = (CONSTANTS[1] - (ALGEBRAIC[8]+ALGEBRAIC[14]+ALGEBRAIC[15]+ALGEBRAIC[16]+ALGEBRAIC[17]+ALGEBRAIC[19]+ALGEBRAIC[20]))/CONSTANTS[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = 1.00000/(1.00000+exp((STATES[0]+86.4000)/4.70000));
ALGEBRAIC[6] = 0.700000/(1.00000+exp(- (STATES[0]+35.0000)/10.0000))+0.300000;
ALGEBRAIC[1] = 10.0000/(1.00000+exp(- (STATES[0]+6.00000)/10.0000));
ALGEBRAIC[9] = 10.0000/(1.00000+exp((STATES[0]+54.4000)/4.60000));
ALGEBRAIC[2] = 1.00000/(1.00000+exp(- (STATES[0] - CONSTANTS[10])/12.0000));
ALGEBRAIC[10] = 5.00000/(exp((STATES[0]+15.0000)/25.0000)+exp(- (STATES[0]+15.0000)/25.0000));
ALGEBRAIC[3] = 1.00000/(1.00000+exp(- (STATES[0] - 56.1000)/10.0000));
ALGEBRAIC[11] = 7.00000/(exp((STATES[0]+50.0000)/9.00000)+exp(- (STATES[0]+50.0000)/9.00000))+0.800000;
ALGEBRAIC[5] = 1.00000/(1.00000+exp(- (STATES[0]+25.0000)/15.0000));
ALGEBRAIC[12] = 15.0000/(exp((STATES[0]+30.0000)/15.0000)+exp(- (STATES[0]+30.0000)/15.0000))+1.00000;
ALGEBRAIC[7] = 1.00000/(1.00000+exp(- (STATES[0]+37.0000)/4.00000));
ALGEBRAIC[13] = 80.0000/(exp((STATES[0]+30.0000)/15.0000)+exp(- (STATES[0]+30.0000)/15.0000));
ALGEBRAIC[0] = pow(STATES[1], 3.00000);
ALGEBRAIC[8] =  CONSTANTS[2]*ALGEBRAIC[0]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[14] =  CONSTANTS[9]*pow(STATES[5], 2.00000)*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[15] =  CONSTANTS[11]*pow(STATES[6], 2.00000)*STATES[7]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[16] =  CONSTANTS[14]*pow(STATES[8], 4.00000)*STATES[9]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[17] =  CONSTANTS[16]*STATES[10]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[18] = ( 0.800000*1.00000)/(1.00000+exp((STATES[0]+80.0000)/12.0000))+0.200000;
ALGEBRAIC[19] =  CONSTANTS[17]*ALGEBRAIC[18]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[20] =  CONSTANTS[18]*(STATES[0] - CONSTANTS[8]);
}