Thomas Hélie Co-Encadrement

Rémy Müller
email: remy.muller@ircam.fr

David Roze
email: david.roze@ircam.fr

Judy Najnudel
email: judy.najnudel@ircam.frremy.muller@ircam.fr

Thomas Hélie
email: thomas.helie@ircam.fr

Aes Student

Thomas H Élie

RBF Radial Basis Functions RKHS Reproducing Kernel Hilbert Spaces SNR Signal Noise Ratio SP Statistical Physics

Keywords: , Power-Balanced Modeling of Nonlinear Electronic Circuits . . . . simulation parameters. . . . . . . . passive peaking EQ: data generation parameters. . . . . . . . . . . 6.1 Diode clipper: data generation parameters. . . . . . . . . . . . . . . . . . LMI Linear Matrix Inequality ODE Ordinary Differential Equation PHS Port-Hamiltonian System physical modeling, statistical physics, thermodynamics, port-Hamiltonian systems

This thesis is concerned with the modeling of nonlinear components and circuits for simulations in audio applications. Our goal is to propose models that are sufficiently sophisticated for simulations to sound realistic, but that remain simple enough for real time to be attainable.

To this end, we explore two different approaches, both based on a port-Hamiltonian systems formulation. Indeed, this formulation structurally guarantees power balance and passivity, and is equipped with numerical methods that extend these guarantees in the discrete time domain. This ensures the accuracy of simulations, provided that the circuit constitutive laws also are accurate.

The first approach is comparable to "white box" modeling. It assumes that the circuit topology is known, and focuses on the modeling of specific components found in vintage audio circuits, namely ferromagnetic coils (found in wah-wah pedals, transformers, passive equalizers among others) and opto-isolators (found in tremolos and optical compressors). The proposed models are physically-based, passive, modular, and usable in real time. In addition to accurate simulations (implemented into plugins for the music software company UVI), a byproduct result of this work is a novel modeling method combining statistical physics and port-Hamiltonian systems. This method produces reduced, macroscopic power-balanced systems from complex physical systems with numerous degrees of freedom. Moreover, the statistical physics framework is responsible for the emergence of explicit thermodynamic variables, and ensures thermodynamic consistency in the final model.

The second approach is comparable to "grey box" modeling. It aims to retrieve the topology and constitutive laws of a circuit from measurements. The learning of the circuit topology is informed by a port-Hamiltonian formulation, and concomitantly, nonlinearities are addressed through kernel-based methods. Thus, necessary physical properties are enforced, while the use of reproducing kernels allows for a variety of nonlinear behaviors to be described with a smaller number of parameters and a higher interpretability compared to neural network methods. Finally, a possible generalization of this approach for a larger class of circuits is outlined through the introduction of the Koopman operator. v

Introduction

This thesis is concerned with the modeling of nonlinear components and analog circuits for simulations in audio applications. It is the result of a collaboration between the research team S3AM1 at the STMS laboratory (IRCAM-CNRS-SU), and the music software publisher UVI 2 . The S3AM team is interested in modeling, simulating, identifying and controlling physical systems that produce sound (in a broad sense), such as acoustic musical instruments, electronic circuits, loudspeakers, vocal apparatus, etc. A significant part of their research over these last years has been based upon the port-Hamiltonian systems formalism. In particular, I relied on this formalism to model and simulate an ondes Martenot circuit for my master's thesis (see Appendix F for publications on this subject). The UVI company is a French software publisher that develops virtual instruments and digital effects for sound designers and music producers. Therefore, the objective of this thesis is twofold: (i) contribute to the state of the art in audio circuit modeling and follow up on the work of our team colleagues on the subject [1,2], and (ii), propose tools that are relevant in a context of industrial applications, namely, models that are sufficiently sophisticated for simulations to sound realistic, but that remain simple enough so that simulations can be performed in real time.

To this end, we explore two different approaches, both based on a port-Hamiltonian systems formulation. Indeed, this formulation structurally guarantees power balance and passivity, and is equipped with numerical methods that extend these guarantees in the discrete time domain. This ensures the accuracy of simulations, provided that the circuit constitutive laws also are accurate. The first approach assumes that the circuit topology is known, and focuses on the modeling of specific components found in vintage audio circuits, namely ferromagnetic coils and opto-isolators. The second approach aims to learn the topology and constitutive laws of a circuit from measurements, by enforcing physical properties through an underlying port-Hamiltonian systems formulation, and by addressing nonlinearities through kernel-based methods.

After a short introduction to the port-Hamiltonian systems formalism in the first chapter, we structure our contributions in three chapters for the first approach, and two chapters for the second approach.

In the second chapter, we revisit equilibrium statistical physics with port-Hamiltonian systems modeling in mind. Starting from a complex system with numerous degrees of freedom, we propose a series of systematical steps in order to derive relevant macroscopic thermodynamic variables, given some experimental conditions.

In the third chapter, we follow the method developed in the second chapter and derive a macroscopic port-Hamiltonian model for ferromagnetic cores, which exhibits temperature-dependent nonlinear characteristics such as saturation and hysteresis. In turn, this model can be connected to other components via magnetic and thermal ports. We exploit this modularity to build a general model for ferromagnetic coils, and we present simulations of a highpass circuit and a transformer based on this general model.

In the fourth chapter, we propose a port-Hamiltonian model of resistive opto-isolators by studying doping mechanisms in semiconductors, and coupling between optical and electrical domains. Based on this model, we identify a Vactrol from measurements, and simulate a minimal optical compressor.

In the fifth chapter, we present an identification method for nonlinear circuits with linear dissipation that preserves passivity. The method relies on optimal reconstruction of energy through reproducing kernels and an underlying port-Hamiltonian formulation. We apply the method to identify a nonlinear peaking EQ filter.

Virtual analog

The aim of virtual analog modeling is to produce digital copies of analog systems.

The motivation behind virtual analog can range from obtaining identical functionalities from cheaper and more flexible tools, preserve the technological legacy of obsolete machines, or enhancing creativity by providing hybrid objects that would be otherwise difficult or even impossible to engineer. Several techniques are available to build virtual analog instruments (for a review, see [3,4,5]). They include Modified Nodal Analysis [6,7], the Nodal DK method [8,9,10], and Wave Digital Filters [11,12,13,14,15,16,17]). Real-time simulations of circuits can be derived from time-continuous state-space representations combined with numerical schemes [18,19,20,21].

The approach used in this thesis is based on a state-space representation, which satisfies the power balance of the physical system structured into conservative, dissipative and external parts, known as Port-Hamiltonian Systems [22,23]. This formulation can be combined with numerical methods that preserve power balance and passivity in the discrete-time domain for both linear and nonlinear systems. This has proven to be relevant for simulations of audio (electronic or multiphysical) systems [24,25,26,27].

Port-Hamiltonian systems 1.2.1 PH-DAE formulation

The PHS formalism provides a unified formalism for the modeling of multiphysical systems, in the sense that it recognizes energy as a universal currency. Indeed, any physical system can be divided into parts that interact with each other via energy exchanges. Moreover, due to the strong geometric structure underlying PHS, the analysis of intrinsic properties such as symmetries or invariant quantities is facilitated.

Chapter 1. Modeling and Simulation of Circuits as Port-Hamiltonian Systems Detailed presentations of PHS are available in [28,23]. In this thesis, we rely on a differential-algebraic formulation adapted to multiphysical systems [26,2]. This formulation allows the representation of a dynamical system as a network of 1. storage components of state x and energy E(x); 2. passive memoryless components described by an effort law z : w → z(w), such as the dissipated power P diss = z (w) w is non-negative for all flows w;

3. connection ports conveying the outgoing power P ext = u y where u are inputs and y are outputs.

The system flows f and efforts e are coupled through a (possibly dependent on x) skewsymmetric interconnection matrix S = -S , so that

   ẋ w y    f = S    ∇E(x) z(w) u    e .
(1.1)

In the context of electronic circuits, flows can either be currents (e.g. for capacitors) or voltages (e.g. for inductors), and vice versa for efforts. For convenience, to distinguish storage, dissipative, and connection ports exchanges in the following, we introduce the block-matrix notation:

S =     J x -K -G x K J w -G w G x G w J y . (1.2)
Such systems satisfy the power balance P stored + P diss + P ext = 0 (1.3) where P stored = ∇E(x) ẋ denotes the stored power.

Proof.

P stored + P diss + P ext = ∇E(x) ẋ + z (w) w + u y = e f = e Se = (e Se) = -e Se = 0 due to the skew-symmetry of S.

Note that throughout this thesis, we adopt the passive sign convention (also called receiver convention) for all components, including external sources. This means that the current is defined positive when entering the component through the positive voltage terminal [29].

Example 1. Consider a circuit constituted of a voltage source (input), a linear capacitor (storage), a linear inductor (storage), and a resistor that obeys Ohm's law (dissipative) connected in series (Fig. 1.1a). The circuit state is given by x = q, Φ , where q denotes the electric charge of the capacitor, and Φ denotes the magnetic flux linkage of the inductor. The (quadratic) energy E is defined by

E(x) = q 2 2 C + Φ 2 2 L , (1.4)
where C is the capacitance and L the inductance. The corresponding flow ẋ gives the current through the capacitor i C and voltage across the inductor v L , and the corresponding effort ∇E(x) gives the voltage across the capacitor v C and current through the inductor i L (Table 1.1). Kirchhoff's laws in receiver convention yield the PHS formulation given by 

State

x q, Φ Flow ẋ q, Φ = [i C , v L ] w i R Energy E(x) q 2 2 C + Φ 2 2 L Effort ∇E(x) q C , Φ L = [v C , i L ] z(w) R i R = v R v in i in R v R i R L v L i L C v C i C (A) RLC circuit schematics ∇E(x) z(w) u v C i L v R v in       ẋ i C 0 1 0 0 v L -1 0 -1 1 w i R 0 1 0 0 y i in 0 -1 0 0 (B) Corresponding PHS.
    i C v L i R i in      =      0 1 0 0 -1 0 -1 1 0 1 0 0 0 -1 0 0           v C i L v R v in      . ( 1

.5)

From now on, such formulations will be given as in Fig. 1.1b for compacity.

PH-ODE reduction

Under certain conditions, Eq. (1.1) can be reduced into the PH-ODE formulation

ẋ y = (J -R) ∇E(x) u , (1.6)
where J = -J is skew-symmetric, and R = R 0 is positive semi-definite. Both matrices are possibly dependent on x. In particular, formulation (1.6) is possible when the dissipative law z is linear, but more generally if algebraic constraints can be reduced, for instance if the matrix that couples dissipative flows and efforts J w = 0, and z(w) can be expressed as z(w) = Z(w) w, Z(w) 0.

(1.7)

Chapter 1. Modeling and Simulation of Circuits as Port-Hamiltonian Systems Indeed, using notation of Eq. (1.2), and denoting Z(x, u) = Z(w) |w=K ∇E(x)-G w u , we obtain

ẋ y = J x -K Z(x, u) K K Z(x, u)G w -G x G w Z(x, u)K + G x -G w Z(x, u)G w + J u ∇E(x) u =        J x -G x G x J u J=-J - -K 0 0 G w Z(x, u) -K 0 0 G w R 0        ∇E(x) u .
(1.8)

Note that such a reduction is not always desirable as it can increase the stiffness of the system, that is, the difference of scale between "fast" phenomena and "slow" phenomena within the system dynamics. For an Ordinary Differential Equation (ODE) of the form ẋ = A x, stiffness can be characterized through the ratio |Re(λmax)| |Re(λmin)| , with λ max (resp. λ min ) the maximal (resp. minimal) eigenvalue of A. Stiff systems require specific iterative, multi-step solvers [30] for the numerical solution to be stable, which can be an issue for real-time applications.

Example 2. For the RLC circuit of Fig. 1.1a, the PH-DAE can be reduced to the PH-ODE given by ∇E(x)

u v C i L v in     ẋ i C 0 1 0 v L -1 -R 1 y i in 0 - 1 0 (1.9)
Example 3. Consider a diode clipper circuit with a linear capacitor, a linear resistor, and a nonlinear diode with passive dissipation law I D : v D → I D (v D ) = i D (Fig. 1.2a). Kirchhoff's laws in receiver convention yield the canonical PH-DAE shown on Fig. 1.2b. As the matrix that couples dissipative flows and efforts J w = 0, the formulation can be reduced to the PH-ODE given by ∇E(x)

u v C v in ẋ i C -R -( I D (v D ) /v D ) |v D = q /C R y i in R -R
(1.10)

Numerical scheme for simulations

In this thesis, we use a numerical scheme based on the discrete gradient (see [31,26]), the principle of which is recalled below. Define x[k] = x(k/ f s ) where f s = 1/T s denotes the sampling rate. Moreover, define the state increment δx[k] = x[k + 1]x[k] and the discrete gradient ∇E(x[k], δx [k]). In the case of mono-variate storage components, i.e., the energy takes the form E(x) = N ∑ n=1 E n (x n ), the n th component of the discrete gradient 1.3. Numerical scheme for simulations is defined as

v in i in R v R i R D v D i D C v C i C (A) Diode clipper schematics. ∇E(x) z(w) u v C i D i R v in       ẋ i C 0 -1 1 0 w v D 1 0 0 0 v R -1 0 0 1 y i in 0 0 - 1
[∇E x[k], δx[k] ] n =          E n x n [k] + δx n [k] -E n (x n [k]) δx n [k] if δx n [k] = 0 dE n dx n (x n [k]) otherwise.
(1.11)

The method consists of replacing ẋ with δx[k]/T s and ∇E(x) with ∇E x[k], δx [k] in Eq. (1.1). As in Eq. (1.3), due to the skew-symmetry of S, the following discrete power balance is satisfied:

∇E x[k], δx[k] δx[k] T s δE[k]/T s + z(w[k]) w[k] P diss [k] + u[k] y[k] P ext [k] = 0. ( 1
where

S = J x -K -G x K J w -G w , (1.14)
and e(ν,

x[k], u[k]) = ∇E x[k], δx[k] , z(w[k]), u[k] .
Denoting J the Jacobian of F , Eq. (1.13) is solved using the Newton-Raphson iteration [32] ν k+1 = ν k -J (ν k ) -1 F (ν k ), (1.15) if J is invertible. Conditions for convergence of the method can be found in [33,32].

Part

Statistical physics framework overview

A macroscopic system (of size 10 -2 m or bigger) is constituted of matter, that is, billions of microscopic particles (of size 10 -9 m or smaller) which are collectively responsible for the system's behavior. However, studying a single particle tells nothing about the macroscopic system, just as following the trajectory of a single person is not sufficient to predict a crowd movement. Yet, solving exhaustive equations with billions of variables would be all at once much too complex and irrelevant: at a high enough scale, individual behaviors do not matter. Indeed, one is usually not interested in the particular Chapter 2. Macroscopic PHS of Systems described by Statistical Physics trajectories of water molecules in one's glass, but rather in the volume, on average, that they take. Likewise, one is not (only) interested in the day's weather report, but rather in the global warming tendency.

Averages and tendencies belong to the domain of statistics, which aims to describe complex systems with a reduced number of variables. Thus, Statistical Physics (SP) computes averages on (fast) fluctuations of complex systems in order to derive (slower) macroscopic quantities, given some experimental conditions. This leads to the prediction of macroscopic thermodynamic phenomena such as temperature, entropy creation, and phase transitions [34,35].

While thermodynamics has been broadly studied in the context of PHS modeling and control (see e.g. [36,37,38,39,40,41,42]), the proper derivation of macroscopic thermodynamic variables from complex systems with numerous degrees of freedom is seldom addressed. Therefore in this chapter, we propose a series of systematical steps in order to construct a simplified yet physically-based, structured macroscopic PHS, from a system that can be described by SP.

Note that in the scope of this work, we limit ourselves to equilibrium SP, in the sense that average quantities are determined for a system at thermodynamic equilibrium, given some experimental conditions. It is compatible with studying the system dynamics, assuming that thermodynamic relaxation (the process of reaching thermodynamic equilibrium) is infinitely faster than the rate of change of experimental conditions. Based on this assumption, a macroscopic trajectory is to be understood as a succession of equilibrium states.

This chapter is structured as follows. In Section 2.2, we formalize the microscopic description of a system through the choice of (i) an ad hoc particle representation and (ii) a set of characterizing functions. In Section 2.3, we investigate experimental conditions and their influence on the system configuration space. Then in Section 2.4, we introduce a stochastic description for configurations. We determine the probability distribution for a system at thermodynamic equilibrium in Section 2.5, which allows the derivation of relevant macroscopic variables as expectations for this probability distribution. Finally, by defining ports corresponding to those macroscopic variables, we obtain a macroscopic PHS model in Section 2. 6.

A part of this work has been presented at the LHMNC conference in 2021 [43].

Microstate of a system 2.2.1 Particle representation

In order to describe a system at a microscopic level, each of its particles must be described in a relevant way. Depending on the system under study, one may choose to represent a particle by its position, momentum, charge, magnetic moment, etc.

The set of all possible values for the chosen representation is denoted P.

Example 4 (Particle represented by its position). For a particle chosen to be represented by its position in space r ∈ R 3 , P = R 3 .

Example 5 (Particle represented by its spin). For a particle chosen to be represented by its spin s ∈ {-1 /2, 1 /2}, P = {-1 /2, 1 /2}.

Example 6 (Particle represented by its position and spin). For a particle chosen to be represented by both its position in space r ∈ R 3 and its spin s ∈ {-1 /2, 1 /2}, P = R 3 × {-1 /2, 1 /2}.

2.2. Microstate of a system

Configuration space

If an element of P represents a particle, then the concatenation of elements of P represent a particular configuration of particles. By analogy with formal language theory [44], a particular configuration of particles is thus a word over the alphabet P. We denote W := P the configuration space of the system, where is the Kleene operator defined by

P 0 = { }, P i+1 = p 1 • p 2 | (p 1 , p 2 ) ∈ P i × P ∀i ≥ 0, (2.1a)
P = i≥0 P i , (2.1b)
with the empty configuration and • the concatenation operation. In other words, W is the set of all possible configurations over P.

Property 1 (The configuration space is a monoid). By construction, the configuration space W is a monoid (see Def. ( 1)) with associative binary operation • (concatenation) and identity element (empty configuration).

Definition 1 (Monoid).

A set S is a monoid if it is equipped with an associative binary operation • : S × S → S and identity element , so that for all (s 1 , s 2 , s 3 ) ∈ S 3 , the following properties hold

1. s 1 • (s 2 • s 3 ) = (s 1 • s 2 ) • s 3 , 2. • s 1 = s 1 • = s 1 .
Note that here, we only consider distinguishable particles, in the sense that configurations are sequences and not multisets1 [45].

Based on the chosen representation, some configurations may not be admissible 2 , and we denote M ⊆ W the set of admissible configurations. An element m ∈ M is called a microstate of the system. In the following, we do not forbid that two particles share the same representation and choose M = W. Figure 2.1a shows examples of microstates for a system of particles described by their spin, and Fig. 2.1b shows a system of particles described by their position and momentum.

Property 2 (The configuration space is measurable). The pair M, P (M) where P (M) denotes the powerset of M is a measurable space, that is, it verifies 1. M ∈ P (M), 2. P (M) is closed under complements: M\P ∈ P (M), ∀P ∈ P (M), 3. P (M) is closed under countable unions: ∞ i=1 P i ∈ P (M) ∀P 1 , P 2 , . . . ∈ P (M).

• 1 • 2 • 1 • 2 • 1 • 2 • 1 • 2 (A)
Examples of microstates for a system of two particles described by their spin s ∈ {-1 /2, 1 /2}.

(B) Examples of microstates for a system with three particles described by their position (circle) and momentum (arrow).

Associated characterizing functions

In order to characterize the system at a microscopic level, one may choose to equip M with I characterizing functions F i=1,...,I : M → F i .

Definition 2 (Extensivity).

A function F i is extensive if F i is a R + -semimodule (see Def. 3) and if it verifies

m 3 = m 1 • m 2 ⇒ F i (m 3 ) = F i (m 1 ) + F i (m 2 ) ∀(m 1 , m 2 , m 3 ) ∈ M 3 .
(2.2)

Definition 3 (R + -semimodule). A set S is a R + -semimodule if for all (r 1 , r 2 ) ∈ R + 2 and (s 1 , s 2 ) ∈ S 2 , the following properties hold 1. r 1 (s 1 + s 2 ) = r 1 s 1 + r 2 s 2 , 2. (r 1 + r 2 ) s 1 = r 1 s 1 + r 2 s 1 , 3. (r 1 r 2 ) s 1 = r 1 (r 2 s 1 ), 4. 1 s 1 = s 1 , 5. 0 s 1 = 0.
Example 7. The function E : M → R + defined as

E : m -→ E (m) (2.3)
where E (m) is the energy of the system in microstate m is extensive for systems with noninteracting particles.

Example 8. The function N : M → N + defined as

N : m -→ N (m) (2.4)
where N (m) is the number of particles of the system in microstate m is always extensive.

Example 9.

The function R that gives the set of all particle positions for the system in microstate m, defined as

R(m) = r i 1≤i≤N (m) , (2.5)
where r i ∈ R 3 is the position of particle i.

Experimental conditions and accessible microstates

Example 10. The function V : M → R + defined as

V : m -→ V (m) (2.6)
where V (m) is the volume occupied by the system in microstate m. Remark: the choice of such function V is hardly unique as the volume relates strongly with that of the matter container. Here, we propose to define V (m) as the minimal bounding volume enclosing all particle positions of microstate m that accounts for the container geometry and its degrees of freedom. For instance, for a cylindrical container of fixed base A closed by a piston moving freely along axis z, we can define the volume as

V (m) = A × h(m), with h(m) = max{r i z | r i ∈ R(m)}. (2.7)
Note that it does not fulfill the extensivity property defined in Eq. (2.2).

In the following, we denote I = {1, . . . , I} the set of indices of characterizing functions on M, F = {F i } i∈I the set of characterizing functions on M, and set F 1 = E .

Experimental conditions and accessible microstates

Experimental conditions may constrain characterizing functions to take values that are compatible with these experimental conditions. Thus, under experimental conditions, the configuration space becomes restricted to a set of accessible microstates M a ⊂ M. Definition 4 (Set of accessible microstates M a ). Denote I 0 ⊆ I the set of indices of characterizing functions that are experimentally constrained. Then for all i ∈ I 0 , the experimental constraint on F i translates into a binary relation

R i ⊂ F i × F 0 i with F 0 i ∈ P (F i ). Denoting θ 0 := (F 0 i ) i∈I 0 , the set of accessible microstates M a θ 0 is M a θ 0 = m ∈ M | F i (m), F 0 i ∈ R i ∀i ∈ I 0 . (2.8)
Remark that I 0 = I defines an isolated system with respect to the chosen characterizing functions.

Example 11. Consider a gas of N 0 particles in a closed tank. The system cannot exchange particles with the environment, therefore the number of particles N (m) is fixed to N 0 . Denoting

R N = N 0 , N 0 , the set of accessible microstates is M a N 0 = m ∈ M | N (m), N 0 ∈ R N .
Example 12. Consider a gas of N 0 particles in a closed tank occupying a space Π ⊂ R 3 .

Denoting

R N = N 0 , N 0 and R Π = Π N 0 × Π N 0 , the set of accessible microstates is M a N 0 , Π = m ∈ M | N (m), N 0 ∈ R N , R(m), Π N 0 ∈ R Π .
Other examples of experimental conditions are shown on Fig. 2.2.

In the following, we assume that all characterizing functions that are not explicitly fixed by experimental conditions can still depend on microstate m, and we denote I 1 := I\I 0 the set of indices of characterizing functions not fixed by experimental conditions.

Stochastic representation and measure of uncertainty

Microstate stochastic description

The system fluctuates from one accessible microstate to another. As it is not possible to predict these random fluctuations in a deterministic fashion, SP adopts a stochastic description. Indeed, from Prop. (2), M, P (M) is measurable, therefore so is M a , Tr P (M) M a ,

where Tr P (M) M a denotes the trace of P (M) on M a [46], so that we can define a probability distribution p : M a → [0, 1], which assigns to each microstate m ∈ M a a probability p(m) to be the actual microstate of the system. Assuming that M a is countable and that the distribution p is discrete, the average of a random quantity F (m) is given by its expectation E p [F ], defined as3

E p [F ] = ∑ m∈M a p(m) F (m).
(2.9)

Statistical entropy

Given some basis of units of information b > 1, a microstate m with probability p(m) has a surprisal S b p (m) defined as

S b p (m) = log b 1 p(m)
with log b := ln ln(b) .

(2.10)

The surprisal, or information content, quantifies how much the occurrence of microstate m is surprising. For example, if some microstate m is the state of the system for certain, it has probability 1 and surprisal 0.

As the probability of two independent events m 1 and m 2 verifies

p (m 1 • m 2 ) = p(m 1 ) p(m 2 ), (2.11)
the surprisal function S b p verifies the extensivity property defined in Eq. (2.2). The surprisal allows the definition of a measure of lack of information on average for a probability distribution p and a basis b, namely, the statistical entropy S b (p) [47] defined as

S b (p) = E p [S b p ]. (2.
12)

The statistical entropy can be interpreted of as "the average number of questions to ask with b possible answers per question" in order to know the actual microstate for certain. Example 13. Consider the outcomes of tossing a coin twice. The coin can come up heads or tails after each toss, hence 2 × 2 = 4 possible outcomes (Fig. 2.3). If all outcomes are equiprobable, one needs at least two questions with two possible answers each to know the exact outcome:

1. Did the coin come up heads or tails after the first toss?

2. Did the coin come up heads or tails after the second toss?

As it happens, taking p 1 : m → p 1 (m) = 1 4 and b = 2 in Eq. (2.12) yields

S b (p 1 ) = -log 2 1 4 = 2.
However, if the probability distribution is not uniform, some outcomes are more probable than others, and the uncertainty is lower; ditto the entropy. For instance, with a probability distribution p 2 assigning 1 2 to outcome (A), 1 4 to outcome (B), and 1 8 to outcomes (C) and (D), the entropy becomes

S b (p 2 ) = 1.75 < S b (p 1 ) = 2.
In information theory, statistical entropy relates to optimal encoding of information. Suppose you repeat the coin toss experiment of Ex. ( 13) for a long period of time, and wish to record every outcome on a computer. For a sequence of two tosses with distribution p 1 , an outcome cannot be encoded in less than two bits; while with distribution p 2 , outcome (A) can be encoded on one bit, outcome (B) on two, and outcomes (C) and (D) on three, that is, 1

× 1 2 + 2 × 1 4 + 6 × 1 8 = 1.
75 bits on average. The most frequent outcome takes the least encoding space; conversely, the comparatively large encoding space taken by outcomes (C) and (D) is compensated by the rarity of their occurrence. On the whole, exploiting the knowledge underpinned by distribution p 2 reduces the encoding cost. This principle underlies Morse code (and, more generally, lossless entropy encoding like Huffman coding [48]): very common letters such as "e" or "i" take much fewer dots than less common letters like "j" or "q".

In the following, we denote k := 1 /ln b, so that the statistical entropy becomes

S b (p) = -k ∑ m∈M a p(m) ln p(m).
(2.13)

Microstate probability distribution at equilibrium and partition function

Thermodynamic equilibrium

A system is at thermodynamic equilibrium when its statistics stops evolving. At this point, the ergodic hypothesis postulates that over a "sufficiently long" period of time t, the system explores all its accessible microstates. Assuming that a microstate m can be measured at a time τ through M : R + → M a , this means that at thermodynamic equilibrium, the temporal mean of a quantity F i coincides with its expectation E p [F i ]:

F i := lim t→+∞ 1 t t 0 (F i • M) (τ) dτ = E p [F i ]. (2.14)
Chapter 2. Macroscopic PHS of Systems described by Statistical Physics Therefore, for a given set θ 1 of mean values (F i ) i∈I 1 , the ergodic hypothesis translates into a set of hypotheses H θ 1 defined as

H θ 1 = E p [F i ] = F i i∈I 1 .
(2.15)

While still discussed [49] (especially regarding the definition of "sufficiently long"), this hypothesis is the foundation of equilibrium statistical physics, and we assume its validity in the following.

Maximum entropy at thermodynamic equilibrium (Boltzmann principle)

At equilibrium, the system provides minimal information: all available information about its macroscopic state is summarized into a single observation. Recalling that statistical entropy is a measure of lack of information, we conclude that at equilibrium, the entropy is maximal: this is the Boltzmann principle.

Resulting microstate probability distribution and partition function

It follows that the microstate probability distribution at thermodynamic equilibrium p is

p =arg max p S b (p) subject to        ∑ m∈M a p(m) = 1, H θ 1 , (2.16)
where H θ 1 accounts for the experimental conditions.

To solve Eq. (2.16), we introduce Lagrange multipliers λ 0 and λ 1 := (λ i ) i∈I 1 , and optimize the Lagrangian L defined by [50]

L : p, λ 0 , λ 1 -→ S b (p) + λ 0   ∑ m∈M a p(m) -1   + ∑ i∈I 1 λ i E p [F i ] -F i . (2.17) Theorem 1. Let θ 1 := F i i∈I 1 ∈ X i∈I 1 F i , where X i∈I 1 F i denotes the Cartesian product of the (F i ) i∈I 1 . Then for all m ∈ M a θ 0 , p m | H θ 1 = exp ∑ i∈I 1 λ i F i (m) k Z λ 1 , ( 2.18a)
where

Z λ 1 := ∑ m∈M a exp ∑ i∈I 1 λ i F i (m) k (2.18b)
is the partition function of the system, and, for all i ∈ I 1 , λ i verifies

∂ ∂λ i k ln Z λ 1 = F i . (2.

18c)

Proof. A necessary condition to optimize L is to solve δL δp = 0, where δ denotes the functional derivative. From Eq. (2.17)-(2.13)-(2.9),

δL δp = 0 ⇒ ∑ m∈M a   -k ln p(m) + 1 + λ 0 + ∑ i∈I 1 λ i F i (m)   = 0. This is true in particular if p verifies -k ln p(m) + 1 + λ 0 + ∑ i∈I 1 λ i F i (m) = 0 ∀m ∈ M a ⇒p(m) = exp ∑ i∈I 1 λ i F i (m) k exp λ 0 k -1 ∀m ∈ M a .
A second necessary condition is to solve ∂L ∂λ 0 = 0, which, combined to the first condition, yields

∂L ∂λ 0 = 0 ⇒ ∑ m∈M a p(m) = 1 ⇒ ∑ m∈M a exp ∑ i∈I 1 λ i F i (m) k = exp 1 - λ 0 k , so that for all m ∈ M a , p (m) is of the form p m | H θ 1 , λ 1 = exp ∑ i∈I 1 λ i F i (m) k Z (λ 1 ) with Z (λ 1 ) := ∑ m∈M a exp ∑ i∈I 1 λ i F i (m) k .
(

2.19)

A third necessary necessary condition is to solve ∂L ∂λ i = 0 for all i ∈ I 1 , which, combined with Eq. (2.19), yields

∂L ∂λ i = 0 ⇒E p [F i ] = F i ⇒ ∑ m∈M a F i (m) exp ∑ i∈I 1 λ i F i (m) k Z λ 1 = F i ⇒ ∂ ∂λ i k ln Z λ 1 = F i .
We deduce that the optimal distribution p is

p m | H θ 1 = p m | H θ 1 , λ 1 with λ 1 such that ∂ ∂λ i k ln Z λ 1 = F i ∀i ∈ I 1 .
Definition 5 (Thermodynamic entropy). The thermodynamic entropy S b θ 1 is defined as the statistical entropy for the probability distribution at equilibrium given θ 1 :

S b θ 1 = S b p • | H θ 1 .
(2.20) Property 3. The thermodynamic entropy function S b is a Legendre transform of k ln Z and we have

S b θ 1 = k ln Z λ 1 -∑ i∈I 1 λ i F i . (2.21)
Proof. We have We deduce that S b is a Legendre transform of k ln Z (see [51] and Appendix A).

S b θ 1 (a) = S b p • | H θ 1 (b) = -k ∑ m∈M a p m | H θ 1 ln p m | H θ 1 (c) = -k ∑ m∈M a p m | H θ 1 ln      exp ∑ i∈I 1 λ i F i (m) k Z λ 1      = -k ∑ m∈M a p m | H θ 1 ∑ i∈I 1 λ i F i (m) k -ln Z λ 1 (d) = -∑ i∈I 1 λ i F i + k ln Z λ 1 , using (
Property 4. It follows from Prop. (3) that for all i ∈ I 1 , the Lagrange multiplier λ i is the derivative of the thermodynamic entropy function with respect to average F i

λ i = - ∂S b ∂F i θ 1 . (2.22)
Example 14. In particular, this defines the system temperature T, chemical potential µ, and pressure P as

1 T := ∂S b ∂E θ 1 , µ T := - ∂S b ∂N θ 1 , P T := ∂S b ∂V θ 1 . (2.23)
System thermally insulated For a system thermally insulated, the surprisal is independent of m so that S b p (m) = S 0 ∀m.

(2.24)

That implies that for such systems, all microstates have the same probability

p (m) = 1 Ω , with Ω = card (M a ) . (2.25)
From Eq. (2.18a), it follows that for thermally insulated systems, we have

∑ i∈I 1 λ i F i (m) = C 0 , (2.26)
2.5. Microstate probability distribution at equilibrium and partition function

21

where C 0 is independent of m.

Identification of Boltzmann constant

To ensure that the statistical entropy does coincide with the thermodynamic entropy at equilibrium, the constant k must be chosen as the Boltzmann constant k B = 1.38 × 10 -23 J.K -1 . Indeed, consider an ideal gas of N non-interacting atoms in a box of volume V at temperature T, represented by their position and momentum. The partition function Z is given by (see Appendix B)

Z (T | N, V) = V N 2 π µ k T h 2 3 N /2 , ( 2.27)
where here µ denotes the mass of an atom, and h is the Planck constant. From Prop. (3), the thermodynamic entropy S b (E , N, V) is given by

S b (E , N, V) = k ln Z (T | N, V) + E T . (2.28)
Moreover, from Eq. (2.23), the pressure P is given by

P = T ∂S b ∂V (E , N, V) = N k T V . ( 2.29)
Therefore, k must be identified with k B so that the ideal gas law P V = N k B T is verified.

Summary

By applying Boltzmann principle, we are able to systematically derive the microstate probability distribution and the thermodynamic entropy given some experimental conditions, through the following steps:

1. Microstate representation Define P, W = P and M ⊆ W equipped with characterizing functions F = (F i : M → F i ) 1≤i≤I , where F 1 is the energy function E . For common experimental constraints (i.e., constraints on F = {E , N , V, S b }), we obtain the results in Table 2.1 (see also [52]).

Experimental conditions and accessible microstates

Ensemble θ 0 θ 1 p (m) Entropy Example Micro-canonical E 0 , N 0 , V 0 , S 0 1 Ω k B ln Ω Gas in an isolated tank Isoenthalpic-isobaric N 0 , S 0 E , V 1 Ω k B ln Ω

Gas in a closed tank

No

with a piston, thermally insulated

thermal contact Unnamed V 0 , S 0 E , N 1 Ω k B ln Ω Gas in a porous tank, thermally insulated Unnamed S 0 E , N , V 1 Ω k B ln Ω
Gas in a porous tank with a piston, thermally insulated

Thermal contact

Canonical N 0 , V 0 E exp -E (m) k B T Z (T) k B ln Z (T) + E T Gas in a closed tank, in contact with a thermostat Isothermal-isobaric N 0 E , V exp -E (m)+P V (m) k B T Z (T, P) k B ln Z (T, P) + E +P V T
Gas in a closed tank with a piston, in contact with a thermostat Grand-canonical

V 0 E , N exp -E (m)-µ N (m) k B T Z (T, µ) k B ln Z (T, µ) + E -µ N T Gas in a porous tank, in contact with a thermostat Unnamed E , N , V exp -E (m)+P V (m)-µ N (m) k B T E +P V -µ N T
Gas in a porous tank with a piston, in contact with a thermostat Chapter 2. Macroscopic PHS of Systems described by Statistical Physics

Final PHS model

Macroscopic state and energy

Denote S := S b θ 1 , and θ 2 := θ 1 \E the set of remaining macroscopic quantities with corresponding set of indices I 2 . For convenience, we choose to define the (extensive) macroscopic state x as x = S, θ 2 , (2.30) so that the flow ẋ accounts for the time variation of extensive quantities. Assuming that the entropy function S b is invertible with respect to E , we define the macroscopic energy function E as

E : x → E(x) = E , (2.31)
so that the effort ∇E accounts for intensive quantities. Otherwise, the macroscopic energy function can be defined implicitly via Eq. (2.21) and contact forms [53].

Remark: the energy function E should be homogeneous of degree 1, so that it verifies for all γ E(γ x) = γ E(x).

(2.32)

Connection to ports

The environment acts on the system flow so that at thermodynamic equilibrium, the effort is shared at the system interface and we have

∂E sys ∂F sys i = ∂E ext ∂F ext i ∀i ∈ I 2 .
(2.33)

Proof. Consider the isolated total system constituted by the system under study and its environment. For all i ∈ I 1 , we have

F total i = F sys i + F ext i .
The entropy is extensive, therefore,

S b total θ 1 total = S b sys θ 1 sys + S b ext θ 1 ext .
(2.34)

The total system is isolated, therefore the total entropy is maximal with respect to any variable, so that for all i ∈ I 1 ,

∂S b total ∂F sys i = 0 ⇒ ∂S b sys ∂F sys i + ∂S b ext ∂F sys i = 0 ⇒ ∂S b sys ∂F sys i - ∂S b ext ∂F ext i = 0 ⇒λ sys i -λ ext i = 0.
∂E ∂F i = ∂E ∂S ∂S b ∂F i = -T λ i .
We deduce that ∂E sys

∂F sys i = ∂E ext ∂F ext i ∀i ∈ I 2 .

Conservative PHS

Conservative, reversible PHS Denoting σ ext the outgoing entropy flow, the conservative PHS interconnection matrix of an open system is found to be

∇E(x) u T µ -P σ ext Ṅext Vext                   Ṡ . . . - 1
∇E(x) z(w) u T ∇ 0 z 0 (w 0 ) σ ext u 0             ẋ Ṡ . . . -1 . ẋ0 . J x -K . -G x w w 0 . K J w . -G w y T ext 1 . . . . y 0 . G x G w . J y , (2.36)
and dissipative law z 0 that verifies z 0 (w 0 ) w 0 ≥ 0 for all w 0 . The entropy creation rate -σ i verifies z 0 (w 0 ) w 0 + T σ i = 0, (2.37) so that the memoryless flow w and effort z(w) of the irreversible PHS become

w = [w 0 , T] , z(w) = 0 z 0 (w 0 ) /T -z 0 (w 0 ) /T 0 w = z 0 (w 0 ), σ i . (2.38)
Furthermore, the system entropy is balanced so that Ṡ = -σ iσ ext .

(2.39)

We obtain the irreversible PHS with interconnection matrix given by

∇E(x) z(w) u T ∇ 0 σ i z 0 (w 0 ) σ ext u 0                 ẋ Ṡ . . -1 . -1 . ẋ0 . J x . -K . -G x w T 1 . . . . . w 0 . K . J w . -G w y T ext 1 . . . . . y 0 . G x . G w . J y .
(2.40)

Conclusion

In this chapter, we revisited equilibrium SP in order to model complex systems with numerous degrees of freedom as macroscopic PHS with a reduced number of variables.

Starting from the choice of a particle's description and ad hoc characterizing functions, we recalled how to derive the probability of a configuration of particles at equilibrium based on given experimental conditions. In the end, macroscopic variables are revealed to be expectations of the chosen characterizing functions for this probability, and the thermodynamic entropy to be a function of these macroscopic variables. Provided that the energy has been chosen as a characterizing function from the start, the macroscopic energy can in turn be expressed as a function of the thermodynamic entropy and other macroscopic variables. Through the PHS formalism, experimental conditions are represented as an input flow that acts on the system so that the resulting output is an effort shared with the system. With this formulation, the externality of the environment, as well as its interactions with the system via exchanges of energy and entropy, are made explicit.

As a result, we proposed two PHS formulations for conservative open systems, a reversible one (with no entropy creation), and an irreversible one (with entropy creation).

An immediate perspective would be to extend this work to non-equilibrium SP, so that a macroscopic trajectory would not only be a succession of equilibrium states, and experimental conditions could change faster.

Chapter 3

Ferromagnetic Coils and Transformers Contents

Ferromagnetic coil overview

Coils and transformers built around ferromagnetic cores are often found in audio circuits, such as effect pedals, amplifiers and loudspeakers. Indeed, ferromagnetic materials have a much higher inductance compared to that of a simple winding. Consequently, ferromagnetic coils have a higher quality factor 1 . Nonetheless, they exhibit temperature-dependent nonlinear characteristics such as saturation and hysteresis, causing audible distortion and power loss. Reliably modeling this behavior is therefore an essential first step in order to simulate these circuits accurately. As a matter of fact, several empirical macroscopic models already exist in the literature. One of them is the Jiles-Atherton model [54,55,56]. This model is built around a differential equation involving a saturation curve and a friction term. While it is rather popular in the audio community, some concerns have been expressed regarding its physical interpretation [57], and subsequent accuracy issues in simulations. Another Chapter 3. Ferromagnetic Coils and Transformers widely used model is the Gyrator-Capacitor [58,[START_REF] Chen | Gyrator-Capacitor Simulation Model of Nonlinear Magnetic Core[END_REF][START_REF] Cauduro | Real-time audio transformer emulation for virtual tube amplifiers[END_REF]. In this model, flows and efforts are taken into the magnetic domain via a gyrator, and inductors are represented as capacitors with a (passive) polynomial constitutive law. It is indeed a useful representation in order to understand the duality between electric and magnetic domains. Yet, a polynomial law -even if it is passive-is an oversimplification, as we shall discuss later on. Other recent models based on fractional derivatives [START_REF] Sowa | Ferromagnetic core coil hysteresis modeling using fractional derivatives[END_REF] are able to reproduce memory effects and dissipation [START_REF] Moshrefi | Physical and geometrical interpretation of fractional operators[END_REF], but as for the Jiles-Atherton or Gyrator-Capacitor models previously mentioned, their parameters do not relate to actual physical quantities. Moreover, neither of these models takes explicitly into account the significant role of temperature in the shape of the hysteresis curve. Yet, temperature may vary in circuits, especially after an extended use; therefore its influence should not be entirely neglected. On the other hand, models explicitly built on energetic considerations, such as variational models [START_REF] François-Lavet | An energy-based variational model of ferromagnetic hysteresis for finite element computations[END_REF], rely on costly finite-element methods, making their real-time use difficult. Similarly, the Preisach model [START_REF] Bertotti | Dynamic generalization of the scalar Preisach model of hysteresis[END_REF][START_REF] Lobue | Entropy and entropy production in magnetic systems with hysteresis[END_REF] thoroughly captures the phenomenology involved in ferromagnetism, including thermodynamics; but it is too complex for audio applications. Therefore, to our present knowledge, a model that is both physically-based (allowing refined and realistic simulations in a wide range of contexts) and suitable for audio applications does not seem to exist.

In this chapter, we propose a nonlinear model of ferromagnetic coil that is physicallybased, passive, and modular, with reduced complexity (3 state variables and 5 parameters).

This chapter is structured as follows. In Section 3.2, we apply SP to derive a macroscopic PHS for the ferromagnetic core, following the method developed in Chapter 2. In turn, this model can be connected to other components via magnetic and thermal ports. Then in Section 3.3, we present a PHS model for the coil and detail the temperaturedependent effects of its interconnection with the core. In Section 3.4, we build a model for the ferromagnetic coil by connecting a core and a coil together through the PHS formalism. This final model is used to simulate a highpass circuit and a transformer in Section 3.5. Finally, we offer some perspectives in Section 3.6.

This work has been partially presented at the DAFX conference in 2020 [START_REF] Najnudel | A power-balanced dynamic model of ferromagnetic coils[END_REF] and published in the JAES journal in 2021 [START_REF] Najnudel | Power-Balanced Modeling of Nonlinear Coils and Transformers for Audio Circuits[END_REF].

Ferromagnetic core

A typical ferromagnetic core is constituted of about 10 22 atoms2 interacting with one another. It is therefore a natural candidate for the SP to macroscopic PHS method. In order to apply the method, we choose the following working hypotheses: H1: The core is isochoric (constant volume V).

H2: The core is closed (constant number of atoms N).

H3:

The core is in a thermostat (the core temperature T is -statically or quasi-staticallyconstrained by that of the exterior).

Magnetostrictive phenomena are not addressed here. They have been extensively treated in [START_REF] Calchand | From canonical hamiltonian to port-hamiltonian modeling: Application to magnetic shape memory alloys actuators[END_REF][START_REF] Calchand | Port hamiltonian modeling of msma based actuator: toward a thermodynamically consistent formulation[END_REF].

s = s 1 ∧ s 2 m = i s i s 2 s 1

Micro-state

In an atom, orbits and intrinsic spins of electrons all contribute to the atom total angular momentum [START_REF] Le | Quantum physics[END_REF]. Because electrons are electrically charged, this angular momentum is responsible for the apparition of a magnetic moment [71], similarly as in a current loop (Fig. 3.1): an electron can be thought as a current loop of infinitely small area. Due to Hund's rules [START_REF] Robert M White | Quantum theory of magnetism[END_REF], single electrons in partially filled orbitals tend to have the same intrinsic spin, as it minimizes the atom overall energy. Consequently, if two atoms have overlapping orbitals that contain single electrons, these electrons tend to have the same angular momentum. This ensures that the distance between them is maximal and that Pauli's exclusion principle, which states that two fermions3 cannot share identical spins and positions at the same time, is verified (Fig. 3.2). Therefore, the magnetic moments of these atoms align with each other. In some crystalline structures, in which billions of billions of atoms are involved, this phenomenon creates a non-zero macroscopic magnetic moment. This is for instance the case in transition metals (iron, cobalt, nickel, etc.), whose outer shells contain several single electrons. Such materials are said to be ferromagnetic.

In 1925, Ernst Ising proposed a simplified model to represent this behavior [START_REF] Ising | Beitrag zur theorie des ferromagnetismus[END_REF][START_REF] Gordon | On the theory of the Ising model of ferromagnetism[END_REF][START_REF] Strecka | A brief account of the Ising and Ising-like models: Mean-field, effective-field and exact results[END_REF]. In this model, the core is represented as a set of N adimensional magnetic moments m i , i ∈ {1, ..., N}, interacting with one another. A micro-state of the core is a particular configuration m ∈ M a = {-1, 1} N . Figures 3.3a-3.3b show an example of such a microstate for N = 9.

The energy of a micro-state m is given by the Heisenberg Hamiltonian:

E (m) = - 1 2 m J ex m, (3.1)
Chapter 3. Ferromagnetic Coils and Transformers

• 1 • 2 • 3 • 4 • 5 • 6 • 7 • 8 • 9 (A) Possible configuration for a ferromagnetic core with N = 9 moments. m = [1, -1, 1, 1, 1, -1, -1, 1, -1]
(B) Corresponding micro-state. where each coefficient J exi,j is the exchange energy between moment i and moment j [START_REF] Ai Liechtenstein | Exchange interactions and spin-wave stiffness in ferromagnetic metals[END_REF]. It extends to atoms the concept of exchange interaction between indistinguishable particles of identical spin. Note that E does not define a positive-definite function but only a lower bounded function. Indeed, the exchange energy actually corresponds to the difference (hence the minus sign) between the energy of two atoms with opposite magnetic moments and the energy of two atoms with identical magnetic moments. As explained at the beginning of the section, for ferromagnetic materials this difference is positive due to Pauli's exclusion principle (it is negative for antiferromagnetic materials). The Heisenberg Hamiltonian can thus take negative values, but it has a lower bound nonetheless: it reaches a minimum for m = ±1, as expected.

Assuming isotropic interactions that affect nearest neighbors only, this exchange energy simplifies to J exi,j = J if i, j nearest neighbors and i = j, 0 otherwise, (

where J is a constant energy characterizing the material.

In the following, we assume that the core topology ensures a constant number of nearest neighbors q for each moment (typically, a torus, Fig. 3.4a), and neglect edge effects. show an example of such a topology with N = 9 moments and q = 4 nearest neighbors, as well as the corresponding exchange matrix.

Micro-state probability distribution at thermodynamic equilibrium and partition function

According to our working hypotheses, the statistical ensemble of interest for the SP to macroscopic PHS method is the canonical ensemble (see Table 2.1 p. 23). The micro-state probability distribution at thermodynamic equilibrium is therefore

p (m | T) = exp -E (m) k B T Z (T) , Z (T) = ∑ m∈M a exp - E (m) k B T , ( 3.3)
where T is the temperature, k B is the Boltzmann constant, and Z is the partition function. At a given temperature, a micro-state with a low energy E (m) has, as expected, a higher probability than a micro-state with a high energy. What should be noted is that the difference between their probabilities increases as the temperature decreases. Conversely, micro-states tend to become equiprobable as the temperature increases. In other words, the temperature operates as a contrast parameter for probabilities. Accordingly, (A) Toroidal ferromagnetic coil.

• 1 2 • 3 4 5 6 • 7 8
• 9

(B) Flattened toroidal core with N = 9 moments. The q = 4 nearest neighbors of the fifth moment (in white) are shown in grey.

J ex = J× configurations that minimize the energy, that is, configurations in which moments align with each other, are most probable below a critical temperature (to be determined in the next sections). This is no longer the case above this critical temperature. At a macroscopic level, this corresponds to a phase transition from ferromagnetic to paramagnetic.

1 2 3 4 5 6 7 8                             1 .
In Chapter 2, the internal energy and the entropy are both derived from the partition function Z. Unfortunately here, there is no analytic expression for Z (T) for a three-dimensional lattice. In these situations, Monte-Carlo methods [START_REF] Ferrenberg | Critical behavior of the three-dimensional Ising model: A high-resolution Monte Carlo study[END_REF] can be used for simulations, but they are impractical for real-time purposes. Therefore, we choose to consider a mean-field approximation of the partition function.

Mean-field approximation of the partition function

As the mean-field approximation is a classic result of statistical physics literature, we do not expand on its theoretical aspects but only recall its principles.

The mean-field approximation is based on the idea that micro-states fluctuate around a mean state, which is used to simplify the partition function computation. However, there is a subtlety. If the mean state is naively defined as the expectation over for a ferromagnetic core with N = 2 moments. The states of lowest energy are not on the symmetry axis. all micro-states m = E p [m], it is found to be 0. Indeed, E (m) = E (-m), therefore p (m) = p (-m) and the expectation vanishes. Yet, under a critical temperature (which will be characterized later on), we do observe a non-zero macroscopic magnetic moment. This is due to spontaneous symmetry breaking [START_REF] James | Spontaneous symmetry breaking in finite systems[END_REF] and subsequent partial ergodicity, which can be invoked in order to define a mean state more adequately. Spontaneous symmetry breaking occurs in systems for which physical laws are invariant under some symmetry transformation, but for which the state of lowest energy does not necessarily retain the same invariance (Fig. 3.5).

• 1 • 2 • 1 • 2 • 1 • 2 • 1 • 2 M + M -
Here, the Hamiltonian is invariant under the transformation T : m → -m, since E • T = E . This symmetry effectively partitions the set of accessible micro-states into two subsets of identical size, M + and M -. Nonetheless, the states of lowest energy are not on the symmetry axis (Fig. 3.6). In practice, any random perturbation causes the system to fall into one of these two subsets and to break the symmetry. At that point, the system explores this subset, but not the other one, as this would mean going through a high energy barrier. This leads to partial ergodicity, which allows the computation of a nonzero mean state, as well as an (approximated) Hamiltonian for each subset. The meanfield partition function is finally obtained using these approximated Hamiltonians.

As x → x exp -1 x is convex on R + , the free energy F(T) = -k B T ln Z (T) is concave on R + . Since the internal energy E : S → E(S) = F(T) + T S is a Legen- dre transform of F (see Appendix A
), E is convex and has an inferior bound. As this is true for any partition function, in particular a partition function computed from an approximated Hamiltonian, the mean-field energy also has a lower bound.

The partitioning of M a into two subsets M + and M -can be formalized as follows. Define the total magnetic moment M(m) of micro-state m as

M(m) = N ∑ i=1 m i . (3.4)
Define the set M 0 of neutral micro-states with respect to their total magnetic moment as

M 0 = {m | M(m) = 0}. (3.5)
These neutral micro-states (which are on the symmetry axis) must be split between M + and M -symmetrically. To this end, any arbitrary partitioning verifying

1. M + 0 ∪ M - 0 = M 0 , 2. card(M + 0 ) = card(M - 0 ) = card(M 0 ) 2 , 3. ∀m ∈ M + 0 , -m ∈ M - 0 ,
is adequate. Then M + and M -can be defined as

M + = {m | M(m) > 0} ∪ M + 0 , M -= {m | M(m) < 0} ∪ M - 0 .
(3.6) Figure 3.7 shows an example of such partitioning for a core with N = 2 moments. For each subset, the mean magnetic moment is defined as

m + = 1 N ∑ m∈M + 2 p (m)M(m) ∈ [0, 1], m -= 1 N ∑ m∈M - 2 p (m)M(m) ∈ [-1, 0] (3.7)
and the mean state m as

m = m + [1, . . . , 1] in M + , m -[1, . . . , 1] in M -. (3.8)
Assuming small deviations mm in each subset, we obtain

E (m) ≈        1 2 N J q m + 2 -J q m + M(m) if m ∈ M + , 1 2 N J q m -2 -J q m -M(m) if m ∈ M -, (3.9)
and deduce the mean-field partition function Z MF defined by (see Appendix C for a complete derivation)

Z MF (m, T) = exp - N J q m 2 2 k B T 2 cosh J q m k B T N , ∀m ∈ [-1, 1], T > 0. (3.10)

Macro-state and energy

The mean-field partition function allows the derivation of the mean-field internal energy and the mean-field entropy.

Core energy From Chapter 2, Section 2.5, the macroscopic energy E for a canonical ensemble is given by

E = T 2 ∂ ∂T k B ln Z (T). (3.11)
Taking the expression of Z MF described by Eq. (3.10) in Eq. (3.11), the mean-field internal energy E MF is found to be

E MF (m, T) := E 0 m 2 2 -m tanh m T c T , (3.12)
where E 0 := N J q relates to the minimal possible energy of the core as E MF (±1, 0) = -E 0 2 = E (±1), and T c := J q k B is the critical temperature of the core.

Core entropy Concomitantly, from Chapter 2, Section 2.5, the entropy S for a canonical ensemble is given by

S = E T + k B ln Z (T). (3.13)
Reinjecting Eq. (3.10) in Eq. (3.13), the mean-field thermodynamic entropy S MF is found to be

S MF (m, T) := S 0 ln 2 cosh m T c T - m T c T tanh m T c T , (3.14)
where S 0 := E 0 T c relates to the maximal possible entropy of the core as S MF (0, +∞) = S 0 ln (2)

= k B ln 2 N = k B ln card(M a ).
Core energy as a function of extensive state x core In the following, we choose to express the energy as a function of an extensive state x core , so that the flow ẋcore accounts for the time variation of extensive quantities and, concomitantly, so that the effort accounts for intensive quantities shared with the exterior at the core interface. To this end, we proceed in two steps. In the first step, we express the energy E MF as a function of (intensive) m and of (extensive) entropy S := S MF (m, T) rather than a function of (m, T). In a second step, we introduce an extensive magnetic state B V core related to m, and express the energy with respect to x core := [S, B V core ] .

Step 1 (T → S). From Eq. (3.14), we can write, for all positive T, T c

m T c T = sign(m) f -1 S S 0 , with f (x) = ln 2 cosh (x) -x tanh (x) , (3.15)
since f is even and invertible on R + (Fig. 3.8). Replacing the expression of m T c T in Eq. (3.12), we obtain, as tanh is odd

ẼMF (m, S) := E 0   m 2 2 -|m| tanh f -1 S S 0   . (3.16)
Step 2 (m → B V core ). We introduce the total magnetic flux B V core = m µ 0 M s V, where µ 0 = 4 π × 10 -7 H.m -1 is the vacuum magnetic permeability and M s is the core saturation magnetization. This corresponds to the core magnetic flux density (usually denoted B) multiplied by the core volume V. We finally obtain the macroscopic state and energy of the core

x core = [S, B V core ] ,
(3.17a)

E core (x core ) = E 0   1 2 B V core B V s 2 - B V core B V s tanh f -1 S S 0   , with B V s = µ 0 M s V. (3.17b)
The associated internal effort is

∇E core (S, B V core ) = [T core , H core ] , (3.18)
where T core and H core denote the core temperature and the internal magnetic field, respectively. Thus, the externality of the thermostat and external magnetic field is made explicit, and their influence is taken into account exclusively through the core connection ports.

Note that the identity ∂E core ∂S = T core restores, as expected, the temperature T used in Eq. (3.12). The proof is given below.

Proof. From Eq. (3.19), we have

∂E core ∂S (S, B V core ) (a) = - E 0 S 0 B V core B V s f -1 S S 0 cosh 2 f -1 S S 0 (b) = E 0 S 0 B V core B V s cosh 2 f -1 S S 0 cosh 2 f -1 S S 0 f -1 S S 0 = E 0 S 0 B V core B V s 1 f -1 S S 0 (c) = T core using (a) tanh u = u cosh 2 u , (b) f -1 = 1 f • f -1 and f (u) = -u cosh 2 (u)
, and (c)

E 0 S 0 = T c and f -1 ( S S 0 ) = B Vcore B Vs T c
T core .

(A) Graph of energy function.

(B) Graph of internal magnetic field, with respect to the temperature (instead of entropy) for visual purposes.

(C) Graph of internal temperature. FIGURE 3.9: Graph of energy function, internal magnetic field, and internal temperature for the ferromagnetic core (adimensional quantities). The core goes from two meta-stable equilibrium states to one stable equilibrium state as the entropy increases.

Figure 3.9a shows the (normalized) energy as a function of the (normalized) entropy and the (normalized) total magnetic flux. We can see the core going from two metastable equilibrium states to one stable equilibrium state, as the entropy increases. The phase transition from ferromagnetic to paramagnetic is thus retained by the mean-field approximation.

Coil modeling and interconnection with the core

Coil modeling

We assume that the coil is a solenoid of section A, length and number of windings n, and that it behaves linearly.

In the electric domain, its state is the magnetic flux linkage Φ coil and its energy is The current through the coil induces a magnetic field, so that the coil can be seen in the magnetic domain as a component of state B V coil , and energy

E elec coil (Φ coil ) = Φ 2 coil 2 L coil , ( 3
E mag coil (B V coil ) = B 2 V coil 2 µ 0 A . (3.22)
The corresponding effort is the coil magnetic field

∇E mag coil (B V coil ) = B V coil µ 0 A = H coil , (3.23)
and the corresponding flow is the coil total magnetic flux ḂV coil .

Assuming that both representations are equivalent, E elec coil (Φ coil ) = E mag coil (B V coil ). The coil can therefore be seen as a converter between the electric and magnetic domains, with a gyrator of gyration resistance n / (Fig. 3.10). Indeed, the gyrator law is given by

e mag e elec = 0 n / -n / 0 f mag f elec . (3.24)
Moreover, from Kirchhoff's laws, we can write

e mag = H coil , e elec = v coil , f mag = -ḂV coil , f elec = i coil . (3.25)
We deduce (B) Barkhausen jumps with damping. FIGURE 3.12: Barkhausen jumps and resulting hysteresis during a cycle, with and without damping. The red curve is the theoretical core internal magnetic field, the blue curve is the real trajectory followed by the core total magnetic flux when constrained by an external magnetic field.

H coil v coil = 0 n / n / 0 ḂV coil i coil . ( 3

Constraints resulting from the interconnection

A ferromagnetic coil is formed when a coil is wound around a ferromagnetic core (Fig. 3.11).

As such, the magnetic flux of the coupled system is the sum of the magnetic fluxes

B V coupled = B V coil + B V core , (3.27)
and they share their magnetic field

H coupled = H coil = H core .
(3.28)

Barkhausen jumps and dissipation

Under the critical temperature, the constraint on the magnetic field of the core causes jumps between meta-stable states, called Barkhausen jumps [START_REF] Bertotti | Hysteresis in magnetism: For physicists, materials scientists, and engineers[END_REF]. Suppose that the external magnetic field increases from a negative value. The core state trajectory (Fig. 3.12a, in blue) follows the core theoretical effort (in red), until this effort is no longer equal to the coil magnetic field. At this point, the state jumps to join the upper branch, so that the constraint is still verified. A similar phenomenon occurs when the coil magnetic field decreases. Because of these jumps, the state trajectory depends on the coil magnetic field history (increasing, or decreasing), and we observe hysteresis, similarly as in a relaxation oscillator [START_REF] Leon O Chua | Linear and nonlinear circuits[END_REF].

In real ferromagnetic cores, there is a multitude of meta-stable states due to domain structure and non-homogeneities [81]. Moreover, relaxation phenomena make these jumps non ideally fast, but damped (Fig. 3.12b). This damping can be modeled with a linear magnetic resistor r core connected in series with the core. As the difference of energy before and after a jump is entirely dissipated as heat [START_REF] Bertotti | Hysteresis in magnetism: For physicists, materials scientists, and engineers[END_REF], Barkhausen jumps are also responsible for the entropy creation -σ i in the core. The power conversion (magnetic to thermal) is balanced, so that

r core H 2 r core + T core σ i = 0. (3.29)
We deduce the core dissipative flow and effort

w = [T core , H r core ] , z(w) = r core H r core T core 0 -1 1 0 w = σ i , ḂV rcore .
(3.30)

Complete PHS model

In real coils, the conversion between electric and magnetic power is not lossless due to Joule heating. These losses can be modeled with a linear resistor r coil in series with the coil, so that for the ferromagnetic coil, the dissipative flow and effort become

w = T core , H r core , i r coil z(w) =     0 -r core H rcore T core 0 r core H rcore T core 0 0 0 0 r coil     w = σ i , ḂV rcore , v r coil .
(3.31)

The complete PHS model of the ferromagnetic coil is derived from Eqs.

Applications

Identification of Fasel inductors and simulation of a highpass filter

Our ferromagnetic coil model is used to simulate the behavior of two inductors: a Fasel Yellow (Fig. 3.14a) and a Fasel Red (Fig. 3.14b). These inductors can be found in wahwah pedals for instance. They are appreciated for their soft saturation.

Identification Model parameters are estimated from measurements. To this end, an inductor is connected in series with a resistor R = 100 Ω and driven with a voltage source of the form v in (t) = v 0 sin 2 π f 0 t (Fig. 3.15). The voltage across the inductor v out is measured for several values of v 0 (between 50 mV and 400 mV). The current i L is obtained through the relation Because of the parasitic resistance r coil , the inductor magnetic flux linkage Φ L is actually

i L (t) = v in (t) -v out (t) R . ( 3
∇E(x) z(w) u T core H core i coil σ i ḂV rcore v r coil σ ext v ext                         Ṡ . . . -
Φ L (t) = t 0 v out (τ) -r coil i L (τ) dτ. (3.33)
To estimate r coil and the total inductance L, we consider small input amplitudes v 0 and assume that the inductor behaves linearly, so that

i L = Φ L L . (3.34)
Then, we derive values of L and r coil that minimize the mean-square error on the current, namely In order to estimate the model parameters in nonlinear regime, a simplified model is used. First, we assume that the temperature stays constant throughout the measurements, so that we can use the free energy of the core F(T, B V core ) = E core (S, B V core ) -T S and remove the entropy from the state. The core effort becomes

(L , r coil ) = arg min (L, r coil ) 1 L t 0 v out (τ) -r coil i L (τ) dτ -i L (t) 2 ∀t. (3.35) v in R L v out ≡ v in R r coil coil core r core v out
H core = ∂F ∂B V core (T, B V core ) = E 0 B V s   B V core B V s -tanh B V core θ B V s   , (3.36)
where θ = T T c = T S 0 E 0 is now a model parameter. From Eq. (3.26), this can be rewritten in the electrical domain as Second, we assume that the inductance of the coil alone L coil is small compared to L4 , so that

H core = E 0 B V s   Φ core B V s n -tanh Φ core θ B V s n   . ( 3
Φ L = Φ core + Φ coil ≈ Φ core . (3.38)
Therefore, assuming T = 303 K, = 0.016 m, and n = 150, the parameters r core , E 0 , θ and B V s are estimated jointly for several values of v 0 , by solving

(r core , E 0 , θ , B V s ) = arg min (r core , E 0 , θ, B Vs ) n H core (Φ L (t)) + 2 n 2 r core ΦL (t) -i L (t) 2 ∀t. (3.39)
The estimated parameters are shown in Table 3 The power balance error is at its highest when the slope in the vicinity of the Newton-Raphson solution is at its steepest. Indeed, recall from Eq. (1.15) that the root estimate increment ∆ is of the form ∆(ν k ) = -J (ν k ) -1 F (ν k ), where F is the function for which the solver estimates a root, and J is its Jacobian. Values for which J is high yield a smaller increment compared to when J is small, and slow down the solver convergence. Therefore, for a given number of iterations, the error on the state estimate is greater, which is naturally reflected in the power balance. As F is related to the energy gradient, the Jacobian J is related to the energy hessian. We can see on Figs. 3.18b-3.18c that the power balance peaks coincide indeed with the energy hessian maxima. Parameter r 1 = r 2 (Ω) r core (Ω)

H core i coil v R ḂV rcore v r coil v ext                 ẋ ḂV core . . . 1 . . v coil . . -1 -n / -1 1 i R .
L 1 = L 2 (H) R (Ω) E 0 (J) S 0 (J.K -1 ) B V s (J.A -1 .m) Value 15
3.3 × 10 -6 5 × 10 -3 1 × 10 3 13.09 4.32 × 10 -2 6.61 × 10 -6

Simulation of a transformer

Output transformers are generally present in amplifiers, to adapt the load impedance seen by the loudspeaker [20,21]. Transformers with a ferromagnetic core are considered particularly interesting because of the core high magnetic permeability, which reduces the leakage flux [START_REF] Wm | Transformer and inductor design handbook[END_REF].

Modeling A nonlinear transformer model is built by coupling two ferromagnetic coils, that is, letting them share the same core (Fig. 3.19a). The primary (resp. secondary) coil inductor and associated resistor are denoted L 1 and r 1 (resp. L 2 and r 2 ), with number of windings n 1 (resp. n 2 ). Figure 3.19b shows the corresponding circuit, with gyrators defined by

e 1 v 1 = 0 n 1/ -n 1/ 0 f 1 i 1 , v 2 e 2 = 0 n 2/ -n 2/ 0 i 2 f 2 .
(

Kirchhoff's laws allow the PHS formulation on Fig. 3.19c (where the gyrators have been reduced).

Simulation A simulation is performed with an input voltage of the form v in (t) = v 0 sin(2π f 0 t), and parameters in Table 3.2. show simulation results for f 0 = 100 Hz and v 0 = 1 V and 20 V, which are a common range for line transformers (note that some studio line input transformers can take up to 34 dBu, which corresponds to approximatively 38 V). It can be seen that saturation and hysteresis arise for large input voltages, while the transformer's behavior for small input voltages is quasi-linear. As expected, the presence of hysteresis coincides with an increased loss due to the magnetic resistor (this effect increases with the input voltage frequency). Thus, the transformer becomes less and less "ideal" as the input voltage increases. This corresponds qualitatively to observations on real transformers. It is worth noting that the modularity of the model would allow for more complex transformer topologies (multiple primaries, multiple secondaries, air-gaps, etc.).

Conclusion

In this chapter, a new macroscopic model of ferromagnetic coil has been proposed. It is based upon a component-wise, energetic approach. First the core and the coil were treated separately, then their coupling, which determines both their electrical and thermal dynamics, was addressed. This leads to a complete model characterized by a wellestablished state, energy function, and entropy production rate law. Characteristics such

3.6. Conclusion v in i in R i R n 1 : n 2 (A)
Transformer loaded with a resistor. as saturation and hysteresis are well reproduced, as well as the influence of thermodynamics. This explicit influence is an improvement with respect to other models. Moreover, the modularity of the model makes it particularly versatile, as the component approach can be applied to various transformer topologies (multiple primaries, multiple secondaries, etc.). As an illustration, the model was used to simulate two representative audio subcircuits: a band-pass filter, and a transformer. Due to the reduced number of parameters and variables, these simulations can be performed in real-time.

v in i in r 1 v r 1 i r 1 L 1 v L 1 i L 1 H core ḂV core H r core ḂV rcore L v L i L 2 r 2 v r 2 i r 2 R v R i R e 1 f 1 v 1 i 1 v 2 i 2 e 2 f 2 n 1/ n 2/ (B) Equivalent circuit schematics. ∇E(x) z(w) u T core H core i L 1 i L 2 σ i ḂV rcore v r 1 v r 2 v R σ ext v in                                     ẋ Ṡ . . . . -1 . . . . -1 . ḂV core . . . . . 1 . . . . . v L 1 . . . . . -n 1/ -1 . . . 1 v L 2 . . . . . -n 2/ . - 1
Nonetheless, even if the model has been successfully identified with real components and exhibits a satisfactory qualitative behavior for audio applications, extensive measurements should be conducted to assess the model relevance in a more quantitative way. This shall be the object of future work.

Resistive opto-isolator overview

A resistive opto-isolator consists of a photoresistor and a LED coupled optically (Figs 4.1a-4.1b). Its operation principle is that the photoresistor resistance decreases (non-linearly) with the light it receives.

Resistive opto-isolators were widely used from the 1960s to the early 2000s due to their low fabrication costs, important dynamic range and low noise distortion (below -80 dB). They could be found in cameras (in exposure meters and autofocus) and security systems (for object detection) to name a few applications.

Apart from their nonlinear response to light, a remarkable feature of photoresistors is their relatively long response times (compared to e.g. transistors in transistor optoisolators). Indeed, these response times vary from a few tens of microseconds (for the turn-on, or attack, when light is switched on) to a few hundreds of milliseconds (for the turn-off, or release, when light is switched off). Moreover, the attack time decreases with the received light. These characteristics made resistive opto-isolators much appreciated for automatic gain control in audio applications, in which adaptive treatment and transient preservation are essential. An emblematic example of optical dynamic compressor from the late 1960s is the LA-2A built by Teletronix [START_REF] Fuston | A History of the Teletronix LA-2A Leveling Amplifier[END_REF], which was used in prominent broadcast studios such as CBS and RCA. A more recent example is the Langevin ELOP built by Manley. Resistive opto-isolators (also known as Vactrols) were manufactured by Perkin Elmer [START_REF]Photoconductive cells and analog optoisolators (Vactrols)[END_REF] until 2010. They are still manufactured by Advanced Photonix, but their availability has severely diminished since the 2000s due to a EU ban on cadmium sulfide, which is one of the main components of photoresistors. As vintage optical dynamic compressors are priced at tens of thousands of dollars, an accurate simulation would be a convenient and much cheaper way to access optical dynamic compression.

Models of resistive opto-isolators for audio applications exist in the literature [START_REF] Parker | A digital model of the Buchla lowpassgate[END_REF][START_REF] Eichas | Modeling of an optocoupler-based audio dynamic range control circuit[END_REF]. Based on a signal representation, they associate static characteristics obtained from measurements, and a combination of low-pass filters to account for the opto-isolator dynamic behavior. Although they demonstrate accurate results, these models are tailored to a specific circuit and offer less modularity than purely physical models. In particular, they are difficult to connect to other components modeled as PHS.

In this chapter, we propose a nonlinear model of resistive opto-isolators that is entirely physically-based and passive. This chapter is structured as follows. In Section 4.2, we provide a minimal, passive LED model. In Section 4.3, we recall the main doping mechanisms in photoresistors and derive a model for their internal dynamics. Then in Section 4.4, we infer laws for the optical coupling between the LED and the photoresistor based on the photoresistor dynamics, the photoresistor static resistance, and the LED dissipative law. Finally, in Section 4.5, we obtain a complete PHS model for the resistive opto-isolator by connecting all components through multiphysical ports. This model is then used to identify a Vactrol from measurements, and to simulate a minimal optical compressor in Section 4.6.

LED

We propose a model that is phenomenologically similar to the Shockley model [START_REF] Shockley | The Theory of p-n Junctions in Semiconductors and p-n Junction Transistors[END_REF], passive by construction, and in which the LED threshold appears explicitly as a parameter. Moreover, as it does not require the use of the Lambert function (which arises when using the Shockley model while taking the LED parasitic series resistance into account [START_REF] Hruska | Diode I-U Curve Fitting with Lambert W Function[END_REF]), its implementation is much simpler.

Denoting v D the LED voltage and i D the LED current, the LED is a dissipative component of flow and effort given by where sp :

w = v D , z(w) = i s sp v D -v t v s -sp - v t v s := I D (v D ) = i D , (4.1) (A) Photoresistor. f R LDR e R LDR i R LDR v R
x → ln(1 + exp x) (4.2)
denotes the softplus function and v t , v s , and i s are positive model parameters. The voltage v t is the LED threshold (from which it starts emitting light), and the ratio i s v s corresponds to the LED conductance.

Due to the fact that the sp function is increasing, and that z(0) = 0, it is immediately verified that z(w) w ≥ 0 for all w.

Photoresistor

A photoresistor consists of a thin layer of photoconductive material (i.e., cadmium sulfide) deposited on a ceramic substrate (Fig. 4.2a). In the following, we assume that the photoconductive material is spatially homogeneous, so that no pn-junction can be formed and that diffusion of free carriers is negligible.

A photoresistor is actually a 2-port component. The first port is an electrical port, and allows connections to other electronic components. The second port is an optical port, which allows interactions with the LED only (Fig. 4.2b), but is not accessible to the user. In the next sections, the optical flow and effort are explicitly referred to as f R LDR and e R LDR to avoid confusion with the electrical flow and effort i R LDR and v R LDR . Note that both flows are in Amperes, and both efforts are in Volts.

Photoconductivity

Photoconductive materials are semiconductors: their electronic band structure enables them to become conductive under certain conditions. Indeed, denote E C the energy level of the conduction band, and E V the energy level of the valence band (Fig. 4.2c, Chapter 4. Resistive Opto-Isolators left). The band gap e g is defined as

e g = E C -E V . (4.3)
In semiconductors, the band gap is low enough so that electrons can leave the valence band and reach the conduction band with a small amount of additional energy.

In a photoresistor, this additional energy is provided through photoabsorption. The absorption of the equivalent of e g generates a pair of free carriers (Fig. 4.2c, right): an electron in the conduction band, and a hole in the valence band. The presence of free carriers increases the photoresistor conductivity. Note that the overall conductivity depends on the quantity of electrons, but also on the quantity of holes (which, as we shall see, do not necessarily remain equal).

Doping

The conductivity of a photoconductive material can be artificially increased through the inclusion of defects, the role of which is to lower the amount of energy needed to generate free carriers [START_REF] Grundmann | [END_REF]. To this end, defects must have adequate bound and ionized energy levels. Indeed, denote E B the defect bound energy, E I the defect ionized energy, and e i the ionizing energy, defined as (Fig. 4.3, left)

e i = E I -E B . (4.4)
For efficient n-doping, E B must lie in the band gap and E I must lie in the conduction band, so that e i is smaller than e g and electrons reach the conduction band more easily (Fig. 4.3, right). Conversely, for efficient p-doping, E I must lie in the band gap and E B must lie in the valence band, so that e i is smaller than e g and electrons leave the valence band more easily (or, equivalently, holes reach the valence band more easily).

As an illustration, consider some photoconductive material made of atoms with four valence electrons, which can form tetrahedral bonds (for instance, silicium). N-doping would consist of inserting an atom with five valence electrons, for instance arsenic (one electron too many, see Fig. 4.4a). If enough energy is provided (through photoabsorption), the supplementary electron reaches the conduction band and the defect becomes ionized (Fig. 4.4b). In this case, the defect is called a donor. Conversely, p-doping would consist of inserting an atom with three valence electrons, for instance bore (one electron too few, see Fig. 4.4c). If enough energy is provided (through photoabsorption), the defect can "borrow" an electron from the valence band to achieve a fourth bond. The defect becomes ionized and a hole remains in the valence band (Fig. 4.4d). In this case, the defect is called an acceptor.

Note that in some materials, compensating native defects (electron "traps" for ndoped materials or hole "traps" for p-doped materials) can form at some "pinning energy" [START_REF] Grundmann | [END_REF]. If this pinning energy is lower (resp. higher) than the conduction band (resp. valence band), doping fails: electrons (resp. holes) are neutralized by compensating native defects before reaching the conduction band (resp. valence band).

In the following, we assume that the photoconductive material is correctly doped and that the influence of compensating native defects is negligible.

Photoresistor internal dynamics

The internal dynamics of the photoresistor is the result of a competition between carrier recombination processes, which can be classified into three types:

E V Ionized level E I E C Bound level E B e g e i ≤ e g τ 0 Bound defect - Free electron τ + Ionized defect Photoabsorption ≥ e i

N-doping site

(A) Tetrahedral lattice (in white) with bound n-doping site (in blue).

+ -(B) Tetrahedral lattice (in white) with ionized ndoping site (in blue) and a remaining free electron.

P-doping site

(C) Tetrahedral lattice (in white) with bound p-doping site (in red).

-+ (D) Tetrahedral lattice (in white) with ionized pdoping site (in red) and a remaining free hole. 1. Radiative recombination: an electron and a hole recombine directly, emitting a photon afterwards. This mechanism is the exact dual of the generation of free carriers after photoabsorption.

2. Auger recombination: no photon is emitted, but the difference of energy is transferred to another particle.

3. Shockley-Read-Hall recombination: free carriers recombine with defects.

As Shockley-Read-Hall recombination is by far the most important recombination process to take place in doped materials [START_REF] Grundmann | [END_REF], we neglect radiative recombination and Auger recombination in the following.

In this section, we consider n-doped materials only, as cadmium sulfide can be ndoped [START_REF] Uv Desnica | Doping limits in II-VI compounds-Challenges, problems and solutions[END_REF]. The reasoning would be similar for p-doped materials.

Assume an initial state with only bound defects and no free carriers, denoted s 0 . Photoabsorption can lead either to ionization (state s i ), or to electron-hole pair generation (state s g ). The ionized defect can then return to state s 0 , followed by the dissipation of the excess energy e i . Likewise, an electron-hole pair can recombine to state s 0 , followed by the dissipation of the excess energy e g (Fig. 4.5a).

For convenience, and since this is transparent energy-wise, we consider that a transition from state s g to state s 0 , followed by a transition from state s 0 to state s i , is a transition from state s g to state s i , dissipating e ge i (Fig. 4.5b). For convenience also, we assume in the following that the ionizing energy is exactly half the band gap, that is, e ge i = e i .

(4.5)

Free carriers dynamics modeling To study the free carriers dynamics, denote g the electron-hole pair generation rate per unit of volume, ρ -the volume density of electrons, ρ + the volume density of holes, τ + the volume density of defects in ionized state, and τ 0 the volume density of defects in bound state. Denote η τ the total volume density of defects, assumed constant in time:

η τ = τ + + τ 0 , ητ = 0. (4.6)
The time variation of electron density ρcorresponds to the electron-hole pair generation rate density minus the de-ionization rate density. This de-ionization rate density is proportional to the ionized defect density and electron density [START_REF] Grundmann | [END_REF]

so that ρ-= g -v 0 σ + 0 τ + ρ -, (4.7)
with v 0 the carrier velocity (electron or hole) and σ + 0 the ionized defect cross section. In the following, we denote v -

0 = v 0 σ + 0 the volumetric flow rate of electrons (with dimension [m 3 .s -1 ]).
Similarly, the time variation of hole density ρ+ corresponds to the electron-hole pair generation rate density minus the ionization rate density. This ionization rate density is proportional to the bound defects density and hole density so that

ρ+ = g -v 0 σ 0 0 τ 0 ρ + , (4.8)
with σ 0 0 the bound defect cross section. In the following, we denote v + 0 = v 0 σ 0 0 the volumetric flow rate of holes (with dimension [m 3 .s -1 ]).

Charge neutrality of the photoresistor imposes that

q = q 0 V 0 τ + + ρ + -ρ -= 0, (4.9)
with q the photoresistor total charge, q 0 the elementary charge, and V 0 the photoresistor volume. Reinjecting Eq. (4.6) and Eq. (4.9) in Eqs. (4.7)-(4.8) yields PHS formulation and equivalent circuit Multiplying Eq. (4.10) by q 0 V 0 and introducing extensive states

ρ-= g -v - 0 ρ --ρ + ρ -, ρ+ = g -v + 0 η τ + ρ + -ρ -ρ + , ( 4
Q -= q 0 V 0 ρ -(total charge of electrons), Q + = q 0 V 0 ρ + (total charge of holes), capacitance C LDR ∝ q 2 0
e g , and carrier generation flow f gen = -q 0 V 0 g, we 1 It also resembles Lotka-Volterra equations modeling the populations of predators and preys [START_REF] Beck | On the positivity of Poisson integrators for the Lotka-Volterra equations[END_REF]. ≡

τ 0 τ + - τ 0 - + photoabsorption of e g
dissipation of e i dissipation of e ge i s 0 s i s g (B) Equivalent representation: a transition from state s g to state s 0 followed by a transition from state s 0 to state s i is replaced with a transition from state s g to state s i , dissipating e ge i . Chapter 4. Resistive Opto-Isolators obtain

f gen G + τ f G + τ G - τ f G - τ C + f C + C - f C - e gen e G - τ =e C - e G + τ =e C + f R LDR e R LDR (A) Photoresistor internal dynamics: equivalent circuit schematics. e C + e C -f G + τ f G - τ f gen             f C + . . -1 . -1 f C - . . . -1 -1 e G + τ 1 . . . . e G -
Q-= -f gen -G - τ (Q + , Q -) Q - C LDR , Q+ = -f gen -G + τ (Q + , Q -) Q + C LDR , (4.11)
where

G - τ (Q + , Q -) := v - 0 q 0 V 0 Q --Q + C LDR and G + τ (Q + , Q -) := v + 0 q 0 V 0 η τ q 0 V 0 + Q + -Q -C LDR both have the dimension of a conductance 2 .
The internal dynamics of the photoresistor can thus be described by two capacitors C -and C + modeling the storage of electrons and holes respectively, with flow (in Amperes) and effort (in Volts)

ẋ = Q+ , Q-:= f C + , f C - ∇E(x) = Q + C LDR , Q - C LDR := [e C + , e C -] , (4.12)
and two conductors G - τ and G + τ modeling the dissipation caused by de-ionization and ionization respectively, of flow (in Volts) and (state-modulated) effort (in Amperes)

w = e G + τ , e G - τ , z(w) = G + τ e G + τ , G - τ e G - τ := f G + τ , f G - τ . (4.13)
The schematics of the corresponding equivalent circuit are shown on Fig. 4.6a, with corresponding PHS in Fig. 4.6b.

R LDR v R LDR i R LDR ≡ R R R d v R LDR i R LDR

Photoresistor electrical flow and effort

The instantaneous resistance of the photoresistor is given by [89]

R(t) = V 0 0 µ + 0 Q + (t) + µ - 0 Q -(t) , ( 4.14)
where µ + 0 (resp. µ - 0 ) is the mobility of holes (resp. electrons) and 0 is the photoresistor length.

In practice, the photoresistor exhibits a finite resistance R d when it is not exposed to light (d for dark), and a non-zero resistance R when it is exposed to maximal light ( for light). The total instantaneous resistance R LDR (t) can thus be modeled as (Fig. 4.7)

R LDR (t) = R d R(t) + R R d + R(t) + R . ( 4.15)
It is immediately verified that lim

R→+∞ R LDR = R d and lim R→0 R LDR = R .
We deduce the electrical flow and (state-modulated) effort of the photoresistor:

w = i R LDR , z(w) = R LDR Q + , Q -i R LDR = v R LDR . (4.16)
As a reminder, notations and units of all quantities involved are recapped in Table 4.1.

Remark on passivity From Eqs. (4.6)-(4.9), we have

τ+ = v + 0 η τ -τ + ρ + -v - 0 τ + ρ -, τ0 = v - 0 η τ -τ 0 ρ --v + 0 τ 0 ρ + . (4.17) with v - 0 , v + 0 ≥ 0.
Assuming that initial densities τ + (0), τ 0 (0) = η ττ + (0) and densities ρ + and ρ -are all positive, it is verified that if τ + reaches the constant η τ , it decreases, thus remaining below η τ and ensuring the positivity of τ 0 ; likewise, if τ + reaches zero, it increases, thus remaining positive. The same is verified for τ 0 .

Similarly, assuming that initial densities ρ -(0), ρ + (0) and densities τ + , τ 0 are all positive, it is verified from Eq. (4.10) that if ρ -(resp. ρ + ) reaches zero, it increases, thus remaining positive.

Quantity

Notation Units

Constants

photoconductive material band gap e g J defect ionization energy e i J defect volume density

η τ m -3 carrier velocity v 0 m.s -1 ionized defect cross-section σ + 0 m 2 bound defect cross-section σ 0 0 m 2 electron mobility µ - 0 m 2 .V -1 .s -1 hole mobility µ + 0 m 2 .V -1 .s -1 (positive) elementary charge q 0 C photoresistor volume V 0 m 3 photoresistor length 0 m photoresistor equivalent capacitance C LDR F Variables electron-hole pair generation rate volume density g(t) m -3 .s -1 electron volume density ρ -(t) m -3 hole volume density ρ + (t) m -3 ionized defect volume density τ + (t) m -3 bound defect volume density τ 0 (t) m -3 total charge of free electrons Q -(t) C total charge of free holes Q + (t) C de-ionization conductance G - τ Q + (t), Q + (t) A.V -1 ionization conductance G + τ Q + (t), Q + (t) A.V -1 carrier generation flow f gen (t) A
Therefore, provided that initial densities are positive, τ 0 and τ + are always positive, and so are conductances G + τ and G - τ .

Optical coupling

Power conversion between the LED and the photoresistor

Two types of power conversion take place between the LED and the photoresistor. The first one is a conversion from electrical to optical and occurs during photoemission by the LED; it can be modeled with a gyrator of gyration resistance γ e . The second one is a conversion from optical to electrical and occurs during photoabsorption by the photoresistor; it can be modeled with a gyrator of gyration resistance γ a . These gyrators obey the following conservative laws:

i D f 1 = 0 1 /γ e -1 /γ e 0 v D e 1 , f 2 f gen = 0 1 /γ a -1 /γ a 0
e 2 e gen .

(4.18)

However, as the photoresistor spectral response does not match exactly with the LED spectral output (Fig. 4.8), some of the power emitted by the LED is not transmitted to the photoresistor. Since the LED and photoresistor are enclosed in opaque resin, we assume that the difference of power is absorbed by the resin and immediately converted into heat. Therefore, for convenience, these losses are modeled with two equivalent dissipative components r opt 1 and r opt 2 .

Schematics of this coupling are shown in Fig. 4.9a, where, for simplicity, the photoresistor internal dynamics is not represented.

From Kirchhoff's laws, we deduce the PHS in Fig. 4.9b. Using Eq. (4.18), the PHS can be reduced to that of Fig 4 .9c.

For simplicity, we choose to keep the gyrators linear, and model all nonlinearities occurring during the power conversion with r opt 1 and r opt 2 .

Carrier generation flow as a function of LED current

The carrier generation flow depends on the amount of light absorbed by the photoresistor. As we have access to neither photoemission (from the LED), nor photoabsorption (into the photoresistor) characteristics, but only LED and photoresistor voltages and currents, we propose to derive the carrier generation flow as a function of the LED current instead, through the following steps.

Free carriers steady state as a function of static resistance

In steady state, Q+ = Q-= 0. From Eq. (4.11), that implies

G - τ (Q + st , Q - st ) Q - st C LDR = G + τ (Q + st , Q - st ) Q + st C LDR , (4.19)
where

Q + st (resp. Q - st ) denotes the steady state of Q + (resp. Q -)
. By solving Eq. (4.19) for a fixed Q + st , we obtain the relationship between Q - st and Q + st :

Q - st = v - 0 -v + 0 Q + st + v - 0 -v + 0 2 Q + st 2 + 4 v - 0 v + 0 η τ q 0 V 0 + Q + st Q + st 2 v - 0 := Q -(Q + st ). (4.20) Chapter 4. Resistive Opto-Isolators v in i in e r opt 1 f r opt 1 e R LDR f R LDR e r opt 2 f r opt 2 i D f 1 f 2 f gen v D e 1 e 2 e gen γ e γ a
LED electrical port LED optical port LDR optical port (A) Optical power conversion from LED photoemission to photoresistor photoabsorption: equivalent circuit schematics. Proof.

v in i D f 1 e r opt 1 e r opt 2 f 2 f gen e R LDR                         i in . -1 . . . . . . v D 1 . . . . . . . e 1 . . . 1 1 . . . f r opt 1 . . -1 . . . . . f r opt 2 . . -1 . . -1 . . e 2 . . . . 1 . . . e gen . . . . . . . 1 f R LDR . . . . . . -1 . (B) Corresponding PHS. v in e r opt 1 e r opt 2 e R LDR         i in . -1 /γ e -1 /γ e . f r opt 1 1 /γ e . . . f r opt 2 1 /γ e . . -1 /γ a f R LDR . . 1 /γ a 0 (C) Corresponding reduced PHS.
G - τ (Q + st , Q - st ) Q - st C LDR = G + τ (Q + st , Q - st ) Q + st C LDR ⇒ v - 0 q 0 V 0 Q - st -Q + st Q - st = v + 0 q 0 V 0 η τ q 0 V 0 + Q + st -Q - st Q + st ⇒v - 0 Q - st 2 + v + 0 -v - 0 Q + st Q - st -v + 0 η τ q 0 V 0 + Q + st Q + st = 0.
For a given Q + st , we recognize a second-degree equation of the form a Q -

st 2 + b Q - st + c = 0. The general solution is given by Q - st = -b± √ ∆ 2 a , ∆ = b 2 -4 a c.
In this case, -4 a c ≥ 0 therefore -b ≤ √ ∆. The physical solution is positive so that

Q - st = -b + √ ∆ 2 a . ( 4
R st = V 0 0 µ + 0 Q + st + µ - 0 Q -(Q + st ) := R(Q + st ). (4.22)
As the function R is invertible on R + (Fig. 4.10), we obtain the steady state of holes as a function of the static resistance:

Q + st = R -1 (R st ) := Q + (R st ). (4.23)
For the function Q + , we propose an empirical model3 of the form

Q + (R st ) = 1 Q 0 R a 0 st + Q 1 R a 1 st , (4.24)
with Q 0 , Q 1 , a 0 , a 1 positive model parameters.

Static resistance as a function of LED current

Measurements and datasheets (Fig. 4.11) show that there is a relation between the photoresistor static resistance and the LED current:

R st = R st (i D ). ( 4

.25)

Carrier generation flow as a function of LED current From Eq. (4.23) and Eq. (4.25), we deduce Finally, from Eq. ( 4.11), we obtain

Q + st = Q + • R st (i D ).
f gen = -G + τ (Q + st , Q - st ) Q + st C LDR = v + 0 q 0 V 0 Q -• Q + • R st -Q + • R st (i D ) -η τ q 0 V 0 Q + • R st (i D ) := ϕ gen (i D ). (4.27)
As explained at the end of Section 4.3, the ionization conductance as well as the hole total charge are always positive for positive initial conditions. Therefore f gen must be negative. We ensure that ϕ gen is indeed a negative function in Section 4.6.1.

Optical resistors dissipation law

For convenience, we treat r opt 1 and r opt 2 jointly as a tripole, of flow and effort

w = f r opt 1 , f r opt 2 ,
z(w) = e r opt 1 , e r opt 2 .

(4.28)

The LED dissipation law I D in Eq. (4.1) and the carrier generation flow ϕ gen must be reconstructed through r opt 1 and r opt 2 . To this end, we remark that from Kirchhoff's laws applied to the circuit in Fig. 4.9a, we have (4.30) From Eq. (4.29), the condition of passivity z(w) w ≥ 0 corresponds to

f r opt 1 = v D γ e , f r opt 2 = v D γ e - e gen γ a , ( 4
i D v D + f gen e gen ≥ 0, (4.31)
which ensures that the power absorbed by the photoresistor is equal or smaller than the power emitted by the LED as expected. Recall that e gen = e R LDR and that the highest

C LDR ≥ max(C(v)), with C(v) := - ϕ gen • I D (v) v I D (v) Q -• Q + • R st + Q + • R st • I D (v).
(4.32) Parameter estimation in Section 4.6.1 shows that the function C has indeed a maximum, and that a range of possible values for C LDR can be obtained experimentally.

Resistive opto-isolator complete model

By replacing the carrier generation flow f gen with e r opt 2 and connecting the PHS corresponding to the photoresistor alone (Fig. 4.6b) with the PHS corresponding to the optical coupling (Fig. 4.9c), we obtain the complete PHS of the voltage-controlled resistive opto-isolator. In this PHS, the LED and its transmission factor are scattered between the optical resistors r opt 1 and r opt 2 (Fig. 4.12a-4.12c).

Temperature effects

The photoresistor band gap, carrier mobilities, and carrier velocities are all temperature dependent. In particular, we have the following relation between the temperature and the band gap [START_REF] Yatendra | Temperature dependence of the energy gap in semiconductors[END_REF] e g (T) = e g (0)

- α T 2 T + β , (4.33)
where α and β are empirical model parameters. The relation between the temperature and the carrier mobilities is more complex as it depends on the doping sites density, and on various scattering mechanisms with phonons [START_REF] Grundmann | [END_REF] which are beyond the scope of this work. Therefore, details of these dependencies are not addressed here. Nevertheless, should an expression of the photoresistor stored energy as a function of its internal entropy S be found, the PHS would be that given in Fig. 4.13. In this PHS, T is the pho-

toresistor internal temperature, σ i comp = - z comp (w comp ) w comp T comp
is the (irreversible) entropy creation rate for each dissipative component, and σ ext is the entropy flow to the exterior.

Chapter 4. Resistive Opto-Isolators

v D i D v in i in v R LDR i R LDR v out i out (A) Voltage-controlled resistive opto-isolator: schematics. v in i in e ropt 1 f ropt 1 e ropt 2 f ropt 2 f C + f C - f G + τ f G - τ e R LDR f R LDR R R v out i out R d v R LDR i R LDR i D f 1 f 2 f gen v D e 1 e 2 e gen

∇E(x)

z(w)

u e C + e C - f G + τ f G - τ e r opt 1 e r opt 2 v R LDR v in i out                             ẋ f C + . . -1 . . 1 /γ a . . . f C - . . . -1 . 1 /γ a . . . w e G + τ 1 . . . . . . . . e G - τ . 1 . . . . . . . f r opt 1 . . . . . . . 1 /γ e . f r opt 2 -1 /γ a -1 /γ a . . . . . 1 /γ e . i R LDR . . . . . . . . -1 y i in . . . . -1 /γ e -1 /
∇E(x) z(w) u e C + e C - T f G + τ f G - τ σ i G + τ σ i G - τ er opt 1 er opt 2 σ ir opt v R LDR σ i R LDR v in i out σ ext                                                           ẋ f C + . . . -
v in 1 i in 1 R 1 v D i D R p v in 2 i in 2 R 2 i B v R LDR i R LDR i A v A v B

Applications

Identification of a Vactrol from measurements

The characteristics of a VTL5C3/2 are measured via the following experimental setup: a voltage divider is formed with a potentiometer and a DC source. The LED is connected in parallel with the potentiometer, so that the potentiometer controls the LED voltage. Concomitantly, the photoresistor is connected with an independent DC source (Fig.

v D = v A , i D = i A , v R LDR = v B , i R LDR = i B . (4.34)
The photoresistor resistance is obtained through

R LDR = v R LDR i R LDR
. Parameters for the experimental setup are shown in Table 4.2.

The parameters R and R d are taken from the VTL5C3/2 datasheet, and the mobilities µ + 0 and µ - 0 are set according to [START_REF] Spear | Electron and hole transport in CdS crystals[END_REF]. Assuming that q 0 , V 0 , and 0 are known, the resistive opto-isolator remaining parameters are estimated from measurements, in three steps. Parameter identification for the LED The set of parameters

Parameter R 1 (Ω) R 2 (Ω) R p (Ω) v in 1 (V) v in 2 (V)
θ D = [v t , v s , i s ] is esti- mated by solving θ D = arg min θ i D -I D (v D , θ) 2 , ( 4.35)
where I D is given by Eq. (4.1). The estimated parameters are shown in Table 4.3.

Parameter identification for the photoresistor internal dynamics For simplicity, the set of parameters θ LDR = v + 0 , v - 0 , η τ is estimated during turn-off. Denoting R sim (θ) the photoresistor instantaneous resistance simulated for a given set θ (using Eq. (4.11) and Eq. (4.15) with f gen = 0), the set θ LDR is obtained by solving

θ LDR = arg min θ R LDR -R sim (θ) 2 . (4.36)
The estimated parameters are shown in Table 4.3. Figure 4.15 shows that the instantaneous resistance simulated with these parameters matches closely with the measured resistance.

Parameter identification for the carrier generation flow

Q = [Q 0 , Q 1 , a 0 , a 1 ] is then obtained by solving θ Q = arg min θ Q -Q + R(Q, θ LDR ), θ 2 , ( 4.37)
ϕ gen (i D ) = - i D φ 0 i α 0 D + φ 1 i α 1 D + φ 2 i α 2 D + , ( 4.38)
with the regularization parameter set to 10 -16 . This simplified model is easier to compute and necessitates less parameters than the model given by Eq. (4.27). Moreover, it ensures that ϕ gen (0) = 0, and that ϕ gen (i D ) ≤ 0 for all i D (so that f LDR is indeed positive). The set θ ϕ = φ 0 , φ 1 , φ 2 , α 0 , α 1 , α 2 is finally obtained by solving

θ ϕ = arg min θ f gen -ϕ gen (i D , θ) 2 . (4.39)
The estimated parameters are shown in Table 4.3, and Fig. 4. 16 shows the estimation results. The simplified model matches well with the original model within the range of LED currents observed under normal utilization.

In the following, the carrier generation flow is modeled with Eq. (4.38) and θ Q is no longer used.

Simulation of an optical compressor

The estimated parameters for the VTL5C3/2 are used to simulate a minimal optical compressor, shown in Fig. 4.19a. This compressor consists in a voltage divider, in which the output resistor is the photoresistor. If the output voltage is greater than the LED threshold, the LED emits light, and the photoresistor resistance drops, decreasing the output voltage in a feedback control loop. The operational amplifier-based voltage follower reduces the electrical coupling between the photoresistor and the LED.

Parameter Value Dimension

Given

q 0 1.60 × 10 -19 C V 0 10 -5 m 3 0 10 -2 m µ + 0 40 × 10 -4 m 2 .V -1 .s -1 µ - 0 350 × 10 -4 m 2 .V -1 .s -1 R 2 Ω R d 10 × 10 6 Ω Estimated η τ 6.11 × 10 23 m -3 v + 0 2.17 × 10 -22 m 3 .s -1 v - 0 2.87 × 10 -16 m 3 .s -1 Q 0 1.11 × 10 -3 C Q 1 38.9 C a 0 1.98 dimensionless a 1 1. 00 dimensionless φ 0 1.62 × 10 -6 A φ 1 4.83 × 10 -2 A φ 2 45.5 A α 0 -2.21 dimensionless α 1 -0.83 dimensionless α 2 0.32 dimensionless v t 1.52 V v s 23.16 × 10 -3 V i s 5.65 × 10 -3 A C LDR 2.65 × 10 -6 F
Modeling The voltage follower is described by the conservative approximation defined in [START_REF] Müller | A minimal passive model of the operational amplifier: Application to Sallen-Key analog filters[END_REF], with flow and effort given by

w = v + , i o , v + ps , v - ps , z(w) =      . . . . . . f + (w) f -(w) . -f + (w) . . . -f -(w) . .      w := i + , v o , i + ps , i - ps , (4.40)
with an infinite gain modeled by an ideal saturating function

f ± (w) = 1 2   1 ± sat v + -v cm v dm   , sat(x) = min max(x, -1), 1 (4.41)
and v cm and v dm defined by

v cm = v + ps + v - ps 2 , v dm = v + ps -v - ps 2 . (4.42)
Omitting the voltage follower power supplies (treated as constants), and reducing the linear dissipation of R 1 and R 2 , Kirchhoff's laws yield the PHS in Fig. 4.19b. For Chapter 4. Resistive Opto-Isolators

v in i in R 1 - + R 2 i o C i C D i D v + R LDR i R LDR v o v out i + i + ps v + ps i -

∇E(x)

z(w) Simulation To simulate the compressor PHS model, the equation F(ν) := f (ν) -(J -R) e(ν) = 0, with ν = δx f s , w , and f s the sample rate, must be solved at each sample. Here we choose to use an iterative solver (typically, a Newton-Raphson method [32]). Since all capacitors are linear, the dynamics of the model can be pre-solved to reduce the problem. This way, the only constraints left for the iterative solver are the algebraic constraints. Indeed, for a quadratic energy, the discrete gradient regenerates the midpoint method [1] and we have

u v C e C + e C - f G + τ f G - τ e r opt 1 e r opt 2 i + v o v R LDR v in                                     ẋ i C -1 /R 2 . . . . -1 /γ e -1 /γ e . 1 /R 2 . . f C + . . . -1 . . 1 /γ a . . . . f C - . . . . -
∇E(x, δx) = Q x + δx 2 , ( 4.43)
with

Q =    1 /C . . . 1 /C LDR . . . 1 /C LDR    . ( 4
Parameter R 1 (Ω) R 2 (Ω) C (F) v + ps (V) v - ps (V) U 0 (V) f 0 (Hz) f s (Hz) Value 1 ×10 5 & 1×10 3 5 4.7×10 -9 10 -5 3 1×10 3 96×10 3
Adopting block-matrix notation

J -R =    M 1 M 2 M 3 M 4 M 5 M 6 M 7 M 8 M 9    , (4.45)
we have

δx f s = M 1 Q x + δx 2 + M 2 z(w) + M 3 u, (4.46)
hence

δx = I 3 f s - 1 2 M 1 Q -1 M 2 z(w) + M 3 u + M 1 Q x . (4.47)
We deduce

w = Q M 2 + M 5 , Q M 3 + M 6 , Q M 1 + M 4 z(w), u, Q x , (4.48)
with Q = 1 2 M 4 Q I 3 f s -1 2 M 1 Q -1
. Therefore, the dependence on δx is removed, and we only have to solve

F(w) := w -Q M 2 + M 5 , Q M 3 + M 6 , Q M 1 + M 4 z(w), u, Q x = 0. (4.49)
After Eq. (4.49) is solved iteratively, the state increment δx is computed using Eq. (4.47), and the state is updated by computing x + δx.

The compressor is driven with a ramped sinusoidal voltage of the form v in = U(t) sin(2π f 0 t), with U(t) defined for t ∈ [0, 2 t 0 ] as

U(t) =          U 0 t t 0 if t ≤ t 0 U 0 2 - t t 0 if t 0 < t ≤ 2 t 0 (4.50)
for an arbitrary t 0 . Simulation results for Vactrol parameters in Table 4.3, and simulation parameters in Table 4.4, are shown in Fig. 4.20a to 4.20f. The dissipated power stays positive during simulation as expected. Usual compression parameters such as threshold, ratio, attack time, and release time can be directly linked to circuit parameters. Indeed, the compression threshold corresponds to the LED threshold. The compression ratio can be controlled with the resistances R 1 and R 2 : the higher the ratio R 1 /R 2 , the higher the compression ratio. The capacitance C influences the time response of the compressor, which has consequences on the "knee" of the compression curve: the lower the capacitance, the softer the knee. In all cases, we observe that the attack is much sharper than the release, in agreement with the photoresistor time responses.

Conclusion

In this chapter, we have proposed a PHS model for the resistive opto-isolator. First, we modeled its subcomponents (LED and photoresistor) separately. Then, we addressed their coupling. The photoresistor's internal dynamics was obtained from the study of doping mechanisms in semiconductors, while a law for the nonlinear optical coupling between the LED and the photoresistor was derived from the LED's dissipation law and the photoresistor's static resistance.

The model has been used to identify a real Vactrol, based on measurements. Simulations using the estimated parameters closely match with measured dynamic and static characteristics. The estimated parameters were then used to simulate a minimal optical compressor. The dissipated power stays positive during simulation, and compression parameters such as attack, release, threshold, ratio and knee adequately and intuitively relate to circuit parameters.

Nonetheless, the proposed law for the optical coupling has a limitation in the sense that its passivity is conditional on the value of the photoresistor's equivalent capacitance that is difficult to estimate at present. Unconditional passivity would constitute a significant improvement. Moreover, supplementary measurements are needed in order to assess the model's accuracy with respect to overshoot phenomena, i.e. the exhibition of a higher resistance (for a given light exposure) after long exposures to light than after long exposures to dark.

Introduction

In the previous chapters, we proposed physically-based models of nonlinear components used in audio circuits. These models are relevant in a context of white box modeling, which requires extensive knowledge of the circuit schematics and constitutive laws in order to compute simulations. However, if the circuit topology is unknown, white box modeling is no longer an option: constitutive laws are not sufficient, or even of no use if one does not know which components a circuit comprises or how they are interconnected. In this case, it is interesting to retrieve the circuit behavior from measurements, provided that measurements on the circuit are available.

To this end, several approaches have been proposed over the years. Among them, black box modeling is concerned with the reproduction of a global input-output behavior, without necessarily capturing local phenomena that take place inside the system. Volterra-based methods [START_REF] Boyd | Measuring Volterra kernels[END_REF][START_REF] Kaizer | Modeling of the nonlinear response of an electrodynamic loudspeaker by a Volterra series expansion[END_REF][START_REF] Hélie | Volterra series and state transformation for real-time simulations of audio circuits including saturations: Application to the Moog ladder filter[END_REF][START_REF] Bouvier | Nonlinear homogeneous order separation for Volterra Series Identification[END_REF][START_REF] Bouvier | Phase-based order separation for Volterra series identification[END_REF], block-oriented models [START_REF] Eichas | Black-box modeling of distortion circuits with block-oriented models[END_REF][START_REF] Schoukens | Identification of block-oriented nonlinear systems starting from linear approximations: A survey[END_REF] and neural networks [START_REF] Esling | Flow synthesizer: Universal audio synthesizer control with normalizing flows[END_REF][START_REF] Damskägg | Real-time modeling of audio distortion circuits with deep learning[END_REF][START_REF] Martínez Ramírez | Deep learning for black-box modeling of audio effects[END_REF] for instance are popular black box modeling techniques. Though these techniques can be used on a fairly wide range of systems, limitations include high sensitivity to model order selection (for Volterra and block-oriented methods) and lack of interpretability (for neural networks); in particular, disentangling model features and linking them to meaningful, intuitive parameters for the user is a task in itself [START_REF] Christopher | Understanding disentangling in β-VAE[END_REF]. Moreover, interpolation quality and extrapolation outside the range of measurements are both data-dependent.

Grey box modeling techniques on the other hand provide a middle ground between white box and black box, and successfully combine desirable features from both paradigms. Typically, prior knowledge about the system may be incorporated during parameter estimation in order to ensure certain properties in the final model. Such in-between modeling techniques associate state-space representations and polynomial models [START_REF] Paduart | Identification of nonlinear systems using polynomial nonlinear state space models[END_REF], state-space representations and neural networks [START_REF] Parker | Modelling of nonlinear state-space systems using a deep neural network[END_REF], digital filters and neural networks [START_REF] Nercessian | Lightweight and interpretable neural modeling of an audio distortion effect using hyperconditioned differentiable biquads[END_REF], or energy-based modeling and neural networks [START_REF] Matsubara | Deep energy-based modeling of discrete-time physics[END_REF] to name a few.

In this chapter, we propose a grey box approach combining a PH-ODE formulation on the one hand, and kernel-based methods [START_REF] Park | Universal approximation using radialbasis-function networks[END_REF][START_REF] Vapnik | Support vector method for function approximation, regression estimation, and signal processing[END_REF] on the other hand. Indeed, although identification of linear PHS from measurements has been extensively addressed [START_REF] Medianu | Identification for port-controlled Hamiltonian systems[END_REF][START_REF] Benner | Identification of port-Hamiltonian systems from frequency response data[END_REF], identification of nonlinear PHS is still little explored (see e.g. [START_REF] Cherifi | An overview on recent machine learning techniques for port-Hamiltonian systems[END_REF] for an overview). In [START_REF] Celledoni | Learning Hamiltonians of constrained mechanical systems[END_REF], the authors propose an identification method for a certain class of (possibly nonlinear) constrained mechanical systems with no input, that focuses on constraint preservation. Here, we are interested in nonlinear systems with input, and aim for passivity preservation rather than constraint preservation. To address nonlinear behavior, we rely on reproducing kernels, which have proven to be a flexible tool for function approximation and solving of differential equations [START_REF] Schaback | Kernel techniques: From machine learning to meshless methods[END_REF]. As such, they already have succesfully been implemented for audio circuit modeling [START_REF] Daniel | Modeling nonlinear circuits with linearized dynamical models via kernel regression[END_REF]. Reproducing kernels are privileged here over deep learning approaches such as in [START_REF] Lutter | Deep Lagrangian networks: Using physics as model prior for deep learning[END_REF], because the number of parameters to infer is much smaller, and because they are generally more interpretable. The specificity of our method resides in choosing a kernel and tailoring the regression so that key physical properties of the system, such as power balance and passivity, are retained.

This chapter is structured as follows. Section 5.2 recalls principles behind Reproducing Kernel Hilbert Spaces (RKHS) theory and describes how Radial Basis Functions (RBF) can be built from a reproducing kernel and exploited for optimal reconstruction. Section 5.3 details the proposed energy and interconnection matrix parametrization. Finally, in Section 5.4, the method is applied to identify a nonlinear peaking EQ, and perspectives are given in Section 5.5.

This work has been presented at the DAFX conference in 2021 [START_REF] Najnudel | Identification of nonlinear circuits as port-Hamiltonian systems[END_REF].

Reconstruction based on Radial Basis Functions

Reproducing Kernel Hilbert Spaces

Consider an arbitrary set Ω ⊆ R d , and real-valued functions on Ω forming a Hilbert space K with inner product •, • K . If the point evaluation functional δ x defined as

δ x : K → R f → f (x) (5.1)
is continuous in K for all x, then K has a unique positive-definite kernel

K : Ω × Ω → R verifying 1. Positive-definiteness: K := K(x i , x j ) 1≤i≤N, 1≤j≤N 0 ∀N ∈ N, x ∈ Ω N , 2. Symmetry: K(x, y) = K(y, x), 3. Membership: K x := K(x, .) ∈ K, 4. Reproduction: f , K x K = f (x).
In this case, K is said to be a Reproducing Kernel Hilbert Space (see [START_REF] Schaback | Native Hilbert spaces for radial basis functions I[END_REF]). Reciprocally, any positive-definite kernel has a unique corresponding native RKHS.

Example 15. Consider K the space of bandlimited continuous functions of bandwith in [-ν 0 , ν 0 ], with 0 < ν 0 < +∞. The kernel K defined for all (x, y)

∈ Ω 2 with Ω = R as K(x, y) = 2 ν 0 sinc(2 ν 0 x -y ), (5.2
)

with sinc : u →      sin(π u) π u if u = 0 1 if u = 0
is the reproducing kernel of K.

Proof. Symmetry From the fact that sinc is even, it is immediately verified that K is symmetric (Fig. 5.1). Membership Denote T F (resp. T -1 F ) the Fourier transform (resp. inverse Fourier transform) defined as

T F : f → f , f : ν → +∞ -∞ f (y) e -2 π j ν y dy, T -1 F : f → f , f : y → +∞ -∞
f (ν) e 2 π j ν y dν.

Denote g x := T -1 F ( g x ) ∈ K a bandlimited function of bandlimit ν 0 , with g x defined as

g x (ν) = e -2 π j ν x if ν ∈ [-ν 0 , ν 0 ], 0 otherwise.
Actually, g x defines K x . Indeed, for all y ∈ R,

g x (y) = T -1 F ( g x )(y) = ν 0 -ν 0 e -2 π j ν x e 2 π j ν y dν = - 1 2 π j x -y e -2 π j ν (x-y) ν 0 -ν 0 = 1 π x -y sin 2 π ν 0 x -y = 2 ν 0 sinc 2 ν 0 x -y = K x (y). Therefore, K x = g x ∈ K. Reproduction Let f ∈ K. Then ∀x, f , K x K = +∞ -∞ f (y) K x (y) dy = +∞ -∞ f (ν) K x (ν) dν (Plancherel theorem) = ν 0 -ν 0 f (ν) e 2 π j ν x dν = f (x).
Positive-definiteness Bochner theorem states that a positive-definite function is the inverse Fourier transform of a positive function. As K x is positive for all x, we deduce that K x is positive-definite for all x and so is K (see e.g. [START_REF] Tobar | Band-limited Gaussian processes: The sinc kernel[END_REF]).

Properties of reproducing kernels

Optimal approximation Reproducing kernels provide a unique and optimal solution to an interpolation problem. Indeed, consider the classic scattered data interpolation problem, that is, finding an approximation of a function f ∈ K verifying

f (x i ) = y i ∀i ∈ {1, ..., N}, (5.3)
for some given data {(x 1 , y 1 ), ..., (x

N , y N )}, [x 1 , ..., x N ] ∈ Ω N . The function f defined as f : x → N ∑ j=1 K(x, x j ) λj (5.4)
with K the positive-definite kernel inducing the space K, is the optimal approximant of f , in the sense that [START_REF] Schaback | Native Hilbert spaces for radial basis functions I[END_REF] f = arg min {g∈K | g(x i )=y i ∀i∈{1,...,N}} fg K .

(5.5)

In Eq. (5.4), the vector λ = λ1 , . . . , λN is the solution of the linear system Kλ = y, where K i,j = K(x i , x j ). The positive-definiteness of the kernel K implies the positivedefiniteness of the matrix K, which in turn ensures that the problem is well-posed and that the solution is unique. In practice though, for a given problem, the native space K of f , its norm • K , and its corresponding reproducing kernel K are unknown. However, if some prior knowledge about f is at hand, a common strategy is to exploit this knowledge and build a feature map Φ : Ω → F, where F is a Hilbert space of (generally) higher dimension than Ω, in order to construct a kernel of the form K(x, y) = Φ(x), Φ(y) F .

(5.6)

Example 16. Consider the function f : R 2 → R defined as

f : (x 1 , x 2 ) → -2 x 2 1 + x 2 2 + 2 x 1 x 2 -4 x 1 + 2 x 2 -2. (5.7)
Assuming that f is polynomial of degree 2, a possible feature map Φ : R 2 → R 6 is

Φ : (x 1 , x 2 ) → x 2 1 , x 2 2 , √ 2 x 1 x 2 , √ 2 x 1 , √ 2 x 2 , 1 . (5.8)
Note that with this feature map, f can be exactly reconstructed using only two data points, as

f (x) = Φ(x) Φ(y 1 ) -3 Φ(x) Φ(y 2 ), (5.9)
with

y 1 = [1, 1] and y 2 = [1, 0] .
If no prior knowledge about f is available, the remaining strategy is to choose a kernel and adjust its parameters, so that the resulting approximation has desirable properties such as generalization (new inputs close to given data inputs should result in outputs close to given data outputs), and stability (small changes in the training data should cause small changes in the final model).

These properties and how they relate to various kernel parameters are detailed in the next section.

Radial Basis Functions (RBF)

In this section, we recall properties and results stated in [START_REF] Schaback | Kernel techniques: From machine learning to meshless methods[END_REF][START_REF] Schaback | A practical guide to radial basis functions[END_REF]. Radial kernels are kernels of the form K(x i , x j ) = φ x i -x j ρ , with φ : R → R a positive-definite function, and ρ a scaling parameter. As the function φ takes the distance x ix j for argument, the kernel evaluation reduces to the computation of a scalar function regardless of the dimension of Ω. For that reason, such kernels are efficient for high-dimensional approximation problems. Moreover, radial kernels are, by construction, invariant under orthogonal transformations. In particular, they do not depend on the choice of orthonormal basis for Ω.

RBF are formed by translating a radial kernel to span Ω (Figs. 5.2a-5.2b). An approximant f of a function f can then be written as

f (x) ≈ N ∑ i=1 φ i (x) λi , with φ i (x) = φ x -x i ρ . (5.10)
Examples of radial kernels include Wendland functions, of the form (here at order (2, 3), see [START_REF] Wendland | Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree[END_REF][START_REF] Schaback | Kernel techniques: From machine learning to meshless methods[END_REF]) or multiquadrics, of the form

K(x i , x j ) =    (1 -r) 4 (1 + 4 r) if r = x i -x j < 1, 0 otherwise, ( 5
K(x i , x j ) =    1 + r 2 if r = x i -x j < 1, 0 otherwise.
(5.12)

They are shown on Fig. 5.3a. Kernels yield very different results depending on the function to be approximated. In practice, a Wendland kernel yields a better approximation than a multiquadric kernel for a function with a lot of "dips" (Figs. 5.3b-5.3c). Conversely, a multiquadric kernel yields a better approximation for a convex function (Figs. 5.3d-5.3e).

Moreover, reconstruction abilities of RBF depend on the number of centers N, the choice of centers {x i }, the kernel smoothness, and the scaling parameter ρ (see [START_REF] Schaback | A practical guide to radial basis functions[END_REF] for a study).

In particular, the interpolation error converges to zero when the fill distance h, that is, the radius of the largest center-free ball in Ω:

h = sup x∈Ω min i∈{1, ..., N} x -x i , (5.13)
tends to zero. The rate of convergence increases with the kernel smoothness (it is exponential for C ∞ kernels). One could then be tempted to add as many data points as possible. However, the conditioning of the matrix K, and the subsequent model stability and sensitivity to noise, relates strongly to the separation radius q, that is, half the distance between the two closest centers:

q = 1 2 min i =j x i -x j . (5.14)
Indeed, a small q implies that two centers are nearly the same, and so are the corresponding rows in K. Therefore, the optimal number of centers is a result of this tradeoff between generalization and stability, and is problem-dependent. As a direct consequence, for a given number of centers, RBF behave best for quasi-uniform distributions of centers, that is, if there is a positive constant c such that q ≤ h ≤ c q.

(5.15)

For analog reasons, the choice of scaling parameter ρ also has strong consequences for the model interpolation error and stability. Indeed, for a given number of centers, increasing ρ decreases the interpolation error. Unfortunately, increasing ρ also decreases the model stability. To illustrate these facts, the function f defined as

f : x → sin(2 π x) + sin(6 π x) + sin(10 π x) + 4 (5.16)
is interpolated using N = 16 data points uniformly distributed, and the Wendland kernel defined in Eq. 5.11, for several scaling values. Figures 5.4a-5.4b show the approximation results as well as the relative error r , defined as

r (x) = 100 f (x) -f (x) f (x) .
(5.17)

As expected, the relative error decreases as ρ increases. In order to evaluate the model stability with respect to ρ, random noise with a SNR of 46 dB and a normal distribution is added to form M = 100 noisy datasets indexed by 1 ≤ m ≤ M. The standard deviation σ( λi ) of each model set of coefficients λi , where λi = ( λi,1 , . . . , λi,M ), is then computed using

σ( λi ) = 1 M M ∑ m=1 λ i -λi,m 2 , with λ i = 1 M M ∑ m=1 λi,m .
(5.18)

Figure 5.5 shows that the deviation of model coefficients increases strongly with ρ. For these reasons, in the following, the samples are distributed evenly along the measured data range, and the scaling parameter is adjusted to the smallest value so that some test function is approximated with an arbitrary degree of accuracy.

PH-ODE parametrization and estimation

In this section, we exploit the reproducing properties of kernels to reconstruct the energy function of a circuit with linear dissipation, and estimate its interconnection matrix. Notations We recall that by convention, f (0) = f . Then for some positive integer k ≥ 1, we denote f (k) the function defined by:

f (k) : x → d dx f (k-1) (x).
Similarly, we denote f (-k) the function defined by:

f (-k) : x → x 0 f (1-k) (u)du, so that f (-k) (0) = 0.

Working hypotheses

For this method, we consider circuits constituted of one-port components such as (possibly nonlinear) inductors and capacitors, linear conductors, and linear resistors. Since the dissipation is assumed to be linear, all algebraic constraints can be reduced. Therefore, such circuits admit the PH-ODE formulation

ẋ y = (J -R) ∇E(x) u , (5.19)
where J = -J is skew-symmetric, R = R is positive semi-definite, and coefficients of J -R are constant. Moreover, we assume in the following that:

1. The energy law is a separable function of the state, i.e. it takes the form

E(x) = ∑ N x k=1 E k (x k ) , N x = dim (x); 2. Each energy component E k is at least C 2 ∀k ∈ {1, ..., N x }; 3. The energy law is convex, i.e. E (2) k (x k ) ≥ 0, where E (2)
k denotes the second derivative of E k .

Note that assumptions 2. and 3. are sufficient but not necessary. Indeed, a sufficient condition to ensure passivity of storage components is for the energy to have an inferior bound [23]. Nevertheless, enforcing convexity results in a desirable asymptotic behavior. Furthermore, as many energy laws are convex (with the notable exception of meta-stable ferromagnetic cores, see Chapter 3), this assumption is not overly restrictive.

Assuming that samples of x, u and y are available, we propose a data-driven method to obtain a joint estimation of the energy law E, and interconnection matrix J -R, that preserves the passivity of the system. To estimate the energy law, we build an optimal approximant using RBF. To estimate the interconnection matrix, we propose a parametrization preserving its underlying structure.

Energy law parametrization

A simple way of enforcing the convexity of E is to construct a non-negative approximant of each E

(2)

k . An approximant of E can subsequently be obtained by integration. We also choose to integrate E

(2)

k so that E (1) k (0) = 0. To ensure the non-negativity of each E (2)
k , we pick a continuous, positive-definite function φ and form N E RBF with centers x k,i and scaling ρ k

φ k,i : x → φ x -x k,i ρ k , i ∈ {1, N E }. (5.20a) A positive approximant of E (2)
k then takes the form

E (2) k (x k ) ≈ N E ∑ i=1 θ E k,i φ k,i (x k ), θ E k,i ≥ 0 ∀k, i. (5.20b)
Finally, a convex energy law approximant takes the form

E θ E ; x := N x ∑ k=1 N E ∑ i=1 θ E k,i φ (-2) k,i (x k ) , θ E k,i ≥ 0 ∀k, i, (5.20c)
where φ

(-2) k,i
denotes the second antiderivative of φ k,i .

Interconnection matrix parametrization

Parametrization of J

Since J = -J is skew-symmetric, it can be written as

J = J(θ J ) := N J ∑ k=1 θ J k J k , θ J = θ J 1 , . . . , θ J N J ∈ R N J , (5.21)
where

N J = dim(J)(dim(J)-1) 2
, and {J k } is the canonical base of skew-symmetric matrices defined by

{J k } = E i,j -E j,i | 0 ≤ i ≤ N J -2, i + 1 ≤ j ≤ N J -1 , (5.22)
with E i,j the matrix that has 1 at position (i, j) and zeros elsewhere.

Example 17. For dim (J) = 3, {J k } is found to be

{J k } =         0 1 0 -1 0 0 0 0 0    ,    0 0 1 0 0 0 -1 0 0    ,    0 0 0 0 0 1 0 -1 0         .

Parametrization of R

Since R is positive semi-definite, it admits a Cholesky decomposition [START_REF] Nicholas | Analysis of the Cholesky decomposition of a semi-definite matrix[END_REF] and can be written as

R = R(θ R ) = T(θ R )T(θ R ) , with T(θ R ) := N R ∑ k=1 θ R k T k , θ R = θ R 1 , . . . , θ R N R ∈ R N R , (5.23)
where

N R = dim(R)(dim(R)+1) 2
, {T k } is the canonical base of lower triangular matrices defined by (5.24) and diagonal coefficients are non-negative.

{T k } = E i,j | 0 ≤ j ≤ N J -2, j + 1 ≤ i ≤ N J -1 ∪ E i,i | 0 ≤ i ≤ N J -1 ,
Example 18. For dim (R) = 3, {T k } is found to be {T k } =         0 0 0 1 0 0 0 0 0    ,    0 0 0 0 0 0 1 0 0    ,    0 0 0 0 0 0 0 1 0    ,    1 0 0 0 0 0 0 0 0    ,    0 0 0 0 1 0 0 0 0    ,    0 0 0 0 0 0 0 0 1         .

Parameter estimation

Denote f s the sample rate, f [j] the measured average flow at sample j

f [j] = δx[j] f s y[j] , (5.25)
where δx

[j] = x[j + 1] -x[j] and y[j] = y[j]+y[j+1] 2 . Similarly, denote Θ := θ J , θ R , θ E ,
and f (Θ) [j] the estimated flow at sample j

f (Θ)[j] = J(θ J ) -R(θ R )   ∇E θ E ; x[j], δx[j] u[j]   , (5.26)
where u

[j] = u[j]+u[j+1]

2

, θ E 0, diag T(θ R ) 0, and ∇E is the average discrete gradient [START_REF] Mclachlan | Discrete gradient methods have an energy conservation law[END_REF] defined component-wise as

∇E k θ E ; x[j], δx[j] =              N E ∑ i=1 θ E k,i φ (-2) k,i x k [j] + δx k [j] -φ (-2) k,i x k [j] δx k [j] δx k [j] > , N E ∑ i=1 θ E k,i φ (-1) k,i x k [j] + δx k [j] 2 otherwise.
(5.27) Denoting F (resp. F(Θ)) the dim(J) × n matrix of measured flows (resp. estimated flows) at all n samples, we define the error (Θ) = F(Θ) -F, and the objective function

v in i in R L v L i L C v C i C v out R p (

∇E(x)

u v C i L v in     ẋ i C 0 1 0 v L -1 -γ (1 -γ) R p + R γ y i in 0 -γ -G p (
E (Θ) = F(Θ) -F 2
, where : M → M = tr(M * M) is the Frobenius norm. Finally, we look for the optimal

Θ = arg min E (Θ) subject to    θ E 0, diag T(θ R ) 0, (5.28)
where diag T(θ R ) denotes the diagonal elements of T(θ R ).

The sample rate f s is considered high enough so that the numerical error is negligible. Therefore, we consider that we identify the continuous system, and the specific contribution of the discretization scheme to the global error [START_REF] Cieśli | Discrete gradient algorithms of high order for one-dimensional systems[END_REF] is not addressed here.

The constrained minimization of E can be performed using the Interior Point Method (see Appendix D and [128]).

Application: identification of a nonlinear passive peaking EQ

Circuit overview and data generation

We consider a passive peaking EQ (see Fig. 5.6a) [START_REF] Dennis A Bohn | Operator adjustable equalizers: An overview[END_REF]. The potentiometer wiper position is parametrized by γ ∈ [0, 1], where γ = 0 corresponds to the lowest position, and 5.4. Application: identification of a nonlinear passive peaking EQ 87 TABLE 5.1: Virtual passive peaking EQ: data generation parameters.

Parameter R p (Ω) R (Ω) γ C (F) I 0 (A) Φ sat (Wb) η U 0 (V) f 0 (Hz) f s (Hz) Value 5 ×10 2 1 ×10 3 1 3.16 ×10 -6 5 ×10 -2 4 ×10 -3
1.1 0.1 & 10 100 96 ×10 3 γ = 1 to the highest. This parameter determines the shape of the frequency response (Fig. 5.6b). The potentiometer, resistor and capacitor are all considered to be linear. The inductor is saturating with an effort law of the type (see Chapter 3)

i L = I 0   Φ L Φ sat -tanh Φ L η Φ sat   , (5.29)
where I 0 > 0, Φ sat > 0, and η ≥ 1 are model parameters (hysteresis is neglected here).

Circuit parameters are set so that the center frequency is 100 Hz and the quality factor is 1. They are shown in Table 5.1. Synthetic measurements are generated for an input voltage of the form v in (t) = U 0 sin 2π f 0 t . The values of f 0 and γ are chosen so that the circuit is maximally resonant. This way, nonlinearities of the inductor can be accurately captured for a U 0 within the range of normal use. The theoretical PH-ODE of the passive peaking EQ is found to be that in Fig. 5.6c, with

G p = 1 R p + R , γ = γ R p R p + R . ( 5.30)
The measurements are generated by discretizing the PHS and performing a standard Newton-Raphson iteration at each sample. Finally, some noise (SNR from 38 to 98 dB, with a normal distribution) is added to the data to test the robustness of the identification method.

Parameter initialization

Interconnection matrix initialization Because our problem is non convex, an initial guess Θ 0 should be estimated in order to facilitate the optimization. To this end, the problem is linearized around x 0 = 0. This is done by generating measurement data with an input voltage small enough to observe a quasi-linear response (here, U 0 = 0.1 V), so that we have

ẋ y ≈ (J -R) Q 0 0 I Q x u ∀x, u, (5.31)
where

Q := ∇ 2 E(x 0
) is a diagonal matrix with positive coefficients and I is the identity matrix of dimension dim(u). Denote F the dim(J) × n matrix of flows at all n samples, and X the dim(J) × n matrix of (average) states and (average) inputs at all n samples. Multiplying Eq. (5.31) with Q on the left (which amounts to preconditioning the problem [START_REF] Cherifi | Numerical methods to compute a minimal realization of a port-Hamiltonian system[END_REF]), we obtain the relation

Q F = Q (J -R) Q J-R X.
(5.32)

88 Chapter 5. PH-ODE Modeling Based on Optimal Energy Reconstruction from Data Denote Q 0 , J 0 and R 0 a solution of

(Q 0 , J 0 , R 0 ) =arg min Q, J, R Q F -J -R X 2 subject to        Q 0, R 0, J = -J .
(5.33) Equation (5.33) is a convex optimization problem with a Linear Matrix Inequality (LMI) constraint, for which standard solvers exist. Note that due to the LMI constraint, Eq. (5.33) does not have a unique solution: given a solution (Q 0 , J 0 , R 0 ), the triplet (α Q 0 , α J 0 , α R 0 ) with α > 0, which corresponds to F = α (J -R) α -1 QX, is also a solution. Consequently, this method does not prevent compensating estimation errors on the interconnection matrix and on the effort. Therefore, the estimation is valid up to a scaling factor.

Here, we rely on the open source Splitting Conic Solver [START_REF] Brendan | Conic Optimization via Operator Splitting and Homogeneous Self-Dual Embedding[END_REF], and Python library CVXPY [START_REF] Diamond | CVXPY: A Python-embedded modeling language for convex optimization[END_REF] to find a solution of Eq. (5.33). Finally, J and R are initialized to

J 0 = Q -1 0 J 0 Q -1 0 , R 0 = Q -1 0 R 0 Q -1 0 .
(5.34)

Energy law initialization

We choose φ compactly supported, so that interpolation matrices are sparse and computation is efficient. A possible choice of positive-definite function verifying these properties is one of the Wendland functions defined as

φ(r) =          1 - r ρ 2 r = x i -x j < ρ, 0 otherwise.
(5.35)

At a minimum, the approximant must reproduce a linear effort on the measured range of each state. To this end, we fix N E = 5. For this N E , we determine (for each component) the smallest ρ so that the mean relative error m (x i ) defined as

m (x i ) = 1 n n ∑ j=1 arctan g(x i [j]) -g(x i [j]) g(x i [j]) (5.36a) with g(x i ) = Q 0,i x i , g(x i ) = N E ∑ j=1 φ x i -x j λ j (5.36b) and [Q 0,1 , Q 0,2 ]
are the diagonal coefficients of Q 0 obtained solving Eq. (5.33), stays within some arbitrary bound b. This metric is privileged here over that of Eq. (5.17), so that the relative error is bounded when the effort is zero, following [START_REF] Kim | A new metric of absolute percentage error for intermittent demand forecasts[END_REF]. Here, for b = 0.03, ρ C = 6.10 -5 and ρ L = 6.10 -3 yield satisfying results (Figs 5.7c-5.7d, for the inductor). Figure 5.7a (resp. 5.7b) shows the resulting basis for the approximation of ∇ 2 E (resp. ∇E).

(A) Passive peaking EQ: chosen radial basis for ∇ 2 E.

(B) Passive peaking EQ: antiderivatives of chosen radial basis for ∇ 2 E.

(C) Passive peaking EQ: approximation of the test effort g(x i ) = Q 0,i x i .

(D) Passive peaking EQ: corresponding relative error.

FIGURE 5.7: Passive peaking EQ: chosen radial basis for the inductor and resulting approximation of the test effort g(x i ) = Q 0,i x i .

Results

The optimization procedure returns a set of estimated parameters after less than 50 iterations. Here, constraint enforcement is privileged over convergence speed 1 as there are no real-time requirements. Still, the estimation is faster compared to deep neural networks methods (mainly because there are far less parameters to estimate). New simulations are computed with the parameters estimated for each SNR. Figures 5.8a-5.8c show that the simulated states match very closely with the "measured" states (here with measured state SNR = 50 dB). Figures 5.8b-5.8d show the estimated effort laws. The estimated effort law for the capacitor is linear as expected, which shows that the scaling parameter ρ has been correctly chosen. The saturating behavior of the inductor is accurately captured within the range of measured data. Figure 5.9 shows the simulated state Normalized Mean Square Error (NMSE = 20 log ( xx / x )) vs the measured state SNR. The NMSE for the inductor is higher than that of the capacitor due to the nonlinearities of the inductor, but both stay around -60 dB regardless of the SNR.

Finally, to evaluate the robustness of the estimated model, simulations and measurements are also run with different input amplitudes and frequencies than those used for the estimation. Figures 5.10a-5.10h show that the simulated states match closely with the measurements in that case also.

Conclusion

In this chapter, we have presented an identification method to retrieve parameters of a circuit modeled as a port-Hamiltonian system, given measurements of state x, input u, and output y. This method allows the joint estimation of constitutive laws of storage components, as well as the interconnection matrix encoding the circuit topology, provided that the circuit dissipation is linear. In turn, the estimated model may be used for passive guaranteed simulations.

The method has been tested on a virtual peaking EQ, with accurate results. However, the method needs to be more thoroughly assessed against real measurements. In particular, we should control that the discretization scheme does not introduce too much numerical dispersion, which would alter the optimization process. In that case, the discretization error would have to be taken into account [START_REF] Matsuda | Estimation of ordinary differential equation models with discretization error quantification[END_REF], or the sample rate would have to be increased.

Another limitation concerns the fact that the initialization procedure may introduce compensating errors on the interconnection matrix and on the effort. A possible way to prevent this would be to include some measurements (possibly on a reduced range) of the effort as well. Identification from co-energy variables or partial measurements

Koopman operator overview

In Chapter 5, we proposed a method to concomitantly recover the interconnection matrix of a nonlinear circuit and constitutive laws of its components from data. However, this method suffers from an important limitation: it assumes that the dissipation is linear, whereas most dissipative components that are not resistors are in fact nonlinear (diodes, transistors, vacuum tubes, etc.). In this chapter, we propose another data-driven approach for identification which allows for nonlinear dissipation. This approach is based on the Koopman operator [START_REF] Bernard O Koopman | Hamiltonian systems and transformation in Hilbert space[END_REF]. In a nutshell, the Koopman operator is a linear operator that encodes the trajectory of observables -i.e., functions of the state. In the infinite-dimensional space of observables, or lifted space, the system dynamics becomes linear, and standard prediction and optimization tools from linear algebra can be of use. Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator

As such, the Koopman operator has been successfully exploited for model predictive control, optimal control, stabilization, and identification [START_REF] Mauroy | Koopman operator in systems and control[END_REF]. Yet, passivity requirements in the Koopman framework are still seldom addressed. In [START_REF] Mamakoukas | Learning datadriven stable Koopman operators[END_REF], the authors investigate the synthesis of a stable Koopman operator from available trajectories of observables. However, passivity is a stronger property than stability, in the sense that a passive system is always Lyapunov-stable in the absence of input [START_REF] Falaize | Modélisation, simulation, génération de code et correction de systèmes multi-physiques audios: Approche par réseau de composants et formulation Hamiltonienne À Ports[END_REF], but not the other way around. As methods that preserve passivity in discrete time are proven to be numerically stable, ensuring the passivity of the model is preferable. In [START_REF] Hara | Learning Koopman operator under dissipativity constraints[END_REF], a method for learning a Koopman operator in discrete time under dissipativity constraints is presented. As the authors operate in discrete time, the dissipativity constraints result in a nonlinear matrix inequality constraint, and successive changes of variables must be performed in order to find a solution.

Here, we propose a PH-ODE formulation in lifted space, so that passivity constraints result directly in a linear matrix inequality constraint. Once a passive approximation of the Koopman operator has been found, a non-iterative numerical scheme can be used for simulations, since the system dynamics is linear in lifted space.

This chapter is structured as follows. In Section 6.2, the theoretical framework behind the Koopman operator is recalled. In Section 6.3, a PH-ODE formulation in lifted space is proposed, as well as a subsequent non-iterative numerical scheme for simulations. Finally, in Section 6.4, the method is applied in order to identify and simulate a diode clipper circuit.

Koopman operator for continuous-time systems 6.2.1 Koopman operator for autonomous systems

Consider the autonomous dynamical system defined by ẋ(t) = f (x(t)), x(0) = x 0 (6.1)

with x ∈ X = R N x , TX = R N x , f : X → TX. Denote S t : X → X the flow of f : S t : x 0 -→ S t (x 0 ) = x(t). (6.2)
Koopman operator Denote (F, . ) a Banach space 1 and φ ∈ F an observable defined as

φ : X -→ R x -→ φ(x). (6.3)
Examples of observables include the energy of the system (φ : x → E(x)), components of the effort (φ :

x → ∂ E ∂x i (x)) or components of the state itself (φ : x → x i ).
Definition 6 (Koopman operator). The (infinite-dimensional) Koopman operator in continuous time K t : F → F associated to S t is defined as

K t : φ -→ K t φ = φ • S t . (6.4)
In other words, applying the Koopman operator to an observable φ yields the evaluation of φ along the flow of f . Property 5 (Linearity of the Koopman operator). The Koopman operator is a linear operator (from linearity of the left composition):

∀(φ 1 , φ 2 ) ∈ F 2 , (c 1 , c 2 ) ∈ R 2 , K t c 1 φ 1 + c 2 φ 2 = c 1 K t φ 1 + c 2 K t φ 2 .
(6.5)

Proof.

K t c 1 φ 1 + c 2 φ 2 = c 1 φ 1 + c 2 φ 2 • S t = c 1 φ 1 • S t + c 2 φ 2 • S t = c 1 K t φ 1 + c 2 K t φ 2 .
Furthermore, if f is Lipschitz continuous (as assumed in the following), then {K t } t≥0 is a strongly continuous semi-group, i.e., (i) it satisfies

K h K t = K h+t ∀(h, t) ∈ R + 2 , ( 6.6)
and (ii) it admits an infinitesimal generator.

Definition 7 (Koopman operator infinitesimal generator). If f is Lipschitz continuous, then {K t } t≥0 has an infinitesimal generator L defined as

L : φ -→ L φ = lim h→0 + K h -I φ h , (6.7)
where I denotes the identity operator on F.

Property 6 (ODE in lifted space). If f is Lipschitz continuous, then K t satisfies the ODE

d dt K t = L K t . (6.8)
Proof. Proof. Let φ ∈ F. Then, for all x 0 ∈ X,

d dt K t (a) = lim h→0 + K h+t -K t h (b) = lim h→0 + K h -I K t h (c) = L K t , using (
L φ(S t (x 0 )) (a) = L K t φ(x 0 ) (b) = d dt K t φ(x 0 ) (c) = d dt φ(S t (x 0 )) (d) = d dt φ(x(t)) (e) = ∇φ(x(t)) • ẋ(t) ( f ) = ∇φ(x(t)) • f (x(t)) (g) = ∇φ • f (S t (x 0 )),
using (a) Def. ( 6), (b) Prop. ( 6), (c) Def. ( 6) again, (d) Eq. ( 6.2), (e) the chain rule, (f) Eq. (6.1), and (g) Eq. ( 6.2) again.

Koopman operator eigenfunctions

Definition 8 (Koopman operator eigenfunction). An eigenfunction ϕ ∈ F with associated eigenvalue λ ∈ C of the Koopman operator K t is a function that verifies, for all t K t ϕ = e λ t ϕ, (

or, equivalently, L ϕ = λ ϕ. (6.11)

Example 19. Consider the dynamical system described by ẋ = -xx 3 . (6.12)

The function ϕ : R → R defined by

ϕ : x -→ x √ 1 + x 2 (6.13)
is an eigenfunction (with eigenvalue λ = -1) of the Koopman operator associated with the dynamical system described by Eq. (6.12).

Proof. For all x ∈ R,

L ϕ(x) (a) = ∇ϕ(x) • f (x) (b) = √ 1 + x 2 -x 2 1 + x 2 -1 /2 1 + x 2 • (-x -x 3 ) = 1 + x 2 -x 2 -x -x 3 1 + x 2 √ 1 + x 2 = - x √ 1 + x 2 = -ϕ(x),
using (a) Prop. (8), and (b) Eqs. (6.12)-(6.13).

Koopman operator for continuous-time systems 97

Eigenfunctions constitute a basis of the space of observables F. As such, they can be seen as "intrinsic coordinates" of the system in F, and provide valuable geometric properties about the system [START_REF] Mauroy | Koopman operator in systems and control[END_REF]. In particular, eigenfunctions with eigenvalue λ = 0 correspond to conservative eigenfunctions. An immediate example is the Hamiltonian for an autonomous system, since d dt E(x(t)) = 0 = 0 × E(x(t)). For a nonconservative system (which has an attractor), conservative eigenfunctions capture the asymptotic behavior of the system in the vicinity of the attractor. Conversely, eigenvalues that verify Re(λ) < 0 correspond to dissipative eigenfunctions. They capture the transient behavior of the system off the attractor.

Finite-dimensional approximation of the Koopman operator

In order to exploit the properties of the Koopman operator in data-driven methods, one has to find a finite-dimensional approximation of its infinitesimal generator L. To this end, the infinitesimal generator is projected on a finite-dimensional subspace of F, in the following way.

Denote F the topological dual of F, i.e. the subset of linear bounded functionals on F [START_REF] Köthe | Topological vector spaces[END_REF]. Denote F M a M-dimensional subspace of F spanned by {φ j } 1≤j≤M2 , and Φ : R M → F M the associated synthesis operator defined by

Φ : v -→ Φ v = φ 1 , . . . , φ M v. (6.14)
Then there exists a dual operator Ψ * : F → R M defined by

Ψ * : φ -→ Ψ * φ = ψ * 1 (φ), . . . , ψ * M (φ) (6.15)
with dual functionals ψ * 1 , . . . , ψ * M ∈ F M , such that the double resolution of identity is verified

Φ Ψ * = I F M , Ψ * Φ = I R M . (6.16)
This defines the projector P M : F → F M as P M = Φ Ψ * . Indeed, from Eq. (6.16), it is immediately verified that P 2 M = P M . The approximation L M of L in F M and its matrix representation L are defined as

L M = P M L P M , L = Ψ * L Φ. (6.17)
In other words, the jth column of L contains the coordinates of L φ j with respect to {φ j } 1≤j≤M . Denoting z = φ(x) with φ = φ 1 , . . . , φ M , the approximated dynamics in

F M M is governed by ż = L z. (6.18)
Proof.

d dt K t Φ ≈ L M K t Φ = P M L P M K t Φ = Φ Ψ * L Φ L Ψ * K t Φ Φ•S t = Φ L Ψ * Φ I R M •S t = (Φ L) • S t = K t Φ L.
As K t Φ(x 0 ) = z(t) for all x 0 , we deduce ż = z L. Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator Example 1 (Continued). Consider again the dynamical system of Eq. (6.12), and denote F M the set of polynomial functions of at most degree 3. F M is spanned by {φ j : x → x j-1 } 1≤j≤4 , with dual basis {ψ * j } 1≤j≤4 defined for φ : x → ∑ ∞ j=1 c j x j-1 as ψ * j (φ) = c j . Then, L is found to be

L =      0 0 0 0 0 -1 0 0 0 0 -2 0 0 -1 0 -3      .
Proof.

L φ j (x) (a) = ∇φ j (x) • f (x) = (j -1) x j-2 -x -x 3 = -(j -1) x j-1 + x j+1 ,
using (a) Prop. (8). The jth column of L contains the coordinates of L φ j with respect to {φ j } 1≤j≤4 , that is

Ψ * L φ j = S j-1 -j + 1, 0, -j + 1, 0 ,
where S is the shift operator defined by S([c 1 , c 2 , . . .]) = [0, c 1 , c 2 , . . .], and its successive compositions are defined by S 0 = I, S i+1 = S • S i .

Estimation of Koopman operator matrix representation and eigenfunctions from data

Assume that n samples of state x are available with n ≥ M. For a chosen collection of observables {φ j } 1≤j≤M , denote Ż the matrix that contains the time derivative of z = φ(x) for all samples, and Z the matrix that contains z for all samples, so that

Ż = ∂φ(x[1]) f (x[1]), . . . , ∂φ(x[n]) f (x[n]) , Z = φ(x[1]), . . . , φ(x[n]) , (6.19)
with

∂φ(x) :=         ∂φ 1 ∂x 1 (x) . . . ∂φ 1 ∂x N x (x) . . . . . . . . . ∂φ M ∂x 1 (x) . . . ∂φ M ∂x N x (x)         . ( 6.20)
Estimation of L From Eq. (6.18), Ż = L Z, and L can be estimated using

L ≈ L with L = Ż Z † , (6.21)
where Z † := Z (Z Z ) -1 denotes the right pseudo-inverse of Z.

Estimation of eigenfunction ϕ Projections of eigenfunctions can be estimated from data in a similar way, following Property 9. If ϕ is an eigenfunction of L with associated eigenvalue λ, then v := Ψ * ϕ is an eigenvector of L with associated eigenvalue λ.

Proof. Let ϕ ∈ F an eigenfunction of L with associated eigenvalue λ.

L ϕ

(a) = λ ϕ (b) ⇒ P M L P M ϕ = λ P M ϕ (c) ⇒ L M φ v = λ φ v (d) ⇒ φ L v = λ φ v (e) ⇒ L v = λ v,
(A) Trajectories of estimated eigenfunctions for the system described by Eq. (6.12).

For the considered subspace, there is one conservative eigenfunction and three dissipative ones.

(B) Time derivatives of eigenfunctions vs estimated eigenfunctions for the system described by Eq. (6.12). Eigenfunctions are proportional to their time derivatives as expected (grey dashed lines have been added for visual purposes). FIGURE 6.1: Estimated eigenfunctions for the system described by Eq. (6.12).

using (a) Eq. (6.11), (b) the projection of (a), (c) and (d) Eq. (6.17), and (e) multiplication with (φφ ) -1 φ on the left.

As L can be estimated from data (see Eq. (6.21)), so can its eigenvalues and eigenvectors.

Example 1 (Continued). Figures 6.1b-6.1a show the estimated eigenfunctions for the system described by Eq. (6.12), with x 0 = 10.

Koopman operator for input/output systems

The Koopman operator for controlled systems is commonly defined by including the input in the state, and by defining observables for this extended state [START_REF] Proctor | Generalizing Koopman theory to allow for inputs and control[END_REF]. However, for systems without feedback control, the input dynamics is irrelevant. The corresponding terms in the Koopman operator are left with no clear interpretation and are discarded, as in [START_REF] Hara | Learning Koopman operator under dissipativity constraints[END_REF]. To avoid this, we present an alternate definition of the Koopman operator for input/output systems based on a bilinear map, as described in [START_REF] Surana | Koopman operator based observer synthesis for control-affine nonlinear systems[END_REF]. With this definition, the Koopman operator for input/output systems can be thought of as a family of operators parametrized by the input, and the explicit linear dependency with respect to the input facilitates their implementation in data-driven methods.

Consider the control-affine dynamical system defined by

ẋ(t) = f (x(t)) + B u(t), x(0) = x 0 , (6.22)
with u ∈ R N u . Denote L the infinitesimal generator of the Koopman operator associated with Eq. (6.22) for u = 0, and introduce the bilinear map G B : F × R N u → F defined as Proof. Let φ ∈ F. For all x 0 ∈ X,

G B : (φ, u) -→ G B (φ, u) = ∇φ • B u. ( 6
d dt K t φ(x 0 ) (a) = d dt φ(x(t)) (b) = ∇φ(x(t)) • ẋ(t) (c) = ∇φ(x(t)) • f (x(t)) + B u(t) = ∇φ(x(t)) • f (x(t)) + ∇φ(x(t)) • B u(t) (d) = L φ(x(t)) + G B (φ(x), u(t)) (e) = L K t φ(x 0 ) + G B (K t φ(x 0 ), u(t)),
using (a) Def. ( 6), (b) the chain rule, (c) Eq. (6.22), (d) Prop. ( 8) and Eq. (6.23), and (e) Def. ( 6) again.

Finite-dimensional approximation

The operator G B can be rewritten as

G B (φ, u) = ∇φ • b 1 , . . . , ∇φ • b N u u := G 1 (φ), . . . , G N u (φ) u, (6.25)
where b j denotes the jth column of B. Denoting G j := Ψ * G j Φ the finite-dimensional representation of G j , we obtain, after projection, the approximated dynamics in lifted space as the one described by ż = L z + G(z) u, (6.26) with G(z) := G 1 z, . . . , G N u z . The proof is omitted as it is similar to that of Eq. (6.18).

PH-ODE realization in lifted space

In this section, we aim to show that under certain assumptions, a PHS that can be described by a passive state-space representation also admits a passive representation in lifted space and reciprocally. In a first step, we show that a PH-ODE admits a PH-ODE realization in lifted space. Then in a second step, we show that a PH-ODE in lifted space is also passive in state space. This equivalence allows the derivation of a non-iterative numerical scheme that exploits the linearity of the dynamics in lifted space, while preserving the passivity of the system in both spaces.

Existence of a quadratic energy realization in lifted space

Consider the passive PH-ODE given by

ẋ y = (J -R) ∇E(x) u , (6.27)
with J = -J , R 0, x ∈ X = R N x , E : X → R 0.

PH-ODE realization in lifted space

101

Assume that there exists a M × M matrix Q 0 with M ≥ N x , a N x × M matrix C, and a C 1 -regular function φ defined as

φ : X -→ R M x -→ φ 1 (x), . . . , φ M (x) (6.28)
with {φ 1 , . . . , φ M } linearly independent, such that

E(x) = 1 2 φ(x) Q φ(x) ∀x, (6.29a)
x = C z with z = φ(x). (6.29b)

The matrix C is not uniquely defined, but one can always add the state components as observables, so that

x = I N x , 0 N x ×M-N x C x 1 , . . . , x N x , φ 1 (x), . . . , φ M-N x (x) z . ( 6.30)
Examples are given below in the case M = N x (φ is a bijective change of state) and M ≥ N x (φ is an embedding).

Example 2 (Case of bijective φ: quadratization method). In the case of a separable energy function of the form E(x) = ∑ M i=1 E i (x i ) (see [24,[START_REF] Lopes | Approche passive pour la modélisation, la simulation et l'étude d'un banc de test robotisé pour les instruments de type cuivre[END_REF]1] for details on complementary hypotheses or for larger classes of energy functions), the change of state φ(x) = sign(x 1 ) 2 E 1 (x 1 ), . . . , sign(x M ) 2 E M (x M ) fulfills the assumptions with Q = I.

Example 3 (Case of embedding φ).

The quadratization method can be applied on a subset of {φ 1 , . . . , φ M } and the set can be completed with linear or nonlinear functions.

Under assumptions (6.28)-(6.29a)-(6.29b), the system admits a PH-ODE realization in lifted space given by = ∂φ(x) definite from the positive semi-definiteness of R, and Q 0, the system in lifted space is also passive.

ż y = J -R Q z u , J -R = ∂φ(C z) 0 0 I (J -R) ∂φ(C z) 0 0 I . ( 6
0 0 I (J -R) ∇E(x) u (c) = ∂φ(x) 0 0 I (J -R) ∂φ(x) Q φ(x) u = ∂φ(x) 0 0 I (J -R) ∂φ(x) 0 0 I Q φ(x) u (d) = ∂φ(C z) 0 0 I (J -R) ∂φ(C z) 0 0 I J-R Q z u , using (a

Passivity in state space from passivity in lifted space

Consider a dynamical system defined by ẋ = f (x, u), y = h(x, u). (6.32) It is passive if there is a positive, C 1 -regular storage function V such that

∂V ∂x (x) ẋ + u y ≤ 0 (6.33)
along all solutions x of Eq. (6.32) for input u.

Theorem 2. If a system described by Eq. (6.32) admits a PH-ODE realization in lifted space, then it is passive with storage function V : x → 1 2 φ(x) Q φ(x).

Proof. Assume that there exists C 1 -regular φ : x → φ 1 (x), . . . , φ M (x) := z, Q 0, J = -J , R 0, such that ż y = (J -R) Q z u .

PH-ODE realization in lifted space

103

Then from the passivity of a PH-ODE, we deduce

(Q z) ż + u y ≤ 0 ⇒ ∂φ ∂x (x) Q φ(x) ∂V ∂x (x)
ẋ + u y ≤ 0.

Remark that V(x) = 1 2 φ(x) Q φ(x) defines a storage function for all linearly independent {φ 1 , . . . , φ M } since Q 0.

Optimal realization

From Theorem 2, if a PH-ODE realization is found in lifted space, then the system is also passive in state space. Therefore, in order to linearize the dynamics in lifted space while retaining passivity, one can build a collection of C 1 observables spanning a finitedimensional subspace, and look for a realization of the form

ż y = J -R G(z) -G(z) -D Q z u , (6.34)
with J = -J , R 0, D 0, Q 0.

Preconditioning In order to (i) precondition the problem, and (ii) ensure that the problem reduces to a LMI, we impose Q = I [START_REF] Cherifi | Numerical methods to compute a minimal realization of a port-Hamiltonian system[END_REF]. Using the Cholesky factorization Q = T Q T Q , this is equivalent to performing the change of variable z = T Q z, (6.35) in order to obtain

ż y = J -R G( z) -G( z) -D z u , (6.36) with J -R = T Q (J -R) T Q , and G( z) = T Q G(T -1 Q z).
Relaxation In practice, finding a collection of observables for which a realization such as Eq. (6.36) can be derived is a delicate problem. Indeed, several numerical experiments (not presented here) have shown that with usual basis functions (polynomials or RBF), formulation (6.36) is too restrictive: the dynamics in lifted space is correctly learned, but not the output y. This would suggest that even if a collection {φ 1 , . . . , φ M } is "sufficient" to approximate a dynamics (through the identification process detailed below), it needs to be complemented in order to provide suitable approximation of the output. An alternative to complementing is to distinguish command and observation matrices G( z) and -G( z) in order to include dissipation, so that formulation (6.36) is relaxed into

ż y = J -R G s (z) -G p (z) -G s (z) -G p (z) -D z u , with J = -J , R G p (z) G p (z) D 0. ( 6
(Θ)[k] = J -R G s (z[k]) -G p (z[k]) -G s (z[k]) -G p (z[k]) -D z[k] u[k] , (6.39)
with

z[k] = z[k + 1] + z[k] /2 and u[k] = u[k + 1] + u[k] /2.
Denote F the matrix of measured flows for all samples, F(Θ) the matrix of estimated flows for all samples, and the objective function

E : Θ → E (Θ) = F(Θ) -F 2 .
Estimation of the set of parameters Θ is achieved by solving the minimization problem with LMI constraint minimize E (Θ)

subject to        J = -J , R G p (z) G p (z) D 0. (6.40)
This problem can be solved with standard optimization tools (see e.g. [START_REF] Brendan | Conic Optimization via Operator Splitting and Homogeneous Self-Dual Embedding[END_REF][START_REF] Diamond | CVXPY: A Python-embedded modeling language for convex optimization[END_REF]).

Numerical scheme for simulations

Assume that a realization in lifted space has been found, for a given collection of observables z, so that ż = L z + G(z) u. (6.41) For efficiency, one may choose (when possible) to diagonalize the matrix L and work with eigenfunctions of the Koopman operator instead (see also [START_REF] Kaiser | Data-driven discovery of Koopman eigenfunctions for control[END_REF][START_REF] Korda | Optimal construction of Koopman eigenfunctions for prediction and control[END_REF]) in the following way. Denote L = P Λ P -1 the eigendecomposition of L and z = P -1 z. Then, we obtain ż = Λ z + G( z) u, (

with G( z) = P -1 G(P z).

In both cases (Eq. (6.41) and Eq. (6.42)), a linear implicit scheme can be used for simulations (see [24] for higher accuracy orders), as a continuous system of the form ż = A z + B(z) u can be discretized into

δz[k] f s = A z[k] + δz[k] 2 + B(z[k]) u[k], (6.43)
with

δz[k] = z[k + 1] -z[k]
and f s the sample rate. We obtain the following scheme:

z[k + 1] = I f s - 1 2 A -1 1 2 A + I f s z[k] + B(z[k]) u[k] , x[k + 1] = C z[k + 1], (6.44)
6.4. Application: identification of a diode clipper circuit Parameter R (Ω)

105 v in i in R v R i R D v D i D C v C i C (A) Diode clipper: schematics. v C i D v in i C -1/R -1 1/R v D 1 0 0 i in 1/R 0 -1/R (
C (F) i s (A) v s (V) v t (V) U 0 (V) f 0 (Hz) f s (Hz) Value 8 ×10 5 1 ×10 -9 4 ×10 -3 1×10 -2 0.9 10 100 96 ×10
3
where I is the identity matrix. In summary, the state-space representation in lifted space provides a mean to derive non-iterative solvers for which, as a major advantage, the existence and uniqueness of the discrete-time solution holds.

Application: identification of a diode clipper circuit 6.4.1 Circuit overview and data generation

In this section, the Koopman operator framework is used in order to identify a virtual diode clipper circuit (Fig. 6.2a). The capacitor is linear, of energy law E(q C ) = q 2 C 2 C . The resistor is linear and obeys Ohm's law. The diode is a dissipative component, whose flow and effort are given by (see Eq. 4.1):

w = v D , z(w) = i s sp v D -v t v s -sp - v t v s := I D (v D ) = i D , (6.45)
where sp is the softplus function defined as sp : x -→ ln(1 + exp x). (6.46)

Kirchhoff's laws yield the PHS with interconnection matrix detailed in Fig. 6.2b. Synthetic measurements are generated by simulating this PHS with an input of the form v in (t) = U 0 sin(2 π f 0 t) and parameters in Table 6.1.

Choice of observables

Observables are built with RBF (see Chapter 5, p.79), defined as with M = 10 centers x j uniformly distributed and ρ = 4.10 -9 . For simplicity, we also add the state as an observable, so that x = C z with C = [1, 0, . . . , 0]. Indeed, once model parameters have been estimated following Eq. (6.40), the state must be simulated as in Eq. (6.44) in order to evaluate the model accuracy. Choosing a simple inverse mapping considerably lowers the simulation computation cost.

φ j (x) =        (1 -r) 4 (1 + 4 r) if r = x -x j ρ < 1, 0 otherwise, ( 6

Results

Model parameters for the passive representation in lifted space are estimated following Eq. (6.40). Moreover, for comparison, an unconstrained Koopman operator approximation K is also estimated by computing

K = F E † , (6.48)
where E is the matrix of measured efforts e[k] = z[k], u[k] for all samples and † denotes the pseudo-inverse. Simulations are performed according to Eq. (6.44) for both models. The dissipated power in lifted space P diss is defined for each sample by

P diss [k] = -u[k] y[k] -z[k] δz[k] f s .
(6.49) Figure 6.3a shows that the unconstrained Koopman operator approximation yields a more accurate simulation, but does not guarantee that the dissipated power in lifted space stays above zero (Fig. 6.3b). On the contrary, the passive Koopman approximation yields a slightly less accurate simulation, but the dissipated power in lifted space stays above zero (Fig. 6.3c).

Conclusion

In this chapter, we have showed how to linearize the dynamics of a nonlinear PH-ODE with input in a higher-dimensional space of observables, through the use of the Koopman operator and a bilinear map with respect to the input and observables. A finitedimensional approximation of the Koopman operator infinitesimal generator can be estimated from data, and passivity can be preserved during estimation with a continuoustime PH-ODE formulation in lifted space and appropriate constraints. In turn, this allows the derivation of a passivity-preserving, non-iterative numerical scheme for simulations.

A relaxed version of the method has been applied to identify and simulate a diode clipper circuit. The state trajectory is correctly reproduced within the range of available data, and the dissipated power in lifted space stays positive during simulation.

However, this relaxed formulation presents some limitations as it causes overdissipation. Therefore, further investigation is needed in order to find an alternative PH-ODE formulation (with matrices possibly dependent on the input u) and appropriate basis functions for which a relaxed form is not required. The accuracy of the simulations with different types of inputs should also be assessed. This shall be the object of future work. Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator

Conclusion

In this thesis, we investigated power-balanced modeling of nonlinear circuits for audio applications. To this end, we explored two different approaches based on a port-Hamiltonian formulation, that guarantees power balance and passivity in both continuous and discrete-time domains. The first approach is based on physics and requires knowledge of the considered circuit's schematics and constitutive laws. With schematics of targeted circuits at hand, we proposed energy-based models of two multiphysical, highly nonlinear components that are found in analog audio circuits, namely, ferromagnetic coils and resistive optoisolators.

In order to model the ferromagnetic coil, we revisited equilibrium statistical physics and derived a macroscopic model for the ferromagnetic core that accounts for thermodynamic phenomena such as meta-stability, phase transitions, and entropy creation. These phenomena, combined with the coil's coercion on the core, were found to be responsible for the hysteresis that arises when the component is driven by high voltages. Parameters of the model were estimated from measurements on real inductors. These parameters were in turn used to simulate two circuits, a highpass filter and a loaded transformer, with satisfactory results. Nonetheless, extensive measurements should be conducted to assess the model more quantitatively, in particular with respect to different input signals, and at different temperatures.

To model the resistive opto-isolator, we modeled its subcomponents -namely, a LED and a photoresistor-separately, then we addressed their coupling. The photoresistor's internal dynamics was obtained from the study of doping mechanisms in semiconductors, while a law for the nonlinear optical coupling between the LED and the photoresistor was derived from the LED's dissipation law and the photoresistor's static resistance. Parameters of the model were estimated from measurements on a real Vactrol. These parameters were in turn used to simulate a minimal optical compressor, with qualitatively satisfactory results. However, as of now, the passivity of the law for the optical coupling between the LED and the photoresistor depends on the value of the photoresistor's equivalent capacitance. Finding an unconditionally passive law instead would constitute a significant improvement. Moreover, supplementary measurements should be conducted in order to assess the model's accuracy with respect to overshoot phenomena that theoretically occur after long exposures to light.

The second approach is based on data and aims to retrieve the topology and constitutive laws of a circuit from measurements of the input, output, and state.

For circuits with linear dissipation, we proposed an identification method based on a parametrization of the interconnection matrix that accounts for an underlying PH-ODE structure, and on the optimal reconstruction of the system's energy through reproducing kernels. In turn, the estimated model may be used for passive guaranteed simulations. The method was tested on a virtual peaking EQ, with accurate results. However, the method should be more thoroughly assessed against real measurements. Another perspective is to limit the introduction of compensating errors on the interconnection matrix and on the effort during the estimation. A possible way to prevent this would be to include some measurements (possibly on a reduced range) of the effort as well.

For circuits with nonlinear dissipation that admit a PH-ODE representation, we proposed a method based on the linearization of the system dynamics in the space of observables, through the Koopman operator. We showed how to estimate a finitedimensional approximation of the Koopman operator from measurements, and how to preserve passivity during estimation via appropriate constraints. The linearity of the dynamics in the space of observables allowed the derivation of a passivity-preserving, 6.5. Conclusion 109 non-iterative numerical scheme for simulations. A relaxed version of the method was applied to identify and simulate a virtual diode clipper circuit. The state trajectory was correctly reproduced within the range of available data, and the dissipated power in the space of observables stayed positive during simulation. However, this relaxed formulation presents some limitations as it causes over-dissipation. Therefore, further investigation is needed in order to build an adequate collection of observables for which a relaxed formulation is not required. Moreover, the model's accuracy with respect to different input signal should be assessed, as well as the robustness of the method with real measurements. Furthermore, an immediate perspective of this work would be to extend the method to PH-DAE. This shall be the object of future work. Proof.

f = T L ( f ) • f -1 = f • f -1 -f -1 × f • f -1 = f • f -1 -I × f -1 ⇒ f = f -1 × f • f -1 -I × f -1 -f -1 = I × f -1 -I × f -1 -f -1 = -f -1 .
Definition 11 (Second Legendre transform). The second Legendre transform of a convex function f is the function f defined as

f : x → f ( x) = T L ( f )(x) |x=-( f ) -1 ( x) . (A.5)
Property 12 (Second Legendre transform of first Legendre transform.). The second Legendre transform of the first Legendre transform of a convex function f is the function f :

f = f . (A.6) Proof. f = T L ( f ) • -f -1 = f • -f -1 + f -1 × f • -f -1 = f • -f -1 -I × f -1 = f • f + I f = f • f -1 -I f -1 • f + I f = f -I f + I f = f .
Example 5 (Internal energy and free energy.). Consider the (convex) internal energy E defined as E : S → E(S) with S the entropy. The temperature T is defined as T = E (S). From Eq. (A.3), we have T L (E)(S) = E(S) -TS, (A.7)

and we define the free energy F as the first Legendre transform of E given by

F : T → T L (E)(S) |S=(E ) -1 (T) . (A.8)
From Prop. ( 11), we have F (T) = -S, (A.9)

and from Prop. (12), we have

F = E. (A.10) Appendix B

Partition Function of an Atom in a Box

Consider N non-interacting atoms in a closed, rigid cube of length a at temperature T.

A microstate of an atom is a vector m = [m x , m y , m z ] ∈ N * 3 , where m i is the energy quantization along axis i. Denote µ the atom mass, and h the Planck constant. The momentum p of an atom is

p = m h 2 a , (B.1)
and the Hamiltonian is given by its kinetic energy [START_REF] John | The physics of low-dimensional semiconductors: An introduction[END_REF] E (m

) := p 2 2 µ = m 2 x + m 2 y + m 2 z h 2 8 µ a 2 . (B.2)
The partition function for a single atom Z 0 is defined as

Z 0 (T) = V 2π µ k T h 2 3 /2
, with V = a 3 . (B.3)

Proof. Denote 0 = h 2 8 µ a 2 , and M a the set of accessible microstates. From Eq. (2.18a), we have

Z 0 (T) = ∑ m∈M a exp -E (m) k T = +∞ ∑ m x =1 +∞ ∑ m y =1 +∞ ∑ m z =1 exp -m 2 x + m 2 y + m 2 z 0 k T = +∞ ∑ n=1 exp -n 2 0 k T 3 ≈ +∞ 0 exp -x 2 0 k T dx 3 =   1 2 π k T 0   3 = 2π µ k T a 2 h 2 3 /2 = V 2π µ k T h 2 3 /2 .

Appendix C

Mean-Field Partition Function of the Ferromagnetic Core

Consider a ferromagnetic core constituted of N magnetic moments in {-1, 1}. Denote m ∈ M a = {-1, 1} N a microstate of the core, and p (m) its probability at equilibrium. Denote M(m) = ∑ N i=1 m i the total magnetic moment of microstate m, M + and M -two symmetric subsets of M a with respect to M (see Eq. 3.6), and m + (resp. m -) the mean moment in M + (resp. M -) defined as

m + = 1 N ∑ m∈M + 2 p (m)M(m) ∈ [0, 1], m -= 1 N ∑ m∈M - 2 p (m)M(m) ∈ [-1, 0]. (C.1)
We have

E (m) ≈        1 2 N J q m + 2 -J q m + M(m) if m ∈ M + , 1 2 N J q m -2 -J q m -M(m) if m ∈ M -. (C.2)
Proof. Denote m = m + 1 the mean state of M + where 1 is a vector of N ones, and consider m ∈ M + . Assume small deviations mm. Then, we have

E (m) = - 1 2 m J ex m = - 1 2 (m + m -m) J ex (m + m -m) = - 1 2     m J ex m + 2 m J ex (m -m) + (m -m) J ex (m -m) neglected     ≈ - 1 2 m J ex m + 2 m J ex (m -m) = 1 2 m J ex m -m J ex m.
Recall that each column of J ex contains J (q times) and zeros (Nq) times (Fig. 3.4c), so that m J ex = J q m + 1 .

Hence E (m) ≈ 1 2 N J q m + 2 -J q m + M(m).

Appendix C. Mean-Field Partition Function of the Ferromagnetic Core

By replacing m + with m -, we derive a similar result for m ∈ M -.

We deduce the mean-field partition function Z MF defined as

Z MF (m, T) = exp - N J q m 2 2 k b T 2 cosh J q m k b T N , ∀m ∈ [-1, 1], T > 0. (C.3)
Proof. Denote S the set of all permutations of {-1, 1} N .

Z MF (m, T) = ∑ m∈M a exp - E (m) k b T = ∑ m∈M + exp - N J q m + 2 2 k b T exp J q m + M(m) k b T + ∑ m∈M - exp - N J q m -2 2 k b T exp J q m -M(m) k b T = 1 2 exp - N J q m + 2 2 k b T ∑ σ∈S ∏ i∈σ exp J q m + i k b T + 1 2 exp - N J q m -2 2 k b T ∑ σ∈S ∏ i∈σ exp J q m -i k b T = 1 2 exp - N J q m + 2 2 k b T   exp J q m + k b T + exp - J q m + k b T   N + 1 2 exp - N J q m -2 2 k b T   exp J q m - k b T + exp - J q m - k b T   N = exp - N J q m 2 2 k b T 2 cosh J q m k b T N ,
using m + = -m -so that m + 2 = m -2 and cosh a m + = cosh a m -.

Appendix D

Interior Point Method

This Appendix presents the outline of the Interior Point Method for solving constrained optimization problems. For more details, we refer to e.g. [START_REF] Boyd | Convex optimization[END_REF]. The logarithmic barrier [START_REF] Boyd | Convex optimization[END_REF] increases the loss if coefficients s i get close to 0. The userdefined parameter t enforces or relaxes the constraint (Fig.

D.1).

A necessary condition to minimize L is finding a solution to

F (x, λ, µ) :=    ∇ f (x) + λ A -µ Ax -b µ x -1/t    = 0, (D.5)
where µ is the derivative of the logarithmic barrier with respect to x, and denotes the element-wise product. A solution is estimated with a damped Newton-Raphson iteration [32]. Starting from a particular x 0 , the set is improved iteratively applying:

x k+1 , λ k+1 , µ k+1 = x k , λ k , µ k -α J -1 x k , λ k , µ k F x k , λ k , µ k (D.6)
where α ∈ [0, 1] is a damping coefficient computed with a line search [START_REF] Boyd | Convex optimization[END_REF] and J is the Jacobian of F given by

J (x, λ, µ) =    ∇ 2 f (x) A -I A 0 0 diag (µ) 0 diag(x)    . (D.7)
Here diag(µ) (resp. diag(x)) denotes the square diagonal matrix with the elements of µ (resp. x) on its diagonal. The parameter t can be increased dynamically during iteration. The iteration is stopped when the error is sufficiently low, or, if f is non convex, when the error starts increasing. with ). On the contrary, with a high t, the estimated solution is the absolute minimum and does not respect the constraint, even if the initial value does (Figs. D.2b-D.2d).

Q = 4 -1 -1 4 , A =    2

INTRODUCTION

Ferromagnetism is frequent in analog audio: it is involved in transducers (dynamic microphones, loudspeakers), tape recorders, coils and transformers. As major non-linearities arise from ferromagnetic components (saturation, hysteresis), the need of refined models is critical to accurately simulate behaviors in circuits.

Since the 1980s, a large body of empirical models have been proposed, among them the Jiles-Atherton model [1], the Gyrator-Capacitor model [2,3], or the Preisach model [4]. But very few have a strong physical meaning [5] and those retaining some energetic interpretation [6] either lose major phenomenological properties or are heavy to implement [7]. As a consequence, preserving the model passivity (no artificial hidden sources of energy) comes with a price -computation time.

In this paper, we propose a new nonlinear model of ferromagnetic coil that is physically-based, passive, modular (allowing electric and thermal connections) and with a reduced complexity (few state variables and parameters). As it is built on statistical physics results on magnets, it is thermodynamically consistent. It also inherits macroscopic characteristics (hysteresis and its conditioned activation) from underlying microscopic phenomena (metastability and phase transition). This lumped-element model is used to simulate a passive high-pass filter. The circuit modeling relies on Port-Hamiltonian Systems [8,9] (PHS) that structurally fulfill the power balance. Simulations are based on numerical methods [10] that preserve this guarantee in the discrete-time domain.

The paper is structured as follows: Section 2 first presents some short recalls on PHS. Section 3 develops a primary model derived from statistical physics. This model exhibits saturation and hysteresis but does not take into account some other phenomena, such as non-homogeneities, thermal fluctuations and eddy currents. Section 4 refines the primary model with a polynomial interpolation based on measurements of a Fasel inductor. In section 5, the final nonlinear model is implemented to simulate a passive high-pass filter.

REVIEW OF PORT-HAMILTONIAN SYSTEMS

The following modeling relies on Port-Hamiltonian systems [11,9], under a differential-algebraic formulation [10]. A dynamical system is represented as a network of: (i) storage components of state x and energy E (x), (ii) dissipative components described by an efforts law w → z(w) that dissipates the power Pdiss = z (w) ⊺ w ≥ 0 for all flows w, and (iii) connection ports conveying the outgoing power Pext = u ⊺ y for inputs u and outputs y. The flows f and efforts e of all the components are coupled through a skew-symmetric interconnection matrix J = -J ⊺ :

  ẋ w y   f = J   ∇E(x) z(w) u   e . (1)
Such systems satisfy the power balance Pstored +Pdiss +Pext = 0 where Pstored = ∇E(x) ⊺ ẋ denotes the stored power. Indeed, Pstored + Pdiss + Pext = e ⊺ f = e ⊺ Je is zero since e ⊺ J e = (e ⊺ Je) ⊺ = -(e ⊺ Je) due to the skew-symmetry of J . All models herein will be formulated as (1).

PRIOR THEORETICAL MODEL

Macroscopic model of a ferromagnetic core

This section presents a bi-stable core model rooted in the mean field Ising model [12,13,14,15,16]. Using statistical physics, Ising derives a macroscopic scalar state (the core magnetization) from a microscopic representation of the core (a set of normalized atomic magnetic moments, which can be either up or down), at a given temperature T . For simplicity, additional assumptions are: a homogeneous, isochoric (constant volume V ) and closed (constant number of atoms N ) ferromagnetic crystal with one (local) magnetization axis and periodic boundaries (typically, a toroidal geometry often found in audio circuits [17]). In this section, there is no external magnetic field (issue addressed in section 3.2).

DAFx.1 Following [18] with our assumptions, the core internal energy is

E = N α 1 2 m 2 -m tanh m θ , (2)
where parameter α (≈ 5 × 10 -21 J for transition metals) denotes the exchange energy between one moment and its nearest neighbours [19,20,21], and where variables m and θ are average intensive quantities (homogeneous over the body) that statistically characterize the core configuration at a macroscopic scale:

• m ∈ [-1, 1]
is the mean normalized magnetic moment: m = ±1 if all moments are aligned in the same direction, and m = 0 if no particular direction is favored;

• θ = T /Tc ∈ R+ is the reduced temperature relative to the core Curie temperature Tc [22]: if θ < 1, there are multiple equilibria m (ferromagnetism), and only m = 0 (disordered moments) otherwise (paramagnetism).

Note that the core parameters α and Tc are related through the Boltzmann constant kb = 1.38 × 10 -23 J.K -1 as α = kb Tc.

A measure of the number of possible microscopic states (atomic moments) consistent with the core macroscopic configuration is given by the entropy [23], which is found to be

S = N kb f m θ with f (χ) = ln(2 cosh χ)-χ tanh χ, χ ∈ R.
(3) This statistical entropy coincides with the thermodynamic entropy for a core in internal thermodynamic equilibrium (possibly timevarying at macroscopic scale). This variable is extensive (proportional to N ) and quantifies the macroscopic "order degree" of the core, on which phase transitions and hysteresis depend.

In addition to E and S, a third extensive variable is introduced, namely, the total magnetic flux of the core (of volume V )

BV = B V, ( 4
)
where B is the magnetic flux density. For the core, B is related to the core magnetization M = m Ms through B = µ0 M where µ0 is the vacuum magnetic permeability and Ms is the saturation magnetization (see Table 1).

Choice of state and energy function

We choose to express the core energy E as a function of the state

xcore = [BV , S] ⊺ , (5)
so that, in (1), the flow ẋcore accounts for the time variation of extensive quantities (to balance with quantities external to the core, or equilibrium-establishing) and, concomitantly, the effort accounts for intensive quantities (shared with the exterior at the core interface, or equilibrium-determining). Choosing extensive energy variables over intensive co-energy variables stems from two arguments. The first one is physical: except for linear, mono-variate components, constitutive laws derived from the co-energy are not equal to those derived from the energy, and should be handled with care. The second is numerical: solving an ODE by integration instead of differentiation is generally preferable [11]. This function is derived from (2), in which m/θ and m are expressed with respect to S and BV using (3-4) and noting that f is smooth, even on R and strictly monotonic 1 (so invertible) on R + . Its formula expressed w.r.t. ( 5) is given by (see Fig. 1),

Ecore [BV , S] ⊺ E0 = 1 2 BV BV s 2 - BV BV s tanh f -1 S S0 , (
where, omitting variables in functions, the core internal magnetic field is

∂ Ecore ∂B V = E0 BV s   BV BV s -sign (BV ) tanh f -1 S S0
  := Hcore (8) and the core temperature is

∂ Ecore ∂S = E0 S0 BV BV s / f -1 S S0 := Tcore. ( 9
)
Fig. 1 shows that as S increases, the core goes from two ordered (aligned moments) meta-stable equilibrium states to one non-ordered (no alignment) stable equilibrium state: it exhibits a phase transition (from ferromagnetic to paramagnetic). Table 1 recaps the physical quantities involved and their units.

Connection to coil and external electrical ports

Ideal coil model

The coil is considered to be linear. Choosing BV as its state variable, the coil energy is

Ecoil(BV ) = B 2 V 2µ0V , ( 10
)
and its derivative with respect to BV is the coil magnetic field Hcoil(BV ) = BV /(µ0V ).

1 Indeed, f ′ (χ) = -χ/ cosh 2 χ ≤ 0 ∀χ ∈ R + .
DAFx.

Coupled system

To express the coupled system L as a PHS, one needs to determine the relations between the core and coil flows and efforts. Using the extensivity of the total magnetic moment ML [24], one gets

ML = Mcore + Mcoil ⇔ BV L = BV core + BV coil , (11)
since BV = µ0M. Differentiating Eq. ( 11) with respect to time, one obtains the relation between the flows:

Ḃ V L = ḂVcore + ḂV coil . (12)
Conversely, the coil and core share their efforts, namely,

HL = Hcoil = Hcore. ( 13
)
Fig. 2 represents the coupling as a series connection.

For any fixed entropy S and for all x = [BV coil BV core ] ⊺ , we introduce the function ES : x → Ecore(BV core , S) + Ecoil(BV coil ) (total energy of the system). With these notations, the core and coil coupling can be expressed as the constrained Dirac structure [25]

  ẋ 0 y   =   . A B -A . . -B .
.

    ∂ E S ∂x λ u   , ( 14
)
with A = [1, -1] ⊺ , B = [0, 1] ⊺ , λ = ḂV coil , u = ḂV L and y = -HL (dots indicate zeros). This constrained Dirac structure can be reduced to (see also [25] for more details): . This equivalent component energy can be computed (see [26] for a detailed derivation) through the expression

ż y = . Br -Br . ∂ E L ∂z u , (15
EL(BV L , S) = Ecoil • H -1 coil + Ecore • H -1 core • H -1 coil + H -1 core -1 (BV L , S), (16)
where the symbol • stands for function composition. In practice, all mathematical functions in this expression can be defined as piecewise affine functions (computation of inverse efforts in particular becomes straightforward when analytical expressions are not available, as is the case here).

Connection to external electrical ports

Denoting n the number of turns, l the length of the coil, A its section, Φ the magnetic flux linkage, the magnetic field HL is related to coil current iL through

HL = n l iL, (17)
and the state BV L is related to the coil voltage vL through

ḂV L = Φ nA V = l n vL. (18)
In section 4.4, variables iL and vL will be related to external ports u and y of Eq. (1).

Thermodynamics

In this section (only), we assume that the ferromagnetic coil is put in a isothermal bath (i.e. the exterior is much larger than the coil size), so that the temperature of the system TL is considered constant and equal to the exterior temperature Text during a change of state, supposedly below the Curie temperature. A convenient and classical way to study the energetic behavior of the ferromagnetic coil is to examine how, for all BV L , the energy EL(BV L , S) of the component subject to a constant magnetic field H0, deviates from the energy H0 BV L . The energy deviation of this conditioned component, called the Gibbs free energy [27], is defined by, for all BV L , S, and all constant-in-time H0 as

GH 0 (BV L , S) = EL(BV L , S) -TLS -H0 BV L . ( 19
)
For any given S, at H0 = 0, two symmetric meta-stable equilibrium states corresponding to GH 0 minima with respect to BV L are available (Fig. 3a, red curve). For H0 ̸ = 0, the symmetry is broken and a previously stable equilibrium state can be made unstable. We suppose now H0 slowly controlled (so it is still considered constant during a change of state). When decreasing H0

DAFx.3 from Hmax ≥ 0 (Fig. 3a, green curve) to -Hmax, BV L starts from its initial equilibrium state and follows a trajectory solution of

∂ G H 0 ∂B V L
= 0 (Fig. 3a, black curve), until the minimum degenerates into an inflection point at H0 = Hcoerc (Fig. 3a, solid blue curve). Then, a Barkhausen jump occurs [27] so that BV L occupies the remaining stable equilibrium state (Fig. 3a, intersection of solid blue curve and left yellow area). Since EL is even with respect to BV L for all S, GH 0 (BV L , S) = G-H 0 (-BV L , S). Therefore, when increasing H0 from -Hmax to Hmax, the Barkhausen jump occurs at -Hcoerc. Consequently, BV L follows a different path depending on whether H0 decreases or increases (Fig. 3a, black curve and arrows), hence the hysteresis (Fig. 3b) between Hcoerc and -Hcoerc.

Thermodynamics laws show that the difference of energy before and after the jump is irreversibly dissipated as heat. Indeed, the first principle of thermodynamics states that the internal energy variation dEL is the work performed on the ferromagnetic coil δW = H0dBV L , plus the received heat δQ = TLδeS where δeS is the variation of incoming entropy and δ denotes an inexact differential [28]: dEL = H0 dBV L + TLδeS. The second principle of thermodynamics states that the internal heat TLdS is the received heat plus the heat internally produced by irreversible phenomena TLδiS:

TLdS = TLδeS + TLδiS. ( 21
)
Replacing TLδeS from Eq. ( 21) in Eq. ( 20) yields

dGH 0 = dEL -TLdS -H0dBV L = -TLδiS, ( 22
)
which is consistent with the assertion that the difference of energy is entirely and irreversibly dissipated as heat. Now, let us denote HL the observed effort law such as H0 = HL(BV L ) (definition given in appendix A). Replacing H0 with HL, the entropy production rate δiS/dt is obtained differentiating Eq. ( 22) with respect to BV L and multiplying with ḂV L :

δiS dt = 1 TL HL(BV L ) - ∂ EL ∂B V L (BV L , S) ḂV L . ( 23
)
To model the conversion between excess electro-magnetic power and thermal power, the ideal thermal exchanger rth is introduced (Fig. 4) so that

ithvth = TL δiS dt ( 24
)
where vth is the exchanger voltage and ith its current. Introducing the function

Pth : xL → HL(BV L ) -∂ E L ∂B V L (BV L , S) ḂV L , (25)
equations (23)(24) allow to model the dissipation in the PHS formalism:

w = [vth, TL] ⊺ z P th (x L ) (w) = [ Pth(xL) vth , - Pth(xL) TL ] ⊺ = [ith, - δiS dt ] ⊺ . ( 26
)
The passivity condition Pdiss ≥ 0 is fulfilled as z(w) ⊺ w = 0.

The complete PHS structure is given in section 4.4.

REFINED MODEL BASED ON MEASUREMENTS

Measurements and observations

As thermodynamically meaningful as the bi-stable model is, it does not capture the variety of phenomena contributing to hysteresis, as measurements on real ferromagnetic coils reveal. To conduct such measurements, a Fasel Red inductor (which can be found in Cry Baby wah-wah pedals [29] for instance) in series with DAFx.4 The magnetic field HL and state BV L are then obtained using Eq. ( 17)-( 18) and the relation Φ(t) = t 0 vL(τ ) dτ . As the coil and the core share the same volume V , Eq. ( 11)-( 13) yield the relation BV L = µ0V (HL + M ) from which M is obtained. These measurements (Fig. 5b) lead to two observations.

• First, M has an order of magnitude of 6, whereas HL has an order of magnitude of 1, as expected for soft materials [17].

• Second, instead of the large jumps predicted by the bi-stable model, one observes a continuous progression, which calls for a model refinement to determine the entropy production rate law responsible for hysteresis.

Model reduction

According to measurements, for this inductor BV core = µ0M V ≫ BV coil = µ0HLV and Ecore ≫ Ecoil. The influence of the coil on the overall energy of the coupled component is negligible (Fig. 6) and we thus may use

EL(BV L , S) ≈ Ecore(BV L , S). ( 27
)
The dynamics of the coupled system is therefore that of a driven core alone.

Entropy production rate law

In real ferromagnetic cores, domain structure and non-homogeneities [30] yield an energy function with not two but multiple local minima. Consequently, multiple Barkhausen jumps give the effort law the shape of a staircase. The Preisach model generates this effort law by computing a statistical mean on a collection of bi-stable systems such as the one presented in section 3, each one representing a domain. This averaging "damps" the large bi-stable jumps.

Here, to obtain a similar result while remaining at a macroscopic level, the hysteresis loop is modeled using a cubic polynomial

P (χ) = p0 + p1χ + p2χ 2 + p3χ 3 interpolating the effort ∂ E L ∂B V L
, and an additional friction term of the form rf ḂV L , rf ≥ 0, to account for thermal fluctuations [31] and eddy currents [32]. The coefficients of P are computed through

[p0 p1 p2 p3] ⊺ = X -1 Y
where, given two interpolation data points χ1 and χ2, X and Y are defined as

X =      1 • • • χ 3 1 1 • • • χ 3 2 0 • • • 3χ 2 1 0 • • • 3χ 2 2      , Y = ∂ E L ∂B V L (χ1) ... ∂ 2 E L ∂B 2 V L (χ1) ... ⊺ .
The final hysteresis loop P (BV L ) is thus defined by

P (BV L ) = δBP (δBBV L ) + rf ḂV L , (28)
where δB = sign(dBV L ), and the entropy production rate δiS/dt is:

δiS dt = 1 TL P (BV L ) - ∂ EL ∂B V L (BV L , S) ḂV L , ( 29
)
which is the expression given in Eq. ( 23) where HL has been replaced with P . For a given ferromagnetic coil, such a loop is accurate in a range from saturation approach to saturation and higher, provided that the data points are taken in that range. At lower fields though, a Rayleigh law would be more adequate [27].

Final model

Finally, Kirchhoff laws on the equivalent circuit shown on Fig. 4, together with Eq. ( 21), yield the PHS in Fig. 7 structured as in Eq.

(1), in which EL is given by Eq. ( 27)-( 6), w and z(w) are given by Eq. ( 26)-( 29), u = [U, δeS/dt] ⊺ , y = [i, -Text].

Model identification with the Fasel inductor

The measurements are taken during an isothermal transformation, so that, replacing S from Eq. ( 3) in the magnetic field, one can use the expression

∂ EL ∂B V L = E0 BV Ls   BV L BV Ls -tanh BV L BV Ls θ  
for identification. A least squares optimization between the Eq. ( 28) spline model and the measurements, i.e. solving p = argmin p HL -Pp BV L 2 2 with p = [E0, BV Ls , θ, rf ] yields the parameters in Table 2. Figure 8 shows a good match between measurements and the estimated model.

∇E(x) z(w) u TL ∂ E L ∂B V L ith -δ i S dt U δeS dt               ẋ Ṡ . . . -1 . 1 ḂV L . . . . l n . w vth . . . . 1 . TL 1 . . . . . y i . -l n -1 . . . -Text -1 . . . . .

APPLICATION TO A PASSIVE HIGH-PASS FILTER

Circuit modeling

The ferromagnetic coil model is used to simulate a high-pass filter (Fig. 9). The resistance R is linear of constitutive law vR(iR) = RiR. Kirchhoff laws yield the PHS shown in Fig. 10.

Simulation

Discretization

The state vector x(t) is discretized to x[k] = x(hk) where h = 1/Fs is the sampling step, and we denote δx

[k] = x[k+1]-x[k].
To preserve the passivity of the PHS in discrete time and reduce the energy gradient sensitivity to the state indexing, we rely on the symmetric discrete energy gradient [10]. Denoting nx the number of states, P(nx) the set of all possible permutations on the Table 2: Physical parameters of the model where zi = zi/BV Ls and pi = piB i V Ls . The units are S.I. units given in Table 1.

∇E(x) z(w) u TL ∂ E L ∂B V L ith -δ i S dt vR U δeS dt                   ẋ Ṡ . . . - 1
∇E(x, δx)i =        1 nx! δxi π∈P(nx) △i(xπ, δxπ) δxi ̸ = 0 ∂ E ∂x i otherwise ( 30
) where △i(x, δx) = E(x + δxi) -E(x + δxi-1) and δxi = [δx1, ..., δxi, 0, ..., 0] ⊺ . The discrete energy variation is obtained with the chain rule:

δE[k] h = ∇E(x[k], δx[k]) ⊺ δx[k] h . ( 31
)
The PHS of Fig. 10

Newton-Raphson iteration

The interconnection matrix is decomposed as

J = [JstoredJdissJext] ⊺ . We denote ē(x[k], δx[k]) = [ ∇E(x[k], δx[k]) z(w[k]) u[k]] ⊺ , ν = δx[k]
and

F : ν → Jstored ē(x[k], ν) -ν/h (32) At each sample k, δx[k] is solution of F (ν) = 0. If F ′ (νi)
is invertible and given an initial value ν0 and a relative error ϵr, this solution can be computed iteratively with the update

νi+1 = νi + ∆ν i ( 33
)
where

∆ν i = -F ′ (νi) -1 F (νi), until ∥∆ν i ∥/∥∆ν 0 ∥ ≤ ϵr.

Simulation parameters

The circuit is driven with a sinusoidal voltage whose parameters are given in Table 3, as well as with an instrumental bass sample. The ferromagnetic coil model parameters are those indicated in Table 2. The incoming entropy flow δeS/dt is set so that the ferromagnetic coil temperature stays constant.

Results and comparison to measurements

The circuit is simulated with the non-linear coil model and a simple linear coil model (iL = ΦL/L with L = 840 mH) for comparison. Simulation results on Fig. 11a-11b show a good correspondence between the non-linear model and measurements. Fig. 11c-11d show that the produced entropy is always positive and that the coil temperature stays constant. Spectrograms of the bass sample is shown on Fig. 11e-11f. Sound results on the bass sample can be heard at https://github.com/JNaj/dafx20-ferromag.

CONCLUSION

In this paper, a physical and passive model of ferromagnetic coil has been developed. It is explicit and maintains a reduced number of variables and parameters.

First the core and the coil were treated separately, then their coupling, which determines both their electrical and thermal dynamics, was addressed. This lead to the building of an equivalent component, characterized by a well-established state, energy function, and entropy production rate law. A refined entropy production law based on measurements was then proposed.

As an application, this model was used to simulate a passive high-pass circuit. The simulations are in close agreement with measurements, though extensive measurements (a set of different frequencies, amplitudes, waveforms) would be required to validate the model on a broader scale.

Besides these complementary measurements, further work aims to assess real-time performances, and build a transformer model on the same principle by coupling two ferromagnetic coils. Coils and transformers built around ferromagnetic cores are largely present in audio circuits, from emblematic effect pedals to amplifiers and loudspeakers. Ferromagnetic materials are sought for their high inductance, which increases the coil quality factor. On the other hand these materials exhibit non-linear characteristics such as saturation and hysteresis, which may cause audible distortion and power loss. Understanding ferromagnetic materials is therefore necessary in order to accurately predict a coil's behavior so that one may carefully avoid-or exploit-distortion when designing or simulating circuits.

Ferromagnetism is a long-enduring research field and several empirical macroscopic models already exist in the literature. One of the most widely used in the audio community is the Jiles-Atherton model [1][2][3], which is built around a differential equation involving a saturation curve and friction term. However some concern has been expressed regarding its physical interpretation [4] and subsequent accuracy issues in simulations. Another popular model is the Gyrator-Capacitor [5][6][7], whose strength resides in its simplicity. Indeed, it essentially consists in a Gyrator-Capacitor representation where the capacitor has a polynomial law. Other recent models based on fractional derivatives [8] have proved particularly accurate but like the Jiles-Atherton or GC models previously mentioned, their parameters are not related to actual physical quanti-ties. Moreover neither of these models takes explicitly into account the significant role of temperature in the shape of the hysteresis curve. Yet temperature may vary in circuits, especially after an extended use; therefore its influence should not be entirely neglected. On the other hand models explicitly built on energetic considerations, such as variational models [9], rely on costly finite-element methods, making real-time use difficult. Similarly the Preisach model [10,11] thoroughly captures the phenomenology involved in ferromagnetism, including thermodynamics; but it is obviously too complex for audio applications. Therefore to our present knowledge a model both physically based (allowing refined and realistic simulations in a wide range of contexts) and suitable for audio applications does not seem to exist.

In this paper we propose a non-linear model of ferromagnetic coil that is physically based, passive (no hidden sources of energy), modular (allowing electric and thermal connections), and with a reduced complexity (only three state variables and five parameters). First we derive a core macroscopic model from classic statistical physics results, with a special care brought to the choice of state variables for thermodynamic consistency and modularity. Then we build a ferromagnetic coil model connecting a core and coil. It ensues that typical characteristics (hysteresis or its absence thereof) naturally arise from the interaction between the coil and core, in association with features intrinsically present in our core model (meta-stability or stability).

Moreover as the model dynamics are expressed through a Port-Hamiltonian Systems (PHS) formulation [12,13] the power balance is structurally fulfilled. This formulation also makes the connection to other components straightforward, so that including the model in more complex systems poses no difficulty.

This ferromagnetic coil model is then used to simulate two circuits: a passive band-pass filter and transformer. The circuits are also modeled as PHS and the simulations are based on numerical methods [14] that preserve the power balance in the discrete-time domain.

The paper is structured as follows: in SEC. 1 the Port-Hamiltonian formalism is briefly presented. In SEC. 2 the core macroscopic model is constructed from statistical physics and thermodynamics. Sec. 3 addresses the connection between the core and coil and describes the resulting complete model. In SEC. 4 the model is assessed against measurements on a Fasel inductor. Finally, simulations of chosen audio circuits are presented in SEC. 5 before providing elements of discussion and work perspectives in SEC. 6.

PORT-HAMILTONIAN SYSTEMS: DIFFERENTIAL-ALGEBRAIC FORMULATION

All subsequent modeling relies on Port-Hamiltonian systems [15,13] under a differential-algebraic formulation [14]. This formulation allows the representation of a dynamical system as a network of:

1. storage components of state x and energy E(x); 2. dissipative components described by an effort law w → z(w), such as the dissipated power P diss = z(w) w is non-negative for all flows w; 3. connection ports conveying the outgoing power P ext = u y where u are inputs and y are outputs.

The flows f and efforts e of all the components are coupled through a skew-symmetric interconnection matrix J = -J :

⎡ ⎣ ẋ w y ⎤ ⎦ f = J ⎡ ⎣ ∇ E(x) z(w) u ⎤ ⎦ e . (1)
Here flows can either be currents (e.g., for capacitors) or voltages (e.g., for inductors) and vice versa for efforts. Such systems satisfy the power balance P stored + P diss + P ext = 0, where P stored = ∇ E(x) ẋ denotes the stored power. Indeed, P stored + P diss + P ext = e f = e J e is zero since e J e = (e J e) = -(e J e) due to the skew-symmetry of J. All models herein will be formulated as (1).

FERROMAGNETIC CORE MODELING

In this section a macroscopic model of the ferromagnetic core is derived from a microscopic representation, known in the literature as the Ising model [16][17][18]. The change of scale is performed within the statistical physics framework. As the use of statistical physics leads to the emergence of thermodynamic variables, the latter are taken into account explicitly in the modeling. Consequently the chosen macroscopic state and its corresponding internal energy allow the connection of the core to both electro-magnetic ports and thermal ports. These ports, through the PHS formalism, control the influence of an external magnetic field on one hand (ultimately responsible for the presence of hysteresis, as will be shown), and the influence of phase transitions, on the other hand (responsible for the amount of hysteresis), on the core state and its subsequent dynamics.

Understanding the Ising model at a quantum level is not the object of this paper. Here we only give necessary elements in order to derive a macroscopic model. Similarly we do not propose new results on statistical physics but use it in a standard way as a means to an end. Therefore we present the main concepts without detailing all intermediate steps. Readers who wish to deepen their knowledge on the subject may refer to [19][20][21].

Ising Model

In the Ising model a ferromagnetic core is represented as a set of N adimensional magnetic moments interacting with one another. A possible state m of the core (called microstate in the following) is therefore a particular configuration of these moments: m ∈ M = {-1, 1} N . Fig. 1 shows a possible micro-state m = 1, -1, 1, 1, 1, -1, -1, 1, -1 for N = 9.

The interactions between the micro-state moments are expressed through the Heisenberg Hamiltonian H(m):

H(m) = - 1 2 m J ex m, (2)
where each coefficient J exi, j is the exchange energy [22] between moment i and moment j. Assuming isotropic interactions affecting nearest neighbors only, this exchange energy simplifies to:

J exi, j = J i, j nearest neighbours, i = j, 0 else, ( 3
)
where J is a constant energy characterizing the material.

For ferromagnetic materials J is positive; consequently the Heisenberg Hamiltonian minimizes itself for configurations in which moments align with one another.

Statistical Physics

The micro-state of the core may fluctuate randomly over time without affecting its overall macroscopic properties: indeed, several micro-states yield the same Hamiltonian.

Therefore the specific micro-state of the core at any given time cannot be known from macroscopic observations. Thus we rely on a probabilistic description of the core (referred to as the system in the following) to predict its macroscopic behavior.

To this end, we consider the canonical ensemble, which is the thermodynamic ensemble (i.e., a time-invariant probability space) of interest for a system under the following set of assumptions hyp:

1. The system is closed (constant number of atoms N). 2. The system is isochoric (constant volume V). 3. The system may exchange energy with the exterior (its energy fluctuates over time). 4. The exterior is much larger than the system and behaves like a thermostat (T core = T ext = T).

The first two assumptions are taken into account in the expression of the Hamiltonian in Eq. ( 2). The fourth assumption constrains the energy exchanges between the system and exterior.

With this set hyp we look for the micro-states probability distribution for the canonical ensemble at thermodynamic equilibrium, denoted p hyp . This distribution derives from a fundamental principle of statistical physics: the statistical entropy maximization at thermodynamic equilibrium.

Derivation. Given a probability distribution p of microstates, the statistical entropy measures the amount of information required to know the exact micro-state of the system. It is defined as:

S : p -→ -k b m∈M p(m) ln p(m), (4)
where k b = 1.38 × 10 -23 JK -1 is the Boltzmann constant. Indeed, for a distribution mapping some micro-state m 0 to 1 and the others to 0, the system is entirely known to be in the state m 0 . According to Eq. ( 4) this distribution would yield a zero entropy (the definition of S can be extended to 0 since lim x →0

x ln x = 0). Conversely an equiprobable distribution between all micro-states maximizes the lack of information on the system. From Eq. ( 4), this distribution also maximizes the entropy. When a system reaches thermodynamic equilibrium it stops evolving. At this point the only information available is the information corresponding to our assumptions on the system. Since this information is minimal (any less information would characterize a different system), the system entropy should be maximal. Moreover, at equilibrium the third assumption in hyp actually translates into the ergodic hypothesis. This hypothesis stipulates that at equilibrium the internal energy defined as the mean energy over time Ē also coincides with the expectation of the Hamiltonians of all possible micro-states:

Ē = E[H] := m∈M p hyp (m)H(m). (5)
Therefore for the canonical ensemble the entropy maximization at equilibrium can be written as:

p hyp = arg max p S( p) subject to Ē = E[H]. (6)
Solving Eq. ( 6) (usually with Lagrange multipliers) yields the well-known Boltzmann distribution for the canonical ensemble:

p hyp (m) = exp -H(m) kb T Z(T ) , Z(T ) = m∈M exp - H(m) k b T . ( 7
)
The dependency to the temperature T is directly related to the constraint on Ē. Indeed, it can be shown that the associated Lagrange multiplier λ, which appears in p hyp during the derivation, is λ = -∂S/∂ Ē = -1/T core = -1/T (see, e.g., [23] for a detailed derivation). The denominator Z(T ) defines the partition function of the system and acts as a normalization factor. From Eq. ( 7) it is clear that at low temperatures, micro-states with a lower Hamiltonian (i.e., whose moments are aligned with each other) are favored, whereas at high temperatures, all micro-states tend to be equiprobable. It follows that the higher the temperature, the higher the entropy, but the Boltzmann distribution is nonetheless the distribution maximizing the entropy at a given temperature.

Finally, reinjecting Eq. ( 7) in Eqs. ( 4) and ( 5) yields the thermodynamic entropy and the internal energy as functions of the temperature:

S = S( p hyp ) = S(T ) := ∂ ∂ T (k b T ln Z)(T ), (8)
Ē = E(T ) := k b T 2 ∂ln Z ∂ T (T ) ( 9 )
(see, e.g., [24] for detailed proof).

Core Macroscopic State and Energy

The classic mean-field Ising model computes an approximation of the free energy, which corresponds to the amount of energy convertible into work, at constant temperature. This mean-field free energy depends on a macroscopic, scalar order parameter m ∈ [ -1, 1]. This order parameter can be understood as a "mean magnetic moment." It is ± 1 when moments tend to align for all micro-states and 0 if there is no alignment tendency at all. The free energy, in its classic formulation, also depends on the external magnetic field (see, e.g., [25] for a complete derivation).

Here we also rely on a mean-field approximation but choose to express the internal energy as a function of the (extensive) entropy S and another extensive variable, the total magnetic flux B V . This way, in (1), the flow ẋcore accounts for the time variation of extensive quantities (to balance with quantities external to the core, or equilibriumestablishing) and, concomitantly, the effort accounts for intensive quantities (shared with the exterior at the core interface, or equilibrium-determining). Thus the externality PAPERS POWER-BALANCED MODELING OF NONLINEAR COILS AND TRANSFORMERS of the thermostat and magnetic field is made explicit. The core macroscopic state can only change if the core is in contact with the exterior (or another component) through connection ports.

Assuming the core has periodic boundaries (a toric geometry for instance), and reinjecting the mean-field partition function of a core isolated from any magnetic field (see [18] for a complete expression) in Eq. ( 9), the mean-field internal energy is found to be:

Ē ≈ E M F (m, T ) = E 0 m 2 2 -m tanh mT c T . ( 10
)
In Eq. ( 10) the energy E 0 = NJq, with q the (constant) number of nearest neighbors of each moment, relates to the minimal possible energy of the core:

E M F (±1, 0) = -E 0 /2.
A similar operation in Eq. ( 8) gives the mean-field thermodynamic entropy:

S ≈S M F (m, T ) = S 0 f mT c T , f (χ) = ln(2 cosh(χ -χ tanh(χ), χ ∈ R. (11)
In Eq. ( 11) the entropy S 0 = Nk b relates to the maximal possible entropy of the core: S M F (0, +∞) = S 0 ln (2).

The ratio E 0 /S 0 := T c gives the critical temperature, above which the core behavior becomes paramagnetic.

Simultaneously we introduce the (extensive) core total magnetic flux B Vcore , defined as:

B Vcore = m μ 0 M s V, (12)
where the constant μ 0 = 4π × 10 -7 H.m -1 is the vacuum magnetic permeability, the quantity M s is the core saturation magnetization, and V is the core volume. The term μ 0 M s V, corresponding to the core saturation total magnetic flux, is denoted B Vs in the following for simplicity. Finally, the core macroscopic state is chosen to be expressed as:

x core = B Vcore , S . (13)
Noting that f is smooth even on R and strictly monotonic 1 (so invertible) on R + , we obtain the expression of the core internal energy:

E core (x core ) = E 0 1 2 B Vcore B Vs 2 - B Vcore B Vs g(S) , (14)
where

g(S) = tanh f -1 S S0 , S ∈ R + .
The effort is:

∇ E core (x core ) = ∂ E core ∂ B Vcore (x core ), ∂ E core ∂ S (x core ) := [H core , T core ] , (15)
where H core and T core denote the core internal magnetic field and core temperature, respectively. The quantity T core defined in Eq. ( 15) coincides exactly with the temperature T used in Eq. ( 7), thus ensuring the thermodynamic consistency of the model (proof in APPENDIX A.1). Fig. 2 shows how as the entropy S increases, the core goes from two ordered (aligned moments) meta-stable equilibrium states to one non-ordered (no alignment) stable equilibrium state: it exhibits a phase transition (from ferromagnetic to paramagnetic). Note that all non-linearities of the core are intrinsically encoded into its energy. Therefore any PHS comprising a core will exhibit a non-linear behavior, regardless of its interconnection matrix.

1 Indeed, f (χ) = -χ/ cosh 2 χ ≤ 0 ∀χ ∈ R + .

Flow-Controlled Conservative PHS

We suppose that the core is flow-controlled. The outgoing total magnetic flux and incoming entropy variation from the exterior are denoted B Vin and δ e S, respectively.2 Fig. 3(a) shows the equivalent circuit. Kirchhoff's laws in receptor convention, as well as Eq. ( 14), yield the PHS formulation in Fig. 5(b).

Effort-Controlled Dissipative PHS

We suppose now that the core is effort-controlled. In this case the exterior magnetic field H in constrains the core magnetic field:

H core = H in . ( 16
)
Fig. 4 . Barkhausen jumps and resulting hysteresis during a cycle, with and without damping. The dotted curve is the theoretical core internal magnetic field; the solid curve is the real trajectory followed by the core total magnetic flux constrained by an external magnetic field.

Below the critical temperature, this constraint causes jumps between meta-stable states [called Barkhausen jumps [26], Fig. 4(a)]. The subsequent relaxation is responsible for hysteresis, similarly to a relaxation oscillator [27]. In real ferromagnetic cores however domain structure and nonhomogeneities [28] generate an energy function with not two but multiple local minima. Therefore on a macroscopic scale the trajectory followed by the magnetic flux during jumps is damped [Fig. 4(b)]. The damping is modeled with a linear magnetic resistor r core connected in series with the core.

Above the critical temperature there is no meta-stability, and the remaining hysteresis is mainly due to eddy currents.

As the difference of energy before and after a jump is entirely dissipated as heat [26], the Barkhausen jumps are also responsible for the variation of entropy creation δ i S in the core. The associated thermal power T core δ i S/dt is equal to the magnetic power dissipated through r core , so that

r core H 2 rcore -T core δ i S dt = 0. ( 17
)
We deduce the dissipative flow and effort:

w = -T core , H rcore z(w) = r core H 2 rcore T core , r core H rcore = δ i S dt , ḂVr core . ( 18
)
Finally, the second law of thermodynamics [21] states:

Ṡ = δ i S dt + δ e S dt . ( 19
)
Fig. 5(a) shows the equivalent circuit. Kirchhoff's laws in receptor convention, as well as Eqs. ( 14), (18), and (19), yield the PHS formulation in Fig. 5(b).

PAPERS POWER-BALANCED MODELING OF NONLINEAR COILS AND TRANSFORMERS

CONNECTION TO COIL

Coil Model

The coil is a (considered linear here) component that can be described in either the electrical or magnetic domain. In the electrical domain, its state is the magnetic flux linkage coil and its energy is:

E elec coil ( coil ) = 2 coil 2L , (20)
with L the coil inductance. Its energy derivative w.r.t. coil is the coil current i coil = coil /L. In the magnetic domain, its state is B Vcoil and its energy is:

E mag coil (B Vcoil ) = B 2 Vcoil 2μ 0 V coil , ( 21
)
with V coil the coil volume. Its energy derivative w.r.t. B Vcoil is the coil magnetic field

H coil = B Vcoil /(μ 0 V coil ). Obviously E elec coil ( coil ) = E mag coil (B Vcoil )
. Moreover, denoting n the number of turns and the length of the coil, the coil flows and efforts in both domains are related through:

H coil ˙ coil = 0 n n 0 ḂVcoil i coil . ( 22
)
The coil can therefore be seen as an interface between the electric and magnetic domains. This leads to the equivalent quadripole representations shown in Fig. 6. In the following the coil will therefore be represented as such a quadripole to account for its double nature.

Coupling Between the Core and Coil

A ferromagnetic coil is formed when a core and a coil are connected (in series in the electrical domain, in parallel in the magnetic domain). As such the magnetic flux of the coupled system is the sum of the magnetic fluxes:

B Vcoupled = B Vcoil + B Vcore , (23)
and they share their magnetic field:

H coupled = H core = H coil . ( 24
)
Therefore the coil acts as an effort-controller for the core and the core dynamics are those described in SEC. 2.5.

Complete Ferromagnetic Coil Model

The losses due to Joule heating in the coil are modeled with a linear resistor r coil in series (in the electrical domain) with the coil, so that for the ferromagnetic coil, the dissipative flows and efforts are:

w = -T core , H rcore , i rcoil z(w) = r core H 2 rcore T core , r core H rcore , r coil i rcoil = δ i S dt , ḂVr core , v rcoil . ( 25
)
The ferromagnetic coil equivalent circuit is shown in Fig. 7(a). Kirchhoff's laws on the equivalent circuit, as well as Eqs. ( 14), ( 19), ( 21), (22), and (25), allow the PHS formulation in Fig. 7(b).

Isothermal Transformations

In the case of interactions with a ferromagnetic coil at constant temperature, one may use an alternate formulation. The entropy is removed from the state, which becomes:

x = B Vcore , B Vcoil . ( 26
)
The core internal energy becomes the free energy:

E free core (B Vcore ) = E 0 1 2 B Vcore B Vs 2 -θ ln cosh B Vcore B Vs θ , (27)
where θ = T/T c is now a parameter of the model. The dissipative flow becomes:

w = H rcore , i rcoil , (28)
and the only input is v in . The PHS of the ferromagnetic coil is otherwise unchanged. Nonetheless the applications presented in the next section will rely on the formulation given in SEC. 3.3, as it is more general.

COMPARISON TO MEASUREMENTS

To assess the accuracy of the model measurements are performed on a Fasel Red inductor. The inductor is connected in series with a resistor R = 100 and driven Fig. 7. Equivalent circuit and PHS for the voltage-controlled ferromagnetic coil. Table 1. Simulation parameters for the band-pass and transformer. r 1 &r 2 &r coil ( ) r core ( ) 22), yield the values of r coil , r core , E 0 , S 0 , and B Vs in Table 1. Figs. 8(b) and 8(c) show that the simulations obtained with these parameters match the measurements quite well for several input amplitudes (see also [29]).

L 1 &L 2 (H) R ( ) VR 1 ( ) E 0 (J) S 0 (JK -1 ) B Vs (JA -1 m) f s (Hz)

ILLUSTRATIVE EXAMPLES

In this section we illustrate a possible use of our ferromagnetic coil model with two examples: a band-pass filter and a transformer. In order to specifically highlight the effect of magnetic non-linearities, both examples are kept minimal. For the band-pass filter we consider the passive sub-circuit only and ignore transistors and feedback. For the transformer the input stage (typically an amplifier) is not considered.

Band-Pass Filter

We consider the passive band-pass filter of a well-known wah-wah pedal circuit [Fig. 9(a)], for which the influence of the core non-linearities on the resulting sound are prominent.

For this band-pass filter the input is the Q2 transistor emitter voltage and the output is the VR 1 potentiometer voltage [Fig. 9(b), where the component L 1 represents the entire ferromagnetic coil equivalent circuit]. Resistors are linear and obey Ohm's law v R = Ri R . Capacitors are linear, of state q C and energy E C (q C ) = q 2 C /(2C). These relations, associated with Kirchhoff's laws and Eqs. ( 14), ( 19), ( 21), (22), and (25), allow a PHS formulation of the band-pass.

The complete PHS is given in Fig. 9(c). A simulation is performed using a Newton-Raphson algorithm on the discretized PHS (see, e.g., [29,30] for more details on the discretization and integration), with v in = U 0 sin (2πf 0 t). For the parameters given in Table 1 and component values in Fig. 9(a), the center frequency is f c ≈ 2 kHz and the bandwidth is f ≈ 1 kHz. Figs. 9(d)-9(f) show the simulation results for different input frequencies f 0 and U 0 = 25 V. The core saturation and hysteresis are mostly observed for input frequencies in the filter bandwidth. Sound examples are available at https://github.com/JNaj/jaes_ferromag.

Transformer With Ferromagnetic Core

Output transformers are generally present in amplifiers to reduce the load impedance seen by the loudspeaker [31,2]. Transformers with a ferromagnetic core are considered particularly interesting because of the core high magnetic permeability, which reduces the leakage flux [32].

We build a non-linear transformer model by coupling two ferromagnetic coils, that is, letting them share the same core [Fig. 10(a)]. The primary (resp. secondary) coil inductor and associated resistor are denoted L 1 and r 1 (resp. L 2 and r 2 ), with number of turns n 1 (resp. n 2 ). To simplify the interconnection matrix we define for the magnetic domain

e 1 v 1 = 0 n 1 -n 1 0 f 1 i 1 , v 2 e 2 = 0 n 2 -n 2 0 i 2 f 2 . ( 29
)
Kirchhoff's laws and Eqs. ( 14), ( 19), ( 20), (25), and (29) allow a PHS formulation of the transformer.

The complete PHS is shown in Fig. 10(c). A simulation is performed (same technique as for the band-pass) with v in = U 0 sin (2πf 0 t) and parameters in Table 1. Figs. 10(d) and 10(e) show simulation results for different input voltages and f 0 = 100 Hz. It can be seen that saturation and hysteresis arise for large input voltages while the transformer's behavior for small input voltages is quasi-linear. This corresponds qualitatively to observations on real transformers.

It is worth noting that the modularity of the model would allow for more complex transformer topologies (multiple primaries, multiple secondaries, air-gaps. . .) without difficulty.

CONCLUSION

In this paper a new macroscopic model of ferromagnetic coil has been developed. It is based upon a componentwise, energetic approach. Characteristics like saturation and hysteresis are well reproduced, as well as the influence of thermodynamics. This explicit influence is an improvement with respect to other models. Moreover the modularity of the model makes it particularly versatile, as the component approach can be applied to multiple combinations of cores and coils. As an illustration the model has been used to simulate two representative audio sub-circuits: a band-pass filter and transformer. Due to the reduced number of parameters and variables these simulations can be performed in real-time.

Nonetheless even if the model has been successfully identified with real components and exhibits a satisfactory qualitative behavior for audio applications, extensive measurements should be conducted to assess the model relevance more quantitatively. This shall be the object of future work.

APPENDIX A.1 Energy Derivative w.r.t the Entropy

From Eq. ( 14) we deduce:

∂ E core S(x core ) 1 = -E0 S0 BV core BV s f -1 S S 0 cosh 2 f -1 S S 0 2 = E0 S0 BV core BV s cosh 2 f -1 S S 0 cosh 2 f -1 S S 0 f -1 S S 0 3 = E0 S0 BV core BV s 1 f -1 S S 0 4 = T (1) using 1. tanh u = u /cosh 2 u, 2. f -1 = 1/(f •f -1 ) and f (u) = -u/cosh 2 (u), 4. E 0 /S 0 = T c and f -1 (S/S 0 ) = |B Vcore |/B Vs T c /T
, where the symbol • stands for function composition.

INTRODUCTION

Physical modeling is concerned with the representation of a system governed by laws of physics. An accurate physical model provides insight into the system's behavior, beyond the conditions available to the experimenter. (2014). PHS are multi-physical (that is, mechanical, electrical, thermal ... or a combination as well), and modular (a power-conserving or dissipative interconnection assembly of PHS is still a PHS). Most importantly, the PH formalism structurally fulfills the physical power balance. Moreover, numerical methods that preserve this guarantee in the discrete-time domain are available for simulations: Falaize and Hélie (2016). Nevertheless, simulating PHS with numerous degrees of freedom can prove an issue, as it involves very large matrices.

On the other hand, statistical physics is especially designed to describe complex systems with a reduced number of variables. From a collection of interacting elementary particles subject to constraints, statistical physics predicts macroscopic thermodynamic phenomena, such as entropy creation and phase transitions: Stowe (2007); Landsberg (2014).

While thermodynamics has been broadly studied in the context of PHS modeling in e.g. ; van der Schaft (2020), the proper derivation of thermodynamic variables through statistical physics is seldomly addressed. In this paper, we combine the two approaches and propose a series of steps to systematically construct a simplified yet physicallybased, structured macroscopic PHS, from a complex system described by statistical physics.

This paper is structured as follows. Section 2 presents the key principles behind statistical physics, and details the derivation of a macroscopic PHS from a stochastic description. Section 3 applies the method to two illustrative examples: an ideal gas, and a ferromagnet. Finally, section 4 gives some conclusions and perspectives.

THEORETICAL FRAMEWORK

Micro-state of a system

Consider a system composed of particles of matter occupying a volume. Denote M the set of all possible configurations of all (or subsets of) countable particles for all volume values. A particular configuration m ∈ M is called a microstate of a system. For instance, each micro-state of a gas can be described in classical mechanics by a particular set of positions and momenta.

Each micro-state is mapped to a number of particles, a volume, and an energy, corresponding to the following functions:

N : M → N * m → N (m) micro-state number of particles, V : M → R + * m → V(m) micro-state volume, E : M → R m → E(m) micro-state energy, (1)
where the energy function E is assumed to have an inferior bound, i.e., E(m) ≥ c for some c ∈ R.

Accessible micro-states under constraints

According to experimental conditions, any quantity ϕ ∈ F = {N , V} can be fixed while E and the remaining unfixed quantities in F are left free to fluctuate 1 . In this case, the experimental constraints determine the set of accessible micro-states M a . For instance, a closed system (no exchange of particles with the environment) has a fixed N (m) = N 0 ∀m, while V and E can fluctuate. However these fluctuations are coupled through the quantity E(m) + P 0 V(m), where P 0 is the (constant) external pressure 2 . Similarly, an isochoric system has a fixed volume V(m) = V 0 , and the fluctuations of N and E are coupled through the quantity E(m) -µ 0 N (m), where µ 0 is the (constant) external chemical potential. Denote

Q = {E, E + P 0 V, E -µ 0 N , E + P 0 V -µ 0 N }. If the system is thermally insulated, the constraint on Ψ ∈ Q is Ψ (m) = Ψ 0 with a given Ψ 0 ∈ R, hence : M a = {m ∈ M | Ψ (m) = Ψ 0 }. (2)
The case of a system in thermal contact with its environment is addressed in section 2.4.

Stochastic modeling and measure of uncertainty

The system may be in any accessible micro-state, and goes randomly from one accessible micro-state to another. As it is not possible to predict these fluctuations in a deterministic fashion, statistical physics adopts a stochastic description. This description assigns to each micro-state m a probability p(m) to be the actual state of the system.

Given a probability distribution p, a measure of the uncertainty on the fluctuating micro-state is the statistical entropy Gray (2011), defined as (for a discrete distribution 3 ):

S : p -→ -k m∈Ma p(m) ln p(m), (3)
where k is a positive constant. The entropy is indeed a measure of lack of information. For instance, a probability distribution assigning 1 to some micro-state m 0 and 0 to all others would mean that the system is in the micro-state m 0 for certain. From (3), the system entropy would be zero for such a distribution. Conversely, an equiprobable distribution between all micro-states would maximize the uncertainty for an observer, as well as the entropy.

The entropy is a positive quantity, since 0 ≤ p(m) ≤ 1 ∀m. Moreover, the total entropy of two independent systems is the sum of their entropies, since p(m, m ) = p(m)p(m ). It follows that the entropy is an extensive quantity.

Principle of maximum entropy at thermodynamic equilibrium

Thermodynamic equilibrium is reached when the constraints on the system are met. At that point, the system stops evolving and provides a minimal amount of information. Therefore, at equilibrium, the micro-state probability distribution maximizes the statistical entropy, given the constraints on the system. Moreover, at thermodynamic equilibrium, statistical physics assumes the ergodic hypothesis (see e.g. Patrascioiu (1987) for a discussion about its validity; here we will admit it as a working hypothesis). 2 The derivation of such coupling quantities is not detailed here. However, they are listed in Table 1, see also [START_REF] Graben | Unified treatment of adiabatic ensembles[END_REF]. 3 It is similarly defined for a continuous distribution: the sum is replaced with an integral.

This hypothesis states that at equilibrium, the system visits all accessible micro-states, given a sufficiently long period of time. As a result, the temporal mean Ψ of a fluctuating quantity Ψ ∈ Q coincides with its expectation:

E[Ψ ] := m∈Ma p(m)Ψ (m) = Ψ . (4)
It follows that the micro-state probability distribution at equilibrium p is:

p = arg max p S(p) subject to      E[Ψ ] = Ψ m∈Ma p(m) = 1 (5)
In the following, the constant k in ( 3) is taken as the Boltzmann constant k b = 1.38 × 10 -23 J.K -1 . This ensures that the statistical entropy coincides with the thermodynamic entropy at equilibrium.

To solve (5), we introduce and optimize the Lagrangian:

L : (p, λ Ψ , λ 0 ) → -k b m∈Ma p(m) ln p(m) + λ Ψ E[Ψ ] -Ψ + λ 0   m∈Ma p(m) -1   , (6)
where λ Ψ and λ 0 are Lagrange multipliers.

p m | Ψ = exp λΨ Ψ (m) /kb Z (λ Ψ ) , Z (λ Ψ ) = m∈Ma exp λΨ Ψ (m) /kb . (8)
A more detailed derivation can be found in Jaynes (1982).

For systems in thermal contact with their environment, the Lagrange multiplier λ Ψ has a direct physical interpretation. Indeed, from ( 4)-( 8), we deduce :

Ψ = ∂ ∂λ Ψ k b ln Z (λ Ψ ) . (9)
Moreover, reinjecting (8) in (3) yields the thermodynamic entropy S:

S = S(p ) = k b ln Z (λ Ψ ) -λ Ψ Ψ := S Ψ . ( 10
) It follows that S is a Legendre transform of k b ln Z and that:

-

λ Ψ = ∂ ∂ Ψ S Ψ = - 1 T , ( 11
)
where T is the temperature (both internal and external, at equilibrium).

By applying maximum entropy to each constraint, we systematically derive the micro-state probability and the entropy for the corresponding statistical ensemble (Table 1, see also [START_REF] Ray | Ensembles and computer simulation calculation of response functions[END_REF]). Thermal contact

Canonical E[E] = Ē exp(-E(m)/k b T ) Z(T ) k b ln Z(T ) + Ē/T Gas in a closed tank, in contact with a thermostat Isothermal-isobaric E[E + P0V] = H exp(-H(m)/k b T ) Z(T,P0) k b ln Z(T, P0) + H/T
Gas in a closed tank with a piston, in contact with a thermostat

Grand-canonical E[E -µ0N ] = L exp(-L(m)/k b T ) Z(T,µ0)
k b ln Z(T, µ0) + L/T Gas in a porous tank, in contact with a thermostat

Unnamed E[E + P0V -µ0N ] = R exp -R(m) /k b T R/T
Gas in a porous tank with a piston, in contact with a thermostat 2.5 Macro-state of a system and PHS formulation Following the ergodic hypothesis, the macroscopic number of particles at equilibrium is

N = E[N ]. Similarly, the macroscopic volume at equilibrium is V = E[V].
A third macroscopic variable is the thermodynamic entropy S. If all external efforts constraining the system (that is, T, µ 0 , P 0 , or a combination of them depending on the experimental conditions) are kept constant in time, there is no dynamics since all macroscopic variables become constant in time. However if these quantities are allowed to vary (slowly, so that the ergodic hypothesis is still verified), one can study the system dynamics between successive equilibrium states.

In order to do that, we rely on port-Hamiltonian systems: (2017). This formulation allows the representation of a dynamical system as a network of:

(1) storage components of state x and energy E (x), storing the power P stored = ∇E (x) ẋ; (2) dissipative components of flow w and effort z (w), such as the dissipated power P diss = z (w) w is nonnegative for all w; (3) connection ports conveying the outgoing power P ext = u y where u are inputs and y are outputs.

The flows f and efforts e of all components are coupled through a skew-symmetric interconnection matrix J = -J (possibly dependent on x):

  ẋ w y   f = J   ∇E (x) z (w) u   e . (12)
For instance, an open system in a thermostat is governed by the conservative PHS in Fig. 1, where δ e S/dt denotes the outgoing entropy flow, int indexes internal flows and efforts, ext indexes external flows and efforts.

∇E(x) u T int µ int -P int δeS /dt Ṅext Vext               Ṡ . . . - 1

Method recap

To sum up, the derivation of a macroscopic PHS from a stochastic description is performed in 5 steps:

Step 1 Express micro-state m and laws N , V, E.

Step 2 Pick a statistical ensemble of interest, according to experimental hypotheses. A PHS is finally derived by adding ports accounting for the environment, as shown for each example in the next section.

Remark on thermodynamic potentials

If only some external efforts constraining the system are kept constant, it is possible to work with an appropriate Legendre transform of the internal energy, in order to reduce the PHS formulation. For instance, the (conservative)

PHS of an open system in a constant thermostat, becomes that of Fig. 2, with F (T, N, V ) = E(S, N, V ) -T S. Table 2. Thermodynamic potentials.

Constant Potential

Internal energy E(S, N, V )

T

APPLICATIONS

Ideal gas in a thermostat

Consider N indiscernible, non-interacting atoms in a closed, rigid cube (constant volume V ) in contact with a thermostat at temperature T .

Step 1. A micro-state of an atom is a vector m = [n x , n y , n z ] ∈ N * 3 , where n i is the energy quantization along axis i. Denoting by m the atom mass, a the cube edge length, and h the Planck constant, the Hamiltonian of the atom is given by Davies (1998):

E(m) = n 2 x + n 2 y + n 2 z h 2 /8ma 2 . ( 13
)
Step 2. From the hypotheses, the statistical ensemble of interest is the canonical ensemble (see Table 1).

Step 3. The micro-state probability distribution at equilibrium is p (m) = exp -E(m) /kbT /Z(T ).

Step 4. From (8), the partition function for one atom is:

Z 0 (T ) = 2π T /T0 3/2 , with T 0 = h 2 /ma 2 kb (14)
(proof in Appendix A). For N atoms, the partition function becomes:

Z(T ) = Z0(T ) N /N! = 2π T /T0 3N/2 /N!. (15
) For the canonical ensemble, (9) can be rewritten as:

Ē = k b T 2 ∂ ln Z ∂T (T ), (16)
so that:

Ē = 3 /2 N k b T. (17)
From (10), we deduce:

S = k b ln Z(T ) + Ē/T = S 0 + 3 /2 N k b ln T /T0 , S 0 = 3 /2 N k b ln 2πe / N ! 2 /3N . ( 18
)
Step 5. From (18), we deduce:

T = T 0 exp 2 (S-S0) /3Nkb . (19)
Reinjecting in (17), we obtain:

E(S) = 3 /2 N k b T 0 exp 2 (S-S0) /3Nkb . ( 20
)
It is immediately verified that, as expected, ∂E/∂S = T . As N and V are constant, they are removed from the state of the PHS and the only state variable is the entropy S. The constraint due to the thermostat is expressed at the ports of the PHS. Finally, we obtain the following PHS:

∇E(x) u T int δeS /dt ẋ Ṡ . -1 y T ext 1 .
.

Ferromagnetic core in a thermostat

Here, we sum up results of [START_REF] Najnudel | A power-balanced dynamic model of ferromagnetic coils[END_REF]. The goal is to illustrate the modeling of a more complex system exhibiting phase transitions and dissipation.

Consider a ferromagnetic core with constant number of atoms N , constant volume V , in contact with a thermostat at temperature T .

Step 1. Following the model of Ising Ising (1925) (see also [START_REF] Newell | On the theory of the Ising model of ferromagnetism[END_REF]; Strecka and Jascur (2015)), the core is represented as a set of N adimensional magnetic moments, interacting with one another. A micro-state of the core is a particular configuration m ∈ M = {-1, 1} N . The corresponding energy is the Heisenberg Hamiltonian:

E(m) = -1 /2 m J ex m, (21)
where each coefficient J exi,j is the exchange energy between moment i and moment j Liechtenstein et al. (1984). Assuming isotropic interactions affecting nearest neighbours only, this exchange energy simplifies to:

J exi,j = J i, j nearest neighbours, i = j, 0 otherwise, ( 22
)
where J is a constant energy characterizing the material.

Step 2. From the hypotheses, the statistical ensemble of interest is the canonical ensemble (see Table 1).

Step 3. The micro-state probability distribution at equilibrium is p (m) = exp -E(m) /kbT /Z(T ).

Step 4. Above dimension 2 in space, there is no analytic expression for Z(T ). Assuming small micro-state fluctuations, we rely on the mean-field approximation: Utermohlen (2018), which yields In (23), the auxiliary variable m ∈ [-1, 1] can be interpreted as a mean magnetic moment, while q is the (constant) number of nearest neighbours of each moment. Reinjecting ( 23) in ( 16), the mean-field internal energy is found to be:

Z M F (m, T ) = exp -N Jqm 2 /2 kbT 2 cosh Jqm /kbT N . (23)
Ē ≈ E M F (m, T ) = E 0 m 2 /2 -m tanh mTc /T , ( 24
)
where E 0 = N Jq, and T c = Jq/k b is the critical temperature, above which the core becomes paramagnetic. Reinjecting ( 23) in (10), we obtain the thermodynamic entropy:

S ≈ S M F (m, T ) = S 0 f mTc /T , (25)
where S 0 = N k b and f (χ) = ln 2 cosh (χ) -χ tanh (χ).

Step 5. Finally, introducing the total magnetic flux B Vcore = m µ 0 M s V , where µ 0 = 4π × 10 -7 H.m -1 is the vacuum magnetic permeability and M s is the core saturation magnetization, we obtain:

E core (S, B Vcore ) = E 0 1 /2 BV core/BV s 2 -BV core/BV s g(S) , (26)
where B Vs = µ 0 M s V and g(S) = tanh f -1 S /S0 . The internal effort is ∇E core (S, B Vcore ) = [T core , H core ] , where T core and H core denote the core temperature and the internal magnetic field, respectively. Figure 3 shows the core going from two meta-stable equilibrium states to one stable equilibrium state, as the entropy increases. This corresponds to a phase transition from ferromagnetic to paramagnetic.

Dissipation. When the core is constrained by an exterior magnetic field H in (created by a coil for instance), jumps between meta-stable states, called Barkhausen jumps, occur: Bertotti (1998). These jumps are damped (Fig. 4) due to domain structure and non-homogeneities (see Kittel (1949)). This damping can be modeled with a linear magnetic resistor r core connected in series with the core (Fig. 5a). As the difference of energy before and after a jump is entirely dissipated as heat Bertotti (1998), Barkhausen jumps are also responsible for the variation of entropy creation δ i S in the core. The associated thermal power is equal to the magnetic power dissipated through r core , so that:

r core H 2 rcore -T core δiS /dt = 0, (27)
where dt stands for an infinitesimal increment of time. We deduce the dissipative flow and effort: w = [-T core , H rcore ] z(w) = rcoreH 2 rcore/Tcore , r core H rcore = δiS /dt, ḂVr core .

Figure 4. Damped Barkhausen jumps and resulting hysteresis during a cycle. The red curve is the theoretical core internal magnetic field, the blue curve is the real trajectory followed by the total magnetic flux of the core constrained by an external magnetic field.

Finally, the second law of thermodynamics Landsberg (2014) states: Ṡ = δiS /dt -δeS /dt. (29) Kirchoff's laws in receptor convention, as well as ( 26)-( 28)-( 29), yield the PHS formulation in Fig. 5b. Note that in addition to the power balance, the entropy balance is made explicit in this formulation.

This model has been successfully implemented in several applications simulating audio circuits (see [START_REF] Najnudel | A power-balanced dynamic model of ferromagnetic coils[END_REF]).

CONCLUSION

In this paper, we presented a method for deriving an ad hoc macroscopic port-Hamiltonian formulation for a constrained system described by statistical physics. This method is based on two key principles of statistical physics (that is, maximum entropy and the ergodic hypothesis), and expresses the internal energy of the system as a function of extensive thermodynamic variables. The exchanges of energy and entropy are made explicit through the PH formulation. Constraints are modeled in ports as inputs, and entropy creation is modeled as dissipation. Alternative formulations based on thermodynamic potentials are also possible, under certain conditions.

The method is applied to model two systems: an ideal gas in a thermostat, and a ferromagnet in a thermostat. In the case of the ferromagnet, the method successfully captures complex phenomena such as phase transitions, meta-stability, dissipation and entropy creation, with only two state variables and one dissipative component.

A perspective of this work is to extend the method to other microscopic quantities and constraints, not restricted to the system number of atoms and volume. Another perspective is to generalize the mean-field approximation (for systems composed of particles interacting with one another), and introduce appropriate auxiliary variables in order to obtain approximations of the partition function with an arbitrary degree of accuracy. This shall be the object of future work. arXiv:1705.09081.

H in

ḂVin core

ḂVcore

INTRODUCTION

Virtual analog modeling is an active research field, in particular within the audio community. Indeed, vintage analog audio effects are still appreciated among musicians, but original devices are now rare and delicate to maintain. A virtual replica then becomes a compelling alternative. Historically, modeling methods have been roughly classified into two categories, white box and black box. White box modeling relies heavily on physics, and requires extensive knowledge on the circuit, from components datasheets to circuit schematics. Such modeling include Wave Digital Filters [1,2,3] and State-Space representations [4,5,6]. Black box modeling on the other hand is more concerned with reproducing a global input-output behavior, without necessarily capturing local phenomena taking place inside the system. It is usually more adaptable, but less physically interpretable. Neural Networks [7,8] are popular black box models. Volterra-based methods can be either white box oriented [9,10], or black box oriented [11].

A crucial counterpart of modeling is system identification, that is, retrieving model laws and parameters from measurements. Obviously, one designs an identification method with a specific model -white box or black box-in mind (see e.g. [12,13] for Volterra, or [14] for WDF). In recent years nonetheless, hybrid modeling, or grey box, has gained considerable momentum for identification. Indeed, it often successfully combines desirable features from both paradigms. Such in-between modeling associates State-Space representations and polynomial models [15], State-Space representations and Neural Networks [16], digital filters and Neural Networks [17] to list a few.

In this paper, we consider an identification method relying on the State-Space representation known as port-Hamiltonian systems (PHS) [18,19] on one hand, and kernel-based methods [20,21] on the other hand. PHS are built as interconnected components with physical constitutive laws, so that the power balance of the system is structurally satisfied. This energy-based formulation can be associated with numerical methods that preserve the power balance and passivity in the discrete-time domain, for both linear and nonlinear systems. The PHS approach has proved relevant to simulate audio systems [22]. Although extensive work is concerned with linear PHS identification [23,24], nonlinear PHS identification is still little explored (see e.g. [25] for an overview). To address nonlinear behavior, we rely on reproducing kernels. Reproducing kernels have long proven to be a valuable and flexible tool for function approximation and solving of differential equations [26]. As such, they already have succesfully been implemented for audio circuit modeling [27]. Reproducing kernels are privileged here over deep learning approaches such as in [28], because the number of parameters to infer is much smaller, and because they are generally more interpretable. The specificity of our method resides in choosing a kernel and tailoring the regression so that key physical properties of the system, such as power balance and passivity, are retained.

This paper is organized as follows. In section 2, we give a brief overview of PHS. In section 3, we propose a parametrization of the PHS interconnection matrix. In section 4, we present an energy modeling based on reproducing kernels. Section 5 describes an optimization procedure to retrieve PHS parameters from measurements. In section 6, the complete method is tested on a virtual passive peaking EQ. Finally, some conclusions and perspectives are given in section 7.

PORT-HAMILTONIAN FORMULATION AND WORKING ASSUMPTIONS

Port-Hamiltonian formulation

The identification method described in this paper relies on port-Hamiltonian systems [29,19], under a differential-algebraic formulation (PHS). This formulation allows the representation of a dynamical system as a network of:

1. storage components of state x and energy H (x), storing the power Pstored = ∇H (x) ⊺ ẋ;

Here, flows can either be currents (e.g. for capacitors) or voltages (e.g. for inductors), and vice versa for efforts. Such systems satisfy the power balance Pstored + Pdiss + Pext = 0. Indeed, Pstored + Pdiss + Pext = e ⊺ f = e ⊺ Se is zero since e ⊺ Se = (e ⊺ Se) ⊺ = -(e ⊺ Se) due to the skew-symmetry of S.

Under some additional assumptions (not detailed here), this formulation can be reduced to the following PH-ODE representation [19]:

ẋ y = (J -R) ∇H (x) u , (2)
where J = -J ⊺ is skew-symmetric, and R = R ⊺ is positive semi-definite. Both matrices are possibly dependent on x. In particular, formulation (2) is possible when the dissipative law z is linear.

Throughout this paper, we adopt the passive sign convention for all components, including ports and external sources. This means that the current is defined positive when entering the component through the positive voltage terminal [30].

Example

As an illustration, consider the linear RLC circuit in series (Fig. 1a). The resistor obey Ohm's law, with flow iR (current through the resistor) and effort z(iR) = R iR = vR (voltage across the resistor). The inductor has state ΦL (magnetic flux linkage through the inductor), energy HL(ΦL) = Φ 2 L /2 L and effort H ′ L (ΦL) = ΦL/L = iL (current through the inductor). The capacitor has state qC (electric charge in the capacitor), energy HC(qC) = q 2 C /2 C and effort H ′ C (qC) = qC/C = vC (voltage across the capacitor). Kirchhoff's laws in receptor convention yield the PHS and PH-ODE representations in Fig. 1b and Fig. 1c, respectively.

Working assumptions

In the following, we limit ourselves to circuits verifying that:

1. The dissipation law z is linear.

2. The coefficients of J -R are constant. k denote the second derivative of Hk (a formal definition can be found in Appendix A).

Assumptions 1 to 3 cover electronic circuits constituted of one-ports such as (possibly nonlinear, see [31]) inductors, (possibly nonlinear, see [32]) capacitors, linear conductors and linear resistors, which admit a PH-ODE formulation such as Eq. ( 2). This deliberately excludes nonlinear dissipative components such as diodes, transistors and vacuum tubes, which will be the object of future work. Assumptions 4 and 5 are stricter than necessary: actually, a sufficient condition to ensure passivity of storage components is for the energy to have an inferior bound [19]. Nevertheless, enforcing convexity results in a desirable asymptotic behavior, and most energy laws are convex anyway (a notable exception concerns meta-stable ferromagnetic cores [31]).

In the next sections, we assume that we can measure x, u and y, and look for an estimation of the reduced matrix J -R and an approximant of H, verifying both Eq. (2) and our working assumptions.

INTERCONNECTION MATRIX MODELING

Decomposition of J

Since J = -J ⊺ is skew-symmetric, it can be written as:

J = J (θ J ) := N J k=1 θ J k Jk, θ J = θ J 1 , . . . , θ J N J ∈ R N J , ( 3
)
where {Jk} is the canonical base of skew-symmetric matrices, and

NJ = dim (J ) dim (J ) -1 / 2.
For the example of section 2.2, we have:

{Jk} =      0 1 0 -1 0 0 0 0 0   ,   0 0 1 0 0 0 -1 0 0   ,   0 0 0 0 0 1 0 -1 0      , θ J = [1, 0, 1].

DAFx.2

Proceedings of the 24 th International Conference on Digital Audio Effects (DAFx20in21), Vienna, Austria, September 8-10, 2021

2 θ R k Tk, θ R = θ R 1 , . . . , θ R N R ∈ R N R , ( 4
)
where {Tk} is the canonical base of lower triangular matrices, NR = dim (R) dim (R) + 1 / 2, and diagonal coefficients are non-negative. For convenience, we choose the first dim (R) coefficients to be the diagonal coefficients.

For the example of section 2.2, we have:

{Tk} =      1 0 0 0 0 0 0 0 0   ,   0 0 0 0 1 0 0 0 0   ,   0 0 0 0 0 0 0 0 1   ,   0 0 0 1 0 0 0 0 0   ,   0 0 0 0 0 0 1 0 0   ,   0 0 0 0 0 0 0 1 0      θ R = 0,
√ R, 0, 0, 0, 0 .

ENERGY LAW MODELING

Optimal approximant

We consider the reproducing kernel theory to build an approximant of H. We refer to [35,26] for a complete theoretical overview of Reproducing Kernel Hilbert Spaces (RKHS). In this section, we only recall practical results. Consider the classic scattered data interpolation problem, which is finding a function f verifying:

f (xi) = yi ∀i ∈ {1, ..., N }, (5)
for some given data {(x1, y1), ..., (xN , yN )}, [x1, ..., xN ] ∈ Ω N . Assuming that f belongs to a RKHS K, the optimal approximant of f in K is the function f defined as:

f : x → N j=1 λjK (x, xj) , (6)
with K : Ω × Ω → R the positive definite kernel inducing K. In Eq. ( 6), the vector λ is the solution of the linear system Kλ = y, where Ki,j = K (xi, xj). For instance, the kernel defined as:

K (xi, xj) = a π sinc a(xi -xj) ,
where 0 < a < +∞ and sinc(u) = sin(u)/u, is the reproducing kernel of the space of bandlimited continuous functions of bandwith in [-a, a].

In practice, the RKHS K of interest for a given problem is often unknown. Therefore what motivates the choice of kernel boils down to the properties one wishes to attach to the approximant, such as locality 1 , smoothness, interpolation behavior, sensitivity to noise, etc. However, there is an inherent tradeoff between these 1 that is, how much influence a data point has over its neighborhood. properties. Indeed, if locality is desirable (typically, because f contains high frequencies), choosing a local kernel is necessary. Nonetheless good reconstruction with a highly local kernel necessitates a high number of samples N . But a high number of samples can in turn lead to overfitting, especially with noisy data. Therefore, N is usually chosen low enough so that the approximant generalizes well and small changes in the given data do not impact the reconstruction too much. Concomitantly, the kernel support is adjusted through a scaling parameter ρ > 0, so that the approximant is reasonably smooth for the chosen N .

Once N is fixed, several strategies are available in order to find optimal parameters (the N samples and the scaling parameter ρ) for a given kernel, see e.g. [36,37,38]. In this work, as the input space dimension is only 1 due to the separability of the energy law, we adopt a grid-based approach: the samples are distributed evenly along the measured data range, and the scaling parameter is adjusted so that some test function is approximated with an arbitrary degree of accuracy. The advantage of this approach resides in its simplicity. Should the energy law not be separable though, a more sophisticated strategy would be preferable. Figure 2 shows approximations from noisy data (SNR = 14 dB with a normal distribution) for different values of N , and K defined as:

K (xi, xj) =
(1 -r) 4 (1 + 4r) r = ∥xi -xj∥ < 1, 0 otherwise.

Choice of kernel

The only assumption we have on the energy H is the convexity assumption. Therefore, any kernel reproducing the convexity of H should be relevant. A simple way of enforcing the convexity of H is to construct a positive approximant of ∇2 H. An approximant of H can then be obtained by integration. To ensure the positivity of each H

k , we look for approximants of the form:

H (2) k (xk) ≈ N H i=1 θ H k,i K (xk, xk,i) , with θ H k,i ≥ 0 ∀k, i, ( 7
)
where K is positive definite and continuous. Additionally, we choose K radial, of the form K (xi, xj) = ϕ ∥xi -xj∥ . Indeed, a radial kernel is local by construction. We also choose K compactly supported, so that interpolation matrices are sparse and computation is efficient. A possible choice of kernel verifying these properties is one of the Wendland functions [39,26] defined as:

ϕ(ρ; r) =      1 ρ 1 - r ρ
where the scaling parameter ρ is different for each component.

Energy law model

To simplify notations in the following, we denote ϕk,i : x → ϕ ρk;∥x -xk,i∥ .

Finally, the energy law approximant we look for has the form:

H θ H ; x := Nx k=1 N H i=1 θ H k,i ϕ (-2) k,i (xk) , θ H k,i ≥ 0 ∀k, i, (10)
where ϕ

(-2)
k,i denotes the second antiderivative of ϕk,i (formal definition in Appendix A). The {ϕk,i} constitute a compactly supported radial basis of ∇2 H. The {xk,i} are called the centers of the radial basis [40].

PARAMETER ESTIMATION

Objective function

We denote f [j] the measured average flows at sample j:

f [j] = δx[j]fs y[j] , (11)
where δx

[j] = x[j + 1] -x[j]
and fs is the sample rate. Similarly we denote f (Θ)[j] the estimated flows at sample j:

f (Θ)[j] = J (θ J ) -R(θ R ) ∇H θ H , x[j], δx[j] u[j] , (12)
where θ H ⪰ 0, diag T (θ R ) ⪰ 0, and ∇H is the discrete gradient [41] defined component-wise as:

∇Hk θ H , x[j], δx[j] =                N H i=1 θ H k,i ϕ (-2) k,i xk[j] + δxk[j] -ϕ (-2) k,i xk[j] δxk[j] δxk[j] > ϵ, N H i=1 θ H k,i ϕ (-1) k,i xk[j] + δxk[j] 2 otherwise. (13)
Denoting F (resp. F (Θ)) the dim(J ) × n matrix of measured flows (resp. estimated flows) at all n samples, we define the error ϵ(Θ) = F (Θ) -F , and the objective function

E(Θ) = F (Θ) -F 2
, where ∥∥ is the Frobenius norm. Finally we look for the optimal:

Θ ⋆ = arg min E(Θ) subject to θ H ⪰ 0, diag T (θ R ) ⪰ 0. ( 14
)
Here diag T (θ R ) denotes the diagonal elements of T (θ R ).

The sample rate fs is considered high enough so that the numerical error is negligible. Therefore we consider that we identify the continuous system, and the specific contribution of the discretization scheme to the global error [42] is not addressed here.

Constrained optimization

To perform a constrained minimization of E, we rely on the Interior Point Method [43]. As this method is well documented, in this section we only provide a basic mathematical layout as a reminder.

We define the loss function L:

L : Θ → E(Θ) - 1 t   Nx k=1 N H i=1 ln θ H k,i + dim(J) k=1 ln θ R k   logarithmic barrier . (15)
The logarithmic barrier [43] penalizes the minimization if all coefficients are not strictly positive. The parameter t is set by the user to enforce or relax the constraint 2 . A necessary condition to minimize L is finding a solution to:

F (Θ, µ) = ∂ϵ(Θ) ⊺ ϵ(Θ) -µ µ ⊙ Θ -1/t = 0, ( 16
)
where ∂ϵ is the Jacobian of ϵ, µ is the derivative of the logarithmic barrier w.r.t Θ, and ⊙ denotes the element-wise product. A solution is estimated with a damped Gauss-Newton iteration [44]. Starting from a particular set of parameters Θ 0 meeting the constraints, the set is improved iteratively using:

Θ k+1 , µ k+1 ⊺ = Θ k , µ k ⊺ -α J -1 Θ k , µ k F Θ k , µ k (17)
where α ∈ [0, 1] is a damping coefficient computed with a line search [43] and J is the Jacobian of F defined as:

J (Θ, µ) = ∂ϵ(Θ) ⊺ ∂ϵ(Θ) -I diag (µ) diag(Θ) . (18)
Here diag(µ) (resp. diag(Θ)) denotes the square diagonal matrix with the elements of µ (resp. Θ) on its diagonal. The iteration is stopped when the error is sufficiently low, or, since the objective function is non convex, if the error starts increasing.

RESULTS FOR A VIRTUAL PASSIVE PEAKING EQ

Circuit parameters and data generation

We consider a passive peaking EQ [45] (Fig. 3a). The potentiometer wiper position is parametrized by γ ∈ [0, 1], where γ = 0 corresponds to the lowest position, and γ = 1 to the highest. This parameter determines the shape of the frequency response (Fig. 3b). The potentiometer, resistor and capacitor are all considered to be linear. The inductor is saturating with an effort law of the type [31]:

iL = I0 ΦL Φsat -tanh ΦL η Φsat , (19)
where I0, Φsat, and η are model parameters (hysteresis is neglected here). Circuit parameters are set so that the center frequency is 50 Hz and the quality factor is 1. They are shown in Table 1. Synthetic measurement data are artificially generated for an input voltage of the form vin = U0 cos (2πf0t). The values of f0 and γ are chosen so that the circuit is maximally resonant. This Table 1: Data generation parameters for the virtual passive peaking EQ. method allows the joint estimation of constitutive laws of storage components, as well as the interconnection matrix encoding the circuit topology. In turn, the estimated model may be used for passive guaranteed simulations.

Rp (Ω) R (Ω) γ C (F) I0 (A) Φsat (Wb) η U0 (V) f0 (
The method has been tested on a virtual peaking EQ, with accurate results. However, the method needs to be more thoroughly assessed against real measurements. In particular, we should control that the discretization scheme in the simulation error does not introduce too much numerical dispersion, which would alter the optimization process. In that case, the discretization error would have to be taken into account [47], or the sample rate would have to be increased.

Another immediate perspective for this work is to extend the method in order to include nonlinear dissipative components. This would allow the inclusion of transistors and vacuum tubes, which are an important part of audio circuits.

It would also be interesting to adapt the method to a co-energy variables formulation. This way, measurements would only need to be voltages and currents, instead of charges and magnetic fluxes, which are much more difficult to obtain in practice. Identification from partial measurements (incomplete state, or input and output only) could be studied as well. This will be the object of future work.

A. DERIVATIVE AND ANTIDERIVATIVE NOTATIONS

By convention, f (0) = f . Then for some positive integer k ≥ 1, we denote f (k) the function defined by:

f (k) : x → d dx f (k-1) (x). (24)
Similarly, we denote f (-k) a function defined by:

f (-k) : x → x 0 f (1-k) (u)du + C, (25)
where C is a constant. In this work, C is taken so that f (-k) (0) = 0.

B. PH-ODE OF THE PASSIVE PEAKING EQ

With

αp = R Rp + R , Gp = 1 Rp + R , Rp ∥ R = RpR Rp + R , (26)
the PH-ODE of the passive peaking EQ on Fig. 3a is given by:

v C i L v in iout         i C . 1 . . v L -1 -γRp ∥ R Rp R (1 -γ) + 1 γRpGp γRp ∥ R i in . -γRpGp -Gp -αp vout . γRp ∥ R αp -Rp ∥ R . (27)
DAFx.8

Proceedings of the 24 th International Conference on Digital Audio Effects (DAFx20in21), Vienna, Austria, September 8-10, 2021 8

INTRODUCTION

As the audio industry is moving toward the digital era, the question of the preservation of analog machines and instruments is paramount. This question is especially relevant for the Onde Martenot, one of the first electronic musical instruments [1] invented in 1928, for it is no longer produced and some of its components are now obsolete. A satisfying solution consists of modeling its circuit in order to build a virtual instrument so that the community of composers, musicians, and musicologists may at least have access to facsimile. To model electronic circuits for audio applications, the state-space form known as Port-Hamiltonian Systems (PHS) has proven to be a powerful approach as it guarantees the power balance of the considered system, therefore preserving the passivity of simulations [2] even when its components are not linear. It is multi-physical (a system can be electrical, mechanical, thermal, or a mix as well) and modular (a system made of several connected PHS is still a PHS). Yet for some circuit configurations, a direct state-space form cannot be derived-the circuit is said not to be realizable-and an equivalent circuit must be computed in order to perform simulations. This is the case with parallel capacitors that must be replaced by a single equivalent capacitor. However, when the components involved in the circuit are not LTI, as some are in the controllable oscillator of the Onde Martenot, the classic impedance approach is no longer suitable and equivalent components must be computed through a specifically designed method.

This paper is structured as follows: The Martenot controllable oscillator circuit is presented in Sec. 2, with a particular attention drawn to the realization problem it poses. In Sec. 3, the PHS formalism is briefly described. In Sec. 4, a method to compute equivalent components in this formalism is developed. A modeling of the complete oscillator is then derived, and several configurations are simulated in Sec. 5. Finally, the simulation results are discussed in Sec. 6.

ONDES MARTENOT RIBBON-CONTROLLED OSCILLATOR AND PROBLEM STATEMENT 1.Circuit Overview

The Onde Martenot, invented by Maurice Martenot in 1928, is one of the first electronic musical instruments and is based on heterodyne processing. Heterodyning is a technique used to shift high frequency signals into the audio domain. In the Onde Martenot specifically, each one of two oscillators generate a high frequency quasi-sinusoidal voltage (around 80 kHz); one is fixed, and the player controls the second frequency using a sliding ribbon. The sum of these two voltages is an amplitude-modulated signal. Its envelope is detected using a triode vacuum tube, producing an audible sound, for which the frequency is the difference between the two oscillators' frequencies. The triode vacuum tube in the detector is a nonlinear component that adds harmonics to the signal. This enriched signal is then routed toward special kinds of loudspeakers (called diffuseurs) selected by the musician, adding another layer of coloration to the sound. The oscillators are made of an LC circuit coupled to a triode vacuum tube (for amplification) through a transformer. In the controllable oscillator, one of the capacitors of the LC circuit is variable and controlled by the ribbon. Fig. 1 shows that the total capacitor is in fact made of several capacitors connected in parallel, some of them LTI but one of them time-varying.

Problem Statement

Two capacitors C A and C B connected in parallel are equivalent to a single capacitor C C (Fig. 2). In the case of an LTI system, the notion of impedance allows us to determine the equivalent capacitor. Indeed, denoting the capacitors' impedances Z A = 1 jCAω and Z B = 1 jCB ω , respectively, Kirchoff's laws i

C = i A + i B and v C = v A = v B yield the relation 1 Z C = 1 Z A + 1 Z B ( 1
)
This relation characterizes entirely the equivalent component C C and gives the value of its capacitance:

jC C ω = jC A ω + jC B ω ⇒ C C = C A + C B (2)
However, this classic impedance approach is no longer suitable for non-LTI systems: if we were to naively define impedance by the ratio v/i (transfer function), that of nonlinear capacitors would still depend on the charge q, itself time dependent. By definition, time-varying capacitors would also yield a time-dependent transfer function. As the ribbon-controlled capacitance depends on the ribbon position, which itself depends on time, an adapted method to characterize the equivalent capacitor is needed. The PHS formalism allows us to represent an energy-storing component by its energy function instead of its impedance. We may thus rely on this notion in a non-LTI case, as it is more general.

PORT-HAMILTONIAN SYSTEMS: FORMALISM AND EXAMPLES

This section recalls basics on Port-Hamiltonian Systems (PHS).

For detailed presentation, readers can refer to Refs. [3] and [4].

Formalism

Here we rely on a differential-algebraic form adapted to multi-physical systems [5,6], which allows us to represent a dynamical system as a network of storage components with their state variable x and total energy of the state H (x), dissipative components with their variable w and constitutive law z(w), and connection ports as control inputs u and their associated outputs y such as u y is the external power brought to the system. The variables are generally time dependent and can be vectors. If such a system is realizable [7,8], the flows and efforts exchanges between the system components are coupled through a skew-symmetric matrix S = -S :

⎛ ⎝ dx dt w -y ⎞ ⎠ F(flows) = S. ⎛ ⎝ ∇ H (x) z(w) u ⎞ ⎠ E(efforts) (3)
The skew-symmetry of S guarantees that the system remains passive, i.e., there is no spontaneous creation of energy. Indeed, from Eq. (3), the scalar product of the efforts and flows yields

E F = E SE = (E SE) = -E SE = -E F = 0, (4)
where E = H(x) is the energy, P ext is the (incoming) external power, and P diss ≤ 0 the dissipated power. Appendix A.2 and Ref. [2] describe a numerical scheme preserving those properties in discrete time.

Capacitors Constitutive Laws

For LTI capacitors, the charge q and voltage v are mapped according to a constitutive law q = Cv, which depends on a unique characteristic constant (capacitance C in Farad). The electric power P = i v received by such a component makes its stored energy E vary as dE dt = P. With current i = dq dt and voltage v = q C and assuming a zero energy for a discharged component, a time integration yields E = H(q) with H (q) = q 2 2C . This energy is sometimes expressed independently of value C as E = qv 2 . For nonlinear capacitors, the last expression is no longer true. But a description based on an energy function q →H(q) is still applicable. The constitutive law is described by the voltage function H (derivative of H), namely,

v = H (q), (6)
with power balance v i = H (q) dq dt = dH (q) dt = dE dt . Remark 1 (Constitutive laws based on q or v). In practice, constitutive laws are usually formulated (and measured) with respect to the voltage (effort) rather than the charge (state). Formally (if possible), such a description corresponds to invert v = H (q) (=q/C for linear capacitors) into q = F(v) (=Cv for linear capacitors) with F = H -1 and formulates the energy as E = H(H -1 (v)) = Cv 2 2 . Note that differentiating this formula yields a (correct) power balance but more difficult interpretations. Note also that such a change of state can be achieved using the Legendre transform of H in the weaker case of convex nonsmooth H.

This remark applies to varactors proposed in [9], with model

H -1 = F : v → Cv/ √ 1 + v/v 2 .
Another example is tanh type which is of the form q → H (q) = v 1 tanh( q q0 ). Fig. 3 shows the voltage functions and corresponding energy functions of these different capacitors types (for q 0 = 7 nC, v 1 = 80 mV, C = 50 nF, and v 2 = 0.2 V).

EQUIVALENT COMPONENT DESCRIPTION OF NON-LTI PARALLEL CAPACITORS

Problem Statement and Hypotheses

Consider two capacitors connected in parallel (Fig. 2). These components are flow controlled ( dx dt = q = i, current). As they are connected in parallel, their dual efforts (voltages) are equal and there is no skew-symmetric matrix S, such that ⎛ According to Eq. ( 6), this means that the voltage v k = H k (q k ), continuously and strictly increases with the charge q k , and is zero for a zero charge. In particular, the constitutive law Eq. ( 6) makes v k and q k in one-to-one relation, allowing therefore its invertibility.

⎝ i A i B -V ⎞ ⎠ = S. ⎛ ⎝ v A v B I ⎞ ⎠ ,

Method

To express the total energy H C as a function of the total charge q C = q A + q B under the constraint that capacitors in parallel share the same voltage v A = v B = v C , the method is decomposed into three steps.

NAJNUDEL ET AL.

PAPERS

Step 1: Express the total charge q C = q A + q B as functions of the common voltage v A = v B = v C . From Eq. ( 6), the charge of isolated components is

q k = H k -1 (v k ), for k = A, B, (7)
so that the total charge depends on the common voltage as

q C = H A -1 + H B -1 (v C ). ( 8
)
This function continuously and strictly increases and is zero at zero. Step 2: Express this common voltage v C as a function of the total charge q C .

v C = H A -1 + H B -1 -1 (q C ). ( 9
)
Step 3: Express the total energy as a function of q C . The energy values H k (q k ) of elementary components k = A, B can be reformulated as functions of the total charge, using the composed functions q C (9)

-→ v C (7)
-→ q k . Their sum yields the total energy function; that is,

H C (q C ) = H A • H A -1 + H B • H B -1 • H A -1 + H B -1 ] -1 (q C ). (10)
These steps are detailed in examples in Appendix A.3.

Remark 2 (Time-varying case). For capacitors that depend on other additional state variables (e.g., the timevarying space variable in Eq. ( 15), Sec. 4.1.1), steps 1 to 3 are unchanged (these additional variables are considered as parameters in this method). This is applied to the ribbon controlled-oscillator in Sec. 4.

Generalizations

This method can also be extended to K non-LTI capacitors connected in parallel, leading to

H tot (q tot ) = K k=1 H k • H k -1 • K k=1 H k -1 -1 (q tot ) (11)
In this case, the charge of each component k is

q k = H k -1 (v C ) = H k -1 • K k=1 H k -1 -1 (q tot ) (12)
This method is adapted to other types of storage components that pose similar realization problems. For instance, it is suitable for coils in series, for which the state is the magnetic flux ϕ, i = H (ϕ) provides the current law and the voltage is v = φ (see [10] for a general description of such causality conflicts and their resolution based on this method). Moreover, when the constitutive laws of the components are not well known, this method can still be used with laws interpolated from measurements. An implementation of the method using piecewise linear functions is available in the PyPHS library, a python library developed at Ircam dedicated to PHS modelling and simulations [11].

SIMULATION OF THE RIBBON-CONTROLLED OSCILLATOR

Ribbon-Controlled Oscillator Modeling

Constitutive laws of components R 1 , L, C 1 , C 2 , C 13 , and C 14 are supposed to be linear and described in Table 4, in Appendix A.1. The transformer is also supposed to be linear and of ratio M. The remaining component models are described in the next section.

Equivalent Variable Capacitor

The ribbon slides between the faces of a comb-shaped capacitor. As it slides, its conductive part hides and activates complementary parts of the teeth that compose the capacitor, according to the ribbon position (Fig. 4). Sec. 4.2 validates that the LTI capacitors C 13 and C 14 and the variable capacitor C 15 connected in parallel are equivalent to a single variable capacitor. In order to evaluate how the equivalent capacitor behaves with respect to its charge q and the ribbon position x, the position is mapped with the heard frequency. The ribbon follows a dummy piano keyboard on which the width x 0 = 11.10 -3 m ( 13) is a semitone [12].

Denoting n the semitone number where the reference is A 1 (110 Hz, n = 0), we roughly have x = nx 0 (except when the ribbon slides between a B and a C or between an E and an F where the displacement is greater). The Onde Martenot is tuned on equal temperament; therefore the heard frequency from A 1 is f m = A 1 2 x 12x 0 . Denoting F the carrier frequency, the actual oscillator frequency is f = Ff m and the corresponding capacitance of the LC circuit for a static configuration is (ignoring the dissipative effects of the triode vacuum tube for simplicity):

C(x) = 1 4π 2 (F -A 1 2 x 12x 0 ) 2 L . ( 14
)
Fig. 5 shows C in function of x with L = 2 mH and F = 10 kHz. Based on the linear electric behavior v = q C(x) observed for any static position x, the total energy of the electromechanical component has the form H (q, x) = H (q = 0, x) + q 0 ξ C(x) dξ. Moreover, the discharged component (then purely mechanical) applies no force F on the ribbon whatever the position x. This means that F = ∂ H ∂ x is zero at any state (q = 0, x), leading to H(q = 0, x) = H(q = 0, x = 0) = 0: the discharged component stores no pure mechanical energy. Finally, the internal energy of the electromechanical component is given by (see also Fig. 6)

H cap (q, x) = q 2 2C(x) . ( 15
)
Remark 3 (Energy time-variation). The total energy E = H(q, x) varies as dE dt = P e + P m where

• P e = ∂ H ∂q (q, x) dq dt accounts for the incoming electrical power due to current dq dt and voltage

v = ∂ H ∂q (q, x) = q C(x) , • P m = ∂ H ∂ x (q,
x) dx dt accounts for the incoming mechanical power due to velocity dx dt and a spring reaction force F = ∂ H ∂ x (q, x) = -C (x)q 2 2C(x) 2 , induced by the capacitance variation.

Triode

The triode vacuum tube is modeled with an enhanced Norman Koren model [13]. This gives the anode current i pc and grid current i gc in function of the voltages v pc and v gc :

i pc = 2E Ex 1 /K g if E 1 ≥ 0 0 else (16) i gc = ⎧ ⎨ ⎩ 0 if v gc < V a vgc-Va Rgk else (17)
with

E 1 = v pc K p ln ⎛ ⎝ 1 + exp ⎛ ⎝ K p ⎛ ⎝ 1 μ + v gc + V ct K vb + v 2 pc ⎞ ⎠ ⎞ ⎠ ⎞ ⎠
The parameters set θ = (μ, E x , K g , K p , K vb , V ct , V a , R gk ) is retrieved from the datasheet [14] through a least squares minimization. This allows the modeling of the triode as a dissipative component in the PHS formalism, with w = vpc vgc and z θ (w) = i pc igc .

Transformer and Feedback Loop

The oscillation starts with a voltage noise V start at the triode grid, which is amplified and filtered by the LC circuit at the triode plate before being re-injected in the grid through a transformer of ratio M. Under open circuit (negligible influence of the following stages) and small-signal (possible linearization around an operating point) hypotheses, the oscillator can be represented as a system of input V start and output V out (Fig. 8, with μ the triode amplification factor and ra the anode resistor). The plate load is constituted by an LC parallel circuit with impedance (s is the Laplace variable)

Z = s L 1 + s 2 LC (18)
Moreover, as V bias is constant, V out = -[Z/(Z + ra)] v pc where operator denotes variations around the operating point. Considering the triode amplification factor definition, this yields

V out = [Z/(Z + ra)]μ(M V out + V start ), so that V out V start = Z μ Z (1 -μM) + ra . ( 19
)
The poles of transfer function Eq. ( 19) are found to be the roots (in s) of the characteristic equation

s 2 + s 1 -μM raC + ω 2 0 = 0 (20)
with ω 2 0 = 1 LC . The condition for the system to start oscillating is that a complex pole has a positive real part. This leads to

1 μ ≤ M < 1 μ + 2ω 0 C gm ( 21
)
where gm = μ/ra is the triode transconductance. The closer to 1/μ the chosen M, the more stable the oscillation amplitude.

Interconnection

Replacing parallel capacitors C 1 //C 2 with equivalent capacitor C 3 and C 13 //C 14 //C 15 with equivalent capacitor C 8 , the oscillator is realizable and can be represented as the following PHS:

⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ v L i C8 i C3 v R1 v pc v gc -I bias -I start ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ = ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ 0 1 0 0 0 0 0 0 -1 0 0 0 1 -M 0 0 0 0 0 -1 1 1 0 0 0 0 1 0 0 0 0 0 0 -1 -1 0 0 0 1 0 0 M -1 0 0 0 0 1 0 0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 0 ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ . ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ i L v C8 v C3 i R1 i pc i gc V bias V start ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠

Numerical Experiments

We now simulate the complete variable oscillator, sliding the ribbon from A 1 to A 6. The simulation is performed according to the power-balanced numerical scheme presented in [2] (see also the PyPHS library [11]). In order to observe the frequency changes, we choose a carrier frequency F = 10 kHz (instead of the actual 80 kHz) and perform the sweep in 2 ms (vel 1 ) or 0.5 s (vel 2 ). The simulation parameters are presented in Table 1. Due to important nonlinearities of some components, a large sample rate is chosen to avoid any aliasing. Table 2 recaps the component values. We denote C1//C2 = C3 and C13//C14//C15 = C8. Figs. 9 and 10 show the observed flows and efforts of the oscillator as the ribbon slides. Figs. 11 and12 show the states of the different storage components, reflecting the frequency changes. Figs. 14 and15 show the power balance of the complete system during the simulation. Fig. 13 shows the spectrogram of the output voltage, suggesting that the harmonic distortion is sufficiently negligible. It is also worth noting that the PHS formalism gives access to other physical parameters of the ribbon, which would otherwise prove difficult to measure. Indeed, the quantity

∇ x H cap (x, q) = -q 2 C (x) 2C 2 (x) (22)
is the force produced by the ribbon displacement (see Remark 3); Figs. 16 and 17 show that the values taken by this 3 shows the reference values.

force during the sweep are negligible no matter the sweep velocity.

INTERPRETATION AND DISCUSSION

Due to the nature of the Ondes Martenot instrument (rare, fragile, and expensive), setting up extensive measurements to evaluate the accuracy of the oscillator model is a complex operation that is still ongoing. However, a preliminary observation is that with the chosen parameters, the oscillation is quasi-sinusoidal (less than 0.1% harmonic distortion for the second harmonic), which corresponds to observations made in [15]: "on the whole ribbon range, the sinusoidal quality of the signal produced by the oscillator is excellent." Moreover, the behaviors of the components are not affected by the ribbon displacement speed and there is no latency between the ribbon displacement and the frequency changes. This suggests that for future simulations of the complete circuit, the oscillator could be modeled with a frequency-controlled sinusoidal voltage generator, which would save computation time. It can be noted, though, that the output voltage of the oscillator slightly decreases as the 3 shows the reference values. heard frequency increases, which is not the case in a real Ondes Martenot. Real instruments have a higher frequency carrier; therefore frequency modulations are relatively less important. The oscillator capacitance varies less and consequently the triode amplification, which depends on its load, is stable during the whole sweep. A second observation is that consistently with the PHS formalism, the power balance is preserved despite the nonlinearities of some components. A third observation is that the mechanical force produced by the ribbon displacement is extremely low (less than 10nN), thus presumably not detectable by the musi-cian. This is likely to be what Maurice Martenot intended as the interaction between the player and the instrument should be as smooth as possible.

CONCLUSION AND PERSPECTIVES

In this paper a refined simulation of the ribbon-controlled oscillator of the Ondes Martenot has been proposed, allowing a numerical investigation of this circuit. It is based on energy-balanced modeling adapted to LTI (capacitors, resistor, inductor) and non-LTI (vacuum tube and the multiphysical time-varying capacitor mechanically driven by a ribbon) components. One contribution of this paper is the design of a method to compute equivalent energy functions of groups of components when required, to derive a PHS state-space realization of a global circuit. This method reveals that LTI and variable capacitors in parallel build an equivalent bi-variate capacitor, depending on an electric state (total charge) and space state (ribbon position). As a second contribution, the ideal energy function for the ribbon-controlled equivalent capacitor is derived in correspondence with the target keyboard designed by Martenot. Numerical experiments on the nonlinear time-varying circuit lead to expected observations: (1) the combination of the triode amplification and LC resonator produces a quasisinusoidal oscillation with a stable amplitude for a static configuration; (2) the mechanical force produced by the variable capacitor due to the ribbon displacement is undetectable by the musician (less than 10nN) for over-speed movement (300 m/s); (3) the latency between the instantaneous frequency and ribbon position is also undetectable. This corroborates that the Martenot's ribbon-controlled circuit is close to an ideal oscillator.

Further work aims to model and simulate the complete Martenot instrument, including all its stages and the diffuseurs. Furthermore, for real-time sound synthesis purposes, the examination of anti-aliasing methods [16] could be profitable to handle the nonlinear heterodyne process at reasonable sampling rates.

C q q = i C q 2 2C q C = v C L ϕ φ = v L φ 2 2L φ L = i L w z (w) R v R vR R = i R
states are given by the variables q (charge) and ϕ (magnetic flux), respectively; the resistor R is a dissipative component described by Ohm's law. The system is current (flow) controlled; its associated output is a voltage (effort). Table 4 recaps the variables and the constitutive laws of the three components. Kirchoff's laws in receptor convention yield

⎛ ⎜ ⎜ ⎝ i C v L v R -V ⎞ ⎟ ⎟ ⎠ = ⎛ ⎜ ⎜ ⎝ 0 -1 -1 1 1 0 0 0 1 0 0 0 -1 0 0 0 ⎞ ⎟ ⎟ ⎠ . ⎛ ⎜ ⎜ ⎝ v C i L i R I ⎞ ⎟ ⎟ ⎠
Currents are flows and voltages are efforts; therefore their products are powers. Eq. ( 5) is thus naturally retrieved. Note that in this simple example, the matrix S is sparse with constant coefficients, but the properties of the PHS formalism hold for nonlinear or coupled systems, which yield more complex matrices.

A.2 PHS: Numerical Scheme for Simulations

The PHS formalism guarantees the passivity of the system in continuous time. Introducing discrete gradient in the numerical scheme [17] allows us to preserve this passivity property in discrete time, therefore granting the stability of the simulation as well. Here a one-step numerical scheme is used, yielding

x(k + 1) = x(k) + δx(k) (23)
In the mono-variate storage component case (H (x) =

) 24
The discrete energy variation is retrieved by chain derivation: δE(k)

t s = ∇ H (x, δx(k)) δx(k) t s ( 25
)
where t s is the sampling period. The simulation is achieved replacing dx dt with δx(k) ts and ∇H(x) with ∇ H (x, δx) in Eq. ( 3). This yields a dynamic equation of the form δx(k) = t s f k (x(k), δx(k)) (26) where f k is a function depending on H, z, u, and S. Its solving (using Newton-Raphson method for instance) allows us to compute x(k + 1) and y(k).

A.3 Equivalent Component Method: Examples

The method steps (SEC. 3) are detailed on two examples:

(LTI) linear time-invariant capacitors with capacitances C k , (in order to illustrate how the standard results of sec. 2 are restored and to be compared at each step to) (NL) capacitors with homogeneous laws of common degree α > 0 (nonlinear for α = 1, see Fig. 19).

Label Energy function H k

Voltage function

H k LTI H k (q k ) = q 2 k 2C k v k = H k (q k ) = qk Ck NL H k (q k ) = E k q k q 0 1+α v k = H k (q k ) = V k q k q 0 α
In the model (NL), [x] α = sign(x) |x| α denotes the signed power function and constant values q 0 (charge), E k (energy), and V k (voltage) are related by

V k = (1 + α)E k /q 0 . ( 27
)
This leads to the following sequence of derivations.

Step 1. Eq. ( 7) yields

q k = H k -1 (v k ) with (LTI):∼H k -1 (v k ) = C k v k , ( 28
) (NL):∼H k -1 (v k ) = q 0 v k V k 1/α , ( 29
)
and Eq. ( 8) yields

q C = Q C (v C ) with Q C (v C ) := H A -1 + H B -1 (v C ), (LTI):∼Q C (v C ) = (C A + C B )v C ( 30
) (NL):∼Q C (v C ) = q 0 v C V A 1/α + q 0 v C V B 1/α = q 0 v C V C 1/α , ( 31
)
with

V C = V -1/α A + V -1/α B -α
. Step 2. Eq. ( 9) yields v C = Q -1 C (q C ) with (LTI):∼Q -1 C (q C ) = q C C A + C B (32) (NL):∼Q -1

C (q C ) = V C q C q 0 α . ( 33
)
Step 3. Eq. ( 10) yields

(LTI):∼H C (q C ) = CAqC CA+CB 2 2C A + CB qC CA+CB 2 2C B = q 2 C 2(C A + C B ) ( 34
) (NL):∼H C (q C ) = k=A,B E k q 0 VC q C q 0 α Vk 1/α q 0 1+α = E C q c q 0 1+α ( 35
)
where E C is found to be related to V C as E k to V k in Eq. (27).

Note that the equivalent laws for (LTI) and (NL) have the same expression. This is not the case in general.

I. INTRODUCTION

A S the audio industry is evolving from analog to digital, the preservation of analog machines and instrumentsand with them, that of the craft of generations of engineersis proving critical [1], [2]. The concern has been especially raised about the ondes Martenot; invented in 1928 by Maurice Martenot, this pioneer electronic musical instrument [3] is no longer produced in its original form and some of its components are now obsolete, such as specific triode vacuum tubes. A solution consists of modeling its circuit and building a real-time virtual instrument, so that the community of composers, musicians and musicologists may have access to virtual facsimiles.

Several techniques are available to build virtual analog instruments (for a review, see [4]- [6]). They include Modified Nodal Analysis [7], [8], the Nodal DK method [9] (for audio applications, see e.g. [10], [11]), Wave Digital Filters [12] (see e.g. [13]- [19]). Real-time simulations of circuits with vacuum tubes have been derived from such methods [20], [21] or from time-continuous state-space representations combined with numerical schemes [22]- [25]. The approach used in this paper is based on a state-space representation, which satisfies the power balance of the physical system structured into conservative, dissipative and external parts, known as Port-Hamiltonian Systems (referred to as PHS) [26], [27]. This formulation can be combined with numerical methods that preserve the power balance structure (and passivity) in the discrete-time domain for both linear and non-linear systems. This has proved to be relevant for simulations of audio (electronic or multi-physical) systems [28]- [31]. In a previous paper [32], the first stage of the ondes Martenot circuit (a variable oscillator) has been modeled and simulated using this method, with a special focus on electro-mechanical power balance. This paper addresses the full modeling and simulation of the circuit of the ondes Martenot No. 169, which is composed of 5 coupled stages. Moreover, analyzing numerical experiments allows some model simplifications, which in turn grant access to real-time. This paper is organized as follows. Section II describes the history and the composition of the ondes Martenot as well as the way the instrument is played. In section III, the PHS formalism is briefly recalled and illustrated with a simple example. In section IV, each isolated stage is first separately modeled as a PHS and the coupling of the stages is then addressed. In section V, the physical parameters for simulation are examined and set. Section VI is devoted to off-line powerbalanced simulations of the complete circuit. Finally, in section VII, simplifications are proposed based on the analysis of numerical experiments. They lead to a reduced order PHS from which a real-time audio plug-in is built for the sound synthesis.

II. HISTORY, ORGANOLOGY, CIRCUIT AND PRINCIPLE

A. History

The advent of electrical engineering marked a disruption in many industrial domains, amongst them musical instrument making. Providing both new timbres and new playing modalities, it gave the 20th century instrument corpus its singularity. Nonetheless, instrument making is not immune to technological obsolescence, and only few of these innovative instruments are still played today. This is the case of the ondes Martenot; only 264 ondes were built, but around 1500 pieces were composed for it [33]. As they were handmade and subjected to successive enhancements, each ondes is unique and identified by a reference number. The considerable task of cataloguing and evaluating the condition of the remaining instruments has been achieved by the Musée de la Musique in Paris [34]. It appears that for some of the ondes, making them playable again would necessitate irreversible interventions. This poses a big deontological dilemma from the preservation point of view and argues in favor of building facsimiles.

B. Organology

This paper focuses on the ondes No. 169, manufactured in 1937, and kept in the Musée de la Musique in Paris. This specimen has a great heritage value, particularly because of its electronic circuit with vacuum triodes. Also, it is kept in playing conditions and is fully documented [35]. It is based on heterodyne processing, like the Theremin [36] and the Trautonium [37]. It generates a harmonic signal which feeds specific loudspeakers (called diffuseurs, Fig. 1a). The player controls the pitch with a sliding ribbon (continuous pitch change) or-in later versions of the instrument-with a mobile keyboard (discrete pitch change and vibratos, Fig. 1b). The loudness is controlled with an intensity key, by pressing a small bag containing a mixture of conductive and insulating 1a on the right, from [33]), circuit, ribbon, keyboard (Fig. 1b), intensity key with the powder bag underneath circled in red (Fig. 1c).

powders. This key operates as a rheostat [38] (Fig. 1c). Thanks to this intensity key, the instrument's expressiveness has been praised since its creation. However, the lack of robustness of its circuit (subject to drifting, particularly in older models) is dreaded by musicians (called ondists) who are accustomed to perform repairs on the fly before concerts.

C. Circuit and operation

The technique of heterodyning was developed originally for wireless telegraphy [39], in order to shift high frequency signals into the audio domain. In the ondes Martenot specifically, two oscillators generate quasi-sinusoidal voltages at high frequency; one is set to 80 kHz and the other, variable below 80 kHz, is controlled by the player. Their sum is an amplitude-modulated signal, whose envelope is detected with a triode vacuum tube in series with an RC circuit. The envelope fundamental frequency, equal to the difference between the oscillators' frequencies, lies in the audible frequency range. The resulting voltage is amplified through two successive triode vacuum tubes, which increase the harmonic distortion present in the signal, due to their non-linear characteristics.

Finally, the diffuseur, selected by the player, converts the electrical waveform into sound and in turn modifies its spectral content. The complete circuit is structured into five stages devoted to specific functionalities (see Fig. 2a), namely : (1) fixedfrequency oscillator, (2) variable-frequency oscillator, (3) demodulator, (4) preamplifier, and (5) power amplifier. These stages are connected through transformers that introduce coupling: this will be naturally taken into account in the global PHS model (addressed in section IV-C). However, in first step, these stages are presented separately, ignoring coupling (no load on the secondary winding, 2b-2d). Qualitative specificities of these stages are stated below.

1) Oscillators: In both oscillators, a voltage noise V start at the triode grid is amplified by the triode vacuum tube and filtered by a LC circuit, before feeding the grid through a transformer of ratio P . Each transformer has two windings on the secondary; the second secondaries (for oscillators 1 and 2) are connected in series to form the demodulator voltage input.

2) Demodulator: The voltage input, equal to the sum of the oscillators' outputs, can be assimilated to an amplitudemodulated sinewave: cos(Φ) + cos(Φφ m ) = 2 cos(Φφ m /2)cos(φ m /2), where F = Φ/2π = 80 kHz is the fixed oscillator frequency, f m = φm /2π is the target frequency, and Ff m is the variable oscillator frequency. The demodulator is composed of a triode vacuum tube in series with an RC circuit (R 4 and C 21 on Fig. 2c). As the triode grid polarization is close to zero, the qualitative behavior of the triode between the grid and the cathode is that of a diode: grid current only appears for positive grid voltages (Fig. 3). The triode vacuum tube is loaded with capacitors in parallel with a transformer. This load forms a resonant bandpass RLC filter (Fig. 2c): the resistance R p models the transformer losses, L p is the primary inductance, C dem is the equivalent capacitor of C 9 and C 10 in parallel. Its resonance frequency lies in the audible range. The stage amplification in a common cathode pattern increases with the triode load. As a consequence, the oscillators' frequencies and their intermodulation products are filtered out before amplification.

3) Preamplifier and power amplifier: Both stages rely on the triode vacuum tube amplification properties in a common cathode pattern [40].

III. POWER-BALANCED MODELING

A. Framework

Detailed presentations of PHS are available in [27]. Here we rely on a differential-algebraic formulation adapted to multiphysical systems [30], which allows the representation of a dynamical system as a network of 1) components storing energy E as a regular definite nonnegative function of their state x (E = H(x) ≥ 0), 2) instantaneous dissipative components for which efforts e w are related to flows w through a constitutive law z that dissipates power (e w = z(w), P diss = z(w) w ≥ 0, ∀w), 3) connection ports as control inputs u and their associated outputs y such as u y is the outgoing power P ext .

(a) Schematics of the complete circuit of the ondes No. 169 (as is from [35]). V in V out Fig. 3: Equivalent small signal schematic of the demodulator. The nodes c, g and p denote the triode cathode, grid and plate respectively; r a is the triode plate resistor.

C k R k Cosc 6F5 1 : P Losc V bias V start 6F5 V out (b) C k R k C dem Rp V bias Lp 6C5 R 4 C 21 V out V in (c) C k R k Rp V bias Lp 6C5 V out V in (d) C k R k Rpw V bias 2A3 V out V in (e)
The variables are generally time-dependent. For each component, ẋ accounts for the incoming state flow. It is named "flow" in the following. 1 Jointly, ∇H(x) is named "effort" (w.r.t. the state) in the following, so that the power received by the energy-storing component ẋ∇H(x) is the product of an effort and a flow. If such a system is realizable [41], [42], the exchanges of generalized flows and efforts between the

C q q = i C q 2 2C q C = v C L φ φ = v L φ 2 2L φ L = i L w z(w) R v R v R R = i R
so we have the following power balance:

dE dt = -P ext -P diss . (5)
Note that -P ext is the incoming power (since P ext is the outgoing power). The passivity of the system stems from this power balance and the positivity of P diss .

B. Example

Consider a linear parallel RLC circuit (Fig. 4). The capacitor C and the inductor L are storage components whose states are given by the variables q (charge) and φ (magnetic flux) respectively; the resistor R is a dissipative component described by Ohm's law. In order to represent it as a PHS, the system is chosen to be current controlled. Table I recaps the variables and the constitutive laws of the three components. Based on Kirchoff's laws, matrix S relating efforts (E) to flows (F) in Eq. ( 1) is found to be Flows which are currents (resp. voltages) have associated efforts which are voltages (resp. currents). Therefore their products are powers and Eq. ( 3) is naturally retrieved. Note that in this simple example, the matrix S is sparse with constant coefficients, but the properties of the PHS formalism also hold for non-linear or coupled systems (state depending interconnection matrices, non-quadratic H, non-linear z).

IV. ONDES MARTENOT PHS MODELING

A. Ondes Martenot components

The ondes Martenot circuit contains resistors, capacitors, inductors, transformers, and triode vacuum tubes. Among those components, the ribbon-controlled capacitor and the triode need to be carefully modeled to satisfy a physical power balance and to admit a PHS formulation. 1) Ribbon-controlled capacitor: The variable capacitor C 15 (Fig. 2a) is controlled by a partly conductive ribbon: as the player moves the ribbon along, it hides or "activates" the teeth of the comb-shaped electrical conductor, located at different distances from the ribbon (Fig. 5). Previous work [32] showed that the LTI capacitors C 13 , C 14 but also the variable capacitor C 15 in parallel (Fig. 2a, stage 1) are equivalent to a single variable capacitor whose energy function is given by

H cap (q, d) = q 2 2C osc (d) , (6)
C osc (d) = 1 4π 2 F -A 1 2 d 12d 0 2 L osc , (7)
where d is the ribbon displacement relative to the position corresponding to the lowest note A 1 , d 0 is the ribbon displacement for one semitone, F is the fixed oscillator frequency and L osc is the inductance of the oscillator.

2) Triode vacuum tubes: Numerous models are available for triode vacuum tubes [43], [44]. For audio applications, the Norman Koren model [45] has proven to be accurate. Here we will rely on an enhanced Norman Koren model [46] which takes into account the triode grid current. Although this current is small compared to that of the plate, it must be considered to ensure the passivity of the component (since its power supply is external, the triode is indeed passive). As a result, the triode vacuum tube is a dissipative component with w = (v pc , v gc ) and z θ (w) = (i pc , i gc ) , where p, g and c respectively refer to the triode plate, grid and cathode. The plate current i pc and the grid current i gc are given by

i pc = 2[E 1 v pc , v gc ] Ex /K g if E 1 ≥ 0 0 else, (8)
i gc =      0 if v gc < V a v gc -V a R gk else, (9)
with

E 1 v pc , v gc = v pc K p ln      1 + exp     K p    1 µ + v gc + V ct K vb + v 2 pc             .
For each type of vacuum tubes used in the circuit of ondes Martenot No. 169, the set of constant parameters (d) Fig. 7: PHS interconnection matrices of the isolated stages: oscillators (Fig. 7a), demodulator (Fig. 7b), preamplifier (Fig. 7c), power amplifier (Fig. 7d).

B. Coupling transformer characteristics

Except for its ratio, the properties of the transformer between stage 3 (resp. 4) and 4 (resp. 5) are unknown and accessing a real circuit to perform measurements has proven to be delicate due to the instrument rarity and fragility. It is assumed that Maurice Martenot chose the transformers with audio applications in mind; the magnetizing reactance L p and the resistance modeling the core losses R p will be thus set as such in the following. The capacitor C dem in parallel with R p and L p (Fig. 2c) forms a current-current band-pass filter, whose high cutoff frequency is given by f ch = (r a + R p )/(2πr a R p C dem ), with C dem = 7 nF and r a = 10 kΩ. The instrument ambitus is C1-B7 corresponding to a fundamental frequency ranging from 32 Hz to 3951 Hz in A440 tuning. Therefore, choosing f ch = 7.9 kHz (the highest possible note second harmonic) yields R p ≈ 4 kΩ. Similarly, the low cutoff frequency is given by f cl = (r a R p )/(2π(r a + R p )L p ). Choosing f cl = 50 Hz yields L p ≈ 9 H. It is assumed that the transformer to the power amplifier has the same properties. The values of the other circuit parameters are provided by the condition report of the ondes No. 169 [35].

C. GUI, real-time results and performances

The dimension of the complete PHS is defined as n =dim E =dim F. For each sample and each element, the matrix update computes n multiplications and n -1 additions, and consequently F s ×n(2n-1) floating operations per second (flops). Before the circuit simplification, the PHS contains 32 component variables, 5 voltage supply ports, 2 inputs ports and 1 observation port. Using F s = 768 kHz and n = 40 requires 2.42 Gflops. After the circuit simplification and the frequency reduction, 17 component variables and 3 ports are removed leading to n = 20. For F s = 192 kHz, this requires 149 Mflops (gain of about 16). The simplified PHS is implemented in the JUCE framework using the PyPHS library to generate C++ code [54]. The player controls the pitch and sound intensity either with sliders or with commercial midi interfaces. Additionally, the user has the possibility to adjust the quantity of harmonics by changing the demodulator input gain (a feature not present on the original instrument). While running, the plugin consumes 85% CPU (i7-2720QM CPU at 2.20 GHz) and 0.9% RAM (4Go), which is still quite heavy but allows real-time usage.

VIII. CONCLUSION AND PERSPECTIVES

In this paper, a refined simulation of the ondes Martenot circuit has been proposed, allowing a numerical investigation. It is based on a power-balanced modeling adapted to LTI (capacitors, resistor, inductor) and non-LTI (vacuum tubes and the multi-physical time-varying capacitor mechanically-driven by a ribbon) components. Due to the nature of the ondes Martenot instrument (rare, fragile and expensive), setting up extensive measurements to evaluate the accuracy of the circuit modeling is a complex operation which is still ongoing. However, numerical experiments on the modeled circuit lead to the following observations:

1) the combination of the triode vacuum tube amplification properties and the LC-resonator produces a quasisinusoidal oscillation with stable amplitude; 2) the contribution of the power amplifier is minor in terms of coloration compared to that of the preamplifier; 3) the overall result does not depend on the carrier frequency value, provided that this frequency stays outside the audio domain. In consequence, the oscillators are replaced with sinewave generators, the power amplifier is replaced with a multiplying factor, and the sampling frequency is lowered by a factor of 4. These simplifications lead to the implementation of the circuit within a controllable audio plugin, functioning in real-time on a common computer.

Further work aims to model the diffuseurs and the control interfaces (ribbon and intensity key). Moreover, this work will rely on anti-aliasing methods [58] to handle the non-linear heterodyne process at lower sampling rates.

6

  PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator 6.1 Koopman operator overview . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Koopman operator for continuous-time systems . . . . . . . . . . . . . . . 6.3 PH-ODE realization in lifted space . . . . . . . . . . . . . . . . . . . . . . . 6.4 Application: identification of a diode clipper circuit . . . . . . . . . . . . . 6.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 . 8

 38 Graph of function f : x → ln 2 cosh (x)x tanh (x). . . . . . . . . . . . . 3.9 Graphs of energy function, internal magnetic field, and internal temperature for the ferromagnetic core. . . . . . . . . . . . . . . . . . . . . . . . . . 3.10 Coil represented as a converter between electric and magnetic domains. . 3.11 Connection of a coil and a core. . . . . . . . . . . . . . . . . . . . . . . . . . 3.12 Barkhausen jumps and resulting hysteresis during a cycle, with and without damping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.13 Voltage-controlled ferromagnetic coil: equivalent circuit and corresponding PHS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.14 Fasel Yellow and Fasel Red inductors. . . . . . . . . . . . . . . . . . . . . . 3.15 Experimental setup for measurements on an inductor . . . . . . . . . . . . 3.16 Fasel Yellow and Red constitutive laws in linear regime: measurements and models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.17 Fasel Yellow and Red constitutive laws in nonlinear regime: measurements models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.18 Highpass filter: PHS, output and power balance during simulation. . . . . 3.19 Transformer: circuit schematics, PHS and simulated outputs. . . . . . . . .4.1 Resistive opto-isolator: component and schematics. . . . . . . . . . . . . . 4.2 Photoresistor: component, 2-port representation, and energy levels of carriers before and after photoabsorption. . . . . . . . . . . . . . . . . . . . . . 4.3 N-doped material: energy levels of carriers before and after photoabsorption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Tetrahedral lattice with bound and ionized doping sites. . . . . . . . . . . 4.5 Possible states and transitions for a n-doped photoresistor. . . . . . . . . .

viii 4 . 6

 46 Photoresistor internal dynamics: equivalent circuit schematics and corresponding PHS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Photoresistor macroscopic model. . . . . . . . . . . . . . . . . . . . . . . . . 4.8 Typical spectral response of an optocoupler. . . . . . . . . . . . . . . . . . . 4.9 Optical power conversion from LED photoemission to photoresistor photoabsorption: equivalent circuit schematics, corresponding PHS and reduced PHS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10 Photoresistor static resistance as a function of steady state. . . . . . . . . . 4.11 Photoresistor static resistance vs LED current for a resistive opto-coupler (datasheet). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.12 Voltage-controlled resistive opto-isolator: schematics and corresponding PHS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.13 Resistive opto-isolator: PHS accounting for temperature. Dots represent zeros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.14 Experimental setup for measurements on a Vactrol. . . . . . . . . . . . . . 4.15 Photoresistor turn-off: measurements and model. . . . . . . . . . . . . . . 4.16 Carrier generation flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.17 Validation of the dynamic model: photoresistor turn-on and resistance vs LED current after 800 ms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.18 Optical resistors: total dissipated power and total effort. . . . . . . . . . . 4.19 Generic optical compressor: schematics and corresponding PHS. . . . . .4.20 Optical compressor: simulation results. . . . . . . . . . . . . . . . . . . . . 5.1 Graph of function sinc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Example of radial kernel and resulting basis. . . . . . . . . . . . . . . . . . 5.3 Resulting interpolations and corresponding relative errors with different kernels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Interpolation results and corresponding relative error for different kernel scalings ρ. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 Standard deviation of the model coefficients estimated from noisy data, for different kernel scalings ρ. . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 Passive peaking EQ: schematics, frequency response and theoretical PHS. 5.7 Passive peaking EQ: chosen radial basis for the inductor and resulting approximation of the test effort. . . . . . . . . . . . . . . . . . . . . . . . . . 5.8 Passive peaking EQ: estimation results with Signal Noise Ratio (SNR) = 50 dB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.9 Simulated state Normalized Mean Square Error with respect to measured state SNR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.10 Passive peaking EQ: measured and simulated state for different inputs with SNR = 50 dB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 3 1. 2 5 1. 3

 13253 Virtual analog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port-Hamiltonian systems . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.1 PH-DAE formulation . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.2 PH-ODE reduction . . . . . . . . . . . . . . . . . . . . . . . . . . Numerical scheme for simulations . . . . . . . . . . . . . . . . . . . . . 6

FIGURE 1 . 1 :

 11 FIGURE 1.1: RLC circuit in series: schematics and PHS.

0 (FIGURE 1 . 2 :

 012 FIGURE 1.2: Corresponding PHS.

. 12 )

 12 Moreover, due to the positivity of z(w[k]) w[k], the system is passive. Denoting ν = δx[k] f s , w[k] , the discretization of Eq. (1.1) yields the implicit equation F (ν) := ν -S e(ν, x[k], u[k]) = 0,

FIGURE 2 . 1 :

 21 FIGURE 2.1: Examples of microstates for different systems.

Chapter 2 .

 2 Macroscopic PHS of Systems described by Statistical Physics (A) Fixed number of particles and fixed volume. (B) Fixed number of particles.(C) Fixed volume.

FIGURE 2 . 2 :

 22 FIGURE 2.2: Examples of experimental conditions for a gas in a tank.

  a) Eq. (2.20), (b) Eq. (2.13), (c) Eq. (2.18a), and (d) Eqs. (2.9)-(2.14).

3 . 1 p 4 .

 314 (a) Partition F = F 0 ∪ F 1 into the set F 0 of functions the values of which are physically constrained by the experiment and its complement F 1 , with corresponding sets of indices I 0 and I 1 . (b) Denote θ 0 := (F 0 i ) i∈I 0 ⊂ X i∈I 0 F i the set of experimentally admissible values for functions (F i ) i∈I 0 (c) Denote M a θ 0 the corresponding set of admissible microstates. Stochastic description For all probability distributions p : M a θ 0 → [0, 1], (a) Derive the surprisal S b p : m ∈ M a (θ 0 ) → log b (m) ∈ R + (b) Derive the statistical entropy function S b : p → E p [S b p ] ∈ 0, 1 card M a (θ 0 ) Boltzmann principle for ergodic systems at thermodynamic equilibrium (a) Introduce θ 1 := F i i∈I 1 the values of functions in F 1 observed at a macroscopic sale (b) Define p m | H θ 1 according to Th. (1). (c) Define the thermodynamic entropy function S b : θ 1 → S b p . | H θ 1

FIGURE 3 . 1 :FIGURE 3 . 2 :

 3132 FIGURE 3.1: Magnetic moment of a loop of current i and area s directed by i.

FIGURE 3 . 3 :

 33 FIGURE 3.3: Example of micro-state for a ferromagnetic core with N = 9 moments. A positive moment is represented as a red triangle, a negative moment as a blue one.

  Corresponding exchange matrix. Dots represent zeros.

FIGURE 3 . 4 :

 34 FIGURE 3.4: Toroidal ferromagnetic core with N = 9 moments having q = 4 nearest neighbors, and corresponding exchange matrix.

FIGURE 3 . 5 :

 35 FIGURE 3.5: Example of spontaneous symmetry breaking.

FIGURE 3 . 6 :

 36 FIGURE 3.6: Axis of symmetry with respect to the Hamiltonian (dashed) for a ferromagnetic core with N = 2 moments. The states of lowest energy are not on the symmetry axis.

FIGURE 3 . 7 :

 37 FIGURE 3.7: Example of subsets M + and M -for a ferromagnetic core with N = 2 moments.

FIGURE 3 . 8 :

 38 FIGURE 3.8: Graph of function f : x → ln 2 cosh (x)x tanh (x).

. 26 )FIGURE 3 . 11 :

 26311 FIGURE 3.11: Connection of a coil and a core.

  (3.17b)-(3.19)-(3.26)-(3.31) and Kirchhoff's laws. That leads to the formulation on Fig. 3.13b, which corresponds to the equivalent circuit on Fig. 3.13a.

FIGURE 3 . 13 :

 313 FIGURE 3.13: Voltage-controlled ferromagnetic coil: equivalent circuit and corresponding PHS.

FIGURE 3 . 14 :

 314 FIGURE 3.14: Fasel Yellow and Fasel Red inductors.

FIGURE 3 . 15 :

 315 FIGURE 3.15: Experimental setup for measurements on an inductor,where the core is represented in the electric domain for simplicity.

FIGURE 3 . 16 :

 316 FIGURE 3.16: Fasel Yellow and Red constitutive laws in linear regime: measurements and models.

Figures 3 .

 3  show the results of that minimization for v 0 = 50 mV. In the following, the estimated value of r coil is used to compute Φ L according to Eq.(3.33).In order to estimate the model parameters in nonlinear regime, a simplified model is used. First, we assume that the temperature stays constant throughout the measurements, so that we can use the free energy of the core F(T, B V core ) = E core (S, B V core ) -T S and remove the entropy from the state. The core effort becomes

  .37) (A) Fasel Yellow constitutive law in nonlinear regime (v 0 = 150 mV): measurements and model. (B) Fasel Yellow constitutive law in nonlinear regime (v 0 = 300 mV): measurements and model. (C) Fasel Red constitutive law in nonlinear regime (v 0 = 150 mV): measurements and model. (D) Fasel Red constitutive law in nonlinear regime (v 0 = 300 mV): measurements and model.

FIGURE 3 . 17 :

 317 FIGURE 3.17: Fasel Yellow and Red constitutive laws in nonlinear regime: measurements at T = 303K and models.

Chapter 3 .

 3 Ferromagnetic Coils and Transformers

57 4 . 4 . 3

 443 Optical resistors dissipation law . . . . . . . . . . . . . . . . . . 60 4.5 Resistive opto-isolator complete model . . . . . . . . . . . . . . . . . . 61 4.6 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.6.1 Identification of a Vactrol from measurements . . . . . . . . . . 63 4.6.2 Simulation of an optical compressor . . . . . . . . . . . . . . . . 66 4.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Chapter 4 .

 4 Resistive Opto-Isolators(A) Resistive opto-isolator. Schematics of a resistive opto-isolator.

FIGURE 4 . 1 :

 41 FIGURE 4.1: Resistive opto-isolator: component and schematics.

  Photoabsorption ≥ e g

FIGURE 4 . 2 :

 42 FIGURE 4.2: Photoresistor: component, 2-port representation, and energy levels of carriers before and after photoabsorption.

FIGURE 4 . 3 :

 43 FIGURE 4.3: N-doped material: energy levels of carriers before and after photoabsorption.

FIGURE 4 . 4 :

 44 FIGURE 4.4: Tetrahedral lattice with bound and ionized doping sites.

. 10 )

 10 which corresponds to the homogeneous Iverson model[START_REF] Arthur | The mathematical modeling of time-dependent photoconductive phenomena in semiconductors[END_REF] 1 .

  photoabsorption of e g

FIGURE 4 . 5 :

 45 FIGURE 4.5: Possible states and transitions for a n-doped photoresistor with Shockley-Read-Hall recombination (above), and equivalent representation (below).

  Corresponding PHS. Dots represent zeros.

FIGURE 4 . 6 :

 46 FIGURE 4.6: Photoresistor internal dynamics: equivalent circuit schematics and corresponding PHS.

FIGURE 4 . 7 :

 47 FIGURE 4.7: Photoresistor macroscopic model.

FIGURE 4 . 8 :

 48 FIGURE 4.8: Typical spectral response of an optocoupler(extracted from[START_REF]Photoconductive cells and analog optoisolators (Vactrols)[END_REF]).

FIGURE 4 . 9 :

 49 FIGURE 4.9: Optical power conversion from LED photoemission to photoresistor photoabsorption: equivalent circuit schematics, corresponding PHS and reduced PHS.

FIGURE 4 . 10 :

 410 FIGURE 4.10: Photoresistor static resistance as a function of steady state.

FIGURE 4 . 11 :

 411 FIGURE 4.11: Photoresistor static resistance vs LED current for a resistive opto-coupler (datasheet).

.29a) e r opt 1 =

 1 γ e i D + γ a f gen , e r opt 2 = -γ a f gen . (4.29b) From Eqs. (4.1)-(4.27), we deduce z f r opt 1 , f r opt 2 = γ e I D (γ e f r opt 1 ) + γ a ϕ gen • I D (γ e f r opt 1 ), -γ a ϕ gen • I D (γ e f r opt 1 ) .

4. 5 .

 5 Resistive opto-isolator complete model 61 value of e R LDR is attained for steady states Q + st and Q - st . Then from Eqs. (4.1)-(4.12)-(4.20)-(4.26)-(4.27), we deduce a condition on C LDR for the model to be passive:

  Voltage-controlled resistive opto-isolator: equivalent circuit schematics. The photoresistance R is modulated by the states of C + and C -.

FIGURE 4 . 14 :

 414 FIGURE 4.14: Experimental setup for measurements on a Vactrol.

FIGURE 4 . 15 :

 415 FIGURE 4.15: Photoresistor turn-off: measurements and model.

  The set θ LDR can now be reinjected in Eqs. (4.20)-(4.22) to obtain the function R. The set of parameters θ

FIGURE 4 . 16 :

 416 FIGURE 4.16: Carrier generation flow.

FIGURE 4 . 17 :

 417 FIGURE 4.17: Validation of the dynamic model: photoresistor turn-on and resistance vs LED current after 800 ms.

  (A) Graph of function C. The value of C LDR must be above its maximum for the resistive opto-coupler to be passive. (B) Optical resistors total dissipated power for an adequate C LDR .(C) Optical resistors total effort compared to LED dissipative law.

FIGURE 4 . 18 :

 418 FIGURE 4.18: Optical resistors: total dissipated power and total effort.

  Schematics of a minimal optical compressor (OPA power supplies are dashed).

FIGURE 4 . 19 :

 419 FIGURE 4.19: Generic optical compressor: schematics and corresponding PHS.

  (A) Optical compressor: simulated output with R 1 = 100 kΩ. (B) Optical compressor: simulated output with R 1 = 1 kΩ. (C) Optical compressor: simulated output, attack. (D) Optical compressor: dissipated power during simulation. (E) Optical compressor: compression ratio for different values of R 1 and fixed R 2 . (F) Optical compressor: compression curve for different values of C.

FIGURE 4 . 20 :

 420 FIGURE 4.20: Optical compressor: simulation results.

FIGURE 5 . 1 :

 51 FIGURE 5.1: Graph of function sinc.

  .11) 80 Chapter 5. PH-ODE Modeling Based on Optimal Energy Reconstruction from Data (A) Radial kernel. (B) Corresponding radial basis.

FIGURE 5 . 2 :

 52 FIGURE 5.2: Example of radial kernel and resulting basis.

  (A) Wendland and Multiquadric kernels. (B) Resulting interpolation of f (x) = sin(2 π x) + sin(6 π x) + sin(10 π x) + 4 with different kernels. (C) Corresponding relative error. (D) Resulting interpolation of f (x) = x 2 + 0.1 with different kernels. (E) Corresponding relative error.

FIGURE 5 . 3 :

 53 FIGURE 5.3: Resulting interpolations and corresponding relative errors with different kernels for a function with dips (Figs. 5.3b-5.3c) and a convex function (Figs. 5.3d-5.3e).

FIGURE 5 . 4 :

 54 FIGURE 5.4: Interpolation results and corresponding relative error for different kernel scalings ρ.

FIGURE 5 . 5 :

 55 FIGURE 5.5: Standard deviation (see Eq. (5.18)) of the model coefficients estimated from noisy data, for different kernel scalings ρ.

  A) Passive peaking EQ: schematics. (B) Passive peaking EQ: frequency response for several wiper positions.

  C) Passive peaking EQ: theoretical PHS.

FIGURE 5 . 6 :

 56 FIGURE 5.6: Passive peaking EQ: schematics, frequency response and theoretical PHS.

  (A) Passive peaking EQ: capacitor measured and simulated state. (B) Passive peaking EQ: capacitor theoretical and estimated effort. (C) Passive peaking EQ: inductor measured and simulated state. (D) Passive peaking EQ: inductor theoretical and estimated effort.

FIGURE 5 . 8 :

 58 FIGURE 5.8: Passive peaking EQ: estimation results with SNR = 50 dB.

FIGURE 5 . 9 :FIGURE 5 . 10 :

 59510 FIGURE 5.9: Simulated state Normalized Mean Square Error with respect to measured state SNR.

Property 7 (Property 8 ..

 78 a) the time derivative definition and the Lipschitz assumption, (b) the semi-group property given in Eq. (6.6), and (c) Def.(7). Linearity of the Koopman operator infinitesimal generator). The infinitesimal generator L is also a linear operator (from linearity of the differential operator). If f is Lipschitz continuous, an observable φ verifies along the flow of f L φ = ∇φ • f , Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator

. 31 )

 31 Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator Proof.

  ) the definition of z and the chain rule, (b) the dynamics described by Eq. (6.27), (c) the definition of E given in Eq. (6.29a), (d) the definition of z again and the inverse map given in Eq. (6.29b). As J = ∂φ(C z) from the anti-symmetry of J, R = ∂φ(C z)

. 37 )

 37 Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator Parameter estimation Denote f [k] the measured flow in lifted space at sample k f [k] = δz[k] f s y[k] , (6.38) with f s the sample rate, δz[k] = z[k + 1]z[k], and y[k] = y[k + 1] + y[k] /2. Similarly, denote Θ = (J, R, D, G s,1 , . . . , G s,N u , G p,1 , . . . , G p,N u ) and f (Θ)[k] the estimated flow at sample k f

. 47 )

 47 Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator (A) Diode clipper: measured and simulated state. (B) Diode clipper: dissipated power in lifted space with unconstrained Koopman operator. (C) Diode clipper: dissipated power in lifted space with constrained Koopman operator.

FIGURE 6 . 3 :

 63 FIGURE 6.3: Diode clipper: simulated state and dissipated power in lifted space.

(

  FIGURE A.1: Construction of the first Legendre transform of f according to Def. (9), and resulting graph.

3 )

 3 Consider a constrained optimization problem of the form minimize f (x) subject to Ax b. (D.1) This can be reformulated as minimize f (x) a slack variable. Denote I b the identity matrix of dimension dim(b), 0 b a vector of dim(b) zeros, A = [A, I b ], x = [x, s] , and f (x) = f (x), 0 b . Then problem (D.2) is equivalent to minimize f (x) To solve (D.3), introduce the loss function L L : (x, λ) -→ f (x) + λ Axb -

FIGURE D. 1 :

 1 FIGURE D.1: Logarithmic barrier for several values of parameter t.

Example 6 . 2 x

 62 Consider the constrained (convex) optimization problem minimize 1 Qx + cx subject to Ax b, (D.8)

  Figures D.2a-D.2d show the results obtained for different initial values and different t.With a low t, the estimated solution respects the constraint even if the initial value does not (Figs. D.2a-D.2c). On the contrary, with a high t, the estimated solution is the absolute minimum and does not respect the constraint, even if the initial value does (Figs. D.2b-D.2d).

21 in 21 203

 2121 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx-20), Vienna, Austria, September 8-12, 2020 3.1.1. Macroscopic quantities and laws

  6) with core constants E0 = N α, S0 = N kb and BV s = V µ0Ms. The energy gradient (effort) is ∇Ecore = [Hcore, Tcore] ⊺ ,

Figure 1 :

 1 Figure 1: Core energy function with respect to BV and S.

  ) with à such as Ã⊺ A = 0 to eliminate the constraint, Br = Ã⊺ B, z = Ã⊺ x, EL the total energy with respect to z. Taking à = [1, 1] ⊺ , this yields Br = 1 and z = BV coil + BV core . Therefore, for any given entropy S, the dynamics of the coupled system is that of an equivalent component of state xL = [BV L , S], energy EL(xL) and magnetic field HL = ∂ E L ∂B V L

21 in

 21 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21 205 (a) Gibbs free energy G H0 for H0 decreasing from Hmax (green curve) to Hcoerc (solid blue curve), at constant temperature, and trajectory of B V L (black curve) for a complete cycle. In the yellow area, two local potential minima coexist but only one direction is possible for B V L to follow (blue arrows). (b) Observed state B V L during a complete cycle, resulting in Barkhausen jumps (blue curve), and theoretical effort ∂ E L ∂B V for B V ranging from min(B V L ) to max(B V L ) (red curve). The area between the blue and red curves is the energy dissipated during a cycle.

Figure 3 :

 3 Figure 3: Gibbs free energy GH 0 for decreasing values of magnetic field H0 (3a), and observed state BV L during a complete cycle of magnetic field variations (3b).

Figure 4 :

 4 Figure 4: Voltage-controlled ferromagnetic coil with thermal dissipation.

21 in 21 206

 2121 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx-20), Vienna, Austria, September 8Measurements setup (thermal dissipation not represented). (b) Measured H L and M .

Figure 5 :

 5 Figure 5: Measurements setup and results.

Figure 6 :

 6 Figure 6: Core energy and coupled system equivalent energy computed with piecewise affine functions.

DAFx. 5 DAF 2 x 21 in 21 207

 522121 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx-20), Vienna, Austria, September 8-12, 2020

Figure 7 :

 7 Figure 7: PHS of the voltage-controlled ferromagnetic coil with thermal dissipation. Dots in the interconnection matrix indicate zeros.

Figure 8 :

 8 Figure 8: Measurements (red curve) and estimated spline model (blue curve).

  -7 1.38.10 -23 150 2.22.10 -7 -1 1

Figure 9 :

 9 Figure 9: Passive high-pass filter.

  is then approximated at sample k replacing ẋ with δx[k]/h, ∇E(x) with ∇E(x[k], δx[k]), w with w[k], u with u[k] and y with y[k].

6 DAF 2 x 21 in

 6221 The state x[k+1] is then computed usingx[k+1] = x[k]+δx[k].DAFx.Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21 208 (a) Measured and simulated currents. (b) Measured and simulated voltages. (c) Simulated entropy flows. (d) Simulated temperature. (e) Bass sample spectrogram. (f) Filtered bass sample spectrogram.

Figure 11 :Table 3 :

 113 Figure 11: Simulation results.

[ 1 ] 7 DAF 2 x 21 in 2 V

 172212 David C Jiles and David L Atherton, "Theory of ferromagnetic hysteresis," Journal of Magnetism and Magnetic Materials, vol. 61, no. 1-2, pp. 48-60, 1986.[2] David C Hamill, "Gyrator-capacitor modeling: a better way of understanding magnetic components," in Proceedings DAFx.Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21 209 A. DEFINITION OF THE BI-STABLE MODEL OBSERVED EFFORT LAW HL Denoting BV L 0 ≥ 0 such as ∂ 2 E L ∂B L (BV L 0 ) = 0 (Fig. 3b, green cross), and BV L 0 ≤ 0 such as ∂ E L ∂B V L ( BV L 0 ) = Hcoerc (Fig. 3b, green plus), one can define HL as: HL(BV L ) =    -sign(dBV L )Hcoerc BV L ∈ [BV L inf , BV L sup ] ∂ E L ∂B V L otherwise , where [BV Linf , BV L sup ] = [ BV L 0 , BV L 0 ] if dBV L ≤ 0 and [-BV L 0 , -BV L 0 ]

Fig. 1 .

 1 Fig. 1. Possible micro-state m of a core with N = 9 moments.

Fig. 2 .Fig. 3 .

 23 Fig. 2. Energy function of the core.

Fig. 5 .Fig. 6 .

 56 Fig. 5. Equivalent circuit and PHS for the effort-controlled core.

Fig. 8 .

 8 Fig. 8. Experimental setup and comparison to measurements for a Fasel Red inductor.

  Fig. 9. Circuit, PHS, and simulation results for the passive band-pass filter.

Fig. 10 .

 10 Fig. 10. Circuit, PHS, and simulation results for the transformer.

  Several physical modeling techniques have been developped over the years: see e.g. Ersal et al. (2008) for an overview. In this paper, we consider in particular the statespace form known as port-Hamiltonian systems (PHS) introduced in Maschke et al. (1992); van der Schaft et al.

  Eberard and Maschke (2004); Eberard et al. (2007); Ramirez et al. (2013); Delvenne and Sandberg (2014)

Case 1 : 7 )

 17 system thermally insulated. From (2), E[Ψ ] = Ψ 0 . The Lagrangian simplifies, and solving ∂L = 0 yields the equiprobable distribution:p m | Ψ 0 = 1 /Ω, Ω = card (M a ) .(Case 2: system in thermal contact. Solving ∂L = 0 yields:

  Gas in a porous tank with a piston, -µ0N (m) = R0 thermally insulated

Step 3

 3 Compute the corresponding micro-state probability distribution at equilibrium. Step 4 Compute the internal energy Ē and the macroscopic state x = [S, N, V ] . Step 5 Express the internal energy Ē as a function of the macroscopic state to obtain E(S, N, V ).

  Helmholtz free energy F (T, N, V ) = E(S, N, V ) -T S P Enthalpy H(S, N, P ) = E(S, N, V ) + P V T, P Gibbs free energy G(T, N, P ) = H(S, N, P ) -T S µ Hill energy L(S, µ, V ) = E(S, N, V ) -µN T, µ Grand potential J(T, µ, V ) = L(S, µ, V ) -T S P, µ Ray energy R(S, µ, P ) = E(S, N, V ) + P V -µN T, P, µ Guggenheim energy R(S, µ, P ) -T S = 0

73 Figure 3 .

 733 Figure 3. Energy function of the ferromagnetic core.

Figure 5 .

 5 Figure 5. Equivalent circuit and PHS for the core constrained by an external magnetic field with dissipation.

2 . 1 1

 21 dissipative components of flow w and effort z (w), such as the dissipated power Pdiss = z (w) ⊺ w is non-negative for all w; 3. connection ports conveying the outgoing power Pext = u ⊺ y where u are inputs and y are outputs. The flows f and efforts e of all components are coupled through a skew-symmetric interconnection matrix S = -S ⊺ (possibly de-DAFx.Proceedings of the 24 th International Conference on Digital Audio Effects (DAFx20in21), Vienna, Austria, September 8-10, 2021 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21 RLC circuit in series.

Figure 1 :

 1 Figure 1: RLC circuit in series and its PHS representations.

3 .

 3 Separability: the energy law is a separable function of the state, i.e. it takes the form H (x) = Nx k=1 Hk (xk) , Nx = dim (x).

4 .

 4 Smoothness: Hk is at least C 2 ∀k ∈ {1, ..., Nx}.5. Convexity: the energy law is convex, i.e. H (2) k (xk) ≥ 0 ∀k, xk, where H (2)

Figure 2 :

 2 Figure 2: Two different approximants of the same function f (x) = sin(2πx) + sin(6πx) + sin(10πx) with noisy data.

  Capacitor simulated state. (b) Capacitor estimated effort. (c) Inductor simulated state. (d) Inductor estimated effort.

Figure 5 :

 5 Figure 5: Estimation results for the virtual passive peaking EQ, with measured state SNR = 50 dB.

Figure 6 :

 6 Figure 6: Simulated state Normalized Mean Square Error with respect to measured state SNR.

Fig. 1 .

 1 Fig. 1. Schematic of the Onde 169 controllable oscillator (source: Musée de la Musique, Paris).

Fig. 2 .

 2 Fig. 2. Equivalence between two parallel capacitors and a single capacitor.

  PAPERS SIMULATION OF THE ONDES MARTENOT RIBBON-CONTROLLED OSCILLATORmeaning that the following power-balance is satisfied

Fig. 3 .

 3 Fig. 3 . (a) Voltage functions H (associated with constitutive law Eq. (6)) and (b) energy functions H for different capacitor types.

Fig. 4 .

 4 Fig.4 . Variable capacitor of the Onde Martenot with its ribbon control. h is the ribbon height, l is the width of a tooth, x is the ribbon position, and d is the distance between the ribbon and capacitor.

Fig. 5 .Fig. 6

 56 Fig. 5. Capacitance of the variable oscillator in function of the ribbon position from A 1 to A 6 .

Fig. 7

 7 Fig. 7 Constitutive law of the variable capacitor.

Fig. 8 .

 8 Fig. 8. Schematic of the simplified oscillator.

Fig. 9 .

 9 Fig. 9 . Velocity vel 1 = 384 m/s: simulated flows and efforts of the storage components, for a carrier frequency F = 10 kHz, during a sweep from A 1 to A 6 .

Fig. 10 .

 10 Fig. 10. Velocity vel 2 = 1.54 m/s: simulated flows and efforts of the storage components, for a carrier frequency F = 10 kHz, during a sweep from A 1 to A 6 zoomed on the first 2 ms.

Fig. 11 .

 11 Fig. 11. Velocity vel 1 = 384 m/s: simulated states of the storage components during a sweep from A 1 to A 6 . Table3shows the reference values.

Fig. 12 .

 12 Fig. 12. Velocity vel 2 = 1.54 m/s: simulated states of the storage components during a sweep from A 1 to A 6 zoomed on the first 2 ms. Table3shows the reference values.

Fig. 13 .

 13 Fig. 13. Spectrogram of the output voltage during a sweep from A 1 to A 6 .

Fig. 14 .

 14 Fig. 14. Velocity vel 1 = 384 m/s: power balance of the system during a sweep from A 1 to A 6 .

Fig. 15 .

 15 Fig. 15. Velocity vel 2 = 1.54 m/s: power balance of the system during a sweep from A 1 to A 6 zoomed on the first 2 ms.

Fig. 16 .

 16 Fig. 16. Velocity vel 1 = 384 m/s: mechanical flow and effort during a sweep from A 1 to A 6 .

Fig. 17 .

 17 Fig. 17. Velocity vel 2 = 1.54 m/s: mechanical flow and effort during a sweep from A 1 to A 6 .

Fig. 18

 18 Fig. 18 Parallel RLC.

N

  n=1 H n (x n ), where N is the storage components number), the discrete gradient [ ∇ H (x, δx)] n is defined by[ ∇ H (x, δx)] n = Hn (xn +δxn )-Hn (xn ) δxn if δx n = 0, H n (x n )e l s e . (

Fig. 19 .

 19 Fig. 19 . (NL) (a) Energy functions H k and (b) voltage functions H k for various degrees α (q 0 = 0.9.10 -8 C and V k = 0.5V).

Fig. 1 :

 1 Fig. 1: Different parts of the ondes Martenot : diffuseurs (Fig.1aon the right, from[33]), circuit, ribbon, keyboard (Fig.1b), intensity key with the powder bag underneath circled in red (Fig.1c).

Fig. 2 :

 2 Fig. 2: Complete circuit (top) and isolated stages simplified for modeling (bottom): oscillators (stages 1 and 2, Fig.2b), demodulator (stage 3, Fig.2c), preamplifier (stage 4, Fig.2d) and power amplifier (stage 5, Fig.2e).

Fig. 4 :

 4 Fig. 4: Current-controlled parallel RLC circuit.

Fig. 5 :

 5 Fig. 5: Variable capacitor schematics where d denotes the ribbon position (up to 1.2 m for the highest note) and (d) the distance between the ribbon and the comb teeth (around 1 mm).

1 µ ≤ P < 1 µ + 2 Fig. 8 :

 128 Fig. 8: Location of s and regimes of oscillation for P ranging between 1/µ and 1/µ + β.

Fig. 9 :

 9 Fig. 9: From top left to bottom right: simulated output voltages at stages 3 (9a), 4 (9b) and 5 with carrier residual (9c), spectrogram of the simulated output voltage at stage 5 (9d), power balance of the circuit during the simulation (9e-9f).

Fig. 10 :

 10 Fig. 10: Spectral density of the simulated fixed oscillator output voltage (10a) and spectrogram of the simulated variable oscillator output voltage during a sweep (f m = 55 Hz to 3520 Hz, 10b).

Fig. 11 :Fig. 12 :

 1112 Fig. 11: Spectral density of the simulated power amplifier output voltage for an input of 1 kHz, amplitude 20 V.

  1.1 RLC circuit in series: schematics and PHS. . . . . . . . . . . . . . . . . . . . 1.2 Corresponding PHS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Examples of microstates for different systems. . . . . . . . . . . . . . . . . 2.2 Examples of experimental conditions for a gas in a tank. . . . . . . . . . . 2.3 Possible outcomes for a coin tossed twice. . . . . . . . . . . . . . . . . . . . 3.1 Magnetic moment of a current loop. . . . . . . . . . . . . . . . . . . . . . . 3.2 Trajectories of single electrons with identical spin in 2 atoms with overlapping orbitals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Example of micro-state for a ferromagnetic core with 9 moments. . . . . . 3.4 Toroidal ferromagnetic core with 9 moments having 4 nearest neighbors, and corresponding exchange matrix. . . . . . . . . . . . . . . . . . . . . . . 3.5 Example of spontaneous symmetry breaking. . . . . . . . . . . . . . . . . . 3.6 Axis of symmetry with respect to the Hamiltonian for a ferromagnetic core with 2 moments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7 Example of subsets M + and M -for a ferromagnetic core with 2 moments.

TABLE 1 .

 1 1: Linear RLC circuit in series: state, flow, energy, and effort.

	1.2. Port-Hamiltonian systems

I Physically-Based, Power-Balanced Modeling of Nonlinear Electronic Components Chapter 2 Macroscopic PHS of Systems described by Statistical Physics Contents 2.1 Statistical physics framework overview

. . . . . . . . . . . . . . . . . 11 2.2 Microstate of a system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.1 Particle representation . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.2 Configuration space . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2.3 Associated characterizing functions . . . . . . . . . . . . . . . . 14 2.3 Experimental conditions and accessible microstates . . . . . . . . . . 15 2.4 Stochastic representation and measure of uncertainty . . . . . . . . . 16 2.4.1 Microstate stochastic description . . . . . . . . . . . . . . . . . . 16 2.4.2 Statistical entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.5 Microstate probability distribution at equilibrium and partition function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.5.1 Thermodynamic equilibrium . . . . . . . . . . . . . . . . . . . . 17 2.5.2 Maximum entropy at thermodynamic equilibrium (Boltzmann principle) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.5.3 Resulting microstate probability distribution and partition function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.5.4 Identification of Boltzmann constant . . . . . . . . . . . . . . . . 21 2.5.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.6 Final PHS model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.6.1 Macroscopic state and energy . . . . . . . . . . . . . . . . . . . . 24 2.6.2 Connection to ports . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.6.3 Conservative PHS . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

TABLE 2 .

 2 1: Statistical ensembles and associated constraints for usual experimental conditions. Ω denotes the cardinal of M a (set of accessible microstates).

3.1 Ferromagnetic coil overview . . . . . . . . . . . . . . . . . . . . . . . . 27 3.2 Ferromagnetic core

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.2.1 Micro-state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.2.2 Micro-state probability distribution at thermodynamic equilibrium and partition function . . . . . . . . . . . . . . . . . . . . . 30 3.2.3 Mean-field approximation of the partition function . . . . . . . 31 3.2.4 Macro-state and energy . . . . . . . . . . . . . . . . . . . . . . . 33 3.3 Coil modeling and interconnection with the core . . . . . . . . . . . . 36 3.3.1 Coil modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.3.2 Constraints resulting from the interconnection . . . . . . . . . . 38 3.3.3 Barkhausen jumps and dissipation . . . . . . . . . . . . . . . . . 38 3.4 Complete PHS model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.5 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.5.1 Identification of Fasel inductors and simulation of a highpass filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.5.2 Simulation of a transformer . . . . . . . . . . . . . . . . . . . . . 44 3.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

TABLE 3 .

 3 1: Fasel inductors: estimated parameters.

	Parameter	L (H) r coil (Ω) r core (Ω)	E 0 (J) S 0 (J.K -1 )	B V s (J.A -1 .m)
	Value	Yellow 0.705 16 Red 0.585 15.4	3.98 × 10 -6 29.38 9.70 × 10 -2 7.34 × 10 -6 3.98 × 10 -6 27.62 9.00 × 10 -2 9.15 × 10 -6
		∇E(x)	z(w)	u

TABLE 3 .

 3 2: Transformer: simulation parameters.

Chapter 4 Resistive Opto-Isolators Contents 4.1 Resistive opto-isolator overview . . . . . . . . . . . . . . . . . . . . . . 47 4.2 LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.3 Photoresistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4

  .3.1 Photoconductivity . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.3.2 Doping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.3.3 Photoresistor internal dynamics . . . . . . . . . . . . . . . . . .

50 4.4 Optical coupling . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . 56 4.4.1 Power conversion between the LED and the photoresistor . . . 56 4.4.2 Carrier generation flow as a function of LED current . . . . . .

TABLE 4 .

 4 1: Notations and units for the photoresistor internal dynamics.

  4.14). Voltages v A , v B , as well as currents i A and i B are measured with a precision multimeter, and voltages v D , v R LDR and currents i D , i R LDR are obtained through

TABLE 4 . 2 :

 42 Experimental setup parameters for measurements on a Vactrol.

TABLE 4 . 3 :

 43 Parameters for the Vactrol VTL5C3/2.

TABLE 4 .

 4

	.44)

4: Optical compressor: simulation parameters.

Part II Data-Driven, Power-Balanced Modeling of Nonlinear Electronic Circuits Chapter 5 PH-ODE Modeling Based on Optimal Energy Reconstruction from Data Contents 5

.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.2 Reconstruction based on Radial Basis Functions . . . . . . . . . . . . 76 5.2.1 Reproducing Kernel Hilbert Spaces . . . . . . . . . . . . . . . . 76 5.2.2 Properties of reproducing kernels . . . . . . . . . . . . . . . . . 78 5.2.3 Radial Basis Functions . . . . . . . . . . . . . . . . . . . . . . . . 79 5.3 PH-ODE parametrization and estimation . . . . . . . . . . . . . . . . . 82 5.3.1 Working hypotheses . . . . . . . . . . . . . . . . . . . . . . . . . 83 5.3.2 Energy law parametrization . . . . . . . . . . . . . . . . . . . . . 84 5.3.3 Interconnection matrix parametrization . . . . . . . . . . . . . . 84 5.3.4 Parameter estimation . . . . . . . . . . . . . . . . . . . . . . . . . 85 5.4 Application: identification of a nonlinear passive peaking EQ . . . . 86 5.4.1 Circuit overview and data generation . . . . . . . . . . . . . . . 86 5.4.2 Parameter initialization . . . . . . . . . . . . . . . . . . . . . . . 87 5.4.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Chapter 6 PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator Contents 6.1 Koopman operator overview

. . . . . . . . . . . . . . . . . . . . . . . . 6.2 Koopman operator for continuous-time systems . . . . . . . . . . . . 6.2.1 Koopman operator for autonomous systems . . . . . . . . . . . 6.2.2 Finite-dimensional approximation of the Koopman operator . . 6.2.3 Koopman operator for input/output systems . . . . . . . . . . . 6.3 PH-ODE realization in lifted space . . . . . . . . . . . . . . . . . . . . 6.3.1 Existence of a quadratic energy realization in lifted space . . . . 6.3.2 Passivity in state space from passivity in lifted space . . . . . . 6.3.3 Optimal realization . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.4 Numerical scheme for simulations . . . . . . . . . . . . . . . . . 6.

4 Application: identification of a diode clipper circuit . . . . . . . . . .

6.4.1 Circuit overview and data generation . . . . . . . . . . . . . . . 6.4.2 Choice of observables . . . . . . . . . . . . . . . . . . . . . . . . 6.4.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  Chapter 6. PH-ODE Modeling Based on Passive, Finite-Dimensional Approximation of the Koopman Operator Property 10 (ODE in lifted space for input/output systems). For input/output systems, K t verifies the ODE d dt K

.23)

It is verified that G B is linear with respect to observable φ (from linearity of the gradient operator), and that it is linear with respect to input u (from linearity of the matrix multiplication and dot product). t = L K t + G B (K t , u(t)).

(6.24)

2 DAF 2 x 21 in

 2221 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21 204 Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx-20), Vienna, Austria, September 8-12, 2020

	Symbol Quantity	S.I. units
	N	atoms nb.	dimensionless
	α	nearest neighbours exchange energy kg.m 2 .s. -2
	m	norm. magnetic moment	dimensionless
	M	magnetic moment	A.m 2
	M	magnetization	A.m -1
	H	magnetic field	A.m -1
	B	magnetic flux density	kg.s -2 .A -1
	µ0	vacuum magnetic permeability	kg.m.s -2 .A -2
	Φ	magnetic flux linkage	kg.m 2 .s -2 .A -1
	n	coil turns nb.	dimensionless
	kb	Boltzmann constant	kg.m 2 .s -2 .K -1
	T	temperature	K
	S	entropy	kg.m 2 .s -2 .K -1
	V = Al volume = section x length	m 3
	Label
	L	coupled core and coil

Table 1 :

 1 Physical quantities and labels.

	HL	coil
		ḂV
		ḂV L

coil Hcoil core ḂVcore Hcore Figure 2: Coil and core connection.

Table 1 .

 1 Statistical ensembles and associated constraints.

	IFAC LHMNC 2021
	Berlin Germany, October 11-13, 2021

  Duindam et al. (2009); van der Schaft et al. (2014), under a differential-algebraic formulation Beattie et al.

Table 2

 2 recaps usual Legendre transforms of the internal energy, also called thermodynamic potentials.

	IFAC LHMNC 2021
	Berlin Germany, October 11-13, 2021

Table 1 .

 1 Simulation parameters.

	Fs	F	vel 1	vel 2
	768 kHz	10 kHz	385 m/s	1.54 m/s

Table 2 .

 2 Component parameter values.

	6F5	μ	E x	K g	K p	K vb
		98	1.6	2614	905	1.87
		V ct	V a	R gk
		0.5	0.33	1300
	R 1	L	C 1 //C 2	C 13 //C 14	V bi as	M
	7.5 k	2 mH	0.22 μF	440 pF	90 V	1 μ

Table 3 .

 3 Reference values.

qC 3 re f qC 8 re f φre f vel 1 4.60.10 -6 C 3.13.10 -8 C 4.60.10 -6 Wb vel 2 4.58.10 -6 C 4.76.10 -8 C 4.58.10 -6 Wb

Table 4 .

 4 State variables and constitutive laws for a linear parallel RLC circuit.

	x	dx dt	H(x)	∇H(x)

TABLE I :

 I State variables and constitutive laws for a linear parallel RLC circuit.

http://s3am.ircam.fr/

https://www.uvi.net/about-us

In sequences, order matters but not in multisets. The sequence (p 1 , p

) is different from the sequence (p 2 , p 1 ), but the multiset {p 1 , p 2 } is equivalent to the multiset {p 2 , p 1 }. However, note that the configuration space could also be built for multisets, cycles, etc.2 For instance, if the chosen representation assigns a unique label to each particle, configurations in which several particles share the same label are not admissible.

It is similarly defined for a continuous distribution: the sum is replaced with an integral.

Defined in this context by the ratio between the inductive reactance and the winding resistance.

Iron for instance has an atomic mass of 9.27 ×10 -26 kg.

That is, particles with half-integer spin, such as electrons.

As the magnetic permeability of the core is several orders of magnitude higher than that of vacuum.

Indeed, [G τ ] = [s -1 × C.V -1 ] = [A.V -1 ].

Model intuitively derived from the curve of R for usual values of η τ , v + 0 and v - 0 .

1/γ e . . fr opt 2 -1/γa -1/γa . . . . . . . . . . 1/γ e . . Tr opt . . 1 . . . . . . . . . . . . i R LDR . . . . . . . . . . . . . -1 . T R LDR . . 1 . . . . . . . . . . . . y i in . . . . . . . -1/γe -1/γe . . . . . . v out . . . . . . . . . . 1 . . . . T ext . . 1 . . . . . . . . . . . .

τ . . 1 . . . . . . . . f r opt 1 1 /γ e . . . . . . . . . . f r opt 2 1 /γ e -1 /γ a -1 /γ a . . . . . . . . v + . . . . . . . . . 1 . i o 1 /R 2 . . . . . . . -1 /R 2 . . i R LDR . . . . . . . -1 . -1 /R 1 1 /R 1 y i in . . . . . . . . . 1 /R 1 -1 /R 1 (B) Corresponding PHS.

That is, the damping parameter for the Newton-Raphson iteration is set low enough so that the iterate stays within the constraint (see Appendix D).

That is, a complete normed vector space.

In practice, the set {φ j } 1≤j≤M can be any basis of functions, typically monomials, or RBF, as one rarely has direct access to approximates of eigenfunctions in the subspace. However, these approximates can be reconstructed from data with this basis, as shown below.

Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx-20), Vienna, Austria, September 8-12, 2020

Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21

J. Audio Eng. Soc., Vol. 69, No. 7/8, 2021 July/August

J. Audio Eng. Soc., Vol. 69, No. 7/8, 2021 July/August

The symbol δ stands for an inexact differential[21].J. Audio Eng. Soc., Vol. 69, No. 7/8, 2021 July/August

Note that F is susceptible to contain other functions, depending on the physics (electric, magnetic, etc) of the considered system.

r = ∥xi -xj∥ < ρ, 0 otherwise,(8)DAFx.3Proceedings of the 24 th International Conference on Digital Audio Effects (DAFx20in21), Vienna, Austria, September 8-10, 2021

it can be increased dynamically during iteration.DAFx.4Proceedings of the 24 th International Conference on Digital Audio Effects (DAFx20in21), Vienna, Austria, September 8-10, 2021 4

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December

Appendix F. Other Publications

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December 963

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December 965

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December 967

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December 969

J. Audio Eng. Soc., Vol. 67, No. 12, 2019 December 971

Note that, according to the component type, the "state flow" can be a current (i = q = ẋ for capacitors with charge q) or a voltage (v = φ = ẋ for induction coils with magnetic flux φ). Thus, the flow is not systematically understood as the "charge flow" that is the electric current.

The measured noise amplitude is around 1 µV RMS[51] for a vacuum tube. However, as the noise is sufficiently filtered out by the oscillator, its amplitude mainly affects the transient duration[52].

ACKNOWLEDGMENT

This work was funded by the Collegium Musicae and is supported by the project ANR-16-CE92-0028, entitled Interconnected Infinite-Dimensional systems for Heterogeneous Media, INFIDHEM, financed by the French National Research Agency (ANR).

IX. ACKNOWLEDGMENTS

This work was funded by the Collegium Musicae and is supported by the project ANR-16-CE92-0028, entitled Interconnected Infinite-Dimensional systems for Heterogeneous Media, INFIDHEM, financed by the French National Research Agency (ANR). Further information is available at https://websites.isae-supaero.fr/infidhem/the-project. The authors thank Thierry Maniguet and Stéphane Vaiedelich (Equipe Conservation Recherche, Musée de la Musique) for their invaluable input.

The authors acknowledge the support of the ANR-DFG (French-German) project INFIDHEM ANR-16-CE92-0028.

Appendix A

Legendre Transforms

In this appendix, we recall definitions and properties of Legendre transforms (see also [51]. For simplicity, here we only consider scalar functions but note that Legendre transforms can be extended to functions defined on convex sets. Example 4. Consider the function f defined as f : x → x 3 + x for all x ∈ R. The set { f (x)x x} has a minimum if x ≥ 1, therefore f is well defined on [1, +∞]. In the following, we restrict ourselves to convex functions f , so that f is invertible and f can be directly computed.

Definition 10 (First Legendre transform of convex functions). Consider a convex function f : I → R. Its first Legendre transform according to Def. (9) is

where T L is defined as T L : f → f -I f with I the identity function.

(A.3)

Note that with Def. (9), the first Legendre transform of a convex function is concave. Another definition of the Legendre transform is f (x ) = sup x∈I {x xf (x)}, which preserves convexity. However, in thermodynamics, Def. ( 9) is more common. Since the atoms are not interacting, the total energy of the gas is the sum of the atomic energies, and the partition function Z for N atoms becomes From statistical physics to macroscopic port-Hamiltonian Systems: A roadmap

ABSTRACT

This paper addresses identification of nonlinear circuits for power-balanced virtual analog modeling and simulation. The proposed method combines a port-Hamiltonian system formulation with kernel-based methods to retrieve model laws from measurements. This combination allows for the estimated model to retain physical properties that are crucial for the accuracy of simulations, while representing a variety of nonlinear behaviors. As an illustration, the method is used to identify a nonlinear passive peaking EQ.

Proceedings of the 23 rd International Conference on Digital Audio Effects (DAFx2020), Vienna, Austria, September 2020-21

Decomposition of R

Since R is positive semi-definite, it admits a Cholesky decomposition [33,34] and can be written as: way, nonlinearities of the inductor can be accurately captured for a plausible U0. The theoretical PH-ODE of the passive peaking EQ is found to be that in Appendix B. The generation is achieved discretizing Eq. ( 2), and performing a standard Newton-Raphson iteration at each sample (a detailed numerical scheme can be found in [46]). Finally, some noise (SNR from 38 to 98 dB, with a normal distribution) is added to the data to test the robustness of the identification method.

Choice of kernel parameters and initialization

A minima, the approximant must reproduce a linear effort on the measured range of each state. We fix NH = 6. For this NH, we determine (for each component) the smallest ρ so that the relative error (g(x) -g(x))/g(x) × 100 on the test effort g(x) = x stays within some arbitrary bounds, chosen to be 10 %. Here, ρC = 4.10 -5 and ρL = 4.10 -3 yield satisfying results (Figs 4c-4d, for the inductor). Figure 4a (resp. 4b) shows the resulting basis for the approximation of ∇ 2 H (resp. ∇H).

Before performing the optimization procedure, an initial guess Θ 0 has to be estimated. To this end, the problem is linearized around the desired solution. Measurement data are generated with an input voltage small enough to observe a quasi-linear effort, so we have:

where D is a diagonal matrix with positive coefficients, and X is the dim(J )×n matrix of average states

and inputs at all n samples. Since n ≫ dim(J ), the matrix M is extracted using M = F X † , where † denotes the pseudo-inverse. Denoting Ms = -(M + M ⊺ )/2 the opposite of the symmetric part of M , the matrix R is initialized to a positive-definite matrix close to Ms. To this end, Ms is decomposed as:

Then the matrix R defined as: is positive-definite, and R is initialized to:

to account for the (unknown) contribution of D. Finally, all θ J k and θ H k,i are initialized to 1.

Results

The optimization procedure returns a set of estimated parameters after less than 50 iterations. Here, constraint enforcement is privileged over convergence speed as there are no real-time requirements. Still, the estimation is faster compared to deep neural networks methods (mainly because there are far less parameters to estimate). New simulations are computed with the parameters estimated for each SNR. Figures 5a-5c show that the simulated states match very closely with the "measured" states (here with measured state SNR = 50 dB). Figures 5b-5d show the estimated effort laws. The estimated effort law for the capacitor is linear as expected. The saturating behavior of the inductor is accurately captured within the range of measured data. Figure 6 (david.roze@ircam.fr)

1 Conservation Recherche Team, CNRS-Musée de la Musique and S3AM Team, STMS Laboratory, IRCAM-CNRS-SU 2 CNRS, S3AM Team, STMS Laboratory, IRCAM-CNRS-SU

The Onde Martenot is a classic electronic musical instrument. This paper focuses on the power-balanced simulation of its ribbon-controlled oscillator, composed of linear and nonlinear as well as time-varying components. To this end, the proposed approach consists of formulating the circuit as a Port-Hamiltonian System for which power-balanced numerical methods are available. A specificity of the Martenot oscillator is to involve parallel capacitors, one of them having a capacitance that nonlinearly depends on the time-varying ribbon position state. In the case of linear time-invariant (LTI) capacitors in parallel, an equivalent component can be deduced using the classic impedance approach. Such a reformulation into a single equivalent component is required to derive a state-space Port-Hamiltonian representation of a circuit. One technical result of this paper is to propose a method to determine such an equivalent component in the non-LTI case. This method is applied to the present Martenot oscillator. Then, powerbalanced numerical experiments are presented for several configurations: fixed ribbon position, realistic, and over-speed movements. These results are examined and interpreted from both the electronic and mechanical points of view.

IEEE TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING 1

Simulation of an Ondes Martenot Circuit Judy Najnudel † , Thomas Hélie * , David Roze * , Henri Boutin † * S3AM Team, STMS Laboratory (UMR 9912), CNRS-IRCAM-SU † S3AM Team, STMS Laboratory (UMR 9912), SU-IRCAM-CNRS Abstract-The ondes Martenot is a classic electronic musical instrument based on heterodyning processing. This paper proposes a power-balanced simulation of its circuit, in order to synthesize the sound it produces. To this end, the proposed approach consists in formulating the circuit as a Port-Hamiltonian System, for which power-balanced numerical methods are available. Observations on numerical experiments based upon this formulation allow simplifications of the circuit in order to achieve real-time computation in home-studio conditions. Index Terms-Electronic music instrument, non-linear, powerbalanced, simulation system components are coupled through a skew-symmetric interconnection matrix S = -S :

.

(

For convenience, to distinguish storage, dissipative, and connection ports exchanges, we introduce the following blockmatrix notation:

The skew-symmetry of S guarantees the system power balance. Indeed,

and Fig. 6: Dissipated power for the triode 6C5. ] through a least squares minimization. The results of that minimization fulfill the passivity criterion, i.e. z θ (w) w ≥ 0 for all w (Fig. 6). They are given in Table II, section VI.

3) Other components: Constitutive laws of R, L, C components are supposed to be linear, as shown in Table I. In the oscillators, the transformers are also supposed to be linear; their ratios P being unknown a priori, they are subjected to an estimation described in section V-A2.

B. PHS of isolated stages

For each stage, we denote R k the regulation resistor between the triode cathode and the ground, C k the bypass capacitor in parallel with R k , V bias the triode DC power supply, V in the input voltage and V out the observed output voltage. We denote L p the transformer magnetizing reactance, R p the transformer resistance modeling the core losses in the demodulator and the preamplifier and R pw the input impedance of the diffuseur. For each oscillator, we denote C osc the capacitor equivalent to the parallel capacitors and L osc the inductance equivalent to the coils in series (Figs. 2b-2e). Kirchhoff's laws yield the interconnection matrices for the oscillator (Fig. 7a), demodulator (Fig. 7b), preamplifier (Fig. 7c), and power amplifier (Fig. 7d).

C. Stages coupling

The connection of two PHS is still a PHS. The total state is the concatenation of the subsystems states, and the total Hamiltonian is the sum of the subsystems Hamiltonians. A conservative interconnection is then achieved by connecting each output port of one system to exactly one input port of the other. For two stages A and B connected through a transformer of ratio ρ, we have V inB = ρV outA and I outA = -ρI inB , that is, y outA

The circuit A connected to the circuit B is then equivalent to a circuit C whose PHS is given by Eq. ( 1), with notations of Eq. ( 2):

and J wC , G xC , G wC , K C are defined likewise, u C = (u inA , u outA , u inB , u outB ) and y C is defined likewise, and

.

V. ESTIMATION OF THE INSTRUMENT PARAMETERS

Most parameters of the components are provided by the circuit specifications [35]. The others have to be determined, in particular the oscillator transformer re-injection ratio P and bypass capacitor C k , as well as the characteristics of the transformers towards the amplification stages.

A. Oscillators (stages 1 and 2) 1) Voltage noise source: The oscillation arises from the voltage noise V start at the grid of the triode at its operating point. This broadband noise mainly results from thermal agitation [50] and is modeled with a white noise source of peak voltage 1 mV 2 .

2) Re-injection transformer ratio: The voltage noise is amplified by the triode, filtered by a LC circuit at the plate and sent back to the grid through a transformer of ratio P (Fig. 2b). To estimate a range of possible values for P , the oscillator circuit is simplified: L osc acts as the transformer primary and the cathode potential is considered constant. Moreover, the oscillator model is linearized around its operating point and it is assumed that the influence of the load on the second secondary is negligible. The oscillator can then be represented as a system of input V start and output V out . Under those assumptions, it can be shown [32], [53] that the system characteristic equation in Laplace domain is s 2 + s(1 -µP )/(r a C osc ) + ω 2 0 (µ being the triode amplification factor, r a the triode plate resistor and ω 2 0 = 1/(L osc C osc ) the oscillation pulsation), and that the condition on P for the system to oscillate is

The closer to 1/µ P is chosen, the more stationary the oscillation amplitude will be. Fig. 8 shows the range of P values for which an oscillation is possible.

3) Inductance of the LC circuit: For a parallel LC circuit of resonant frequency F , L osc = 1/ C osc (2πF ) 2 . With F set to 80 kHz and C osc = 544 pF, this yields L osc = 7 mH.

4) Cathode bypass capacitor: The bypass capacitor C k stabilizes the cathode potential, which otherwise would depend strongly on the plate current (through the regulation resistor R k ), itself depending on the input voltage. This stabilization ensures that the signal to be amplified v gc is the biased input voltage and not a modulation of it. In parallel with IEEE TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING 7 VI. POWER-BALANCED SIMULATION This section is devoted to the power-balanced simulation of the ondes Martenot No. 169 complete circuit, composed of the 5 coupled stages (the power amplifier being loaded by a basic resistor equivalent to that of a diffuseur-around 1.5 kΩ).

A. Discrete-time system

The simulation is performed using the PyPHS library [30], [54]. It is based on the numerical method recalled below in the case of mono-variate storage components (H(x) =

and the discrete gradient (see [30], [55]

The method consists of replacing ẋ with δx[k]/T s and ∇H(x) with ∇H x[k], δx[k] in Eq. ( 1). As in Eqs. (3)(4)(5), due to the skew-symmetry of S, the following discrete power balance is satisfied:

Moreover, due to the positivity of z(w[k]) w[k], the system is also still passive. Denoting ν = δx[k]F s , w[k] , the discretization of Eq. (1) yields the implicit equation

where

Denoting F the Jacobian of F , Eq. ( 12) is solved using the Newton-Raphson iteration

if F is invertible. Conditions for convergence of the method can be found in [56], [57].

B. Numerical experiments

The circuit is simulated based on the concatenation of the stages PHS with component parameters values of Table II. The control law of the ribbon position d is built to generate a frequency sweep according to parameters in Table III and Eq. (7). Fig. 9a-9c show the output voltages of stages 3, 4 and 5 during the simulation, and the effect of the successive harmonic distortions. Fig. 9d shows the spectrogram of the complete circuit output during the whole sweep. Fig. 9e shows the stored power, outgoing power and dissipated power of the complete circuit during the whole sweep. As shown in Fig. 9f, the total power, sum of these three contributions, amounts to less than 10 -13 W.

VII. AUDIO PLUGIN

A. Circuit simplification

The voltage generated by the oscillators, even when connected to the other stages, is nearly sinusoidal: the harmonic distortion is about 0.03% for harmonic 2 (Fig. 10a-10b). For a real-time application, physically modeled oscillators may be thus replaced with a sinewave generator.

Additionally, although the simulated performances of the power amplifier are rather poor for a class A amplifier (almost 5% harmonic distortion for harmonic 2, Fig. 11), the stage contributions to the final sound are of much less importance compared to the demodulator and preamplifier. In practice, based on numerical experiments, this stage may also be removed for real-time application.

B. Oscillators frequency reduction

The original oscillator frequency F is around 80 kHz. This choice, alongside with heterodyning, can certainly be attributed to the cost and unreliability of high value capacitors in Maurice Martenot's time: an oscillator at an audible frequency, 3000 Hz for instance, would necessitate a capacitor of 4 µF (the inductance being equal for both oscillators). But in a virtual instrument context, the components may take