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 11 entries in the algebraic variable array.
   There are a total of 6 entries in each of the rate and state variable arrays.
   There are a total of 16 entries in the constant variable array.
 */
/*
 * ALGEBRAIC[0] is N_x in component N_x (dimensionless).
 * CONSTANTS[0] is N_0 in component model_parameters (dimensionless).
 * VOI is x in component model_parameters (mm).
 * CONSTANTS[1] is ksh in component model_parameters (per_mm).
 * STATES[0] is F_DVR_v in component F_DVR_v (nl_min).
 * ALGEBRAIC[7] is Jv in component model_parameters (nl_min_mm).
 * STATES[1] is F_DVR_GLU in component F_DVR_GLU (pmol_min).
 * ALGEBRAIC[9] is JGLU in component JGLU (pmol_min_mm).
 * STATES[2] is F_DVR_LAC in component F_DVR_LAC (pmol_min).
 * ALGEBRAIC[10] is JLAC in component JLAC (pmol_min_mm).
 * STATES[3] is F_AVR_v in component F_AVR_v (nl_min).
 * ALGEBRAIC[6] is J_ABS_V in component J_ABS_V (nl_min_mm).
 * STATES[4] is F_AVR_GLU in component F_AVR_GLU (pmol_min).
 * ALGEBRAIC[5] is JGLY in component JGLY (pmol_min_mm).
 * STATES[5] is F_AVR_LAC in component F_AVR_LAC (pmol_min).
 * CONSTANTS[2] is PGLU in component JGLU (nl_min_mm).
 * CONSTANTS[3] is sigma_GLU in component JGLU (dimensionless).
 * ALGEBRAIC[1] is c_DVR_GLU in component c_DVR_GLU (millimolar).
 * ALGEBRAIC[2] is c_AVR_GLU in component c_AVR_GLU (millimolar).
 * CONSTANTS[4] is PLAC in component JLAC (nl_min_mm).
 * CONSTANTS[5] is sigma_LAC in component JLAC (dimensionless).
 * ALGEBRAIC[4] is c_AVR_LAC in component c_AVR_LAC (millimolar).
 * ALGEBRAIC[3] is c_DVR_LAC in component c_DVR_LAC (millimolar).
 * CONSTANTS[15] is Vmax in component JGLY (pmol_min_mm).
 * CONSTANTS[6] is Km in component JGLY (millimolar).
 * CONSTANTS[7] is GlyFract in component JGLY (dimensionless).
 * CONSTANTS[14] is F_DVR_G_0 in component model_parameters (pmol_min).
 * CONSTANTS[8] is L in component model_parameters (mm).
 * CONSTANTS[13] is kv in component kv (nl_min_mm).
 * CONSTANTS[9] is VolFract in component kv (dimensionless).
 * CONSTANTS[12] is F_DVR_V_0 in component model_parameters (nl_min).
 * CONSTANTS[10] is c_DVR_GLU_0 in component model_parameters (millimolar).
 * ALGEBRAIC[8] is x_L in component model_parameters (dimensionless).
 * CONSTANTS[11] is b in component model_parameters (dimensionless).
 * RATES[0] is d/dt F_DVR_v in component F_DVR_v (nl_min).
 * RATES[1] is d/dt F_DVR_GLU in component F_DVR_GLU (pmol_min).
 * RATES[2] is d/dt F_DVR_LAC in component F_DVR_LAC (pmol_min).
 * RATES[3] is d/dt F_AVR_v in component F_AVR_v (nl_min).
 * RATES[4] is d/dt F_AVR_GLU in component F_AVR_GLU (pmol_min).
 * RATES[5] is d/dt F_AVR_LAC in component F_AVR_LAC (pmol_min).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 128.0;
CONSTANTS[1] = 1.213;
STATES[0] = 3.75;
STATES[1] = 0.01;
STATES[2] = 0.01;
STATES[3] = 0.01;
STATES[4] = 0.01;
STATES[5] = 0.01;
CONSTANTS[2] = 1.2;
CONSTANTS[3] = 0.5;
CONSTANTS[4] = 33.93;
CONSTANTS[5] = 0.5;
CONSTANTS[6] = 0.1;
CONSTANTS[7] = 0.2;
CONSTANTS[8] = 4.0;
CONSTANTS[9] = 0.3;
CONSTANTS[10] = 10.0;
CONSTANTS[11] = 4.0;
CONSTANTS[12] =  3.75000*CONSTANTS[0];
CONSTANTS[13] =  (CONSTANTS[1]/( CONSTANTS[0]*(1.00000 - exp(- ( CONSTANTS[1]*CONSTANTS[8])))))*CONSTANTS[9]*CONSTANTS[12];
CONSTANTS[14] =  CONSTANTS[12]*CONSTANTS[10];
CONSTANTS[15] =  (CONSTANTS[1]/( CONSTANTS[0]*(1.00000 - exp(- ( CONSTANTS[1]*CONSTANTS[8])))))*( CONSTANTS[7]*CONSTANTS[14]);
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - (ALGEBRAIC[7]+ CONSTANTS[1]*STATES[0]);
resid[1] = RATES[1] - - (ALGEBRAIC[9]+ CONSTANTS[1]*STATES[1]);
resid[2] = RATES[2] - - (ALGEBRAIC[10]+ CONSTANTS[1]*STATES[2]);
resid[3] = RATES[3] - ALGEBRAIC[7]+ CONSTANTS[1]*STATES[0]+ALGEBRAIC[6];
resid[4] = RATES[4] - (ALGEBRAIC[9]+ CONSTANTS[1]*STATES[1]) - ALGEBRAIC[5];
resid[5] = RATES[5] - ALGEBRAIC[10]+ CONSTANTS[1]*STATES[2]+ 2.00000*ALGEBRAIC[5];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] = STATES[2]/STATES[0];
ALGEBRAIC[8] = VOI/CONSTANTS[8];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[0]*exp(- ( CONSTANTS[1]*VOI));
ALGEBRAIC[2] = STATES[4]/STATES[3];
ALGEBRAIC[5] =  ALGEBRAIC[0]*(( CONSTANTS[15]*ALGEBRAIC[2])/(CONSTANTS[6]+ALGEBRAIC[2]));
ALGEBRAIC[6] =  CONSTANTS[13]*ALGEBRAIC[0];
ALGEBRAIC[7] =  0.300000*(STATES[0]/( CONSTANTS[0]*CONSTANTS[11]))*ALGEBRAIC[0];
ALGEBRAIC[1] = STATES[1]/STATES[0];
ALGEBRAIC[9] =  ALGEBRAIC[0]*CONSTANTS[2]*(ALGEBRAIC[1] - ALGEBRAIC[2])+ (1.00000 - CONSTANTS[3])*ALGEBRAIC[7]*((ALGEBRAIC[1]+ALGEBRAIC[2])/2.00000);
ALGEBRAIC[4] = STATES[5]/STATES[3];
ALGEBRAIC[10] =  ALGEBRAIC[0]*CONSTANTS[4]*(ALGEBRAIC[1] - ALGEBRAIC[4])+ (1.00000 - CONSTANTS[5])*ALGEBRAIC[7]*((ALGEBRAIC[1]+ALGEBRAIC[4])/2.00000);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}