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 0 entries in the algebraic variable array.
   There are a total of 16 entries in each of the rate and state variable arrays.
   There are a total of 21 entries in the constant variable array.
 */
/*
 * VOI is t in component environment (s).
 * CONSTANTS[0] is kM2T2_on in component Model (second_order_rate_constant).
 * CONSTANTS[1] is kM2T2_off in component Model (first_order_rate_constant).
 * CONSTANTS[2] is kM2T2_iso in component Model (first_order_rate_constant).
 * CONSTANTS[3] is kM2T2_negativeiso in component Model (first_order_rate_constant).
 * CONSTANTS[4] is kM2C1_on in component Model (second_order_rate_constant).
 * CONSTANTS[5] is kM2C1_off in component Model (first_order_rate_constant).
 * CONSTANTS[6] is kM2C1_cat in component Model (first_order_rate_constant).
 * CONSTANTS[7] is kMT1T2_on in component Model (second_order_rate_constant).
 * CONSTANTS[8] is kMT1T2_off in component Model (first_order_rate_constant).
 * CONSTANTS[9] is kMT1T2M2pro_on in component Model (second_order_rate_constant).
 * CONSTANTS[10] is kMT1T2M2pro_off in component Model (first_order_rate_constant).
 * CONSTANTS[11] is kM2_act in component Model (first_order_rate_constant).
 * CONSTANTS[12] is kMT1_shedeff in component Model (second_order_rate_constant).
 * CONSTANTS[13] is kMT1C1_cat in component Model (first_order_rate_constant).
 * CONSTANTS[14] is kMT1C1_on in component Model (second_order_rate_constant).
 * CONSTANTS[15] is kMT1C1_off in component Model (first_order_rate_constant).
 * CONSTANTS[16] is kMT1T2M2proMT1_on in component Model (second_order_rate_constant).
 * CONSTANTS[17] is kMT1T2M2proMT1_off in component Model (first_order_rate_constant).
 * STATES[0] is M2T2 in component Model (M).
 * STATES[1] is M2C1 in component Model (M).
 * STATES[2] is MT1T2 in component Model (M).
 * STATES[3] is MT1T2M2proMT1 in component Model (M).
 * STATES[4] is MT1C1 in component Model (M).
 * STATES[5] is M2 in component Model (M).
 * STATES[6] is MT1 in component Model (M).
 * STATES[7] is M2_p in component Model (M).
 * STATES[8] is T2 in component Model (M).
 * STATES[9] is C1_D in component Model (M).
 * STATES[10] is C1 in component Model (M).
 * STATES[11] is MT1_cat in component Model (M).
 * STATES[12] is MT1_t in component Model (M).
 * STATES[13] is MT1T2M2pro in component Model (M).
 * CONSTANTS[18] is qMT1 in component Model (flux).
 * CONSTANTS[19] is qT2 in component Model (flux).
 * CONSTANTS[20] is qpro in component Model (flux).
 * STATES[14] is MT1T2_star in component Model (um).
 * STATES[15] is M2T2_star in component Model (um).
 * RATES[5] is d/dt M2 in component Model (M).
 * RATES[6] is d/dt MT1 in component Model (M).
 * RATES[12] is d/dt MT1_t in component Model (M).
 * RATES[4] is d/dt MT1C1 in component Model (M).
 * RATES[2] is d/dt MT1T2 in component Model (M).
 * RATES[13] is d/dt MT1T2M2pro in component Model (M).
 * RATES[3] is d/dt MT1T2M2proMT1 in component Model (M).
 * RATES[10] is d/dt C1 in component Model (M).
 * RATES[9] is d/dt C1_D in component Model (M).
 * RATES[11] is d/dt MT1_cat in component Model (M).
 * RATES[8] is d/dt T2 in component Model (M).
 * RATES[7] is d/dt M2_p in component Model (M).
 * RATES[0] is d/dt M2T2 in component Model (M).
 * RATES[15] is d/dt M2T2_star in component Model (um).
 * RATES[1] is d/dt M2C1 in component Model (M).
 * RATES[14] is d/dt MT1T2_star in component Model (um).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 5900000;
CONSTANTS[1] = 6.3;
CONSTANTS[2] = 33;
CONSTANTS[3] = 0.00000002;
CONSTANTS[4] = 2600;
CONSTANTS[5] = 0.0021;
CONSTANTS[6] = 0.0045;
CONSTANTS[7] = 2980000;
CONSTANTS[8] = 0.202;
CONSTANTS[9] = 140000;
CONSTANTS[10] = 0.0047;
CONSTANTS[11] = 0.02;
CONSTANTS[12] = 2800;
CONSTANTS[13] = 0.00197;
CONSTANTS[14] = 1000;
CONSTANTS[15] = 1;
CONSTANTS[16] = 3000;
CONSTANTS[17] = 0.0009;
STATES[0] = 0.0000000072;
STATES[1] = 0.0000085;
STATES[2] = 0.00000000139;
STATES[3] = 0.00000000056;
STATES[4] = 0.0000029;
STATES[5] = 0;
STATES[6] = 0;
STATES[7] = 0;
STATES[8] = 0;
STATES[9] = 0;
STATES[10] = 0;
STATES[11] = 0;
STATES[12] = 0;
STATES[13] = 0;
CONSTANTS[18] = 0;
CONSTANTS[19] = 0;
CONSTANTS[20] = 0;
STATES[14] = 0;
STATES[15] = 0;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[12] = 0.1001;
RATES[4] = 0.1001;
RATES[2] = 0.1001;
RATES[13] = 0.1001;
RATES[3] = 0.1001;
RATES[10] = 0.1001;
RATES[9] = 0.1001;
RATES[11] = 0.1001;
RATES[8] = 0.1001;
RATES[7] = 0.1001;
RATES[0] = 0.1001;
RATES[15] = 0.1001;
RATES[1] = 0.1001;
RATES[14] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[5] - (( - CONSTANTS[0]*STATES[5]*STATES[8]+ CONSTANTS[1]*STATES[0]) -  CONSTANTS[4]*STATES[5]*STATES[10])+ (CONSTANTS[5]+CONSTANTS[6])*STATES[1]+ CONSTANTS[11]*STATES[3];
resid[1] = RATES[6] - ((((((CONSTANTS[18] -  CONSTANTS[12]*STATES[6]*STATES[6]) -  CONSTANTS[7]*STATES[6]*STATES[8])+ CONSTANTS[8]*STATES[2]) -  CONSTANTS[14]*STATES[6]*STATES[10])+ (CONSTANTS[15]+CONSTANTS[13])*STATES[4]) -  CONSTANTS[16]*STATES[6]*STATES[13])+ CONSTANTS[17]*STATES[3]+ CONSTANTS[11]*STATES[3];
resid[2] = RATES[12] -  CONSTANTS[12]*STATES[6]*STATES[6];
resid[3] = RATES[4] -  CONSTANTS[14]*STATES[6]*STATES[10] -  (CONSTANTS[15]+CONSTANTS[13])*STATES[4];
resid[4] = RATES[2] - (( CONSTANTS[7]*STATES[6]*STATES[8] -  CONSTANTS[8]*STATES[2]) -  CONSTANTS[9]*STATES[2]*STATES[7])+ CONSTANTS[10]*STATES[13];
resid[5] = RATES[13] - (( CONSTANTS[9]*STATES[2]*STATES[7] -  CONSTANTS[10]*STATES[13]) -  CONSTANTS[16]*STATES[6]*STATES[13])+ CONSTANTS[17]*STATES[3];
resid[6] = RATES[3] - ( CONSTANTS[16]*STATES[6]*STATES[13] -  CONSTANTS[17]*STATES[3]) -  CONSTANTS[11]*STATES[3];
resid[7] = RATES[10] - (( - CONSTANTS[14]*STATES[6]*STATES[10]+ CONSTANTS[15]*STATES[4]) -  CONSTANTS[4]*STATES[5]*STATES[10])+ CONSTANTS[5]*STATES[1];
resid[8] = RATES[9] -  CONSTANTS[6]*STATES[1]+ CONSTANTS[13]*STATES[4];
resid[9] = RATES[11] -  CONSTANTS[12]*STATES[6]*STATES[6];
resid[10] = RATES[8] - (( - CONSTANTS[0]*STATES[5]*STATES[8]+ CONSTANTS[1]*STATES[0]+CONSTANTS[19]) -  CONSTANTS[7]*STATES[6]*STATES[8])+ CONSTANTS[8]*STATES[2];
resid[11] = RATES[7] - (CONSTANTS[20] -  CONSTANTS[9]*STATES[2]*STATES[7])+ CONSTANTS[10]*STATES[13];
resid[12] = RATES[0] - (( CONSTANTS[0]*STATES[5]*STATES[8] -  CONSTANTS[1]*STATES[0]) -  CONSTANTS[2]*STATES[0])+ CONSTANTS[3]*STATES[15];
resid[13] = RATES[15] -  CONSTANTS[2]*STATES[0] -  CONSTANTS[3]*STATES[15];
resid[14] = RATES[1] -  CONSTANTS[4]*STATES[5]*STATES[10] -  (CONSTANTS[5]+CONSTANTS[6])*STATES[1];
resid[15] = RATES[14] -  CONSTANTS[11]*STATES[3];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
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;
SI[15] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}