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 4 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 25 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Vm in component membrane (millivolt).
 * CONSTANTS[0] is C in component membrane (picoF).
 * ALGEBRAIC[2] is i_K in component potassium_current (picoA).
 * ALGEBRAIC[3] is i_R in component repolarising_current (picoA).
 * STATES[1] is IP3 in component IP3 (nanomolar).
 * CONSTANTS[1] is m3IP3 in component IP3 (dimensionless).
 * CONSTANTS[2] is m4IP3 in component IP3 (dimensionless).
 * CONSTANTS[3] is kIP3 in component IP3 (first_order_rate_constant).
 * CONSTANTS[4] is A in component IP3 (dimensionless).
 * STATES[2] is Ca in component Ca (nanomolar).
 * CONSTANTS[5] is m3SR in component Ca (dimensionless).
 * CONSTANTS[6] is m4SR in component Ca (dimensionless).
 * CONSTANTS[7] is m3PMCA in component Ca (dimensionless).
 * CONSTANTS[8] is m4PMCA in component Ca (dimensionless).
 * CONSTANTS[9] is kSR_rel in component Ca (flux).
 * CONSTANTS[10] is kPMCA in component Ca (flux).
 * ALGEBRAIC[1] is Jcat in component Jcat (flux).
 * CONSTANTS[11] is ECa in component Jcat (millivolt).
 * CONSTANTS[12] is Gcat in component Jcat (nanomolar_per_millivolt_second).
 * CONSTANTS[13] is m3cat in component Jcat (dimensionless).
 * CONSTANTS[14] is m4cat in component Jcat (dimensionless).
 * CONSTANTS[15] is Gtot in component potassium_current (picoS).
 * ALGEBRAIC[0] is PoBKCa in component potassium_current (dimensionless).
 * CONSTANTS[16] is PoSKCa in component potassium_current (dimensionless).
 * CONSTANTS[17] is E_K in component potassium_current (millivolt).
 * CONSTANTS[18] is a in component potassium_current (dimensionless).
 * CONSTANTS[19] is b in component potassium_current (dimensionless).
 * CONSTANTS[20] is c in component potassium_current (dimensionless).
 * CONSTANTS[21] is m3 in component potassium_current (dimensionless).
 * CONSTANTS[22] is m4 in component potassium_current (dimensionless).
 * CONSTANTS[23] is GR in component repolarising_current (picoS).
 * CONSTANTS[24] is Vrest in component repolarising_current (millivolt).
 * RATES[0] is d/dt Vm in component membrane (millivolt).
 * RATES[1] is d/dt IP3 in component IP3 (nanomolar).
 * RATES[2] is d/dt Ca in component Ca (nanomolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -31.1;
CONSTANTS[0] = 1.0;
STATES[1] = 1.0;
CONSTANTS[1] = 4.0;
CONSTANTS[2] = 55.0;
CONSTANTS[3] = 0.1733;
CONSTANTS[4] = 0.211;
STATES[2] = 50.0;
CONSTANTS[5] = 1.1;
CONSTANTS[6] = 0.3;
CONSTANTS[7] = -6.19;
CONSTANTS[8] = 0.39;
CONSTANTS[9] = 180.0;
CONSTANTS[10] = 0.679;
CONSTANTS[11] = 50.0;
CONSTANTS[12] = 0.66;
CONSTANTS[13] = -6.18;
CONSTANTS[14] = 0.37;
CONSTANTS[15] = 6927;
CONSTANTS[16] = 0.5;
CONSTANTS[17] = -80.0;
CONSTANTS[18] = 53.3;
CONSTANTS[19] = -80.8;
CONSTANTS[20] = -6.4;
CONSTANTS[21] = 1.32E-3;
CONSTANTS[22] = 0.30;
CONSTANTS[23] = 955.0;
CONSTANTS[24] = -31.1;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[1] =  CONSTANTS[4]*(1.00000+ tanh((CONSTANTS[1] - VOI)/CONSTANTS[2])) -  CONSTANTS[3]*STATES[1];
RATES[2] =  (CONSTANTS[9]/2.00000)*(1.00000+ tanh((STATES[1] - CONSTANTS[5])/CONSTANTS[6])) -  (CONSTANTS[10]/2.00000)*(1.00000+ tanh((arbitrary_log(STATES[2], 10) - CONSTANTS[7])/CONSTANTS[8]));
ALGEBRAIC[0] =  0.500000*(1.00000+ tanh(( (arbitrary_log(STATES[2], 10) - CONSTANTS[20])*(STATES[0] - CONSTANTS[19]) - CONSTANTS[18])/( CONSTANTS[21]*pow((STATES[0]+ CONSTANTS[18]*(arbitrary_log(STATES[2], 10) - CONSTANTS[20])) - CONSTANTS[19], 2.00000)+CONSTANTS[22])));
ALGEBRAIC[2] =  CONSTANTS[15]*(STATES[0] - CONSTANTS[17])*( 0.400000*ALGEBRAIC[0]+ 0.600000*CONSTANTS[16]);
ALGEBRAIC[3] =  CONSTANTS[23]*(STATES[0] - CONSTANTS[24]);
RATES[0] =  - (1.00000/CONSTANTS[0])*(ALGEBRAIC[2]+ALGEBRAIC[3]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  0.500000*(1.00000+ tanh(( (arbitrary_log(STATES[2], 10) - CONSTANTS[20])*(STATES[0] - CONSTANTS[19]) - CONSTANTS[18])/( CONSTANTS[21]*pow((STATES[0]+ CONSTANTS[18]*(arbitrary_log(STATES[2], 10) - CONSTANTS[20])) - CONSTANTS[19], 2.00000)+CONSTANTS[22])));
ALGEBRAIC[2] =  CONSTANTS[15]*(STATES[0] - CONSTANTS[17])*( 0.400000*ALGEBRAIC[0]+ 0.600000*CONSTANTS[16]);
ALGEBRAIC[3] =  CONSTANTS[23]*(STATES[0] - CONSTANTS[24]);
ALGEBRAIC[1] =  ( CONSTANTS[12]*(CONSTANTS[11] - STATES[0]))*( 0.500000*(1.00000+ tanh((arbitrary_log(STATES[2], 10) - CONSTANTS[13])/CONSTANTS[14])));
}