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 32 entries in the constant variable array. */ /* * STATES[0] is s in component synaptic_input (dimensionless). * ALGEBRAIC[13] is sum_g_syn_e_s in component synaptic_coupling (nanoS). * ALGEBRAIC[12] is V_public in component synaptic_input (millivolt). * VOI is time in component environment (millisecond). * STATES[1] is V in component membrane (millivolt). * CONSTANTS[0] is C in component membrane (picoF). * CONSTANTS[1] is i_app in component membrane (picoA). * ALGEBRAIC[15] is i_NaP in component persistent_sodium_current (picoA). * ALGEBRAIC[14] is i_Na in component fast_sodium_current (picoA). * ALGEBRAIC[3] is i_K in component potassium_current (picoA). * ALGEBRAIC[9] is i_L in component leakage_current (picoA). * ALGEBRAIC[10] is i_tonic_e in component tonic_current (picoA). * ALGEBRAIC[16] is i_syn_e in component synaptic_input (picoA). * CONSTANTS[2] is E_Na in component fast_sodium_current (millivolt). * CONSTANTS[3] is g_Na in component fast_sodium_current (nanoS). * ALGEBRAIC[0] is m_infinity in component fast_sodium_current_m_gate (dimensionless). * STATES[2] is n in component fast_sodium_current_n_gate (dimensionless). * CONSTANTS[4] is theta_m in component fast_sodium_current_m_gate (millivolt). * CONSTANTS[5] is sigma_m in component fast_sodium_current_m_gate (millivolt). * ALGEBRAIC[1] is n_infinity in component fast_sodium_current_n_gate (dimensionless). * ALGEBRAIC[2] is tau_n in component fast_sodium_current_n_gate (millisecond). * CONSTANTS[6] is tau_n_max in component fast_sodium_current_n_gate (millisecond). * CONSTANTS[7] is theta_n in component fast_sodium_current_n_gate (millivolt). * CONSTANTS[8] is sigma_n in component fast_sodium_current_n_gate (millivolt). * CONSTANTS[9] is g_K in component potassium_current (nanoS). * CONSTANTS[10] is E_K in component potassium_current (millivolt). * STATES[3] is n in component potassium_current_n_gate (dimensionless). * ALGEBRAIC[4] is n_infinity in component potassium_current_n_gate (dimensionless). * ALGEBRAIC[5] is tau_n in component potassium_current_n_gate (millisecond). * CONSTANTS[11] is tau_n_max in component potassium_current_n_gate (millisecond). * CONSTANTS[12] is theta_n in component potassium_current_n_gate (millivolt). * CONSTANTS[13] is sigma_n in component potassium_current_n_gate (millivolt). * CONSTANTS[14] is g_NaP in component persistent_sodium_current (nanoS). * ALGEBRAIC[6] is m_infinity in component persistent_sodium_current_m_gate (dimensionless). * STATES[4] is h in component persistent_sodium_current_h_gate (dimensionless). * CONSTANTS[15] is theta_m in component persistent_sodium_current_m_gate (millivolt). * CONSTANTS[16] is sigma_m in component persistent_sodium_current_m_gate (millivolt). * ALGEBRAIC[7] is h_infinity in component persistent_sodium_current_h_gate (dimensionless). * ALGEBRAIC[8] is tau_h in component persistent_sodium_current_h_gate (millisecond). * CONSTANTS[17] is tau_h_max in component persistent_sodium_current_h_gate (millisecond). * CONSTANTS[18] is theta_h in component persistent_sodium_current_h_gate (millivolt). * CONSTANTS[19] is sigma_h in component persistent_sodium_current_h_gate (millivolt). * CONSTANTS[20] is g_L in component leakage_current (nanoS). * CONSTANTS[21] is E_L in component leakage_current (millivolt). * CONSTANTS[22] is E_syn_e in component tonic_current (millivolt). * CONSTANTS[23] is g_tonic_e in component tonic_current (nanoS). * ALGEBRAIC[11] is s_infinity in component synaptic_input (dimensionless). * CONSTANTS[24] is kr in component synaptic_input (dimensionless). * CONSTANTS[25] is tau_s in component synaptic_input (millisecond). * CONSTANTS[26] is sigma_s in component synaptic_input (millivolt). * CONSTANTS[27] is theta_s in component synaptic_input (millivolt). * CONSTANTS[28] is g_syn_e_1_2 in component synaptic_coupling (nanoS). * CONSTANTS[29] is g_syn_e_1_3 in component synaptic_coupling (nanoS). * CONSTANTS[30] is g_syn_e_1_4 in component synaptic_coupling (nanoS). * CONSTANTS[31] is g_syn_e_1_5 in component synaptic_coupling (nanoS). * RATES[1] is d/dt V in component membrane (millivolt). * RATES[2] is d/dt n in component fast_sodium_current_n_gate (dimensionless). * RATES[3] is d/dt n in component potassium_current_n_gate (dimensionless). * RATES[4] is d/dt h in component persistent_sodium_current_h_gate (dimensionless). * RATES[0] is d/dt s in component synaptic_input (dimensionless). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1; STATES[1] = -50.0; CONSTANTS[0] = 21.0; CONSTANTS[1] = 0.0; CONSTANTS[2] = 50.0; CONSTANTS[3] = 28.0; STATES[2] = 0.01; CONSTANTS[4] = -34.0; CONSTANTS[5] = -5.0; CONSTANTS[6] = 10.0; CONSTANTS[7] = -29.0; CONSTANTS[8] = -4.0; CONSTANTS[9] = 11.2; CONSTANTS[10] = -85.0; STATES[3] = 0.01; CONSTANTS[11] = 10.0; CONSTANTS[12] = -29.0; CONSTANTS[13] = -4.0; CONSTANTS[14] = 2.8; STATES[4] = 0.46; CONSTANTS[15] = -40.0; CONSTANTS[16] = -6.0; CONSTANTS[17] = 10000.0; CONSTANTS[18] = -48.0; CONSTANTS[19] = 6.0; CONSTANTS[20] = 2.8; CONSTANTS[21] = -57.5; CONSTANTS[22] = 0.0; CONSTANTS[23] = 0.0; CONSTANTS[24] = 1.0; CONSTANTS[25] = 5.0; CONSTANTS[26] = -5.0; CONSTANTS[27] = -10.0; CONSTANTS[28] = 0.10; CONSTANTS[29] = 0.10; CONSTANTS[30] = 0.10; CONSTANTS[31] = 0.10; RATES[1] = 0.1001; RATES[2] = 0.1001; RATES[3] = 0.1001; RATES[4] = 0.1001; RATES[0] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[1] - (- (ALGEBRAIC[15]+ALGEBRAIC[14]+ALGEBRAIC[3]+ALGEBRAIC[9]+ALGEBRAIC[10]+ALGEBRAIC[16])+CONSTANTS[1])/CONSTANTS[0]; resid[1] = RATES[2] - (ALGEBRAIC[1] - STATES[2])/ALGEBRAIC[2]; resid[2] = RATES[3] - (ALGEBRAIC[4] - STATES[3])/ALGEBRAIC[5]; resid[3] = RATES[4] - (ALGEBRAIC[7] - STATES[4])/ALGEBRAIC[8]; resid[4] = RATES[0] - ( (1.00000 - STATES[0])*ALGEBRAIC[11] - - ( CONSTANTS[24]*STATES[0]))/CONSTANTS[25]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[12] = STATES[1]; } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 1.00000/(1.00000+exp((STATES[1] - CONSTANTS[7])/CONSTANTS[8])); ALGEBRAIC[2] = CONSTANTS[6]/cosh((STATES[1] - CONSTANTS[7])/( 2.00000*CONSTANTS[8])); ALGEBRAIC[3] = CONSTANTS[9]*pow(STATES[3], 4.00000)*(STATES[1] - CONSTANTS[10]); ALGEBRAIC[4] = 1.00000/(1.00000+exp((STATES[1] - CONSTANTS[12])/CONSTANTS[13])); ALGEBRAIC[5] = CONSTANTS[11]/cosh((STATES[1] - CONSTANTS[12])/( 2.00000*CONSTANTS[13])); ALGEBRAIC[7] = 1.00000/(1.00000+exp((STATES[1] - CONSTANTS[18])/CONSTANTS[19])); ALGEBRAIC[8] = CONSTANTS[17]/cosh((STATES[1] - CONSTANTS[18])/( 2.00000*CONSTANTS[19])); ALGEBRAIC[9] = CONSTANTS[20]*(STATES[1] - CONSTANTS[21]); ALGEBRAIC[10] = CONSTANTS[23]*(STATES[1] - CONSTANTS[22]); ALGEBRAIC[11] = 1.00000/(1.00000+exp((STATES[1] - CONSTANTS[27])/CONSTANTS[26])); ALGEBRAIC[0] = 1.00000/(1.00000+exp((STATES[1] - CONSTANTS[4])/CONSTANTS[5])); ALGEBRAIC[14] = CONSTANTS[3]*pow(ALGEBRAIC[0], 3.00000)*(1.00000 - STATES[2])*(STATES[1] - CONSTANTS[2]); ALGEBRAIC[6] = 1.00000/(1.00000+exp((STATES[1] - CONSTANTS[15])/CONSTANTS[16])); ALGEBRAIC[15] = CONSTANTS[14]*ALGEBRAIC[6]*STATES[4]*(STATES[1] - CONSTANTS[2]); ALGEBRAIC[13] = CONSTANTS[28]*STATES[0]+ CONSTANTS[29]*STATES[0]+ CONSTANTS[30]*STATES[0]+ CONSTANTS[31]*STATES[0]; ALGEBRAIC[16] = ALGEBRAIC[13]*(STATES[1] - CONSTANTS[22]); } 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) { }