Generated Code
The following is c 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 4 entries in each of the rate and state variable arrays.
There are a total of 7 entries in the constant variable array.
*/
/*
* VOI is time in component environment (hour).
* STATES[0] is c in component c (dimensionless).
* ALGEBRAIC[0] is f in component c (dimensionless).
* CONSTANTS[0] is kcd in component reaction_constants (first_order_rate_constant).
* CONSTANTS[1] is ki1 in component reaction_constants (dimensionless).
* STATES[1] is o in component o (dimensionless).
* STATES[2] is a in component a (dimensionless).
* CONSTANTS[2] is kad in component reaction_constants (first_order_rate_constant).
* CONSTANTS[3] is ki2 in component reaction_constants (first_order_rate_constant).
* STATES[3] is r in component r (dimensionless).
* CONSTANTS[4] is kcr in component reaction_constants (first_order_rate_constant).
* CONSTANTS[5] is krd in component reaction_constants (first_order_rate_constant).
* CONSTANTS[6] is k in component reaction_constants (dimensionless).
* RATES[0] is d/dt c in component c (dimensionless).
* RATES[2] is d/dt a in component a (dimensionless).
* RATES[3] is d/dt r in component r (dimensionless).
* RATES[1] is d/dt o in component o (dimensionless).
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.6;
CONSTANTS[0] = 1.0;
CONSTANTS[1] = 0.1;
STATES[1] = 0.055;
STATES[2] = 0.055;
CONSTANTS[2] = 10.0;
CONSTANTS[3] = 0.1;
STATES[3] = 0.08;
CONSTANTS[4] = 0.05;
CONSTANTS[5] = 0.9;
CONSTANTS[6] = 0.001;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[2] = STATES[0]/(1.00000+( STATES[1]*STATES[3])/CONSTANTS[3]) - CONSTANTS[2]*STATES[2];
RATES[3] = (pow( STATES[1]*STATES[3], 2.00000)/( 1.00000*(CONSTANTS[6]+pow( STATES[1]*STATES[3], 2.00000)))+CONSTANTS[4]) - CONSTANTS[5]*STATES[3];
RATES[1] = 1.00000*(STATES[2] - STATES[1]);
ALGEBRAIC[0] = (VOI<1.00000 ? 1.00000 : 0.00000);
RATES[0] = 1.00000*((1.00000+ALGEBRAIC[0])/(1.00000+STATES[1]/CONSTANTS[1])) - CONSTANTS[0]*STATES[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI<1.00000 ? 1.00000 : 0.00000);
}
