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 19 entries in the algebraic variable array.
   There are a total of 7 entries in each of the rate and state variable arrays.
   There are a total of 17 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is C_m in component environment (fF).
 * STATES[0] is q_K_o in component environment (fmol).
 * STATES[1] is q_K_i in component environment (fmol).
 * STATES[2] is q_Na_o in component environment (fmol).
 * STATES[3] is q_Na_i in component environment (fmol).
 * STATES[4] is q_x0_funny in component environment (fmol).
 * STATES[5] is q_x1_funny in component environment (fmol).
 * STATES[6] is q_mem in component environment (fC).
 * CONSTANTS[1] is R in component environment (J_per_K_per_mol).
 * CONSTANTS[2] is T in component environment (kelvin).
 * CONSTANTS[3] is F in component environment (C_per_mol).
 * ALGEBRAIC[13] is v_funny_K in component funny (fmol_per_sec).
 * ALGEBRAIC[14] is v_funny_Na in component funny (fmol_per_sec).
 * ALGEBRAIC[18] is I_mem_funny in component funny (fA).
 * CONSTANTS[4] is kappa_funny_Na in component funny_parameters (fmol_per_sec).
 * CONSTANTS[5] is kappa_funny_K in component funny_parameters (fmol_per_sec).
 * CONSTANTS[6] is kappa_R_xf in component funny_parameters (fmol_per_sec).
 * CONSTANTS[7] is K_Na_i in component funny_parameters (per_fmol).
 * CONSTANTS[8] is K_Na_o in component funny_parameters (per_fmol).
 * CONSTANTS[9] is K_K_i in component funny_parameters (per_fmol).
 * CONSTANTS[10] is K_K_o in component funny_parameters (per_fmol).
 * CONSTANTS[11] is K_x0_funny in component funny_parameters (per_fmol).
 * CONSTANTS[12] is K_x1_funny in component funny_parameters (per_fmol).
 * CONSTANTS[13] is zNa in component funny_parameters (dimensionless).
 * CONSTANTS[14] is zK in component funny_parameters (dimensionless).
 * CONSTANTS[15] is z_xff in component funny_parameters (dimensionless).
 * CONSTANTS[16] is z_xfr in component funny_parameters (dimensionless).
 * ALGEBRAIC[0] is mu_K_i in component funny (J_per_mol).
 * ALGEBRAIC[1] is mu_K_o in component funny (J_per_mol).
 * ALGEBRAIC[2] is mu_Na_i in component funny (J_per_mol).
 * ALGEBRAIC[3] is mu_Na_o in component funny (J_per_mol).
 * ALGEBRAIC[4] is V_mem in component funny (J_per_C).
 * ALGEBRAIC[6] is Am_Na in component funny (J_per_mol).
 * ALGEBRAIC[5] is Am_K in component funny (J_per_mol).
 * ALGEBRAIC[9] is Af_K in component funny (J_per_mol).
 * ALGEBRAIC[10] is Ar_K in component funny (J_per_mol).
 * ALGEBRAIC[11] is Af_Na in component funny (J_per_mol).
 * ALGEBRAIC[12] is Ar_Na in component funny (J_per_mol).
 * ALGEBRAIC[7] is mu_x0_funny in component funny (J_per_mol).
 * ALGEBRAIC[8] is mu_x1_funny in component funny (J_per_mol).
 * ALGEBRAIC[15] is Af_R_xf in component funny (J_per_mol).
 * ALGEBRAIC[16] is Ar_R_xf in component funny (J_per_mol).
 * ALGEBRAIC[17] is v_xf in component funny (fmol_per_sec).
 * RATES[1] is d/dt q_K_i in component environment (fmol).
 * RATES[0] is d/dt q_K_o in component environment (fmol).
 * RATES[3] is d/dt q_Na_i in component environment (fmol).
 * RATES[2] is d/dt q_Na_o in component environment (fmol).
 * RATES[6] is d/dt q_mem in component environment (fC).
 * RATES[4] is d/dt q_x0_funny in component environment (fmol).
 * RATES[5] is d/dt q_x1_funny in component environment (fmol).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 153400;
