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 8 entries in each of the rate and state variable arrays.
   There are a total of 13 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is Rs in component Rs (number_per_cell).
 * STATES[1] is L in component L (picomolar).
 * STATES[2] is Cs in component Cs (number_per_cell).
 * CONSTANTS[0] is Vs in component model_parameters (number_per_cell_minute).
 * CONSTANTS[10] is kf in component model_parameters (second_order_rate_constant).
 * CONSTANTS[1] is kr in component model_parameters (first_order_rate_constant).
 * CONSTANTS[2] is kt in component model_parameters (first_order_rate_constant).
 * CONSTANTS[3] is ksyn in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is ke in component model_parameters (first_order_rate_constant).
 * STATES[3] is Ri in component Ri (number_per_cell).
 * STATES[4] is Li in component Li (picomolar).
 * STATES[5] is Ci in component Ci (number_per_cell).
 * CONSTANTS[12] is kfe in component model_parameters (second_order_rate_constant).
 * CONSTANTS[11] is kre in component model_parameters (first_order_rate_constant).
 * CONSTANTS[5] is kh in component model_parameters (first_order_rate_constant).
 * CONSTANTS[6] is kx in component model_parameters (first_order_rate_constant).
 * CONSTANTS[7] is Ve in component model_parameters (L_per_cell).
 * CONSTANTS[8] is NA in component model_parameters (number_per_picomole).
 * STATES[6] is Ld in component Ld (number_per_cell).
 * STATES[7] is Y in component Y (cell_per_L).
 * CONSTANTS[9] is IL2 in component model_parameters (dimensionless).
 * RATES[0] is d/dt Rs in component Rs (number_per_cell).
 * RATES[2] is d/dt Cs in component Cs (number_per_cell).
 * RATES[3] is d/dt Ri in component Ri (number_per_cell).
 * RATES[5] is d/dt Ci in component Ci (number_per_cell).
 * RATES[4] is d/dt Li in component Li (picomolar).
 * RATES[6] is d/dt Ld in component Ld (number_per_cell).
 * RATES[1] is d/dt L in component L (picomolar).
 * RATES[7] is d/dt Y in component Y (cell_per_L).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1500;
STATES[1] = 10;
STATES[2] = 1;
CONSTANTS[0] = 11;
CONSTANTS[1] = 0.0138;
CONSTANTS[2] = 0.007;
CONSTANTS[3] = 0.0011;
CONSTANTS[4] = 0.04;
STATES[3] = 300;
STATES[4] = 0.01;
STATES[5] = 1;
CONSTANTS[5] = 0.035;
CONSTANTS[6] = 0.15;
CONSTANTS[7] = 1e-14;
CONSTANTS[8] = 6.022e11;
STATES[6] = 1;
STATES[7] = 2.5e8;
CONSTANTS[9] = 1;
CONSTANTS[10] = (CONSTANTS[9]==1.00000 ? CONSTANTS[1]/11.1000 : CONSTANTS[1]/8.20000);
CONSTANTS[11] = (CONSTANTS[9]==1.00000 ?  CONSTANTS[1]*8.00000 :  CONSTANTS[1]*5.00000);
CONSTANTS[12] = (CONSTANTS[9]==1.00000 ? CONSTANTS[11]/1000.00 : CONSTANTS[11]/3000.00);
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[5] = 0.1001;
RATES[4] = 0.1001;
RATES[6] = 0.1001;
RATES[1] = 0.1001;
RATES[7] = 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]+CONSTANTS[3])*STATES[2]+CONSTANTS[0]) - ( CONSTANTS[10]*STATES[1]*STATES[0]+ CONSTANTS[2]*STATES[0]);
resid[1] = RATES[2] -  CONSTANTS[10]*STATES[1]*STATES[0] -  (CONSTANTS[1]+CONSTANTS[4])*STATES[2];
resid[2] = RATES[3] - ( CONSTANTS[11]*STATES[5]+ CONSTANTS[2]*STATES[0]) - ( CONSTANTS[12]*STATES[4]*STATES[3]+ CONSTANTS[5]*STATES[3]);
resid[3] = RATES[5] - ( CONSTANTS[12]*STATES[4]*STATES[3]+ CONSTANTS[4]*STATES[2]) -  (CONSTANTS[11]+CONSTANTS[5])*STATES[5];
resid[4] = RATES[4] - ( CONSTANTS[11]*STATES[5] -  CONSTANTS[12]*STATES[4]*STATES[3])/( CONSTANTS[7]*CONSTANTS[8]) -  CONSTANTS[6]*STATES[4];
resid[5] = RATES[6] -  CONSTANTS[5]*STATES[5];
resid[6] = RATES[1] - ( (( CONSTANTS[1]*STATES[2]+ CONSTANTS[6]*STATES[4]*CONSTANTS[7]*CONSTANTS[8]) -  CONSTANTS[10]*STATES[1]*STATES[0])*STATES[7])/CONSTANTS[8];
resid[7] = RATES[7] - (CONDVAR[0]>0.00000 ?  (( 600.000*STATES[2])/(250.000+STATES[2]) - 200.000)*1000.00 : 0.00000);
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = (( 600.000*STATES[2])/(250.000+STATES[2]) - 200.000) - 0.00000;
}