Generated Code
The following is c_ida 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 5 entries in each of the rate and state variable arrays. There are a total of 13 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * STATES[0] is Y in component Y (dimensionless). * CONSTANTS[0] is C1 in component model_parameters (dimensionless). * CONSTANTS[1] is k1 in component model_parameters (first_order_rate_constant). * STATES[1] is P in component P (dimensionless). * CONSTANTS[2] is K in component model_parameters (dimensionless). * CONSTANTS[3] is C in component model_parameters (dimensionless). * CONSTANTS[4] is C2 in component model_parameters (dimensionless). * CONSTANTS[5] is k2 in component model_parameters (first_order_rate_constant). * CONSTANTS[6] is ky in component model_parameters (first_order_rate_constant). * STATES[2] is X in component X (dimensionless). * CONSTANTS[7] is k3 in component model_parameters (first_order_rate_constant). * CONSTANTS[8] is k4 in component model_parameters (first_order_rate_constant). * STATES[3] is Z in component Z (dimensionless). * CONSTANTS[9] is C3 in component model_parameters (dimensionless). * CONSTANTS[10] is k5 in component model_parameters (first_order_rate_constant). * CONSTANTS[11] is K2 in component model_parameters (dimensionless). * STATES[4] is IL6 in component IL6 (dimensionless). * CONSTANTS[12] is k6 in component model_parameters (first_order_rate_constant). * RATES[0] is d/dt Y in component Y (dimensionless). * RATES[2] is d/dt X in component X (dimensionless). * RATES[1] is d/dt P in component P (dimensionless). * RATES[3] is d/dt Z in component Z (dimensionless). * RATES[4] is d/dt IL6 in component IL6 (dimensionless). * There are a total of 32 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 10.0; CONSTANTS[0] = 1.0; CONSTANTS[1] = 1.0; STATES[1] = 10.0; CONSTANTS[2] = 5.0; CONSTANTS[3] = 50.0; CONSTANTS[4] = 1.0; CONSTANTS[5] = 1.3; CONSTANTS[6] = 0.01; STATES[2] = 500.0; CONSTANTS[7] = 0.05; CONSTANTS[8] = 0.9; STATES[3] = 200.0; CONSTANTS[9] = 1.0; CONSTANTS[10] = 5.0; CONSTANTS[11] = 2.0; STATES[4] = 1.9; CONSTANTS[12] = 0.02; RATES[0] = 0.1001; RATES[2] = 0.1001; RATES[1] = 0.1001; RATES[3] = 0.1001; RATES[4] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - CONSTANTS[1]*CONSTANTS[0]*(STATES[1]/(CONSTANTS[2]+STATES[1]))*CONSTANTS[3] - ( CONSTANTS[5]*CONSTANTS[4]*(1.00000 - STATES[1]/(CONSTANTS[2]+STATES[1]))*STATES[0]+ CONSTANTS[6]*STATES[0]); resid[1] = RATES[2] - CONSTANTS[5]*CONSTANTS[4]*(1.00000 - STATES[1]/(CONSTANTS[2]+STATES[1]))*STATES[0] - CONSTANTS[7]*STATES[2]; resid[2] = RATES[1] - (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[2]>=0.00000&&CONDVAR[3]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[4]>=0.00000&&CONDVAR[5]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[6]>=0.00000&&CONDVAR[7]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[8]>=0.00000&&CONDVAR[9]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[10]>=0.00000&&CONDVAR[11]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[12]>=0.00000&&CONDVAR[13]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[14]>=0.00000&&CONDVAR[15]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[16]>=0.00000&&CONDVAR[17]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[18]>=0.00000&&CONDVAR[19]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[20]>=0.00000&&CONDVAR[21]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[22]>=0.00000&&CONDVAR[23]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[24]>=0.00000&&CONDVAR[25]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[26]>=0.00000&&CONDVAR[27]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : CONDVAR[28]>=0.00000&&CONDVAR[29]<0.00000 ? 10.0000 - CONSTANTS[8]*STATES[1] : CONDVAR[30]>=0.00000&&CONDVAR[31]<0.00000 ? - ( CONSTANTS[8]*STATES[1]) : 0.0/0.0); resid[3] = RATES[3] - CONSTANTS[10]*CONSTANTS[9]*(STATES[4]/(CONSTANTS[11]+STATES[4])) - CONSTANTS[12]*STATES[3]; resid[4] = RATES[4] - 0.100000*STATES[2] - 10.0000*STATES[4]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = VOI - 0.00000; CONDVAR[1] = VOI - 6.00000; CONDVAR[2] = VOI - 6.00000; CONDVAR[3] = VOI - 12.0000; CONDVAR[4] = VOI - 12.0000; CONDVAR[5] = VOI - 18.0000; CONDVAR[6] = VOI - 18.0000; CONDVAR[7] = VOI - 24.0000; CONDVAR[8] = VOI - 24.0000; CONDVAR[9] = VOI - 30.0000; CONDVAR[10] = VOI - 30.0000; CONDVAR[11] = VOI - 36.0000; CONDVAR[12] = VOI - 36.0000; CONDVAR[13] = VOI - 42.0000; CONDVAR[14] = VOI - 42.0000; CONDVAR[15] = VOI - 48.0000; CONDVAR[16] = VOI - 48.0000; CONDVAR[17] = VOI - 54.0000; CONDVAR[18] = VOI - 54.0000; CONDVAR[19] = VOI - 60.0000; CONDVAR[20] = VOI - 60.0000; CONDVAR[21] = VOI - 66.0000; CONDVAR[22] = VOI - 66.0000; CONDVAR[23] = VOI - 72.0000; CONDVAR[24] = VOI - 72.0000; CONDVAR[25] = VOI - 78.0000; CONDVAR[26] = VOI - 78.0000; CONDVAR[27] = VOI - 84.0000; CONDVAR[28] = VOI - 84.0000; CONDVAR[29] = VOI - 90.0000; CONDVAR[30] = VOI - 90.0000; CONDVAR[31] = VOI - 96.0000; }