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 6 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 25 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is Na_ext in component concentrations (mM).
 * CONSTANTS[1] is Na_int in component concentrations (mM).
 * CONSTANTS[2] is H_ext in component concentrations (mM).
 * CONSTANTS[3] is H_int in component concentrations (mM).
 * STATES[0] is NH4_ext in component concentrations (mM).
 * CONSTANTS[4] is NH4_int in component concentrations (mM).
 * ALGEBRAIC[2] is J_NHE3_Na in component NHE3 (mM_per_s).
 * ALGEBRAIC[3] is J_NHE3_H in component NHE3 (mM_per_s).
 * ALGEBRAIC[4] is J_NHE3_NH4 in component NHE3 (mM_per_s).
 * CONSTANTS[23] is J_NHE3_Na_Max in component NHE3 (mM_per_s).
 * ALGEBRAIC[5] is plot in component fluxes (mM).
 * CONSTANTS[5] is x_T in component NHE3 (mM).
 * ALGEBRAIC[1] is sigma in component NHE3 (per_s).
 * CONSTANTS[20] is P_Na in component NHE3 (per_s).
 * CONSTANTS[21] is P_H in component NHE3 (per_s).
 * CONSTANTS[22] is P_NH4 in component NHE3 (per_s).
 * CONSTANTS[6] is P0_Na in component NHE3 (per_s).
 * CONSTANTS[7] is P0_H in component NHE3 (per_s).
 * CONSTANTS[8] is P0_NH4 in component NHE3 (per_s).
 * CONSTANTS[9] is K_Na in component NHE3 (mM).
 * CONSTANTS[10] is K_H in component NHE3 (mM).
 * CONSTANTS[11] is K_NH4 in component NHE3 (mM).
 * CONSTANTS[12] is K_I in component NHE3 (mM).
 * CONSTANTS[13] is f_m in component NHE3 (dimensionless).
 * CONSTANTS[14] is f_M in component NHE3 (dimensionless).
 * CONSTANTS[15] is alpha_ext_Na in component NHE3 (dimensionless).
 * CONSTANTS[16] is alpha_int_Na in component NHE3 (dimensionless).
 * CONSTANTS[17] is beta_ext_H in component NHE3 (dimensionless).
 * CONSTANTS[18] is beta_int_H in component NHE3 (dimensionless).
 * ALGEBRAIC[0] is gamma_ext_NH4 in component NHE3 (dimensionless).
 * CONSTANTS[19] is gamma_int_NH4 in component NHE3 (dimensionless).
 * RATES[0] is d/dt NH4_ext in component concentrations (mM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.1;
CONSTANTS[1] = 0.0;
CONSTANTS[2] = 3.1623e-5;
CONSTANTS[3] = 1.0e-3;
STATES[0] = 1.0;
CONSTANTS[4] = 0.0;
CONSTANTS[5] = 1.0;
CONSTANTS[6] = 1.6e-3;
CONSTANTS[7] = 0.48e-3;
CONSTANTS[8] = 1.6e-3;
CONSTANTS[9] = 30.0;
CONSTANTS[10] = 72e-6;
CONSTANTS[11] = 27.0;
CONSTANTS[12] = 1.0e-6;
CONSTANTS[13] = 0.0;
CONSTANTS[14] = 2.0;
CONSTANTS[15] = CONSTANTS[0]/CONSTANTS[9];
CONSTANTS[24] = 39.0000;
CONSTANTS[16] = CONSTANTS[1]/CONSTANTS[9];
CONSTANTS[17] = CONSTANTS[2]/CONSTANTS[10];
CONSTANTS[18] = CONSTANTS[3]/CONSTANTS[10];
CONSTANTS[19] = CONSTANTS[4]/CONSTANTS[11];
CONSTANTS[20] = ( CONSTANTS[6]*( CONSTANTS[14]*CONSTANTS[3]+ CONSTANTS[13]*CONSTANTS[12]))/(CONSTANTS[3]+CONSTANTS[12]);
CONSTANTS[21] = ( CONSTANTS[7]*( CONSTANTS[14]*CONSTANTS[3]+ CONSTANTS[13]*CONSTANTS[12]))/(CONSTANTS[3]+CONSTANTS[12]);
CONSTANTS[22] = ( CONSTANTS[8]*( CONSTANTS[14]*CONSTANTS[3]+ CONSTANTS[13]*CONSTANTS[12]))/(CONSTANTS[3]+CONSTANTS[12]);
CONSTANTS[23] = ( CONSTANTS[5]*CONSTANTS[20]*CONSTANTS[21])/(CONSTANTS[20]+CONSTANTS[21]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[24];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[0]/CONSTANTS[11];
ALGEBRAIC[1] =  (1.00000+CONSTANTS[15]+CONSTANTS[17]+ALGEBRAIC[0])*( CONSTANTS[20]*CONSTANTS[16]+ CONSTANTS[21]*CONSTANTS[18]+ CONSTANTS[22]*CONSTANTS[19])+ (1.00000+CONSTANTS[16]+CONSTANTS[18]+CONSTANTS[19])*( CONSTANTS[20]*CONSTANTS[15]+ CONSTANTS[21]*CONSTANTS[17]+ CONSTANTS[22]*ALGEBRAIC[0]);
ALGEBRAIC[2] =  (CONSTANTS[5]/ALGEBRAIC[1])*( CONSTANTS[20]*CONSTANTS[21]*( CONSTANTS[16]*CONSTANTS[17] -  CONSTANTS[15]*CONSTANTS[18])+ CONSTANTS[20]*CONSTANTS[22]*( CONSTANTS[16]*ALGEBRAIC[0] -  CONSTANTS[15]*CONSTANTS[19]));
ALGEBRAIC[3] =  (CONSTANTS[5]/ALGEBRAIC[1])*( CONSTANTS[20]*CONSTANTS[21]*( CONSTANTS[15]*CONSTANTS[18] -  CONSTANTS[16]*CONSTANTS[17])+ CONSTANTS[21]*CONSTANTS[22]*( CONSTANTS[18]*ALGEBRAIC[0] -  CONSTANTS[17]*CONSTANTS[19]));
ALGEBRAIC[4] =  (CONSTANTS[5]/ALGEBRAIC[1])*( CONSTANTS[20]*CONSTANTS[22]*( CONSTANTS[15]*CONSTANTS[19] -  CONSTANTS[16]*ALGEBRAIC[0])+ CONSTANTS[21]*CONSTANTS[22]*( CONSTANTS[17]*CONSTANTS[19] -  ALGEBRAIC[0]*CONSTANTS[18]));
ALGEBRAIC[5] = - 1.00000/(ALGEBRAIC[2]/CONSTANTS[23]);
}