• No results found

Discrete time variational mechanics of multidomain systems: Applications to coupled electronic, hydraulic, and multibody systems

N/A
N/A
Protected

Academic year: 2021

Share "Discrete time variational mechanics of multidomain systems: Applications to coupled electronic, hydraulic, and multibody systems"

Copied!
179
0
0

Loading.... (view fulltext now)

Full text

(1)

Discrete time variational mechanics of multidomain systems:

Applications to coupled electronic, hydraulic, and multibody systems

by

Tomas Sj¨ostr¨om

Master Thesis for the degree of

Master of Science in Engineering Physics

Supervisor: Claude Lacoursiere Examiner: Matrin Servin

November 23, 2012

Ume˚ a University Department of Physics

SE-901 87 UME˚ A

Sweden

(2)
(3)

Abstract

English

Today there exist few non-smooth multi-domain simulation tools using time- discretized Lagrangian mechanics for circuits.The main goal is to show that it is possible to use a semi-implicit, parameter free non-smooth variational time stepper to simulate the circuits with time-steps proportional to the system time scales.

This is demonstrated by implementing and performing extensive numerical tests for various types of electrical, mechanical and hydraulic components and demonstrate that the components are stable, with the correct behavior when the system is solved using a modified block pivot solver.

Simulation results shows that piecewise linear models are enough for the simple switching circuits in this thesis.

Svenska

Idag finns det f˚a simulatorer f¨or icke-sl¨ata multidom¨an kretsar som bygger p˚a tidsdiskretisering av Lagranges ekvationer.

Huvudm˚alet ¨ar att visa att det ¨ar m¨ojligt att anv¨anda en semi-implicit, parameter fri icke-sl¨at diskret l¨osare f¨or att simulera kretsar med tidssteg pro- portionella mot systemens tidsskalor.

Detta visas genom att implementera olika typer av elektriska, mekaniska och hydrauliska komponenter samt att visa att komponenterna ¨ar stabila och har r¨att beteende n¨ar systemet simuleras av en modifierad block pivot l¨osare.

Simulerings resultaten visar att icke-sl¨ata Newton metoder med styckvis- linj¨ara komponenter och komplement¨ara villkor ¨ar tillr¨akligt f¨or att simulera brytande komponponenter i de simulerande kretsarna.

(4)

Acknowledgments

First and for-most I want to thank my supervisor Claude Lacoursiere for helping me under a year will I worked on this Master Thesis. I also want to thank Algoryx Simulation AB for providing me with an interesting master thesis.

Last I want to thank all at UMIT Research Lab at Ume˚a University for letting me work there.

(5)

Contacts

Student

Name Tomas Sj¨ostr¨om

Adress Bob¨acksv¨agen 12 92262 Tavelsj¨o Sweden Visit address MIT building, Campustorget 5, UMIT-lab Phone number 076 1470678

Email tomas sjostrom@hotmail.com Client

Name Algoryx Simulation AB

Adress Uminove Science Park, Box 7973SE – 907 19 Ume˚a Sweden Visit address Uminove Science Park, Box 7973SE – 907 19 Ume˚a Sweden Phone number 46-90-717090

Email contact@amgoryx.se Supervisor

Name Claude Lacoursiere

Adress Ume˚a University SE-901 87 Ume˚a Sweden Visit address MIT building, Campustorget 5, MA456 Phone number 46 706754242

Email claude@hpc2n.umu.se Examinator

Name Matrin Servin

Adress Ume˚a University SE-901 87 Ume˚a Sweden Visit address MIT building, Campustorget 5,MA456 Phone number 46 907866508

Email martin.servin@physics.umu.se

(6)

Contents

1. Introduction 11

1.1. Problem Statement . . . 12

1.2. Related work . . . 12

1.3. Original contributions . . . 13

1.4. Limitations . . . 13

2. Definitions 14 I. Theory 15 3. Lagrangian mechanics 16 3.1. Euler Lagrange equation . . . 16

3.2. Generalization . . . 17

3.2.1. Kinetic storage . . . 17

3.2.2. Potential storage . . . 18

3.2.3. Pure dissipators . . . 18

3.3. Constraints . . . 19

3.3.1. Charge-conservation . . . 20

4. Multi-domain system 21 4.1. Mechanical systems . . . 21

4.2. Electrical systems . . . 21

4.3. Hydraulic systems . . . 22

5. Discrete time variational mechanics 24 5.1. Potential and kinetic storage . . . 24

5.2. Pure dissipators . . . 24

5.3. Component connection . . . 25

5.4. Time stepping . . . 25

6. The linear complementarity problem 28 6.0.1. Inequality constraints . . . 29

(7)

6.0.2. Impact stage . . . 29

6.1. Mixed LCP solver . . . 30

7. Lumped components and their discretization 33 7.1. Creating component . . . 33

7.2. The resistor . . . 34

7.3. The ideal voltage source . . . 36

7.4. The ideal current source . . . 37

7.5. The inductor . . . 38

7.6. The capacitor . . . 39

7.7. The diode . . . 40

7.8. The transformer . . . 42

7.9. The transistor . . . 45

7.10. The operational amplifier . . . 47

7.11. The electric motor . . . 52

7.11.1. Ideal motor . . . 52

7.11.2. Non-Ideal motor . . . 54

7.12. The hydraulic pump . . . 57

7.13. The hydraulic pipe . . . 58

7.14. The check valve . . . 60

7.15. The relief valve . . . 61

7.16. The hydraulic piston . . . 62

8. Circuits 68 8.1. Serial circuit . . . 71

8.1.1. Circuit . . . 71

8.1.2. Time scale . . . 71

8.2. Parallel circuit . . . 72

8.2.1. Circuit . . . 72

8.2.2. Time scale . . . 72

8.3. RLC circuit . . . 73

8.3.1. Circuit . . . 73

8.3.2. Time scale . . . 75

8.4. Single diode . . . 76

8.4.1. Circuit . . . 76

8.4.2. Time scale . . . 76

8.5. The diode bridge . . . 77

8.5.1. Circuit . . . 77

8.5.2. Time scale . . . 79

(8)

8.6. The transformer . . . 81

8.6.1. Circuit . . . 81

8.6.2. Time scale . . . 83

8.7. The common emitter amplifier with BTJ . . . 84

8.7.1. Circuit . . . 84

8.7.2. Time scale . . . 85

8.8. The flip-flop . . . 86

8.8.1. Circuit . . . 86

8.8.2. Time scale . . . 87

8.9. The differential amplifier . . . 88

8.9.1. Circuit . . . 88

8.9.2. Time scale . . . 89

8.10. The non-Inverting amplifier . . . 90

8.10.1. Circuit . . . 90

8.10.2. Time scale . . . 92

8.11. The electric motor start up . . . 93

8.11.1. Circuit . . . 93

8.11.2. Time scale . . . 94

8.12. The hydraulic piston with dry friction . . . 96

8.12.1. Circuit . . . 96

8.12.2. Time scale . . . 98

II. Method 99 9. Implementation 100 9.1. Breadboard . . . 100

9.1.1. Example . . . 101

9.2. Circuit split . . . 104

9.2.1. Artificial ground potential . . . 108

9.2.2. Algorithm . . . 111

III. Results 112 10. Test runs 113 10.1. Serial circuit . . . 114

10.2. Parallel circuit . . . 116

10.3. RLC circuit . . . 118

10.4. Single diode . . . 120

(9)

10.5. The diode bridge . . . 122

10.6. The transformer . . . 123

10.6.1. High impedance . . . 123

10.6.2. Low impedance . . . 125

10.7. The common emitter amplifier with BTJ . . . 127

10.8. The flip-flop . . . 129

10.9. The differential amplifier . . . 130

10.10.The non-Inverting amplifier . . . 131

10.11.The electric motor start up . . . 133

10.11.1.The ideal electric Motor . . . 133

10.11.2.The non-ideal electric Motor . . . 135

10.12.The hydraulic piston with dry friction . . . 137

11.Discussion 139 11.1. Solvability . . . 139

11.2. Stability . . . 140

11.3. Computational complexity . . . 141

11.4. Circuit split . . . 143

11.5. The diode . . . 144

11.5.1. The ideal diode model . . . 144

11.5.2. The Shockley diode . . . 146

11.5.3. Piecewise linear model . . . 147

11.6. The transistor . . . 148

11.7. The transformer . . . 148

11.8. The operational amplifier . . . 148

11.9. The electric motor . . . 148

11.10.The hydraulic pump . . . 149

11.11.The hydraulic pipe . . . 149

11.12.The check valve . . . 149

11.13.The relief valve . . . 149

11.14.The hydraulic piston . . . 150

11.15.Comparison to 5Spice . . . 151

11.16.Comparison to Hopsan . . . 154

11.17.Proof of concept . . . 155

12.Conclusions 156

13.Future work 157

(10)

IV. References 158

V. Appendix 161

14. Appendix A 162

14.1. Serial Circuit . . . 163

14.2. Parallel Circuit . . . 164

14.3. RLC Circuit . . . 165

14.4. Single Diode . . . 166

14.5. The diode Bridge . . . 167

14.6. The transformer . . . 168

14.7. Common Emitter Amplifier with BTJ . . . 169

14.8. The flip-flop . . . 170

14.9. The differential Amplifier . . . 171

14.10.the Non-Inverting amplifier . . . 172

14.11.The electric motor ramping up . . . 173

14.12.The hydraulic piston with dry friction . . . 174

15. Appendix B 175 15.1. Connection 1 . . . 175

15.2. Connection 2 . . . 176

15.3. Connection 3 . . . 178

15.4. Connection 4 . . . 178

15.5. Connection 5 . . . 179

15.6. Connection 6 . . . 179

(11)

1. Introduction

Large vehicles consist of components from many different domains, a loader may have a mechanical scoop powered by hydraulic cylinders that is in turn controlled by an electric system. If the time-step used by the time stepper is longer then the time it takes to calculate the time-step, it’s possible to simulate the loader in real-time. It’s also important that the solution is stable with an error not diverting to infinity.

