Generated Code
The following is c_ida 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[16] is v_funny_K in component funny (fmol_per_sec). * ALGEBRAIC[17] 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[11] is Am_Na in component funny (J_per_mol). * ALGEBRAIC[10] is Am_K in component funny (J_per_mol). * ALGEBRAIC[12] is Af_K in component funny (J_per_mol). * ALGEBRAIC[13] is Ar_K in component funny (J_per_mol). * ALGEBRAIC[14] is Af_Na in component funny (J_per_mol). * ALGEBRAIC[15] is Ar_Na in component funny (J_per_mol). * ALGEBRAIC[5] is mu_x0_funny in component funny (J_per_mol). * ALGEBRAIC[6] is mu_x1_funny in component funny (J_per_mol). * ALGEBRAIC[7] is Af_R_xf in component funny (J_per_mol). * ALGEBRAIC[8] is Ar_R_xf in component funny (J_per_mol). * ALGEBRAIC[9] 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). * There are a total of 0 condition variables. */ 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; RATES[1] = 0.1001; RATES[0] = 0.1001; RATES[3] = 0.1001; RATES[2] = 0.1001; RATES[6] = 0.1001; RATES[4] = 0.1001; RATES[5] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[1] - - ALGEBRAIC[16]; resid[1] = RATES[0] - ALGEBRAIC[16]; resid[2] = RATES[3] - - ALGEBRAIC[17]; resid[3] = RATES[2] - ALGEBRAIC[17]; resid[4] = RATES[6] - ALGEBRAIC[18]; resid[5] = RATES[4] - - ALGEBRAIC[9]; resid[6] = RATES[5] - ALGEBRAIC[9]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[4] = STATES[6]/CONSTANTS[0]; ALGEBRAIC[5] = CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[11]*STATES[4]); ALGEBRAIC[7] = ALGEBRAIC[5]+ CONSTANTS[15]*CONSTANTS[3]*ALGEBRAIC[4]; ALGEBRAIC[6] = CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[12]*STATES[5]); ALGEBRAIC[8] = ALGEBRAIC[6]+ CONSTANTS[16]*CONSTANTS[3]*ALGEBRAIC[4]; ALGEBRAIC[9] = CONSTANTS[6]*(exp(ALGEBRAIC[7]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[8]/( CONSTANTS[1]*CONSTANTS[2]))); ALGEBRAIC[10] = CONSTANTS[14]*CONSTANTS[3]*ALGEBRAIC[4]; ALGEBRAIC[0] = CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[9]*STATES[1]); ALGEBRAIC[12] = ALGEBRAIC[6]+ALGEBRAIC[0]+ALGEBRAIC[10]; ALGEBRAIC[1] = CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[10]*STATES[0]); ALGEBRAIC[13] = ALGEBRAIC[6]+ALGEBRAIC[1]; ALGEBRAIC[16] = (ALGEBRAIC[10]==0.00000 ? 1.00000*CONSTANTS[5]*(exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[13]/( CONSTANTS[1]*CONSTANTS[2]))) : ((( 1.00000*CONSTANTS[5]*ALGEBRAIC[10])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[13]/( CONSTANTS[1]*CONSTANTS[2])))); ALGEBRAIC[11] = CONSTANTS[13]*CONSTANTS[3]*ALGEBRAIC[4]; ALGEBRAIC[2] = CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[7]*STATES[3]); ALGEBRAIC[14] = ALGEBRAIC[6]+ALGEBRAIC[2]+ALGEBRAIC[11]; ALGEBRAIC[3] = CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[8]*STATES[2]); ALGEBRAIC[15] = ALGEBRAIC[6]+ALGEBRAIC[3]; ALGEBRAIC[17] = (ALGEBRAIC[11]==0.00000 ? 1.00000*CONSTANTS[4]*(exp(ALGEBRAIC[14]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[15]/( CONSTANTS[1]*CONSTANTS[2]))) : ((( 1.00000*CONSTANTS[4]*ALGEBRAIC[11])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[11]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[14]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[15]/( CONSTANTS[1]*CONSTANTS[2])))); ALGEBRAIC[18] = CONSTANTS[3]*(( - CONSTANTS[14]*ALGEBRAIC[16]+ CONSTANTS[13]*ALGEBRAIC[17]+ CONSTANTS[16]*ALGEBRAIC[9]) - CONSTANTS[15]*ALGEBRAIC[9]); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; SI[5] = 1.0; SI[6] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }