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 2 entries in the algebraic variable array.
   There are a total of 7 entries in each of the rate and state variable arrays.
   There are a total of 8 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Ca_t in component equations (uM_per_kg).
 * STATES[1] is TnCa_t in component equations (uM_per_kg).
 * STATES[2] is CB_on_t in component equations (uM_per_kg).
 * STATES[3] is Ca_released in component equations (uM_per_kg).
 * STATES[4] is Ca_sequestered in component equations (uM_per_kg).
 * STATES[5] is cumCB_on_t in component equations (uM_per_kg).
 * STATES[6] is cumCB_off_t in component equations (uM_per_kg).
 * ALGEBRAIC[0] is Ca_release_rate in component equations (uM_per_kg_per_second).
 * ALGEBRAIC[1] is dTnCa_t_dt in component equations (uM_per_kg_per_second).
 * CONSTANTS[0] is Ca_tot_released in component equations (uM_per_kg).
 * CONSTANTS[1] is total_Tn in component equations (uM_per_kg).
 * CONSTANTS[2] is total_CB in component equations (uM_per_kg).
 * CONSTANTS[3] is k_1 in component equations (kg_per_uM_per_second).
 * CONSTANTS[4] is k_2 in component equations (per_second).
 * CONSTANTS[5] is k_3 in component equations (per_second).
 * CONSTANTS[6] is f in component equations (kg_per_uM_per_second).
 * CONSTANTS[7] is g in component equations (per_second).
 * RATES[0] is d/dt Ca_t in component equations (uM_per_kg).
 * RATES[1] is d/dt TnCa_t in component equations (uM_per_kg).
 * RATES[2] is d/dt CB_on_t in component equations (uM_per_kg).
 * RATES[3] is d/dt Ca_released in component equations (uM_per_kg).
 * RATES[4] is d/dt Ca_sequestered in component equations (uM_per_kg).
 * RATES[5] is d/dt cumCB_on_t in component equations (uM_per_kg).
 * RATES[6] is d/dt cumCB_off_t in component equations (uM_per_kg).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0;
STATES[1] = 0;
STATES[2] = 0;
STATES[3] = 0;
STATES[4] = 0;
STATES[5] = 0;
STATES[6] = 0;
CONSTANTS[0] = 35;
CONSTANTS[1] = 70;
CONSTANTS[2] = 150;
CONSTANTS[3] = 5e6;
CONSTANTS[4] = 10;
CONSTANTS[5] = 1000;
CONSTANTS[6] = 0.4e6;
CONSTANTS[7] = 10;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 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] -  CONSTANTS[5]*STATES[0]) - ALGEBRAIC[1];
resid[1] = RATES[1] -  CONSTANTS[3]*STATES[0]*(CONSTANTS[1] - STATES[1]) -  CONSTANTS[4]*STATES[1];
resid[2] = RATES[2] -  CONSTANTS[6]*STATES[1]*(CONSTANTS[2] - STATES[2]) -  CONSTANTS[7]*STATES[2];
resid[3] = RATES[3] - ALGEBRAIC[0];
resid[4] = RATES[4] -  CONSTANTS[5]*STATES[0];
resid[5] = RATES[5] -  CONSTANTS[6]*STATES[1]*(CONSTANTS[2] - STATES[2]);
resid[6] = RATES[6] -  CONSTANTS[7]*STATES[2];
}
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] = (CONDVAR[0]>0.00000 ? 0.00000 :  20.0000*CONSTANTS[0]*(1.00000 -  10.0000*VOI));
ALGEBRAIC[1] =  CONSTANTS[3]*STATES[0]*(CONSTANTS[1] - STATES[1]) -  CONSTANTS[4]*STATES[1];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 0.100000;
}