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 17 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 20 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is C_m in component model_parameters (uF_per_cm2).
 * STATES[0] is V_s in component soma_compartment (mV).
 * CONSTANTS[1] is V_Na in component soma_compartment (mV).
 * CONSTANTS[2] is V_K in component soma_compartment (mV).
 * STATES[1] is V_D in component dendritic_compartment (mV).
 * ALGEBRAIC[15] is I_Na in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[16] is I_soma in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[0] is I_h in component soma_compartment (uA_per_cm2).
 * ALGEBRAIC[1] is I_K_DR in component soma_compartment (uA_per_cm2).
 * CONSTANTS[3] is g_K_DR in component soma_compartment (mS_per_cm2).
 * CONSTANTS[4] is g_Na in component soma_compartment (mS_per_cm2).
 * CONSTANTS[5] is g_c in component model_parameters (mS_per_cm2).
 * CONSTANTS[6] is g_h in component soma_compartment (mS_per_cm2).
 * CONSTANTS[7] is p in component model_parameters (dimensionless).
 * STATES[2] is n in component gating_variables (dimensionless).
 * STATES[3] is h in component gating_variables (dimensionless).
 * ALGEBRAIC[8] is m_infinity in component gating_variables (dimensionless).
 * CONSTANTS[8] is V_L in component dendritic_compartment (mV).
 * ALGEBRAIC[7] is I_D in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[4] is I_L in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[3] is I_pump in component dendritic_compartment (uA_per_cm2).
 * CONSTANTS[19] is I_pump_ss in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[5] is I_NMDA in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[6] is I_Na_NMDA in component dendritic_compartment (uA_per_cm2).
 * CONSTANTS[14] is R_pump in component dendritic_compartment (uA_per_cm2).
 * ALGEBRAIC[2] is f_NMDA in component dendritic_compartment (dimensionless).
 * CONSTANTS[9] is alpha in component dendritic_compartment (mMcm2_per_uAs).
 * CONSTANTS[15] is g_NMDA in component dendritic_compartment (mS_per_cm2).
 * CONSTANTS[16] is g_Na_NMDA in component dendritic_compartment (mS_per_cm2).
 * CONSTANTS[17] is g_L in component dendritic_compartment (mS_per_cm2).
 * STATES[4] is Na in component dendritic_compartment (mM).
 * CONSTANTS[10] is Na_eq in component dendritic_compartment (mM).
 * CONSTANTS[11] is K_p in component dendritic_compartment (mM).
 * CONSTANTS[12] is K_Na in component dendritic_compartment (mM).
 * CONSTANTS[13] is q in component dendritic_compartment (mV).
 * ALGEBRAIC[9] is n_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[10] is h_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[11] is r_infinity in component gating_variables (dimensionless).
 * ALGEBRAIC[12] is tau_h in component gating_variables (second).
 * ALGEBRAIC[13] is tau_n in component gating_variables (second).
 * ALGEBRAIC[14] is tau_mL in component gating_variables (second).
 * CONSTANTS[18] is tau_r in component gating_variables (second).
 * RATES[0] is d/dt V_s in component soma_compartment (mV).
 * RATES[1] is d/dt V_D in component dendritic_compartment (mV).
 * RATES[4] 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).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1;
