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 4 entries in each of the rate and state variable arrays.
   There are a total of 23 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 (picofarad).
 * ALGEBRAIC[7] is I_Ca in component I_Ca (picoampere).
 * ALGEBRAIC[0] is I_K in component I_K (picoampere).
 * ALGEBRAIC[8] is I_SK in component I_SK (picoampere).
 * ALGEBRAIC[10] is I_DA in component I_DA (picoampere).
 * CONSTANTS[1] is gK in component I_K (nanosiemens).
 * CONSTANTS[2] is VK in component model_parameters (millivolt).
 * STATES[1] is n in component n (dimensionless).
 * ALGEBRAIC[1] is n_infinity in component n (dimensionless).
 * CONSTANTS[3] is lambda in component n (dimensionless).
 * CONSTANTS[4] is tau_n in component n (millisecond).
 * CONSTANTS[5] is vn in component n (millivolt).
 * CONSTANTS[6] is sn in component n (millivolt).
 * CONSTANTS[7] is gCa in component I_Ca (nanosiemens).
 * CONSTANTS[8] is VCa in component model_parameters (millivolt).
 * ALGEBRAIC[2] is m_infinity in component m (dimensionless).
 * CONSTANTS[9] is vm in component m (millivolt).
 * CONSTANTS[10] is sm in component m (millivolt).
 * CONSTANTS[11] is gSK in component I_SK (nanosiemens).
 * ALGEBRAIC[3] is s_infinity in component I_SK (dimensionless).
 * CONSTANTS[12] is ks in component I_SK (micromolar).
 * STATES[2] is Ca in component Ca (micromolar).
 * ALGEBRAIC[9] is I_BK in component I_DA (picoampere).
 * CONSTANTS[13] is gBK in component I_DA (nanosiemens).
 * ALGEBRAIC[4] is f_infinity in component f (dimensionless).
 * CONSTANTS[14] is vf in component f (millivolt).
 * CONSTANTS[15] is sf in component f (millivolt).
 * STATES[3] is h in component h (dimensionless).
 * ALGEBRAIC[5] is h_infinity in component h (dimensionless).
 * CONSTANTS[16] is tau_h in component h (millisecond).
 * CONSTANTS[17] is vh in component h (millivolt).
 * CONSTANTS[18] is sh in component h (millivolt).
 * CONSTANTS[19] is fc in component Ca (dimensionless).
 * CONSTANTS[20] is alpha in component Ca (micromolar_femtocoulomb).
 * CONSTANTS[21] is kc in component Ca (first_order_rate_constant).
 * ALGEBRAIC[6] is PRL in component PRL (dimensionless).
 * CONSTANTS[22] is kPRL in component PRL (micromolar_4).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt n in component n (dimensionless).
 * RATES[3] is d/dt h in component h (dimensionless).
 * RATES[2] is d/dt Ca in component Ca (micromolar).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -60;
CONSTANTS[0] = 10;
CONSTANTS[1] = 4;
CONSTANTS[2] = -75;
STATES[1] = 0.1;
CONSTANTS[3] = 0.7;
CONSTANTS[4] = 30;
CONSTANTS[5] = -5;
CONSTANTS[6] = 10;
CONSTANTS[7] = 2;
CONSTANTS[8] = 50;
CONSTANTS[9] = -20;
CONSTANTS[10] = 12;
CONSTANTS[11] = 1.7;
CONSTANTS[12] = 0.5;
STATES[2] = 0.1;
CONSTANTS[13] = 0.2;
CONSTANTS[14] = -20;
CONSTANTS[15] = 5.6;
STATES[3] = 0.1;
CONSTANTS[16] = 20;
CONSTANTS[17] = -60;
CONSTANTS[18] = 5;
CONSTANTS[19] = 0.01;
CONSTANTS[20] = 0.0015;
CONSTANTS[21] = 0.16;
CONSTANTS[22] = 1;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[3] = 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[7]+ALGEBRAIC[0]+ALGEBRAIC[8]+ALGEBRAIC[10])/CONSTANTS[0];
resid[1] = RATES[1] - ( CONSTANTS[3]*(ALGEBRAIC[1] - STATES[1]))/CONSTANTS[4];
resid[2] = RATES[3] - (ALGEBRAIC[5] - STATES[3])/CONSTANTS[16];
resid[3] = RATES[2] -  - CONSTANTS[19]*( CONSTANTS[20]*ALGEBRAIC[7]+ CONSTANTS[21]*STATES[2]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[6] =  CONSTANTS[22]*pow(STATES[2], 4.00000);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[1]*STATES[1]*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[1] = 1.00000/(1.00000+exp((CONSTANTS[5] - STATES[0])/CONSTANTS[6]));
ALGEBRAIC[5] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[17])/CONSTANTS[18]));
ALGEBRAIC[2] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[7] =  CONSTANTS[7]*ALGEBRAIC[2]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[3] = pow(STATES[2], 2.00000)/(pow(STATES[2], 2.00000)+pow(CONSTANTS[12], 2.00000));
ALGEBRAIC[8] =  CONSTANTS[11]*ALGEBRAIC[3]*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[4] = 1.00000/(1.00000+exp((CONSTANTS[14] - STATES[0])/CONSTANTS[15]));
ALGEBRAIC[9] =  CONSTANTS[13]*ALGEBRAIC[4]*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[10] = ALGEBRAIC[9];
}
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)
{
}