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 13 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 24 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 (picoF).
 * CONSTANTS[1] is i_app in component membrane (picoA).
 * ALGEBRAIC[12] is i_NaP in component persistent_sodium_current (picoA).
 * ALGEBRAIC[11] is i_Na in component fast_sodium_current (picoA).
 * ALGEBRAIC[3] is i_K in component potassium_current (picoA).
 * ALGEBRAIC[9] is i_L in component leakage_current (picoA).
 * ALGEBRAIC[10] is i_tonic_e in component tonic_current (picoA).
 * CONSTANTS[2] is E_Na in component fast_sodium_current (millivolt).
 * CONSTANTS[3] is g_Na in component fast_sodium_current (nanoS).
 * ALGEBRAIC[0] is m_infinity in component fast_sodium_current_m_gate (dimensionless).
 * STATES[1] is n in component fast_sodium_current_n_gate (dimensionless).
 * CONSTANTS[4] is theta_m in component fast_sodium_current_m_gate (millivolt).
 * CONSTANTS[5] is sigma_m in component fast_sodium_current_m_gate (millivolt).
 * ALGEBRAIC[1] is n_infinity in component fast_sodium_current_n_gate (dimensionless).
 * ALGEBRAIC[2] is tau_n in component fast_sodium_current_n_gate (millisecond).
 * CONSTANTS[6] is tau_n_max in component fast_sodium_current_n_gate (millisecond).
 * CONSTANTS[7] is theta_n in component fast_sodium_current_n_gate (millivolt).
 * CONSTANTS[8] is sigma_n in component fast_sodium_current_n_gate (millivolt).
 * CONSTANTS[9] is g_K in component potassium_current (nanoS).
 * CONSTANTS[10] is E_K in component potassium_current (millivolt).
 * STATES[2] is n in component potassium_current_n_gate (dimensionless).
 * ALGEBRAIC[4] is n_infinity in component potassium_current_n_gate (dimensionless).
 * ALGEBRAIC[5] is tau_n in component potassium_current_n_gate (millisecond).
 * CONSTANTS[11] is tau_n_max in component potassium_current_n_gate (millisecond).
 * CONSTANTS[12] is theta_n in component potassium_current_n_gate (millivolt).
 * CONSTANTS[13] is sigma_n in component potassium_current_n_gate (millivolt).
 * CONSTANTS[14] is g_NaP in component persistent_sodium_current (nanoS).
 * ALGEBRAIC[6] is m_infinity in component persistent_sodium_current_m_gate (dimensionless).
 * STATES[3] is h in component persistent_sodium_current_h_gate (dimensionless).
 * CONSTANTS[15] is theta_m in component persistent_sodium_current_m_gate (millivolt).
 * CONSTANTS[16] is sigma_m in component persistent_sodium_current_m_gate (millivolt).
 * ALGEBRAIC[7] is h_infinity in component persistent_sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[8] is tau_h in component persistent_sodium_current_h_gate (millisecond).
 * CONSTANTS[17] is tau_h_max in component persistent_sodium_current_h_gate (millisecond).
 * CONSTANTS[18] is theta_h in component persistent_sodium_current_h_gate (millivolt).
 * CONSTANTS[19] is sigma_h in component persistent_sodium_current_h_gate (millivolt).
 * CONSTANTS[20] is g_L in component leakage_current (nanoS).
 * CONSTANTS[21] is E_L in component leakage_current (millivolt).
 * CONSTANTS[22] is g_tonic_e in component tonic_current (nanoS).
 * CONSTANTS[23] is E_syn_e in component tonic_current (millivolt).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt n in component fast_sodium_current_n_gate (dimensionless).
 * RATES[2] is d/dt n in component potassium_current_n_gate (dimensionless).
 * RATES[3] is d/dt h in component persistent_sodium_current_h_gate (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -50.0;
CONSTANTS[0] = 21.0;
CONSTANTS[1] = 0.0;
CONSTANTS[2] = 50.0;
CONSTANTS[3] = 28.0;
STATES[1] = 0.01;
CONSTANTS[4] = -34.0;
CONSTANTS[5] = -5.0;
CONSTANTS[6] = 10.0;
CONSTANTS[7] = -29.0;
CONSTANTS[8] = -4.0;
CONSTANTS[9] = 11.2;
CONSTANTS[10] = -85.0;
STATES[2] = 0.01;
CONSTANTS[11] = 10.0;
CONSTANTS[12] = -29.0;
CONSTANTS[13] = -4.0;
CONSTANTS[14] = 2.8;
STATES[3] = 0.46;
CONSTANTS[15] = -40.0;
CONSTANTS[16] = -6.0;
CONSTANTS[17] = 10000.0;
CONSTANTS[18] = -48.0;
CONSTANTS[19] = 6.0;
CONSTANTS[20] = 2.8;
CONSTANTS[21] = -57.5;
CONSTANTS[22] = 0.0;
CONSTANTS[23] = 0.0;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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[12]+ALGEBRAIC[11]+ALGEBRAIC[3]+ALGEBRAIC[9]+ALGEBRAIC[10])+CONSTANTS[1])/CONSTANTS[0];
resid[1] = RATES[1] - (ALGEBRAIC[1] - STATES[1])/ALGEBRAIC[2];
resid[2] = RATES[2] - (ALGEBRAIC[4] - STATES[2])/ALGEBRAIC[5];
resid[3] = RATES[3] - (ALGEBRAIC[7] - STATES[3])/ALGEBRAIC[8];
}
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[1] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[7])/CONSTANTS[8]));
ALGEBRAIC[2] = CONSTANTS[6]/cosh((STATES[0] - CONSTANTS[7])/( 2.00000*CONSTANTS[8]));
ALGEBRAIC[3] =  CONSTANTS[9]*pow(STATES[2], 4.00000)*(STATES[0] - CONSTANTS[10]);
ALGEBRAIC[4] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[12])/CONSTANTS[13]));
ALGEBRAIC[5] = CONSTANTS[11]/cosh((STATES[0] - CONSTANTS[12])/( 2.00000*CONSTANTS[13]));
ALGEBRAIC[7] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[18])/CONSTANTS[19]));
ALGEBRAIC[8] = CONSTANTS[17]/cosh((STATES[0] - CONSTANTS[18])/( 2.00000*CONSTANTS[19]));
ALGEBRAIC[9] =  CONSTANTS[20]*(STATES[0] - CONSTANTS[21]);
ALGEBRAIC[10] =  CONSTANTS[22]*(STATES[0] - CONSTANTS[23]);
ALGEBRAIC[0] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[4])/CONSTANTS[5]));
ALGEBRAIC[11] =  CONSTANTS[3]*pow(ALGEBRAIC[0], 3.00000)*(1.00000 - STATES[1])*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[15])/CONSTANTS[16]));
ALGEBRAIC[12] =  CONSTANTS[14]*ALGEBRAIC[6]*STATES[3]*(STATES[0] - CONSTANTS[2]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}