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 15 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 24 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is y0 in component y0 (dimensionless).
 * ALGEBRAIC[10] is g0 in component y0 (dimensionless).
 * ALGEBRAIC[1] is r0 in component y0 (dimensionless).
 * ALGEBRAIC[0] is h0 in component y0 (dimensionless).
 * CONSTANTS[0] is S0 in component y0 (dimensionless).
 * STATES[1] is y2 in component y2 (dimensionless).
 * CONSTANTS[1] is a00 in component model_parameters (dimensionless).
 * CONSTANTS[2] is a02 in component model_parameters (dimensionless).
 * CONSTANTS[3] is c0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is e0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[5] is epsilon in component model_parameters (dimensionless).
 * STATES[2] is y1 in component y1 (dimensionless).
 * ALGEBRAIC[11] is g1 in component y1 (dimensionless).
 * ALGEBRAIC[3] is r1 in component y1 (dimensionless).
 * ALGEBRAIC[2] is h1 in component y1 (dimensionless).
 * CONSTANTS[6] is S1 in component y1 (dimensionless).
 * CONSTANTS[7] is a10 in component model_parameters (dimensionless).
 * CONSTANTS[8] is a12 in component model_parameters (dimensionless).
 * CONSTANTS[9] is a11 in component model_parameters (dimensionless).
 * CONSTANTS[10] is e1 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[12] is g2 in component y2 (dimensionless).
 * ALGEBRAIC[5] is r2 in component y2 (dimensionless).
 * ALGEBRAIC[4] is h2 in component y2 (dimensionless).
 * CONSTANTS[11] is S2 in component y2 (dimensionless).
 * STATES[3] is y3 in component y3 (dimensionless).
 * STATES[4] is y4 in component y4 (dimensionless).
 * CONSTANTS[12] is a23 in component model_parameters (dimensionless).
 * CONSTANTS[13] is a24 in component model_parameters (dimensionless).
 * CONSTANTS[14] is a20 in component model_parameters (dimensionless).
 * CONSTANTS[15] is a21 in component model_parameters (dimensionless).
 * CONSTANTS[16] is a22 in component model_parameters (dimensionless).
 * CONSTANTS[17] is e2 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[13] is g3 in component y3 (dimensionless).
 * ALGEBRAIC[7] is r3 in component y3 (dimensionless).
 * ALGEBRAIC[6] is h3 in component y3 (dimensionless).
 * CONSTANTS[18] is S3 in component y3 (dimensionless).
 * CONSTANTS[19] is a32 in component model_parameters (dimensionless).
 * CONSTANTS[20] is a33 in component model_parameters (dimensionless).
 * ALGEBRAIC[14] is g4 in component y4 (dimensionless).
 * ALGEBRAIC[9] is r4 in component y4 (dimensionless).
 * ALGEBRAIC[8] is h4 in component y4 (dimensionless).
 * CONSTANTS[21] is S4 in component y4 (dimensionless).
 * CONSTANTS[22] is a42 in component model_parameters (dimensionless).
 * CONSTANTS[23] is a44 in component model_parameters (dimensionless).
 * RATES[0] is d/dt y0 in component y0 (dimensionless).
 * RATES[2] is d/dt y1 in component y1 (dimensionless).
 * RATES[1] is d/dt y2 in component y2 (dimensionless).
 * RATES[3] is d/dt y3 in component y3 (dimensionless).
 * RATES[4] is d/dt y4 in component y4 (dimensionless).
 * There are a total of 20 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.4;
