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 23 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 22 entries in the constant variable array. */ /* * VOI is time in component environment (millisecond). * STATES[0] is V in component membrane (millivolt). * CONSTANTS[0] is RToF in component membrane (millivolt). * CONSTANTS[1] is K_c in component membrane (millimolar). * CONSTANTS[2] is K_i in component membrane (millimolar). * CONSTANTS[3] is Na_c in component membrane (millimolar). * CONSTANTS[4] is Na_i in component membrane (millimolar). * ALGEBRAIC[5] is i_ns in component non_specific_current (picoA_per_picoF). * ALGEBRAIC[10] is i_to in component transient_outward_K_current (picoA_per_picoF). * ALGEBRAIC[20] is i_K1 in component inward_rectifier (picoA_per_picoF). * ALGEBRAIC[15] is i_Kur in component ultra_rapid_K_current (picoA_per_picoF). * ALGEBRAIC[21] is i_b_Na in component background_currents (picoA_per_picoF). * ALGEBRAIC[22] is i_NaK in component sodium_potassium_pump (picoA_per_picoF). * ALGEBRAIC[0] is i_Stim in component membrane (picoA_per_picoF). * CONSTANTS[5] is stim_start in component membrane (millisecond). * CONSTANTS[6] is stim_end in component membrane (millisecond). * CONSTANTS[7] is stim_period in component membrane (millisecond). * CONSTANTS[8] is stim_duration in component membrane (millisecond). * CONSTANTS[9] is stim_amplitude in component membrane (picoA_per_picoF). * CONSTANTS[10] is g_ns in component non_specific_current (nanoS_per_picoF). * CONSTANTS[20] is E_K in component transient_outward_K_current (millivolt). * CONSTANTS[11] is g_to in component transient_outward_K_current (nanoS_per_picoF). * STATES[1] is oa in component transient_outward_K_current_oa_gate (dimensionless). * STATES[2] is oi in component transient_outward_K_current_oi_gate (dimensionless). * ALGEBRAIC[1] is alpha_oa in component transient_outward_K_current_oa_gate (per_millisecond). * ALGEBRAIC[6] is beta_oa in component transient_outward_K_current_oa_gate (per_millisecond). * ALGEBRAIC[16] is tau_oa in component transient_outward_K_current_oa_gate (millisecond). * ALGEBRAIC[11] is oa_inf in component transient_outward_K_current_oa_gate (dimensionless). * ALGEBRAIC[2] is alpha_oi in component transient_outward_K_current_oi_gate (per_millisecond). * ALGEBRAIC[7] is beta_oi in component transient_outward_K_current_oi_gate (per_millisecond). * ALGEBRAIC[17] is tau_oi in component transient_outward_K_current_oi_gate (millisecond). * ALGEBRAIC[12] is oi_inf in component transient_outward_K_current_oi_gate (dimensionless). * CONSTANTS[12] is g_Kur in component ultra_rapid_K_current (nanoS_per_picoF). * STATES[3] is ua in component ultra_rapid_K_current_ua_gate (dimensionless). * STATES[4] is ui in component ultra_rapid_K_current_ui_gate (dimensionless). * ALGEBRAIC[3] is alpha_ua in component ultra_rapid_K_current_ua_gate (per_millisecond). * ALGEBRAIC[8] is beta_ua in component ultra_rapid_K_current_ua_gate (per_millisecond). * ALGEBRAIC[18] is tau_ua in component ultra_rapid_K_current_ua_gate (millisecond). * ALGEBRAIC[13] is ua_inf in component ultra_rapid_K_current_ua_gate (dimensionless). * ALGEBRAIC[4] is alpha_ui in component ultra_rapid_K_current_ui_gate (per_millisecond). * ALGEBRAIC[9] is beta_ui in component ultra_rapid_K_current_ui_gate (per_millisecond). * ALGEBRAIC[19] is tau_ui in component ultra_rapid_K_current_ui_gate (millisecond). * ALGEBRAIC[14] is ui_inf in component ultra_rapid_K_current_ui_gate (dimensionless). * CONSTANTS[13] is g_K1 in component inward_rectifier (nanoS_per_picoF). * CONSTANTS[14] is g_b_Na in component background_currents (nanoS_per_picoF). * CONSTANTS[21] is E_Na in component background_currents (millivolt). * CONSTANTS[15] is k_NaK_K in component sodium_potassium_pump (millimolar). * CONSTANTS[16] is k_NaK_Na in component sodium_potassium_pump (millimolar). * CONSTANTS[17] is i_NaK_max in component sodium_potassium_pump (picoA_per_picoF). * CONSTANTS[18] is V_rev in component sodium_potassium_pump (millivolt). * CONSTANTS[19] is B in component sodium_potassium_pump (millivolt). * RATES[0] is d/dt V in component membrane (millivolt). * RATES[1] is d/dt oa in component transient_outward_K_current_oa_gate (dimensionless). * RATES[2] is d/dt oi in component transient_outward_K_current_oi_gate (dimensionless). * RATES[3] is d/dt ua in component ultra_rapid_K_current_ua_gate (dimensionless). * RATES[4] is d/dt ui in component ultra_rapid_K_current_ui_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -50; CONSTANTS[0] = 26.54; CONSTANTS[1] = 5.4; CONSTANTS[2] = 139; CONSTANTS[3] = 140; CONSTANTS[4] = 11.2; CONSTANTS[5] = 100; CONSTANTS[6] = 10000; CONSTANTS[7] = 500; CONSTANTS[8] = 2; CONSTANTS[9] = -100; CONSTANTS[10] = 0.018; CONSTANTS[11] = 0.01652; STATES[1] = 0.2488; STATES[2] = 0.1866; CONSTANTS[12] = 0.6; STATES[3] = 0.9933; STATES[4] = 0.0999; CONSTANTS[13] = 0.03; CONSTANTS[14] = 0.00607; CONSTANTS[15] = 1; CONSTANTS[16] = 11; CONSTANTS[17] = 2.002; CONSTANTS[18] = -150; CONSTANTS[19] = -200; CONSTANTS[20] = CONSTANTS[0]*log(CONSTANTS[1]/CONSTANTS[2]); CONSTANTS[21] = CONSTANTS[0]*log(CONSTANTS[3]/CONSTANTS[4]); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 0.650000/(exp((STATES[0]+10.0000)/- 8.50000)+exp((STATES[0] - 30.0000)/- 59.0000)); ALGEBRAIC[6] = 0.650000/(2.50000+exp((STATES[0]+82.0000)/17.0000)); ALGEBRAIC[16] = 15.0000/(ALGEBRAIC[1]+ALGEBRAIC[6]); ALGEBRAIC[11] = 1.00000/(1.00000+exp((STATES[0]+20.4700)/- 17.5400)); RATES[1] = (ALGEBRAIC[11] - STATES[1])/ALGEBRAIC[16]; ALGEBRAIC[2] = 1.00000/(18.5300+exp((STATES[0]+113.700)/10.9500)); ALGEBRAIC[7] = 1.00000/(35.5600+exp((STATES[0]+1.26000)/- 7.44000)); ALGEBRAIC[17] = 15.0000/(ALGEBRAIC[2]+ALGEBRAIC[7]); ALGEBRAIC[12] = 1.00000/(1.00000+exp((STATES[0]+43.1000)/5.30000)); RATES[2] = (ALGEBRAIC[12] - STATES[2])/ALGEBRAIC[17]; ALGEBRAIC[3] = 0.650000/(exp((STATES[0]+10.0000)/- 8.50000)+exp((STATES[0] - 30.0000)/- 59.0000)); ALGEBRAIC[8] = 0.650000/(2.50000+exp((STATES[0]+82.0000)/17.0000)); ALGEBRAIC[18] = 1.00000/(ALGEBRAIC[3]+ALGEBRAIC[8]); ALGEBRAIC[13] = 1.00000/(1.00000+exp((STATES[0]+33.3000)/- 9.60000)); RATES[3] = (ALGEBRAIC[13] - STATES[3])/ALGEBRAIC[18]; ALGEBRAIC[4] = 1.00000/(21.0000+exp((STATES[0] - 185.000)/28.0000)); ALGEBRAIC[9] = 1.00000/exp((STATES[0] - 158.000)/- 16.0000); ALGEBRAIC[19] = 5.00000/(ALGEBRAIC[4]+ALGEBRAIC[9]); ALGEBRAIC[14] = 1.00000/(1.00000+exp((STATES[0] - 99.4500)/27.4800)); RATES[4] = (ALGEBRAIC[14] - STATES[4])/ALGEBRAIC[19]; ALGEBRAIC[5] = CONSTANTS[10]*STATES[0]; ALGEBRAIC[10] = CONSTANTS[11]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[20] = ( CONSTANTS[13]*(STATES[0]+86.7500))/(1.00000+exp((STATES[0]+20.0000)/20.0000)); ALGEBRAIC[15] = ( CONSTANTS[12]*0.00500000+0.0500000/(1.00000+exp(- (STATES[0] - 15.0000)/13.0000)))*pow(STATES[3], 3.00000)*STATES[4]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[21] = CONSTANTS[14]*(STATES[0] - CONSTANTS[21]); ALGEBRAIC[22] = ( (( (( CONSTANTS[17]*CONSTANTS[1])/(CONSTANTS[1]+CONSTANTS[15]))*pow(CONSTANTS[4], 1.50000))/(pow(CONSTANTS[4], 1.50000)+pow(CONSTANTS[16], 1.50000)))*(STATES[0] - CONSTANTS[18]))/(STATES[0] - CONSTANTS[19]); ALGEBRAIC[0] = (VOI>=CONSTANTS[5]&&VOI<=CONSTANTS[6]&&(VOI - CONSTANTS[5]) - floor((VOI - CONSTANTS[5])/CONSTANTS[7])*CONSTANTS[7]<=CONSTANTS[8] ? CONSTANTS[9] : 0.00000); RATES[0] = - (ALGEBRAIC[5]+ALGEBRAIC[15]+ALGEBRAIC[10]+ALGEBRAIC[20]+ALGEBRAIC[21]+ALGEBRAIC[22]+ALGEBRAIC[0]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 0.650000/(exp((STATES[0]+10.0000)/- 8.50000)+exp((STATES[0] - 30.0000)/- 59.0000)); ALGEBRAIC[6] = 0.650000/(2.50000+exp((STATES[0]+82.0000)/17.0000)); ALGEBRAIC[16] = 15.0000/(ALGEBRAIC[1]+ALGEBRAIC[6]); ALGEBRAIC[11] = 1.00000/(1.00000+exp((STATES[0]+20.4700)/- 17.5400)); ALGEBRAIC[2] = 1.00000/(18.5300+exp((STATES[0]+113.700)/10.9500)); ALGEBRAIC[7] = 1.00000/(35.5600+exp((STATES[0]+1.26000)/- 7.44000)); ALGEBRAIC[17] = 15.0000/(ALGEBRAIC[2]+ALGEBRAIC[7]); ALGEBRAIC[12] = 1.00000/(1.00000+exp((STATES[0]+43.1000)/5.30000)); ALGEBRAIC[3] = 0.650000/(exp((STATES[0]+10.0000)/- 8.50000)+exp((STATES[0] - 30.0000)/- 59.0000)); ALGEBRAIC[8] = 0.650000/(2.50000+exp((STATES[0]+82.0000)/17.0000)); ALGEBRAIC[18] = 1.00000/(ALGEBRAIC[3]+ALGEBRAIC[8]); ALGEBRAIC[13] = 1.00000/(1.00000+exp((STATES[0]+33.3000)/- 9.60000)); ALGEBRAIC[4] = 1.00000/(21.0000+exp((STATES[0] - 185.000)/28.0000)); ALGEBRAIC[9] = 1.00000/exp((STATES[0] - 158.000)/- 16.0000); ALGEBRAIC[19] = 5.00000/(ALGEBRAIC[4]+ALGEBRAIC[9]); ALGEBRAIC[14] = 1.00000/(1.00000+exp((STATES[0] - 99.4500)/27.4800)); ALGEBRAIC[5] = CONSTANTS[10]*STATES[0]; ALGEBRAIC[10] = CONSTANTS[11]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[20] = ( CONSTANTS[13]*(STATES[0]+86.7500))/(1.00000+exp((STATES[0]+20.0000)/20.0000)); ALGEBRAIC[15] = ( CONSTANTS[12]*0.00500000+0.0500000/(1.00000+exp(- (STATES[0] - 15.0000)/13.0000)))*pow(STATES[3], 3.00000)*STATES[4]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[21] = CONSTANTS[14]*(STATES[0] - CONSTANTS[21]); ALGEBRAIC[22] = ( (( (( CONSTANTS[17]*CONSTANTS[1])/(CONSTANTS[1]+CONSTANTS[15]))*pow(CONSTANTS[4], 1.50000))/(pow(CONSTANTS[4], 1.50000)+pow(CONSTANTS[16], 1.50000)))*(STATES[0] - CONSTANTS[18]))/(STATES[0] - CONSTANTS[19]); ALGEBRAIC[0] = (VOI>=CONSTANTS[5]&&VOI<=CONSTANTS[6]&&(VOI - CONSTANTS[5]) - floor((VOI - CONSTANTS[5])/CONSTANTS[7])*CONSTANTS[7]<=CONSTANTS[8] ? CONSTANTS[9] : 0.00000); }