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 1 entries in the algebraic variable array.
   There are a total of 5 entries in each of the rate and state variable arrays.
   There are a total of 5 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * ALGEBRAIC[0] is GnRH in component GnRH (nanomolar).
 * STATES[0] is F in component F (dimensionless).
 * CONSTANTS[0] is kfb in component model_parameters (second_order_rate_constant).
 * CONSTANTS[1] is kdf in component model_parameters (first_order_rate_constant).
 * STATES[1] is D in component D (dimensionless).
 * CONSTANTS[2] is kbd in component model_parameters (first_order_rate_constant).
 * STATES[2] is B in component B (dimensionless).
 * STATES[3] is R in component R (ng_ml).
 * CONSTANTS[3] is a1 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is a2 in component model_parameters (first_order_rate_constant).
 * STATES[4] is C in component C (ng_ml).
 * RATES[0] is d/dt F in component F (dimensionless).
 * RATES[1] is d/dt D in component D (dimensionless).
 * RATES[2] is d/dt B in component B (dimensionless).
 * RATES[3] is d/dt R in component R (ng_ml).
 * RATES[4] is d/dt C in component C (ng_ml).
 * There are a total of 32 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.0;
CONSTANTS[0] = 19.35;
CONSTANTS[1] = 2.52;
STATES[1] = 0.0;
CONSTANTS[2] = 9.91;
STATES[2] = 0.0;
STATES[3] = 2115.0;
CONSTANTS[3] = 0.0328;
CONSTANTS[4] = 0.0830;
STATES[4] = 0.0;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 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[1]*STATES[1] -  CONSTANTS[0]*STATES[0]*ALGEBRAIC[0];
resid[1] = RATES[1] -  CONSTANTS[2]*STATES[2] -  CONSTANTS[1]*STATES[1];
resid[2] = RATES[2] -  CONSTANTS[0]*STATES[0]*ALGEBRAIC[0] -  CONSTANTS[2]*STATES[2];
resid[3] = RATES[3] -  (CONSTANTS[3]+ CONSTANTS[4]*STATES[2])*STATES[3];
resid[4] = RATES[4] -  (CONSTANTS[3]+ CONSTANTS[4]*STATES[2])*STATES[3];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? 0.500000 : CONDVAR[2]>=0.00000&&CONDVAR[3]<0.00000 ? 0.00000 : CONDVAR[4]>=0.00000&&CONDVAR[5]<0.00000 ? 0.500000 : CONDVAR[6]>=0.00000&&CONDVAR[7]<0.00000 ? 0.00000 : CONDVAR[8]>=0.00000&&CONDVAR[9]<0.00000 ? 0.500000 : CONDVAR[10]>=0.00000&&CONDVAR[11]<0.00000 ? 0.00000 : CONDVAR[12]>=0.00000&&CONDVAR[13]<0.00000 ? 0.500000 : CONDVAR[14]>=0.00000&&CONDVAR[15]<0.00000 ? 0.00000 : CONDVAR[16]>=0.00000&&CONDVAR[17]<0.00000 ? 0.500000 : CONDVAR[18]>=0.00000&&CONDVAR[19]<0.00000 ? 0.00000 : CONDVAR[20]>=0.00000&&CONDVAR[21]<0.00000 ? 0.500000 : CONDVAR[22]>=0.00000&&CONDVAR[23]<0.00000 ? 0.00000 : CONDVAR[24]>=0.00000&&CONDVAR[25]<0.00000 ? 0.500000 : CONDVAR[26]>=0.00000&&CONDVAR[27]<0.00000 ? 0.00000 : CONDVAR[28]>=0.00000&&CONDVAR[29]<0.00000 ? 0.500000 : CONDVAR[30]>=0.00000&&CONDVAR[31]<0.00000 ? 0.00000 : 0.0/0.0);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI*0.0166667 - 0.00000;
CONDVAR[1] = VOI*0.0166667 - 4.00000;
CONDVAR[2] = VOI*0.0166667 - 4.00000;
CONDVAR[3] = VOI*0.0166667 - 24.0000;
CONDVAR[4] = VOI*0.0166667 - 24.0000;
CONDVAR[5] = VOI*0.0166667 - 28.0000;
CONDVAR[6] = VOI*0.0166667 - 28.0000;
CONDVAR[7] = VOI*0.0166667 - 148.000;
CONDVAR[8] = VOI*0.0166667 - 148.000;
CONDVAR[9] = VOI*0.0166667 - 152.000;
CONDVAR[10] = VOI*0.0166667 - 152.000;
CONDVAR[11] = VOI*0.0166667 - 157.000;
CONDVAR[12] = VOI*0.0166667 - 157.000;
CONDVAR[13] = VOI*0.0166667 - 161.000;
CONDVAR[14] = VOI*0.0166667 - 161.000;
CONDVAR[15] = VOI*0.0166667 - 281.000;
CONDVAR[16] = VOI*0.0166667 - 281.000;
CONDVAR[17] = VOI*0.0166667 - 285.000;
CONDVAR[18] = VOI*0.0166667 - 285.000;
CONDVAR[19] = VOI*0.0166667 - 295.000;
CONDVAR[20] = VOI*0.0166667 - 295.000;
CONDVAR[21] = VOI*0.0166667 - 299.000;
CONDVAR[22] = VOI*0.0166667 - 299.000;
CONDVAR[23] = VOI*0.0166667 - 419.000;
CONDVAR[24] = VOI*0.0166667 - 419.000;
CONDVAR[25] = VOI*0.0166667 - 424.000;
CONDVAR[26] = VOI*0.0166667 - 424.000;
CONDVAR[27] = VOI*0.0166667 - 464.000;
CONDVAR[28] = VOI*0.0166667 - 464.000;
CONDVAR[29] = VOI*0.0166667 - 468.000;
CONDVAR[30] = VOI*0.0166667 - 468.000;
CONDVAR[31] = VOI*0.0166667 - 588.000;
}