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 12 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 11 entries in the constant variable array. */ /* * VOI is time in component environment (minute). * CONSTANTS[0] is VP in component red_cells_and_viscosity (litre). * STATES[0] is VRC in component RBC_volume (litre). * ALGEBRAIC[2] is HM in component hematocrit_fraction (dimensionless). * ALGEBRAIC[1] is HM1 in component hematocrit_fraction (dimensionless). * ALGEBRAIC[0] is VB in component hematocrit_fraction (litre). * ALGEBRAIC[3] is VIE in component viscosity_due_to_RBCs (dimensionless). * CONSTANTS[1] is HMK in component parameter_values (dimensionless). * CONSTANTS[2] is HKM in component parameter_values (dimensionless). * ALGEBRAIC[5] is VIM in component blood_viscosity (dimensionless). * ALGEBRAIC[4] is VIB in component blood_viscosity (dimensionless). * ALGEBRAIC[8] is HM7 in component oxygen_stimulation (mmHg). * CONSTANTS[3] is PO2AMB in component parameter_values (mmHg). * CONSTANTS[4] is HM6 in component parameter_values (mmHg). * CONSTANTS[9] is PO2AM1 in component oxygen_stimulation (mmHg). * ALGEBRAIC[6] is HM3 in component oxygen_stimulation (mmHg). * CONSTANTS[10] is HM4 in component oxygen_stimulation (mmHg). * ALGEBRAIC[7] is HM5 in component oxygen_stimulation (mmHg). * ALGEBRAIC[9] is RC1 in component RBC_production (L_per_minute). * CONSTANTS[5] is HM8 in component parameter_values (L_per_minute_per_mmHg). * CONSTANTS[6] is REK in component parameter_values (dimensionless). * ALGEBRAIC[10] is RC2 in component RBC_destruction (L_per_minute). * CONSTANTS[7] is RKC in component parameter_values (per_minute). * CONSTANTS[8] is TRRBC in component parameter_values (L_per_minute). * ALGEBRAIC[11] is RCD in component RBC_volume (L_per_minute). * RATES[0] is d/dt VRC in component RBC_volume (litre). * There are a total of 2 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 3.00449; STATES[0] = 2.00439; CONSTANTS[1] = 90; CONSTANTS[2] = 0.53333; CONSTANTS[3] = 150; CONSTANTS[4] = 1850; CONSTANTS[5] = 4.714e-08; CONSTANTS[6] = 1; CONSTANTS[7] = 5.8e-06; CONSTANTS[8] = 0; CONSTANTS[9] = (CONSTANTS[3]>80.0000 ? 80.0000 : CONSTANTS[3]); CONSTANTS[10] = CONSTANTS[3] - 40.0000; RATES[0] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - ALGEBRAIC[11]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = CONSTANTS[0]+STATES[0]; ALGEBRAIC[1] = STATES[0]/ALGEBRAIC[0]; ALGEBRAIC[2] = 100.000*ALGEBRAIC[1]; ALGEBRAIC[6] = (CONSTANTS[9] - 40.0000)*ALGEBRAIC[2]; ALGEBRAIC[7] = (CONDVAR[0]<0.00000 ? 0.00000 : ALGEBRAIC[6]+CONSTANTS[10]); ALGEBRAIC[8] = CONSTANTS[4] - ALGEBRAIC[7]; ALGEBRAIC[9] = (CONDVAR[1]<0.00000 ? 0.00000 : ALGEBRAIC[8]*CONSTANTS[5]*CONSTANTS[6]+5.00000e-06); ALGEBRAIC[3] = ALGEBRAIC[2]/( (CONSTANTS[1] - ALGEBRAIC[2])*CONSTANTS[2]); ALGEBRAIC[4] = ALGEBRAIC[3]+1.50000; ALGEBRAIC[5] = 0.333300*ALGEBRAIC[4]; ALGEBRAIC[10] = STATES[0]*CONSTANTS[7]*ALGEBRAIC[5]; ALGEBRAIC[11] = (ALGEBRAIC[9] - ALGEBRAIC[10])+CONSTANTS[8]; } void getStateInformation(double* SI) { SI[0] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = (ALGEBRAIC[6]+CONSTANTS[10]) - 0.00000; CONDVAR[1] = ( ALGEBRAIC[8]*CONSTANTS[5]*CONSTANTS[6]+5.00000e-06) - 0.00000; }