STATES[0] = 27.9828;
STATES[1] = 5510;
STATES[2] = 9.3276;
STATES[3] = 0.00456;
STATES[4] = 5.4799070E-06;
STATES[5] = 5.4799070E-06;
STATES[6] = -8.5e4;
CONSTANTS[1] = 8.31;
CONSTANTS[2] = 310;
CONSTANTS[3] = 96500;
CONSTANTS[4] = 45.0247;
CONSTANTS[5] = 91.4974;
CONSTANTS[6] = 0.188833;
CONSTANTS[7] = 1.80864;
CONSTANTS[8] = 13.2633;
CONSTANTS[9] = 2.57828;
CONSTANTS[10] = 18.9074;
CONSTANTS[11] = 0.00306604;
CONSTANTS[12] = 61.5887;
CONSTANTS[13] = 1;
CONSTANTS[14] = 1;
CONSTANTS[15] = -1.8309039;
CONSTANTS[16] = 0.787348905;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = STATES[6]/CONSTANTS[0];
ALGEBRAIC[5] =  CONSTANTS[14]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[0] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[9]*STATES[1]);
ALGEBRAIC[8] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[12]*STATES[5]);
ALGEBRAIC[9] = ALGEBRAIC[8]+ALGEBRAIC[0]+ALGEBRAIC[5];
ALGEBRAIC[1] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[10]*STATES[0]);
ALGEBRAIC[10] = ALGEBRAIC[8]+ALGEBRAIC[1];
ALGEBRAIC[13] = (ALGEBRAIC[5]==0.00000 ?  1.00000*CONSTANTS[5]*(exp(ALGEBRAIC[9]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2]))) :  ((( 1.00000*CONSTANTS[5]*ALGEBRAIC[5])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[5]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[9]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2]))));
RATES[1] = - ALGEBRAIC[13];
RATES[0] = ALGEBRAIC[13];
ALGEBRAIC[6] =  CONSTANTS[13]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[2] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[7]*STATES[3]);
ALGEBRAIC[11] = ALGEBRAIC[8]+ALGEBRAIC[2]+ALGEBRAIC[6];
ALGEBRAIC[3] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[8]*STATES[2]);
ALGEBRAIC[12] = ALGEBRAIC[8]+ALGEBRAIC[3];
ALGEBRAIC[14] = (ALGEBRAIC[6]==0.00000 ?  1.00000*CONSTANTS[4]*(exp(ALGEBRAIC[11]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2]))) :  ((( 1.00000*CONSTANTS[4]*ALGEBRAIC[6])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[6]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[11]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2]))));
RATES[3] = - ALGEBRAIC[14];
RATES[2] = ALGEBRAIC[14];
ALGEBRAIC[7] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[11]*STATES[4]);
ALGEBRAIC[15] = ALGEBRAIC[7]+ CONSTANTS[15]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[16] = ALGEBRAIC[8]+ CONSTANTS[16]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[17] =  CONSTANTS[6]*(exp(ALGEBRAIC[15]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[16]/( CONSTANTS[1]*CONSTANTS[2])));
RATES[4] = - ALGEBRAIC[17];
RATES[5] = ALGEBRAIC[17];
ALGEBRAIC[18] =  CONSTANTS[3]*(( - CONSTANTS[14]*ALGEBRAIC[13]+ CONSTANTS[13]*ALGEBRAIC[14]+ CONSTANTS[16]*ALGEBRAIC[17]) -  CONSTANTS[15]*ALGEBRAIC[17]);
RATES[6] = ALGEBRAIC[18];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = STATES[6]/CONSTANTS[0];
ALGEBRAIC[5] =  CONSTANTS[14]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[0] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[9]*STATES[1]);
ALGEBRAIC[8] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[12]*STATES[5]);
ALGEBRAIC[9] = ALGEBRAIC[8]+ALGEBRAIC[0]+ALGEBRAIC[5];
ALGEBRAIC[1] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[10]*STATES[0]);
ALGEBRAIC[10] = ALGEBRAIC[8]+ALGEBRAIC[1];
ALGEBRAIC[13] = (ALGEBRAIC[5]==0.00000 ?  1.00000*CONSTANTS[5]*(exp(ALGEBRAIC[9]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2]))) :  ((( 1.00000*CONSTANTS[5]*ALGEBRAIC[5])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[5]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[9]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2]))));
ALGEBRAIC[6] =  CONSTANTS[13]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[2] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[7]*STATES[3]);
ALGEBRAIC[11] = ALGEBRAIC[8]+ALGEBRAIC[2]+ALGEBRAIC[6];
ALGEBRAIC[3] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[8]*STATES[2]);
ALGEBRAIC[12] = ALGEBRAIC[8]+ALGEBRAIC[3];
ALGEBRAIC[14] = (ALGEBRAIC[6]==0.00000 ?  1.00000*CONSTANTS[4]*(exp(ALGEBRAIC[11]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2]))) :  ((( 1.00000*CONSTANTS[4]*ALGEBRAIC[6])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[6]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[11]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2]))));
ALGEBRAIC[7] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[11]*STATES[4]);
ALGEBRAIC[15] = ALGEBRAIC[7]+ CONSTANTS[15]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[16] = ALGEBRAIC[8]+ CONSTANTS[16]*CONSTANTS[3]*ALGEBRAIC[4];
ALGEBRAIC[17] =  CONSTANTS[6]*(exp(ALGEBRAIC[15]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[16]/( CONSTANTS[1]*CONSTANTS[2])));
ALGEBRAIC[18] =  CONSTANTS[3]*(( - CONSTANTS[14]*ALGEBRAIC[13]+ CONSTANTS[13]*ALGEBRAIC[14]+ CONSTANTS[16]*ALGEBRAIC[17]) -  CONSTANTS[15]*ALGEBRAIC[17]);
}