• No results found

Simulation of Newton's pendulum using switched bond graphs

N/A
N/A
Protected

Academic year: 2021

Share "Simulation of Newton's pendulum using switched bond graphs"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Simulation of Newton's pendulum using switched bond graphs

Krister Edstrom

Department of Electrical Engineering Linkoping University, S-581 83 Linkoping, Sweden

WWW: http://www.control.isy.liu.se

Email: edstrom@isy.liu.se

August 25, 1998

REGLERTEKNIK

AUTOMATIC CONTROL LINKÖPING

Report no.: LiTH-ISY-R-2048 Submitted to ICBGM'98

Technical reports from the Automatic Control group in Linkoping are available by anonymous ftp at the

address

ftp.control.isy.liu.se

. This report is contained in the compressed postscript le

2048.ps.Z

.

(2)

Simulation of Newton's pendulum using switched bond graphs

Krister Edstrom

(edstrom@isy.liu.se) Dept. of Electrical Engineering

Linkopings Universitet SE-581 83 Linkoping, Sweden

1 Introduction

The well know Newton's pendulum, shown in Figure 1, is in this paper modeled and simulated using switched bond graphs 5]. The pendulum is very di cult to model with classical bond graphs since the connection and disconnection of masses will cause causal changes in the model.

Figure 1: Newton's pendulum

When making a switched bond graph model, the level of details in the model can di er. The contact between the masses could be modeled with a spring and a damper to describe the elasticity and the dissipation respectively. In most mechanical literature, impacts between bodies are not modeled at such a detailed level

3]. The e ects of elasticity and dissipation are modeled as instantaneous, using the principle of momentum conservation and another relation describing the capacity of the bodies to recover from impact. Since the switch describes innitely fast changes in the system, this paper describes a model where the elasticity and momentum conservation are modeled within the switch.

Simulation of switched bond graphs has been discussed earlier in, e.g., 1, 4, 2]. In 1] it is shown how a switched bond graph can be simulated when the initializations are assumed to be trivial. In 4, 2] initialization using a generalization of momentum conservation is discussed. Problems where the switch models very fast are then dealt with. In this paper we discuss an approach for modeling very fast energy storage within the switch.

2 A switched bond graph model of the pendulum

To simplify the bond graph, we will assume that the ideal physical model (IPM) of Newton's pendulum is

the one shown in Figure 2.

(3)

Figure 2: An IPM of Newton's pendulum.

The switched bond graph model of the IPM in Figure 2 is depicted in Figure 3. In the bond graph the

ow variables are velocities and the e ort variables are forces. The extra 1 -junction is introduced to get an intuitive mathematical description. Together with the choices of positive energy ow directions, all velocities will be positive to the right.

0 1 0 1 0 1 0 1 0 1

C1 C2

I1 I2 I3 I4

Sw1 Sw2 Sw3 Sw4 Sw5

Figure 3: The switch bond graph model of Newton's pendulum.

With the assumption that all I -elements and all C -elements are linear, the bond graph model is complete except for the description of the switches. A switch will include conditions for changing states and, if necessary, an initialization rule consisting of an elasticity coe cient .

2.1 The storage elements

The storage elements model the masses and the springs. We will assume that the masses weigh 100 g each and that the sti ness of each spring is k = 10 N=m . The assumption that the I - and C -elements are linear gives the following constitutive relations for the I -elements:

x _ = e (1)

f = x I = x

m = 10 x (2)

and for the C -elements:

x _ = f (3)

e = x

C = k x = 10 x (4)

2.2 The Sw-elements

The switches model two di erent phenomena the contact between a spring and a mass ( Sw

1

and Sw

5

),

and the contact between two masses ( Sw

2

, Sw

3

, and Sw

4

). In the

E

state, where a switch acts as a zero e ort source, the e ort (force) between the elements is zero and there will be no contact. In the other state,

F

, where a switch acts as a zero ow source, the velocity di erence is zero, and hence the elements are connected.

Contact between a spring and a mass

In the rst case, when a switch models the contact between a mass and a spring, the modeling procedure

is straightforward. In the

F

-mode, where the mass and the spring are connected, the e ort variable at the

bond next to the switch describes the force from the spring acting on the mass. The condition for loosing

contact is that this force becomes less than zero.

(4)

When the elements have no contact, i.e., when the switch is in the

E

-mode, the change of modes appears when the mass reaches the spring.

The two transition conditions for switches Sw

1

and Sw

5

is hence:

g

FE

= ( e < 0) (5)

g

EF

= (

Z

fdt



C ) (6)

The integral

R

fdt describes the position of the mass relative to the position of the spring, and C is a constant, di erent for each switch, depending on the position where the mass reaches a spring.

The initialization of the new mode when one of the two switches Sw

1

or Sw

5

changes states will be trivial since the state variables are continuous is both switching directions. The new values of all states  x = ( x

1

::: x

6

)

T

equal the old values  x

0

.

x  =  x

0

(7)

Contact between two masses

When a switch models the contact between two masses, elasticity and damping have to be included in the switch model. This is done by introducing the elasticity coe cient in an initialization rule belonging to the switch.

The condition for changing from

E

-mode to

F

-mode, i.e., detecting the collision, is the same as above:

(

R

fdt



C ). We will also include the condition ( f < 0) because energy is transferred between the masses only when the distance between them is zero, and they are moving towards each other. This gives the transition condition g

EF

=(

R

fdt



C )

^

( f < 0). To detect when the masses loose contact is trickier. The procedure for detection is the following:

When detecting a collision, the switch changes position from

E

to

F

. The new mode will be initialized using one equation describing momentum conservation, and another equation describing the elasticity. The generation of the equation describing the momentum conservation is algorithmically found from the switched bond graph 2]. The ow variable f at the switch is the di erence in velocity between the two masses. Hence, the initialization equation describing elasticity is f =

;

f

0

3], where f

0

is the value of the ow before the collision.

This initialization procedure will give a value of f that is non-zero, assuming that

6

= 0. This contradicts the constitutive relation for the switch, f



0. Therefore the mode is left immediately when entered. The system then returns to its previous mode with new values of the velocities of the masses.

The complete description of switches Sw

2

, Sw

3

, and Sw

4

is:

g

FE

= | (8)

g

EF

= (

Z

fdt



C )

^

( f < 0) (9)

= 1 (10)

There are two initialization rules that will be generated when one of the switches Sw

2

to Sw

4

changes state, depending on whether transition condition g

FE

or g

EF

is fullled. When the switch changes state from

F

to

E

, the state variables  x are continuous:

x  =  x

0

(11)

When switching in the other direction,

E

to

F

, the initialization is more di cult. With the indeces a and b

for the two masses next to the switch changing states, the following initialization rule, describing momentum

(5)

conservation, will be generated when changing modes 2]:

x

a

+ x

b

= x

0a

+ x

0b

(12)

The initialization rule describing elasticity is:

f =

;

f

0 )

f

b;

f

a

=

;

( f

b0;

f

a0

)

)

1

I

b

x

b;

I 1

a

x

a

=

;

( 1 I

b

x

0b;

I 1

a

x

0a

)

)

)

10 x

b;

10 x

a

=

;

10 x

0b

+ 10 x

0a )

x

b;

x

a

= x

0a;

x

0b

(13) All other states, belonging to the masses not colliding, and to the springs, will be continuous:

x 

r

=  x

0r

(14)

When solving Equations (12) and (13) the following values of the initial states are found:

x

a

= x

0b

(15)

x

b

= x

0a

(16)

x 

r

=  x

0r

(17)

To conclude the complete model of the switch has to include a condition for detecting contact between the masses. The condition for leaving the mode is not necessary, since the mode is left due to a contradiction between the constitutive relation of the switch and the initial values of the new mode. Furthermore, the condition for leaving the mode cannot be described in terms of the force di erence between the masses, since the masses are rigidly connected.

The model of the switch also has to include an initialization rule. When describing a collision between two masses, the initialization rule is given by a parameter describing the elasticity. An initialization equation containing this parameter can then be derived from the bond graph.

3 Simulation

3.1 The simulation algorithm

The simulation algorithm consists of the following steps:

1. Start the simulation in the initial mode and continue until a transition condition is fullled or the stop time is reached. The continuous equations are found by rst replacing the switches with zero e ort or zero ow sources, depending on what states the switches are in, and then using a standard bond graph equation generation algorithm.

2. Generate the initial rules for the new mode as described in Section 2.2. If the initial values contradict the constitutive relation for the switch, go back to the previous mode with the new values of the states.

3. Check if any transition condition is fullled by the initial values. If so, go to step 2.

4. Simulate the new mode until a transition condition is fullled or the stop time is reached. If a transition condition is fullled go to step 2.

3.2 Modes visited during simulation

If we are starting in mode

EEEEE

(all ve switches in

E

position) with the leftmost mass moving to the left

with 1 m=s the mass will soon reach the spring. There will be contact between the mass and the spring,

(6)

mode

FEEEE

, until the velocity is reversed and the force between them goes to zero, mode

EEEEE

. We are then back in the starting mode with the same magnitude of velocity but with a di erent direction.

The next mode change occurs when the mass I

1

will hit mass I

2

, and the simulation will continue in mode

EFEEE

. The initialization rule for this mode will give a value of the relative velocity of the masses that contradicts the constitutive relation of the switch. Hence the mode is left before simulated and we are back in mode

EEEEE

. The velocity of mass I

1

is transfered to mass I

2

. Immediately the transition condition for entering mode

EEFEE

is fullled. When initializing this mode we will immediately end up un mode

EEEEE

etc.

The discrete state trajectory will be repetitive, and the modes visited in each repetition are shown in Table 1.

The mode number in the table are the switch states interpreted as binary numbers,

EFEEE)

10111

)

23.

Add 1 to get mode number 1 for the combination

FFFFF

. Hence mode

EFEEE

has mode number 24.

step mode mode no step mode mode no

1

EEEEE

32 simulated 11

EEEEE

32 simulated

2

FEEEE

16 simulated 12

EEEFE

30 not simulated

3

EEEEE

32 simulated 13

EEEEE

32 not simulated

4

EFEEE

24 not simulated 14

EEFEE

28 not simulated

5

EEEEE

32 not simulated 15

EEEEE

32 not simulated

6

EEFEE

28 not simulated 16

EFEEE

24 not simulated

7

EEEEE

32 not simulated 1

EEEEE

32 simulated

8

EEEFE

30 not simulated 2

FEEEE

16 simulated

9

EEEEE

32 simulated 3 ::: ::: :::

10

EEEEF

31 simulated 4 ::: ::: :::

Table 1: Modes that are iterated when simulating the pendulum.

3.3 Generating a mathematical description

Since only three modes are simulated, only three mode equations have to be generated, and they are the equations for modes number 32, 31, and 16.

mode no 32 mode no 31 mode no 16

x _

1

= 0 x _

1

= 0 x _

1

=

;

x

5

=C

5

x _

2

= 0 x _

2

= 0 x _

2

= 0

x _

3

= 0 x _

3

= 0 x _

3

= 0

x _

4

= 0 x _

4

=

;

x

6

=C

6

x _

4

= 0

x

5

= 0 x

5

= 0 x _

5

= x

1

=I

1

x

6

= 0 x _

6

= x

4

=I

4

x

6

= 0

To exemplify how the initialization procedure works we will take a look at steps 3-6 in Table 1.

In step 3 the continuous equations are solved numerically. The solver also handles the transition conditions for changing modes. When detecting that transition g

EF

for switch Sw

2

is fullled, the solver returns the current values of the continuous states and information about which switch the condition belongs to. This information will lead us to the new mode, which is initialized according to Equations (15), (16), and (17).

This is step 4 in the table.

The values of the continuous states when the condition is fullled are such that the ow at the switch, f

Sw0 2

,

is non-zero. Since the ow after initialization is f

Sw2

=

;

f

Sw0 2

, where = 1, we get f

Sw2 6

= 0. Hence the

constitutive relation for the switch, f

Sw2

= 0, is violated. The simulation therefore continues in the previous

mode, mode number 32, with the new values of the states.

(7)

The only di erences between step 5 and step 3 are that the second mass has velocity 1 m=s and the rst mass is in rest in step 5. Mode number 28 will therefore be initialized in exactly the same way as mode number 24.

3.4 A simulation run

If assuming that the radius of a mass is 0 : 01 m , that it is 0 : 03 m from the left spring to the center of the leftmost mass when all four masses have contact, and that it is 0 : 03 m from the right spring to the center of the rightmost mass when all four masses have contact, the result from a simulation run is shown in Figure 4.

The gure shows one iteration of steps 1 to 16 in Table 1.

0 0.5 1 1.5

−0.1

−0.08

−0.06

−0.04

−0.02 0 0.02 0.04 0.06 0.08 0.1

Time, s

State variable values, m/10 or kgm/s

x

I1

x

I

4

xC

1

xC

2

Position, m/10

0 0.5 1 1.5

−0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4

Time, s

p

I1

pI

4

p

C1

pC

2

Figure 4: Results from a simulation run.

The leftmost gure shows how the state variables vary during simulation. The two state variables x

I1

and x

I4

are the momenta of masses I

1

and I

4

. We see that there is a discontinuity where the momentum of mass I

1

is transfered to mass I

4

via masses I

2

and I

3

. The other two state variables describe the deection from the equilibrium point for the two springs.

The rightmost gure shows the actual positions of masses I

1

and I

4

and the two springs. All four masses are shadowed in the background.

References

1] K. Edstrom. Simulation of mode switching systems using switched bond graphs. Linkopings University, December 1996. Lic. thesis.

2] K. Edstrom. Mode initialization when simulating switched bond graphs. In Proc. of 2nd IMACS Inter- national Multiconference: CESA'98, Computational Engineering in Systems Applications, 1998.

3] J.L. Meriam and L.G. Craig. Engineering Mechanics, volume 2, Dynamics. Wiley, 1987.

4] P.J. Mosterman. Hybrid System Dynamics: A Hybrid Bond Graph Modeling Paradigm and its Application in Diagnosis. PhD thesis, Graduate School of Vanderbilt University, 1997.

5] J.-E. Stromberg, J. Top, and U. Soderman. Variable causality in bond graphs caused by discrete e ects.

In Proc. First Int. Conf. on Bond Graph Modeling and Simulation (ICBGM'93), volume 25 of SCS

Simulation Series, pages 115{119, 1993.

References

Related documents

Stöden omfattar statliga lån och kreditgarantier; anstånd med skatter och avgifter; tillfälligt sänkta arbetsgivaravgifter under pandemins första fas; ökat statligt ansvar

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

Generally, a transition from primary raw materials to recycled materials, along with a change to renewable energy, are the most important actions to reduce greenhouse gas emissions

För att uppskatta den totala effekten av reformerna måste dock hänsyn tas till såväl samt- liga priseffekter som sammansättningseffekter, till följd av ökad försäljningsandel

Generella styrmedel kan ha varit mindre verksamma än man har trott De generella styrmedlen, till skillnad från de specifika styrmedlen, har kommit att användas i större

Närmare 90 procent av de statliga medlen (intäkter och utgifter) för näringslivets klimatomställning går till generella styrmedel, det vill säga styrmedel som påverkar

På många små orter i gles- och landsbygder, där varken några nya apotek eller försälj- ningsställen för receptfria läkemedel har tillkommit, är nätet av

When simulating hybrid systems using switched bond graphs, the initialization of new modes is made by using a generalization of the principle of momentum conservation.. This