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 16 entries in the algebraic variable array.
   There are a total of 4 entries in each of the rate and state variable arrays.
   There are a total of 32 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (ms).
 * CONSTANTS[0] is epi in component environment (dimensionless).
 * CONSTANTS[1] is endo in component environment (dimensionless).
 * CONSTANTS[2] is mcell in component environment (dimensionless).
 * STATES[0] is u in component membrane (dimensionless).
 * ALGEBRAIC[0] is Vm in component membrane (mV).
 * CONSTANTS[3] is V_0 in component membrane (mV).
 * CONSTANTS[4] is V_fi in component membrane (mV).
 * ALGEBRAIC[8] is J_fi in component fast_inward_current (per_ms).
 * ALGEBRAIC[14] is J_so in component slow_outward_current (per_ms).
 * ALGEBRAIC[15] is J_si in component slow_inward_current (per_ms).
 * ALGEBRAIC[1] is J_stim in component membrane (per_ms).
 * ALGEBRAIC[2] is m in component m (dimensionless).
 * CONSTANTS[5] is u_m in component m (dimensionless).
 * ALGEBRAIC[4] is p in component p (dimensionless).
 * CONSTANTS[6] is u_p in component p (dimensionless).
 * ALGEBRAIC[3] is q in component q (dimensionless).
 * CONSTANTS[13] is u_q in component q (dimensionless).
 * ALGEBRAIC[5] is r in component r (dimensionless).
 * CONSTANTS[15] is u_r in component r (dimensionless).
 * CONSTANTS[16] is tau_fi in component fast_inward_current (ms).
 * CONSTANTS[17] is u_u in component fast_inward_current (dimensionless).
 * STATES[1] is v in component fast_inward_current_v_gate (dimensionless).
 * ALGEBRAIC[6] is v_inf in component fast_inward_current_v_gate (dimensionless).
 * ALGEBRAIC[9] is tau_v_minus in component fast_inward_current_v_gate (ms).
 * CONSTANTS[30] is tau_v1_minus in component fast_inward_current_v_gate (ms).
 * CONSTANTS[12] is tau_v2_minus in component fast_inward_current_v_gate (ms).
 * CONSTANTS[7] is tau_v_plus in component fast_inward_current_v_gate (ms).
 * ALGEBRAIC[11] is tau_o in component slow_outward_current (ms).
 * CONSTANTS[14] is tau_o1 in component slow_outward_current (ms).
 * CONSTANTS[31] is tau_o2 in component slow_outward_current (ms).
 * ALGEBRAIC[13] is tau_so in component slow_outward_current (ms).
 * CONSTANTS[18] is tau_so1 in component slow_outward_current (ms).
 * CONSTANTS[19] is tau_so2 in component slow_outward_current (ms).
 * CONSTANTS[20] is k_so in component slow_outward_current (dimensionless).
 * CONSTANTS[21] is u_so in component slow_outward_current (dimensionless).
 * CONSTANTS[22] is tau_si in component slow_inward_current (ms).
 * STATES[2] is w in component slow_inward_current_w_gate (dimensionless).
 * STATES[3] is s in component slow_inward_current_s_gate (dimensionless).
 * ALGEBRAIC[10] is w_inf in component slow_inward_current_w_gate (dimensionless).
 * CONSTANTS[23] is tau_winf in component slow_inward_current_w_gate (ms).
 * CONSTANTS[24] is wstar_inf in component slow_inward_current_w_gate (dimensionless).
 * ALGEBRAIC[12] is tau_w_minus in component slow_inward_current_w_gate (ms).
 * CONSTANTS[25] is tau_w1_minus in component slow_inward_current_w_gate (ms).
 * CONSTANTS[26] is tau_w2_minus in component slow_inward_current_w_gate (ms).
 * CONSTANTS[27] is k_w_minus in component slow_inward_current_w_gate (dimensionless).
 * CONSTANTS[28] is u_w_minus in component slow_inward_current_w_gate (dimensionless).
 * CONSTANTS[29] is tau_w_plus in component slow_inward_current_w_gate (ms).
 * ALGEBRAIC[7] is tau_s in component slow_inward_current_s_gate (ms).
 * CONSTANTS[8] is tau_s1 in component slow_inward_current_s_gate (ms).
 * CONSTANTS[11] is tau_s2 in component slow_inward_current_s_gate (ms).
 * CONSTANTS[9] is k_s in component slow_inward_current_s_gate (dimensionless).
 * CONSTANTS[10] is u_s in component slow_inward_current_s_gate (dimensionless).
 * RATES[0] is d/dt u in component membrane (dimensionless).
 * RATES[1] is d/dt v in component fast_inward_current_v_gate (dimensionless).
 * RATES[2] is d/dt w in component slow_inward_current_w_gate (dimensionless).
 * RATES[3] is d/dt s in component slow_inward_current_s_gate (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1;
CONSTANTS[1] = 0;
CONSTANTS[2] = 0;
STATES[0] = 0;
CONSTANTS[3] = -83;
CONSTANTS[4] = 2.7;
CONSTANTS[5] = 0.3;
CONSTANTS[6] = 0.13;
STATES[1] = 1;
CONSTANTS[7] = 1.45;
STATES[2] = 1;
STATES[3] = 0;
CONSTANTS[8] = 2.7342;
CONSTANTS[9] = 2.0994;
CONSTANTS[10] = 0.9087;
CONSTANTS[11] = (CONSTANTS[0]==1.00000 ? 16.0000 : CONSTANTS[1]==1.00000 ? 2.00000 : 4.00000);
CONSTANTS[12] = (CONSTANTS[0]==1.00000 ? 1150.00 : CONSTANTS[1]==1.00000 ? 10.0000 : 1.45000);
CONSTANTS[13] = (CONSTANTS[0]==1.00000 ? 0.00600000 : CONSTANTS[1]==1.00000 ? 0.0240000 : 0.100000);
CONSTANTS[14] = (CONSTANTS[0]==1.00000 ? 400.000 : CONSTANTS[1]==1.00000 ? 470.000 : 410.000);
CONSTANTS[15] = (CONSTANTS[0]==1.00000 ? 0.00600000 : CONSTANTS[1]==1.00000 ? 0.00600000 : 0.00500000);
CONSTANTS[16] = (CONSTANTS[0]==1.00000 ? 0.110000 : CONSTANTS[1]==1.00000 ? 0.104000 : 0.0780000);
CONSTANTS[17] = (CONSTANTS[0]==1.00000 ? 1.55000 : CONSTANTS[1]==1.00000 ? 1.56000 : 1.61000);
CONSTANTS[18] = (CONSTANTS[0]==1.00000 ? 30.0200 : CONSTANTS[1]==1.00000 ? 40.0000 : 91.0000);
CONSTANTS[19] = (CONSTANTS[0]==1.00000 ? 0.996000 : CONSTANTS[1]==1.00000 ? 1.20000 : 0.800000);
CONSTANTS[20] = (CONSTANTS[0]==1.00000 ? 2.04600 : CONSTANTS[1]==1.00000 ? 2.00000 : 2.10000);
CONSTANTS[21] = (CONSTANTS[0]==1.00000 ? 0.650000 : CONSTANTS[1]==1.00000 ? 0.650000 : 0.600000);
CONSTANTS[22] = (CONSTANTS[0]==1.00000 ? 1.88750 : CONSTANTS[1]==1.00000 ? 2.90130 : 3.38490);
CONSTANTS[23] = (CONSTANTS[0]==1.00000 ? 0.0700000 : CONSTANTS[1]==1.00000 ? 0.0273000 : 0.0100000);
CONSTANTS[24] = (CONSTANTS[0]==1.00000 ? 0.940000 : CONSTANTS[1]==1.00000 ? 0.780000 : 0.500000);
CONSTANTS[25] = (CONSTANTS[0]==1.00000 ? 60.0000 : CONSTANTS[1]==1.00000 ? 6.00000 : 70.0000);
CONSTANTS[26] = (CONSTANTS[0]==1.00000 ? 15.0000 : CONSTANTS[1]==1.00000 ? 140.000 : 8.00000);
CONSTANTS[27] = (CONSTANTS[0]==1.00000 ? 65.0000 : CONSTANTS[1]==1.00000 ? 200.000 : 200.000);
CONSTANTS[28] = (CONSTANTS[0]==1.00000 ? 0.0300000 : CONSTANTS[1]==1.00000 ? 0.0160000 : 0.0160000);
CONSTANTS[29] = (CONSTANTS[0]==1.00000 ? 200.000 : CONSTANTS[1]==1.00000 ? 280.000 : 280.000);
CONSTANTS[30] = (CONSTANTS[0]==1.00000 ? 60.0000 : CONSTANTS[1]==1.00000 ? 75.0000 : 80.0000);
CONSTANTS[31] = (CONSTANTS[0]==1.00000 ? 6.00000 : CONSTANTS[1]==1.00000 ? 6.00000 : 7.00000);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = (STATES[0]<CONSTANTS[6] ? 0.00000 : 1.00000);
ALGEBRAIC[7] =  (1.00000 - ALGEBRAIC[4])*CONSTANTS[8]+ ALGEBRAIC[4]*CONSTANTS[11];
RATES[3] = ((1.00000+ tanh( CONSTANTS[9]*(STATES[0] - CONSTANTS[10])))/2.00000 - STATES[3])/ALGEBRAIC[7];
ALGEBRAIC[2] = (STATES[0]<CONSTANTS[5] ? 0.00000 : 1.00000);
ALGEBRAIC[6] = (STATES[0]<CONSTANTS[13] ? 1.00000 : 0.00000);
ALGEBRAIC[3] = (STATES[0]<CONSTANTS[13] ? 0.00000 : 1.00000);
ALGEBRAIC[9] =  ALGEBRAIC[3]*CONSTANTS[12]+ (1.00000 - ALGEBRAIC[3])*CONSTANTS[30];
RATES[1] = ( (1.00000 - ALGEBRAIC[2])*(ALGEBRAIC[6] - STATES[1]))/ALGEBRAIC[9] - ( ALGEBRAIC[2]*STATES[1])/CONSTANTS[7];
ALGEBRAIC[5] = (STATES[0]<CONSTANTS[15] ? 0.00000 : 1.00000);
ALGEBRAIC[10] =  (1.00000 - ALGEBRAIC[5])*(1.00000 - ( STATES[0]*1.00000)/CONSTANTS[23])+ ALGEBRAIC[5]*CONSTANTS[24];
ALGEBRAIC[12] = CONSTANTS[25]+( (CONSTANTS[26] - CONSTANTS[25])*(1.00000+ tanh( CONSTANTS[27]*(STATES[0] - CONSTANTS[28]))))/2.00000;
RATES[2] = ( (1.00000 - ALGEBRAIC[5])*(ALGEBRAIC[10] - STATES[2]))/ALGEBRAIC[12] - ( ALGEBRAIC[5]*STATES[2])/CONSTANTS[29];
ALGEBRAIC[8] = ( - ALGEBRAIC[2]*STATES[1]*(STATES[0] - CONSTANTS[5])*(CONSTANTS[17] - STATES[0]))/CONSTANTS[16];
ALGEBRAIC[11] =  (1.00000 - ALGEBRAIC[5])*CONSTANTS[14]+ ALGEBRAIC[5]*CONSTANTS[31];
ALGEBRAIC[13] = CONSTANTS[18]+( (CONSTANTS[19] - CONSTANTS[18])*(1.00000+ tanh( CONSTANTS[20]*(STATES[0] - CONSTANTS[21]))))/2.00000;
ALGEBRAIC[14] = ( STATES[0]*(1.00000 - ALGEBRAIC[4]))/ALGEBRAIC[11]+ALGEBRAIC[4]/ALGEBRAIC[13];
ALGEBRAIC[15] = ( - ALGEBRAIC[4]*STATES[2]*STATES[3])/CONSTANTS[22];
ALGEBRAIC[1] = (VOI>=100.000&&VOI<=101.000 ? - 1.00000 : 0.00000);
RATES[0] = - (ALGEBRAIC[8]+ALGEBRAIC[14]+ALGEBRAIC[15]+ALGEBRAIC[1]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = (STATES[0]<CONSTANTS[6] ? 0.00000 : 1.00000);
ALGEBRAIC[7] =  (1.00000 - ALGEBRAIC[4])*CONSTANTS[8]+ ALGEBRAIC[4]*CONSTANTS[11];
ALGEBRAIC[2] = (STATES[0]<CONSTANTS[5] ? 0.00000 : 1.00000);
ALGEBRAIC[6] = (STATES[0]<CONSTANTS[13] ? 1.00000 : 0.00000);
ALGEBRAIC[3] = (STATES[0]<CONSTANTS[13] ? 0.00000 : 1.00000);
ALGEBRAIC[9] =  ALGEBRAIC[3]*CONSTANTS[12]+ (1.00000 - ALGEBRAIC[3])*CONSTANTS[30];
ALGEBRAIC[5] = (STATES[0]<CONSTANTS[15] ? 0.00000 : 1.00000);
ALGEBRAIC[10] =  (1.00000 - ALGEBRAIC[5])*(1.00000 - ( STATES[0]*1.00000)/CONSTANTS[23])+ ALGEBRAIC[5]*CONSTANTS[24];
ALGEBRAIC[12] = CONSTANTS[25]+( (CONSTANTS[26] - CONSTANTS[25])*(1.00000+ tanh( CONSTANTS[27]*(STATES[0] - CONSTANTS[28]))))/2.00000;
ALGEBRAIC[8] = ( - ALGEBRAIC[2]*STATES[1]*(STATES[0] - CONSTANTS[5])*(CONSTANTS[17] - STATES[0]))/CONSTANTS[16];
ALGEBRAIC[11] =  (1.00000 - ALGEBRAIC[5])*CONSTANTS[14]+ ALGEBRAIC[5]*CONSTANTS[31];
ALGEBRAIC[13] = CONSTANTS[18]+( (CONSTANTS[19] - CONSTANTS[18])*(1.00000+ tanh( CONSTANTS[20]*(STATES[0] - CONSTANTS[21]))))/2.00000;
ALGEBRAIC[14] = ( STATES[0]*(1.00000 - ALGEBRAIC[4]))/ALGEBRAIC[11]+ALGEBRAIC[4]/ALGEBRAIC[13];
ALGEBRAIC[15] = ( - ALGEBRAIC[4]*STATES[2]*STATES[3])/CONSTANTS[22];
ALGEBRAIC[1] = (VOI>=100.000&&VOI<=101.000 ? - 1.00000 : 0.00000);
ALGEBRAIC[0] = CONSTANTS[3]+ STATES[0]*(CONSTANTS[4] - CONSTANTS[3]);
}