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 3 entries in the algebraic variable array.
There are a total of 3 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 enviroment (second).
* STATES[0] is P in component P (micromolar).
* CONSTANTS[0] is V_p in component P (per_second).
* CONSTANTS[1] is k_p in component P (micromolar).
* CONSTANTS[2] is IPR_3_flux in component P (flux).
* STATES[1] is c in component c (micromolar).
* ALGEBRAIC[2] is J_flux in component J_flux (flux).
* ALGEBRAIC[0] is J_pump in component J_pump (flux).
* CONSTANTS[12] is J_leak in component J_leak (flux).
* CONSTANTS[3] is k_flux in component J_flux (micromolar_per_second).
* ALGEBRAIC[1] is mu in component mu (dimensionless).
* STATES[2] is h in component h (dimensionless).
* CONSTANTS[4] is b in component J_flux (dimensionless).
* CONSTANTS[5] is k_1 in component J_flux (micromolar).
* CONSTANTS[6] is gamma in component J_pump (micromolar_per_second).
* CONSTANTS[7] is k_gamma in component J_pump (micromolar).
* CONSTANTS[8] is beta in component J_leak (flux).
* CONSTANTS[9] is k_mu in component mu (micromolar).
* CONSTANTS[10] is k_2 in component h (micromolar).
* CONSTANTS[11] is tau_h in component h (second).
* RATES[0] is d/dt P in component P (micromolar).
* RATES[1] is d/dt c in component c (micromolar).
* RATES[2] is d/dt h in component h (dimensionless).
* There are a total of 1 condition variables.
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0;
CONSTANTS[0] = 0.08;
CONSTANTS[1] = 1;
CONSTANTS[2] = 0.72;
STATES[1] = 0.3;
CONSTANTS[3] = 3;
STATES[2] = 1;
CONSTANTS[4] = 0.11;
CONSTANTS[5] = 0.7;
CONSTANTS[6] = 1;
CONSTANTS[7] = 0.27;
CONSTANTS[8] = 0.15;
CONSTANTS[9] = 0.01;
CONSTANTS[10] = 0.7;
CONSTANTS[11] = 0.2;
CONSTANTS[12] = CONSTANTS[8];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - (CONDVAR[0]<=0.00000 ? CONSTANTS[2] - ( CONSTANTS[0]*STATES[0]*CONSTANTS[1])/(CONSTANTS[1]+STATES[0]) : ( - CONSTANTS[0]*STATES[0]*CONSTANTS[1])/(CONSTANTS[1]+STATES[0]));
resid[1] = RATES[1] - (ALGEBRAIC[2] - ALGEBRAIC[0])+CONSTANTS[12];
resid[2] = RATES[2] - (pow(CONSTANTS[10], 2.00000)/(pow(CONSTANTS[10], 2.00000)+pow(STATES[1], 2.00000)) - STATES[2])/CONSTANTS[11];
}
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] = ( CONSTANTS[6]*pow(STATES[1], 2.00000))/(pow(CONSTANTS[7], 2.00000)+pow(STATES[1], 2.00000));
ALGEBRAIC[1] = pow(STATES[0], 3.00000)/(pow(CONSTANTS[9], 3.00000)+pow(STATES[0], 3.00000));
ALGEBRAIC[2] = CONSTANTS[3]*ALGEBRAIC[1]*STATES[2]*(CONSTANTS[4]+( (1.00000 - CONSTANTS[4])*STATES[1])/(CONSTANTS[5]+STATES[1]));
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 15.0000;
}
