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 13 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 14 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * CONSTANTS[0] is alpha in component model_constants (dimensionless).
 * CONSTANTS[1] is lamda in component model_constants (dimensionless).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[2] is Cm in component membrane (microF_per_cm2).
 * ALGEBRAIC[8] is i_Ca_T in component T_type_calcium_current (microA_per_cm2).
 * ALGEBRAIC[9] is i_Ca_L in component L_type_calcium_current (microA_per_cm2).
 * ALGEBRAIC[11] is i_Ca_K in component calcium_activated_potassium_current (microA_per_cm2).
 * ALGEBRAIC[10] is i_K in component potassium_current (microA_per_cm2).
 * ALGEBRAIC[12] is i_Cl in component leak_chloride_current (microA_per_cm2).
 * ALGEBRAIC[0] is V_tilde in component gate_voltage (millivolt).
 * CONSTANTS[3] is E_Ca in component T_type_calcium_current (millivolt).
 * CONSTANTS[4] is g_Ca_T in component T_type_calcium_current (milliS_per_cm2).
 * ALGEBRAIC[7] is m in component T_type_calcium_current_m_gate (dimensionless).
 * STATES[1] is h in component T_type_calcium_current_h_gate (dimensionless).
 * ALGEBRAIC[1] is alpha_m in component T_type_calcium_current_m_gate (per_millisecond).
 * ALGEBRAIC[4] is beta_m in component T_type_calcium_current_m_gate (per_millisecond).
 * ALGEBRAIC[2] is alpha_h in component T_type_calcium_current_h_gate (per_millisecond).
 * ALGEBRAIC[5] is beta_h in component T_type_calcium_current_h_gate (per_millisecond).
 * CONSTANTS[5] is g_Ca_L in component L_type_calcium_current (milliS_per_cm2).
 * STATES[2] is x_Ca in component L_type_calcium_current_x_Ca_gate (dimensionless).
 * CONSTANTS[6] is tau_x_Ca in component L_type_calcium_current_x_Ca_gate (millisecond).
 * CONSTANTS[7] is E_K in component potassium_current (millivolt).
 * CONSTANTS[8] is g_K in component potassium_current (milliS_per_cm2).
 * STATES[3] is n in component potassium_current_n_gate (dimensionless).
 * ALGEBRAIC[3] is alpha_n in component potassium_current_n_gate (per_millisecond).
 * ALGEBRAIC[6] is beta_n in component potassium_current_n_gate (per_millisecond).
 * STATES[4] is Ca in component calcium_activated_potassium_current (millimolar).
 * CONSTANTS[9] is g_Ca_K in component calcium_activated_potassium_current (milliS_per_cm2).
 * CONSTANTS[10] is rho in component calcium_activated_potassium_current (per_millisecond).
 * CONSTANTS[11] is K_c in component calcium_activated_potassium_current (millimolar_per_millivolt).
 * CONSTANTS[12] is g_Cl in component leak_chloride_current (milliS_per_cm2).
 * CONSTANTS[13] is E_Cl in component leak_chloride_current (millivolt).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt h in component T_type_calcium_current_h_gate (dimensionless).
 * RATES[2] is d/dt x_Ca in component L_type_calcium_current_x_Ca_gate (dimensionless).
 * RATES[3] is d/dt n in component potassium_current_n_gate (dimensionless).
 * RATES[4] is d/dt Ca in component calcium_activated_potassium_current (millimolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.12;
CONSTANTS[1] = 12.5;
STATES[0] = -55.0;
CONSTANTS[2] = 2.5;
CONSTANTS[3] = 80.0;
CONSTANTS[4] = 0.51;
STATES[1] = 0.01;
CONSTANTS[5] = 0.004;
STATES[2] = 0.01;
CONSTANTS[6] = 500.0;
CONSTANTS[7] = -75.0;
CONSTANTS[8] = 0.3;
STATES[3] = 0.01;
STATES[4] = 1E-4;
CONSTANTS[9] = 0.03;
CONSTANTS[10] = 0.125E3;
CONSTANTS[11] = 425.0E-5;
CONSTANTS[12] = 0.003;
CONSTANTS[13] = -40.0;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[4] =  (CONSTANTS[10]/CONSTANTS[0])*( CONSTANTS[11]*STATES[2]*(CONSTANTS[3] - STATES[0]) - STATES[4]);
ALGEBRAIC[0] = ( 127.000*STATES[0]+8265.00)/105.000;
RATES[2] = (1.00000/(1.00000+exp( 0.150000*(- ALGEBRAIC[0] - 50.0000))) - STATES[2])/( CONSTANTS[0]*CONSTANTS[6]);
ALGEBRAIC[2] =  0.0700000*exp((25.0000 - ALGEBRAIC[0])/20.0000);
ALGEBRAIC[5] = 1.00000/(1.00000+exp(5.50000 -  ALGEBRAIC[0]*0.100000));
RATES[1] = ( ALGEBRAIC[2]*(1.00000 - STATES[1]) -  ALGEBRAIC[5]*STATES[1])/( CONSTANTS[0]*CONSTANTS[1]);
ALGEBRAIC[3] = ( 0.0100000*(55.0000 - ALGEBRAIC[0]))/(exp((55.0000 - ALGEBRAIC[0])/10.0000) - 1.00000);
ALGEBRAIC[6] =  0.125000*exp((45.0000 - ALGEBRAIC[0])/80.0000);
RATES[3] = ( ALGEBRAIC[3]*(1.00000 - STATES[3]) -  ALGEBRAIC[6]*STATES[3])/( CONSTANTS[0]*CONSTANTS[1]);
ALGEBRAIC[1] = ( 0.100000*(50.0000 - ALGEBRAIC[0]))/(exp(5.00000 -  ALGEBRAIC[0]*0.100000) - 1.00000);
ALGEBRAIC[4] =  4.00000*exp((25.0000 - ALGEBRAIC[0])/18.0000);
ALGEBRAIC[7] = ALGEBRAIC[1]/(ALGEBRAIC[1]+ALGEBRAIC[4]);
ALGEBRAIC[8] =  CONSTANTS[4]*pow(ALGEBRAIC[7], 3.00000)*STATES[1]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[9] =  CONSTANTS[5]*STATES[2]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[11] = ( CONSTANTS[9]*STATES[4]*(STATES[0] - CONSTANTS[7]))/(0.500000+STATES[4]);
ALGEBRAIC[10] =  CONSTANTS[8]*pow(STATES[3], 4.00000)*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[12] =  CONSTANTS[12]*(STATES[0] - CONSTANTS[13]);
RATES[0] =  - (1.00000/( CONSTANTS[2]*CONSTANTS[0]))*(ALGEBRAIC[8]+ALGEBRAIC[9]+ALGEBRAIC[11]+ALGEBRAIC[10]+ALGEBRAIC[12]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = ( 127.000*STATES[0]+8265.00)/105.000;
ALGEBRAIC[2] =  0.0700000*exp((25.0000 - ALGEBRAIC[0])/20.0000);
ALGEBRAIC[5] = 1.00000/(1.00000+exp(5.50000 -  ALGEBRAIC[0]*0.100000));
ALGEBRAIC[3] = ( 0.0100000*(55.0000 - ALGEBRAIC[0]))/(exp((55.0000 - ALGEBRAIC[0])/10.0000) - 1.00000);
ALGEBRAIC[6] =  0.125000*exp((45.0000 - ALGEBRAIC[0])/80.0000);
ALGEBRAIC[1] = ( 0.100000*(50.0000 - ALGEBRAIC[0]))/(exp(5.00000 -  ALGEBRAIC[0]*0.100000) - 1.00000);
ALGEBRAIC[4] =  4.00000*exp((25.0000 - ALGEBRAIC[0])/18.0000);
ALGEBRAIC[7] = ALGEBRAIC[1]/(ALGEBRAIC[1]+ALGEBRAIC[4]);
ALGEBRAIC[8] =  CONSTANTS[4]*pow(ALGEBRAIC[7], 3.00000)*STATES[1]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[9] =  CONSTANTS[5]*STATES[2]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[11] = ( CONSTANTS[9]*STATES[4]*(STATES[0] - CONSTANTS[7]))/(0.500000+STATES[4]);
ALGEBRAIC[10] =  CONSTANTS[8]*pow(STATES[3], 4.00000)*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[12] =  CONSTANTS[12]*(STATES[0] - CONSTANTS[13]);
}