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 22 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 26 entries in the constant variable array.
 */
/*
 * VOI is t in component GLUT2_BG (second).
 * CONSTANTS[0] is R in component params_BG (J_per_K_mol).
 * CONSTANTS[1] is T in component params_BG (kelvin).
 * CONSTANTS[2] is K_Ai in component params_BG (per_fmol).
 * CONSTANTS[23] is q_init_Ai in component params_BG (fmol).
 * CONSTANTS[3] is K_Ao in component params_BG (per_fmol).
 * CONSTANTS[20] is q_init_Ao in component params_BG (fmol).
 * CONSTANTS[4] is K_1 in component params_BG (per_fmol).
 * CONSTANTS[5] is q_init_1 in component params_BG (fmol).
 * CONSTANTS[6] is K_2 in component params_BG (per_fmol).
 * CONSTANTS[7] is q_init_2 in component params_BG (fmol).
 * CONSTANTS[8] is K_3 in component params_BG (per_fmol).
 * CONSTANTS[9] is q_init_3 in component params_BG (fmol).
 * CONSTANTS[10] is K_4 in component params_BG (per_fmol).
 * CONSTANTS[11] is q_init_4 in component params_BG (fmol).
 * CONSTANTS[12] is kappa_r1 in component params_BG (fmol_per_s).
 * CONSTANTS[13] is kappa_r2 in component params_BG (fmol_per_s).
 * CONSTANTS[14] is kappa_r3 in component params_BG (fmol_per_s).
 * CONSTANTS[15] is kappa_r4 in component params_BG (fmol_per_s).
 * CONSTANTS[25] is mu_Ai in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[16] is v_Ai in component GLUT2_BG (fmol_per_s).
 * CONSTANTS[22] is mu_Ao in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[17] is v_Ao in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[0] is mu_1 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[18] is v_1 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[1] is mu_2 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[19] is v_2 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[2] is mu_3 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[20] is v_3 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[3] is mu_4 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[21] is v_4 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[4] is A_f_r1 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[12] is v_r1 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[5] is A_r_r1 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[6] is A_f_r2 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[13] is v_r2 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[7] is A_r_r2 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[8] is A_f_r3 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[14] is v_r3 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[9] is A_r_r3 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[10] is A_f_r4 in component GLUT2_BG (J_per_mol).
 * ALGEBRAIC[15] is v_r4 in component GLUT2_BG (fmol_per_s).
 * ALGEBRAIC[11] is A_r_r4 in component GLUT2_BG (J_per_mol).
 * CONSTANTS[24] is q_Ai in component GLUT2_BG (fmol).
 * CONSTANTS[21] is q_Ao in component GLUT2_BG (fmol).
 * STATES[0] is q_1 in component GLUT2_BG (fmol).
 * STATES[1] is q_2 in component GLUT2_BG (fmol).
 * STATES[2] is q_3 in component GLUT2_BG (fmol).
 * STATES[3] is q_4 in component GLUT2_BG (fmol).
 * CONSTANTS[16] is V_i in component params_BG (pL).
 * CONSTANTS[17] is g_i in component params_BG (mM).
 * CONSTANTS[18] is g_o in component params_BG (mM).
 * CONSTANTS[19] is V_o in component params_BG (pL).
 * RATES[0] is d/dt q_1 in component GLUT2_BG (fmol).
 * RATES[1] is d/dt q_2 in component GLUT2_BG (fmol).
 * RATES[2] is d/dt q_3 in component GLUT2_BG (fmol).
 * RATES[3] is d/dt q_4 in component GLUT2_BG (fmol).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 8.31;
CONSTANTS[1] = 273.15;
CONSTANTS[2] = 149.65;
CONSTANTS[3] = 149.65;
CONSTANTS[4] = 33.20;
CONSTANTS[5] = 0.0017;
CONSTANTS[6] = 4.25e+03;
CONSTANTS[7] = 0.0017;
CONSTANTS[8] = 344.59;
CONSTANTS[9] = 0.0017;
CONSTANTS[10] = 1.99;
CONSTANTS[11] = 0.0017;
CONSTANTS[12] = 0.36;
CONSTANTS[13] = 0.26;
CONSTANTS[14] = 1.01e+05;
CONSTANTS[15] = 1.01e+04;
CONSTANTS[16] = 0.09;
CONSTANTS[17] = 10;
CONSTANTS[18] = 1e-5;
CONSTANTS[19] = 0.09;
CONSTANTS[20] =  CONSTANTS[18]*CONSTANTS[19];
CONSTANTS[21] = CONSTANTS[20];
CONSTANTS[22] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[3]*CONSTANTS[21]);
CONSTANTS[23] =  CONSTANTS[17]*CONSTANTS[16];
CONSTANTS[24] = CONSTANTS[23];
CONSTANTS[25] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[2]*CONSTANTS[24]);
STATES[0] = CONSTANTS[5];
STATES[1] = CONSTANTS[7];
STATES[2] = CONSTANTS[9];
STATES[3] = CONSTANTS[11];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ALGEBRAIC[18];
resid[1] = RATES[1] - ALGEBRAIC[19];
resid[2] = RATES[2] - ALGEBRAIC[20];
resid[3] = RATES[3] - ALGEBRAIC[21];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[16] = ALGEBRAIC[15];
ALGEBRAIC[17] = - ALGEBRAIC[14];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[10]*STATES[3]);
ALGEBRAIC[4] = ALGEBRAIC[3];
ALGEBRAIC[0] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[4]*STATES[0]);
ALGEBRAIC[5] = ALGEBRAIC[0];
ALGEBRAIC[12] =  CONSTANTS[12]*(exp(ALGEBRAIC[4]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[5]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[8] = CONSTANTS[22]+ALGEBRAIC[0];
ALGEBRAIC[1] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[6]*STATES[1]);
ALGEBRAIC[9] = ALGEBRAIC[1];
ALGEBRAIC[14] =  CONSTANTS[14]*(exp(ALGEBRAIC[8]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[9]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[18] = ALGEBRAIC[12] - ALGEBRAIC[14];
ALGEBRAIC[6] = ALGEBRAIC[1];
ALGEBRAIC[2] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[8]*STATES[2]);
ALGEBRAIC[7] = ALGEBRAIC[2];
ALGEBRAIC[13] =  CONSTANTS[13]*(exp(ALGEBRAIC[6]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[7]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[19] = ALGEBRAIC[14] - ALGEBRAIC[13];
ALGEBRAIC[10] = ALGEBRAIC[2];
ALGEBRAIC[11] = CONSTANTS[25]+ALGEBRAIC[3];
ALGEBRAIC[15] =  CONSTANTS[15]*(exp(ALGEBRAIC[10]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[11]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[20] = ALGEBRAIC[13] - ALGEBRAIC[15];
ALGEBRAIC[21] = ALGEBRAIC[15] - ALGEBRAIC[12];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}