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 3 entries in each of the rate and state variable arrays. There are a total of 4 entries in the constant variable array. */ /* * STATES[0] is C in component MultienvironmentExampleComponent (uM). * STATES[1] is D in component MultienvironmentExampleComponent (per_um2). * STATES[2] is E in component MultienvironmentExampleComponent (per_um2). * CONSTANTS[0] is kf in component MultienvironmentExampleComponent (per_uM_per_s). * CONSTANTS[1] is kr in component MultienvironmentExampleComponent (per_s). * ALGEBRAIC[0] is J in component MultienvironmentExampleComponent (per_um2_per_s). * VOI is t in component MultienvironmentExampleComponent (second). * CONSTANTS[2] is R in component MultienvironmentExampleComponent (per_um). * CONSTANTS[3] is Cpc in component MultienvironmentExampleComponent (uM_um2). * RATES[0] is d/dt C in component MultienvironmentExampleComponent (uM). * RATES[1] is d/dt D in component MultienvironmentExampleComponent (per_um2). * RATES[2] is d/dt E in component MultienvironmentExampleComponent (per_um2). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 200; STATES[1] = 4; STATES[2] = 0; CONSTANTS[0] = 6e-3; CONSTANTS[1] = 1e-3; CONSTANTS[2] = 5; CONSTANTS[3] = CONSTANTS[2]/602.200; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = STATES[0]*STATES[1]*CONSTANTS[0] - CONSTANTS[1]*STATES[2]; RATES[0] = - CONSTANTS[3]*ALGEBRAIC[0]; RATES[1] = - ALGEBRAIC[0]; RATES[2] = ALGEBRAIC[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = STATES[0]*STATES[1]*CONSTANTS[0] - CONSTANTS[1]*STATES[2]; }