Generated Code

The following is c code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 3 entries in the algebraic variable array.
   There are a total of 1 entries in each of the rate and state variable arrays.
   There are a total of 10 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is V_m in component concentrations (volt).
 * STATES[0] is Na_int in component concentrations (mM).
 * CONSTANTS[1] is Na_ext in component concentrations (mM).
 * CONSTANTS[2] is HCO3_int in component concentrations (mM).
 * CONSTANTS[3] is HCO3_ext in component concentrations (mM).
 * ALGEBRAIC[1] is J_NBC_Na in component NBC (mM_per_s).
 * ALGEBRAIC[2] is J_NBC_HCO3 in component NBC (mM_per_s).
 * CONSTANTS[4] is g_NBC in component NBC (mS_per_cm2).
 * CONSTANTS[5] is F in component NBC (coulomb_per_mmole).
 * CONSTANTS[6] is R in component NBC (joule_per_mmole_kelvin).
 * CONSTANTS[7] is T in component NBC (kelvin).
 * CONSTANTS[8] is n in component NBC (dimensionless).
 * ALGEBRAIC[0] is E_NBC in component NBC (volt).
 * RATES[0] is d/dt Na_int in component concentrations (mM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = -0.032;
STATES[0] = 15.0;
CONSTANTS[1] = 146.0;
CONSTANTS[2] = 9.0;
CONSTANTS[3] = 15.0;
CONSTANTS[4] = 0.08;
CONSTANTS[5] = 96.5;
CONSTANTS[6] = 0.008315;
CONSTANTS[7] = 300;
CONSTANTS[8] = 2;
CONSTANTS[9] = 1.00000;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[9];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  (( CONSTANTS[6]*CONSTANTS[7])/( (1.00000 - CONSTANTS[8])*CONSTANTS[5]))*log( (CONSTANTS[1]/STATES[0])*pow(CONSTANTS[3]/CONSTANTS[2], 2.00000));
ALGEBRAIC[1] = ( CONSTANTS[4]*(ALGEBRAIC[0] - CONSTANTS[0]))/CONSTANTS[5];
ALGEBRAIC[2] =  3.00000*ALGEBRAIC[1];
}