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 2 entries in the algebraic variable array.
   There are a total of 1 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 (s).
 * CONSTANTS[0] is HR in component Environment (ratepm).
 * CONSTANTS[5] is hrf in component Environment (Hz).
 * CONSTANTS[1] is PRint in component LVTiming (s).
 * ALGEBRAIC[0] is beattime in component LVTiming (s).
 * CONSTANTS[2] is Esys in component LVElastanceFunction (elastance).
 * CONSTANTS[3] is Edia in component LVElastanceFunction (elastance).
 * CONSTANTS[4] is TsK in component LVElastanceFunction (s).
 * CONSTANTS[6] is Ts in component LVElastanceFunction (s).
 * ALGEBRAIC[1] is E_LV in component LVElastanceFunction (elastance).
 * STATES[0] is dummy in component dummy (dimensionless).
 * RATES[0] is d/dt dummy in component dummy (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 70;
CONSTANTS[1] = 0.00012;
CONSTANTS[2] = 5.6;
CONSTANTS[3] = 0.19;
CONSTANTS[4] = 0.35;
STATES[0] = 10;
CONSTANTS[5] = CONSTANTS[0]/60.0000;
CONSTANTS[6] =  CONSTANTS[4]* pow(( 1.00000*CONSTANTS[5]), 1.0 / 2);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  STATES[0]*- 3.00000;
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI -  floor(VOI/CONSTANTS[5])*CONSTANTS[5]) - CONSTANTS[1];
ALGEBRAIC[1] = (ALGEBRAIC[0]>=0.00000&&ALGEBRAIC[0]<=CONSTANTS[6] ? CONSTANTS[3]+( (CONSTANTS[2] - CONSTANTS[3])*(1.00000 - cos((  3.14159265358979*ALGEBRAIC[0])/CONSTANTS[6])))/2.00000 : ALGEBRAIC[0]< 1.50000*CONSTANTS[6]&&ALGEBRAIC[0]>=CONSTANTS[6] ? CONSTANTS[3]+( (CONSTANTS[2] - CONSTANTS[3])*(1.00000+cos(( 2.00000* 3.14159265358979*(ALGEBRAIC[0] - CONSTANTS[6]))/CONSTANTS[6])))/2.00000 : CONSTANTS[3]);
}