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 10 entries in the algebraic variable array.
   There are a total of 4 entries in each of the rate and state variable arrays.
   There are a total of 21 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * CONSTANTS[0] is Cm in component membrane (femtoF).
 * STATES[0] is V in component membrane (millivolt).
 * ALGEBRAIC[1] is ICa in component Ca_current (femtoA).
 * ALGEBRAIC[2] is IK in component rapid_K_current (femtoA).
 * ALGEBRAIC[9] is Il in component leak_current (femtoA).
 * ALGEBRAIC[5] is Is1 in component slow_K_current (femtoA).
 * ALGEBRAIC[7] is Is2 in component very_slow_K_current (femtoA).
 * CONSTANTS[1] is Vm in component Ca_current (millivolt).
 * CONSTANTS[2] is VCa in component Ca_current (millivolt).
 * CONSTANTS[3] is gCa in component Ca_current (picoS).
 * ALGEBRAIC[0] is minf in component Ca_current (dimensionless).
 * CONSTANTS[4] is sm in component Ca_current (millivolt).
 * CONSTANTS[5] is VK in component rapid_K_current (millivolt).
 * CONSTANTS[6] is gK in component rapid_K_current (picoS).
 * STATES[1] is n in component rapid_K_current (dimensionless).
 * CONSTANTS[7] is lambda in component rapid_K_current (dimensionless).
 * CONSTANTS[8] is tnbar in component rapid_K_current (dimensionless).
 * CONSTANTS[9] is Vn in component rapid_K_current (millivolt).
 * CONSTANTS[10] is sn in component rapid_K_current (millivolt).
 * ALGEBRAIC[4] is taun in component rapid_K_current (dimensionless).
 * ALGEBRAIC[3] is ninf in component rapid_K_current (dimensionless).
 * CONSTANTS[11] is gs1 in component slow_K_current (picoS).
 * STATES[2] is s1 in component slow_K_current (dimensionless).
 * ALGEBRAIC[6] is s1inf in component slow_K_current (dimensionless).
 * CONSTANTS[12] is Vs1 in component slow_K_current (millivolt).
 * CONSTANTS[13] is ss1 in component slow_K_current (millivolt).
 * CONSTANTS[14] is taus1 in component slow_K_current (dimensionless).
 * CONSTANTS[15] is Vs2 in component very_slow_K_current (millivolt).
 * STATES[3] is s2 in component very_slow_K_current (dimensionless).
 * ALGEBRAIC[8] is s2inf in component very_slow_K_current (dimensionless).
 * CONSTANTS[16] is ss2 in component very_slow_K_current (millivolt).
 * CONSTANTS[17] is gs2 in component very_slow_K_current (picoS).
 * CONSTANTS[18] is taus2 in component very_slow_K_current (dimensionless).
 * CONSTANTS[19] is gl in component leak_current (picoS).
 * CONSTANTS[20] is Vl in component leak_current (millivolt).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt n in component rapid_K_current (dimensionless).
 * RATES[2] is d/dt s1 in component slow_K_current (dimensionless).
 * RATES[3] is d/dt s2 in component very_slow_K_current (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 4524;
STATES[0] = -43;
CONSTANTS[1] = -22;
CONSTANTS[2] = 100;
CONSTANTS[3] = 280;
CONSTANTS[4] = 7.5;
CONSTANTS[5] = -80;
CONSTANTS[6] = 1300;
STATES[1] = 0.03;
CONSTANTS[7] = 1.1;
CONSTANTS[8] = 9.09;
CONSTANTS[9] = -9;
CONSTANTS[10] = 10;
CONSTANTS[11] = 20;
STATES[2] = 0.1;
CONSTANTS[12] = -40;
CONSTANTS[13] = 0.5;
CONSTANTS[14] = 1000;
CONSTANTS[15] = -42;
STATES[3] = 0.434;
CONSTANTS[16] = 0.4;
CONSTANTS[17] = 32;
CONSTANTS[18] = 120000;
CONSTANTS[19] = 25;
CONSTANTS[20] = -40;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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[1]+ALGEBRAIC[2]+ALGEBRAIC[9]+ALGEBRAIC[5]+ALGEBRAIC[7])/CONSTANTS[0];
resid[1] = RATES[1] - ( CONSTANTS[7]*(ALGEBRAIC[3] - STATES[1]))/( ALGEBRAIC[4]*1.00000);
resid[2] = RATES[2] - (ALGEBRAIC[6] - STATES[2])/( CONSTANTS[14]*1.00000);
resid[3] = RATES[3] - (ALGEBRAIC[8] - STATES[3])/( CONSTANTS[18]*1.00000);
}
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[1] - STATES[0])/CONSTANTS[4]));
ALGEBRAIC[1] =  CONSTANTS[3]*ALGEBRAIC[0]*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[2] =  CONSTANTS[6]*STATES[1]*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[3] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[4] = CONSTANTS[8]/(1.00000+exp((STATES[0] - CONSTANTS[9])/CONSTANTS[10]));
ALGEBRAIC[5] =  CONSTANTS[11]*STATES[2]*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((CONSTANTS[12] - STATES[0])/CONSTANTS[13]));
ALGEBRAIC[7] =  CONSTANTS[17]*STATES[3]*(STATES[0] - CONSTANTS[5]);
ALGEBRAIC[8] = 1.00000/(1.00000+exp((CONSTANTS[15] - STATES[0])/CONSTANTS[16]));
ALGEBRAIC[9] =  CONSTANTS[19]*(STATES[0] - CONSTANTS[20]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}