Simulación de una ley de contracción para modelos...

107
I Trabajo de Fin de Máster Máster en Ingeniería Industrial June 2019 Simulación de una ley de contracción para modelos musculoesqueléticos Supervisor: Jonas Stålhand Examiner: Joakim Holmberg Division of Solid Mechanics Linköping University LIU-IEI-TEK-A--19/03334—SE Tutor: José Luis Muñoz Departamento de Ingeniería Mecánica y Fabricación. ETSII - UPM Pablo Rodríguez Roca (Simulation of an Evolution Law for Musculoskeletal Modelling)

Transcript of Simulación de una ley de contracción para modelos...

Page 1: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

I

Trabajo de Fin de Máster

Máster en Ingeniería Industrial

June 2019

Simulación de una ley de contracción para modelos musculoesqueléticos

Supervisor:

Jonas Stålhand

Examiner:

Joakim Holmberg

Division of Solid Mechanics

Linköping University

LIU-IEI-TEK-A--19/03334—SE

Tutor:

José Luis Muñoz

Departamento de Ingeniería Mecánica y Fabricación.

ETSII - UPM

Pablo Rodríguez Roca

(Simulation of an Evolution Law for Musculoskeletal Modelling)

Page 2: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

II

Page 3: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

III

Abstract. Currently there are several musculoskeletal models that calculate forces and reactions in muscles and bones from specific movements. All of them are based on the three-element model developed by (Zajac, 1989) based on the experiments carried out by Hill (Hill A., 1938).

For the dynamics it is needed to know the contracting speeds of both the muscle and the tendon. However, the models do not have enough equations to calculate these two terms independently. This is why all the models based on the Hill model assume that the tendon is much more rigid than the muscle and, therefore:

�𝐿𝐿�̇�𝑀� ≫ �𝐿𝐿�̇�𝑇� ⟹ 𝐿𝐿�̇�𝑇 = 0

This assumption introduces an unknown error in the calculations. Therefore, a new model was proposed by (Sharifimajd & Stålhand, 2013) that was later developed by (Roser, 2019).

This model does not need to make use of the assumption and it needs to be tested. In this master thesis, this new model has been developed and tested in MATLAB. Furthermore, with the help of AnyBody commercial software, which uses Hill model, it has been deter-mined whether the proposed model is realistic, and the error introduced when supposing that the speed of contraction of the tendon is zero.

Results show that this new model is coherent with the reality, having the same steady state values in both models. However, it has been found that the response in MATLAB is delayed between 11 and 233 milliseconds depending on the case. This is enough to consider this model an alternative and it is worth developing further.

Page 4: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

IV

Page 5: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

V

Index ABSTRACT. .............................................................................................................................. III

NOTATION ............................................................................................................................... IX

1. INTRODUCTION. .............................................................................................................. 1

1.1. State of the art. ................................................................................................................................... 1

1.2. Aim of the project. ............................................................................................................................ 3

2. PROPOSED MODEL. ........................................................................................................ 5

2.1. Muscle contraction mechanism. .................................................................................................. 5

2.2. Modified Hill model. ........................................................................................................................ 6 2.2.1. Equilibrium. ......................................................................................................................................... 6 2.2.2. Dissipation inequality. .................................................................................................................... 7 2.2.3. Muscle speed. ...................................................................................................................................... 7

3. MODEL DEVELOPMENT ................................................................................................ 9

3.1. Equations. ............................................................................................................................................ 9 3.1.1. Parameter k. ........................................................................................................................................ 9 3.1.2. Strain-energy Ψ. ................................................................................................................................. 9 3.1.3. Tendon force function 𝐹𝐹𝑇𝑇 . .......................................................................................................... 10

3.2. MATLAB implementation. ........................................................................................................................... 12 3.2.1. Tendon force. ................................................................................................................................... 12 3.2.2. Active force 𝜏𝜏. ................................................................................................................................... 13 3.2.3. Normalized force-length dependence 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀). ................................................................... 13 3.2.4. Steady-state force 𝜏𝜏0. .................................................................................................................... 14 3.2.5. Integration of the muscle speed 𝐿𝐿𝑀𝑀 . ....................................................................................... 14 3.2.6. Activation level 𝜙𝜙. .......................................................................................................................... 14

3.3. Data. .................................................................................................................................................... 15

4. ISOMETRIC CONTRACTION. ..................................................................................... 17

4.1. MATLAB implementation. .......................................................................................................... 17

Page 6: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

VI

4.2. Simulations. ...................................................................................................................................... 17 4.2.1. Resting length. ................................................................................................................................. 18 4.2.2. Stretched system. ........................................................................................................................... 21 4.2.3. Shortened system. ......................................................................................................................... 25

5. ISOTONIC CONTRACTION. ......................................................................................... 31

5.1. MATLAB implementation. ........................................................................................................... 31

5.2. Simulations. ...................................................................................................................................... 32 5.2.1. Before point A. ................................................................................................................................. 32 5.2.2. After point A. .................................................................................................................................... 33 5.2.3. Before point B. ................................................................................................................................. 33 5.2.4. After point B. .................................................................................................................................... 34

6. GENERIC CONTRACTION ............................................................................................ 35

6.1. MATLAB implementation ............................................................................................................ 35

6.2. Simulations. ...................................................................................................................................... 36 6.2.1. Case 1: left part of the curve. ..................................................................................................... 36 6.2.2. Case 2: right part of the curve. ................................................................................................. 38

7. ANYBODY COMPARISON. ........................................................................................... 41

7.1. AnyBody code. ................................................................................................................................. 41

7.2. How to use the same functions.................................................................................................. 42

7.3. Virtual activation. .......................................................................................................................... 44

7.4. Isotonic contraction. ..................................................................................................................... 44 7.4.1. AnyBody configuration. ............................................................................................................... 45 7.4.2. MATLAB configuration. ............................................................................................................... 46 7.4.3. Results. ................................................................................................................................................ 46

7.5. Isometric contraction. .................................................................................................................. 51 7.5.1. AnyBody configuration. ............................................................................................................... 51 7.5.2. MATLAB configuration. ............................................................................................................... 52 7.5.3. Results. ................................................................................................................................................ 52

7.6. General contraction. ..................................................................................................................... 57 7.6.1. From 0.413 m. to 0.407 m. ......................................................................................................... 58 7.6.2. From 0.423 m. to 0.417 m. ......................................................................................................... 59 7.6.3. From 0.4349 m. to 0.413 m. ...................................................................................................... 61

8. CONCLUSIONS AND FURTHER RESEARCH ........................................................... 65

BIBLIOGRAPHY ..................................................................................................................... 67

RESUMEN EN ESPAÑOL. ..................................................................................................... 69

Page 7: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

VII

I. Introducción. ................................................................................................................................... 69

II. Modelo propuesto. ........................................................................................................................ 70

III. Desarrollo del modelo. ................................................................................................................ 72

IV. Simulaciones en MATLAB. .......................................................................................................... 73 Contracción isométrica. ................................................................................................................................ 74 Contracción isotónica. ................................................................................................................................... 75 Contracción general........................................................................................................................................ 75

V. Comparación con AnyBody. ....................................................................................................... 77 Contracción Isotónica. ................................................................................................................................... 78 Contracción Isométrica. ................................................................................................................................ 78 Contracción genérica. .................................................................................................................................... 79

VI. Conclusiones. ................................................................................................................................... 79

VII. Planificación temporal. ............................................................................................................... 80

VIII. Presupuesto. .................................................................................................................................... 84

APPENDIX ............................................................................................................................... 87

A. ISOMETRIC CONTRACTION ........................................................................................................ 87

B. Isotonic contraction. ..................................................................................................................... 89

C. Generic contraction. ..................................................................................................................... 91

D. AnyBody Generic Contraction ................................................................................................... 94

Page 8: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

VIII

Page 9: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

IX

Notation Symbol Meaning

a Hill Parameter

b Hill Parameter

𝐜𝐜𝟏𝟏 Shape Factor for PE Strain Energy

𝐜𝐜𝟐𝟐 Shape Factor for PE Strain Energy

CE Contractile Element

D Damper

𝑭𝑭 Force

𝑭𝑭𝑪𝑪𝑪𝑪 CE Force

𝑭𝑭𝑫𝑫 Damping Force

𝑭𝑭𝟎𝟎𝑴𝑴 Maximum Isometric Force

𝑭𝑭𝒎𝒎𝒎𝒎𝒎𝒎𝑴𝑴 Maximum Muscle Force

𝑭𝑭𝑷𝑷𝑪𝑪 Parallel Element Force

𝑭𝑭𝑻𝑻 Tendon Force

𝒇𝒇𝑳𝑳 Normalized Force-Length Dependency Function

J Shape Factor in Tendon Force

k Proportional factor

�̂�𝐤 Proportional Factor for 𝒇𝒇𝑳𝑳

𝑳𝑳𝑴𝑴 Muscle Length

𝑳𝑳𝒎𝒎𝒎𝒎𝒎𝒎𝑴𝑴 Maximum Muscle Length

𝑳𝑳𝒎𝒎𝒎𝒎𝒎𝒎𝑴𝑴 Minimum Muscle Length

𝑳𝑳𝒐𝒐𝒐𝒐𝒐𝒐𝑴𝑴 Optimal Muscle Length

𝑳𝑳𝑻𝑻𝑻𝑻𝑴𝑴 Muscle Length for Tendon Slack Length

�̇�𝑳𝑴𝑴 Muscle Speed

𝑳𝑳𝑻𝑻 Tendon Length

𝑳𝑳𝟎𝟎𝑻𝑻 Tendon Length for Isometric Maximum Force

𝑳𝑳𝑻𝑻𝑻𝑻 Tendon Slack Length

Page 10: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

X

Symbol Meaning

�̇�𝑳𝑻𝑻 Tendon Speed

𝑳𝑳𝒐𝒐𝒐𝒐𝒐𝒐 Total Length

𝑷𝑷𝒎𝒎𝒎𝒎𝒐𝒐 Internal Mechanical Power

PE Parallel Element

𝒓𝒓 Fictional Radius for the Clutch

SE Serial Element

𝑻𝑻 Torque in the Clutch

𝒐𝒐 Time

𝒗𝒗𝑴𝑴 Contraction Speed

𝒗𝒗𝒎𝒎𝒎𝒎𝒎𝒎𝑴𝑴 Maximum Contraction Speed

𝜺𝜺𝟎𝟎 Tendon Strain for Isometric Maximum Force

𝜸𝜸 Proportional Factor

𝝓𝝓 Muscle Activation

𝚿𝚿 Strain Energy

�̇�𝚿 Strain Power

𝚿𝚿𝐏𝐏𝐏𝐏 Parallel Element Strain Energy

𝚿𝚿𝐓𝐓 Tendon Strain Energy

𝝎𝝎 Angular Speed of the Clutch

Page 11: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

1

1. Introduction. The human body is one the most fascinating mechanism that exist and that is why it is not only studied by doctors but also by engineers. In particular, mechanical engineers have fo-cused on investigating about muscle and bone properties in order to be able to define the forces and movements humans do.

As a result of all the research done in this field, the so-called musculoskeletal models have been developed. They are models that simulate kinetics of the human body the same way that robots’ movements can be modelled. However, the knowledge about the inner mecha-nisms of the muscles is not wide enough to make these simulations completely accurate. Furthermore, another example on how difficult to correctly model the human body is the fact that we have more muscles than needed to perform one single movement (Holmberg, 2012). This way, many combinations of active muscles lead to the same movement, and mathematically this becomes a very complex problem to solve.

In general, the simplest articulation these models can simulate is the one composed of two bones connected by a revolute joint. At the same time, these two bones are connected by a muscle which is attached to each bone by a tendon. All of this can be seen in Figure 1.

Figure 1: Simplest articulation in musculoskeletal models.

It is important to note here that the term “body” in biomechanics is referred to the physics definition and not to the human body. Likewise, the term “muscle” is referred to the con-tractile part of the articulation and does not include the tendons.

1.1. State of the art. Current applications of the musculoskeletal modelling are based on the 3 element Hill-type model that (Zajac, 1989) developed using Hill experiments (Hill A., 1938). This model

Muscle Tendon

Attachment point

Attachment point

Tendon

Page 12: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

1. Introduction.

2

(Figure 2) is composed of one contractile element (CE) with one spring in parallel called parallel element (PE) and one series element (SE). The contractile element is the muscle part, where the force is produced. Its parallel element is a passive resistance in the muscle. The series element is the tendon that attach the muscle to the bone. Each muscle has two tendons; however, they can be coupled in only one spring herein.

Figure 2: Hill model.

The total length of the system is the sum of the muscle length and the tendon length.

𝐿𝐿𝑡𝑡𝑡𝑡𝑡𝑡 = 𝐿𝐿𝑀𝑀 + 𝐿𝐿𝑇𝑇 (1.1)

Taking the time derivative of the equation (1.1) leads to:

𝐿𝐿𝑡𝑡𝑡𝑡𝑡𝑡̇ = 𝐿𝐿�̇�𝑀 + 𝐿𝐿�̇�𝑇 (1.2)

The dynamics of the model require the calculation of the speed of the system and its com-ponents. While the parallel element and the tendon can be model as simple elastic elements, the muscle’s force shows a dependency on speed and length of the muscle (Figure 3). This famous relationship used in most of the simulations was based on Hill’s experiments (Hill A., 1938).

Figure 3: Force-length dependency (left) and force-speed dependency (right)

The muscle cannot generate any force neither below 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 nor above 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 . The same applies for the maximum contraction speed −𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 . No force is produced by the muscle when the speed is lower than −𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 . Note here that the sign criteria is the same used by (Roser, 2019) and is positive for elongation and negative for contraction. 𝐹𝐹0𝑀𝑀 is the maximum isometric

PE

𝐿𝐿𝑀𝑀 𝐿𝐿𝑇𝑇

CE

SE 𝐹𝐹 𝐹𝐹

𝐹𝐹0𝑀𝑀

𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 𝐿𝐿𝑀𝑀 𝑣𝑣𝑀𝑀

𝐹𝐹𝑀𝑀 𝐹𝐹𝑀𝑀

𝐹𝐹0𝑀𝑀

𝐹𝐹𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

−𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

Page 13: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

1. Introduction.

3

(zero speed) force that a muscle can achieve. It is produced at the optimal muscle length 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 .

1.2. Aim of the project. Since it is the muscle force which is dependent on the speed and length of the muscle, the right-hand side elements of the equation (1.2) must be computed separately. However, this problem does not have a unique solution. The solution adopted up to now has been consider that the stiffness of the tendon is much higher than the muscle’s and therefore assume that:

�𝐿𝐿�̇�𝑀� ≫ �𝐿𝐿�̇�𝑇� ⟹ 𝐿𝐿�̇�𝑇 = 0 (1.3)

This approximation leads to an imprecise model with an unknown error. A new model pro-posed in (Roser, 2019) will include an evolution law for the contractile element. This avoids making the equation (1.3) assumption and therefore could improve the precision of the cur-rent models.

In this thesis, this model is simulated in MATLAB and compared with the results obtained with a commercial program (AnyBody Modelling system) in order to determine the influ-ence of neglecting the elasticity of the tendon.

Page 14: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

1. Introduction.

4

Page 15: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

5

2. Proposed model. The proposed model for the simulations has been engineered by Jonas Stålhand, from the Solid Mechanics division of Linköping University. Alexandra Roser, student in this univer-sity has developed the model further for her master thesis. Her works serves as starting point for this thesis and, in this section, their theoretical concepts are briefly explained.

2.1. Muscle contraction mechanism. The muscle cell or myocyte is composed of myofibrils, which contains sarcomeres with two types of filaments: actin filaments and myosin filaments (Scott, Stevens, & Binder–Macleod, 2001). These filaments are disposed in parallel and attached one with each other as can be seen in Figure 4.

Figure 4: Actin and Myosin filaments. (Image courtesy of (Roser, 2019))

The contraction in the muscle is due to the cross-bridging sequence. In the sarcomeres, the myosin heads have two binding points: one for ATP (adenosine triphosphate) and other for actin. When the ATP binding is active, the actin one is deactivated. By a chemical process that goes beyond the scope of this work, the myosin heads move along the actin filament attaching and detaching from it. This process is not perfect, and some bindings are not suc-cessful, causing some slippage. This behavior can resemble a friction clutch (Sharifimajd & Stålhand, 2013).

Actin

Myosin

Myosin head

Page 16: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

2. Proposed model.

6

2.2. Modified Hill model.

Figure 5: Proposed modified Hill’s model.

In Figure 5, the proposed model is represented. It still preserves the serial (SE) and parallel (PE) elements present in Hill’s model representing the same components. However, there are two new elements. First of them is a damper (D), which is included in order to describe the viscoelasticity of the muscle. The second of them is a friction clutch with a torque T and an angular speed 𝜔𝜔. This is the clutch described in section 2.1 and now contains an evolution law which will help with the contraction speed calculations.

In this case, the equations (1.1) and (1.2) are still valid and they will be used in the simula-tions. However, a new equilibrium of forces is needed.

2.2.1. Equilibrium.

Figure 6: Free body diagram.

In the free body diagram in Figure 6 it can be seen that the tendon force 𝐹𝐹𝑇𝑇 is equal to the external force 𝐹𝐹. Furthermore, the friction clutch generates a contractile force 𝐹𝐹𝐶𝐶𝐶𝐶 propor-tional to the torque T. Thus, the equilibrium equations are:

𝐹𝐹 = 𝐹𝐹𝑇𝑇 (2.1)

𝐹𝐹𝑇𝑇 = 𝐹𝐹𝐶𝐶𝐶𝐶 + 𝐹𝐹𝑃𝑃𝐶𝐶 + 𝐹𝐹𝐷𝐷 (2.2)

𝑇𝑇 = 𝑟𝑟 · 𝐹𝐹𝐶𝐶𝐶𝐶 (2.3)

Where 𝑟𝑟 is a fictional radius in (2.3). Note now that the 𝐹𝐹𝑀𝑀 represent the total muscle force along the muscle length: 𝐹𝐹𝐶𝐶𝐶𝐶 + 𝐹𝐹𝑃𝑃𝐶𝐶 + 𝐹𝐹𝐷𝐷.

𝐿𝐿𝑀𝑀 𝐿𝐿𝑇𝑇

𝜔𝜔 𝑇𝑇

D

PE

SE 𝐹𝐹 𝐹𝐹

𝐹𝐹 𝐹𝐹𝑇𝑇 𝐹𝐹𝑇𝑇

𝐹𝐹𝐷𝐷

𝐹𝐹𝑃𝑃𝐶𝐶

𝑇𝑇 𝐹𝐹𝐶𝐶𝐶𝐶

Page 17: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

2. Proposed model.

7

2.2.2. Dissipation inequality. In order to link the forces and the deformation of the muscle and the tendon, it is necessary to study the energies involved.

Even though it is not real, it is assumed that this model is an athermal mechanical process for simplicity. The second law of thermodynamics gives the dissipation inequality:

𝑃𝑃𝑚𝑚𝑚𝑚𝑡𝑡 − Ψ̇ ≥ 0 (2.4)

Where 𝑃𝑃𝑚𝑚𝑚𝑚𝑡𝑡 is the internal mechanical power and Ψ is the strain-energy stored in the muscle and tendon (Stålhand, 2018). The internal power can be defined as:

𝑃𝑃𝑚𝑚𝑚𝑚𝑡𝑡 = 𝐹𝐹𝑃𝑃𝐶𝐶 · 𝐿𝐿�̇�𝑀 + 𝐹𝐹𝑇𝑇 · 𝐿𝐿�̇�𝑇 + 𝐹𝐹𝐶𝐶𝐶𝐶�𝐿𝐿�̇�𝑀 + 𝑟𝑟𝜔𝜔� + 𝐹𝐹𝐷𝐷 · 𝐿𝐿�̇�𝑀 (2.5)

Where 𝑟𝑟𝜔𝜔 represent the linear speed of the clutch and this can be interpreted as the maxi-mum contraction speed 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 . The skeletal muscles can be divided in three types of muscle fibers: slow-oxidative, fast-oxidative-glycolytic and fast-glycolytic (Widmaier, Raff, & Strang, 2016). The first one is characterized by a slow contraction speed that can be approx-imated by 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 ≈ 6 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 /𝑠𝑠 and the other two are considered fast contracting fibers with a value of the speed 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 ≈ 16 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 /𝑠𝑠, (Nigg & Herzog, 2007). Each muscle presents different percentages of each fiber making the 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 acquire a value between both mentioned previ-ously.

The strain-energy is a linear combination of the strain-energy in the muscle and the strain energy in the tendon and they are dependent on the muscle length 𝐿𝐿𝑀𝑀 and tendon length 𝐿𝐿𝑇𝑇 respectively and independently. Therefore, the time derivative of the strain-energy can be expressed using the chain rule as:

Ψ̇ =𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

𝜕𝜕𝐿𝐿𝑀𝑀

𝜕𝜕𝜕𝜕+𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

𝜕𝜕𝐿𝐿𝑇𝑇

𝜕𝜕𝜕𝜕=𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

𝐿𝐿�̇�𝑀 +𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

𝐿𝐿�̇�𝑇 (2.6)

Introducing equations (2.5) and (2.6) into (2.4), the dissipation equation is defined:

�𝐹𝐹𝑃𝑃𝐶𝐶 + 𝐹𝐹𝐷𝐷 −𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

�𝐿𝐿�̇�𝑀 + �𝐹𝐹𝑇𝑇 −𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

� 𝐿𝐿�̇�𝑇 + 𝐹𝐹𝐶𝐶𝐶𝐶�𝐿𝐿�̇�𝑀 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 � ≥ 0 (2.7)

If the tendon is considered an elastic serial spring it is satisfied that 𝐹𝐹𝑇𝑇 = 𝜕𝜕Ψ/(𝜕𝜕𝐿𝐿𝑇𝑇 ). This, with equation (2.2) leads equation (2.7) to:

�𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

− 𝐹𝐹𝐶𝐶𝐶𝐶 −𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

�𝐿𝐿�̇�𝑀 + 𝐹𝐹𝐶𝐶𝐶𝐶�𝐿𝐿�̇�𝑀 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 � ≥ 0 (2.8)

2.2.3. Muscle speed. To satisfy the condition in equation (2.8), both addends must be positive.

Page 18: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

2. Proposed model.

8

Starting with the second parenthesis, the contractile force 𝐹𝐹𝐶𝐶𝐶𝐶 produced in the filaments can be approximated to a linear function that satisfy the main points of the function repre-sented in Figure 3 at the right:

𝐹𝐹𝐶𝐶𝐶𝐶 = �𝑘𝑘�𝐿𝐿�̇�𝑀 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 �, 𝐿𝐿�̇�𝑀 ≥ −𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

0, otherwise (2.9)

Where 𝑘𝑘 ≥ 0. Introducing equation (2.9) in equation (2.8), it satisfies at the same time that the second parenthesis is positive.

For the first parenthesis, a similar method is used. It must be proportional to the muscle speed and always positive.

𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

− 𝐹𝐹𝐶𝐶𝐶𝐶 −𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

= 𝛾𝛾𝐿𝐿�̇�𝑀 (2.10)

Where 𝛾𝛾 ≥ 0. Taking equation (2.9), substituting it in equation (2.10) and rearranging terms:

𝐿𝐿�̇�𝑀(𝛾𝛾 + 𝑘𝑘) + 𝑘𝑘𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 =

𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

−𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

(2.11)

The right-hand side of the equation it is called active force 𝜏𝜏 and applying the condition 𝐹𝐹𝑇𝑇 =𝜕𝜕Ψ/(𝜕𝜕𝐿𝐿𝑇𝑇 ), it can be written as:

𝜏𝜏 = 𝐹𝐹𝑇𝑇 −𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

(2.12)

When 𝐿𝐿�̇�𝑀 = 0, the active force becomes:

𝜏𝜏0 = 𝑘𝑘𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 (2.13)

In order to get an equation for 𝐿𝐿�̇�𝑀 with the same appearance as Hill’s equation (Hill A., 1938), the factor 𝛾𝛾 is defined as:

𝛾𝛾 =1𝑏𝑏�𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

−𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

� =1𝑏𝑏𝜏𝜏 (2.14)

Where 𝑏𝑏 = 0.25 · 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 , (Hill A., 1938). Operating equation (2.11) with equations from

(2.12) to (2.14) leads to the same equation as Hill got:

𝐿𝐿�̇�𝑀 = 𝑏𝑏𝜏𝜏 − 𝜏𝜏0𝜏𝜏 + 𝑎𝑎

(2.15)

Where 𝑎𝑎 = 0.25 · 𝐹𝐹0𝑀𝑀, (Hill A., 1938).

Page 19: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

9

3. Model development

3.1. Equations. The equation (2.15) is an ordinary differential equation with the form: 𝐿𝐿�̇�𝑀 = f(𝐿𝐿𝑀𝑀). To be able to calculate this ODE, there are three unknown variables in the equations stated previ-ously: the parameter k, the strain-energy Ψ, and the tendon force 𝐹𝐹𝑇𝑇.

3.1.1. Parameter k. The parameter k has been introduced in equation (2.9). It is necessary to account the length dependence and the activation of the muscle (Roser, 2019).

𝑘𝑘 = 𝑘𝑘� · 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀) · 𝜙𝜙 (3.1)

Where 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀) is the normalized force function represented in Figure 3. It is the result of dividing the contractile force 𝐹𝐹𝐶𝐶𝐶𝐶 by the optimum muscle length 𝐹𝐹0𝑀𝑀. This function can be approximated in first instance with a Gaussian function.

The activation of the muscle is controlled by 𝜙𝜙, whose values vary from 0 (muscle deac-tivated) to 1 (muscle completely activated). Further explanation on the activity can be found in section 3.2.6.

The parameter 𝑘𝑘� is chosen to be 𝐹𝐹0𝑀𝑀/𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 so the Equation (2.9) for 𝐿𝐿�̇�𝑀 = 0 satisfies the right-hand side of Figure 3.

3.1.2. Strain-energy 𝚿𝚿. The strain-energy of the muscle-tendon system can be assumed to be a linear combination of the strain-energy of the parallel element and the tendon.

Ψ = Ψ𝑃𝑃𝐶𝐶(𝐿𝐿𝑀𝑀) + Ψ𝑇𝑇(𝐿𝐿𝑇𝑇) (3.2)

The muscle length dependent part can be modelled (Sharifimajd & Stålhand, 2013) while the tendon will be modelled later. Therefore, the strain-energy function becomes:

Ψ =𝑐𝑐1

2𝑐𝑐2�exp �𝑐𝑐2 �𝜆𝜆𝑀𝑀

2 − 1�2− 1�� +Ψ𝑇𝑇(𝐿𝐿𝑇𝑇) (3.3)

Where 𝜆𝜆𝑀𝑀 = 𝐿𝐿𝑀𝑀/𝐿𝐿0𝑀𝑀 being 𝐿𝐿0𝑀𝑀 the resting length of the muscle and 𝐿𝐿𝑠𝑠𝑇𝑇 is the tendon slack length, i.e. the length at which the tendon starts producing force.

Page 20: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

10

This Equation (3.3) fits the assumption 𝐹𝐹𝑇𝑇 = 𝜕𝜕Ψ/(𝜕𝜕𝐿𝐿𝑇𝑇 ) for the equation (2.12). The Equa-tion (3.3) is used as well in the calculation of the length derivative of the strain-energy for equation (2.12):

∂Ψ∂LM

= 𝐹𝐹𝑃𝑃𝐶𝐶 = 2𝑐𝑐1 𝜆𝜆𝑀𝑀

𝐿𝐿0𝑀𝑀�𝜆𝜆𝑀𝑀2 − 1� �exp �𝑐𝑐2 �𝜆𝜆𝑀𝑀

2 − 1�2− 1�� (3.4)

The Equation (3.4) is the force in the parallel element. Therefore, for a fully activated mus-cle, the total force in the muscle 𝐹𝐹𝑀𝑀 would be the generated by the filaments (Equation (2.9) plus the parallel element force in Equation (3.4). A general representation of these forces can be seen in Figure 7.

Figure 7: Forces in the muscle segment.

Figure 7 does not take into account the elastic limit of the parallel element because the max-imum muscle length happens before the elastic limit, and therefore is never reached.

3.1.3. Tendon force function 𝑭𝑭𝑻𝑻. The tendon force must be determined for the calculation of the active force 𝜏𝜏. There are different alternatives to represent it, however, it must be satisfied that 𝐹𝐹𝑇𝑇 = 0 at 𝐿𝐿𝑇𝑇 = 𝐿𝐿𝑠𝑠𝑇𝑇 and 𝐹𝐹𝑇𝑇 = 𝐹𝐹0𝑀𝑀 at 𝐿𝐿𝑇𝑇 = 𝐿𝐿0𝑇𝑇 (Christensen, Damsgaard, Rasmussen, & de Zee, 2002). The length 𝐿𝐿0𝑇𝑇 is calculated as 𝐿𝐿0𝑇𝑇 = 𝐿𝐿𝑠𝑠𝑇𝑇(1 + 𝜀𝜀0) where 𝜀𝜀0 is the tendon strain due to maximum isometric force (Roser, 2019).

The expression chosen is the one proposed by (Christensen, Damsgaard, Rasmussen, & de Zee, 2002):

𝐹𝐹𝑇𝑇(𝐿𝐿𝑇𝑇) = �0, 𝐿𝐿T ≤ 𝐿𝐿s𝑇𝑇

𝐹𝐹0𝑀𝑀

𝑒𝑒𝐽𝐽 − 1�exp�𝐽𝐽

𝐿𝐿𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇

𝐿𝐿0𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇� − 1� , 𝐿𝐿𝑇𝑇 > 𝐿𝐿sT

(3.5)

Where J is a shape factor whose value is chosen to be 3 (Christensen, Damsgaard, Rasmussen, & de Zee, 2002).

𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 𝐿𝐿0𝑀𝑀

𝐹𝐹0𝑀𝑀

𝐹𝐹

𝐿𝐿𝑀𝑀

𝐹𝐹𝑀𝑀 = 𝐹𝐹𝑃𝑃𝐶𝐶 + 𝐹𝐹𝐶𝐶𝐶𝐶

𝐹𝐹𝑃𝑃𝐶𝐶

Page 21: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

11

This force function can be plotted with respect to the muscle length 𝐿𝐿𝑀𝑀 instead of the tendon length 𝐿𝐿𝑇𝑇 doing the change: 𝐿𝐿𝑀𝑀 = 𝐿𝐿 − 𝐿𝐿𝑇𝑇 . Then, the tendon slack length 𝐿𝐿𝑠𝑠𝑇𝑇 would become the muscle length for the slack tendon 𝐿𝐿𝑇𝑇𝑠𝑠𝑀𝑀 = 𝐿𝐿 − 𝐿𝐿𝑠𝑠𝑇𝑇. Note that, while 𝐿𝐿𝑠𝑠𝑇𝑇 is a fixed value for each tendon, 𝐿𝐿𝑇𝑇𝑠𝑠𝑀𝑀 is changing depending on the total length.

Figure 8: Tendon force with respect to the muscle length.

Therefore, the curve 𝐹𝐹𝑇𝑇/𝐿𝐿𝑀𝑀 plotted in Figure 8 will shift right when the total length in-creases, and it will shift left for a decrease in the total length.

The equilibrium of forces must be satisfied and will happen when the forces in Figure 7 and Figure 8 intersect.

It is important to clarify that this process is considered to be quasi-static and therefore will not compute any effects of the inertia of the muscle.

𝐹𝐹𝑇𝑇

𝐿𝐿𝑀𝑀 𝐿𝐿𝑇𝑇𝑠𝑠𝑀𝑀

Page 22: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

12

3.2. MATLAB implementation.

In Figure 9 all equations presented previously are structured in the order they are con-nected in the code in MATLAB. From bottom to top, the implementation of each formula is shown hereafter. All the parameters used has been removed in order to present the code in a general form.

3.2.1. Tendon force. function FT = tforce(LM) % (Parameters needed here) LT=L-LM % Tendon length at which the tendon force equals the muscle-specific % maximum isometric force LT_0=LT_s*(1+Eps) % Function according to Christensen et al. (2002) if LT>=LT_s FT=FM_0.*(exp(Jt.*((LT-LT_s)./(LT_0-LT_s)))-1)./(exp(Jt)-1); else FT=0; end end

𝐿𝐿𝑡𝑡𝑡𝑡𝑡𝑡 = 𝐿𝐿𝑀𝑀 + 𝐿𝐿𝑇𝑇

𝐿𝐿�̇�𝑀 = 𝑏𝑏𝜏𝜏 − 𝜏𝜏0𝜏𝜏 + 𝑎𝑎

𝑎𝑎 = 0.25 𝐹𝐹0𝑀𝑀

𝑏𝑏 = 0.25 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

𝑘𝑘 = 𝑘𝑘� · 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀) · 𝜙𝜙

𝜏𝜏0 = 𝑘𝑘 · 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 𝜏𝜏 = 𝐹𝐹𝑇𝑇 −

𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

∂Ψ∂𝐿𝐿𝑀𝑀

= 2𝑐𝑐1 ·𝜆𝜆𝑀𝑀

