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 13 entries in the algebraic variable array.
   There are a total of 5 entries in each of the rate and state variable arrays.
   There are a total of 15 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * ALGEBRAIC[0] is Vs in component membrane (millivolt).
 * CONSTANTS[0] is V_I in component membrane (millivolt).
 * CONSTANTS[1] is V_K in component membrane (millivolt).
 * CONSTANTS[2] is V_L in component membrane (millivolt).
 * CONSTANTS[3] is V_H_Na in component membrane (millivolt).
 * CONSTANTS[4] is V_H_K in component membrane (millivolt).
 * CONSTANTS[13] is g_I in component membrane (milliS_per_microF).
 * CONSTANTS[5] is g_K in component membrane (milliS_per_microF).
 * CONSTANTS[6] is g_L in component membrane (milliS_per_microF).
 * CONSTANTS[14] is g_T in component membrane (milliS_per_microF).
 * CONSTANTS[7] is g_P in component membrane (milliS_per_microF).
 * CONSTANTS[8] is Kp in component membrane (millimolar).
 * STATES[1] is c in component calcium_concentration (millimolar).
 * ALGEBRAIC[3] is sI in component sI_gate (dimensionless).
 * STATES[2] is yI in component yI_gate (dimensionless).
 * STATES[3] is xT in component xT_gate (dimensionless).
 * STATES[4] is xK in component xK_gate (dimensionless).
 * ALGEBRAIC[1] is alpha_m in component sI_gate (per_millisecond).
 * ALGEBRAIC[2] is beta_m in component sI_gate (per_millisecond).
 * ALGEBRAIC[6] is ZI in component yI_gate (dimensionless).
 * ALGEBRAIC[4] is alpha_h in component yI_gate (per_millisecond).
 * ALGEBRAIC[5] is beta_h in component yI_gate (per_millisecond).
 * ALGEBRAIC[7] is tau_yI in component yI_gate (millisecond).
 * ALGEBRAIC[8] is sT in component xT_gate (dimensionless).
 * CONSTANTS[9] is tau_xT in component xT_gate (millisecond).
 * CONSTANTS[10] is V_Ca in component calcium_concentration (millivolt).
 * CONSTANTS[11] is rho in component calcium_concentration (per_millisecond).
 * CONSTANTS[12] is K_c in component calcium_concentration (millimolar_per_millivolt).
 * ALGEBRAIC[9] is alpha_n in component xK_gate (per_millisecond).
 * ALGEBRAIC[10] is beta_n in component xK_gate (per_millisecond).
 * ALGEBRAIC[12] is tau_xK in component xK_gate (millisecond).
 * ALGEBRAIC[11] is sK in component xK_gate (dimensionless).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[2] is d/dt yI in component yI_gate (dimensionless).
 * RATES[3] is d/dt xT in component xT_gate (dimensionless).
 * RATES[1] is d/dt c in component calcium_concentration (millimolar).
 * RATES[4] is d/dt xK in component xK_gate (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -54;
CONSTANTS[0] = 30.0;
CONSTANTS[1] = -75.0;
CONSTANTS[2] = -40.0;
CONSTANTS[3] = 115.0;
CONSTANTS[4] = -12.0;
CONSTANTS[5] = 0.3;
CONSTANTS[6] = 0.003;
CONSTANTS[7] = 0.03;
CONSTANTS[8] = 0.5;
STATES[1] = 0.1;
STATES[2] = 0.1;
STATES[3] = 0.1;
STATES[4] = 0.1;
CONSTANTS[9] = 235.0;
CONSTANTS[10] = 140.0;
CONSTANTS[11] = 0.0003;
CONSTANTS[12] = 0.0085;
CONSTANTS[13] =  1.00000*((CONSTANTS[3] - CONSTANTS[4])/(CONSTANTS[0] - CONSTANTS[1]));
CONSTANTS[14] =  1.00000*(( CONSTANTS[3]*CONSTANTS[1] -  CONSTANTS[0]*CONSTANTS[4])/(CONSTANTS[0] - CONSTANTS[1]));
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[1] = 0.1001;
RATES[4] = 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[13]*pow(ALGEBRAIC[3], 3.00000)*STATES[2]+ CONSTANTS[14]*STATES[3])*(CONSTANTS[0] - STATES[0])+ ( CONSTANTS[5]*pow(STATES[4], 4.00000)+ CONSTANTS[7]*STATES[1]*pow(CONSTANTS[8]+STATES[1], -1.00000))*(CONSTANTS[1] - STATES[0])+ CONSTANTS[6]*(CONSTANTS[2] - STATES[0]);
resid[1] = RATES[2] - (ALGEBRAIC[6] - STATES[2])/ALGEBRAIC[7];
resid[2] = RATES[3] - (ALGEBRAIC[8] - STATES[3])/CONSTANTS[9];
resid[3] = RATES[1] -  CONSTANTS[11]*( CONSTANTS[12]*STATES[3]*(CONSTANTS[10] - STATES[0]) - STATES[1]);
resid[4] = RATES[4] - (ALGEBRAIC[11] - STATES[4])/ALGEBRAIC[12];
}
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*CONSTANTS[13]*STATES[0]+ 1.00000*CONSTANTS[14];
ALGEBRAIC[1] = ( 0.100000*(50.0000 - ALGEBRAIC[0]))/- exp((50.0000 - ALGEBRAIC[0])/10.0000);
ALGEBRAIC[2] =  4.00000*exp((25.0000 - ALGEBRAIC[0])/18.0000);
ALGEBRAIC[3] = ALGEBRAIC[1]/(ALGEBRAIC[1]+ALGEBRAIC[2]);
ALGEBRAIC[4] =  0.0700000*exp((25.0000 - ALGEBRAIC[0])/20.0000);
ALGEBRAIC[5] = 1.00000/(exp((55.0000 - ALGEBRAIC[0])/10.0000)+1.00000);
ALGEBRAIC[6] = ALGEBRAIC[4]/(ALGEBRAIC[4]+ALGEBRAIC[5]);
ALGEBRAIC[7] = 12.5000/(ALGEBRAIC[4]+ALGEBRAIC[5]);
ALGEBRAIC[8] = 1.00000/(exp( 0.150000*(-50.0000 - ALGEBRAIC[0]))+1.00000);
ALGEBRAIC[9] = ( 0.0100000*(55.0000 - ALGEBRAIC[0]))/(exp((55.0000 - ALGEBRAIC[0])/10.0000) - 1.00000);
ALGEBRAIC[10] =  0.125000*exp((45.0000 - ALGEBRAIC[0])/80.0000);
ALGEBRAIC[11] = ALGEBRAIC[9]/(ALGEBRAIC[9]+ALGEBRAIC[10]);
ALGEBRAIC[12] = 12.5000/(ALGEBRAIC[9]+ALGEBRAIC[10]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}