The main objective for this thesis is to evaluate an semi-implicit, parameter free non-smooth variational multi-domain time stepper that is build on work done for mechanical systems in Lacoursi`ere (2007). This is demonstrated by implementing and performing extensive numerical tests for various types of electrical, mechanical and hydraulic components and then demonstrate that the components are stable, with the correct behavior when the system is solved using a modified block pivot solver.

The thesis is divided into three parts. The first part describes the theory be- hind the project, the second part highlights special parts of the implementation and the last part contains results together withe proof of concept.

The theory part begins by explaining Lagrangian mechanics and constraints in chapter 3 with the equation of motion in equation 3.16. It counties in chapter 4 by showing that the different domains can be described using conservation of energy. Chapter 5 discretize the Lagrangian and shows the time stepper.

The chapter about linear complementarity problem shows how inequalities can be described by complementarity conditions. In chapter 7 the components are discretized and chapter 8 shows the dynamics for the different circuits.

The general principles behind the breadboard and modifications to the block pivot solver is in methods, chapter II.

The last part contains the results from the simulated circuits in chapter 10 and are then discussed in chapter 11. Chapter 12 together with chapter 13 contains the general conclusions from this master thesis.

The appendix’s contains the parameters from the simulations as well as an description of the principal sub matrices for an non-symmetric diode.

(12)

1.1. Problem Statement

The purpose of this thesis is to show, using extensive numerical testing that dis- crete time variational principle can be used to formulate and solve multi-domain systems. The goal is to systematic use differential algebraic equations(DAEs) with free variables to describe the system and avoid using co-simulation, but instead simulate the different domains in the same solver.

Solving DAE numerically often introduce numerical difficulties. The usual way is therefor to describe the circuits as systems of ordinary differential equa- tions, ODEs. In this thesis this is avoided by using discrete-time variational mechanics.

The main reason for using discrete-time variational is to construct a solver that can simulate systems using time steps in the same order as the natural periods of oscillations of interest. This is unlike models like Spice requires unnecessary small time-step because of non-linearities represented by functions with sharp derivatives.

1.2. Related work

This is not the first time DAEs and the variational principle is used to described electrical circuits For instance Layton has a similar approach but unlike the description in this thesis, the equation of motion used by Laytons in (Layton, 1998, page 297) leads to singular matrices.

Ad hoc integration methods in Acary et al. (2011b) for non-smooth DAE’s includes free parameters, i.e., the θ method where they need to choose θ and don’t have a solid justification for it. Spice in Quarles et al. (2012) requires non-linear iterative solvers with small time-steps to resolve non-linear functions using smooth ODE’s. The Modelica solver in Modelica Association (2012) uses general high order, solver DAE solvers, while according to (Lacoursi`ere, 2007, chap 4) the solver in this thesis is a one step stable method tailored to for cir- cuits. Marsden in Ober-Bl¨obaum et al. (2011) has Variational method for elec- trical circuits but not electronics. According to solving Modelica Association (2012) multi-domain systems with co-simulation using ODE integrators is gen- erally less stable then system DAE’s.

Many if not all these methods require clever preprocessing to eliminate the nodal matrix. For instance modified nodal analysis where the size of the solu- tion matrix is reduced by making the smaller matrix more dense.

(13)

1.3. Original contributions

The theoretical work done in this thesis has been a collaboration between the author of this thesis Tomas Sj¨ostr¨om and the supervisor Claude Lacoursiere see table 1.1.

Tomas Sj¨ostr¨om Claude Lacoursiere

Work Section Work Section

Transformer 10.6 Resistor 7.2

None ideal motor 7.11.2 Inductor 7.5

Piston 10.12 Capacitance 7.6

The split circuit algorithm 9.2 Diode 7.7

Breadboard 9.1.1 Transistor 7.9

The expanded tikz library Whole report Op-amp 7.10

Motor 7.11.1

Pipe 7.13

Figure 1.1.: Shows the theoretic work done by Claude Lacoursiere

1.4. Limitations

Ideal components pose a problem as they can introduce undamped high fre- quencies. This means that if they operates at time scales shorter than the time-step won’t be damped. Two of the components, the op-amp and tran- sistor introduce asymmetries in the complementarity problems. It is easier to solve symmetric positive define LCP problems. The proof to show that the asymmetries can be solved are not done. Only the time-step size has been compared between the different methods used in this thesis. The solution time has not been compared due to the solver used by this thesis is has not been optimized.

(14)

2. Definitions

Matrices in this thesis are denoted with capital letters iEX the impedance matrix is denoted by Z. Vector and scalars are denoted with small letters except for volume-rate that is denoted by Q, the distinction is apparent from the context.

Symbols

The following symbols are used in circuit diagrams Voltage Source Current Source

Resistor Inductor

Diode Motor

Transformer Opamp

NPN Transistor Mosfet Transistor

Ground Mass

Pump Check Valve

Spool Valve Piston

Relife Valve Reservoir

General circuit Z

(15)

Part I.

Theory

(16)

3. Lagrangian mechanics

3.1. Euler Lagrange equation

The theory in this master thesis is based on classical Lagrangian mechanics.

By using an energy based principle, the coupling between different domains, i.e. mechanical, electrical and hydraulic can be formulated in a unified way, and solved simultaneously. This is unlike methods i.e. Simulink that requires the use co-simulations using different time integrators and solvers for different domains.

Conservative physical systems can be described by the Lagrangian is given by

Lps,s, t9 qTps,s, t9 qVps, tq (3.1) where s are the generalized coordinates and s9 are the generalized velocities.

The action is defined as

S

»

Lps,s, t9 qdt (3.2)

Equation 3.1 only accounts for conservative forces. In order to account for dissi- pative forces given by the Rayleigh dissipation function as defined in (Lacoursi`ere, 2007, page 68) to be

f 

Bps,s9q

Bs9 (3.3)

The energy dissipation rate for a Lagrangian without explicit depends given by (Lacoursi`ere, 2007, page 69) by

dE dt 

B

Bs9s9 (3.4)

where E T V is the energy.

The derivation of the Euler Lagrange’s equation can be derived in different ways, using the Hamiltonian principle of least action or the energy principle as

(17)

in (Layton, 1998, page 290-297) and can be written as d

dt

BL