𝐿𝐿0𝑀𝑀�𝜆𝜆𝑀𝑀2 − 1� exp �𝑐𝑐2 �𝜆𝜆𝑀𝑀

2 − 1�2�

𝐹𝐹𝑇𝑇 =𝐹𝐹0𝑀𝑀

𝑒𝑒𝐽𝐽 − 1�exp�𝐽𝐽

𝐿𝐿𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇

𝐿𝐿0𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇� − 1�

𝑘𝑘� =𝐹𝐹0𝑀𝑀

𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

Figure 9: Flow chart for the MATLAB code.

Page 23: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

13

Every function that is length dependent is modelled by the muscle length, so the integration of the Hill equation is possible. Since the tendon force is dependent on the tendon length, first step in the code is to write the tendon length as a function of the muscle length. Then, the Equation (3.5) is described with an if statement.

3.2.2. Active force 𝝉𝝉. function t = tau(LM) % (Parameters needed here) LT_0=LT_s*(1+Eps); landa=LM/LM_0; PE=2.*C1.*landa./LM_0.*(landa.^2-1).*exp(C2.*(landa.^2-1).^2); if PE<=0 PE=0; else PE=2.*C1.*landa./LM_0.*(landa.^2-1).*exp(C2.*(landa.^2-1).^2); End t=tforce(LM)-PE; end

Inside the active force is also defined the length derivative of the strain-energy, modelled to be 0 when the function is negative, since the non-active muscle only generates force when is stretched over its resting length 𝐿𝐿0𝑀𝑀.

The active force is then defined as the tendon force minus the parallel element force.

3.2.3. Normalized force-length dependence 𝒇𝒇𝑳𝑳(𝑳𝑳𝑴𝑴). function F = fl(LM) xdata=[LM_min LM_opt LM_max]; ydata=[0.01 1 0.01]; gaussian=@(p,xdata) exp(-(xdata-p(1)).^2/(2*p(2)^2)); options = optimoptions('lsqcurvefit','OptimalityTolerance', 1e-16, 'FunctionTolerance', 1e-16); p=lsqcurvefit(gaussian, [LM_opt 0.01], xdata, ydata,[],[],options); F=gaussian(p,LM); end

This function returns values between 0 and 1. It approximates the left-hand side graphic in Figure 3 as a Gaussian function. The implementation is a modified version of Roser (2019). The ydata has been modified to widen the shape of the function and the tolerance has been tweaked to ensure the convergence of the function lsqcurvefit. This function fits the xdata and the ydata to the shape of the gaussian function.

Page 24: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

14

3.2.4. Steady-state force 𝝉𝝉𝟎𝟎. function t0 = tau0(LM) vM_max=FibreTwitch*LM_opt; kappa=FM_0./vM_max; act=1; t0=act*kappa*fl(LM)*FibreTwitch*LM_opt; end

This function makes use of the previous 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀) function. The FibreTwitch parameter is the one that accounts the contraction speed for each type of muscle fiber.

3.2.5. Integration of the muscle speed �̇�𝑳𝑴𝑴. tspan=0:0.001:1; LM_dot=@(t,LM) b.*((tau(LM)-tau0(LM))./(tau(LM)+a)); [time,LMsol]=ode15s(LM_dot,tspan,Lini);

The Hill equation is written as a function of time and muscle length. Those are the variables needed for the ODE solver.

The chosen solver is the ode15s which better handles stiff problems i.e. problems where values change rapidly in the first steps. The arguments of the solver are the function to in-tegrate, the time evaluated as tspan, and the initial muscle length named Lini.

The result of this integration is the muscle length for each time step. This length and time are stored in the variables LMsol and time respectively.

3.2.6. Activation level 𝝓𝝓. In already existing models, the activation level is an output of the inverse dynamic compu-tations that ensures the equilibrium for every time step. However, the activation level 𝜙𝜙 is an input in this model. This means that the user must provide a certain activity level for the muscle to run the simulation.

The inverse dynamic computation is a complex process out of the scope of this project, but the code does support the activity level as a time-dependent vector. This vector can be a made-up one or an exported one from another program.

function a=activation(time) Act=[0 0 0.2 0.3 0.4 0.6 0.8 0.9 1 1]; a=spline(ActEvo(:,1),ActEvo(:,2),time); end

Page 25: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

15

This function returns an interpolation for the points specified in time of the vector Act us-ing a spline. The variable time can be one single element or a vector. The return will have the same size as the variable time.

3.3. Data. All the simulations have been done using the parameters of a generic soleus muscle. This muscle is located in the back part of the calf and it has been chosen due to its high power and its big ratio between tendon and muscle. The higher this ratio is, the assumption in Equation (1.3) will probably influence the outcome more.

Symbol MATLAB Value Meaning

𝑭𝑭𝟎𝟎𝑴𝑴 FM_0 2830 [N] Maximum force output at optimum fiber length

𝑳𝑳𝒎𝒎𝒎𝒎𝒎𝒎𝑴𝑴 LM_min 0.02 [m] Minimum muscle length

𝑳𝑳𝒎𝒎𝒎𝒎𝒎𝒎𝑴𝑴 LM_max 0.06 [m] Maximum muscle length

𝑳𝑳𝒐𝒐𝒐𝒐𝒐𝒐𝑴𝑴 LM_opt 0.04 [m] Optimum muscle length

𝑳𝑳𝟎𝟎𝑴𝑴 LM_0 0.048 [m] Muscle’s resting length

𝑳𝑳𝑻𝑻𝑻𝑻 LT_s 0.375 [m] Tendon slack length

𝜺𝜺𝟎𝟎 Eps 0.053 Tendon strain for 𝐹𝐹0𝑀𝑀

𝑱𝑱 Jt 3 Shape parameter for the tendon force

𝒄𝒄𝟏𝟏 C1 15[N·m] Shape parameter for parallel element strain-energy

𝒄𝒄𝟐𝟐 C2 1.5 Shape parameter for parallel element strain-energy

- FibreTwitch 10 [1/s] Contraction speed parameter

Some of these values are unknown for this muscle since there are not studies about those properties focused on the human soleus muscle. These values are 𝐿𝐿0𝑀𝑀, 𝑐𝑐1, 𝑐𝑐2 and FiberTwitch. The rest of them come from experimental data (Delp, 1990).

These values are joined in one vector P of parameters in MATLAB. This vector is one of the arguments in the functions so there is no need to copy again these values. This method re-duces time to the user and simplifies code.

Page 26: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

3. Model development

16

Page 27: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

17

4. Isometric contraction. Isometric contraction is the one produced in an articulation where the total length L re-mains constant. The muscle is contracting and therefore reducing its length 𝐿𝐿𝑀𝑀 while the tendon is being stretched, so 𝐿𝐿𝑇𝑇 is increasing. (Widmaier, Raff, & Strang, 2016)

4.1. MATLAB implementation. There are mainly three inputs in this simulation:

• Total length. • Initial muscle length. • Activation level.

The total length in this MATLAB code is called “L” and has to be defined as a constant value before calling the ODE15s solver and it is included in the vector of parameters “P”. This value will be used in the tendon force function “tforce”. Since the definition of the tendon force depends on the tendon length, the only way to have that value is doing the variable change:

LT=L-LM;

The tendon length will be a single variable or a vector depending on the size of the muscle length, which is one of the arguments in tforce.

The ODE15s solver needs an initial condition to be able to begin the integration. In the code attached in the Appendix this value is called “Lini” and represents the initial position of the muscle.

The activation level in the code is called “act”. Even though it can be expressed as a series of activation levels for a specific time step, in this simulation it is going to be a constant value of 0 or 1. This extremely simple cases makes the simulations simple enough to understand their behavior and determine if they are correct.

4.2. Simulations. The analyzed cases are divided according the total length used for the isometric contraction. Likewise, each total length has three different scenarios, depending on the initial muscle length. Finally, each condition is simulated for an activated muscle and for a deactivated one.

Page 28: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

18

The aim of these simulations is to check if the code represents coherent behaviors and to find exceptional cases where it does not work properly.

4.2.1. Resting length. In this case, both the muscle and the tendon will be in their resting lengths. Therefore, the total length for the simulation is:

𝐿𝐿 = 𝐿𝐿0𝑀𝑀 + 𝐿𝐿𝑠𝑠𝑇𝑇 = 0.423 m (4.1)

The forces curves are plotted in Figure 10. It can be seen that for no activation in the muscle, the parallel force and the tendon force are in equilibrium for 𝐿𝐿0𝑀𝑀 with no force in that instant.

Figure 10: Forces for Equation (4.1)

The steady-state equilibrium for this total length will be:

• Non-activated muscle: 𝐹𝐹 = 0 N 𝐿𝐿 = 0.048 m • Activated muscle: 𝐹𝐹 = 1434 N 𝐿𝐿 = 0.0323 m

I. Initial length: resting muscle length.

In this case, with no activation in the muscle, the equilibrium point will be where the tendon force and the parallel element force match. And that is satisfied as can be seen in Figure 11.

Page 29: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

19

Figure 11: Length and Force evolution. Resting length. Initial length: resting muscle length. No activation.

The initial condition is already in equilibrium and because there is not any force that changes that equilibrium, the length and the force remain constant.

Now if the muscle is activated, the tendon force should match the muscle force 𝐹𝐹𝑀𝑀 instead of the parallel element. This new state is represented in Figure 12.

Figure 12: Length and Force evolution. Resting length. Initial length: resting muscle length. Muscle activated.

II. Initial length: muscle shortened.

The muscle being shorter than its resting length means that the tendon is stretched. This configuration (and some of the followings) is not realistic since something external should stretch the tendon to that position. However, they are simulated in order to check if the code works for every case.

The chosen length for the muscle is 0.035 m. With the muscle not contracting, the tendon force will try to reach the same equilibrium as in Figure 11.

Page 30: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

20

Figure 13: Length and Force evolution. Resting length. Initial length: shortened muscle length. Muscle not activated.

If the muscle is activated, the steady-state of the system in Figure 14 must be the same as in Figure 12.

Figure 14: Length and Force evolution. Resting length. Initial length: shortened muscle length. Muscle activated.

III. Initial length: muscle stretched.

Now the muscle starts stretched with a length of 0.054 m. Then, the parallel element will contribute with positive force while the tendon will not apply force since it will be smaller than its slack length.

For the simulation with the muscle deactivated, the steady state is for both, muscle and ten-don, their resting lengths (Figure 15).

Page 31: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

21

Figure 15: Length and Force evolution. Resting length. Initial length: stretched muscle length. Muscle not activated.

And if the muscle is contracting, its length will reduce until it reaches 𝐿𝐿0𝑀𝑀 = 0.0323 m (Fig-ure 16).

Figure 16: Length and Force evolution. Resting length. Initial length: stretched muscle length. Muscle activated.

4.2.2. Stretched system. Herein, the total length is higher than the sum of the slack length of the muscle and the ten-don. Therefore, in the resting position i.e. where no force is generated, both the muscle and the tendon are stretched. In that point, the parallel element force must match the tendon force. The selected total length is:

𝐿𝐿 = 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 + 𝐿𝐿𝑠𝑠𝑇𝑇 = 0.4349 m (4.2)

Which is selected because it is the one that makes the tendon force reach the maximum muscle force 𝐹𝐹0𝑀𝑀 as can be seen in Figure 17.

Page 32: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

22

Figure 17: Forces for a total length L=0.4349 m.

The steady-state equilibrium for this total length will be:

• Non-activated muscle: 𝐹𝐹 = 210 N 𝐿𝐿𝑀𝑀 = 0.0540393 m • Activated muscle: 𝐹𝐹 = 2830 N 𝐿𝐿𝑀𝑀 = 0.04 m

I. Initial length: resting muscle length.

For an initial length of 0.054 m and no activation in the muscle the position should not change. With the muscle activated, the equilibrium should be at a length of 0.04 m. This can be verified in Figure 18 and Figure 19.

Figure 18: Length and Force evolution. Stretched system. Initial length: resting muscle length. No activation.

Page 33: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

23

Figure 19: Length and Force evolution. Stretched system. Initial length: resting muscle length. Muscle activated.

II. Initial length: muscle shortened.

The initial muscle length chosen for this simulation is 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚 = 0.03 m. If the muscle is not active, the force of the tendon (which is stretched) will make the muscle longer. Once the muscle is longer than its slack length, the parallel element force will work as a brake until the equilibrium is reached (Figure 20).

Figure 20: Length and Force evolution. Stretched system. Initial length: shortened muscle length. Muscle not activated.

If the muscle is active, it will try to provide 900 N when its length is 0.03 m, but the tendon is going to provide a force higher than that. Thus, the muscle length will be extended, being able to produce more and more force at the same time the tendon will reduce its force until both forces match (Figure 21).

Page 34: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

24

Figure 21: Length and Force evolution. Stretched system. Initial length: shortened muscle length. Muscle activated.

III. Initial length: muscle stretched.

In this case, the parallel element contributes to the muscle force and the tendon will act as a brake. The length chosen now is 0.06 m., which is the most extreme stretch in this muscle.

Figure 22: Length and Force evolution. Stretched system. Initial length: stretched muscle length. Muscle not activated.

Figure 23: Length and Force evolution. Stretched system. Initial length: stretched muscle length. Muscle activated.

Page 35: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

25

4.2.3. Shortened system. Now, the total length is chosen to make both the tendon and the muscle to be in a position where no one produce any resistive force. Taking the total length as:

𝐿𝐿 = 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 + 𝐿𝐿𝑠𝑠𝑇𝑇 − 0.008 = 0.407 m (4.3)

The forces will look like in Figure 24: Forces for a total length of 0.415 m.

Figure 24: Forces for a total length of 0.415 m.

The steady-state equilibrium for this total length will be:

• Non-activated muscle: 𝐹𝐹 = 0 N 𝐿𝐿𝑀𝑀 ∈ [0.032, 0.048] m • Activated muscle: 𝐹𝐹 = 247 N 𝐿𝐿𝑀𝑀 = 0.0255 m

As it can be seen, the equilibrium for a non-activated muscle it is no longer a point but an interval, since both the muscle and tendon are not long enough to produce a resistive force.

I. Initial length: resting muscle length.

For this configuration, the muscle length could be any value between 0.032 m and 0.048 m. Taking the middle value (0.04 m) for example, the result is the following:

Page 36: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

26

Figure 25: Length and Force evolution. Shortened system. Initial length: resting muscle length. No activation.

Figure 26: Length and Force evolution. Shortened system. Initial length: resting muscle length. Muscle activated.

It can be seen that with no activation, the system remains in the equilibrium point and with the muscle activated it contracts until the new equilibrium point. It can be observed that at that length the muscle can create force, but the tendon needs to be stretched a bit to create a resistive force.

II. Initial length: muscle shortened.

To have the muscle shortened and therefore, a stretched tendon, the muscle length has to be below 0.032 m. If 0.028 m is taken, the result is:

Page 37: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

27

Figure 27: Length and Force evolution. Shortened system. Initial length: muscle shortened. No activation.

Figure 28: Length and Force evolution. Shortened system. Initial length: muscle shortened. Muscle activated.

Now the tendon can provide force to stretch the muscle to the resting position when the muscle is not active. With the active muscle the tendon provides force since the beginning.

III. Initial length: muscle stretched.

If the muscle has to be stretched, the initial length must be above 0.048 m which is the last point of equilibrium with no parallel element force involved. Taking 0.052 m as initial length the Figure 29 and Figure 30 are the result.

Page 38: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

28

Figure 29: Length and Force evolution. Shortened system. Initial length: muscle stretched. No activation.

Figure 30: Length and Force evolution. Shortened system. Initial length: muscle stretched. Muscle activated.

With the muscle deactivated the equilibrium point is reached thanks to the parallel element force but a more interesting phenomenon occurs when the muscle is activated. Until time equals 0.081 s the tendon cannot provide any force, therefore the muscle, which is fully ac-tivated will not find any resistance to the contraction and the contraction speed will in-crease. However, if Figure 3 is remembered, the contraction speed it is constrained by the −𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 .

Page 39: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

29

Figure 31: Contraction speed when tendon does not create a resistive force.

If the contraction speed is plotted with respect to time (Figure 31), it can be found that for the time 0.053 s the speed is 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 = −0.4 m/s, at the same time that the 𝐹𝐹𝑀𝑀 = 0.

Page 40: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

4. Isometric contraction.

30

Page 41: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

31

5. Isotonic contraction. Isotonic contraction is a contraction in which the muscle changes length while the load on the muscle remains constant (Widmaier, Raff, & Strang, 2016). Since the load is constant, the tendon will not change its length. This case is not the most interesting one from the point of view of the aim of the project, but it is an important type of contraction that can confirm whether the code works or not.

5.1. MATLAB implementation. In the isotonic contraction there are again three inputs:

