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 35 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 47 entries in the constant variable array.
*/
/*
* VOI is t in component params_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 F in component params_BG (C_per_mol).
* CONSTANTS[3] is K_Nai in component params_BG (per_fmol).
* CONSTANTS[38] is q_Nai in component params_BG (fmol).
* CONSTANTS[4] is K_Nao in component params_BG (per_fmol).
* CONSTANTS[40] is q_Nao in component params_BG (fmol).
* CONSTANTS[5] is K_Hi in component params_BG (per_fmol).
* CONSTANTS[42] is q_Hi in component params_BG (fmol).
* CONSTANTS[6] is K_Ho in component params_BG (per_fmol).
* CONSTANTS[44] is q_Ho in component params_BG (fmol).
* CONSTANTS[7] is K_1 in component params_BG (per_fmol).
* CONSTANTS[8] is q_init_1 in component params_BG (fmol).
* CONSTANTS[9] is K_2 in component params_BG (per_fmol).
* CONSTANTS[10] is q_init_2 in component params_BG (fmol).
* CONSTANTS[11] is K_3 in component params_BG (per_fmol).
* CONSTANTS[12] is q_init_3 in component params_BG (fmol).
* CONSTANTS[13] is K_4 in component params_BG (per_fmol).
* CONSTANTS[14] is q_init_4 in component params_BG (fmol).
* CONSTANTS[15] is K_5 in component params_BG (per_fmol).
* CONSTANTS[16] is q_init_5 in component params_BG (fmol).
* CONSTANTS[17] is K_6 in component params_BG (per_fmol).
* CONSTANTS[18] is q_init_6 in component params_BG (fmol).
* CONSTANTS[19] is kappa_r1 in component params_BG (fmol_per_s).
* CONSTANTS[20] is kappa_r2 in component params_BG (fmol_per_s).
* CONSTANTS[21] is kappa_r3 in component params_BG (fmol_per_s).
* CONSTANTS[22] is kappa_r4 in component params_BG (fmol_per_s).
* CONSTANTS[23] is kappa_r5 in component params_BG (fmol_per_s).
* CONSTANTS[24] is kappa_r6 in component params_BG (fmol_per_s).
* CONSTANTS[25] is kappa_r7 in component params_BG (fmol_per_s).
* CONSTANTS[39] is mu_Nai in component BG_NHE1 (J_per_mol).
* CONSTANTS[41] is mu_Nao in component BG_NHE1 (J_per_mol).
* CONSTANTS[43] is mu_Hi in component BG_NHE1 (J_per_mol).
* CONSTANTS[45] is mu_Ho in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[0] is mu_1 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[27] is v_1 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[1] is mu_2 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[28] is v_2 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[2] is mu_3 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[29] is v_3 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[3] is mu_4 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[30] is v_4 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[4] is mu_5 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[31] is v_5 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[5] is mu_6 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[32] is v_6 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[34] is V_Vm in component BG_NHE1 (volt).
* ALGEBRAIC[33] is V0_Vm in component params_BG (volt).
* ALGEBRAIC[6] is A_f_r1 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[20] is v_r1 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[7] is A_r_r1 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[8] is A_f_r2 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[21] is v_r2 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[9] is A_r_r2 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[10] is A_f_r3 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[22] is v_r3 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[11] is A_r_r3 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[12] is A_f_r4 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[23] is v_r4 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[13] is A_r_r4 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[14] is A_f_r5 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[24] is v_r5 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[15] is A_r_r5 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[16] is A_f_r6 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[25] is v_r6 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[17] is A_r_r6 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[18] is A_f_r7 in component BG_NHE1 (J_per_mol).
* ALGEBRAIC[26] is v_r7 in component BG_NHE1 (fmol_per_s).
* ALGEBRAIC[19] is A_r_r7 in component BG_NHE1 (J_per_mol).
* STATES[0] is q_1 in component BG_NHE1 (fmol).
* STATES[1] is q_2 in component BG_NHE1 (fmol).
* STATES[2] is q_3 in component BG_NHE1 (fmol).
* STATES[3] is q_4 in component BG_NHE1 (fmol).
* STATES[4] is q_5 in component BG_NHE1 (fmol).
* STATES[5] is q_6 in component BG_NHE1 (fmol).
* CONSTANTS[26] is nNa in component BG_NHE1 (dimensionless).
* CONSTANTS[27] is z_zf1 in component params_BG (dimensionless).
* CONSTANTS[28] is z_zr1 in component params_BG (dimensionless).
* CONSTANTS[29] is z_zf2 in component params_BG (dimensionless).
* CONSTANTS[30] is z_zr2 in component params_BG (dimensionless).
* CONSTANTS[31] is Nai in component params_BG (mM).
* CONSTANTS[32] is Nao in component params_BG (mM).
* CONSTANTS[33] is Hi in component params_BG (mM).
* CONSTANTS[34] is Ho in component params_BG (mM).
* CONSTANTS[35] is V_i in component params_BG (pL).
* CONSTANTS[36] is V_o in component params_BG (pL).
* STATES[6] is V_E in component params_BG (volt).
* CONSTANTS[37] is dt in component params_BG (second).
* RATES[0] is d/dt q_1 in component BG_NHE1 (fmol).
* RATES[1] is d/dt q_2 in component BG_NHE1 (fmol).
* RATES[2] is d/dt q_3 in component BG_NHE1 (fmol).
* RATES[3] is d/dt q_4 in component BG_NHE1 (fmol).
* RATES[4] is d/dt q_5 in component BG_NHE1 (fmol).
* RATES[5] is d/dt q_6 in component BG_NHE1 (fmol).
* RATES[6] is d/dt V_E in component params_BG (volt).
* There are a total of 0 condition variables.
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 8.31;
CONSTANTS[1] = 293;
CONSTANTS[2] = 96485;
CONSTANTS[3] = 1e-08;
CONSTANTS[4] = 1e-08;
CONSTANTS[5] = 1e-06;
CONSTANTS[6] = 1e-06;
CONSTANTS[7] = 1;
CONSTANTS[8] = 1;
CONSTANTS[9] = 1;
CONSTANTS[10] = 1;
CONSTANTS[11] = 1;
CONSTANTS[12] = 1;
CONSTANTS[13] = 1;
CONSTANTS[14] = 1;
CONSTANTS[15] = 1;
CONSTANTS[16] = 1;
CONSTANTS[17] = 1;
CONSTANTS[18] = 1;
CONSTANTS[19] = 1;
CONSTANTS[20] = 1;
CONSTANTS[21] = 1;
CONSTANTS[22] = 1;
CONSTANTS[23] = 1;
CONSTANTS[24] = 1;
CONSTANTS[25] = 1;
CONSTANTS[26] = 1;
CONSTANTS[27] = 1;
CONSTANTS[28] = 1;
CONSTANTS[29] = 1;
CONSTANTS[30] = 1;
CONSTANTS[31] = 20;
CONSTANTS[32] = 100;
CONSTANTS[33] = 10e-3;
CONSTANTS[34] = 1e-12;
CONSTANTS[35] = 8.5e5;
CONSTANTS[36] = 8.5e5;
STATES[6] = -0.05;
CONSTANTS[37] = 1e-3;
CONSTANTS[38] = CONSTANTS[31]*CONSTANTS[35];
CONSTANTS[46] = 0.00000;
CONSTANTS[39] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[3]*CONSTANTS[38]);
CONSTANTS[40] = CONSTANTS[32]*CONSTANTS[36];
CONSTANTS[41] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[4]*CONSTANTS[40]);
CONSTANTS[42] = CONSTANTS[33]*CONSTANTS[35];
CONSTANTS[43] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[5]*CONSTANTS[42]);
CONSTANTS[44] = CONSTANTS[34]*CONSTANTS[36];
CONSTANTS[45] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[6]*CONSTANTS[44]);
STATES[0] = CONSTANTS[8];
STATES[1] = CONSTANTS[10];
STATES[2] = CONSTANTS[12];
STATES[3] = CONSTANTS[14];
STATES[4] = CONSTANTS[16];
STATES[5] = CONSTANTS[18];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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[0] - ALGEBRAIC[27];
resid[1] = RATES[1] - ALGEBRAIC[28];
resid[2] = RATES[2] - ALGEBRAIC[29];
resid[3] = RATES[3] - ALGEBRAIC[30];
resid[4] = RATES[4] - ALGEBRAIC[31];
resid[5] = RATES[5] - ALGEBRAIC[32];
resid[6] = RATES[6] - CONSTANTS[46];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[33] = STATES[6];
ALGEBRAIC[34] = ALGEBRAIC[33];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[7]*STATES[0]);
ALGEBRAIC[6] = CONSTANTS[26]*CONSTANTS[41]+ALGEBRAIC[0];
ALGEBRAIC[1] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[9]*STATES[1]);
ALGEBRAIC[7] = ALGEBRAIC[1];
ALGEBRAIC[20] = CONSTANTS[19]*(exp(ALGEBRAIC[6]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[7]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[5] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[17]*STATES[5]);
ALGEBRAIC[16] = ALGEBRAIC[5];
ALGEBRAIC[17] = ALGEBRAIC[0]+CONSTANTS[45];
ALGEBRAIC[25] = CONSTANTS[24]*(exp(ALGEBRAIC[16]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[17]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[18] = ALGEBRAIC[0];
ALGEBRAIC[3] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[13]*STATES[3]);
ALGEBRAIC[19] = ALGEBRAIC[3];
ALGEBRAIC[26] = CONSTANTS[25]*(exp(ALGEBRAIC[18]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[19]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[27] = (ALGEBRAIC[25] - ALGEBRAIC[20]) - ALGEBRAIC[26];
ALGEBRAIC[8] = ALGEBRAIC[1];
ALGEBRAIC[2] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[11]*STATES[2]);
ALGEBRAIC[9] = ALGEBRAIC[2];
ALGEBRAIC[21] = CONSTANTS[20]*(exp(ALGEBRAIC[8]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[9]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[28] = ALGEBRAIC[20] - ALGEBRAIC[21];
ALGEBRAIC[10] = ALGEBRAIC[2];
ALGEBRAIC[11] = ALGEBRAIC[3]+ CONSTANTS[26]*CONSTANTS[39];
ALGEBRAIC[22] = CONSTANTS[21]*(exp(ALGEBRAIC[10]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[11]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[29] = ALGEBRAIC[21] - ALGEBRAIC[22];
ALGEBRAIC[12] = ALGEBRAIC[3]+CONSTANTS[43];
ALGEBRAIC[4] = CONSTANTS[0]*CONSTANTS[1]*log( CONSTANTS[15]*STATES[4]);
ALGEBRAIC[13] = ALGEBRAIC[4];
ALGEBRAIC[23] = CONSTANTS[22]*(exp(ALGEBRAIC[12]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[13]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[30] = (ALGEBRAIC[22]+ALGEBRAIC[26]) - ALGEBRAIC[23];
ALGEBRAIC[14] = ALGEBRAIC[4];
ALGEBRAIC[15] = ALGEBRAIC[5];
ALGEBRAIC[24] = CONSTANTS[23]*(exp(ALGEBRAIC[14]/( CONSTANTS[0]*CONSTANTS[1])) - exp(ALGEBRAIC[15]/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[31] = ALGEBRAIC[23] - ALGEBRAIC[24];
ALGEBRAIC[32] = ALGEBRAIC[24] - ALGEBRAIC[25];
}
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)
{
}
