Controlled oscillation modeling using port-Hamiltonian neural networks
Organizations: IRCAM, 1, place Igor-Stravinsky, 75004, Paris, France
Abstract
Learning dynamical systems through purely data-driven methods is challenging as they do not learn the underlying conservation laws that enable them to correctly generalize. Existing port-Hamiltonian neural network methods have recently been successfully applied for modeling mechanical systems. However, even though these methods are designed on power-balance principles, they usually do not consider power-preserving discretizations and often rely on Runge-Kutta numerical methods. In this work, we propose to use a second-order discrete gradient method embedded in the learning of dynamical systems with port-Hamiltonian neural networks. Numerical results are provided for three systems deliberately selected to span different ranges of dynamical behavior under control: a baseline harmonic oscillator with quadratic energy storage; a Duffing oscillator, with a non-quadratic Hamiltonian offering amplitude-dependent effects; and a self-sustained oscillator, which can stabilize in a controlled limit cycle through the incorporation of a nonlinear dissipation. We show how the use of this discrete gradient method outperforms the performance of a Runge-Kutta method of the same order. Experiments are also carried out to compare two theoretically equivalent port-Hamiltonian systems formulations and to analyze the impact of regularizing the Jacobian of port-Hamiltonian neural networks during training.
Figures & tables
| System | Harmonic oscillator | Duffing oscillator | Self-sustained oscillator |
| (linear) | (nonlinear) | (nonlinear) | |
| \begin{array}[]{l}\bm{x}=\begin{bmatrix}q\\ p\end{bmatrix}\\ \bm{u}\end{array} | \begin{array}[]{rll}q:&\text{centered position (elongation)}&\text{[m]}\\ p:&\text{momentum}&\text{[Kg.m.s{}^{-1}]}\\ u=f:&\text{force (applied or exterior)}&\text{[N]}\end{array} | ||
| \bm{J}=\left[\begin{array}[]{cc|c}0&1&0\\ -1&0&-1\\ \hline\cr 0&1&0\end{array}\right] | \bm{J}=\left[\begin{array}[]{cc|c}0&-1&0\\ 1&0&0\\ \hline\cr 0&0&0\end{array}\right] | ||
| \bm{R}=\alpha\,\left[\begin{array}[]{cc|c}0&0&0\\ 0&1&0\\ \hline\cr 0&0&0\end{array}\right] with [N ] | \bm{R}=\Gamma(w)\left[\begin{array}[]{cc|c}1&0&1\\ 0&0&0\\ \hline\cr 1&0&1\end{array}\right] with [ N] | ||
| \bm{S}=\left[\begin{array}[]{cc|c|c}0&1&0&0\\ -1&0&-1&-1\\ \hline\cr 0&1&0&0\\ 0&1&0&0\end{array}\right] | \bm{S}=\left[\begin{array}[]{cc|c|c}0&-1&1&0\\ 1&0&0&0\\ \hline\cr-1&0&0&-1\\ 0&0&1&0\end{array}\right] | ||
| (i) | (ii) | |
| Dissipation | ||
| Interconnection matrix | ||
| Accuracy order | Name | Characteristic | Power-balance |
| 2 | Explicit midpoint (RK2) | Explicit | |
| 2 | Discrete gradient (DG) | Inverse-explicit |
| System | Harmonic Oscillator | Duffing Oscillator | Self-sustained oscillator |
| Intrinsic parameters | |||
| [Hz] | |||
| [kg] | |||
| [ ] | |||
| [ ] | - | - | |
| [N] | |||
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| System | Harmonic oscillator (linear) |
| System | Duffing oscillator (nonlinear) |
| 1, if ( underdamped ) |
| System | Self-sustained oscillator (nonlinear) |
| 1, if ( underdamped ) |
| Model | Components | Network | Input | Layers | Hidden | Output | Number of parameters | |
| type | dimension | units | dimension | (per component) | (per model) | |||
| NODE | Black-box | MLP | 3 | 3 | 100 | 2 | 21,4k | 21,4k |
| PHNN-JR | MLP | 2 | 2 | 100 | 3 | 10,7k | 21,8k | |
| MLP | 3 | 2 | 100 | 3 | 11,1k | |||
| PHNN-S | MLP | 2 | 2 | 100 | 3 | 10,7k | 21,1k | |
| MLP | 1 | 2 | 100 | 1 | 10,4k | |||
| Model | Components | Network | Input | Layers | Hidden | Output | Number of parameters | |
| type | dimension | units | dimension | (per component) | (per model) | |||
| NODE | Black-box | MLP | 3 | 2 | 60 | 2 | 4,3k | 4,3k |
| PHNN-JR | MLP | 2 | 2 | 42 | 3 | 2,1k | 4,3k | |
| MLP | 3 | 2 | 42 | 3 | 2,2k | |||
| PHNN-S | MLP | 2 | 2 | 42 | 3 | 2,1k | 4,1k | |
| MLP | 1 | 2 | 42 | 1 | 2k | |||
| Model | Components | Network | Input | Layers | Hidden | Output | Number of parameters | |
| type | dimension | units | dimension | (per component) | (per model) | |||
| NODE | Black-box | MLP | 3 | 2 | 24 | 2 | 848 | 848 |
| PHNN-JR | MLP | 2 | 2 | 16 | 3 | 371 | 809 | |
| MLP | 3 | 2 | 16 | 3 | 438 | |||
| PHNN-S | MLP | 2 | 2 | 16 | 3 | 371 | 852 | |
| MLP | 1 | 2 | 20 | 1 | 481 | |||
| Harmonic | 25 | 100 | 400 |
| NODE-RK2 | 2.53e-02 [2.33e-02] | 1.69e-04 [1.54e-04] | 2.79e-05 [1.84e-05] |
| PHNN-JR-DG | 2.58e-04 [3.82e-04] | 9.10e-06 [1.22e-05] | 7.29e-06 [5.07e-06] |
| PHNN-JR-RK2 | 1.14e-04 [1.02e-04] | 6.88e-06 [3.81e-06] | 5.18e-06 [5.50e-06] |
| PHNN-S-DG | 4.22e-05 [5.99e-05] | 6.24e-06 [4.97e-06] | 4.78e-06 [1.21e-05] |
| PHNN-S-RK2 | 4.89e-05 [2.11e-04] | 5.77e-06 [9.55e-06] | 3.73e-06 [8.89e-06] |
| Duffing | 25 | 100 | 400 |
| Harmonic | Small size | Medium size | Large size |
| NODE-RK2 | 2.53e-02 [2.33e-02] | 2.85e-02 [2.59e-02] | 1.45e-01 [4.67e-02] |
| PHNN-JR-DG | 2.58e-04 [3.82e-04] | 1.47e-04 [2.68e-04] | 7.33e-04 [2.52e-03] |
| PHNN-JR-RK2 | 1.14e-04 [1.02e-04] | 5.56e-05 [1.19e-04] | 1.51e-04 [3.87e-04] |
| PHNN-S-DG | 4.22e-05 [5.99e-05] | 5.56e-05 [9.58e-05] | 2.45e-04 [4.59e-04] |
| PHNN-S-RK2 | 4.89e-05 [2.11e-04] | 4.28e-05 [3.73e-05] | 2.01e-04 [2.13e-04] |
| Duffing | Small size | Medium size | Large size |
| Harmonic | BL | CN | SN | SR |
| NODE-RK2 | 2.53e-02 [2.33e-02] | 7.82e-02 [1.63e+00] | 2.63e-02 [2.53e-02] | 2.56e-02 [5.70e-02] |
| PHNN-JR-DG | 2.58e-04 [3.82e-04] | 2.20e-04 [3.40e-04] | 1.94e-04 [3.09e-04] | 2.30e-04 [3.19e-04] |
| PHNN-JR-RK2 | 1.14e-04 [1.02e-04] | 1.50e-04 [5.70e-04] | 7.18e-05 [9.39e-05] | 1.26e-04 [1.46e-04] |
| PHNN-S-DG | 4.22e-05 [5.99e-05] | 3.84e-05 [4.05e-05] | 3.44e-05 [6.62e-05] | 1.13e-04 [3.07e-04] |
| PHNN-S-RK2 | 4.89e-05 [2.11e-04] | 1.17e-05 [5.67e-05] | 5.66e-05 [2.02e-04] | 2.97e-05 [5.35e-04] |
| Duffing | BL | CN | SN | SR |