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 15 entries in each of the rate and state variable arrays.
   There are a total of 16 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is x in component x (dimensionless).
 * CONSTANTS[0] is d in component model_parameters (first_order_rate_constant).
 * CONSTANTS[1] is gamma in component model_parameters (first_order_rate_constant).
 * CONSTANTS[2] is lambda in component model_parameters (first_order_rate_constant).
 * CONSTANTS[3] is beta in component model_parameters (first_order_rate_constant).
 * STATES[1] is v in component v (dimensionless).
 * STATES[2] is y0 in component y0 (dimensionless).
 * CONSTANTS[4] is a0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[5] is eta in component model_parameters (first_order_rate_constant).
 * CONSTANTS[6] is phi in component model_parameters (first_order_rate_constant).
 * STATES[3] is L in component L (dimensionless).
 * CONSTANTS[7] is pa in component model_parameters (first_order_rate_constant).
 * STATES[4] is za in component za (dimensionless).
 * STATES[5] is y1 in component y1 (dimensionless).
 * CONSTANTS[8] is a1 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[9] is k in component model_parameters (first_order_rate_constant).
 * CONSTANTS[10] is u in component model_parameters (first_order_rate_constant).
 * STATES[6] is m_8 in component m_8 (dimensionless).
 * CONSTANTS[11] is r in component model_parameters (first_order_rate_constant).
 * STATES[7] is m_7 in component m_7 (dimensionless).
 * STATES[8] is m_6 in component m_6 (dimensionless).
 * STATES[9] is m_5 in component m_5 (dimensionless).
 * STATES[10] is m_4 in component m_4 (dimensionless).
 * STATES[11] is m_3 in component m_3 (dimensionless).
 * STATES[12] is m_2 in component m_2 (dimensionless).
 * STATES[13] is m_1 in component m_1 (dimensionless).
 * STATES[14] is m_0 in component m_0 (dimensionless).
 * CONSTANTS[12] is alpha in component model_parameters (first_order_rate_constant).
 * CONSTANTS[13] is ca in component model_parameters (first_order_rate_constant).
 * CONSTANTS[14] is ba in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is log_za in component za (dimensionless).
 * CONSTANTS[15] is R0 in component R0 (dimensionless).
 * RATES[0] is d/dt x in component x (dimensionless).
 * RATES[2] is d/dt y0 in component y0 (dimensionless).
 * RATES[5] is d/dt y1 in component y1 (dimensionless).
 * RATES[3] is d/dt L in component L (dimensionless).
 * RATES[1] is d/dt v in component v (dimensionless).
 * RATES[6] is d/dt m_8 in component m_8 (dimensionless).
 * RATES[7] is d/dt m_7 in component m_7 (dimensionless).
 * RATES[8] is d/dt m_6 in component m_6 (dimensionless).
 * RATES[9] is d/dt m_5 in component m_5 (dimensionless).
 * RATES[10] is d/dt m_4 in component m_4 (dimensionless).
 * RATES[11] is d/dt m_3 in component m_3 (dimensionless).
 * RATES[12] is d/dt m_2 in component m_2 (dimensionless).
 * RATES[13] is d/dt m_1 in component m_1 (dimensionless).
 * RATES[14] is d/dt m_0 in component m_0 (dimensionless).
 * RATES[4] is d/dt za in component za (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1;
CONSTANTS[0] = 0.1;
CONSTANTS[1] = 0.5;
CONSTANTS[2] = 10;
CONSTANTS[3] = 0.1;
STATES[1] = 1;
STATES[2] = 0;
CONSTANTS[4] = 0.1;
CONSTANTS[5] = 0.01;
CONSTANTS[6] = 0.1;
STATES[3] = 0;
CONSTANTS[7] = 0.000001;
STATES[4] = 1;
STATES[5] = 0;
CONSTANTS[8] = 0.2;
CONSTANTS[9] = 1;
CONSTANTS[10] = 1;
STATES[6] = 0;
CONSTANTS[11] = 1;
STATES[7] = 0;
STATES[8] = 0;
STATES[9] = 0;
STATES[10] = 0;
STATES[11] = 0;
STATES[12] = 0;
STATES[13] = 0;
STATES[14] = 1;
CONSTANTS[12] = 0.2;
CONSTANTS[13] = 15.5;
CONSTANTS[14] = 0.1;
CONSTANTS[15] =  (( CONSTANTS[2]*CONSTANTS[5])/( CONSTANTS[0]*CONSTANTS[8]*(CONSTANTS[4]+CONSTANTS[5])))*(CONSTANTS[3]+( CONSTANTS[1]*CONSTANTS[6])/(CONSTANTS[6]+CONSTANTS[0]));
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[5] = 0.1001;
RATES[3] = 0.1001;
RATES[1] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[4] = 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] - ( CONSTANTS[0]*STATES[0]+ CONSTANTS[3]*STATES[0]*STATES[1]+ CONSTANTS[1]*STATES[0]*STATES[1]);
resid[1] = RATES[2] - ( CONSTANTS[3]*STATES[0]*STATES[1] - ( CONSTANTS[4]*STATES[2]+ CONSTANTS[5]*STATES[2]+ CONSTANTS[7]*STATES[2]*STATES[4]))+ CONSTANTS[6]*STATES[3];
resid[2] = RATES[5] -  CONSTANTS[5]*STATES[2] - ( CONSTANTS[8]*STATES[5]+ CONSTANTS[7]*STATES[5]*STATES[4]);
resid[3] = RATES[3] -  CONSTANTS[1]*STATES[0]*STATES[1] - ( CONSTANTS[6]*STATES[3]+ CONSTANTS[0]*STATES[3]);
resid[4] = RATES[1] -  CONSTANTS[9]*STATES[5] -  CONSTANTS[10]*STATES[1];
resid[5] = RATES[6] -  2.00000*CONSTANTS[11]*STATES[7] -  CONSTANTS[11]*STATES[6];
resid[6] = RATES[7] -  2.00000*CONSTANTS[11]*STATES[8] -  CONSTANTS[11]*STATES[7];
resid[7] = RATES[8] -  2.00000*CONSTANTS[11]*STATES[9] -  CONSTANTS[11]*STATES[8];
resid[8] = RATES[9] -  2.00000*CONSTANTS[11]*STATES[10] -  CONSTANTS[11]*STATES[9];
resid[9] = RATES[10] -  2.00000*CONSTANTS[11]*STATES[11] -  CONSTANTS[11]*STATES[10];
resid[10] = RATES[11] -  2.00000*CONSTANTS[11]*STATES[12] -  CONSTANTS[11]*STATES[11];
resid[11] = RATES[12] -  2.00000*CONSTANTS[11]*STATES[13] -  CONSTANTS[11]*STATES[12];
resid[12] = RATES[13] -  2.00000*CONSTANTS[11]*STATES[14] -  CONSTANTS[11]*STATES[13];
resid[13] = RATES[14] -  - CONSTANTS[11]*STATES[14];
resid[14] = RATES[4] - ( CONSTANTS[12]*STATES[6]+ CONSTANTS[13]*(STATES[2]+STATES[5])*STATES[4]) -  CONSTANTS[14]*STATES[4];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = arbitrary_log(STATES[4], 10);
}
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;
SI[9] = 1.0;
SI[10] = 1.0;
SI[11] = 1.0;
SI[12] = 1.0;
SI[13] = 1.0;
SI[14] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}