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 0 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 7 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is x in component x (dimensionless).
 * CONSTANTS[0] is alpha in component x (per_second).
 * CONSTANTS[1] is omega in component x (per_second).
 * CONSTANTS[2] is D in component x (per_second).
 * CONSTANTS[3] is a in component x (dimensionless).
 * CONSTANTS[4] is b in component model_constants (dimensionless).
 * STATES[1] is z in component z (dimensionless).
 * STATES[2] is y in component y (dimensionless).
 * CONSTANTS[5] is beta in component y (per_second).
 * CONSTANTS[6] is gamma in component z (per_second).
 * RATES[0] is d/dt x in component x (dimensionless).
 * RATES[2] is d/dt y in component y (dimensionless).
 * RATES[1] is d/dt z in component z (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.5;
CONSTANTS[0] = 0.5;
CONSTANTS[1] = 2;
CONSTANTS[2] = 0.8228;
CONSTANTS[3] = 8.1252;
CONSTANTS[4] = 1.091;
STATES[1] = 1.0;
STATES[2] = 0.95;
CONSTANTS[5] = 0.38;
CONSTANTS[6] = 0.6;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[1] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ( CONSTANTS[0]*exp( CONSTANTS[3]*(1.00000 - pow(STATES[1], 2.00000))+ CONSTANTS[4]*(1.00000 - pow(STATES[2], 2.00000)))+ CONSTANTS[2]*cos( CONSTANTS[1]*VOI)) -  CONSTANTS[0]*STATES[0];
resid[1] = RATES[2] -  CONSTANTS[5]*STATES[0]*exp( CONSTANTS[4]*(1.00000 - pow(STATES[1], 2.00000))) -  CONSTANTS[5]*STATES[2];
resid[2] = RATES[1] -  CONSTANTS[6]*STATES[2] -  CONSTANTS[6]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
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)
{
}