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 13 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 14 entries in the constant variable array. */ /* * VOI is time in component environment (second). * ALGEBRAIC[4] is phi3_c1 in component phi (per_second). * STATES[0] is h1 in component h1 (dimensionless). * ALGEBRAIC[0] is phi1_c1 in component phi (second_order_rate). * ALGEBRAIC[2] is phi2_c1 in component phi (per_second). * CONSTANTS[0] is p in component model_parameters (micro_molar). * ALGEBRAIC[1] is phi_1_c1 in component phi (per_second). * ALGEBRAIC[8] is phi3_c2 in component phi (per_second). * STATES[1] is h2 in component h2 (dimensionless). * ALGEBRAIC[3] is phi1_c2 in component phi (second_order_rate). * ALGEBRAIC[6] is phi2_c2 in component phi (per_second). * ALGEBRAIC[5] is phi_1_c2 in component phi (per_second). * CONSTANTS[1] is r2 in component model_parameters (second_order_rate). * CONSTANTS[2] is R1 in component model_parameters (micro_molar). * CONSTANTS[3] is k1 in component model_parameters (micro_molar_per_second). * CONSTANTS[4] is R3 in component model_parameters (micro_molar). * CONSTANTS[5] is k2 in component model_parameters (micro_molar_per_second). * CONSTANTS[6] is r4 in component model_parameters (per_second). * CONSTANTS[7] is k3 in component model_parameters (micro_molar_per_second). * CONSTANTS[8] is R5 in component model_parameters (micro_molar). * STATES[2] is c1 in component c1 (micro_molar). * STATES[3] is c2 in component c2 (micro_molar). * CONSTANTS[9] is Vp in component model_parameters (micro_molar_per_second). * CONSTANTS[10] is Kp in component model_parameters (micro_molar). * ALGEBRAIC[7] is j_pump_c1 in component j_pump (micro_molar_per_second). * ALGEBRAIC[9] is j_pump_c2 in component j_pump (micro_molar_per_second). * CONSTANTS[11] is kf in component model_parameters (micro_molar_per_second). * ALGEBRAIC[10] is j_receptor_c1 in component j_receptor (micro_molar_per_second). * ALGEBRAIC[11] is j_receptor_c2 in component j_receptor (micro_molar_per_second). * ALGEBRAIC[12] is j_diffusion in component j_diffusion (micro_molar_per_second). * CONSTANTS[12] is D in component model_parameters (per_second). * CONSTANTS[13] is j_leak in component model_parameters (micro_molar_per_second). * RATES[0] is d/dt h1 in component h1 (dimensionless). * RATES[1] is d/dt h2 in component h2 (dimensionless). * RATES[2] is d/dt c1 in component c1 (micro_molar). * RATES[3] is d/dt c2 in component c2 (micro_molar). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.8; CONSTANTS[0] = 0.2778; STATES[1] = 0.1; CONSTANTS[1] = 100; CONSTANTS[2] = 6; CONSTANTS[3] = 44; CONSTANTS[4] = 50; CONSTANTS[5] = 26.5; CONSTANTS[6] = 20; CONSTANTS[7] = 1.6; CONSTANTS[8] = 1.6; STATES[2] = 0.3; STATES[3] = 0.1; CONSTANTS[9] = 1.2; CONSTANTS[10] = 0.18; CONSTANTS[11] = 28; CONSTANTS[12] = 0.01; CONSTANTS[13] = 0.2; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[4] = CONSTANTS[7]/(CONSTANTS[8]+STATES[2]); ALGEBRAIC[0] = ( CONSTANTS[1]*STATES[2])/(CONSTANTS[2]+STATES[2]); ALGEBRAIC[2] = (CONSTANTS[5]+ CONSTANTS[6]*STATES[2])/(CONSTANTS[4]+STATES[2]); ALGEBRAIC[1] = CONSTANTS[3]/(CONSTANTS[4]+STATES[2]); RATES[0] = ALGEBRAIC[4]*(1.00000 - STATES[0]) - ( ALGEBRAIC[0]*ALGEBRAIC[2]*STATES[0]*CONSTANTS[0])/( ALGEBRAIC[0]*CONSTANTS[0]+ALGEBRAIC[1]); ALGEBRAIC[8] = CONSTANTS[7]/(CONSTANTS[8]+STATES[3]); ALGEBRAIC[3] = ( CONSTANTS[1]*STATES[3])/(CONSTANTS[2]+STATES[3]); ALGEBRAIC[6] = (CONSTANTS[5]+ CONSTANTS[6]*STATES[3])/(CONSTANTS[4]+STATES[3]); ALGEBRAIC[5] = CONSTANTS[3]/(CONSTANTS[4]+STATES[3]); RATES[1] = ALGEBRAIC[8]*(1.00000 - STATES[1]) - ( ALGEBRAIC[3]*ALGEBRAIC[6]*STATES[1]*CONSTANTS[0])/( ALGEBRAIC[3]*CONSTANTS[0]+ALGEBRAIC[5]); ALGEBRAIC[7] = ( CONSTANTS[9]*pow(STATES[2], 2.00000))/(pow(CONSTANTS[10], 2.00000)+pow(STATES[2], 2.00000)); ALGEBRAIC[10] = CONSTANTS[11]*pow(( CONSTANTS[0]*STATES[0]*ALGEBRAIC[0])/( ALGEBRAIC[0]*CONSTANTS[0]+ALGEBRAIC[1]), 4.00000); ALGEBRAIC[12] = CONSTANTS[12]*(STATES[3] - STATES[2]); RATES[2] = (ALGEBRAIC[10] - ALGEBRAIC[7])+CONSTANTS[13]+ALGEBRAIC[12]; ALGEBRAIC[9] = ( CONSTANTS[9]*pow(STATES[3], 2.00000))/(pow(CONSTANTS[10], 2.00000)+pow(STATES[3], 2.00000)); ALGEBRAIC[11] = CONSTANTS[11]*pow(( CONSTANTS[0]*STATES[1]*ALGEBRAIC[3])/( ALGEBRAIC[3]*CONSTANTS[0]+ALGEBRAIC[5]), 4.00000); RATES[3] = (ALGEBRAIC[11] - ALGEBRAIC[9])+CONSTANTS[13]+ALGEBRAIC[12]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[4] = CONSTANTS[7]/(CONSTANTS[8]+STATES[2]); ALGEBRAIC[0] = ( CONSTANTS[1]*STATES[2])/(CONSTANTS[2]+STATES[2]); ALGEBRAIC[2] = (CONSTANTS[5]+ CONSTANTS[6]*STATES[2])/(CONSTANTS[4]+STATES[2]); ALGEBRAIC[1] = CONSTANTS[3]/(CONSTANTS[4]+STATES[2]); ALGEBRAIC[8] = CONSTANTS[7]/(CONSTANTS[8]+STATES[3]); ALGEBRAIC[3] = ( CONSTANTS[1]*STATES[3])/(CONSTANTS[2]+STATES[3]); ALGEBRAIC[6] = (CONSTANTS[5]+ CONSTANTS[6]*STATES[3])/(CONSTANTS[4]+STATES[3]); ALGEBRAIC[5] = CONSTANTS[3]/(CONSTANTS[4]+STATES[3]); ALGEBRAIC[7] = ( CONSTANTS[9]*pow(STATES[2], 2.00000))/(pow(CONSTANTS[10], 2.00000)+pow(STATES[2], 2.00000)); ALGEBRAIC[10] = CONSTANTS[11]*pow(( CONSTANTS[0]*STATES[0]*ALGEBRAIC[0])/( ALGEBRAIC[0]*CONSTANTS[0]+ALGEBRAIC[1]), 4.00000); ALGEBRAIC[12] = CONSTANTS[12]*(STATES[3] - STATES[2]); ALGEBRAIC[9] = ( CONSTANTS[9]*pow(STATES[3], 2.00000))/(pow(CONSTANTS[10], 2.00000)+pow(STATES[3], 2.00000)); ALGEBRAIC[11] = CONSTANTS[11]*pow(( CONSTANTS[0]*STATES[1]*ALGEBRAIC[3])/( ALGEBRAIC[3]*CONSTANTS[0]+ALGEBRAIC[5]), 4.00000); }