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 5 entries in the algebraic variable array. There are a total of 1 entries in each of the rate and state variable arrays. There are a total of 5 entries in the constant variable array. */ /* * ALGEBRAIC[0] is V in component environment (millivolt). * VOI is t in component environment (millisec). * STATES[0] is n in component potassium_channel_n_gate (dimensionless). * ALGEBRAIC[3] is i_K in component potassium_channel (microA_per_cm2). * CONSTANTS[0] is g_K in component potassium_channel (milliS_per_cm2). * CONSTANTS[1] is Ki in component potassium_channel (mM). * CONSTANTS[2] is Ko in component potassium_channel (mM). * CONSTANTS[3] is RTF in component potassium_channel (millivolt). * CONSTANTS[4] is E_K in component potassium_channel (millivolt). * ALGEBRAIC[1] is K_conductance in component potassium_channel (milliS_per_cm2). * ALGEBRAIC[2] is alpha_n in component potassium_channel_n_gate (per_millisec). * ALGEBRAIC[4] is beta_n in component potassium_channel_n_gate (per_millisec). * RATES[0] is d/dt n in component potassium_channel_n_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.325; CONSTANTS[0] = 36; CONSTANTS[1] = 90; CONSTANTS[2] = 3; CONSTANTS[3] = 25; CONSTANTS[4] = CONSTANTS[3]*log(CONSTANTS[2]/CONSTANTS[1]); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI>5.00000&&VOI<15.0000 ? - 85.0000 : 0.00000); ALGEBRAIC[2] = ( 0.0100000*(ALGEBRAIC[0]+10.0000))/(exp((ALGEBRAIC[0]+10.0000)/10.0000) - 1.00000); ALGEBRAIC[4] = 0.125000*exp(ALGEBRAIC[0]/80.0000); RATES[0] = ALGEBRAIC[2]*(1.00000 - STATES[0]) - ALGEBRAIC[4]*STATES[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI>5.00000&&VOI<15.0000 ? - 85.0000 : 0.00000); ALGEBRAIC[2] = ( 0.0100000*(ALGEBRAIC[0]+10.0000))/(exp((ALGEBRAIC[0]+10.0000)/10.0000) - 1.00000); ALGEBRAIC[4] = 0.125000*exp(ALGEBRAIC[0]/80.0000); ALGEBRAIC[1] = CONSTANTS[0]*pow(STATES[0], 4.00000); ALGEBRAIC[3] = ALGEBRAIC[1]*(ALGEBRAIC[0] - CONSTANTS[4]); }