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 13 entries in the algebraic variable array.
   There are a total of 3 entries in each of the rate and state variable arrays.
   There are a total of 19 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[16] is F in component main (dimensionless).
 * CONSTANTS[0] is R_T in component main (dimensionless).
 * ALGEBRAIC[0] is R_off in component main (dimensionless).
 * STATES[0] is D in component main (dimensionless).
 * STATES[1] is A_1 in component main (dimensionless).
 * STATES[2] is A_2 in component main (dimensionless).
 * ALGEBRAIC[4] is lambda_off in component main (dimensionless).
 * ALGEBRAIC[5] is lambda_on in component main (dimensionless).
 * ALGEBRAIC[1] is lambda_D in component main (dimensionless).
 * ALGEBRAIC[2] is lambda_A_1 in component main (dimensionless).
 * ALGEBRAIC[6] is lambda_A_2 in component main (dimensionless).
 * ALGEBRAIC[3] is lambda_A2_cyc in component main (dimensionless).
 * CONSTANTS[15] is Ca in component main (dimensionless).
 * CONSTANTS[14] is Ca_50 in component main (dimensionless).
 * ALGEBRAIC[11] is k_on in component XB_RU_interaction (per_second).
 * ALGEBRAIC[12] is k_off in component XB_RU_interaction (per_second).
 * CONSTANTS[1] is k_0_on in component main (per_second).
 * CONSTANTS[2] is k_0_off in component main (per_second).
 * CONSTANTS[3] is k_Ca_on in component main (per_second).
 * CONSTANTS[4] is k_Ca_off in component main (per_second).
 * ALGEBRAIC[9] is f in component XB_XB_interaction (per_second).
 * ALGEBRAIC[10] is f_prime in component XB_XB_interaction (per_second).
 * CONSTANTS[5] is f_0 in component main (per_second).
 * CONSTANTS[6] is f_prime_0 in component main (per_second).
 * CONSTANTS[7] is h in component main (per_second).
 * CONSTANTS[8] is h_prime in component main (per_second).
 * CONSTANTS[9] is g in component main (per_second).
 * CONSTANTS[10] is n_H in component main (dimensionless).
 * CONSTANTS[11] is u in component main (dimensionless).
 * CONSTANTS[12] is w in component main (dimensionless).
 * CONSTANTS[13] is v in component main (dimensionless).
 * CONSTANTS[17] is k_u_on in component RU_rate_constant (per_second).
 * CONSTANTS[18] is k_u_off in component RU_rate_constant (per_second).
 * ALGEBRAIC[7] is k_w_on in component RU_RU_interaction (per_second).
 * ALGEBRAIC[8] is k_w_off in component RU_RU_interaction (per_second).
 * RATES[0] is d/dt D in component main (dimensionless).
 * RATES[1] is d/dt A_1 in component main (dimensionless).
 * RATES[2] is d/dt A_2 in component main (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1;
STATES[0] = 0;
STATES[1] = 0;
STATES[2] = 0;
CONSTANTS[1] = 0;
CONSTANTS[2] = 100;
CONSTANTS[3] = 120;
CONSTANTS[4] = 50;
CONSTANTS[5] = 50;
CONSTANTS[6] = 400;
CONSTANTS[7] = 8;
CONSTANTS[8] = 6;
CONSTANTS[9] = 4;
CONSTANTS[10] = 1;
CONSTANTS[11] = 1;
CONSTANTS[12] = 1;
CONSTANTS[13] = 1;
CONSTANTS[14] = CONSTANTS[4]/CONSTANTS[3];
CONSTANTS[15] =  CONSTANTS[14]*100.000;
CONSTANTS[16] = 1.00000/(1.00000+pow(CONSTANTS[15]/CONSTANTS[14], - CONSTANTS[10]));
CONSTANTS[17] = CONSTANTS[1]+( (CONSTANTS[3] - CONSTANTS[1])*CONSTANTS[15])/(CONSTANTS[14]+CONSTANTS[15]);
CONSTANTS[18] = CONSTANTS[2]+( (CONSTANTS[4] - CONSTANTS[2])*CONSTANTS[15])/(CONSTANTS[14]+CONSTANTS[15]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[2] =  CONSTANTS[7]*STATES[1] -  (CONSTANTS[8]+CONSTANTS[9])*STATES[2];
ALGEBRAIC[6] = STATES[2]/CONSTANTS[0];
ALGEBRAIC[9] =  CONSTANTS[5]*pow(1.00000+ ALGEBRAIC[6]*(exp(CONSTANTS[13] - 1.00000) - 1.00000), 2.00000);
ALGEBRAIC[10] =  CONSTANTS[6]*pow(1.00000+ ALGEBRAIC[6]*(exp(- (CONSTANTS[13] - 1.00000)) - 1.00000), 2.00000);
RATES[1] = ( ALGEBRAIC[9]*STATES[0]+ CONSTANTS[8]*STATES[2]) -  (ALGEBRAIC[10]+CONSTANTS[7])*STATES[1];
ALGEBRAIC[0] = CONSTANTS[0] - (STATES[0]+STATES[1]+STATES[2]);
ALGEBRAIC[5] = (STATES[0]+STATES[1]+STATES[2])/CONSTANTS[0];
ALGEBRAIC[7] =  CONSTANTS[17]*pow(1.00000+ ALGEBRAIC[5]*(CONSTANTS[11] - 1.00000), 2.00000);
ALGEBRAIC[11] =  ALGEBRAIC[7]*pow(1.00000+ ALGEBRAIC[6]*(exp(CONSTANTS[12] - 1.00000) - 1.00000), 2.00000);
ALGEBRAIC[8] =  CONSTANTS[18]*pow(CONSTANTS[11] -  ALGEBRAIC[5]*(CONSTANTS[11] - 1.00000), 2.00000);
ALGEBRAIC[12] =  ALGEBRAIC[8]*pow(1.00000+ ALGEBRAIC[6]*(exp(- (CONSTANTS[12] - 1.00000)) - 1.00000), 2.00000);
RATES[0] = ( ALGEBRAIC[11]*ALGEBRAIC[0]+ ALGEBRAIC[10]*STATES[1]+ CONSTANTS[9]*STATES[2]) -  (ALGEBRAIC[12]+ALGEBRAIC[9])*STATES[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[6] = STATES[2]/CONSTANTS[0];
ALGEBRAIC[9] =  CONSTANTS[5]*pow(1.00000+ ALGEBRAIC[6]*(exp(CONSTANTS[13] - 1.00000) - 1.00000), 2.00000);
ALGEBRAIC[10] =  CONSTANTS[6]*pow(1.00000+ ALGEBRAIC[6]*(exp(- (CONSTANTS[13] - 1.00000)) - 1.00000), 2.00000);
ALGEBRAIC[0] = CONSTANTS[0] - (STATES[0]+STATES[1]+STATES[2]);
ALGEBRAIC[5] = (STATES[0]+STATES[1]+STATES[2])/CONSTANTS[0];
ALGEBRAIC[7] =  CONSTANTS[17]*pow(1.00000+ ALGEBRAIC[5]*(CONSTANTS[11] - 1.00000), 2.00000);
ALGEBRAIC[11] =  ALGEBRAIC[7]*pow(1.00000+ ALGEBRAIC[6]*(exp(CONSTANTS[12] - 1.00000) - 1.00000), 2.00000);
ALGEBRAIC[8] =  CONSTANTS[18]*pow(CONSTANTS[11] -  ALGEBRAIC[5]*(CONSTANTS[11] - 1.00000), 2.00000);
ALGEBRAIC[12] =  ALGEBRAIC[8]*pow(1.00000+ ALGEBRAIC[6]*(exp(- (CONSTANTS[12] - 1.00000)) - 1.00000), 2.00000);
ALGEBRAIC[1] = STATES[0]/CONSTANTS[0];
ALGEBRAIC[2] = STATES[1]/CONSTANTS[0];
ALGEBRAIC[3] = STATES[2]/(STATES[0]+STATES[1]+STATES[2]);
ALGEBRAIC[4] = ALGEBRAIC[0]/CONSTANTS[0];
}