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 7 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 6 entries in the constant variable array. */ /* * VOI is t in component main (second). * CONSTANTS[0] is RT in component main (J_per_mol). * STATES[0] is q_1 in component main (mole). * STATES[1] is q_2 in component main (mole). * STATES[2] is q_3 in component main (mole). * STATES[3] is q_4 in component main (mole). * ALGEBRAIC[6] is v_r in component main (mol_per_s). * ALGEBRAIC[0] is u_1 in component main (J_per_mol). * ALGEBRAIC[1] is u_2 in component main (J_per_mol). * ALGEBRAIC[2] is u_3 in component main (J_per_mol). * ALGEBRAIC[3] is u_4 in component main (J_per_mol). * ALGEBRAIC[4] is u_f in component main (J_per_mol). * ALGEBRAIC[5] is u_r in component main (J_per_mol). * CONSTANTS[1] is K_q_1 in component main (per_mol). * CONSTANTS[2] is K_q_2 in component main (per_mol). * CONSTANTS[3] is K_q_3 in component main (per_mol). * CONSTANTS[4] is K_q_4 in component main (per_mol). * CONSTANTS[5] is kappa_r in component main (mol_per_s). * RATES[0] is d/dt q_1 in component main (mole). * RATES[1] is d/dt q_2 in component main (mole). * RATES[2] is d/dt q_3 in component main (mole). * RATES[3] is d/dt q_4 in component main (mole). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 2578.73058; STATES[0] = 1; STATES[1] = 1; STATES[2] = 0; STATES[3] = 0; CONSTANTS[1] = 2; CONSTANTS[2] = 2; CONSTANTS[3] = 2; CONSTANTS[4] = 2; CONSTANTS[5] = 0.1; 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] - - ALGEBRAIC[6]; resid[1] = RATES[1] - - 2.00000*ALGEBRAIC[6]; resid[2] = RATES[2] - ALGEBRAIC[6]; resid[3] = RATES[3] - 2.00000*ALGEBRAIC[6]; } 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] = CONSTANTS[0]*log( CONSTANTS[1]*STATES[0]); ALGEBRAIC[1] = CONSTANTS[0]*log( CONSTANTS[2]*STATES[1]); ALGEBRAIC[4] = ALGEBRAIC[0]+ 2.00000*ALGEBRAIC[1]; ALGEBRAIC[2] = CONSTANTS[0]*log( CONSTANTS[3]*STATES[2]); ALGEBRAIC[3] = CONSTANTS[0]*log( CONSTANTS[4]*STATES[3]); ALGEBRAIC[5] = ALGEBRAIC[2]+ 2.00000*ALGEBRAIC[3]; ALGEBRAIC[6] = CONSTANTS[5]*(exp(ALGEBRAIC[4]/CONSTANTS[0]) - exp(ALGEBRAIC[5]/CONSTANTS[0])); } 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) { }