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 8 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 17 entries in the constant variable array. */ /* * VOI is time in component environment (minute). * CONSTANTS[0] is AMK in component electrolytes (dimensionless). * CONSTANTS[1] is TVD in component electrolytes (L_per_minute). * CONSTANTS[2] is NOD in component electrolytes (monovalent_mEq_per_minute). * CONSTANTS[3] is STH in component electrolytes (dimensionless). * CONSTANTS[4] is KOD in component electrolytes (monovalent_mEq_per_minute). * CONSTANTS[5] is VUD in component electrolytes (L_per_minute). * ALGEBRAIC[3] is VEC in component extracellular_fluid_volume (litre). * ALGEBRAIC[4] is CNA in component extracellular_Na_concentration (monovalent_mEq_per_litre). * CONSTANTS[6] is NID in component parameter_values (monovalent_mEq_per_minute). * CONSTANTS[7] is TRPL in component parameter_values (L_per_minute). * CONSTANTS[11] is NED in component extracellular_Na_concentration (monovalent_mEq_per_minute). * STATES[0] is NAE in component extracellular_Na_concentration (monovalent_mEq). * CONSTANTS[12] is AMK1 in component aldosterone_effect_on_cellular_K_distribution (dimensionless). * CONSTANTS[8] is ALCLK in component parameter_values (dimensionless). * ALGEBRAIC[5] is CKE in component extracellular_K_concentration (monovalent_mEq_per_litre). * ALGEBRAIC[0] is KE in component extracellular_K_concentration (monovalent_mEq). * STATES[1] is KTOT in component extracellular_K_concentration (monovalent_mEq). * CONSTANTS[9] is KID in component parameter_values (monovalent_mEq_per_minute). * CONSTANTS[13] is KTOTD in component extracellular_K_concentration (monovalent_mEq_per_minute). * STATES[2] is VIC in component intracellular_fluid_volume (litre). * ALGEBRAIC[2] is CKI in component intracellular_K_concentration (monovalent_mEq_per_litre). * ALGEBRAIC[1] is KI in component intracellular_K_concentration (monovalent_mEq). * ALGEBRAIC[7] is VID in component intracellular_fluid_volume (L_per_minute). * CONSTANTS[10] is VIDML in component parameter_values (litre2_per_monovalent_mEq_per_minute). * ALGEBRAIC[6] is CCD in component intracellular_fluid_volume (monovalent_mEq_per_litre). * STATES[3] is VTW in component total_body_water (litre). * RATES[0] is d/dt NAE in component extracellular_Na_concentration (monovalent_mEq). * RATES[1] is d/dt KTOT in component extracellular_K_concentration (monovalent_mEq). * RATES[2] is d/dt VIC in component intracellular_fluid_volume (litre). * RATES[3] is d/dt VTW in component total_body_water (litre). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 1.037; CONSTANTS[1] = 0.000980838; CONSTANTS[2] = 0.0959449; CONSTANTS[3] = 0.977181; CONSTANTS[4] = 0.0804374; CONSTANTS[5] = 0.000989; CONSTANTS[6] = 0.1; CONSTANTS[7] = 0; STATES[0] = 2109.91; CONSTANTS[8] = 0.3; STATES[1] = 3622.54; CONSTANTS[9] = 0.08; STATES[2] = 25.0404; CONSTANTS[10] = 0.01; STATES[3] = 39.8952; CONSTANTS[11] = ( CONSTANTS[6]*CONSTANTS[3] - CONSTANTS[2])+ CONSTANTS[7]*142.000; CONSTANTS[12] = (CONSTANTS[0] - 1.00000)*CONSTANTS[8]+1.00000; CONSTANTS[13] = CONSTANTS[9] - CONSTANTS[4]; CONSTANTS[14] = CONSTANTS[1] - CONSTANTS[5]; CONSTANTS[15] = CONSTANTS[11]; CONSTANTS[16] = CONSTANTS[13]; RATES[2] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[2] - ALGEBRAIC[7]; resid[1] = RATES[3] - CONSTANTS[14]; resid[2] = RATES[0] - CONSTANTS[15]; resid[3] = RATES[1] - CONSTANTS[16]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[5] = ALGEBRAIC[0]/ALGEBRAIC[3]; } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[3] = STATES[3] - STATES[2]; ALGEBRAIC[4] = STATES[0]/ALGEBRAIC[3]; ALGEBRAIC[0] = (STATES[1] - 3000.00)/( CONSTANTS[12]*9.33330); ALGEBRAIC[1] = STATES[1] - ALGEBRAIC[0]; ALGEBRAIC[2] = ALGEBRAIC[1]/STATES[2]; ALGEBRAIC[6] = ALGEBRAIC[2] - ALGEBRAIC[4]; ALGEBRAIC[7] = ALGEBRAIC[6]*CONSTANTS[10]; } 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) { }