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 2 entries in each of the rate and state variable arrays.
There are a total of 9 entries in the constant variable array.
*/
/*
* VOI is time in component environment (hour).
* STATES[0] is M in component M (nanomolar).
* ALGEBRAIC[0] is q in component M (dimensionless).
* CONSTANTS[0] is vm in component M (flux).
* CONSTANTS[1] is km in component M (first_order_rate_constant).
* CONSTANTS[2] is Pcrit in component M (nanomolar).
* CONSTANTS[3] is Keq in component M (per_nanomolar).
* STATES[1] is Pt in component Pt (nanomolar).
* CONSTANTS[4] is vp in component Pt (first_order_rate_constant).
* CONSTANTS[5] is kp1 in component Pt (flux).
* CONSTANTS[6] is kp3 in component Pt (first_order_rate_constant).
* CONSTANTS[7] is kp2 in component Pt (flux).
* CONSTANTS[8] is Jp in component Pt (nanomolar).
* RATES[0] is d/dt M in component M (nanomolar).
* RATES[1] is d/dt Pt in component Pt (nanomolar).
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 1.0;
CONSTANTS[1] = 0.1;
CONSTANTS[2] = 0.1;
CONSTANTS[3] = 200.0;
STATES[1] = 0.0;
CONSTANTS[4] = 0.5;
CONSTANTS[5] = 10.0;
CONSTANTS[6] = 0.1;
CONSTANTS[7] = 0.03;
CONSTANTS[8] = 0.05;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 2.00000/(1.00000+ pow((1.00000+ 8.00000*CONSTANTS[3]*STATES[1]), 1.0 / 2));
RATES[0] = CONSTANTS[0]/(1.00000+pow(( STATES[1]*(1.00000 - ALGEBRAIC[0]))/( 2.00000*CONSTANTS[2]), 2.00000)) - CONSTANTS[1]*STATES[0];
RATES[1] = CONSTANTS[4]*STATES[0] - (( CONSTANTS[5]*STATES[1]*ALGEBRAIC[0]+ CONSTANTS[7]*STATES[1])/(CONSTANTS[8]+STATES[1])+ CONSTANTS[6]*STATES[1]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 2.00000/(1.00000+ pow((1.00000+ 8.00000*CONSTANTS[3]*STATES[1]), 1.0 / 2));
}
