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 8 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 10 entries in the constant variable array.
 */
/*
 * VOI is t in component environment (second).
 * CONSTANTS[0] is C_m in component environment (fF).
 * CONSTANTS[1] is w_i in component environment (pL).
 * CONSTANTS[2] is w_o in component environment (pL).
 * STATES[0] is q_mem in component environment (fC).
 * CONSTANTS[3] is R in component environment (J_per_K_per_mol).
 * CONSTANTS[4] is T in component environment (kelvin).
 * CONSTANTS[5] is F in component environment (C_per_mol).
 * ALGEBRAIC[6] is v_CaB in component CaB (fmol_per_sec).
 * STATES[1] is q_Ca_o in component environment (fmol).
 * STATES[2] is q_Ca_i in component environment (fmol).
 * ALGEBRAIC[0] is V_mem in component environment (J_per_C).
 * ALGEBRAIC[7] is I_mem_CaB in component CaB (fA).
 * CONSTANTS[6] is kappa_CaB in component CaB_parameters (fmol_per_sec).
 * CONSTANTS[7] is K_Ca_i in component CaB_parameters (per_fmol).
 * CONSTANTS[8] is K_Ca_o in component CaB_parameters (per_fmol).
 * CONSTANTS[9] is zCa in component CaB_parameters (dimensionless).
 * ALGEBRAIC[1] is mu_Ca_i in component CaB (J_per_mol).
 * ALGEBRAIC[2] is mu_Ca_o in component CaB (J_per_mol).
 * ALGEBRAIC[3] is Af_CaB in component CaB (J_per_mol).
 * ALGEBRAIC[4] is Ar_CaB in component CaB (J_per_mol).
 * ALGEBRAIC[5] is Am_CaB in component CaB (J_per_mol).
 * RATES[2] is d/dt q_Ca_i in component environment (fmol).
 * RATES[1] is d/dt q_Ca_o in component environment (fmol).
 * RATES[0] is d/dt q_mem in component environment (fC).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1e6;
CONSTANTS[1] = 25.8;
CONSTANTS[2] = 3.52;
STATES[0] = -8.5e4;
CONSTANTS[3] = 8.31;
CONSTANTS[4] = 310;
CONSTANTS[5] = 96500;
STATES[1] = 9.3276;
STATES[2] = 0.00456;
CONSTANTS[6] = 2.73233e-05;
CONSTANTS[7] = 0.000151953;
CONSTANTS[8] = 0.00100872;
CONSTANTS[9] = 2;
RATES[2] = 0.1001;
RATES[1] = 0.1001;
RATES[0] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[2] - - ALGEBRAIC[6];
resid[1] = RATES[1] - ALGEBRAIC[6];
resid[2] = RATES[0] - ALGEBRAIC[7];
}
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] = STATES[0]/CONSTANTS[0];
ALGEBRAIC[1] =  CONSTANTS[3]*CONSTANTS[4]*log( CONSTANTS[7]*STATES[2]);
ALGEBRAIC[3] = ALGEBRAIC[1]+ CONSTANTS[9]*CONSTANTS[5]*ALGEBRAIC[0];
ALGEBRAIC[2] =  CONSTANTS[3]*CONSTANTS[4]*log( CONSTANTS[8]*STATES[1]);
ALGEBRAIC[4] = ALGEBRAIC[2];
ALGEBRAIC[5] =  CONSTANTS[9]*CONSTANTS[5]*ALGEBRAIC[0];
ALGEBRAIC[6] = (ALGEBRAIC[5]==0.00000 ?  CONSTANTS[6]*(exp(ALGEBRAIC[3]/( CONSTANTS[3]*CONSTANTS[4])) - exp(ALGEBRAIC[4]/( CONSTANTS[3]*CONSTANTS[4]))) :  ((( CONSTANTS[6]*ALGEBRAIC[5])/( CONSTANTS[3]*CONSTANTS[4]))/(exp(ALGEBRAIC[5]/( CONSTANTS[3]*CONSTANTS[4])) - 1.00000))*(exp(ALGEBRAIC[3]/( CONSTANTS[3]*CONSTANTS[4])) - exp(ALGEBRAIC[4]/( CONSTANTS[3]*CONSTANTS[4]))));
ALGEBRAIC[7] =  - CONSTANTS[9]*CONSTANTS[5]*ALGEBRAIC[6];
}
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)
{
}