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 11 entries in the algebraic variable array.
   There are a total of 3 entries in each of the rate and state variable arrays.
   There are a total of 21 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 (nanoF).
 * CONSTANTS[1] is i_app in component membrane (nanoA).
 * ALGEBRAIC[8] is i_tonic_e in component tonic_current (nanoA).
 * ALGEBRAIC[9] is i_Na in component fast_sodium_current (nanoA).
 * ALGEBRAIC[10] is i_NaP in component persistent_sodium_current (nanoA).
 * ALGEBRAIC[1] is i_K in component potassium_current (nanoA).
 * ALGEBRAIC[7] is i_leak in component leakage_current (nanoA).
 * 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 potassium_current_n_gate (dimensionless).
 * CONSTANTS[4] is theta_m in component fast_sodium_current_m_gate (millivolt).
 * CONSTANTS[5] is omega_m in component fast_sodium_current_m_gate (millivolt).
 * CONSTANTS[6] is g_K in component potassium_current (nanoS).
 * CONSTANTS[7] is E_K in component potassium_current (millivolt).
 * ALGEBRAIC[2] is n_infinity in component potassium_current_n_gate (dimensionless).
 * ALGEBRAIC[3] is tau_n in component potassium_current_n_gate (millisecond).
 * CONSTANTS[8] is tau_n_max in component potassium_current_n_gate (millisecond).
 * CONSTANTS[9] is theta_n in component potassium_current_n_gate (millivolt).
 * CONSTANTS[10] is omega_n in component potassium_current_n_gate (millivolt).
 * CONSTANTS[11] is g_NaP in component persistent_sodium_current (nanoS).
 * ALGEBRAIC[4] is m_infinity in component persistent_sodium_current_m_gate (dimensionless).
 * STATES[2] is h in component persistent_sodium_current_h_gate (dimensionless).
 * CONSTANTS[12] is theta_m in component persistent_sodium_current_m_gate (millivolt).
 * CONSTANTS[13] is omega_m in component persistent_sodium_current_m_gate (millivolt).
 * ALGEBRAIC[5] is h_infinity in component persistent_sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[6] is tau_h in component persistent_sodium_current_h_gate (millisecond).
 * CONSTANTS[14] is tau_h_max in component persistent_sodium_current_h_gate (millisecond).
 * CONSTANTS[15] is theta_h in component persistent_sodium_current_h_gate (millivolt).
 * CONSTANTS[16] is omega_h in component persistent_sodium_current_h_gate (millivolt).
 * CONSTANTS[17] is g_leak in component leakage_current (nanoS).
 * CONSTANTS[18] is E_leak in component leakage_current (millivolt).
 * CONSTANTS[19] is g_tonic_e in component tonic_current (nanoS).
 * CONSTANTS[20] 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 potassium_current_n_gate (dimensionless).
 * RATES[2] 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] = 0.021;
CONSTANTS[1] = 0;
CONSTANTS[2] = 50;
CONSTANTS[3] = 28;
STATES[1] = 0.01;
CONSTANTS[4] = -34;
CONSTANTS[5] = -5;
CONSTANTS[6] = 11.2;
CONSTANTS[7] = -85;
CONSTANTS[8] = 10;
CONSTANTS[9] = -29;
CONSTANTS[10] = -4;
CONSTANTS[11] = 2.5;
STATES[2] = 0.92;
CONSTANTS[12] = -45.1;
CONSTANTS[13] = -6;
CONSTANTS[14] = 10000;
CONSTANTS[15] = -53;
CONSTANTS[16] = 6;
CONSTANTS[17] = 2.2;
CONSTANTS[18] = -57.5;
CONSTANTS[19] = 0.2;
CONSTANTS[20] = 0;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 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[9]+ALGEBRAIC[10]+ALGEBRAIC[1]+ALGEBRAIC[7])+ALGEBRAIC[8]+CONSTANTS[1])/CONSTANTS[0];
resid[1] = RATES[1] - (ALGEBRAIC[2] - STATES[1])/ALGEBRAIC[3];
resid[2] = RATES[2] - (ALGEBRAIC[5] - STATES[2])/ALGEBRAIC[6];
}
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] =  CONSTANTS[6]*pow(STATES[1], 4.00000)*(1.00000/1000.00)*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[2] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[9])/CONSTANTS[10]));
ALGEBRAIC[3] = CONSTANTS[8]/cosh((STATES[0] - CONSTANTS[9])/( 2.00000*CONSTANTS[10]));
ALGEBRAIC[5] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[15])/CONSTANTS[16]));
ALGEBRAIC[6] = CONSTANTS[14]/cosh((STATES[0] - CONSTANTS[15])/( 2.00000*CONSTANTS[16]));
ALGEBRAIC[7] =  CONSTANTS[17]*(1.00000/1000.00)*(STATES[0] - CONSTANTS[18]);
ALGEBRAIC[8] =  CONSTANTS[19]*(1.00000/1000.00)*(STATES[0] - CONSTANTS[20]);
ALGEBRAIC[0] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[4])/CONSTANTS[5]));
ALGEBRAIC[9] =  CONSTANTS[3]*pow(ALGEBRAIC[0], 3.00000)*(1.00000 - STATES[1])*(1.00000/1000.00)*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[4] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[12])/CONSTANTS[13]));
ALGEBRAIC[10] =  CONSTANTS[11]*ALGEBRAIC[4]*STATES[2]*(1.00000/1000.00)*(STATES[0] - CONSTANTS[2]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}