• Non ci sono risultati.

Chapter 4 The program

N/A
N/A
Protected

Academic year: 2021

Condividi "Chapter 4 The program"

Copied!
20
0
0

Testo completo

(1)

Chapter 4

The program

In this chapter it will be explained the characterization of each element and the definition of their properties, the structure of the Matlab program and at last the way of programming of the constraints with particular attention to the penalty constraints.

4.1. Multi-body theory: characterization of the Multi-body elements

The model is programmed in a 2D dimension system. The reference system is shown in the picture 4.1. Every element is formed by some nodes in function of its properties and each node has three degrees of freedom (ddl): x , i y and i ϑ . They i respectively represent the translation along X axes, the translation along Y axes and the rotation around the Z axes. The angle ϑ always starts from the Y axes and goes i in the anticlockwise direction till the vector of which its position has to be determinate.

Fig.4.1: The reference plane

The model uses several multi-body elements and links, which assemble them. Every element is distinguished from particular properties in fact the elements don’t generate the same constraints, the same kinetic energy and the same mass.

(2)

The free rigid body element R

This element is formed by three nodes:

• 1 node for the gravity centre characterized by the mass and the inertia moment,

• 2 nodes which determine the connection points which will be linked to the other elements,

• 1 element of extremities which links the 2 previous nodes and defined by a length.

For this elements the gravity centre (node 2) can be put in the middle or generally between the two extremity nodes in any position as the picture 4.2 shows.

Fig.4.2: The rigid body element

According to the type of the elements, the constraints are not the same. The nodes 1 and 3 have to be placed in relation with the node 2 in order to respect the condition of rigid body: in fact according to the dynamic movement of the element, it has to preserve its length and to keep straight. Another condition has to be fixed: all the nodes must have the same rotation. So this element is defined by 6 constraint’s condition:

(3)

x l x x l x y l y y l y 1 2 1 2 2 3 2 2 3 2 1 2 1 2 2 3 2 2 3 2 1 2 2 3 sin 0 sin 0 sin 0 cos 0 0 0 − − − − + θ ⋅ − = ⎧ ⎪ + θ ⋅ = ⎪ ⎪ + θ ⋅ − = ⎪ ⎨ + θ ⋅ = ⎪ ⎪θ − θ = ⎪ θ − θ = ⎪⎩ (4.1)

Those conditions will be written in the vector h and so also the matrix B will be defined. All the term of those equations are defined in the picture 4.3:

Fig.4.3: The rigid body element scheme for the constraint

Thus every node has 3 degrees of freedom, the constraint’s condition are 6 so the element has 3 3× − =6 3 degrees of freedom: two translations along the axes X and Y and one rotation around the Z axes. This is correct for a rigid body defined in a 2D dimension system. The kinetic energy is given by:

( )

( )

( )

m x2 2 m y2 2 J 2 2

1 1 1

2 2 2

τ =  +  + θ (4.2) It is possible to define a free rigid body with one node too: this element includes the modelling of a punctual mass and it is modelled by only one node that is the gravity centre and the two other nodes will be like merged with the inertia centre.

The fixed rigid body element F

This kind of element can be formed by 2 or 3 nodes according to its function. The element F with two nodes is used when the gravity centre of the rigid body is not aligned with the extremities of the element: one of the two nodes is common with

(4)

another element on which it is fixed and on the other a punctual mass will be added. Thus the function of this element is to connect the gravity centre of the rigid body to the rigid body itself. This kind of element is shown in the picture 4.3.

Fig.4.3: The fixed rigid body element.

The utility of this element is that it does not influence the kinetic energy of the system because it does not have any mass and physical properties, it is only used to connect the gravity centre to the rigid body. As explained about the R element also for this element it is necessary to define the constraint’s condition in order to respect the definition of a rigid body: so the node where the gravity centre is laid, has to be placed in relation with the node belonging to the other element. the constraint’s condition are 3 2 3× − =3 considering that each node has 3 ddl and the element must have 3 degrees of freedom:

(

)

(

)

II II x l x y l y 4 2 2 4 2 2 4 2 sin 0 cos 0 0 ⎧ + α + θ − = ⎪ + α + θ − = ⎨ ⎪θ − θ = ⎩ (4.3)

where l is the length of the element II and II α is the angle taken in anticlockwise direction between the two elements linked. The constraints are calculated in the same way of the free rigid body element. So more generally, this element is used to link two elements which cannot be linked directly.

The element F with 3 nodes is used in the case where two elements are "welded" together as shown on the picture 4.4.

(5)