Bs9  BL

Bs 

Bps,s9q

Bs9 (3.5)

3.2. Generalization

In Lacoursi`ere (2007) components are build on energy transference, storage and transformation which is common to mechanical, electrical and the hydraulic domain. Energy in a components is defined as

E

»

Pptqdt

»

peptqfptq qdt (3.6) where E is the energy of the component, P is the power, e is the effort and f is the flow. For instance electrical circuits has the P IU. The systems are seen as ideal, energy don’t leave the system.

Due to the fact thats9and s is in general coordinates and can be interpreted as in table 3.1

Effort e Flow f Displacement s Momentum p

force F velocity v position x linear Momentum x

torque τ angular velocity ω angle Θ angular Momentum Θ

voltage U current I charge q flux linkage Λ

pressure P volume rate Q volume V Pressure momentum V temperature T entropy rate S entropy S pnoneq

Figure 3.1.: Shows correspondence between mechanical, electrical and hy- draulic systems, from (Layton, 1998, page 276)

the energy postulate can be used in all domains.

3.2.1. Kinetic storage

The derivative of the momentum is defined as

p9e (3.7)

for example for a single particle with mass m the momentum is p mv and the effort is F mv.9

Replacing edt  dp and using the same definition of kinetic storage as in (Layton, 1998, page 276) yields the kinetic energy part of the Lagrangian to

(18)

be

Lps,s, t9 q

»

gpfqBf (3.8)

where gpfq is a function of the flow

Each component can then be derivatived with respect to the flow to yield the Euler Lagrange equation

d dt

BLps,s, t9 q

Bs9 gpfq (3.9)

3.2.2. Potential storage

The derivative of displacement flow as

s9f (3.10)

in mechanical systems vx9

Replacing f dt  ds and using the same definition of kinetic storage as in (Layton, 1998, page 276) yields the potential energy part of the Largrantian to be

Lpq,q, t9 q

»

gpfqdf (3.11)

where gpqq is only depending on displacement.

Each component can then be derivatived respect to the displacement to yield the Euler Lagrange equation

BLpq,q, t9 q

Bq gpqq (3.12)

3.2.3. Pure dissipators

Pure dissipator is by definition not conservative forces and can’t be described by the Lagrangian. A flow through a component exerts a dissipative effort on the system described in the same way as in (Layton, 1998, page 279) by a dissipative state function on the form

pfq

»

gpfqdf (3.13)

where ℜ is a Rayleigh dissipation function. For a resistor with resistance R and current I the state function becomes ℜpfq 12RI2.

(19)

The derivative in the Euler Lagrange equation becomes ℜpfq

Bf gpfq (3.14)

3.3. Constraints

Constrains are restrictions on the degrees freedoms in the system, in this thesis on the displacements, flows and on the effort. If a constraint is violated it applies a constraint force on the system that direct the system to a nonvolatile state, i.e. a ball penetrating a surface is force up to the surface by a non- penetration constraint.

In this thesis only holonomic(displacement dependent) gps, tq ¥0 and non- holonomic(displacement and flow dependent) aps, f, tq¥0 constraints are con- sidered. The f part of the Euler equation can in principle be seen as effort constraints with regularization in the form of mass. Pure effort constraints, without regularization are not allowed due to the fact that it is possible to put the constraints parallel to each other see figure 11.2.

The constraints can augmented to equation 3.1 as seen in (Lacoursi`ere, 2007, page 72-79) to

L



s,s, λ,9 λ, t9

Lps,s, t9 q λgps,s9q (3.15) subjected to Rayleigh function in equation 3.3.

