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 4 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 (second).
 * STATES[0] is M in component M (dimensionless).
 * STATES[1] is AM in component AM (dimensionless).
 * STATES[2] is Mp in component Mp (dimensionless).
 * ALGEBRAIC[2] is k1 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[0] is k2 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[1] is k7 in component model_parameters (first_order_rate_constant).
 * STATES[3] is AMp in component AMp (dimensionless).
 * CONSTANTS[2] is k3 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[3] is k4 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is k5 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[3] is k6 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is phosphorylation in component phosphorylation (dimensionless).
 * ALGEBRAIC[1] is stress in component stress (dimensionless).
 * RATES[0] is d/dt M in component M (dimensionless).
 * RATES[2] is d/dt Mp in component Mp (dimensionless).
 * RATES[3] is d/dt AMp in component AMp (dimensionless).
 * RATES[1] is d/dt AM in component AM (dimensionless).
 * There are a total of 2 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.0;
STATES[1] = 0.0;
STATES[2] = 0.0;
CONSTANTS[0] = 0.5;
CONSTANTS[1] = 0.01;
STATES[3] = 0.0;
CONSTANTS[2] = 0.4;
CONSTANTS[3] = 0.1;
CONSTANTS[4] = 0.5;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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] - - ( ALGEBRAIC[2]*STATES[0])+ CONSTANTS[0]*STATES[2]+ CONSTANTS[1]*STATES[1];
resid[1] = RATES[2] - ( CONSTANTS[3]*STATES[3]+ ALGEBRAIC[2]*STATES[0]) -  (CONSTANTS[0]+CONSTANTS[2])*STATES[2];
resid[2] = RATES[3] - ( CONSTANTS[2]*STATES[2]+ ALGEBRAIC[3]*STATES[1]) -  (CONSTANTS[4]+CONSTANTS[3])*STATES[3];
resid[3] = RATES[1] -  CONSTANTS[4]*STATES[3] -  (ALGEBRAIC[3]+CONSTANTS[1])*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[3]+STATES[2];
ALGEBRAIC[1] = STATES[3]+STATES[1];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? 0.550000 : 0.300000);
ALGEBRAIC[3] = ALGEBRAIC[2];
}
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 - 5.00000;
}