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 2 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 8 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * STATES[0] is R in component R (pg_ml). * CONSTANTS[0] is L_ in component R (ng_ml). * CONSTANTS[1] is T_ in component R (ng_ml). * CONSTANTS[2] is dR in component R (first_order_rate_constant). * CONSTANTS[3] is rR in component R (ng_ml_min). * ALGEBRAIC[1] is H in component R (dimensionless). * ALGEBRAIC[0] is x in component R (dimensionless). * STATES[1] is L in component L (ng_ml). * STATES[2] is T in component T (ng_ml). * CONSTANTS[4] is dL in component L (first_order_rate_constant). * CONSTANTS[5] is rL in component L (first_order_rate_constant). * CONSTANTS[6] is dT in component T (first_order_rate_constant). * CONSTANTS[7] is rT in component T (first_order_rate_constant). * RATES[0] is d/dt R in component R (pg_ml). * RATES[1] is d/dt L in component L (ng_ml). * RATES[2] is d/dt T in component T (ng_ml). * There are a total of 2 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.0; CONSTANTS[0] = 30.0; CONSTANTS[1] = 8.0; CONSTANTS[2] = 0.10; CONSTANTS[3] = 0.1; STATES[1] = 10.0; STATES[2] = 12.0; CONSTANTS[4] = 0.015; CONSTANTS[5] = 5.0; CONSTANTS[6] = 0.023; CONSTANTS[7] = 0.01; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 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[3]*ALGEBRAIC[1] - CONSTANTS[2]*STATES[0]; resid[1] = RATES[1] - CONSTANTS[5]*STATES[0] - CONSTANTS[4]*STATES[1]; resid[2] = RATES[2] - CONSTANTS[7]*STATES[1] - CONSTANTS[6]*STATES[2]; } 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] = 2.00000 - (STATES[1]/CONSTANTS[0]+STATES[2]/CONSTANTS[1]); ALGEBRAIC[1] = (CONDVAR[0]<0.00000 ? 0.00000 : ALGEBRAIC[0]==0.00000 ? 0.500000 : CONDVAR[1]>0.00000 ? 1.00000 : 0.0/0.0); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = ALGEBRAIC[0] - 0.00000; CONDVAR[1] = ALGEBRAIC[0] - 0.00000; }