The corresponding Euler Lagrange equation is derived in (Lacoursi`ere, 2007, page 72-79) to

d dt

BLps,s, t9 q

Bs9 

BLps,s, t9 q

Bs GTλATα9 Bps,s9q

Bs9

d dt

BL



λ,λ, t9

B

λ9

 BL



λ,λ, t9

Bλ gps,s, t9 q0



Bpα,α, t9 q

Bα9 aps,s, t9 q0

(3.16)

where the Jacobian matrix is defined as Gij 

Bgi

Bqj and Aij 

Bai

BIj. Note that the constraint force is given by Aα and Gλ. The magnitude of the force is given by λ ,α and it’s direction is given by the steepest descent (the Jacobian).

Equation 3.16 can be written

(20)

3.3.1. Charge-conservation

Coupling lumped components together is done using Kirchhoff’s current law or corresponding conservation of mass for hydraulics, i.e. that the current into a node must be the same as the current out from a node, if not the node will have a buildup of charge

The Kirchhoff’s current law can be written as

¸

i

ajiq9iIs,j 0 (3.17)

where aji Pr1, 0, 1sis the Jacobian matrix A also called nodal matrix and Is,j

is the sum of current source i at node j. The rows of the Jacobian corresponds to the nodes in the circuit and the coulombs corresponds to the currents. A component with one current connected to node one and two would have a Jacobian matrix on the form

A



1

1



(3.18) where the sign indicates if the current goes into the node or out from the node.

Equation 3.17 correspond to the holonomic conservation of charge constraint and is enforced by the current.

Equation 3.16 then becomes

d dt

BLps,s, t9 q

Bs9 

BLps,s, t9 q

Bs ATU Bps,s9q

Bs9

Aq9Is

(3.19)

where f contains the current sources and the constraint force is the voltage U .

(21)

4. Multi-domain system

4.1. Mechanical systems

The flow variable for mechanical systems is as can be seen in table 3.1 velocity and the constraint effort is force. In this thesis only 1D kinetic stores in the form of 1D multi-body has been implemented to describe the mechanical world.

The kinetic energy becomes

TpfqTpvq 1

2mv2 (4.1)

where m is the mass. The body can subjected to some potential Vpsq , iEX gravity as well as some dissipative force gpvq. This yields the equation of motion3.5 to be on the form

mv9BV

Bs gpvq (4.2)

and can then be augmented with other constraints, i.e. distance constraints as in equation 3.16

4.2. Electrical systems

The electrical systems are fundamental laws, Kirchhoff’s current(KCL) and Kirchhoff’s voltage law (KVL). KVL in electrical circuits is a result of conser- vation of energy and can be written as

¸

i

Ui 0 (4.3)

where Ui is the voltage drop over the component i. Equation states that 4.3 the sum of all the voltage sources in a loop must be equal to the sum of all the voltage drops over all loads in the same loop. In other case, energy will have been created or destroyed.

Coupling lumped components together is done using Kirchhoff’s current law.

The current into a node must be the same as the current out from a node, in other case the node will have a buildup of charge.

(22)

As seen in table 3.1 the effort for an electrical circuit is the voltage and the flow is the current I. In this thesis the electrical system consist of dissipators i.e.

resistors, kinetic storage’s i.e. inductors and potential storage’s i.e. capacitors.

The kinetic energy becomes

Tps, fqTpIq (4.4)

for inductors, the potential energy for capacitors becomes

VpsqVpqq (4.5)

and the dissipative state function becomes

ps, fqpq, Iq (4.6)

The equation of motion 3.5 becomes d

dt

BTpIq

BI 

BVpqq

Bs 

Bpq, Iq

BI (4.7)

which is correspondence to Kirchhoff’s voltage law due to that both laws ensure conservation of energy .

Equation 4.7 can then be augmented with constraints i.e. the conservation of charge as in equation 3.16.

4.3. Hydraulic systems

In correspondence to the electrical circuits in section 4.2 the hydraulically cir- cuits are govern by the conservation of mass and the Bernoulli’s equation.

Bernoulli’s equation ensure conservation of energy is given in (Husain et al., 2009, page 31) as

P

ρ A2Q2

2 const (4.8)

where ρ is the density, A the area and the system has no high difference.

The connection between components are in the hydraulic case done with mass conservation. The mass of the flow into a node from one component must mach the mass of the flow out a node. In correspondence to equation 3.17 the conservation of mass becomes

¸

i

ajiQiQs,j 0 (4.9)

(23)

where aji PrAi,0, Aisis the Jacobian matrix A, Qs,j is the sum of Q sources iat node j, Ai is the Cross section area of the components. A component with one flow connected to node 1 and 2 would have a Jacobian matrix on the form

A



A

A



(4.10) where the sign indicates if the fluid goes into the node or out from the node.

As seen in table 3.1 the effort for a hydraulic circuit is the pressure and the flow if the volume rate Q. In correspondence to the electrical circuits the hydraulic systems consist of dissipators by viscosity, kinetic storage’s through inertia in the fluid and potential storage’s in form of containers. The kinetic energy becomes

Tps, fqTpQq (4.11)

for inductors, the potential energy for containers becomes

VpsqVpVq (4.12)

and the dissipative state function becomes

ps, fqpV, Qq (4.13)

The equation of motion 3.5 becomes d

dt

BTpQq

BI 

BVpVq

BQ 

BpV, Qq

BI (4.14)

which is correspondence to the Bernoulli’s equation due to that both laws ensure conservation of energy.

Equation 4.14 can then be augmented with constraints i.e. the conservation of mass from equation 4.9 as in equation 3.16.

(24)

5. Discrete time variational mechanics

5.1. Potential and kinetic storage

In this thesis the Lagrangian is discretized in the same way as in (Lacoursi`ere, 2007, page 48-49) to a sum of linear functions of short intervals ∆t

Lpsk, sk 1,∆tq

»h 0

Lps,s, t9 qdt (5.1) where N is a constant, ssk 1 and s9 ∆t1 psk 1skq.

The discrete action is defined as

Sps0, s1, .., sN,∆tq

N1

¸

k0

Lpsk, sk 1,∆tq∆t (5.2) The Hamiltonian principle of least action yields

BSps0, s1, .., sN,∆tq

Bsk 

BLpsk, sk 1,∆tq

Bsk

BLpsk1, sk,∆tq

Bsk 0 (5.3) and the discrete time Lagrange equation

BLpsk, sk 1,∆tq∆t

BsTk

BLpsk1, sk,∆tq∆t

BsTk 0 (5.4)

5.2. Pure dissipators

