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 18 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 14 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is HCO3_int in component concentrations (mM).
 * STATES[1] is HCO3_ext in component concentrations (mM).
 * STATES[2] is Cl_int in component concentrations (mM).
 * STATES[3] is Cl_ext in component concentrations (mM).
 * ALGEBRAIC[12] is J_AE1_HCO3 in component AE1 (mM_per_s).
 * ALGEBRAIC[17] is J_AE1_Cl in component AE1 (mM_per_s).
 * ALGEBRAIC[13] is J_HCO3_influx in component AE1 (mM_per_s).
 * ALGEBRAIC[14] is J_Cl_influx in component AE1 (mM_per_s).
 * CONSTANTS[0] is K_HCO3_ext in component AE1 (mM).
 * CONSTANTS[1] is K_HCO3_int in component AE1 (mM).
 * CONSTANTS[2] is K_Cl_ext in component AE1 (mM).
 * CONSTANTS[3] is K_Cl_int in component AE1 (mM).
 * CONSTANTS[4] is P_HCO3_ext in component AE1 (per_s).
 * CONSTANTS[5] is P_HCO3_int in component AE1 (per_s).
 * CONSTANTS[6] is P_Cl_ext in component AE1 (per_s).
 * CONSTANTS[7] is P_Cl_int in component AE1 (per_s).
 * ALGEBRAIC[1] is beta_ext in component AE1 (dimensionless).
 * ALGEBRAIC[8] is beta_int in component AE1 (dimensionless).
 * ALGEBRAIC[9] is gamma_ext in component AE1 (dimensionless).
 * ALGEBRAIC[10] is gamma_int in component AE1 (dimensionless).
 * ALGEBRAIC[11] is sigma in component AE1 (per_s).
 * CONSTANTS[8] is x_Tmax in component AE1 (mM).
 * CONSTANTS[9] is K_I in component AE1 (mM).
 * ALGEBRAIC[0] is x_T in component AE1 (mM).
 * ALGEBRAIC[15] is x_ext in component AE1 (mM).
 * ALGEBRAIC[16] is x_int in component AE1 (mM).
 * ALGEBRAIC[2] is Jo_bm in component AE1 (mM_per_s).
 * ALGEBRAIC[3] is Ji_bm in component AE1 (mM_per_s).
 * ALGEBRAIC[4] is Js_bm in component AE1 (mM_per_s).
 * ALGEBRAIC[5] is Jo_cm in component AE1 (mM_per_s).
 * ALGEBRAIC[6] is Ji_cm in component AE1 (mM_per_s).
 * ALGEBRAIC[7] is Js_cm in component AE1 (mM_per_s).
 * RATES[0] is d/dt HCO3_int in component concentrations (mM).
 * RATES[1] is d/dt HCO3_ext in component concentrations (mM).
 * RATES[2] is d/dt Cl_int in component concentrations (mM).
 * RATES[3] is d/dt Cl_ext in component concentrations (mM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 165.0;
STATES[1] = 0.0;
STATES[2] = 0.0;
STATES[3] = 0.0;
CONSTANTS[0] = 198;
CONSTANTS[1] = 198;
CONSTANTS[2] = 50;
CONSTANTS[3] = 50;
CONSTANTS[4] = 1247;
CONSTANTS[5] = 135;
CONSTANTS[6] = 562;
CONSTANTS[7] = 61;
CONSTANTS[8] = 1;
CONSTANTS[9] = 172;
CONSTANTS[10] = 0.00000;
CONSTANTS[11] = 1.00000;
CONSTANTS[12] = 0.00000;
CONSTANTS[13] = 0.00000;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[10];
RATES[1] = CONSTANTS[11];
RATES[2] = CONSTANTS[12];
RATES[3] = CONSTANTS[13];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = CONSTANTS[8]/(1.00000+STATES[0]/CONSTANTS[9]);
ALGEBRAIC[1] = STATES[1]/CONSTANTS[0];
ALGEBRAIC[2] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[4]+1.00000/CONSTANTS[5]+CONSTANTS[1]/( CONSTANTS[5]*STATES[0])), - 1.00000);
ALGEBRAIC[3] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[4]+1.00000/CONSTANTS[5]+CONSTANTS[0]/( CONSTANTS[4]*STATES[1])), - 1.00000);
ALGEBRAIC[4] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[4]+1.00000/CONSTANTS[5]), - 1.00000);
ALGEBRAIC[5] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[6]+1.00000/CONSTANTS[7]+CONSTANTS[3]/( CONSTANTS[7]*STATES[2])), - 1.00000);
ALGEBRAIC[6] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[6]+1.00000/CONSTANTS[7]+CONSTANTS[2]/( CONSTANTS[6]*STATES[3])), - 1.00000);
ALGEBRAIC[7] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[6]+1.00000/CONSTANTS[7]), - 1.00000);
ALGEBRAIC[8] = STATES[0]/CONSTANTS[1];
ALGEBRAIC[9] = STATES[3]/CONSTANTS[2];
ALGEBRAIC[10] = STATES[2]/CONSTANTS[3];
ALGEBRAIC[11] =  (1.00000+ALGEBRAIC[1]+ALGEBRAIC[9])*( CONSTANTS[5]*ALGEBRAIC[8]+ CONSTANTS[7]*ALGEBRAIC[10])+ (1.00000+ALGEBRAIC[8]+ALGEBRAIC[10])*( CONSTANTS[4]*ALGEBRAIC[1]+ CONSTANTS[6]*ALGEBRAIC[9]);
ALGEBRAIC[12] =  (ALGEBRAIC[0]/ALGEBRAIC[11])*( CONSTANTS[5]*ALGEBRAIC[8]*CONSTANTS[6]*ALGEBRAIC[9] -  CONSTANTS[4]*ALGEBRAIC[1]*CONSTANTS[7]*ALGEBRAIC[10]);
ALGEBRAIC[13] =  (ALGEBRAIC[0]/ALGEBRAIC[11])*CONSTANTS[4]*ALGEBRAIC[1]*( CONSTANTS[5]*ALGEBRAIC[8]+ CONSTANTS[7]*ALGEBRAIC[10]);
ALGEBRAIC[14] =  (ALGEBRAIC[0]/ALGEBRAIC[11])*CONSTANTS[6]*ALGEBRAIC[9]*( CONSTANTS[5]*ALGEBRAIC[8]+ CONSTANTS[7]*ALGEBRAIC[10]);
ALGEBRAIC[15] = ( ALGEBRAIC[0]*( CONSTANTS[5]*ALGEBRAIC[8]+ CONSTANTS[7]*ALGEBRAIC[10]))/ALGEBRAIC[11];
ALGEBRAIC[16] = ( ALGEBRAIC[0]*( CONSTANTS[4]*ALGEBRAIC[1]+ CONSTANTS[6]*ALGEBRAIC[9]))/ALGEBRAIC[11];
ALGEBRAIC[17] = - ALGEBRAIC[12];
}