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 15 entries in the algebraic variable array. There are a total of 6 entries in each of the rate and state variable arrays. There are a total of 33 entries in the constant variable array. */ /* * VOI is time in component environment (second). * STATES[0] is V in component membrane (millivolt). * CONSTANTS[0] is R in component membrane (millijoule_per_mole_kelvin). * CONSTANTS[1] is T in component membrane (kelvin). * CONSTANTS[2] is F in component membrane (coulomb_per_mole). * CONSTANTS[3] is Cm in component membrane (microF_per_cm2). * ALGEBRAIC[11] is i_K_dr in component delayed_rectifier_K_channel_current (nanoA_per_cm2). * ALGEBRAIC[12] is i_K_Ca in component Ca_sensitive_K_current (nanoA_per_cm2). * ALGEBRAIC[13] is i_K_ATP in component ATP_sensitive_K_current (nanoA_per_cm2). * ALGEBRAIC[4] is i_fast in component fast_current (nanoA_per_cm2). * ALGEBRAIC[9] is i_Ca in component calcium_current (nanoA_per_cm2). * ALGEBRAIC[10] is i_NS in component cationic_nonselective_inward_current (nanoA_per_cm2). * ALGEBRAIC[14] is i_NaL in component Na_leak_current (nanoA_per_cm2). * CONSTANTS[4] is g_fast in component fast_current (microS_per_cm2). * CONSTANTS[5] is V_fast in component fast_current (millivolt). * ALGEBRAIC[0] is m_infinity in component fast_current_m_gate (dimensionless). * STATES[1] is h in component fast_current_h_gate (dimensionless). * CONSTANTS[6] is Vm in component fast_current_m_gate (millivolt). * CONSTANTS[7] is Sm in component fast_current_m_gate (millivolt). * CONSTANTS[8] is lamda_h in component fast_current_h_gate (per_second). * ALGEBRAIC[5] is tau_h in component fast_current_h_gate (second). * ALGEBRAIC[1] is h_infinity in component fast_current_h_gate (dimensionless). * CONSTANTS[9] is Vh in component fast_current_h_gate (millivolt). * CONSTANTS[10] is Sh in component fast_current_h_gate (millivolt). * CONSTANTS[11] is K_Ca in component calcium_current (micromolar). * CONSTANTS[12] is P_Ca in component calcium_current (nanoA_per_micromolar_per_cm2). * CONSTANTS[13] is Ca_o in component calcium_current (micromolar). * STATES[2] is Ca_i in component cytosolic_calcium (micromolar). * ALGEBRAIC[8] is f_infinity in component calcium_current_f_gate (dimensionless). * STATES[3] is d in component calcium_current_d_gate (dimensionless). * CONSTANTS[14] is lamda_d in component calcium_current_d_gate (per_second). * ALGEBRAIC[6] is tau_d in component calcium_current_d_gate (second). * ALGEBRAIC[2] is d_infinity in component calcium_current_d_gate (dimensionless). * CONSTANTS[15] is Vd in component calcium_current_d_gate (millivolt). * CONSTANTS[16] is Sd in component calcium_current_d_gate (millivolt). * CONSTANTS[17] is g_NS in component cationic_nonselective_inward_current (microS_per_cm2). * CONSTANTS[18] is K_NS in component cationic_nonselective_inward_current (micromolar). * CONSTANTS[19] is VNS in component cationic_nonselective_inward_current (millivolt). * STATES[4] is Ca_lum in component cytosolic_calcium (micromolar). * CONSTANTS[20] is V_K in component delayed_rectifier_K_channel_current (millivolt). * CONSTANTS[21] is g_K_dr in component delayed_rectifier_K_channel_current (microS_per_cm2). * STATES[5] is n in component delayed_rectifier_K_channel_current_n_gate (dimensionless). * CONSTANTS[22] is lamda_n in component delayed_rectifier_K_channel_current_n_gate (per_second). * CONSTANTS[23] is Vn in component delayed_rectifier_K_channel_current_n_gate (millivolt). * CONSTANTS[24] is Sn in component delayed_rectifier_K_channel_current_n_gate (millivolt). * ALGEBRAIC[3] is n_infinity in component delayed_rectifier_K_channel_current_n_gate (dimensionless). * ALGEBRAIC[7] is tau_n in component delayed_rectifier_K_channel_current_n_gate (second). * CONSTANTS[25] is g_K_Ca in component Ca_sensitive_K_current (microS_per_cm2). * CONSTANTS[26] is g_K_ATP in component ATP_sensitive_K_current (microS_per_cm2). * CONSTANTS[27] is g_NaL in component Na_leak_current (microS_per_cm2). * CONSTANTS[28] is V_Na in component Na_leak_current (millivolt). * CONSTANTS[29] is k_rel in component cytosolic_calcium (per_second). * CONSTANTS[30] is k_Ca in component cytosolic_calcium (per_second). * CONSTANTS[31] is k_pump in component cytosolic_calcium (per_second). * CONSTANTS[32] is omega in component cytosolic_calcium (micromolar_cm2_per_nanoA_per_second). * RATES[0] is d/dt V in component membrane (millivolt). * RATES[1] is d/dt h in component fast_current_h_gate (dimensionless). * RATES[3] is d/dt d in component calcium_current_d_gate (dimensionless). * RATES[5] is d/dt n in component delayed_rectifier_K_channel_current_n_gate (dimensionless). * RATES[2] is d/dt Ca_i in component cytosolic_calcium (micromolar). * RATES[4] is d/dt Ca_lum in component cytosolic_calcium (micromolar). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -38.34146; CONSTANTS[0] = 8314; CONSTANTS[1] = 310; CONSTANTS[2] = 96485; CONSTANTS[3] = 1; CONSTANTS[4] = 600; CONSTANTS[5] = 80; STATES[1] = 0.214723; CONSTANTS[6] = -25; CONSTANTS[7] = 9; CONSTANTS[8] = 12.5; CONSTANTS[9] = -48; CONSTANTS[10] = -7; CONSTANTS[11] = 1; CONSTANTS[12] = 2; CONSTANTS[13] = 2500; STATES[2] = 0.6959466; STATES[3] = 0.0031711238; CONSTANTS[14] = 2.5; CONSTANTS[15] = -10; CONSTANTS[16] = 5; CONSTANTS[17] = 5; CONSTANTS[18] = 50; CONSTANTS[19] = -20; STATES[4] = 102.686; CONSTANTS[20] = -75; CONSTANTS[21] = 600; STATES[5] = 0.1836403; CONSTANTS[22] = 12.5; CONSTANTS[23] = -18; CONSTANTS[24] = 14; CONSTANTS[25] = 5; CONSTANTS[26] = 2; CONSTANTS[27] = 0.3; CONSTANTS[28] = 80; CONSTANTS[29] = 0.2; CONSTANTS[30] = 7; CONSTANTS[31] = 30; CONSTANTS[32] = 0.2; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[4] = - CONSTANTS[29]*(STATES[4] - STATES[2])+ CONSTANTS[31]*STATES[2]; ALGEBRAIC[5] = 1.00000/( CONSTANTS[8]*(exp((CONSTANTS[9] - STATES[0])/( 2.00000*CONSTANTS[10]))+exp((STATES[0] - CONSTANTS[9])/( 2.00000*CONSTANTS[10])))); ALGEBRAIC[1] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10])); RATES[1] = (ALGEBRAIC[1] - STATES[1])/ALGEBRAIC[5]; ALGEBRAIC[6] = 1.00000/( CONSTANTS[14]*(exp((CONSTANTS[15] - STATES[0])/( 2.00000*CONSTANTS[16]))+exp((STATES[0] - CONSTANTS[15])/( 2.00000*CONSTANTS[16])))); ALGEBRAIC[2] = 1.00000/(1.00000+exp((CONSTANTS[15] - STATES[0])/CONSTANTS[16])); RATES[3] = (ALGEBRAIC[2] - STATES[3])/ALGEBRAIC[6]; ALGEBRAIC[3] = 1.00000/(1.00000+exp((CONSTANTS[23] - STATES[0])/CONSTANTS[24])); ALGEBRAIC[7] = 1.00000/( CONSTANTS[22]*(exp((CONSTANTS[23] - STATES[0])/( 2.00000*CONSTANTS[24]))+exp((STATES[0] - CONSTANTS[23])/( 2.00000*CONSTANTS[24])))); RATES[5] = (ALGEBRAIC[3] - STATES[5])/ALGEBRAIC[7]; ALGEBRAIC[8] = CONSTANTS[11]/(CONSTANTS[11]+STATES[2]); ALGEBRAIC[9] = ( (( CONSTANTS[12]*STATES[3]*ALGEBRAIC[8]*2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*(CONSTANTS[13] - STATES[2]*exp(( 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))))/(1.00000 - exp(( 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))); RATES[2] = CONSTANTS[29]*(STATES[4] - STATES[2]) - ( CONSTANTS[32]*ALGEBRAIC[9]+ CONSTANTS[30]*STATES[2]+ CONSTANTS[31]*STATES[2]); ALGEBRAIC[11] = CONSTANTS[21]*pow(STATES[5], 4.00000)*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[12] = (( CONSTANTS[25]*pow(STATES[2], 3.00000))/(pow(CONSTANTS[11], 3.00000)+pow(STATES[2], 3.00000)))*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[13] = CONSTANTS[26]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[0] = 1.00000/(1.00000+exp((CONSTANTS[6] - STATES[0])/CONSTANTS[7])); ALGEBRAIC[4] = CONSTANTS[4]*pow(ALGEBRAIC[0], 3.00000)*STATES[1]*(STATES[0] - CONSTANTS[5]); ALGEBRAIC[10] = (( CONSTANTS[17]*pow(CONSTANTS[18], 2.00000))/(pow(CONSTANTS[18], 2.00000)+pow(STATES[4], 2.00000)))*((STATES[0] - CONSTANTS[19])/(1.00000 - exp( 0.100000*(CONSTANTS[19] - STATES[0]))) - 10.0000); ALGEBRAIC[14] = CONSTANTS[27]*(STATES[0] - CONSTANTS[28]); RATES[0] = - (ALGEBRAIC[11]+ALGEBRAIC[12]+ALGEBRAIC[13]+ALGEBRAIC[4]+ALGEBRAIC[9]+ALGEBRAIC[10]+ALGEBRAIC[14])/CONSTANTS[3]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[5] = 1.00000/( CONSTANTS[8]*(exp((CONSTANTS[9] - STATES[0])/( 2.00000*CONSTANTS[10]))+exp((STATES[0] - CONSTANTS[9])/( 2.00000*CONSTANTS[10])))); ALGEBRAIC[1] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10])); ALGEBRAIC[6] = 1.00000/( CONSTANTS[14]*(exp((CONSTANTS[15] - STATES[0])/( 2.00000*CONSTANTS[16]))+exp((STATES[0] - CONSTANTS[15])/( 2.00000*CONSTANTS[16])))); ALGEBRAIC[2] = 1.00000/(1.00000+exp((CONSTANTS[15] - STATES[0])/CONSTANTS[16])); ALGEBRAIC[3] = 1.00000/(1.00000+exp((CONSTANTS[23] - STATES[0])/CONSTANTS[24])); ALGEBRAIC[7] = 1.00000/( CONSTANTS[22]*(exp((CONSTANTS[23] - STATES[0])/( 2.00000*CONSTANTS[24]))+exp((STATES[0] - CONSTANTS[23])/( 2.00000*CONSTANTS[24])))); ALGEBRAIC[8] = CONSTANTS[11]/(CONSTANTS[11]+STATES[2]); ALGEBRAIC[9] = ( (( CONSTANTS[12]*STATES[3]*ALGEBRAIC[8]*2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*(CONSTANTS[13] - STATES[2]*exp(( 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))))/(1.00000 - exp(( 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))); ALGEBRAIC[11] = CONSTANTS[21]*pow(STATES[5], 4.00000)*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[12] = (( CONSTANTS[25]*pow(STATES[2], 3.00000))/(pow(CONSTANTS[11], 3.00000)+pow(STATES[2], 3.00000)))*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[13] = CONSTANTS[26]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[0] = 1.00000/(1.00000+exp((CONSTANTS[6] - STATES[0])/CONSTANTS[7])); ALGEBRAIC[4] = CONSTANTS[4]*pow(ALGEBRAIC[0], 3.00000)*STATES[1]*(STATES[0] - CONSTANTS[5]); ALGEBRAIC[10] = (( CONSTANTS[17]*pow(CONSTANTS[18], 2.00000))/(pow(CONSTANTS[18], 2.00000)+pow(STATES[4], 2.00000)))*((STATES[0] - CONSTANTS[19])/(1.00000 - exp( 0.100000*(CONSTANTS[19] - STATES[0]))) - 10.0000); ALGEBRAIC[14] = CONSTANTS[27]*(STATES[0] - CONSTANTS[28]); }