How hpeuscher/oxygen-concentrator-model works
Purpose and entry points
This is a MATLAB/Octave simulation repository for a Devilbiss-style pressure-swing adsorption (PSA) oxygen concentrator. The principal executable workflows are:
• src/sim_devilbiss_theoretical.m — parameterized theoretical device simulation.
• src/sim_devilbiss_experimental.m — simulation aligned with recorded experimental data.
• src/sim_psa.m — core PSA-cycle simulation invoked by the device-level workflows.
The included measurement input is datasets/20260410_122553_Devilbiss.mat.
Device-level simulation orchestration
src/sim_devilbiss_theoretical.m and src/sim_devilbiss_experimental.m configure a Devilbiss system, establish operating scenarios, run the PSA model, and produce result views. They form the boundary between user-facing study scripts and reusable physical-model functions.
Default model parameters are centralized in src/devilbiss_default_params.m, allowing both entry points to share nominal device, bed, valve, and timing assumptions.
PSA state evolution
src/sim_psa.m is the central dynamic model. It advances the PSA system through its cycle and coordinates pressure, flow, adsorption/state behavior, and boundary-condition inputs. Its output is the primary simulation-result structure consumed by visualization and comparison stages.
Historical or phase-dependent PSA state is supplied by src/historic_psa_state_devilbiss.m, which provides Devilbiss-specific state context needed across cycle transitions.
Boundary conditions and system interfaces
src/get_bc_devilbiss.m defines Devilbiss-specific boundary conditions for the PSA model. This separates external device behavior—such as supply, product, exhaust, or cycle-phase conditions—from generic cycle integration in src/sim_psa.m.
This is an important modeling boundary: device scripts select parameters and conditions; the PSA engine evolves the internal system under those conditions.
Pneumatic flow modeling
Flow through ordinary restrictions/valves is modeled by src/compute_valve_flow.m. One-way/check-valve behavior is handled separately by src/compute_check_valve_flow.m.
These functions encapsulate component-level pneumatic constraints, so higher-level PSA logic can request flows without embedding valve equations directly. src/sigmoid.m likely supports smooth switching or transition behavior used by the physical/control model.
Experimental-data integration
src/sim_devilbiss_experimental.m is the data-comparison path and is associated with datasets/20260410_122553_Devilbiss.mat. The dataset is a material external input boundary: measured device behavior enters here, while the simulation core remains in src/sim_psa.m and its Devilbiss adapters.
Results visualization
Simulation outputs are rendered through:
• src/plot_simulation_results_1d.m
• src/plot_simulation_results_2d.m
src/link_all_axes.m supports synchronized figure inspection, and src/colormap_symmetric.m supports balanced visualization of signed or centered quantities. Plotting is downstream of simulation and should not alter model state.
Components 14
Study workflows
User-facing device simulation scripts.
- Theoretical study · Parameterized nominal-device simulation.
src/sim_devilbiss_theoretical.m - Experimental study · Simulation and measured-data comparison workflow.
src/sim_devilbiss_experimental.m - Devilbiss measurements · Recorded experimental device input.
datasets/20260410_122553_Devilbiss.mat
PSA model
Cycle evolution and Devilbiss-specific model adapters.
- Default parameters · Shared nominal device, bed, valve, and timing assumptions.
src/devilbiss_default_params.m - PSA cycle simulator · Central dynamic model that advances PSA cycle state.
src/sim_psa.m - Historical PSA state · Devilbiss state context across cycle transitions.
src/historic_psa_state_devilbiss.m - Devilbiss boundary conditions · Supply, product, exhaust, and phase conditions.
src/get_bc_devilbiss.m
Pneumatic components
Reusable valve-flow constraints.
- Valve flow · Flow through ordinary restrictions and valves.
src/compute_valve_flow.m - Check-valve flow · One-way pneumatic flow behavior.
src/compute_check_valve_flow.m - Smooth switching · Supports smooth physical or control transitions.
src/sigmoid.m
Results views
Downstream visualization utilities.
- 1D results plots · Renders one-dimensional simulation outputs.
src/plot_simulation_results_1d.m - 2D results plots · Renders two-dimensional simulation outputs.
src/plot_simulation_results_2d.m - Linked axes · Synchronizes figure inspection.
src/link_all_axes.m - Symmetric colormap · Balanced display for signed or centered values.
src/colormap_symmetric.m
Connections 17
- Theoretical study → Default parameters: loads
- Theoretical study → PSA cycle simulator: runs
- Theoretical study → 1D results plots: renders results
- Theoretical study → 2D results plots: renders results
- Experimental study → Devilbiss measurements: loads measurements
- Experimental study → Default parameters: loads
- Experimental study → PSA cycle simulator: runs
- Experimental study → 1D results plots: renders comparison
- Experimental study → 2D results plots: renders comparison
- PSA cycle simulator → Historical PSA state: uses state context
- PSA cycle simulator → Devilbiss boundary conditions: requests conditions
- PSA cycle simulator → Valve flow: computes flows
- PSA cycle simulator → Check-valve flow: computes one-way flows
- PSA cycle simulator → Smooth switching: uses smooth transitions
- 1D results plots → Linked axes: synchronizes views
- 2D results plots → Linked axes: synchronizes views
- 2D results plots → Symmetric colormap: colors centered values