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 8 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 22 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is C_ext_Na in component Concentrations (mM).
 * ALGEBRAIC[0] is C_ext_H in component Concentrations (mM).
 * CONSTANTS[1] is C_ext_NH4 in component Concentrations (mM).
 * CONSTANTS[2] is C_int_Na in component Concentrations (mM).
 * CONSTANTS[3] is C_int_H in component Concentrations (mM).
 * CONSTANTS[4] is C_int_NH4 in component Concentrations (mM).
 * STATES[0] is pH_ext in component Concentrations (dimensionless).
 * CONSTANTS[5] is XTxP0_NHE3_Na in component NHE3_Parameters (nmol_per_s_per_cm2).
 * CONSTANTS[6] is XTxP0_NHE3_H in component NHE3_Parameters (nmol_per_s_per_cm2).
 * CONSTANTS[7] is XTxP0_NHE3_NH4 in component NHE3_Parameters (nmol_per_s_per_cm2).
 * CONSTANTS[8] is K_NHE3_Na in component NHE3_Parameters (mM).
 * CONSTANTS[9] is K_NHE3_H in component NHE3_Parameters (mM).
 * CONSTANTS[10] is K_NHE3_NH4 in component NHE3_Parameters (mM).
 * CONSTANTS[16] is XTxP_NHE_Na in component NHE3 (nmol_per_s_per_cm2).
 * CONSTANTS[17] is XTxP_NHE_H in component NHE3 (nmol_per_s_per_cm2).
 * CONSTANTS[18] is XTxP_NHE_NH4 in component NHE3 (nmol_per_s_per_cm2).
 * CONSTANTS[11] is alpha_ext_Na in component NHE3 (dimensionless).
 * ALGEBRAIC[1] is beta_ext_H in component NHE3 (dimensionless).
 * CONSTANTS[12] is gamma_ext_NH4 in component NHE3 (dimensionless).
 * CONSTANTS[13] is alpha_int_Na in component NHE3 (dimensionless).
 * CONSTANTS[14] is beta_int_H in component NHE3 (dimensionless).
 * CONSTANTS[15] is gamma_int_NH4 in component NHE3 (dimensionless).
 * ALGEBRAIC[2] is sum_NHE3 in component NHE3 (nmol_per_s_per_cm2).
 * ALGEBRAIC[3] is J_NHE3_Na in component NHE3 (nmol_per_s_per_cm2).
 * ALGEBRAIC[4] is J_NHE3_H in component NHE3 (nmol_per_s_per_cm2).
 * ALGEBRAIC[5] is J_NHE3_NH4 in component NHE3 (nmol_per_s_per_cm2).
 * CONSTANTS[20] is J_NHE3_Na_Max in component NHE3 (nmol_per_s_per_cm2).
 * ALGEBRAIC[7] is plot_b in component NHE3 (dimensionless).
 * ALGEBRAIC[6] is plot_a in component NHE3 (dimensionless).
 * CONSTANTS[19] is K_H in component NHE3 (dimensionless).
 * RATES[0] is d/dt pH_ext in component Concentrations (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.1;
CONSTANTS[1] = 0;
CONSTANTS[2] = 0;
CONSTANTS[3] = 1e-3;
CONSTANTS[4] = 0;
STATES[0] = 6;
CONSTANTS[5] = 1.6e-3;
CONSTANTS[6] = 0.48e-3;
CONSTANTS[7] = 1.6e-3;
CONSTANTS[8] = 30;
CONSTANTS[9] = 72e-6;
CONSTANTS[10] = 0.027e3;
CONSTANTS[11] = CONSTANTS[0]/CONSTANTS[8];
CONSTANTS[21] = 2.00000;
CONSTANTS[12] = CONSTANTS[1]/CONSTANTS[10];
CONSTANTS[13] = CONSTANTS[2]/CONSTANTS[8];
CONSTANTS[14] = CONSTANTS[3]/CONSTANTS[9];
CONSTANTS[15] = CONSTANTS[4]/CONSTANTS[10];
CONSTANTS[16] = ( CONSTANTS[5]*2.00000*CONSTANTS[3])/(CONSTANTS[3]+1.00000e-06);
CONSTANTS[17] = ( CONSTANTS[6]*2.00000*CONSTANTS[3])/(CONSTANTS[3]+1.00000e-06);
CONSTANTS[18] = ( CONSTANTS[7]*2.00000*CONSTANTS[3])/(CONSTANTS[3]+1.00000e-06);
CONSTANTS[19] = ( (1.00000+CONSTANTS[11])*CONSTANTS[14]+( (1.00000+CONSTANTS[14])*CONSTANTS[11]*CONSTANTS[16])/CONSTANTS[17])/(1.00000+ 2.00000*CONSTANTS[14]);
CONSTANTS[20] = ( CONSTANTS[16]*CONSTANTS[17])/(CONSTANTS[16]+CONSTANTS[17]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[21];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  1000.00*pow(10.0000, - STATES[0]);
ALGEBRAIC[1] = ALGEBRAIC[0]/CONSTANTS[9];
ALGEBRAIC[2] =  (1.00000+CONSTANTS[11]+ALGEBRAIC[1]+CONSTANTS[12])*( CONSTANTS[16]*CONSTANTS[13]+ CONSTANTS[17]*CONSTANTS[14]+ CONSTANTS[18]*CONSTANTS[15])+ (1.00000+CONSTANTS[13]+CONSTANTS[14]+CONSTANTS[15])*( CONSTANTS[16]*CONSTANTS[11]+ CONSTANTS[17]*ALGEBRAIC[1]+ CONSTANTS[18]*CONSTANTS[12]);
ALGEBRAIC[3] =  (( CONSTANTS[16]*CONSTANTS[17])/ALGEBRAIC[2])*( CONSTANTS[11]*CONSTANTS[14] -  CONSTANTS[13]*ALGEBRAIC[1])+ (( CONSTANTS[16]*CONSTANTS[18])/ALGEBRAIC[2])*( CONSTANTS[11]*CONSTANTS[15] -  CONSTANTS[13]*CONSTANTS[12]);
ALGEBRAIC[4] =  (( CONSTANTS[16]*CONSTANTS[17])/ALGEBRAIC[2])*( CONSTANTS[13]*ALGEBRAIC[1] -  CONSTANTS[11]*CONSTANTS[14])+ (( CONSTANTS[17]*CONSTANTS[18])/ALGEBRAIC[2])*( ALGEBRAIC[1]*CONSTANTS[15] -  CONSTANTS[14]*CONSTANTS[12]);
ALGEBRAIC[5] =  (( CONSTANTS[16]*CONSTANTS[18])/ALGEBRAIC[2])*( CONSTANTS[13]*CONSTANTS[12] -  CONSTANTS[11]*CONSTANTS[15])+ (( CONSTANTS[17]*CONSTANTS[18])/ALGEBRAIC[2])*( CONSTANTS[12]*CONSTANTS[14] -  ALGEBRAIC[1]*CONSTANTS[15]);
ALGEBRAIC[6] = ALGEBRAIC[3]/CONSTANTS[20];
ALGEBRAIC[7] = 1.00000/ALGEBRAIC[6];
}