Generated Code

The following is c 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).
 */
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;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[2] = CONSTANTS[2] -  (CONSTANTS[3]+ CONSTANTS[4]*STATES[1])*STATES[2];
RATES[3] =  (CONSTANTS[3]+ CONSTANTS[4]*STATES[1])*STATES[2];
ALGEBRAIC[0] = (VOI*0.0166667>=0.00000&&VOI*0.0166667<4.00000 ? 0.500000 : VOI*0.0166667>=4.00000&&VOI*0.0166667<24.0000 ? 0.00000 : VOI*0.0166667>=24.0000&&VOI*0.0166667<28.0000 ? 0.500000 : VOI*0.0166667>=28.0000&&VOI*0.0166667<148.000 ? 0.00000 : VOI*0.0166667>=148.000&&VOI*0.0166667<152.000 ? 0.500000 : VOI*0.0166667>=152.000&&VOI*0.0166667<157.000 ? 0.00000 : VOI*0.0166667>=157.000&&VOI*0.0166667<161.000 ? 0.500000 : VOI*0.0166667>=161.000&&VOI*0.0166667<281.000 ? 0.00000 : VOI*0.0166667>=281.000&&VOI*0.0166667<285.000 ? 0.500000 : VOI*0.0166667>=285.000&&VOI*0.0166667<295.000 ? 0.00000 : VOI*0.0166667>=295.000&&VOI*0.0166667<299.000 ? 0.500000 : VOI*0.0166667>=299.000&&VOI*0.0166667<419.000 ? 0.00000 : VOI*0.0166667>=419.000&&VOI*0.0166667<424.000 ? 0.500000 : VOI*0.0166667>=424.000&&VOI*0.0166667<464.000 ? 0.00000 : VOI*0.0166667>=464.000&&VOI*0.0166667<468.000 ? 0.500000 : VOI*0.0166667>=468.000&&VOI*0.0166667<588.000 ? 0.00000 : 0.0/0.0);
RATES[0] =  CONSTANTS[1]*STATES[1] -  CONSTANTS[0]*STATES[0]*ALGEBRAIC[0];
RATES[1] =  CONSTANTS[0]*STATES[0]*ALGEBRAIC[0] -  CONSTANTS[1]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI*0.0166667>=0.00000&&VOI*0.0166667<4.00000 ? 0.500000 : VOI*0.0166667>=4.00000&&VOI*0.0166667<24.0000 ? 0.00000 : VOI*0.0166667>=24.0000&&VOI*0.0166667<28.0000 ? 0.500000 : VOI*0.0166667>=28.0000&&VOI*0.0166667<148.000 ? 0.00000 : VOI*0.0166667>=148.000&&VOI*0.0166667<152.000 ? 0.500000 : VOI*0.0166667>=152.000&&VOI*0.0166667<157.000 ? 0.00000 : VOI*0.0166667>=157.000&&VOI*0.0166667<161.000 ? 0.500000 : VOI*0.0166667>=161.000&&VOI*0.0166667<281.000 ? 0.00000 : VOI*0.0166667>=281.000&&VOI*0.0166667<285.000 ? 0.500000 : VOI*0.0166667>=285.000&&VOI*0.0166667<295.000 ? 0.00000 : VOI*0.0166667>=295.000&&VOI*0.0166667<299.000 ? 0.500000 : VOI*0.0166667>=299.000&&VOI*0.0166667<419.000 ? 0.00000 : VOI*0.0166667>=419.000&&VOI*0.0166667<424.000 ? 0.500000 : VOI*0.0166667>=424.000&&VOI*0.0166667<464.000 ? 0.00000 : VOI*0.0166667>=464.000&&VOI*0.0166667<468.000 ? 0.500000 : VOI*0.0166667>=468.000&&VOI*0.0166667<588.000 ? 0.00000 : 0.0/0.0);
}