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 2 entries in the algebraic variable array.
   There are a total of 2 entries in each of the rate and state variable arrays.
   There are a total of 9 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is a in component a (dimensionless).
 * ALGEBRAIC[0] is ainf in component a (dimensionless).
 * CONSTANTS[0] is w in component a (dimensionless).
 * CONSTANTS[1] is ka in component a (dimensionless).
 * CONSTANTS[2] is th0 in component a (dimensionless).
 * CONSTANTS[3] is n in component a (dimensionless).
 * CONSTANTS[4] is wi in component a (dimensionless).
 * CONSTANTS[8] is noise in component a (dimensionless).
 * STATES[1] is s in component s (dimensionless).
 * ALGEBRAIC[1] is sinf in component s (dimensionless).
 * CONSTANTS[5] is taus in component s (second).
 * CONSTANTS[6] is ks in component s (dimensionless).
 * CONSTANTS[7] is ths in component s (dimensionless).
 * RATES[0] is d/dt a in component a (dimensionless).
 * RATES[1] is d/dt s in component s (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
CONSTANTS[0] = 0.8;
CONSTANTS[1] = -0.05;
CONSTANTS[2] = 0.17;
CONSTANTS[3] = 0.01;
CONSTANTS[4] = 0;
STATES[1] = 0.3;
CONSTANTS[5] = 250;
CONSTANTS[6] = 0.05;
CONSTANTS[7] = 0.2;
CONSTANTS[8] =  CONSTANTS[3]*CONSTANTS[4];
RATES[0] = 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] - ((ALGEBRAIC[0] - STATES[0])+CONSTANTS[8])/1.00000;
resid[1] = RATES[1] - (ALGEBRAIC[1] - STATES[1])/CONSTANTS[5];
}
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] = 1.00000/(1.00000+exp(( CONSTANTS[0]*STATES[1]*STATES[0] - CONSTANTS[2])/CONSTANTS[1]));
ALGEBRAIC[1] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[7])/CONSTANTS[6]));
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}