Generated Code
The following is c 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 4 entries in each of the rate and state variable arrays. There are a total of 24 entries in the constant variable array. */ /* * VOI is time in component environment (millisecond). * STATES[0] is V in component membrane (millivolt). * CONSTANTS[0] is C in component membrane (picoF). * CONSTANTS[1] is i_app in component membrane (picoA). * ALGEBRAIC[10] is i_NaP in component persistent_sodium_current (picoA). * ALGEBRAIC[4] is i_Na in component fast_sodium_current (picoA). * ALGEBRAIC[8] is i_K in component potassium_current (picoA). * ALGEBRAIC[11] is i_L in component leakage_current (picoA). * ALGEBRAIC[12] is i_tonic_e in component tonic_current (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[1] 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[5] 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[2] is n in component potassium_current_n_gate (dimensionless). * ALGEBRAIC[2] is n_infinity in component potassium_current_n_gate (dimensionless). * ALGEBRAIC[6] 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[9] is m_infinity in component persistent_sodium_current_m_gate (dimensionless). * STATES[3] 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[3] is h_infinity in component persistent_sodium_current_h_gate (dimensionless). * ALGEBRAIC[7] 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 g_tonic_e in component tonic_current (nanoS). * CONSTANTS[23] is E_syn_e in component tonic_current (millivolt). * RATES[0] is d/dt V in component membrane (millivolt). * RATES[1] is d/dt n in component fast_sodium_current_n_gate (dimensionless). * RATES[2] is d/dt n in component potassium_current_n_gate (dimensionless). * RATES[3] is d/dt h in component persistent_sodium_current_h_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -50.0; CONSTANTS[0] = 21.0; CONSTANTS[1] = 0.0; CONSTANTS[2] = 50.0; CONSTANTS[3] = 28.0; STATES[1] = 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[2] = 0.01; CONSTANTS[11] = 10.0; CONSTANTS[12] = -29.0; CONSTANTS[13] = -4.0; CONSTANTS[14] = 2.8; STATES[3] = 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; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[7])/CONSTANTS[8])); ALGEBRAIC[5] = CONSTANTS[6]/cosh((STATES[0] - CONSTANTS[7])/( 2.00000*CONSTANTS[8])); RATES[1] = (ALGEBRAIC[1] - STATES[1])/ALGEBRAIC[5]; ALGEBRAIC[2] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[12])/CONSTANTS[13])); ALGEBRAIC[6] = CONSTANTS[11]/cosh((STATES[0] - CONSTANTS[12])/( 2.00000*CONSTANTS[13])); RATES[2] = (ALGEBRAIC[2] - STATES[2])/ALGEBRAIC[6]; ALGEBRAIC[3] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[18])/CONSTANTS[19])); ALGEBRAIC[7] = CONSTANTS[17]/cosh((STATES[0] - CONSTANTS[18])/( 2.00000*CONSTANTS[19])); RATES[3] = (ALGEBRAIC[3] - STATES[3])/ALGEBRAIC[7]; ALGEBRAIC[9] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[15])/CONSTANTS[16])); ALGEBRAIC[10] = CONSTANTS[14]*ALGEBRAIC[9]*STATES[3]*(STATES[0] - CONSTANTS[2]); ALGEBRAIC[0] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[4])/CONSTANTS[5])); ALGEBRAIC[4] = CONSTANTS[3]*pow(ALGEBRAIC[0], 3.00000)*(1.00000 - STATES[1])*(STATES[0] - CONSTANTS[2]); ALGEBRAIC[8] = CONSTANTS[9]*pow(STATES[2], 4.00000)*(STATES[0] - CONSTANTS[10]); ALGEBRAIC[11] = CONSTANTS[20]*(STATES[0] - CONSTANTS[21]); ALGEBRAIC[12] = CONSTANTS[22]*(STATES[0] - CONSTANTS[23]); RATES[0] = (- (ALGEBRAIC[10]+ALGEBRAIC[4]+ALGEBRAIC[8]+ALGEBRAIC[11]+ALGEBRAIC[12])+CONSTANTS[1])/CONSTANTS[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[7])/CONSTANTS[8])); ALGEBRAIC[5] = CONSTANTS[6]/cosh((STATES[0] - CONSTANTS[7])/( 2.00000*CONSTANTS[8])); ALGEBRAIC[2] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[12])/CONSTANTS[13])); ALGEBRAIC[6] = CONSTANTS[11]/cosh((STATES[0] - CONSTANTS[12])/( 2.00000*CONSTANTS[13])); ALGEBRAIC[3] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[18])/CONSTANTS[19])); ALGEBRAIC[7] = CONSTANTS[17]/cosh((STATES[0] - CONSTANTS[18])/( 2.00000*CONSTANTS[19])); ALGEBRAIC[9] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[15])/CONSTANTS[16])); ALGEBRAIC[10] = CONSTANTS[14]*ALGEBRAIC[9]*STATES[3]*(STATES[0] - CONSTANTS[2]); ALGEBRAIC[0] = 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[4])/CONSTANTS[5])); ALGEBRAIC[4] = CONSTANTS[3]*pow(ALGEBRAIC[0], 3.00000)*(1.00000 - STATES[1])*(STATES[0] - CONSTANTS[2]); ALGEBRAIC[8] = CONSTANTS[9]*pow(STATES[2], 4.00000)*(STATES[0] - CONSTANTS[10]); ALGEBRAIC[11] = CONSTANTS[20]*(STATES[0] - CONSTANTS[21]); ALGEBRAIC[12] = CONSTANTS[22]*(STATES[0] - CONSTANTS[23]); }