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 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).
 * STATES[0] is Na_ext in component concentrations (mM).
 * CONSTANTS[0] is Na_int in component concentrations (mM).
 * CONSTANTS[1] is H_ext in component concentrations (mM).
 * CONSTANTS[2] is H_int in component concentrations (mM).
 * CONSTANTS[3] 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[22] is J_NHE3_Na_Max in component NHE3 (mM_per_s).
 * ALGEBRAIC[5] is plot in component fluxes (dimensionless).
 * 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[23] 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).
 * ALGEBRAIC[0] is alpha_ext_Na in component NHE3 (dimensionless).
 * CONSTANTS[15] is alpha_int_Na in component NHE3 (dimensionless).
 * CONSTANTS[16] is beta_ext_H in component NHE3 (dimensionless).
 * CONSTANTS[17] is beta_int_H in component NHE3 (dimensionless).
 * CONSTANTS[18] is gamma_ext_NH4 in component NHE3 (dimensionless).
 * CONSTANTS[19] is gamma_int_NH4 in component NHE3 (dimensionless).
 * RATES[0] is d/dt Na_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;
CONSTANTS[0] = 0.0;
CONSTANTS[1] = 3.1623e-5;
CONSTANTS[2] = 1.0e-3;
CONSTANTS[3] = 0.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] = 100.000;
CONSTANTS[16] = CONSTANTS[1]/CONSTANTS[10];
CONSTANTS[17] = CONSTANTS[2]/CONSTANTS[10];
CONSTANTS[18] = CONSTANTS[3]/CONSTANTS[11];
CONSTANTS[19] = CONSTANTS[4]/CONSTANTS[11];
CONSTANTS[20] = ( CONSTANTS[6]*( CONSTANTS[14]*CONSTANTS[2]+ CONSTANTS[13]*CONSTANTS[12]))/(CONSTANTS[2]+CONSTANTS[12]);
CONSTANTS[21] = ( CONSTANTS[7]*( CONSTANTS[14]*CONSTANTS[2]+ CONSTANTS[13]*CONSTANTS[12]))/(CONSTANTS[2]+CONSTANTS[12]);
CONSTANTS[22] = ( CONSTANTS[5]*CONSTANTS[20]*CONSTANTS[21])/(CONSTANTS[20]+CONSTANTS[21]);
CONSTANTS[23] = ( CONSTANTS[8]*( CONSTANTS[14]*CONSTANTS[2]+ CONSTANTS[13]*CONSTANTS[12]))/(CONSTANTS[2]+CONSTANTS[12]);
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - CONSTANTS[24];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[0]/CONSTANTS[9];
ALGEBRAIC[1] =  (1.00000+ALGEBRAIC[0]+CONSTANTS[16]+CONSTANTS[18])*( CONSTANTS[20]*CONSTANTS[15]+ CONSTANTS[21]*CONSTANTS[17]+ CONSTANTS[23]*CONSTANTS[19])+ (1.00000+CONSTANTS[15]+CONSTANTS[17]+CONSTANTS[19])*( CONSTANTS[20]*ALGEBRAIC[0]+ CONSTANTS[21]*CONSTANTS[16]+ CONSTANTS[23]*CONSTANTS[18]);
ALGEBRAIC[2] =  (CONSTANTS[5]/ALGEBRAIC[1])*( CONSTANTS[20]*CONSTANTS[21]*( CONSTANTS[15]*CONSTANTS[16] -  ALGEBRAIC[0]*CONSTANTS[17])+ CONSTANTS[20]*CONSTANTS[23]*( CONSTANTS[15]*CONSTANTS[18] -  ALGEBRAIC[0]*CONSTANTS[19]));
ALGEBRAIC[3] =  (CONSTANTS[5]/ALGEBRAIC[1])*( CONSTANTS[20]*CONSTANTS[21]*( ALGEBRAIC[0]*CONSTANTS[17] -  CONSTANTS[15]*CONSTANTS[16])+ CONSTANTS[21]*CONSTANTS[23]*( CONSTANTS[17]*CONSTANTS[18] -  CONSTANTS[16]*CONSTANTS[19]));
ALGEBRAIC[4] =  (CONSTANTS[5]/ALGEBRAIC[1])*( CONSTANTS[20]*CONSTANTS[23]*( ALGEBRAIC[0]*CONSTANTS[19] -  CONSTANTS[15]*CONSTANTS[18])+ CONSTANTS[21]*CONSTANTS[23]*( CONSTANTS[16]*CONSTANTS[19] -  CONSTANTS[18]*CONSTANTS[17]));
ALGEBRAIC[5] = - STATES[0]/(ALGEBRAIC[2]/CONSTANTS[22]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}