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 11 entries in the algebraic variable array.
   There are a total of 10 entries in each of the rate and state variable arrays.
   There are a total of 27 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * ALGEBRAIC[2] is Rate_Ca_influx_across_the_SR in component Ca_influx_across_the_SR (flux).
 * CONSTANTS[0] is Ca_e in component extracellular_calcium (molar).
 * STATES[0] is Ca_f in component fuzzy_space_calcium (molar).
 * CONSTANTS[1] is k1 in component Ca_influx_across_the_SR (first_order_rate_constant).
 * STATES[1] is Ca_2_S1 in component Ca_bound_to_the_SRRC_fast_activating_binding_site (molar).
 * STATES[2] is Ca_S2 in component Ca_bound_to_the_SRRC_slow_inactivating_binding_site (molar).
 * STATES[3] is S1 in component SRRC_fast_activating_binding_site (molar).
 * STATES[4] is S2 in component SRRC_slow_inactivating_binding_site (molar).
 * STATES[5] is Ca_s in component SR_calcium (molar).
 * ALGEBRAIC[0] is dCa2_S1_dt in component Ca_movement_through_the_SRRC (flux).
 * ALGEBRAIC[1] is dCa_S2_dt in component Ca_movement_through_the_SRRC (flux).
 * CONSTANTS[2] is k_on1 in component Ca_movement_through_the_SRRC (second_order_rate_constant).
 * CONSTANTS[3] is k_off1 in component Ca_movement_through_the_SRRC (first_order_rate_constant).
 * CONSTANTS[4] is k_on2 in component Ca_movement_through_the_SRRC (second_order_rate_constant).
 * CONSTANTS[5] is k_off2 in component Ca_movement_through_the_SRRC (first_order_rate_constant).
 * CONSTANTS[6] is k_s in component Ca_movement_through_the_SRRC (first_order_rate_constant).
 * STATES[6] is cas1 in component Ca_movement_through_the_SRRC (dimensionless).
 * STATES[7] is cas2 in component Ca_movement_through_the_SRRC (dimensionless).
 * ALGEBRAIC[4] is dcas1_dt in component Ca_movement_through_the_SRRC (first_order_rate_constant).
 * ALGEBRAIC[5] is dcas2_dt in component Ca_movement_through_the_SRRC (first_order_rate_constant).
 * ALGEBRAIC[3] is r_o in component Ca_movement_through_the_SRRC (dimensionless).
 * ALGEBRAIC[6] is Rate_Ca_movement_through_the_SRRC in component Ca_movement_through_the_SRRC (flux).
 * CONSTANTS[7] is Km_NaCaX in component Ca_efflux_across_the_SR_by_NaCa_exchange (molar).
 * CONSTANTS[8] is Vmax_NaCaX in component Ca_efflux_across_the_SR_by_NaCa_exchange (flux).
 * ALGEBRAIC[7] is Rate_Ca_efflux_across_the_SR_by_NaCa_exchange in component Ca_efflux_across_the_SR_by_NaCa_exchange (flux).
 * STATES[8] is Ca_c in component cytosolic_calcium (molar).
 * CONSTANTS[9] is kf in component Ca_movement_between_the_fuzzy_space_and_cytosol (first_order_rate_constant).
 * ALGEBRAIC[8] is Rate_Ca_movement_between_the_fuzzy_space_and_cytosol in component Ca_movement_between_the_fuzzy_space_and_cytosol (flux).
 * CONSTANTS[10] is Km_s in component Ca_uptake_by_SR_Ca_ATPase (molar).
 * CONSTANTS[11] is Vmax_s in component Ca_uptake_by_SR_Ca_ATPase (flux).
 * ALGEBRAIC[9] is Rate_Ca_uptake_by_SR_Ca_ATPase in component Ca_uptake_by_SR_Ca_ATPase (flux).
 * STATES[9] is Ca_CSQ in component calsequestrin_bound_calcium (molar).
 * CONSTANTS[12] is K_ons in component Ca_buffering_in_the_SR (second_order_rate_constant).
 * CONSTANTS[13] is K_offs in component Ca_buffering_in_the_SR (first_order_rate_constant).
 * CONSTANTS[14] is Bmax_s in component Ca_buffering_in_the_SR (molar).
 * ALGEBRAIC[10] is Rate_Ca_buffering_in_the_SR in component Ca_buffering_in_the_SR (flux).
 * CONSTANTS[15] is Rt in component fuzzy_space_calcium (molar).
 * CONSTANTS[16] is Bmax_f1 in component fuzzy_space_calcium (molar).
 * CONSTANTS[17] is Bmax_f2 in component fuzzy_space_calcium (molar).
 * CONSTANTS[18] is Kb_f1 in component fuzzy_space_calcium (molar).
 * CONSTANTS[19] is Kb_f2 in component fuzzy_space_calcium (molar).
 * CONSTANTS[20] is V_f in component fuzzy_space_calcium (dimensionless).
 * CONSTANTS[21] is Bmax_c in component cytosolic_calcium (molar).
 * CONSTANTS[22] is dye_c in component cytosolic_calcium (molar).
 * CONSTANTS[23] is Kb_c in component cytosolic_calcium (molar).
 * CONSTANTS[24] is Kb_dye in component cytosolic_calcium (molar).
 * CONSTANTS[25] is V_c in component cytosolic_calcium (dimensionless).
 * CONSTANTS[26] is V_s in component SR_calcium (dimensionless).
 * RATES[6] is d/dt cas1 in component Ca_movement_through_the_SRRC (dimensionless).
 * RATES[7] is d/dt cas2 in component Ca_movement_through_the_SRRC (dimensionless).
 * RATES[0] is d/dt Ca_f in component fuzzy_space_calcium (molar).
 * RATES[8] is d/dt Ca_c in component cytosolic_calcium (molar).
 * RATES[5] is d/dt Ca_s in component SR_calcium (molar).
 * RATES[9] is d/dt Ca_CSQ in component calsequestrin_bound_calcium (molar).
 * RATES[3] is d/dt S1 in component SRRC_fast_activating_binding_site (molar).
 * RATES[4] is d/dt S2 in component SRRC_slow_inactivating_binding_site (molar).
 * RATES[1] is d/dt Ca_2_S1 in component Ca_bound_to_the_SRRC_fast_activating_binding_site (molar).
 * RATES[2] is d/dt Ca_S2 in component Ca_bound_to_the_SRRC_slow_inactivating_binding_site (molar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.002;
STATES[0] = 0.12e-6;
CONSTANTS[1] = 0.2;
STATES[1] = 0;
STATES[2] = 0;
STATES[3] = 0;
STATES[4] = 0;
STATES[5] = 201e-6;
CONSTANTS[2] = 2000000000;
CONSTANTS[3] = 1400;
CONSTANTS[4] = 13000000;
CONSTANTS[5] = 3.9;
CONSTANTS[6] = 9;
STATES[6] = 0;
STATES[7] = 0;
CONSTANTS[7] = 0.000036;
CONSTANTS[8] = 0.0012;
STATES[8] = 1e-7;
CONSTANTS[9] = 2500;
CONSTANTS[10] = 0.00000025;
CONSTANTS[11] = 0.000525;
STATES[9] = 0;
CONSTANTS[12] = 8772;
CONSTANTS[13] = 5.596536;
CONSTANTS[14] = 0.008;
CONSTANTS[15] = 0.00000015;
CONSTANTS[16] = 0.0002;
CONSTANTS[17] = 0.0011;
CONSTANTS[18] = 0.000017;
CONSTANTS[19] = 0.000013;
CONSTANTS[20] = 0.0013;
CONSTANTS[21] = 0.00012;
CONSTANTS[22] = 0;
CONSTANTS[23] = 0.00000096;
CONSTANTS[24] = 2e-7;
CONSTANTS[25] = 0.9287;
CONSTANTS[26] = 0.07;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[2]*STATES[0]*STATES[3] -  (pow(CONSTANTS[3], 2.00000)/( CONSTANTS[2]*STATES[0]))*STATES[1];
RATES[3] = - ALGEBRAIC[0];
ALGEBRAIC[1] =  CONSTANTS[4]*STATES[0]*STATES[4] -  CONSTANTS[5]*STATES[2];
RATES[4] = - ALGEBRAIC[1];
RATES[1] = ALGEBRAIC[0];
RATES[2] = ALGEBRAIC[1];
ALGEBRAIC[4] =  CONSTANTS[2]*STATES[0]*(1.00000 - STATES[6]) -  (pow(CONSTANTS[3], 2.00000)/( CONSTANTS[2]*STATES[0]))*STATES[6];
RATES[6] = ALGEBRAIC[4];
ALGEBRAIC[5] =  CONSTANTS[4]*STATES[0]*(1.00000 - STATES[7]) -  CONSTANTS[5]*STATES[7];
RATES[7] = ALGEBRAIC[5];
ALGEBRAIC[2] =  CONSTANTS[1]*(CONSTANTS[0] - STATES[0]);
ALGEBRAIC[3] =  STATES[6]*(1.00000 - STATES[7]);
ALGEBRAIC[6] =  CONSTANTS[6]*ALGEBRAIC[3]*(STATES[5] - STATES[0]);
ALGEBRAIC[7] = ( CONSTANTS[8]*STATES[0])/(CONSTANTS[7]+STATES[0]);
ALGEBRAIC[8] =  CONSTANTS[9]*(STATES[0] - STATES[8]);
RATES[0] = ((ALGEBRAIC[6] - ( CONSTANTS[15]*(ALGEBRAIC[4]+ALGEBRAIC[5])+ALGEBRAIC[8]+ALGEBRAIC[7]))+ALGEBRAIC[2])/(( CONSTANTS[16]*CONSTANTS[18])/pow(STATES[0]+CONSTANTS[18], 2.00000)+( CONSTANTS[17]*CONSTANTS[19])/pow(STATES[0]+CONSTANTS[19], 2.00000)+CONSTANTS[20]);
ALGEBRAIC[9] = ( CONSTANTS[11]*(pow(STATES[8], 2.00000) - pow(STATES[5], 2.00000)/pow(7000.00, 2.00000)))/(pow(CONSTANTS[10], 2.00000)+pow(STATES[8], 2.00000)+pow(STATES[5], 2.00000)/pow(7000.00, 2.00000));
RATES[8] = (ALGEBRAIC[8] - ALGEBRAIC[9])/(( CONSTANTS[21]*CONSTANTS[23])/pow(STATES[8]+CONSTANTS[23], 2.00000)+( CONSTANTS[22]*CONSTANTS[24])/pow(STATES[8]+CONSTANTS[24], 2.00000)+CONSTANTS[25]);
ALGEBRAIC[10] =  CONSTANTS[12]*STATES[5]*(CONSTANTS[14] - STATES[9]) -  CONSTANTS[13]*STATES[9];
RATES[5] = (ALGEBRAIC[9] - ALGEBRAIC[6])/CONSTANTS[26] - ALGEBRAIC[10];
RATES[9] = ALGEBRAIC[10];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[2]*STATES[0]*STATES[3] -  (pow(CONSTANTS[3], 2.00000)/( CONSTANTS[2]*STATES[0]))*STATES[1];
ALGEBRAIC[1] =  CONSTANTS[4]*STATES[0]*STATES[4] -  CONSTANTS[5]*STATES[2];
ALGEBRAIC[4] =  CONSTANTS[2]*STATES[0]*(1.00000 - STATES[6]) -  (pow(CONSTANTS[3], 2.00000)/( CONSTANTS[2]*STATES[0]))*STATES[6];
ALGEBRAIC[5] =  CONSTANTS[4]*STATES[0]*(1.00000 - STATES[7]) -  CONSTANTS[5]*STATES[7];
ALGEBRAIC[2] =  CONSTANTS[1]*(CONSTANTS[0] - STATES[0]);
ALGEBRAIC[3] =  STATES[6]*(1.00000 - STATES[7]);
ALGEBRAIC[6] =  CONSTANTS[6]*ALGEBRAIC[3]*(STATES[5] - STATES[0]);
ALGEBRAIC[7] = ( CONSTANTS[8]*STATES[0])/(CONSTANTS[7]+STATES[0]);
ALGEBRAIC[8] =  CONSTANTS[9]*(STATES[0] - STATES[8]);
ALGEBRAIC[9] = ( CONSTANTS[11]*(pow(STATES[8], 2.00000) - pow(STATES[5], 2.00000)/pow(7000.00, 2.00000)))/(pow(CONSTANTS[10], 2.00000)+pow(STATES[8], 2.00000)+pow(STATES[5], 2.00000)/pow(7000.00, 2.00000));
ALGEBRAIC[10] =  CONSTANTS[12]*STATES[5]*(CONSTANTS[14] - STATES[9]) -  CONSTANTS[13]*STATES[9];
}