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 6 entries in the algebraic variable array.
   There are a total of 2 entries in each of the rate and state variable arrays.
   There are a total of 13 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component V (millivolt).
 * CONSTANTS[0] is C in component V (microF_per_cm2).
 * CONSTANTS[1] is i_app in component V (microA_per_cm2).
 * ALGEBRAIC[0] is i_L in component i_L (microA_per_cm2).
 * ALGEBRAIC[5] is i_Ca in component i_Ca (microA_per_cm2).
 * ALGEBRAIC[2] is i_K in component i_K (microA_per_cm2).
 * CONSTANTS[2] is g_L in component i_L (milliS_per_cm2).
 * CONSTANTS[3] is E_L in component i_L (millivolt).
 * CONSTANTS[4] is E_Ca in component i_Ca (millivolt).
 * CONSTANTS[5] is g_Ca in component i_Ca (milliS_per_cm2).
 * ALGEBRAIC[1] is m_infinity in component i_Ca (dimensionless).
 * CONSTANTS[6] is V1 in component i_Ca (millivolt).
 * CONSTANTS[7] is V2 in component i_Ca (millivolt).
 * CONSTANTS[8] is E_K in component i_K (millivolt).
 * CONSTANTS[9] is g_K in component i_K (milliS_per_cm2).
 * STATES[1] is n in component i_K_n_gate (dimensionless).
 * ALGEBRAIC[3] is n_infinity in component i_K_n_gate (dimensionless).
 * ALGEBRAIC[4] is lambda_n in component i_K_n_gate (per_millisecond).
 * CONSTANTS[10] is lambda_n_bar in component i_K_n_gate (per_millisecond).
 * CONSTANTS[11] is V3 in component i_K_n_gate (millivolt).
 * CONSTANTS[12] is V4 in component i_K_n_gate (millivolt).
 * RATES[0] is d/dt V in component V (millivolt).
 * RATES[1] is d/dt n in component i_K_n_gate (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -50;
CONSTANTS[0] = 20.0;
CONSTANTS[1] = 300.0;
CONSTANTS[2] = 2.0;
CONSTANTS[3] = -50.00;
CONSTANTS[4] = 100.0;
CONSTANTS[5] = 4.0;
CONSTANTS[6] = 10.0;
CONSTANTS[7] = 15.0;
CONSTANTS[8] = -70.0;
CONSTANTS[9] = 8.0;
STATES[1] = 0.001;
CONSTANTS[10] = 0.066666667;
CONSTANTS[11] = -1.0;
CONSTANTS[12] = 14.5;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - (CONSTANTS[1] - (ALGEBRAIC[0]+ALGEBRAIC[5]+ALGEBRAIC[2]))/CONSTANTS[0];
resid[1] = RATES[1] -  ALGEBRAIC[4]*(ALGEBRAIC[3] - STATES[1]);
}
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[0] =  CONSTANTS[2]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[2] =  CONSTANTS[9]*STATES[1]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[3] =  0.500000*(1.00000+ tanh((STATES[0] - CONSTANTS[11])/CONSTANTS[12]));
ALGEBRAIC[4] =  CONSTANTS[10]*cosh((STATES[0] - CONSTANTS[11])/( 2.00000*CONSTANTS[12]));
ALGEBRAIC[1] =  0.500000*(1.00000+ tanh((STATES[0] - CONSTANTS[6])/CONSTANTS[7]));
ALGEBRAIC[5] =  CONSTANTS[5]*ALGEBRAIC[1]*(STATES[0] - CONSTANTS[4]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}