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 10 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 13 entries in the constant variable array. */ /* * VOI is time in component environment (second). * STATES[0] is q_L in component environment (fmol). * STATES[1] is q_K1 in component environment (fmol). * STATES[2] is q_K2 in component environment (fmol). * STATES[3] is q_LK1 in component environment (fmol). * STATES[4] is q_K2P in component environment (fmol). * STATES[5] is q_P in component environment (fmol). * STATES[6] is q_LK1K2 in component environment (fmol). * ALGEBRAIC[7] is v_Re1 in component RTK (fmol_per_sec). * ALGEBRAIC[8] is v_Re2 in component RTK (fmol_per_sec). * ALGEBRAIC[9] is v_Re3 in component RTK (fmol_per_sec). * CONSTANTS[0] is kappa_Re1 in component RTK_parameters (fmol_per_sec). * CONSTANTS[1] is kappa_Re2 in component RTK_parameters (fmol_per_sec). * CONSTANTS[2] is kappa_Re3 in component RTK_parameters (fmol_per_sec). * CONSTANTS[3] is K_L in component RTK_parameters (per_fmol). * CONSTANTS[4] is K_K1 in component RTK_parameters (per_fmol). * CONSTANTS[5] is K_K2 in component RTK_parameters (per_fmol). * CONSTANTS[6] is K_LK1 in component RTK_parameters (per_fmol). * CONSTANTS[7] is K_K2P in component RTK_parameters (per_fmol). * CONSTANTS[8] is K_P in component RTK_parameters (per_fmol). * CONSTANTS[9] is K_LK1K2 in component RTK_parameters (per_fmol). * CONSTANTS[10] is R in component constants (J_per_K_per_mol). * CONSTANTS[11] is T in component constants (kelvin). * ALGEBRAIC[0] is mu_L in component RTK (J_per_mol). * ALGEBRAIC[1] is mu_K1 in component RTK (J_per_mol). * ALGEBRAIC[2] is mu_K2 in component RTK (J_per_mol). * ALGEBRAIC[3] is mu_LK1 in component RTK (J_per_mol). * ALGEBRAIC[4] is mu_K2P in component RTK (J_per_mol). * ALGEBRAIC[5] is mu_P in component RTK (J_per_mol). * ALGEBRAIC[6] is mu_LK1K2 in component RTK (J_per_mol). * CONSTANTS[12] is F in component constants (C_per_mol). * RATES[0] is d/dt q_L in component environment (fmol). * RATES[1] is d/dt q_K1 in component environment (fmol). * RATES[2] is d/dt q_K2 in component environment (fmol). * RATES[3] is d/dt q_LK1 in component environment (fmol). * RATES[4] is d/dt q_K2P in component environment (fmol). * RATES[5] is d/dt q_P in component environment (fmol). * RATES[6] is d/dt q_LK1K2 in component environment (fmol). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1; STATES[1] = 1e-3; STATES[2] = 1e-3; STATES[3] = 1e-6; STATES[4] = 1e-9; STATES[5] = 1; STATES[6] = 1e-9; CONSTANTS[0] = 0.000186898; CONSTANTS[1] = 0.0125535; CONSTANTS[2] = 132.879; CONSTANTS[3] = 197.162; CONSTANTS[4] = 197.162; CONSTANTS[5] = 4.01297e+09; CONSTANTS[6] = 0.00144219; CONSTANTS[7] = 3.79118e-07; CONSTANTS[8] = 2.54645e+07; CONSTANTS[9] = 2.14714e-05; CONSTANTS[10] = 8.31; CONSTANTS[11] = 310; CONSTANTS[12] = 96485; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[3]*STATES[0]); ALGEBRAIC[1] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[4]*STATES[1]); ALGEBRAIC[3] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[6]*STATES[3]); ALGEBRAIC[7] = CONSTANTS[0]*(exp((ALGEBRAIC[0]+ALGEBRAIC[1])/( CONSTANTS[10]*CONSTANTS[11])) - exp(ALGEBRAIC[3]/( CONSTANTS[10]*CONSTANTS[11]))); RATES[0] = - ALGEBRAIC[7]; RATES[1] = - ALGEBRAIC[7]; ALGEBRAIC[2] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[5]*STATES[2]); ALGEBRAIC[6] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[9]*STATES[6]); ALGEBRAIC[8] = CONSTANTS[1]*(exp((ALGEBRAIC[3]+ALGEBRAIC[2])/( CONSTANTS[10]*CONSTANTS[11])) - exp(ALGEBRAIC[6]/( CONSTANTS[10]*CONSTANTS[11]))); RATES[2] = - ALGEBRAIC[8]; ALGEBRAIC[4] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[7]*STATES[4]); ALGEBRAIC[5] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[8]*STATES[5]); ALGEBRAIC[9] = CONSTANTS[2]*(exp((ALGEBRAIC[5]+ALGEBRAIC[6])/( CONSTANTS[10]*CONSTANTS[11])) - exp((ALGEBRAIC[3]+ALGEBRAIC[4])/( CONSTANTS[10]*CONSTANTS[11]))); RATES[3] = (ALGEBRAIC[7] - ALGEBRAIC[8])+ALGEBRAIC[9]; RATES[4] = ALGEBRAIC[9]; RATES[5] = - ALGEBRAIC[9]; RATES[6] = ALGEBRAIC[8] - ALGEBRAIC[9]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[3]*STATES[0]); ALGEBRAIC[1] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[4]*STATES[1]); ALGEBRAIC[3] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[6]*STATES[3]); ALGEBRAIC[7] = CONSTANTS[0]*(exp((ALGEBRAIC[0]+ALGEBRAIC[1])/( CONSTANTS[10]*CONSTANTS[11])) - exp(ALGEBRAIC[3]/( CONSTANTS[10]*CONSTANTS[11]))); ALGEBRAIC[2] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[5]*STATES[2]); ALGEBRAIC[6] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[9]*STATES[6]); ALGEBRAIC[8] = CONSTANTS[1]*(exp((ALGEBRAIC[3]+ALGEBRAIC[2])/( CONSTANTS[10]*CONSTANTS[11])) - exp(ALGEBRAIC[6]/( CONSTANTS[10]*CONSTANTS[11]))); ALGEBRAIC[4] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[7]*STATES[4]); ALGEBRAIC[5] = CONSTANTS[10]*CONSTANTS[11]*log( CONSTANTS[8]*STATES[5]); ALGEBRAIC[9] = CONSTANTS[2]*(exp((ALGEBRAIC[5]+ALGEBRAIC[6])/( CONSTANTS[10]*CONSTANTS[11])) - exp((ALGEBRAIC[3]+ALGEBRAIC[4])/( CONSTANTS[10]*CONSTANTS[11]))); }