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 10 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 Cm in component membrane (femtofarad).
 * ALGEBRAIC[9] is Ica in component Ica (femtoampere).
 * ALGEBRAIC[1] is Is1 in component Is1 (femtoampere).
 * ALGEBRAIC[7] is Is2 in component Is2 (femtoampere).
 * ALGEBRAIC[6] is Il in component Il (femtoampere).
 * ALGEBRAIC[3] is Ik in component Ik (femtoampere).
 * CONSTANTS[1] is gCa in component Ica (picosiemens).
 * CONSTANTS[2] is VCa in component Ica (millivolt).
 * ALGEBRAIC[0] is m_infinity in component m (dimensionless).
 * CONSTANTS[3] is vm in component m (millivolt).
 * CONSTANTS[4] is sm in component m (millivolt).
 * CONSTANTS[5] is gs1 in component Is1 (picosiemens).
 * CONSTANTS[6] is VK in component Ik (millivolt).
 * STATES[1] is s1 in component s1 (dimensionless).
 * ALGEBRAIC[2] is s1_infinity in component s1 (dimensionless).
 * CONSTANTS[7] is autos1 in component s1 (dimensionless).
 * CONSTANTS[8] is s1knot in component s1 (dimensionless).
 * CONSTANTS[9] is tau_s1 in component s1 (millisecond).
 * CONSTANTS[10] is vs1 in component s1 (millivolt).
 * CONSTANTS[11] is ss1 in component s1 (millivolt).
 * CONSTANTS[12] is gK in component Ik (picosiemens).
 * STATES[2] is n in component n (dimensionless).
 * ALGEBRAIC[4] is n_infinity in component n (dimensionless).
 * CONSTANTS[13] is tau_n_bar in component n (millisecond).
 * ALGEBRAIC[5] is tau_n in component n (millisecond).
 * CONSTANTS[14] is vn in component n (millivolt).
 * CONSTANTS[15] is sn in component n (millivolt).
 * CONSTANTS[16] is gl in component Il (picosiemens).
 * CONSTANTS[17] is Vl in component Il (millivolt).
 * CONSTANTS[18] is gs2 in component Is2 (picosiemens).
 * STATES[3] is s2 in component s2 (dimensionless).
 * ALGEBRAIC[8] is s2_infinity in component s2 (dimensionless).
 * CONSTANTS[19] is autos2 in component s2 (dimensionless).
 * CONSTANTS[20] is s2knot in component s2 (dimensionless).
 * CONSTANTS[21] is tau_s2 in component s2 (millisecond).
 * CONSTANTS[22] is vs2 in component s2 (millivolt).
 * CONSTANTS[23] is ss2 in component s2 (millivolt).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt s1 in component s1 (dimensionless).
 * RATES[2] is d/dt n in component n (dimensionless).
 * RATES[3] is d/dt s2 in component s2 (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -40.0;
CONSTANTS[0] = 4525.0;
CONSTANTS[1] = 280.0;
CONSTANTS[2] = 100.0;
CONSTANTS[3] = -22.0;
CONSTANTS[4] = 7.5;
CONSTANTS[5] = 20.0;
CONSTANTS[6] = -80.0;
STATES[1] = 0.9;
CONSTANTS[7] = 1;
CONSTANTS[8] = 1;
CONSTANTS[9] = 1000.0;
CONSTANTS[10] = -50.0;
CONSTANTS[11] = 5;
CONSTANTS[12] = 1300.0;
STATES[2] = 0.0;
CONSTANTS[13] = 8.25;
CONSTANTS[14] = -9.0;
CONSTANTS[15] = 10.0;
CONSTANTS[16] = 25.0;
CONSTANTS[17] = -40.0;
CONSTANTS[18] = 16;
STATES[3] = 0.5;
CONSTANTS[19] = 1;
CONSTANTS[20] = 0.49;
CONSTANTS[21] = 30000.0;
CONSTANTS[22] = -40.0;
CONSTANTS[23] = 15;
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[9]+ALGEBRAIC[1]+ALGEBRAIC[7]+ALGEBRAIC[6]+ALGEBRAIC[3])/CONSTANTS[0];
resid[1] = RATES[1] -  CONSTANTS[7]*((ALGEBRAIC[2] - STATES[1])/CONSTANTS[9])+ (1.00000 - CONSTANTS[7])*(CONSTANTS[8] - STATES[1]);
resid[2] = RATES[2] - (ALGEBRAIC[4] - STATES[2])/ALGEBRAIC[5];
resid[3] = RATES[3] -  CONSTANTS[19]*((ALGEBRAIC[8] - STATES[3])/CONSTANTS[21])+ (1.00000 - CONSTANTS[19])*(CONSTANTS[20] - STATES[3]);
}
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[5]*STATES[1]*(STATES[0] - CONSTANTS[6]);
ALGEBRAIC[2] = 1.00000/(1.00000+exp((CONSTANTS[10] - STATES[0])/CONSTANTS[11]));
ALGEBRAIC[3] =  CONSTANTS[12]*STATES[2]*(STATES[0] - CONSTANTS[6]);
ALGEBRAIC[4] = 1.00000/(1.00000+exp((CONSTANTS[14] - STATES[0])/CONSTANTS[15]));
ALGEBRAIC[5] = CONSTANTS[13]/(1.00000+exp((STATES[0] - CONSTANTS[14])/CONSTANTS[15]));
ALGEBRAIC[6] =  CONSTANTS[16]*(STATES[0] - CONSTANTS[17]);
ALGEBRAIC[7] =  CONSTANTS[18]*STATES[3]*(STATES[0] - CONSTANTS[6]);
ALGEBRAIC[8] = 1.00000/(1.00000+exp((CONSTANTS[22] - STATES[0])/CONSTANTS[23]));
ALGEBRAIC[0] = 1.00000/(1.00000+exp((CONSTANTS[3] - STATES[0])/CONSTANTS[4]));
ALGEBRAIC[9] =  CONSTANTS[1]*ALGEBRAIC[0]*(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)
{
}