Ivan Cohen
email: ivan.cohen@orosys.fr

Thomas Helie
email: thomas.helie@ircam.fr

Measures and parameter estimation of triodes, for the real-time simulation of a multi-stage guitar preamplifier

This paper deals with the real-time simulation of a multi-stage guitar preamplifier. Dynamic triode models based on Norman Korens model, and "secondary phenomena" as grid rectification effect and parasitic capacitances are considered. Then, the circuit is modeled by a nonlinear differential algebraic system, with extended state-space representations. Standard numerical schemes yield efficient stable simulations of the circuit, and are implemented as VST plug-ins. Measures of real triodes have been realized, to develop new triode models, and to characterize the capabilities of aged and new triodes. The results are compared for all the models, using lookup tables generated with the measures, and Norman Korens model with its parameters estimated from the measures.

INTRODUCTION

Many commercial guitar amplifiers simulations have been released today, and several papers about this subject have been published [START_REF] Leach | SPICE models for vacuum tube amplifiers[END_REF][START_REF] Koren | Improved vacuum tube models for SPICE simulations[END_REF][START_REF] Yeh | A review of digital techniques for modeling vacuum-tube guitar amplifiers[END_REF][START_REF] Tubaro | Non-linear digital implementation of a parametric analog tube ground cathode amplifier[END_REF][START_REF] Pakarinen | Wave digital simulation of a vacuum-tube amplifier[END_REF]. They are often focused on common cathode triode amplifier modeling, a circuit widely used in guitar and hi-fi amplifiers to increase the voltage ampli-tude of a sound signal. A triode model is chosen, as the one from Norman Koren [START_REF] Koren | Improved vacuum tube models for SPICE simulations[END_REF]. This model matches well with the triode behaviour displayed in the datasheets. Nevertheless, some phenomena as grid rectification effect or parasitic capacitances, and accuracy between models and real triodes, are rarely described. Moreover, in simulations, the interaction between multiple stages is usually not studied.

In this article, we want to study and simulate in real time a simplified vacuum tube guitar preamplifier. It is made of two common cathode triode amplifiers (see figure 7), and a typical guitar amplifier tone stack (figure 9). In section 2, the Norman Korens triode model is considered. We suggest different ways to improve its accuracy, based on a precedent work (see [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF]), and measures of real triodes (section 3). They are realized on 12AX7 with different capabilities, using look-up tables (i) and identification algorithms (ii). Numerical schemes are suggested in section 4, using extended state space representations, and methods to resolve system of differential algebraic equations. Then, the stages of a preamplifier are studied in section 5. The influence of the coupling between them is displayed. The results are compared with the behaviour of a simplified topology, without real coupling, but less CPU consuming. Finally, these models are simulated in real-time.

Sound examples are available at http://www. orosys.fr/cohen/aes129.htm.

PARAMETRIZED MODELS OF TRIODES

The triode is a vacuum tube, with three pins : the grid (G), the cathode (K) and the plate (P). The indirectly heated cathode causes a space charge of electrons that may be attracted to the positively charged plate, and creates a current. Then, a negative voltage is applied to the grid to control the amount of electrons repelled back towards the cathode. This electronic component has a strongly nonlinear behaviour in the working area we consider. Its model is very important for the realism of the complete stage's simulation.

We consider the triode equivalent to two current sources I g and I p , dependant on the voltages V gk (grid-cathode) and V pk (plate-cathode). These currents are always positive, around a few mA. The influence of the heater is neglected.

The vacumm tube guitar preamplifiers use almost systematically 12AX7 dual triodes (also called ECC83). This is a "high gain" triode, its gain parameter µ being around 100.

(Basic) Norman Koren's model

Derived from the Leach model, Norman Koren's model is "phenomenological", and models the behavior of physical phenomena using parameters not

I p = E Ex 1 K g (1 + sgn(E 1 )) (1)
with :

E 1 = V pk K p ln   1 + exp   K p   1 µ + V gk + V ct K vb + V 2 pk      
Typical parameters values from [START_REF] Koren | Improved vacuum tube models for SPICE simulations[END_REF] and SPICE models are displayed in the table 1.

µ E x K g K p V ct K vb 100 1.4 1060 600 0 300
Table 1: Norman Koren's typical parameters values

Grid rectification effect

The I g current is responsible for the grid rectification effect that designers try to contain using specific polarizations and a resistance in front of the triode's grid. When the grid-to-cathode voltage V gk becomes positive, the value of I g increases by a few mA. As a result, the voltage measured at the grid is limited in its positive course. The triode acts like a rectifier. This kind of distortion is not wanted by electronic designers, but exists for high gain configurations. It is one of the causes of plate voltage's saturation [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], and a phenomenon that differentiates the behaviour of vacuum tubes from the transistors [START_REF] Blencowe | Designing Tube Preamps for Guitar and Bass[END_REF].

In [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], the grid current model was a simple approximation of a diode's characteristic. A smooth transition is added between the resistive behaviour and the interval of voltages where the current is null, with a second order polynomial. This model gives results close to SPICE's diode models and the measures we have done as we will see later.

I g =      0 if V gk < V γ -K n V gk -V γ R gk if V gk > V γ + K n aV 2 gk + bV gk + c otherwise ( 2
)
with

a = 1 4K n R gk b = K -V γ 2K n R gk c = -a(V γ -K n ) 2 -b(V γ -K n ) (3)
The parameter R gk controls the resistive behaviour of the grid current, V γ is the voltage threshold between the null and resistive behaviour. The parameter K n is the length of the smooth transition.

Parasitic capacitances and Miller effect

The dynamic behaviour of the triode model is considered. Three capacitances are introduced between each pole, with their capacitance values chosen according to the datasheets (around a few picofarads).

In spite of their low values, one of them, the capacitance C gp between the grid and the plate, changes the frequency response of a triode circuit below 20 kHz. This is the consequence of the Miller effect. The capacitance acts as its value is multiplied by the gain of the stage (around 60), like a lowpass filter with the resistance in front of the triode's grid. The cutoff frequency is 5 kHz and more. The other capacitances can be neglected (see [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF]). These results have been confirmed by SPICE simulations and listening tests.

MEASURES OF TRIODES

A device has been developed to measure the static behaviour of different kinds of triodes. Their dynamic behaviour will be studied in a future work.

The results are shown as series of triplets (I p , V gk , V pk ) i and (I g , V gk , V pk ) i . The triodes measured are the following : a 12AX7 Sovtek bougth in a music store (1), another 12AX7 recently put in a guitar amplifier [START_REF] Leach | SPICE models for vacuum tube amplifiers[END_REF], and a 12AX7 used for several years in a guitar amplifier [START_REF] Koren | Improved vacuum tube models for SPICE simulations[END_REF]. At the beginning, we work on the plate current I p only.

The measured triplets are used in MATLAB to generate a surface I p = f (V gk , V pk ) (see figure 2) using bilinear interpolation. The measures cover all the working range of the triode, constrained by the maximum power dissipation and the maximum plate current recommanded in the datasheets (1.5W and 10 mA for the 12AX7). Several methods have been developed to model the real triodes using these measures.

Fig. 2: Characterization surface for the I p current

Interpolation

A lookup table of I p is generated using equally spaced dots of the surface. The voltages are limited to 0 ≤ V pk ≤ 400 V and -10 ≤ V gk ≤ 5 V. This table is used in simulation, with a low step, using bilinear or bicubic interpolation to calculate any current value in the limited range, as well as the derivatives [START_REF] William | Numerical Recipes in C++[END_REF].

Identification

Then, the Norman Koren's model is used again, and its parameters are estimated for each measured triode. Let n be the number of measures used for the estimation. Let θ be a vector where Norman Koren's parameters are stored.