CONSTANTS[0] = 0.010;
STATES[1] = 1.17;
CONSTANTS[1] = -0.00843;
CONSTANTS[2] = -0.440;
CONSTANTS[3] = 0.443;
CONSTANTS[4] = 0.0;
CONSTANTS[5] = 0.50;
STATES[2] = 1.4;
CONSTANTS[6] = 0.010;
CONSTANTS[7] = 0.082;
CONSTANTS[8] = -0.0668;
CONSTANTS[9] = -0.0040;
CONSTANTS[10] = 0.0;
CONSTANTS[11] = 0.010;
STATES[3] = 0.95;
STATES[4] = 0.65;
CONSTANTS[12] = 0.0576;
CONSTANTS[13] = 3.25E-4;
CONSTANTS[14] = 0.0;
CONSTANTS[15] = 0.0310;
CONSTANTS[16] = -0.0957;
CONSTANTS[17] = 0.0;
CONSTANTS[18] = 0.010;
CONSTANTS[19] = 0.00869;
CONSTANTS[20] = -0.00857;
CONSTANTS[21] = 0.010;
CONSTANTS[22] = 1.39E-4;
CONSTANTS[23] = -1.43E-4;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[1] = 0.1001;
RATES[3] = 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] -  1.00000*ALGEBRAIC[10]+CONSTANTS[3]+CONSTANTS[4];
resid[1] = RATES[2] -  1.00000*ALGEBRAIC[11]+CONSTANTS[10];
resid[2] = RATES[1] -  1.00000*ALGEBRAIC[12]+CONSTANTS[17];
resid[3] = RATES[3] -  1.00000*ALGEBRAIC[13];
resid[4] = RATES[4] -  1.00000*ALGEBRAIC[14];
}
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[1] = (CONDVAR[2]<0.00000&&CONDVAR[3]<0.00000 ? 1.00000 - exp(( CONSTANTS[0]*pow(STATES[0], 2.00000))/( ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1])*pow(CONSTANTS[5] - STATES[0], 2.00000))) : 1.00000);
ALGEBRAIC[0] = (CONDVAR[0]>0.00000 ? ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1])/(1.00000+ (( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1])/CONSTANTS[0])*(1.00000 - exp(- (( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1])/CONSTANTS[0])))) : CONDVAR[1]<=0.00000 ?  CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1] : 0.0/0.0);
ALGEBRAIC[10] =  ALGEBRAIC[0]*ALGEBRAIC[1];
ALGEBRAIC[3] = (CONDVAR[6]<0.00000&&CONDVAR[7]<0.00000 ? 1.00000 - exp(( CONSTANTS[6]*pow(STATES[2], 2.00000))/( ( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1])*pow(CONSTANTS[5] - STATES[2], 2.00000))) : 1.00000);
ALGEBRAIC[2] = (CONDVAR[4]>0.00000 ? ( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1])/(1.00000+ (( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1])/CONSTANTS[6])*(1.00000 - exp(- (( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1])/CONSTANTS[6])))) : CONDVAR[5]<=0.00000 ?  CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1] : 0.0/0.0);
ALGEBRAIC[11] =  ALGEBRAIC[2]*ALGEBRAIC[3];
ALGEBRAIC[5] = (CONDVAR[10]<0.00000&&CONDVAR[11]<0.00000 ? 1.00000 - exp(( CONSTANTS[11]*pow(STATES[1], 2.00000))/( ( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4])*pow(CONSTANTS[5] - STATES[1], 2.00000))) : 1.00000);
ALGEBRAIC[4] = (CONDVAR[8]>0.00000 ? ( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4])/(1.00000+ (( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4])/CONSTANTS[11])*(1.00000 - exp(- (( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4])/CONSTANTS[11])))) : CONDVAR[9]<=0.00000 ?  CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4] : 0.0/0.0);
ALGEBRAIC[12] =  ALGEBRAIC[4]*ALGEBRAIC[5];
ALGEBRAIC[7] = (CONDVAR[14]<0.00000&&CONDVAR[15]<0.00000 ? 1.00000 - exp(( CONSTANTS[18]*pow(STATES[3], 2.00000))/( ( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3])*pow(CONSTANTS[5] - STATES[3], 2.00000))) : 1.00000);
ALGEBRAIC[6] = (CONDVAR[12]>0.00000 ? ( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3])/(1.00000+ (( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3])/CONSTANTS[18])*(1.00000 - exp(- (( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3])/CONSTANTS[18])))) : CONDVAR[13]<=0.00000 ?  CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3] : 0.0/0.0);
ALGEBRAIC[13] =  ALGEBRAIC[6]*ALGEBRAIC[7];
ALGEBRAIC[9] = (CONDVAR[18]<0.00000&&CONDVAR[19]<0.00000 ? 1.00000 - exp(( CONSTANTS[21]*pow(STATES[4], 2.00000))/( ( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4])*pow(CONSTANTS[5] - STATES[4], 2.00000))) : 1.00000);
ALGEBRAIC[8] = (CONDVAR[16]>0.00000 ? ( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4])/(1.00000+ (( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4])/CONSTANTS[21])*(1.00000 - exp(- (( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4])/CONSTANTS[21])))) : CONDVAR[17]<=0.00000 ?  CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4] : 0.0/0.0);
ALGEBRAIC[14] =  ALGEBRAIC[8]*ALGEBRAIC[9];
}
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)
{
CONDVAR[0] = ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1]) - 0.00000;
CONDVAR[1] = ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1]) - 0.00000;
CONDVAR[2] = STATES[0] - CONSTANTS[5];
CONDVAR[3] = ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[1]) - 0.00000;
CONDVAR[4] = ( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1]) - 0.00000;
CONDVAR[5] = ( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1]) - 0.00000;
CONDVAR[6] = STATES[2] - CONSTANTS[5];
CONDVAR[7] = ( CONSTANTS[7]*STATES[0]+ CONSTANTS[9]*STATES[2]+ CONSTANTS[8]*STATES[1]) - 0.00000;
CONDVAR[8] = ( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4]) - 0.00000;
CONDVAR[9] = ( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4]) - 0.00000;
CONDVAR[10] = STATES[1] - CONSTANTS[5];
CONDVAR[11] = ( CONSTANTS[14]*STATES[0]+ CONSTANTS[15]*STATES[2]+ CONSTANTS[16]*STATES[1]+ CONSTANTS[12]*STATES[3]+ CONSTANTS[13]*STATES[4]) - 0.00000;
CONDVAR[12] = ( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3]) - 0.00000;
CONDVAR[13] = ( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3]) - 0.00000;
CONDVAR[14] = STATES[3] - CONSTANTS[5];
CONDVAR[15] = ( CONSTANTS[19]*STATES[1]+ CONSTANTS[20]*STATES[3]) - 0.00000;
CONDVAR[16] = ( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4]) - 0.00000;
CONDVAR[17] = ( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4]) - 0.00000;
CONDVAR[18] = STATES[4] - CONSTANTS[5];
CONDVAR[19] = ( CONSTANTS[22]*STATES[1]+ CONSTANTS[23]*STATES[4]) - 0.00000;
}