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 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[1] is i_ns in component non_specific_current (picoA_per_picoF). * ALGEBRAIC[2] 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[11] 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[3] is alpha_oa in component transient_outward_K_current_oa_gate (per_millisecond). * ALGEBRAIC[4] is beta_oa in component transient_outward_K_current_oa_gate (per_millisecond). * ALGEBRAIC[6] is tau_oa in component transient_outward_K_current_oa_gate (millisecond). * ALGEBRAIC[5] is oa_inf in component transient_outward_K_current_oa_gate (dimensionless). * ALGEBRAIC[7] is alpha_oi in component transient_outward_K_current_oi_gate (per_millisecond). * ALGEBRAIC[8] is beta_oi in component transient_outward_K_current_oi_gate (per_millisecond). * ALGEBRAIC[10] is tau_oi in component transient_outward_K_current_oi_gate (millisecond). * ALGEBRAIC[9] 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[12] is alpha_ua in component ultra_rapid_K_current_ua_gate (per_millisecond). * ALGEBRAIC[13] is beta_ua in component ultra_rapid_K_current_ua_gate (per_millisecond). * ALGEBRAIC[15] is tau_ua in component ultra_rapid_K_current_ua_gate (millisecond). * ALGEBRAIC[14] is ua_inf in component ultra_rapid_K_current_ua_gate (dimensionless). * ALGEBRAIC[16] is alpha_ui in component ultra_rapid_K_current_ui_gate (per_millisecond). * ALGEBRAIC[17] 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[18] 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). * There are a total of 3 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -80; 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] = 5000; 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]); RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 0.1001; RATES[3] = 0.1001; RATES[4] = 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[1]+ALGEBRAIC[11]+ALGEBRAIC[2]+ALGEBRAIC[20]+ALGEBRAIC[21]+ALGEBRAIC[22]+ALGEBRAIC[0]); resid[1] = RATES[1] - (ALGEBRAIC[5] - STATES[1])/ALGEBRAIC[6]; resid[2] = RATES[2] - (ALGEBRAIC[9] - STATES[2])/ALGEBRAIC[10]; resid[3] = RATES[3] - (ALGEBRAIC[14] - STATES[3])/ALGEBRAIC[15]; resid[4] = RATES[4] - (ALGEBRAIC[18] - STATES[4])/ALGEBRAIC[19]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000&&CONDVAR[2]<=0.00000 ? CONSTANTS[9] : 0.00000); ALGEBRAIC[1] = CONSTANTS[10]*STATES[0]; ALGEBRAIC[2] = CONSTANTS[11]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[5] = 1.00000/(1.00000+exp((STATES[0]+20.4700)/- 17.5400)); ALGEBRAIC[3] = 0.650000/(exp((STATES[0]+10.0000)/- 8.50000)+exp((STATES[0] - 30.0000)/- 59.0000)); ALGEBRAIC[4] = 0.650000/(2.50000+exp((STATES[0]+82.0000)/17.0000)); ALGEBRAIC[6] = 15.0000/(ALGEBRAIC[3]+ALGEBRAIC[4]); ALGEBRAIC[9] = 1.00000/(1.00000+exp((STATES[0]+43.1000)/5.30000)); ALGEBRAIC[7] = 1.00000/(18.5300+exp((STATES[0]+113.700)/10.9500)); ALGEBRAIC[8] = 1.00000/(35.5600+exp((STATES[0]+1.26000)/- 7.44000)); ALGEBRAIC[10] = 15.0000/(ALGEBRAIC[7]+ALGEBRAIC[8]); ALGEBRAIC[11] = ( 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[14] = 1.00000/(1.00000+exp((STATES[0]+33.3000)/- 9.60000)); ALGEBRAIC[12] = 0.650000/(exp((STATES[0]+10.0000)/- 8.50000)+exp((STATES[0] - 30.0000)/- 59.0000)); ALGEBRAIC[13] = 0.650000/(2.50000+exp((STATES[0]+82.0000)/17.0000)); ALGEBRAIC[15] = 1.00000/(ALGEBRAIC[12]+ALGEBRAIC[13]); ALGEBRAIC[18] = 1.00000/(1.00000+exp((STATES[0] - 99.4500)/27.4800)); ALGEBRAIC[16] = 1.00000/(21.0000+exp((STATES[0] - 185.000)/28.0000)); ALGEBRAIC[17] = 1.00000/exp((STATES[0] - 158.000)/- 16.0000); ALGEBRAIC[19] = 5.00000/(ALGEBRAIC[16]+ALGEBRAIC[17]); ALGEBRAIC[20] = ( CONSTANTS[13]*(STATES[0]+86.7500))/(1.00000+exp((STATES[0]+20.0000)/20.0000)); 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]); } 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) { CONDVAR[0] = VOI - CONSTANTS[5]; CONDVAR[1] = VOI - CONSTANTS[6]; CONDVAR[2] = ((VOI - CONSTANTS[5]) - floor((VOI - CONSTANTS[5])/CONSTANTS[7])*CONSTANTS[7]) - CONSTANTS[8]; }