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 7 entries in the algebraic variable array. There are a total of 3 entries in each of the rate and state variable arrays. There are a total of 14 entries in the constant variable array. */ /* * VOI is time in component environment (millisecond). * STATES[0] is V in component V (millivolt). * CONSTANTS[0] is C in component V (microF_per_cm2). * CONSTANTS[1] is i_app in component V (microA_per_cm2). * ALGEBRAIC[0] is i_L in component i_L (microA_per_cm2). * ALGEBRAIC[3] is i_Ca in component i_Ca (microA_per_cm2). * ALGEBRAIC[6] is i_K in component i_K (microA_per_cm2). * CONSTANTS[2] is g_L in component i_L (milliS_per_cm2). * CONSTANTS[3] is E_L in component i_L (millivolt). * CONSTANTS[4] is E_Ca in component i_Ca (millivolt). * CONSTANTS[5] is g_Ca in component i_Ca (milliS_per_cm2). * STATES[1] is m in component i_Ca_m_gate (dimensionless). * ALGEBRAIC[1] is m_infinity in component i_Ca_m_gate (dimensionless). * ALGEBRAIC[4] is lambda_m in component i_Ca_m_gate (per_millisecond). * CONSTANTS[6] is lambda_m_bar in component i_Ca_m_gate (per_millisecond). * CONSTANTS[7] is V1 in component i_Ca_m_gate (millivolt). * CONSTANTS[8] is V2 in component i_Ca_m_gate (millivolt). * CONSTANTS[9] is E_K in component i_K (millivolt). * CONSTANTS[10] is g_K in component i_K (milliS_per_cm2). * STATES[2] is n in component i_K_n_gate (dimensionless). * ALGEBRAIC[2] is n_infinity in component i_K_n_gate (dimensionless). * ALGEBRAIC[5] is lambda_n in component i_K_n_gate (per_millisecond). * CONSTANTS[11] is lambda_n_bar in component i_K_n_gate (per_millisecond). * CONSTANTS[12] is V3 in component i_K_n_gate (millivolt). * CONSTANTS[13] is V4 in component i_K_n_gate (millivolt). * RATES[0] is d/dt V in component V (millivolt). * RATES[1] is d/dt m in component i_Ca_m_gate (dimensionless). * RATES[2] is d/dt n in component i_K_n_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -50; CONSTANTS[0] = 20.0; CONSTANTS[1] = 540.0; CONSTANTS[2] = 2.0; CONSTANTS[3] = -50.00; CONSTANTS[4] = 100.0; CONSTANTS[5] = 4.0; STATES[1] = 0.1; CONSTANTS[6] = 1.0; CONSTANTS[7] = 0.0; CONSTANTS[8] = 15.0; CONSTANTS[9] = -70.0; CONSTANTS[10] = 8.0; STATES[2] = 0.1; CONSTANTS[11] = 0.1; CONSTANTS[12] = 10.0; CONSTANTS[13] = 10.0; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 0.500000*(1.00000+ tanh((STATES[0] - CONSTANTS[7])/CONSTANTS[8])); ALGEBRAIC[4] = CONSTANTS[6]*cosh((STATES[0] - CONSTANTS[7])/( 2.00000*CONSTANTS[8])); RATES[1] = ALGEBRAIC[4]*(ALGEBRAIC[1] - STATES[1]); ALGEBRAIC[2] = 0.500000*(1.00000+ tanh((STATES[0] - CONSTANTS[12])/CONSTANTS[13])); ALGEBRAIC[5] = CONSTANTS[11]*cosh((STATES[0] - CONSTANTS[12])/( 2.00000*CONSTANTS[13])); RATES[2] = ALGEBRAIC[5]*(ALGEBRAIC[2] - STATES[2]); ALGEBRAIC[0] = CONSTANTS[2]*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[3] = CONSTANTS[5]*STATES[1]*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[6] = CONSTANTS[10]*STATES[2]*(STATES[0] - CONSTANTS[9]); RATES[0] = (CONSTANTS[1] - (ALGEBRAIC[0]+ALGEBRAIC[3]+ALGEBRAIC[6]))/CONSTANTS[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = 0.500000*(1.00000+ tanh((STATES[0] - CONSTANTS[7])/CONSTANTS[8])); ALGEBRAIC[4] = CONSTANTS[6]*cosh((STATES[0] - CONSTANTS[7])/( 2.00000*CONSTANTS[8])); ALGEBRAIC[2] = 0.500000*(1.00000+ tanh((STATES[0] - CONSTANTS[12])/CONSTANTS[13])); ALGEBRAIC[5] = CONSTANTS[11]*cosh((STATES[0] - CONSTANTS[12])/( 2.00000*CONSTANTS[13])); ALGEBRAIC[0] = CONSTANTS[2]*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[3] = CONSTANTS[5]*STATES[1]*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[6] = CONSTANTS[10]*STATES[2]*(STATES[0] - CONSTANTS[9]); }