The derivative of the Rayleigh dissipation from equation 3.5 is done in the same way as in (Lacoursi`ere, 2007, page 66-68) to yield the discrete Euler Lagrange equation with dissipative force as

BLpsk, sk 1,∆tq∆t

BsTk

BLpsk1, sk,∆tq∆t

BsTk ∆tfpsk, fk 1q (5.5)

(25)

where f is defined as in equation 3.3 of

BLpsk, sk 1,∆tq∆t

BsTk

BLpsk1, sk,∆tq∆t

BsTk

∆tfpsk, fkq (5.6) depending on which time-step the velocity is taken.

5.3. Component connection

The charge conservation from equation 3.17 is discretized at time-step k 1 and is enforce by the current. It is augmented to equation 5.5 as

BLpqk, qk 1,∆tq∆t

BqkT

BLpqk1, qk,∆tq∆t

BqTk

∆tATU ∆tfpsk, fk 1q ∆tUe Afk 1Is

(5.7) where U is the constraint force force, Ueare external efforts and Isare external flows. Note that the constraint forces don’t depends on previous time-step.

5.4. Time stepping

For the case of inductors the kinetic energy has the form Tptq 1

2fTLf (5.8)

where L is a block diagonal matrix with non-zeros one the diagonal for the kinetic components. For instance for a body with mass m Tptq 12mv2

Potential storage can be can be written as Vptq 1

2sTC1s (5.9)

where C1 is a block diagonal matrix with non-zeros on the diagonal for the potential components. For instances for a capacitor equation 5.9 would be Vptq 2C11q2

In this thesis only linearly dissipators are used this yields a Rayleigh dissi- pation function on the from

pfq 1

2fTRf (5.10)

(26)

where R would contain the resistance on the diagonal in the same way as above.

Discrediting equation 5.8, 5.9 and 5.10 can be done in many different ways.

In this thesis they are chosen in order to yield a non-singular impedance matrix.

The kinetics storage are discretized with

fptq sk 1sk

∆t (5.11)

The potential storage are discretized using the midpoint rule sptq sk 1 sk

2 (5.12)

The discrete Lagrangian becomes

Lpsk, sk 1,∆tq 1

4∆t2psk 1skqTZpsk 1skq 1

8psk 1 skqTZpsk 1 skq

(5.13)

The derivatived dissipation function becomes

fpsk, fk 1qRfk 1 (5.14) Equation 5.7 divided by ∆t would then become



1

∆tL R ∆t

4 C1



fk 1 ATU LfkC1



sk∆t 4 fk

ee Afk 1 Is

sk 1sk ∆tfk 1

(5.15)

where ee is eternal efforts and the solver first solves a matrix to get the flows and efforts then steps the displacements with an semi implicit Euler step.

Collecting the terms in front of fk 1 to an impedance matrices as

Z 





1

∆tL 0 0

0 R 0

0 0 ∆t4 C1



 (5.16)

(27)

and defining the right hand side bLfkC1



sk∆t 4 fk

ee (5.17)

as yields equation 5.15 to become



Z AT

A 0



fk 1 e







b Is



sk 1sk ∆tfk 1

(5.18)

where 0 is the zero matrix representation no relaxation of the constraint. The relaxation is not needed as the KCL is a linear constraint, the constraint is solved exactly and there is no need for relaxation.

Other constraints like the distance constraints may have relaxation with a diagonal matrix instead of zero matrix. This represents soften the constraint and is used in the original Spook solver to ensure that the solution matrix is a P -matrix. As can be seen in chapter 6, having no relaxation gives a Semi definite matrix requiring the algorithm from section 9.2 reduce the number of solutions to one when the circuit is split. The discretization is done in more depth for each component in chapter 7.

If you only remember one thing from this chapter remember the solution

matrix 

Z AT

A 0



(5.19)

(28)

6. The linear complementarity problem

The switching in this thesis is described using complementarity instead of fast changing function, i.e. the diode in section 7.7 has a complementarity condition on the form

Is¤I KU ¥Us (6.1)

which means that if Is ¤ I then U  Us and if U ¤ Us then I  Is. equation 6.1 is shown in figure 6.1

Us

I

Us UQ

IQ

Is

Figure 6.1.: Shows the ideal diodes IV curve

(29)

6.0.1. Inequality constraints

An Other example on complementarity are inequality constraints. The con- straints have the form aps, f, tq ¥ 0, constraints that can be both active and inactive. A mechanical example would be a ball falling towards the floor with a non-penetrating constraint. When the ball falls towards the floor the non- penetration constraint is turn off. But when the ball penetrates the floor the constraint is activated and takes the ball to the surface.

In this thesis the inequality constraints will be used for describing diodes that blocks the current in one direction but not in the other. The constraint Euler Lagrangian is as described in (Lacoursi`ere, 2007, page 78-79) as

d dt

BLps,s, t9 q

Bs9 

BLps,s, t9 q

Bs CTβ Bps,s9q

Bs9

0¤cps,s, t9 qKβ¥0

(6.2)

TheKmeans that if the constraint force is negative the constraint is set inactive and if the constraint force is positive the constraint is active.

6.0.2. Impact stage

If the inequality constraint from section 6.0.1 was the only thing that stops the ball from falling through the floor in section 6.0.1 the ball would collide with the floor with non-zero incident velocity, and be forced to move away from the floor in a very short time interval. An impact model sets that time interval to zero.

This is imposed on the Lagrangian given in (Lacoursi`ere, 2007, page 167) as an LCP on the form





M GT CImpT

G 0 0

CImp 0 0









v λ ν











M v

Gv

w





0¤νKw¥0

(6.3)

where M is the mass matrix, G is the Jacobian for other constraints, CImp is the Jacobian for the impact constraints, vis the velocity before the collision, v is the velocity after the collision, λ is the constraint force, w is a slack variable for the LCP. Notice that the n0 and the relaxations been removed.

When a collision is detected the the impact constraint activates and set the

(30)

velocity of the particle to zero. With the velocity set to zero the time-step before the impact the particle will never penetrate the wall.

6.1. Mixed LCP solver

The electrical and corresponding hydraulic circuits is described as an the linear complementarity problem(LCP) defined in the same way as in (Acary et al., 2011a, 51) as

wSxa

w¯0, x¯0, wTx0 (6.4)

where LCP is totally defined by the matrix S and vector a. The goal is to find a vector x that fulfills that Sxa¯0 while x¯0.

To ensure that equation 6.4 is solvable for any right hand side the S must according to (Lacoursi`ere, 2007, page 298) be a p-matrix, all principle sub matrices have non-zero determinant. Symmetric positive definite matrices are a subclass of p-matrices.

