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 9 entries in each of the rate and state variable arrays.
   There are a total of 10 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is x1 in component x1 (nanomolar).
 * STATES[1] is x2 in component x2 (nanomolar).
 * STATES[2] is x3 in component x3 (nanomolar).
 * STATES[3] is x4 in component x4 (nanomolar).
 * STATES[4] is x5 in component x5 (nanomolar).
 * STATES[5] is x6 in component x6 (nanomolar).
 * STATES[6] is x7 in component x7 (nanomolar).
 * STATES[7] is x8 in component x8 (nanomolar).
 * STATES[8] is x9 in component x9 (nanomolar).
 * CONSTANTS[0] is k1 in component rate_variables (second_order_rate_constant).
 * CONSTANTS[1] is k1_ in component rate_variables (first_order_rate_constant).
 * CONSTANTS[2] is k2 in component rate_variables (second_order_rate_constant).
 * CONSTANTS[3] is k2_ in component rate_variables (first_order_rate_constant).
 * CONSTANTS[4] is k4 in component rate_variables (second_order_rate_constant).
 * CONSTANTS[5] is k4_ in component rate_variables (first_order_rate_constant).
 * CONSTANTS[6] is k5 in component rate_variables (second_order_rate_constant).
 * CONSTANTS[7] is k5_ in component rate_variables (first_order_rate_constant).
 * ALGEBRAIC[0] is scatchard in component x1 (dimensionless).
 * CONSTANTS[8] is k3 in component rate_variables (second_order_rate_constant).
 * CONSTANTS[9] is k3_ in component rate_variables (first_order_rate_constant).
 * RATES[0] is d/dt x1 in component x1 (nanomolar).
 * RATES[1] is d/dt x2 in component x2 (nanomolar).
 * RATES[2] is d/dt x3 in component x3 (nanomolar).
 * RATES[3] is d/dt x4 in component x4 (nanomolar).
 * RATES[4] is d/dt x5 in component x5 (nanomolar).
 * RATES[5] is d/dt x6 in component x6 (nanomolar).
 * RATES[6] is d/dt x7 in component x7 (nanomolar).
 * RATES[7] is d/dt x8 in component x8 (nanomolar).
 * RATES[8] is d/dt x9 in component x9 (nanomolar).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 10;
STATES[1] = 0.1;
STATES[2] = 1.0;
STATES[3] = 1.0;
STATES[4] = 1.0;
STATES[5] = 1.0;
STATES[6] = 1.0;
STATES[7] = 1.0;
STATES[8] = 1.0;
CONSTANTS[0] = 1000000;
CONSTANTS[1] = 0.0004;
CONSTANTS[2] = 1000000;
CONSTANTS[3] = 0.04;
CONSTANTS[4] = 1000000;
CONSTANTS[5] = 0.0004;
CONSTANTS[6] = 10000000;
CONSTANTS[7] = 0.004;
CONSTANTS[8] = 1000000;
CONSTANTS[9] = 0.0004;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 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[2] -  CONSTANTS[0]*STATES[0]*STATES[1])+ CONSTANTS[3]*STATES[3]) -  CONSTANTS[2]*STATES[0]*STATES[2])+ CONSTANTS[5]*(STATES[5]+STATES[6])) -  CONSTANTS[4]*STATES[0]*(STATES[4]+STATES[8]))+ CONSTANTS[7]*(STATES[6]+STATES[7]+STATES[8])) -  CONSTANTS[6]*STATES[0]*(STATES[4]+STATES[5]+STATES[6]);
resid[1] = RATES[1] - (( CONSTANTS[1]*STATES[2] -  CONSTANTS[0]*STATES[0]*STATES[1])+ CONSTANTS[9]*(STATES[4]+STATES[8])) -  CONSTANTS[8]*STATES[1]*(STATES[2]+STATES[3]);
resid[2] = RATES[2] - ((((( CONSTANTS[0]*STATES[0]*STATES[1] -  CONSTANTS[1]*STATES[2])+ CONSTANTS[3]*STATES[3]) -  CONSTANTS[2]*STATES[0]*STATES[2])+ CONSTANTS[9]*STATES[4]) -  CONSTANTS[8]*STATES[1]*STATES[2]);
resid[3] = RATES[3] - (( CONSTANTS[2]*STATES[0]*STATES[2] -  CONSTANTS[3]*STATES[3])+ CONSTANTS[9]*STATES[8]) -  CONSTANTS[2]*STATES[1]*STATES[3];
resid[4] = RATES[4] - (((( CONSTANTS[8]*STATES[1]*STATES[2] -  CONSTANTS[9]*STATES[4])+ CONSTANTS[5]*STATES[5]) -  CONSTANTS[4]*STATES[0]*STATES[4])+ CONSTANTS[7]*STATES[8]) -  CONSTANTS[6]*STATES[0]*STATES[4];
resid[5] = RATES[5] - (( CONSTANTS[4]*STATES[0]*STATES[4] -  CONSTANTS[5]*STATES[5])+ CONSTANTS[7]*STATES[6]) -  CONSTANTS[6]*STATES[0]*STATES[5];
resid[6] = RATES[6] - ( CONSTANTS[4]*STATES[0]*STATES[8] -  CONSTANTS[5]*STATES[6])+ CONSTANTS[7]*(STATES[7] - STATES[6])+ CONSTANTS[6]*STATES[0]*(STATES[5] - STATES[6]);
resid[7] = RATES[7] -  CONSTANTS[6]*STATES[0]*STATES[6] -  CONSTANTS[7]*STATES[7];
resid[8] = RATES[8] - (((( CONSTANTS[8]*STATES[1]*STATES[3] -  CONSTANTS[9]*STATES[8])+ CONSTANTS[5]*STATES[6]) -  CONSTANTS[4]*STATES[0]*STATES[8])+ CONSTANTS[6]*STATES[0]*STATES[4]) -  CONSTANTS[7]*STATES[8];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (STATES[2]+STATES[3]+STATES[6]+STATES[7]+STATES[8])/STATES[0];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}