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 26 entries in the algebraic variable array.
   There are a total of 12 entries in each of the rate and state variable arrays.
   There are a total of 37 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is V_s in component soma_compartment (mV).
 * CONSTANTS[0] is V_Na in component soma_compartment (mV).
 * ALGEBRAIC[25] is I_Na_s in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[0] is I_K_DR_s in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[1] is I_Ca_T in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[2] is I_K_Ca in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[3] is I_A in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[4] is I_h in component soma_compartment (uA_per_cm2).
 * CONSTANTS[1] is g_Na_s in component soma_compartment (mS_per_cm2).
 * CONSTANTS[2] is g_K_DR_s in component soma_compartment (mS_per_cm2).
 * CONSTANTS[3] is g_Ca_T in component soma_compartment (mS_per_cm2).
 * CONSTANTS[4] is g_K_Ca in component soma_compartment (mS_per_cm2).
 * CONSTANTS[5] is g_A in component soma_compartment (mS_per_cm2).
 * CONSTANTS[6] is g_h in component soma_compartment (mS_per_cm2).
 * STATES[1] is Ca in component soma_compartment (mM).
 * CONSTANTS[7] is k_Ca in component soma_compartment (per_second).
 * CONSTANTS[8] is K_Ca in component soma_compartment (mM).
 * CONSTANTS[9] is V_h in component soma_compartment (mV).
 * CONSTANTS[10] is beta in component soma_compartment (mMcm2_per_uAs).
 * CONSTANTS[11] is I_APP in component soma_compartment (uA_per_cm2).
 * CONSTANTS[12] is V_Ca in component general_variables (mV).
 * CONSTANTS[13] is V_K in component general_variables (mV).
 * STATES[2] is n in component gating_variables (dimensionless).
 * STATES[3] is h in component gating_variables (dimensionless).
 * ALGEBRAIC[13] is m_infinity in component gating_variables (dimensionless).
 * CONSTANTS[14] is g_c in component general_variables (mS_per_cm2).
 * CONSTANTS[15] is p in component general_variables (dimensionless).
 * STATES[4] is V_D in component dendritic_compartment (mV).
 * CONSTANTS[16] is C_m in component general_variables (uF_per_cm2).
 * STATES[5] is m_T in component gating_variables (dimensionless).
 * STATES[6] is h_T in component gating_variables (dimensionless).
 * STATES[7] is a in component gating_variables (dimensionless).
 * STATES[8] is b in component gating_variables (dimensionless).
 * STATES[9] is m_h in component gating_variables (dimensionless).
 * STATES[10] is Na in component dendritic_compartment (mM).
 * CONSTANTS[17] is K_p in component dendritic_compartment (mM).
 * ALGEBRAIC[8] is I_L in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[7] is I_pump in component dendritic_compartment (uA_per_cm2).
 * CONSTANTS[18] is R_pump in component dendritic_compartment (uA_per_cm2).
 * CONSTANTS[19] is Na_eq in component dendritic_compartment (mM).
 * ALGEBRAIC[6] is phi_Na in component dendritic_compartment (dimensionless).
 * CONSTANTS[31] is phi_Na_eq in component dendritic_compartment (dimensionless).
 * CONSTANTS[20] is alpha in component dendritic_compartment (mMcm2_per_uAs).
 * ALGEBRAIC[9] is I_NMDA in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[10] is I_Na_NMDA in component dendritic_compartment (uA_per_cm2).
 * CONSTANTS[21] is g_NMDA in component dendritic_compartment (mS_per_cm2).
 * CONSTANTS[22] is g_Na_NMDA in component dendritic_compartment (mS_per_cm2).
 * CONSTANTS[23] is g_L in component dendritic_compartment (mS_per_cm2).
 * CONSTANTS[24] is Mg_o in component dendritic_compartment (mM).
 * CONSTANTS[25] is K_Mg in component dendritic_compartment (mM).
 * CONSTANTS[26] is q in component dendritic_compartment (mV).
 * CONSTANTS[27] is V_NMDA in component dendritic_compartment (mV).
 * CONSTANTS[28] is V_L in component dendritic_compartment (mV).
 * ALGEBRAIC[11] is I_D in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[12] is I_Ca_L in component dendritic_compartment (uA_per_cm2).
 * CONSTANTS[29] is g_Ca_L in component dendritic_compartment (mS_per_cm2).
 * CONSTANTS[30] is g_K_DR_D in component dendritic_compartment (mS_per_cm2).
 * ALGEBRAIC[5] is I_K_DR_D in component dendritic_compartment (uA_per_cm2).
 * STATES[11] is m_L in component gating_variables (dimensionless).
 * ALGEBRAIC[16] is m_T_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[17] is h_T_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[18] is a_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[19] is b_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[20] is m_h_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[21] is m_L_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[14] is n_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[15] is h_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[22] is tau_h in component gating_variables (second).
 * ALGEBRAIC[23] is tau_n in component gating_variables (second).
 * CONSTANTS[32] is tau_m_T in component gating_variables (second).
 * CONSTANTS[33] is tau_h_T in component gating_variables (second).
 * ALGEBRAIC[24] is tau_m_L in component gating_variables (second).
 * CONSTANTS[34] is tau_a in component gating_variables (second).
 * CONSTANTS[35] is tau_b in component gating_variables (second).
 * CONSTANTS[36] is tau_m_h in component gating_variables (second).
 * RATES[0] is d/dt V_s in component soma_compartment (mV).
 * RATES[1] is d/dt Ca in component soma_compartment (mM).
 * RATES[4] is d/dt V_D in component dendritic_compartment (mV).
 * RATES[10] is d/dt Na in component dendritic_compartment (mM).
 * RATES[3] is d/dt h in component gating_variables (dimensionless).
 * RATES[2] is d/dt n in component gating_variables (dimensionless).
 * RATES[5] is d/dt m_T in component gating_variables (dimensionless).
 * RATES[11] is d/dt m_L in component gating_variables (dimensionless).
 * RATES[9] is d/dt m_h in component gating_variables (dimensionless).
 * RATES[7] is d/dt a in component gating_variables (dimensionless).
 * RATES[8] is d/dt b in component gating_variables (dimensionless).
 * RATES[6] is d/dt h_T in component gating_variables (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -64.0;
CONSTANTS[0] = 55;
CONSTANTS[1] = 3.2;
CONSTANTS[2] = 6.4;
CONSTANTS[3] = 1.5;
CONSTANTS[4] = 1.2;
CONSTANTS[5] = 2;
CONSTANTS[6] = 0.1;
STATES[1] = 0;
CONSTANTS[7] = 1;
CONSTANTS[8] = 0.0004;
CONSTANTS[9] = -30;
CONSTANTS[10] = 0.104;
CONSTANTS[11] = -6.7;
CONSTANTS[12] = 120;
CONSTANTS[13] = -85;
STATES[2] = 0.002;
STATES[3] = 1.0;
CONSTANTS[14] = 0.1;
CONSTANTS[15] = 0.5;
STATES[4] = -77.0;
CONSTANTS[16] = 1;
STATES[5] = 0.1;
STATES[6] = 0.1;
STATES[7] = 0.1;
STATES[8] = 0.1;
STATES[9] = 0.1;
STATES[10] = 5.09;
CONSTANTS[17] = 15;
CONSTANTS[18] = 18;
CONSTANTS[19] = 8;
CONSTANTS[20] = 0.173;
CONSTANTS[21] = 25;
CONSTANTS[22] = 5;
CONSTANTS[23] = 0.18;
CONSTANTS[24] = 1.4;
CONSTANTS[25] = 10;
CONSTANTS[26] = 12.5;
CONSTANTS[27] = 0;
CONSTANTS[28] = -50;
CONSTANTS[29] = 0.19;
CONSTANTS[30] = 0.14;
STATES[11] = 0.1;
CONSTANTS[31] = pow(CONSTANTS[19], 3.00000)/(pow(CONSTANTS[19], 3.00000)+pow(CONSTANTS[17], 3.00000));
CONSTANTS[32] = 1.00000;
CONSTANTS[33] = 10.0000;
CONSTANTS[34] = 0.500000;
CONSTANTS[35] = 10.0000;
CONSTANTS[36] = 190.000;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[4] = 0.1001;
RATES[10] = 0.1001;
RATES[3] = 0.1001;
RATES[2] = 0.1001;
RATES[5] = 0.1001;
RATES[11] = 0.1001;
RATES[9] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[6] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ( 1000.00*(CONSTANTS[11] - (ALGEBRAIC[25]+ALGEBRAIC[1]+ALGEBRAIC[0]+ALGEBRAIC[2]+ALGEBRAIC[3]+ALGEBRAIC[4]+ (CONSTANTS[14]/CONSTANTS[15])*(STATES[0] - STATES[4]))))/CONSTANTS[16];
resid[1] = RATES[1] - - ( CONSTANTS[10]*ALGEBRAIC[1]+ CONSTANTS[7]*STATES[1]);
resid[2] = RATES[4] - - ( 1000.00*(ALGEBRAIC[12]+ALGEBRAIC[5]+ALGEBRAIC[9]+ALGEBRAIC[7]+ALGEBRAIC[8]+ (CONSTANTS[14]/(1.00000 - CONSTANTS[15]))*(STATES[4] - STATES[0])))/CONSTANTS[16];
resid[3] = RATES[10] -  CONSTANTS[20]*(- ALGEBRAIC[10] -  ALGEBRAIC[7]*3.00000);
resid[4] = RATES[3] - (ALGEBRAIC[15] - STATES[3])/ALGEBRAIC[22];
resid[5] = RATES[2] - (ALGEBRAIC[14] - STATES[2])/ALGEBRAIC[23];
resid[6] = RATES[5] - (ALGEBRAIC[16] - STATES[5])/CONSTANTS[32];
resid[7] = RATES[11] - (ALGEBRAIC[21] - STATES[11])/ALGEBRAIC[24];
resid[8] = RATES[9] - (ALGEBRAIC[20] - STATES[9])/CONSTANTS[36];
resid[9] = RATES[7] - (ALGEBRAIC[18] - STATES[7])/CONSTANTS[34];
resid[10] = RATES[8] - (ALGEBRAIC[19] - STATES[8])/CONSTANTS[35];
resid[11] = RATES[6] - (ALGEBRAIC[17] - STATES[6])/CONSTANTS[33];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[11] = ALGEBRAIC[9]+ALGEBRAIC[7]+ALGEBRAIC[8];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[2]*(STATES[0] - CONSTANTS[13])*pow(STATES[2], 2.00000);
ALGEBRAIC[1] =  CONSTANTS[3]*STATES[6]*(STATES[0] - CONSTANTS[12])*pow(STATES[5], 2.00000);
ALGEBRAIC[2] =  (( CONSTANTS[4]*pow(STATES[1], 4.00000))/(pow(STATES[1], 4.00000)+pow(CONSTANTS[8], 4.00000)))*(STATES[0] - CONSTANTS[13]);
ALGEBRAIC[3] =  CONSTANTS[5]*STATES[8]*(STATES[0] - CONSTANTS[13])*pow(STATES[7], 4.00000);
ALGEBRAIC[4] =  CONSTANTS[6]*STATES[9]*(STATES[0] - CONSTANTS[9]);
ALGEBRAIC[5] =  CONSTANTS[30]*(STATES[4] - CONSTANTS[13])*pow(STATES[2], 2.00000);
ALGEBRAIC[6] = pow(STATES[10], 3.00000)/(pow(STATES[10], 3.00000)+pow(CONSTANTS[17], 3.00000));
ALGEBRAIC[7] =  CONSTANTS[18]*(ALGEBRAIC[6] - CONSTANTS[31]);
ALGEBRAIC[8] =  CONSTANTS[23]*(STATES[4] - CONSTANTS[28]);
ALGEBRAIC[9] =  (CONSTANTS[21]/(1.00000+ (CONSTANTS[24]/CONSTANTS[25])*exp(- STATES[4]/CONSTANTS[26])))*(STATES[4] - CONSTANTS[27]);
ALGEBRAIC[10] =  (CONSTANTS[22]/(1.00000+ (CONSTANTS[24]/CONSTANTS[25])*exp(- STATES[4]/CONSTANTS[26])))*(STATES[4] - CONSTANTS[0]);
ALGEBRAIC[12] =  CONSTANTS[29]*(STATES[4] - CONSTANTS[12])*pow(STATES[11], 2.00000);
ALGEBRAIC[14] = 1.00000/(1.00000+exp(- (STATES[0]+31.0000)/5.30000));
ALGEBRAIC[15] = 1.00000/(1.00000+exp((STATES[0]+30.0000)/8.30000));
ALGEBRAIC[16] = 1.00000/(1.00000+exp(- (STATES[0]+55.0000)/7.00000));
ALGEBRAIC[17] = 1.00000/(1.00000+exp((STATES[0]+81.0000)/11.0000));
ALGEBRAIC[18] = 1.00000/(1.00000+exp(- (STATES[0]+60.0000)/10.0000));
ALGEBRAIC[19] = 1.00000/(1.00000+exp((STATES[0]+70.0000)/5.70000));
ALGEBRAIC[20] = 1.00000/(1.00000+exp((STATES[0]+80.0000)/8.00000));
ALGEBRAIC[21] = 1.00000/(1.00000+exp(- (STATES[4]+20.0000)/5.30000));
ALGEBRAIC[22] =  0.400000*(1.00000+2.00000/(1.00000+exp((STATES[0]+25.0000)/5.00000)));
ALGEBRAIC[23] = ( 0.800000*(1.00000+2.00000/(1.00000+exp((STATES[0]+25.0000)/10.0000))))/(1.00000+exp(- (STATES[0]+70.0000)/10.0000));
ALGEBRAIC[24] = 0.400000/( 5.00000*exp(- (STATES[4]+11.0000)/8.30000)+(- (STATES[4]+11.0000)/8.30000)/(exp(- (STATES[4]+11.0000)/8.30000) - 1.00000));
ALGEBRAIC[13] = 1.00000/(1.00000+exp(- (STATES[0]+35.0000)/6.20000));
ALGEBRAIC[25] =  CONSTANTS[1]*STATES[3]*(STATES[0] - CONSTANTS[0])*pow(ALGEBRAIC[13], 3.00000);
}
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;
SI[11] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}