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 2 entries in the algebraic variable array.
There are a total of 4 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 M in component M (dimensionless).
* STATES[1] is AM in component AM (dimensionless).
* STATES[2] is Mp in component Mp (dimensionless).
* ALGEBRAIC[0] is k1 in component model_parameters (first_order_rate_constant).
* CONSTANTS[0] is k2 in component model_parameters (first_order_rate_constant).
* CONSTANTS[1] is gx in component model_parameters (first_order_rate_constant).
* STATES[3] is AMp in component AMp (dimensionless).
* CONSTANTS[2] is fp in component model_parameters (first_order_rate_constant).
* CONSTANTS[3] is gp in component model_parameters (first_order_rate_constant).
* CONSTANTS[4] is k5 in component model_parameters (first_order_rate_constant).
* ALGEBRAIC[1] is k6 in component model_parameters (first_order_rate_constant).
* CONSTANTS[5] is fp1 in component model_parameters (first_order_rate_constant).
* CONSTANTS[6] is gp1 in component model_parameters (first_order_rate_constant).
* CONSTANTS[7] is g1 in component model_parameters (first_order_rate_constant).
* CONSTANTS[8] is gp3 in component model_parameters (first_order_rate_constant).
* CONSTANTS[9] is g3 in component model_parameters (first_order_rate_constant).
* CONSTANTS[10] is g2 in component model_parameters (first_order_rate_constant).
* CONSTANTS[11] is gp2 in component model_parameters (first_order_rate_constant).
* RATES[0] is d/dt M in component M (dimensionless).
* RATES[2] is d/dt Mp in component Mp (dimensionless).
* RATES[3] is d/dt AMp in component AMp (dimensionless).
* RATES[1] is d/dt AM in component AM (dimensionless).
* There are a total of 2 condition variables.
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.0;
STATES[1] = 0.0;
STATES[2] = 0.0;
CONSTANTS[0] = 0.1;
CONSTANTS[1] = 0.11;
STATES[3] = 0.0;
CONSTANTS[2] = 0.44;
CONSTANTS[3] = 0.11;
CONSTANTS[4] = 0.1;
CONSTANTS[5] = 0.88;
CONSTANTS[6] = 0.22;
CONSTANTS[7] = 0.01;
CONSTANTS[8] = 3.00000*CONSTANTS[6];
CONSTANTS[9] = 3.00000*CONSTANTS[7];
CONSTANTS[10] = 20.0000*CONSTANTS[7];
CONSTANTS[11] = 4.00000*(CONSTANTS[5]+CONSTANTS[6]);
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[1] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - ( ALGEBRAIC[0]*STATES[0])+ CONSTANTS[0]*STATES[2]+ CONSTANTS[1]*STATES[1];
resid[1] = RATES[2] - ( CONSTANTS[3]*STATES[3]+ ALGEBRAIC[0]*STATES[0]) - (CONSTANTS[0]+CONSTANTS[2])*STATES[2];
resid[2] = RATES[3] - ( CONSTANTS[2]*STATES[2]+ ALGEBRAIC[1]*STATES[1]) - (CONSTANTS[4]+CONSTANTS[3])*STATES[3];
resid[3] = RATES[1] - CONSTANTS[4]*STATES[3] - (ALGEBRAIC[1]+CONSTANTS[1])*STATES[1];
}
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[0] = (CONDVAR[0]>0.00000&&CONDVAR[1]<0.00000 ? 0.350000 : 0.0600000);
ALGEBRAIC[1] = ALGEBRAIC[0];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 0.00000;
CONDVAR[1] = VOI - 5.00000;
}
