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 1 entries in the algebraic variable array. There are a total of 4 entries in each of the rate and state variable arrays. There are a total of 5 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * ALGEBRAIC[0] is GnRH in component GnRH (nanomolar). * STATES[0] is F in component F (dimensionless). * CONSTANTS[0] is kfb in component model_parameters (second_order_rate_constant). * CONSTANTS[1] is kbf in component model_parameters (first_order_rate_constant). * STATES[1] is B in component B (dimensionless). * STATES[2] is R in component R (dimensionless). * CONSTANTS[2] is s in component model_parameters (first_order_rate_constant). * CONSTANTS[3] is a1 in component model_parameters (first_order_rate_constant). * CONSTANTS[4] is a2 in component model_parameters (first_order_rate_constant). * STATES[3] is C in component C (dimensionless). * RATES[0] is d/dt F in component F (dimensionless). * RATES[1] is d/dt B in component B (dimensionless). * RATES[2] is d/dt R in component R (dimensionless). * RATES[3] is d/dt C in component C (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1.0; CONSTANTS[0] = 19.35; CONSTANTS[1] = 9.91; STATES[1] = 0.0; STATES[2] = 2115.0; CONSTANTS[2] = 6.80; CONSTANTS[3] = 0.0328; CONSTANTS[4] = 0.0830; STATES[3] = 0.0; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[2] = CONSTANTS[2] - (CONSTANTS[3]+ CONSTANTS[4]*STATES[1])*STATES[2]; RATES[3] = (CONSTANTS[3]+ CONSTANTS[4]*STATES[1])*STATES[2]; ALGEBRAIC[0] = (VOI>=0.00000&&VOI<0.0666667 ? 0.500000 : VOI>=0.0666667&&VOI<0.400000 ? 0.00000 : VOI>=0.400000&&VOI<0.466667 ? 0.500000 : VOI>=0.466667&&VOI<2.46667 ? 0.00000 : VOI>=2.46667&&VOI<2.53333 ? 0.500000 : VOI>=2.53333&&VOI<2.61667 ? 0.00000 : VOI>=2.61667&&VOI<2.68333 ? 0.500000 : VOI>=2.68333&&VOI<4.68333 ? 0.00000 : VOI>=4.68333&&VOI<4.75000 ? 0.500000 : VOI>=4.75000&&VOI<4.91667 ? 0.00000 : VOI>=4.91667&&VOI<4.98333 ? 0.500000 : VOI>=4.98333&&VOI<6.98333 ? 0.00000 : VOI>=6.98333&&VOI<7.06667 ? 0.500000 : VOI>=7.06667&&VOI<7.73333 ? 0.00000 : VOI>=7.73333&&VOI<7.80000 ? 0.500000 : VOI>=7.80000&&VOI<9.80000 ? 0.00000 : 0.0/0.0); RATES[0] = CONSTANTS[1]*STATES[1] - CONSTANTS[0]*STATES[0]*ALGEBRAIC[0]; RATES[1] = CONSTANTS[0]*STATES[0]*ALGEBRAIC[0] - CONSTANTS[1]*STATES[1]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI>=0.00000&&VOI<0.0666667 ? 0.500000 : VOI>=0.0666667&&VOI<0.400000 ? 0.00000 : VOI>=0.400000&&VOI<0.466667 ? 0.500000 : VOI>=0.466667&&VOI<2.46667 ? 0.00000 : VOI>=2.46667&&VOI<2.53333 ? 0.500000 : VOI>=2.53333&&VOI<2.61667 ? 0.00000 : VOI>=2.61667&&VOI<2.68333 ? 0.500000 : VOI>=2.68333&&VOI<4.68333 ? 0.00000 : VOI>=4.68333&&VOI<4.75000 ? 0.500000 : VOI>=4.75000&&VOI<4.91667 ? 0.00000 : VOI>=4.91667&&VOI<4.98333 ? 0.500000 : VOI>=4.98333&&VOI<6.98333 ? 0.00000 : VOI>=6.98333&&VOI<7.06667 ? 0.500000 : VOI>=7.06667&&VOI<7.73333 ? 0.00000 : VOI>=7.73333&&VOI<7.80000 ? 0.500000 : VOI>=7.80000&&VOI<9.80000 ? 0.00000 : 0.0/0.0); }