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 12 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 20 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * ALGEBRAIC[9] is rel_LH_E2_P4_RP_LH in component RP_LH (microg_day).
 * STATES[0] is RP_LH in component RP_LH (microg).
 * ALGEBRAIC[8] is syn_LH_E2_P4 in component RP_LH (microg_day).
 * CONSTANTS[0] is V0_LH in component RP_LH (microg_day).
 * CONSTANTS[1] is V1_LH in component RP_LH (microg_day).
 * CONSTANTS[2] is h in component RP_LH (dimensionless).
 * CONSTANTS[3] is Km_LH in component RP_LH (ng_L).
 * CONSTANTS[4] is Ki_LHP in component RP_LH (nmol_L).
 * CONSTANTS[5] is kLH_rel in component RP_LH (first_order_rate_constant).
 * CONSTANTS[6] is CLH_P in component RP_LH (L_nmol).
 * CONSTANTS[7] is CLH_E in component RP_LH (L_ng).
 * ALGEBRAIC[2] is E2 in component E2 (ng_L).
 * ALGEBRAIC[3] is E2_dE in component E2_dE (ng_L).
 * ALGEBRAIC[4] is P4 in component P4 (nmol_L).
 * ALGEBRAIC[5] is P4_dP in component P4_dP (nmol_L).
 * STATES[1] is LH in component LH (microg_l).
 * CONSTANTS[8] is v_dis in component LH (litre).
 * ALGEBRAIC[0] is clear_LH in component LH (microg_l_day).
 * CONSTANTS[9] is kLH_cl in component LH (first_order_rate_constant).
 * ALGEBRAIC[11] is rel_FSH_E2_P4_RP_FSH in component RP_FSH (microg_day).
 * STATES[2] is RP_FSH in component RP_FSH (microg).
 * ALGEBRAIC[10] is syn_FSH_Ih in component RP_FSH (microg_day).
 * CONSTANTS[10] is V_FSH in component RP_FSH (microg_day).
 * CONSTANTS[11] is Ki_FSH_Ih in component RP_FSH (U_L).
 * CONSTANTS[12] is kFSH_rel in component RP_FSH (first_order_rate_constant).
 * CONSTANTS[13] is CFSH_P in component RP_FSH (L_nmol).
 * CONSTANTS[14] is CFSH_E in component RP_FSH (L_ng2).
 * ALGEBRAIC[7] is Ih_dIh in component Ih_dIh (U_L).
 * STATES[3] is FSH in component FSH (microg_l).
 * CONSTANTS[15] is v_dis in component FSH (litre).
 * ALGEBRAIC[1] is clear_FSH in component FSH (microg_l_day).
 * CONSTANTS[16] is kFSH_cl in component FSH (first_order_rate_constant).
 * CONSTANTS[17] is dE in component E2_dE (day).
 * CONSTANTS[18] is dP in component P4_dP (day).
 * ALGEBRAIC[6] is Ih in component Ih (U_L).
 * CONSTANTS[19] is dIh in component Ih_dIh (day).
 * RATES[0] is d/dt RP_LH in component RP_LH (microg).
 * RATES[1] is d/dt LH in component LH (microg_l).
 * RATES[2] is d/dt RP_FSH in component RP_FSH (microg).
 * RATES[3] is d/dt FSH in component FSH (microg_l).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 467.0;
CONSTANTS[0] = 1400.0;
CONSTANTS[1] = 95900.0;
CONSTANTS[2] = 8.0;
CONSTANTS[3] = 360.0;
CONSTANTS[4] = 26.0;
CONSTANTS[5] = 3.0;
CONSTANTS[6] = 0.024;
CONSTANTS[7] = 0.008;
STATES[1] = 40.0;
CONSTANTS[8] = 2.5;
CONSTANTS[9] = 14.0;
STATES[2] = 0.0;
CONSTANTS[10] = 4400.0;
CONSTANTS[11] = 1176.5;
CONSTANTS[12] = 45.0;
CONSTANTS[13] = 3.0;
CONSTANTS[14] = 0.005;
STATES[3] = 150.0;
CONSTANTS[15] = 2.5;
CONSTANTS[16] = 8.21;
CONSTANTS[17] = 0.42;
CONSTANTS[18] = 2.9;
CONSTANTS[19] = 2.0;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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[8] - ALGEBRAIC[9];
resid[1] = RATES[1] - ALGEBRAIC[9]/CONSTANTS[8] - ALGEBRAIC[0];
resid[2] = RATES[2] - ALGEBRAIC[10] - ALGEBRAIC[11];
resid[3] = RATES[3] - ALGEBRAIC[11]/CONSTANTS[15] - ALGEBRAIC[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[6] = 300.000+ 1330.00*exp(- (pow(VOI - 7.00000, 2.00000)/19.0000));
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[9]*STATES[1];
ALGEBRAIC[1] =  CONSTANTS[16]*STATES[3];
ALGEBRAIC[3] = (300.000 - ( 240.000*pow((VOI+1.00000) - CONSTANTS[17], 2.00000))/(3.00000+pow((VOI+1.00000) - CONSTANTS[17], 2.00000)))+ 90.0000*exp(- (pow(VOI - (CONSTANTS[17]+8.00000), 2.00000)/10.0000));
ALGEBRAIC[5] =  52.0000*exp(- (pow(VOI - (CONSTANTS[18]+7.00000), 2.00000)/18.0000));
ALGEBRAIC[8] = (CONSTANTS[0]+( CONSTANTS[1]*pow(ALGEBRAIC[3], CONSTANTS[2]))/(pow(CONSTANTS[3], CONSTANTS[2])+pow(ALGEBRAIC[3], CONSTANTS[2])))/(1.00000+ALGEBRAIC[5]/CONSTANTS[4]);
ALGEBRAIC[2] = (300.000 - ( 240.000*pow(VOI+1.00000, 2.00000))/(3.00000+pow(VOI+1.00000, 2.00000)))+ 90.0000*exp(- (pow(VOI - 8.00000, 2.00000)/10.0000));
ALGEBRAIC[4] =  52.0000*exp(- (pow(VOI - 7.00000, 2.00000)/18.0000));
ALGEBRAIC[9] = ( CONSTANTS[5]*(1.00000+ CONSTANTS[6]*ALGEBRAIC[4])*STATES[0])/(1.00000+ CONSTANTS[7]*ALGEBRAIC[2]);
ALGEBRAIC[7] = 300.000+ 1330.00*exp(- (pow(VOI - (7.00000+CONSTANTS[19]), 2.00000)/19.0000));
ALGEBRAIC[10] = CONSTANTS[10]/(1.00000+ALGEBRAIC[7]/CONSTANTS[11]);
ALGEBRAIC[11] = ( CONSTANTS[12]*(1.00000+ CONSTANTS[13]*ALGEBRAIC[4])*STATES[2])/(1.00000+ CONSTANTS[14]*pow(ALGEBRAIC[2], 2.00000));
}
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)
{
}