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 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 4 entries in the constant variable array. */ /* * VOI is time in component environment (second). * STATES[0] is x1 in component insulin (nanomolar). * ALGEBRAIC[0] is scatchard in component insulin (dimensionless). * CONSTANTS[0] is k1 in component rate_constants (second_order_rate_constant). * CONSTANTS[1] is k1_ in component rate_constants (first_order_rate_constant). * CONSTANTS[2] is k2_ in component rate_constants (first_order_rate_constant). * STATES[1] is x2 in component unbound_receptor (nanomolar). * STATES[2] is x3 in component single_bound_receptor (nanomolar). * STATES[3] is x4 in component double_bound_receptor (nanomolar). * CONSTANTS[3] is k2 in component rate_constants (second_order_rate_constant). * RATES[0] is d/dt x1 in component insulin (nanomolar). * RATES[1] is d/dt x2 in component unbound_receptor (nanomolar). * RATES[2] is d/dt x3 in component single_bound_receptor (nanomolar). * RATES[3] is d/dt x4 in component double_bound_receptor (nanomolar). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1000; CONSTANTS[0] = 1000000; CONSTANTS[1] = 0.0004; CONSTANTS[2] = 0.04; STATES[1] = 0.1; STATES[2] = 0.0; STATES[3] = 0.0; CONSTANTS[3] = 1000000; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 0.1001; RATES[3] = 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]*STATES[2] - CONSTANTS[0]*STATES[0]*STATES[1])+ CONSTANTS[2]*STATES[3]) - CONSTANTS[3]*STATES[0]*STATES[2]; resid[1] = RATES[1] - CONSTANTS[1]*STATES[2] - CONSTANTS[0]*STATES[0]*STATES[1]; resid[2] = RATES[2] - (( CONSTANTS[0]*STATES[0]*STATES[1] - CONSTANTS[1]*STATES[2])+ CONSTANTS[2]*STATES[3]) - CONSTANTS[3]*STATES[0]*STATES[2]; resid[3] = RATES[3] - CONSTANTS[3]*STATES[0]*STATES[2] - CONSTANTS[2]*STATES[3]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (STATES[2]+STATES[3])/STATES[0]; } 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; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }