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 1 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 6 entries in the constant variable array.
 */
/*
 * VOI is t in component y_channel (millisecond).
 * STATES[0] is y in component y_channel (dimensionless).
 * CONSTANTS[0] is V in component y_channel (millivolt).
 * CONSTANTS[1] is E_y in component y_channel (millivolt).
 * ALGEBRAIC[0] is i_y in component y_channel (microA_per_cm2).
 * CONSTANTS[2] is g_y in component y_channel (milliS_per_cm2).
 * CONSTANTS[3] is gamma in component y_channel (dimensionless).
 * CONSTANTS[4] is alpha_y in component y_channel (per_millisecond).
 * CONSTANTS[5] is beta_y in component y_channel (per_millisecond).
 * RATES[0] is d/dt y in component y_channel (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0;
CONSTANTS[0] = 0;
CONSTANTS[1] = -85;
CONSTANTS[2] = 36;
CONSTANTS[3] = 4;
CONSTANTS[4] = 1;
CONSTANTS[5] = 2;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  CONSTANTS[4]*(1.00000 - STATES[0]) -  CONSTANTS[5]*STATES[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[2]*pow(STATES[0], CONSTANTS[3])*(CONSTANTS[0] - CONSTANTS[1]);
}