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 12 entries in the algebraic variable array.
   There are a total of 4 entries in each of the rate and state variable arrays.
   There are a total of 12 entries in the constant variable array.
 */
/*
 * VOI is time in component interface_component (ms).
 * CONSTANTS[0] is IStim in component parameters (uA_per_mmsq).
 * CONSTANTS[1] is g_K_add in component parameters (mS_per_mmsq).
 * STATES[0] is V in component membrane (mV).
 * CONSTANTS[2] is V_initial in component initial_values (mV).
 * CONSTANTS[3] is Cm in component parameters (uF_per_mm2).
 * CONSTANTS[11] is IStimC in component membrane (uA_per_mm2).
 * ALGEBRAIC[0] is i_Na in component sodium_channel (uA_per_mm2).
 * CONSTANTS[4] is g_Na_max in component parameters (mS_per_mm2).
 * ALGEBRAIC[1] is g_Na in component sodium_channel (mS_per_mm2).
 * CONSTANTS[5] is E_Na in component parameters (mV).
 * STATES[1] is m in component sodium_channel_m_gate (dimensionless).
 * CONSTANTS[6] is m_initial in component initial_values (dimensionless).
 * ALGEBRAIC[2] is alpha_m in component sodium_channel_m_gate (per_ms).
 * ALGEBRAIC[5] is beta_m in component sodium_channel_m_gate (per_ms).
 * STATES[2] is h in component sodium_channel_h_gate (dimensionless).
 * CONSTANTS[7] is h_initial in component initial_values (dimensionless).
 * ALGEBRAIC[3] is alpha_h in component sodium_channel_h_gate (per_ms).
 * ALGEBRAIC[6] is beta_h in component sodium_channel_h_gate (per_ms).
 * ALGEBRAIC[10] is i_K in component potassium_channel (uA_per_mm2).
 * ALGEBRAIC[7] is g_K1 in component potassium_channel (mS_per_mm2).
 * ALGEBRAIC[9] is g_K2 in component potassium_channel (mS_per_mm2).
 * STATES[3] is n in component potassium_channel_n_gate (dimensionless).
 * CONSTANTS[8] is n_initial in component initial_values (dimensionless).
 * ALGEBRAIC[4] is alpha_n in component potassium_channel_n_gate (per_ms).
 * ALGEBRAIC[8] is beta_n in component potassium_channel_n_gate (per_ms).
 * ALGEBRAIC[11] is i_Leak in component leakage_current (uA_per_mm2).
 * CONSTANTS[9] is g_L in component parameters (mS_per_mm2).
 * CONSTANTS[10] is E_L in component parameters (mV).
 * RATES[0] is d/dt V in component membrane (mV).
 * RATES[1] is d/dt m in component sodium_channel_m_gate (dimensionless).
 * RATES[2] is d/dt h in component sodium_channel_h_gate (dimensionless).
 * RATES[3] is d/dt n in component potassium_channel_n_gate (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.0;
CONSTANTS[1] = 0.0;
CONSTANTS[2] = -73.8;
CONSTANTS[3] = 0.12;
CONSTANTS[4] = 4.0;
CONSTANTS[5] = 40.0;
CONSTANTS[6] = 0.05;
CONSTANTS[7] = 0.785;
CONSTANTS[8] = 0.0935;
CONSTANTS[9] = 0.0;
CONSTANTS[10] = -60.0;
CONSTANTS[11] = CONSTANTS[0];
STATES[0] = CONSTANTS[2];
STATES[1] = CONSTANTS[6];
STATES[2] = CONSTANTS[7];
STATES[3] = CONSTANTS[8];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = ( 0.100000*(- STATES[0] - 48.0000))/(exp((- STATES[0] - 48.0000)/15.0000) - 1.00000);
ALGEBRAIC[5] = ( 0.120000*(STATES[0]+8.00000))/(exp((STATES[0]+8.00000)/5.00000) - 1.00000);
RATES[1] =  ALGEBRAIC[2]*(1.00000 - STATES[1]) -  ALGEBRAIC[5]*STATES[1];
ALGEBRAIC[3] =  0.170000*exp((- STATES[0] - 90.0000)/20.0000);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((- STATES[0] - 42.0000)/10.0000));
RATES[2] =  ALGEBRAIC[3]*(1.00000 - STATES[2]) -  ALGEBRAIC[6]*STATES[2];
ALGEBRAIC[4] = ( 0.000100000*(- STATES[0] - 50.0000))/(exp((- STATES[0] - 50.0000)/10.0000) - 1.00000);
ALGEBRAIC[8] =  0.00200000*exp((- STATES[0] - 90.0000)/80.0000);
RATES[3] =  ALGEBRAIC[4]*(1.00000 - STATES[3]) -  ALGEBRAIC[8]*STATES[3];
ALGEBRAIC[0] =  ( CONSTANTS[4]*pow(STATES[1], 3.00000)*STATES[2]+0.00140000)*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[7] =  0.0120000*exp((- STATES[0] - 90.0000)/50.0000)+ 0.000150000*exp((STATES[0]+90.0000)/60.0000);
ALGEBRAIC[9] =  0.0120000*pow(STATES[3], 4.00000);
ALGEBRAIC[10] =  (ALGEBRAIC[7]+ALGEBRAIC[9]+CONSTANTS[1])*(STATES[0]+100.000);
ALGEBRAIC[11] =  CONSTANTS[9]*(STATES[0] - CONSTANTS[10]);
RATES[0] = (CONSTANTS[0] - (ALGEBRAIC[0]+ALGEBRAIC[10]+ALGEBRAIC[11]))/CONSTANTS[3];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = ( 0.100000*(- STATES[0] - 48.0000))/(exp((- STATES[0] - 48.0000)/15.0000) - 1.00000);
ALGEBRAIC[5] = ( 0.120000*(STATES[0]+8.00000))/(exp((STATES[0]+8.00000)/5.00000) - 1.00000);
ALGEBRAIC[3] =  0.170000*exp((- STATES[0] - 90.0000)/20.0000);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((- STATES[0] - 42.0000)/10.0000));
ALGEBRAIC[4] = ( 0.000100000*(- STATES[0] - 50.0000))/(exp((- STATES[0] - 50.0000)/10.0000) - 1.00000);
ALGEBRAIC[8] =  0.00200000*exp((- STATES[0] - 90.0000)/80.0000);
ALGEBRAIC[0] =  ( CONSTANTS[4]*pow(STATES[1], 3.00000)*STATES[2]+0.00140000)*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[7] =  0.0120000*exp((- STATES[0] - 90.0000)/50.0000)+ 0.000150000*exp((STATES[0]+90.0000)/60.0000);
ALGEBRAIC[9] =  0.0120000*pow(STATES[3], 4.00000);
ALGEBRAIC[10] =  (ALGEBRAIC[7]+ALGEBRAIC[9]+CONSTANTS[1])*(STATES[0]+100.000);
ALGEBRAIC[11] =  CONSTANTS[9]*(STATES[0] - CONSTANTS[10]);
ALGEBRAIC[1] =  pow(STATES[1], 3.00000)*STATES[2]*CONSTANTS[4];
}