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 5 entries in the algebraic variable array.
   There are a total of 1 entries in each of the rate and state variable arrays.
   There are a total of 28 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is k_p1 in component SERCA (second_order_rate_constant).
 * CONSTANTS[1] is k_p2 in component SERCA (first_order_rate_constant).
 * CONSTANTS[2] is k_p3 in component SERCA (first_order_rate_constant).
 * CONSTANTS[3] is k_m1 in component SERCA (first_order_rate_constant).
 * CONSTANTS[4] is k_m2 in component SERCA (second_order_rate_constant).
 * CONSTANTS[5] is k_m3 in component SERCA (second_order_rate_constant).
 * CONSTANTS[18] is kdatp in component SERCA (millimolar).
 * CONSTANTS[6] is kdcai in component SERCA (millimolar).
 * CONSTANTS[7] is kdcasr in component SERCA (millimolar).
 * CONSTANTS[8] is kdh1 in component SERCA (millimolar).
 * CONSTANTS[9] is kdhi in component SERCA (millimolar_squared).
 * CONSTANTS[10] is kdhsr in component SERCA (millimolar_squared).
 * CONSTANTS[11] is kdh in component SERCA (millimolar).
 * CONSTANTS[12] is n in component SERCA (dimensionless).
 * CONSTANTS[13] is Ca_i in component SERCA (millimolar).
 * CONSTANTS[14] is Ca_sr in component SERCA (millimolar).
 * CONSTANTS[15] is H_i in component SERCA (millimolar).
 * STATES[0] is ATP in component SERCA (millimolar).
 * CONSTANTS[16] is ADP in component SERCA (millimolar).
 * CONSTANTS[17] is P_i in component SERCA (millimolar).
 * ALGEBRAIC[0] is T_ATP in component SERCA (dimensionless).
 * CONSTANTS[19] is T_Cai in component SERCA (dimensionless).
 * CONSTANTS[20] is T_Casr in component SERCA (dimensionless).
 * CONSTANTS[21] is T_H1 in component SERCA (dimensionless).
 * CONSTANTS[22] is T_Hi in component SERCA (dimensionless).
 * CONSTANTS[23] is T_Hsr in component SERCA (dimensionless).
 * CONSTANTS[24] is T_H in component SERCA (dimensionless).
 * ALGEBRAIC[1] is a_p1 in component SERCA (first_order_rate_constant).
 * CONSTANTS[25] is a_p2 in component SERCA (first_order_rate_constant).
 * CONSTANTS[26] is a_m1 in component SERCA (first_order_rate_constant).
 * ALGEBRAIC[2] is a_m2 in component SERCA (first_order_rate_constant).
 * ALGEBRAIC[3] is s2 in component SERCA (first_order_rate_constant).
 * ALGEBRAIC[4] is v_cycle in component SERCA (first_order_rate_constant).
 * RATES[0] is d/dt ATP in component SERCA (millimolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 25900;
CONSTANTS[1] = 2540;
CONSTANTS[2] = 20.5;
CONSTANTS[3] = 2;
CONSTANTS[4] = 67200;
CONSTANTS[5] = 149;
CONSTANTS[6] = 0.9;
CONSTANTS[7] = 2.24;
CONSTANTS[8] = 1.09e-5;
CONSTANTS[9] = 3.54e-3;
CONSTANTS[10] = 1.05e-8;
CONSTANTS[11] = 7.24e-5;
CONSTANTS[12] = 2;
CONSTANTS[13] = 1e-3;
CONSTANTS[14] = 1;
CONSTANTS[15] = 1e-4;
STATES[0] = 0.01;
CONSTANTS[16] = 20e-3;
CONSTANTS[17] = 1;
CONSTANTS[18] = CONSTANTS[3]/CONSTANTS[0];
CONSTANTS[19] = CONSTANTS[13]/CONSTANTS[6];
CONSTANTS[27] = 0.100000;
CONSTANTS[20] = CONSTANTS[14]/CONSTANTS[7];
CONSTANTS[21] = CONSTANTS[15]/CONSTANTS[8];
CONSTANTS[22] = pow(CONSTANTS[15], CONSTANTS[12])/CONSTANTS[9];
CONSTANTS[23] = pow(CONSTANTS[15], CONSTANTS[12])/CONSTANTS[10];
CONSTANTS[24] = CONSTANTS[15]/CONSTANTS[11];
CONSTANTS[25] = ( CONSTANTS[2]*CONSTANTS[23])/( CONSTANTS[23]*(1.00000+CONSTANTS[24])+ CONSTANTS[24]*(1.00000+pow(CONSTANTS[20], 2.00000)));
CONSTANTS[26] = ( CONSTANTS[4]*CONSTANTS[16]*pow(CONSTANTS[20], 2.00000)*CONSTANTS[24])/( CONSTANTS[23]*(1.00000+CONSTANTS[24])+ CONSTANTS[24]*(1.00000+pow(CONSTANTS[20], 2.00000)));
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[27];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[0]/CONSTANTS[18];
ALGEBRAIC[1] = ( CONSTANTS[1]*ALGEBRAIC[0]*pow(CONSTANTS[19], 2.00000))/( ALGEBRAIC[0]*pow(CONSTANTS[19], 2.00000)+ CONSTANTS[22]*(1.00000+ ALGEBRAIC[0]*(1.00000+CONSTANTS[21]+pow(CONSTANTS[19], 2.00000))));
ALGEBRAIC[2] = ( CONSTANTS[5]*CONSTANTS[17]*CONSTANTS[22])/( ALGEBRAIC[0]*pow(CONSTANTS[19], 2.00000)+ CONSTANTS[22]*(1.00000+ ALGEBRAIC[0]*(1.00000+CONSTANTS[21]+pow(CONSTANTS[19], 2.00000))));
ALGEBRAIC[3] = ALGEBRAIC[1]+CONSTANTS[25]+CONSTANTS[26]+ALGEBRAIC[2];
ALGEBRAIC[4] = ( ALGEBRAIC[1]*CONSTANTS[25] -  CONSTANTS[26]*ALGEBRAIC[2])/ALGEBRAIC[3];
}