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 5 entries in each of the rate and state variable arrays. There are a total of 15 entries in the constant variable array. */ /* * VOI is time in component environment (millisecond). * STATES[0] is V in component membrane (millivolt). * ALGEBRAIC[0] is Vs in component membrane (millivolt). * CONSTANTS[0] is V_I in component membrane (millivolt). * CONSTANTS[1] is V_K in component membrane (millivolt). * CONSTANTS[2] is V_L in component membrane (millivolt). * CONSTANTS[3] is V_H_Na in component membrane (millivolt). * CONSTANTS[4] is V_H_K in component membrane (millivolt). * CONSTANTS[13] is g_I in component membrane (milliS_per_microF). * CONSTANTS[5] is g_K in component membrane (milliS_per_microF). * CONSTANTS[6] is g_L in component membrane (milliS_per_microF). * CONSTANTS[14] is g_T in component membrane (milliS_per_microF). * CONSTANTS[7] is g_P in component membrane (milliS_per_microF). * CONSTANTS[8] is Kp in component membrane (millimolar). * STATES[1] is c in component calcium_concentration (millimolar). * ALGEBRAIC[8] is sI in component sI_gate (dimensionless). * STATES[2] is yI in component yI_gate (dimensionless). * STATES[3] is xT in component xT_gate (dimensionless). * STATES[4] is xK in component xK_gate (dimensionless). * ALGEBRAIC[1] is alpha_m in component sI_gate (per_millisecond). * ALGEBRAIC[5] is beta_m in component sI_gate (per_millisecond). * ALGEBRAIC[9] is ZI in component yI_gate (dimensionless). * ALGEBRAIC[2] is alpha_h in component yI_gate (per_millisecond). * ALGEBRAIC[6] is beta_h in component yI_gate (per_millisecond). * ALGEBRAIC[11] is tau_yI in component yI_gate (millisecond). * ALGEBRAIC[3] is sT in component xT_gate (dimensionless). * CONSTANTS[9] is tau_xT in component xT_gate (millisecond). * CONSTANTS[10] is V_Ca in component calcium_concentration (millivolt). * CONSTANTS[11] is rho in component calcium_concentration (per_millisecond). * CONSTANTS[12] is K_c in component calcium_concentration (millimolar_per_millivolt). * ALGEBRAIC[4] is alpha_n in component xK_gate (per_millisecond). * ALGEBRAIC[7] is beta_n in component xK_gate (per_millisecond). * ALGEBRAIC[12] is tau_xK in component xK_gate (millisecond). * ALGEBRAIC[10] is sK in component xK_gate (dimensionless). * RATES[0] is d/dt V in component membrane (millivolt). * RATES[2] is d/dt yI in component yI_gate (dimensionless). * RATES[3] is d/dt xT in component xT_gate (dimensionless). * RATES[1] is d/dt c in component calcium_concentration (millimolar). * RATES[4] is d/dt xK in component xK_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -54; CONSTANTS[0] = 30.0; CONSTANTS[1] = -75.0; CONSTANTS[2] = -40.0; CONSTANTS[3] = 115.0; CONSTANTS[4] = -12.0; CONSTANTS[5] = 0.3; CONSTANTS[6] = 0.003; CONSTANTS[7] = 0.03; CONSTANTS[8] = 0.5; STATES[1] = 0.1; STATES[2] = 0.1; STATES[3] = 0.1; STATES[4] = 0.1; CONSTANTS[9] = 235.0; CONSTANTS[10] = 140.0; CONSTANTS[11] = 0.0003; CONSTANTS[12] = 0.0085; CONSTANTS[13] = 1.00000*((CONSTANTS[3] - CONSTANTS[4])/(CONSTANTS[0] - CONSTANTS[1])); CONSTANTS[14] = 1.00000*(( CONSTANTS[3]*CONSTANTS[1] - CONSTANTS[0]*CONSTANTS[4])/(CONSTANTS[0] - CONSTANTS[1])); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[1] = CONSTANTS[11]*( CONSTANTS[12]*STATES[3]*(CONSTANTS[10] - STATES[0]) - STATES[1]); ALGEBRAIC[0] = 1.00000*CONSTANTS[13]*STATES[0]+ 1.00000*CONSTANTS[14]; ALGEBRAIC[3] = 1.00000/(exp( 0.150000*(-50.0000 - ALGEBRAIC[0]))+1.00000); RATES[3] = (ALGEBRAIC[3] - STATES[3])/CONSTANTS[9]; ALGEBRAIC[1] = ( 0.100000*(50.0000 - ALGEBRAIC[0]))/- exp((50.0000 - ALGEBRAIC[0])/10.0000); ALGEBRAIC[5] = 4.00000*exp((25.0000 - ALGEBRAIC[0])/18.0000); ALGEBRAIC[8] = ALGEBRAIC[1]/(ALGEBRAIC[1]+ALGEBRAIC[5]); RATES[0] = ( CONSTANTS[13]*pow(ALGEBRAIC[8], 3.00000)*STATES[2]+ CONSTANTS[14]*STATES[3])*(CONSTANTS[0] - STATES[0])+ ( CONSTANTS[5]*pow(STATES[4], 4.00000)+ CONSTANTS[7]*STATES[1]*pow(CONSTANTS[8]+STATES[1], -1.00000))*(CONSTANTS[1] - STATES[0])+ CONSTANTS[6]*(CONSTANTS[2] - STATES[0]); ALGEBRAIC[2] = 0.0700000*exp((25.0000 - ALGEBRAIC[0])/20.0000); ALGEBRAIC[6] = 1.00000/(exp((55.0000 - ALGEBRAIC[0])/10.0000)+1.00000); ALGEBRAIC[9] = ALGEBRAIC[2]/(ALGEBRAIC[2]+ALGEBRAIC[6]); ALGEBRAIC[11] = 12.5000/(ALGEBRAIC[2]+ALGEBRAIC[6]); RATES[2] = (ALGEBRAIC[9] - STATES[2])/ALGEBRAIC[11]; ALGEBRAIC[4] = ( 0.0100000*(55.0000 - ALGEBRAIC[0]))/(exp((55.0000 - ALGEBRAIC[0])/10.0000) - 1.00000); ALGEBRAIC[7] = 0.125000*exp((45.0000 - ALGEBRAIC[0])/80.0000); ALGEBRAIC[12] = 12.5000/(ALGEBRAIC[4]+ALGEBRAIC[7]); ALGEBRAIC[10] = ALGEBRAIC[4]/(ALGEBRAIC[4]+ALGEBRAIC[7]); RATES[4] = (ALGEBRAIC[10] - STATES[4])/ALGEBRAIC[12]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = 1.00000*CONSTANTS[13]*STATES[0]+ 1.00000*CONSTANTS[14]; ALGEBRAIC[3] = 1.00000/(exp( 0.150000*(-50.0000 - ALGEBRAIC[0]))+1.00000); ALGEBRAIC[1] = ( 0.100000*(50.0000 - ALGEBRAIC[0]))/- exp((50.0000 - ALGEBRAIC[0])/10.0000); ALGEBRAIC[5] = 4.00000*exp((25.0000 - ALGEBRAIC[0])/18.0000); ALGEBRAIC[8] = ALGEBRAIC[1]/(ALGEBRAIC[1]+ALGEBRAIC[5]); ALGEBRAIC[2] = 0.0700000*exp((25.0000 - ALGEBRAIC[0])/20.0000); ALGEBRAIC[6] = 1.00000/(exp((55.0000 - ALGEBRAIC[0])/10.0000)+1.00000); ALGEBRAIC[9] = ALGEBRAIC[2]/(ALGEBRAIC[2]+ALGEBRAIC[6]); ALGEBRAIC[11] = 12.5000/(ALGEBRAIC[2]+ALGEBRAIC[6]); ALGEBRAIC[4] = ( 0.0100000*(55.0000 - ALGEBRAIC[0]))/(exp((55.0000 - ALGEBRAIC[0])/10.0000) - 1.00000); ALGEBRAIC[7] = 0.125000*exp((45.0000 - ALGEBRAIC[0])/80.0000); ALGEBRAIC[12] = 12.5000/(ALGEBRAIC[4]+ALGEBRAIC[7]); ALGEBRAIC[10] = ALGEBRAIC[4]/(ALGEBRAIC[4]+ALGEBRAIC[7]); }