# Generated Code

The following is matlab code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

```function [VOI, STATES, ALGEBRAIC, CONSTANTS] = mainFunction()
% This is the "main function".  In Matlab, things work best if you rename this function to match the filename.
[VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel();
end

function [algebraicVariableCount] = getAlgebraicVariableCount()
% Used later when setting a global variable with the number of algebraic variables.
% Note: This is not the "main method".
algebraicVariableCount =325;
end
% There are a total of 43 entries in each of the rate and state variable arrays.
% There are a total of 210 entries in the constant variable array.
%

function [VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel()
% Create ALGEBRAIC of correct size
global algebraicVariableCount;  algebraicVariableCount = getAlgebraicVariableCount();
% Initialise constants and state variables
[INIT_STATES, CONSTANTS] = initConsts;

% Set timespan to solve over
tspan = [0, 10];

% Set numerical accuracy options for ODE solver
options = odeset('RelTol', 1e-06, 'AbsTol', 1e-06, 'MaxStep', 1);

% Solve model with ODE solver
[VOI, STATES] = ode15s(@(VOI, STATES)computeRates(VOI, STATES, CONSTANTS), tspan, INIT_STATES, options);

% Compute algebraic variables
[RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS);
ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI);

% Plot state variables against variable of integration
[LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends();
figure();
plot(VOI, STATES);
xlabel(LEGEND_VOI);
l = legend(LEGEND_STATES);
set(l,'Interpreter','none');
end

function [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends()
LEGEND_STATES = ''; LEGEND_ALGEBRAIC = ''; LEGEND_VOI = ''; LEGEND_CONSTANTS = '';
LEGEND_VOI = strpad('time in component environment (minute)');
LEGEND_CONSTANTS(:,1) = strpad('MYOGRS in component temp_myogrs_and_pamk (dimensionless)');
LEGEND_CONSTANTS(:,2) = strpad('PAMK in component temp_myogrs_and_pamk (dimensionless)');
LEGEND_CONSTANTS(:,3) = strpad('PAMKRN in component temp_myogrs_and_pamk (dimensionless)');
LEGEND_ALGEBRAIC(:,7) = strpad('ANM in component general_angiotensin_multiplier (dimensionless)');
LEGEND_ALGEBRAIC(:,85) = strpad('CKE in component extracellular_K_concentration (monovalent_mEq_per_litre)');
LEGEND_ALGEBRAIC(:,4) = strpad('AMK in component aldosterone_effect_on_cell_membrane_K_transport (dimensionless)');
LEGEND_ALGEBRAIC(:,6) = strpad('AMNA in component aldosterone_effect_on_cell_membrane_Na_transport (dimensionless)');
LEGEND_ALGEBRAIC(:,8) = strpad('ANMAL in component angiotensin_control_of_aldosterone_secretion (dimensionless)');
LEGEND_CONSTANTS(:,4) = strpad('ANMALD in component aldosterone_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,87) = strpad('OSMAL in component osmotic_control_of_aldosterone_secretion (dimensionless)');
LEGEND_ALGEBRAIC(:,99) = strpad('AMR1 in component aldosterone_secretion (dimensionless)');
LEGEND_CONSTANTS(:,5) = strpad('AMKMUL in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,6) = strpad('ALDINF in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,7) = strpad('ALDKNS in component aldosterone_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,91) = strpad('AMRBSC in component aldosterone_secretion (dimensionless)');
LEGEND_ALGEBRAIC(:,94) = strpad('AMRT in component aldosterone_secretion (dimensionless)');
LEGEND_ALGEBRAIC(:,97) = strpad('AMR in component aldosterone_secretion (dimensionless)');
LEGEND_STATES(:,1) = strpad('AMC in component aldosterone_concentration (dimensionless)');
LEGEND_CONSTANTS(:,8) = strpad('AMT in component aldosterone_parameter_values (minute)');
LEGEND_ALGEBRAIC(:,2) = strpad('AM in component general_aldosterone_multiplier (dimensionless)');
LEGEND_CONSTANTS(:,9) = strpad('AM1UL in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,10) = strpad('AM1LL in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,11) = strpad('AMCSNS in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,12) = strpad('ALDMM in component aldosterone_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,1) = strpad('AM1 in component general_aldosterone_multiplier (dimensionless)');
LEGEND_CONSTANTS(:,13) = strpad('AMKM in component aldosterone_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,3) = strpad('AMKT in component aldosterone_effect_on_cell_membrane_K_transport (dimensionless)');
LEGEND_CONSTANTS(:,14) = strpad('AMNAM in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,15) = strpad('AMNAUL in component aldosterone_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,16) = strpad('AMNALL in component aldosterone_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,5) = strpad('AMNAT in component aldosterone_effect_on_cell_membrane_Na_transport (dimensionless)');
LEGEND_ALGEBRAIC(:,233) = strpad('MDFLW in component proximal_tubular_and_macula_densa_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,11) = strpad('ANUVN in component angiotensin_effect_on_venous_constriction (dimensionless)');
LEGEND_ALGEBRAIC(:,10) = strpad('ANU in component angiotensin_effect_on_circulation (dimensionless)');
LEGEND_ALGEBRAIC(:,269) = strpad('ANGSCR in component instantaneous_angiotensin_formation (dimensionless)');
LEGEND_ALGEBRAIC(:,263) = strpad('MDFLW3 in component instantaneous_angiotensin_formation (L_per_minute)');
LEGEND_STATES(:,2) = strpad('ANX1 in component time_delayed_angiotensin_formation (dimensionless)');
LEGEND_CONSTANTS(:,17) = strpad('ANXM in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,18) = strpad('ANV in component angiotensin_parameter_values (minute)');
LEGEND_ALGEBRAIC(:,276) = strpad('ANX in component time_delayed_angiotensin_formation (dimensionless)');
LEGEND_ALGEBRAIC(:,284) = strpad('ANPR in component total_angiotensin_formation (dimensionless)');
LEGEND_CONSTANTS(:,19) = strpad('REK in component angiotensin_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,277) = strpad('ANPRT in component total_angiotensin_formation (dimensionless)');
LEGEND_ALGEBRAIC(:,294) = strpad('ANPR1 in component artificial_angiotensin_formation (dimensionless)');
LEGEND_CONSTANTS(:,20) = strpad('ANGKNS in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,21) = strpad('ANGINF in component angiotensin_parameter_values (dimensionless)');
LEGEND_STATES(:,3) = strpad('ANC in component angiotensin_concentration (dimensionless)');
LEGEND_CONSTANTS(:,22) = strpad('ANT in component angiotensin_parameter_values (minute)');
LEGEND_CONSTANTS(:,23) = strpad('ANMUL in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,24) = strpad('ANMLL in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,25) = strpad('ANCSNS in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,26) = strpad('ANUM in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,27) = strpad('ANULL in component angiotensin_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,9) = strpad('ANU1 in component angiotensin_effect_on_circulation (dimensionless)');
LEGEND_CONSTANTS(:,28) = strpad('ANUVM in component angiotensin_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,29) = strpad('Z12 in component angiotensin_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,83) = strpad('CNA in component extracellular_Na_concentration (monovalent_mEq_per_litre)');
LEGEND_ALGEBRAIC(:,66) = strpad('PA1 in component pressure_driving_autonomic_receptors (mmHg)');
LEGEND_CONSTANTS(:,30) = strpad('CNR in component antidiuretic_hormone_parameter_values (monovalent_mEq_per_litre)');
LEGEND_ALGEBRAIC(:,48) = strpad('PLA in component left_atrial_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,35) = strpad('PRA in component right_atrial_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,17) = strpad('ANPX in component ANP_effect_on_renal_afferent_arteriolar_resistance (dimensionless)');
LEGEND_ALGEBRAIC(:,51) = strpad('ANP in component total_ANP_secreted (dimensionless)');
LEGEND_ALGEBRAIC(:,49) = strpad('ANPL in component total_ANP_secreted (dimensionless)');
LEGEND_ALGEBRAIC(:,36) = strpad('ANPR2 in component total_ANP_secreted (dimensionless)');
LEGEND_ALGEBRAIC(:,53) = strpad('ANP1 in component ANP_into_circulation (dimensionless)');
LEGEND_CONSTANTS(:,39) = strpad('ANPKNS in component atrial_natriuretic_peptide_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,40) = strpad('ANPINF in component atrial_natriuretic_peptide_parameter_values (dimensionless)');
LEGEND_STATES(:,5) = strpad('ANPC in component ANP_in_plasma (dimensionless)');
LEGEND_CONSTANTS(:,41) = strpad('ANPTC in component atrial_natriuretic_peptide_parameter_values (minute)');
LEGEND_CONSTANTS(:,42) = strpad('ANPXUL in component atrial_natriuretic_peptide_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,16) = strpad('ANPX1 in component ANP_effect_on_renal_afferent_arteriolar_resistance (dimensionless)');
LEGEND_ALGEBRAIC(:,170) = strpad('PO2ART in component arterial_PO2 (mmHg)');
LEGEND_ALGEBRAIC(:,41) = strpad('PPA in component pulmonary_vasculature_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,21) = strpad('VVR in component autonomic_drive_on_target_organs_and_tissues (litre)');
LEGEND_ALGEBRAIC(:,23) = strpad('AUH in component autonomic_drive_on_target_organs_and_tissues (dimensionless)');
LEGEND_ALGEBRAIC(:,24) = strpad('AUR in component autonomic_drive_on_target_organs_and_tissues (dimensionless)');
LEGEND_ALGEBRAIC(:,26) = strpad('AUM in component autonomic_drive_on_target_organs_and_tissues (dimensionless)');
LEGEND_ALGEBRAIC(:,25) = strpad('AOM in component autonomic_drive_on_target_organs_and_tissues (dimensionless)');
LEGEND_ALGEBRAIC(:,27) = strpad('AVE in component autonomic_drive_on_target_organs_and_tissues (dimensionless)');
LEGEND_ALGEBRAIC(:,20) = strpad('AU in component actual_autonomic_stimulation (dimensionless)');
LEGEND_CONSTANTS(:,43) = strpad('CRRFLX in component autonomics_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,44) = strpad('EXE in component autonomics_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,72) = strpad('AUC in component chemoreceptors_effect_of_PA (dimensionless)');
LEGEND_CONSTANTS(:,45) = strpad('AUC1 in component autonomics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,174) = strpad('AUC3 in component chemoreceptors_effect_of_art_PO2 (dimensionless)');
LEGEND_CONSTANTS(:,46) = strpad('O2CHMO in component autonomics_parameter_values (per_mmHg)');
LEGEND_ALGEBRAIC(:,172) = strpad('AUC2 in component chemoreceptors_effect_of_art_PO2 (dimensionless)');
LEGEND_ALGEBRAIC(:,18) = strpad('AU6C in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_CONSTANTS(:,47) = strpad('AUX in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,48) = strpad('AUK in component autonomics_parameter_values (per_minute)');
LEGEND_CONSTANTS(:,49) = strpad('BAROTC in component autonomics_parameter_values (minute)');
LEGEND_ALGEBRAIC(:,67) = strpad('AUB in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_ALGEBRAIC(:,69) = strpad('A1B in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_ALGEBRAIC(:,71) = strpad('AU6A in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_CONSTANTS(:,50) = strpad('AU4 in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_STATES(:,6) = strpad('AU6 in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_ALGEBRAIC(:,73) = strpad('AUN in component CNS_ischemic_reflex (dimensionless)');
LEGEND_CONSTANTS(:,51) = strpad('AUN1 in component autonomics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,50) = strpad('AULP in component autonomic_response_to_vasculature_pressure (dimensionless)');
LEGEND_CONSTANTS(:,52) = strpad('AULPM in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,207) = strpad('AUEX in component autonomic_response_to_exercise (dimensionless)');
LEGEND_CONSTANTS(:,53) = strpad('EXC in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,54) = strpad('EXCXP in component autonomics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,178) = strpad('AUTTL in component total_autonomic_stimulation (dimensionless)');
LEGEND_ALGEBRAIC(:,176) = strpad('AUTTL1 in component total_autonomic_stimulation (dimensionless)');
LEGEND_CONSTANTS(:,55) = strpad('EXCML in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,56) = strpad('AUDMP in component autonomics_parameter_values (minute)');
LEGEND_CONSTANTS(:,57) = strpad('AUMAX in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,58) = strpad('AUMIN in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,59) = strpad('AUSLP in component autonomics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,181) = strpad('DAU in component actual_autonomic_stimulation (per_minute)');
LEGEND_STATES(:,7) = strpad('AU1 in component actual_autonomic_stimulation (dimensionless)');
LEGEND_ALGEBRAIC(:,19) = strpad('AUT in component actual_autonomic_stimulation (dimensionless)');
LEGEND_CONSTANTS(:,60) = strpad('VV9 in component autonomics_parameter_values (litre)');
LEGEND_CONSTANTS(:,61) = strpad('AUL in component autonomics_parameter_values (litre)');
LEGEND_CONSTANTS(:,62) = strpad('AUV in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,63) = strpad('AUS in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,64) = strpad('O2A in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,65) = strpad('AUM1 in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,66) = strpad('AUM2 in component autonomics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,67) = strpad('AUY in component autonomics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,22) = strpad('AUO in component autonomic_drive_on_target_organs_and_tissues (dimensionless)');
LEGEND_CONSTANTS(:,68) = strpad('MDMP in component autonomics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,82) = strpad('VEC in component extracellular_fluid_volume (litre)');
LEGEND_ALGEBRAIC(:,153) = strpad('PPD in component concentration_of_protein_in_pulmonary_interstitium (gram_per_minute)');
LEGEND_ALGEBRAIC(:,234) = strpad('RVS in component venous_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,150) = strpad('DFP in component pulmonary_interstitial_free_fluid_volume (L_per_minute)');
LEGEND_ALGEBRAIC(:,124) = strpad('VPF in component pulmonary_interstitial_free_fluid_volume (litre)');
LEGEND_ALGEBRAIC(:,235) = strpad('BFN in component blood_flow_through_NM_NR_tissues (L_per_minute)');
LEGEND_ALGEBRAIC(:,210) = strpad('PVS in component venous_average_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,236) = strpad('PC in component capillary_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,28) = strpad('CPP in component plasma_protein_concentration (gram_per_L)');
LEGEND_ALGEBRAIC(:,31) = strpad('PPC in component plasma_colloid_osmotic_pressure (mmHg)');
LEGEND_STATES(:,8) = strpad('VP in component plasma_volume (litre)');
LEGEND_ALGEBRAIC(:,135) = strpad('PGH in component hydrostatic_pressure_of_tissue_gel (mmHg)');
LEGEND_ALGEBRAIC(:,133) = strpad('PTC in component total_osmotic_pressure_of_tissue_gel (mmHg)');
LEGEND_ALGEBRAIC(:,270) = strpad('VTCPL in component plasma_leakage (L_per_minute)');
LEGEND_ALGEBRAIC(:,278) = strpad('VTC in component rate_of_fluid_out_of_capillaries (L_per_minute)');
LEGEND_CONSTANTS(:,69) = strpad('CFC in component capillary_dynamics_parameter_values (L_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,140) = strpad('VTL in component lymph_flow (L_per_minute)');
LEGEND_CONSTANTS(:,70) = strpad('TRPL in component capillary_dynamics_parameter_values (L_per_minute)');
LEGEND_ALGEBRAIC(:,285) = strpad('VPD in component plasma_volume (L_per_minute)');
LEGEND_STATES(:,9) = strpad('PRP in component total_plasma_protein (gram)');
LEGEND_ALGEBRAIC(:,30) = strpad('DLP in component protein_destruction_and_formation (gram_per_minute)');
LEGEND_CONSTANTS(:,71) = strpad('CPR in component capillary_dynamics_parameter_values (gram_per_L)');
LEGEND_CONSTANTS(:,72) = strpad('LPPR in component capillary_dynamics_parameter_values (gram_per_minute)');
LEGEND_CONSTANTS(:,73) = strpad('LPDE in component capillary_dynamics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,74) = strpad('LPK in component capillary_dynamics_parameter_values (L_per_minute)');
LEGEND_ALGEBRAIC(:,29) = strpad('CPPD in component protein_destruction_and_formation (gram_per_L)');
LEGEND_CONSTANTS(:,75) = strpad('PCR in component capillary_dynamics_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,76) = strpad('CPK in component capillary_dynamics_parameter_values (L_per_minute_per_mmHg)');
LEGEND_CONSTANTS(:,77) = strpad('PCE in component capillary_dynamics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,264) = strpad('PRCD in component plasma_leakage (mmHg)');
LEGEND_ALGEBRAIC(:,128) = strpad('CPI in component interstitial_protein_concentration (gram_per_L)');
LEGEND_ALGEBRAIC(:,279) = strpad('DPC in component protein_influx_into_interstitium (gram_per_minute)');
LEGEND_ALGEBRAIC(:,141) = strpad('DPL in component lymph_protein_flow (gram_per_minute)');
LEGEND_ALGEBRAIC(:,286) = strpad('DPP in component total_plasma_protein (gram_per_minute)');
LEGEND_ALGEBRAIC(:,125) = strpad('VTS in component total_systemic_fluid_volume (litre)');
LEGEND_ALGEBRAIC(:,126) = strpad('VTS1 in component interstitial_fluid_volume (litre)');
LEGEND_CONSTANTS(:,78) = strpad('TSSLML in component capillary_dynamics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,79) = strpad('TSSLTC in component capillary_dynamics_parameter_values (per_minute)');
LEGEND_STATES(:,10) = strpad('VTS2 in component interstitial_fluid_volume (litre)');
LEGEND_STATES(:,11) = strpad('TSP in component total_interstitial_protein (gram)');
LEGEND_ALGEBRAIC(:,287) = strpad('DPI in component total_interstitial_protein (gram_per_minute)');
LEGEND_ALGEBRAIC(:,130) = strpad('PTCPR in component interstitial_colloid_osmotic_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,134) = strpad('PTT in component total_tissue_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,131) = strpad('CHY in component hydrostatic_pressure_of_tissue_gel (gram_per_L)');
LEGEND_CONSTANTS(:,80) = strpad('HYL in component capillary_dynamics_parameter_values (gram)');
LEGEND_CONSTANTS(:,81) = strpad('CMPTSS in component capillary_dynamics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,82) = strpad('PGHF in component capillary_dynamics_parameter_values (L_mmHg_per_gram)');
LEGEND_ALGEBRAIC(:,132) = strpad('POSHYL in component total_osmotic_pressure_of_tissue_gel (mmHg)');
LEGEND_CONSTANTS(:,83) = strpad('GCOPF in component capillary_dynamics_parameter_values (per_mmHg)');
LEGEND_CONSTANTS(:,84) = strpad('VTSF in component capillary_dynamics_parameter_values (litre)');
LEGEND_ALGEBRAIC(:,136) = strpad('PIF in component interstial_free_fluid_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,138) = strpad('PTS in component interstitial_solid_tissue_pressure (mmHg)');
LEGEND_CONSTANTS(:,85) = strpad('PLDF in component capillary_dynamics_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,137) = strpad('PLD1 in component lymph_flow (mmHg)');
LEGEND_ALGEBRAIC(:,139) = strpad('PLD in component lymph_flow (mmHg)');
LEGEND_ALGEBRAIC(:,127) = strpad('VG in component interstitial_gel_volume (litre)');
LEGEND_ALGEBRAIC(:,129) = strpad('VIF in component interstitial_free_fluid_volume (litre)');
LEGEND_ALGEBRAIC(:,101) = strpad('AMM in component global_M_blood_flow_autoregulation_output (dimensionless)');
LEGEND_ALGEBRAIC(:,113) = strpad('ARM in component global_NM_blood_flow_autoregulation_output (dimensionless)');
LEGEND_ALGEBRAIC(:,199) = strpad('ATRRFB in component volume_effect_on_arteries (dimensionless)');
LEGEND_ALGEBRAIC(:,206) = strpad('ATRVFB in component volume_effect_on_unstressed_venous_volume (litre)');
LEGEND_ALGEBRAIC(:,89) = strpad('HMD in component heart_deterioration (dimensionless)');
LEGEND_STATES(:,12) = strpad('HPL in component left_ventricular_hypertrophy (dimensionless)');
LEGEND_STATES(:,13) = strpad('HPR in component right_ventricular_hypertrophy (dimensionless)');
LEGEND_ALGEBRAIC(:,159) = strpad('OSA in component arterial_PO2 (dimensionless)');
LEGEND_ALGEBRAIC(:,265) = strpad('RBF in component actual_renal_blood_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,183) = strpad('VIM in component blood_viscosity (dimensionless)');
LEGEND_STATES(:,14) = strpad('VRC in component RBC_volume (litre)');
LEGEND_STATES(:,15) = strpad('VV6 in component long_term_stress_relaxation (litre)');
LEGEND_STATES(:,16) = strpad('VV7 in component short_term_stress_relaxation (litre)');
LEGEND_ALGEBRAIC(:,216) = strpad('BFM in component blood_flow_through_M_tissues (L_per_minute)');
LEGEND_ALGEBRAIC(:,280) = strpad('QAO in component systemic_blood_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,169) = strpad('QRO in component right_ventricular_output (L_per_minute)');
LEGEND_ALGEBRAIC(:,165) = strpad('QLO in component left_ventricular_output (L_per_minute)');
LEGEND_ALGEBRAIC(:,45) = strpad('RPA in component pulmonary_arterial_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,54) = strpad('RPV in component pulmonary_venous_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,208) = strpad('VVE in component venous_excess_volume (litre)');
LEGEND_STATES(:,17) = strpad('VVS1 in component venous_blood_volume (litre)');
LEGEND_STATES(:,18) = strpad('VAS1 in component arterial_blood_volume (litre)');
LEGEND_STATES(:,19) = strpad('VLA1 in component left_atrial_blood_volume (litre)');
LEGEND_STATES(:,20) = strpad('VPA1 in component pulmonary_vasculature_blood_volume (litre)');
LEGEND_STATES(:,21) = strpad('VRA1 in component right_atrial_blood_volume (litre)');
LEGEND_ALGEBRAIC(:,32) = strpad('VBD in component total_blood_volume_change (litre)');
LEGEND_ALGEBRAIC(:,213) = strpad('QVO in component rate_of_blood_flow_from_veins_to_right_atrium (L_per_minute)');
LEGEND_ALGEBRAIC(:,33) = strpad('VRA in component right_atrial_blood_volume (litre)');
LEGEND_ALGEBRAIC(:,215) = strpad('DRA in component right_atrial_blood_volume (L_per_minute)');
LEGEND_ALGEBRAIC(:,34) = strpad('VRE in component right_atrial_pressure (litre)');
LEGEND_ALGEBRAIC(:,37) = strpad('PRA1 in component autonomic_stimulation_effect_on_right_atrial_pressure (mmHg)');
LEGEND_CONSTANTS(:,86) = strpad('HTAUML in component circulatory_dynamics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,161) = strpad('RVM in component pressure_effect_on_right_ventricular_pumping (dimensionless)');
LEGEND_ALGEBRAIC(:,160) = strpad('PP2 in component pressure_effect_on_right_ventricular_pumping (mmHg)');
LEGEND_ALGEBRAIC(:,59) = strpad('QLN in component left_ventricular_output (L_per_minute)');
LEGEND_ALGEBRAIC(:,166) = strpad('HPEF in component pumping_effectiveness_of_right_ventricle (L_per_minute)');
LEGEND_CONSTANTS(:,87) = strpad('QRF in component circulatory_dynamics_parameter_values (L_per_minute)');
LEGEND_CONSTANTS(:,88) = strpad('HSR in component circulatory_dynamics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,38) = strpad('QRN in component right_ventricular_output (dimensionless)');
LEGEND_ALGEBRAIC(:,57) = strpad('QPO in component rate_of_blood_flow_from_pulmonary_veins_to_left_atrium (L_per_minute)');
LEGEND_ALGEBRAIC(:,39) = strpad('VPA in component pulmonary_vasculature_blood_volume (litre)');
LEGEND_ALGEBRAIC(:,171) = strpad('DPA in component pulmonary_vasculature_blood_volume (L_per_minute)');
LEGEND_ALGEBRAIC(:,40) = strpad('VPE in component pulmonary_vasculature_pressure (litre)');
LEGEND_ALGEBRAIC(:,42) = strpad('PP1T in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,43) = strpad('PP1 in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,44) = strpad('CPA in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,52) = strpad('PL1 in component pulmonary_venous_resistance (mmHg)');
LEGEND_ALGEBRAIC(:,55) = strpad('RPT in component total_pulmonary_vascular_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,46) = strpad('VLA in component left_atrial_blood_volume (litre)');
LEGEND_ALGEBRAIC(:,167) = strpad('DLA in component left_atrial_blood_volume (L_per_minute)');
LEGEND_ALGEBRAIC(:,47) = strpad('VLE in component left_atrial_pressure (litre)');
LEGEND_ALGEBRAIC(:,58) = strpad('PLA1 in component autonomic_stimulation_effect_on_left_atrial_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,163) = strpad('LVM in component pumping_effectiveness_of_left_ventricle (dimensionless)');
LEGEND_ALGEBRAIC(:,162) = strpad('PA2 in component pumping_effectiveness_of_left_ventricle (mmHg)');
LEGEND_ALGEBRAIC(:,164) = strpad('QLOT in component left_ventricular_output (L_per_minute)');
LEGEND_CONSTANTS(:,89) = strpad('HSL in component circulatory_dynamics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,74) = strpad('QLO1 in component left_ventricular_output (L_per_minute)');
LEGEND_ALGEBRAIC(:,60) = strpad('VVS in component venous_blood_volume (litre)');
LEGEND_ALGEBRAIC(:,288) = strpad('DVS in component venous_blood_volume (L_per_minute)');
LEGEND_ALGEBRAIC(:,61) = strpad('VVA in component angiotensin_induced_venous_constriction (litre)');
LEGEND_CONSTANTS(:,90) = strpad('ANY in component circulatory_dynamics_parameter_values (litre)');
LEGEND_ALGEBRAIC(:,207) = strpad('VVE1 in component venous_excess_volume (litre)');
LEGEND_CONSTANTS(:,91) = strpad('CV in component circulatory_dynamics_parameter_values (L_per_mmHg)');
LEGEND_ALGEBRAIC(:,209) = strpad('PVS1 in component venous_average_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,62) = strpad('PR1 in component venous_outflow_pressure_into_heart (mmHg)');
LEGEND_CONSTANTS(:,92) = strpad('PR1LL in component circulatory_dynamics_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,211) = strpad('RVG in component resistance_from_veins_to_right_atrium (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,212) = strpad('PGV in component rate_of_blood_flow_from_veins_to_right_atrium (mmHg)');
LEGEND_CONSTANTS(:,93) = strpad('CN7 in component circulatory_dynamics_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,94) = strpad('CN2 in component circulatory_dynamics_parameter_values (per_mmHg)');
LEGEND_CONSTANTS(:,95) = strpad('RVSM in component circulatory_dynamics_parameter_values (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,237) = strpad('CN3 in component venous_resistance (dimensionless)');
LEGEND_ALGEBRAIC(:,238) = strpad('RV1 in component venous_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,239) = strpad('NNRVR in component NM_NR_venous_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,63) = strpad('VAS in component arterial_blood_volume (litre)');
LEGEND_ALGEBRAIC(:,289) = strpad('DAS in component arterial_blood_volume (L_per_minute)');
LEGEND_ALGEBRAIC(:,76) = strpad('PAM in component pressure_effect_on_arterial_distention (dimensionless)');
LEGEND_CONSTANTS(:,96) = strpad('PAEX in component circulatory_dynamics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,201) = strpad('R1 in component non_renal_systemic_arterial_resistance_multiplier (dimensionless)');
LEGEND_ALGEBRAIC(:,203) = strpad('NNRAR in component NM_NR_arterial_resistance (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,97) = strpad('RAR in component circulatory_dynamics_parameter_values (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,98) = strpad('RMULT1 in component circulatory_dynamics_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,205) = strpad('RSM in component M_systemic_resistance (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,99) = strpad('RAM in component circulatory_dynamics_parameter_values (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,240) = strpad('RSN in component total_NM_NR_systemic_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,77) = strpad('FISFLO in component blood_flow_through_AV_fistulas (L_per_minute)');
LEGEND_CONSTANTS(:,100) = strpad('FIS in component circulatory_dynamics_parameter_values (L_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,271) = strpad('SYSFLO in component systemic_blood_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,290) = strpad('RTP in component total_peripheral_resistance (mmHg_minute_per_L)');
LEGEND_STATES(:,22) = strpad('TVD in component rate_of_fluid_intake (L_per_minute)');
LEGEND_ALGEBRAIC(:,312) = strpad('NOD in component actual_Na_excretion_rate (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,188) = strpad('STH in component effect_of_salt_appetite_stimulation_on_thirst (dimensionless)');
LEGEND_ALGEBRAIC(:,316) = strpad('KOD in component actual_K_excretion_rate (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,325) = strpad('VUD in component actual_urine_volume (L_per_minute)');
LEGEND_STATES(:,23) = strpad('VTW in component total_body_water (litre)');
LEGEND_CONSTANTS(:,101) = strpad('NID in component electrolytes_parameter_values (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,102) = strpad('TRPL in component electrolytes_parameter_values (L_per_minute)');
LEGEND_ALGEBRAIC(:,314) = strpad('NED in component extracellular_Na_concentration (monovalent_mEq_per_minute)');
LEGEND_STATES(:,24) = strpad('NAE in component extracellular_Na_concentration (monovalent_mEq)');
LEGEND_ALGEBRAIC(:,78) = strpad('AMK1 in component aldosterone_effect_on_cellular_K_distribution (dimensionless)');
LEGEND_CONSTANTS(:,103) = strpad('ALCLK in component electrolytes_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,79) = strpad('KE in component extracellular_K_concentration (monovalent_mEq)');
LEGEND_STATES(:,25) = strpad('KTOT in component extracellular_K_concentration (monovalent_mEq)');
LEGEND_CONSTANTS(:,104) = strpad('KID in component electrolytes_parameter_values (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,318) = strpad('KTOTD in component extracellular_K_concentration (monovalent_mEq_per_minute)');
LEGEND_STATES(:,26) = strpad('VIC in component intracellular_fluid_volume (litre)');
LEGEND_ALGEBRAIC(:,81) = strpad('CKI in component intracellular_K_concentration (monovalent_mEq_per_litre)');
LEGEND_ALGEBRAIC(:,80) = strpad('KI in component intracellular_K_concentration (monovalent_mEq)');
LEGEND_ALGEBRAIC(:,90) = strpad('VID in component intracellular_fluid_volume (L_per_minute)');
LEGEND_CONSTANTS(:,105) = strpad('VIDML in component electrolytes_parameter_values (litre2_per_monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,86) = strpad('CCD in component intracellular_fluid_volume (monovalent_mEq_per_litre)');
LEGEND_ALGEBRAIC(:,115) = strpad('POT in component pressure_of_O2_in_NM_tissue_cells (mmHg)');
LEGEND_CONSTANTS(:,106) = strpad('HSL in component heart_hypertrophy_or_deterioration_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,107) = strpad('Z13 in component heart_hypertrophy_or_deterioration_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,108) = strpad('HSR in component heart_hypertrophy_or_deterioration_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,109) = strpad('DHDTR in component heart_hypertrophy_or_deterioration_parameter_values (per_mmHg_per_minute)');
LEGEND_STATES(:,27) = strpad('HMD1 in component heart_deterioration (dimensionless)');
LEGEND_ALGEBRAIC(:,117) = strpad('DHM in component heart_deterioration (per_minute)');
LEGEND_ALGEBRAIC(:,93) = strpad('AUHR in component effect_of_autonomic_stimulation_on_HR (beats_per_minute)');
LEGEND_CONSTANTS(:,208) = strpad('PRHR in component effect_of_PRA_on_HR (beats_per_minute)');
LEGEND_CONSTANTS(:,110) = strpad('PR1LL in component HR_and_SV_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,96) = strpad('HDHR in component effect_of_heart_deterioration_on_HR (dimensionless)');
LEGEND_ALGEBRAIC(:,98) = strpad('HR in component heart_rate (beats_per_minute)');
LEGEND_ALGEBRAIC(:,168) = strpad('SVO in component stroke_volume_output (litre)');
LEGEND_ALGEBRAIC(:,103) = strpad('PMO in component pressure_of_O2_in_M_tissue_cells (mmHg)');
LEGEND_ALGEBRAIC(:,105) = strpad('PDO in component M_autoregulatory_driving_force (mmHg)');
LEGEND_ALGEBRAIC(:,107) = strpad('POE in component M_ST_sensitivity_control (mmHg)');
LEGEND_CONSTANTS(:,111) = strpad('POM in component M_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,100) = strpad('AMM1 in component M_ST_time_delay_and_limit (dimensionless)');
LEGEND_CONSTANTS(:,112) = strpad('A4K in component M_autoregulatory_local_blood_flow_parameter_values (minute)');
LEGEND_CONSTANTS(:,113) = strpad('AMM4 in component M_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_STATES(:,28) = strpad('AMM1T in component M_ST_time_delay_and_limit (dimensionless)');
LEGEND_ALGEBRAIC(:,108) = strpad('POF in component M_LT_sensitivity_control (mmHg)');
LEGEND_CONSTANTS(:,114) = strpad('POM2 in component M_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_STATES(:,29) = strpad('AMM2 in component M_LT_time_delay (dimensionless)');
LEGEND_CONSTANTS(:,115) = strpad('A4K2 in component M_autoregulatory_local_blood_flow_parameter_values (minute)');
LEGEND_STATES(:,30) = strpad('OVA in component O2_volume_of_arterial_blood (mL_per_L)');
LEGEND_ALGEBRAIC(:,158) = strpad('HM in component hematocrit_fraction (dimensionless)');
LEGEND_ALGEBRAIC(:,230) = strpad('RMO in component delivery_of_O2_to_M_tissues (mL_per_minute)');
LEGEND_ALGEBRAIC(:,217) = strpad('O2ARTM in component M_O2_blood_supply (mL_per_minute)');
LEGEND_ALGEBRAIC(:,231) = strpad('PVO in component M_venous_O2_content (mmHg)');
LEGEND_CONSTANTS(:,116) = strpad('EXC in component M_O2_delivery_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,117) = strpad('EXCXP2 in component M_O2_delivery_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,232) = strpad('OVS in component M_venous_O2_content (dimensionless)');
LEGEND_ALGEBRAIC(:,106) = strpad('MMO in component metabolic_O2_consumption_by_M_tissue (mL_per_minute)');
LEGEND_ALGEBRAIC(:,104) = strpad('P2O in component metabolic_O2_consumption_by_M_tissue (mmHg)');
LEGEND_CONSTANTS(:,118) = strpad('OMM in component M_O2_delivery_parameter_values (mL_per_minute)');
LEGEND_CONSTANTS(:,119) = strpad('PM5 in component M_O2_delivery_parameter_values (per_mmHg)');
LEGEND_ALGEBRAIC(:,102) = strpad('QOM in component volume_of_O2_in_M_tissue (mL)');
LEGEND_ALGEBRAIC(:,262) = strpad('DO2M in component volume_of_O2_in_M_tissue (mL_per_minute)');
LEGEND_STATES(:,31) = strpad('QOM1 in component volume_of_O2_in_M_tissue (mL)');
LEGEND_CONSTANTS(:,120) = strpad('PK2 in component M_O2_delivery_parameter_values (mmHg_per_mL)');
LEGEND_ALGEBRAIC(:,118) = strpad('POD in component NM_autoregulatory_driving_force (mmHg)');
LEGEND_CONSTANTS(:,121) = strpad('POR in component NM_autoregulatory_local_blood_flow_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,120) = strpad('POB in component NM_ST_sensitivity_control (mmHg)');
LEGEND_CONSTANTS(:,122) = strpad('POK in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,109) = strpad('AR1 in component NM_ST_time_delay_and_damping (dimensionless)');
LEGEND_CONSTANTS(:,123) = strpad('A1K in component NM_autoregulatory_local_blood_flow_parameter_values (minute)');
LEGEND_STATES(:,32) = strpad('AR1T in component NM_ST_time_delay_and_damping (dimensionless)');
LEGEND_ALGEBRAIC(:,121) = strpad('POA in component NM_I_sensitivity_control (mmHg)');
LEGEND_CONSTANTS(:,124) = strpad('PON in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,110) = strpad('AR2 in component NM_I_time_delay_and_limit (dimensionless)');
LEGEND_CONSTANTS(:,125) = strpad('A2K in component NM_autoregulatory_local_blood_flow_parameter_values (minute)');
LEGEND_STATES(:,33) = strpad('AR2T in component NM_I_time_delay_and_limit (dimensionless)');
LEGEND_ALGEBRAIC(:,122) = strpad('POC in component NM_LT_sensitivity_control (mmHg)');
LEGEND_CONSTANTS(:,126) = strpad('POZ in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,111) = strpad('AR3 in component NM_LT_time_delay_and_limit (dimensionless)');
LEGEND_CONSTANTS(:,127) = strpad('A3K in component NM_autoregulatory_local_blood_flow_parameter_values (minute)');
LEGEND_STATES(:,34) = strpad('AR3T in component NM_LT_time_delay_and_limit (dimensionless)');
LEGEND_ALGEBRAIC(:,112) = strpad('ARM1 in component total_NM_autoregulation (dimensionless)');
LEGEND_CONSTANTS(:,128) = strpad('AUTOSN in component NM_autoregulatory_local_blood_flow_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,272) = strpad('DOB in component delivery_of_O2_to_NM_tissues (mL_per_minute)');
LEGEND_ALGEBRAIC(:,266) = strpad('O2ARTN in component NM_O2_blood_supply (mL_per_minute)');
LEGEND_ALGEBRAIC(:,273) = strpad('POV in component NM_venous_O2_content (mmHg)');
LEGEND_ALGEBRAIC(:,274) = strpad('OSV in component NM_venous_O2_content (dimensionless)');
LEGEND_ALGEBRAIC(:,119) = strpad('MO2 in component O2_consumption_by_NM_tissue (mL_per_minute)');
LEGEND_CONSTANTS(:,129) = strpad('O2M in component NM_O2_delivery_parameter_values (mL_per_minute)');
LEGEND_ALGEBRAIC(:,116) = strpad('P1O in component O2_consumption_by_NM_tissue (mmHg)');
LEGEND_ALGEBRAIC(:,114) = strpad('QO2 in component volume_of_O2_in_NM_tissue (mL)');
LEGEND_ALGEBRAIC(:,291) = strpad('DO2N in component volume_of_O2_in_NM_tissue (mL_per_minute)');
LEGEND_ALGEBRAIC(:,281) = strpad('DO2N1 in component volume_of_O2_in_NM_tissue (mL_per_minute)');
LEGEND_STATES(:,35) = strpad('QO2T in component volume_of_O2_in_NM_tissue (mL)');
LEGEND_ALGEBRAIC(:,123) = strpad('PCP in component pulmonary_capillary_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,145) = strpad('POS in component colloid_osmotic_pressure_of_pulmonary_interstitium (mmHg)');
LEGEND_ALGEBRAIC(:,142) = strpad('PPI in component pulmonary_interstitial_fluid_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,146) = strpad('PFI in component fluid_filtration_into_pulmonary_interstitium (L_per_minute)');
LEGEND_CONSTANTS(:,130) = strpad('CPF in component pulmonary_fluid_dynamics_parameter_values (L_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,148) = strpad('PLF in component lung_lymphatic_protein_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,149) = strpad('DFZ in component pulmonary_interstitial_free_fluid_volume (L_per_minute)');
LEGEND_STATES(:,36) = strpad('VPF1 in component pulmonary_interstitial_free_fluid_volume (litre)');
LEGEND_ALGEBRAIC(:,151) = strpad('PPO in component lung_lymphatic_protein_flow (gram_per_minute)');
LEGEND_ALGEBRAIC(:,147) = strpad('PPN in component protein_leakage_into_pulmonary_interstitium (gram_per_minute)');
LEGEND_ALGEBRAIC(:,144) = strpad('CPN in component concentration_of_protein_in_pulmonary_interstitium (gram_per_L)');
LEGEND_ALGEBRAIC(:,152) = strpad('PPZ in component concentration_of_protein_in_pulmonary_interstitium (gram_per_minute)');
LEGEND_STATES(:,37) = strpad('PPR1 in component concentration_of_protein_in_pulmonary_interstitium (gram)');
LEGEND_ALGEBRAIC(:,143) = strpad('PPR in component concentration_of_protein_in_pulmonary_interstitium (gram)');
LEGEND_ALGEBRAIC(:,282) = strpad('O2UTIL in component total_O2_utilization (mL_per_minute)');
LEGEND_ALGEBRAIC(:,292) = strpad('ALVENT in component alveolar_ventilation (L_per_minute)');
LEGEND_CONSTANTS(:,131) = strpad('VNTSTM in component pulmonary_O2_uptake_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,295) = strpad('PO2ALV in component alveolar_PO2 (mmHg)');
LEGEND_CONSTANTS(:,132) = strpad('PO2AMB in component pulmonary_O2_uptake_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,297) = strpad('O2DFS in component respiratory_O2_diffusion_into_capillaries (mL_per_minute)');
LEGEND_CONSTANTS(:,133) = strpad('PL2 in component pulmonary_O2_uptake_parameter_values (L_mL_per_minute_per_mmHg)');
LEGEND_CONSTANTS(:,134) = strpad('VPTISS in component pulmonary_O2_uptake_parameter_values (litre)');
LEGEND_ALGEBRAIC(:,154) = strpad('RSPDFC in component respiratory_O2_diffusion_into_capillaries (mL_per_minute_per_mmHg)');
LEGEND_ALGEBRAIC(:,299) = strpad('DOVA in component O2_volume_of_arterial_blood (mL_per_L_per_minute)');
LEGEND_ALGEBRAIC(:,157) = strpad('HM1 in component hematocrit_fraction (dimensionless)');
LEGEND_ALGEBRAIC(:,156) = strpad('VB in component hematocrit_fraction (litre)');
LEGEND_ALGEBRAIC(:,179) = strpad('VIE in component viscosity_due_to_RBCs (dimensionless)');
LEGEND_CONSTANTS(:,135) = strpad('HMK in component red_cells_and_viscosity_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,136) = strpad('HKM in component red_cells_and_viscosity_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,182) = strpad('VIB in component blood_viscosity (dimensionless)');
LEGEND_ALGEBRAIC(:,189) = strpad('HM7 in component oxygen_stimulation (mmHg)');
LEGEND_CONSTANTS(:,137) = strpad('PO2AMB in component red_cells_and_viscosity_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,138) = strpad('HM6 in component red_cells_and_viscosity_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,209) = strpad('PO2AM1 in component oxygen_stimulation (mmHg)');
LEGEND_ALGEBRAIC(:,185) = strpad('HM3 in component oxygen_stimulation (mmHg)');
LEGEND_CONSTANTS(:,210) = strpad('HM4 in component oxygen_stimulation (mmHg)');
LEGEND_ALGEBRAIC(:,187) = strpad('HM5 in component oxygen_stimulation (mmHg)');
LEGEND_ALGEBRAIC(:,191) = strpad('RC1 in component RBC_production (L_per_minute)');
LEGEND_CONSTANTS(:,139) = strpad('HM8 in component red_cells_and_viscosity_parameter_values (L_per_minute_per_mmHg)');
LEGEND_CONSTANTS(:,140) = strpad('REK in component red_cells_and_viscosity_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,194) = strpad('RC2 in component RBC_destruction (L_per_minute)');
LEGEND_CONSTANTS(:,141) = strpad('RKC in component red_cells_and_viscosity_parameter_values (per_minute)');
LEGEND_CONSTANTS(:,142) = strpad('TRRBC in component red_cells_and_viscosity_parameter_values (L_per_minute)');
LEGEND_ALGEBRAIC(:,197) = strpad('RCD in component RBC_volume (L_per_minute)');
LEGEND_CONSTANTS(:,143) = strpad('SR in component stress_relaxation_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,144) = strpad('SRK in component stress_relaxation_parameter_values (minute)');
LEGEND_CONSTANTS(:,145) = strpad('SR2 in component stress_relaxation_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,146) = strpad('SRK2 in component stress_relaxation_parameter_values (minute)');
LEGEND_CONSTANTS(:,147) = strpad('ANMSLT in component thirst_drinking_and_salt_appetite_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,148) = strpad('Z10 in component thirst_drinking_and_salt_appetite_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,149) = strpad('Z11 in component thirst_drinking_and_salt_appetite_parameter_values (per_mmHg2)');
LEGEND_ALGEBRAIC(:,184) = strpad('ANMSML in component effect_of_salt_appetite_stimulation_on_thirst (dimensionless)');
LEGEND_ALGEBRAIC(:,186) = strpad('STH1 in component effect_of_salt_appetite_stimulation_on_thirst (dimensionless)');
LEGEND_ALGEBRAIC(:,192) = strpad('AHCM in component effect_of_antidiuretic_hormone_on_thirst (dimensionless)');
LEGEND_CONSTANTS(:,150) = strpad('AHTHM in component thirst_drinking_and_salt_appetite_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,195) = strpad('ANMTH in component effect_of_angiotensin_on_thirst (dimensionless)');
LEGEND_CONSTANTS(:,151) = strpad('ANMTM in component thirst_drinking_and_salt_appetite_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,152) = strpad('DR in component thirst_drinking_and_salt_appetite_parameter_values (L_per_minute)');
LEGEND_CONSTANTS(:,153) = strpad('TVDDL in component thirst_drinking_and_salt_appetite_parameter_values (minute)');
LEGEND_ALGEBRAIC(:,200) = strpad('AHTH in component rate_of_fluid_intake (dimensionless)');
LEGEND_ALGEBRAIC(:,198) = strpad('AHTH1 in component rate_of_fluid_intake (dimensionless)');
LEGEND_ALGEBRAIC(:,204) = strpad('TVZ in component rate_of_fluid_intake (L_per_minute)');
LEGEND_ALGEBRAIC(:,202) = strpad('TVZ1 in component rate_of_fluid_intake (L_per_minute)');
LEGEND_ALGEBRAIC(:,193) = strpad('AHZ in component effect_of_pressure_on_volume_receptors (dimensionless)');
LEGEND_CONSTANTS(:,154) = strpad('AH10 in component volume_receptors_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,155) = strpad('AH9 in component volume_receptors_parameter_values (per_mmHg)');
LEGEND_ALGEBRAIC(:,190) = strpad('AHZ1 in component effect_of_pressure_on_volume_receptors (dimensionless)');
LEGEND_CONSTANTS(:,156) = strpad('AH11 in component volume_receptors_parameter_values (minute)');
LEGEND_ALGEBRAIC(:,196) = strpad('AH7 in component total_volume_nervous_feedback (dimensionless)');
LEGEND_CONSTANTS(:,157) = strpad('ATRFBM in component volume_receptors_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,158) = strpad('ATRVM in component volume_receptors_parameter_values (litre)');
LEGEND_ALGEBRAIC(:,218) = strpad('PAR in component perfusion_pressure (mmHg)');
LEGEND_CONSTANTS(:,159) = strpad('GBL in component kidney_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,160) = strpad('RAPRSP in component kidney_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,161) = strpad('RFCDFT in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,162) = strpad('RCDFPC in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,163) = strpad('RCDFDP in component kidney_parameter_values (minute)');
LEGEND_STATES(:,40) = strpad('PAR1 in component perfusion_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,241) = strpad('RNAUG2 in component renal_autoregulatory_feedback_factor (dimensionless)');
LEGEND_CONSTANTS(:,164) = strpad('RNAUGN in component kidney_parameter_values (minute_per_L)');
LEGEND_CONSTANTS(:,165) = strpad('RNAULL in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,166) = strpad('RNAUUL in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,242) = strpad('RNAUG1 in component renal_autoregulatory_feedback_factor (dimensionless)');
LEGEND_ALGEBRAIC(:,243) = strpad('RNAUG1T in component renal_autoregulatory_feedback_factor (dimensionless)');
LEGEND_STATES(:,41) = strpad('RNAUG3 in component renal_autoregulatory_feedback_factor (dimensionless)');
LEGEND_ALGEBRAIC(:,220) = strpad('AUMK in component autonomic_effect_on_AAR (dimensionless)');
LEGEND_CONSTANTS(:,168) = strpad('ARF in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,219) = strpad('AUMKT in component autonomic_effect_on_AAR (dimensionless)');
LEGEND_ALGEBRAIC(:,222) = strpad('ANMAR in component angiotensin_effect_on_AAR (dimensionless)');
LEGEND_CONSTANTS(:,169) = strpad('ANMAM in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,170) = strpad('ANMARL in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,221) = strpad('ANMAR1 in component angiotensin_effect_on_AAR (dimensionless)');
LEGEND_ALGEBRAIC(:,244) = strpad('AAR1 in component AAR_calculation (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,171) = strpad('AARK in component kidney_parameter_values (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,245) = strpad('AAR in component atrial_natriuretic_peptide_effect_on_AAR (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,172) = strpad('ANPXAF in component kidney_parameter_values (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,173) = strpad('AARLL in component kidney_parameter_values (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,246) = strpad('AART in component atrial_natriuretic_peptide_effect_on_AAR (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,223) = strpad('AUMK2 in component autonomic_effect_on_EAR (dimensionless)');
LEGEND_CONSTANTS(:,174) = strpad('AUMK1 in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,224) = strpad('ANMER in component angiotensin_effect_on_EAR (dimensionless)');
LEGEND_CONSTANTS(:,175) = strpad('ANMEM in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,247) = strpad('RNAUG4 in component effect_of_renal_autoregulatory_feedback_on_EAR (dimensionless)');
LEGEND_CONSTANTS(:,176) = strpad('EFAFR in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,248) = strpad('EAR in component EAR_calculation (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,177) = strpad('EARK in component kidney_parameter_values (mmHg_minute_per_L)');
LEGEND_CONSTANTS(:,178) = strpad('EARLL in component kidney_parameter_values (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,249) = strpad('EAR1 in component EAR_calculation (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,250) = strpad('RR in component total_renal_resistance (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,251) = strpad('RFN in component normal_renal_blood_flow (L_per_minute)');
LEGEND_CONSTANTS(:,179) = strpad('REK in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,252) = strpad('GFN in component glomerular_filtration_rate (L_per_minute)');
LEGEND_ALGEBRAIC(:,253) = strpad('GLPC in component glomerular_colloid_osmotic_pressure (mmHg)');
LEGEND_CONSTANTS(:,180) = strpad('GPPD in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,181) = strpad('GLPCA in component kidney_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,254) = strpad('EFAFPR in component glomerular_colloid_osmotic_pressure (dimensionless)');
LEGEND_ALGEBRAIC(:,255) = strpad('EFAFPR1 in component glomerular_colloid_osmotic_pressure (dimensionless)');
LEGEND_ALGEBRAIC(:,256) = strpad('GLP in component glomerular_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,257) = strpad('APD in component glomerular_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,267) = strpad('GFR in component glomerular_filtration_rate (L_per_minute)');
LEGEND_CONSTANTS(:,182) = strpad('PXTP in component kidney_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,183) = strpad('GFLC in component kidney_parameter_values (L_per_minute_per_mmHg)');
LEGEND_CONSTANTS(:,184) = strpad('GFNLL in component kidney_parameter_values (L_per_minute)');
LEGEND_ALGEBRAIC(:,258) = strpad('PFL in component glomerular_filtration_rate (mmHg)');
LEGEND_ALGEBRAIC(:,259) = strpad('GFN1 in component glomerular_filtration_rate (L_per_minute)');
LEGEND_CONSTANTS(:,185) = strpad('MDFL1 in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,260) = strpad('PTFL in component proximal_tubular_and_macula_densa_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,261) = strpad('MDFLWT in component proximal_tubular_and_macula_densa_flow (L_per_minute)');
LEGEND_ALGEBRAIC(:,275) = strpad('RTSPPC in component renal_tissue_osmotic_pressure (mmHg)');
LEGEND_CONSTANTS(:,186) = strpad('RTPPR in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,187) = strpad('RTPPRS in component kidney_parameter_values (mmHg)');
LEGEND_ALGEBRAIC(:,268) = strpad('RTSPPC1 in component renal_tissue_osmotic_pressure (mmHg)');
LEGEND_ALGEBRAIC(:,319) = strpad('UROD in component actual_urea_excretion_rate (mOsm_per_minute)');
LEGEND_STATES(:,42) = strpad('PLUR in component glomerular_urea_concentration (mOsm)');
LEGEND_CONSTANTS(:,188) = strpad('URFORM in component kidney_parameter_values (mOsm_per_minute)');
LEGEND_ALGEBRAIC(:,225) = strpad('PLURC in component plasma_urea_concentration (mOsm_per_litre)');
LEGEND_ALGEBRAIC(:,283) = strpad('RCPRS in component peritubular_capillary_pressure (mmHg)');
LEGEND_CONSTANTS(:,189) = strpad('RFABX in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,190) = strpad('RVRS in component kidney_parameter_values (mmHg_minute_per_L)');
LEGEND_ALGEBRAIC(:,301) = strpad('RFABD in component peritubular_capillary_reabsorption_factor (dimensionless)');
LEGEND_CONSTANTS(:,191) = strpad('RTSPRS in component kidney_parameter_values (mmHg)');
LEGEND_CONSTANTS(:,192) = strpad('RABSC in component kidney_parameter_values (per_mmHg)');
LEGEND_CONSTANTS(:,193) = strpad('RFABDP in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,194) = strpad('RFABDM in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,293) = strpad('RABSPR in component peritubular_capillary_reabsorption_factor (mmHg)');
LEGEND_ALGEBRAIC(:,296) = strpad('RFAB1 in component peritubular_capillary_reabsorption_factor (dimensionless)');
LEGEND_ALGEBRAIC(:,298) = strpad('RFAB in component peritubular_capillary_reabsorption_factor (dimensionless)');
LEGEND_ALGEBRAIC(:,300) = strpad('RFABD1 in component peritubular_capillary_reabsorption_factor (dimensionless)');
LEGEND_ALGEBRAIC(:,302) = strpad('DTNAI in component distal_tubular_Na_delivery (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,304) = strpad('DTNARA in component Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,195) = strpad('DTNAR in component kidney_parameter_values (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,196) = strpad('DIURET in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,197) = strpad('AHMNAR in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,198) = strpad('DTNARL in component kidney_parameter_values (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,303) = strpad('DTNARA1 in component Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,227) = strpad('DTNANG in component angiotensin_induced_Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,199) = strpad('ANMNAM in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,226) = strpad('DTNANG1 in component angiotensin_induced_Na_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,305) = strpad('DTKI in component distal_tubular_K_delivery (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,306) = strpad('RFABK in component effect_of_physical_forces_on_distal_K_reabsorption (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,200) = strpad('RFABKM in component kidney_parameter_values (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,308) = strpad('MDFLK in component effect_of_fluid_flow_on_distal_K_reabsorption (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,201) = strpad('MDFLKM in component kidney_parameter_values (monovalent_mEq_per_litre)');
LEGEND_ALGEBRAIC(:,307) = strpad('MDFLK1 in component effect_of_fluid_flow_on_distal_K_reabsorption (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,315) = strpad('KODN in component normal_K_excretion (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,324) = strpad('VUDN in component normal_urine_volume (L_per_minute)');
LEGEND_STATES(:,43) = strpad('DTKA in component K_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,309) = strpad('DTKSC in component K_secretion_from_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_CONSTANTS(:,202) = strpad('ANMKEM in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,203) = strpad('ANMKEL in component kidney_parameter_values (dimensionless)');
LEGEND_CONSTANTS(:,204) = strpad('CKEEX in component kidney_parameter_values (dimensionless)');
LEGEND_ALGEBRAIC(:,228) = strpad('ANMKE1 in component K_secretion_from_distal_tubules (dimensionless)');
LEGEND_ALGEBRAIC(:,229) = strpad('ANMKE in component K_secretion_from_distal_tubules (dimensionless)');
LEGEND_ALGEBRAIC(:,311) = strpad('NODN in component normal_Na_excretion (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,310) = strpad('NODN1 in component normal_Na_excretion (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,313) = strpad('KODN1 in component normal_K_excretion (monovalent_mEq_per_minute)');
LEGEND_ALGEBRAIC(:,317) = strpad('DTURI in component normal_urea_excretion (mOsm_per_minute)');
LEGEND_ALGEBRAIC(:,320) = strpad('OSMOPN1 in component normal_osmolar_and_water_excretion (mOsm_per_minute)');
LEGEND_ALGEBRAIC(:,321) = strpad('OSMOPN in component normal_osmolar_and_water_excretion (mOsm_per_minute)');
LEGEND_ALGEBRAIC(:,322) = strpad('OSMOP1T in component normal_urine_volume (mOsm_per_minute)');
LEGEND_ALGEBRAIC(:,323) = strpad('OSMOP1 in component normal_urine_volume (mOsm_per_minute)');
LEGEND_CONSTANTS(:,205) = strpad('RNAGTC in component kidney_parameter_values (minute)');
LEGEND_CONSTANTS(:,206) = strpad('GFNDMP in component kidney_parameter_values (dimensionless)');
LEGEND_RATES(:,1) = strpad('d/dt AMC in component aldosterone_concentration (dimensionless)');
LEGEND_RATES(:,2) = strpad('d/dt ANX1 in component time_delayed_angiotensin_formation (dimensionless)');
LEGEND_RATES(:,3) = strpad('d/dt ANC in component angiotensin_concentration (dimensionless)');
LEGEND_RATES(:,5) = strpad('d/dt ANPC in component ANP_in_plasma (dimensionless)');
LEGEND_RATES(:,6) = strpad('d/dt AU6 in component arterial_baroreceptor_reflex (dimensionless)');
LEGEND_RATES(:,7) = strpad('d/dt AU1 in component actual_autonomic_stimulation (dimensionless)');
LEGEND_RATES(:,8) = strpad('d/dt VP in component plasma_volume (litre)');
LEGEND_RATES(:,9) = strpad('d/dt PRP in component total_plasma_protein (gram)');
LEGEND_RATES(:,10) = strpad('d/dt VTS2 in component interstitial_fluid_volume (litre)');
LEGEND_RATES(:,11) = strpad('d/dt TSP in component total_interstitial_protein (gram)');
LEGEND_RATES(:,21) = strpad('d/dt VRA1 in component right_atrial_blood_volume (litre)');
LEGEND_RATES(:,20) = strpad('d/dt VPA1 in component pulmonary_vasculature_blood_volume (litre)');
LEGEND_RATES(:,19) = strpad('d/dt VLA1 in component left_atrial_blood_volume (litre)');
LEGEND_RATES(:,17) = strpad('d/dt VVS1 in component venous_blood_volume (litre)');
LEGEND_RATES(:,18) = strpad('d/dt VAS1 in component arterial_blood_volume (litre)');
LEGEND_RATES(:,24) = strpad('d/dt NAE in component extracellular_Na_concentration (monovalent_mEq)');
LEGEND_RATES(:,25) = strpad('d/dt KTOT in component extracellular_K_concentration (monovalent_mEq)');
LEGEND_RATES(:,26) = strpad('d/dt VIC in component intracellular_fluid_volume (litre)');
LEGEND_RATES(:,23) = strpad('d/dt VTW in component total_body_water (litre)');
LEGEND_RATES(:,12) = strpad('d/dt HPL in component left_ventricular_hypertrophy (dimensionless)');
LEGEND_RATES(:,13) = strpad('d/dt HPR in component right_ventricular_hypertrophy (dimensionless)');
LEGEND_RATES(:,27) = strpad('d/dt HMD1 in component heart_deterioration (dimensionless)');
LEGEND_RATES(:,28) = strpad('d/dt AMM1T in component M_ST_time_delay_and_limit (dimensionless)');
LEGEND_RATES(:,29) = strpad('d/dt AMM2 in component M_LT_time_delay (dimensionless)');
LEGEND_RATES(:,31) = strpad('d/dt QOM1 in component volume_of_O2_in_M_tissue (mL)');
LEGEND_RATES(:,32) = strpad('d/dt AR1T in component NM_ST_time_delay_and_damping (dimensionless)');
LEGEND_RATES(:,33) = strpad('d/dt AR2T in component NM_I_time_delay_and_limit (dimensionless)');
LEGEND_RATES(:,34) = strpad('d/dt AR3T in component NM_LT_time_delay_and_limit (dimensionless)');
LEGEND_RATES(:,35) = strpad('d/dt QO2T in component volume_of_O2_in_NM_tissue (mL)');
LEGEND_RATES(:,36) = strpad('d/dt VPF1 in component pulmonary_interstitial_free_fluid_volume (litre)');
LEGEND_RATES(:,37) = strpad('d/dt PPR1 in component concentration_of_protein_in_pulmonary_interstitium (gram)');
LEGEND_RATES(:,30) = strpad('d/dt OVA in component O2_volume_of_arterial_blood (mL_per_L)');
LEGEND_RATES(:,14) = strpad('d/dt VRC in component RBC_volume (litre)');
LEGEND_RATES(:,16) = strpad('d/dt VV7 in component short_term_stress_relaxation (litre)');
LEGEND_RATES(:,15) = strpad('d/dt VV6 in component long_term_stress_relaxation (litre)');
LEGEND_RATES(:,22) = strpad('d/dt TVD in component rate_of_fluid_intake (L_per_minute)');
LEGEND_RATES(:,40) = strpad('d/dt PAR1 in component perfusion_pressure (mmHg)');
LEGEND_RATES(:,41) = strpad('d/dt RNAUG3 in component renal_autoregulatory_feedback_factor (dimensionless)');
LEGEND_RATES(:,42) = strpad('d/dt PLUR in component glomerular_urea_concentration (mOsm)');
LEGEND_RATES(:,43) = strpad('d/dt DTKA in component K_reabsorption_into_distal_tubules (monovalent_mEq_per_minute)');
LEGEND_STATES  = LEGEND_STATES';
LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC';
LEGEND_RATES = LEGEND_RATES';
LEGEND_CONSTANTS = LEGEND_CONSTANTS';
end

function [STATES, CONSTANTS] = initConsts()
VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = [];
CONSTANTS(:,1) = 1.0;
CONSTANTS(:,2) = 1.0;
CONSTANTS(:,3) = 1.0;
CONSTANTS(:,4) = 2.5;
CONSTANTS(:,5) = 12;
CONSTANTS(:,6) = 0;
CONSTANTS(:,7) = 0;
STATES(:,1) = 1.0;
CONSTANTS(:,8) = 60;
CONSTANTS(:,9) = 5;
CONSTANTS(:,10) = 0;
CONSTANTS(:,11) = 0.65;
CONSTANTS(:,12) = 2.5;
CONSTANTS(:,13) = 0.5;
CONSTANTS(:,14) = 0.8;
CONSTANTS(:,15) = 15;
CONSTANTS(:,16) = 0.04;
STATES(:,2) = 0.0;
CONSTANTS(:,17) = 0;
CONSTANTS(:,18) = 5000;
CONSTANTS(:,19) = 1;
CONSTANTS(:,20) = 0;
CONSTANTS(:,21) = 0;
STATES(:,3) = 0.859476;
CONSTANTS(:,22) = 12;
CONSTANTS(:,23) = 1.8;
CONSTANTS(:,24) = 0.7;
CONSTANTS(:,25) = 0.4;
CONSTANTS(:,26) = 6;
CONSTANTS(:,27) = 0.8;
CONSTANTS(:,28) = 0;
CONSTANTS(:,29) = 5;
STATES(:,4) = 1.0;
CONSTANTS(:,30) = 139;
CONSTANTS(:,31) = 85;
CONSTANTS(:,32) = 0.3;
CONSTANTS(:,33) = 0;
CONSTANTS(:,34) = 15;
CONSTANTS(:,35) = 2.5;
CONSTANTS(:,36) = 0.93617;
CONSTANTS(:,37) = 0.2;
CONSTANTS(:,38) = 5;
CONSTANTS(:,39) = 0;
CONSTANTS(:,40) = 0;
STATES(:,5) = 1.0;
CONSTANTS(:,41) = 4;
CONSTANTS(:,42) = 10;
CONSTANTS(:,43) = 0;
CONSTANTS(:,44) = 0;
CONSTANTS(:,45) = 0.3;
CONSTANTS(:,46) = 0.01;
CONSTANTS(:,47) = 1;
CONSTANTS(:,48) = 0.004;
CONSTANTS(:,49) = 0.16;
CONSTANTS(:,50) = -0.060024;
STATES(:,6) = 1.00132;
CONSTANTS(:,51) = 0.5;
CONSTANTS(:,52) = 0;
CONSTANTS(:,53) = 1;
CONSTANTS(:,54) = 1.0;
CONSTANTS(:,55) = 0.01;
CONSTANTS(:,56) = 0.3;
CONSTANTS(:,57) = 5.0;
CONSTANTS(:,58) = 0.4;
CONSTANTS(:,59) = 1.5;
STATES(:,7) = 1.00007;
CONSTANTS(:,60) = 2.51;
CONSTANTS(:,61) = 1.5;
CONSTANTS(:,62) = 0.55;
CONSTANTS(:,63) = 1;
CONSTANTS(:,64) = 0.1;
CONSTANTS(:,65) = 3;
CONSTANTS(:,66) = 1;
CONSTANTS(:,67) = 0;
CONSTANTS(:,68) = 0;
STATES(:,8) = 3.00449;
CONSTANTS(:,69) = 0.01167;
CONSTANTS(:,70) = 0;
STATES(:,9) = 216.243;
CONSTANTS(:,71) = 40;
CONSTANTS(:,72) = 0.03;
CONSTANTS(:,73) = 8;
CONSTANTS(:,74) = 2.728e-14;
CONSTANTS(:,75) = 15;
CONSTANTS(:,76) = 0.000253;
CONSTANTS(:,77) = 1;
CONSTANTS(:,78) = 0.15;
CONSTANTS(:,79) = 0.005;
STATES(:,10) = 0.0;
STATES(:,11) = 279.945;
CONSTANTS(:,80) = 60;
CONSTANTS(:,81) = 2;
CONSTANTS(:,82) = -2;
CONSTANTS(:,83) = 0.8092;
CONSTANTS(:,84) = 6;
CONSTANTS(:,85) = 4.2;
STATES(:,12) = 1.00163;
STATES(:,13) = 1.00237;
STATES(:,14) = 2.00439;
STATES(:,15) = 0.0101913;
STATES(:,16) = 0.00366525;
STATES(:,17) = 3.28246;
STATES(:,18) = 0.862514;
STATES(:,19) = 0.379883;
STATES(:,20) = 0.38131;
STATES(:,21) = 0.100043;
CONSTANTS(:,86) = 0.4;
CONSTANTS(:,87) = 0.15;
CONSTANTS(:,88) = 1;
CONSTANTS(:,89) = 1;
CONSTANTS(:,90) = -0.2;
CONSTANTS(:,91) = 0.1;
CONSTANTS(:,92) = 0;
CONSTANTS(:,93) = 0.2;
CONSTANTS(:,94) = 0.0212;
CONSTANTS(:,95) = 1;
CONSTANTS(:,96) = 2;
CONSTANTS(:,97) = 30.52;
CONSTANTS(:,98) = 1;
CONSTANTS(:,99) = 96.3;
CONSTANTS(:,100) = 0;
STATES(:,22) = 0.000980838;
STATES(:,23) = 39.8952;
CONSTANTS(:,101) = 0.1;
CONSTANTS(:,102) = 0;
STATES(:,24) = 2109.91;
CONSTANTS(:,103) = 0.3;
STATES(:,25) = 3622.54;
CONSTANTS(:,104) = 0.08;
STATES(:,26) = 25.0404;
CONSTANTS(:,105) = 0.01;
CONSTANTS(:,106) = 1;
CONSTANTS(:,107) = 0.625;
CONSTANTS(:,108) = 1;
CONSTANTS(:,109) = 0.05;
STATES(:,27) = 1.0;
CONSTANTS(:,110) = 0;
CONSTANTS(:,111) = 0.04;
CONSTANTS(:,112) = 0.1;
CONSTANTS(:,113) = 0.005;
STATES(:,28) = 1.00269;
CONSTANTS(:,114) = 2;
STATES(:,29) = 1.09071;
CONSTANTS(:,115) = 40000;
STATES(:,30) = 204.497;
CONSTANTS(:,116) = 1;
CONSTANTS(:,117) = 0.17;
CONSTANTS(:,118) = 57.1;
CONSTANTS(:,119) = 30;
STATES(:,31) = 48.0839;
CONSTANTS(:,120) = 0.79167;
CONSTANTS(:,121) = 35;
CONSTANTS(:,122) = 0.1;
CONSTANTS(:,123) = 0.5;
STATES(:,32) = 1.02127;
CONSTANTS(:,124) = 0.1;
CONSTANTS(:,125) = 60;
STATES(:,33) = 1.01179;
CONSTANTS(:,126) = 2;
CONSTANTS(:,127) = 40000;
STATES(:,34) = 1.1448;
CONSTANTS(:,128) = 0.9;
CONSTANTS(:,129) = 164;
STATES(:,35) = 72.2362;
CONSTANTS(:,130) = 0.0003;
STATES(:,36) = 0.0123238;
STATES(:,37) = 0.419998;
CONSTANTS(:,131) = 1;
CONSTANTS(:,132) = 150;
CONSTANTS(:,133) = 1.8;
CONSTANTS(:,134) = 0.0175;
STATES(:,38) = 2.368e-07;
CONSTANTS(:,135) = 90;
CONSTANTS(:,136) = 0.53333;
CONSTANTS(:,137) = 150;
CONSTANTS(:,138) = 1850;
CONSTANTS(:,139) = 4.714e-08;
CONSTANTS(:,140) = 1;
CONSTANTS(:,141) = 5.8e-06;
CONSTANTS(:,142) = 0;
CONSTANTS(:,143) = 1;
CONSTANTS(:,144) = 5;
CONSTANTS(:,145) = 1;
CONSTANTS(:,146) = 10000;
CONSTANTS(:,147) = 2;
CONSTANTS(:,148) = 45;
CONSTANTS(:,149) = 0.01;
CONSTANTS(:,150) = 2;
CONSTANTS(:,151) = 1.5;
CONSTANTS(:,152) = 0;
CONSTANTS(:,153) = 30;
CONSTANTS(:,154) = 0.333;
CONSTANTS(:,155) = 1;
STATES(:,39) = 0.301963;
CONSTANTS(:,156) = 1000;
CONSTANTS(:,157) = 0;
CONSTANTS(:,158) = 0;
CONSTANTS(:,159) = 0;
CONSTANTS(:,160) = 0;
CONSTANTS(:,161) = 0;
CONSTANTS(:,162) = 0;
CONSTANTS(:,163) = 2000;
STATES(:,40) = 103.525;
CONSTANTS(:,164) = 0.6;
CONSTANTS(:,165) = 0.3;
CONSTANTS(:,166) = 10;
CONSTANTS(:,167) = 0;
STATES(:,41) = 0.0;
CONSTANTS(:,168) = 0.5;
CONSTANTS(:,169) = 1.4;
CONSTANTS(:,170) = 0.86;
CONSTANTS(:,171) = 1;
CONSTANTS(:,172) = 1.5;
CONSTANTS(:,173) = 4;
CONSTANTS(:,174) = 0.3;
CONSTANTS(:,175) = 1.6;
CONSTANTS(:,176) = 0;
CONSTANTS(:,177) = 1;
CONSTANTS(:,178) = 24;
CONSTANTS(:,179) = 1;
CONSTANTS(:,180) = 1.0;
CONSTANTS(:,181) = 1.0;
CONSTANTS(:,182) = 8;
CONSTANTS(:,183) = 0.0208333;
CONSTANTS(:,184) = 0.001;
CONSTANTS(:,185) = 10;
CONSTANTS(:,186) = 0.9;
CONSTANTS(:,187) = 15.2;
STATES(:,42) = 159.549;
CONSTANTS(:,188) = 0.24;
CONSTANTS(:,189) = 0.8;
CONSTANTS(:,190) = 19.167;
CONSTANTS(:,191) = 6;
CONSTANTS(:,192) = 0.5;
CONSTANTS(:,193) = 1;
CONSTANTS(:,194) = 0.3;
CONSTANTS(:,195) = 0.675;
CONSTANTS(:,196) = 1;
CONSTANTS(:,197) = 0.3;
CONSTANTS(:,198) = 1e-06;
CONSTANTS(:,199) = 1;
CONSTANTS(:,200) = 0.03;
CONSTANTS(:,201) = 0.667;
STATES(:,43) = 0.0367573;
CONSTANTS(:,202) = 2;
CONSTANTS(:,203) = 0.3;
CONSTANTS(:,204) = 4;
CONSTANTS(:,205) = 15;
CONSTANTS(:,206) = 3;
CONSTANTS(:,207) = power(CONSTANTS(:,53), CONSTANTS(:,54));
CONSTANTS(:,208) =  power(CONSTANTS(:,110), 0.500000).*5.00000;
CONSTANTS(:,209) = piecewise({CONSTANTS(:,137)>80.0000, 80.0000 }, CONSTANTS(:,137));
CONSTANTS(:,210) = CONSTANTS(:,137) - 40.0000;
if (isempty(STATES)), warning('Initial values for states not set');, end
end

function [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS)
global algebraicVariableCount;
statesSize = size(STATES);
statesColumnCount = statesSize(2);
if ( statesColumnCount == 1)
STATES = STATES';
ALGEBRAIC = zeros(1, algebraicVariableCount);
utilOnes = 1;
else
statesRowCount = statesSize(1);
ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
RATES = zeros(statesRowCount, statesColumnCount);
utilOnes = ones(statesRowCount, 1);
end
ALGEBRAIC(:,32) = ((((((STATES(:,8)+STATES(:,14)) - STATES(:,17)) - STATES(:,18)) - STATES(:,19)) - STATES(:,20)) - STATES(:,21))./2.00000;
ALGEBRAIC(:,46) = STATES(:,19)+ ALGEBRAIC(:,32).*0.128000;
ALGEBRAIC(:,47) = ALGEBRAIC(:,46) - 0.380000;
ALGEBRAIC(:,48) = ALGEBRAIC(:,47)./0.0100000;
ALGEBRAIC(:,49) = piecewise({ (ALGEBRAIC(:,48) - 1.00000).*1.00000<0.00000, 0.00000 },  (ALGEBRAIC(:,48) - 1.00000).*1.00000);
ALGEBRAIC(:,33) = STATES(:,21)+ ALGEBRAIC(:,32).*0.0574000;
ALGEBRAIC(:,34) = ALGEBRAIC(:,33) - 0.100000;
ALGEBRAIC(:,35) = ALGEBRAIC(:,34)./0.00500000;
ALGEBRAIC(:,36) = piecewise({ (ALGEBRAIC(:,35)+1.00000).*2.00000<0.00000, 0.00000 },  (ALGEBRAIC(:,35)+1.00000).*2.00000);
ALGEBRAIC(:,51) = (ALGEBRAIC(:,49)+ALGEBRAIC(:,36))./3.00000;
ALGEBRAIC(:,53) = piecewise({CONSTANTS(:,39)>0.00000, CONSTANTS(:,39) }, ALGEBRAIC(:,51)+CONSTANTS(:,40));
RATES(:,5) = (ALGEBRAIC(:,53) - STATES(:,5))./CONSTANTS(:,41);
ALGEBRAIC(:,63) = STATES(:,18)+ ALGEBRAIC(:,32).*0.261000;
ALGEBRAIC(:,64) = ALGEBRAIC(:,63) - 0.495000;
ALGEBRAIC(:,65) = ALGEBRAIC(:,64)./0.00355000;
RATES(:,40) = ((100.000+ (ALGEBRAIC(:,65) - 100.000).*CONSTANTS(:,162)) - STATES(:,40))./CONSTANTS(:,163);
ALGEBRAIC(:,66) = piecewise({CONSTANTS(:,43)>1.00000e-07, CONSTANTS(:,43) }, ALGEBRAIC(:,65) - CONSTANTS(:,44));
ALGEBRAIC(:,67) = piecewise({ALGEBRAIC(:,66)<160.000&ALGEBRAIC(:,66)>=80.0000,  0.0166670.*(160.000 - ALGEBRAIC(:,66)) , ALGEBRAIC(:,66)<80.0000, 1.33360 }, 0.00000);
ALGEBRAIC(:,69) =  (ALGEBRAIC(:,67) - 1.00000).*CONSTANTS(:,47)+1.00000;
ALGEBRAIC(:,71) = ALGEBRAIC(:,69) - CONSTANTS(:,50);
RATES(:,6) = (ALGEBRAIC(:,71) - STATES(:,6))./CONSTANTS(:,49);
ALGEBRAIC(:,82) = STATES(:,23) - STATES(:,26);
ALGEBRAIC(:,83) = STATES(:,24)./ALGEBRAIC(:,82);
ALGEBRAIC(:,1) = CONSTANTS(:,9) - (CONSTANTS(:,9) - 1.00000)./( ((CONSTANTS(:,10) - 1.00000)./(CONSTANTS(:,10) - CONSTANTS(:,9))).*(STATES(:,1) - 1.00000).*CONSTANTS(:,11)+1.00000);
ALGEBRAIC(:,2) =  (ALGEBRAIC(:,1) - 1.00000).*CONSTANTS(:,12)+1.00000;
ALGEBRAIC(:,3) =  (ALGEBRAIC(:,2) - 1.00000).*CONSTANTS(:,13)+1.00000;
ALGEBRAIC(:,4) = piecewise({ALGEBRAIC(:,3)<0.200000, 0.200000 }, ALGEBRAIC(:,3));
ALGEBRAIC(:,78) =  (ALGEBRAIC(:,4) - 1.00000).*CONSTANTS(:,103)+1.00000;
ALGEBRAIC(:,79) = (STATES(:,25) - 3000.00)./( ALGEBRAIC(:,78).*9.33330);
ALGEBRAIC(:,80) = STATES(:,25) - ALGEBRAIC(:,79);
ALGEBRAIC(:,81) = ALGEBRAIC(:,80)./STATES(:,26);
ALGEBRAIC(:,86) = ALGEBRAIC(:,81) - ALGEBRAIC(:,83);
ALGEBRAIC(:,90) =  ALGEBRAIC(:,86).*CONSTANTS(:,105);
RATES(:,26) = ALGEBRAIC(:,90);
ALGEBRAIC(:,84) = (ALGEBRAIC(:,83) - CONSTANTS(:,30))./(142.000 - CONSTANTS(:,30));
ALGEBRAIC(:,88) = piecewise({ALGEBRAIC(:,84)<0.00000, 0.00000 }, ALGEBRAIC(:,84));
ALGEBRAIC(:,68) = piecewise({ALGEBRAIC(:,66)>CONSTANTS(:,31), CONSTANTS(:,31) }, ALGEBRAIC(:,66));
ALGEBRAIC(:,70) =  power(CONSTANTS(:,31) - ALGEBRAIC(:,68), 2.00000).*CONSTANTS(:,32);
ALGEBRAIC(:,92) = ALGEBRAIC(:,88)+ALGEBRAIC(:,70)+CONSTANTS(:,33);
ALGEBRAIC(:,95) = piecewise({ALGEBRAIC(:,92)<0.00000, 0.00000 }, ALGEBRAIC(:,92));
RATES(:,4) = (ALGEBRAIC(:,95) - STATES(:,4))./CONSTANTS(:,34);
ALGEBRAIC(:,7) = CONSTANTS(:,23) - (CONSTANTS(:,23) - 1.00000)./( ((CONSTANTS(:,24) - 1.00000)./(CONSTANTS(:,24) - CONSTANTS(:,23))).*(STATES(:,3) - 1.00000).*CONSTANTS(:,25)+1.00000);
ALGEBRAIC(:,8) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,4)+1.00000;
ALGEBRAIC(:,85) = ALGEBRAIC(:,79)./ALGEBRAIC(:,82);
ALGEBRAIC(:,87) = (ALGEBRAIC(:,85) - 3.30000)./1.00000;
ALGEBRAIC(:,91) =  ALGEBRAIC(:,8).*0.909000.*ALGEBRAIC(:,87);
ALGEBRAIC(:,94) =  (ALGEBRAIC(:,91) - 1.00000).*CONSTANTS(:,5)+1.00000;
ALGEBRAIC(:,97) = piecewise({ALGEBRAIC(:,94)<0.00000, 0.00000 }, ALGEBRAIC(:,94));
ALGEBRAIC(:,99) = piecewise({CONSTANTS(:,7)>0.00000, CONSTANTS(:,7) }, ALGEBRAIC(:,97)+CONSTANTS(:,6));
RATES(:,1) = (ALGEBRAIC(:,99) - STATES(:,1))./CONSTANTS(:,8);
ALGEBRAIC(:,102) = piecewise({STATES(:,31)<0.000100000, 0.000100000 }, STATES(:,31));
ALGEBRAIC(:,103) =  CONSTANTS(:,120).*ALGEBRAIC(:,102);
ALGEBRAIC(:,105) = ALGEBRAIC(:,103) - 38.0000;
ALGEBRAIC(:,107) =  ALGEBRAIC(:,105).*CONSTANTS(:,111)+1.00000;
RATES(:,28) = ( ALGEBRAIC(:,107).*1.00000 - STATES(:,28))./CONSTANTS(:,112);
ALGEBRAIC(:,108) =  CONSTANTS(:,114).*ALGEBRAIC(:,105)+1.00000;
RATES(:,29) = ( ALGEBRAIC(:,108).*1.00000 - STATES(:,29))./CONSTANTS(:,115);
ALGEBRAIC(:,114) = piecewise({STATES(:,35)<0.00000, 0.00000 }, STATES(:,35));
ALGEBRAIC(:,115) =  ALGEBRAIC(:,114).*0.486110;
ALGEBRAIC(:,117) =  (ALGEBRAIC(:,115) - 10.0000).*CONSTANTS(:,109);
RATES(:,27) = ALGEBRAIC(:,117);
ALGEBRAIC(:,118) = ALGEBRAIC(:,115) - CONSTANTS(:,121);
ALGEBRAIC(:,120) =  ALGEBRAIC(:,118).*CONSTANTS(:,122)+1.00000;
RATES(:,32) = ( ALGEBRAIC(:,120).*1.00000 - STATES(:,32))./CONSTANTS(:,123);
ALGEBRAIC(:,121) =  CONSTANTS(:,124).*ALGEBRAIC(:,118)+1.00000;
RATES(:,33) = ( ALGEBRAIC(:,121).*1.00000 - STATES(:,33))./CONSTANTS(:,125);
ALGEBRAIC(:,122) =  CONSTANTS(:,126).*ALGEBRAIC(:,118)+1.00000;
RATES(:,34) = ( ALGEBRAIC(:,122).*1.00000 - STATES(:,34))./CONSTANTS(:,127);
ALGEBRAIC(:,124) = piecewise({STATES(:,36)<0.00100000, 0.00100000 }, STATES(:,36));
ALGEBRAIC(:,125) = (ALGEBRAIC(:,82) - STATES(:,8)) - ALGEBRAIC(:,124);
RATES(:,10) =  ( (ALGEBRAIC(:,125) - 12.0000).*CONSTANTS(:,78) - STATES(:,10)).*CONSTANTS(:,79);
ALGEBRAIC(:,28) = STATES(:,9)./STATES(:,8);
ALGEBRAIC(:,31) =  0.280000.*ALGEBRAIC(:,28)+ 0.00190000.*power(ALGEBRAIC(:,28), 2.00000);
ALGEBRAIC(:,39) = STATES(:,20)+ ALGEBRAIC(:,32).*0.155000;
ALGEBRAIC(:,40) = ALGEBRAIC(:,39) - 0.306250;
ALGEBRAIC(:,41) = ALGEBRAIC(:,40)./0.00480000;
ALGEBRAIC(:,42) =  0.0260000.*ALGEBRAIC(:,41);
ALGEBRAIC(:,43) = piecewise({ALGEBRAIC(:,42)<1.00000e-05, 1.00000e-05 }, ALGEBRAIC(:,42));
ALGEBRAIC(:,44) = power(ALGEBRAIC(:,43), 0.500000);
ALGEBRAIC(:,45) = 1.00000./ALGEBRAIC(:,44);
ALGEBRAIC(:,52) = ALGEBRAIC(:,48)+18.0000;
ALGEBRAIC(:,54) = 1.00000./( ALGEBRAIC(:,52).*0.0357000);
ALGEBRAIC(:,123) = ( (ALGEBRAIC(:,41) - ALGEBRAIC(:,48)).*ALGEBRAIC(:,54))./(ALGEBRAIC(:,54)+ALGEBRAIC(:,45))+ALGEBRAIC(:,48);
ALGEBRAIC(:,143) = piecewise({STATES(:,37)<0.0250000, 0.0250000 }, STATES(:,37));
ALGEBRAIC(:,144) = ALGEBRAIC(:,143)./ALGEBRAIC(:,124);
ALGEBRAIC(:,145) =  ALGEBRAIC(:,144).*0.400000;
ALGEBRAIC(:,142) = 2.00000 - 0.150000./ALGEBRAIC(:,124);
ALGEBRAIC(:,146) =  (((ALGEBRAIC(:,123) - ALGEBRAIC(:,142))+ALGEBRAIC(:,145)) - ALGEBRAIC(:,31)).*CONSTANTS(:,130);
ALGEBRAIC(:,148) =  (ALGEBRAIC(:,142)+11.0000).*0.000300000;
ALGEBRAIC(:,149) = ALGEBRAIC(:,146) - ALGEBRAIC(:,148);
ALGEBRAIC(:,150) = ALGEBRAIC(:,149);
RATES(:,36) = ALGEBRAIC(:,150);
ALGEBRAIC(:,151) =  ALGEBRAIC(:,148).*ALGEBRAIC(:,144);
ALGEBRAIC(:,147) =  (ALGEBRAIC(:,28) - ALGEBRAIC(:,144)).*0.000225000;
ALGEBRAIC(:,152) = ALGEBRAIC(:,147) - ALGEBRAIC(:,151);
ALGEBRAIC(:,153) = ALGEBRAIC(:,152);
RATES(:,37) = ALGEBRAIC(:,153);
ALGEBRAIC(:,19) = CONSTANTS(:,57) - (CONSTANTS(:,57) - 1.00000)./exp( CONSTANTS(:,59).*(STATES(:,7) - 1.00000));
ALGEBRAIC(:,20) = piecewise({ALGEBRAIC(:,19)<CONSTANTS(:,58), CONSTANTS(:,58) }, ALGEBRAIC(:,19));
ALGEBRAIC(:,22) = ALGEBRAIC(:,20) - 1.00000;
ALGEBRAIC(:,23) =  ALGEBRAIC(:,22).*CONSTANTS(:,62)+1.00000;
ALGEBRAIC(:,89) = piecewise({STATES(:,27)>1.00000, 1.00000 }, STATES(:,27));
ALGEBRAIC(:,58) =  (ALGEBRAIC(:,48)+4.00000).*( CONSTANTS(:,86).*(ALGEBRAIC(:,20) - 1.00000)+1.00000) - 4.00000;
ALGEBRAIC(:,59) = piecewise({ALGEBRAIC(:,58)<= - 2.00000, 0.0100000 , ALGEBRAIC(:,58)> - 2.00000&ALGEBRAIC(:,58)<=1.00000, 0.0100000+( (3.60000 - 0.0100000).*(ALGEBRAIC(:,58) -  - 2.00000))./(1.00000 -  - 2.00000) , ALGEBRAIC(:,58)>1.00000&ALGEBRAIC(:,58)<=5.00000, 3.60000+( (9.40000 - 3.60000).*(ALGEBRAIC(:,58) - 1.00000))./(5.00000 - 1.00000) , ALGEBRAIC(:,58)>5.00000&ALGEBRAIC(:,58)<=8.00000, 9.40000+( (11.6000 - 9.40000).*(ALGEBRAIC(:,58) - 5.00000))./(8.00000 - 5.00000) , ALGEBRAIC(:,58)>8.00000&ALGEBRAIC(:,58)<=12.0000, 11.6000+( (13.5000 - 11.6000).*(ALGEBRAIC(:,58) - 8.00000))./(12.0000 - 8.00000) }, 13.5000);
ALGEBRAIC(:,156) = STATES(:,8)+STATES(:,14);
ALGEBRAIC(:,157) = STATES(:,14)./ALGEBRAIC(:,156);
ALGEBRAIC(:,158) =  100.000.*ALGEBRAIC(:,157);
ALGEBRAIC(:,159) = (STATES(:,30)./ALGEBRAIC(:,158))./5.25000;
ALGEBRAIC(:,162) = ALGEBRAIC(:,65)./( ALGEBRAIC(:,23).*ALGEBRAIC(:,159));
ALGEBRAIC(:,163) = piecewise({ALGEBRAIC(:,162)<=0.00000, 1.04000 , ALGEBRAIC(:,162)>0.00000&ALGEBRAIC(:,162)<=60.0000, 1.04000+( (1.02500 - 1.04000).*(ALGEBRAIC(:,162) - 0.00000))./(60.0000 - 0.00000) , ALGEBRAIC(:,162)>60.0000&ALGEBRAIC(:,162)<=125.000, 1.02500+( (0.970000 - 1.02500).*(ALGEBRAIC(:,162) - 60.0000))./(125.000 - 60.0000) , ALGEBRAIC(:,162)>125.000&ALGEBRAIC(:,162)<=160.000, 0.970000+( (0.880000 - 0.970000).*(ALGEBRAIC(:,162) - 125.000))./(160.000 - 125.000) , ALGEBRAIC(:,162)>160.000&ALGEBRAIC(:,162)<=200.000, 0.880000+( (0.590000 - 0.880000).*(ALGEBRAIC(:,162) - 160.000))./(200.000 - 160.000) , ALGEBRAIC(:,162)>200.000&ALGEBRAIC(:,162)<=240.000, 0.590000+( (0.00000 - 0.590000).*(ALGEBRAIC(:,162) - 200.000))./(240.000 - 200.000) }, 0.00000);
ALGEBRAIC(:,164) =  ALGEBRAIC(:,163).*ALGEBRAIC(:,59).*ALGEBRAIC(:,23).*CONSTANTS(:,89).*ALGEBRAIC(:,89).*STATES(:,12);
ALGEBRAIC(:,74) = (ALGEBRAIC(:,48) - ALGEBRAIC(:,65))./3.00000;
ALGEBRAIC(:,165) = piecewise({ALGEBRAIC(:,74)>0.00000, ALGEBRAIC(:,164)+ALGEBRAIC(:,74) }, ALGEBRAIC(:,164));
ALGEBRAIC(:,55) = ALGEBRAIC(:,54)+ALGEBRAIC(:,45);
ALGEBRAIC(:,56) = ALGEBRAIC(:,41) - ALGEBRAIC(:,48);
ALGEBRAIC(:,57) = ALGEBRAIC(:,56)./ALGEBRAIC(:,55);
ALGEBRAIC(:,167) = ALGEBRAIC(:,57) - ALGEBRAIC(:,165);
RATES(:,19) = ALGEBRAIC(:,167);
ALGEBRAIC(:,160) = (ALGEBRAIC(:,41)./ALGEBRAIC(:,23))./ALGEBRAIC(:,159);
ALGEBRAIC(:,161) = piecewise({ALGEBRAIC(:,160)<=0.00000, 1.06000 , ALGEBRAIC(:,160)>0.00000&ALGEBRAIC(:,160)<=32.0000, 1.06000+( (0.970000 - 1.06000).*(ALGEBRAIC(:,160) - 0.00000))./(32.0000 - 0.00000) , ALGEBRAIC(:,160)>32.0000&ALGEBRAIC(:,160)<=38.4000, 0.970000+( (0.930000 - 0.970000).*(ALGEBRAIC(:,160) - 32.0000))./(38.4000 - 32.0000) , ALGEBRAIC(:,160)>38.4000&ALGEBRAIC(:,160)<=48.0000, 0.930000+( (0.800000 - 0.930000).*(ALGEBRAIC(:,160) - 38.4000))./(48.0000 - 38.4000) , ALGEBRAIC(:,160)>48.0000&ALGEBRAIC(:,160)<=60.8000, 0.800000+( (0.460000 - 0.800000).*(ALGEBRAIC(:,160) - 48.0000))./(60.8000 - 48.0000) , ALGEBRAIC(:,160)>60.8000&ALGEBRAIC(:,160)<=72.0000, 0.460000+( (0.00000 - 0.460000).*(ALGEBRAIC(:,160) - 60.8000))./(72.0000 - 60.8000) }, 0.00000);
ALGEBRAIC(:,166) =  (1.00000 - CONSTANTS(:,87)).*ALGEBRAIC(:,23).*ALGEBRAIC(:,161).*CONSTANTS(:,88).*ALGEBRAIC(:,89).*STATES(:,13)+( CONSTANTS(:,87).*ALGEBRAIC(:,165))./ALGEBRAIC(:,59);
ALGEBRAIC(:,37) =  (ALGEBRAIC(:,35)+8.00000).*( CONSTANTS(:,86).*(ALGEBRAIC(:,20) - 1.00000)+1.00000) - 8.00000;
ALGEBRAIC(:,38) = piecewise({ALGEBRAIC(:,37)<= - 8.00000, 0.00000 , ALGEBRAIC(:,37)> - 8.00000&ALGEBRAIC(:,37)<= - 6.00000, 0.00000+( (0.750000 - 0.00000).*(ALGEBRAIC(:,37) -  - 8.00000))./( - 6.00000 -  - 8.00000) , ALGEBRAIC(:,37)> - 6.00000&ALGEBRAIC(:,37)<= - 2.00000, 0.750000+( (2.60000 - 0.750000).*(ALGEBRAIC(:,37) -  - 6.00000))./( - 2.00000 -  - 6.00000) , ALGEBRAIC(:,37)> - 2.00000&ALGEBRAIC(:,37)<=4.00000, 2.60000+( (9.80000 - 2.60000).*(ALGEBRAIC(:,37) -  - 2.00000))./(4.00000 -  - 2.00000) , ALGEBRAIC(:,37)>4.00000&ALGEBRAIC(:,37)<=12.0000, 9.80000+( (13.5000 - 9.80000).*(ALGEBRAIC(:,37) - 4.00000))./(12.0000 - 4.00000) }, 13.5000);
ALGEBRAIC(:,169) =  ALGEBRAIC(:,38).*ALGEBRAIC(:,166);
ALGEBRAIC(:,171) = ALGEBRAIC(:,169) - ALGEBRAIC(:,57);
RATES(:,20) = ALGEBRAIC(:,171);
ALGEBRAIC(:,170) = piecewise({ALGEBRAIC(:,159)>1.00000, 114.000+ (ALGEBRAIC(:,159) - 1.00000).*6667.00 , ALGEBRAIC(:,159)>0.936000&ALGEBRAIC(:,159)<=1.00000, 74.0000+ (ALGEBRAIC(:,159) - 0.936000).*625.000 , ALGEBRAIC(:,159)>0.800000&ALGEBRAIC(:,159)<=0.936000, 46.0000+ (ALGEBRAIC(:,159) - 0.800000).*205.882 },  ALGEBRAIC(:,159).*57.5000);
ALGEBRAIC(:,173) = (ALGEBRAIC(:,170) - 67.0000)./30.0000;
ALGEBRAIC(:,175) = piecewise({ALGEBRAIC(:,173)>1.00000, 1.00000 , ALGEBRAIC(:,173)<0.600000, 0.600000 }, ALGEBRAIC(:,173));
ALGEBRAIC(:,177) = 1.00000./ALGEBRAIC(:,175);
ALGEBRAIC(:,180) =  ( (ALGEBRAIC(:,177) - 1.00000).*3.00000 - STATES(:,38)).*0.000500000;
RATES(:,38) = ALGEBRAIC(:,180);
ALGEBRAIC(:,72) = piecewise({ALGEBRAIC(:,66)<80.0000&ALGEBRAIC(:,66)>=40.0000,  0.00500000.*(80.0000 - ALGEBRAIC(:,66)).*CONSTANTS(:,45) , ALGEBRAIC(:,66)<40.0000,  0.200000.*CONSTANTS(:,45) }, 0.00000);
ALGEBRAIC(:,172) = piecewise({ALGEBRAIC(:,170)<80.0000&ALGEBRAIC(:,170)>=40.0000,  CONSTANTS(:,46).*(80.0000 - ALGEBRAIC(:,170)) , ALGEBRAIC(:,170)<40.0000,  CONSTANTS(:,46).*40.0000 }, 0.00000);
ALGEBRAIC(:,174) = ALGEBRAIC(:,72)+ALGEBRAIC(:,172);
ALGEBRAIC(:,18) = STATES(:,6);
ALGEBRAIC(:,73) = piecewise({ALGEBRAIC(:,66)<40.0000,  0.0400000.*(40.0000 - ALGEBRAIC(:,66)).*CONSTANTS(:,51) }, 0.00000);
ALGEBRAIC(:,50) =  (15.0000./(ALGEBRAIC(:,48)+ALGEBRAIC(:,35)+ALGEBRAIC(:,41)) - 1.00000).*CONSTANTS(:,52)+1.00000;
ALGEBRAIC(:,176) =  ( CONSTANTS(:,207).*ALGEBRAIC(:,50).*(ALGEBRAIC(:,174)+ALGEBRAIC(:,18)+ALGEBRAIC(:,73)) - 1.00000).*CONSTANTS(:,55)+1.00000;
ALGEBRAIC(:,178) = piecewise({ALGEBRAIC(:,176)<0.00000, 0.00000 }, ALGEBRAIC(:,176));
ALGEBRAIC(:,181) = (ALGEBRAIC(:,178) - STATES(:,7))./CONSTANTS(:,56);
RATES(:,7) = ALGEBRAIC(:,181);
ALGEBRAIC(:,190) =  power(abs(ALGEBRAIC(:,35)), CONSTANTS(:,154)).*CONSTANTS(:,155);
ALGEBRAIC(:,193) = piecewise({ALGEBRAIC(:,35)<0.00000,  - ALGEBRAIC(:,190) }, ALGEBRAIC(:,190));
RATES(:,39) = (ALGEBRAIC(:,193) - STATES(:,39))./CONSTANTS(:,156);
ALGEBRAIC(:,185) =  (CONSTANTS(:,209) - 40.0000).*ALGEBRAIC(:,158);
ALGEBRAIC(:,187) = piecewise({ALGEBRAIC(:,185)+CONSTANTS(:,210)<0.00000, 0.00000 }, ALGEBRAIC(:,185)+CONSTANTS(:,210));
ALGEBRAIC(:,189) = CONSTANTS(:,138) - ALGEBRAIC(:,187);
ALGEBRAIC(:,191) = piecewise({ ALGEBRAIC(:,189).*CONSTANTS(:,139).*CONSTANTS(:,140)+5.00000e-06<0.00000, 0.00000 },  ALGEBRAIC(:,189).*CONSTANTS(:,139).*CONSTANTS(:,140)+5.00000e-06);
ALGEBRAIC(:,179) = ALGEBRAIC(:,158)./( (CONSTANTS(:,135) - ALGEBRAIC(:,158)).*CONSTANTS(:,136));
ALGEBRAIC(:,182) = ALGEBRAIC(:,179)+1.50000;
ALGEBRAIC(:,183) =  0.333300.*ALGEBRAIC(:,182);
ALGEBRAIC(:,194) =  STATES(:,14).*CONSTANTS(:,141).*ALGEBRAIC(:,183);
ALGEBRAIC(:,197) = (ALGEBRAIC(:,191) - ALGEBRAIC(:,194))+CONSTANTS(:,142);
RATES(:,14) = ALGEBRAIC(:,197);
ALGEBRAIC(:,195) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,151).*0.00100000;
ALGEBRAIC(:,184) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,147)+1.00000;
ALGEBRAIC(:,186) =  power(CONSTANTS(:,148) - ALGEBRAIC(:,115), 2.00000).*CONSTANTS(:,149).*ALGEBRAIC(:,184);
ALGEBRAIC(:,188) = piecewise({ALGEBRAIC(:,186)<0.800000, 0.800000 , ALGEBRAIC(:,186)>8.00000, 8.00000 }, ALGEBRAIC(:,186));
ALGEBRAIC(:,192) =  (STATES(:,4) - 1.00000).*CONSTANTS(:,150)+1.00000;
ALGEBRAIC(:,198) =  ALGEBRAIC(:,192).*ALGEBRAIC(:,188).*0.00100000;
ALGEBRAIC(:,200) = piecewise({ALGEBRAIC(:,198)<0.00000, 0.00000 }, ALGEBRAIC(:,198));
ALGEBRAIC(:,202) =  (ALGEBRAIC(:,195)+ALGEBRAIC(:,200)).*1.00000;
ALGEBRAIC(:,204) = piecewise({ALGEBRAIC(:,202)<0.00000, 0.00000 }, ALGEBRAIC(:,202));
RATES(:,22) = ((ALGEBRAIC(:,204)+CONSTANTS(:,152)) - STATES(:,22))./CONSTANTS(:,153);
ALGEBRAIC(:,21) = (CONSTANTS(:,60) -  ALGEBRAIC(:,20).*CONSTANTS(:,61))+CONSTANTS(:,61);
ALGEBRAIC(:,196) = ALGEBRAIC(:,193) - STATES(:,39);
ALGEBRAIC(:,206) =  ALGEBRAIC(:,196).*CONSTANTS(:,158);
ALGEBRAIC(:,60) = STATES(:,17)+ ALGEBRAIC(:,32).*0.398600;
ALGEBRAIC(:,9) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,26)+1.00000;
ALGEBRAIC(:,10) = piecewise({ALGEBRAIC(:,9)<CONSTANTS(:,27), CONSTANTS(:,27) }, ALGEBRAIC(:,9));
ALGEBRAIC(:,61) =  (ALGEBRAIC(:,10) - 1.00000).*CONSTANTS(:,90);
ALGEBRAIC(:,207) = ((((ALGEBRAIC(:,60) - ALGEBRAIC(:,21)) - ALGEBRAIC(:,61)) - STATES(:,16)) - STATES(:,15)) - ALGEBRAIC(:,206);
ALGEBRAIC(:,208) = piecewise({ALGEBRAIC(:,207)<0.000100000, 0.000100000 }, ALGEBRAIC(:,207));
RATES(:,16) = ( (ALGEBRAIC(:,208) - 0.740000).*CONSTANTS(:,143) - STATES(:,16))./CONSTANTS(:,144);
RATES(:,15) = ( (ALGEBRAIC(:,208) - 0.740000).*CONSTANTS(:,145) - STATES(:,15))./CONSTANTS(:,146);
ALGEBRAIC(:,209) = 3.70000+(ALGEBRAIC(:,208) - 0.740000)./CONSTANTS(:,91);
ALGEBRAIC(:,210) = piecewise({ALGEBRAIC(:,209)<0.000100000, 0.000100000 }, ALGEBRAIC(:,209));
ALGEBRAIC(:,211) = 0.740000./power(ALGEBRAIC(:,210)./( ALGEBRAIC(:,183).*3.70000), 0.500000);
ALGEBRAIC(:,62) = piecewise({ALGEBRAIC(:,35)<CONSTANTS(:,92), CONSTANTS(:,92) }, ALGEBRAIC(:,35));
ALGEBRAIC(:,212) = ALGEBRAIC(:,210) - ALGEBRAIC(:,62);
ALGEBRAIC(:,213) = ALGEBRAIC(:,212)./ALGEBRAIC(:,211);
ALGEBRAIC(:,215) = ALGEBRAIC(:,213) - ALGEBRAIC(:,169);
RATES(:,21) = ALGEBRAIC(:,215);
ALGEBRAIC(:,214) = ALGEBRAIC(:,65) - ALGEBRAIC(:,210);
ALGEBRAIC(:,100) = piecewise({STATES(:,28)<CONSTANTS(:,113), CONSTANTS(:,113) }, STATES(:,28));
ALGEBRAIC(:,101) =  ALGEBRAIC(:,100).*STATES(:,29);
ALGEBRAIC(:,12) = CONSTANTS(:,35) - (CONSTANTS(:,35) - 1.00000)./( ((CONSTANTS(:,36) - 1.00000)./(CONSTANTS(:,36) - CONSTANTS(:,35))).*(STATES(:,4) - 1.00000)+1.00000);
ALGEBRAIC(:,13) = piecewise({ALGEBRAIC(:,12)<CONSTANTS(:,36), CONSTANTS(:,36) }, ALGEBRAIC(:,12));
ALGEBRAIC(:,26) = power( ALGEBRAIC(:,22).*CONSTANTS(:,65)+1.00000, CONSTANTS(:,66));
ALGEBRAIC(:,199) =  ALGEBRAIC(:,196).*CONSTANTS(:,157)+1.00000;
ALGEBRAIC(:,76) = power(ALGEBRAIC(:,65)./100.000, CONSTANTS(:,96));
ALGEBRAIC(:,201) = (( ALGEBRAIC(:,10).*ALGEBRAIC(:,13).*ALGEBRAIC(:,26).*ALGEBRAIC(:,183).*CONSTANTS(:,2))./ALGEBRAIC(:,76))./ALGEBRAIC(:,199);
ALGEBRAIC(:,205) =  CONSTANTS(:,99).*ALGEBRAIC(:,101).*ALGEBRAIC(:,201).*CONSTANTS(:,1).*CONSTANTS(:,98);
ALGEBRAIC(:,216) = ALGEBRAIC(:,214)./ALGEBRAIC(:,205);
ALGEBRAIC(:,217) =  STATES(:,30).*ALGEBRAIC(:,216);
[CONSTANTS, STATES, ALGEBRAIC] = rootfind_0(VOI, CONSTANTS, STATES, ALGEBRAIC);
ALGEBRAIC(:,25) =  ALGEBRAIC(:,22).*CONSTANTS(:,64)+1.00000;
ALGEBRAIC(:,104) = piecewise({ALGEBRAIC(:,103)>38.0000, 38.0000 }, ALGEBRAIC(:,103));
ALGEBRAIC(:,106) =  ALGEBRAIC(:,25).*CONSTANTS(:,118).*CONSTANTS(:,116).*(1.00000 - power(38.0001 - ALGEBRAIC(:,104), 3.00000)./54872.0);
ALGEBRAIC(:,262) = ALGEBRAIC(:,230) - ALGEBRAIC(:,106);
RATES(:,31) = ALGEBRAIC(:,262);
ALGEBRAIC(:,11) =  (ALGEBRAIC(:,10) - 1.00000).*CONSTANTS(:,28)+1.00000;
ALGEBRAIC(:,16) = CONSTANTS(:,42) - CONSTANTS(:,42)./( 0.555556.*(1.00000+STATES(:,5)));
ALGEBRAIC(:,17) = piecewise({ALGEBRAIC(:,16)< - 1.00000,  - 1.00000 }, ALGEBRAIC(:,16));
ALGEBRAIC(:,27) =  ALGEBRAIC(:,22).*CONSTANTS(:,67)+1.00000;
ALGEBRAIC(:,109) = piecewise({STATES(:,32)<0.500000, 0.500000 }, STATES(:,32));
ALGEBRAIC(:,110) = piecewise({STATES(:,33)<0.500000, 0.500000 }, STATES(:,33));
ALGEBRAIC(:,111) = piecewise({STATES(:,34)<0.300000, 0.300000 }, STATES(:,34));
ALGEBRAIC(:,112) =  ALGEBRAIC(:,109).*ALGEBRAIC(:,110).*ALGEBRAIC(:,111);
ALGEBRAIC(:,113) =  (ALGEBRAIC(:,112) - 1.00000).*CONSTANTS(:,128)+1.00000;
ALGEBRAIC(:,203) =  CONSTANTS(:,97).*ALGEBRAIC(:,113).*ALGEBRAIC(:,201).*CONSTANTS(:,1).*CONSTANTS(:,98);
ALGEBRAIC(:,218) = piecewise({CONSTANTS(:,160)>0.00000&CONSTANTS(:,161)<=0.00000, CONSTANTS(:,160) , CONSTANTS(:,161)>0.00000, STATES(:,40) }, ALGEBRAIC(:,65) - CONSTANTS(:,159));
ALGEBRAIC(:,219) =  (ALGEBRAIC(:,26) - 1.00000).*CONSTANTS(:,168)+1.00000;
ALGEBRAIC(:,220) = piecewise({ALGEBRAIC(:,219)<0.800000, 0.800000 }, ALGEBRAIC(:,219));
ALGEBRAIC(:,221) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,169)+1.00000;
ALGEBRAIC(:,222) = piecewise({ALGEBRAIC(:,221)<CONSTANTS(:,170), CONSTANTS(:,170) }, ALGEBRAIC(:,221));
ALGEBRAIC(:,223) =  (ALGEBRAIC(:,220) - 1.00000).*CONSTANTS(:,174)+1.00000;
ALGEBRAIC(:,224) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,175)+1.00000;
[CONSTANTS, STATES, ALGEBRAIC] = rootfind_1(VOI, CONSTANTS, STATES, ALGEBRAIC);
RATES(:,41) =  (ALGEBRAIC(:,241) - 1.00000).*CONSTANTS(:,167);
ALGEBRAIC(:,263) = ALGEBRAIC(:,233);
ALGEBRAIC(:,269) = piecewise({ALGEBRAIC(:,263)>1.00000, 1.00000./(1.00000+ (ALGEBRAIC(:,263) - 1.00000).*72.0000) }, 10.0000 - 9.00000./(1.00000+ (1.00000 - ALGEBRAIC(:,263)).*8.00000));
ALGEBRAIC(:,276) =  (ALGEBRAIC(:,269) - 1.00000).*CONSTANTS(:,17);
RATES(:,2) = (ALGEBRAIC(:,276) - STATES(:,2))./CONSTANTS(:,18);
ALGEBRAIC(:,75) = ALGEBRAIC(:,65) - ALGEBRAIC(:,35);
ALGEBRAIC(:,77) =  ALGEBRAIC(:,75).*CONSTANTS(:,100);
ALGEBRAIC(:,265) =  CONSTANTS(:,179).*ALGEBRAIC(:,251);
ALGEBRAIC(:,271) = ALGEBRAIC(:,216)+ALGEBRAIC(:,235)+ALGEBRAIC(:,265);
ALGEBRAIC(:,280) = ALGEBRAIC(:,271)+ALGEBRAIC(:,77);
RATES(:,12) = (power(( ALGEBRAIC(:,65).*ALGEBRAIC(:,280))./( 500.000.*CONSTANTS(:,106)), CONSTANTS(:,107)) - STATES(:,12))./57600.0;
RATES(:,13) = (power(( ALGEBRAIC(:,41).*ALGEBRAIC(:,280))./( 75.0000.*CONSTANTS(:,108)), CONSTANTS(:,107)) - STATES(:,13))./57600.0;
ALGEBRAIC(:,126) = ALGEBRAIC(:,125) - STATES(:,10);
ALGEBRAIC(:,134) =  power((ALGEBRAIC(:,126) - CONSTANTS(:,84))./CONSTANTS(:,84), 2.00000).*1.00000;
ALGEBRAIC(:,131) = power((CONSTANTS(:,80)./ALGEBRAIC(:,125))./5.00000, CONSTANTS(:,81));
ALGEBRAIC(:,135) =  ALGEBRAIC(:,131).*CONSTANTS(:,82)+ALGEBRAIC(:,134);
ALGEBRAIC(:,128) = STATES(:,11)./ALGEBRAIC(:,125);
ALGEBRAIC(:,130) =  0.280000.*ALGEBRAIC(:,128)+ 0.00190000.*power(ALGEBRAIC(:,128), 2.00000);
ALGEBRAIC(:,132) =  ALGEBRAIC(:,131).*2.00000;
ALGEBRAIC(:,133) =  ALGEBRAIC(:,132).*ALGEBRAIC(:,130).*CONSTANTS(:,83);
ALGEBRAIC(:,264) = piecewise({ALGEBRAIC(:,236) - CONSTANTS(:,75)<0.00000, 0.00000 }, ALGEBRAIC(:,236) - CONSTANTS(:,75));
ALGEBRAIC(:,270) = power( ALGEBRAIC(:,264).*CONSTANTS(:,76), CONSTANTS(:,77));
ALGEBRAIC(:,278) =  (((ALGEBRAIC(:,236) - ALGEBRAIC(:,31)) - ALGEBRAIC(:,135))+ALGEBRAIC(:,133)).*CONSTANTS(:,69)+ALGEBRAIC(:,270);
ALGEBRAIC(:,136) = ALGEBRAIC(:,135) - ALGEBRAIC(:,132);
ALGEBRAIC(:,137) = (ALGEBRAIC(:,136)+CONSTANTS(:,85)) - ALGEBRAIC(:,134);
ALGEBRAIC(:,139) = piecewise({ALGEBRAIC(:,137)>7.00000, 7.00000 }, ALGEBRAIC(:,137));
ALGEBRAIC(:,140) = piecewise({ALGEBRAIC(:,139)<0.00000, 0.00000 },  ALGEBRAIC(:,139).*0.0200000);
ALGEBRAIC(:,285) = ((ALGEBRAIC(:,140) - ALGEBRAIC(:,278)) - ALGEBRAIC(:,150))+CONSTANTS(:,70);
RATES(:,8) = ALGEBRAIC(:,285);
ALGEBRAIC(:,29) = piecewise({ALGEBRAIC(:,28) - CONSTANTS(:,71)<0.00000, 0.00000 }, ALGEBRAIC(:,28) - CONSTANTS(:,71));
ALGEBRAIC(:,30) = CONSTANTS(:,72) -  power(ALGEBRAIC(:,29), CONSTANTS(:,73)).*CONSTANTS(:,74);
ALGEBRAIC(:,279) =  ALGEBRAIC(:,270).*ALGEBRAIC(:,28)+ (ALGEBRAIC(:,28) - ALGEBRAIC(:,128)).*0.00104000;
ALGEBRAIC(:,141) =  ALGEBRAIC(:,128).*ALGEBRAIC(:,140);
ALGEBRAIC(:,286) = (((ALGEBRAIC(:,30)+ALGEBRAIC(:,141)) - ALGEBRAIC(:,279)) - ALGEBRAIC(:,153))+ CONSTANTS(:,70).*72.0000;
RATES(:,9) = ALGEBRAIC(:,286);
ALGEBRAIC(:,287) = ALGEBRAIC(:,279) - ALGEBRAIC(:,141);
RATES(:,11) = ALGEBRAIC(:,287);
ALGEBRAIC(:,288) = ALGEBRAIC(:,280) - ALGEBRAIC(:,213);
RATES(:,17) = ALGEBRAIC(:,288);
ALGEBRAIC(:,289) = ALGEBRAIC(:,165) - ALGEBRAIC(:,280);
RATES(:,18) = ALGEBRAIC(:,289);
ALGEBRAIC(:,266) =  STATES(:,30).*ALGEBRAIC(:,235);
[CONSTANTS, STATES, ALGEBRAIC] = rootfind_2(VOI, CONSTANTS, STATES, ALGEBRAIC);
ALGEBRAIC(:,116) = piecewise({ALGEBRAIC(:,115)>35.0000, 35.0000 }, ALGEBRAIC(:,115));
ALGEBRAIC(:,119) =  ALGEBRAIC(:,25).*CONSTANTS(:,129).*(1.00000 - power(35.0001 - ALGEBRAIC(:,116), 3.00000)./42875.0);
ALGEBRAIC(:,281) = ALGEBRAIC(:,272) - ALGEBRAIC(:,119);
ALGEBRAIC(:,291) = piecewise({ALGEBRAIC(:,114)<6.00000&ALGEBRAIC(:,281)<0.00000,  ALGEBRAIC(:,281).*0.100000 }, ALGEBRAIC(:,281));
RATES(:,35) = ALGEBRAIC(:,291);
ALGEBRAIC(:,277) =  (ALGEBRAIC(:,269)+STATES(:,2)).*CONSTANTS(:,19);
ALGEBRAIC(:,284) = piecewise({ALGEBRAIC(:,277)<1.00000e-05, 1.00000e-05 }, ALGEBRAIC(:,277));
ALGEBRAIC(:,294) = piecewise({CONSTANTS(:,20)>0.00000, CONSTANTS(:,20) }, ALGEBRAIC(:,284)+CONSTANTS(:,21));
RATES(:,3) = (ALGEBRAIC(:,294) - STATES(:,3))./CONSTANTS(:,22);
ALGEBRAIC(:,282) = ALGEBRAIC(:,272)+ALGEBRAIC(:,230);
ALGEBRAIC(:,155) = STATES(:,38)+1.00000;
ALGEBRAIC(:,292) =  ALGEBRAIC(:,282).*CONSTANTS(:,131).*0.0266670.*ALGEBRAIC(:,177).*ALGEBRAIC(:,155);
ALGEBRAIC(:,295) = CONSTANTS(:,132) - (ALGEBRAIC(:,282)./ALGEBRAIC(:,292))./0.761000;
ALGEBRAIC(:,154) = CONSTANTS(:,133)./(CONSTANTS(:,134)+ALGEBRAIC(:,124));
ALGEBRAIC(:,297) =  (ALGEBRAIC(:,295) - ALGEBRAIC(:,170)).*ALGEBRAIC(:,154);
ALGEBRAIC(:,299) = (ALGEBRAIC(:,297) - ALGEBRAIC(:,282))./( ALGEBRAIC(:,169).*1.00000);
RATES(:,30) = ALGEBRAIC(:,299);
ALGEBRAIC(:,302) =  ALGEBRAIC(:,233).*ALGEBRAIC(:,83).*0.00616190;
ALGEBRAIC(:,5) =  (ALGEBRAIC(:,2) - 1.00000).*CONSTANTS(:,14)+1.00000;
ALGEBRAIC(:,6) = piecewise({ALGEBRAIC(:,5)<CONSTANTS(:,16), CONSTANTS(:,16) , ALGEBRAIC(:,5)>CONSTANTS(:,15), CONSTANTS(:,15) }, ALGEBRAIC(:,5));
ALGEBRAIC(:,14) = CONSTANTS(:,38) - (CONSTANTS(:,38) - 1.00000)./( ((CONSTANTS(:,37) - 1.00000)./(CONSTANTS(:,37) - CONSTANTS(:,38))).*(STATES(:,4) - 1.00000)+1.00000);
ALGEBRAIC(:,15) = piecewise({ALGEBRAIC(:,14)<CONSTANTS(:,37), CONSTANTS(:,37) }, ALGEBRAIC(:,14));
ALGEBRAIC(:,268) =  ALGEBRAIC(:,253).*CONSTANTS(:,186) - CONSTANTS(:,187);
ALGEBRAIC(:,275) = piecewise({ALGEBRAIC(:,268)<1.00000, 1.00000 }, ALGEBRAIC(:,268));
ALGEBRAIC(:,283) =  ( (ALGEBRAIC(:,251) - 1.20000).*CONSTANTS(:,189)+1.20000).*CONSTANTS(:,190);
ALGEBRAIC(:,293) = ((ALGEBRAIC(:,253)+CONSTANTS(:,191)) - ALGEBRAIC(:,283)) - ALGEBRAIC(:,275);
ALGEBRAIC(:,296) =  ALGEBRAIC(:,293).*CONSTANTS(:,192);
ALGEBRAIC(:,298) = ALGEBRAIC(:,296);
ALGEBRAIC(:,300) =  (ALGEBRAIC(:,298) - 1.00000).*CONSTANTS(:,194)+1.00000;
ALGEBRAIC(:,301) = piecewise({ALGEBRAIC(:,300)<0.000100000, 0.000100000 }, ALGEBRAIC(:,300));
ALGEBRAIC(:,303) =  (( ALGEBRAIC(:,6).*ALGEBRAIC(:,301).*CONSTANTS(:,195))./CONSTANTS(:,196)).*( (ALGEBRAIC(:,15) - 1.00000).*CONSTANTS(:,197)+1.00000);
ALGEBRAIC(:,304) = piecewise({ALGEBRAIC(:,303)<CONSTANTS(:,198), CONSTANTS(:,198) }, ALGEBRAIC(:,303));
ALGEBRAIC(:,226) =  ( (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,199)+1.00000).*0.100000;
ALGEBRAIC(:,227) = piecewise({ALGEBRAIC(:,226)<0.00000, 0.00000 }, ALGEBRAIC(:,226));
ALGEBRAIC(:,310) = (ALGEBRAIC(:,302) - ALGEBRAIC(:,304)) - ALGEBRAIC(:,227);
ALGEBRAIC(:,311) = piecewise({ALGEBRAIC(:,310)<1.00000e-08, 1.00000e-08 }, ALGEBRAIC(:,310));
ALGEBRAIC(:,312) =  ALGEBRAIC(:,311).*CONSTANTS(:,179);
ALGEBRAIC(:,314) = ( CONSTANTS(:,101).*ALGEBRAIC(:,188) - ALGEBRAIC(:,312))+ CONSTANTS(:,102).*142.000;
RATES(:,24) = ALGEBRAIC(:,314);
ALGEBRAIC(:,305) = ( ALGEBRAIC(:,302).*ALGEBRAIC(:,85))./ALGEBRAIC(:,83);
ALGEBRAIC(:,306) =  (ALGEBRAIC(:,301) - 1.00000).*CONSTANTS(:,200);
ALGEBRAIC(:,307) =  (ALGEBRAIC(:,233) - 1.00000).*CONSTANTS(:,201)+1.00000;
ALGEBRAIC(:,308) = piecewise({ALGEBRAIC(:,307)<0.100000, 0.100000 }, ALGEBRAIC(:,307));
ALGEBRAIC(:,228) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,202)+1.00000;
ALGEBRAIC(:,229) = piecewise({ALGEBRAIC(:,228)<CONSTANTS(:,203), CONSTANTS(:,203) }, ALGEBRAIC(:,228));
ALGEBRAIC(:,309) = ( power(ALGEBRAIC(:,85)./4.40000, CONSTANTS(:,204)).*ALGEBRAIC(:,4).*0.0800000.*ALGEBRAIC(:,308))./ALGEBRAIC(:,229);
ALGEBRAIC(:,313) = ((ALGEBRAIC(:,305)+ALGEBRAIC(:,309)) - STATES(:,43)) - ALGEBRAIC(:,306);
ALGEBRAIC(:,315) = piecewise({ALGEBRAIC(:,313)<0.00000, 0.00000 }, ALGEBRAIC(:,313));
ALGEBRAIC(:,316) =  ALGEBRAIC(:,315).*CONSTANTS(:,179);
ALGEBRAIC(:,318) = CONSTANTS(:,104) - ALGEBRAIC(:,316);
RATES(:,25) = ALGEBRAIC(:,318);
ALGEBRAIC(:,225) = STATES(:,42)./STATES(:,23);
ALGEBRAIC(:,317) =  power(ALGEBRAIC(:,252), 2.00000).*ALGEBRAIC(:,225).*3.84000;
ALGEBRAIC(:,319) =  ALGEBRAIC(:,317).*CONSTANTS(:,179);
RATES(:,42) = CONSTANTS(:,188) - ALGEBRAIC(:,319);
ALGEBRAIC(:,320) = ALGEBRAIC(:,317)+ 2.00000.*(ALGEBRAIC(:,311)+ALGEBRAIC(:,315));
ALGEBRAIC(:,321) = piecewise({ALGEBRAIC(:,320)>0.600000, 0.600000 }, ALGEBRAIC(:,320));
ALGEBRAIC(:,322) = ALGEBRAIC(:,320) - 0.600000;
ALGEBRAIC(:,323) = piecewise({ALGEBRAIC(:,322)<0.00000, 0.00000 }, ALGEBRAIC(:,322));
ALGEBRAIC(:,324) = ALGEBRAIC(:,321)./( 600.000.*ALGEBRAIC(:,15))+ALGEBRAIC(:,323)./360.000;
RATES(:,43) =  ( (ALGEBRAIC(:,315)./ALGEBRAIC(:,324)).*0.000451800 - STATES(:,43)).*1.00000;
ALGEBRAIC(:,325) =  ALGEBRAIC(:,324).*CONSTANTS(:,179);
RATES(:,23) = STATES(:,22) - ALGEBRAIC(:,325);
RATES = RATES';
end

% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
statesSize = size(STATES);
statesColumnCount = statesSize(2);
if ( statesColumnCount == 1)
STATES = STATES';
utilOnes = 1;
else
statesRowCount = statesSize(1);
utilOnes = ones(statesRowCount, 1);
end
ALGEBRAIC(:,32) = ((((((STATES(:,8)+STATES(:,14)) - STATES(:,17)) - STATES(:,18)) - STATES(:,19)) - STATES(:,20)) - STATES(:,21))./2.00000;
ALGEBRAIC(:,46) = STATES(:,19)+ ALGEBRAIC(:,32).*0.128000;
ALGEBRAIC(:,47) = ALGEBRAIC(:,46) - 0.380000;
ALGEBRAIC(:,48) = ALGEBRAIC(:,47)./0.0100000;
ALGEBRAIC(:,49) = piecewise({ (ALGEBRAIC(:,48) - 1.00000).*1.00000<0.00000, 0.00000 },  (ALGEBRAIC(:,48) - 1.00000).*1.00000);
ALGEBRAIC(:,33) = STATES(:,21)+ ALGEBRAIC(:,32).*0.0574000;
ALGEBRAIC(:,34) = ALGEBRAIC(:,33) - 0.100000;
ALGEBRAIC(:,35) = ALGEBRAIC(:,34)./0.00500000;
ALGEBRAIC(:,36) = piecewise({ (ALGEBRAIC(:,35)+1.00000).*2.00000<0.00000, 0.00000 },  (ALGEBRAIC(:,35)+1.00000).*2.00000);
ALGEBRAIC(:,51) = (ALGEBRAIC(:,49)+ALGEBRAIC(:,36))./3.00000;
ALGEBRAIC(:,53) = piecewise({CONSTANTS(:,39)>0.00000, CONSTANTS(:,39) }, ALGEBRAIC(:,51)+CONSTANTS(:,40));
ALGEBRAIC(:,63) = STATES(:,18)+ ALGEBRAIC(:,32).*0.261000;
ALGEBRAIC(:,64) = ALGEBRAIC(:,63) - 0.495000;
ALGEBRAIC(:,65) = ALGEBRAIC(:,64)./0.00355000;
ALGEBRAIC(:,66) = piecewise({CONSTANTS(:,43)>1.00000e-07, CONSTANTS(:,43) }, ALGEBRAIC(:,65) - CONSTANTS(:,44));
ALGEBRAIC(:,67) = piecewise({ALGEBRAIC(:,66)<160.000&ALGEBRAIC(:,66)>=80.0000,  0.0166670.*(160.000 - ALGEBRAIC(:,66)) , ALGEBRAIC(:,66)<80.0000, 1.33360 }, 0.00000);
ALGEBRAIC(:,69) =  (ALGEBRAIC(:,67) - 1.00000).*CONSTANTS(:,47)+1.00000;
ALGEBRAIC(:,71) = ALGEBRAIC(:,69) - CONSTANTS(:,50);
ALGEBRAIC(:,82) = STATES(:,23) - STATES(:,26);
ALGEBRAIC(:,83) = STATES(:,24)./ALGEBRAIC(:,82);
ALGEBRAIC(:,1) = CONSTANTS(:,9) - (CONSTANTS(:,9) - 1.00000)./( ((CONSTANTS(:,10) - 1.00000)./(CONSTANTS(:,10) - CONSTANTS(:,9))).*(STATES(:,1) - 1.00000).*CONSTANTS(:,11)+1.00000);
ALGEBRAIC(:,2) =  (ALGEBRAIC(:,1) - 1.00000).*CONSTANTS(:,12)+1.00000;
ALGEBRAIC(:,3) =  (ALGEBRAIC(:,2) - 1.00000).*CONSTANTS(:,13)+1.00000;
ALGEBRAIC(:,4) = piecewise({ALGEBRAIC(:,3)<0.200000, 0.200000 }, ALGEBRAIC(:,3));
ALGEBRAIC(:,78) =  (ALGEBRAIC(:,4) - 1.00000).*CONSTANTS(:,103)+1.00000;
ALGEBRAIC(:,79) = (STATES(:,25) - 3000.00)./( ALGEBRAIC(:,78).*9.33330);
ALGEBRAIC(:,80) = STATES(:,25) - ALGEBRAIC(:,79);
ALGEBRAIC(:,81) = ALGEBRAIC(:,80)./STATES(:,26);
ALGEBRAIC(:,86) = ALGEBRAIC(:,81) - ALGEBRAIC(:,83);
ALGEBRAIC(:,90) =  ALGEBRAIC(:,86).*CONSTANTS(:,105);
ALGEBRAIC(:,84) = (ALGEBRAIC(:,83) - CONSTANTS(:,30))./(142.000 - CONSTANTS(:,30));
ALGEBRAIC(:,88) = piecewise({ALGEBRAIC(:,84)<0.00000, 0.00000 }, ALGEBRAIC(:,84));
ALGEBRAIC(:,68) = piecewise({ALGEBRAIC(:,66)>CONSTANTS(:,31), CONSTANTS(:,31) }, ALGEBRAIC(:,66));
ALGEBRAIC(:,70) =  power(CONSTANTS(:,31) - ALGEBRAIC(:,68), 2.00000).*CONSTANTS(:,32);
ALGEBRAIC(:,92) = ALGEBRAIC(:,88)+ALGEBRAIC(:,70)+CONSTANTS(:,33);
ALGEBRAIC(:,95) = piecewise({ALGEBRAIC(:,92)<0.00000, 0.00000 }, ALGEBRAIC(:,92));
ALGEBRAIC(:,7) = CONSTANTS(:,23) - (CONSTANTS(:,23) - 1.00000)./( ((CONSTANTS(:,24) - 1.00000)./(CONSTANTS(:,24) - CONSTANTS(:,23))).*(STATES(:,3) - 1.00000).*CONSTANTS(:,25)+1.00000);
ALGEBRAIC(:,8) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,4)+1.00000;
ALGEBRAIC(:,85) = ALGEBRAIC(:,79)./ALGEBRAIC(:,82);
ALGEBRAIC(:,87) = (ALGEBRAIC(:,85) - 3.30000)./1.00000;
ALGEBRAIC(:,91) =  ALGEBRAIC(:,8).*0.909000.*ALGEBRAIC(:,87);
ALGEBRAIC(:,94) =  (ALGEBRAIC(:,91) - 1.00000).*CONSTANTS(:,5)+1.00000;
ALGEBRAIC(:,97) = piecewise({ALGEBRAIC(:,94)<0.00000, 0.00000 }, ALGEBRAIC(:,94));
ALGEBRAIC(:,99) = piecewise({CONSTANTS(:,7)>0.00000, CONSTANTS(:,7) }, ALGEBRAIC(:,97)+CONSTANTS(:,6));
ALGEBRAIC(:,102) = piecewise({STATES(:,31)<0.000100000, 0.000100000 }, STATES(:,31));
ALGEBRAIC(:,103) =  CONSTANTS(:,120).*ALGEBRAIC(:,102);
ALGEBRAIC(:,105) = ALGEBRAIC(:,103) - 38.0000;
ALGEBRAIC(:,107) =  ALGEBRAIC(:,105).*CONSTANTS(:,111)+1.00000;
ALGEBRAIC(:,108) =  CONSTANTS(:,114).*ALGEBRAIC(:,105)+1.00000;
ALGEBRAIC(:,114) = piecewise({STATES(:,35)<0.00000, 0.00000 }, STATES(:,35));
ALGEBRAIC(:,115) =  ALGEBRAIC(:,114).*0.486110;
ALGEBRAIC(:,117) =  (ALGEBRAIC(:,115) - 10.0000).*CONSTANTS(:,109);
ALGEBRAIC(:,118) = ALGEBRAIC(:,115) - CONSTANTS(:,121);
ALGEBRAIC(:,120) =  ALGEBRAIC(:,118).*CONSTANTS(:,122)+1.00000;
ALGEBRAIC(:,121) =  CONSTANTS(:,124).*ALGEBRAIC(:,118)+1.00000;
ALGEBRAIC(:,122) =  CONSTANTS(:,126).*ALGEBRAIC(:,118)+1.00000;
ALGEBRAIC(:,124) = piecewise({STATES(:,36)<0.00100000, 0.00100000 }, STATES(:,36));
ALGEBRAIC(:,125) = (ALGEBRAIC(:,82) - STATES(:,8)) - ALGEBRAIC(:,124);
ALGEBRAIC(:,28) = STATES(:,9)./STATES(:,8);
ALGEBRAIC(:,31) =  0.280000.*ALGEBRAIC(:,28)+ 0.00190000.*power(ALGEBRAIC(:,28), 2.00000);
ALGEBRAIC(:,39) = STATES(:,20)+ ALGEBRAIC(:,32).*0.155000;
ALGEBRAIC(:,40) = ALGEBRAIC(:,39) - 0.306250;
ALGEBRAIC(:,41) = ALGEBRAIC(:,40)./0.00480000;
ALGEBRAIC(:,42) =  0.0260000.*ALGEBRAIC(:,41);
ALGEBRAIC(:,43) = piecewise({ALGEBRAIC(:,42)<1.00000e-05, 1.00000e-05 }, ALGEBRAIC(:,42));
ALGEBRAIC(:,44) = power(ALGEBRAIC(:,43), 0.500000);
ALGEBRAIC(:,45) = 1.00000./ALGEBRAIC(:,44);
ALGEBRAIC(:,52) = ALGEBRAIC(:,48)+18.0000;
ALGEBRAIC(:,54) = 1.00000./( ALGEBRAIC(:,52).*0.0357000);
ALGEBRAIC(:,123) = ( (ALGEBRAIC(:,41) - ALGEBRAIC(:,48)).*ALGEBRAIC(:,54))./(ALGEBRAIC(:,54)+ALGEBRAIC(:,45))+ALGEBRAIC(:,48);
ALGEBRAIC(:,143) = piecewise({STATES(:,37)<0.0250000, 0.0250000 }, STATES(:,37));
ALGEBRAIC(:,144) = ALGEBRAIC(:,143)./ALGEBRAIC(:,124);
ALGEBRAIC(:,145) =  ALGEBRAIC(:,144).*0.400000;
ALGEBRAIC(:,142) = 2.00000 - 0.150000./ALGEBRAIC(:,124);
ALGEBRAIC(:,146) =  (((ALGEBRAIC(:,123) - ALGEBRAIC(:,142))+ALGEBRAIC(:,145)) - ALGEBRAIC(:,31)).*CONSTANTS(:,130);
ALGEBRAIC(:,148) =  (ALGEBRAIC(:,142)+11.0000).*0.000300000;
ALGEBRAIC(:,149) = ALGEBRAIC(:,146) - ALGEBRAIC(:,148);
ALGEBRAIC(:,150) = ALGEBRAIC(:,149);
ALGEBRAIC(:,151) =  ALGEBRAIC(:,148).*ALGEBRAIC(:,144);
ALGEBRAIC(:,147) =  (ALGEBRAIC(:,28) - ALGEBRAIC(:,144)).*0.000225000;
ALGEBRAIC(:,152) = ALGEBRAIC(:,147) - ALGEBRAIC(:,151);
ALGEBRAIC(:,153) = ALGEBRAIC(:,152);
ALGEBRAIC(:,19) = CONSTANTS(:,57) - (CONSTANTS(:,57) - 1.00000)./exp( CONSTANTS(:,59).*(STATES(:,7) - 1.00000));
ALGEBRAIC(:,20) = piecewise({ALGEBRAIC(:,19)<CONSTANTS(:,58), CONSTANTS(:,58) }, ALGEBRAIC(:,19));
ALGEBRAIC(:,22) = ALGEBRAIC(:,20) - 1.00000;
ALGEBRAIC(:,23) =  ALGEBRAIC(:,22).*CONSTANTS(:,62)+1.00000;
ALGEBRAIC(:,89) = piecewise({STATES(:,27)>1.00000, 1.00000 }, STATES(:,27));
ALGEBRAIC(:,58) =  (ALGEBRAIC(:,48)+4.00000).*( CONSTANTS(:,86).*(ALGEBRAIC(:,20) - 1.00000)+1.00000) - 4.00000;
ALGEBRAIC(:,59) = piecewise({ALGEBRAIC(:,58)<= - 2.00000, 0.0100000 , ALGEBRAIC(:,58)> - 2.00000&ALGEBRAIC(:,58)<=1.00000, 0.0100000+( (3.60000 - 0.0100000).*(ALGEBRAIC(:,58) -  - 2.00000))./(1.00000 -  - 2.00000) , ALGEBRAIC(:,58)>1.00000&ALGEBRAIC(:,58)<=5.00000, 3.60000+( (9.40000 - 3.60000).*(ALGEBRAIC(:,58) - 1.00000))./(5.00000 - 1.00000) , ALGEBRAIC(:,58)>5.00000&ALGEBRAIC(:,58)<=8.00000, 9.40000+( (11.6000 - 9.40000).*(ALGEBRAIC(:,58) - 5.00000))./(8.00000 - 5.00000) , ALGEBRAIC(:,58)>8.00000&ALGEBRAIC(:,58)<=12.0000, 11.6000+( (13.5000 - 11.6000).*(ALGEBRAIC(:,58) - 8.00000))./(12.0000 - 8.00000) }, 13.5000);
ALGEBRAIC(:,156) = STATES(:,8)+STATES(:,14);
ALGEBRAIC(:,157) = STATES(:,14)./ALGEBRAIC(:,156);
ALGEBRAIC(:,158) =  100.000.*ALGEBRAIC(:,157);
ALGEBRAIC(:,159) = (STATES(:,30)./ALGEBRAIC(:,158))./5.25000;
ALGEBRAIC(:,162) = ALGEBRAIC(:,65)./( ALGEBRAIC(:,23).*ALGEBRAIC(:,159));
ALGEBRAIC(:,163) = piecewise({ALGEBRAIC(:,162)<=0.00000, 1.04000 , ALGEBRAIC(:,162)>0.00000&ALGEBRAIC(:,162)<=60.0000, 1.04000+( (1.02500 - 1.04000).*(ALGEBRAIC(:,162) - 0.00000))./(60.0000 - 0.00000) , ALGEBRAIC(:,162)>60.0000&ALGEBRAIC(:,162)<=125.000, 1.02500+( (0.970000 - 1.02500).*(ALGEBRAIC(:,162) - 60.0000))./(125.000 - 60.0000) , ALGEBRAIC(:,162)>125.000&ALGEBRAIC(:,162)<=160.000, 0.970000+( (0.880000 - 0.970000).*(ALGEBRAIC(:,162) - 125.000))./(160.000 - 125.000) , ALGEBRAIC(:,162)>160.000&ALGEBRAIC(:,162)<=200.000, 0.880000+( (0.590000 - 0.880000).*(ALGEBRAIC(:,162) - 160.000))./(200.000 - 160.000) , ALGEBRAIC(:,162)>200.000&ALGEBRAIC(:,162)<=240.000, 0.590000+( (0.00000 - 0.590000).*(ALGEBRAIC(:,162) - 200.000))./(240.000 - 200.000) }, 0.00000);
ALGEBRAIC(:,164) =  ALGEBRAIC(:,163).*ALGEBRAIC(:,59).*ALGEBRAIC(:,23).*CONSTANTS(:,89).*ALGEBRAIC(:,89).*STATES(:,12);
ALGEBRAIC(:,74) = (ALGEBRAIC(:,48) - ALGEBRAIC(:,65))./3.00000;
ALGEBRAIC(:,165) = piecewise({ALGEBRAIC(:,74)>0.00000, ALGEBRAIC(:,164)+ALGEBRAIC(:,74) }, ALGEBRAIC(:,164));
ALGEBRAIC(:,55) = ALGEBRAIC(:,54)+ALGEBRAIC(:,45);
ALGEBRAIC(:,56) = ALGEBRAIC(:,41) - ALGEBRAIC(:,48);
ALGEBRAIC(:,57) = ALGEBRAIC(:,56)./ALGEBRAIC(:,55);
ALGEBRAIC(:,167) = ALGEBRAIC(:,57) - ALGEBRAIC(:,165);
ALGEBRAIC(:,160) = (ALGEBRAIC(:,41)./ALGEBRAIC(:,23))./ALGEBRAIC(:,159);
ALGEBRAIC(:,161) = piecewise({ALGEBRAIC(:,160)<=0.00000, 1.06000 , ALGEBRAIC(:,160)>0.00000&ALGEBRAIC(:,160)<=32.0000, 1.06000+( (0.970000 - 1.06000).*(ALGEBRAIC(:,160) - 0.00000))./(32.0000 - 0.00000) , ALGEBRAIC(:,160)>32.0000&ALGEBRAIC(:,160)<=38.4000, 0.970000+( (0.930000 - 0.970000).*(ALGEBRAIC(:,160) - 32.0000))./(38.4000 - 32.0000) , ALGEBRAIC(:,160)>38.4000&ALGEBRAIC(:,160)<=48.0000, 0.930000+( (0.800000 - 0.930000).*(ALGEBRAIC(:,160) - 38.4000))./(48.0000 - 38.4000) , ALGEBRAIC(:,160)>48.0000&ALGEBRAIC(:,160)<=60.8000, 0.800000+( (0.460000 - 0.800000).*(ALGEBRAIC(:,160) - 48.0000))./(60.8000 - 48.0000) , ALGEBRAIC(:,160)>60.8000&ALGEBRAIC(:,160)<=72.0000, 0.460000+( (0.00000 - 0.460000).*(ALGEBRAIC(:,160) - 60.8000))./(72.0000 - 60.8000) }, 0.00000);
ALGEBRAIC(:,166) =  (1.00000 - CONSTANTS(:,87)).*ALGEBRAIC(:,23).*ALGEBRAIC(:,161).*CONSTANTS(:,88).*ALGEBRAIC(:,89).*STATES(:,13)+( CONSTANTS(:,87).*ALGEBRAIC(:,165))./ALGEBRAIC(:,59);
ALGEBRAIC(:,37) =  (ALGEBRAIC(:,35)+8.00000).*( CONSTANTS(:,86).*(ALGEBRAIC(:,20) - 1.00000)+1.00000) - 8.00000;
ALGEBRAIC(:,38) = piecewise({ALGEBRAIC(:,37)<= - 8.00000, 0.00000 , ALGEBRAIC(:,37)> - 8.00000&ALGEBRAIC(:,37)<= - 6.00000, 0.00000+( (0.750000 - 0.00000).*(ALGEBRAIC(:,37) -  - 8.00000))./( - 6.00000 -  - 8.00000) , ALGEBRAIC(:,37)> - 6.00000&ALGEBRAIC(:,37)<= - 2.00000, 0.750000+( (2.60000 - 0.750000).*(ALGEBRAIC(:,37) -  - 6.00000))./( - 2.00000 -  - 6.00000) , ALGEBRAIC(:,37)> - 2.00000&ALGEBRAIC(:,37)<=4.00000, 2.60000+( (9.80000 - 2.60000).*(ALGEBRAIC(:,37) -  - 2.00000))./(4.00000 -  - 2.00000) , ALGEBRAIC(:,37)>4.00000&ALGEBRAIC(:,37)<=12.0000, 9.80000+( (13.5000 - 9.80000).*(ALGEBRAIC(:,37) - 4.00000))./(12.0000 - 4.00000) }, 13.5000);
ALGEBRAIC(:,169) =  ALGEBRAIC(:,38).*ALGEBRAIC(:,166);
ALGEBRAIC(:,171) = ALGEBRAIC(:,169) - ALGEBRAIC(:,57);
ALGEBRAIC(:,170) = piecewise({ALGEBRAIC(:,159)>1.00000, 114.000+ (ALGEBRAIC(:,159) - 1.00000).*6667.00 , ALGEBRAIC(:,159)>0.936000&ALGEBRAIC(:,159)<=1.00000, 74.0000+ (ALGEBRAIC(:,159) - 0.936000).*625.000 , ALGEBRAIC(:,159)>0.800000&ALGEBRAIC(:,159)<=0.936000, 46.0000+ (ALGEBRAIC(:,159) - 0.800000).*205.882 },  ALGEBRAIC(:,159).*57.5000);
ALGEBRAIC(:,173) = (ALGEBRAIC(:,170) - 67.0000)./30.0000;
ALGEBRAIC(:,175) = piecewise({ALGEBRAIC(:,173)>1.00000, 1.00000 , ALGEBRAIC(:,173)<0.600000, 0.600000 }, ALGEBRAIC(:,173));
ALGEBRAIC(:,177) = 1.00000./ALGEBRAIC(:,175);
ALGEBRAIC(:,180) =  ( (ALGEBRAIC(:,177) - 1.00000).*3.00000 - STATES(:,38)).*0.000500000;
ALGEBRAIC(:,72) = piecewise({ALGEBRAIC(:,66)<80.0000&ALGEBRAIC(:,66)>=40.0000,  0.00500000.*(80.0000 - ALGEBRAIC(:,66)).*CONSTANTS(:,45) , ALGEBRAIC(:,66)<40.0000,  0.200000.*CONSTANTS(:,45) }, 0.00000);
ALGEBRAIC(:,172) = piecewise({ALGEBRAIC(:,170)<80.0000&ALGEBRAIC(:,170)>=40.0000,  CONSTANTS(:,46).*(80.0000 - ALGEBRAIC(:,170)) , ALGEBRAIC(:,170)<40.0000,  CONSTANTS(:,46).*40.0000 }, 0.00000);
ALGEBRAIC(:,174) = ALGEBRAIC(:,72)+ALGEBRAIC(:,172);
ALGEBRAIC(:,18) = STATES(:,6);
ALGEBRAIC(:,73) = piecewise({ALGEBRAIC(:,66)<40.0000,  0.0400000.*(40.0000 - ALGEBRAIC(:,66)).*CONSTANTS(:,51) }, 0.00000);
ALGEBRAIC(:,50) =  (15.0000./(ALGEBRAIC(:,48)+ALGEBRAIC(:,35)+ALGEBRAIC(:,41)) - 1.00000).*CONSTANTS(:,52)+1.00000;
ALGEBRAIC(:,176) =  ( CONSTANTS(:,207).*ALGEBRAIC(:,50).*(ALGEBRAIC(:,174)+ALGEBRAIC(:,18)+ALGEBRAIC(:,73)) - 1.00000).*CONSTANTS(:,55)+1.00000;
ALGEBRAIC(:,178) = piecewise({ALGEBRAIC(:,176)<0.00000, 0.00000 }, ALGEBRAIC(:,176));
ALGEBRAIC(:,181) = (ALGEBRAIC(:,178) - STATES(:,7))./CONSTANTS(:,56);
ALGEBRAIC(:,190) =  power(abs(ALGEBRAIC(:,35)), CONSTANTS(:,154)).*CONSTANTS(:,155);
ALGEBRAIC(:,193) = piecewise({ALGEBRAIC(:,35)<0.00000,  - ALGEBRAIC(:,190) }, ALGEBRAIC(:,190));
ALGEBRAIC(:,185) =  (CONSTANTS(:,209) - 40.0000).*ALGEBRAIC(:,158);
ALGEBRAIC(:,187) = piecewise({ALGEBRAIC(:,185)+CONSTANTS(:,210)<0.00000, 0.00000 }, ALGEBRAIC(:,185)+CONSTANTS(:,210));
ALGEBRAIC(:,189) = CONSTANTS(:,138) - ALGEBRAIC(:,187);
ALGEBRAIC(:,191) = piecewise({ ALGEBRAIC(:,189).*CONSTANTS(:,139).*CONSTANTS(:,140)+5.00000e-06<0.00000, 0.00000 },  ALGEBRAIC(:,189).*CONSTANTS(:,139).*CONSTANTS(:,140)+5.00000e-06);
ALGEBRAIC(:,179) = ALGEBRAIC(:,158)./( (CONSTANTS(:,135) - ALGEBRAIC(:,158)).*CONSTANTS(:,136));
ALGEBRAIC(:,182) = ALGEBRAIC(:,179)+1.50000;
ALGEBRAIC(:,183) =  0.333300.*ALGEBRAIC(:,182);
ALGEBRAIC(:,194) =  STATES(:,14).*CONSTANTS(:,141).*ALGEBRAIC(:,183);
ALGEBRAIC(:,197) = (ALGEBRAIC(:,191) - ALGEBRAIC(:,194))+CONSTANTS(:,142);
ALGEBRAIC(:,195) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,151).*0.00100000;
ALGEBRAIC(:,184) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,147)+1.00000;
ALGEBRAIC(:,186) =  power(CONSTANTS(:,148) - ALGEBRAIC(:,115), 2.00000).*CONSTANTS(:,149).*ALGEBRAIC(:,184);
ALGEBRAIC(:,188) = piecewise({ALGEBRAIC(:,186)<0.800000, 0.800000 , ALGEBRAIC(:,186)>8.00000, 8.00000 }, ALGEBRAIC(:,186));
ALGEBRAIC(:,192) =  (STATES(:,4) - 1.00000).*CONSTANTS(:,150)+1.00000;
ALGEBRAIC(:,198) =  ALGEBRAIC(:,192).*ALGEBRAIC(:,188).*0.00100000;
ALGEBRAIC(:,200) = piecewise({ALGEBRAIC(:,198)<0.00000, 0.00000 }, ALGEBRAIC(:,198));
ALGEBRAIC(:,202) =  (ALGEBRAIC(:,195)+ALGEBRAIC(:,200)).*1.00000;
ALGEBRAIC(:,204) = piecewise({ALGEBRAIC(:,202)<0.00000, 0.00000 }, ALGEBRAIC(:,202));
ALGEBRAIC(:,21) = (CONSTANTS(:,60) -  ALGEBRAIC(:,20).*CONSTANTS(:,61))+CONSTANTS(:,61);
ALGEBRAIC(:,196) = ALGEBRAIC(:,193) - STATES(:,39);
ALGEBRAIC(:,206) =  ALGEBRAIC(:,196).*CONSTANTS(:,158);
ALGEBRAIC(:,60) = STATES(:,17)+ ALGEBRAIC(:,32).*0.398600;
ALGEBRAIC(:,9) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,26)+1.00000;
ALGEBRAIC(:,10) = piecewise({ALGEBRAIC(:,9)<CONSTANTS(:,27), CONSTANTS(:,27) }, ALGEBRAIC(:,9));
ALGEBRAIC(:,61) =  (ALGEBRAIC(:,10) - 1.00000).*CONSTANTS(:,90);
ALGEBRAIC(:,207) = ((((ALGEBRAIC(:,60) - ALGEBRAIC(:,21)) - ALGEBRAIC(:,61)) - STATES(:,16)) - STATES(:,15)) - ALGEBRAIC(:,206);
ALGEBRAIC(:,208) = piecewise({ALGEBRAIC(:,207)<0.000100000, 0.000100000 }, ALGEBRAIC(:,207));
ALGEBRAIC(:,209) = 3.70000+(ALGEBRAIC(:,208) - 0.740000)./CONSTANTS(:,91);
ALGEBRAIC(:,210) = piecewise({ALGEBRAIC(:,209)<0.000100000, 0.000100000 }, ALGEBRAIC(:,209));
ALGEBRAIC(:,211) = 0.740000./power(ALGEBRAIC(:,210)./( ALGEBRAIC(:,183).*3.70000), 0.500000);
ALGEBRAIC(:,62) = piecewise({ALGEBRAIC(:,35)<CONSTANTS(:,92), CONSTANTS(:,92) }, ALGEBRAIC(:,35));
ALGEBRAIC(:,212) = ALGEBRAIC(:,210) - ALGEBRAIC(:,62);
ALGEBRAIC(:,213) = ALGEBRAIC(:,212)./ALGEBRAIC(:,211);
ALGEBRAIC(:,215) = ALGEBRAIC(:,213) - ALGEBRAIC(:,169);
ALGEBRAIC(:,214) = ALGEBRAIC(:,65) - ALGEBRAIC(:,210);
ALGEBRAIC(:,100) = piecewise({STATES(:,28)<CONSTANTS(:,113), CONSTANTS(:,113) }, STATES(:,28));
ALGEBRAIC(:,101) =  ALGEBRAIC(:,100).*STATES(:,29);
ALGEBRAIC(:,12) = CONSTANTS(:,35) - (CONSTANTS(:,35) - 1.00000)./( ((CONSTANTS(:,36) - 1.00000)./(CONSTANTS(:,36) - CONSTANTS(:,35))).*(STATES(:,4) - 1.00000)+1.00000);
ALGEBRAIC(:,13) = piecewise({ALGEBRAIC(:,12)<CONSTANTS(:,36), CONSTANTS(:,36) }, ALGEBRAIC(:,12));
ALGEBRAIC(:,26) = power( ALGEBRAIC(:,22).*CONSTANTS(:,65)+1.00000, CONSTANTS(:,66));
ALGEBRAIC(:,199) =  ALGEBRAIC(:,196).*CONSTANTS(:,157)+1.00000;
ALGEBRAIC(:,76) = power(ALGEBRAIC(:,65)./100.000, CONSTANTS(:,96));
ALGEBRAIC(:,201) = (( ALGEBRAIC(:,10).*ALGEBRAIC(:,13).*ALGEBRAIC(:,26).*ALGEBRAIC(:,183).*CONSTANTS(:,2))./ALGEBRAIC(:,76))./ALGEBRAIC(:,199);
ALGEBRAIC(:,205) =  CONSTANTS(:,99).*ALGEBRAIC(:,101).*ALGEBRAIC(:,201).*CONSTANTS(:,1).*CONSTANTS(:,98);
ALGEBRAIC(:,216) = ALGEBRAIC(:,214)./ALGEBRAIC(:,205);
ALGEBRAIC(:,217) =  STATES(:,30).*ALGEBRAIC(:,216);
ALGEBRAIC(:,25) =  ALGEBRAIC(:,22).*CONSTANTS(:,64)+1.00000;
ALGEBRAIC(:,104) = piecewise({ALGEBRAIC(:,103)>38.0000, 38.0000 }, ALGEBRAIC(:,103));
ALGEBRAIC(:,106) =  ALGEBRAIC(:,25).*CONSTANTS(:,118).*CONSTANTS(:,116).*(1.00000 - power(38.0001 - ALGEBRAIC(:,104), 3.00000)./54872.0);
ALGEBRAIC(:,262) = ALGEBRAIC(:,230) - ALGEBRAIC(:,106);
ALGEBRAIC(:,11) =  (ALGEBRAIC(:,10) - 1.00000).*CONSTANTS(:,28)+1.00000;
ALGEBRAIC(:,16) = CONSTANTS(:,42) - CONSTANTS(:,42)./( 0.555556.*(1.00000+STATES(:,5)));
ALGEBRAIC(:,17) = piecewise({ALGEBRAIC(:,16)< - 1.00000,  - 1.00000 }, ALGEBRAIC(:,16));
ALGEBRAIC(:,27) =  ALGEBRAIC(:,22).*CONSTANTS(:,67)+1.00000;
ALGEBRAIC(:,109) = piecewise({STATES(:,32)<0.500000, 0.500000 }, STATES(:,32));
ALGEBRAIC(:,110) = piecewise({STATES(:,33)<0.500000, 0.500000 }, STATES(:,33));
ALGEBRAIC(:,111) = piecewise({STATES(:,34)<0.300000, 0.300000 }, STATES(:,34));
ALGEBRAIC(:,112) =  ALGEBRAIC(:,109).*ALGEBRAIC(:,110).*ALGEBRAIC(:,111);
ALGEBRAIC(:,113) =  (ALGEBRAIC(:,112) - 1.00000).*CONSTANTS(:,128)+1.00000;
ALGEBRAIC(:,203) =  CONSTANTS(:,97).*ALGEBRAIC(:,113).*ALGEBRAIC(:,201).*CONSTANTS(:,1).*CONSTANTS(:,98);
ALGEBRAIC(:,218) = piecewise({CONSTANTS(:,160)>0.00000&CONSTANTS(:,161)<=0.00000, CONSTANTS(:,160) , CONSTANTS(:,161)>0.00000, STATES(:,40) }, ALGEBRAIC(:,65) - CONSTANTS(:,159));
ALGEBRAIC(:,219) =  (ALGEBRAIC(:,26) - 1.00000).*CONSTANTS(:,168)+1.00000;
ALGEBRAIC(:,220) = piecewise({ALGEBRAIC(:,219)<0.800000, 0.800000 }, ALGEBRAIC(:,219));
ALGEBRAIC(:,221) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,169)+1.00000;
ALGEBRAIC(:,222) = piecewise({ALGEBRAIC(:,221)<CONSTANTS(:,170), CONSTANTS(:,170) }, ALGEBRAIC(:,221));
ALGEBRAIC(:,223) =  (ALGEBRAIC(:,220) - 1.00000).*CONSTANTS(:,174)+1.00000;
ALGEBRAIC(:,224) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,175)+1.00000;
ALGEBRAIC(:,263) = ALGEBRAIC(:,233);
ALGEBRAIC(:,269) = piecewise({ALGEBRAIC(:,263)>1.00000, 1.00000./(1.00000+ (ALGEBRAIC(:,263) - 1.00000).*72.0000) }, 10.0000 - 9.00000./(1.00000+ (1.00000 - ALGEBRAIC(:,263)).*8.00000));
ALGEBRAIC(:,276) =  (ALGEBRAIC(:,269) - 1.00000).*CONSTANTS(:,17);
ALGEBRAIC(:,75) = ALGEBRAIC(:,65) - ALGEBRAIC(:,35);
ALGEBRAIC(:,77) =  ALGEBRAIC(:,75).*CONSTANTS(:,100);
ALGEBRAIC(:,265) =  CONSTANTS(:,179).*ALGEBRAIC(:,251);
ALGEBRAIC(:,271) = ALGEBRAIC(:,216)+ALGEBRAIC(:,235)+ALGEBRAIC(:,265);
ALGEBRAIC(:,280) = ALGEBRAIC(:,271)+ALGEBRAIC(:,77);
ALGEBRAIC(:,126) = ALGEBRAIC(:,125) - STATES(:,10);
ALGEBRAIC(:,134) =  power((ALGEBRAIC(:,126) - CONSTANTS(:,84))./CONSTANTS(:,84), 2.00000).*1.00000;
ALGEBRAIC(:,131) = power((CONSTANTS(:,80)./ALGEBRAIC(:,125))./5.00000, CONSTANTS(:,81));
ALGEBRAIC(:,135) =  ALGEBRAIC(:,131).*CONSTANTS(:,82)+ALGEBRAIC(:,134);
ALGEBRAIC(:,128) = STATES(:,11)./ALGEBRAIC(:,125);
ALGEBRAIC(:,130) =  0.280000.*ALGEBRAIC(:,128)+ 0.00190000.*power(ALGEBRAIC(:,128), 2.00000);
ALGEBRAIC(:,132) =  ALGEBRAIC(:,131).*2.00000;
ALGEBRAIC(:,133) =  ALGEBRAIC(:,132).*ALGEBRAIC(:,130).*CONSTANTS(:,83);
ALGEBRAIC(:,264) = piecewise({ALGEBRAIC(:,236) - CONSTANTS(:,75)<0.00000, 0.00000 }, ALGEBRAIC(:,236) - CONSTANTS(:,75));
ALGEBRAIC(:,270) = power( ALGEBRAIC(:,264).*CONSTANTS(:,76), CONSTANTS(:,77));
ALGEBRAIC(:,278) =  (((ALGEBRAIC(:,236) - ALGEBRAIC(:,31)) - ALGEBRAIC(:,135))+ALGEBRAIC(:,133)).*CONSTANTS(:,69)+ALGEBRAIC(:,270);
ALGEBRAIC(:,136) = ALGEBRAIC(:,135) - ALGEBRAIC(:,132);
ALGEBRAIC(:,137) = (ALGEBRAIC(:,136)+CONSTANTS(:,85)) - ALGEBRAIC(:,134);
ALGEBRAIC(:,139) = piecewise({ALGEBRAIC(:,137)>7.00000, 7.00000 }, ALGEBRAIC(:,137));
ALGEBRAIC(:,140) = piecewise({ALGEBRAIC(:,139)<0.00000, 0.00000 },  ALGEBRAIC(:,139).*0.0200000);
ALGEBRAIC(:,285) = ((ALGEBRAIC(:,140) - ALGEBRAIC(:,278)) - ALGEBRAIC(:,150))+CONSTANTS(:,70);
ALGEBRAIC(:,29) = piecewise({ALGEBRAIC(:,28) - CONSTANTS(:,71)<0.00000, 0.00000 }, ALGEBRAIC(:,28) - CONSTANTS(:,71));
ALGEBRAIC(:,30) = CONSTANTS(:,72) -  power(ALGEBRAIC(:,29), CONSTANTS(:,73)).*CONSTANTS(:,74);
ALGEBRAIC(:,279) =  ALGEBRAIC(:,270).*ALGEBRAIC(:,28)+ (ALGEBRAIC(:,28) - ALGEBRAIC(:,128)).*0.00104000;
ALGEBRAIC(:,141) =  ALGEBRAIC(:,128).*ALGEBRAIC(:,140);
ALGEBRAIC(:,286) = (((ALGEBRAIC(:,30)+ALGEBRAIC(:,141)) - ALGEBRAIC(:,279)) - ALGEBRAIC(:,153))+ CONSTANTS(:,70).*72.0000;
ALGEBRAIC(:,287) = ALGEBRAIC(:,279) - ALGEBRAIC(:,141);
ALGEBRAIC(:,288) = ALGEBRAIC(:,280) - ALGEBRAIC(:,213);
ALGEBRAIC(:,289) = ALGEBRAIC(:,165) - ALGEBRAIC(:,280);
ALGEBRAIC(:,266) =  STATES(:,30).*ALGEBRAIC(:,235);
ALGEBRAIC(:,116) = piecewise({ALGEBRAIC(:,115)>35.0000, 35.0000 }, ALGEBRAIC(:,115));
ALGEBRAIC(:,119) =  ALGEBRAIC(:,25).*CONSTANTS(:,129).*(1.00000 - power(35.0001 - ALGEBRAIC(:,116), 3.00000)./42875.0);
ALGEBRAIC(:,281) = ALGEBRAIC(:,272) - ALGEBRAIC(:,119);
ALGEBRAIC(:,291) = piecewise({ALGEBRAIC(:,114)<6.00000&ALGEBRAIC(:,281)<0.00000,  ALGEBRAIC(:,281).*0.100000 }, ALGEBRAIC(:,281));
ALGEBRAIC(:,277) =  (ALGEBRAIC(:,269)+STATES(:,2)).*CONSTANTS(:,19);
ALGEBRAIC(:,284) = piecewise({ALGEBRAIC(:,277)<1.00000e-05, 1.00000e-05 }, ALGEBRAIC(:,277));
ALGEBRAIC(:,294) = piecewise({CONSTANTS(:,20)>0.00000, CONSTANTS(:,20) }, ALGEBRAIC(:,284)+CONSTANTS(:,21));
ALGEBRAIC(:,282) = ALGEBRAIC(:,272)+ALGEBRAIC(:,230);
ALGEBRAIC(:,155) = STATES(:,38)+1.00000;
ALGEBRAIC(:,292) =  ALGEBRAIC(:,282).*CONSTANTS(:,131).*0.0266670.*ALGEBRAIC(:,177).*ALGEBRAIC(:,155);
ALGEBRAIC(:,295) = CONSTANTS(:,132) - (ALGEBRAIC(:,282)./ALGEBRAIC(:,292))./0.761000;
ALGEBRAIC(:,154) = CONSTANTS(:,133)./(CONSTANTS(:,134)+ALGEBRAIC(:,124));
ALGEBRAIC(:,297) =  (ALGEBRAIC(:,295) - ALGEBRAIC(:,170)).*ALGEBRAIC(:,154);
ALGEBRAIC(:,299) = (ALGEBRAIC(:,297) - ALGEBRAIC(:,282))./( ALGEBRAIC(:,169).*1.00000);
ALGEBRAIC(:,302) =  ALGEBRAIC(:,233).*ALGEBRAIC(:,83).*0.00616190;
ALGEBRAIC(:,5) =  (ALGEBRAIC(:,2) - 1.00000).*CONSTANTS(:,14)+1.00000;
ALGEBRAIC(:,6) = piecewise({ALGEBRAIC(:,5)<CONSTANTS(:,16), CONSTANTS(:,16) , ALGEBRAIC(:,5)>CONSTANTS(:,15), CONSTANTS(:,15) }, ALGEBRAIC(:,5));
ALGEBRAIC(:,14) = CONSTANTS(:,38) - (CONSTANTS(:,38) - 1.00000)./( ((CONSTANTS(:,37) - 1.00000)./(CONSTANTS(:,37) - CONSTANTS(:,38))).*(STATES(:,4) - 1.00000)+1.00000);
ALGEBRAIC(:,15) = piecewise({ALGEBRAIC(:,14)<CONSTANTS(:,37), CONSTANTS(:,37) }, ALGEBRAIC(:,14));
ALGEBRAIC(:,268) =  ALGEBRAIC(:,253).*CONSTANTS(:,186) - CONSTANTS(:,187);
ALGEBRAIC(:,275) = piecewise({ALGEBRAIC(:,268)<1.00000, 1.00000 }, ALGEBRAIC(:,268));
ALGEBRAIC(:,283) =  ( (ALGEBRAIC(:,251) - 1.20000).*CONSTANTS(:,189)+1.20000).*CONSTANTS(:,190);
ALGEBRAIC(:,293) = ((ALGEBRAIC(:,253)+CONSTANTS(:,191)) - ALGEBRAIC(:,283)) - ALGEBRAIC(:,275);
ALGEBRAIC(:,296) =  ALGEBRAIC(:,293).*CONSTANTS(:,192);
ALGEBRAIC(:,298) = ALGEBRAIC(:,296);
ALGEBRAIC(:,300) =  (ALGEBRAIC(:,298) - 1.00000).*CONSTANTS(:,194)+1.00000;
ALGEBRAIC(:,301) = piecewise({ALGEBRAIC(:,300)<0.000100000, 0.000100000 }, ALGEBRAIC(:,300));
ALGEBRAIC(:,303) =  (( ALGEBRAIC(:,6).*ALGEBRAIC(:,301).*CONSTANTS(:,195))./CONSTANTS(:,196)).*( (ALGEBRAIC(:,15) - 1.00000).*CONSTANTS(:,197)+1.00000);
ALGEBRAIC(:,304) = piecewise({ALGEBRAIC(:,303)<CONSTANTS(:,198), CONSTANTS(:,198) }, ALGEBRAIC(:,303));
ALGEBRAIC(:,226) =  ( (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,199)+1.00000).*0.100000;
ALGEBRAIC(:,227) = piecewise({ALGEBRAIC(:,226)<0.00000, 0.00000 }, ALGEBRAIC(:,226));
ALGEBRAIC(:,310) = (ALGEBRAIC(:,302) - ALGEBRAIC(:,304)) - ALGEBRAIC(:,227);
ALGEBRAIC(:,311) = piecewise({ALGEBRAIC(:,310)<1.00000e-08, 1.00000e-08 }, ALGEBRAIC(:,310));
ALGEBRAIC(:,312) =  ALGEBRAIC(:,311).*CONSTANTS(:,179);
ALGEBRAIC(:,314) = ( CONSTANTS(:,101).*ALGEBRAIC(:,188) - ALGEBRAIC(:,312))+ CONSTANTS(:,102).*142.000;
ALGEBRAIC(:,305) = ( ALGEBRAIC(:,302).*ALGEBRAIC(:,85))./ALGEBRAIC(:,83);
ALGEBRAIC(:,306) =  (ALGEBRAIC(:,301) - 1.00000).*CONSTANTS(:,200);
ALGEBRAIC(:,307) =  (ALGEBRAIC(:,233) - 1.00000).*CONSTANTS(:,201)+1.00000;
ALGEBRAIC(:,308) = piecewise({ALGEBRAIC(:,307)<0.100000, 0.100000 }, ALGEBRAIC(:,307));
ALGEBRAIC(:,228) =  (ALGEBRAIC(:,7) - 1.00000).*CONSTANTS(:,202)+1.00000;
ALGEBRAIC(:,229) = piecewise({ALGEBRAIC(:,228)<CONSTANTS(:,203), CONSTANTS(:,203) }, ALGEBRAIC(:,228));
ALGEBRAIC(:,309) = ( power(ALGEBRAIC(:,85)./4.40000, CONSTANTS(:,204)).*ALGEBRAIC(:,4).*0.0800000.*ALGEBRAIC(:,308))./ALGEBRAIC(:,229);
ALGEBRAIC(:,313) = ((ALGEBRAIC(:,305)+ALGEBRAIC(:,309)) - STATES(:,43)) - ALGEBRAIC(:,306);
ALGEBRAIC(:,315) = piecewise({ALGEBRAIC(:,313)<0.00000, 0.00000 }, ALGEBRAIC(:,313));
ALGEBRAIC(:,316) =  ALGEBRAIC(:,315).*CONSTANTS(:,179);
ALGEBRAIC(:,318) = CONSTANTS(:,104) - ALGEBRAIC(:,316);
ALGEBRAIC(:,225) = STATES(:,42)./STATES(:,23);
ALGEBRAIC(:,317) =  power(ALGEBRAIC(:,252), 2.00000).*ALGEBRAIC(:,225).*3.84000;
ALGEBRAIC(:,319) =  ALGEBRAIC(:,317).*CONSTANTS(:,179);
ALGEBRAIC(:,320) = ALGEBRAIC(:,317)+ 2.00000.*(ALGEBRAIC(:,311)+ALGEBRAIC(:,315));
ALGEBRAIC(:,321) = piecewise({ALGEBRAIC(:,320)>0.600000, 0.600000 }, ALGEBRAIC(:,320));
ALGEBRAIC(:,322) = ALGEBRAIC(:,320) - 0.600000;
ALGEBRAIC(:,323) = piecewise({ALGEBRAIC(:,322)<0.00000, 0.00000 }, ALGEBRAIC(:,322));
ALGEBRAIC(:,324) = ALGEBRAIC(:,321)./( 600.000.*ALGEBRAIC(:,15))+ALGEBRAIC(:,323)./360.000;
ALGEBRAIC(:,325) =  ALGEBRAIC(:,324).*CONSTANTS(:,179);
ALGEBRAIC(:,24) =  ALGEBRAIC(:,22).*CONSTANTS(:,63)+1.00000;
ALGEBRAIC(:,93) =  72.0000.*ALGEBRAIC(:,24);
ALGEBRAIC(:,96) =  (ALGEBRAIC(:,89) - 1.00000).*0.500000+1.00000;
ALGEBRAIC(:,98) =  (ALGEBRAIC(:,93)+CONSTANTS(:,208)).*ALGEBRAIC(:,96);
ALGEBRAIC(:,127) = piecewise({ALGEBRAIC(:,125)<=0.00000, 0.00000 , ALGEBRAIC(:,125)>0.00000&ALGEBRAIC(:,125)<=12.0000, 0.00000+( (11.4000 - 0.00000).*(ALGEBRAIC(:,125) - 0.00000))./(12.0000 - 0.00000) , ALGEBRAIC(:,125)>12.0000&ALGEBRAIC(:,125)<=15.0000, 11.4000+( (14.0000 - 11.4000).*(ALGEBRAIC(:,125) - 12.0000))./(15.0000 - 12.0000) , ALGEBRAIC(:,125)>15.0000&ALGEBRAIC(:,125)<=18.0000, 14.0000+( (16.0000 - 14.0000).*(ALGEBRAIC(:,125) - 15.0000))./(18.0000 - 15.0000) , ALGEBRAIC(:,125)>18.0000&ALGEBRAIC(:,125)<=21.0000, 16.0000+( (17.3000 - 16.0000).*(ALGEBRAIC(:,125) - 18.0000))./(21.0000 - 18.0000) , ALGEBRAIC(:,125)>21.0000&ALGEBRAIC(:,125)<=24.0000, 17.3000+( (18.0000 - 17.3000).*(ALGEBRAIC(:,125) - 21.0000))./(24.0000 - 21.0000) }, 18.0000);
ALGEBRAIC(:,129) = ALGEBRAIC(:,125) - ALGEBRAIC(:,127);
ALGEBRAIC(:,138) = ALGEBRAIC(:,134) - ALGEBRAIC(:,136);
ALGEBRAIC(:,168) = ALGEBRAIC(:,165)./ALGEBRAIC(:,98);
ALGEBRAIC(:,267) =  ALGEBRAIC(:,252).*CONSTANTS(:,179);
ALGEBRAIC(:,290) = ALGEBRAIC(:,75)./ALGEBRAIC(:,280);
end

% Functions required for solving differential algebraic equation
function [CONSTANTS, STATES, ALGEBRAIC] = rootfind_0(VOI, CONSTANTS_IN, STATES_IN, ALGEBRAIC_IN)
ALGEBRAIC = ALGEBRAIC_IN;
CONSTANTS = CONSTANTS_IN;
STATES = STATES_IN;
global initialGuess_0;
if (length(initialGuess_0) ~= 3), initialGuess_0 = [56.8057,39.9793,0.699673];, end
options = optimset('Display', 'off', 'TolX', 1E-6);
if length(VOI) == 1
residualfn = @(algebraicCandidate)residualSN_0(algebraicCandidate, ALGEBRAIC, VOI, CONSTANTS, STATES);
soln = fsolve(residualfn, initialGuess_0, options);
initialGuess_0 = soln;
ALGEBRAIC(:,230) = soln(1);
ALGEBRAIC(:,231) = soln(2);
ALGEBRAIC(:,232) = soln(3);
else
SET_ALGEBRAIC(:,230) = logical(1);
SET_ALGEBRAIC(:,231) = logical(1);
SET_ALGEBRAIC(:,232) = logical(1);
for i=1:length(VOI)
residualfn = @(algebraicCandidate)residualSN_0(algebraicCandidate, ALGEBRAIC(i,:), VOI(i), CONSTANTS, STATES(i,:));
soln = fsolve(residualfn, initialGuess_0, options);
initialGuess_0 = soln;
TEMP_ALGEBRAIC(:,230) = soln(1);
TEMP_ALGEBRAIC(:,231) = soln(2);
TEMP_ALGEBRAIC(:,232) = soln(3);
ALGEBRAIC(i,SET_ALGEBRAIC) = TEMP_ALGEBRAIC(SET_ALGEBRAIC);
end
end
end

function resid = residualSN_0(algebraicCandidate, ALGEBRAIC, VOI, CONSTANTS, STATES)
ALGEBRAIC(:,230) = algebraicCandidate(1);
ALGEBRAIC(:,231) = algebraicCandidate(2);
ALGEBRAIC(:,232) = algebraicCandidate(3);
resid(1) = ALGEBRAIC(:,232) - (ALGEBRAIC(:,217) - ALGEBRAIC(:,230))./( ALGEBRAIC(:,158).*5.25000.*ALGEBRAIC(:,216));
resid(2) = ALGEBRAIC(:,231) -  57.1400.*ALGEBRAIC(:,232).*power(CONSTANTS(:,116), CONSTANTS(:,117));
resid(3) = ALGEBRAIC(:,230) -  (ALGEBRAIC(:,231) - ALGEBRAIC(:,103)).*CONSTANTS(:,119).*ALGEBRAIC(:,216);
end

% Functions required for solving differential algebraic equation
function [CONSTANTS, STATES, ALGEBRAIC] = rootfind_1(VOI, CONSTANTS_IN, STATES_IN, ALGEBRAIC_IN)
ALGEBRAIC = ALGEBRAIC_IN;
CONSTANTS = CONSTANTS_IN;
STATES = STATES_IN;
global initialGuess_1;
if (length(initialGuess_1) ~= 29), initialGuess_1 = [1.00051,2.77751,2.79521,16.9144,0.36019,2.77632,4.97174,35.7072,1.00071,1.00071,1.00071,40,40,40,0.6,42.4737,42.4737,84.8171,1.22057,0.125006,37.8383,1.20569,1.20569,51.842,47.88,6.00368,0.125006,1.00005,1.00051];, end
options = optimset('Display', 'off', 'TolX', 1E-6);
if length(VOI) == 1
residualfn = @(algebraicCandidate)residualSN_1(algebraicCandidate, ALGEBRAIC, VOI, CONSTANTS, STATES);
soln = fsolve(residualfn, initialGuess_1, options);
initialGuess_1 = soln;
ALGEBRAIC(:,233) = soln(1);
ALGEBRAIC(:,234) = soln(2);
ALGEBRAIC(:,235) = soln(3);
ALGEBRAIC(:,236) = soln(4);
ALGEBRAIC(:,237) = soln(5);
ALGEBRAIC(:,238) = soln(6);
ALGEBRAIC(:,239) = soln(7);
ALGEBRAIC(:,240) = soln(8);
ALGEBRAIC(:,241) = soln(9);
ALGEBRAIC(:,242) = soln(10);
ALGEBRAIC(:,243) = soln(11);
ALGEBRAIC(:,244) = soln(12);
ALGEBRAIC(:,245) = soln(13);
ALGEBRAIC(:,246) = soln(14);
ALGEBRAIC(:,247) = soln(15);
ALGEBRAIC(:,248) = soln(16);
ALGEBRAIC(:,249) = soln(17);
ALGEBRAIC(:,250) = soln(18);
ALGEBRAIC(:,251) = soln(19);
ALGEBRAIC(:,252) = soln(20);
ALGEBRAIC(:,253) = soln(21);
ALGEBRAIC(:,254) = soln(22);
ALGEBRAIC(:,255) = soln(23);
ALGEBRAIC(:,256) = soln(24);
ALGEBRAIC(:,257) = soln(25);
ALGEBRAIC(:,258) = soln(26);
ALGEBRAIC(:,259) = soln(27);
ALGEBRAIC(:,260) = soln(28);
ALGEBRAIC(:,261) = soln(29);
else
SET_ALGEBRAIC(:,233) = logical(1);
SET_ALGEBRAIC(:,234) = logical(1);
SET_ALGEBRAIC(:,235) = logical(1);
SET_ALGEBRAIC(:,236) = logical(1);
SET_ALGEBRAIC(:,237) = logical(1);
SET_ALGEBRAIC(:,238) = logical(1);
SET_ALGEBRAIC(:,239) = logical(1);
SET_ALGEBRAIC(:,240) = logical(1);
SET_ALGEBRAIC(:,241) = logical(1);
SET_ALGEBRAIC(:,242) = logical(1);
SET_ALGEBRAIC(:,243) = logical(1);
SET_ALGEBRAIC(:,244) = logical(1);
SET_ALGEBRAIC(:,245) = logical(1);
SET_ALGEBRAIC(:,246) = logical(1);
SET_ALGEBRAIC(:,247) = logical(1);
SET_ALGEBRAIC(:,248) = logical(1);
SET_ALGEBRAIC(:,249) = logical(1);
SET_ALGEBRAIC(:,250) = logical(1);
SET_ALGEBRAIC(:,251) = logical(1);
SET_ALGEBRAIC(:,252) = logical(1);
SET_ALGEBRAIC(:,253) = logical(1);
SET_ALGEBRAIC(:,254) = logical(1);
SET_ALGEBRAIC(:,255) = logical(1);
SET_ALGEBRAIC(:,256) = logical(1);
SET_ALGEBRAIC(:,257) = logical(1);
SET_ALGEBRAIC(:,258) = logical(1);
SET_ALGEBRAIC(:,259) = logical(1);
SET_ALGEBRAIC(:,260) = logical(1);
SET_ALGEBRAIC(:,261) = logical(1);
for i=1:length(VOI)
residualfn = @(algebraicCandidate)residualSN_1(algebraicCandidate, ALGEBRAIC(i,:), VOI(i), CONSTANTS, STATES(i,:));
soln = fsolve(residualfn, initialGuess_1, options);
initialGuess_1 = soln;
TEMP_ALGEBRAIC(:,233) = soln(1);
TEMP_ALGEBRAIC(:,234) = soln(2);
TEMP_ALGEBRAIC(:,235) = soln(3);
TEMP_ALGEBRAIC(:,236) = soln(4);
TEMP_ALGEBRAIC(:,237) = soln(5);
TEMP_ALGEBRAIC(:,238) = soln(6);
TEMP_ALGEBRAIC(:,239) = soln(7);
TEMP_ALGEBRAIC(:,240) = soln(8);
TEMP_ALGEBRAIC(:,241) = soln(9);
TEMP_ALGEBRAIC(:,242) = soln(10);
TEMP_ALGEBRAIC(:,243) = soln(11);
TEMP_ALGEBRAIC(:,244) = soln(12);
TEMP_ALGEBRAIC(:,245) = soln(13);
TEMP_ALGEBRAIC(:,246) = soln(14);
TEMP_ALGEBRAIC(:,247) = soln(15);
TEMP_ALGEBRAIC(:,248) = soln(16);
TEMP_ALGEBRAIC(:,249) = soln(17);
TEMP_ALGEBRAIC(:,250) = soln(18);
TEMP_ALGEBRAIC(:,251) = soln(19);
TEMP_ALGEBRAIC(:,252) = soln(20);
TEMP_ALGEBRAIC(:,253) = soln(21);
TEMP_ALGEBRAIC(:,254) = soln(22);
TEMP_ALGEBRAIC(:,255) = soln(23);
TEMP_ALGEBRAIC(:,256) = soln(24);
TEMP_ALGEBRAIC(:,257) = soln(25);
TEMP_ALGEBRAIC(:,258) = soln(26);
TEMP_ALGEBRAIC(:,259) = soln(27);
TEMP_ALGEBRAIC(:,260) = soln(28);
TEMP_ALGEBRAIC(:,261) = soln(29);
ALGEBRAIC(i,SET_ALGEBRAIC) = TEMP_ALGEBRAIC(SET_ALGEBRAIC);
end
end
end

function resid = residualSN_1(algebraicCandidate, ALGEBRAIC, VOI, CONSTANTS, STATES)
ALGEBRAIC(:,233) = algebraicCandidate(1);
ALGEBRAIC(:,234) = algebraicCandidate(2);
ALGEBRAIC(:,235) = algebraicCandidate(3);
ALGEBRAIC(:,236) = algebraicCandidate(4);
ALGEBRAIC(:,237) = algebraicCandidate(5);
ALGEBRAIC(:,238) = algebraicCandidate(6);
ALGEBRAIC(:,239) = algebraicCandidate(7);
ALGEBRAIC(:,240) = algebraicCandidate(8);
ALGEBRAIC(:,241) = algebraicCandidate(9);
ALGEBRAIC(:,242) = algebraicCandidate(10);
ALGEBRAIC(:,243) = algebraicCandidate(11);
ALGEBRAIC(:,244) = algebraicCandidate(12);
ALGEBRAIC(:,245) = algebraicCandidate(13);
ALGEBRAIC(:,246) = algebraicCandidate(14);
ALGEBRAIC(:,247) = algebraicCandidate(15);
ALGEBRAIC(:,248) = algebraicCandidate(16);
ALGEBRAIC(:,249) = algebraicCandidate(17);
ALGEBRAIC(:,250) = algebraicCandidate(18);
ALGEBRAIC(:,251) = algebraicCandidate(19);
ALGEBRAIC(:,252) = algebraicCandidate(20);
ALGEBRAIC(:,253) = algebraicCandidate(21);
ALGEBRAIC(:,254) = algebraicCandidate(22);
ALGEBRAIC(:,255) = algebraicCandidate(23);
ALGEBRAIC(:,256) = algebraicCandidate(24);
ALGEBRAIC(:,257) = algebraicCandidate(25);
ALGEBRAIC(:,258) = algebraicCandidate(26);
ALGEBRAIC(:,259) = algebraicCandidate(27);
ALGEBRAIC(:,260) = algebraicCandidate(28);
ALGEBRAIC(:,261) = algebraicCandidate(29);
resid(1) = ALGEBRAIC(:,236) - ( ALGEBRAIC(:,234).*1.70000.*ALGEBRAIC(:,235)+ALGEBRAIC(:,210));
resid(2) = ALGEBRAIC(:,237) -  ( (ALGEBRAIC(:,236) - 17.0000).*CONSTANTS(:,93)+17.0000).*CONSTANTS(:,94);
resid(3) = ALGEBRAIC(:,238) - CONSTANTS(:,95)./ALGEBRAIC(:,237);
resid(4) = ALGEBRAIC(:,234) -  ALGEBRAIC(:,27).*ALGEBRAIC(:,238).*ALGEBRAIC(:,183).*ALGEBRAIC(:,11);
resid(5) = ALGEBRAIC(:,239) -  ALGEBRAIC(:,234).*1.79000;
resid(6) = ALGEBRAIC(:,240) - (ALGEBRAIC(:,203)+ALGEBRAIC(:,239));
resid(7) = ALGEBRAIC(:,235) - ALGEBRAIC(:,214)./ALGEBRAIC(:,240);
resid(8) = ALGEBRAIC(:,243) - ( (ALGEBRAIC(:,233) - 1.00000).*CONSTANTS(:,164)+1.00000);
resid(9) = ALGEBRAIC(:,242) - piecewise({ALGEBRAIC(:,243)<CONSTANTS(:,165), CONSTANTS(:,165) , ALGEBRAIC(:,243)>CONSTANTS(:,166), CONSTANTS(:,166) }, ALGEBRAIC(:,243));
resid(10) = ALGEBRAIC(:,241) - (ALGEBRAIC(:,242) - STATES(:,41));
resid(11) = ALGEBRAIC(:,244) -  CONSTANTS(:,171).*CONSTANTS(:,3).*ALGEBRAIC(:,220).*ALGEBRAIC(:,241).*ALGEBRAIC(:,222).*40.0000.*CONSTANTS(:,1);
resid(12) = ALGEBRAIC(:,246) - ((ALGEBRAIC(:,244) -  ALGEBRAIC(:,17).*CONSTANTS(:,172))+CONSTANTS(:,172));
resid(13) = ALGEBRAIC(:,245) - piecewise({ALGEBRAIC(:,246)<CONSTANTS(:,173), CONSTANTS(:,173) }, ALGEBRAIC(:,246));
resid(14) = ALGEBRAIC(:,247) - ( (ALGEBRAIC(:,241) - 1.00000).*CONSTANTS(:,176)+1.00000);
resid(15) = ALGEBRAIC(:,249) -  43.3330.*CONSTANTS(:,177).*ALGEBRAIC(:,224).*ALGEBRAIC(:,247).*CONSTANTS(:,1).*ALGEBRAIC(:,223);
resid(16) = ALGEBRAIC(:,248) - piecewise({ALGEBRAIC(:,249)<CONSTANTS(:,178), CONSTANTS(:,178) }, ALGEBRAIC(:,249));
resid(17) = ALGEBRAIC(:,250) - (ALGEBRAIC(:,245)+ALGEBRAIC(:,248));
resid(18) = ALGEBRAIC(:,251) - ALGEBRAIC(:,218)./ALGEBRAIC(:,250);
resid(19) = ALGEBRAIC(:,255) - ( ALGEBRAIC(:,251).*(1.00000 - ALGEBRAIC(:,157)))./( ALGEBRAIC(:,251).*(1.00000 - ALGEBRAIC(:,157)) - ALGEBRAIC(:,252));
resid(20) = ALGEBRAIC(:,254) - piecewise({ALGEBRAIC(:,255)<1.00000, 1.00000 }, ALGEBRAIC(:,255));
resid(21) = ALGEBRAIC(:,253) - piecewise({CONSTANTS(:,181)>0.00000,  power(ALGEBRAIC(:,254), 1.35000).*ALGEBRAIC(:,31).*0.980000 }, ALGEBRAIC(:,31)+4.00000);
resid(22) = ALGEBRAIC(:,257) -  ALGEBRAIC(:,245).*ALGEBRAIC(:,251);
resid(23) = ALGEBRAIC(:,256) - (ALGEBRAIC(:,218) - ALGEBRAIC(:,257));
resid(24) = ALGEBRAIC(:,258) - ((ALGEBRAIC(:,256) - ALGEBRAIC(:,253)) - CONSTANTS(:,182));
resid(25) = ALGEBRAIC(:,259) -  ALGEBRAIC(:,258).*CONSTANTS(:,183);
resid(26) = ALGEBRAIC(:,252) - piecewise({ALGEBRAIC(:,259)<CONSTANTS(:,184), CONSTANTS(:,184) }, ALGEBRAIC(:,259));
resid(27) = ALGEBRAIC(:,260) -  ALGEBRAIC(:,252).*8.00000;
resid(28) = ALGEBRAIC(:,261) - ( (ALGEBRAIC(:,260) - 1.00000).*CONSTANTS(:,185)+1.00000);
resid(29) = ALGEBRAIC(:,233) - piecewise({ALGEBRAIC(:,261)<0.00000, 0.00000 }, ALGEBRAIC(:,261));
end

% Functions required for solving differential algebraic equation
function [CONSTANTS, STATES, ALGEBRAIC] = rootfind_2(VOI, CONSTANTS_IN, STATES_IN, ALGEBRAIC_IN)
ALGEBRAIC = ALGEBRAIC_IN;
CONSTANTS = CONSTANTS_IN;
STATES = STATES_IN;
global initialGuess_2;
if (length(initialGuess_2) ~= 3), initialGuess_2 = [163.508,37.6,0.694163];, end
options = optimset('Display', 'off', 'TolX', 1E-6);
if length(VOI) == 1
residualfn = @(algebraicCandidate)residualSN_2(algebraicCandidate, ALGEBRAIC, VOI, CONSTANTS, STATES);
soln = fsolve(residualfn, initialGuess_2, options);
initialGuess_2 = soln;
ALGEBRAIC(:,272) = soln(1);
ALGEBRAIC(:,273) = soln(2);
ALGEBRAIC(:,274) = soln(3);
else
SET_ALGEBRAIC(:,272) = logical(1);
SET_ALGEBRAIC(:,273) = logical(1);
SET_ALGEBRAIC(:,274) = logical(1);
for i=1:length(VOI)
residualfn = @(algebraicCandidate)residualSN_2(algebraicCandidate, ALGEBRAIC(i,:), VOI(i), CONSTANTS, STATES(i,:));
soln = fsolve(residualfn, initialGuess_2, options);
initialGuess_2 = soln;
TEMP_ALGEBRAIC(:,272) = soln(1);
TEMP_ALGEBRAIC(:,273) = soln(2);
TEMP_ALGEBRAIC(:,274) = soln(3);
ALGEBRAIC(i,SET_ALGEBRAIC) = TEMP_ALGEBRAIC(SET_ALGEBRAIC);
end
end
end

function resid = residualSN_2(algebraicCandidate, ALGEBRAIC, VOI, CONSTANTS, STATES)
ALGEBRAIC(:,272) = algebraicCandidate(1);
ALGEBRAIC(:,273) = algebraicCandidate(2);
ALGEBRAIC(:,274) = algebraicCandidate(3);
resid(1) = ALGEBRAIC(:,274) - (ALGEBRAIC(:,266) - ALGEBRAIC(:,272))./( ALGEBRAIC(:,158).*5.25000.*ALGEBRAIC(:,235));
resid(2) = ALGEBRAIC(:,273) -  ALGEBRAIC(:,274).*57.1400;
resid(3) = ALGEBRAIC(:,272) -  (ALGEBRAIC(:,273) - ALGEBRAIC(:,115)).*12.8570.*ALGEBRAIC(:,235);
end

% Compute result of a piecewise function
function x = piecewise(cases, default)
set = [0];
for i = 1:2:length(cases)
if (length(cases{i+1}) == 1)
x(cases{i} & ~set,:) = cases{i+1};
else
x(cases{i} & ~set,:) = cases{i+1}(cases{i} & ~set);
end
set = set | cases{i};
if(set), break, end
end
if (length(default) == 1)
x(~set,:) = default;
else
x(~set,:) = default(~set);
end
end

% Pad out or shorten strings to a set length
req_length = 160;
insize = size(strin,2);
if insize > req_length
strout = strin(1:req_length);
else
strout = [strin, blanks(req_length - insize)];
end
end

```
Source
Derived from workspace Guyton, Full cardiovascular circulation model at changeset 289ac0cbccb2.
Collaboration
To begin collaborating on this work, please use your git client and issue this command: