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 3 entries in each of the rate and state variable arrays.
   There are a total of 11 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is PRL in component PRL (nanog_ml).
 * CONSTANTS[0] is kD in component PRL (nanog_ml).
 * CONSTANTS[1] is kO in component PRL (picog_ml).
 * CONSTANTS[2] is rP in component PRL (nanog_ml_hr).
 * CONSTANTS[3] is qP in component PRL (first_order_rate_constant).
 * STATES[1] is OT in component OT (picog_ml).
 * STATES[2] is DA in component DA (nanog_ml).
 * ALGEBRAIC[0] is vD in component DA (nanog_ml_hr).
 * CONSTANTS[4] is vDbar in component DA (nanog_ml_hr).
 * CONSTANTS[5] is DA_infinity in component DA (nanog_ml).
 * CONSTANTS[6] is qD in component DA (first_order_rate_constant).
 * CONSTANTS[7] is kx in component OT (picog_ml).
 * ALGEBRAIC[1] is vO in component OT (picog_ml_hr).
 * CONSTANTS[8] is vObar in component OT (picog_ml_hr).
 * CONSTANTS[9] is rO in component OT (picog_ml_hr).
 * CONSTANTS[10] is qO in component OT (first_order_rate_constant).
 * ALGEBRAIC[2] is x in component x (picog_ml).
 * RATES[0] is d/dt PRL in component PRL (nanog_ml).
 * RATES[2] is d/dt DA in component DA (nanog_ml).
 * RATES[1] is d/dt OT in component OT (picog_ml).
 * There are a total of 8 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 20.0;
CONSTANTS[0] = 300.0;
CONSTANTS[1] = 9.0;
CONSTANTS[2] = 300000.0;
CONSTANTS[3] = 0.5;
STATES[1] = 25.0;
STATES[2] = 20000.0;
CONSTANTS[4] = 10000.0;
CONSTANTS[5] = 20000.0;
CONSTANTS[6] = 0.2;
CONSTANTS[7] = 50.0;
CONSTANTS[8] = 500.0;
CONSTANTS[9] = 1100.0;
CONSTANTS[10] = 1.0;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[1] = 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[2]*(1.00000/(CONSTANTS[0]+STATES[2]))*pow(STATES[1]/(CONSTANTS[1]+STATES[1]), 2.00000) -  CONSTANTS[3]*STATES[0];
resid[1] = RATES[2] -  CONSTANTS[6]*(CONSTANTS[5] - STATES[2]) - ALGEBRAIC[0];
resid[2] = RATES[1] -  CONSTANTS[9]*(ALGEBRAIC[2]/(CONSTANTS[7]+ALGEBRAIC[2])) - ( CONSTANTS[10]*STATES[1]+ALGEBRAIC[1]);
}
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 ? CONSTANTS[4] : 0.00000);
ALGEBRAIC[1] = (CONDVAR[2]>=0.00000&&CONDVAR[3]<=0.00000 ? CONSTANTS[8] : 0.00000);
ALGEBRAIC[2] = (CONDVAR[4]>=0.00000&&CONDVAR[5]<=0.00000 ? 51.0000 : CONDVAR[6]>=0.00000&&CONDVAR[7]<=0.00000 ? 51.0000 : 1.00000);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 2.00000;
CONDVAR[1] = VOI - 4.00000;
CONDVAR[2] = VOI - 2.00000;
CONDVAR[3] = VOI - 4.00000;
CONDVAR[4] = VOI - 2.00000;
CONDVAR[5] = VOI - 4.00000;
CONDVAR[6] = VOI - 16.0000;
CONDVAR[7] = VOI - 18.0000;
}