Generated Code

The following is c code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 7 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 11 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is sigma in component parameters (dm).
 * CONSTANTS[1] is CNG_tot in component parameters (mole_per_dm_squared).
 * CONSTANTS[2] is CaM_tot in component parameters (mole_per_dm_cubed).
 * CONSTANTS[3] is km_CNG_0 in component parameters (per_second).
 * CONSTANTS[4] is km_CaM4 in component parameters (per_second).
 * CONSTANTS[5] is kp_CaM4 in component parameters (dm_6_per_second_per_mole_squared).
 * CONSTANTS[6] is kp_CNG_i in component parameters (dm_3_per_second_per_mole).
 * CONSTANTS[7] is km_CNG_i in component parameters (per_second).
 * CONSTANTS[8] is i_Ca in component parameters (per_second).
 * CONSTANTS[9] is k_Ca in component parameters (mole_per_dm_squared_per_second).
 * CONSTANTS[10] is K_Ca in component parameters (mole_per_dm_cubed).
 * ALGEBRAIC[0] is kp_act in component parameters (per_second).
 * STATES[0] is CNG_o in component dCNG_o_dt (mole_per_dm_squared).
 * ALGEBRAIC[1] is CNG_o_normalized in component dCNG_o_dt (dimensionless).
 * STATES[1] is CNG_i in component dCNG_i_dt (mole_per_dm_squared).
 * STATES[2] is CaM4 in component dCaM4_dt (mole_per_dm_cubed).
 * STATES[3] is Ca in component dCa_dt (mole_per_dm_cubed).
 * ALGEBRAIC[2] is Ca_normalized in component dCa_dt (dimensionless).
 * ALGEBRAIC[3] is CaM4_normalized in component dCaM4_dt (dimensionless).
 * ALGEBRAIC[4] is CNG_i_normalized in component dCNG_i_dt (dimensionless).
 * ALGEBRAIC[5] is CNG_c in component dCNG_c_dt (mole_per_dm_squared).
 * ALGEBRAIC[6] is CaM in component dCaM_dt (mole_per_dm_cubed).
 * RATES[0] is d/dt CNG_o in component dCNG_o_dt (mole_per_dm_squared).
 * RATES[3] is d/dt Ca in component dCa_dt (mole_per_dm_cubed).
 * RATES[2] is d/dt CaM4 in component dCaM4_dt (mole_per_dm_cubed).
 * RATES[1] is d/dt CNG_i in component dCNG_i_dt (mole_per_dm_squared).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 5e-7;
CONSTANTS[1] = 1.3e-13;
CONSTANTS[2] = 2e-5;
CONSTANTS[3] = 1e-2;
CONSTANTS[4] = 2.5;
CONSTANTS[5] = 1.1e9;
CONSTANTS[6] = 2.1e6;
CONSTANTS[7] = 3.4e-1;
CONSTANTS[8] = 2e4;
CONSTANTS[9] = 1e-10;
CONSTANTS[10] = 1.2e-7;
STATES[0] = 0;
STATES[1] = 0;
STATES[2] = 0;
STATES[3] = 0;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[3] = ( (STATES[0]/CONSTANTS[0])*CONSTANTS[8] - ( (CONSTANTS[9]/CONSTANTS[0])*STATES[3])/(STATES[3]+CONSTANTS[10])) -  4.00000*( CONSTANTS[5]*pow(STATES[3], 2.00000)*((CONSTANTS[2] - STATES[2]) - STATES[1]/CONSTANTS[0]) -  CONSTANTS[4]*STATES[2]);
RATES[2] = (( CONSTANTS[5]*pow(STATES[3], 2.00000)*((CONSTANTS[2] - STATES[2]) - STATES[1]/CONSTANTS[0]) -  CONSTANTS[4]*STATES[2]) -  (CONSTANTS[6]/CONSTANTS[0])*STATES[2]*(CONSTANTS[1] - STATES[0]))+ (CONSTANTS[7]/CONSTANTS[0])*STATES[1];
RATES[1] =  - CONSTANTS[7]*STATES[1]+ CONSTANTS[6]*STATES[2]*(CONSTANTS[1] - STATES[1]);
ALGEBRAIC[0] = (VOI>0.100000&&VOI<0.200000 ? 5.50000 : VOI>4.10000&&VOI<4.20000 ? 5.50000 : 1.60000e-05);
RATES[0] = ( ALGEBRAIC[0]*((CONSTANTS[1] - STATES[0]) - STATES[1]) -  CONSTANTS[3]*STATES[0]) -  CONSTANTS[6]*STATES[0]*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI>0.100000&&VOI<0.200000 ? 5.50000 : VOI>4.10000&&VOI<4.20000 ? 5.50000 : 1.60000e-05);
ALGEBRAIC[1] = STATES[0]/CONSTANTS[1];
ALGEBRAIC[2] =  STATES[3]*10000.0;
ALGEBRAIC[3] = STATES[2]/CONSTANTS[2];
ALGEBRAIC[4] = STATES[1]/CONSTANTS[1];
ALGEBRAIC[5] = (CONSTANTS[1] - STATES[0]) - STATES[1];
ALGEBRAIC[6] = (CONSTANTS[2] - STATES[2]) -  (1.00000/CONSTANTS[0])*STATES[1];
}