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 7 entries in the algebraic variable array.
   There are a total of 11 entries in each of the rate and state variable arrays.
   There are a total of 57 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is Q_Ca_p in component Q_Ca_p (millimole).
 * CONSTANTS[0] is J_bp_Ca in component model_fluxes (millimole_per_hour).
 * ALGEBRAIC[0] is J_pb_Ca in component model_fluxes (millimole_per_hour).
 * CONSTANTS[1] is J_pu_Ca in component model_fluxes (millimole_per_hour).
 * ALGEBRAIC[3] is J_ip_Ca in component model_fluxes (millimole_per_hour).
 * STATES[1] is Q_P_p in component Q_P_p (millimole).
 * CONSTANTS[38] is J_bp_P in component model_fluxes (millimole_per_hour).
 * ALGEBRAIC[4] is J_pb_P in component model_fluxes (millimole_per_hour).
 * CONSTANTS[2] is J_pu_P in component model_fluxes (millimole_per_hour).
 * CONSTANTS[48] is J_ip_P in component model_fluxes (millimole_per_hour).
 * CONSTANTS[55] is J_pc_P in component model_fluxes (millimole_per_hour).
 * ALGEBRAIC[6] is J_cp_P in component model_fluxes (millimole_per_hour).
 * STATES[2] is Q_P_c in component Q_P_c (millimole).
 * STATES[3] is Q_PTH_p in component Q_PTH_p (millimole).
 * ALGEBRAIC[1] is S_PTH in component model_fluxes (millimole_per_hour).
 * CONSTANTS[3] is C_PTH_p in component model_parameters (millimolar).
 * CONSTANTS[4] is k_PTH in component model_parameters (first_order_rate_constant).
 * STATES[4] is Q_Ca_b in component Q_Ca_b (millimole).
 * STATES[5] is Q_P_b in component Q_P_b (millimole).
 * STATES[6] is Q_E_k in component Q_E_k (millimole).
 * CONSTANTS[5] is S_E in component model_parameters (millimole_per_hour).
 * CONSTANTS[6] is k_E in component model_parameters (first_order_rate_constant).
 * STATES[7] is Q_D_p in component Q_D_p (millimole).
 * CONSTANTS[7] is k_D in component model_parameters (first_order_rate_constant).
 * STATES[8] is Q_TCa_i in component Q_TCa_i (millimole).
 * CONSTANTS[49] is k1_D in component model_parameters (first_order_rate_constant).
 * CONSTANTS[50] is k2_D in component model_parameters (first_order_rate_constant).
 * STATES[9] is Q_C_PT in component Q_C_PT (millimole).
 * CONSTANTS[51] is k3_D in component model_parameters (first_order_rate_constant).
 * CONSTANTS[52] is k4_D in component model_parameters (first_order_rate_constant).
 * STATES[10] is Q_TP_k in component Q_TP_k (millimole).
 * CONSTANTS[53] is k1_P in component model_parameters (first_order_rate_constant).
 * CONSTANTS[8] is k2_P in component model_parameters (first_order_rate_constant).
 * CONSTANTS[9] is J_P_ing in component model_fluxes (millimole_per_hour).
 * CONSTANTS[10] is Stoic_Ca_P in component model_fluxes (dimensionless).
 * CONSTANTS[11] is k_Ca_i in component model_fluxes (first_order_rate_constant).
 * CONSTANTS[12] is C_Ca_i in component model_parameters (millimolar).
 * CONSTANTS[13] is C_Ca_p in component model_parameters (millimolar).
 * CONSTANTS[14] is C_P_p in component model_parameters (millimolar).
 * CONSTANTS[15] is k_Ca_b in component model_parameters (first_order_rate_constant).
 * CONSTANTS[16] is k3_P in component model_parameters (first_order_rate_constant).
 * CONSTANTS[17] is k4_P in component model_parameters (first_order_rate_constant).
 * CONSTANTS[39] is Y_Ca_i_2plus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[40] is Y_Ca_p_1minus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[18] is C_D_p in component model_parameters (picomolar).
 * CONSTANTS[54] is Ca_thr in component model_parameters (first_order_rate_constant).
 * CONSTANTS[56] is Ca_T in component model_parameters (second_order_rate_constant).
 * ALGEBRAIC[2] is P_thr in component model_parameters (millimole_per_hour).
 * ALGEBRAIC[5] is P_T in component model_parameters (litre_per_hour).
 * CONSTANTS[41] is Y_i_D_p_1plus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[42] is Y_PT_D_p_1plus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[43] is Y_k_Jext_1plus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[44] is Y_PTH_p_2plus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[45] is Y_PTH_p_2minus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[46] is Y_i_D_p_1minus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[47] is Y_PT_D_p_1minus in component model_parameters (first_order_rate_constant).
 * CONSTANTS[19] is Y_Ca_i_2plus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[20] is Y_PTH_p_2plus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[21] is Y_PTH_p_2minus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[22] is Y_Ca_p_1plus_minus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[23] is Y_i_D_p_1plus_minus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[24] is Y_PT_D_p_1plus_minus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[25] is Y_k_Jext_1plus_minus_Max in component model_parameters (first_order_rate_constant).
 * CONSTANTS[26] is X_R_PTH_Ca in component model_parameters (millimolar).
 * CONSTANTS[27] is X_R_i_Ca in component model_parameters (millimolar).
 * CONSTANTS[28] is X_R_PTH_D in component model_parameters (picomolar).
 * CONSTANTS[29] is X_R_E_PTH in component model_parameters (picomolar).
 * CONSTANTS[30] is X_R_i_D in component model_parameters (picomolar).
 * CONSTANTS[31] is X_R_P_k_PTH in component model_parameters (picomolar).
 * CONSTANTS[32] is b_PTH_Ca in component model_parameters (litre_per_millimole).
 * CONSTANTS[33] is b_PTH_D in component model_parameters (litre_per_picomole).
 * CONSTANTS[34] is b_E_PTH in component model_parameters (litre_per_picomole).
 * CONSTANTS[35] is b_i_D in component model_parameters (litre_per_picomole).
 * CONSTANTS[36] is a in component model_parameters (dimensionless).
 * CONSTANTS[37] is d in component model_parameters (dimensionless).
 * RATES[0] is d/dt Q_Ca_p in component Q_Ca_p (millimole).
 * RATES[1] is d/dt Q_P_p in component Q_P_p (millimole).
 * RATES[2] is d/dt Q_P_c in component Q_P_c (millimole).
 * RATES[3] is d/dt Q_PTH_p in component Q_PTH_p (millimole).
 * RATES[4] is d/dt Q_Ca_b in component Q_Ca_b (millimole).
 * RATES[5] is d/dt Q_P_b in component Q_P_b (millimole).
 * RATES[6] is d/dt Q_E_k in component Q_E_k (millimole).
 * RATES[7] is d/dt Q_D_p in component Q_D_p (millimole).
 * RATES[8] is d/dt Q_TCa_i in component Q_TCa_i (millimole).
 * RATES[9] is d/dt Q_C_PT in component Q_C_PT (millimole).
 * RATES[10] is d/dt Q_TP_k in component Q_TP_k (millimole).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.000;
