Generated Code

The following is c_ida 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[6] is J_AE1_HCO3 in component AE1 (mM_per_s).
 * ALGEBRAIC[7] is J_AE1_Cl in component AE1 (mM_per_s).
 * ALGEBRAIC[10] is J_HCO3_influx in component AE1 (mM_per_s).
 * ALGEBRAIC[11] 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[2] is beta_int in component AE1 (dimensionless).
 * ALGEBRAIC[3] is gamma_ext in component AE1 (dimensionless).
 * ALGEBRAIC[4] is gamma_int in component AE1 (dimensionless).
 * ALGEBRAIC[5] 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[8] is x_ext in component AE1 (mM).
 * ALGEBRAIC[9] is x_int in component AE1 (mM).
 * ALGEBRAIC[12] is Jo_bm in component AE1 (mM_per_s).
 * ALGEBRAIC[13] is Ji_bm in component AE1 (mM_per_s).
 * ALGEBRAIC[14] is Js_bm in component AE1 (mM_per_s).
 * ALGEBRAIC[15] is Jo_cm in component AE1 (mM_per_s).
 * ALGEBRAIC[16] is Ji_cm in component AE1 (mM_per_s).
 * ALGEBRAIC[17] 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).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.0;
STATES[1] = 1.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] = 1.00000;
CONSTANTS[11] = 1.00000;
CONSTANTS[12] = 0.00000;
CONSTANTS[13] = 0.00000;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - CONSTANTS[10];
resid[1] = RATES[1] - CONSTANTS[11];
resid[2] = RATES[2] - CONSTANTS[12];
resid[3] = 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] = STATES[0]/CONSTANTS[1];
ALGEBRAIC[3] = STATES[3]/CONSTANTS[2];
ALGEBRAIC[4] = STATES[2]/CONSTANTS[3];
ALGEBRAIC[5] =  (1.00000+ALGEBRAIC[1]+ALGEBRAIC[3])*( CONSTANTS[5]*ALGEBRAIC[2]+ CONSTANTS[7]*ALGEBRAIC[4])+ (1.00000+ALGEBRAIC[2]+ALGEBRAIC[4])*( CONSTANTS[4]*ALGEBRAIC[1]+ CONSTANTS[6]*ALGEBRAIC[3]);
ALGEBRAIC[6] =  (ALGEBRAIC[0]/ALGEBRAIC[5])*( CONSTANTS[5]*ALGEBRAIC[2]*CONSTANTS[6]*ALGEBRAIC[3] -  CONSTANTS[4]*ALGEBRAIC[1]*CONSTANTS[7]*ALGEBRAIC[4]);
ALGEBRAIC[7] = - ALGEBRAIC[6];
ALGEBRAIC[8] = ( ALGEBRAIC[0]*( CONSTANTS[5]*ALGEBRAIC[2]+ CONSTANTS[7]*ALGEBRAIC[4]))/ALGEBRAIC[5];
ALGEBRAIC[9] = ( ALGEBRAIC[0]*( CONSTANTS[4]*ALGEBRAIC[1]+ CONSTANTS[6]*ALGEBRAIC[3]))/ALGEBRAIC[5];
ALGEBRAIC[10] =  (ALGEBRAIC[0]/ALGEBRAIC[5])*CONSTANTS[4]*ALGEBRAIC[1]*( CONSTANTS[5]*ALGEBRAIC[2]+ CONSTANTS[7]*ALGEBRAIC[4]);
ALGEBRAIC[11] =  (ALGEBRAIC[0]/ALGEBRAIC[5])*CONSTANTS[6]*ALGEBRAIC[3]*( CONSTANTS[5]*ALGEBRAIC[2]+ CONSTANTS[7]*ALGEBRAIC[4]);
ALGEBRAIC[12] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[4]+1.00000/CONSTANTS[5]+CONSTANTS[1]/( CONSTANTS[5]*STATES[0])), - 1.00000);
ALGEBRAIC[13] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[4]+1.00000/CONSTANTS[5]+CONSTANTS[0]/( CONSTANTS[4]*STATES[1])), - 1.00000);
ALGEBRAIC[14] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[4]+1.00000/CONSTANTS[5]), - 1.00000);
ALGEBRAIC[15] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[6]+1.00000/CONSTANTS[7]+CONSTANTS[3]/( CONSTANTS[7]*STATES[2])), - 1.00000);
ALGEBRAIC[16] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[6]+1.00000/CONSTANTS[7]+CONSTANTS[2]/( CONSTANTS[6]*STATES[3])), - 1.00000);
ALGEBRAIC[17] = pow( (1.00000/ALGEBRAIC[0])*(1.00000/CONSTANTS[6]+1.00000/CONSTANTS[7]), - 1.00000);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}