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 2 entries in the algebraic variable array.
There are a total of 2 entries in each of the rate and state variable arrays.
There are a total of 4 entries in the constant variable array.
*/
/*
* STATES[0] is A in component equation_1 (conc).
* STATES[1] is D in component equation_1 (conc).
* ALGEBRAIC[0] is kf in component equation_1 (per_sec).
* CONSTANTS[0] is kb in component equation_1 (per_sec).
* VOI is time in component equation_1 (second).
* CONSTANTS[1] is kf_ in component equation_1 (per_conc_per_sec).
* CONSTANTS[2] is Tk in component equation_1 (kelvin).
* CONSTANTS[3] is T in component equation_1 (kelvin).
* ALGEBRAIC[1] is V in component equation_1 (conc).
* RATES[0] is d/dt A in component equation_1 (conc).
* RATES[1] is d/dt D in component equation_1 (conc).
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.99;
STATES[1] = 0;
CONSTANTS[0] = 0.00777;
CONSTANTS[1] = 0.00333;
CONSTANTS[2] = 313;
CONSTANTS[3] = 340;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = CONSTANTS[1]*exp(CONSTANTS[3]/CONSTANTS[2])*(1.00000 - STATES[0]);
RATES[0] = - ALGEBRAIC[0]*STATES[0]+ CONSTANTS[0]*((1.00000 - STATES[0]) - STATES[1]);
RATES[1] = ALGEBRAIC[0]*((1.00000 - STATES[0]) - STATES[1]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = CONSTANTS[1]*exp(CONSTANTS[3]/CONSTANTS[2])*(1.00000 - STATES[0]);
ALGEBRAIC[1] = (1.00000 - STATES[0]) - STATES[1];
}