CONSTANTS[0] = 3.3;
CONSTANTS[1] = 0.21;
STATES[1] = 1.000;
CONSTANTS[2] = 1.27;
STATES[2] = 3226.0;
STATES[3] = 1.000;
CONSTANTS[3] = 3.85;
CONSTANTS[4] = 100.0;
STATES[4] = 100.0;
STATES[5] = 1.000;
STATES[6] = 1.000;
CONSTANTS[5] = 1.000;
CONSTANTS[6] = 0.05;
STATES[7] = 1.000;
CONSTANTS[7] = 0.1;
STATES[8] = 1.000;
STATES[9] = 1.000;
STATES[10] = 1.000;
CONSTANTS[8] = 1.000;
CONSTANTS[9] = 1.000;
CONSTANTS[10] = 0.464;
CONSTANTS[11] = 1.000;
CONSTANTS[12] = 1.000;
CONSTANTS[13] = 2.4;
CONSTANTS[14] = 1.2;
CONSTANTS[15] = 1.000;
CONSTANTS[16] = 1.000;
CONSTANTS[17] = 51.8;
CONSTANTS[18] = 90.0;
CONSTANTS[19] = 1.000;
CONSTANTS[20] = 1.000;
CONSTANTS[21] = 1.000;
CONSTANTS[22] = 0.02;
CONSTANTS[23] = 0.02;
CONSTANTS[24] = 0.01;
CONSTANTS[25] = 0.01;
CONSTANTS[26] = 1.0;
CONSTANTS[27] = 1.0;
CONSTANTS[28] = 90.0;
CONSTANTS[29] = 3.85;
CONSTANTS[30] = 90.0;
CONSTANTS[31] = 90.0;
CONSTANTS[32] = 0.05;
CONSTANTS[33] = 0.03;
CONSTANTS[34] = 0.55;
CONSTANTS[35] = 0.03;
CONSTANTS[36] = 0.85;
CONSTANTS[37] = 0.15;
CONSTANTS[38] =  CONSTANTS[10]*CONSTANTS[0];
CONSTANTS[39] =  CONSTANTS[19]*(CONSTANTS[12]/(CONSTANTS[12]+CONSTANTS[27]));
CONSTANTS[40] =  CONSTANTS[22]*( CONSTANTS[36]*(1.00000 -  tanh( CONSTANTS[32]*(CONSTANTS[13] - CONSTANTS[26])))+CONSTANTS[37]);
CONSTANTS[41] =  CONSTANTS[23]*( CONSTANTS[36]*(1.00000+ tanh( CONSTANTS[35]*(CONSTANTS[18] - CONSTANTS[30])))+CONSTANTS[37]);
CONSTANTS[42] =  CONSTANTS[24]*( CONSTANTS[36]*(1.00000+ tanh( CONSTANTS[33]*(CONSTANTS[18] - CONSTANTS[28])))+CONSTANTS[37]);
CONSTANTS[43] =  CONSTANTS[25]*( CONSTANTS[36]*(1.00000+ tanh( CONSTANTS[34]*( 1.00000*CONSTANTS[14] - CONSTANTS[29])))+CONSTANTS[37]);
CONSTANTS[44] =  CONSTANTS[20]*(CONSTANTS[3]/(CONSTANTS[3]+ 1.00000*CONSTANTS[31]));
CONSTANTS[45] =  CONSTANTS[21]*(CONSTANTS[31]/( 1.00000*CONSTANTS[3]+CONSTANTS[31]));
CONSTANTS[46] =  CONSTANTS[23]*( CONSTANTS[36]*(1.00000 -  tanh( CONSTANTS[35]*(CONSTANTS[18] - CONSTANTS[30])))+CONSTANTS[37]);
CONSTANTS[47] =  CONSTANTS[24]*( CONSTANTS[36]*(1.00000 -  tanh( CONSTANTS[33]*(CONSTANTS[18] - CONSTANTS[28])))+CONSTANTS[37]);
CONSTANTS[48] = CONSTANTS[9];
CONSTANTS[49] = CONSTANTS[41];
CONSTANTS[50] = CONSTANTS[46];
CONSTANTS[51] = CONSTANTS[42];
CONSTANTS[52] = CONSTANTS[47];
CONSTANTS[53] = CONSTANTS[43];
CONSTANTS[54] = 1.95000+CONSTANTS[44];
CONSTANTS[55] =  CONSTANTS[17]*1.00000*CONSTANTS[14];
CONSTANTS[56] = CONSTANTS[54]/CONSTANTS[13];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[6] = CONSTANTS[5] -  CONSTANTS[6]*STATES[6];
RATES[7] =  1.00000*STATES[6] -  CONSTANTS[7]*STATES[7];
RATES[8] =  (1.00000 - STATES[8])*CONSTANTS[49] -  STATES[8]*CONSTANTS[50];
RATES[9] =  (1.00000 - STATES[9])*CONSTANTS[51] -  STATES[9]*CONSTANTS[52];
RATES[10] =  (1.00000 - STATES[10])*CONSTANTS[53] -  STATES[10]*CONSTANTS[8];
ALGEBRAIC[1] =  1.00000*CONSTANTS[40]*( CONSTANTS[51]*(1.00000 - STATES[9]) -  CONSTANTS[52]*STATES[9]);
RATES[3] = ALGEBRAIC[1] -  CONSTANTS[4]*1.00000*CONSTANTS[3];
ALGEBRAIC[0] =  CONSTANTS[15]*STATES[4];
RATES[4] = ALGEBRAIC[0] - CONSTANTS[0];
ALGEBRAIC[3] = ( CONSTANTS[39]*(1.00000 - STATES[8])*1.00000*CONSTANTS[49]+ CONSTANTS[11]*1.00000*(CONSTANTS[12] - CONSTANTS[13])) -  STATES[8]*CONSTANTS[50];
RATES[0] = (CONSTANTS[0]+ALGEBRAIC[3]) - (ALGEBRAIC[0]+CONSTANTS[1]);
ALGEBRAIC[4] =  CONSTANTS[10]*ALGEBRAIC[0];
RATES[5] = ALGEBRAIC[4] - CONSTANTS[38];
ALGEBRAIC[6] =  CONSTANTS[16]*STATES[2];
RATES[1] = (CONSTANTS[38]+CONSTANTS[48]+ALGEBRAIC[6]) - (ALGEBRAIC[4]+CONSTANTS[2]+CONSTANTS[55]);
RATES[2] = CONSTANTS[55] - ALGEBRAIC[6];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] =  1.00000*CONSTANTS[40]*( CONSTANTS[51]*(1.00000 - STATES[9]) -  CONSTANTS[52]*STATES[9]);
ALGEBRAIC[0] =  CONSTANTS[15]*STATES[4];
ALGEBRAIC[3] = ( CONSTANTS[39]*(1.00000 - STATES[8])*1.00000*CONSTANTS[49]+ CONSTANTS[11]*1.00000*(CONSTANTS[12] - CONSTANTS[13])) -  STATES[8]*CONSTANTS[50];
ALGEBRAIC[4] =  CONSTANTS[10]*ALGEBRAIC[0];
ALGEBRAIC[6] =  CONSTANTS[16]*STATES[2];
ALGEBRAIC[2] =  CONSTANTS[45]*STATES[10];
ALGEBRAIC[5] = ALGEBRAIC[2]/CONSTANTS[14];
}