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 8 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 13 entries in the constant variable array. */ /* * VOI is t in component environment (second). * CONSTANTS[0] is C_m in component environment (fF). * CONSTANTS[1] is w_i in component environment (pL). * CONSTANTS[2] is w_o in component environment (pL). * STATES[0] is q_mem in component environment (fC). * CONSTANTS[3] is R in component environment (J_per_K_per_mol). * CONSTANTS[4] is T in component environment (kelvin). * CONSTANTS[5] is F in component environment (C_per_mol). * ALGEBRAIC[6] is v_KACh in component KACh (fmol_per_sec). * STATES[1] is q_K_o in component environment (fmol). * STATES[2] is q_K_i in component environment (fmol). * CONSTANTS[6] is q_Gibetagamma in component environment (fmol). * ALGEBRAIC[0] is V_mem in component environment (J_per_C). * ALGEBRAIC[7] is I_mem_KACh in component KACh (fA). * CONSTANTS[7] is kappa_KACh in component KACh_parameters (fmol_per_sec). * CONSTANTS[8] is K_K_i in component KACh_parameters (per_fmol). * CONSTANTS[9] is K_K_o in component KACh_parameters (per_fmol). * CONSTANTS[10] is K_Gibetagamma in component KACh_parameters (per_fmol). * CONSTANTS[11] is zK in component KACh_parameters (dimensionless). * ALGEBRAIC[1] is mu_K_i in component KACh (J_per_mol). * ALGEBRAIC[2] is mu_K_o in component KACh (J_per_mol). * CONSTANTS[12] is mu_Gibetagamma in component KACh (J_per_mol). * ALGEBRAIC[4] is Af_KACh in component KACh (J_per_mol). * ALGEBRAIC[5] is Ar_KACh in component KACh (J_per_mol). * ALGEBRAIC[3] is Am_KACh in component KACh (J_per_mol). * RATES[2] is d/dt q_K_i in component environment (fmol). * RATES[1] is d/dt q_K_o in component environment (fmol). * RATES[0] is d/dt q_mem in component environment (fC). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 1e6; CONSTANTS[1] = 25.8; CONSTANTS[2] = 3.52; STATES[0] = -8.5e4; CONSTANTS[3] = 8.31; CONSTANTS[4] = 310; CONSTANTS[5] = 96500; STATES[1] = 9.3276; STATES[2] = 0.00456; CONSTANTS[6] = 1e-6; CONSTANTS[7] = 0.217237; CONSTANTS[8] = 0.013549; CONSTANTS[9] = 0.0899434; CONSTANTS[10] = 1e-6; CONSTANTS[11] = 1; CONSTANTS[12] = CONSTANTS[3]*CONSTANTS[4]*log( CONSTANTS[10]*CONSTANTS[6]); RATES[2] = 0.1001; RATES[1] = 0.1001; RATES[0] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[2] - - ALGEBRAIC[6]; resid[1] = RATES[1] - ALGEBRAIC[6]; resid[2] = RATES[0] - ALGEBRAIC[7]; } 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[0] = STATES[0]/CONSTANTS[0]; ALGEBRAIC[1] = CONSTANTS[3]*CONSTANTS[4]*log( CONSTANTS[8]*STATES[2]); ALGEBRAIC[4] = ALGEBRAIC[1]+ CONSTANTS[11]*CONSTANTS[5]*ALGEBRAIC[0]+CONSTANTS[12]; ALGEBRAIC[2] = CONSTANTS[3]*CONSTANTS[4]*log( CONSTANTS[9]*STATES[1]); ALGEBRAIC[5] = ALGEBRAIC[2]; ALGEBRAIC[3] = CONSTANTS[11]*CONSTANTS[5]*ALGEBRAIC[0]; ALGEBRAIC[6] = (ALGEBRAIC[3]==0.00000 ? CONSTANTS[7]*(exp(ALGEBRAIC[4]/( CONSTANTS[3]*CONSTANTS[4])) - exp(ALGEBRAIC[5]/( CONSTANTS[3]*CONSTANTS[4]))) : ((( CONSTANTS[7]*ALGEBRAIC[3])/( CONSTANTS[3]*CONSTANTS[4]))/(exp(ALGEBRAIC[3]/( CONSTANTS[3]*CONSTANTS[4])) - 1.00000))*(exp(ALGEBRAIC[4]/( CONSTANTS[3]*CONSTANTS[4])) - exp(ALGEBRAIC[5]/( CONSTANTS[3]*CONSTANTS[4])))); ALGEBRAIC[7] = - CONSTANTS[11]*CONSTANTS[5]*ALGEBRAIC[6]; } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }