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 4 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 kbf in component model_parameters (first_order_rate_constant).
 * STATES[1] is B in component B (dimensionless).
 * STATES[2] is R in component R (dimensionless).
 * CONSTANTS[2] is s in component model_parameters (first_order_rate_constant).
 * 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[3] is C in component C (dimensionless).
 * RATES[0] is d/dt F in component F (dimensionless).
 * RATES[1] is d/dt B in component B (dimensionless).
 * RATES[2] is d/dt R in component R (dimensionless).
 * RATES[3] is d/dt C in component C (dimensionless).
 * 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] = 9.91;
STATES[1] = 0.0;
STATES[2] = 2115.0;
CONSTANTS[2] = 6.80;
CONSTANTS[3] = 0.0328;
CONSTANTS[4] = 0.0830;
STATES[3] = 0.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] -  CONSTANTS[1]*STATES[1] -  CONSTANTS[0]*STATES[0]*ALGEBRAIC[0];
resid[1] = RATES[1] -  CONSTANTS[0]*STATES[0]*ALGEBRAIC[0] -  CONSTANTS[1]*STATES[1];
resid[2] = RATES[2] - CONSTANTS[2] -  (CONSTANTS[3]+ CONSTANTS[4]*STATES[1])*STATES[2];
resid[3] = RATES[3] -  (CONSTANTS[3]+ CONSTANTS[4]*STATES[1])*STATES[2];
}
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;
}
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 - 0.0666667;
CONDVAR[2] = VOI - 0.0666667;
CONDVAR[3] = VOI - 0.400000;
CONDVAR[4] = VOI - 0.400000;
CONDVAR[5] = VOI - 0.466667;
CONDVAR[6] = VOI - 0.466667;
CONDVAR[7] = VOI - 2.46667;
CONDVAR[8] = VOI - 2.46667;
CONDVAR[9] = VOI - 2.53333;
CONDVAR[10] = VOI - 2.53333;
CONDVAR[11] = VOI - 2.61667;
CONDVAR[12] = VOI - 2.61667;
CONDVAR[13] = VOI - 2.68333;
CONDVAR[14] = VOI - 2.68333;
CONDVAR[15] = VOI - 4.68333;
CONDVAR[16] = VOI - 4.68333;
CONDVAR[17] = VOI - 4.75000;
CONDVAR[18] = VOI - 4.75000;
CONDVAR[19] = VOI - 4.91667;
CONDVAR[20] = VOI - 4.91667;
CONDVAR[21] = VOI - 4.98333;
CONDVAR[22] = VOI - 4.98333;
CONDVAR[23] = VOI - 6.98333;
CONDVAR[24] = VOI - 6.98333;
CONDVAR[25] = VOI - 7.06667;
CONDVAR[26] = VOI - 7.06667;
CONDVAR[27] = VOI - 7.73333;
CONDVAR[28] = VOI - 7.73333;
CONDVAR[29] = VOI - 7.80000;
CONDVAR[30] = VOI - 7.80000;
CONDVAR[31] = VOI - 9.80000;
}