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 9 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Na_int in component concentrations (mM).
 * CONSTANTS[0] is Na_ext in component concentrations (mM).
 * CONSTANTS[1] is K_int in component concentrations (mM).
 * CONSTANTS[2] is K_ext in component concentrations (mM).
 * CONSTANTS[3] is NH4_ext in component concentrations (mM).
 * ALGEBRAIC[0] is J_NaK_Na in component NaK (mM_per_s).
 * ALGEBRAIC[1] is J_NaK_K in component NaK (mM_per_s).
 * ALGEBRAIC[2] is J_NaK_NH4 in component NaK (mM_per_s).
 * CONSTANTS[5] is K_Na in component NaK (mM).
 * CONSTANTS[6] is K_K in component NaK (mM).
 * CONSTANTS[7] is K_NH4 in component NaK (mM).
 * CONSTANTS[4] is J_NaK_Na_Max in component NaK (mM_per_s).
 * RATES[0] is d/dt Na_int in component concentrations (mM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 0.0;
CONSTANTS[1] = 39.0;
CONSTANTS[2] = 10.0;
CONSTANTS[3] = 0.0;
CONSTANTS[4] = 10.8;
CONSTANTS[5] =  0.200000*(1.00000+CONSTANTS[1]/8.33000);
CONSTANTS[6] =  0.100000*(1.00000+CONSTANTS[0]/18.5000);
CONSTANTS[8] = 1.00000;
CONSTANTS[7] =  0.200000*CONSTANTS[6];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[8];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[4]*pow(STATES[0]/(STATES[0]+CONSTANTS[5]), 3.00000)*pow(CONSTANTS[2]/(CONSTANTS[2]+CONSTANTS[6]), 2.00000);
ALGEBRAIC[1] = ( (- 2.00000/3.00000)*ALGEBRAIC[0])/(1.00000+( CONSTANTS[3]*CONSTANTS[6])/( CONSTANTS[2]*CONSTANTS[7]));
ALGEBRAIC[2] =  ALGEBRAIC[1]*pow(CONSTANTS[3]/CONSTANTS[7], 1.00000)*pow(CONSTANTS[6]/CONSTANTS[2], 1.00000);
}