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 3 entries in the algebraic variable array.
   There are a total of 13 entries in each of the rate and state variable arrays.
   There are a total of 30 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is cAMP in component cAMP (nmol_g).
 * CONSTANTS[0] is Ko in component cAMP (dimensionless).
 * CONSTANTS[1] is Ka in component cAMP (per_nanomolar).
 * CONSTANTS[2] is Kb in component cAMP (per_nanomolar).
 * CONSTANTS[3] is Kdsm in component cAMP (nmol_g).
 * CONSTANTS[4] is Vmsm in component cAMP (flux).
 * CONSTANTS[5] is Vdsm in component cAMP (flux).
 * ALGEBRAIC[0] is ACTH in component cAMP (picomolar).
 * ALGEBRAIC[1] is IS in component IS (nmol_g).
 * CONSTANTS[6] is Crpt in component IS (nmol_g).
 * CONSTANTS[7] is K in component IS (dimensionless).
 * CONSTANTS[8] is Kd in component IS (nmol_g).
 * CONSTANTS[9] is n in component IS (dimensionless).
 * STATES[1] is V in component V (flux).
 * CONSTANTS[10] is P in component V (minute_2).
 * CONSTANTS[11] is Q in component V (first_order_rate_constant).
 * STATES[2] is W in component W (flux).
 * CONSTANTS[12] is T in component W (nmol2_min2_g2).
 * CONSTANTS[13] is U in component W (first_order_rate_constant).
 * STATES[3] is CHOC in component CHOC (nmol_g).
 * CONSTANTS[14] is Lmtr in component model_parameters (first_order_rate_constant).
 * STATES[4] is Kmtr in component Kmtr (first_order_rate_constant).
 * STATES[5] is CHOM in component CHOM (nmol_g).
 * CONSTANTS[15] is Kbac in component model_parameters (first_order_rate_constant).
 * STATES[6] is Kfor in component Kfor (first_order_rate_constant).
 * CONSTANTS[16] is Kcb in component model_parameters (first_order_rate_constant).
 * CONSTANTS[17] is Kcf in component model_parameters (first_order_rate_constant).
 * STATES[7] is CHON in component CHON (nmol_g).
 * STATES[8] is CHOL in component CHOL (nmol_g).
 * CONSTANTS[18] is C in component Kmtr (g_nmol_min2).
 * CONSTANTS[19] is D in component Kmtr (first_order_rate_constant).
 * CONSTANTS[20] is R in component Kfor (g_nmol_min2).
 * CONSTANTS[21] is S in component Kfor (first_order_rate_constant).
 * CONSTANTS[22] is Vm in component model_parameters (flux).
 * CONSTANTS[23] is Km in component model_parameters (nmol_g).
 * STATES[9] is PREG in component PREG (nmol_g).
 * CONSTANTS[24] is Vmptr in component model_parameters (flux).
 * CONSTANTS[25] is Kmptr in component model_parameters (nmol_g).
 * STATES[10] is PRO in component PRO (nmol_g).
 * CONSTANTS[26] is HA in component PRO (dimensionless).
 * CONSTANTS[27] is AH in component model_parameters (first_order_rate_constant).
 * STATES[11] is HYPR in component HYPR (nmol_g).
 * CONSTANTS[28] is HY in component model_parameters (first_order_rate_constant).
 * STATES[12] is CORT in component CORT (nmol_g).
 * CONSTANTS[29] is LH in component CORT (first_order_rate_constant).
 * ALGEBRAIC[2] is LH_CORT in component CORT (flux).
 * RATES[0] is d/dt cAMP in component cAMP (nmol_g).
 * RATES[1] is d/dt V in component V (flux).
 * RATES[2] is d/dt W in component W (flux).
 * RATES[3] is d/dt CHOC in component CHOC (nmol_g).
 * RATES[5] is d/dt CHOM in component CHOM (nmol_g).
 * RATES[8] is d/dt CHOL in component CHOL (nmol_g).
 * RATES[4] is d/dt Kmtr in component Kmtr (first_order_rate_constant).
 * RATES[6] is d/dt Kfor in component Kfor (first_order_rate_constant).
 * RATES[7] is d/dt CHON in component CHON (nmol_g).
 * RATES[9] is d/dt PREG in component PREG (nmol_g).
 * RATES[10] is d/dt PRO in component PRO (nmol_g).
 * RATES[11] is d/dt HYPR in component HYPR (nmol_g).
 * RATES[12] is d/dt CORT in component CORT (nmol_g).
 * There are a total of 8 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.95;