Fig.4.4: The fixed rigid body element with 3 nodes

The position of one element is defined by an angle α and the two elements share one node. So the constraint’s condition are similar to that of the free rigid body with three nodes: x l x x l x y l y y l y 1 2 1 2 2 3 2 2 3 2 1 2 1 2 2 3 2 2 3 2 1 2 2 3 sin( ) 0 sin( ) 0 cos( ) 0 cos( ) 0 0 0 − − − − + θ + α ⋅ − = ⎧ ⎪ θ + α ⋅ = ⎪ ⎪ + θ + α ⋅ − = ⎪ ⎨ θ + α ⋅ = ⎪ ⎪θ − θ = ⎪ θ − θ = ⎪⎩ (4.4)

The kinetic energy doesn’t change so it is given by (4.2).

The spring element S

As showed in the chapter 2 the prostheses is formed by a spring element ( the EBS system ), so it is necessary to model it. Also for this element the mass properties have to be considered, so an element with three nodes has been chosen to model the spring. This element is showed on the picture 4.5:

Fig.4.5: The spring element.

The kinetic energy of this element is the same than a rigid body. On the contrary the potential energy changes because of its mass and its stiffness. So for a spring

(6)

defined by k , the stiffness, l0, its empty length and l , its instantaneous length at ins the time t, the potential energy is given by:

(

x m g ν = gy

)

(

ins

( )

)

x k l t l y 2 2 0 2 1 2 ⎛ ⎞ + − ⎜ ⎟ ⎝ ⎠ (4.5)

The constraints are the same except for the number in fact the spring has a degree of freedom less than a classic element because its length can change. So it’s possible to suppress one of the six constraint’s condition: the fourth one is chosen to be suppressed. The other condition are defined in (4.1).

The damper element D

The damper is also modelled by three nodes as showed on picture 4.6:

Fig. 4.6: Model of a damper

The dampers modify the dissipation energy in a system. So the dissipation energy with a damper c is :

(

)

D 1c vit1 vit2 2 2

= − (4.6) where vit1 and vit2 are the velocity of the node 1 and 3 as shown in the picture 4.7.

(7)

The properties of this element are the same than the rigid body element, so the gravity centre is laid on the node 2 and the dissipation function defined in (4.6) shows the relative displacements between the node 1 and 3 through their velocity. The constraints are the same than the spring element and they are defined in (4.1).

The hinge element H

This is a particular element in fact its function is link two elements to allow their relative rotation and to fix all the translation upon the axes X and Y in the 2D reference system. This element is shown on the picture 4.7.

Fig.4.7: The hinge element scheme

According to its properties, the constraints are:

x x y y 1 2 1 2 0 0 − = ⎧ ⎨ − = ⎩ (4.7)

The function of this joint is very important in the prostheses model because of its friction coefficient: in fact every hinge of the prostheses are characterized by a friction coefficient. In this way it will change the dissipation energy: so with cfriction, the friction coefficient and θ , 1 θ , the rotation velocity of the nodes 1 and 2, the dissipation 2 energy is given by:

(

)

friction

D 1c 1 2 2

2

(8)

The special element O: Otto-bock element

This element is necessary to model the special suspension of the prostheses described in the chapter 2. It is a hybrid element: the mass properties and the constraint’s condition are the same of the rigid body R so it produces the same modification for the kinetic and potential energy; the difference is that a damper or/and a stiffness coefficient can be added to the element’s characteristic. In this way the dissipation and the potential energy has to be updated. Then the damper property is different from what has already been described about the damper element: in fact the damper coefficient changes if it’s in traction or in compression. An element like this is shown in the picture 4.8.

Fig.4.8: Scheme of the Otto-bock element.

4.2. Matlab and Maple

The software used to solve the Lagrange’s equation defined in the previous chapter to obtain the motion equation is Matlab. This software is right for the numerical resolution of a system but it is not appropriate to solve a system written in the symbolic way. For this reason the equation of motion have been programmed using Matlab with the assistance of Maple’s library. Maple is a software right for symbolic resolution of a system. The definition of the symbolic parameters have been done using the command syms and the partial derivative of a respect to b have been programmed using the command jacobian(a,b). In this way the system 3.44 and the matrixes 3.45 have been programmed. An easy example of this programming way is presented below.

(9)

The simple pendulum:

Fig.4.9: The simple pendulum.

The lagrange variable q chosen is the angle J, so the kinetic and potential energy are:

(

)

m l V m g l 2 2 1 2 1 cos Τ = ⋅ ⋅ θ = ⋅ ⋅ − θ  (4.9)

The matrixes used to solve the system 3.44 are given by: M =simple(jacobian(jacobian(T; qd); qd));

f =simple(jacobian(jacobian(T; qd); q) *qd)+

-simple(jacobian(T; q))’+ simple(jacobian(V; q))’+ simple(jacobian(D; qd))’; Ct =simple(jacobian(f; qd));

Kt =simple(jacobian(f; q)) + simple(jacobian(B’ * lambda; q)); where q, qd, qdd are θ θ θ, ,  respectively. Thus the matrixes are:

M = m l⋅ 2 f = mglsin(q) Ct = 0

Kt = mglcos(q)

(10)

4.3. Walker model

Several model have been created to check the different parts of the program and to improve it in order to obtain a mathematical model that represents the human act of walking with and without the prostheses in a realistic way: a pendulum, a double pendulum, a simple walker with and without knee and so on. So during the research all the problems connected with the parts of the program, like for example the problem of impact of the foot on the ground, have been solved using simpler model; in the next chapter the model representing the ballistic walk will be presented. Anyway the main model is the model on picture (4.10).This is a walker which has a amputated leg: he has a leg with a normal knee and an other one with a prostheses.

foot

shin

thigh

hip

prostheses

g

X

Y

Fig.4.10: Walker model

The thigh and the shin are modelled by a simple rigid element with three nodes a gravity centre in the middle. Each foot is modelled by a punctual mass as well as the hip. The connection used to link the hip, the knee and the foot is the hinge.

The prostheses is modelled as shown in the picture 4.11: on the left side the prostheses with its element is presented and on the right side how is it in the Matlab model. The bodies are differently coloured depending on the type of elements which were employed:

(11)

• The black ones are free rigid bodies( the element R)

• The red ones are rigid bodies linked to others( the element F)

• The green bar represents the hydraulic spring developed by Otto Bock • The hinge elements are represented on the left side of the picture.

The number written next each links, that are the hinges, and next each elements correspond to the numbers of the nodes used to program the prostheses. When there are more numbers next to the joint, this means that two or three elements are linked together in the same hinge. The presence of a little slope is essential to allow to the model to represent the human walking. In fact the idea is don’t give initial energy to the system and let it go under the gravity action. This concept is on a basis of the ballistic walk, which will be described in the next chapter.

(12)

4.4. The structure of the program

The programming is divided into three main parts : the data, the construction of the equations, and their resolution. More information about them are given in [10] and in the programs. The units used in the program are kilogram, meter, degree and second.

The data file

The program Data gives all the information about the system. All the data will be read and exploited by the other programs Equation and Prg-otto. First, this program defines through a matrix elem the type of the element which composes the system studied ( for example, R or F or S as defined previously ). The matrix has n lines (with n the number of elements) and 7 rows which corresponds to 7 properties of each element as shown on the picture 4.12.

Fig. 4.12: The matrix elem

The first row defines the nature of the element and how they are linked. The second and the third rows correspond to the physical parameters: more precisely to the material properties (mass, inertia moment, damping and stiffness) and to the length of the element (distance between each extremity and the gravity centre).The rows 4, 5, 6 allow to define respectively the numbers of the gravity centre and the nodes in

(13)

contact with other elements. The last row is only for the fixed rigid body F: it determines the fixed angle between it and the rigid body which it is linked with. So for example the first element defined in the matrix element of the picture 4.12 is an R element with the gravity centre laid in the node 2 and with the nodes 3 and 1 as the extremity nodes; the second element is a fixed rigid body with 2 nodes linked with the other one in the common node 3. In this matrix there are not directly the value of the variables but only a number which refers to other matrix. So elem calls the following matrix : atta for the angle (row 7), lon for the lengths, mat for the material properties,

d for the damping and s for the stiffness. Also the constraints are specified according to their properties: in fact they can be permanent or unilateral. So, different matrixes have to be defined. For nodes which are fixed, there is the matrix fix where the ddl of the node which will be blocked is written and its value too( the position where the node has to be blocked). But if these numerical values are not known, it’s necessary to use the matrix fixin instead. For example, during the walk, the foot is going to be blocked, but the values of its position on the x axis is unknown; so some parameters will be defined in the expression of the constraints to solve this problem. For the unilateral constraint, there is an other matrix con-temp. The size of this matrix is not constant because the unilateral constraints can bring into action a non constant number of nodes. This matrix is used for the hyper extension of the knee. For the permanent constraints, there is the matrix con-perm. And the last one force nc is for the non conservative forces. At the end the initial position and velocity of the walker has to be specified. The initial conditions are defined by nb-node the number of node,

ref the reference vector and position the matrix of positioning. The ref vector contains the number and the coordinates of the first node which is going to be the reference for the positioning of the other nodes. The position matrix allows to position each node in relation with the reference node. All the elements are not concerned because for example the fixed rigid element already have a position. The first row of this matrix correspond to the number of the element in elem, the second one to the number of the node which the element is positioned from, the third one is only for the elements S, D and O which need a second link with another node. The last row represents the angle in degree between the y axis (reference defined previously) and the rigid body. In this program, the value of the slope is also defined (in degree).

(14)

The creation of the equations

The program equation uses the data defined by the program Data in order to build the multi body equations of the system. The program works with symbolic variables that is to say that it does not use only numerical values but also characters. The numerical values are only used for the variable which come from Data. First of all, the program builds by a symbolic way the three vectors of displacements

[

nbnodes nbnodes nbnodes

]

q = x y1, , ,...,1 θ1 x ,y ,θ , velocity q and acceleration q .

Then, the program reads the elem matrix: according to the type of each element, it builds the symbolic expressions of the constraints h, the potential and kinetic energies V and T, the dissipation function D and the forces vector f. Indeed, each element does not modify these expressions by the same way. The information in

elem gives all the numerical values of the mass, inertia moment that are necessary for these expressions. Then, the program reads the constraints and the forces applied on the system: the permanent constraints and the blocked ddl modify the h matrix, in fact a line in h is added in correspondence to each constraint and ddl blocked. So the matrix B and Kt will be influenced by those constraints. For the unilateral constraints, D and V are directly modified and there will be repercussions on Kt and Ct. The way of their activation and deactivation will be explained in the next paragraph. For the forces defined in Data, the program builds a part of the f vector. Only the contribution of the O element and the non conservative forces have been taken into account.

In this way the system to solve is complete and the matrixes are defined as follows:

(

)

t T t T M q h B q T T V D f q q q q q q f C q B f K q q 2 2 0 ∂ = ∂ ∂ = ∂ ⎛ ⎞ ∂ ∂ ∂ ∂ ∂ = − + + ∂ ∂ ∂ ∂ ∂ = ∂ ∂ ⋅ λ ∂ = + ∂ ∂      (4.10)

(15)

Once that all the matrix and vectors are built, the program displays all their elements which are not equal to zero. Thus, the user must copy/paste all the elements of the matrixes in the respective functions because the program of resolution will use those functions to solve the system. This way is convenient because it avoids to calculate the equations and thus the elements of the matrixes every time that the resolution is loaded. The functions which have been created are : h, B, M, f, Ct and Kt.

The resolution

The resolution of the multi-body equations uses two programs : prg-otto and

resol-otto which is a function of prg-otto.

The prg-otto realizes, at the same time, the end of the pre-processing, the processing and the post processing. Indeed, at the beginning, with all the dates taken from the Data file, it builds the initial vector of the displacements q0. If the initial values entered by the user do not satisfy the constraints condition, there is a corrector. Then it does the same think with the vit vector to build the initial vector of velocity q but there is no correction for the 0 velocity. The vector q is put equal to zero. Moreover, the numerical 0 parameters of the numeric scheme are defined : the final time, the time step, the parameters of the H.H.T. schema and so on. Then the program starts the processing. There is a big time loop. For each time step, the program calls on the program resol-otto. The prg-otto send to resol-otto the vector of the displacement, the velocity and the acceleration but also the time and one coefficient which indicates if the constraints are activated or not. For the post processing the program proposes an animation where it’s possible to see the behaviour of the walker. It’s also possible to study the evolution of several parameters: for example the evolution of the velocity of one of the node during the time.

The resol-otto is a Matlab function which is called by prg-otto for the resolution of the equations. This program carries out the Newton-Raphson loop. The parameters which are given to the function are q q qt, ,  . It returns t t

t t t t t t

(16)

necessary it does a correction. To do that it has to call the functions M, f, Ct, Kt……, created previously.

Anyway it’s possible to analyse all the Matlab codes with the respective explanations in the Appendix A.

(17)

4.5. Program of the unilateral constraints

In the chapter 3 the theories about the unilateral constraints have been presented and in particular two main methods: the Lagrange’s Multipliers and the Penalty method. Now those two methods will be applied to the same problem, the hypertension of the leg ( fig.4.13 ), in order to understand how are they programmed and to explain the reason why the penalty method has been chosen at the end.

Fig.4.13: The hypertension problem

4.5.1. Lagrange’s Multipliers

In this case a Lagrange coefficient λcont corresponds to the unilateral constraint. As shortly explained about the touch of the foot on the ground in the previous chapter, when the constraint is deactivated, the force will thus be imposed null by controlling

const

λ to be equal to zero. Anyway if it’s necessary to active the constraint, this Lagrange’s coefficient will not be null: this means that there is a force that works to avoid the hypertension of the leg. The change of the sign of the force produces the deactivation of the constraint: so the difficult of this method is to check the exact time of the activation and deactivation by controlling the sign of the Lagrange’s coefficient. At a stretch the algorithm for the Lagrange’s multiplier is presented in the scheme 4.1. Another problem is connected with the relative velocity that the two parts of the leg have during the walking. This velocities are different generally, but at the moment of the activation of the constraint, they have to be equal: this fact implies a big

(18)

velocity gap and then accelerations and forces almost infinite. Thus the consequence is a big instability of the value of the Lagrange’s coefficient.

At the time t− ∆t: deactivate constraint ƒ λcont =0

ƒ Resolution of the equilibrium At the time t: active constraint

ƒ no condition upon λcont ƒ Resolution of the equilibrium At the time t+ ∆t: active constraint

ƒ no condition upon λcont ƒ Resolution of the equilibrium

Test about the sign of the λcont:

• λcont

( ) (

t ⋅ λ + ∆t t

)

> 0 : no modification for the time t+ ∆2 t

• λcont

( ) (

t ⋅ λ + ∆t t

)

< 0 : to force λcont

(

t+ ∆ =2 t

)

0

Scheme 4.1: The algorithm used for Lagrange’s Multipliers

As shown on the picture 4.14 this value swings around the zero value and so it’s impossible to be in the same instant in which the constraint will be deactivate or activate. For this reason the penalty method has been preferred to represent this unilateral constraint and thus to avoid the hypertension of the leg.

(19)

4.5.2. The penalty method

As explained in the previous chapter the penalty method is based on the use of a virtual damper and spring which block the leg when there is the impact of the shin against the knee. So it is necessary to define how they are programmed given that they represent temporary constraint and thus, they are not always activated. They modify the value of the dissipation and the potential energy when they are activated. so that the total dissipation and potential energy is given by

k i i i D D0 p D 1 = = +

(4.11) k i i i V V0 p V 1 = = +

(4.12) where

• D0 and V0 are the dissipation and the potential energy of the system

• Di and Vi are the contributes to the dissipation and potential energy of the virtual damper and spring

• pi is the penalty coefficient. It is equal to 0 when the constraints have to be deactivated and on the contrary equal to 1.

The temporary constraint of the knee is programmed the following way:

con_temp = [ n 0 0 1 | m 0 0 -1 | -30° 1000 1000 ]

The program reads this expression and it writes:

n m

H= θ − θ −30° = (4.13) 0

The two last parameters correspond to the damper and stiffness coefficients of the virtual damper and spring and they will be used to change the symbolic potential and damper functions: without constra i i V V int 1K p H2 2 − = + (4.14) without constra i i H D D C p t 2 int 1 2 − ∂ ⎛ ⎞ = + ∂ ⎝ ⎠ (4.15)

(20)

Now the algorithm of the penalty method is going to be presented. The program checks if the constraint H has been violated:

• if not : nothing happens and the program will go to the next step; • if yes : the program will make the following calculus:

( )

( )

(

)

(

)

( )

( )

t t dt t t t t t t t 1 2 mod 1 2 1 2 θ − θ = ∆ θ + ∆ − θ + ∆ + θ − θ (4.16) that is the time in which the system has to be constrained (look at the fig.4.13). The Newmark iteration restarts from the previously defined time, but now with the constraint activated.

• The calculus is made every step with active constraints. At every time step, the parameters are calculated and then a test is made to check if the constraints still have to be active. The test does this calculus:

(

)

(

)

(

θ1 t+ ∆ − θt 2 t+ ∆t

)

⋅ θ

(

1

( )

t − θ2

( )

t

)

<0 (4.17) If this equation is verified, the Newmark subroutine is called but with the constraints off, and new displacements are found. From this point there are two possible solutions:

1. If θ − θ <0 the constraints are activated and the results are calculated 1 2 with the constraints on.

2. If θ − θ ≥ the constraints are deactivated and the results are 1 2 0 calculated without the constraint.

Figura

Fig. 4.12: The matrix elem

Riferimenti

Documenti correlati