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 20 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 51 entries in the constant variable array.
 */
/*
 * VOI is t in component BG_HKE (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_Ki in component params_BG (per_fmol).
 * CONSTANTS[3] is K_Ko in component params_BG (per_fmol).
 * CONSTANTS[4] is K_Pi in component params_BG (per_fmol).
 * CONSTANTS[5] is K_ATPi in component params_BG (per_fmol).
 * CONSTANTS[6] is K_Hi in component params_BG (per_fmol).
 * CONSTANTS[7] is K_Ho in component params_BG (per_fmol).
 * CONSTANTS[8] is K_ADPi in component params_BG (per_fmol).
 * CONSTANTS[33] is q_init_Ki in component params_BG (fmol).
 * CONSTANTS[30] is q_init_Ko in component params_BG (fmol).
 * CONSTANTS[36] is q_init_Pi in component params_BG (fmol).
 * CONSTANTS[39] is q_init_ATPi in component params_BG (fmol).
 * CONSTANTS[42] is q_init_Hi in component params_BG (fmol).
 * CONSTANTS[45] is q_init_Ho in component params_BG (fmol).
 * CONSTANTS[48] is q_init_ADPi in component params_BG (fmol).
 * CONSTANTS[9] is K_1 in component params_BG (per_fmol).
 * CONSTANTS[10] is q_init_1 in component params_BG (fmol).
 * CONSTANTS[11] is K_2 in component params_BG (per_fmol).
 * CONSTANTS[12] is q_init_2 in component params_BG (fmol).
 * CONSTANTS[13] is K_3 in component params_BG (per_fmol).
 * CONSTANTS[14] is q_init_3 in component params_BG (fmol).
 * CONSTANTS[15] is K_4 in component params_BG (per_fmol).
 * CONSTANTS[16] is q_init_4 in component params_BG (fmol).
 * CONSTANTS[17] is kappa_r1 in component params_BG (fmol_per_s).
 * CONSTANTS[18] is kappa_r2 in component params_BG (fmol_per_s).
 * CONSTANTS[19] is kappa_r3 in component params_BG (fmol_per_s).
 * CONSTANTS[20] is kappa_r4 in component params_BG (fmol_per_s).
 * CONSTANTS[35] is mu_Ki in component BG_HKE (J_per_mol).
 * CONSTANTS[32] is mu_Ko in component BG_HKE (J_per_mol).
 * CONSTANTS[38] is mu_Pi in component BG_HKE (J_per_mol).
 * CONSTANTS[41] is mu_ATPi in component BG_HKE (J_per_mol).
 * CONSTANTS[44] is mu_Hi in component BG_HKE (J_per_mol).
 * CONSTANTS[47] is mu_Ho in component BG_HKE (J_per_mol).
 * CONSTANTS[50] is mu_ADPi in component BG_HKE (J_per_mol).
 * ALGEBRAIC[0] is mu_1 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[16] is v_1 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[1] is mu_2 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[17] is v_2 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[2] is mu_3 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[18] is v_3 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[3] is mu_4 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[19] is v_4 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[4] is A_f_r1 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[12] is v_r1 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[5] is A_r_r1 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[6] is A_f_r2 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[13] is v_r2 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[7] is A_r_r2 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[8] is A_f_r3 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[14] is v_r3 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[9] is A_r_r3 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[10] is A_f_r4 in component BG_HKE (J_per_mol).
 * ALGEBRAIC[15] is v_r4 in component BG_HKE (fmol_per_s).
 * ALGEBRAIC[11] is A_r_r4 in component BG_HKE (J_per_mol).
 * CONSTANTS[34] is q_Ki in component BG_HKE (fmol).
 * CONSTANTS[31] is q_Ko in component BG_HKE (fmol).
 * CONSTANTS[40] is q_ATPi in component BG_HKE (fmol).
 * CONSTANTS[37] is q_Pi in component BG_HKE (fmol).
 * CONSTANTS[43] is q_Hi in component BG_HKE (fmol).
 * CONSTANTS[46] is q_Ho in component BG_HKE (fmol).
 * CONSTANTS[49] is q_ADPi in component BG_HKE (fmol).
 * STATES[0] is q_1 in component BG_HKE (fmol).
 * STATES[1] is q_2 in component BG_HKE (fmol).
 * STATES[2] is q_3 in component BG_HKE (fmol).
 * STATES[3] is q_4 in component BG_HKE (fmol).
 * CONSTANTS[21] is V_i in component params_BG (pL).
 * CONSTANTS[22] is K_i in component params_BG (mM).
 * CONSTANTS[23] is K_o in component params_BG (mM).
 * CONSTANTS[24] is ATPi in component params_BG (mM).
 * CONSTANTS[25] is Hi in component params_BG (mM).
 * CONSTANTS[26] is Ho in component params_BG (mM).
 * CONSTANTS[27] is ADPi in component params_BG (mM).
 * CONSTANTS[28] is Pi in component params_BG (mM).
 * CONSTANTS[29] is V_o in component params_BG (pL).
 * RATES[0] is d/dt q_1 in component BG_HKE (fmol).
 * RATES[1] is d/dt q_2 in component BG_HKE (fmol).
 * RATES[2] is d/dt q_3 in component BG_HKE (fmol).
 * RATES[3] is d/dt q_4 in component BG_HKE (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] = 149.65;
CONSTANTS[5] = 149.65;
CONSTANTS[6] = 149.65;
CONSTANTS[7] = 149.65;
CONSTANTS[8] = 149.65;
CONSTANTS[9] = 33.20;
CONSTANTS[10] = 0.0017;
CONSTANTS[11] = 4.25e+03;
CONSTANTS[12] = 0.0017;
CONSTANTS[13] = 344.59;
CONSTANTS[14] = 0.0017;
CONSTANTS[15] = 1.99;
CONSTANTS[16] = 0.0017;
CONSTANTS[17] = 0.36;
CONSTANTS[18] = 0.26;
CONSTANTS[19] = 1.01e+05;
CONSTANTS[20] = 1.01e+04;
CONSTANTS[21] = 0.09;
CONSTANTS[22] = 10;
CONSTANTS[23] = 1e-5;
CONSTANTS[24] = 1e-5;
CONSTANTS[25] = 1e-5;
CONSTANTS[26] = 1e-5;
CONSTANTS[27] = 1e-5;
CONSTANTS[28] = 1e-5;
CONSTANTS[29] = 0.09;
CONSTANTS[30] =  CONSTANTS[23]*CONSTANTS[29];
CONSTANTS[31] = CONSTANTS[30];
CONSTANTS[32] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[3]*CONSTANTS[31]);
CONSTANTS[33] =  CONSTANTS[22]*CONSTANTS[21];
CONSTANTS[34] = CONSTANTS[33];
CONSTANTS[35] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[2]*CONSTANTS[34]);
CONSTANTS[36] =  CONSTANTS[28]*CONSTANTS[21];
CONSTANTS[37] = CONSTANTS[36];
CONSTANTS[38] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[4]*CONSTANTS[37]);
CONSTANTS[39] =  CONSTANTS[24]*CONSTANTS[21];
CONSTANTS[40] = CONSTANTS[39];
CONSTANTS[41] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[5]*CONSTANTS[40]);
CONSTANTS[42] =  CONSTANTS[25]*CONSTANTS[21];
CONSTANTS[43] = CONSTANTS[42];
CONSTANTS[44] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[6]*CONSTANTS[43]);
CONSTANTS[45] =  CONSTANTS[26]*CONSTANTS[21];
CONSTANTS[46] = CONSTANTS[45];
CONSTANTS[47] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[7]*CONSTANTS[46]);
CONSTANTS[48] =  CONSTANTS[27]*CONSTANTS[21];
CONSTANTS[49] = CONSTANTS[48];
CONSTANTS[50] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[8]*CONSTANTS[49]);
STATES[0] = CONSTANTS[10];
STATES[1] = CONSTANTS[12];
STATES[2] = CONSTANTS[14];
STATES[3] = CONSTANTS[16];
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[16];
resid[1] = RATES[1] - ALGEBRAIC[17];
resid[2] = RATES[2] - ALGEBRAIC[18];
resid[3] = RATES[3] - ALGEBRAIC[19];
}
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] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[9]*STATES[0]);
ALGEBRAIC[4] = ALGEBRAIC[0]+CONSTANTS[32];
ALGEBRAIC[1] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[11]*STATES[1]);
ALGEBRAIC[5] = ALGEBRAIC[1]+CONSTANTS[38];
ALGEBRAIC[12] =  CONSTANTS[17]*(exp(ALGEBRAIC[4]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[5]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[3] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[15]*STATES[3]);
ALGEBRAIC[10] = ALGEBRAIC[3];
ALGEBRAIC[11] = ALGEBRAIC[0]+CONSTANTS[47];
ALGEBRAIC[15] =  CONSTANTS[20]*(exp(ALGEBRAIC[10]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[11]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[16] = ALGEBRAIC[15] - ALGEBRAIC[12];
ALGEBRAIC[6] = ALGEBRAIC[1]+CONSTANTS[41];
ALGEBRAIC[2] =  CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[13]*STATES[2]);
ALGEBRAIC[7] = ALGEBRAIC[2]+CONSTANTS[35];
ALGEBRAIC[13] =  CONSTANTS[18]*(exp(ALGEBRAIC[6]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[7]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[17] = ALGEBRAIC[12] - ALGEBRAIC[13];
ALGEBRAIC[8] = ALGEBRAIC[2]+CONSTANTS[44];
ALGEBRAIC[9] = ALGEBRAIC[3]+CONSTANTS[50];
ALGEBRAIC[14] =  CONSTANTS[19]*(exp(ALGEBRAIC[8]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[9]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[18] = ALGEBRAIC[13] - ALGEBRAIC[14];
ALGEBRAIC[19] = ALGEBRAIC[14] - ALGEBRAIC[15];
}
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)
{
}
Source
Derived from workspace HKE - The Physics of Physiology at changeset 2f86140bdd58.
Collaboration
To begin collaborating on this work, please use your git client and issue this command:
License
The terms of use/license for this work is unspecified.