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 5 entries in each of the rate and state variable arrays.
   There are a total of 12 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is P in component P (picomolar).
 * CONSTANTS[0] is k1 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[1] is k1_ in component model_parameters (first_order_rate_constant).
 * CONSTANTS[2] is k2 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[3] is k2_ in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is kcl in component model_parameters (first_order_rate_constant).
 * CONSTANTS[11] is D in component model_parameters (flux).
 * STATES[1] is Ca in component Ca (picomolar).
 * STATES[2] is Ci in component Ci (picomolar).
 * STATES[3] is Ra in component Ra (picomolar).
 * STATES[4] is Ri in component Ri (picomolar).
 * CONSTANTS[5] is k3 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[6] is k3_ in component model_parameters (first_order_rate_constant).
 * CONSTANTS[7] is k4 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[8] is k4_ in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is rho in component rho (dimensionless).
 * CONSTANTS[9] is De in component model_parameters (flux).
 * CONSTANTS[10] is Dd in component model_parameters (flux).
 * RATES[0] is d/dt P in component P (picomolar).
 * RATES[3] is d/dt Ra in component Ra (picomolar).
 * RATES[4] is d/dt Ri in component Ri (picomolar).
 * RATES[1] is d/dt Ca in component Ca (picomolar).
 * RATES[2] is d/dt Ci in component Ci (picomolar).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 3;
CONSTANTS[0] = 1e-6;
CONSTANTS[1] = 1e-3;
CONSTANTS[2] = 1e-7;
CONSTANTS[3] = 1e-3;
CONSTANTS[4] = 5e-3;
STATES[1] = 4e-4;
STATES[2] = 0.05;
STATES[3] = 16.9;
STATES[4] = 1.7;
CONSTANTS[5] = 1e-3;
CONSTANTS[6] = 1e-4;
CONSTANTS[7] = 2e-3;
CONSTANTS[8] = 0.4;
CONSTANTS[9] = 0;
CONSTANTS[10] = 0.015;
CONSTANTS[11] = CONSTANTS[9]+CONSTANTS[10];
RATES[0] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 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[3]*STATES[2]+CONSTANTS[11]) - ( CONSTANTS[0]*STATES[3]*STATES[0]+ CONSTANTS[2]*STATES[4]*STATES[0]+ CONSTANTS[4]*STATES[0]);
resid[1] = RATES[3] - ( CONSTANTS[1]*STATES[1]+ CONSTANTS[5]*STATES[4]) - ( CONSTANTS[0]*STATES[3]*STATES[0]+ CONSTANTS[6]*STATES[3]);
resid[2] = RATES[4] - ( CONSTANTS[3]*STATES[2]+ CONSTANTS[6]*STATES[3]) - ( CONSTANTS[2]*STATES[4]*STATES[0]+ CONSTANTS[5]*STATES[4]);
resid[3] = RATES[1] - ( CONSTANTS[0]*STATES[3]*STATES[0]+ CONSTANTS[7]*STATES[2]) - ( CONSTANTS[1]*STATES[1]+ CONSTANTS[8]*STATES[1]);
resid[4] = RATES[2] - ( CONSTANTS[2]*STATES[4]*STATES[0]+ CONSTANTS[8]*STATES[1]) - ( CONSTANTS[3]*STATES[2]+ CONSTANTS[7]*STATES[2]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (STATES[3]+STATES[1])/(STATES[3]+STATES[1]+STATES[4]+STATES[2]);
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}