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 0 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 19 entries in the constant variable array. */ /* * VOI is time in component environment (minute). * CONSTANTS[15] is C in component C (nanomolar). * CONSTANTS[0] is kf1 in component model_parameters (second_order_rate_constant). * CONSTANTS[12] is kr1 in component model_parameters (first_order_rate_constant). * CONSTANTS[13] is k_x1 in component model_parameters (first_order_rate_constant). * CONSTANTS[1] is kt in component model_parameters (first_order_rate_constant). * CONSTANTS[2] is ke in component model_parameters (first_order_rate_constant). * CONSTANTS[3] is L in component model_parameters (nanomolar). * CONSTANTS[16] is R in component R (nanomolar). * CONSTANTS[14] is K_X in component D (per_nanomolar). * CONSTANTS[17] is D in component D (nanomolar). * CONSTANTS[4] is kx2 in component model_parameters (second_order_rate_constant). * CONSTANTS[5] is k_x2 in component model_parameters (first_order_rate_constant). * CONSTANTS[6] is R_initial in component R (nanomolar). * CONSTANTS[7] is krec in component model_parameters (first_order_rate_constant). * CONSTANTS[8] is kdeg in component model_parameters (first_order_rate_constant). * STATES[0] is Ri in component Ri (nanomolar). * CONSTANTS[18] is signal in component signal (dimensionless). * CONSTANTS[9] is kappaE in component model_parameters (dimensionless). * CONSTANTS[10] is Vs in component model_parameters (flux). * CONSTANTS[11] is KD in component model_parameters (nanomolar). * RATES[0] is d/dt Ri in component Ri (nanomolar). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 0.1; CONSTANTS[1] = 0.005; CONSTANTS[2] = 0.10; CONSTANTS[3] = 0.01; CONSTANTS[4] = 4.83; CONSTANTS[5] = 0.016; CONSTANTS[6] = 2000.0; CONSTANTS[7] = 0.0; CONSTANTS[8] = 0.05; STATES[0] = 200.0; CONSTANTS[9] = 0.20; CONSTANTS[10] = 10.0; CONSTANTS[11] = 1.0; CONSTANTS[12] = CONSTANTS[11]*CONSTANTS[0]; CONSTANTS[13] = 0.0100000*CONSTANTS[12]; CONSTANTS[14] = CONSTANTS[4]/(CONSTANTS[5]+CONSTANTS[13]+CONSTANTS[2]); rootfind_0(VOI, CONSTANTS, RATES, STATES, ALGEBRAIC, pret); CONSTANTS[18] = (( 2.00000*CONSTANTS[17])/200.000)/(CONSTANTS[9]+( 2.00000*CONSTANTS[17])/200.000); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = CONSTANTS[1]*(CONSTANTS[16]+CONSTANTS[15]) - (CONSTANTS[7]+CONSTANTS[8])*STATES[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void objfunc_0(double *p, double *hx, int m, int n, void *adata) { struct rootfind_info* rfi = (struct rootfind_info*)adata; #define VOI rfi->aVOI #define CONSTANTS rfi->aCONSTANTS #define RATES rfi->aRATES #define STATES rfi->aSTATES #define ALGEBRAIC rfi->aALGEBRAIC #define pret rfi->aPRET CONSTANTS[15] = p[0]; CONSTANTS[16] = p[1]; CONSTANTS[17] = p[2]; hx[0] = CONSTANTS[15] - ( CONSTANTS[0]*CONSTANTS[3]*CONSTANTS[16])/(CONSTANTS[12]+CONSTANTS[1]+ (CONSTANTS[13]+CONSTANTS[2])*CONSTANTS[14]*CONSTANTS[16]); hx[1] = CONSTANTS[17] - CONSTANTS[14]*CONSTANTS[16]*CONSTANTS[15]; hx[2] = CONSTANTS[16] - (CONSTANTS[6] - (CONSTANTS[15]+ 2.00000*(CONSTANTS[2]/CONSTANTS[1])*(1.00000+CONSTANTS[7]/CONSTANTS[8])*CONSTANTS[17])); #undef VOI #undef CONSTANTS #undef RATES #undef STATES #undef ALGEBRAIC #undef pret } void rootfind_0(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC, int* pret) { static double p[3] = {0.1,0.1,0.1}; double bp[3], work[LM_DIF_WORKSZ(3, 3)]; struct rootfind_info rfi; rfi.aVOI = VOI; rfi.aCONSTANTS = CONSTANTS; rfi.aRATES = RATES; rfi.aSTATES = STATES; rfi.aALGEBRAIC = ALGEBRAIC; rfi.aPRET = pret; do_levmar(objfunc_0, p, bp, work, pret, 3, &rfi); CONSTANTS[15] = p[0]; CONSTANTS[16] = p[1]; CONSTANTS[17] = p[2]; }