STATES[0] = -64;
CONSTANTS[1] = 55;
CONSTANTS[2] = -85;
STATES[1] = -77;
CONSTANTS[3] = 3.2;
CONSTANTS[4] = 3.2;
CONSTANTS[5] = 0.1;
CONSTANTS[6] = 0.1;
CONSTANTS[7] = 0.5;
STATES[2] = 0.002;
STATES[3] = 1;
CONSTANTS[8] = -50;
CONSTANTS[9] = 0.173;
STATES[4] = 5.09;
CONSTANTS[10] = 8;
CONSTANTS[11] = 15;
CONSTANTS[12] = 15;
CONSTANTS[13] = 12.5;
CONSTANTS[14] =  18.0000*(CONSTANTS[7]/(1.00000 - CONSTANTS[7]));
CONSTANTS[15] =  1.25000*(CONSTANTS[7]/(1.00000 - CONSTANTS[7]));
CONSTANTS[16] =  1.00000*(CONSTANTS[7]/(1.00000 - CONSTANTS[7]));
CONSTANTS[17] =  0.180000*(CONSTANTS[7]/(1.00000 - CONSTANTS[7]));
CONSTANTS[18] = 190.000;
CONSTANTS[19] = ( (( CONSTANTS[14]*CONSTANTS[7])/(1.00000 - CONSTANTS[7]))*pow(CONSTANTS[10], 3.00000))/(pow(CONSTANTS[12], 3.00000)+pow(CONSTANTS[10], 3.00000));
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[4] = 0.1001;
RATES[3] = 0.1001;
RATES[2] = 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[16] -  (CONSTANTS[5]/CONSTANTS[7])*(STATES[1] - STATES[0]))/CONSTANTS[0];
resid[1] = RATES[1] - (- ALGEBRAIC[7]+ (CONSTANTS[5]/(1.00000 - CONSTANTS[7]))*(STATES[0] - STATES[1]))/CONSTANTS[0];
resid[2] = RATES[4] -  CONSTANTS[9]*(- ALGEBRAIC[6] -  3.00000*(ALGEBRAIC[3] - CONSTANTS[19]));
resid[3] = RATES[3] - (ALGEBRAIC[10] - STATES[3])/ALGEBRAIC[12];
resid[4] = RATES[2] - (ALGEBRAIC[9] - STATES[2])/ALGEBRAIC[13];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[11] = 1.00000/(1.00000+exp((STATES[0]+80.0000)/8.00000));
ALGEBRAIC[14] = 0.400000/( 5.00000*exp(- (STATES[1]+11.0000)/8.30000)+(- (STATES[1]+11.0000)/8.30000)/(exp(- (STATES[1]+11.0000)/8.30000) - 1.00000));
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] = ( (( CONSTANTS[14]*CONSTANTS[7])/(1.00000 - CONSTANTS[7]))*pow( STATES[1]*1.00000+STATES[4], 3.00000))/(pow(CONSTANTS[11], 3.00000)+pow( STATES[1]*1.00000+STATES[4], 3.00000));
ALGEBRAIC[2] = 1.00000/(1.00000+ 0.141000*exp(- STATES[1]/CONSTANTS[13]));
ALGEBRAIC[6] =  CONSTANTS[16]*ALGEBRAIC[2]*(STATES[1] - CONSTANTS[1]);
ALGEBRAIC[4] =  CONSTANTS[17]*(STATES[1] - CONSTANTS[8]);
ALGEBRAIC[5] =  CONSTANTS[15]*ALGEBRAIC[2]*STATES[1];
ALGEBRAIC[7] = ((ALGEBRAIC[5]+ALGEBRAIC[3]) - CONSTANTS[19])+ALGEBRAIC[4];
ALGEBRAIC[9] = 1.00000/(1.00000+exp(- (STATES[0]+31.0000)/5.30000));
ALGEBRAIC[10] = 1.00000/(1.00000+exp((STATES[0]+30.0000)/8.30000));
ALGEBRAIC[12] = 0.430000+0.860000/(1.00000+exp((STATES[0]+25.0000)/5.00000));
ALGEBRAIC[13] = (0.800000+1.60000/(1.00000+exp( 0.100000*(STATES[0]+25.0000))))/(1.00000+exp( - 0.100000*(STATES[0]+70.0000)));
ALGEBRAIC[8] = 1.00000/(1.00000+exp(- (STATES[0]+35.0000)/6.20000));
ALGEBRAIC[15] =  CONSTANTS[4]*STATES[3]*(STATES[0] - CONSTANTS[1])*pow(ALGEBRAIC[8], 3.00000);
ALGEBRAIC[0] =  CONSTANTS[6]*STATES[3]*(STATES[0]+30.0000);
ALGEBRAIC[1] =  CONSTANTS[3]*(STATES[0] - CONSTANTS[2])*pow(STATES[2], 2.00000);
ALGEBRAIC[16] = ALGEBRAIC[15]+ALGEBRAIC[1]+ALGEBRAIC[0];
}
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)
{
}