Wuppertal. Learning the Missing Piece: Gaussian Processes for Port-Hamiltonian Systems

Hi, I’m Matthias Menge. I am a PhD student at the University of Wuppertal, supervised by Peter Zaspel and Michael Günther. Since October 2025 I have been working on project C03 of the Collaborative Research Centre CRC 1701 “Port-Hamiltonian Systems”. In project C03 we build models of physical systems directly from data.

Tales from engineering: a fan on the test bench

In my previous job as a simulation engineer, a typical project started with a parcel. A customer sent us a fan or an actuator, for example from an HVAC system, and asked for a virtual prototype of its motor controller, so that the controller could be designed and tested in simulation before any hardware was built. We wrote the controller model ourselves. The hard part was the PCB and the motor together with whatever it drives: there were usually no models for them. We had to identify them, that is, fit models to measurements, often knowing little about what happens inside. In my master’s thesis I then used data-driven model order reduction to shrink the motor and electronics models, so they could be used in large-scale simulations.

Both experiences left me with the same question: how do you build a data-driven model that you can still trust once it is connected to the rest of a system? A generic black-box model, say a neural network that just fits the measured curves, may match the data well. But nothing stops it from creating a little energy where the real motor never would. Once the model is coupled to the controller, this can make the simulation unstable for no physical reason.

A virtual prototype as a puzzle. Software and electronics can usually be modelled, but the motor and its environment (grey) often have to be learned from measurements.

How port-Hamiltonian systems can help

Port-Hamiltonian systems [1] describe a physical system in terms of its energy. They track how much energy is stored, how it moves around inside without loss, where it is dissipated, and how it is exchanged with the outside through ports.

One can think of these models as toy bricks with power sockets. Each brick keeps track of its own energy. Plug two bricks together so that no power is created at the joint, and the result is again a brick of the same kind: its energy balance still holds, and it cannot create energy out of nothing. This is what you need when a simulation is assembled from components made by different people.

Learning only what is missing

In many engineering problems, much of this structure is known: how the components are connected, and where and how energy is lost. What is missing is often a nonlinear law, such as how a capacitor stores charge or how a motor’s magnetic core saturates. My project starts from a preprint by my supervisors [2]. They keep the known structure fixed and learn only the missing part with a Gaussian process. The learned piece sits inside a fixed port-Hamiltonian frame, which is what makes it a candidate for coupling.

A Gaussian process [3] is a Bayesian regression method. Instead of fitting a single function, it starts from a prior distribution over functions, whose smoothness is set by a kernel. Conditioning this prior on the measurements gives a posterior: its mean serves as the prediction, and its variance quantifies the uncertainty, which is small near the data and grows away from it. Gaussian processes stay Gaussian under linear operations, so the known port-Hamiltonian structure can be built directly into the kernel. Neural networks can be made structure-preserving too, but Gaussian processes are typically more data-efficient and quantify their uncertainty as part of the method rather than as an add-on. This makes the learned model easier to trust and shows where more data would be most informative.

Earlier work [4] used Gaussian processes for port-Hamiltonian systems described by ordinary differential equations. The preprint extends this to differential-algebraic equations, models that also contain constraints such as Kirchhoff’s laws in a circuit or the fixed length of a pendulum rod. For a small nonlinear circuit and a pendulum, both with simulated data, a few dozen samples were enough to recover the missing part down to the accuracy of the simulated data itself. One catch: the method needs measurements of the full internal state, which is itself a challenge for a real fan.

Gaussian-process port-Hamiltonian model of an iron ball in a magnetic field, based on the example and method presented in [4]. The model is trained on 2 to 32 points drawn at random from the first 10 s of a single trajectory. In each frame, ten Hamiltonians are sampled from the posterior and each is simulated from the same initial state (blue). With few points the samples scatter widely; as more data arrives they collapse onto the true trajectory and keep following it beyond the training window.

Where my PhD goes from here

The examples in the preprint are deliberately small. For now, my PhD is about making the approach work for realistic systems, in two directions.
The first is scaling up to larger systems with more unknowns, where more of the structure than a single function has to be learned.
The second is smarter sampling. Measurements on a test bench cost time and money, so it pays to choose them carefully. Because the Gaussian process knows where it is uncertain, it can help decide which operating condition to measure next, instead of sampling at random.
If this works, the next fan that lands on an engineer’s desk could be measured and turned into a model that couples safely with the controller, and that also tells you where it needs more data.

References

[1] A. van der Schaft and D. Jeltsema, “Port-Hamiltonian systems theory: An introductory overview,”Foundations and Trends in Systems and Control, vol. 1, no. 2–3, pp. 173–378, 2014, doi: 10.1561/2600000002.
[2] P. Zaspel and M. Günther, “Data-driven identification of port-Hamiltonian DAE systems by Gaussian processes.” arXiv preprint arXiv:2406.18726, 2024. Available: https://arxiv.org/abs/2406.18726
[3] C. E. Rasmussen and C. K. I. Williams, Gaussian processes for machine learning. MIT Press, 2006. doi: 10.7551/mitpress/3206.001.0001.
[4] T. Beckers, J. Seidman, P. Perdikaris, and G. J. Pappas, “Gaussian process port-Hamiltonian systems: Bayesian learning with physics prior,” in 2022 IEEE 61st conference on decision and control (CDC), 2022, pp. 1447–1453. doi: 10.1109/CDC51059.2022.9992733.

Leave a Reply