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 9 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 16 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Ca_m in component Ca_m (micromolar).
 * ALGEBRAIC[0] is J_min in component J_min (micromolar).
 * ALGEBRAIC[1] is J_mout in component J_mout (micromolar).
 * CONSTANTS[0] is k_min in component J_min (micromolar).
 * STATES[1] is Ca_cyt in component Ca_cyt (micromolar).
 * CONSTANTS[1] is K_m in component J_min (micromolar).
 * CONSTANTS[2] is n in component J_min (micromolar).
 * CONSTANTS[3] is k_mout in component J_mout (micromolar).
 * ALGEBRAIC[2] is J_ERch in component J_ERch (micromolar).
 * ALGEBRAIC[3] is J_ERpump in component J_ERpump (micromolar).
 * ALGEBRAIC[4] is J_ERleak in component J_ERleak (micromolar).
 * ALGEBRAIC[7] is J_CaPr in component J_CaPr (micromolar).
 * ALGEBRAIC[8] is J_Pr in component J_Pr (micromolar).
 * CONSTANTS[4] is rho_m in component Ca_cyt (dimensionless).
 * CONSTANTS[5] is beta_m in component Ca_cyt (dimensionless).
 * STATES[2] is Ca_tot in component Ca_tot (micromolar).
 * STATES[3] is Ca_ER in component Ca_ER (micromolar).
 * CONSTANTS[6] is rho_ER in component Ca_ER (dimensionless).
 * CONSTANTS[7] is beta_ER in component Ca_ER (dimensionless).
 * ALGEBRAIC[5] is CaPr in component CaPr (micromolar).
 * CONSTANTS[8] is k_ERch in component J_ERch (micromolar).
 * CONSTANTS[9] is K_ch in component J_ERch (micromolar).
 * CONSTANTS[10] is k_ERpump in component J_ERpump (per_second).
 * CONSTANTS[11] is k_ERleak in component J_ERleak (per_second).
 * CONSTANTS[12] is k_min in component J_CaPr (per_second).
 * CONSTANTS[13] is k_plus in component J_Pr (per_micromolar_per_second).
 * ALGEBRAIC[6] is Pr in component Pr (micromolar).
 * CONSTANTS[14] is Ca_tot in component CaPr (micromolar).
 * CONSTANTS[15] is Pr_tot in component Pr (micromolar).
 * RATES[0] is d/dt Ca_m in component Ca_m (micromolar).
 * RATES[1] is d/dt Ca_cyt in component Ca_cyt (micromolar).
 * RATES[2] is d/dt Ca_tot in component Ca_tot (micromolar).
 * RATES[3] is d/dt Ca_ER in component Ca_ER (micromolar).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
CONSTANTS[0] = 330;
STATES[1] = 0.01;
CONSTANTS[1] = 1.6;
CONSTANTS[2] = 8;
CONSTANTS[3] = 0.5;
CONSTANTS[4] = 0.01;
CONSTANTS[5] = 0.025;
STATES[2] = 0.01;
STATES[3] = 20;
CONSTANTS[6] = 0.01;
CONSTANTS[7] = 0.0025;
CONSTANTS[8] = 0.001;
CONSTANTS[9] = 5;
CONSTANTS[10] = 20;
CONSTANTS[11] = 0.05;
CONSTANTS[12] = 0.01;
CONSTANTS[13] = 0.1;
CONSTANTS[14] = 90;
CONSTANTS[15] = 120;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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] - ALGEBRAIC[1];
resid[1] = RATES[1] -  ((((ALGEBRAIC[2] - ALGEBRAIC[3])+ALGEBRAIC[4]+ALGEBRAIC[7]) - ALGEBRAIC[8])+ (CONSTANTS[4]/CONSTANTS[5])*(ALGEBRAIC[1] - ALGEBRAIC[0]))*1.00000;
resid[2] = RATES[2] - STATES[1]+ (CONSTANTS[6]/CONSTANTS[7])*STATES[3]+ (CONSTANTS[4]/CONSTANTS[5])*STATES[0]+ALGEBRAIC[5];
resid[3] = RATES[3] -  (CONSTANTS[7]/CONSTANTS[6])*((ALGEBRAIC[3] - ALGEBRAIC[4]) - ALGEBRAIC[2])*1.00000;
}
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[0]*pow(STATES[1], CONSTANTS[2]))/(pow(CONSTANTS[1], CONSTANTS[2])+pow(STATES[1], CONSTANTS[2]));
ALGEBRAIC[1] = ( CONSTANTS[3]*STATES[0])/1.00000;
ALGEBRAIC[2] =  (( CONSTANTS[8]*pow(STATES[1], 2.00000))/(pow(CONSTANTS[9], 2.00000)+pow(STATES[1], 2.00000)))*(STATES[3] - STATES[1]);
ALGEBRAIC[3] =  CONSTANTS[10]*STATES[1];
ALGEBRAIC[4] =  CONSTANTS[11]*(STATES[3] - STATES[1]);
ALGEBRAIC[5] = CONSTANTS[14] - (STATES[1]+ (CONSTANTS[6]/CONSTANTS[7])*STATES[3]);
ALGEBRAIC[7] =  CONSTANTS[12]*ALGEBRAIC[5];
ALGEBRAIC[6] = CONSTANTS[15] - ALGEBRAIC[5];
ALGEBRAIC[8] =  CONSTANTS[13]*STATES[1]*ALGEBRAIC[6];
}
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)
{
}