θ = [µ E x K g K p V ct K vb ] T ( 4
)
y i is the I p current's value from the measure i, and Ŷi (θ) the I p current's value calculated with the parameters θ and the voltages (V gk , V pk ) from the measure i. Let Φ(θ) the objective function of the least squares, defined as :

Φ(θ) = n i=1 (y i -Ŷi (θ)) 2 (5)
This function is the optimization criterion, which evaluates the accuracy of the estimation. The function fminsearch of MATLAB is used to minimize Φ(θ), with the Nelder-Mead's optimization method [START_REF] Lagarias | Convergence Properties of the Nelder-Mead Simplex Method in Low Dimensions[END_REF]. It is applied to the 3 test triodes (1) (2) (3) and to some data extracted from a datasheet (4).

The identifiability of Norman Koren's model is checked. The optimization algorithm is tested on the model with realistic parameters (well known), which returns these parameters with an error lower than 1%. Then, the estimation is done with a few measures (n around 10), to get the results of the table 2.

µ E x K g K p V ct K vb (1)

Comparisons between triode's models

We compare the differences between the triodes with the figure 3 and the table 2. The old age of the triode (3) is displayed by a reduction of the gain (µ parameter). Globally, for fixed voltages V gk and V pk , the I p current will be smaller for an aged triode than for a new one. This observation is used in the aged vacuum tubes detectors. Other parameters as E x , K g and V ct are smaller in the triode (3).

In the figure 4, minimal differences between the interpoled model and the estimated model of the triode (1) are shown. We consider two possible causes for these differences. First, the estimation algorithm may be improved, using more measures or other optimization criterion, like weighted or nonlinear least squares. Then, the Norman Koren's viability is considered. This model may be unable to match exactly with a real triode's behaviour. For example, the derivative at the origin of the I p current with the voltage V pk is null, which is not the case in reality. Some parameters as µ and E x may not be constant. But our data displays that this model is a quite accurate approximation of a real triode, for the I p current behaviour.

Grid current

We consider again the grid current I g . The figure 5 displays the grid current's behaviour of the triode [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF]. These measures show a low dependence on the voltage V pk , so we choose the model from the equation 2 as a good approximation of the measured grid current. Its parameters are estimated and shown in the table 3. Linear state-space representations are well known in control engineering. For nonlinear cases, nonlinear functions can be introduced in their classical formulation. Moreover, the nonlinearity can introduce implicit equations. We have suggested an extended state-space representation in [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], to separate the differential equations of implicit problems, with the introduction of a static nonlinear vector W . This is a similar but more general state-space representation for nonlinear systems than the K-method (see [START_REF] Poli | Elimination of Delay-Free Loops in Discrete-Time, Models of Nonlinear Acoustic Systems[END_REF]). Let X be the dynamic state vector of the studied system, W a static nonlinear state, U the input vec-tor and Y the output vector.

dX/dt = f (X, W, U ) (6) 0 = g(X, W, U ) (7)
Y = h(X, W, U ) (8)
Remark : the linear case is a particular extended state space representation without the function g, with dim W = 0 and the functions f (X, U ) = AX + BU and h(X, U ) = CX + DU (A, B, C and D are constant matrices).

Discretization

The discretization of the extended state-space equations is done with the resolution of differential and implicit equations. Their complexity is a consequence of the numerical scheme chosen for the resolution, and the existence of nonlinear delay-free loops in the electronic circuit. Let T e be the sampling period.

Differential equations

To resolve the ordinary differential equations (equation 6), explicit Runge-Kutta methods are often used, because of their good stability and accuracy performances [START_REF] Demailly | Analyse numerique et equations differentielles[END_REF], for example the second order method (equation 9). Implicit methods are also used, as backward Euler's method, or trapezoidal method (equation 10), often called bilinear transform and widely used in digital signal processing.

k 1 = T e f (X n , W n , U n ) (9)
X n+1 = X n + T e f (X n + k 1 2 , W n , U n + U n+1 2 ) X n+1 = X n + T e 2 f (X n+1 , W n+1 , U n+1 ) + T e 2 f (X n , W n , U n ) (10)
We have seen in [START_REF] Cohen | Simulation of a guitar preamplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF] that the consideration of the parasitic capacitance C gp in the triode's model makes a stiffness problem appear. There is no rigorous definition of stiffness in the literature, but it can be considered as a differential equation for which certain numerical methods for solving the equation are numerically unstable, with some terms that can lead to rapid variation in the solution. Decreasing the sampling step, and using implicit schemes are two solutions to get rid of the stiff equations. In the first case, we need sampling frequencies up to some megahertz to get a stable numerical scheme, or variable sampling steps. They are widely used in "offline" simulators (as SPICE), but are not convenient for real time applications. So, implicit methods of differential equations resolution are prefered in stiff numerical schemes.

Implicit equations

The standard method of Newton-Raphson is used to solve implicit equations written f (Z) = 0 with Z a vector of any dimension, and find its roots. This algorithm is well known [START_REF] Demailly | Analyse numerique et equations differentielles[END_REF], uses the Jacobian matrix J f (Z) of the function f (Z), and converges to a solution after a specified number of iterations. It is important to check if its application's conditions are satisfied, if the Jacobian matrix is Lipschitz continuous and locally isomorphic around the solution [START_REF] Demailly | Analyse numerique et equations differentielles[END_REF]. This is generally the case for our state-space equations. When the interpoled model is used, processing has been done to make sure that the derivatives of the currents I p and I g are monotonic.

This method resolves the equation 7 but also the equation 6 if implicit methods of differential equation's resolution are used. So, with the capacitance C gp considered in the equations, Z is the vector [X W ] T .

Let Z k n be the approximative value of Z at the iteration k of the algorithm for the sample n. J f (Z) is the Jacobian matrix of f (Z).

Z k+1 n = Z k n -J -1 f (Z k n ) × f (Z k n ) (11)

THE MULTI-STAGE GUITAR PREAMPLI-FIER

The circuit we are studying is a simplified guitar preamplifier, made of two common cathode triode amplifiers (A1,A2) and a typical guitar tone stack (T). The triodes chosen by designers are very often 12AX7s. First, each electronic stage is considered separately. Their extended state-space representation is given, and the circuit is simulated using an explicit numerical scheme to show its behaviour. Then, they are interconnected, and the influence of the inter-stage coupling on the preamplifier's harmonic response is discussed.

A1 A2 T

Fig. 6: The vacuum tube guitar preamplifier scheme 5.1. Common cathode triode amplifier

The circuit

The common cathode triode amplifier is a topology of circuit that has been widely used in hi-fi and guitar amplifiers. Easy to design, with a well known behaviour, musicians and audiophiles like its sound properties. So, its use today is justified, several years after the apparition of transistors, as its study in papers about guitar amplifiers simulation [START_REF] Yeh | A review of digital techniques for modeling vacuum-tube guitar amplifiers[END_REF][START_REF] Tubaro | Non-linear digital implementation of a parametric analog tube ground cathode amplifier[END_REF][START_REF] Pakarinen | Wave digital simulation of a vacuum-tube amplifier[END_REF]. It is found in most of the vacuum tube guitar preamplifiers, which have the purpose to increase the voltage of the guitar's signal (with a maximum voltage of 400 mV, and an impedance of 20 kΩ, depending on the type of guitar pickup), and to enrich its tone.

The circuit is very simple, the triode 12AX7 is connected with a few resistances and two capacitances. We don't consider the parasitic capacitance between the plate and the grid to simplify the extended statespace representation.

Rg

The extended state-space representation

Using Kirchoff laws and triode models, the triode stage can be modeled by a nonlinear differential algebraic system with an extended state-space representation.

