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 21 entries in the algebraic variable array.
   There are a total of 11 entries in each of the rate and state variable arrays.
   There are a total of 20 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is Cm in component membrane (picoF).
 * CONSTANTS[1] is i_app in component membrane (picoA).
 * ALGEBRAIC[19] is i_Na in component sodium_current (picoA).
 * ALGEBRAIC[3] is i_Ca_L in component L_type_calcium_current (picoA).
 * ALGEBRAIC[6] is i_Ca_T in component T_type_calcium_current (picoA).
 * ALGEBRAIC[10] is i_K_dr in component delayed_rectifier_K_channel_current (picoA).
 * ALGEBRAIC[14] is i_M in component M_like_K_current (picoA).
 * ALGEBRAIC[20] is i_ir in component inward_rectifier_K_current (picoA).
 * ALGEBRAIC[18] is i_d in component inward_leak_current (picoA).
 * CONSTANTS[2] is g_Na in component sodium_current (nanoS).
 * CONSTANTS[3] is V_Na in component sodium_current (millivolt).
 * ALGEBRAIC[0] is O in component sodium_current (dimensionless).
 * STATES[1] is A in component A (dimensionless).
 * CONSTANTS[4] is k1 in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[5] is k1_ in component reaction_constants (first_order_rate_constant).
 * ALGEBRAIC[1] is alpha in component reaction_constants (first_order_rate_constant).
 * ALGEBRAIC[2] is beta in component reaction_constants (first_order_rate_constant).
 * STATES[2] is D in component D (dimensionless).
 * STATES[3] is A_ in component A_ (dimensionless).
 * CONSTANTS[19] is a in component reaction_constants (dimensionless).
 * STATES[4] is D_ in component D_ (dimensionless).
 * CONSTANTS[6] is k2 in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[7] is k2_ in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[8] is V_Ca in component L_type_calcium_current (millivolt).
 * CONSTANTS[9] is g_Ca_L in component L_type_calcium_current (nanoS).
 * STATES[5] is m in component L_type_calcium_current_m_gate (dimensionless).
 * ALGEBRAIC[4] is m_infinity in component L_type_calcium_current_m_gate (dimensionless).
 * ALGEBRAIC[5] is tau_m in component L_type_calcium_current_m_gate (millisecond).
 * CONSTANTS[10] is Vh in component L_type_calcium_current_m_gate (millivolt).
 * CONSTANTS[11] is g_Ca_T in component T_type_calcium_current (nanoS).
 * STATES[6] is m in component T_type_calcium_current_m_gate (dimensionless).
 * STATES[7] is h in component T_type_calcium_current_h_gate (dimensionless).
 * ALGEBRAIC[7] is m_infinity in component T_type_calcium_current_m_gate (dimensionless).
 * ALGEBRAIC[8] is tau_m in component T_type_calcium_current_m_gate (millisecond).
 * ALGEBRAIC[9] is h_infinity in component T_type_calcium_current_h_gate (dimensionless).
 * CONSTANTS[12] is tau_h in component T_type_calcium_current_h_gate (millisecond).
 * CONSTANTS[13] is V_K in component delayed_rectifier_K_channel_current (millivolt).
 * CONSTANTS[14] is g_K_dr in component delayed_rectifier_K_channel_current (nanoS).
 * STATES[8] is n in component delayed_rectifier_K_channel_current_n_gate (dimensionless).
 * STATES[9] is h in component delayed_rectifier_K_channel_current_h_gate (dimensionless).
 * ALGEBRAIC[11] is n_infinity in component delayed_rectifier_K_channel_current_n_gate (dimensionless).
 * ALGEBRAIC[12] is tau_n in component delayed_rectifier_K_channel_current_n_gate (millisecond).
 * ALGEBRAIC[13] is h_infinity in component delayed_rectifier_K_channel_current_h_gate (dimensionless).
 * CONSTANTS[15] is tau_h in component delayed_rectifier_K_channel_current_h_gate (millisecond).
 * CONSTANTS[16] is g_M in component M_like_K_current (nanoS).
 * STATES[10] is n in component M_like_K_current_n_gate (dimensionless).
 * ALGEBRAIC[15] is n_infinity in component M_like_K_current_n_gate (dimensionless).
 * ALGEBRAIC[16] is tau_n in component M_like_K_current_n_gate (millisecond).
 * CONSTANTS[17] is g_ir in component inward_rectifier_K_current (nanoS).
 * ALGEBRAIC[17] is n_infinity in component inward_rectifier_K_current_n_gate (dimensionless).
 * CONSTANTS[18] is g_d in component inward_leak_current (nanoS).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt A in component A (dimensionless).
 * RATES[3] is d/dt A_ in component A_ (dimensionless).
 * RATES[2] is d/dt D in component D (dimensionless).
 * RATES[4] is d/dt D_ in component D_ (dimensionless).
 * RATES[5] is d/dt m in component L_type_calcium_current_m_gate (dimensionless).
 * RATES[6] is d/dt m in component T_type_calcium_current_m_gate (dimensionless).
 * RATES[7] is d/dt h in component T_type_calcium_current_h_gate (dimensionless).
 * RATES[8] is d/dt n in component delayed_rectifier_K_channel_current_n_gate (dimensionless).
 * RATES[9] is d/dt h in component delayed_rectifier_K_channel_current_h_gate (dimensionless).
 * RATES[10] is d/dt n in component M_like_K_current_n_gate (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -60;
CONSTANTS[0] = 14;
CONSTANTS[1] = 15;
CONSTANTS[2] = 60;
CONSTANTS[3] = 60;
STATES[1] = 1;
CONSTANTS[4] = 0.3;
CONSTANTS[5] = 0.03;
STATES[2] = 0;
STATES[3] = 0;
STATES[4] = 0;
CONSTANTS[6] = 0.001;
CONSTANTS[7] = 0.01;
CONSTANTS[8] = 100;
CONSTANTS[9] = 1.3;
STATES[5] = 0;
CONSTANTS[10] = 40;
CONSTANTS[11] = 0.94;
STATES[6] = 0;
STATES[7] = 0;
CONSTANTS[12] = 22;
CONSTANTS[13] = -80;
CONSTANTS[14] = 20;
STATES[8] = 0;
STATES[9] = 0;
CONSTANTS[15] = 1000;
CONSTANTS[16] = 4;
STATES[10] = 0;
CONSTANTS[17] = 1.71;
CONSTANTS[18] = 0.044;
CONSTANTS[19] =  pow((( CONSTANTS[4]*CONSTANTS[7])/( CONSTANTS[5]*CONSTANTS[6])), 1.0 / 2);
RATES[0] = 0.1;
RATES[1] = 0.1;
RATES[3] = 0.1;
RATES[2] = 0.1;
RATES[4] = 0.1;
RATES[5] = 0.1;
RATES[6] = 0.1;
RATES[7] = 0.1;
RATES[8] = 0.1;
RATES[9] = 0.1;
RATES[10] = 0.1;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - (CONSTANTS[1] - (ALGEBRAIC[19]+ALGEBRAIC[3]+ALGEBRAIC[6]+ALGEBRAIC[10]+ALGEBRAIC[14]+ALGEBRAIC[20]+ALGEBRAIC[18]))/CONSTANTS[0];
resid[1] = RATES[1] - ( ALGEBRAIC[1]*STATES[2]+ CONSTANTS[5]*STATES[3]) - ( ALGEBRAIC[2]*STATES[1]+ CONSTANTS[4]*STATES[1]);
resid[2] = RATES[3] - ( ALGEBRAIC[1]*CONSTANTS[19]*STATES[4]+ CONSTANTS[4]*STATES[1]) - ( (ALGEBRAIC[2]/CONSTANTS[19])*STATES[3]+ CONSTANTS[5]*STATES[3]);
resid[3] = RATES[2] - ( ALGEBRAIC[2]*STATES[1]+ CONSTANTS[7]*STATES[4]) - ( ALGEBRAIC[1]*STATES[2]+ CONSTANTS[6]*STATES[2]);
resid[4] = RATES[4] - ( (ALGEBRAIC[2]/CONSTANTS[19])*STATES[3]+ CONSTANTS[6]*STATES[2]) - ( ALGEBRAIC[1]*CONSTANTS[19]*STATES[4]+ CONSTANTS[7]*STATES[4]);
resid[5] = RATES[5] - (ALGEBRAIC[4] - STATES[5])/ALGEBRAIC[5];
resid[6] = RATES[6] - (ALGEBRAIC[7] - STATES[6])/ALGEBRAIC[8];
resid[7] = RATES[7] - (ALGEBRAIC[9] - STATES[7])/CONSTANTS[12];
resid[8] = RATES[8] - (ALGEBRAIC[11] - STATES[8])/ALGEBRAIC[12];
resid[9] = RATES[9] - (ALGEBRAIC[13] - STATES[9])/CONSTANTS[15];
resid[10] = RATES[10] - (ALGEBRAIC[15] - STATES[10])/ALGEBRAIC[16];
}
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[1] = 10.0000/(1.00000+exp(- (STATES[0]+6.00000)/10.0000));
ALGEBRAIC[2] = 10.0000/(1.00000+exp((STATES[0]+54.4000)/4.60000));
ALGEBRAIC[3] =  CONSTANTS[9]*pow(STATES[5], 2.00000)*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[4] = 1.00000/(1.00000+exp(- (STATES[0] - CONSTANTS[10])/12.0000));
ALGEBRAIC[5] = 5.00000/(exp((STATES[0]+15.0000)/25.0000)+exp(- (STATES[0]+15.0000)/25.0000));
ALGEBRAIC[6] =  CONSTANTS[11]*pow(STATES[6], 2.00000)*STATES[7]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[7] = 1.00000/(1.00000+exp(- (STATES[0] - 56.1000)/10.0000));
ALGEBRAIC[8] = 7.00000/(exp((STATES[0]+50.0000)/9.00000)+exp(- (STATES[0]+50.0000)/9.00000))+0.800000;
ALGEBRAIC[9] = 1.00000/(1.00000+exp((STATES[0]+86.4000)/4.70000));
ALGEBRAIC[10] =  CONSTANTS[14]*pow(STATES[8], 4.00000)*STATES[9]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[11] = 1.00000/(1.00000+exp(- (STATES[0]+25.0000)/15.0000));
ALGEBRAIC[12] = 15.0000/(exp((STATES[0]+30.0000)/15.0000)+exp(- (STATES[0]+30.0000)/15.0000))+1.00000;
ALGEBRAIC[13] = 0.700000/(1.00000+exp(- (STATES[0]+35.0000)/10.0000))+0.300000;
ALGEBRAIC[14] =  CONSTANTS[16]*STATES[10]*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[15] = 1.00000/(1.00000+exp(- (STATES[0]+37.0000)/4.00000));
ALGEBRAIC[16] = 80.0000/(exp((STATES[0]+30.0000)/15.0000)+exp(- (STATES[0]+30.0000)/15.0000));
ALGEBRAIC[18] =  CONSTANTS[18]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[0] = pow(STATES[1], 3.00000);
ALGEBRAIC[19] =  CONSTANTS[2]*ALGEBRAIC[0]*(STATES[0] - CONSTANTS[3]);
ALGEBRAIC[17] = ( 0.800000*1.00000)/(1.00000+exp((STATES[0]+80.0000)/12.0000))+0.200000;
ALGEBRAIC[20] =  CONSTANTS[17]*ALGEBRAIC[17]*(STATES[0] - CONSTANTS[13]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
SI[10] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}