Skip to content

Repository files navigation

Automatic Control Laboratory Projects

Reproducible control-system experiments from nonlinear modelling to portable C99 runtimes

Python validation MATLAB validation C validation MATLAB R2024b C99 Python 3.10 to 3.12

This repository is a control-engineering portfolio covering nonlinear systems, state-space control, LQR, observers, actuator saturation, anti-windup, numerical validation, and deployment-oriented C implementations.

It is designed for engineers and students who want more than isolated scripts: each experiment documents its model, assumptions, controller design, measurable results, automated evidence, and limitations.

Project status

The five documented studies, independent Python reference models, MATLAB tests and two portable C99 runtimes are implemented and maintained. Current work is focused on clearer traceability and portability rather than adding unverified hardware claims.

The published numbers are reproducible simulation results. No experiment in this repository has been validated on physical laboratory hardware.

Why this repository is useful

  • Compare multiple controller architectures under documented conditions.
  • Reproduce numerical results from executable MATLAB and Python models.
  • Inspect portable C99 implementations with fixed-size state and no dynamic allocation.
  • Trace engineering requirements to automated MATLAB, Python, and C tests.
  • Study where simulation evidence ends and hardware validation must begin.

Featured projects

Project Main methods Published result
Nonlinear control loops Jacobian linearisation, equilibrium stability, controllability, local state feedback Linearisation error increases away from the operating point
Elastically mounted rotary arm Fifth-order trajectory, feedback, feedforward, 2-DOF control, load disturbance 2-DOF tracking RMSE is about 70% lower
Quarter-car active suspension State-space modelling, LQR, road disturbance, actuator saturation RMS body acceleration is reduced by about 35%
Magnetic levitation Nonlinear plant, pole placement, Luenberger observer, sensor noise, convergence study, portable C runtime Position-estimation RMSE is below 0.001 mm
Two-tank process Nonlinear hydraulics, PI control, saturation, back-calculation, portable C runtime Recovery improves from about 429 s to 312 s

Detailed numerical results are generated from executable models and published in the results summary.

Results preview

Active suspension Magnetic levitation Two-tank anti-windup
Active suspension Magnetic levitation Two-tank

Quick start

MATLAB experiments

run_all

Run the MATLAB test suite:

results = runtests('matlab/tests', 'IncludeSubfolders', true);
assertSuccess(results);

Portable C runtimes

cmake -S c -B build/c -DCMAKE_BUILD_TYPE=Release
cmake --build build/c --parallel
ctest --test-dir build/c --output-on-failure
./build/c/maglev_observer_demo
./build/c/two_tank_demo

Python validation

python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt
ruff check .
ruff format --check .
pytest -q
python -m validation.generate_reference_figures --check-only
python -m validation.report --check

Technical coverage

  • Nonlinear differential-equation modelling
  • Operating-point and Jacobian linearisation
  • State-space modelling, controllability, and observability
  • Pole placement and eigenvalue analysis
  • Luenberger observers and output-feedback control
  • LQR control and disturbance rejection
  • P and PI control with back-calculation anti-windup
  • Actuator saturation and control-effort analysis
  • Fourth-order Runge-Kutta integration and convergence studies
  • Deterministic sensor-noise scenarios
  • Portable C99 observer and PI-control runtimes
  • Fixed-size state storage without dynamic allocation
  • CMake, CTest, GCC, Clang, and strict compiler warnings
  • Direct MATLAB and multi-version Python CI

Tools used

Purpose Technology
Control experiments MATLAB R2024b scripts and matlab.unittest
Independent references Python 3.10–3.12, NumPy and SciPy
Portable runtimes C99 with fixed-size state and no dynamic allocation
Build and runtime tests CMake, CTest, GCC and Clang
Automation GitHub Actions, Ruff and pytest

Verification approach

Layer Evidence
MATLAB Direct matlab.unittest execution using MATLAB R2024b
Python Numerical regression, behaviour, and report-freshness checks on Python 3.10–3.12
C GCC and Clang builds with warnings treated as errors
Runtime CTest checks for configuration handling, tracking, saturation, determinism, anti-windup, and convergence
Traceability Requirements mapped to automated evidence in the verification matrix

Repository structure

projects/                  MATLAB experiments and project-specific functions
matlab/+control_lab/       Shared MATLAB numerical and metrics utilities
matlab/tests/              Direct matlab.unittest verification
validation/                Independent numerical reference models and reports
tests/                     Python numerical and behaviour tests
c/                         Portable C99 control runtimes
c/tests/                   CTest-based runtime verification
docs/                      Architecture, results, and requirements traceability
.github/workflows/         MATLAB, Python, and C CI workflows

See the architecture document for the system structure and extension points.

Contributing

Focused contributions that improve numerical validation, portability, documentation, or test coverage are welcome. Read CONTRIBUTING.md before opening a pull request.

Useful starting points include:

  • independent numerical checks;
  • additional deterministic disturbance scenarios;
  • compiler and platform portability improvements;
  • documentation corrections;
  • requirements-to-test traceability improvements.

Limitations

These are simulation and software-validation projects, not production controllers. They do not establish:

  • hardware-in-the-loop performance;
  • real-time scheduling guarantees;
  • fixed-point numerical behaviour;
  • MISRA-C compliance;
  • robust stability outside the tested parameter ranges;
  • functional-safety certification.

Each project README documents its specific assumptions and validation boundaries.

Possible next work

  • Add more independent reference cases around saturation and disturbance rejection.
  • Extend compiler and operating-system portability checks for the C runtimes.
  • Document fixed-point and timing requirements before attempting embedded deployment.
  • Add hardware-in-the-loop work only when a real interface and measurable acceptance criteria exist.

Attribution

The original laboratory exercises were completed in a four-person academic team. This repository contains independently structured portfolio implementations and documentation. See NOTICE.md.

About

Academic MATLAB/Simulink portfolio covering nonlinear systems, rotary-arm control, active suspension, magnetic levitation and two-tank process control.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages