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 3 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 11 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * STATES[0] is PRL in component PRL (nanog_ml). * CONSTANTS[0] is kD in component PRL (nanog_ml). * CONSTANTS[1] is kO in component PRL (picog_ml). * CONSTANTS[2] is rP in component PRL (nanog_ml_hr). * CONSTANTS[3] is qP in component PRL (first_order_rate_constant). * STATES[1] is OT in component OT (picog_ml). * STATES[2] is DA in component DA (nanog_ml). * ALGEBRAIC[0] is vD in component DA (nanog_ml_hr). * CONSTANTS[4] is vDbar in component DA (nanog_ml_hr). * CONSTANTS[5] is DA_infinity in component DA (nanog_ml). * CONSTANTS[6] is qD in component DA (first_order_rate_constant). * CONSTANTS[7] is kx in component OT (picog_ml). * ALGEBRAIC[1] is vO in component OT (picog_ml_hr). * CONSTANTS[8] is vObar in component OT (picog_ml_hr). * CONSTANTS[9] is rO in component OT (picog_ml_hr). * CONSTANTS[10] is qO in component OT (first_order_rate_constant). * ALGEBRAIC[2] is x in component x (picog_ml). * RATES[0] is d/dt PRL in component PRL (nanog_ml). * RATES[2] is d/dt DA in component DA (nanog_ml). * RATES[1] is d/dt OT in component OT (picog_ml). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 20.0; CONSTANTS[0] = 300.0; CONSTANTS[1] = 9.0; CONSTANTS[2] = 300000.0; CONSTANTS[3] = 0.5; STATES[1] = 25.0; STATES[2] = 20000.0; CONSTANTS[4] = 10000.0; CONSTANTS[5] = 20000.0; CONSTANTS[6] = 0.2; CONSTANTS[7] = 50.0; CONSTANTS[8] = 500.0; CONSTANTS[9] = 1100.0; CONSTANTS[10] = 1.0; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = CONSTANTS[2]*(1.00000/(CONSTANTS[0]+STATES[2]))*pow(STATES[1]/(CONSTANTS[1]+STATES[1]), 2.00000) - CONSTANTS[3]*STATES[0]; ALGEBRAIC[0] = (VOI>=2.00000&&VOI<=4.00000 ? CONSTANTS[4] : 0.00000); RATES[2] = CONSTANTS[6]*(CONSTANTS[5] - STATES[2]) - ALGEBRAIC[0]; ALGEBRAIC[1] = (VOI>=2.00000&&VOI<=4.00000 ? CONSTANTS[8] : 0.00000); ALGEBRAIC[2] = (VOI>=2.00000&&VOI<=4.00000 ? 51.0000 : VOI>=16.0000&&VOI<=18.0000 ? 51.0000 : 1.00000); RATES[1] = CONSTANTS[9]*(ALGEBRAIC[2]/(CONSTANTS[7]+ALGEBRAIC[2])) - ( CONSTANTS[10]*STATES[1]+ALGEBRAIC[1]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI>=2.00000&&VOI<=4.00000 ? CONSTANTS[4] : 0.00000); ALGEBRAIC[1] = (VOI>=2.00000&&VOI<=4.00000 ? CONSTANTS[8] : 0.00000); ALGEBRAIC[2] = (VOI>=2.00000&&VOI<=4.00000 ? 51.0000 : VOI>=16.0000&&VOI<=18.0000 ? 51.0000 : 1.00000); }