The solution matrix used in this thesis is positive semi definite p0-matrix with one or several solution, especially in the non-symmetric case with transistor and op amp the. To ensure that the LCP has one unique solution all principal sub matrix of S must have full rank. The LCP is solved with a block pivot algorithm. As can be seen in section 9.2 some of the principle sub matrices can have zero determinant. It’s possible to split the circuits into sub circuits with blocking diodes. This is taken care of in the same section by introduction artificial ground nodes.

A S on the form

S



Z AT

A 0



(6.5) is solvable as long as the square nn matrix Z has full rank and the rectangular matrix mn A has full row rank. The complementary conditions used in this thesis is either on the currents corresponding to the Z matrix or on the voltages corresponding to the A. This means that either nodes or currents or both is set to inactive. In practices the equations are removed from the S and the corresponding variable is set to a fix value. If a row is removed the dimension Awill decrease but the rows will still be linearly independent and the LCP still solvable. On the other hand if a current is removed the system can split into

(31)

sub system. These is not the only restriction needed on the S to ensure that the LCP is solvable when the currents are remove.

All components in this thesis are build of Thevenin equivalent components consisting of bi-port devices with one current, i.e. the transistor has tree ports but is build by two diodes where each diode is connected to two ports. The most general form is one bi port device connected to two other circuits on the form

S 



































m 0 0 i j 0 k l 0 n

0 Z2 0 B1 B2 B3 0 0 0 0

0 0 Z3 0 0 0 B4 B5 B6 0

b A1 0 0 0 0 0 0 0 0

c A2 0 0 0 0 0 0 0 0

0 A3 0 0 0 0 0 0 0 0

d 0 A4 0 0 0 0 0 0 0

e 0 A5 0 0 0 0 0 0 0

0 0 A6 0 0 0 0 0 0 0

f 0 0 0 0 0 0 0 0 0



































(6.6)

where b, c, d, e, f , i, k, l, m, n are real constants, m¡0 ,Z are mass matrices, Aare a rectangular matrices with full row rank and Z B has full row rank. A is the nodal matrix and B is the corresponding matrix in KVL, not necessary symmetric.

When the bi-port device is connected to the circuit it can do it in six ways see figure 6.2

Appendix B in section 15 shows which constants that needs to be non-zero.

Note connection with entries not connected to any nodes are only allowed if the node is parallel to an other component also connected to these nodes. In other case it is possible to build a constraint loop which would require a new ground node. A loop would lead to a short circuit between the two nodes and in principle collapse them to one node. For instance the op-amp is working because the input side drives the out put side, but the output side don’t drive the input side. Note that it is possible to connected the input and output side but

In order for the principle sub matrices to have full rank the constants must fulfill table 6.3.

This shows that the components that are designed need to fulfill that the constants fulfill the requirement in table 6.3 as well as full rank in the S.

Note that this require the LCP to be solved by the modified block pivot non-smooth LCP sovler in order to handle the splitting of circuits.

(32)

Z3

Z2

1 2

3 4

5 6

Figure 6.2.: Shows the six different ways a component can be coupled between two circuits with impedance matrix Z2 and Z3

Connection type Required non-zero constants Required zero constants

1 f, n

2 b, d, i, k

3 b, f , i, n d, j

4 d, f , k, n e, l

5 b, c, i, j

6 d, e, k, l

Figure 6.3.: Shows the required values for the constant in equation 6.6 depend- ing on connection type in figure 6.2. The mass is always m¡0

(33)

7. Lumped components and their discretization

7.1. Creating component

The general method for creating electrical components are

* State the Kirchhoff’s volt law for the components. This is the equation that is to be solved for each components.

* Assume the KVL is the current derivative of the Lagrangian.

* Integrate the KVL with respect to current in order to get Lagrangian and Rayleigh function

* Augment corresponding constraints, i.e. charge conservation

* Discretization of the Lagrangian

* Derivative the Lagrangian with respect to charge at time k and voltage The hydraulic components subjected to lamina flow are done in the same way.

(34)

7.2. The resistor

The resistor can be seen as an ideal dissipator yielding a dissipative force on the system. This means that it can be described with a Rayleigh dissipation function.

Kirchhoff’s voltage law, KVL is given by

U RI (7.1)

The Energy dissipation is given by ℜ

»I 0

RIdI 1

2ITRI (7.2)

A resistor has input ports, one in and one out node. This means that the Jacobian from section 3.3.1 becomes

A



1

1



(7.3) The resistors is discretized with I Ik 1 as

 R

2Ik 12 (7.4)

In order for it to have a term in the mass matrix.