The state variables are chosen according to the number of parasitic capacitances, and nonlinear functions (the plate and grid currents from the triode's model). For the dynamic state variable X, we choose the voltages of the capacitances C k and C L . For the nonlinear static variable W , we choose the voltages V gk and V pk .

To be able to perform the coupling between this circuit and the tonestack later, we consider the input voltage V in and the output current I out as inputs for our system. The output voltage V out and the input current I in are the outputs.

U = [V in I out ] T X = [V k V out -V p ] T W = [V p -V k V g -V k ] T Y = [V out I in ] T (12)
The extended state-space representation of the system is the following :

f (X, W, U ) = (-X1 R k + I g + I p )/C k -X2+W1+X1 RLCL + U2 CL g(X, W, U ) =      W 1 + X 1 -V bias +R p (I p -U 2 + X2+W1+X1 RL ) W 2 + X 1 + RgRin Rg+Rin (I g -U1 Rin ) h(X, W, U ) = X 2 + W 1 + X 1

W2+X1-U1 Rin

with

I p = I p (W 1 , W 2 ) I g = I g (W 1 , W 2 ) (13)

Results

A sinousoid with a frequency of 200 Hz and an amplitude of 10 V feeds the input of the simulated stage.

In the figure 8, the output and its harmonic content are displayed. Fig. 8: Output signal has been found in [START_REF] Amps | Tone stack calculator[END_REF]. It is generally cascaded after all the preamplifier stages, and sometimes before a cathode follower.

The frequency knobs are potentiometers, modeled as parameterized resistors (R 2 , R 3 , R 4 and R 5 ), with Treble, Middle and Bass controls, with values between 0 and 1.

The extended state-space representation

Using Kirchoff laws, the tonestack can be modeled by a differential system with a linear state-space representation.

The state variables are the voltages of each capacitance. To be able to perform the coupling between this circuit and the tonestack later, we consider the input voltage V in and the output current I out as inputs for our system. The output voltage V out and the input current I in are the outputs.

U = [V in I out ] T X = [V c1 V c2 V c3 ] T Y = [V out I in ] T (14)
The extended state-space representation of the system is the following :

f (X, U ) =   A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33   X +   B 1 B 2 B 3   U h(X, U ) = C 11 C 12 C 13 C 21 C 22 C 23 X + D 11 D 12 D 21 D 22 U
The expression of theses coefficients is easy to find, but a few complicated and not very relevant in this paper. For more information about tone stacks, see [START_REF] Yeh | Discretization of the 59 Fender Bassman Tone Stack[END_REF][START_REF] Miletitch | Etude et modelisation numerique d'une pedale d'effet pour guitare[END_REF].

Results

The frequency response of the tone stack is shown in the figure 10 (1)

10 2 10 3 10 4 -30 -25 -20 -15 -10 -5 0 frequency (Hz) amplitude (dB)
(2)

10 2 10 3 10 4 -30 -25 -20 -15 -10 -5 0 frequency (Hz) amplitude (dB)
(3)

10 2 10 3 10 4 -30 -25 -20 -15 -10 -5 0 frequency (Hz) amplitude (dB) (4)
Fig. 10: The tone stack frequency's response

Coupling

With the extended state-space representation of both circuits, it is possible to simulate their combination. The components values are taken from a real preamplifier schematic. The coupling is done by adding one intermediate variable, and one equation for each relationship between one output and one input of two consecutive stages.

This preamplifier is studied in two cases, with different coupling configurations. Each time, a sinousoid with a frequency of 200 Hz and an amplitude of 1 V feeds the input of the simulated circuit. The tonestack knobs are set in an intermediate position. The output and its harmonic content are displayed in the figures 12 and 14.

Let X A1 , X A2 , X T be the dynamic state vector of respectively the two common cathode triode amplifiers and the tonestack, W A1 and W A2 the static nonlinear states for the common cathode triode amplifiers, U A1 , U A2 and U T the input vectors, Y A1 , Y A2 , Y T the output vectors. The simulation of the full preamplifier is done by solving the extended state-space representation of each stage, using the numerical schemes we have seen. Moreover, some extra nonlinear static state variables W are added, to introduce the coupling relationship in the equations.

Stages cascaded and decoupled

First, the stages are cascaded with an imperfect coupling. The voltages are the same at the entrance and at the exit of cascaded stages, but no currents are flowing between them. This is equivalent to the following relationship :

Y A1 1 = U A2 1 Y A2 1 = U T 1 U A1 2 = 0 U A2 2 = 0
So, the influence of cascaded stages exists only in one direction, from the input to the output of the preamplifier. The behaviour of the second triode amplifier has no influence on the behaviour of the first for example (see figure 11).

A1 A2 T

Vin Vout V V Fig. 11: Decoupled preamplifier's schematic

The equations 15 are introduced using the coupling state variables W A1A2 and W A2T . First, we replace some inputs in the equations with :

U A2 1 = W A1A2 U T 1 = W A2T U A1 2 = 0 U A2 2 = 0
Then, we introduce the outputs relationship according to the coupling variables :

W A1A2 = X A1 2 + W A1 1 + X A1 1 W A2T = X A2 2 + W A2 1 + X A2 1
In the extended state-space representation of the preamplifier, the dimension of the vector X is 7, and 6 for the vector W . The dimension of these vectors in each stage are added together, with the dimension of the coupling state variables for W (2).

The figure 12 displays the output and the harmonic content of the "decoupled" preamplifier. are not considered, because we only take account of the input and output voltages of the full preamplifiers. The input and output currents are only useful if stages exist before and after the full circuit.

Stages cascaded and coupled

To have a "perfect" coupling, both voltages and currents are the same at the entrance and at the exit of cascaded stages. The following relationship is introduced in the equations :

Y A1 1 = U A2 1 Y A2 1 = U T 1 U A1 2 = Y A2 2 U A2 2 = Y T 2
The influence of cascaded stages exists in all the directions, from the input to the output of the preamplifier (see figure 13).

A1

A2 T Vin Vout V V i i Fig. 13: Coupled preamplifier's schematic

The equations 15 are introduced using the coupling state variables

W A1A2 1 , W A1A2 2 , W A2T 1 and W A2T 2 .
We replace the inputs in the equations with :

U A2 1 = W A1A2 1 U T 1 = W A2T 1 U A1 2 = W A1A2 2 U A2 2 = W A2T 2
Then, we introduce the output relationships according to the coupling variables :

W A1A2 1 = X A1 2 + W A1 1 + X A1 1 W A1A2 2 = W A1 2 + X A1 1 -U A1 1 R in W A2T 1 = X A2 2 + W A2 1 + X A2 1 W A2T 2 = C A2 21 C A2 22 C A2 23 X A2 + D A2 21 D A2 22 W A1A2 1 W A2T 2 T
In the extended state-space representation of the preamplifier, the dimension of the vector X is 7, and 8 for the vector W . The dimension of these vectors in each stage are added together, with the dimension of the coupling state variables for W (4).

The figure 14 displays the output and the harmonic content of the "coupled" preamplifier.

DISCUSSION

The explicit numerical scheme of the complete stage, with different triode models, has been implemented as a real-time VST plug-in. High sampling frequencies in simulations increase the speed of the convergence of the numerical scheme, and reduce the aliasing. As a result, we have decided to choose 96 kHz as the sampling frequency.

The real triode's models have only shown a few differences, the most significant being their gain. This Fig. 14: Coupled preamplifier element may not look pertinent. But a voltage decrease before a saturating triode can change a lot the harmonic response in a high gain preamplifier, with three or more triodes for example. The designers choose the polarization of each stage to get an exact quantity of saturation, without too much grid rectification. If the triode's gain changes, this parameter is no more balanced. That's why guitarists are able to tell when the preamplifier triodes become old, because they don't listen to the same quantity of saturation than before. Other remark, the interpolated (with bilinear interpolation) and estimated models of any triode give almost the same results in the simulations. But the interpolated model is prefered because it needs less CPU processing in the VST plug-in.

Then, the coupling between stages has shown to be significant. It is "imperfect" in a few market simulations to reduce the CPU consumption, but that implies a lot of loss in realism. If we compare the figures 8, 14, and 12, we can see that the preamplifier produces more distorsion than a common cathode triode amplifier alone. Nevertheless, the triode amplifier has been feed with a 10 V sinusoid in the figure 8 whereas the preamplifier has a 1V sinusoid as an input. Else, the harmonic content is different in the two coupling cases. The odd harmonics are strong in the two cases, but the coupled preamplifier shows higher even harmonics.

CONCLUSION

A preamplifier stage has been studied and simulated with efficient numerical schemes for real time applications. It yields to the implementation of plugins, which produces satisfactory sounds with standard cabinet simulations. Moreover, future work will be dedicated to model and simulate more complex topologies of guitar preamplifiers, with a larger number of triodes measured, and guitar power amplifiers.

Fig. 3 :Fig. 4 :

 34 Fig. 3: Interpoled currents from the triode (1), the triode (2), and the triode (3)

Fig. 5 :

 5 Fig. 5: Grid current measured for several constant values of V pk

Fig. 7 :

 7 Fig. 7: The Common Cathode Triode Amplifier

5. 2 .

 2 Tone stack 5.2.1. The circuit Commonly found in many guitar amplifiers, the tone stack changes the frequency content of the guitar signal. The user can adjust Treble, Middle, and Bass controls to modify the gain of the respective frequency bands. The schematic is standard, and

Fig. 9 :

 9 Fig. 9: The Tonestack

Fig. 12 :

 12 Fig. 12: Decoupled preamplifier Note : U A2T 2

Table 2 :

 2 Norman Koren's parameters for each 12AX7 triode

	106 1.46 1572 464 0.49 179
	(2) 107 1.46 1551 538 0.52 201
	(3) 96 1.39 1408 866 0.29 171
	(4) 105 1.53 1934 712 0.67 255

Table 3 :

 3 Grid current parameters for several 12AX7 triodes

	4. NUMERICAL SCHEMES
	4.1. Extended State-Space Representations

Table 4 :

 4 , for 4 different sets of knobs parameters shown, in the table 4. Sets of knobs parameters

		Bass Mid Treble
	Set (1)	0.5	0.5	0.5
	Set (2)	0.7	0.1	0.7
	Set (3)	0.1	0.5	0.8
	Set (4)	0.9	0.5	0.1


Ivan Cohen
email: ivan.cohen@orosys.fr

Thomas Helie
email: thomas.helie@ircam.fr

REAL-TIME SIMULATION OF A GUITAR POWER AMPLIFIER

This paper deals with the real time simulation of a class A single ended guitar power amplifier. Power tubes and triode models are based on Norman Koren's work. Beam tetrodes and pentodes characteristics are discussed, and displayed as Norman Koren's model parameters. A simple output transformer model is considered, with its parameters calculated from datasheets specifications. Then, the circuit is modeled by a nonlinear differential algebraic system, with extended state-space representations. Standard numerical schemes yield efficient and stable simulations of the stage, and are implemented as VST plug-ins.

INTRODUCTION

Many analog audio circuit simulations (guitar amplifiers, synthesizers, studio devices etc.) have been released for musicians, who want to replace their equipment with cheaper and more flexible digital equivalents. However, the realism of these digital simulations can still be improved. This is mainly due to nonlinearities that are responsible for the "sound signature of analog audio devices" the modeling of which is often complex and still keeps a lot of people busy.

This paper deals with realistic simulation of guitar tube amplifiers, for real-time applications. Several papers have been published about this subject, often focused on triode amplifiers circuits, and sometimes power amplifiers (see [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF][START_REF] Yeh | A review of digital techniques for modeling vacuum-tube guitar amplifiers[END_REF][START_REF] Pakarinen | Wave digital simulation of a vacuum-tube amplifier[END_REF][START_REF] Pakarinen | Wave digital modeling of the output chain of a vacuum-tube amplifier[END_REF][START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF]). In this article, we consider a single-ended tube power amplifier, using pentodes and an output transformer. First, we consider Norman Koren's model for several standard power tubes found in guitar power amplifiers. The control grid current and the parasitic capacitances are studied, and compared with the work done in [START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF] about triodes. Then, a simple linear model for the output transformer is introduced, with its parameters calculated from datasheets specifications. The circuit is simulated in real time using extended state space representations. Finally, the results are shown and discussed.

THE CLASS A POWER AMPLIFIER

The class A power amplifier (figure 1) increases the power of the signal from a preamplifier to a speaker, with a matched output impedance. This is a very simple power amplifier, chosen for its sound characteristics, and for the simplicity of its modelisation. It is defined as "single ended" because it uses a single tube to produce an output, in contrast to push-pull amplifiers, another topology using more tubes and phase inverters for more power, operating in classes AB or B (see [START_REF] Kuehnel | Vacuum Tube Circuit, Design Guitar Amplifier Power Amps[END_REF] for more information about power amplifiers classes). The voltages V b1 and V b2 are constant bias voltages. Typical values for its components can be seen in table 1. The passive components are considered ideal. Using the Millman's theorem, Kirchoff laws and our component models, the electronic circuit can be modeled by a set of differential algebraic equations.

POWER TUBES MODELS

Introduction

Vg1

Vg2 Vp As seen in [START_REF] Jones | Valve Amplifiers[END_REF][START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], the triode has a capacitive behaviour between the grid and the plate, increased by the Miller effect. The adding of the screen grid decreases the value of the capacitance (from 2 pF to 0.02 pF), and increases the power gain of the vacuum tube (µ is the voltage gain). This yields to a topology called the tetrode, which has a unwanted side-effect, known as the Dynatron effect. It gives the tetrode valve a distinctive negative resistance characteristic, sometimes called "tetrode kink". This problem has been solved with the addition of a third grid (the pentode patented by Philips/Mullard [START_REF] Krahl | Pentode tube[END_REF]), and with another topology called the beam tetrode. These two kinds of vacuum tubes are very often described as pentodes.

The pentode is a vacuum tube widely used in guitar and hifi power amplifiers, a triode with the control grid (G1), the cathode (K), the plate (P), and two extra pins : the screen grid and the suppressor grid (G3). Beam tetrodes and pentodes plate current curves in datasheets show they have a significantly different behaviour. In short, beam tetrodes have much sharped knees compared to pentodes, a lower ratio of screen to plate current, a lower third harmonic distortion [START_REF] Kuehnel | Vacuum Tube Circuit, Design Guitar Amplifier Power Amps[END_REF]. Their model is very important for the realism of the complete stage's simulation.

Norman Koren's model

The Norman Koren's model [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF] is said "phenomenological". It models the behavior of physical phenomena using parameters not derived from fundamental physics, to match published curves from datasheets. The expression of the Ip and Ig2 currents for pentodelike vacuum tubes are the following :

E1 = V g2k Kp log 1 + exp Kp 1 µ + V g1k V g2k (1)
Ip = E Ex 1 Kg1 (1 + sgn(E1)) arctan V pk K vb (2)
Ig2 = exp Ex log V g2k µ + V g1k (3)
The table 2 displays typical tubes parameters, from [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF] and SPICE models. µ is the voltage amplification factor, Kg1 a parameter inversely proportional to overall plate current, Ex an exponent, K vb a knee parameters in volts, Kg2 the inverse screen grid current sensitivity, and Kp a parameter that affects the plate currents for large plate voltages and large negative grid voltages. The differences between the pentodes and the beam tetrodes general are displayed in this

Grid current and parasitic capacitances

The Ig1 current is often neglected in triode models [START_REF] Pakarinen | Wave digital simulation of a vacuum-tube amplifier[END_REF][START_REF] Yeh | Simulating guitar distortion circuits using wave digital and nonlinear state-space formulations[END_REF]. But it is responsible for the grid rectification effect that designers try to limit using specific polarizations and the resistance Rg1. In [START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], the grid current model was a simple approximation of a diode's characteristic. A smooth transition is added between the resistive behaviour and the interval of voltages where the current is null, with a second order polynomial. This model gives results close to SPICE's diode models. The parameter R g1k controls the resistive behaviour of the grid current, Vγ is the voltage threshold between the null and resistive behaviour. The parameter Kn is the length of the smooth transition.

Ig1 =      0 if V g1k < Vγ -Kn V g1k -V γ R g1k if V g1k > Vγ + Kn aV 2 g1k + bV g1k + c otherwise (4)
with

a = 1 4KnR g1k b = K -Vγ 2KnR g1k c = -a(Vγ -Kn) 2 -b(Vγ -Kn) (5)
Vγ Rg1 Kn 13 V 6000 Ω 3 V Table 3: Typical values for the parameters of grid current's model

In [START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], we consider the dynamic behaviour of the triode model with its parasitic capacitances, in particular the capacitance between the grid and the cathode, because of the Miller effect. Pentodes and tetrodes have lower parasitic capacitances than triodes. The parameter µ is lower than 20, instead of 100 for 12AX7 triodes. So, considering the Miller effect for pentode-like tubes, the capacitances have no effect inside the bandwidth of audible frequencies, and including parasitic capacitances in tube models is not judged relevant. This result has been confirmed by SPICE simulations and informal listening tests.

OUTPUT TRANSFORMER MODELS

Vacuum tube power amplifiers typically have a tube output impedance around 1 kΩ, whereas loudspeakers have an impedance between 4 and 16 Ω. high-impedance plate speaker load is transformed into a low-impedance load using an output transformer. The ideal output transformer is defined by the number of turns in its primary winding Np and in its secondary winding Ns. The ratio between the input and output impedance of the transformer is a function of (Np/Ns) 2 .

We consider the Plitron PAT-3050-SE-02 output transformer, a typical output transformer for single ended power amplifiers. The relevant information for our model is available on Plitron datasheets, and in the table 4.

A simplified model

The transformer's model has been developed by Plitron and adapted by Norman Koren [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF]. Its schematic is displayed in the figure

Presentation

Linear state-space representations are well known in control engineering. For nonlinear cases, nonlinear functions can be introduced in their classical formulation. Moreover, the nonlinearity can introduce implicit equations. We have suggested an extended state-space representation in [START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF], to separate the differential equations of implicit problems, with the introduction of a static nonlinear W This is a similar but more general state-space representation for nonlinear systems than the K-method (see [START_REF] De Poli | Elimination of delay-free loops in discrete-time, models of nonlinear acoustic systems[END_REF]). Let X be the dynamic state vector of the studied system, W a static nonlinear state, U the input vector and Y the output vector.

dX/dt = f (X, W, U ) (6) 0 = g(X, W, U ) (7) Y = h(X, W, U ) (8)
Remark : the linear case is a particular extended state space representation without the function g, with dim W = 0 and the functions f (X, U ) = AX + BU and h(X, U ) = CX + DU (A, B, C and D are constant matrices).

Circuit Equations

The dynamic behavior of the circuit is caused by the capacitors and inductances. The nonlinearity comes from the tube modeling, the expression of the currents Ip, Ig1 and Ig2. Let the state variables be :

U = Vin X = [V k VT 1 -Vp Vout -VT O ] T W = [Vg1 Vg2 Vp] T Y = Vout
The dimension of the vectors X and W both equal to three. The state space representation of the class A power amplifier stage is the following :

f =          Ig1 + Ig2 + Ip -X 1 R k 1 C k D ∆ [V b2 -X2 -W3] -B ∆ R L R out -1 X3 A ∆ R L R out -1 X3 -C ∆ [V b2 -X2 -W3] (9)
g =    W1 -U + Rg1Ig1 W2 -V b1 + Rg2Ig2 -X2 + RinIp (10)
h = RL Rout X3 (11)
with

A = L1 Rin , B = M12 Rout , C = M12 Rin , D = L2 Rout ∆ = AD -BC
The currents are functions of X, W and U . This extended state space representation yields to a numerical simulation with standard methods of resolution, for differential and implicit equations.

Discretization

Discretization of the extended state-space equations is done with the resolution of differential and implicit equations. Their complexity is a consequence of the numerical scheme chosen for the resolution, and the existence of nonlinear delay-free loops in the electronic circuit. Te is the sampling period.

Differential equations

To solve the ordinary differential equations (equation 6), explicit Runge-Kutta methods are often used [11,[START_REF] Stoer | Introduction to Numerical Analyisis[END_REF]. Implicit methods are also used to solve stiff problems (see [START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF]), as the trapezoidal method (equation 12), often called bilinear transform and widely used in digital signal processing [13].

Xn+1 = Xn + Te 2 f (Xn+1, Wn+1, Un+1) + Te 2 f (Xn, Wn, Un) (12)
We have seen in [START_REF] Helie | Simulation of a guitar amplifier stage for several triode models : examination of some relevant phenomena and choice of adapted numerical schemes[END_REF] that the consideration of the parasitic capacitance Cgp in the model makes a stiffness problem appear, and requires the use of implicit numerical schemes. Stiffness can be considered as a differential equation with some terms that can lead to rapid variation in the solution. In equations 9, the coefficient ∆ is around 10 -6 . The use of implicit algorithms is necessary to guarantee the stability.

Implicit equations

The standard method of Newton-Raphson is used to solve implicit equations written f (Z) = 0 with Z a vector of any dimension, and find its roots. This method solves equation 7, but also equation 6 if implicit methods of differential equation's resolution are used. So, Z is the vector [X W ] T .

Let Z k n be the approximative value of Z at the iteration k of the algorithm for the sample n. J f (Z) is the Jacobian matrix of f (Z).

Z k+1 n = Z k n -J -1 f (Z k n ) × f (Z k n ) (13)
This algorithm converges to a solution if the derivatives are Lipschitz continuous and locally isomorphic around the solution [11,[START_REF] Stoer | Introduction to Numerical Analyisis[END_REF]. This is the case if the initial value Z 0 n is close enough to the solution. Our numerical scheme works well, with 4 iterations, if we choose the previous state Zn-1 as the initial value, with high sampling frequencies in megahertz), to ensure that successive samples are close in value to each other.

DISCUSSION

The main purpose of power tube stages is to increase the power of the signal. Input voltages are around a few volts in general : the stage adds a few harmonics to the signal's content, with an impact on the sound which is less important than what is done by preamplifiers stages. If the input voltage is higher, distortion appears from the power tubes and the output transformers. This phenomenon occurs typically in "vintage" guitar amps.

In our simulation, the nonlinear behaviour of the transformer is not considered. A sinousoid with a frequency of 2000 Hz and an amplitude of 30 V feeds the input of the simulated stage, with a 6L6GC beam tetrode. The output is displayed in the figure 5. The output does not change significantly when we replace the tube models. The only perceptive phenomenon is the gain difference between tubes with this model. More differences may be listenable if a more complex circuit had been modeled, with coupling between the circuit and a speaker. Sound samples are available on http://www.orosys.fr/cohen/samples.htm.

CONCLUSION

This study has shown a way to simulate a simple class A power amplifier, using extended state-space representations, the tube model of Norman Koren, and a linear model of the output transformer. It yields to the implementation of plug-ins, which produces satisfactory sounds with standard cabinet simulations. Moreover, future work will be dedicated to model and simulate other topologies of guitar power amplifiers, phenomenon such as feedback and sag, the coupling between each element of a guitar amplifier, and the nonlinearities of output transformers, such as hysteresis effects.

Figure 2 :

 2 Figure 2: The power tube's model

Figure 3 :

 3 Figure 3: Norman Koren's model for the Ip current

Figure 4 :

 4 Figure 4: Simplified output transformer model

Figure 5 :

 5 Figure 5: Output signal and harmonic response for an input sinusoid (2000 Hz 30 V)

Table 1 :

 1 Typical values of the components used in the power amplifier

					Vp			Vout
	Vin	Rg1	Vg1	Vg2	Rg2	Vb1	T
				6L6GC				RL
			Vk
			Rk	Ck	Vb2
			Figure 1: The electronic circuit
	Vb1	Vb2	Rg1		Rg2		Rk	RL	Ck
	300 V 400 V 5.6 kΩ 1 kΩ 220 Ω 8 Ω 100 µF

Table 2 :

 2 table, particularly with the parameters µ and K vb . The parameters of Norman Koren's model for a few pentodes and beam tetrodes

	Pentode	µ	Kg1	Kg2	Kp K vb	Ex
	EL34	11	650	4200	60	24	1.35
	EL84	16	570	4200	50	24	1.35
	Beam Tetrode	µ	Kg1	Kg2	Kp K vb	Ex
	6L6GC	8.7 1460 4500	48	12	1.35
	KT88	8.8	730	4200	32	16	1.35

Table 5 :

 5 The parameters of the output transformer's model used in simulation

	Total primary inductance			Lp	40 H
	Primary leakage inductance		Lsp	10 mH
	Quality factor = Lp/Lsp			Q	4000
	Turns ratio			N = Np/Ns 35.551
	Total primary resistance			Rip	80 Ω
	Total secondary resistance		Ris	0.1 Ω
	Table 4: Information about the Plitron PAT-3050-SE-02 output
	transformer
	4, and its are calculated according to the datasheet in
	the table 5.
		L2 = Lp/N 2
		M12 =	1 -1/Q	√	L1L2
	Rin	Rout	L1		L2	M12
	80 Ω 0.1 Ω 40 H 0.0316505 H 1.125035 H
		Vin	iin	K	iout	Vout
			Rin		Rout
			VT1 VTo
			L1		L2
		Vin2				Vout2


Ivan Cohen
email: ivan.cohen@orosys.fr

Thomas Helie
email: thomas.helie@ircam.fr

Simulation of a guitar amplifier stage for several triode models: examination of some relevant phenomena and choice of adapted numerical schemes

This paper deals with the simulation of a high gain triode stage of a guitar amplifier. Triode models taking into account various "secondary phenomena" are considered and their relevance on the stage is analyzed. More precisely, both static and dynamic models (including parasitic capacitances) are compared. For each case, the stage can be modeled by a nonlinear differential algebraic system. For static triode models, standard explicit numerical schemes yield efficient stable simulations of the stage. However, the effect due to the capacitances in dynamic models is audible (Miller effect) and must be considered. The problem becomes stiff and requires the use of implicit schemes. The results are compared for all the models and corresponding VST plug-ins have been implemented.

INTRODUCTION

Many analog audio circuit simulations (guitar amplifiers, synthesizers, studio devices etc.) have been released for musicians, who want to replace their equipment with cheaper and more flexible digital equivalents (hardware or software). Nevertheless, the realism of these digital simulations can still be improved. This is mainly due to some nonlinearities that are responsible for the "sound signature of analog audio devices" the modeling of which is often complex and still keeps a lot of people busy. This paper deals with the simulation of guitar tube amplifiers for real-time applications. These devices are composed of three main parts : the preamplifier, power amplifier, and power supply. Moreover, their "sound signatures" follow from designers' choices (location of the tonestack, specific cutoff frequencies, polarization of tube stages etc.). In this article, the behavior of a typical 12AX7 triode stage of a high gain preamplifier is studied, for static and dynamic triode models, with well-suited numerical schemes and implementations of real-time numerical simulations.

THE COMMON CATHODE TRIODE AM-PLIFIER

Presentation

The common cathode triode amplifier is a topology of circuit that has been used in hi-fi and guitar amplifiers to increase the voltage of a signal. It has interesting properties in terms of sound for musicians and audiophiles, which justifies its use today, several years after the apparition of transistors (for example the harmonic content of the triode saturation [START_REF] Barbour | The Cool Sound of Tubes[END_REF]), and its study in papers about guitar amplifiers simulation [START_REF] Serafini | A complete model of a tube amplifer stage[END_REF] [6] [START_REF] Tubaro | Non-linear digital implementation of a parametric analog tube ground cathode amplifier[END_REF] [8] [START_REF] Yeh | A review of digital techniques for modeling vacuum-tube guitar amplifiers[END_REF]. It is found in most of the guitar preamplifiers, which have the purpose to increase the voltage of the guitar's signal (with a maximum voltage of 400 mV, and an impedance of 20 kΩ, depending on the type of guitar pickup), and to enrich its tone. The triode chosen by designers is very often a 12AX7 (also called ECC83).

Electronic circuit

The electronic circuit can be seen in figure 1, with values for its components in the table

Ip

Fig. 1: The common cathode triode amplifier R p . To increase the performances of this topology, the resistance R k is added between the cathode and the ground, to polarize the input voltage, with a decoupling condensator C k in parallel, which limits the variation of the cathode bias potential. The resistance R g limits the grid rectification effect (see next section for explanations). The R o and C o coupling components allow the designer to add several triode amplifiers in cascade, if more distortion of harmonics is needed in the output signal. The condensator suppresses the DC component of the signal, the resistance changes the output gain of the electronic stage, and they act together as a high-pass filter [START_REF] Jones | Valve Amplifiers, third edition[END_REF].

Electronic equations

For this study, the resistances and capacitors are considered ideal, and the triode as a set of two current sources (see figure 2), controlled by the voltages of its poles, the grid (g), the cathode (k) and the plate (p). The influence of the heater is neglected. The triode modeled is a generic 12AX7 / ECC83. Using the Millman's theorem, the electronic circuit can be modeled by a set of differential algebraic equations :

V g R g = -I g + V in R g V p R p + C o dV p dt = -I p + V bias R p + C o dV out dt V k R k + C k dV k dt = I p + I g V out R o + C o dV out dt = C o dV p dt ( 1
)
where I p and I g are functions set by a not trivial choice of the triode's model. In the next sections, the triode behavior and its modeling will be the object of a particular attention.

STATIC TRIODE MODELS

Introduction

The 12AX7 triode is a vacuum tube diode, with a negative grid to cathode voltage Vgk controling the electron flux, generated by the heater from the cathode to the plate. The currents I p and I g are always positive, up to a few mA. The 12AX7 is a high gain triode, with its gain parameter µ around 100. Datasheets -available on the internet -show graphs of the function I p = f (V gk, V pk), got from measures.

Triode models

For the first modeling, we focus on the static triode models of Leach [START_REF] Leach | Spice models for vacuum tube amplifiers[END_REF] and Norman Koren [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF], which are standard and broadly used. They model the triode as two current sources which are a function of the voltages V pk and V gk :

I p = L p (V gk , V pk ) I g = L g (V gk , V pk ) (2)
where L p and L g are nonlinear functions.

Leach's model

The Leach's model is derived from the Child-Langmuire law [3] [5], and also gives an expression for the current I g .

L p = K(µV gk + V pk ) 3/2 if (µV gk + V pk ) > 0 0 else L g = 0 if V gk < V γ V gk -V γ R gk else (3)
The following table gives typical values for the model parameters, from [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF] and SPICE models. The figures 4 and 3 show the dependance of I p with V gk and V pk .

µ K Rgk V γ 88.5 1.73 × 10 -6 20 kΩ 0.6 V
Table 2: Typical values for Leach's model parameters

Norman Koren's model

Derived from the Leach model, Norman Koren's model is "phenomenological", which models the behavior of physical phenomena using parameters not derived from fundamental physics. It has been designed so that plate current I p > 0 whenever plate voltage V pk > 0 [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF]. It matches better published curves from datasheets. The expression of the L p function is the following :

E 1 = V pk Kp ln 1 + exp K p 1 µ + V gk √ K vb +V 2 pk L p = E Ex 1 Kg (1 + sgn(E 1 )) (4)
The following table gives typical values for the model parameters, from [START_REF] Koren | Improved vacuum tube models for spice simulations[END_REF] and SPICE models. The figures 5 and 6 show the dependance of I p with V gk and V pk .

µ K p K vb K g Ex 88.5 600 300 1060 1.4
Table 3: Typical values for Norman Koren's model parameters

Grid rectification effect

The I g current is often neglected in simulations, but it is responsible for the grid rectification effect that designers try to contain using specific polarization.

When the grid-to-cathode voltage V gk becomes positive, the value of I g increases by a few mA. As a One of the uses of the resistance R g is to control the amount of the grid rectification effect. This is why it is usually chosen with high values. Another use of this resistance will be seen in the study of the dynamic triode models. This kind of distortion is not wanted by electronic designers, but exists, and is modeled to increase the realism of the simulation. More, it is one of the reasons of the plate voltage saturation.

Ip (mA) V g k = -2 V V g k = -1 V V g k = 0 V V g k = 1 V
Ip (mA) V p k = 0 V V p k = 5 0 V V p k = 1 0 0 V V p k = 1 5 0 V V p k = 2 0 0 V V p k = 2 5 0 V V p k = 3 0 0 V V p k = 3 5 0 V
Complex ways to model this current are described in SPICE circuits, like replacing the current source by a diode and a resistance, but the adopted model for the current I g is the expression from the Leach's 7), as a first study of the grid rectification effect. Improvements will be done in a future work using measures.

Ip (mA) V g k = -2 V V g k = -1 V V g k = 0 V V g k = 1 V
Ip (mA) Vpk =0 V V p k = 5 0 V V p k = 1 0 0 V V p k = 1 5 0 V V p k = 2 0 0 V V p k = 2 5 0 V V p k = 3 0 0 V V p k = 3 5 0 V
Next, deriving the equations of the circuit for these models leads to nonlinear differential algebraic systems, with a state-space-like representation. For nonlinear cases, the expression of dX/dt and Y can be replaced with nonlinear functions of X and U . Moreover, the nonlinearity can introduce implicit equations. They are expressed using a static nonlinear state vector W , and added to the state space representation.

dX/dt = f (X, W, U ) 0 = g(X, W, U ) Y = h(X, W, U ) (6)

State-space equations of the triode amplifier

The dynamic behavior of the circuit is caused by the condensators. The nonlinearity comes from the triode modeling, and the expression of the currents I p and I g . Therefore, the condensators voltages have been chosen as the dynamic state variables, and the triode potentials as the static nonlinear state variables, which have an implicit expression. Let the state variables be :

U = V in X = [V k V out -V p ] T W = [V p V g ] T Y = V out (7)
The dimension of the vectors X and W are both equal to two. The state space representation of the triode stage is the following :

f (X, W, U ) = -X1 R k C k + Ig+Ip C k -X2+W1 RoCo g(X, W, U ) = W 1 + R p (I p + X2+W1 Ro ) -V bias W 2 -U + R g I g h(X, W, U ) = X 2 + W 1 (8)
with

I p = L p (W 2 -X 1 , W 1 -X 1 ) I g = L g (W 2 -X 1 , W 1 -X 1 ) (9)
This extended state space representation yields to a numerical simulation with standard methods of resolution, for differential and implicit equations.

Resolution of differential equations and numerical schemes

The notation Z n indicates the state of the variable Z for the n-th sample. For each sample, X n is determined using methods of resolution for the differential equations dX/dt = f (X, W, U ), and then the zeros of 0 = g(X, W, U ) give W n with implicit equations resolution methods.

Differential equations

Let T e be the sampling period and F e the sampling frequency. A method to resolve differential equations in the discrete domain is to approximate dX/dt with F e × (X n+1 -X n ). This is the explicit Euler method (see equation 10).

X n+1 = X n + T e f (X n , W n , U n ) (10)
In general, we prefer to use explicit Runge-Kutta methods instead of explicit Euler, for stability and accuracy considerations [START_REF] Demailly | Analyse numerique et equations differentielles[END_REF]. The resolution of the function dX/dt = f (X, W, U ) will be done with the Runge-Kutta second order method (see equation [START_REF]LTSpice IV / Switcher-CAD III[END_REF].

k 1 = T e f (X n , W n , U n ) ( 11
)
X n+1 = X n + T e f (X n + k 1 2 , W n , U n + U n+1 2 )

Implicit equations

The equation 0 = g(X, W, U ) is implicit. The standard method of Newton-Raphson is used to find the value of W , which satisfies the implicit equation 0 = g(X, W, U ), for constant values of X and U . This algorithm is iterative, and converges to a solution for W .

Let W k n be the approximated value of W at the iteration k of the algorithm for the sample n. J(g(X, W, U )) is the Jacobian matrix of g(X, W, U ), derived with respect to the vector W .

W k+1 n = W k n -J -1 (g(X n , W k n , U n ))×g(X n , W k n , U n ) (12)
If W 0 n is close to the solution, the algorithm converges faster. Because the variation of W between two samples can be considered low if the sampling frequency F e is high, W n-1 is chosen as the initialization value.

The number of iterations done for each sample is constant. Studying the error on W and the speed of its convergence reveals that four iterations for the Newton-Raphson algorithm are sufficient. This numerical scheme is efficient and stable, and has been implemented in a real-time application as a VST plug-in for the two triode models.

Comparisons

The simulations with the static triode models of Leach and Norman Koren are compared. First, the curves of the function L p are compared to the ones found in the datasheets of the 12AX7. It appears that the Norman Koren's model is more realistic than the Leach's one, it models the behavior of the triode better for high grid and plate voltages.

Second, the behavior of the simulated circuit is observed. A sine waveform with a frequency of 200 Hz and an amplitude of 10 V is used to feed the input of the triode stage. The consideration of the I g current is essential in the two cases, and changes the maximum of the grid voltage, which can feed the triode according to the rectification effect. Without taking it into account, the grid voltage can be very high, exceeding the physical limit of voltage the real triode's grid can handle, and command impossible voltages like a negative V p voltage with the Leach's model.

As a result, Norman Koren's static triode model is chosen as the most efficient.

DYNAMIC TRIODE MODELS

The accuracy of the triode model can be increased if its dynamic behavior is considered. It is modeled from the Norman Koren's static model, including three parasitic capacitances between its poles.

Parasitic capacitances and Miller effect

The capacitance values of table 4 are taken from the datasheets, for C gp (grid-plate), C gk (grid-cathode) and C pk (plate-cathode).

Cgp

Cgk Cpk 1.7 pF 1.8 pF 1.9 pF to the two other capacitances, and acts in combination with R g as a lowpass filter, with a minimum cutoff frequency at 5 kHz. These results have been confirmed using SPICE [START_REF]LTSpice IV / Switcher-CAD III[END_REF] simulations and are audible. The other capacitances have a very low influence on the frequency response, and have therefore been neglected in the following study. The difference between the frequency response of the triode stage with and without the parasitic capacitances are shown in the figure 10.

New circuit and new equations

The circuit seen in figure 11 is the same triode amplifier as before, taking the parasitic capacitance Cgp of the 12AX7 into account, and yields to a new set of equations, resulting from the Millman's theorem.

V k R k + C k dV k dt = I g + I p V g R g + C gp dV g dt = -I g + V in R g + C gp dV p dt V p R p + (C o + C gp ) dV p dt = -I p + V bias R p +C o dV out dt + C gp dV g dt V out R o + C o dV out dt = C o dV p dt (13)
Adding a capacitance in the circuit does not add an equation in the system. As a result, the dimension of the vector X becomes three, and the new dimension of W is one. The new state-space variables are :

U = V in X = [V k V out -V p V g -V p ] T W = V p Y = V out (14)
The extended state-space representation of the sys-

f (X, W, U ) =      -1 R k C k X 1 + 1 C k (I g + I p ) -1 RoCo (X 2 + W 1 ) 1 Cgp (-I g + U -X3-W1 Rg ) g(X, W, U ) = W 1 -V bias R p + I p + I g + ... -U R g + X 2 + W 1 R o + X 3 + W 1 R g h(X, W, U ) = X 2 + W 1 (15)
with

I p = L p (X 3 + W 1 -X 1 , W 1 -X 1 ) I g = L g (X 3 + W 1 -X 1 , W 1 -X 1 ) (16)

Stiff problems and stability

The simulation of the new set of equations, using the previous numerical scheme, is not stable. Indeed, the parasitic capacitance C gp , with its very low value, can involve high derivatives of the vector X : a stiff problem appears.

There is no rigorous definition of stiffness in the literature, but it can be considered as a differential equation for which certain numerical methods for solving the equation are numerically unstable, with some terms that can lead to rapid variation in the solution. This requires the use of implicit numerical schemes, like implicit Euler methods (see equation 17). The Newton-Raphson algorithm is used for both the resolution of the dynamic and nonlinear implicit equations.

X n+1 = X n + T e f (X n+1 , W n+1 , U n+1 ) (17)
This new numerical scheme is stable and implemented as a VST plug-in too.

Comparisons

The new triode model takes more parameters into account than the static ones. The parasitic capacitance changes the frequency response of the triode stage, and the results are audible. With the same sinusoid than before as an input, we can see that the output signal waveform has a different shape and a different harmonic content, which matches with the equivalent simulation results in SPICE [START_REF]LTSpice IV / Switcher-CAD III[END_REF], considered as our reference for the numerical schemes. Changing a linear element inside a dynamic and nonlinear system with delay free loops changes the way the signal is distorted and in a complex way that cannot be modeled by a simple additional filter inside the signal chain.

Alternatively, the need for Newton-Raphson algorithm's for both differential equations and nonlinear implicit equations has a cost, in terms of CPU consumption, which is not negligible for real-time applications. Code optimization will become necessary for the simulation of more stages and full guitar amplifiers, using for example tables and interpolation algorithms.

DISCUSSION

The choice of the sampling frequency (96 kHz in our case) is very important, for three reasons. First, the use of high sampling frequencies or oversampling functions is recommended for nonlinear digital simulations, to avoid the apparition of aliasing in the audible frequencies. Secondly, the differential equations resolution algorithms use F e as a step, so increasing the sampling frequency increases the accuracy of the processing. Lastly, the more the sampling frequency is important, the less is the variation of W between two samples. The convergence of the Newton-Raphson algorithm is faster if its initial value is close to the solution W of the equation g(X, W, U ) = 0. As such, increasing the sampling frequency increases the convergence's speed of Newton-Raphson's algorithm for a given number of iterations.

In realistic terms, the simulation of the triode stage is able to produce signals with a rich harmonic content, if the gain of the input signal is high enough. Three or four triode stages in cascade, with a good cabinet simulation, result in a good approximation of a high gain guitar amplifier sound. Sound examples are available at http://www.orosys.fr/ cohen/aes127.htm.

CONCLUSION

A preamplifier stage has been studied and simulated for Leach and Norman Koren's static models as well as dynamic versions, with efficient numerical schemes for real time applications. As a result, the Norman Koren's model combined with the parasitic capacitance C gp was selected, for both objective and perceptive considerations. It yields to the implementation of plug-ins, which produces satisfactory sounds with standard cabinet simulations. Moreover, future work will be dedicated to model and simulate the other stages of a guitar amplifier, and to increase the efficiency of the electronic components models using measures.

Fig. 2 :

 2 Fig. 2: The triode's model

Fig. 3 :

 3 Fig. 3: I p function of Vpk for the Leach's model

Fig. 4 :

 4 Fig. 4: I p function of Vgk for the Leach's model

Fig. 5 :

 5 Fig. 5: I p function of Vpk for the Koren's model

Fig. 6 :

 6 Fig. 6: I p function of Vgk for the Koren's model

3. 4 .Fig. 7 :

 47 Fig. 7: I g function of Vpk

Fig. 8 :

 8 Fig. 8: Output signal for Leach's model (respectively without and with the I g current)

Table 4 :Fig. 9 :

 49 Fig. 9: Output signal for Koren's model (respectively without and with the I g current)

Fig. 10 :

 10 Fig. 10: Frequency response

Fig. 11 :

 11 Fig. 11: The common cathode triode amplifier with the parasitic capacitance Cgp

Fig. 12 :

 12 Fig. 12: Output signal for the dynamic triode's model

Table 1 :

 1 1. Typical values of components used in the common cathode triode amplifierThe triode is a current source controlled by a voltage, and can be considered as a voltage source if we connect the cathode to the ground, and the plate to a constant voltage source V bias and a load resistance

	Rp	Rg	Ro	Rk
	100 KΩ 220 KΩ 22 KΩ	2.7 KΩ
	Vbias	Co	Ck
	300 V	20 nF	10 µF


David Widory

Frédérick Gal

Eric Proust

Bernhard Mayer

Bernhard Mayer Comparison

Comparison of shallow aquifer and soil gas monitoring approaches for detecting CO2 leakage at a natural analogue site in France

Natural analogue sites where geologic CO 2 is leaking to the surface provide excellent opportunities to test approaches suitable for monitoring for potential CO 2 leakage at carbon capture and storage sites. We tested isotope monitoring approaches for CO 2 detection in shallow aquifers and the overlying soil zone at a CO 2 analogue site near Sainte-Marguerite in the Massif Central (France). The Sainte-Marguerite area is located in the southern part ofthe Limagnegraben(FrenchMassif Central).Thebasement, composed of highlyfractured granite, outcrops toward the west of the study area,notably around the Saladis spring. An intercalated arkosicpermeable interval between fractured granite and Oligocene marls and limestonesacts as a stratiform drain for fluid migration while the overlying thick Oligocene interval is impermeable and acts as aseal. The Allierriver bed is located near the contact betweenthe basement and the sedimentary rocks. Deep CO 2 -ladden fluids migrate through the arkose intervaltoward the Sainte-Marguerite area and sustain a number of local springs.The Sainte-Marguerite area is known for the travertinedeposits associated with the CO 2 -rich natural springs.

We collected water samples and effervescentgases at the springs as well as soil gases for chemical and isotopic analyses. The analytical parameters included major anions and cations,  13 C& 18 O of CO 2 , D& 18 O of H 2 O and  13 C of dissolved inorganic carbon (DIC). Preliminary results revealed that  13 C values of CO 2 in most groundwater and soil samples were similar. Oxygen isotope measurements revealed equilibrium between CO 2 and H 2 O-oxygen in most samples, but except for a limited number of samples, 18 O values of water did not deviate significantly from the local meteoric water line. Our preliminary results suggest that both the groundwater and the soil sampling approaches should be capable of detecting leakage of CO 2 provided that the leaking gas has a distinct isotopic composition. The thresholds of leakage detection are currently determined in laboratory column experiments, where CO 2 of known isotopic composition is bubbled through a water-saturated sand at different rates and continuously measured for its  13 C and  18 Oisotope composition using laser spectroscopy. The potential for isotope exchange between oxygen from water and oxygen from bubbling CO 2 is also evaluated.

  Comparison of shallow aquifer and soil gas monitoring approaches for detecting CO 2 leakage at a natural analogue site in France

	D. Widory 1 , F. Gal 1 , E. Proust 1 & B. Mayer 2
	1 Bureau de Recherches Géologiques et Minières (BRGM), 3 Avenue Claude Guillemin,
	BP 36009, 45060 Orléans Cedex 2, France
	2 Department of Geoscience, University of Calgary, 2500 University Drive NW,
	Calgary, Alberta, Canada T2N 1N4