• Initial muscle length. • Tendon force. • Activation level.

Initial muscle length and the activation level works exactly the same way as in the isometric contraction. In this case the activation level will be fixed at 1 since the cases with the muscle deactivated are extremely simple and are not useful.

The important change is the tendon force implementation. This force does not depend nei-ther on time nor on any length. Therefore, the function tforce will look like this:

function FT = tforce(t,LM,P) FT=zeros(size(LM)); for h=1:size(LM) FT(h)=1300; end end

Where 1300 can be substituted for any other value in newtons. The for loop is to ensure that the return has the same size of the LM variable. When the ODE15s solver call this function, LM is a single value and therefore tforce must return just one value. However, when the solver has finished, to calculate the rest of the variables of the model, the tendon force has to be a vector in order to be coherent in dimensions.

Page 42: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

5. Isotonic contraction.

32

5.2. Simulations. Now, the analyzed cases will depend on the initial muscle length with respect to the equi-librium points that the constant force create.

Figure 32: Forces in an isotonic contraction (𝐹𝐹𝑇𝑇 = 1300 N).

For a tendon force of 1300 N, the forces involved in the process are shown in Figure 32. Thus, there are three equilibrium points when the muscle is fully activated:

• Point A: 𝐹𝐹 = 1300 N 𝐿𝐿𝑀𝑀 = 0.0318 m • Point B: 𝐹𝐹 = 1300 N 𝐿𝐿𝑀𝑀 = 0.0482 m • Point C: 𝐹𝐹 = 1300 N 𝐿𝐿𝑀𝑀 = 0.063 m

While points A and B are possible equilibrium points, the point C cannot exist since its po-sition implies a muscle length higher than the maximum muscle length. In other cases, with a lower tendon force that would give an existing equilibrium point, the tendon force will be compensated only by the parallel element force 𝐹𝐹𝑃𝑃𝐶𝐶 , since the contractile element will not be able to produce enough force. Therefore, the analyzed cases will be before and after points A and B. The non-active muscle simulations are not considered herein, since they always will match the point C.

5.2.1. Before point A. The chosen point for this simulation is 𝐿𝐿𝑀𝑀 = 0.025 m.

A

B

C

Page 43: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

5. Isotonic contraction.

33

Figure 33: Length and Force evolution. 𝐿𝐿𝑀𝑀 < 0.0318 m.

Here, the muscle is too short to provide enough force to hold the 1300 N load. However, thanks to this load, the muscle will increase its length and therefore its capability to provide more force until it reaches the tendon force.

5.2.2. After point A. In this case, the muscle length is 𝐿𝐿𝑀𝑀 = 0.035 m. With this length, the muscle has more than enough force to hold the tendon force and therefore the muscle will be able to contract until 0.0318 m.

Figure 34: Length and Force evolution. 𝐿𝐿𝑀𝑀 > 0.0318 m.

5.2.3. Before point B. Technically, being before point B means being after point A, but it is important to verify what happens after the maximum isometric force. The initial muscle length in this case is 𝐿𝐿𝑀𝑀 = 0.046 m and the response is similar to what happened in the previous point, but with the bump due to have crossed the maximum isometric force.

Page 44: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

5. Isotonic contraction.

34

Figure 35: Length and Force evolution. 𝐿𝐿𝑀𝑀 < 0.0482 m.

5.2.4. After point B. After point B, the muscle will be too long to provide enough force and the tendon force will make the muscle even bigger, so the only force that can be hold the tendon force is the par-allel element one. This can be seen in Figure 36, with a muscle length of 0.05 m.

Figure 36: Length and Force evolution. 𝐿𝐿𝑀𝑀 > 0.0482 m.

This is equilibrium point is the same as if the muscle is not activated anytime because the muscle length is above its maximum. With a higher load the muscle could even break but this case is not considered in this project.

Page 45: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

35

6. Generic contraction In isometric and isotonic contractions, the total length was something fixed in the first case or an output of the code in the other one. In a generic contraction, the total length is a value dependent on time and therefore the output is the force needed to follow the specified movement.

6.1. MATLAB implementation For this contraction there are two input variables:

• Activation level. • Total length evolution.

The activation level is again fixed at 1 because it makes no sense to calculate the force for a movement if the muscle is not active. However, it is still considered an input since it can be set to different values rather than 0 or 1, or even be a time dependent value. This will be used in next sections, when this code is compared with the AnyBody program.

The total length evolution is an upgrade on how the isometric L value worked there. In iso-metric and generic contraction, this total length is used to calculate the tendon length based on the muscle length calculated by the ODE15s solver. Here, this variable is time dependent and to implement so, there are two main options. The first of them would be specifying points of the length through time and then make an interpolation between them. The second one is to define a mathematical expression that depends on the time, so there is no need to interpolate.

The second option has been chosen for its simplicity and flexibility. The expression chosen is an inverse exponential, similar to the expression that model the discharge of a capacitor:

𝐿𝐿(𝜕𝜕) = (𝐿𝐿0 − 𝐿𝐿∞) ∙ 𝑒𝑒−𝐶𝐶·𝑡𝑡 + 𝐿𝐿∞ (6.1)

Where 𝐿𝐿0 is the initial length, 𝐿𝐿∞ is the final length and 𝐶𝐶 is a shape parameter to modify the speed of the contraction.

In this case the initial muscle length is not considered as an input parameter. When an ar-ticulation is in a certain position, there is only one possible position for the muscle and the tendon. That position comes from the equilibrium of the forces in the tendon and in the parallel element of the muscle, when the muscle is not activated. This equilibrium point will be the initial value in order to make a more realistic set of simulations.

Page 46: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

6. Generic contraction

36

This equilibrium point is calculated with an external force, so the main code is not too clut-tered. The complete code is not attached in this document, but mainly what it does is to calculate the distance between the tendon force and the parallel element force for each mus-cle length and return the muscle length where that distance is minimized:

dist=(FT-PE); [value,eq_i]=min(abs(dist)); LM_eq=LM(eq_i);

The function min returns the value of the least difference between forces in newtons and eq_i, which is the index where the minimum value is found. The muscle length correspond-ing to that index is the equilibrium length used as initial value.

6.2. Simulations. There are several combinations of initial and final positions, each one with its own equilib-rium system. However, if it is analyzed only at an initial point where no parallel force exists, and another initial point where it does exist, most of the other combinations will look simi-lar to these. These two combinations could be for example:

𝐿𝐿0 (m) 𝐿𝐿0𝑀𝑀 (m) 𝐿𝐿∞ (m) 𝐿𝐿∞𝑀𝑀 (m)

Case 1 0.415 0.04 0.405 0.0247

Case 2 0.43 0.0515 0.423 0.0323

6.2.1. Case 1: left part of the curve. In case 1, setting the initial total length at 0.415 m the corresponding muscle length for that is 0.04 m. In the steady state, for a total length of 0.405 m, the muscle length is 0.0247 m:

Figure 37: Initial point (left) and final point (right) for Case 1.

With these points, the total length evolution described in Equation (6.1) becomes:

Page 47: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

6. Generic contraction

37

𝐿𝐿(𝜕𝜕) = (0.415− 0.405) ∙ 𝑒𝑒−8·𝑡𝑡 + 0.405 (6.2)

The shape parameter 𝐶𝐶 is chosen to be 8 because, for simulations of 1 second, makes the system fast enough to get the steady state, but slow enough to see correctly the transitory phase. All of these can be seen in Figure 38: Total length evolution in case 1.

Figure 38: Total length evolution in case 1.

Figure 39: Length and Force evolution. General contraction case 1.

In Figure 39, a coherent evolution is obtained. F^M which is the maximum available force in the muscle (contractile element plus parallel element) starts from 0 N, even though in Figure 38 (left) it can be seen that the available force is 2830 N. This is due to the contraction speed, which starts at 0.4 m/s, which is the maximum speed, and therefore the muscle can-not provide any force. The evolution of the contraction speed can be seen in Figure 40.

Page 48: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

6. Generic contraction

38

Figure 40: Contraction speed in case 1.

6.2.2. Case 2: right part of the curve. Now, in case 2, the initial total length is 0.43 m, which corresponds to a muscle length of 0.0515 m. In the steady state, for a total length of 0.423 m the muscle length is 0.0323 m.

Figure 41: Initial point (left) and final point (right) for Case 2.

With these points, the total length evolution described in Equation (6.1) becomes:

𝐿𝐿(𝜕𝜕) = (0.43− 0.423) ∙ 𝑒𝑒−8·𝑡𝑡 + 0.423 (6.3)

With this input, the result is plotted in Figure 42. Now the initial force in the muscle is closer to the maximum it can provide at 0.0515 m. That is because the contraction speed is now closer to 0 m/s (Figure 43). The tendon force starts at 99 N since the system is stretched and both the tendon and the muscle have a longer length than their slack length.

Page 49: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

6. Generic contraction

39

Figure 42: Length and Force evolution. General contraction case 2.

Figure 43: Contraction speed in case 2.

Page 50: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

6. Generic contraction

40

Page 51: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

41

7. AnyBody comparison. Once MATLAB code run solid simulations, where the muscle length and force evolutions are coherent with the reality, it is time to compare how different these results are from what AnyBody computes.

AnyBody is a commercial program where some human-body structures can be built with muscles and bones (called segments) and after that run an “Inverse Dynamics Simulation” which calculates the required forces in the muscles to perform any movement specified by the user.

One big difference that will affect to comparison is that the activation level in AnyBody is an output from the analysis that ensures the equilibrium. However, the tendon force calculated in MATLAB code and the total length evolution can be used as inputs at the same time. Therefore, the method to compare the MATLAB code with AnyBody computations is to check how different from an activation of 1 (the one used in MATLAB) AnyBody output is.

Furthermore, as MATLAB code accepts vectors for the activation definition, the activation output from AnyBody can be introduced then to MATLAB and re-run the simulation.

7.1. AnyBody code. In order to recreate the same contractions made in previous sections, one simple muscle and tendon is used. This single muscle-tendon unit is attached in one side to a fixed refer-ence and the other side to a massless rigid segment. This rigid segment has every movement constrained except for the X displacement.

To create the massless rigid segment, it is used the class AnySeg and an initial position is set via the property r0.

AnySeg localseg = { r0 = {0.42, 0, 0}; Mass = 0; Jii = {0, 0, 0}; };

Now the muscle is needed. To define it the class AnyMuscleModel3E is used and inside of it, it is necessary to write every property of the muscle. Within these values there are also the tendon properties. All these properties must be the same as those defined in the table in Section 3.3. Then, the muscle is attached to the global reference and the massless segment “localseg” using the class AnyViaPointMuscle:

Page 52: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

42

AnyViaPointMuscle muscle = { AnyMuscleModel &MusMdl = ..Muscles.SoleusPar; AnyFixedRefFrame &Org = ..GlobalRef; AnySeg &Ins = ..localseg; };

In order to restrict all the movements except the displacement in the x direction of the mass-less segment it is necessary to use the class AnyPrismaticJoint. Here, it is defined the free axis and the segment that it is going to be constrained. At the same time, the position of this side of the muscle it is declared controllable using AnyKinLinear. This class create the object positionmeasure and with other classes it can be specified how this position changes.

AnyPrismaticJoint position = { Axis = x; AnyFixedRefFrame &Ground = .GlobalRef; AnySeg &Slider = .localseg; }; AnyKinLinear positionmeasure = { AnyFixedRefFrame &Ground = .GlobalRef; AnySeg &Slider = .localseg; };

The result of this code can be seen in Figure 44.

Figure 44: Soleus muscle with a massless segment (blue coordinate system)

7.2. How to use the same functions. The definition of the parallel element force function in previous sections was made by ap-proximation. The same applies for the normalized force-length dependency in the muscle. Both are adjusted to produce coherent values but probably not accurate ones.

AnyBody contains in the internal code these function with enough accuracy. However, the implementation of these functions is not open to the user. Therefore, to optimize the func-tions in the MATLAB code, some points of these curves can be extracted using the code in Section 7.1.

Page 53: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

43

As said before, the object positionmeasure is needed in order to control the position of the massless segment. This control is made by using the class AnyKinEqSimpleDriver. Within this class the position, speed or acceleration of the point driven can be defined. There are two other parameters worth describing: MeasureOrganizer and Reaction.Type. The first one control which direction is driven: 0 = x, 1 = y and 2 = z. The second one is how the reac-tion force is managed. If the value is set to Off, the force will be provided by the muscle to perform the specified movement. If the value is On, a virtual motor will carry all the neces-sary force.