The derivation of the Rayleigh dissipation function can be found in (Lacoursi`ere, 2007, page 68) and yields

B

Bqk ∆tRIk 1 (7.5)

B

BU 0 (7.6)

Combining equation , , and 3.16 yields the discretized augmented Euler La- grange equation divide by ∆t to be



Zr 0

0 R



Ir Ik 1







Ar1 Ar2 1 1



Ui Uj







Ur 0





Ar1 1 Ar2 1



Ir

Ik 1







0 0

 (7.7)

where Zr, Ari, Is, Urbelongs to the rest of the circuit and Ui, Uj is the voltage

(35)

at the nodes connecting the resistor to the circuit.

(36)

7.3. The ideal voltage source

An ideal voltage source is an infinite external source of energy imposing a voltage difference UExtbetween in between two nodes. In reality this is not the case, but there is also a small resistance R in a battery reducing the voltage to U0. This gives a KVL as

RIU0 UExt (7.8)

The battery is connected to the circuit in the same way as a resistor with a Jacobian matrix as in equation . This yields the calculations for the battery to be the same as in section 7.2 with the different that the resistor now has an imposed external voltage on the rightsized. In correspondence to equation 7.9 the discretized augmented Euler Lagrange equation divide by ∆t for the battery becomes



Zr 0

0 R



Ir Ik 1







Ar1 Ar2 1 1



Ui Uj







Ur UExt





Ar1 1 Ar2 1



Ir

Ik 1







0 0

 (7.9)

where Zr, Ari,Is ,Ur belongs to the rest of the circuit and Ui, Uj is the voltage at the nodes connecting the resistor to the circuit.

(37)

7.4. The ideal current source

A current source is an infinite supply of external voltage to two existing nodes in the circuit. In order to ensure that the current source is added to existing nodes it is attached in parallel to a resistor with resistance R.

This yields the same KVL as for the resistor but a different in the KCL. The current from the current source IExt will flow into one of the resistors nodes and out from the other the KCL form equation 3.17 becomes

¸

ajiq9Ij 0

¸

akiq9 Ik0 (7.10)

As can be seen in equation 5.7 this corresponds to adding IExt on the right hand side of the current constraint. In correspondence to equation 7.9 the discretized augmented Euler Lagrange equation divide by ∆t for the battery becomes



Zr 0

0 R



Ir Ik 1







Ar1 Ar2 1 1



Ui Uj







Ur 0





Ar1 1 Ar2 1



Ir

Ik 1







IExt

IExt

 (7.11)

where Zr, Ari,Is ,Ur belongs to the rest of the circuit and Ui, Uj is the voltage at the nodes connecting the resistor to the circuit.

(38)

7.5. The inductor

Inductors can be seen as kinetic storages. The voltage over the inductor is given by

U LdI

dt Ld2q

dt2 (7.12)

The voltage U can be seen as the force created by the second derivative of the charge. The associated flux linkage, momentum is given as

Λ

»T 0

LdI

dtdtLI (7.13)

where t is an arbitrary time. The kinetic energy is defined as in (Layton, 1998, page 276-278) to be

T 

»I 0

LIdI  1

2ITLI (7.14)

The inductor has the same type of connections as a resistor, one in and one out node. This means that the jacobian from section 3.3.1 becomes

A



1

1



(7.15) The current is I  dqdt and is discretized to I  qk∆t1qk, as the equation is not stiff and will have a mass. The discrete Lagrangian at time k becomes

Lpqk, qk,∆tq∆t 1

2∆tpqk 1qkqTLpqk 1qkq (7.16) The discrete augmented Euler Lagrangian, divided by ∆t becomes



Zr 0 0 ∆t1 L



Ir Ik 1







Ar1 Ar2 1 1



Ui Uj







Ur

1

∆tLIk





Ar1 1 Ar2 1



Ir Ik 1







0 0

 (7.17)

where Zr, Ari, Ur,Is belongs to the rest of the circuit and Ui, Uj is the voltage at the nodes connecting the inductor to the circuit.

(39)

7.6. The capacitor

The Capacitors can be seen as ideal potential storage with a voltage-drop given by

U  q

C (7.18)

According to is the potential energy is given by (Layton, 1998, page 277-279) V 

»q 0

Udq 

»q 0

q

Cdq  q2

2C (7.19)

The capacitor is a two device with an in and an out port. This gives a Jacobian to be

A



1 1



(7.20) In-order for the capacitor to have a term in the mass matrix the charge is desecrated with the midpoint rule as qqk 12 qk

The discrete Lagrangian becomes Lpqk, qk,∆tq∆t h

8pqk 1 qkqT C1pqk 1 qkq (7.21) Using that Ikpqk 1qkqthe discrete augmented Euler Lagrangian, divided by ∆t can be written as



Zr 0

0 ∆t4 C1



Ir

Ik 1







Ar1 Ar2

1 1



Ui

Uj







Ur



1

C qk ∆t4 Ik







Ar1 1 Ar2 1



Ir Ik 1







0 0

 (7.22)

where Zr, Ari, Ur,Isbelongs to the rest of the circuit and UiUj is the voltage drop over the capacitor.

References

Related documents

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

As the second contribution, we show that for fixed priority scheduling strategy, the schedulability checking problem can be solved by reachability analysis on standard timed

This thesis gives an inside about my artistic process and they way how it was shaped over one year. How does the act of thinking affect my practice. Is there a first or second.

While trying to keep the domestic groups satisfied by being an ally with Israel, they also have to try and satisfy their foreign agenda in the Middle East, where Israel is seen as

This is valid for identication of discrete-time models as well as continuous-time models. The usual assumptions on the input signal are i) it is band-limited, ii) it is

Paper II: Derivation of internal wave drag parametrization, model simulations and the content of the paper were developed in col- laboration between the two authors with

Weakly coupled elliptic system, Simple variational setting, Subcritical system in exterior domain, Entire solutions to critical system, Brezis–Nirenberg problem.. Clapp was