CONSTANTS[0] = 0.013;
CONSTANTS[1] = 0.01;
CONSTANTS[2] = 1000.0;
CONSTANTS[3] = 10.0;
CONSTANTS[4] = 6.0;
CONSTANTS[5] = 10.0;
CONSTANTS[6] = 3.0;
CONSTANTS[7] = 80.0;
CONSTANTS[8] = 2.11;
CONSTANTS[9] = 4.0;
STATES[1] = 11.3;
CONSTANTS[10] = 0.052;
CONSTANTS[11] = 0.042;
STATES[2] = 10.0;
CONSTANTS[12] = 8.0;
CONSTANTS[13] = 0.0015;
STATES[3] = 532.0;
CONSTANTS[14] = 1.65;
STATES[4] = 0.446;
STATES[5] = 11.3;
CONSTANTS[15] = 10.0;
STATES[6] = 0.370;
CONSTANTS[16] = 0.01;
CONSTANTS[17] = 0.00033;
STATES[7] = 3.03;
STATES[8] = 3000.0;
CONSTANTS[18] = 6.25;
CONSTANTS[19] = 125.0;
CONSTANTS[20] = 3.0;
CONSTANTS[21] = 76.0;
CONSTANTS[22] = 1890.0;
CONSTANTS[23] = 270.0;
STATES[9] = 6.56;
CONSTANTS[24] = 500.0;
CONSTANTS[25] = 150.0;
STATES[10] = 0.64;
CONSTANTS[26] = 0.5;
CONSTANTS[27] = 16.4;
STATES[11] = 0.64;
CONSTANTS[28] = 16.4;
STATES[12] = 5.2;
CONSTANTS[29] = 0.724;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[5] = 0.1001;
RATES[8] = 0.1001;
RATES[4] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ( CONSTANTS[4]*CONSTANTS[0]*(1.00000+ CONSTANTS[2]*ALGEBRAIC[0]))/((1.00000+ CONSTANTS[1]*ALGEBRAIC[0])+ CONSTANTS[0]*(1.00000+ CONSTANTS[2]*ALGEBRAIC[0])) - ( CONSTANTS[5]*STATES[0])/(CONSTANTS[3]+STATES[0]);
resid[1] = RATES[1] -  CONSTANTS[10]*ALGEBRAIC[1] -  CONSTANTS[11]*STATES[1];
resid[2] = RATES[2] -  CONSTANTS[12]*pow(STATES[3], -1.00000) -  CONSTANTS[13]*STATES[2];
resid[3] = RATES[3] - (STATES[1]+STATES[2]+ CONSTANTS[14]*STATES[5]) -  STATES[4]*STATES[3];
resid[4] = RATES[5] - ( STATES[4]*STATES[3]+ CONSTANTS[15]*STATES[7]+ CONSTANTS[17]*STATES[8]) - ( CONSTANTS[14]*STATES[5]+ CONSTANTS[16]*STATES[5]+ STATES[6]*STATES[5]);
resid[5] = RATES[8] -  CONSTANTS[16]*STATES[5] -  CONSTANTS[17]*STATES[8];
resid[6] = RATES[4] -  CONSTANTS[18]*ALGEBRAIC[1] -  CONSTANTS[19]*STATES[4];
resid[7] = RATES[6] -  CONSTANTS[20]*ALGEBRAIC[1] -  CONSTANTS[21]*STATES[6];
resid[8] = RATES[7] -  STATES[6]*STATES[5] - ( CONSTANTS[15]*STATES[7]+( CONSTANTS[22]*STATES[7])/(CONSTANTS[23]+STATES[7]));
resid[9] = RATES[9] - ( CONSTANTS[22]*STATES[7])/(CONSTANTS[23]+STATES[7]) - ( CONSTANTS[24]*STATES[9])/(CONSTANTS[25]+STATES[9]);
resid[10] = RATES[10] -  CONSTANTS[26]*(( CONSTANTS[24]*STATES[9])/(CONSTANTS[25]+STATES[9])) -  CONSTANTS[27]*STATES[10];
resid[11] = RATES[11] -  CONSTANTS[27]*STATES[10] -  CONSTANTS[28]*STATES[11];
resid[12] = RATES[12] -  CONSTANTS[28]*STATES[11] -  CONSTANTS[29]*STATES[12];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] =  CONSTANTS[29]*STATES[12];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? 12.0000 : CONDVAR[2]>=0.00000&&CONDVAR[3]<0.00000 ? 16.0000 : CONDVAR[4]>=0.00000&&CONDVAR[5]<0.00000 ? 12.0000 : CONDVAR[6]>=0.00000&&CONDVAR[7]<0.00000 ? 16.0000 : 12.0000);
ALGEBRAIC[1] = ( CONSTANTS[7]*CONSTANTS[6]*pow(STATES[0], CONSTANTS[9]))/(pow(CONSTANTS[8], CONSTANTS[9])+pow(STATES[0], CONSTANTS[9]));
}
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;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
SI[10] = 1.0;
SI[11] = 1.0;
SI[12] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 0.00000;
CONDVAR[1] = VOI - 10.0000;
CONDVAR[2] = VOI - 10.0000;
CONDVAR[3] = VOI - 20.0000;
CONDVAR[4] = VOI - 20.0000;
CONDVAR[5] = VOI - 35.0000;
CONDVAR[6] = VOI - 35.0000;
CONDVAR[7] = VOI - 45.0000;
}