AnyKinEqSimpleDriver positiondriver = { MeasureOrganizer = {0}; DriverPos = {Main.MyModel.Muscles.SoleusPar.Lfbar}; DriverVel = {0}; //DriverAcc = ; AnyKinMeasure &uhuh = .positionmeasure; Reaction.Type = {Off}; };

To recreate the normalized force-length dependency in the muscle, different values from 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 = 0.02 m and 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 = 0.04 m are introduced in the variable DriverPos. Then the in-

verse dynamics simulation is run, and the force resultant of the analysis is stored. Therefore, nine points (Figure 45) are obtained for the left part of the normalized curve, which is where no parallel element force appears.

Figure 45: Points extracted from AnyBody.

Now, these points are mirrored and joined by a spline curve and stored in a function file in MATLAB. This code can be read in the Appendix.

Same procedure is applied to obtain the parallel element curve. However, in this case, the length points used are in the right side of the curve and instead of the muscle force read before, the parallel element force is taken from AnyBody analysis results. In AnyBody code it has been found that 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 = 𝐿𝐿0𝑀𝑀 = 0.04 m.

Page 54: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

44

Fortunately, the definition of the tendon force used in Equation (3.5) is the same as AnyBody uses in their code and there is no need to extract any data for its correct implementation.

7.3. Virtual activation. In these comparisons, values that has already been seen such as the evolution of the tendon or muscle length or muscle force are going to be used. However, AnyBody returns as output an activation vector that ensures the equilibrium in each time step.

The MATLAB code is not prepared to calculate the activation at each time step. However, once the force available in the muscle is calculated, it can be compared to the force of the tendon. From this operation (Equation) the so-called virtual activation is extracted. This virtual activation does not ensure equilibrium at all times, but it gives an approximate idea of how it would be.

𝑎𝑎𝑐𝑐𝜕𝜕𝑣𝑣 =𝐹𝐹𝑇𝑇

𝐹𝐹𝑀𝑀 (4.1)

This new parameter will be used to make the comparison with the activation calculated in AnyBody and thus know how close the models are.

7.4. Isotonic contraction. The isotonic contraction is the least interesting case, as the tendon keeps its length constant due to the fact that the force in the tendon is also constant.

Although this simulation will not show any information about the tendon behavior, this will help to discover differences between the models.

In this isotonic contraction 1300 N is used as constant tendon force. However, the parallel element and the muscle force-length dependency curves are now different. The forces for this configuration can be seen in Figure 46. There are 4 different points to analyze in this case, one before and after each equilibrium point.

Page 55: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

45

Figure 46: Forces in isotonic contraction with AnyBody parameters.

Analyzed points:

• 0.026 m 720 N • 0.033 m 2148 N • 0.046 m 2342 N • 0.055 m 594 N

Equilibrium points:

• 0.029 m 1300 N • 0.0513 m 1300 N

The second equilibrium point corresponds to a metastable equilibrium. Only when the mus-cle length is exactly 0.0513 m, equilibrium is preserved. If the muscle length is over that value, the muscle will not be able to produce enough force and it will stretch to the infinity (since there is no breaking point). Any slight variation that reduce the muscle length below 0.0513 m will allow the muscle to continue contracting to the left equilibrium point at 0.029 m.

Therefore, the expected results for the analyzed points are that the first three points will lead to the left equilibrium point and the last one, to infinite stretch.

7.4.1. AnyBody configuration. In this isotonic contraction, AnyBody needs the constant tendon force and the total length evolution obtained from MATLAB as inputs.

The tendon force is easy to implement since it is a constant value. To do so, the class AnyForce3D is used and with AnySeg it is specified where it is applied.

AnyForce3D kraft = { //FORCE F = {1300,0,0}; AnySeg &Ins = .localseg; };

Page 56: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

46

The total length evolution is imported from an external file. This external file called “timepos.txt” must contain one column of time steps and a second column of positions. AnyKinEqInterPolDriver reads each column and interpolates to obtain the values needed by the solver.

AnyKinEqInterPolDriver positiondriver = { Type = Bspline; BsplineOrder = 4; MeasureOrganizer = {0}; //0=X, 1=Y, 2=Z FileName = "timepos.txt"; AnyKinMeasure &uhuh = .positionmeasure; Reaction.Type = {Off}; };

7.4.2. MATLAB configuration. The timepos.txt file can be easily generated inside of MATLAB without the necessity of copying each column manually. The first step is to calculate the equilibrium tendon length for the force chosen. For that, the Equation (3.5) is inverted so the tendon length is now 𝐿𝐿𝑇𝑇 = 𝑓𝑓(𝐹𝐹𝑇𝑇).

The second step is to create a matrix of two columns. The first column corresponds to the time steps and the second one to the positions, as stated in previous section. Once the vector is formed, the third step is to create the file with the function save. It is important to specify that the encoding for the file is set to be ASCII, otherwise AnyBody will not be able to read it at all.

LT_eq=LT_s+((LT_0-LT_s)/Jt).*log(tforce(time,LMsol,P)*(exp(Jt)...

-1)/FM_0+1); TimePos=[time LMsol+LT_eq]; save('timepos.txt','TimePos','-ASCII');

7.4.3. Results. The muscle force 𝐹𝐹𝑀𝑀 obtained corresponds to the maximum force the muscle can deliver with the activation set to 1. The activation in the proposed model is not trivial to calculate. However, the relation 𝐹𝐹𝑇𝑇/𝐹𝐹𝑀𝑀 could be a fictional activation that would obligate the muscle force to be in equilibrium with the tendon force, but do not forget is not as a result of the computation.

There are two different simulations for each case. One of them use activation 1 all the time in MATLAB code. The other one takes the activation vector obtained in AnyBody and import it to MATLAB using this vector instead of a constant value of 1.

One generalized result is the tendon length dimension. Both models calculate the same length except for an insignificant deviation (AnyBody: 0.390098577864011 m; MATLAB: 0.390098577919056 m). Hereunder are the results for each point.

Page 57: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

47

I. Muscle length: 0.026 m. Available force: 720 N.

Figure 47: Case I. Activation = 1 left column. Activation = Vector right column.

Muscle length evolution with activation set to 1 is exactly the same for both models. This is explained because the AnyBody model uses the total length evolution imported from MATLAB and also decides that the length of the tendon is constant and with the same value as MATLAB code. Importing the activation data from AnyBody, MATLAB code seems to pro-duce a little slower response, with only 46 milliseconds of lag.

The AnyBody force follows exactly the tendon force line because its code calculates the ac-tivation to ensure the equilibrium. However, this leads to an impossible situation where the muscle must be activated at 150% in the beginning. MATLAB model takes into account that the tendon force will elongate the muscle and therefore could end up reaching the equilib-rium. Thanks to that, MATLAB model uses 52.18 J less of mechanical work than AnyBody model with the activation set to 1 and 51.18 J less with AnyBody activity. This difference in mechanical work is carried out by the tendon in MATLAB.

Page 58: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

48

In general, using AnyBody activation vector makes the MATLAB system slower since the muscle is not delivering all its available force.

II. Muscle length: 0.033 m. Available force: 2148 N.

Figure 48: Case II. Activation = 1 left column. Activation = Vector right column.

In this second case, the muscle length evolution is the same between models for the same reason in the first case. Now the lag in length is about 16 milliseconds.

The difference in mechanical work with activation set to 1 is now 63.84 J more than the AnyBody result. This extra work comes from having the muscle more activated than neces-sary. With AnyBody activation this work is increased to 64.99 J. These values are so close although the initial muscle force for the MATLAB model, using AnyBody activation, is 100 N lower, but that is because the system then is slower, as it can be seen also in the activation

Page 59: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

49

evolution. For 0.4 seconds, the activation 1 model matches the AnyBody activation, but for the other simulation they do not match until 0.6 seconds.

III. Muscle length: 0.046 m. Available force: 2342 N.

Figure 49: Case III. Activation = 1 left column. Activation = Vector right column.

Now the muscle length evolution shows again some lag when using AnyBody activation. The lag in this case is about 11 milliseconds.

The mechanical work for activation set to 1 is 240.11 J and for the AnyBody activation model the work is 243.4 J. These values can be considered practically the same. Thus, the models are behaving almost the same without any relevant difference.

Page 60: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

50

IV. Muscle length: 0.055 m. Available force: 594 N.

Figure 50: Case IV. Activation = 1 left column. Activation = Vector right column.

This case is different than the others since there is no equilibrium point reached. Despite this, both models have the same muscle length evolution.

Attending to the force, the way AnyBody treats the muscle is accepting that the muscle can be overactivated and tries to satisfy the equilibrium at any moment. On the other hand, MATLAB code knows that beyond maximum muscle length there cannot exist any force and the parallel element past 0.0725 m is not implemented. Once the muscle force in MATLAB is close to 0, the virtual activation shoots up to infinity, while AnyBody has lower values for activation since there is still a small force provided by the parallel element.

Page 61: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

51

7.5. Isometric contraction. In the isometric contraction simulations made in previous sections, many positions for the total length and the initial muscle length were tested. Once all of them were checked to be realistic, the comparison with AnyBody code is made.

However, for simplicity the comparison is made for three different total lengths and, in each one of them, the initial muscle length is the equilibrium position for the tendon and the muscle is deactivated. That is equivalent to calculate the equilibrium point for the tendon and the parallel element and it is done the same way as described in Section 6.1.

7.5.1. AnyBody configuration. AnyBody needs for this isometric simulation a constant total length and the evolution of the force that the massless segment will experience. That force is equivalent to the tendon force.

In first place, the total length is specified by AnyKinEqSimpleDriver where now it is no longer reading a file, but a constant value for position in DriverPos.

AnyKinEqSimpleDriver positiondriver = { MeasureOrganizer = {0}; DriverPos = {0.435}; DriverVel = {0}; AnyKinMeasure &uhuh = .positionmeasure; Reaction.Type = {Off}; };

For the tendon force, it is necessary to import the data from an external file. The procedure is similar to what is done in the isotonic contraction. Now the file read is called “timeforce.txt”.

AnyForce3D kraft = { //FORCE AnyFunInterpol force = { Type = Bspline; BsplineOrder = 4; FileName = "timeforce.txt"; }; AnyVector Fx = force(t); F={Fx[0],0,0}; AnySeg &Ins = .localseg; };

NOTE: if we are in the right-hand side of the force-length dependency curve it can appear some error in AnyBody, because the equilibrium in the beginning cannot be satisfied. Changing the first line of the timeforce.txt file to a slightly higher value of the force will probably solve it.

Page 62: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

52

7.5.2. MATLAB configuration. The code for the force in AnyBody needs to read a file with one first column for the time steps and one second column with forces. The way this file is created is the same as the file produced for the isotonic contraction.

TimeForce=[time Ftend]; save('timeforce.txt','TimeForce','-ASCII');

7.5.3. Results. I. Total length 0.41 m.

This simulation uses 0.41m. of total length which corresponds to an initial muscle length of 0.035 m. and an equilibrium point of 0.02491 m for the muscle length. In Figure 51 it can be seen that the contraction take place in the left part of the curve.

Figure 51: Forces in isometric contraction with total length of 0.41 m.

Page 63: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

53

Figure 52: Results for isometric contraction with 0.041 m of total length. Left: Activation =

1. Right: Activation = AnyBody Vector.

The tendon force and the total length are the inputs in AnyBody. Its results, the tendon length and the muscle length evolution from AnyBody, are identical to the MATLAB output. However, using AnyBody activation vector the response in MATLAB becomes slower with a 35 milliseconds lag for both lengths.

Muscle force in MATLAB is higher than the result of AnyBody by 53.46 J of mechanical work, however using the activation vector this work is reduced to 47.45 J, but again the response is slower.

Another useful way of comparing models is to calculate the virtual activity in MATLAB, di-viding the tendon force by the muscle force and plotting it on top of AnyBody activation. Without AnyBody activation, the virtual activation in MATLAB is almost the same, with a 24 milliseconds lag. However, as seen before, the use of AnyBody activation makes the MATLAB result slower.

Page 64: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

54

II. Total length 0.426 m.

This simulation uses 0.426m. of total length which corresponds to an initial muscle length of 0.0498 m. and an equilibrium point of 0.0329 m for the muscle length. In Figure 53 it can be seen that the contraction take place from left part of the curve to the right.

Figure 53: Forces in isometric contraction with total length of 0.426 m.

Page 65: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

55

Figure 54: Results for isometric contraction with 0.0426 m of total length. Left: Activation

= 1. Right: Activation = AnyBody Vector.

Tendon and muscle length have the same shape for AnyBody and MATLAB and again, using the activation vector, the system becomes slower for MATLAB model. The lag in this case is about 72 milliseconds for both.

Muscle force is higher, using 128.85 J of extra mechanical work. However, since the virtual activation and the AnyBody activation are extremely close, the result of the muscle force with AnyBody activation is also very similar.

III. Total length 0.435 m.

This simulation uses 0.435 m of total length which corresponds to an initial muscle length of 0.0578 m and an equilibrium point of 0.04012 m for the muscle length. In Figure 55 it can be seen that the contraction take place at the right side of the curve.

Page 66: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

56

Figure 55: Forces in isometric contraction with total length of 0.426 m.

Page 67: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

57

Figure 56: Results for isometric contraction with 0.0435 m of total length. Left: Activa-

tion = 1. Right: Activation = AnyBody Vector.

In this case the influence of the AnyBody activation on the muscle and tendon length evolu-tion is higher. The MATLAB model is delayed 233 milliseconds.

The muscle force with activation set to 1 is faster for the MATLAB model by 64 milliseconds. Using the AnyBody activation, MATLAB model is heavily delayed, making it 172 millisec-onds slower.

Comparing the virtual activation for the MATLAB model with the activation output of the AnyBody code, it is a little bit faster and starts different than zero. This is explained because the muscle force does not start at zero.

7.6. General contraction. The most special cases of contraction have been compared and now is the turn for the more generic type of contraction. Is the same contraction as seen in Section 6.

In AnyBody the inputs will be a file with the total length variation and other file with the tendon force evolution. This is, combining the code in Isotonic and Isometric comparison. These files will be created with MATLAB by the same procedure as in these previous con-tractions.

The contractions will be performed at the left and across the force-length dependency curve as in previous simulations.

Page 68: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

58

7.6.1. From 0.413 m. to 0.407 m. This contraction take place in the left part of the curve where the muscle force decreases when contracting. The initial length for the muscle is 0.038 m and decreases to 0.0237 m. The initial and final states can be seen in Figure 57.

Figure 57: Forces in generic contraction from 0.413 m to 0.407 m. (Left: initial; Right: fi-

nal)

Page 69: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

59

Figure 58: Results for generic contraction. From 0.413 m to 0.407 m. Left: Activation =

1. Right: Activation = AnyBody Vector.

Forcing AnyBody to contract following a specific total length and tendon force evolution seems to produce the same results in terms of muscle and tendon length. If the activation vector produced in AnyBody is used in MATLAB, the system is delayed 36 milliseconds.

Muscle force presents an overshoot response, producing 74.34 J extra of mechanical work. However, using AnyBody activation, this extra mechanical work is reduced to 67.62 J.

If the virtual activation, defined as 𝐹𝐹𝑇𝑇/𝐹𝐹𝑀𝑀 from the MATLAB model, is plotted with the ac-tivation from AnyBody that the muscle is activated slower than AnyBody does.

7.6.2. From 0.423 m. to 0.417 m. This contraction take place across the curve where the muscle force changes its behavior when its length is decreased. The initial length for the muscle is 0.0471 m and decreases to 0.0279 m. The initial and final states can be seen in Figure 59.

Page 70: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

60

Figure 59: Forces in generic contraction from 0.423 m to 0.417 m. (Left: initial; Right: fi-

nal)

Page 71: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

61

Figure 60: Results for generic contraction. From 0.423 m. to 0.417 m. Left: Activation =

1. Right: Activation = AnyBody Vector.

Forcing AnyBody to contract following a specific total length and tendon force evolution seems to produce the same results in terms of muscle and tendon length. If the activation vector produced in AnyBody is used in MATLAB, the system is delayed 47 milliseconds.

Muscle force presents an overshoot response, producing 120.78 J extra of mechanical work. However, using AnyBody activation, this extra mechanical work is reduced to 67.01 J.

If the virtual activation is plotted with the activation from AnyBody that the muscle is acti-vated slightly slower than AnyBody does. This similarity between virtual activation and An-ybody activation explains the big reduction (almost 50%) in extra mechanical work.

7.6.3. From 0.4349 m. to 0.413 m. This contraction take place across the curve as in previous section, but with a wider varia-tion. The initial length for the muscle is 0.0542 m and decreases to 0.02616 m. The initial and final states can be seen in Figure 61.

Figure 61: Forces in generic contraction from 0.4349 m to 0.413 m. (Left: initial; Right: fi-

nal)

Page 72: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

62

Figure 62: Results for generic contraction. From 0.4349 m to 0.413 m. Left: Activation

= 1. Right: Activation = AnyBody Vector.

In this last case, the muscle length evolution produced by AnyBody is exactly the same. How-ever, the tendon shows a small drop in its length evolution for MATLAB model. The differ-ence in length is about 0.2 millimeters, small enough to be negligible, but it represents one case of difference in behavior between models.

Page 73: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

63

Another difference in performance between models is the drop of muscle force at 0.1 sec-onds in MATLAB. If tendon force is checked, it shows that in the beginning the tendon force is zero. This happens because the total length variation is faster than the muscle contraction speed, so the tendon length falls below its slack length (0.375 m) and stops producing a resistive force. If this tendon force disappears, the muscle will contract faster, and therefore making the muscle weaker.

Page 74: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

7. AnyBody comparison.

64

Page 75: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

65

8. Conclusions and further research. After having done every simulation possible and having compared all the results with the results obtained by AnyBody in the same conditions, it can be said that the proposed model is a valid model which behaves properly and coherent with the reality. However, it shows small differences with AnyBody model, enough to consider it a different model that needs further investigation.

In the isometric contraction it has been verified that, with the muscle activated, its length decreases only if its position allows it, providing enough force. With the muscle deactivated, the tendon-muscle unit comes to its equilibrium position.

In the isotonic contraction there are one stable equilibrium point and other one metastable equilibrium point. If the initial length of the muscle is lower than the metastable equilibrium point, the contraction of the muscle is possible, and it contracts to the stable equilibrium point. If the muscle is longer than the metastable equilibrium point, the external force will stretch the muscle and the muscle will not be able to produce enough force.

In the generic contraction, the muscle and tendon length evolution are coherent with the reality. It is verified also that when the maximum contraction speed is exceeded, the muscle cannot generate force, even though its position allows it.

Comparing these results with AnyBody output, it is noted that AnyBody can generate the same results in the steady state. In the transitory phase they also match, however in Any-Body the muscle activation is not constant. Using the same activation levels from AnyBody in MATLAB code, the response is slower but with a lag never larger than 250 milliseconds, and usually below 100 milliseconds.

The existing technology nowadays is not powerful enough to prove which of these results is better. However, it has been showed that both provides the same steady state result with small differences in the transitory phase. Therefore, it can be affirmed that the initial as-sumption in AnyBody leads to a very slightly different behavior but still good enough to keep being used.

To make the proposed model useful for musculoskeletal simulations, further research is necessary to implement a procedure that calculates the necessary activation to ensure that the muscle force (having in mind position and speed effects) is always in equilibrium with the tendon force. The results obtained with this procedure would differ slightly and proba-bly add some lag to the model, as seen before when the AnyBody activation was used.

Once this activation is implemented, it is necessary to test this model with a pair of antago-nist muscles, in order to be able to simulate a simple articulation that can be opened and closed.

Page 76: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

8. Conclusions and further research.

66

Page 77: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

67

Bibliography. Christensen, S., Damsgaard, M., Rasmussen, J., & de Zee, M. (2002). Muscle Model for Inverse

Dynamic Musculo-Skeletal Models. Denmark: Institute of Mechanical Engineering, Aalborg University (Not Published).

Delp, S. (1990). Surgery simulation : A computer graphics system to analyze and design musculoskeletal reconstructions of the lower extremity. PhD dissertation, Stanford University.

Hill A., V. (1938). The heat of shortening and the dynamic constants of muscle. Proceedings of the Royal Society of London. Series B - Biological Sciences, 126(843), 136-195.

Holmberg, J. (2012). Musculoskeletal Biomechanics in Cross-country Skiing. Dissertations. No. 1437. Linköping: Linköping University.

Nigg, B., & Herzog, W. (2007). Biomechanics of the musculo-skeletal system (3rd ed.). John Wiley & Sons Ltd.

Roser, A. (2019). An Analysis of Including the Evolution Law for the Serial Element in the Musculoskeletal Modelling. Master's Thesis. Linköping University.

Scott, W., Stevens, J., & Binder–Macleod, S. (2001). Human Skeletal Muscle Fiber Type Classifications. Physical Therapy, 81(11), 1810-1816.

Sharifimajd, B., & Stålhand, J. (2013). A continuum model for skeletal muscle contraction at homogeneous finite deformations. Biomechanics and Modeling in Mechanobiology, 12(5), 965-973. doi:10.1007/s10237-012-0456-x

Stålhand, J. (2018). Lecture Notes in TMMS07 Biomechanics. Linköping University: (Not published).

Widmaier, E., Raff, H., & Strang, K. (2016). Vander's Human Physiology: The Mechanisms of Body Function (14th ed.). New York: McGraw Hill.

Zajac, F. (1989). Muscle and tendon: properties, models, scaling, and application to biomechanics and motor control. Critical Reviews in Biomedical Engineering 17 (4), 359-411.

Page 78: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

8. Bibliography.

68

Page 79: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

69

Resumen en español.

I. Introducción. En la actualidad existen varios modelos musculoesqueléticos que calculan fuerzas y reac-ciones en músculos y huesos a partir de movimientos especificados. Todos ellos están basa-dos en el modelo de tres elementos desarrollado por (Zajac, 1989) basado a su vez en los experimentos realizados por Hill (Hill A., 1938). Este modelo se compone de un elemento contráctil (CE) que es la parte del músculo que genera la fuerza, un elemento en paralelo (PE) que es la fuerza pasiva en el músculo y un elemento en serie (SE) que representa al tendón. (Figura 1)

La longitud total del sistema es la suma de la longitud del músculo y la del tendón.

𝐿𝐿𝑡𝑡𝑡𝑡𝑡𝑡 = 𝐿𝐿𝑀𝑀 + 𝐿𝐿𝑇𝑇 (I.1)

Tomando la derivada de la ecuación (I.1):

𝐿𝐿𝑡𝑡𝑡𝑡𝑡𝑡̇ = 𝐿𝐿�̇�𝑀 + 𝐿𝐿�̇�𝑇 (I.2)

Para el cálculo dinámico se necesita conocer las velocidades tanto del músculo como el ten-dón. Sin embargo, los modelos no tienen suficientes ecuaciones como para poder calcular estos dos términos de forma independiente. Es por esto por lo que todos los modelos basa-dos en el de Hill asumen que el tendón es mucho más rígido que el músculo y, por tanto:

�𝐿𝐿�̇�𝑀� ≫ �𝐿𝐿�̇�𝑇� ⟹ 𝐿𝐿�̇�𝑇 = 0 (I.3)

Esta suposición introduce un error en los cálculos desconocido. Es por esto por lo que en la Universidad de Linköping se propuso un nuevo modelo (Sharifimajd & Stålhand, 2013) que posteriormente se desarrolló por (Roser, 2019).

𝐿𝐿𝑀𝑀 𝐿𝐿𝑇𝑇

CE

SE 𝐹𝐹 𝐹𝐹

Figura 1: Modelo de Hill.

Page 80: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

70

Este modelo no necesita hacer uso de la suposición (I.3) y necesita ser probado. En este trabajo de fin de máster se ha terminado de desarrollar este nuevo modelo y con ayuda del software comercial AnyBody, que utiliza el modelo de Hill, se ha determinado si el modelo propuesto es realista y a su vez cual es el error introducido al suponer que la velocidad de contracción del tendón es nula.

II. Modelo propuesto. Las células musculares o miocitos están compuestas de miofibrillas, que a su vez contienen sarcómeros con dos tipos de filamentos: actina y miosina (Scott, Stevens, & Binder–Macleod, 2001).

La contracción en el músculo se lleva a cabo según la secuencia cross-bridging. Mediante un proceso químico que se escapa del objetivo de esta investigación, los filamentos de actina y miosina se acoplan y desacoplan produciendo un movimiento relativo de avance entre ellos. Este proceso puede ser representado por un embrague de fricción (Sharifimajd & Stålhand, 2013).

En la Figura 2 se representa el modelo propuesto. Todavía conserva el elemento en serie (SE) y en paralelo (PE). Sin embargo, hay dos nuevos componentes. El primero es un amor-tiguador que describe el carácter viscoelástico del músculo. El segundo es el embrague de fricción que aporta de forma ficticia un par T y una velocidad de rotación ω.

Figura 2: Modelo propuesto.

Figura 3: Equilibrio en el diagrama de cuerpos libres.

Si se analiza el equilibrio planteado en la Figura 3, se ve que la fuerza del tendón 𝐹𝐹𝑇𝑇 es pro-porcional a la fuerza externa 𝐹𝐹. Además, el embrague genera una fuerza contráctil 𝐹𝐹𝐶𝐶𝐶𝐶 pro-porcional al par 𝑇𝑇. Así el equilibrio queda:

𝐿𝐿𝑀𝑀 𝐿𝐿𝑇𝑇

𝜔𝜔 𝑇𝑇

D

PE

SE 𝐹𝐹 𝐹𝐹

𝐹𝐹 𝐹𝐹𝑇𝑇 𝐹𝐹𝑇𝑇

𝐹𝐹𝐷𝐷

𝐹𝐹𝑃𝑃𝐶𝐶

𝑇𝑇 𝐹𝐹𝐶𝐶𝐶𝐶

Page 81: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

71

𝐹𝐹 = 𝐹𝐹𝑇𝑇 (II.1)

𝐹𝐹𝑇𝑇 = 𝐹𝐹𝐶𝐶𝐶𝐶 + 𝐹𝐹𝑃𝑃𝐶𝐶 + 𝐹𝐹𝐷𝐷 (II.2)

𝑇𝑇 = 𝑟𝑟 · 𝐹𝐹𝐶𝐶𝐶𝐶 (II.3)

Donde r es un radio ficticio.

Para poder relacionar las fuerzas con la deformación en el músculo y tendón, es necesario aplicar la desigualdad de la disipación, asumiendo que es un proceso atérmico por sencillez. Esta desigualdad dice que la potencial mecánica interna no puede ser mayor a la variación de la energía de elongación.

La potencia mecánica interna se define como:

𝑃𝑃𝑚𝑚𝑚𝑚𝑡𝑡 = 𝐹𝐹𝑃𝑃𝐶𝐶 · �̇�𝐿𝑀𝑀 + 𝐹𝐹𝑇𝑇 · �̇�𝐿𝑇𝑇 + 𝐹𝐹𝐶𝐶𝐶𝐶��̇�𝐿𝑀𝑀 + 𝑟𝑟𝜔𝜔� + 𝐹𝐹𝐷𝐷 · �̇�𝐿𝑀𝑀 (II.4)

Y la derivada temporal de la energía elástica:

Ψ̇ =𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

𝜕𝜕𝐿𝐿𝑀𝑀

𝜕𝜕𝜕𝜕+𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

𝜕𝜕𝐿𝐿𝑇𝑇

𝜕𝜕𝜕𝜕=𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

�̇�𝐿𝑀𝑀 +𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

𝐿𝐿�̇�𝑇 (II.5)

Combinando estas dos ecuaciones dentro de la desigualdad y aplicando condiciones de equi-librio:

�𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑇𝑇

− 𝐹𝐹𝐶𝐶𝐶𝐶 −𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

� �̇�𝐿𝑀𝑀 + 𝐹𝐹𝐶𝐶𝐶𝐶��̇�𝐿𝑀𝑀 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 � ≥ 0 (II.6)

Para satisfacer (II.6) los dos sumandos deben ser positivos. Además, se considera biológica-mente irrealizable que adquieran valores negativos.

Para el primer sumando se dice que el paréntesis tiene que ser proporcional a 𝐿𝐿�̇�𝑀 mediante la función 𝛾𝛾, que es siempre positiva. A su vez, la fuerza en el elemento contráctil es propor-cional a la velocidad además de a la función 𝑘𝑘 que describe la dependencia con la longitud del músculo.

𝐹𝐹𝐶𝐶𝐶𝐶 = �𝑘𝑘��̇�𝐿𝑀𝑀 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 �, �̇�𝐿𝑀𝑀 ≥ −𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

0, otherwise (II.7)

Esta dependencia con la longitud va a la vez acompañada de una dependencia con la veloci-dad de contracción como se observa en (II.7). Esta dependencia se describía ya en los mo-delos de (Zajac, 1989) y representados tienen la forma mostrada en la Figura 4.

Page 82: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

72

Figura 4: Dependencia de la fuerza con la longitud (izquierda) y la velocidad (derecha).

Donde 𝐹𝐹0𝑀𝑀se denomina fuerza isométrica máxima.

En la Sección “2. Proposed model” se desarrolla el modelo hasta llegar a la ley de contrac-ción, es decir la ecuación diferencial que gobierna el movimiento, sin necesidad de imponer que la longitud del tendón se considera constante:

𝐿𝐿�̇�𝑀 = 𝑏𝑏𝜏𝜏 − 𝜏𝜏0𝜏𝜏 + 𝑎𝑎

(II.8)

III. Desarrollo del modelo. Para terminar de desarrollar el modelo se necesita conocer la función 𝑘𝑘, la función de ener-gía elástica Ψ y la fuerza en el tendón 𝐹𝐹𝑇𝑇.

La función k se define como:

𝑘𝑘 = 𝑘𝑘� · 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀) · 𝜙𝜙 (III.1)

Donde 𝑘𝑘� = 𝐹𝐹0𝑀𝑀/𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 para que la ecuación (II.7) cumpla que la fuerza se hace cero cuando �̇�𝐿𝑀𝑀 = 0. La función es la fuerza normalizada representada en la izquierda de la Figura 4. Se va a aproximar mediante una función gaussiana. La activación del músculo 𝜙𝜙 puede variar entre 0 (músculo desactivado) y 1 (músculo activado).

La energía elástica se puede representar como (Sharifimajd & Stålhand, 2013) proponen:

Ψ =𝑐𝑐1

2𝑐𝑐2�exp �𝑐𝑐2 �𝜆𝜆𝑀𝑀

2 − 1�2− 1�� + Ψ𝑇𝑇(𝐿𝐿𝑇𝑇) (III.2)

Donde 𝜆𝜆𝑀𝑀 = 𝐿𝐿𝑀𝑀/𝐿𝐿0𝑀𝑀 siendo 𝐿𝐿0𝑀𝑀 la longitud de reposo para el músculo y 𝐿𝐿𝑠𝑠𝑇𝑇 la del tendón, es decir longitud a partir de la cual el tendón empieza a realizar fuerza resistiva. Derivándola respecto a la longitud del músculo:

∂Ψ∂LM

= 𝐹𝐹𝑃𝑃𝐶𝐶 = 2𝑐𝑐1 𝜆𝜆𝑀𝑀

𝐿𝐿0𝑀𝑀�𝜆𝜆𝑀𝑀2 − 1� �exp �𝑐𝑐2 �𝜆𝜆𝑀𝑀

2 − 1�2− 1�� (III.3)

Para la fuerza en el tendón se coge la propuesta por (Christensen, Damsgaard, Rasmussen, & de Zee, 2002):

𝐹𝐹0𝑀𝑀

𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚

𝑀𝑀 𝐿𝐿𝑀𝑀 𝑣𝑣𝑀𝑀

𝐹𝐹𝑀𝑀 𝐹𝐹𝑀𝑀

𝐹𝐹0𝑀𝑀

𝐹𝐹𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

−𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

Page 83: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

73

𝐹𝐹𝑇𝑇(𝐿𝐿𝑇𝑇) = �0, 𝐿𝐿T ≤ 𝐿𝐿s𝑇𝑇

𝐹𝐹0𝑀𝑀

𝑒𝑒𝐽𝐽 − 1�exp�𝐽𝐽

𝐿𝐿𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇

𝐿𝐿0𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇� − 1� , 𝐿𝐿𝑇𝑇 > 𝐿𝐿sT

(III.4)

Uniendo todas las ecuaciones se realiza un diagrama de flujo que es el que sigue el código de MATLAB:

Es importante aclarar que todo este proceso se considera cuasi estático y por lo tanto no se tienen en cuenta efectos de inercia en el músculo.

IV. Simulaciones en MATLAB. Para todas las simulaciones que se realizan en este trabajo se han cogido los datos del músculo sóleo que se encuentran en el repositorio de AnyBody. Se ha elegido este músculo debido a su alta relación tendón/músculo, ya que esto puede hacer que la suposición en (I.3) tenga más influencia a la hora de comparar resultados. Sus datos se encuentran en la Sección “3.3. Data”.

Se realizan tres tipos de contracciones distintas: isométrica, isotónica y genérica. Estas tres se diferencian principalmente en cómo se trata la longitud total del sistema.

𝐿𝐿𝑡𝑡𝑡𝑡𝑡𝑡 = 𝐿𝐿𝑀𝑀 + 𝐿𝐿𝑇𝑇

𝐿𝐿�̇�𝑀 = 𝑏𝑏𝜏𝜏 − 𝜏𝜏0𝜏𝜏 + 𝑎𝑎

𝑎𝑎 = 0.25 𝐹𝐹0𝑀𝑀

𝑏𝑏 = 0.25 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

𝑘𝑘 = 𝑘𝑘� · 𝑓𝑓𝐿𝐿(𝐿𝐿𝑀𝑀) · 𝜙𝜙

𝜏𝜏0 = 𝑘𝑘 · 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀 𝜏𝜏 = 𝐹𝐹𝑇𝑇 −

𝜕𝜕Ψ𝜕𝜕𝐿𝐿𝑀𝑀

∂Ψ∂𝐿𝐿𝑀𝑀

= 2𝑐𝑐1 ·𝜆𝜆𝑀𝑀

𝐿𝐿0𝑀𝑀�𝜆𝜆𝑀𝑀2 − 1� exp �𝑐𝑐2 �𝜆𝜆𝑀𝑀

2 − 1�2�

𝐹𝐹𝑇𝑇 =𝐹𝐹0𝑀𝑀

𝑒𝑒𝐽𝐽 − 1�exp�𝐽𝐽

𝐿𝐿𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇

𝐿𝐿0𝑇𝑇 − 𝐿𝐿𝑠𝑠𝑇𝑇� − 1�

𝑘𝑘� =𝐹𝐹0𝑀𝑀

𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚𝑀𝑀

Page 84: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

74

Contracción isométrica. En la contracción isométrica la longitud total se mantiene constante. Al contraerse el músculo, éste reduce su tamaño y el tendón se estira. El resultado de esta simulación será la fuerza que el músculo desarrolle en función de la longitud total de la que se parta y cómo evolucionará la longitud del músculo.

Para la contracción isométrica se plantean 18 casos distintos. Globalmente se eligen tres longitudes totales diferentes:

• 𝐿𝐿 = 0.423 m. Donde el músculo y el tendón están en su posición de reposo. • 𝐿𝐿 = 0.4349 m. Aquí el sistema se encuentra estirado, presentando longitudes mayo-

res a las de reposo tanto el tendón como el músculo en el equilibrio. • 𝐿𝐿 = 0.407 m. El sistema ahora posee una longitud menor a la de reposo con lo cual

no aparecerán en el equilibrio fuerzas resistivas.

A su vez, cada una de estas simulaciones presentan tres longitudes iniciales distintas para el músculo. De esta forma, éste puede estar en equilibrio con el tendón, estirado (y por tanto el tendón encogido) o encogido (y el tendón estirado).

Todas estas posibilidades a la vez se ven complementadas con la opción de tener el músculo activo (y así comprobar cómo se comporta el músculo) o inactivo (para poder estudiar cómo reacciona el elemento paralelo.

Como ejemplo, la primera de las longitudes totales, con el músculo y el tendón en posición de equilibrio, presentan el esquema de fuerzas de la Figura 5.

Figura 5: Ejemplo de fuerzas en contracción isométrica. 𝐿𝐿 = 0.423 m, 𝐿𝐿𝑚𝑚𝑚𝑚𝑚𝑚 = 0.048 m.

Los resultados de estas simulaciones se pueden ver en la sección “4.2. Simulations”. El ele-vado número de casos es debido a que sobre esta simulación se ha construido todo el mo-delo en MATLAB y el resto de las simulaciones son modificaciones de esta. De esta forma la contracción isométrica ha servido de banco de pruebas para todo el desarrollo del proyecto.

Page 85: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

75

Contracción isotónica. En la contracción isotónica la longitud total se deja libre. En este caso se aplica una fuerza constante a uno de los extremos del sistema mientras el otro se mantiene fijo. El tendón mantendrá una longitud constante debido que la fuerza no altera su magnitud. El resultado de nuevo será la fuerza desarrollada por el músculo y la longitud del músculo (o total).

La fuerza del tendón elegida son 1300 N. Para esta fuerza hay un punto de equilibrio estable A, otro metaestable B y un último no alcanzable C. Estos puntos se ven en la Figura 6.

Figura 6: Fuerzas en contracción isotónica. 𝐹𝐹 = 1300 N.

Se realizan 4 simulaciones. Antes y después del punto de equilibrio estable, cuando el músculo genera cada vez menos fuerza cuanto más se contrae, y antes y después del punto de equilibrio metaestable, cuando el músculo gana fuerza cuanto más se contrae (hasta lle-gar a 𝐿𝐿𝑡𝑡𝑜𝑜𝑡𝑡𝑀𝑀 .

• 𝐿𝐿𝑀𝑀 = 0.025 m. Antes del punto A. • 𝐿𝐿𝑀𝑀 = 0.035 m. Después del punto A. • 𝐿𝐿𝑀𝑀 = 0.046 m. Antes del punto B. • 𝐿𝐿𝑀𝑀 = 0.05 m. Después del punto B.

Las tres primeras convergen hacia el punto A. La cuarta no puede proporcionar fuerza sufi-ciente para llegar a B hasta que el elemento paralelo no genere los 1300 N de fuerza nece-sarios. Esta situación es irreal puesto que el músculo tendría que estar desmontado de la articulación para elongarse tanto.

Los resultados de esta simulación pueden verse en la sección “5.2. Simulations”.

Contracción general. En la contracción general se le especifica al sistema la evolución de la longitud total con el tiempo mientras que se le indica al músculo el nivel de activación adecuado. El músculo se irá contrayendo y el tendón se irá adaptando tanto a la longitud del músculo como a la total.

A

B

C

Page 86: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

76

De esta forma, el resultado de la simulación es la evolución temporal de la longitud del músculo, de la longitud del del tendón, así como las fuerzas en el tendón y la fuerza máxima disponible en el músculo.

Para especificar la variación de la longitud total se ha elegido una función exponencial (Ecuación IV.1) ya que es la que más se asemeja a un movimiento natural.

𝐿𝐿(𝜕𝜕) = (𝐿𝐿0 − 𝐿𝐿∞) ∙ 𝑒𝑒−8·𝑡𝑡 + 𝐿𝐿∞ (IV.1)

De esta forma el número de casos estudiados es dos: comenzando en el lado izquierdo de la curva 𝐹𝐹𝑀𝑀 y comenzando en el lado derecho.

Los datos de ambos casos se pueden ver resumidos en la tabla a continuación.

𝑳𝑳𝟎𝟎 (m) 𝑳𝑳𝟎𝟎𝑴𝑴 (m) 𝑳𝑳∞ (m) 𝑳𝑳∞𝑴𝑴 (m)

Case 1 0.415 0.04 0.405 0.0247

Case 2 0.43 0.0515 0.423 0.0323

Las fuerzas para el caso 1 en el caso inicial y final se pueden ver representadas en la Figura 7.

Figura 7: Punto inicial (izquierdo) y final (derecho) para el caso 1.

Y las fuerzas para el caso 2 en el caso inicial y final se pueden ver representadas en la Figura 8.

Page 87: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

77

Figura 8: Punto inicial (izquierda) y punto final (derecha) para el caso 2.

Los resultados se pueden consultar en la sección “6.2. Simulations”. En el primer caso se puede observar cómo se llega a alcanzar la velocidad máxima de contracción en el instante inicial y cómo eso hace que la fuerza disponible en el músculo empiece siendo nula.

V. Comparación con AnyBody. AnyBody es un software de simulación de modelos musculoesqueléticos que se basa en el modelo de contracción de Hill y utiliza datos reales extraídos de experimentos (Delp, 1990). Importando ciertos valores usados en MATLAB se pueden recrear las mismas contracciones que las expuestas anteriormente.

AnyBody es un software de código cerrado y se desconoce la forma en la que se implementa la curva 𝐹𝐹𝑀𝑀 o la curva 𝐹𝐹𝑃𝑃𝐶𝐶 . Sin embargo, para que las comparaciones tengan sentido es ne-cesario usar las mismas funciones. Para ello se realizan una serie de contracciones a lo largo de las distintas longitudes posibles para este músculo y se obtienen puntos de la curva. In-terpolando entre ellos se puede tener una muy buena aproximación a dichas curvas.

Figura 9: Fuerzas extraídas de AnyBody.

Page 88: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

78

A su vez, el código de MATLAB solo trabaja con activaciones especificadas, nunca las calcula a cada salto de tiempo como hace AnyBody. Así un nuevo parámetro de comparación de curvas es la activación virtual definida como:

𝑎𝑎𝑐𝑐𝜕𝜕𝑣𝑣 =𝐹𝐹𝑇𝑇

𝐹𝐹𝑀𝑀 (V.1)

En las simulaciones, a la vez que se compara la actividad virtual de MATLAB con la obtenida en AnyBody, se repite la simulación una vez más, pero obligando a MATLAB a seguir la ac-tivación de AnyBody y así comparar cómo se comportaría.

Contracción Isotónica. Se comienza con esta ya que es la que resulta menos interesante puesto que el tendón per-manece a una longitud constante. Es necesario exportar de MATLAB la evolución de la lon-gitud total, así como especificarle la fuerza constante utilizada (1300 N de nuevo).

Se repiten las mismas 4 simulaciones, pero modificando los puntos ligeramente para estu-diar a su vez más casos. Estos nuevos puntos son:

• 𝐿𝐿𝑀𝑀 = 0.026 m 720 N • 𝐿𝐿𝑀𝑀 = 0.033 m 2148 N • 𝐿𝐿𝑀𝑀 = 0.046 m 2342 N • 𝐿𝐿𝑀𝑀 = 0.055 m 594 N

Un resultado general para estas cuatro simulaciones es que la longitud del tendón es la misma en ambos modelos (empiezan a diferir a partir del noveno decimal).

Por lo general, también se observa que AnyBody calcula la misma evolución para la longitud del músculo. Sin embargo, las fuerzas en el músculo son distintas y esto también se puede ver comparando la activación de AnyBody y la activación virtual de MATLAB.

Si se usa el vector de activaciones de AnyBody en MATLAB, la respuesta cambia y se ve re-trasada en MATLAB entre 11 y 46 milisegundos dependiendo del caso.

Todo esto se puede ver en la sección “7.3.3. Results”.

Contracción Isométrica. En esta contracción, es necesario especificarle a AnyBody la longitud total, que permanecerá constante, y la evolución de la fuerza en el tendón a causa de la fuerza generada en el músculo.

De las 18 simulaciones realizadas se comparan 3 de ellas. Éstas son las tres longitudes tota-les, pero partiendo siempre de la longitud inicial de músculo en equilibrio con el tendón y de activación 1. Las longitudes totales elegidas en este caso son:

• 𝐿𝐿 = 0.41 m. • 𝐿𝐿 = 0.426 m. • 𝐿𝐿 = 0.435 m.

Page 89: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

79

El caso más relevante en esta comparación es el segundo. En él la activación del músculo en AnyBody y la activación virtual son prácticamente iguales. Sin embargo, cuando se usa el vector de activación en MATLAB, el modelo presenta un retraso de 72 milisegundos.

Estos resultados se encuentran en la sección “7.4.3. Results”.

Contracción genérica. AnyBody necesita para esta contracción de la importación desde MATLAB de la evolución de la fuerza en el tendón y de la evolución de la longitud total. La longitud total se modela igual que en el caso anterior.

Se realizan tres simulaciones cuyas longitudes iniciales y finales son:

• 𝐿𝐿 = 0.413 m hasta 𝐿𝐿 = 0.407 m. • 𝐿𝐿 = 0.423 m hasta 𝐿𝐿 = 0.417 m. • 𝐿𝐿 = 0.4349 m hasta 𝐿𝐿 = 0.413 m.

En esta ocasión se destaca el último caso que, a diferencia de todos los casos anteriores, se puede apreciar una evolución distinta en la longitud del tendón. Se puede observar una pe-queña caída en su longitud que le hace estar por debajo de su longitud de reposo y por tanto no genera ninguna fuerza resistiva. Esto afecta a su vez a la velocidad de contracción y como consecuencia a la fuerza muscular.

Este caso especial junto a los otros dos se pueden ver en la sección “7.5. General contrac-tion”.

VI. Conclusiones. Después de haber hecho todas las simulaciones posibles y haber comparado todos los re-sultados con los resultados obtenidos por AnyBody en las mismas condiciones, se puede decir que el modelo propuesto es un modelo válido que se comporta de manera adecuada y coherente con la realidad. Sin embargo, muestra pequeñas diferencias con el modelo de AnyBody, suficientes como para considerarlo un modelo diferente que necesita más inves-tigación.

En la contracción isométrica se ha verificado que, con el músculo activado, su longitud dis-minuye solo si su posición lo permite, proporcionando suficiente fuerza. Con el músculo desactivado, la unidad tendón-músculo llega a su posición de equilibrio.

En la contracción isotónica hay un punto de equilibrio estable y otro punto de equilibrio metaestable. Si la longitud inicial del músculo es más baja que el punto de equilibrio me-taestable, la contracción del músculo es posible y se contrae hasta el punto de equilibrio estable. Si el músculo es más largo que el punto de equilibrio metaestable, la fuerza externa estirará el músculo y el músculo no podrá producir suficiente fuerza.

En la contracción genérica, la evolución de la longitud del músculo y del tendón es coherente con la realidad. También se verifica que cuando se excede la velocidad máxima de contrac-ción, el músculo no puede generar fuerza, aunque su posición sí lo permita.

Page 90: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

80

Al comparar estos resultados con los de AnyBody, se observa que AnyBody puede generar los mismos valores en el estado estable. En la fase transitoria también coinciden, sin em-bargo, en AnyBody, la activación muscular no es constante. Usando los mismos niveles de activación de AnyBody en el código de MATLAB, la respuesta es más lenta, pero con un re-traso nunca mayor a 250 milisegundos, y generalmente por debajo de 100 milisegundos.

La tecnología existente en la actualidad no es lo suficientemente potente como para demos-trar cuál de estos resultados es mejor. Sin embargo, se ha demostrado que ambos propor-cionan el mismo resultado de estado estable con pequeñas diferencias en la fase transitoria. Por lo tanto, se puede afirmar que la suposición inicial (longitud del tendón constante) en AnyBody conduce a un comportamiento ligeramente diferente pero que es lo suficiente-mente bueno como para seguir usándose.

Para hacer que el modelo propuesto sea útil para las simulaciones musculoesqueléticas, se necesita más investigación para implementar un procedimiento que calcule la activación necesaria para garantizar que la fuerza muscular (teniendo en cuenta los efectos de la posi-ción y la velocidad) siempre esté en equilibrio con la fuerza del tendón. Los resultados ob-tenidos con este procedimiento diferirán ligeramente y, probablemente, agregarán algo de retraso al modelo, como se vio antes cuando se usaba la activación de AnyBody.

Una vez implementada esta activación, es necesario probar este modelo con un par de músculos antagonistas, para poder simular una articulación simple que abra y se cierre.

VII. Planificación temporal. En este apartado se muestra la planificación y la programación temporal de este trabajo haciendo uso de herramientas como la Estructura de Descomposición del Proyecto (EDP) o el Diagrama de Gantt.

Esta planificación ayuda a organizar de forma lógica cada una de las actividades llevadas a cabo, así como su orden jerárquico. La herramienta empleada en este caso es la EDP. La EDP recoge cada uno de los trabajos a realizar para la finalización exitosa del proyecto.

Haciendo uso del Diagrama de Gantt se van a establecer fechas para cada una de las activi-dades de forma que se pueda definir un calendario con una ordenación secuencial lógica.

A comienzo de este proyecto se descompuso jerárquicamente cada una de las tareas con el fin de identificar los recursos necesarios a cada uno de ellos, tanto personales como econó-micos y temporales. A medida que se sucedían las actividades ha sido necesario ir introdu-ciendo modificaciones que ajustaran lo inicialmente planificado, pero siempre respetando la estructura inicial.

En la Figura 10 se muestra la EDP final que se ha seguido a lo largo de este estudio.

Page 91: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

81

Figura 10: Estructura de descomposición del proyecto.

Mediante el diagrama de Gantt se puede expresar el tiempo destinado en cada una de las tareas que se recogen en la EDP. El diagrama de PERT sobre vista de Gantt de la Figura 11 muestra el número de días dedicado a cada una de las principales etapas.

Page 92: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

82

Page 93: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

83

Figura 11: Diagrama de PERT sobre vista de Gantt.

Page 94: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

84

Este proyecto comienza en marzo, donde todavía se contaba con clases. Posteriormente, a mediados de abril se finalizan las clases y la dedicación a este trabajo es plena. Cada una de las principales divisiones de este trabajo lleva asociado un nivel de dedicación distinto.

Fases Fechas Días Dedicación Total

Periodo 1 1, 2 04/3 – 15/4 20+20 2 h/d 80 h

Periodo 2 3, 4 15/4 – 14/6 29+19 6 h/d 288 h

Periodo 3 5 14/6 – 1/7 16 5 h/d 80 h

Periodo 4 5 1/7 – 22/7 10 1.5 h/d 15 h

Según el plan de estudios del Máster en Ingeniería Industrial, se le asignan 12 créditos al Trabajo de Fin de Máster, lo que corresponde a una dedicación de entre 300 y 350 horas. El total de horas dedicado a este proyecto han sido de 463, superando considerablemente lo exigido, justificado en que un nuevo modelo como el estudiado requiere de mucha cantidad de estudio y pruebas para ser considerado una buena alternativa a tener en cuenta.

VIII. Presupuesto. En cuanto al presupuesto destinado a este proyecto se puede dividir en costes en personal, en licencias y material usado.

Respecto a los costes de personal, en este proyecto han estado implicados el supervisor y otro profesor del departamento en Suecia, cuyos sueldos de aproximadamente 22€/h. Se ha contado con otro tutor en España para la adaptación del proyecto a la normativa de la Uni-versidad Politécnica de Madrid con un salario horario de unos 18€/h. Por último, el autor como ingeniero ya graduado se estima un salario de 13€/h.

Salario/h Dedicación Total

Supervisor 22 € 60 h 1320€

Profesor 22 € 15 h 330€

Tutor 18 € 12 h 216€

Autor 13 € 463 h 6019€

En cuanto a materiales, las simulaciones se han realizado en el ordenador portátil del autor haciendo uso de la licencia de estudiante de MATLAB y una licencia de investigación de AnyBody suministrada por la Universidad de Linköping cuyo coste es de 580€ anuales. El programa AnyBody ha estado instalado durante un mes en el ordenador así que el gasto de amortización de la licencia equivale a 48€.

El coste del ordenador también debe ser amortizado. El ordenador es un ASUS K55VD de 2012. Con una vida media de 8 años y un precio de 700€ y valor residual nulo, la amortiza-ción mensual es de 7.3€. Para este proyecto de 5 meses de duración, el gasto total de amor-tización es de 36€.

Page 95: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

85

Considerando un coste de bibliografía consultada de 100€, el total asciende a 8069€. A esta cifra se le debe añadir el 21% de IVA y así el coste total de este trabajo de fin de grado es de 9763.5€.

Page 96: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Resumen en español.

86

Page 97: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

87

Appendix

A. ISOMETRIC CONTRACTION % An isometric simulation for the soleus muscle. disp('starting...') clear close all % Soleus parameters: FM_0=2830; % Maximum force output at optimum fiber length LM_opt=0.04; % Optimum fiber length LM_min=0.02; % Minimum fiber length LM_max=0.06; % Maximum fiber length LT_s=0.375; % Tendon slack length Eps=0.053; % Tendon strain at F0 Jt=3; % Shape parameter for the tendon stiffness C1=15; % Param (Equation 3.4) C2=1.5; % Param (Equation 3.4) FibreTwitch=10; a=0.25*FM_0; b=0.25*FibreTwitch*LM_opt; act=1; % Tendon length at which the tendon force equals the muscle-specific % maximum isometric force LT_0=LT_s*(1+Eps); LM_0=0.048; L=LM_opt+LT_s+0.02; LM_eq=fl_ft(L,act); % Vector of parameters P=[FM_0 LM_0 L LM_eq LM_opt LM_min LM_max LT_s LT_0... Eps Jt C1 C2 FibreTwitch a b act]; % ODE: (Section 3.2.5) Lini=LM_eq; % <-------------------------INITIAL LENGTH tspan=(0:0.01:1).'; LM_dot=@(t,LM,P) b.*((tau(t,LM,P)-tau0(t,LM,P))... ./(tau(t,LM,P)+a)); % (Equation 2.15) [time,LMsol]=ode15s(@(t,LM) LM_dot(t,LM,P),tspan,Lini); LT=L-LMsol; vT=diff(LT)/Lini(2); % Force in the whole muscle (CE+PE): vM_max=FibreTwitch*LM_opt; kappa=FM_0./vM_max; k=kappa*fl(LMsol,P); % (Equation 3.1) vM=LM_dot(time,LMsol,P); Ftend=tforce(time,LMsol,P);

Page 98: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

88

FM=k.*(vM+vM_max); % (Equation 2.9) for n=1:size(FM,1) if vM(n)<=-vM_max FM(n)=0; else end end landa=LMsol./LM_0; % (Equation 3.4) FPE=2.*C1.*landa./LM_0.*(landa.^2-1).*exp(C2.*(landa.^2-1).^2); for j=1:size(LMsol,1) if FPE(j)<=0 FPE(j)=0; else end end % FPE=fpecurve(LMsol); % To use different PE curve % act=activation(time); % To use different activation Ftot=FPE+act.*FM; %EXPORT TimeForce=[time Ftend]; save('timeforce.txt','TimeForce','-ASCII'); disp('...finished') %% ---------------------FUNCTIONS---------------------------- %Tau 0 function (Equation 2.13) function t = tau0(t,LM,P) FM_0=P(1); LM_opt=P(5); vM_max=FibreTwitch*LM_opt; kappa=FM_0./vM_max; act=P(17); % act=activation(t); % To use different activation t=act.*kappa.*fl(LM,P).*FibreTwitch.*LM_opt; % 12*LM_opt = vM_max in Alexandra section 3.1.4 end % Force-Length dependence fl(LM)) % From Alexandra's work. % Figure 3: Left. function F = fl(LM,P) LM_opt=P(5); LM_min=P(6); LM_max=P(7); xdata=[LM_min LM_opt LM_max]; ydata=[0.01 1 0.01]; gaussian=@(p,xdata) exp(-(xdata-p(1)).^2./(2.*p(2).^2)); options = optimoptions('lsqcurvefit','OptimalityTolerance',... 1e-16, 'FunctionTolerance', 1e-16); p=lsqcurvefit(gaussian, [LM_opt 0.01], xdata, ydata,[],[],options); F=gaussian(p,LM); % F=flcurve(LM); % To use different fL curve end %Tau function. (Equation 2.12) function t = tau(t,LM,P) C1=P(12); C2=P(13);

Page 99: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

89

LM_0=P(2); PE=zeros(size(LM)); for i=1:size(LM) landa=LM(i)/LM_0; if LM(i)<=LM_0 PE(i)=0; else PE(i)=2.*C1.*landa./LM_0.*(landa.^2-1)... .*exp(C2.*(landa.^2-1).^2); % (Equation 3.4) end end % PE=fpecurve(LM); % To use different PE curve t=tforce(t,LM,P)-PE; end % Tendon force. (Equation 3.5) function FT = tforce(t,LM,P) FM_0=P(1); LM_opt=P(5); LT_s=P(8); Eps=P(10); Jt=P(11); LT_0=LT_s*(1+Eps); LM_0=P(2); LT=P(3)-LM; FT=zeros(size(LM)); for h=1:size(LM) % Function according to Christensen et al. (2002) if LT(h)>=LT_s FT(h)=FM_0.*(exp(Jt.*((LT(h)-LT_s)./(LT_0-LT_s)))-1)./(exp(Jt)-1); else FT(h)=0; end end end

B. Isotonic contraction. % An isotonic simulation for the soleus muscle. disp('starting...') clear close all % Soleus parameters: FM_0=2830; % Maximum force output at optimum fiber length LM_opt=0.04; % Optimum fiber length LM_min=0.02; % Minimum fiber length LM_max=0.06; % Maximum fiber length LT_s=0.375; % Tendon slack length Eps=0.053; % Tendon strain at F0 Jt=3; % Shape parameter for the tendon stiffness C1=15; % Param in (Equation 3.4) C2=1.5; % Param in (Equation 3.4) FibreTwitch=10; a=0.25*FM_0;

Page 100: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

90

b=0.25*FibreTwitch*LM_opt; act=1; % Tendon length at which the tendon force equals the muscle-specific % maximum isometric force LT_0=LT_s*(1+Eps); LM_0=0.048; % Vector of parameters P=[FM_0 LM_0 LM_opt LM_min LM_max LT_s LT_0...

Eps Jt C1 C2 FibreTwitch a b]; % ODE: (Section 3.2.5) Lini=0.055; % <-------------------------INITIAL LENGTH tspan=(0:0.01:1).'; LM_dot=@(t,LM,P) b.*((tau(t,LM,P)-tau0(t,LM,P))... ./(tau(t,LM,P)+a)); % (Equation 2.15) [time,LMsol]=ode15s(@(t,LM) LM_dot(t,LM,P),tspan,Lini); LT=L-LMsol; vT=diff(LT)/Lini(2); % Force in the whole muscle (CE+PE): vM_max=FibreTwitch*LM_opt; kappa=FM_0./vM_max; k=kappa*fl(LMsol,P); % (Equation 3.1) vM=LM_dot(time,LMsol,P); Ftend=tforce(time,LMsol,P); FM=k.*(vM+vM_max); % (Equation 2.9) for n=1:size(FM,1) if vM(n)<=-vM_max FM(n)=0; else end end landa=LMsol./LM_0; % (Equation 3.4) FPE=2.*C1.*landa./LM_0.*(landa.^2-1).*exp(C2.*(landa.^2-1).^2); for j=1:size(LMsol,1) if FPE(j)<=0 FPE(j)=0; else end end % FPE=fpecurve(LMsol); % To use different PE curve % act=activation(time); % To use different activation Ftot=FPE+act.*FM; %EXPORT LT_eq=LT_s+((LT_0-LT_s)/Jt).*log(tforce(time,LMsol,P)*(exp(Jt)-1)/FM_0+1); TimePos=[time LMsol+LT_eq]; save('timepos.txt','TimePos','-ASCII'); disp('...finished') %% ---------------------FUNCTIONS---------------------------- %Tau 0 function (Equation 2.13) function t = tau0(t,LM,P) FM_0=P(1); LM_opt=P(5); vM_max=FibreTwitch*LM_opt;

Page 101: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

91

kappa=FM_0./vM_max; act=P(17); % act=activation(t); % To use different activation t=act.*kappa.*fl(LM,P).*FibreTwitch.*LM_opt; end % Force-Length dependence fl(LM)) % From Alexandra's work. % Figure 3: Left. function F = fl(LM,P) LM_opt=P(5); LM_min=P(6); LM_max=P(7); xdata=[LM_min LM_opt LM_max]; ydata=[0.01 1 0.01]; gaussian=@(p,xdata) exp(-(xdata-p(1)).^2./(2.*p(2).^2)); options = optimoptions('lsqcurvefit','OptimalityTolerance',... 1e-16, 'FunctionTolerance', 1e-16); p=lsqcurvefit(gaussian, [LM_opt 0.01], xdata, ydata,[],[],options); F=gaussian(p,LM); % F=flcurve(LM); % To use different fL curve end %Tau function. (Equation 2.12) function t = tau(t,LM,P) C1=P(12); C2=P(13); LM_0=P(2); PE=zeros(size(LM)); for i=1:size(LM) landa=LM(i)/LM_0; if LM(i)<=LM_0 PE(i)=0; else PE(i)=2.*C1.*landa./LM_0.*(landa.^2-1)... .*exp(C2.*(landa.^2-1).^2); % (Equation 3.4) end end % PE=fpecurve(LM); % To use different PE curve t=tforce(t,LM,P)-PE; end % Tendon force. (Equation 3.5) function FT = tforce(t,LM,P) FT=1300; end

C. Generic contraction. % An generic contraction simulation for the soleus muscle. disp('starting...') clear close all % Soleus parameters: FM_0=2830; % Maximum force output at optimum fiber length LM_opt=0.04; % Optimum fiber length

Page 102: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

92

LM_min=0.02; % Minimum fiber length LM_max=0.06; % Maximum fiber length LT_s=0.375; % Tendon slack length Eps=0.053; % Tendon strain at F0 Jt=3; % Shape parameter for the tendon stiffness C1=15; % Param in (Equation 3.4) C2=1.5; % Param in (Equation 3.4) FibreTwitch=10; a=0.25*FM_0; b=0.25*FibreTwitch*LM_opt; act=1; % Tendon length at which the tendon force equals the muscle-specific % maximum isometric force LT_0=LT_s*(1+Eps); LM_0=0.048; L1=LT_s+0.0599; L2=LT_s+0.038; LM_eq=fl_ft(L1,act); fl_ft(L2,act); % Vector of parameters P=[FM_0 LM_0 LM_opt LM_min LM_max LT_s LT_0...

Eps Jt C1 C2 FibreTwitch a b]; % ODE: (Section 3.2.5) Lini=0.055; % <-------------------------INITIAL LENGTH tspan=(0:0.01:1).'; LM_dot=@(t,LM,P) b.*((tau(t,LM,P)-tau0(t,LM,P))... ./(tau(t,LM,P)+a)); % (Equation 2.15) [time,LMsol]=ode15s(@(t,LM) LM_dot(t,LM,P),tspan,Lini); LT=L-LMsol; vT=diff(LT)/Lini(2); % Force in the whole muscle (CE+PE): vM_max=FibreTwitch*LM_opt; kappa=FM_0./vM_max; k=kappa*fl(LMsol,P); % (Equation 3.1) vM=LM_dot(time,LMsol,P); Ftend=tforce(time,LMsol,P); FM=k.*(vM+vM_max); % (Equation 2.9) for n=1:size(FM,1) if vM(n)<=-vM_max FM(n)=0; else end end landa=LMsol./LM_0; % (Equation 3.4) FPE=2.*C1.*landa./LM_0.*(landa.^2-1).*exp(C2.*(landa.^2-1).^2); for j=1:size(LMsol,1) if FPE(j)<=0 FPE(j)=0; else end end % FPE=fpecurve(LMsol); % To use different PE curve % act=activation(time); % To use different activation Ftot=FPE+act.*FM; %EXPORT

Page 103: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

93

TimePos=[time L]; save('timepos.txt','TimePos','-ASCII'); TimeForce=[time Ftend]; save('timeforce.txt','TimeForce','-ASCII'); disp('...finished') %% ---------------------FUNCTIONS---------------------------- %Tau 0 function (Equation 2.13) function t = tau0(t,LM,P) FM_0=P(1); LM_opt=P(5); vM_max=FibreTwitch*LM_opt; kappa=FM_0./vM_max; act=P(17); % act=activation(t); % To use different activation t=act.*kappa.*fl(LM,P).*FibreTwitch.*LM_opt; end % Force-Length dependence fl(LM)) % From Alexandra's work. % Figure 3: Left. function F = fl(LM,P) LM_opt=P(5); LM_min=P(6); LM_max=P(7); xdata=[LM_min LM_opt LM_max]; ydata=[0.01 1 0.01]; gaussian=@(p,xdata) exp(-(xdata-p(1)).^2./(2.*p(2).^2)); options = optimoptions('lsqcurvefit','OptimalityTolerance',... 1e-16, 'FunctionTolerance', 1e-16); p=lsqcurvefit(gaussian, [LM_opt 0.01], xdata, ydata,[],[],options); F=gaussian(p,LM); % F=flcurve(LM); % To use different fL curve end %Tau function. (Equation 2.12) function t = tau(t,LM,P) C1=P(12); C2=P(13); LM_0=P(2); PE=zeros(size(LM)); for i=1:size(LM) landa=LM(i)/LM_0; if LM(i)<=LM_0 PE(i)=0; else PE(i)=2.*C1.*landa./LM_0.*(landa.^2-1)... .*exp(C2.*(landa.^2-1).^2); % (Equation 3.4) end end % PE=fpecurve(LM); % To use different PE curve t=tforce(t,LM,P)-PE; end % Tendon force. (Equation 3.5) function FT = tforce(t,LM,P) FM_0=P(1); LM_opt=P(6); LT_s=P(9); Eps=P(11);

Page 104: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

94

Jt=P(12); LT_0=LT_s*(1+Eps); LM_0=P(2); L1=P(3); L2=P(4); L=(L1-L2).*(exp(-8.*t))+L2; LT=L-LM; FT=zeros(size(LM)); for h=1:size(LM) % Function according to Christensen et al. (2002) if LT(h)>=LT_s FT(h)=FM_0.*(exp(Jt.*((LT(h)-LT_s)./(LT_0-LT_s)))-1)./(exp(Jt)-1); else FT(h)=0; end end end

D. AnyBody Generic Contraction

Main = { // The actual body model goes in this folder AnyFolder MyModel = { // Global Reference Frame AnyFixedRefFrame GlobalRef = { AnyDrawRefFrame global = { RGB = {0.91796875, 0.76953125, 0.06640625}; ScaleXYZ = {0.1, 0.1, 0.1}; }; }; // Global reference frame AnySeg localseg = { r0 = {0.42009858, 0, 0}; Mass = 0; Jii = {0, 0, 0}; // AnyDrawSeg DrawSegment = // { // RGB = {0.0, 1.0, 0.0}; // }; AnyDrawRefFrame local = { RGB = {0, 0, 1}; ScaleXYZ = {0.1, 0.1, 0.1}; }; }; AnyForce3D kraft = { //FORCE //F = {Main.MyModel.Muscles.SoleusPar.F0, 0, 0}; //F = {2400,0,0}; //Flocal = {0, 0, 0}; AnyFunInterpol force = { Type = Bspline;

Page 105: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

95

BsplineOrder = 4; //MeasureOrganizer = {0}; //0=X, 1=Y, 2=Z //BsplineOrder = 4; //T = {0.0, 0.5, 1.0}; //Data = {{100, 180, 180}*1}; FileName = "timeforce.txt"; //FileErrorContinueOnOff = Off; }; AnyVector Fx = force(t); F={Fx[0],0,0}; AnySeg &Ins = .localseg; }; AnyFolder Muscles = { // Hill muscle model AnyVar StrengthScaleShank = 1; AnyVar StrengthScaleThigh = 1; AnyVar StrengthScalePelvis = 1; AnyVar FiberLengthScaleShank = 1; AnyVar FiberLengthScaleThigh = 1; AnyVar StressIndex = 1; // muscle parameters from body model in rep 6.1 AnyMuscleModel3E SoleusPar = { F0 = .StrengthScaleShank*.StressIndex*2830; // Maximum force

output at optimum fiber length Lf0 = .FiberLengthScaleShank* 0.04; // Optimum fiber length Lt0 = 0.375; // Tendon slack length Lt0 = 0.375; // Tendon slack length Gamma0 = 0*(3.14/180); // Pennation angle in radian: not

considered in MATLAB code Epsilon0 = 0.053; // Tendon strain at F0 K1 = 10; // Factor for determining shortening speed at optimum

length K2 = 0; // Factor for determining shortening speed at optimum

length Fcfast = 0.4; // Factor for determining shortening speed at

optimum length Jt = 3.0; // Shape parameter for the tendon stiffness Jpe = 3.0; // Shape parameter for the parallel stiffness PEFactor = 5; // Parameter for influence of parallel stiffness }; //--------------------------------- AnyViaPointMuscle muscle = { AnyMuscleModel &MusMdl = ..Muscles.SoleusPar; AnyFixedRefFrame &Org = ..GlobalRef; AnySeg &Ins = ..localseg; AnyDrawMuscle DrwMus = {MaxStress = 2500000;}; }; }; // Muscles folder

Page 106: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

96

AnyPrismaticJoint position = { Axis = x; AnyFixedRefFrame &Ground = .GlobalRef; AnySeg &Slider = .localseg; }; AnyKinLinear positionmeasure = { AnyFixedRefFrame &Ground = .GlobalRef; AnySeg &Slider = .localseg; }; // AnyKinEqSimpleDriver positiondriver = { // MeasureOrganizer = {0}; // DriverPos = {Main.MyModel.Muscles.SoleusPar.Lf0-0.015}; // DriverPos = {0.425000000000000}; // DriverVel = {0}; // DriverAcc = ; // AnyKinMeasure &uhuh = .positionmeasure; // Reaction.Type = {Off}; // }; AnyKinEqInterPolDriver positiondriver = { Type = Bspline; BsplineOrder = 4; MeasureOrganizer = {0}; //0=X, 1=Y, 2=Z FileName = "timepos.txt"; //FileErrorContinueOnOff = Off; AnyKinMeasure &uhuh = .positionmeasure; Reaction.Type = {Off}; }; }; // MyModel // The study: Operations to be performed on the model AnyBodyStudy Study = { AnyFolder &Model = .MyModel; Gravity = {0.0, -9.81, 0.0}; }; }; // Main

Page 107: Simulación de una ley de contracción para modelos …oa.upm.es/65399/1/TFM_PABLO_RODRIGUEZ_ROCA.pdf · 2020. 11. 12. · I . Trabajo de Fin de Máster Máster en Ingeniería Industrial

Appendix

97