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 5 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 7 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * ALGEBRAIC[0] is kappa_L1 in component rate_constants (per_second).
 * CONSTANTS[0] is kappa_P1 in component rate_constants (per_second).
 * ALGEBRAIC[3] is kappa_L2 in component rate_constants (per_second).
 * CONSTANTS[1] is kappa_P2 in component rate_constants (per_second).
 * CONSTANTS[2] is kappa_L2_0 in component rate_constants (per_second).
 * CONSTANTS[3] is kappa_L2_1 in component rate_constants (per_second).
 * ALGEBRAIC[1] is Kd_Ca in component rate_constants (nanomolar).
 * CONSTANTS[4] is n in component rate_constants (dimensionless).
 * STATES[0] is Ca_i in component cytosolic_calcium (nanomolar).
 * CONSTANTS[5] is Ca_o in component cytosolic_calcium (nanomolar).
 * ALGEBRAIC[2] is Ca_i_ss in component cytosolic_calcium (nanomolar).
 * CONSTANTS[6] is gamma in component cytosolic_calcium (dimensionless).
 * STATES[1] is Ca_s in component subspace_calcium (nanomolar).
 * ALGEBRAIC[4] is Ca_s_ss in component subspace_calcium (nanomolar).
 * RATES[0] is d/dt Ca_i in component cytosolic_calcium (nanomolar).
 * RATES[1] is d/dt Ca_s in component subspace_calcium (nanomolar).
 * There are a total of 4 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.132;
CONSTANTS[1] = 3.78;
CONSTANTS[2] = 0.054;
CONSTANTS[3] = 2.4;
CONSTANTS[4] = 3;
STATES[0] = 75;
CONSTANTS[5] = 2000000.0;
CONSTANTS[6] = 0.24;
STATES[1] = 5300.0;
RATES[0] = 0.1;
RATES[1] = 0.1;
}
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[0]+ CONSTANTS[6]*(ALGEBRAIC[3]+CONSTANTS[1]))*STATES[0]+ CONSTANTS[6]*ALGEBRAIC[3]*STATES[1]+ ALGEBRAIC[0]*CONSTANTS[5];
resid[1] = RATES[1] -  (ALGEBRAIC[3]+CONSTANTS[1])*STATES[0] -  ALGEBRAIC[3]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = CONSTANTS[5]/(1.00000+CONSTANTS[0]/ALGEBRAIC[0]);
ALGEBRAIC[4] =  ALGEBRAIC[2]*(1.00000+CONSTANTS[1]/ALGEBRAIC[3]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? 5.00000e-06 : 2.00000e-05);
ALGEBRAIC[1] = (CONDVAR[2]>=0.00000&&CONDVAR[3]<0.00000 ? 1.00000 : 0.500000);
ALGEBRAIC[3] = CONSTANTS[2]+CONSTANTS[3]/(1.00000+pow( 1000.00*ALGEBRAIC[1]/STATES[0], CONSTANTS[4]));
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 0.00000;
CONDVAR[1] = VOI - 40.0000;
CONDVAR[2] = VOI - 0.00000;
CONDVAR[3] = VOI - 80.0000;
}