155 78
English Pages 182 Year 2021
Vladimir Ryzhov · Tatiana Fedorova · Kirill Safronov · Shaharin Anwar Sulaiman · Mark Ovinis · Veeradasan Perumal
Modeling and Simulation of Complex Dynamical Systems Virtual Laboratory Approach based on Wolfram SystemModeler
Modeling and Simulation of Complex Dynamical Systems
Vladimir Ryzhov Tatiana Fedorova Kirill Safronov Shaharin Anwar Sulaiman Mark Ovinis Veeradasan Perumal •
•
•
•
•
Modeling and Simulation of Complex Dynamical Systems Virtual Laboratory Approach based on Wolfram SystemModeler
123
Vladimir Ryzhov Department of Applied Mathematics and Mathematical Modeling St. Petersburg State Marine Technical University (SMTU) Saint Petersburg, Russia
Tatiana Fedorova Department of Applied Mathematics and Mathematical Modeling St. Petersburg State Marine Technical University (SMTU) Saint Petersburg, Russia
Kirill Safronov Department of Applied Mathematics and Mathematical Modeling St. Petersburg State Marine Technical University (SMTU) Saint Petersburg, Russia
Shaharin Anwar Sulaiman Department of Mechanical Engineering Universiti Teknologi PETRONAS Seri Iskandar, Malaysia
Mark Ovinis Department of Mechanical Engineering Universiti Teknologi PETRONAS Seri Iskandar, Malaysia
Veeradasan Perumal Department of Mechanical Engineering Universiti Teknologi PETRONAS Seri Iskandar, Malaysia
ISBN 978-981-16-3052-1 ISBN 978-981-16-3053-8 https://doi.org/10.1007/978-981-16-3053-8
(eBook)
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2021 This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. This Springer imprint is published by the registered company Springer Nature Singapore Pte Ltd. The registered company address is: 152 Beach Road, #21-01/04 Gateway East, Singapore 189721, Singapore
Introduction
The demand and relevance of massive open online course (MOOC) and the use of distance learning for Higher Education Institute (HEI) have never been more urgent, especially during the COVID-19 pandemic period where mobility was limited. Distance learning tools that allow remote provision of educational material and quality control of knowledge acquisition have become necessary in the educational process. In particular, when studying engineering disciplines where the need for the active development of practical competencies is important, the capabilities of these distance learning tools are crucial. Experience [1–4] shows that virtual laboratory works supported by e-learning systems and web conferencing systems can be good distance learning tools. Virtual laboratories have several advantages that make them in demand in today’s engineering education market: – virtual laboratory works provide versatility and multifunctionality, as well as flexibility and ease of adaptation to various technical subjects, physical processes and phenomena; – ability to carry out experiments, the conduct of which under normal conditions is impossible or fraught with great difficulties; – interactivity; – the virtual learning environment simplifies the implementation and quality control of a student’s preparation for laboratory work; – the virtual learning environment makes it possible to form individual approaches to student learning; – the use of computer modeling packages when performing virtual laboratory works, with advanced process visualization capabilities, allows the creation of laboratory works similar to real laboratory works; – the visual capabilities of virtual laboratory work created in advanced computer modeling packages allows the exploration of multidimensional processes that cannot be realized physically;
v
vi
Introduction
– computer modeling and visualization of advanced packages facilitate the study of dynamic processes and phenomena that can be otherwise very difficult to understand just by looking at simple static pictures of textbooks. Other features of virtual laboratories are: – computer modeling makes it possible to change the initial conditions of a virtual experiment in a greater range than would be possible in a physical experiment, as well as to include the influence of additional factors in an experiment; – virtual laboratory work can be stopped at any time, slowed down or accelerated, which often contributes to a deeper understanding of the physical phenomena and technical processes that are being studied; – the ability to quickly change the input parameters of a virtual experiment, adjusting the developed computer model and visual display of the results develops research competencies; implementation of this type of “virtual” activity allows increased efficiency of a laboratory work, especially in the cognitive domain; – during the virtual experiment, the student’s algorithmic, logical and abstract thinking is actively developed. It has been indicated in some publications [2–4] that the use of computer technology, in particular virtual laboratory works, makes the educational process more dynamic, flexible and compact. Furthermore, the younger generation has extraordinary interest and commitment in digital tools and applications. Experience has shown that classes conducted using distance learning technologies and computer modeling technologies generate more interest and response from students than traditional lectures, seminars and laboratory work. According to some experts, the use of information and communication tools can increase the effectiveness of studying the disciplines of the natural science by 20–30% [2–4]. From a methodological point of view, it is important that the use of virtual laboratory work in the educational process allows: • • • •
individual training; the possibility of modular execution of each laboratory work; step-by-step study of a physical, technical or technological process; the possibility of a meaningful quick analysis of the obtained experimental data simultaneously with a virtual experiment; • the possibility of creative modification and improvement, making adjustments to the developed (or proposed) mathematical and computer model. This textbook is dedicated to the use of virtual laboratory technology in conjunction with the capabilities of e-learning platforms to support distance educational process. The textbook was prepared by a team of authors from two universities: St. Petersburg State Marine Technical University (Russia) and Universiti Teknologi PETRONAS (Malaysia). This textbook serves to demonstrate the use of virtual laboratory technology, previously developed by the authors within the framework of the InMotion: Innovative teaching and learning strategies in open
Introduction
vii
modeling and simulation environment for student-centered engineering education (ERASMUS+) project [1]. This textbook develops topics such as modeling of mechanical oscillatory systems with one and several degrees of freedom, described by Rozhdestvensky et al. [5]. In this set of virtual laboratories, the computer simulation capabilities of Wolfram SystemModeler [6] to study the behavior of mechanical systems are proposed. The step-by-step instructions on creating “virtual stands” are intended both for building component models of mechanical systems and for studying the properties of these systems, as part of a virtual educational laboratory which might be created, for instance, based on the Sakai Learning Management System [7]. The modular structure of the virtual laboratories allows flexibility in performing any tasks at different extents and with varying degree of complexity. Therefore, the proposed set of virtual laboratories can be easily adapted to work with different target audience. These laboratories are also intended to be used as visual demonstrations when getting acquainted with the capabilities of the Wolfram SystemModeler package, supplementing the textbook [5]. In addition, the virtual educational laboratory can be used as a practical supplement to the courses “Physics” and “Theoretical Mechanics.” Object-oriented modeling of complex systems allows creation of component models for a simulation in a short time, without explicit mathematical models, which sometimes turn out to be very complex and complicated. With basic knowledge of the theory of dynamic systems and the principles of component modeling, a student can build a computer model of the system at a more generic level. At the same time, the component model of the system provides very good results, as the model is implemented in the form of a program code for the governing equations and the numerical methods that solve them. It should be noted that the software implementation in the Modelica language for most of the tasks presented in the virtual laboratories is given in the textbook [5]. The virtual laboratories that are related to component modeling of both continuous and hybrid dynamic systems are listed in Table I. Familiarity with the following topics is recommended: • • • • • • •
Wolfram SystemModeler user guide; Dynamic systems theory; Fundamentals of theoretical mechanics; Kinematics and dynamics; Oscillation theory; Ordinary differential equations Conservation laws in mechanics—conservation of energy and conservation of momentum; • Types of collisions—elastic and inelastic impacts. Each laboratory work is divided into the methodological stages as shown in Fig. 1.
viii
Introduction
Table I List of virtual laboratories (VL) No VL
Theme of virtual laboratory
1 2 3 4 5 6 7 8 9 10
Computer Computer Computer Computer Computer Computer Computer Computer Computer Computer
TheoreƟcal basis
MathemaƟcal model
Modeling Modeling Modeling Modeling Modeling Modeling Modeling Modeling Modeling Modeling
of of of of of of of of of of
Projectile Motion Spring Damper System Ballistic Pendulum Newton’s Cradle Rotational Motion of Bodies Elliptic Pendulum Coupled Pendulum System Double Pendulum Rotating Swing Gyroscopic Precession
Component modeling
Numerical experiment
Ploƫng graphs
Analysis of results
Fig. 1 Methodological stages of the virtual laboratory work
Theoretical Basic To successfully complete the work, the student needs to study the theoretical foundations and familiarize himself with the following information prior to each laboratory work: • Learning objectives: What the student will learn when the virtual laboratory is completed, • Statement of the problem: In the description of the laboratory work, a problem is posed that must be solved.
Mathematical Model Detailed descriptions of the mathematical models of the proposed laboratory work can be found at the beginning of each laboratory work. They have the following structure: • Physical statement of the problem; • Development of the mathematical model.
Introduction
ix
Component Modeling All laboratory works are carried out in accordance with the principles of component modeling. To successfully use this approach, it is recommended that the following are done at the start of each laboratory: • Start SystemModeler; • Since component models are created using the Modelica libraries called PlanarMechanics, MultiBody and Mechanical.Translation Library, make sure that they are installed; • Create a new model in diagram view in the Model Center; • Find suitable components in the built-in Modelica libraries, drag them to the diagram layer and connect them to each other using the Connection Line Tool.
Numerical Experiment (Testing and Simulation of the Model) When conducting a numerical experiment, in case of difficulty, it is useful to refer to Sect. 2, which describes the basics of working with WSM and provides answers to the most frequently asked questions. In particular, follow the guidelines below: • Read Sect. 2.4 before choosing a numerical method to model your model. • To run the model for a numerical experiment, see Sect. 2.5. • Select a numerical method and run the simulation. If everything is done correctly, an animation of the computer model will be displayed on the screen. If the animation of the model is not displayed on the screen, check the values of the components parameters, and also compare the developed diagram with the correct diagram given in Sect. 2 and study the behavior of the mechanical system, which the developed model describes.
Plotting Graphs After testing the model, study the behavior of the mechanical system that the developed model describes. This section provides the questions and setting of tasks for the virtual laboratory that must be performed to analyze the qualitative and quantitative characteristics of the simulated system.
x
Introduction
Analysis of Results After modeling and plotting, an analysis of the numerical and visual results should be done. This analysis can be performed either using the appropriate SystemModeler tools or independently (using knowledge in the subject area in question). The specified analysis of the results obtained is part of the analytical report on the completed virtual laboratory work. The stages of the laboratory work indicated above should be accompanied by preliminary and intermediate control and testing. Fig. 2 shows the stages of preliminary and intermediate control.
Entrance test
Tests and quesƟons
AnalyƟcal Report and PresentaƟon
Assessment of the laboratory work
Fig. 2 Control and assessment stages of the virtual laboratory work
Entrance Test The aim of entrance test is assessing the readiness of a student to perform a virtual laboratory. In the entrance test, the knowledge acquired by the student within the framework of the studied basic disciplines and the knowledge necessary to perform the various stages of laboratory work is monitored. The entrance test precedes the virtual laboratory and can be conducted in a learning management system, for example LMS Sakai [7]. If an unsatisfactory result was obtained when attempting the entrance test, the corresponding theoretical material is provided. After successfully passing the entrance test, the student can move on to the tasks of his virtual laboratory work.
Tests and Questions Before preparing an analytical report, a student must answer test questions as a form of self-check on the correctness of the computer model built and assess the achieved level of competencies. Control (output) testing is mandatory and can be carried out in a learning management system, for example LMS Sakai [5].
Introduction
xi
Analytical Report and Presentation The analytical report should contain the following basic information: 1. Description of the problem statement; 2. Description of the constraints and assumptions used; 3. Description of the computer model including all its components. Indicate the values of the parameters of all devices used in the simulation, with an explanation of where this information was taken from; 4. Detail description of the computational experiments that were carried out using the developed model, as well as the results of these experiments—graphical and tabular dependencies; Table II Criteria for assessing the quality of the performed virtual laboratory No
Criteria
Maximum Score
1
Entrance test
2
Mathematical and computer models
3
Simulations. Graphs and figures
3
Analysis of results
4
Tests and questions (output)
5
Analytical report
6
Presentation
Student answers are complete and well thought. They cover all aspects of the questions asked in the exercises (tests). Student may start his virtual laboratory work Mathematical model is correct. The computer model contains the necessary components, blocks and connectors to accurately represent the system The student has selected the correct parameters for the simulation. The resulting graphic and animation fully provide answers to the questions formulated in the task for the virtual laboratory work The student performed the analysis of the obtained numerical and visual results correctly. To analyze the results, the necessary SystemModeler tools were correctly used, or the knowledge previously obtained in the subject area under consideration was used to analyze the results. The adequacy of the results of the mathematical and simulation model was shown by comparison with known experimental or theoretical data Student answers are complete and well thought. They cover all aspects of the questions asked in the exercises (tests). At the same time, the questions of the tests provide for the verification of the student’s knowledge in two or three related disciplines related to the laboratory work (e.g., computer modeling, mechanics, physics). As such, the student’s multidisciplinary competencies are assessed The report is factually correct and complete. It thoroughly addresses main sections described in the assignment. It contains no spelling or grammatical errors The presentation correctly reflects the content and results of all stages of the virtual laboratory work and corresponds to the analytical report. The student presented the prepared material in correct mathematical language. During the discussion on the completed virtual laboratory work, the student correctly answered all the questions asked by the teacher and other students
xii
Introduction
5. Comprehensive analysis of the results obtained should be included in the report, and the resulting simulation should be judged reasonable compared to the “real world”; 6. Suggestions for future improvements/clarifications that are made with the studio-developed model. When writing a report, it is necessary to use the special terminology of modeling, which was studied in the theoretical course. Equations and methods that were used need to be cited. An important element of control and evaluation of the results of the performed virtual work is its presentation, prepared based on the analytical report. The presentation can be made by the student using web conferencing systems used in the distance learning process such as Zoom, BBB, etc.
Assessment of the Laboratory Work Evaluation of the virtual laboratory work is based on a previously developed criteria [1], Table II. These criteria allow a teacher to give a qualitative and quantitative assessment of all stages of the virtual laboratory work and to assess the student’s work as a whole. Thus, the structure of the virtual laboratories described in Sects. 1 and 2 is based on the methodological and control/assessment stages described above.
Contents
1 Virtual Labs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Basic (Simple) Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 Spring Pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 Simple (Math) Pendulum . . . . . . . . . . . . . . . . . . . . 1.2 Complex Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Computer Modeling of Projectile Motion . . . . . . . . 1.2.2 Computer Modeling of Springdamper System . . . . . 1.2.3 Computer Modeling of Ballistic Pendulum . . . . . . . 1.2.4 Computer Modeling of Newton’s Cradle . . . . . . . . . 1.2.5 Computer Modeling of Rotational Motion of Bodies 1.2.6 Computer Modeling of Elliptic Pendulum . . . . . . . . 1.2.7 Computer Modeling of Coupled Pendulum System . 1.2.8 Computer Modeling of Double Pendulum . . . . . . . . 1.2.9 Computer Modeling of Rotating Swing . . . . . . . . . . 1.2.10 Computer Modeling of Gyroscopic Precession . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Getting Start with Wolfram SystemModeler . . . . . . . . . . . . 2.2 Creating a Component Model . . . . . . . . . . . . . . . . . . . . . . 2.3 Setting the Initial Parameters of a Computer Model . . . . . . 2.4 Choosing a Numerical Method and Simulation Settings . . . 2.5 Simulate a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Plotting and Graph Analysis . . . . . . . . . . . . . . . . . . . . . . . 2.7 FFT Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8 Guidelines for “Computer Modeling of Projectile Motion” . 2.9 Guidelines for “Computer Modeling of Spring-Damper System” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.10 Guidelines for “Computer Modeling of Ballistic Pendulum”
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
1 2 3 5 10 10 15 21 29 36 44 51 60 67 80 90
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
91 91 94 96 98 103 103 107 108
. . . . 113 . . . . 119
xiii
xiv
Contents
2.11 Guidelines for “Computer 2.12 Guidelines for “Computer of Bodies” . . . . . . . . . . . 2.13 Guidelines for “Computer 2.14 Guidelines for “Computer System” . . . . . . . . . . . . . 2.15 Guidelines for “Computer 2.16 Guidelines for “Computer 2.17 Guidelines for “Computer Precession” . . . . . . . . . . . References . . . . . . . . . . . . . . . .
Modeling of Newton’s Cradle” . . . . . . 127 Modeling of Rotational Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Modeling of Elliptic Pendulum” . . . . . 137 Modeling of Coupled Pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Modeling of Double Pendulum” . . . . . 148 Modeling of Rotating Swing” . . . . . . . 157 Modeling of Gyroscopic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Chapter 1
Virtual Labs
Abstract This chapter contains the description of the virtual labs. We start with a brief description of simple classical models such as a spring pendulum and a simple mathematical pendulum. The equations for these models are provided in cases with and without the impact of friction force. Subsequently, more sophisticated models are considered. These models are both continuous and hybrid. Particular attention is paid to the ways how the mechanical models may be built, such as Newton’s Second Law and Lagrange equations. For the hybrid models, statecharts are provided with detailed description of states and transfers. A problem statement and prerequisites shall be given for each laboratory. The description of each lab is provided with some advice on how to build the component model. In addition, parameter values for configuring the model and plot samples are given, useful for checking after the model is built. Finally, some tasks related to the constructed model are given.
To facilitate the process of computer modeling of large systems, an approach called component modeling is often used in practice. In this case, it is assumed that the model of a complex dynamic system can be represented as interconnected components describing the individual components of the system under consideration. In component modeling, each component is described as a class. From objects, or copies of classes, a required model is composed. Such an approach in modeling is called object-oriented and involves the creation of libraries of basic components on which new, more complex systems are built. It is possible to connect components into which the source object is interconnected in various ways using “directed” or “non-directional” links. Directed links are typically used to model control systems, while non-directional links form the basis of so-called physical modeling. This approach is used in the Wolfram SystemModeler package, which is selected as a working tool for component modeling. This textbook contains mainly tasks for the development of component computer models with undirected connections. In this case, the models themselves are based on algebraic, differential, and differential-algebraic equations. In addition, the © The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2021 V. Ryzhov et al., Modeling and Simulation of Complex Dynamical Systems, https://doi.org/10.1007/978-981-16-3053-8_1
1
2
1 Virtual Labs
textbook contains information that is necessary to achieve the practical goals of training in the course “Computer Simulation of Dynamic Systems using the Wolfram SystemModeler.” These goals are determined by the ability to: • competently work with the interface of the Wolfram SystemModeler package; • build component models of dynamic systems in the Wolfram SystemModeler package; • carry out a computational experiment with the constructed models; • analyze the results obtained in the framework of the computer models created, to assess their adequacy—compliance with the actual physical processes. As a result of performing virtual labs, the student will gain experience on: • the practical use of the Wolfram SystemModeler package for creating component models of dynamic systems; • conducting a computational experiment aimed at analyzing the main characteristics of the simulated physical systems; • preparation of an analytical report on the results achieved in the framework of the virtual lab; • presentation of the results in the form of an open discussion with the teacher and students of the group; • self-critical assessment of the quality of the work performed. This chapter contains a set of virtual labs related to the simulation of mechanical systems. The composition and content of virtual labs are selected in such a way as to meet the achievement of the above learning objectives. The textbook contains instructions for performing all stages of virtual lab, as well as the necessary reference materials (e.g. description of component libraries used in performing virtual lab, help on alternative numerical methods that can be used by a student in performing lab, etc.) required to complete assignments. The detailed requirements for the steps of the implementation, composition, and reporting of virtual lab in LMS Sakai [1] are formulated and the criteria for assessing the quality of the work conducted by the student are also indicated.
1.1
Basic (Simple) Models
To improve the understanding of the general laws of simulated dynamic processes for mechanical systems, it is advisable to begin with illustrative examples in which these processes can be easily visualized. Simple mechanical oscillatory systems are considered first, such as a spring pendulum and a mathematical pendulum. From the point of view of the theory of dynamic modeling, the basic models considered in this section are continuous isolated systems [2–4]. These models will be used in other labs as components for building more complex systems (both continuous and hybrid).
1.1 Basic (Simple) Models
1.1.1
3
Spring Pendulum
The ideal spring pendulum (ideal oscillator) is a mechanical system consisting of a spring with a given coefficient of elasticity (stiffness) k, one end of which is rigidly fixed, and a rigid body with mass m, performing harmonic oscillations, is attached to the other end. When the spring is not deformed, the body is in the equilibrium position. If the body is removed from the equilibrium position (spring is stretched or compressed), it will be affected by the elastic force from the deformed spring, which returns the body to the equilibrium position (Fig. 1.1). As a result, harmonic undamped oscillations occur. Based on Newton’s Second Law and Hooke’s Law, the behavior of an ideal spring pendulum is described by the equation: m
d2 x þ kx ¼ 0 dt2
with given initial conditions: x ð t ¼ 0Þ ¼ x 0 ; t ð t ¼ 0Þ ¼ t 0 :
Fig. 1.1 Three positions of the spring pendulum: a neutral, b compressed, c stretched
a)
b)
c)
4
1 Virtual Labs
For the written problem, an analytical solution of the following general form can be easily obtained: x ¼ A sinðxtÞ þ B cosðxtÞ; where the values of the constants A and B are determined considering the initial conditions (based on the initial state of the object). In this case, it is easy to show qffiffiffi that the natural frequency of oscillation of the “spring-mass” system is x ¼ mk , and the oscillation period of the spring pendulum is determined by the formula pffiffiffi T ¼ 2p mk. A real oscillator always has a loss of vibrational energy. Therefore, free oscillations will be damped (and therefore not undamped). In this case, the force of damping friction should be added to the equation of oscillations F ðtÞ: m
d2 x ¼ kx þ F ðtÞ dt2
Typically, damping friction force is assumed to be proportional to velocity with a coefficient b: F ðtÞ ¼ b
dx dt
Then, we finally get m
d2 x dx þ kx þ b ¼ 0 2 dt dt
Note. To work with the obtained equation in the Wolfram SystemModeler package, it is necessary to do some of its transformations. This is because, in Wolfram SystemModeler version 4.2, numerical methods can only work with differential equations of the first-order [2, 5]. Therefore, a reduction to the system of equations of the first-order is required: dx ¼v dt m
dv ¼ kx bv dt
Free oscillations of a real oscillatory system are damped. To obtain undamped oscillations, it is necessary to compensate for the energy losses caused by the friction forces. This can be done by acting on the system with a variable external force F ðtÞ, changing, in the simplest case, according to the harmonic law:
1.1 Basic (Simple) Models
5
F ðtÞ ¼ Fmax cosðxB tÞ; where xв—is the frequency of external force. In this case, the oscillation equation of the ideal pendulum will take the form: m
d2 x þ kx ¼ F ðtÞ; dt2
and in the presence of damping, it will be written as: m
d2 x dx þ kx þ b ¼ F ðtÞ: dt2 dt
In general, external force may vary not only according to the harmonic law, and the nature of the oscillations, in this case, will be different. The amplitude of steady-state forced oscillations depends only on the parameters of the system (and not on the initial conditions, as was in the case of free oscillations) and the frequency of the external force acting on it. When the frequency of the external force coincides with the natural frequency of the system, a resonance occurs—a sharp increase in the amplitude of the forced oscillations. In the presence of damping and external forces, the system of equations of the first-order will look like: Spring Pendulum Model: dx ¼v dt m
dv ¼ kx bv þ F ðtÞ dt
The process of component modeling of an auxiliary model of a simple one-dimensional spring system with damping is shown in Sect. 2.2. Follow those instructions.
1.1.2
Simple (Math) Pendulum
Formulation of the problem A mathematical pendulum is a harmonic oscillator, which is a mechanical system consisting of a material point at the end of a weightless inextensible thread or a
6
1 Virtual Labs
weightless inextensible rod in a uniform field of gravity. The pendulum moves without resistance. When the material point deviates from the equilibrium position, the returning force is the projection of gravity on the tangent to the trajectory along which this material point moves. A returning force acting on a material point causes it to oscillate around an equilibrium position (Fig. 1.2). Description of the mathematical model The equation of oscillations of a pendulum is easy to obtain using the basic equation of the dynamics of rotational motion: J
d2 h ¼ mgl sin h dt2
where J ¼ ml2 is the moment of inertia of the mathematical pendulum, and M1 ¼ mgl sin h—is the rotational moment due to the force of gravity. Reducing the written equation by ml2 we get the equation of oscillations, which does not depend on the mass of the body: d2 h g ¼ sin h 2 dt l Rewrite the equation as a system of two equations and express as derivatives:
Fig. 1.2 Forces acting on a mathematical pendulum
1.1 Basic (Simple) Models
7
Simple (Math) Pendulum Model: dh ¼ x dt dx ¼ g sin h l dt
Comment. We will conduct a small analysis of the resulting model. Note that the oscillation equation of a mathematical pendulum is nonlinear. This is because the acceleration of the body is not proportional to the coordinate, but it is a complex function of the deviation from the equilibrium position, the angle h. If these deviations are small, then sin h h, and the model of small oscillations will be linear: d2 h g ¼ h dt2 l Let us complicate the problem and take damping into account. We write the torque generated by gravity (M1 ¼ mgl sin h) and damping (M1 ¼ bl2 ddht ), on the assumption that the damping force is directly proportional to the velocity: J
d2 h dh ¼ mgl sin h bl2 2 dt dt
As a result, the equation of free damped oscillations of a mathematical pendulum is obtained: d2 h g b dh ¼ sin h dt2 l m dt In the presence of friction in the system, the oscillations of the pendulum decrease, and the magnitude mb characterizes the speed of this decrease. If the friction is negligible, then in the case of small deviations, sin h h and this equation transforms into the equation of free undamped oscillations, the solution of which will be a periodic function. Component modeling We will develop a computer model of the mathematical pendulum in the Wolfram SystemModeler, using the library of ready-made components [5]. The computer model of the mathematical pendulum can be implemented as a model of a rod suspended on a revolute joint. A rigid body is attached to the lower end of the rod.
8
1 Virtual Labs
Fig. 1.3 a Component Fixed, b component PlanarWorld
a
b
Choosing components for a diagram of component model 1. Components defining the position of the pendulum in space. Component Fixed —a fixed point, component PlanarWorld—a fixed coordinate system (Fig. 1.3). 2. Components describing a mathematical pendulum. Component Revolute— plane revolute joint., component FixedTranslation—a rigid rod, component Body—a rigid body (Fig. 1.4). These components are summarized in a Table 1.1, which is recommended to use in virtual labs, when using a mathematical pendulum as a basic model. Connecting all the listed components, you will get a (mathematical) model of a free pendulum (Fig. 1.5). Setting the initial parameters of the model At the bottom of the screen in the diagram view, check that the initial settings of the components are correct. The recommended parameter values are given in Table 1.2. It is recommended to set the following initial value for the angular velocity of the body (Table 1.3). Testing and simulation of the model Choose a numerical method that you will use to simulate your model. The numerical experiment in the Simulation Center window leads to the creation of the next 3D-animation (Fig. 1.6). Note This model will be used in several labs. When creating a conventional mathematical model of a pendulum, it is recommended to rely on the Tables 1.1, 1.2 and 1.3 each time, unless otherwise recommended. An additional study on the
a
b
c
Fig. 1.4 a Component Revolute, b component FixedTranslation, c component PlanarWorld
1.1 Basic (Simple) Models
9
Table 1.1 The model components Library
Name of the component
Quantity and short description
modelica://PlanarMechanics modelica://PlanarMechanics.Parts modelica://PlanarMechanics. Joints. modelica://PlanarMechanics. Parts. modelica://PlanarMechanics. Parts.
PlanarWorld Fixed Revolute
fixed coordinate system—1 fixed point—1 plane revolute joint—1
FixedTranslation
rigid rod—1
Body
rigid body—1
Fig. 1.5 Diagram of a model of a free (mathematical) pendulum
properties of a mathematical model of a pendulum with the construction of graphs, phase diagrams, and frequency characteristics will be carried out in laboratory work “Computer modeling of coupled pendulum system”.
10
1 Virtual Labs
Table 1.2 Setting parameters of computer model components Parameter values
Description
fixedPoint.r[2] = {0,1} m pendulum.r[2] = {0, − 1} m pendMass.m = 5 kg pendMass.I = 0.001 kg m^2 pendMass.g[2] = planarWorld.g m/s^2
Pendulum is fixed at x, y-position (x = 0, y = 1) Length of the rod L = 1 m (at phi = 0) Mass of the body M = 5 kg Inertia of the body I = 0.001 kg m2 Local gravity acting on the mass g = 9.8 m/s2
Table 1.3 Setting the initial values of the parameters Parameter values
Description
revolute.phi = 0 rad revolute.w = 2 rad/s
Initial value of the pivot joint u0 ¼ 0 rad Initial value of angular velocity x0 ¼ 2 rad/s
Fig. 1.6 3D animation of the computer model
1.2 1.2.1
Complex Models Computer Modeling of Projectile Motion
The purpose of this lab is to study the dynamics of the translational motion of a material point in a field of gravity. The ability to describe and simulate a simple physical model, e.g. the movement of a body thrown at an angle to the horizon, is the first important step towards understanding the dynamic modeling process. In this virtual lab, you will build computer model of the projectile motion (Fig. 1.7), simulate the model, and study the characteristics of this dynamic system.
1.2 Complex Models
11
Fig. 1.7 Projectile motion of a body
Learning Objectives: • to explore the dynamics of the translational motion of a body in the field of gravity; • to evaluate numerically the “stability” of the obtained solution. Formulation of the problem A bullet of mass m is fired with some initial velocity~ v0 at the target located at a distance L and height H from the point of the shot. It is necessary to investigate the bullet movement, considering it as a point mass, varying the initial conditions (the angle of fire h; the initial velocity of the bullet u,), compare the analytical and numerical results and evaluate the obtained numerical solution. Description of the mathematical model At the beginning, a body of mass m is located at the origin of coordinates and begins to move at an angle h to the horizon with an initial velocity ~ v0 : Write down an equation of motion of the body, considering it as a point mass. The initial conditions for the velocity~ v0 indicated in the problem formulation can be written in vector form: ~ v0 ¼ v0x~i þ v0y~j; where v0x ¼ v0 cos h; v0y ¼ v0 sin h: Newton’s Second Law, assuming that the body is acted upon by gravity, external force, and damping, has the form: m
d~ v ¼ m~ gþ~ Fext þ ~ Fdamp dt
For the bullet, we will assume that ~ Fext ¼ 0, and ~ Fdamp ¼ 0.
12
1 Virtual Labs
If we consider this particular case, the movement of a body exclusively in the field of gravity, then Newton’s Second Law in a scalar form with initial conditions will give the following mathematical model: Bullet flight model at a fixed angle from the origin, without damping: dx ¼ vx dt dy ¼ vy dt dvx ¼ 0; v0x ¼ v0 cos h dt dvy ¼ g; v0y ¼ v0 sin h dt
From here, it is possible to obtain an equation that describes the motion of a bullet from the origin, depending on its initial velocity and acceleration: r ¼ v0 t þ at2 This formula is the law of body in a uniformly accelerated motion. To account for damping in the resulting mathematical model, you must add the component proportional to the velocity. Bullet flight model at a fixed angle from the origin with damping: dx ¼ vx dt dy ¼ vy dt dvx ¼ bvx ; v0x ¼ v0 cos h dt dvy ¼ g bvy ; v0y ¼ v0 sin h dt
Component modeling Choosing components for a diagram of component model The computer model that you need to create should consist of the components listed in Table 1.4.
1.2 Complex Models
13
Table 1.4 The model components Library
Name of the component
Quantity and short description
modelica://PlanarMechanics modelica://PlanarMechanics. Parts.
PlanarWorld Body
1 fixed coordinate system 1 rigid body
By placing the components on the diagram layer, you will get a model of a dynamic system describing the movement of a bullet fired from a gun. If the process of modeling difficult, refer to the diagram of correct model in Sect. 2.8. Setting the initial parameters of the model A long-range rifle is fired at A with the projectile hitting a mountain at B. The target at Point B is 1.5 km above Point A and 5 km away from it, as shown in Fig. 1.8. It is necessary to analyze the process of movement of the bullet, considering different initial conditions. The initial velocity, u is set to a constant 400 m/s, meaning that the only thing that will determine if the target is hit will be the angle at which the rifle is fired. The goal of this first part is to determine the angle at which the rifle should be fired. At the bottom of the screen in the diagram view, check that the initial settings of the components are correct; refer to Table 1.5. Set the parameters you can change in the model. It is necessary to find the component Velocity in the library Modelica.SIunits and to set initial values for the velocity of the mass (bullet) as u = 400 m/s. The origin of the reference system in this case will be a rectangular coordinate system placed at A, with positive x-axis to the right and positive y-axis up. Placing the origin of the reference system in A will simplify the equations, since it means that the initial position is zero x0 ¼ 0, y0 ¼ 0. Testing and simulation of the model Choose a numerical method to simulate your model. You will see an animation of a computer model of the unconstrained motion. An example of a screenshot of the animation is shown in Sect. 2.8. Fig. 1.8 Bullet hitting the target at Point B
14
1 Virtual Labs
Table 1.5 Setting parameters of computer model components Name of the component
Parameter values
Description
PlanarWorld Body
g [2] = planarWorld.g m/s^2 m = 0.04 kg
Acceleration of gravity Bullet mass
Plotting and graph analysis Task 1a. Performing an analytical calculation: determining the angles of mounted and flat shooting. A body thrown at an angle to the horizon moves along a parabola. The velocity vector is tangential to the parabola at any point. The speed of body movement changes only under the action of gravity—the body moves with the acceleration of free fall. The body’s flight distance is greatest if its initial speed is directed to the horizon at an angle of 45°. The body’s lifting height increases as the angle change from 0° to 90° when moving vertically upwards. If the target is at a distance less than the longest range of the flight, the projectile can hit it along two paths: with a tilt angle less than 45° (flat shooting at open targets), and with a tilt angle greater than 45° (mounted shooting at closed goals). Perform an analytical calculation to find the angle of the rifle in these two cases (using the Wolfram Mathematica package [6]). Task 1b. Performing numerical simulations: determining the angles of mounted and flat firing. After setting the same initial conditions as in Task 1, change the angle h, at which the bullet flies. Plot several graphs of the trajectory of movement depending on the angle h. Find the values of angles h, at which the bullet will hit a given point B, performing numerical simulations and plot them on the graphs. Compare the results of the analytical solution obtained in Task 1a and the computational simulation. Task 2a. Performing an analytical calculation: changing the velocity of a bullet. Suppose you can change the velocity of the bullet u. Plot the graph of the velocity u as a function of the angle h (using Wolfram Mathematica package [6]). Find out at what minimum initial velocity u will the bullet reach point B. Task 2b. Perform a numerical simulation: change the velocity of a bullet. Find the minimum bullet velocity u and the related angle h graphically by conducting a series of numerical simulations, where you can change both the initial velocity of the bullet and the angle of the shot and compare the result with the analytical one. Task 3. Solution Stability Analysis Which angle h obtained in the previous task should be chosen for firing so that the deviation from the solution due to external influences was minimal? Determine analytically and verify using simulation. For numerical confirmation of analytical conclusions, you need to conduct a series of simulations by changing the angle h and verify this by analyzing the resulting graphical dependencies.
1.2 Complex Models
15
Task 4. Time of flight of the bullet Analytically and from the results of a numerical experiment, determine how the flight time t is related to the angle of the gun when fired, h:
1.2.2
Computer Modeling of Springdamper System
The purpose of this work is to build a component model and to study the characteristics of the oscillatory system of coupled spring pendulums. In this virtual lab, you will work with systems of springs and dampers. You will build and simulate your own models and then analyze the results (see Fig. 1.9). The ideal spring pendulum (ideal oscillator) is a mechanical system consisting of a spring with a given coefficient of elasticity (stiffness) k and a body of mass m, oscillating without damping. When the spring is not stretched, the body is in the equilibrium position. If the body is removed from the equilibrium position (the spring is stretched or compressed), it will be affected by the elastic force from the stretched spring, which returns the body to the equilibrium position. As a result, harmonic undamped oscillations occur. In this lab, you need to build computer models of the proposed dynamic systems and investigate their behavior. Learning Objectives: • how springs and dampers work and what parameters affect them. For a mathematical model of the system, a “base” model, the “spring pendulum” is used, Formulation of the problem Coupled spring pendulums is an oscillatory system composed of two spring pendulums (with masses m1 and m2, stiffness of springs k1 and k2, damping coefficients b1 and b2 respectively) fixed between two walls and connected by a spring with stiffness k. An external force (constant or periodic) can be applied to each mass, as shown in Fig. 1.10.
Fig. 1.9 Springdamper system
16
1 Virtual Labs
Fig. 1.10 Dynamic system: pendulums with spring and damper
Description of the mathematical model Let the distance between the walls be constant and equal to l, the initial coordinate of the first body is determined by the length of the first spring in the undeformed state xo1 = l1. The initial position of the second body is xo2 = xo1 + l2, where l2 is the length of the second spring in the undeformed state and l3 is the length of the third spring in the undeformed state. Using Newton’s Second Law, we can write the equations of the free system as: d2 x 1 dx1 ¼ k1 ðx1 x01 Þ kððx2 x1 Þ ðx02 x01 ÞÞ b1 dt2 dt 2 d x2 dx2 m2 2 ¼ k ððx1 x2 Þ ðx02 x01 ÞÞ k2 ðx2 x02 Þ b2 dt dt
m1
Here, the coordinates x1 and x2 are the positions of the centers of mass at an arbitrary point in time, so that, for example, Dx1 ¼ x1 x01 is the elongation of the first spring. In addition, the spring damping factors are considered. If necessary, they can be set to zero. In addition to differential equations in the mathematical model, a boundary condition of fixed ends was used. The extension of the spring through the displacement of the masses can be expressed as: Dx1 ¼ x1 x01 Dx2 ¼ ðx2 x1 Þ ðx02 x01 Þ Dx3 ¼ x2 x02 After deformation, the total length of the system should remain unchanged, i.e.: ðl1 þ Dx1 Þ þ ðl2 þ Dx2 Þ þ ðl3 þ Dx3 Þ ¼ l or Dx1 þ Dx2 þ Dx3 ¼ 0 Add an external force to each equation and to obtain first-order equations:
1.2 Complex Models
17
Model of coupled spring pendulums: dx1 dt dv1 m1 dt dx2 dt dv2 m2 dt
¼ v1 ¼ k1 ðx1 x01 Þ k ððx2 x1 Þ ðx02 x01 ÞÞ b1 v1 þ F1 ðtÞ ¼ v2 ¼ kððx1 x2 Þ ðx02 x01 ÞÞ k2 ðx2 x02 Þ b2 v2 þ F2 ðtÞ
Comment When conducting numerical experiments in virtual lab, the external force can be chosen as follows: • for free oscillations: F1 ðtÞ ¼ F2 ðtÞ ¼ 0 • for forced oscillations with constant external force: F1 ðtÞ ¼ F1 F2 ðtÞ ¼ F2 • to study the phenomenon of resonance with external periodic force: F1 ðtÞ ¼ F1 cos x1 t F2 ðtÞ ¼ F2 cos x2 t: Component modeling. Part 1. A model of a simple one-dimensional spring system with damping You should begin with a simple model. Use the built-in library Mechanical. Translation Library to simulate translational mechanical motion. The process of selecting components for an auxiliary model of a simple one-dimensional spring system with damping is shown in Sect. 2.2. Follow the instructions. Drag all selected components to the diagram layer. Make all the necessary connections of components, and you will get a component model of a one-dimensional spring system with damping. The diagram of the model also can be found in Sect. 2.2. Setting the initial parameters of the model At the bottom of the screen in the diagram view, check that the initial settings of the components are correct (see Table 1.6).
18 Table 1.6 Setting parameters of computer model components
1 Virtual Labs Parameter values
Description
springDamper.c = 100 N/m springDamper.d = 5 Ns/m springDamper.s_rel0 = 0.2 m
Spring constant Damping constant Unstretched spring length Relative distance
springDamper.s_rel = 0.2 m (true) mass.m = 6 kg const.k = 10
Mass of the sliding mass Constant output value
Based on the parameter values indicated in Table 1.2, build a model of a system with a mass that is initially at a point with x = 0.2 and connected by a spring and a damper with a fixed point. At the beginning, the spring is not deformed and an external force of 10 N acts on the body. The springDamper will try to return the mass to the equilibrium position. Choose a numerical method and simulate your model. Part 2. Model of a system consisting of two bodies, springs and dampers (the main model) Now, based on the simple model, you need to build a new model of the system, as shown in Fig. 1.10. Choosing components for a diagram of component model Continuing with the model, we need to add one more spring and one more mass. The spring component can be found in the library Translation.Components. Drag and drop the spring onto the diagram view. The mass can also be drag and dropped again to the diagram view, but it is also possible to copy the mass we already have in the model. Comment. This is done by right-clicking on the model and clicking Copy and then Paste, or by clicking on Duplicate. It can also be done by clicking on the model and pressing Ctrl + C and then Ctrl + V, or alternately only pressing Ctrl + D. Connect them together and the result should look like left part of Fig. 1.10. Now all that is missing from having the complete model is to add another springDamper, another fixed frame and another force acting on the second mass. Similar to earlier assignments, add a duplicate of the first springDamper and of the first fixed point. The components const and force can be duplicated from the diagram view and then connected to the second mass. Having made all the necessary connections of the components, you will get a computer model of a mechanical system consisting of two bodies, springs, and dampers. If the process of modeling is difficult, you can see the diagram of correct model in Sect. 2.9. Setting the initial parameters of the model At the bottom of the screen in the diagram view, check that the initial settings of the components are correct (see Tables 1.7 and 1.8). Set options for spring1 and mass1, Table 1.7 and for springDamper, fixed frame and const1 as per Table 1.8.
1.2 Complex Models Table 1.7 The value of the component parameters
19 Parameter values
Description
spring1.c = 10 N/m spring1.s_rel0 = 0.1 m spring1.s_rel = 0.1 m (true) mass1.m = 6 kg
Spring constant Unstretched spring length Relative distance Mass of the sliding mass
Table 1.8 The value of the component parameters Parameter values
Description
springDamper1.c = 100 N/m springDamper1.d = 5 Ns/m springDamper1.s_rel0 = 0.2 m springDamper1.s_rel = 0.2 m (true) fixed1.s0 = 0.5 m const1.k = 10
Spring constant Damping constant Unstretched spring length Relative distance Fixed offset position of housing Constant output value
Now you can simulate the system. Create a copy of your model and make changes to it that will allow you to conduct studies of the dynamic characteristics of the model, to investigate the resonance of the mechanical system. Part 3. Building a model to study the resonance To test and see how the system resonates, we can set both forces to a cosine behavior with a frequency that will resonate with the system. Choosing components for a diagram of component model First, you need to use a cosine signal as input to the force component. Go to the library Modelica.Blocks.Sources and drag and drop two cosine components to the diagram view. Remove the const components that were used as force input signal before and put the cosine components in stead and connect them to the force components. The result without parameters set will look like this (Fig. 1.11).
Fig. 1.11 Fragment of the diagram of the component modified model
20
1 Virtual Labs
Note Say that we want to resonate the first mass. The first mass has an angular frequency that is dependent on the parameters mass.m and springDamper.c. If the process of modeling is difficult, you can see the diagram of correct model in Sect. 2.9. Setting the initial parameters of the model Try setting these parameters for the system as per Table 1.9: Note. If we set the frequency of the cosine force to be equal to the angular frequency, the force will resonate with the first mass and spring. Additional task Build a similar model using the Planar Mechanics library. This library is used for modeling 2D models and one of the benefits of using this library is that an animation is automatically produced from it. The downside is that it is more difficult to use in modeling (since the user needs to take care of two dimensions) and it requires more computational time. When modeling, consider the possibility of application to the system of both constant and cosine force. You can see the diagram of correct model in Sect. 2.9. Testing and simulation of the model Choose a numerical method that you will use and simulate your model. You will see an animation of a computer model of a mechanical system consisting of two bodies, springs, and dampers. Plotting and graph analysis. Part 1: model of one-dimensional spring system with damping Task 1. Return to the auxiliary model of a simple spring pendulum with damping. Plot the position of the center of mass of the body.
Table 1.9 The value of the component parameters Parameter values
Description
springDamper.c = 100 N/m springDamper.d = 0.05 Ns/m springDamper.s_rel0 = 0.2 m springDamper.s_rel = 0.2 m (true) mass.m = 10 kg spring1.c = 10 N/m spring1.s_rel0 = 0.1 m spring1.s_rel = 0.1 m (true) mass1.m = 1 kg springDamper1.c = 10 N/m springDamper1.d = 0.05 Ns/m springDamper1.s_rel0 = 0.2 m springDamper1.s_rel = 0.2 m (true) fixed1.s0 = 0.5 m cosine.freqHz cosine1.freqHz
Spring constant Damping constant Unstretched spring length Relative distance Mass of the sliding mass Spring constant Unstretched spring length Relative distance Mass of the sliding mass Spring constant Damping constant Unstretched spring length Relative distance Constant output value Fixed offset position of housing Frequency of cosine wave
1.2 Complex Models
21
Task 2. Conduct a series of experiments, changing the spring stiffness and damping. If the parameters are changed to: springDamper.d = 3 Ns/m, springDamper. c = 30 N/m, const.k = 25, what is the maximum offset of the mass? Conduct the appropriate experiment and plot the graphs. Part 2: model of a system consisting of two bodies, springs, and dampers Task 3. Switch to a two-mass system. Plot the graphs of the position of the center of mass of both bodies. Task 4. Plot graphs of the velocity of bodies in the selected period, as well as graphs of the offset of each of the springs. Task 5. Conduct a series of experiments, changing the stiffness of the springs and damping. Task 6. Calculate normal and partial oscillation frequencies of each of the bodies. Model the conditions under which oscillations of the bodies will be harmonic. In this case, you can determine the frequency of oscillations directly on the graph and compare them with theoretical values that you obtained for normal frequencies. Check the accuracy of your results using FFT analysis. Part 3: a modified model of a system consisting of two bodies, springs, and dampers Task 7. Investigate the resonance of the mechanical system. Use a computer model of a system with two masses, springs, dampers, and external periodic force. The effect might not be very obvious at first. Try changing the simulation time to run it for longer. You may do this by clicking the Settings tab and changing the Stop Time to 500 s and Solver to CVODES. Draw conclusions from this simulation. Explain the choice of Solver CVODES.
1.2.3
Computer Modeling of Ballistic Pendulum
The purpose of this virtual lab is to check that the conservation laws are satisfied in the model of a mathematical pendulum using a perfectly inelastic collision with a bullet (the problem of a ballistic pendulum). In this virtual lab, you will build a computer model of a ballistic pendulum (as shown in Fig. 1.12) and study the characteristics of the simulated system.
Fig. 1.12 Hybrid model: ballistic pendulum
22
1 Virtual Labs
This experiment allows the indirect (by the magnitude of the deviation of the pendulum from a fixed position) “measurement” the speed of a bullet. If the time of the collision of a bullet with a pendulum is small compared with the period of oscillation of the pendulum, then the pendulum does not have time to noticeably deviate from the initial position during the collision. This means that during the impact, no additional forces arise that tend to return the pendulum to its original position, and in modeling, we can consider the ballistic pendulum as a hybrid model. Learning Objective: • to build a hybrid model of ballistic pendulum. The model of the mathematical pendulum is used as the basic model. Formulation of the problem Let us take a pendulum: a stationary body of mass M on a rigid rod of length l. The body is shot in the horizontal direction by a bullet of mass m from a distance s. When a bullet hits the body, it gets stuck in it, giving the pendulum some initial velocity. As a result, the pendulum deviates and begins to oscillate, as depicted in Fig. 1.13. Comment: This experiment allows indirect (by the magnitude of the deviation of the pendulum from a fixed position) “measurement” the velocity of a bullet. Description of the mathematical model From the point of view of the theory of dynamical systems, the system “mathematical pendulum—bullet” should be treated as hybrid system. In practice, one often has to deal with discrete-continuous models of dynamic systems, which are called hybrid systems. Other names of similar systems are “systems with a variable structure”, “event-driven systems”. The variable structure of the models is due to the presence of slow (continuous) and fast (discrete) processes in the system. Thus, a distinctive feature of the complex behavior of the hybrid system is the set of qualitatively different and successively changing modes of operation. Mode or continuous behavior is called the state of the hybrid system, and mode switching is called discrete actions or events. The execution time of
Fig. 1.13 Dynamic system: ballistic pendulum
1.2 Complex Models
23
discrete actions is not considered. From the point of view of the functioning of the system, they are performed instantly. Hybrid models allow systems to be described in a variety of engineering applications. For example, in mechanical objects, continuous motion can be interrupted or corrected by some physical impact. Thus, in the system “mathematical pendulum—bullet”, a continuous state is a fixed pendulum and a flying bullet. The moment of impact is a discrete event, after which the system begins to move in a new continuous mode of the joint oscillatory process. It is convenient to describe hybrid mathematical models at the design stage using state diagrams (UML standard). The state diagram is a directed graph whose vertices correspond to the states of the system under study, and the edges describe discrete events, that is, transitions from one state to another. There are also two states: initial and final. The initial state is present in any state diagram; the final state may or may not be present in this system. If the time of the collision of a bullet with a pendulum is small compared with the period of oscillation of the pendulum, then the pendulum does not have time to noticeably deviate from the initial position during the collision. This means that during the impact no forces will emerge, seeking to return the pendulum to its original position, and the bullet-pendulum system can be considered as closed. The impact of a bullet, in which it gets stuck in a pendulum, is inelastic. In the case of an inelastic impact, the law of conservation of momentum is satisfied, which for a two-body system has the form: mv1 þ Mv2 ¼ ðM þ mÞv0 Here m is the mass of a bullet, M is the mass of a body, v1 is the bullet velocity before impact, v2 ¼ 0 is the body velocity before impact. v0 is the total initial velocity of the system after the collision. So we get the velocity of the bullet: v1 ¼
Mþm v0 m
Or, knowing the velocity of the bullet, the initial velocity of the “pendulum-bullet” system, after the discrete event named “collision”: m v0 ¼ v1 Mþm We assume that at small distances with a high velocity of the bullet the horizontal component of the velocity is approximately equal to its absolute value (i.e., the vertical displacement of the bullet can be neglected): v1x v1
24
1 Virtual Labs
Fig. 1.14 Ballistic Pendulum state diagram
Then the collision will occur in time: t¼
s v1
We describe the mathematical model of this system in the form of a state diagram (Fig. 1.14). The black circle in the figure indicates the initial state, S1 and S2 are the states (continuous) of the model, T12 is the transition from S1 to S2. The description of states and transitions is given below. Hybrid Ballistic Pendulum Model: State S1 Equations: ( dh ¼ x dt dx ¼ g sin h —dynamic equations of motion of the pendulum l dt x ¼ v1 t—the bullet moves straight Initial conditions: h0 ¼ 0; x0 ¼ 0, the pendulum is resting x0 ¼ s, the bullet starts moving at a distance -s from the origin Transition T12 Discrete event: x ¼ 0, the bullet hits the pendulum The transfer of momentum occurs v0 ¼
m v1 Mþm
The pendulum gets an initial angular velocity: x0 ¼
v0 l
State S2 Equations: ( dh ¼ x dt dx ¼ g sin h —dynamic equations of motion of the pendulum l dt
1.2 Complex Models
25
Initial conditions: h0 ¼ 0—deviation before impact x0 ¼ vl0 —new angular velocity
Comment. Below are the ratios that can be checked when doing virtual lab. For the oscillations of an ideal mathematical pendulum, the law of energy conservation holds: at any time, the sum of the potential and kinetic energy of an oscillating body remains constant. In the process of oscillation, potential energy is converted into kinetic energy and vice versa. At the extreme points of the deviation (the amplitude value h ¼ hmax ) the entire energy of the pendulum is equal to the potential energy. At the equilibrium position h = 0, all the energy is equal to the kinetic, and the velocity of the pendulum is maximum. Kinetic energy is the amount of work that needs to be done to give a particle of mass m a velocity v from a state of rest: 1 T ¼ mv2 2 The potential energy V depends on the height h and the mass of the particle m V ¼ mgh The total work performed by all forces acting on a particle during a certain time interval is equal to the change in the total energy and is defined as U1;2 : 1 U1;2 ¼ DT þ DV ¼ mDv2 þ mgDh 2 where Dv ¼ v2 v1 Dh ¼ h2 h1 Substitute the initial and final values into the expression for changing the total energy of the mathematical pendulum. Since the system is not affected by external forces, this change should be zero: 1 U0;Hmax ¼ m v2Hmax v2 þ mgðhHmax hÞ ¼ 0 2 At the top point vHmax ¼ 0, therefore the velocity immediately after the impact:
26
1 Virtual Labs
v¼
pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2gðhHmax hÞ
And, finally, the velocity of the bullet will be determined by the expression: v1 ¼
M þ m pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2gðhHmax hÞ m
Component modeling Choosing components for a diagram of component model You need to start modeling with an ordinary free pendulum (see Sect. 1.1.2). If we confine ourselves to this, then in animation we will see a sphere. However, to obtain a reasonable model, we need a bullet stuck in a box. Add another Shape component to give the body a rectangular shape by setting the “box” shape and connect this shape to the Body component. As a result, you must get a diagram as shown in Fig. 1.15. The model of a ballistic pendulum can be composed of a pendulum with a box, a spherical body for modeling a bullet, and a Pin component describing a perfectly inelastic impact. Let us analyze this component in more detail. “Pin” is not a standard component of the Planar Mechanic library. The Modelica code is given in Sect. 2.10. Copy it to your computer. In this lab, it models a perfectly inelastic impact of two bodies, being essentially a spring with a damper with very high stiffness and damping. The parameters of stiffness and damping that are recommended in this lab are given in the figure below. In addition, you can choose the direction of the impact and the distance at which the animation takes place. Connect the box and the bullet in the ballistic pendulum model using “Pin”, set the required numerical values. We get the model of the ordinary free pendulum with a bullet approaching it. If the process of modeling is difficult, you can see the diagram of correct model in Sect. 2.10. Fig. 1.15 Reshaping a component—a way to get a box in animation
1.2 Complex Models
27
Setting the initial parameters of the model By now, you should be familiar with the setting of parameters for a simple free pendulum (see Sect. 1.1.2). Comment. The animation of the Body component must be turned off, otherwise you will see both the sphere and the box at the same time. For a box, set the parameters as indicated in Table 1.10. Install the characteristics of a perfectly inelastic impact, as indicated in Table 1.11. Provide the ability to change the velocity of the bullet in the settings window as shown in Fig. 1.16. Now you have two models ready—the ordinary and the ballistic pendulums. Testing and simulation of the model Choose a numerical method and simulate your model. Start the animation with tracing the bullet movement. You will see an animation of a computer model of a ballistic pendulum (the correct diagram is given in Sect. 2.10.) Plotting and graph analysis Task. 1. Explore the ordinary free pendulum. Build the trajectory of its movement. Task 2. Build the dependence of the angle of deviation of the pendulum from the negative Y-axis for different values of the initial velocity. Task 3. Go to the ballistic pendulum model. Build graphs of the trajectory of the box and the graph of its angle of deviation (in degrees °) from the negative Y-axis. Use these graphs to determine the velocity of the bullet.
Table 1.10
Parameter value for box
Parameter values
Description
animation = true shapeType = ”box” r_shape[3] = {− 0.25, 0.12, 0} m
¼ true, if animation shall be enabled Type of shape Vector from frame_a to shape origin, resolved in frame_a Vector in length direction of shape, resolved in frame_a Vector in width direction of shape, resolved in frame_a Length direction of shape Width direction of shape Height direction of shape Color of shape Addition data for cylinder, cone, pipe, gearwheel, and spring Reflection of ambient light (= 0: light is completely absorbed)
lengthDirection[3] = {1, 0, 0} widthDirection[3] = {1, 0, 0} length = 0.5 m width = 0.25 m height = 0.25 m color[3] = {0, 128, 0} extra = 0.0 specularCoefficient = World. defaltSpecularCoefficient
28
1 Virtual Labs
Table 1.11 The characteristics of a perfectly inelastic impact Pin component that describes a perfectly inelastic impact Parameter values Description normal[3] = {1, 0, 0} Normal direction pf the plane, resolved in frame_a animation = true Include animation of supporting plane plane_length = 0.5 m Length of plane visualization kInSurface = 1,000,000 N/ Spring constant of in-plane motion m damping = 100,000 N s/m Dampling of in-plane motion Projectile: Parameters and Initial Values Parameter/Initial values Description animation = true ¼ true, if animation shall be enabled (show cylinder and sphere) r_CM[3] = m Vector from frame_a to canter of mass, resolved in frame_a m = 0.05 kg Mass of rigid body r = 10 m Initial position of projectile u = 230 m/s Initial velocity of projectile rx = r m (true) Initialization of position of projectile ry = − 0.98 m (true) Initialization of position of projectile vx2 = − u m/s (true) Initialization of velocity of projectile
Fig. 1.16 Setting bullet velocity
Task 4. Write the analytical expression for the difference between the initial height and the height at the maximum deviation angle. Dh ¼ hHmax h0 . Express the initial velocity of the pendulum v0 through the maximum deviation angle. Change the initial velocity v0 in the numerical experiment and determine Dh from the graphs to make sure that the derived ratio is correct. Run the animation and check that your conclusions are correct. Task 5. Find at what value of the initial velocity v0 that puts the pendulum in rotation.
1.2 Complex Models
29
Task 6. Use formulas from the theoretical part to get the value of the velocity after the impact and compare it with the value that you determined from the simulation.
1.2.4
Computer Modeling of Newton’s Cradle
The purpose of this virtual lab is to study the process of converting kinetic and potential energy into each other in a mechanical system consisting of a set of pendulums. In this virtual lab, you will build computer model of the Newton’s cradle (Fig. 1.17), simulate the model, and study the characteristics of this dynamic system. Work of this mechanical system visually illustrates the laws of conservation of momentum and energy. In this virtual lab, the behavior of a system of five Newton balls attached to a common fixed position is studied. Learning Objectives: • To build a computer model of a system of contacting pendulums (using the law of conservation of momentum); • To observe the “law of conservation of momentum” for various external influences on the mechanical system. Formulation of the problem There is a Newton’s pendulum (Newton’s cradle), a mechanical system consisting of a set of pendulums with adjacent balls of mass m, suspended on fixed threads of the same length l (Fig. 1.18). If you retract the extreme ball and release it, then its energy and momentum will be transmitted without change through the three middle balls to the latter, which will acquire the same velocity and rise to the same height (in the absence of opposing forces and friction, which is unattainable in real conditions).
Fig. 1.17
N’s cradle
30 Fig. 1.18
1 Virtual Labs N’s Pendulum
Build a mathematical model of the Newton’s pendulum. Description of the mathematical model This experiment demonstrates the process of converting different types of energy into each other: kinetic 1 T ¼ mt2 2 and potential W ¼ mgh: If p is the momentum of the body, m is the mass of the body, v is the velocity of the body, then p ¼ mv. A change in the impulse of a body of constant mass can occur only because of a change in velocity and is always due to the action of force. During the interaction of bodies, the impulse of one body can be partially or completely transferred to another body. If no external forces act on the system of bodies, then system is called closed. The law of conservation of momentum says that in a closed system, the vector sum of the momentum of all bodies remains constant for any interactions of the bodies of this system with each other: m~ v1 þ m~ v2 ¼ m~ v01 þ m~ v02 The result of the collision of two bodies can be fully calculated if their motion before impact and the mechanical energy after impact are known. Usually, one considers either perfectly elastic impact, in which energy is conserved, or energy conservation coefficient k is introduced as the ratio of kinetic energy after impact to kinetic energy before impact when one body strikes a fixed wall made of another body’s material. k is a characteristic of the material from which the bodies are made, and does not depend on the other parameters of the bodies (shape, velocity, etc.).
1.2 Complex Models
31
In a real collision of bodies, intermediate variants are observed between the case of an perfectly elastic impact—a rebound, and the case of an perfectly inelastic impact—the adhesion of the colliding bodies. The degree of impact in the case of perfectly elastic impact is characterized by the recovery coefficient k. With k = 0, the impact is perfectly inelastic, with k = 1, the impact is perfectly elastic. Let u1 , u2 be the velocities of the bodies before the impact, v1 , v2 the velocities of the bodies after the impact, and k the recovery coefficient, S is the total impact impulse. Then: m1 ð u1 u2 Þ m1 þ m2 m1 ð u1 u2 Þ v 2 ¼ u2 þ ð 1 þ k Þ m1 þ m2 m1 m2 ð u1 u2 Þ S ¼ ð1 þ k Þ m1 þ m2
v1 ¼ u 1 ð 1 þ k Þ
Loss of kinetic energy T on impact: m1 m2 ðu1 u2 Þ2 T ¼ 1 þ k2 m1 þ m2 2 Newton’s pendulum is designed so that the initial ball transfers impulse to the second ball, and then freezes. At first glance, our eye does not notice how the next ball takes momentum from the previous one; we cannot trace its velocity. But, if you take a closer look, you can see how the ball “shudders” a little. This is explained by the fact that it makes movements with the velocity sent to it, but since the distance is very small, it has nowhere to accelerate, it can transfer impulse to the third ball and eventually stop. The next ball performs the same action, etc. The last ball has nowhere to transmit its impulse, so it oscillates freely, rising to a certain height, and then returns, and the whole process of impulse transmission repeats in the reverse order. From the point of view of modeling the Newton pendulum as a dynamical system, we again get a hybrid system, much more complex than in the previous case. This is due to the assumption that the intermediate balls do not have time to change their position, dynamic simulation of the transfer of momentum becomes very difficult. Here Hertz’s theory can come to the rescue by proposing to model an impact as compression using some “pseudo-springs”. We place imaginary “pseudo-springs” between the balls with given elastic coefficients ki and damping coefficients bi. To complicate the problem, we assume that the elasticity of the balls can be different, hence the different values of the elastic coefficients. In addition, we allow energy loss, so we introduce damping. Based on the above reasoning, we construct a state diagram of the hybrid model of the mechanical system (Fig. 1.19). Description of states and transitions is given below.
32
1 Virtual Labs
Fig. 1.19 The state diagram of the Newton pendulum
Newton’s Pendulum Hybrid Model: State S1 Equations: 8 dh1 ¼ x < 1 dt —dynamic equations of motion of the first pendulum : dx1 ¼ g sin h1 l dt
Initial conditions at the initial moment: h10 ¼ a; x10 ¼ 0—we lift the first pendulum to a given angle and let it go hi0 ¼ 0; xi0 ¼ 0; i ¼ 2; 3; 4; 5—the other pendulums are at rest Initial conditions пocлe пepexoдa T21: h10 ¼ 0; x10 ¼ vl1 —the first pendulum begins to move with acquired velocity hi0 ¼ 0; xi0 ¼ 0; i ¼ 2; 3; 4; 5—the other pendulums are at rest Transition T12 Discrete event: h1 ¼ 0—the first ball touches the second In this case, the first pendulum gains velocity v1 ¼ lx1 . Initial conditions for the state S2: v1 ¼ lx1 —the first pendulum has a velocity obtained while moving down vi ¼ 0; i ¼ 2; 3; 4; 5—the other pendulums are at rest State S2 It is necessary to solve the system of differential equations for five balls connected by “pseudo-springs” (we use the second Newton law as equations): 8 > m1 ddvt1 ¼ Aðx1 x2 Þ B1 v1 > > > > > > m dv2 ¼ Aðx1 x2 Þ Cðx2 x3 Þ B2 v2 > < 2 dt m3 ddvt3 ¼ C ðx2 x3 Þ Dðx3 x4 Þ B3 v3 > > > > m4 dv4 ¼ Dðx3 x4 Þ E ðx4 x5 Þ B4 v4 > > dt > > : m5 ddvt5 ¼ E ðx3 x4 Þ B5 v5 Initial conditions depend on which transition (T12 or T32) lead to this state
1.2 Complex Models
33
Transition T23 Discrete event: v5 6¼ 0—at the moment the fifth ball starts to move, it ceases to “feel” the pseudo-spring and begins to move like a mathematical pendulum with a given initial velocity. The fifth pendulum acquires angular velocity x50 ¼ vl5 State S3 Equations: 8 dh5 ¼ x < 5 dt —dynamic equations of motion of the fifth pendulum : dx5 ¼ g sin h5 l dt
Initial conditions: h50 ¼ 0; x50 ¼ vl5 —the fifth pendulum begins to move with acquired velocity hi0 ¼ 0; xi0 ¼ 0; i ¼ 1; 2; 3; 4—the other pendulums are at rest Transition T32 Discrete event: h5 ¼ 0—the fifth ball touches the fourth In this case, the fifth pendulum gains velocity v5 ¼ lx5 . Initial conditions for the state S2: v5 ¼ lx5 —the first pendulum has a velocity obtained while moving down vi ¼ 0; i ¼ 1; 2; 3; 4—the other pendulums are at rest Transition T21 Discrete event: v1 6¼ 0—at the moment when the fifth ball starts to move, it ceases to “feel” the pseudo-spring and begins to move like a mathematical pendulum with a given initial velocity. The fifth pendulum acquires angular velocity x10 ¼ vl1 .
Comment: Stiffness and damping coefficients are choosing experimentally and will be recommended to students in the process of performing work in the study of the special component of the “pseudo-spring” Pin. If the coefficients are chosen correctly, then when you visualize the movement of this hybrid system, you will see the last ball rise to the same height to which you took the first one. This model is quite universal, it allows you to conduct experiments with different balls, change the number of balls and explore the processes of energy loss during collisions. Component modeling Choosing components for a diagram of component model You need to start modeling with simple free pendulum (see Sect. 1.1.2). Now it is necessary to build a component model of a pendulum system consisting of five identical pendulums (balls on rigid rods) touching each other.
34
1 Virtual Labs
Note. While simulating, one of the outside balls can be retracted at a certain angle and released. In this case, the force of gravity will return it to the neutral position, which will lead to its collision with the next ball. Elastic collision between balls is modeled as a “spring with a damper” using the Pin component (see previous lab). Pin models the elastic impact of two bodies, being essentially a spring with a damper with a very high stiffness and low damping. The component model of the Newton pendulum can be made up of five ordinary free pendulums (that is, you need five components Fixed, Revolute, FixedTranslation, Body), with the addition of four components describing the elastic collision “Pin”. Connecting all the above components correctly, you will get the “Newton cradle” dynamic model. If the process of modeling is difficult, you can refer to the diagram of correct model in Sect. 2.11. Setting the initial parameters of the model To create fixed points located on a horizontal rod, you need five Fixed components. Place the fixed points along the X-axis 5 cm from each other. This means that in the parameters field you need to set coordinates {0, 0, 0} to the first point, i.e. put it at the origin. The second point set the coordinates {0.05, 0, 0} and so on, with a step of 0.05. For the component Revolute, you need to specify the axis of rotation by the vector {0, 0, 1}. For the FixedTranslation component, you need to set the direction by the vectors {0, −0.5, 0}, which means that you took identical rods 0.5 m long and arranged them along the negative direction of the y-axis. For the Body component (for the first experiment) you need to take balls of the same mass m = 1 kg. The “Pin” component in this lab models the elastic impact of two bodies, being essentially a spring with a damper with a very high stiffness and low damping (compare the characteristics of this component with the one specified in a previous lab to describe an absolutely inelastic collision of a pendulum with a bullet). The parameters of stiffness and damping that are recommended in this work are shown in Table 1.12. Setting the damping parameter to zero is necessary to simulate an perfectly elastic impact. Table 1.12
Extra component Pin
Parameter/Initial values
Description
normal[3] = {1, 0, 0} animation = true plane_length = 0.5 m kInSurface = 1,000,000 N/m damping = 100,000 N s/m mu_static = 0.3 mu_dynamic = 0.3 thickness = 0.001 contact = false ()
Normal direction pf the plane, resolved in frame_a Include animation of supporting plane Length of plane visualization Spring constant of in-plane motion Dampling of in-plane motion
1.2 Complex Models
35
Testing and simulation of the model Choose a numerical method and simulate your model. You will see an animation of a computer model of the Newton pendulum (the correct diagram is given in Sect. 2.11.) Plotting and graph analysis Task 1. Check the law of conservation of energy in the system in the case of a perfectly elastic impact by plotting the kinetic energy, potential energy, and total energy. Explain what you are observing. Run the animation in real-time and make sure that your assumptions about the nature of the motion of the Newton pendulum are correct. Task 2. Change the simulation settings in the Simulation Center window. The damping parameter affects the value of the total energy that is lost due to friction when the balls collide with each other. Set the damping parameter to 1000 N s, which physically means that part of the energy is lost in the collision process. Task 3. Conduct a series of experiments: change the damping parameter to see how it affects the behavior of the system. Note. To perform Tasks 2 and 3 switch to the Parameter tab on the left in the Experiment Browser. Scroll down to the damping parameter and change its value to 1000 by typing into the box to the right of the parameter: see Fig. 1.20. Perform an experiment for a modified parameter damping value. Task 4. Plot the deflection angles, velocities, and accelerations of the balls as a function of time, as well as the trajectories of the balls for a perfectly elastic impact, and explain what you observe. Task 5. Investigate the motion characteristics of the Newton’s cradle with different masses of balls. To do this, you need to draw trajectories and plot the velocities of different balls in the Newton cradle.
Fig. 1.20 Change the numeric value of the parameter damping
36
1.2.5
1 Virtual Labs
Computer Modeling of Rotational Motion of Bodies
The purpose of this virtual lab is to develop a component model and study the characteristics of a dynamic system of rotating balls. You will build computer models of dynamic systems consisting of bodies rotating around an axis, simulate the model and study the characteristics of this dynamic system. Learning Objectives: • To build component models for mechanical systems with rotating elements. Formulation of the problem Consider a mechanical system consisting of two balls of mass m fixed on the ends of two horizontal rods attached symmetrically and rigidly at an angle b to the vertical axis (rod). The balls are located at equal distances r0 from the vertical axis. Rods with balls rotate around a vertical axis with an angular velocity x0, Fig. 1.21. Lab includes three tasks., see Fig. 1.21. Task 1. Dynamic system A. The mechanical system consists of two balls attached to the ends of two horizontal rods attached symmetrically and rigidly at an angle b = 90° to the vertical axis (rod). The balls are at equal distances from the vertical axis. The rods with the balls rotate around a vertical axis with a given angular velocity. Task 2. Dynamic system B. The mechanical system consists of two balls attached to the ends of two horizontal rods attached symmetrically and rigidly at an angle b 6¼ 90° to the vertical axis (rod). The balls are at equal distances from the vertical axis. The rods with the balls rotate around a vertical axis with a given angular velocity. Task 3. Dynamic system C. The mechanical system of task 1 lies on the horizontal plane (there is no vertical rod). There are two weightless rods and only one ball with a mass m1, fixed at the end of one of the rods. The rods have the same length and are attached at one end to a revolute joint that allows them to rotate. There is no friction between the ball and the plane during rotation. Another ball with mass m2 moves from some point located at a given distance s from the free end of the second rod at a speed v2 and flies on its free end. As a result, the mechanical
a
b
c
Fig. 1.21 Dynamic systems: mechanical systems A, B, C with bodies rotating about an axis
1.2 Complex Models
37
system begins to perform a rotational motion relative to the revolute joint fastening of the two rods. For the listed mechanical systems A, B, and C, it is necessary to find the laws of their motion. Description of the mathematical model Let a body with the moment of inertia I ¼ mr 2 rotate as a perfectly rigid body with respect to some axis, then the angular momentum of this body is defined as: H ¼ Ix ¼ mxr 2 _ ,where x ¼ h—its angular velocity, h—angular displacement of the body. In the inertial frame of reference, external forces such as gravity, normal reaction act on the balls. They do not create a torque about the vertical axis. Consequently, the angular momentum remains constant H ¼ const when the distance between the ball and the axis of rotation changes (true in the absence of friction in the axis of rotation). Since the distance from the axis of rotation to each of the balls in models A and B can be calculated as r sin b, then the constant momentum is determined by the expression: _ 2 sin2 b H ¼ mhr Then the equation of rotational motion of the body (for models A and B) can be written as: dh H ¼ dt mr2 sin2 b We consider that if the written equation is true for a body on the right side, then for the left body of the same mass with the position—r0 , the formula will be similar. Then if we designate the current angular coordinate of the right ball as h1 , and the current angular coordinate of the left one as h2 , the mathematical model of the mechanical system will look like: Model of rotational motion: dh1 H ¼ 2 2 dt mr sin b h1 ð 0Þ ¼ 0 dh2 H ¼ 2 2 dt mr sin b h2 ð0Þ ¼ p
38
1 Virtual Labs
Fig. 1.22 State diagram of the mechanical system C
Let us turn to model C. The free ball begins to move uniformly and straight in the direction perpendicular to the rod from a distance x ¼ s to the free end of the rod (x ¼ 0Þ. When the coordinates of the ball and the end of the rod coincide, a discrete event occurs, a “collision” at which the impulse of the incident-free ball is transferred to the rod with a fixed ball. The law of conservation of momentum for the projections of velocities on the coordinate axis, directed along the velocity of the free ball before impact, can be written in the form: m2 v2 ¼ m2 u2 þ m1 u1 ; where v2 is the linear velocity of the free ball before the impact, u2 is the linear velocity of the free ball after the impact, and u1 is the linear velocity of the ball fixed on the rod after the impact (equal to the linear velocity of the free end of the rod). Modeling this system, we assume that the impact in the general case is central and elastic. Since the “rod-fixed ball” system is hinged, the momentum it receives from the incident ball causes the system to rotate with the initial linear velocity, u1 . Construct a state diagram of the hybrid model of the mechanical system C (see Fig. 1.21). The description of the states and the transition of the state diagram are given in Fig. 1.22. Hybrid model of impact: State S1 Equations: dh ¼ x—rotation of the first (fixed on the rod) ball dt x ¼ v2 t—the second (free) ball moves in a straight line Initial conditions: h0 ¼ 0; x0 ¼ 0—the first ball is resting x0 ¼ s—the second ball starts moving from a distance s Transition T12 Discrete event: x ¼ 0—the impact of the second (free) ball and the free end of the rod. With this the transfer of momentum occurs:
1.2 Complex Models
39
m2 v2 ¼ m2 u2 þ m1 u1 The first (fixed on the rod) ball acquires an initial angular velocity: x1 ¼
u1 r
State S2 Equations: dh ¼ x—rotation of the first (fixed on the rod) ball dt Initial conditions: h0 ¼ 0—deviation at the moment of impact did not occur x1 ¼ ur1 —new angular velocity
Component modeling Model A: Rotating balls You will begin by modeling the behavior of a dynamic system of rotating balls. Choosing components for a diagram of component model The model you need to build should consist of the components specified in Table 1.13. Properly connecting all above components, you will get a dynamic system model A. The model should consist of a revolute joint with two bodies attached to it. To do this, attach two FixedTranslation components with the Bodies horizontally and one FixedTranslation component for the vertical axis to the Revolute. If the process of modeling is difficult, you can refer to the diagram of correct model in Sect. 2.12.
Table 1.13 The model components Library
Name of the class
Quantity and short description
modelica://PlanarMechanics modelica://PlanarMechanics. Parts modelica://PlanarMechanics. Joints. modelica://PlanarMechanics. Parts. modelica://PlanarMechanics. Parts.
PlanarWorld Fixed
1 fixed coordinate system 1 fixed point
Revolute
1 plane revolute joint
FixedTranslation
3 rigid vertical rods and two horizontal rods 2 rigid body
Body
40
1 Virtual Labs
Setting the initial parameters of the model At the bottom of the screen in the diagram view, check that the initial settings of the components are correct. Recommended parameter values are given in Table 1.14. Set the parameters you can change in the model. One of them is the radius r, which must be changed in this task. Set its initial value. You can leave the values of the other parameters “by default”. It is recommended to set the following initial values for the velocities of the balls as per Table 1.15. Testing and simulation of the model Choose a numerical method and simulate your model. You will see an animation of a computer model A (the correct diagram is given in Sect. 2.12). Plotting and graph analysis Task 1. Fill in Table 1.16 by simulating model for all the values for r (Note: You should change this parameter in SystemModeler). Model B: Rotating balls In the framework of the created computer model, you need to investigate the effect of the junction of the rods to the vertical axis of rotation on the characteristics of a dynamic system. Choosing components for a diagram of component model To investigate the influence of the junction angles of rods to the vertical axis of rotation, create another model (B). In this model, attach two horizontal rods to the vertical stand (rod) using Revolute joint, which will ensure rotation in the horizontal plane. The list of the components that you need is given in Table 1.17.
Table 1.14 Setting parameters of computer model components Component
Parameter values
Description
fixedPoint body1 body2 revolute1 revolute1.w
r[3] = {0,0,0} m m = 5 kg m = 5 kg n = {0, 1, 0} W
beta r
90° R
fixedTranslation1
r = {0, −r * cos(beta), −r * sin(beta)} r = {0, −r * cos(beta), r * sin(beta)} r = {0, 1, 0} g[2] = planarWorld. g m/s^2
Point at the origin Mass of the first ball Mass of the second ball Rotation relative to the selected axis Angular rotation velocity (can be changed during the experiment) The angle of attachment of horizontal rods Variable distance from the center to the mounting of balls on horizontal rods First horizontal rod
fixedTranslation2 fixedTranslation3 PlanarWorld
Second horizontal rod Vertical stand (rod) Acceleration of gravity
1.2 Complex Models
41
Table 1.15 Setting the initial values of the parameters Parameter values
Description
vx1(start = − 2, fixed = true) = body1. v_0[1] vz1(start = − 2, fixed = true) = body1. v_0[3]
Initial speed in the plane of rotation in the X-direction Initial speed in the plane of rotation in the z direction
Table 1.16 Values of the parameter r r
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
x Table 1.17 The model components Library
Name of the class
Quantity and short description
modelica://PlanarMechanics modelica://PlanarMechanics. Parts modelica://PlanarMechanics. Joints. modelica://PlanarMechanics. Parts. modelica://PlanarMechanics. Parts.
PlanarWorld Fixed
1 fixed coordinate system 1 fixed point
Revolute
3 plane revolute joints
FixedTranslation
3 rigid vertical rods and two horizontal rods 2 rigid body
Body
Connecting all above components, you will get a dynamic system model B. You can see the diagram of correct model in Sect. 2.12. Setting the initial parameters of the model Set the parameters of the components as per Table 1.18 to study the rotation of balls with different masses on rods rotating at an angle to the horizontal. You can leave the values of the other parameters “by default”. Testing and simulation of the model Choose a numerical method that you will use and simulate your model. You will see an animation of a dynamic model B, the correct diagram is given in Sect. 2.12. Plotting and graph analysis Task 2. Fill in Table 1.19 by simulating model for all the values for b (Note: You should change this parameter in SystemModeler). Plot the angular velocity. Animate your model if you are curious about how it looks.
42
1 Virtual Labs
Table 1.18 Setting parameters of computer model components Component
Parameter values
Description
fixedPoint body1 body2 revolute1 revolute1.w
r[3] = {0,0,0} m m = 5 kg m = 10 kg n = {0, 1, 0} W
revolute2 revolute3 r
n = {1, 0, 0} n = {1, 0, 0} 0.6
fixedTranslation1
r = {0, −0.6 * cos (theta), 0.6 * sin (theta)} r = {0, −0.6 * cos (theta), −0.6 * sin (theta)} r = {0, 1, 0} r[2] = {0, − 1} m
Point at the origin Mass of the first ball Mass of the second ball Rotation relative to the selected axis angle rotation velocity (can be changed during the experiment) Rotate the first horizontal rod Rotate the second horizontal rod distance from the center to the mounting of balls on horizontal rods First horizontal rod
fixedTranslation2
fixedTranslation3 pendulum
pendMass pendMass pendMass
Second horizontal rod
Vertical stand (rod) Vector specifying the length and direction of the rod relative to the fixed point when deviating from the vertical phi = 0 Mass of a body Moment of inertia of the body Acceleration of gravity
m = 5 kg I = 0.001 kgm^2 g[2] = planarWorld. g m/s^2
Table 1.19 Values of the parameter b b x
90
80
70
60
50
40
30
20
10
rad rad=s
Task for individual research (high complexity). In models A and B, it is assumed that there is an external force keeping the rods at their designated angle, which greatly simplifies the description of their motion. If the rods do not have this external force and have another degree of rotation, the motion will be a lot more complicated. Evaluate the previous cell to see how that would look like. Right-click in the animation to trace the trajectories. Model C: Ball and rod collision Let a ball of mass m = 5 kg be fixed at the end of the rod. The system is located on a plane without friction. Another ball with the same mass moves at a velocity of v = 10 m/s and hits the opposite end of the rod, setting it in motion. The rod is weightless; the rod length is l = 1.2 m. The system (C) is shown in Fig. 1.21.
1.2 Complex Models
43
A component model can be built using a mechanical system model (A), but without a rod, while simulating the interaction of a free (projectile) ball with the rod end can be performed using the contact component Pin (refer to the two previous labs). Choosing components for a diagram of component model Pin component in this lab simulates the collision of two bodies, being essentially a spring with a damper with high stiffness and damping. The stiffness and damping parameters are given in the next section. In addition, you can choose the distance from which the free ball begins to move in the direction of the free end of the rod. Connect the horizontal rod and the ball in the collision model using this component, setting the required numerical values of the parameters. Create a copy of Model A, remove the vertical stand, and insert the Pin element between the free rod and the body. Connecting all above components, you will get a dynamic system model C. You can see the diagram of correct model in Sect. 2.12. Setting the initial parameters of the model Provide the ability to change the characteristics of a “projectile” ball in a computational experiment, Table 1.20. Set the parameters of the contact element Pin, Table 1.21. Please note that the kInSurface and damping parameters should have large numeric values (which will correspond to a perfectly elastic impact). Testing and simulation of the model Choose a numerical method and simulate your model. You will see an animation of dynamic model C; see Fig. 1.21. Plotting and graph analysis Task 3. Build trajectories of rotating and projectile balls on the same graph. Conduct a series of experiments, changing the mass of the two balls. Conduct a second series of experiments, changing the initial velocity of the projectile ball. Task 4. Plot graphs of the angular velocity of the rotating ball and the velocity of the projectile ball before and after the collision for the series of experiments above. Task 5. Find the change in angular momentum caused by the impact. Task 6. Use graphs of the velocity to calculate the impulse change at 10 m/s. What kind of collision is this?
Table 1.20
Setting the parameters of the body2 component (projectile ball)
Parameter/Initial values
Description
u = 10 m/s rz = 0.6 m (true) rx = − 0.98 m (true) vx2 = u m/s (true)
Velocity of free moving body Initialization of position of free moving body Initialization of position of free moving body Initialization of velocity of free moving body
44
1 Virtual Labs
Table 1.21
Setting the parameters of the Pin component
Parameter values
Description
normal[3] = {1, 0, 0} animation = false plane_length = 0.5 m kInSurface = 100,000 N/m damping = 100,000 Ns/m mu_static = 1 mu_dynamic = 1 thickness = 0.001
Normal direction pf the plane, resolved in frame_a Include animation of supporting plane Length of plane visualization Spring constant of in-plane motion Dampling of in-plane motion
Fig. 1.23 Elliptic pendulum
1.2.6
Computer Modeling of Elliptic Pendulum
The aim of the work is to study the motion of bodies in non-inertial reference systems. In this virtual lab, you will build a computer model of dynamic system: elliptic pendulum (Fig. 1.23), simulate the model, and study the characteristics of this dynamic system. Comment. When describing a motion, a point of origin is required. In many problem formulations, the origin is chosen to simplify the problem and in some cases, the point of origin is moving. This results in a moving reference system used to express another motion. This can complicate calculations and will be examined in this virtual lab. Motion cannot be described if it is not described relative to something, a position cannot be expressed if there is no origin that it is relative to. This is what is called a reference system, and it can be expressed in different ways (rectangular coordinates, polar coordinates). In early mechanics, the motion is always described in relation to a static reference system, but in more complicated problem formulations, the reference system is in motion too. The challenge is to describe both the motion of the reference system in relation to a static reference system, and then the motion of a particle in relation both to the moving reference system and the static reference system. The motion of the particle is relative to the motion of the moving reference system. Learning Objectives: • To build computer models of moving bodies in moving reference systems.
1.2 Complex Models
45
Formulation of the problem A simple pendulum hangs from a car with mass m1 moving without friction along a track. The car moves with a constant transitional acceleration a0 and the pendulum with mass m2 starts at an initial angle h ¼ 0 from the vertical. Your task is to determine the tension in the supporting rod of length l of the pendulum, T. Note. When the mechanical system moves, the tension force of the rod changes, which leads to a change in both the restoring force and, consequently, the frequency and oscillation period of the pendulum. Description of the mathematical model The equation of motion in a non-inertial reference frame without rotation can be represented as: X F ¼ mða0 þ arel Þ; where arel is the acceleration of the body relative to the non-inertial reference system and a0 is the transitional acceleration of the body. Thus, the acceleration of the body a is composed of arel the acceleration of the body relative to the car and a0 ; the acceleration of the car itself: a ¼ a0 þ arel The velocity of the body can also be decomposed into relative and transitional velocities. We build a model of this system in generalized coordinates. The generalized coordinates of a dynamic system are defined as the minimum group of parameters which can completely describe the motion of the system. Additionally, the generalized coordinates must be able to express the kinetic and potential energy of the system with respect to an inertial frame of reference. The generalized coordinates can be defined as, 0
1 q1 B q2 C C q¼B @ : A qn where n is the number or generalized coordinates of the system. Additionally, the number of independent generalized coordinates is defined as the degrees of freedom of the system. We introduce the generalized forces Qext , acting on a system as the value of the coefficient of variation of the generalized coordinate in the terms of virtual work. At the same time, there is a simple connection between the generalized force and the _ In addition, we note that generalized forces are generalized impulse: Qext ¼ p. divided into potential (for example, gravity) Qpext , and non-potential (applied external force, traction force, or friction force) Qnext :
46
1 Virtual Labs
Qext ¼ Qnext þ Qpext To formulate the Lagrange’s Equation, the Lagrangian Lðq; q_ Þ of the system must be defined, Lðq; q_ Þ ¼ T ðq; q_ Þ W ðqÞ where, T ðq; q_ Þ is the kinetic energy of the system; W ðqÞ is the potential energy of the system. The Lagrange equation is given by, d @Lðq; q_ Þ @Lðq; q_ Þ ¼ Qnext dt @ q_ @q A force Qpext , acting on a mass with coordinates P(q), is called potential if there is such a function W = W(q), such that the coordinates of the force hold Qpext ¼
@W ; @q
where W is the potential energy of the mass P. Potential force in our mechanical systems is gravity. The potential energy of a rigid body in the field of gravity is W = mgy, where y is the coordinate of the center of mass of the rigid body in a fixed coordinate system, the Y-axis is directed opposite to the gravity. Finally, we obtain the second order Lagrange equations: _ _ d @Tðq; qÞ @Tðq; qÞ ¼ Qext dt @ q_ @q Note also that if the dimension of qi is length, then Qext is length; if the dimension of qi is angle (dimensionless value), then Qext has the dimension of the moment of force. The steps to obtain the Lagrange’s equation can be summarized as, • • • • •
Define the generalized coordinates. Calculate the kinetic and potential energy: T ðq; q_ Þ and V ðqÞ Calculate the Lagrangian Lðq; q_ Þ Define the External applied forces: Qext Use Lðq; q_ Þ and Qext to obtain the Lagrange’s equation expression.
The PendulumCar model has two degrees of freedom and is in the field of gravity. Let us take as the generalized coordinates q1 ¼ y, the displacement of the car from the origin, and q2 ¼ h the deflection angle of the rod from the vertical as illustrated in Fig. 1.24. The kinetic energy of the system is the sum of the kinetic energy of the car and pendulum:
1.2 Complex Models
47
Fig. 1.24 Dynamic system: elliptical pendulum
1 1 T ¼ T1 þ T2 ¼ m1 y_ 2 þ m2 v22 ; 2 2 here v2 is the absolute velocity of the body: v2 ¼ v0 þ vrel : Considering that _ v0 ¼ y_ ; vrel ¼ lh; find _ y2l cos h v2 ¼ l2 h_ 2 þ y_ 2 þ h_ Then for kinetic energy we get: 1 1 _ y cos h T ¼ T1 þ T2 ¼ ðm1 þ m2 Þ_y2 þ m2 l2 h_ 2 þ m2 lh_ 2 2 Potential energy can be calculated as: W ðqÞ ¼ m2 gl cos h Thus, the Lagrangian of the system will have the form: 1 1 _ y þ g cos h L ¼ ðm1 þ m2 Þ_y2 þ m2 l2 h_ 2 þ m2 l h_ 2 2
48
1 Virtual Labs
We write the first Lagrange equation: @L ¼ ðm1 þ m2 Þ_y þ m2 lh_ cos h @ y_ @L ¼0 @y so, i d @L d h ¼ ðm1 þ m2 Þ_y þ m2 lh_ cos h ¼ 0 dt @ y_ dt Let us write the second Lagrange equation: @L ¼ m2 l2 h_ þ m2 l_y cos h @ h_ @L _ y þ g sin h ¼ m2 l h_ @h
d @L _ y sin h ¼ m2 l2 €h þ m2 l€y cos h m2 lh_ dt @ h_ so, m2 l2 €h þ m2 l€y cos h þ m2 lg sin h ¼ 0 As a result, we obtain a system of equations describing the motion of the system. Model of an elliptical pendulum: i dh ðm1 þ m2 Þ_y þ m2 lh_ cos h ¼ 0 dt l€h þ €y cos h þ g sin h ¼ 0
Note. Before performing this lab, it is useful to solve the following problem analytically. Determine the tension in the supporting rod, which occurs in the process of oscillation of the pendulum, with uniformly accelerated movement of the car as shown in Fig. 1.25. To solve the problem, it is necessary to return from the Lagrange equations to the equation of motion in the form of Newton’s second law. Having considered the forces acting on the pendulum, and decomposing them into normal and tangential components, one should clearly write down the tension in the supporting rod. In a virtual lab, you will “measure” this force experimentally. It will be useful to compare the results of the computational experiment with the theoretical ones.
1.2 Complex Models
49
Fig. 1.25 To the problem of determining the tension in the supporting rod
Component modeling Choosing components for a diagram of component model We will separately model the car and the pendulum. The car simulation is a simulation of linear motion with acceleration. We assume that the car begins its movement from some fixed point a, for which we use the Fixed component. Connect it with the Prismatic component, which will simulate the movement of the car (connected to point b) in a straight line along the x axis. At the beginning, points a and b coincide, then point b (connected with the car) begins to move to the right according to a certain law. Connect component Accelerate to the Prismatic. It will move the point b in which the cart is located, with the pre-determined acceleration. Acceleration a(t) can be specified by the Pulse signal of the Modelica.Blocks.Source library. The Body can be used as a car model. The components needed to model the car are listed in Table 1.22. Table 1.22 The model components Library
Name of the class
Quantity and short description
modelica://PlanarMechanics
PlanarWorld
modelica://PlanarMechanics.Parts modelica://Modelica.Mechanics.MultiBody. Joints modelica://Modelica.Mechanics.Translational. Sources modelica://Modelica.Blocks.Sources modelica://PlanarMechanics.Parts. modelica://Modelica.Mechanics.MultiBody. Visualizers
Fixed Prismatic
1 fixed coordinate system 1 fixed point 1 prismatic rod
Accelerate
1 acceleration
Pulse Body FixedShape
1 input signal 1 car 1 visualization of car as a box
50
1 Virtual Labs
Assemble the listed components to build a model of accelerated motion. Let us turn to the modeling of the pendulum. You already know this component model. As usual, you take one Revolute, modeling plane revolute joint, one FixedTranslation, modeling a rod and one Body, modeling a rigid body. To measure the tension force of the pendulum thread it is necessary to add a CutForce sensor to the pendulum model, which measures the force applied between two given points from the library modelica://Modelica.Mechanics. MultiBody.Sensors. It must be placed between the mass and the rod. By connecting all components (car and pendulum with a thread tension sensor), you will get a model of the dynamic system “elliptic pendulum”. You can see the diagram of correct model in Sect. 2.13. Setting the initial parameters of the model A simple pendulum hangs from a car moving without friction along a track. The car moves with a constant transitional acceleration a0 ¼ 1 m=s and the pendulum starts at an initial angle h = 0 from the horizontal and a mass m = 0.5 kg. At the bottom of the screen in the diagram view, check that the initial settings of the components are correct. Recommended parameter values are given in Table 1.23. Prismatic simulates the movement of the car in a straight line along the x axis, which is determined by the choice of the vector {1, 0, 0}. At the beginning, points a and b coincide, then point b begins to move to the right according to a certain law.
Table 1.23 Setting parameters of computer model components Component
Parameter values
Description
fixed1 body1
r[3] = {0,0,0} m m = 1 kg animation = false
fixedShape1
body2 revolute1
shapeType = “box” length = 0.5, width = 0.25, height = 0.25, color = {0, 128, 0}, r_shape = {− 0.25, 0.12, 0} m = 0,5 kg n = {0, 0, 1}
Fixed point Mass of the car, animation must be disabled Visualization parameters of the car as a box
fixedTranslation1
r = {− 1, 0, 0}
accelerate1
useSupport = true
pulse1 PlanarWorld
amplitude = a0, period = 20, nperiod = 1) g[2] = planarWorld.g m/s^2
Mass of a body Rotation relative to the selected axis Pendulum rod pointing down The ability to change the acceleration of the car Pulse parameters Acceleration of gravity
1.2 Complex Models
51
To ensure uniformly accelerated motion, you need to select a Pulse signal with an amplitude of a0 = 1 m/s2 and a period of 20 s in the Modelica.Blocks.Source library and feed it to the input of the Accelerate component. Set the mass parameter of the car (Body1) m = 1 kg. In the animation, you will see a car in the form of a ball. Add fixedShape component to give the body a rectangular shape by setting the shape to “box”. The recommended dimensions are shown in Table 1.23. When modeling a free pendulum, set the same parameters of the components as in previous labs, as listed in Table 1.23. You can put the values of other parameters “by default”. It is recommended to set the following initial value of acceleration a0 = 1. Testing and simulation of the model Choose a numerical method that you will use simulating your model and simulate your model. You will see an animation of a computer model of an elliptical pendulum (the correct diagram is given in Sect. 2.13.) Plotting and graph analysis Task 1. Build a graph of the tension force of the thread depending on the time for a given acceleration of the car. Repeating the experiment at various accelerations to make a conclusion about the dependence T ða0 Þ. Present results on one graph. Compare the results with those calculated analytically. Task 2. Build a graph of the tension force of the thread depending on the time for a given mass of a body. Repeating the experiment at various masses to make a conclusion about the dependence T ðmÞ. Present results on one graph. Compare the results with those calculated analytically. Task 3. Build a graph of the tension force of the thread depending on the time for a given mass of a car. Repeating the experiment at various masses to make a conclusion about the dependence T ðM Þ. Present results on one graph. Compare the results with those calculated analytically. Task 4. Build a graph of the tension force of the thread depending on the time for a given length of a thread. Repeating the experiment at various lengths to make a conclusion about the dependence T ðlÞ. Present results on one graph. Compare the results with those calculated analytically. Task 5. Conduct a series of computational experiments to obtain the trajectory of the elliptic pendulum, depending on the length of the pendulum and the masses m and M.
1.2.7
Computer Modeling of Coupled Pendulum System
The purpose of this virtual lab is to build a component model and study the characteristics of the dynamic system of two mathematical pendulums, with masses connected by a spring, as shown in Fig. 1.26. To build a mathematical model of coupled pendulums, “basic” models mathematical and spring pendulums are used.
52
1 Virtual Labs
Fig. 1.26 Physical system of two pendulums connected to each other by a spring (coupled pendulum)
Learning Objectives: • To conduct a qualitative analysis of the models of mechanical oscillatory systems; • To explore time dependencies characterizing dynamic processes and analyze phase diagrams. Formulation of the problem Two pendulums with masses m1 and m2 are fixed at points of different length with suspension lengths l1 and l2, as shown in Fig. 1.26. The pendulum masses are connected by a weightless spring with stiffness k. As an additional difficulty to the model, we can assume that different external forces F1 and F2 can act on each of the masses. Figure 1.27 shows the diagram of the considered mechanical system. Description of the mathematical model Two pendulums with length l1 and l2 are connected by a weightless spring of stiffness k. The spring connects masses m1 and m2. When the pendulums move in the same vertical plane, the state of such a system is completely described by two independent parameters, the angles h1 and h2 denoting the deviations of the pendulums from the vertical, i.e. the system has two degrees of freedom. The equation of motion for each pendulum can be obtained from the general equation of the dynamics of rotational motion around a fixed axis:
Fig. 1.27 Dynamic system: Two pendulums connected by a spring
1.2 Complex Models
53
J
d2 h ¼M dt2
Here J is the moment of inertia of the body relative to the axis of rotation, h is the angle of rotation, M is the total moment of the acting forces about the same axis. For example, in the absence of friction on the pendulum 1, the torque: M11 ¼ m1 gl1 sin h1 created by gravity and the moment of elastic force M12 ¼ kl21 ðsin h2 sin h1 Þcosh1 Therefore, the equation of motion of the pendulum 1 will be: m1 l21
d2 h1 ¼ m1 gl1 sin h1 þ kl21 ðsin h2 sin h1 Þ cos h1 dt2
In deriving the equation, it is assumed that the angles of deflection of the pendulum are small. A similar formula is obtained for the pendulum 2. Thus, we have obtained a system of equations: Model of a system of coupled pendulums: dh1 dt dx1 dt dh2 dt dx2 dt
¼ x1 ¼
g k sin h1 þ ðsin h2 sin h1 Þ cos h1 l1 m1
¼ x2 ¼
g k sin h2 ðsin h2 sin h1 Þ cos h2 l2 m2
where x1 and x2 corresponding angular velocities. Note. You are encouraged to develop the system of equations in the case of application of external forces to each of the bodies. Comment. Let us give a description of the physical process, based on the constructed mathematical model for the simple case of identical pendulums. Consider the behavior of the angles of displacement of the pendulums h1 and h2 , when at first only one of the pendulums was retracted, i.e. at time t = 0, the displacement amplitude of the second pendulum h2 is zero. In this case, only
54
1 Virtual Labs
pendulum 1 begins to oscillate, but over time the amplitude h2 increases and when the amplitude h1 drops to zero, the amplitude h2 reaches its maximum value, etc. The same is observed with an arbitrary initial displacement of both pendulums. And only in two cases there is no exchange of energy between the pendulums: if two identical pendulums at the beginning were deflected at the same angle and had the same speeds, then they produce common-mode harmonic oscillations; if, at t = 0, the deviations and the projections of the velocities are equal and opposite in sign, the pendulums will also perform harmonic oscillations with frequency, but occurring in antiphase (antiphase oscillations). These oscillations are called normal oscillations of a system of coupled oscillators. We should also mention the so-called partial oscillations inherent in coupled systems. These oscillations are obtained if one of the pendulums is rigidly fixed, and the second is taken out of equilibrium and left to itself. Obviously, the partial frequency will exceed the frequency of one pendulum. In a symmetric system, both partial frequencies are equal. In the case of different pendulums (l1 6¼ l2 ; m1 6¼ m2 ), their movement is more complex than that described for a symmetric system [2]. Part 1: Free pendulum Component modeling You need to start modeling with an ordinary free pendulum, as shown in Fig. 1.28. For an ordinary free pendulum, refer to Sect. 1.1.2. Testing and simulation of the model Choose a numerical method and simulate your model. Plotting and graph analysis Task 1. Kinematic behavior of the pendulum Investigate the behavior of the pendulum for initial angular velocity 8\x0 \8 rad/s. Plot: • a graph of the angle offset of a free pendulum; • a graph of angular velocity; • a phase diagram of a free pendulum Fig. 1.28 Dynamic system: Free pendulum
1.2 Complex Models
55
Draw conclusions. Task 2. Analytical and graphical solution for oscillation frequency of a free pendulum For a simple system like this, the frequency can be found by calculating the period time and using f ¼ T1 . Using the equation for small vibrations: sffiffiffi l T ¼ 2p g Perform these simple calculations for a pendulum with a length l = 1 and find the period. After this, the body offset along the X-axis will be plotted. Analyze the resulting graph. Find the oscillation period and frequency from the graph. Make a similar experiment to obtain a law for the offset angle, calculate the oscillation frequency. Compare the results obtained analytically and the numerical experiment. Draw conclusions. Task 3. Find the oscillation frequency of a free pendulum using a tool « FFT analysis » . There is a simple way to get this answer in SystemModeler, that is also suitable for finding the frequency of bodies in a more complex system. This is done by doing a FFT analysis. Details on the implementation of FFT analysis can be found in Sect. 2.7. From the graph of the amplitude-frequency characteristics of the system, you can determine the peak amplitude. Compare the result obtained by FFT analysis with the results obtained analytically and graphically. Draw conclusions. Comment. The FFT analysis method is especially useful when it is impossible to obtain an analytical result. You can see this further when modeling complex systems with connected and double pendulums. Task 4. Study of the dynamic behavior of pendulum Using the computer model of a free single pendulum, you will conduct numerical experiments for the qualitative and quantitative analysis of a dynamic system: • Determine the energy stored by the pendulum when its angle deviates in the interval h1 (−p < h1 < p). • At what values of the stored energy will the oscillations of the pendulum cease to be harmonic? • Build a phase portrait of a free single pendulum without friction. • Determine the phase trajectories corresponding to two possible types of motion: oscillations and rotation around the fixed point. • Determine the coordinates and type of singular points corresponding to the oscillations of the pendulum with respect to a stable lower equilibrium position.
56
1 Virtual Labs
• Determine the phase curves separating the phase space into areas with different behavior (oscillatory and rotational processes). Specify the coordinates and the type of singular points through which the indicated phase curves pass. After completing the tasks in Part 1 of the lab, you should proceed to the Part 2 of the lab, following the same steps of the component modeling. Part 2: Coupled pendulum Component modeling You will now expand your model to a system of coupled pendulums. Choosing components for a diagram of component model To expand the model, you need one more pendulum, a spring, and two forces. Build a new model in a Diagram View of Model Center. Find in PlanarMechanics the following additional components as listed in Table 1.24. A pendulum can be added by selecting all components (except PlanarWorld), that already are in the Diagram View and copying them, as shown in Fig. 1.29. Now you have two pendulums. However, the pendulum you just duplicated has the exact same parameters as the first one, which is not what you would like. Let us change some parameters of the second pendulum as shown in Table 1.25. Now the pendulum has been displaced and is a little bit shorter than the first pendulum. Let us add a spring between the two masses. The spring can be found under PlanarMechanics.Parts. Connect the spring to both masses. Next, you will add an external force. Drag and drop the WorldForce to the diagram layer. It can be found under PlanarMechanics.Sources. WorldForce needs three input signals, one for the forces in x and y-direction and the last one represents a torque, exerted perpendicular to the x-y plane. Apply a cosine force in the x-direction and no force in the y-direction and no torque. Drag and drop one Cosine and two Constants from Modelica.Blocks.Sources to the diagram layer. Rename Cosine to “forceX” and Constants to “forceY” and “torque”. When connecting, for example, “forceX” to WorldForce a dialog box will appear, asking to which connector element the component should be connected to (Fig. 1.30).
Table 1.24 Additional components Library
Name of the class
Quantity and short description
modelica://PlanarMechanics. Parts. modelica://PlanarMechanics. Sources. modelica://Modelica.Blocks. Sources. modelica://Modelica.Blocks. Sources.
Spring
1 spring
WorldForce
2 external forces
Cosine
1 periodic signal applied to external force 2 constant signal applied to external force
Constant
1.2 Complex Models
57
a)
b)
Fig. 1.29 Creating a model of coupled pendulums
Table 1.25 Setting parameters of computer model components Parameter values
Description
fixedPoint.r[2] = {1,0.9} m pendulum.r[2] = {0, − 0.9} m
Fixed x, y-position Length of the rod resolved w.r.t. body frame at phi = 0
Fig. 1.30 a dialog box of external force
58
1 Virtual Labs
Connect forceX to worldForce.force[1], corresponding to the force output in X-direction. Connect the two remaining const to worldForce.force[2] and worldForce.force[3] and set the values of the y force and torque to zero (see parameters below the screenshot). Also connect worldForce to pendMass. The diagram view should now look as Fig. 1.31. Connecting all components, you will get a model of the dynamic system “coupled pendulums”. You can see the diagram of correct model in Sect. 2.14. Setting the initial parameters of the model As mentioned above, for a more general statement of the problem, it is necessary to change some parameters of the second pendulum, as shown in Table 1.25. Next, you need to adjust the parameters of the external force. In this lab, we apply a periodic force in the direction of the X-axis and choose the projection of the force on the Y-axis and the torque to be zero. To do this, set the values of the periodic force in the direction of the X-axis (see “Parameters” at the bottom of the screen), as shown in Table 1.26. In the window below the diagram, check that the parameters of the selected components are set correctly. Recommended parameter values are given in Table 1.27. Set initialization values of velocities to zero: pendMass.v[2] = {0,0} and pendMass1.v[2] = {0,0}. We also want the worldForce to be applied in the world frame, which means that the force will be applied in the x-direction according to the world coordinate
Fig. 1.31 The diagram view of external force
1.2 Complex Models Table 1.26 Setting parameters for input X, zero input Y, and torque setting
Table 1.27 Setting parameters of computer model components
59 Parameter values
Description
forceX. amplitude = 10 forceX.freqHz = 1 Hz forceX.phase = 0 ° forceX.offset = 0 forceX. startTime = 0 s forceY.k = 0
Amplitude of cosine wave Frequency of cosine wave Phase of cosine wave Offset of output signal Output = offset for time < startTime Constant output value
Parameter values
Description
spring.c_x = 100 N/m spring.c_y = 100 N/m spring.s_relx0 = 1 m
Spring constant in X-direction Spring constant in Y-direction Unstreched spring length
system. The standard value for resolveInFrame is for the force to be applied in frame_b, which in this case would be in the frame of pendMass. That would mean that if the pendulum would swing a quarter of a revolution, i.e. h1 = p/2, the force would still be applied in the x-direction for the pendulum mass, but in the y-direction in the world frame, since the coordinate system for the mass has changed compared to the world coordinate system. To change this set the following parameter (by either using the dropdown menu or writing the value), worldForce. resolveInFrame = world—Resolve in world frame. Testing and simulation of the model Choose a numerical method that you will use simulating your model. You should see the animation of the coupled pendulums, Fig. 1.25 (the correct diagram is given in Sect. 2.14.) Plotting and graph analysis Task 1. Time dependencies of parameters characterizing the dynamic behavior of the system Plot the x-positions of the two pendulum masses. You need to plot the following graphs, choosing the optimal settings: • a graph of the angle offset of each pendulum; • a graph of angular velocity of each pendulum; • a phase diagram of each pendulum Task 2. Observation of the beat pattern You need to remove the external force, and as the initial condition give the first pendulum the initial angular velocity xx0 . By changing the time interval and, if necessary, some of the parameters of the pendulums, to achieve the appearance of a beat pattern.
60
1 Virtual Labs
Task 3. FFT- dual mass analysis It is difficult to observe a good frequency from the position plot. Do a FFT analysis of the two masses, starting with pendMass. Drag and drop the r[1] variable of either mass to the FFT analysis window and then press OK with the default values. Plot the amplitude—frequency dependance, determine by schedule the frequency values and compare with the analytical result (solve the problem of determining the eigenvalues of the system of equations describing the motion of the connected pendulums, for example, in the Wolfram Mathematica [6]). Compare the frequencies calculated analytically with the frequencies obtained from the FFT analysis. Draw conclusions.
1.2.8
Computer Modeling of Double Pendulum
The purpose of this lab is to build a component model and to study the characteristics of a dynamical system of double pendulum. A mathematical model of an oscillatory system, constructed using the Lagrange equations, is considered. Newton’s laws can be used to describe the equation of motion (mathematical model) of any dynamical system. However, in analyzing complex systems, the application of Newton’s laws can be difficult. Another approach is to use the Lagrange equation, which uses the potential and kinetic energy of the system, as well as the work done by non-conservative external forces acting on the system. To build a mathematical model of a double pendulum, the “base” model of the mathematical pendulum is used below. Learning Objectives: • To simulate systems with two and three degrees of freedom using the package Wolfram SystemModeler; Formulation of the problem A double pendulum can be represented as follows: For the first pendulum at the point of body m1, there is a revolute joint, to which a second pendulum with m2, is suspended, on an inextensible rod of length l2, forced to swing in the same plane, as shown in Fig. 1.32. Description of the mathematical model The derivation of the differential equation of motion of a double pendulum in Cartesian coordinates is difficult because of the presence of reactions arising in revolute joints. These problems can be solved by developing the equations of motion for generalized coordinates using the Lagrange equations. Specifying the position of a system of points in Cartesian coordinates is not always convenient. The choice of parameters necessary to describe the position of all points of the mechanical system (i.e., generalized coordinates) must be determined primarily by convenience.
1.2 Complex Models
61
Fig. 1.32 Dynamic system: double pendulum
In our case, it is convenient to take as the generalized coordinates the angles of deviation of each of the pendulums from the vertical (h1 & h2). First, it is necessary to introduce a reference system and express the Cartesian coordinates in terms of generalized:
x1 ¼ l1 sin h1 y1 ¼ l1 cos h1
and
x2 ¼ l1 sin h1 þ l2 sin h2 y2 ¼ ðl1 cos h1 þ l2 cos h2 Þ
Then, by differentiating these equalities, obtain the Cartesian velocity components, expressed in terms of the generalized coordinates (h1 & h2) and generalized velocities (h_ 1 &h_ 2 ):
x_ 1 ¼ l1 h_ 1 cos h1 y_ 1 ¼ l1 h_ 1 sin h1
and
x_ 2 ¼ l1 h_ 1 cos h1 þ l2 h_ 2 cos h2 y_ 2 ¼ l1 h_ 1 sin h1 þ l2 h_ 2 sin h2
Then you can calculate the squares of the velocities of each pendulum (included in the kinetic energy):
v21 ¼ x_ 21 þ y_ 21 v22 ¼ x_ 22 þ y_ 22
Cartesian coordinates included in the formula of potential energy, W ¼ m1 gy1 þ m2 gy2 are replaced with generic coordinates. The velocities included in the kinetic energy formula are replaced by the generalized velocities, so that the kinetic energy in the general case will depend on the generalized coordinates
62
1 Virtual Labs
T¼
m1 v21 m2 v22 þ 2 2
Write the Lagrangian and formulate the Lagrange equations for the first and second pendulum in the absence of non-potential forces: (@
@L @t @ h_ 1 @ @L @t @ h_ 2
@L @h ¼0 1 @L @h ¼0 2
After algebraic transformations, it is easy to obtain the following system of differential equations for the mathematical model of a double pendulum. Model of the system “double pendulum”: dh1 ¼ x1 dt
dx1 m2 _ 2 cosðh1 h2 Þ þ l2 h_ 2 ¼ ð h Þ h sin h 1 2 1 dt l1 2 m1 þ m2 sin2 ðh1 h2 Þ g m1 þ m 2 sin h2 cosðh1 h2 Þ sin h1 l1 m2 dh2 ¼ x2 dt
dx2 m 2 þ m1 m2 _ 2 l1 _ 2 h ¼ ð h Þ cos ð h h Þ þ h sin h 1 2 1 2 dt m1 þ m2 2 l2 1 m1 þ m2 sin2 ðh1 h2 Þ g þ ðsin h1 cosðh1 h2 Þ sin h2 Þ l2
This system is written for the case of free oscillations. In the case of external non-potential forces, the corresponding term should be added to Lagrangian, Qnext . Part 1. Double pendulum with two degrees of freedom Component modeling Choosing components for a diagram of component model The model you need to build should consist of the components specified in Table 1.28. Next, you will add an external force. Drag and drop the WorldForce component to the diagram layer. It can be found under PlanarMechanics.Sources. This component needs three input signals, one for the forces in x and y-direction, and the last one represents a torque, exerted perpendicular to the x-y plane. Apply a cosine force in the x-direction and no force in the y-direction and no torque. Signals are shown in Fig. 1.33.
1.2 Complex Models
63
Table 1.28 The model components Library
Name of the classes
Quantity and short description
modelica://PlanarMechanics modelica://PlanarMechanics. Parts modelica://PlanarMechanics. Joints modelica://PlanarMechanics. Parts modelica://PlanarMechanics. Parts modelica://PlanarMechanics. Sources modelica://Modelica.Blocks. Sources modelica://Modelica.Blocks. Sources
PlanarWorld Fixed
1 fixed coordinate system 1 fixed point
Revolute
2 plane revolute joint
FixedTranslation
2 rigid rod
Body
2 rigid body
WorldForce
1 external forces
Cosine
1 periodic signal applied to external force 2 constant signal applied to external force
Fig. 1.33
Constant
WorldForce: three input signals
Drag and drop all components from Table 1.28 to the diagram layer. Name component Cosine—as « forceX» , component Const—as « forceY» and component Const2—as «torque» . Connect forceX to worldForce.force[1], corresponding to the force output in X-direction. Connect the two remaining Const to worldForce.force[1] and worldForce.force[2]. Also connect WorldForce to lower mass. Connecting all components, you will get a model of the dynamic system “double pendulum”. You can see the diagram of correct model in Sect. 2.15. Setting the initial parameters of the model At the bottom of the screen in the diagram view, check that the initial settings of the components are correct, as shown in Table 1.29. It is also recommended to choose radians (rad) as units for angles phi (“by default” degrees are chosen).
64
1 Virtual Labs
Table 1.29 Parameters and initial values of the components Fixed
First revolute
Second revolute
Masses (equal)
Rods (equal)
Testing and simulation of the model Choose a numerical method and simulate your model. You will see an animation of a computer model of a double pendulum. Part 2. Double pendulum with three degrees of freedom Component modeling Choosing components for a diagram of component model To go further than this 2D-double pendulum, you can easily model the same pendulum, but now in three dimensions instead of two. The mathematical model of a pendulum with three degrees of freedom can be found in [7]. For modeling mechanics in three dimensions, the MultiBody library should be used. It is in the Modelica Standard Library under Mechanics. The modeling is quite similar as to model with PlanarMechanics, but with the addition of one more dimension. The extra dimension means that you need to put one additional revolute at every point where you had revolute joints in the 2D-pendulum. Figure 1.34a, b shows the modifications on the revolute joints.
1.2 Complex Models
a)
65
б)
c)
Fig. 1.34 a 2D revolute joint, b 3D revolute joint, c external force in 3D
The other thing that needs to be done is to specify coordinates and directions in three dimensions instead of two. It is also necessary to provide the opportunity to apply a periodic external force for all three directions, Fig. 1.34c. Combining all the listed components on the diagram layer, we obtain a model of a mathematical pendulum with three degrees of freedom. You can see the diagram of correct model in Sect. 2.15. Setting the initial parameters of the model After the model is assembled, it is recommended to set the numeric parameter values, specified in Table 1.30. Recommended value for initial velocity of the first body is body.v_0 = {1,0,1} m/s. Testing and simulation of the model Choose a numerical method and simulate your model for different starting conditions and forces and see how it behaves. Plotting and graph analysis Part 1: 2D double pendulum Task 1. Carry out a numerical experiment with different initial velocities for two masses and see how the constructed model behaves. Draw conclusions. Plot a series of graphs of angular offsets of bodies and obtain the beat pattern. At what values of the parameters did it happen? Task 2. Plot a series of graphs of angular velocities of bodies over time. Draw conclusions.
66
1 Virtual Labs
Table 1.30 Setting parameters of computer model components Parameter values
Description
fixed.r = {0,1,0} m revolute.n = {1,0,0} revolute1.n = {0,0,1} fixedTranslation.r = {0, − 1,0} m body.m = 5 kg revolute2.n = {1,0,0} revolute3.n = {0,0,1} FixedTranslation1.r = {0, − 1,0} m body1.m = 5 kg cosine.amplitude = 50 cosine.freqH = 0.1 Hz cosine2.amplitude = 10 cosine2.freqH = 1 Hz
Position vector from world frame Axis of rotation Axis of rotation Vector from frame_a to frame_b Mass of the rigid body Axis of rotation Axis of rotation Vector from frame_a to frame_b Mass of the rigid body Amplitude of cosine wave Frequency of cosine wave Amplitude of cosine wave Frequency of cosine wave
Task 3. Plot the phase diagrams (correlation between angular velocity and angle of offset) of the first and second bodies for different values of parameters. Explain the graphs. Task 4. Determine the natural frequency of the double pendulum using the tool “FFT analysis”. You can determine the oscillation frequency in Wolfram SystemModeler using the FFT analysis tool by analyzing the amplitude-frequency characteristic of the system. This method is applicable for finding the oscillation frequency in the case of a double pendulum. Find the natural frequencies of your system using this method. Task 5. Apply to the second (lower) mass different external forces to study the behavior of the system. Task 6. Repeat experiments from tasks 1 to 5 for cases of different masses. Consider extreme cases of a very large lower mass and a very small lower mass. How did the change in this parameter affect the results of the experiment? Have the natural frequencies of the system changed? Perform additional FFT analysis. Record the resulting graphs. Draw conclusions. Task 7. Repeat experiments from tasks 1 to 5 for cases of different lengths of rods. Consider the limiting cases of a very large lower rod and a very small lower rod. How did the change in this parameter affect the results of the experiment? Have the natural frequencies of the system changed? Perform additional FFT analysis. Record the resulting graphs. Draw conclusions. Part 2: 3D double pendulum Find the natural oscillation frequencies of the 3D double pendulum using the FFT analysis tool. Record the resulting graphs. Compare the results with the 2D case. Draw conclusions.
1.2 Complex Models
67
Now perform the task with increased complexity. When building a component model of the dynamic system below, follow the steps of the component modeling process similar to those used in parts 1 and 2 of the lab. Part 3: Coupled Pendulum System Component modeling Try to use SystemModeler to go beyond what is possible to predict with calculations by hand. Choosing components for a diagram of component model Below is an extremely complicated pendulum system containing: • • • • •
Two triple-pendulums (different length on the links); Two springs connecting the triple-pendulums together; One oscillation force on the first mass on the first pendulum; One oscillating force on the first mass on the second pendulum; One oscillating force on the last mass in the second pendulum.
Due to the complexity of this model, the diagram is shown in Fig. 1.35. Setting the initial parameters of the model Specify for the components of a complex system the same characteristics (the masses, the stiffness of the springs, the values of external signals, etc.) that you used in previous labs. Testing and simulation of the model Choose a numerical method and simulate the model. Plotting and graph analysis Task 1. Qualitative analysis of system behavior Track the trajectory of the selected mass using the “Tracing path” to see how one mass will move in the system. Task 2. The study of the kinematic behavior of the system You need to plot the following graphs, choosing the optimal settings: • a graph of the angle offset of one mass in the system; • a graph of angular velocity of one mass in the system; • a phase diagram of one mass in the system. Analyze the results and draw conclusions.
1.2.9
Computer Modeling of Rotating Swing
The purpose of this work is to build a component model and study the characteristics of the dynamic system of rotating swing. Rotating swing consists of ropes or chains with cradles attached to horizontal rods attached to a vertical stand. The vertical stand rotates about a vertical axis passing through its center. The angle between the vertical axis and the plane of the location of the rods during rotation may vary (from 90°).
68
1 Virtual Labs
Fig. 1.35 Diagram of a complex oscillatory system
Each chain with a cradle can be modeled as a multi-link pendulum. Using the model of a double pendulum, it is necessary to move from one double pendulum to several pendulums attached to each other. For the computer model to be adequate (to imitate the behavior of a real chain with a cradle), a sufficiently large number of pendulums is required. To build a mathematical model of rotating swing, the “base” models, the mathematical pendulum and the double pendulum model, are used.
1.2 Complex Models
69
Learning Objectives: When this virtual lab has been completed, you will have learned: • To simulate complex systems with three degrees of freedom with rotation. Formulation of the problem The rods are rigidly fixed in a horizontal plane on the vertical axis of rotation (rack). Chains with weights are attached to the rods (see Fig. 1.36). If the system is stationary, then all the chains hang vertically downwards; if the rods rotate around a vertical axis, the chains deflect under the action of centrifugal force and Coriolis forces. With an increase in the angular velocity of rotation, the deviations from the vertical of the chains with weights increase. The angle of deflection of the chains can be controlled (so that, for example, a fall from the Rotating Swing or the chain does not break away from the rod) is possible using the PID controller. The PID controller is used to control the torque applied to the vertical axis of rotation. Description of the mathematical model We obtain a system of differential equations describing the motion of the rotating swing. Let 8 rods of length a be fixed symmetrically in the horizontal plane on top of a rotating vertical stand (simulated using a rigid rod with a revolute), on the end of each a pendulum is attached, which is a rigid rod of length l with mass m as shown in Fig. 1.37. Let J be the moment of inertia and u be the angle of rotation of the vertical stand (and therefore the entire rotating swing). The basis of the motion of the rotating swing is the rotation of the stand around its axis under the action of some applied torque. _ angular acceleration of the stand a The angular velocity x of the stand is x ¼ u; _ In the simplest model of rotation of the stand, the torque M leads to an is a ¼ x. increase in the angular velocity of the stand:
Fig. 1.36 Dynamic system: rotating swing
70
1 Virtual Labs
Fig. 1.37 Pendulum on a rotating stand
M¼J
dx dt
First, we will write down the equation of motion of a pendulum on a rotating stand as shown in Fig. 1.37. Then we will generalize it to the case of a larger number of pendulums. In addition to the values introduced above, we will need the angle of deflection of the rod of the pendulum h. We write the Lagrange equations (for more information on the mathematical models based on the Lagrange equations, [2]) in the form: d @T ðq; q_ Þ @T ðq; q_ Þ ¼ Qext ; dt @ q_ @q choosing as generic coordinates u—the angle of rotation of the stand and the angle of deflection of the rod h. We represent the kinetic energy as the sum of the kinetic energy of the stand and the suspended mass.: 1 1 T ¼ T1 þ T2 ¼ J u_ 2 þ mv2 ; 2 2 here v is the absolute velocity of the cradle v2 ¼ v0 þ vrel :
1.2 Complex Models
71
Considering that _ _ vrel ¼ lh; v0 ¼ ða þ l sin hÞu; find v2 ¼ l2 h_ 2 þ ða þ l sin hÞ2 u_ 2 : then: i 1 m h 2 _2 l h þ ða þ l sin hÞ2 u_ 2 T ¼ T1 þ T2 ¼ J u_ 2 þ 2 2 the first Lagrange equation: @T ¼ J u_ þ mu_ ða þ l sin hÞ2 @ u_ i d @T h _ ða þ l sin hÞ cos h € þ 2mu_ hl ¼ J þ mða þ l sin hÞ2 u dt @ u_ @T ¼0 @u then h
i _ ða þ l sin hÞ cos h ¼ M € þ 2mu_ hl J þ mða þ l sin hÞ2 u
the second Lagrange equation: @T ¼ ml2 h_ @ h_ d @T h ¼ ml2 € dt @ h_
@T ¼ mu_ 2 lða þ l sin hÞ cos h @h then
ml2 €h mu_ 2 lða þ l sin hÞ cos h ¼ mgl sin h Dividing the last equation by ml we get: l€h u_ 2 ða þ l sin hÞ cos h þ g sin h ¼ 0: Thus, for one suspended mass the following system of differential equations is obtained.
72
1 Virtual Labs
model of rotating swing: du ¼x dt dx ¼a dt dh ¼r dt dr ¼e hdt
Angular velocity of stand Angular acceleration of stand Angular velocity of the body i
Angular ðcentrifugalÞ acceleration of the body
_ ða þ l sin hÞ cos h ¼ M € þ 2mu_ hl J þ mða þ l sin hÞ2 u
l€h u_ 2 ða þ l sin hÞ cos h þ g sin h ¼ 0
1 equation
2 equation
To simulate a rotating swing consisting of 8 chains with suspended masses, it is necessary to record 8 similar ratios with a constant shift u0 around the circumference for a uniform distribution of the suspended masses relative to the stand. To control the angle of deviation of chains from the vertical, use the PID controller (Fig. 1.38). The PID controller will need a reference signal and a measurement signal. You can use a Ramp from Modelica.Blocks.Sources as the reference signal and then take the measurement signal from the angular velocity of the revolute joint. PID controller equation is as follows [8] u ¼ P þ I þ D; where P—proportional component:
P ¼ Kp eðtÞ;
here e—current error i.e. the difference between the control xref and measured x signals e ¼ xref x; Kp —proportional gain;
Fig. 1.38 PID regulator circuit
1.2 Complex Models
73
I—integral component:
Zt
I ¼ Ki eðsÞ dt; 0
here Ki —integral gain; D—differential component: D ¼ Kd
deðtÞ ; dt
here Kd —differential gain. Note. To measure the angular velocity in WSM, you can use a special component of the built-in library, which will be described in detail below. Thus, you can control the angular velocity of rotation of the rotating swing. Using the equations listed above, we obtain a mathematical model of the dynamic system “rotating swing” with controller. Component modeling Part 1: Simulation of a three-dimensional double pendulum In the first part of the work, you need to repeat modeling of a double pendulum with three degrees of freedom, see the lab “Double Pendulum”. After the model is assembled, it is recommended to set parameter values and initial values similar to the values given in the lab “Double Pendulum”. Part 2: Simulation of the rotation of the cradle on the rod and on the “rope” Let us start with building the simplest component model, consisting of only one cradle, rotating on the rod in a circle. Choosing components for a diagram of component model The model you need to create consist of the components specified in Table 1.31. With these components you can create a simple swing, where the fixedRotation rotates 90° around the Y-axis. You will also need an input to the torque to get the swing to rotate. Table 1.31 The model components Library
Name of the classes
The number of components and a brief description
modelica://Modelica.Mechanics. MultiBody modelica://Modelica.Mechanics. MultiBody. Joints modelica://Modelica. Mechanics. MultiBody.Parts modelica://Modelica.Mechanics. MultiBody.Parts modelica://Modelica.Mechanics. Rotational.Sources modelica://Modelica.Mechanics. MultiBody.Parts
World
1 fixed coordinate system
Revolute
5 plane revolute joint
FixedTranslation
4 rigid rod
FixedRotation Torque
1 rotates related components 90 degrees around the Y-axis 1 external constant torque
Body
2 rigid body
74
1 Virtual Labs
The easiest way to get the swing construction to rotate in the way you want is to use a PID controller LimPID, which can be found in the library Modelica.Block, to control the torque Continuous. For LimPID, you will need a reference signal and a measurement signal. You can use a Ramp from Modelica.Blocks.Sources as the reference signal and then take the measurement signal from the angular velocity of the revolute joint. Use AbsoluteAngularVelocity from MultiBody.Sensors for measuring the angular velocity. This way you can control the angular velocity of the swing. The double pendulum model is an imperfect “rope” model. To get a better approximation of a rope, you should try to add more pendulums with shorter rod lengths. A useful feature is “transform into new class” that can be used in Model Center (Fig. 1.39a), which will result in a new component containing everything that was selected. The new component will look like Fig. 1.39b. Create a new component icon (Fig. 1.40) and reassemble the model, replacing the simple Body components with the new “pendulum” components.
a) Fig. 1.39 Component diagram “rope”
b)
1.2 Complex Models
75
Fig. 1.40 Icon of a new component “pendulum”
You can now put many pendulums in a row by using this newly created class. Let us use five pendulums, as shown in Fig. 1.40a. If more complexity is needed, you can add some components to the rope to create a new component, for example containing five pendulums. Create the icon of the “five-fold” pendulum (Fig. 1.41) and assemble the same model again, placing instead of the simple Body components the new “fivePend” components. The result will consist of four connected components of five pendulums. When modeling the “rope”, if a more representative model is required, you can merge several already constructed components into one new component. Setting the initial parameters of the model After constructing the component model diagram, in the window below the diagram, check the settings of the parameters. The parameters of the pendulum leave the same as in the first part of the lab. For the PID controller, set the following parameter values as shown in Table 1.32. When you increase the number of links of the “rope”, reduce the length of the rods and the mass of the body. Change the length of fixedTranslation to {0, −0.2,
Fig. 1.41 Icon of the new component model of the “five-fold” pendulum
76
1 Virtual Labs
Table 1.32 The model components Parameter values
Description
controllerType = Modelica.Blocks.Types. SimpleController.PID k = 50 Ti = 0.001 s
Type of controller
Td = 0.1 s yMax = 1500 yMin = − yMax
Gain of controller Time constant of Integrator block Time constant of Derivative block Upper limit of output Lower limit of output
0} and lower the mass of the body to 0.2. If you want to make more links, reduce the parameters twice. Testing and simulation of the model Choose a numerical method that you will use simulating your model. This model can now be simulated. Set the simulation stop time to 30 s and give it a go. A screenshot from the simulation can be seen in Sect. 2.16, represented by a single rod, does not behave like a real rope. Simulate your model with the component “fivePend” and see if the “rope” will behave better. Continue the experiment by increasing the number of links in the rope. How many pendulums do you need to create a good approximation of the “rope”? Plotting and graph analysis Task 1. Plot the kinematic behavior of the five-link “rope”. Use the “trace” option to make sure your results are correct. Task 2. Plot the angular offset and angular velocity of each of the five links of your “rope”. Part 3: Assembly of rotating swing Now you can create a component model of the rotating swing using many pendulums. Choosing components for a diagram of component model The five-link rope with the cradle, which you modeled in the second part of the lab, will be used in this part as a new component. Select it and save it as a component of “PendulumToSwing”. Create an icon for this new component, as shown in Fig. 1.42. Set how many ropes with cradles should be modeled on the rotating swing by entering the parameter nrOfSwings. Take the rotation control loop from part 2 of this lab. For more flexible control of the input signal, it is recommended to send the sum of two signals to the PID controller, as shown in Fig. 1.43.
1.2 Complex Models
77
Fig. 1.42 Icon of “five-link rope”
Fig. 1.43 The sum of two input signals
This component calculates the output y as the sum of two input signals u1 and u2: y ¼ k 1 u1 þ k 2 u2 ; Example. parameter: k1 ¼ þ 2; k2 ¼ 3 leads to the following equation: y ¼ 2u1 3u2 : This rotation control loop provides rotation with a given maximum angular velocity in one plane. To control the offset of the rotating swing in other planes, we add two more revolute joints, connected to the springdamper components, to ensure smooth turns, as shown in Fig. 1.44. Torque applied to these revolute joints is defined as the product of a constant signal and a signal from the PID controller, as shown in Fig. 1.45.
78
1 Virtual Labs
Fig. 1.44 Using the SpringDamper component
Fig. 1.45 Torque applied to revolute joints
This component calculates the output y (elementwise) as the product of the corresponding elements of the two inputs u1 and u2: y ¼ u1 u2 : Assemble the rotating swing of 8 “ropes” as shown in Fig. 1.46. Connect the rotating swing with three revolute joints as described above. Apply constant torques to the revolute joints and connect an angular velocity control
1.2 Complex Models
Fig. 1.46
79
Fragment of the model “rotating swing”
loop. If the assembly of this model is difficult, refer to the correct diagram in Sect. 2.16. Setting the initial parameters of the model After the model is assembled, it is recommended to set the numeric values of the parameters specified in Table 1.33. Table 1.33 The model components
Spring parameters Parameter values useHeatPort = false c = 100,000 Nm/ rad d = 100 Nms/rad phi_rel0 = 0° Parameters of the first Parameter values height = − 2 duration = 10 s
Description ¼true, if heatPort is enabled Spring constant
Damring constant Unstretched spring angle input signal on the PID controller Description Height of ramps Duration of ramps (= 0.0 gives a Step) offset = 0 Offset of output signal startTime = 25 s Output = offset for time < startTime Parameters of the second input signal on the PID controller Parameter values Description height = 2 Height of ramps duration = 10 s Duration of ramps (= 0.0 gives a Step) offset = 0 Offset of output signal startTime = 1 s Output = offset for time < startTime Parameters of constant signal Parameter values Description k=4 Constant output value
80
1 Virtual Labs
Testing and simulation of the model Choose a numerical method and simulate your model. If everything is done correctly, you will see an animation of a computer model of a rotating swing. Plotting and graph analysis Task 1. Plot the offset of any three cradles on the ropes along the X-axis and along the Y-axis. Task 2. Plot the angular offset of the cradle, graphs of angular velocities and accelerations over a time interval of 90 s. Task 3. What will happen at 70 s? Task 4. Plot a schedule of a rotating swing on a plane XY. What will the motion projections of other swings look like? What will the projections on other planes look like?
1.2.10 Computer Modeling of Gyroscopic Precession The purpose of this virtual lab is to build a component model and simulate the precession of a gyroscope in a gimbal (Fig. 1.47). This lab will demonstrate how the torque applied to a rotating object may induce gyroscopic precession. A gyroscope is any heavy symmetric body that rotates near the axis of symmetry. Due to the rapid rotation, the gyroscope has the following properties: it tends to keep the position of the axis of rotation in space unchanged; resistant to impact; reacts in an unusual way to the action of an external force. Attempting to rotate the gyroscope relative to one axis causes it to rotate relative to the other—perpendicular to it [9]. In this lab you can study the laws of gyroscope movement, the basic laws of gyroscope precession using the computer model that you built, you can “adjust” the model parameters and, thus, correct the behavior of the gyroscopic system.
Fig. 1.47 Triaxial gyro
1.2 Complex Models
81
Learning Objectives: When this virtual lab has been completed, you will have learned: • To explore the basic properties of the gyroscopic system; • To explore the basic patterns of gyro precession. Formulation of the problem A gyroscope (see Fig. 1.48) is a solid symmetric body rotating around the axis of symmetry with an angular velocity much higher than the velocity of rotation of the axis itself. A gyro in a gimbal is a material system consisting of three solid bodies— the rotor and two suspension rings—connected to each other with revolute joints. The rotor is a gyroscope that rotates around its axis of symmetry, which is installed in bearings fixed in the inner ring of the gimbal. The inner ring of the suspension rotates around its axis, which is installed in bearings fixed in the outer ring of the gimbal. The outer ring of the suspension rotates around its axis, fixed in fixed bearings. All three bodies have a common fixed point, called the point of suspension of the gyroscope. The axes of rotation of the suspension rings are orthogonal. The axes of rotation of the rotor and the inner ring of the suspension are also orthogonal. The system is in the field of gravity. It is assumed that the center of mass of the outer ring is on its axis of rotation (which is fixed). The centers of mass of the rotor and the inner ring coincide with the point of suspension of the gyroscope. It is assumed that there is no friction in the axes of rotation of bodies.
Fig. 1.48 Three-axis gyroscope in gimbal suspension
82
1 Virtual Labs
Precession is the movement along the circumference of the end of the axis of the gyroscope under the action of a constant small force. The precession is due to the action of an external force F, which generates a torque T T¼
dL dt
where L is the gyro moment. In a rapidly rotating gyroscope, the direction of the angular momentum vector approximately coincides with the direction of the axis of the gyroscope itself. Therefore, under the action of an external torque T, the axis of the gyroscope will also begin to rotate around the vertical axis with an angular velocity X, as a cone in space. Since the vector T rotates with L in such a way that their mutual arrangement does not change with time, the rotation of the gyroscope axis with a constant force F turns out to be uniform. This rotation is called regular precession, and the quantity X = xp is the angular velocity of precession. We can formulate the following precession rule: under the action of forces applied to the axis of a rapidly rotating gyroscope and directed perpendicular to this axis, the axis of the gyroscope precesses in a plane perpendicular to the direction of the axis. The direction of movement of the point at which the force is applied will be found if the direction of the force is rotated 90° around the gyroscope axis in the direction in which the gyroscope rotor rotates around this axis. Description of the mathematical model Following [9], we associate the following coordinate systems with the bodies: with the rotor—the system Oxyz, with inner ring system Ox1y1z1, with outer ring system Ox2y2z2 (Fig. 1.44). O is the fixed point of all three bodies (the point of suspension of the gyroscope). The coordinate systems are Cartesian, rectangular. Ox2 is fixed axis of the outer ring of the gimbal; a is angle of rotation of the outer ring relative to a fixed coordinate system (support); and i2, j2, k2 the axes (Fig. 1.49). We get system Ox1y1z1 from system Ox2y2z2 turning it around axes Oy2 at an angle b; i1, j1, k1—axes of system Ox1y1z1; j1 = j2. Oy1—the axis of rotation of the inner ring relative to the outer one coincides with the axis Oy2. We get system Oxyz from system Ox1y1z1 turning it around axes at an angle c; i, j, k—axes of system Oxyz; k = k 1. Oz—the axis of rotation of the rotor relative to the outer one coincides with the axis Oz1.
Fig. 1.49 Gyro Coordinate Systems
1.2 Complex Models
83
Thus, the position of the gyroscope in the gimbal is completely determined by three angles. a, b, c. Let’s write down the angular velocities. The outer ring rotates around a fixed axis with an angular velocity x2 = a_ i2 where a_ = da/dt. The inner ring rotates relative to the outer ring with an angular velocity b_ j1. In addition, it participates in the rotation with the outer ring. Therefore, the angular velocity of the inner ring _ 1. The rotor rotates relative to the fixed coordinate system is equal to x1 = x2 + bj relative to the inner ring with an angular velocity c_ k. In addition, it rotates with the inner ring. Therefore, the angular velocity of the rotor relative to a fixed coordinate system is equal to x0 = x1 + c_ k . When drawing up the equations of motion of the gyro in the gymbal, it is assumed that the center of mass of the outer ring lies on the axis of rotation Ox2, the center of mass of the inner ring coincides with the fixed point O, the center of mass of the rotor also coincides with the point O. Thus, the movement of the outer ring is rotation around a fixed axis, the movement of the inner ring and the movement of the rotor are the rotation of a solid body around a fixed point. We build a mathematical model of the motion of a gyroscope in a gimbal using Lagrangian. Potential force acting on the gyro in the gimbal is gravity. In this lab, the centers of mass of all three bodies (rotor and suspension rings) are fixed, therefore the potential energy of a gyroscope in a gimbal Wp —is a constant value (independent of t). It is known that the kinetic energy of a solid body having a fixed point O can be calculated using the formula T = 1/2 (x, K), where —K is the angular velocity of the body, x—is the kinetic moment of the body relative to the point O. Calculate the kinetic energies of the rotor and the rings of the gimbal. The formulas used to calculate the kinetic moments are very cumbersome and, therefore, are not given in these instructions (can be found in [9]). The kinetic energy of the gyroscope is equal to the sum of the kinetic energies Tк2, Tк1, Tк0 is the outer ring, the inner ring and the rotor respectively. Substituting the expressions for potential and kinetic energy into the general formula for the Lagrangian, we obtain the Lagrange function for the gyroscope in the gimbal: L¼
1 1 1 _ c sin b þ C c_ 2 Wp A2 þ ðA þ A1 Þ cos2 b þ ðC þ C1 Þ sin2 b a_ 2 þ ðA þ B1 Þb_ 2 þ C a_ 2 2 2
Here a, b, c are the angles of rotation of the outer suspension ring, the inner suspension ring, and the rotor, respectively; A2 is the moment of inertia of the outer ring relative to the axis of rotation; A1, B1, C1 are the main moments of inertia of the
84
1 Virtual Labs
inner ring; A is the equatorial moment of inertia of the rotor; C is the polar moment of inertia of the rotor. We assume that the conditions A + B1 6¼ 0, A + A1 + A2 6¼ 0, C 6¼ 0 are satisfied. The moments of inertia have non-negative values. The initial values of the variables are arbitrary. Note that the function Ldoes not depend on the angles a, c. We write the Lagrange equations of the second kind with ideal constraints. The power of the force F applied to the point P moving with the velocity v is the quantity N = (F, V). A possible movement of a material system is any movement of a system that does not violate the constraints imposed on the system. It is known that any position of a (free) solid is uniquely determined by six independent parameters. Relations between individual points of a solid are not considered, since any movement of a body is described by equations that do not contain the internal forces of the body. The following constraints are imposed on the gyroscope in the gimbal: 1. Axis Ox2 is fixed. Denote the moment of reactions of this bond with respect to the point OM2′. Then M2′ is the torque acting on the outer ring from the support side; M012 (moment of external forces acting on the gyroscope) is equal to M012 =M 2′ + M2′′, where M2′′ is the moment of gravity of the outer ring relative to the point O. 2. Axes Oy1 and Oy2 are the same. The moments of reactions of this connection with respect to the point O is M01 (forces acting on the inner ring from the outer ring) and moment (M01) (forces acting according to the third Newton law on the outer ring from the inner ring). 3. Axes Oz and Oz1 are the same. The moments of reactions of this connection with respect to the point is M0 (forces acting on the rotor from the inner ring) and moment (M0) (forces acting according to the third Newton law on the inner ring from the rotor). Note that for any possible coupling functions (at), (bt), (ct), that is, for any possible movements of the rotor and suspension rings. Thus, on a gyroscope in a gimbal, ideal constraints are superimposed. If ideal constraints are imposed on the material system and, moreover, potential forces act on it, then Lagrange equations of the second kind are valid. d @Lðq; q_ Þ @Lðq; q_ Þ ¼0 dt @ q_ @q Calculate the derivatives of the angles and their derivatives of the Lagrange function
1.2 Complex Models
85
@L @L ¼ 0; ¼0 @a @c @L 1 _ c cos b ¼ ðA þ A1 C C1 Þa_ 2 sin 2b þ Ca_ @c 2 @L ¼ A2 þ ðA þ A1 Þ cos2 b þ ðC þ C1 Þ sin2 b a_ þ C c_ sin b @ a_ @L _ @L ¼ Cða_ sin b þ c_ Þ ¼ ðA þ B1 Þb; _ @ c_ @b Substitute the derivatives into the equations. Gyro model in gimbal:
d A2 þ ðA þ A1 Þ cos2 b þ ðC þ C1 Þ sin2 b a_ þ Cc_ sin b ¼ 0 dt € þ ðA þ A1 C C1 Þa_ 2 cos b sin b C a_ _ c cos b ¼ 0 ðA þ B1 Þb d _ ½Cðasinb þ c_ Þ ¼ 0 dt The last three equations are the equations of motion of a gyroscope in a gimbal. Component modeling Choosing components for a diagram of component model The model you need to build should consist of the components specified in Table 1.34. Drag and drop on the diagram layer the components specified in Table 1.34. Give the components original names so that you can more easily navigate the diagram, as listed in Table 1.35. Due to the complexity of both the mathematical description and the component modeling of the gyroscope, when constructing a diagram, you can use the list of connectors, Table 1.36. After all the necessary connections of the components, you will get a gyroscope model. If the process of modeling is difficult, you can refer the diagram of correct model in Sect. 2.17. Setting the initial parameters of the model Provide in the model the ability to change the values of the magnitude of the external force and the angle of its application, as well as the angular velocity of the inner ring, as shown in Table 1.37. In the example above, some parameter values are given for the first experiment. In the following experiments you need to change these parameters. In the window below the diagram, check the numerical values of the parameters, as listed in Table 1.38.
86
1 Virtual Labs
Table 1.34 The model components Library
Name of the classes
The number of components and a brief description
modelica://Modelica. Mechanics.MultiBody. Parts modelica://Modelica. Mechanics.MultiBody. Visualizers modelica:// PlanarMechanics.Parts
BodyCylinder
2 (mount of the gyro, the rotor of the gyro)
FixedShape
2 (indicator of the orientation of the mount, indicator of the orientation of the rotor)
FixedTranslation
3 (distance from the mount to the outer ring, distance from the outer ring to the center of the gyro, placement for the indicator of the rotor orientation) 4 (fixed rotation to line up the rotor initially, fixed rotation to line up the inner ring initially, fixed rotation to line up the outer ring initially and displacement showing where to put the external force) 3 (revolution around the X-axis, revolution around the Y-axis and revolution around the Z-axis) 2 (inner ring of the gyro, outer ring of the gyro)
modelica://Modelica. Mechanics.MultiBody. Parts
FixedRotation
modelica:// PlanarMechanics.Joints
Revolute
modelica://Modelica. Mechanics.MultiBody. Visualizers modelica://Modelica. Mechanics.MultiBody. Forces modelica://Modelica. Blocks.Sources modelica://Modelica. Mechanics.MultiBody. World
VoluminousWheel
WorldForce
1 (external force)
Pulse
1 (signal to external force)
MultiBody.World
1 (fixed coordinate system)
Testing and simulation of the model Choose a numerical method and simulate your model. You will see an animation of a gyroscope (the correct diagram is given in Sect. 2.17.) Plotting and graph analysis Task 1. By simulating the model, you can try different values of the parameters and see how the gyro behaves. One of the most interesting parameters is the degreeOfForce, which specifies the force on the inner ring at the degree specified, where 0° is “3 o’clock”, 90° is “12 o’clock”, etc. Try different values and check for yourself that the force always gets delayed by 90 degrees. Try to explain what you are observing. Run the animation in real time and make sure that your assumptions about the nature of the movement of the gyroscope are correct.
1.2 Complex Models
87
Table 1.35 Rename Components Name of the classes
A brief description
BodyCylinder mount BodyCylinder rotor FixedShape baseOrientationIndicator FixedShape rotationIndicator FixedTranslation1 FixedTranslation
Mount of the gyro Rotor of the gyro Indicator of the orientation of the mount Indicator of the orientation of the rotor Distance from the mount to the outer ring Distance from the outer ring to the center of the gyro Placement for the indicator of the rotor orientation
FixedTranslation rotationIndicatorOrientator FixedRotation rotorFixedRotation FixedRotation innerRingFixedRotation FixedRotation outerRingFixedRotation FixedRotation forceOrientator Revolute X Revolute Y Revolute Z VoluminousWheel innerRing VoluminousWheel outerRing
Fixed rotation to line up the rotor initially Fixed rotation to line up the inner ring initially Fixed rotation to line up the outer ring initially Displacement showing where to put the external force Revolution around the X-axis Revolution around the Y-axis Revolution around the Z-axis Inner ring of the gyro Outer ring of the gyro
Table 1.36 List of connectors Connector
Connection description
connect(mount.frame_a, world. frame_b) connect(baseOrientationIndicator. frame_a, mount.frame_b) connect(outerRingFixedRotation. frame_b, outerRing.frame_a)) connect(innerRingFixedRotation. frame_b, innerRing.frame_a) connect(fixedTranslation1.frame_b, fixedTranslation.frame_a) connect(fixedTranslation1.frame_a, mount.frame_b) connect(rotor.frame_a, rotorFixedRotation.frame_b) connect(rotationIndicatorOrientator. frame_b, rotationIndicator.frame_a) connect(rotationIndicatorOrientator. frame_a, rotor.frame_a)
Connect fixed coordinate system with mount of the gyro Connect indicator of the orientation of the mount with mount of the gyro Connect fixed rotation to line up the outer ring initially with outer ring Connect fixed rotation to line up the inner ring initially with inner ring Set the distance between outer ring and the center of the rotor Set the distance between outer ring and the mount of the gyro Connect fixed rotation to line up the rotor initially with rotor Set placement for the indicator of the rotor orientation Connect placement for the indicator of the rotor orientation with rotor (continued)
88
1 Virtual Labs
Table 1.36 (continued) Connector
Connection description
connect(revoluteX.frame_b, innerRingFixedRotation.frame_a) connect(revoluteZ.frame_b, rotorFixedRotation.frame_a) connect(revoluteY.frame_b, outerRingFixedRotation.frame_a) connect(revoluteX.frame_b, revoluteZ. frame_a) connect(revoluteY.frame_b, revoluteX.frame_a) connect(fixedTranslation.frame_b, revoluteY.frame_a) connect(pulse1.y, force1.force)
Connect revolution around the X-axis with fixed rotation to line up the inner ring Connect revolution around the Z-axis with fixed rotation to line up the rotor initially Connect revolution around the Y-axis with fixed rotation to line up the outer ring initially Connect revolution around the X-axis with Z-axis
connect(forceOrientator.frame_b, force1.frame_b) connect(forceOrientator.frame_a, innerRingFixedRotation.frame_a)
Table 1.37
Connect revolution around the Y-axis with X-axis Connect revolution around the Y-axis with distance from the outer ring to the center of the gyro Apply an external signal to an external force component Set the direction of the external force in its coordinate system. Change the coordinate system of the external force to the coordinate system of the inner ring
General parameters of the model
Model the external force at the angles of application of force degOfForce = 45°, 90°, 120°. Task 2. Also try different values of the strength of the force (here called forceMagnitude) and the angular speed (here called spin) of the rotor and see how this affects the motion, as shown in Fig. 1.50. Do the modified parameters affect the gyro precession? Explain what you are watching. Task 3. Plot the angle of rotation of the rotor around the X-axis and the Y-axis at various magnitudes and angles of the applied force. Task 4. Change the angular velocity of the rotor and see how it affects its rotation around the X and Y axes and try to explain what you see.
1.2 Complex Models Table 1.38 Setting the parameters of the components The mount of the gyro
Rotor
Inner ring
Outer ring
89
90
1 Virtual Labs
Fig. 1.50 Setting the parameters of the component forceMagnitude
References 1. Sakai Learning Management System. https://www.sakailms.org/ 2. Rozhdestvensky, K, Ryzhov, V, Fedorova, T, Safronov, K, Tryaskin, N, Sulaiman Sh, A, Ovinis, M, Hassan, S.: Computer Modeling and Simulation of Dynamic Systems Using Wolfram SystemModeler. Springer Nature Singapore Pte Ltd. (2020). https://link.springer. com/book/10.1007/978-981-15-2803-3 3. Kolesov Yu, B., Senichenkov Yu, B.: Modeling Systems. Dynamic and Hybrid Systems. SPb.: BHV-Petersburg (2012) 4. Kolesov Yu, B., Senichenkov Yu, B.: Modeling Systems. Object Oriented Approach. SPb.: BHV-Petersburg (2012) 5. Wolfram SystemModeler. http://www.wolfram.com/system-modeler/ 6. Wolfram Mathematica. http://www.wolfram.com/mathematica/ 7. Levi-Civita, T., Amaldi, U.: The course of theoretical mechanics. Volume 2. Part 1. Dynamics of Systems with a Finite Number of Degrees of Freedom. M.: Publishing house of foreign literature (1951) 8. Yurevich, E.: The Theory of Automatic Control, 4th edn. SPb.: BHV-Petersburg (2016)
Chapter 2
Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Abstract This chapter provides recommendations for the implementation of the virtual labs considered in Chapter 1. This chapter is to be used when encountering difficulties in Chapter 1. The instructions contain the necessary reference material that is needed to complete the tasks. For each lab from the Chapter 1, there are guidelines and recommendations on how to construct the diagrams of component models and to perform the model simulation. In addition, example answers to the tasks set in each lab are provided.
2.1
Getting Start with Wolfram SystemModeler
The Wolfram System Modeler package provides powerful tools for modeling physical systems and processes not only using the Modelica language, but also with the help of an extensive library of physical and logical components. One of the goals of performing the virtual labs is to get familiar with the capabilities of the drag-and-drop interface of SystemModeler, which greatly simplifies the process of creating a model [1]. We present the basic principles of component modeling in Wolfram SystemModeler. You may read more about this in [2]. In the built-in Modelica library or in the library modelica://PlanarMechanics, find suitable ready-made components, drag-and-drop the found components from the Class Browser to the diagram area in the Diagram View and connect them with the help of the Connection Line Tool. After dragging a component to the diagram area, by simply clicking on it, a window with its characteristics will open at the bottom of the screen. Part of these characteristics you can set yourself, part is recommended to leave the “default”. For example, select the Revolute component (see Fig. 2.1) in the modelica:// PlanarMechanics.Joints library, which is often used in various mechanical systems, as discussed in this textbook. Clicking on the Revolute component will bring up the information given in Fig. 2.2. © The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2021 V. Ryzhov et al., Modeling and Simulation of Complex Dynamical Systems, https://doi.org/10.1007/978-981-16-3053-8_2
91
92
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.1 Component Revolute
Fig. 2.2 Parameters window of the selected component
If, after studying the provided information, you still have questions, then when you click on a component with the right mouse button, a pop-up window will appear in which you have to select “Class Documentation” (Fig. 2.3). This section contains complete information about the selected component. A large number of computer models of mechanical systems can be approximated and created using the freely distributed Modelica libraries: a simpler two-dimensional PlanarMechanics and a more complex three-dimensional Modelica.Mechanics.MultiBody. While building a model, remember to see detailed descriptions about components in Class Description. It provides a lot of useful information: class specification, settable parameters, and their possible values, related components, examples of using the component, possible visualization, etc. Moreover, you can find the definition of the component in the form of Modelica code. To do this, click on a component with the right mouse button, and then choose “Open Class” in a pop-up window (Fig. 2.4). After that, you will be able to get acquainted with the diagram of the component (if the selected component has it) and Modelica code. To read more about the Modelica language, see [3].
2.1 Getting Start with Wolfram SystemModeler
Fig. 2.3 Selection “Class Documentation”
Fig. 2.4 Opening a class definition
93
94
2.2
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Creating a Component Model
Consider the rules for creating a diagram of the component model. Let us begin, for example, with the construction of an auxiliary model that describes a simple one-dimensional spring system with damping. In the future, by copying this model or its elements, you can create much more complex models of oscillatory systems. Create a new model and open an empty layer in the Diagram View. Read more about this in [1, 2]. Then open Modelica Standard Library and find Mechanical.Translation Library (Fig. 2.5a). Find the Fixed component under Components and drag it onto the diagram layer (see Fig. 2.5b). To make the diagram layer look similar to the problem description, we can rotate the Fixed component by right-clicking on the component and go to Shape and the Rotate Right (or press Ctrl + R), Fig. 2.6. If everything was done correctly, you will see a component rotated 90°, e.g. simulating, in this case, a fixed point on the wall, as shown in Fig. 2.7. The next step is to add components to model the spring and the damper that is connected to the body. In the library, we can see that there is a component that combines a spring and a damper in one component, the SpringDamper. Drag this component to the diagram view. Now we need to connect these two components. This is done by clicking on the Connection Line Tool in the toolbar (or by pressing C), as shown in Fig. 2.8. Then connect the two components together. The result should look like Fig. 2.9. The next step is to add a mass that should model the body in the assignment model. Drag and drop a mass component to the diagram view. Connect the mass to the springDamper, as shown in Fig. 2.10.
Fig. 2.5 Selecting the required component from the library
2.2 Creating a Component Model
Fig. 2.6 Rotate the selected component
Fig. 2.7 A fixed point on the wall
Fig. 2.8 Connecting components together by Connection Line Tool
95
96
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.9 Model of spring with damper connected to fixed point
Fig. 2.10 Model of spring pendulum
Now we should add the force that will push on the mass. Open the Translational.Sources package and drag and drop a force component to the diagram view. We also need an input signal that controls how large the output force will be. Drag and drop the const component from the Modelica.Blocks.Sources package. Then connect the const component to the force component and the force component to the mass component, as shown in Fig. 2.11. If we fill in some values for the different parameters on the components, this system can now be simulated.
2.3
Setting the Initial Parameters of a Computer Model
To set a value to a parameter, click on the component that you would like to modify and fill in a value in the appropriate field as shown in Fig. 2.12. Fill in these values of the different components, as shown in Table 2.1. This will result in a system with a mass, starting at position x = 0.2, that is attached via a spring and a damper to a fixed point with a force pushing with 10 N on the mass. What do we expect to happen with this system? Well, since the mass starts at x = 0.2 and the unstretched length of the springDamper is 0.2 m, no force will initially come from the springDamper. However, a force of 10 N comes from
2.3 Setting the Initial Parameters of a Computer Model
Fig. 2.11 Diagram of the component model
Fig. 2.12 Set a value to a parameter of component
97
98
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Table 2.1 Setting parameters of computer model components
Parameter values
Description
springDamper.c = 100 N/m springDamper.d = 5 Ns/m springDamper.s_rel0 = 0.2 m
Spring constant Damping constant Unstretched spring length Relative distance Mass of the sliding mass Constant output value
springDamper.s_rel = 0.2 m (true) mass.m = 6 kg const.k = 10
an external source which will push on the mass. The springDamper will try to pull the mass back to the starting position and eventually the mass will find an equilibrium position.
2.4
Choosing a Numerical Method and Simulation Settings
To perform a computational experiment, it is necessary to choose a numerical method for solving the equations determining the mathematical model of the dynamical system. You also need to configure the following experiment parameters (see Fig. 2.13): Experiment start time (Start time), experiment end time (Stop time), integration step (Step size), accuracy (Tolerance). In addition, you should set the number (Number of intervals) or the length of the intervals (Interval length) to display graphical results. The listed parameters can also be specified in WSM “by default”. In the proposed virtual labs, the mathematical model of dynamic systems is determined by differential and algebraic equations. To solve systems of algebraic and differential equations in Wolfram SystemModeler (version 4.2), the following methods are used (field Solver, see Fig. 2.13): • • • • •
DASSL, CVODES, explicit Euler method (with a fixed step), Hoyn’s method (with a fixed step), Runge–Kutta method of fourth order (with a fixed step).
In this case, all numerical methods in this version of Wolfram SystemModeler allow solving only ordinary differential equations of the first-order. In this regard, ordinary differential equations that determine the mathematical model of the dynamical system should be reduced to first-order differential equations. In the settings of the computational experiment, it is possible to choose the method of solving the determining equations of the mathematical model, Fig. 2.13.
2.4 Choosing a Numerical Method and Simulation Settings
99
Fig. 2.13 Computational experiment settings
The DASSL and CVODES methods themselves control the integration step, while for the remaining methods, the integration step is fixed and can be set by the user (Step size field). Since the number of integration steps is usually large, not all steps can be displayed on charts, but only a certain number of them (Number of intervals field). Alternatively, you can specify the step length (Interval length field) with which points will be drawn on the graphs. Such settings can be useful, for example, in case the function oscillates quickly and its graph does not look smooth enough. DASSL DASSL (Differential/Algebraic System Solver) [4] is designed for the numerical solution of implicit systems of differential or differential–algebraic equations for y 2 RN with given initial conditions: F ðt; y; y0Þ ¼ 0; yðt0 Þ ¼ y0 : DASSL is useful for solving two classes of problems that cannot be solved by standard methods. The first class is represented by problems that cannot be brought to a standard form y0 ¼ f ðt; yÞ. The problems of the second class are theoretically
100
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
reducible to the standard form, but such a transformation leads to serious complications. For example, the conversion Ay0 ¼ By requires multiplication by an inverse matrix A1 . If matrix A is sparse, then the matrix A1 will not be the same, so the solution of the original problem is preferable. In particular, DASSL allows solving differential–algebraic equations when the matrix is degenerate. DASSL is based on the backward differentiation formula (BDF), which is part of a family of implicit multi-step numerical integration methods [5, 6]. At each time step, left finite differences (backward differences) are used to approximate time derivatives (backward differentiation): y0 ðtn Þ
yðtn Þ yðtn1 Þ yn yn1 : Dtn Dtn
Let yn be the exact value approximation yðtn Þ and Dtn ¼ tn tn1 the variable (generally) time step. The nonlinear system obtained at each time step is: Fðtn ; yn ;
yn yn1 Þ¼0 Dtn
Solving by Newton’s method: þ1 ym ¼ ym n n
@F yn yn1 @F þ 0 @y @y Dtn
1 ym n yn1 F t n ; ym ; ; n Dtn
where ym n is the approximation for yn obtained at step m. To accelerate convergence, the nonlinear system is written as: Fðt; y; ^ay þ bÞ ¼ 0 where ^a is a constant characterizing the step change, b is the vector dependent on the solution in the previous step. Values t, y, ^a and b are calculated at t ¼ tn . The converted system is solved by the modified Newton method. A more detailed description of the software is presented in [5]. Since DASSL is quite stable for a wide range of problems, it is chosen by default in Wolfram SystemModeler. CVODES CVODES (C-language Variable-coefficients ODE Solver) [7, 8] is a software tool for solving the Cauchy problem for systems of ordinary differential equations of the first-order (both rigid and non-rigid) with respect to y 2 RN , given explicitly as: y0 ¼ f ðt; yÞ; yðt0 Þ ¼ y0 : CVODES uses one of two numerical methods: using the difference approximation back method of the inverse differentiation (BDF) [5] and the implicit
2.4 Choosing a Numerical Method and Simulation Settings
101
Adams-Fulton method [9, 10]. Both methods can be represented by a linear multi-step formula: K1 X
an;i yni þ Dtn
i¼0
K2 X i¼0
bn;i y0ni ¼ 0;
where y0n ¼ f ðtn ; yn Þ. Coefficients an;i and bn;i uniquely define a specific integration formula, and an;0 ¼ 1. Adams-Fulton method is used for non-rigid problems. For this method K 1 ¼ 1 and K 2 ¼ q 1. The order of the formula q can vary from 1 to 12. For harder problems, use BDF with K 1 ¼ q and K 2 ¼ 0. The order of the formula q can vary from 1 to 5, and it is selected automatically and dynamically. In both cases, a system of nonlinear equations is solved for each value tn Gðyn Þ yn Dtn bn;0 f ðtn ; yn Þ an ¼ 0; an ¼
X i[0
an;i yni þ Dtn bn;i y0ni :
For non-rigid problems, the iterative process does not require solving systems of linear equations. For harder problems, the Newton method is used, which requires solving at each step a system of linear equations of the form þ1 m ym M ym n n ¼ Gðyn Þ where ym n is the approximation of yn obtained at step m, and M is the Jacobi matrix approximation: M I cJ; J ¼ @f =@y; c ¼ Dtn bn;0 If the right side and/or the initial conditions of the problem depend on the parameter p 2 RM : y0 ¼ f ðt; y; pÞ; yðt0 Þ ¼ y0 ðpÞ; CVODES can also perform forward or adjoint sensitivity analysis. A more detailed description of the software is presented in [7, 8]. Explicit Euler Method The Euler method is the simplest method [9, 10] of solving the Cauchy problem for first-order differential equations given explicitly as: y0 ¼ f ðt; yÞ; yðt0 Þ ¼ y0 :
102
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
This explicit one-step method of the first-order of accuracy is based on an approximation by an integral curve by a piecewise-linear function (Euler broken line), each step of which has the form: yn ¼ yn1 þ hf ðtn1 ; yn1 Þ: Hereinafter Dt ¼ h is a constant grid in time scale. The stability analysis of various variants of the Euler method is given in [11]. Heun’s Method The Heun’s method [12] is a special variant of the general scheme of the Runge– Kutta method, which has a second order of accuracy. It is designed to solve differential equations of the first-order, given explicitly as: y0 ¼ f ðt; yÞ; yðt0 Þ ¼ y0 : The method involves a double calculation of the value of the right side of the equation at each step tn with the predictor: ^yn ¼ yn1 þ hf ðtn1 ; yn1 Þ and h ^yn ¼ yn1 þ ðf ðtn1 ; yn1 Þ þ f ðtn ; ^yn ÞÞ: 2 The analysis of the stability of the method and its properties are presented in [11–13]. 4th order Runge–Kutta method Runge–Kutta methods are a large class of numerical methods for solving the Cauchy problem for first-order differential equations specified explicitly as: y0 ¼ f ðt; yÞ; yðt0 Þ ¼ y0 : A variant of the 4th order Runge–Kutta method [9, 13] implies a fourfold calculation of the value of the right side of the equation at each step tn : 8 k1 > > >
k > 3 > : k4
¼ f ðtn1 ; yn1 Þ ¼ f ðtn1 þ h2; yn1 þ k21 Þ ¼ f ðtn1 þ h2; yn1 þ k22 Þ ¼ f ðtn1 þ h; yn1 þ k3 Þ;
h yn ¼ yn1 þ ðk1 þ 2k2 þ 2k3 þ k4 Þ 6
2.4 Choosing a Numerical Method and Simulation Settings
103
The analysis of the stability of the method and its properties are presented in [10, 13].
2.5
Simulate a Model
Run . To simulate a model and see the generated 3D animation, follow the steps below: • Click the Simulate button
.
• When the simulation is finished, click the Animate button in Simulation Center. • Use your mouse or trackpad to drag the animation into a good angle and zoom in with your scroll wheel or by using the trackpad. Then click the Play button to play the animation. • Clicking on a blank area of the screen with the right mouse button will result in a pop-up window with additional features allowing you to look at the animation from different points, increase or decrease the screen size and trace the path of the selected item, see Fig. 2.14. Select the function “Trace Path” and check the items you want to trace, as shown in Fig. 2.15.
2.6
Plotting and Graph Analysis
WSM allows you to Plot both time diagrams (dependencies of a parameter on time) and phase diagrams (dependencies of some variables on others). To begin with, we will construct the schedule of the time dependence. To do this, click on the button on the toolbar. New Y(T) Plot Window, as shown in Fig. 2.16. In the Experiment Browser window, check the box, for example, opposite the variable x to plot the variable x time dependence, as shown in Fig. 2.17.
Fig. 2.14 Animation settings window
104
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.15 Select an element to trace its movement
Fig. 2.16 Select the type of graph showing the time dependence
An example illustrating the time dependence of the offset angle for a mathematical pendulum is shown in Fig. 2.18. In some cases, it is useful to consider the motion of the system in-phase space. The phase diagram method is convenient for the qualitative analysis of dynamic systems. In any system with one degree of freedom, the coordinate and velocity change with time. The state of the system at each time point can be characterized by two values of x and t, and on the plane of these variables this state is uniquely determined by the position of the imaging point with coordinates (x, t). Over time, the imaging point will move along a curve, which is called the phase trajectory of motion. Analysis of the trajectory allows you to judge the features of the process. The plane of the variables x and t is called the phase plane. The family of phase trajectories forms a phase portrait of a dynamic system. Construct the phase diagram.
2.6 Plotting and Graph Analysis
105
Fig. 2.17 Checkbox for plotting the variable x time dependence
Fig. 2.18 Graph of the time dependence of angle of offset of the mathematical pendulum (x ¼ 2 rad/s)
106
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.19 Selecting the phase diagram building mode
To do this, click on the button New Y(X) Plot Window on the toolbar, as shown in Fig. 2.19. Next, in the Experiment Browser window, first check the box next to the variable that will be plotted along the abscissa, and then the box next to the variable plotted along the ordinate. For example, to obtain the dependence of the angular velocity on the angle of offset of the mathematical pendulum, you need to check the boxes as follows, as shown in Fig. 2.20. As a result, you will obtain a graph as shown in Fig. 2.21. If you need to repeat a numerical experiment with other values of parameters within one task, you need to perform the following steps: • To create a new plot, click the toolbar icon
.
• To plot a variable, check its checkbox in the Plot window on the left in Simulation Center. • To create a new subplot, click the toolbar icon
.
• To plot two variables against each other in a parametric plot, click the toolbar and check the checkboxes of the two variables to plot. icon • To change a parameter value, first click Parameters next to the Plot tab. • Change a parameter by opening up a tree in the Parameters view and changing the value for the parameter you want to change. Then run the simulation again.
Fig. 2.20 Window Experiment Browser
2.7 FFT Analysis
107
Fig. 2.21 Phase diagram of the mathematical pendulum (x0 ¼ 2 rad/s)
2.7
FFT Analysis
To find the natural frequencies of the oscillatory systems, you can use the Fourier transform to go from the time scale to the frequency scale. To do this, you need to select the FFT analysis tool in the toolbar, Fig. 2.22. You will see a pop-up window for FFT analysis, in which you need to set the start and end times of the experiment and the limits of the frequencies you are interested in. For other values, use the “by default” option. In addition, it is necessary to determine the amplitude of the variable of interest. If the body makes an oscillatory motion that is described by variable r[1] on xaxis, drag the variable r[1] to the FFT analysis window, and then click OK with the set values, as shown in Fig. 2.23. In Fig. 2.24, the result of the FFT analysis of the x-coordinate of the body is presented for a given frequency change from 0 to 2.5 Hz.
Fig. 2.22 FFT analysis tool selection
108
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.23 FFT analysis tool settings window
Below are detailed instructions for performing virtual labs and answers to the questions posed in Chap. 1.
2.8
Guidelines for “Computer Modeling of Projectile Motion”
A description of the virtual lab is given in Sect. 1.2.1. Modeling Guidelines
The dynamic system consists of a body, with a given mass, which is considered in a fixed coordinate system. The corresponding diagram of the system component model is shown in Fig. 2.25. After simulating the model, you will see an animation of a computer model of the unconstrained motion of body, Fig. 2.26. Tasks instructions Below are comments and recommendations for performing of virtual lab. Task 1. Determining the angles of mounted and flat shooting.
2.8 Guidelines for “Computer Modeling of Projectile Motion”
109
Fig. 2.24 The result of the FFT analysis
Fig. 2.25 Diagram of the dynamic system component model: a body thrown at an angle to the horizon
A body thrown at an angle to the horizon moves along a parabola. The velocity vector is tangential to the parabola at any point. The speed of body movement changes only under the action of gravity—the body moves with the acceleration of free fall. The body’s flight distance is greatest if its initial speed is directed to the horizon at an angle of 45°. The body’s lifting height increases as the angle change from 0° to 90° when moving vertically upwards. If the target is at a distance less than the longest range of the flight, the projectile can hit it along two paths: with a tilt angle less than 45° (flat shooting at open targets), and with a tilt angle greater than 45° (mounted shooting at closed goals).
Fig. 2.26 Screenshot of the animation of the projectile motion of body
110
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Perform an analytical calculation to find the angle of the rifle in these two cases (using, for example, Wolfram Mathematica [14]), plot a parametric graph with the ability to change the angle of fire, as shown in Fig. 2.27. If everything is done correctly, you will get a solution for the first angle of 0.46 rad, for the second, an angle of 1.4072 rad. An example of mounted and flat shooting is shown in Fig. 2.28. The point of intersection of the graphs is the point B, which the bullet must hit. Task 2. Change the velocity of a bullet. Suppose you can change the speed of the bullet u. Find out at what minimum initial velocity u the bullet will reach point B. The bullet velocity u can be considered a function of the angle h. Using the equations for a body thrown at an angle to the horizon (see Sect. 1.2.1) for the initial data of the problem, it is easy to obtain: u¼
5000 pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi cosh 2ð5000 tan h 1500Þ=ð9:81Þ
The graph of this function is shown in Fig. 2.29. Find the minimum of this function (using the Wolfram Mathematica package). The minimum velocity is 256.1 m/s with an angle of 0.93 rad. Find the minimum bullet velocity u and the related angle h graphically by conducting a series of numerical simulation, where you can change both the initial velocity of the bullet and the angle of the shot and compare the result with the analytical one. Examples of numerical experiments are shown in Fig. 2.30.
Fig. 2.27 Graph with a slider to change the shooting angle
2.8 Guidelines for “Computer Modeling of Projectile Motion”
111
Fig. 2.28 Examples of two bullet paths (with mounted and flat shooting)
Fig. 2.29 The dependence of the velocity of the bullet from the angle h
Compare the obtained result with the analytical one. You should again get a minimum velocity of 256.1 m/s with a tilt angle of 0.93 rad. The flight schedule of the projectile with the specified initial data is shown in Fig. 2.31. Task 3. Solution Stability Analysis. Which angle h obtained in the previous task should be chosen for firing so that the deviation from the solution due to external influences was minimal? Determine analytically and verify using simulation. In Fig. 2.32, a series of three experiments for the smaller of the two angles with a step Dh = 0.05 rad is shown. What conclusions can you draw from this graph? When choosing an angle of 0.46 rad the solution turns out to be more “stable”, and when you hover over a larger angle of 1.4072 rad it is enough to change it to a
112
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler 1.396 rad u
287.8 m/s Projectile motion
y
0 8000
1000
2000
3000
4000
5000 8000
6000
6000
4000
4000
2000
2000
0 0
1000
2000
x
3000
4000
0 5000
Fig. 2.30 The trajectory of the projectile at angles 1.031 rad and 1.396 rad and initial speeds of 292.1 m/s and 287.8 m/s, respectively
Projectile motion 8000
0
1000
2000
3000
4000
5000 8000
6000
6000
4000
4000
2000
2000
0
0
1000
2000
3000
4000
0 5000
Fig. 2.31 The trajectory of the projectile at an angle of 0.93 rad and a minimum initial velocity of 256.1 m/s
few fractions of a radian to be very far from the goal. To confirm the above conclusion, conduct a series of experiments for 1.4072 rad. Task 4. The study of the time of flight of the bullet. Analytically and from the results of a numerical experiment, it is necessary to determine how the flight time t is related to the angle h at which the shooting is made. In this case, a larger angle h leads to a longer trajectory, which means a longer flight time, t.
2.9 Guidelines for “Computer Modeling of Spring-Damper System”
113
Fig. 2.32 Flight paths for a smaller firing angle with a sighting error Dh = ±0.05 rad
2.9
Guidelines for “Computer Modeling of Spring-Damper System”
A description of the virtual lab is given in Sect. 1.2.2. Modeling Guidelines The diagram of the component model of a spring pendulum with damping is shown in Fig. 2.11. The diagram of the component model of a pendulum with two masses is shown in Fig. 2.33. To observe the phenomenon of resonance in a two-mass system, replace both constant forces (see Fig. 2.34) with periodic ones with a frequency that will
Fig. 2.33 The diagram of the component model of a pendulum with two masses
114
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
coincide with the system’s own frequency. To achieve resonance with oscillations of the first mass, find the eigenfrequency of its oscillations using the well-known formula: rffiffiffiffi k x¼ m If you set the frequency of the external periodic force equal to the calculated angular frequency, then the external force will resonate with the first mass and spring. Calculate and set such parameters for the system. Note that x ¼ 2pf . The component model diagram for the study of the resonance phenomenon is shown in Fig. 2.34. Build a similar model using the Planar Mechanics library. When modeling, consider the possibility of both constant and cosine force. The result of modeling is shown in Fig. 2.35. An example of a screenshot of the system animation is shown in Fig. 2.36. Tasks instructions Task 1. Return to the auxiliary model of a simple spring pendulum with damping. Plot the position of the center of mass of the body. An example of such plot is given in Fig. 2.37. You should get the same or similar plot. Task 2. Conduct a series of experiments, changing the spring stiffness and damping. Examples of a series of graphs of damped oscillations are given in Fig. 2.38. Task 3. Switch to a two-mass system. Plot graphs of the position of the center of mass of both bodies. An example of such plot is given in Fig. 2.39. You should get the same or similar plot.
Fig. 2.34 The component model diagram for the study of the resonance phenomenon in a two-mass system
2.9 Guidelines for “Computer Modeling of Spring-Damper System”
115
Fig. 2.35 Component model diagram in Planar Mechanics
Fig. 2.36 Screenshot of a mechanical system motion animation example
Task 4. Plot graphs of the velocity of bodies in the selected period of time, as well as graphs of the offset of each of the springs. It is recommended to construct graphs of the velocities of the first and second masses when observing harmonic and non-harmonic oscillations. An example of
116
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.37 Position of the center of mass of the body
Fig. 2.38 Graphs of the dependence of the position of the center of mass of the body on time at different coefficients damping (blue line d = 0.1, green line d = 1, yellow line d = 3)
graphs is shown in Fig. 2.40. The mode of harmonic oscillations can be achieved by changing the value of the initial displacement of the springs. The plots of deformation of three springs of the system with non-harmonic oscillations are shown in Fig. 2.41.
2.9 Guidelines for “Computer Modeling of Spring-Damper System”
117
Fig. 2.39 Position of the centers of mass of two bodies (the upper graph is the left mass; the lower graph is the right mass)
Fig. 2.40 Velocities of the first (blue line) and second (yellow line) masses with harmonic and non-harmonic oscillations
Plot the deformation of three springs of the system with harmonic oscillations. Compare the results obtained for the case of non-harmonic and harmonic oscillations. Draw conclusions. Task 5. Conduct a series of experiments, changing the stiffness of the springs and damping. This task is performed in the same way as in task 2. Task 6. Calculate normal and partial oscillation frequencies of each of the bodies. Model the conditions under which oscillations of the bodies will be harmonic. In this case, you can determine the frequency of oscillations directly on the
118
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.41 Deformation of three springs of the system with non-harmonic oscillations (blue line— first spring, yellow line—second spring, green line—third spring)
graph and compare them with theoretical values that you obtained for normal frequencies. Check the accuracy of your results using FFT analysis. You can achieve harmonic oscillations as well as recommended in task 4. The eigenfrequency of the first mass obtained by FFT analysis is shown in Fig. 2.42. Task 7. Investigate the resonant modes of the mechanical system. Use a computer model of a system with two masses, springs, dampers, and external periodic force. To observe the resonance effect, increase the time of the experiment. Do this by clicking the “Settings” tab and changing the stop time to 500 s. When choosing a numerical method, use the CVODES solver.
Fig. 2.42 Eigenfrequency of the first mass, obtained using FFT analysis
2.9 Guidelines for “Computer Modeling of Spring-Damper System”
119
Fig. 2.43 Position mass plots
The resulting position plots of the masses will look something like it is shown in Fig. 2.43.
2.10
Guidelines for “Computer Modeling of Ballistic Pendulum”
A description of the virtual lab is given in Sect. 1.2.3. Modeling Guidelines The diagram of the component model of the mathematical pendulum (the basic diagram for labs containing the mathematical pendulum, as one of the components) is shown in Fig. 2.44. The model makes several simplifications: • in joints, friction is not taken into account; • rod mass is not taken into account; • in the model of the ballistic pendulum, it is assumed that the bullet is stuck in the bar, even if the model shows that it is flying out. It does not affect the velocity calculation. The diagram of the component model of a ballistic pendulum can be composed of a component model of the mathematical pendulum, a body modeling a bullet and a component describing an absolutely inelastic impact (Fig. 2.45). Creation of model Pin “Contact element”.
120
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.44 Diagram of the component model of the mathematical pendulum
Fig. 2.45 Component diagram of the ballistic pendulum
To create a new component, you need to write its code in the Modelica language. In addition to the code of the Pin component itself, we need auxiliary functions that convert the signal. They are defined by creating a function in a package called Functions. Since this is a package, when creating the class, we select the Package class type (Fig. 2.46).
Fig. 2.46 Create a custom package for Functions helper functions
2.10
Guidelines for “Computer Modeling of Ballistic Pendulum”
121
You can read more about creating packages in [2, 3]. Create two helper functions, one “Models an S-Function”.
and “Models a point-symmetric Triple S-Function”.
Now let’s create the main model.
122
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
This component is used to model the ground. Essentially it is a very stiff spring-damper component with large damping. However, it also has friction, which makes objects moving on the surface create a friction force that slows the movement down. An extension of the general model is our Pin model.
Let’s switch to the mode of creating icons and create an image of the Pin component (Fig. 2.47). The hierarchical structure of the created model is shown in the figure. It is a Pin model that calls the S_Func and TriplesS_Func functions from the Functions package and is an extension of the PartialSupportingPlanePin component (Fig. 2.48). A screenshot of the ballistic pendulum animation is shown in Fig. 2.49. Tasks instructions Task.1. Explore the ordinary free pendulum. Build the trajectory of its movement. An example of such a schedule is given in Fig. 2.50. Task 2. Plot the angle of deviation of the pendulum from the negative Y-axis for different values of the initial velocity. An example is given in Fig. 2.51.
Fig. 2.47 Icon “Pin”
2.10
Guidelines for “Computer Modeling of Ballistic Pendulum”
Fig. 2.48 The hierarchical structure of the created model Pin
Fig. 2.49 A screenshot of the ballistic pendulum animation
Fig. 2.50 The trajectory of the free pendulum
123
124
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.51 The angular offset of the free pendulum
Task 3. Go to the ballistic pendulum model. Build graphs of the trajectory of the box and the graph of its angle of deviation (in degrees °) from the negative Y-axis. Use these graphs to determine the velocity of the bullet. Examples of the graphs are shown in Figs. 2.52 and 2.53. Task 4. Write the analytical expression for the difference between the initial height and the height at the maximum deviation angle Dh ¼ hHmax h0 .
Fig. 2.52 The trajectory of the box
2.10
Guidelines for “Computer Modeling of Ballistic Pendulum”
125
Fig. 2.53 Angle of deviation (in degrees °) from the negative y-axis
We write the expression for the height in the extreme position: hhmax ¼ h0 coshmax Then Dh will be: Dh ¼ hhmax h0 ¼ h0 ð1 coshmax Þ Taking in this experiment h0 ¼ 1, we get: Dh ¼ 1 coshmax Express the initial velocity of the pendulum v0 through the maximum deviation angle. We write the law of conservation of energy: 1 U0;hmax ¼ m v2hmax v20 þ mgðhhmax h0 Þ ¼ 0 2 Then: 1 mv0 2 þ mgð1 coshmax Þ ¼ 0 2 The final dependence of the initial velocity of the pendulum on the maximum angle of deviation v0 ¼
pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2gð1 coshmax Þ
126
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Change the initial velocity, v0 in the numerical experiment and determine Dh from the graphs to make sure that the derived ratio is correct. Run the animation and check that your conclusions are correct. Task 5. Find at what value of the initial velocity, v0 that puts the pendulum in rotation. Answer: v0 ’ 6.3 м/c. Task 6. Use formulas from the theoretical part to get the value of the velocity after the impact and compare it with the value that you determined as a result of simulation. We first find the relationship between the initial velocity of the bullet and the velocity of the pendulum after the impact. We write the law of conservation of momentum: mprojectile vprojectile;before þ mbox vbox;before ¼ mprojectile þ mbox vafter Here projectile—bullet, box—body, before—velocity before impact, after— velocity after impact. Substitute the masses of the box 20 kg and bullet 0.05 kg and take into account that at the initial moment the box was at rest 0:05 vprojectile;before þ 20 0 ¼ ð0:05 þ 20Þvafter Finally, we have for the velocity of the bullet before the impact: vprojectile;before ¼
20:05 vafter 0:05
We take into account that the velocity after a collision is the initial velocity of the pendulum: vafter ¼
pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2gð1 coshmax Þ
Using this formula, we determine the bullet velocity: vprojectile;before ¼
20:05 pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2gð1 coshmax Þ 0:05
From the graph Fig. 2.53 of the angle of deflection of the pendulum after the collision of a box with a bullet we get: hmax ¼ 10:1 1 cosðhmax Þ ¼ 0:017
2.10
Guidelines for “Computer Modeling of Ballistic Pendulum”
127
Finally, for bullet velocity we have: vprojectile;before ¼
20:05 pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2 g 0:017 ¼ 231:59 m=s 0:05
In the experiment, the speed was set at 230 m/s, which is in agreement with the calculations.
2.11
Guidelines for “Computer Modeling of Newton’s Cradle”
A description of the virtual lab is given in Sect. 1.2.4. Modeling Guidelines The diagram of the component model of the Newton pendulum is shown in Fig. 2.54. A screenshot of Newton’s pendulum animation is shown in Fig. 2.55. You see a three-dimensional visualization of the model. On the left—fixed point, combined with the origin. Balls are attached to each of the fixed points using rods. The left ball is deflected from the equilibrium position.
Fig. 2.54 Newton’s pendulum component model diagram
128
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.55 A screenshot of Newton’s pendulum animation
Tasks instructions Task 1. Check the law of conservation of energy in the system in the case of a perfectly elastic impact by plotting the kinetic energy, potential energy, and total energy. The resulting graphs are shown in Fig. 2.56. Task 2. Change the simulation settings in the Simulation Center window. The damping parameter affects the value of the total energy that is lost due to friction
Fig. 2.56 Kinetic (yellow line), potential (green line), and total energy (blue line) of a mechanical system
2.11
Guidelines for “Computer Modeling of Newton’s Cradle”
129
Fig. 2.57 Change the numeric value of the damping parameter
when the balls collide with each other. Set the damping parameter to 1000 N s, which physically means that part of the energy is lost in the collision process. To perform tasks 2 and 3 switch to the Parameter tab on the left in the Experiment Browser, Fig. 2.57. Conduct a numerical experiment for the modified value of the damping parameter. Task 3. Conduct a series of experiments: change the damping parameter to see on how it affects the behavior of the system. An example of a graph illustrating the energy loss during an elastic impact, obtained as a result of a numerical experiment, is shown in Fig. 2.58. Changing numeric values of damping parameter, draw conclusions how it affects the behavior of the system. Task 4. Plot the deflection angles, velocities, and accelerations of the balls as a function of time, as well as the trajectories of the balls for a perfectly elastic impact, and explain what you observe. Examples of graphs of deflection angles, velocities, and accelerations of balls (first and fifth) as a function of time for a perfectly elastic impact are given in Figs. 2.59, 2.60 and 2.61. The trajectories of all the balls of the Newton pendulum are shown in Fig. 2.62. Task 5. Investigate the motion characteristics of the Newton pendulum with different masses of balls. Examples of such graphs are given in this chapter. You should get the same or similar graphs. In Figs. 2.63 and 2.64 you see graphs with the mass of the first ball of 2 kg, and the fifth—0.5 kg.
130
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.58 An example of a graph illustrating the energy loss during an elastic impact
Fig. 2.59 Angular deviations of the balls
Fig. 2.60 Angular velocities of the first and fifth balls
2.12
Guidelines for “Computer Modeling of Rotational …”
131
Fig. 2.61 The acceleration of the first and fifth balls
Fig. 2.62 Trajectories of all five Newton pendulum balls
2.12
Guidelines for “Computer Modeling of Rotational Motion of Bodies”
A description of the virtual lab is given in Sect. 1.2.5. Modeling Guidelines Dynamic system A. The component diagram of two rotating bodies consists of a rod and a revolute with two bodies attached to it, as shown in Fig. 2.65. Dynamic system B. If the angles b 6¼ 90° need to be changed in a series of computational experiments, then two bodies are attached to the rotating axis with the help of rotating elements, as shown in Fig. 2.66.
132
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.63 Animation and trajectories of the “asymmetric” Newton cradle
Fig. 2.64 The velocities of the first ball (blue line) and the fifth ball (yellow line) in the “asymmetric” Newton cradle
2.12
Guidelines for “Computer Modeling of Rotational …”
133
Fig. 2.65 Diagram of the component model of two rotating bodies, system A
Fig. 2.66 Component model diagram of two rotating bodies, system B
Dynamic system C. The collision model diagram is shown in Fig. 2.67. Tasks instructions Task 1. When you run a numerical experiment, change the values of r within the limits shown in Table 1.16 “Values of the parameter r”. The result of your numerical experiment should be as in Table 2.2.
Fig. 2.67 Diagram of the two-body collision component model, system C
134
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Table 2.2 The dependence of the angular velocity x on the distance r r
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
x
2:828
3:142
3:536
4:041
4:714
5:657
7:071
9:428
14:142
28:284
Observe the angular velocity in the plot “Angular Velocity”. Animate your model if you are curious on how it looks. An example of screenshot is shown in Fig. 2.68. Task 2. Starting a numerical experiment, change the values of the angle b within the limits indicated in Table 1.19 “Values of the parameter b” in the Subsect. 1.2.4. The result of your numerical experiment should be as in Table 2.3. Task for individual research (high complexity). An example of screenshot is shown in Fig. 2.69. Task 3. Build trajectories of rotating and projectile balls on the same graph (Fig. 2.70). In Fig. 2.71 is a graph of the trajectories of rotating and projectile balls. Conduct a series of experiments, changing the mass of the two balls. Conduct a second series of experiments, changing the initial velocity of the projectile ball.
Fig. 2.68 Angular velocity of the distance between the balls with the animation window
2.12
Guidelines for “Computer Modeling of Rotational …”
135
Table 2.3 The dependence of the angular velocity x on the angle b b
90
80
70
60
50
40
30
20
10
rad
x
2:828
2:872
3:01
3:266
3:692
4:4
5:657
8:27
16:288
rad=s
Fig. 2.69 A screenshot of animation for a complex model
Fig. 2.70 Screenshot example: the ball and free end of the rod collision (a) and turning the mechanical system as a result of a collision (b)
Task 4. Plot graphs of the angular velocity of the rotating ball and the velocity of the projectile ball before and after the collision for the series of experiments proposed above. Figure 2.72 shows the angular velocity of the rotating ball and the velocity of the projectile ball before and after the collision for the experiment. Task 5. Find the change in angular momentum caused by the impact.
136
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.71 Trajectories of rotating (blue line) and projectile (yellow line) balls on the same graph
Fig. 2.72 Angular velocity of the rotating ball (blue line) and the velocity of the projectile ball (yellow line) before and after the collision
Consider a ball on a rod. Before the collision, it was in rest H before ¼ 0. After the impact, its angular momentum can be found using the formula H after ¼ mxr 2 .
2.12
Guidelines for “Computer Modeling of Rotational …”
137
M ¼ DH ¼ Hafter Hbefore Find the value of the angular velocity of the ball from the graph (see, for example, Fig. 2.72). M 25:2 H M Task 6. Use graphs of the velocity to calculate the impulse change at 10 m/s. What kind of collision is this? * Answer: Δp 0, with this collision, the law of conservation of the linear momentum of the system is fulfilled.
2.13
Guidelines for “Computer Modeling of Elliptic Pendulum”
A description of the virtual lab is given in Sect. 1.2.6. Modeling Guidelines The diagram of the component model of the elliptical pendulum is shown in Fig. 2.73. A screenshot of an elliptic pendulum animation is shown in Fig. 2.74. Tasks instructions Task 1. Plot a graph of the tension force of the thread depending on the time for a given acceleration of the car. Repeat the experiment at various accelerations to make a conclusion about the dependence Tða0 Þ. Present results on one graph. Compare the results with those calculated analytically. Figure 2.75 shows the time dependencies of the tension are given for different values of acceleration. We construct an analytical solution. We will show the forces acting on the body in Fig. 2.76. Newton’s second law can be applied to both the tangential and the normal components of the motion. Tangential component: X
F t ¼ mat
€ a0 sinH mgcosH ¼ m r H € ¼ g cosH þ a0 sinH rH
138
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.73 The diagram of the component model of the elliptical pendulum
Fig. 2.74 A screenshot of an elliptic pendulum animation
2.13
Guidelines for “Computer Modeling of Elliptic Pendulum”
139
Fig. 2.75 Time dependencies of the tension for different values of acceleration a0 ¼ 0:1; 1; 5 m=s respectively, blue, yellow and green lines correspondingly
Fig. 2.76 An animation of an elliptical pendulum with applied forces
For the normal component we have: X F n ¼ man 2 _ a0 cosH T mgsinH ¼ m r H
140
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
To eliminate the derivatives, we use the relation: _ € Hd:H ¼ HdH _ integrating tangential equation: You can get H _ _2 H H Z H _ H _ ¼ Z 1 ðgcos H þ a0 sin HÞdH ¼ Hd r 2 0 0
expressing the tension force of the pendulum thread from the normal equation we get: 2 _ a0 cosH þ mgsinH T ¼ m rH T ¼ mð3gsinH 3a0 cosHÞ With increasing acceleration, a0 the value of the tension of the thread T decreases, which is consistent with the results shown in the graph. The tasks 2–4 are performed in the same way as task 1. In task 5, summarize the results obtained in tasks 1–4.
2.14
Guidelines for “Computer Modeling of Coupled Pendulum System”
A description of the virtual lab is given in Sect. 1.2.7. Modeling Guidelines The diagram of the component model of the mathematical pendulum is from the previous labs. A diagram of the component model of coupled pendulums is shown in Fig. 2.77. Tasks instructions Tasks for modeling a free pendulum. Task 1. The study of the kinematic behavior of the pendulum. The plot of the angle of displacement of the pendulum as a function of time is shown in Fig. 2.78. The plot of the angular velocity as a function of time may be drawn in the same way. Figure 2.79 shows the phase diagram. As can be seen from the graphs, under given initial conditions, the pendulum performs harmonic oscillations. Task 2. Analytical and graphical solution for oscillation frequency of a free pendulum.
2.14
Guidelines for “Computer Modeling of Coupled Pendulum System”
141
Fig. 2.77 Component model diagram of coupled pendulums
Graphically. From the analysis of the graph presented in Fig. 2.79, it is possible to determine the oscillation period (geometrically). It turns out to be: T 2:061 c: Analytically. On the other hand, according to the formula for calculating the period of small oscillations, we obtain: sffiffiffi l 2:01: T ¼ 2p g The graph shows that the angular amplitude is h 0.65 rad (37°). This means that the oscillations can no longer be considered small, which explains the discrepancy in the values of the period.
142
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.78 Angle of displacement of the pendulum as a function of time (x ¼ 2 rad/s)
Fig. 2.79 Phase diagram of the mathematical pendulum (x0 ¼ 2 rad/s)
If you use the formula for the case of finite amplitudes, you can get (if you take, for example, the first two terms): 2
3 2 1 32 1 2 a 4 a 6 1 þ 2 sin 2 þ 2 4 sin 2 þ 7 6 7 T ¼ T0 6 7 2:057; 4 5 ð2n 1Þ!! 2 2n a þ sin þ ð2nÞ!! 2 which is much better and consistent with the result of the computational experiment.
2.14
Guidelines for “Computer Modeling of Coupled Pendulum System”
143
Fig. 2.80 Amplitude-frequency characteristics of the free pendulum
Thus, the natural frequency of oscillations of a pendulum under the given initial conditions is f ¼ T1 0:485 Hz. Task 3. Find the oscillation frequency of a free pendulum using a tool «FFT analysis». The natural frequency of oscillation of the pendulum can also be determined by building the amplitude-frequency characteristic (AFC), as shown in Fig. 2.80. The oscillation frequency is also about 0.5 Hz. Task 4. Study of the dynamic behavior of pendulum. Select the initial values of the angular velocity of the pendulum from the recommended range 8\x0 \8 rad/s with a step of 2 rad/s with zero initial deviation u0 ¼ 0. It is clear that when the initial value of the angle is shifted by 2p, the form of the phase portrait for oscillations will not change. Therefore, the graph can be immediately supplemented with phase trajectories for the cases u0 ¼ 2p and u0 ¼ 2p. The result is shown in Fig. 2.81. It can be seen from the figure that when the initial value of the angular velocity modulus exceeds a certain number, the nature of the motion of the pendulum changes, namely, the oscillations are replaced by rotation around the point of suspension. Thus, there are two types of phase trajectories corresponding to two types of motion: closed trajectories (oscillations) and unclosed trajectories (rotation around the point of suspension).
Fig. 2.81 Phase portrait of the mathematical pendulum at different initial values of the angular velocity x0 (rad/s): blue— x0 ¼ 2 and x0 ¼ 2, yellow—x0 ¼ 4 and x0 ¼ 4, green—x0 ¼ 6 and x0 ¼ 6, red— x0 ¼ 8, lilac—x0 ¼ 8
144
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.82 Screenshot of animation of coupled pendulums
Find the trajectory that will be a transition between the two types of movement using law of conservation of energy. Tasks for modeling a coupled pendulum. The animation of the coupled pendulums is shown in Fig. 2.82. Task 1. Time dependencies of parameters characterizing the dynamic behavior of the system. Plot the x-positions of the two pendulum masses (Fig. 2.83). A clear pattern cannot really be seen here of how the masses oscillate (Fig. 2.83). Let us increase the simulation time from 10 to 100 s. This may be done under the Settings tab. Change Stop Time [s] to 100 s. We can also increase the number of times to save the result by increasing the number of intervals. This will
Fig. 2.83 The x-positions of the two pendulum masses, time 10 s, 2000 intervals (the upper graph is the left mass, the lower graph is the right mass)
2.14
Guidelines for “Computer Modeling of Coupled Pendulum System”
145
Fig. 2.84 Setting up a numerical experiment
give us more data points to plot from, and also gives the animation more frames, which gives us the possibility to slow down the animation by a great amount. Increase the number of intervals from 2000 intervals to 10,000 intervals. The settings should now look like this (see Fig. 2.84). Run the simulation again and plot the x-positions of the masses, as shown in Fig. 2.85.
Fig. 2.85 The x-positions of the two pendulum masses, time 100 s, 10,000 intervals (the upper graph is the left mass, the lower graph is the right mass)
146
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.86 Graphs of the displacement angles of mathematical pendulums as a function of time: blue—the first pendulum, yellow—the second pendulum
The plot of the time changes in the angles of displacement of the pendulums (20 s) is shown in Fig. 2.86. As can be seen from the above figures, under these initial conditions, the oscillations of the pendulums are not harmonic. Also, in Fig. 2.86, it is clear that oscillations are made by pendulums in antiphase. Draw the plot of the angular velocity and phase diagrams of both pendulums. Then perform the same plots, increasing the simulation time to 100 s. Task 2. Observation of the beat pattern. Remove the external force, and as the initial condition, we give the first pendulum the initial angular velocity xx0 ¼ 2 rad/s. The displacement angles and the phase diagram of the first pendulum are presented in Figs. 2.87 and 2.88 (simulation time—20 s). Figures 2.87 and 2.88 shows that the oscillations are not harmonic. However, the phase diagram shows that pendulums have two “centers” (or a segment along the abscissa axis), with respect to which oscillations are made, which roughly corresponds to the beat pattern. Without external force, the swing of the pendulums became approximately the same. Plot of the angular velocity and phase diagram for the second pendulum. After that, try to reduce the swing of the oscillations of the pendulums, taking the initial condition for the angular velocity xx0 ¼ 0:2 rad/s. Do the oscillations become closer to harmonical? Task 3. FFT-dual mass analysis. Let us return to the initial settings of the system parameters with the frequency of the driving force in the X-direction equal to f ¼ 1 Hz.
2.14
Guidelines for “Computer Modeling of Coupled Pendulum System”
147
Fig. 2.87 Angles of displacement of pendulums as a function of time: blue—the first pendulum, yellow—the second pendulum (xx0 ¼ 2 rad/s)
Fig. 2.88 Phase diagram of the first pendulum (xx0 ¼ 2 rad/s)
Theoretical calculations give us two values of natural frequencies: x1 ¼ 0:511964 Hz x2 ¼ 1:12947 Hz The graphs of the amplitude-frequency and phase-frequency characteristics of the first pendulum are shown in Fig. 2.89. Draw the amplitude-frequency and phase-frequency characteristics for the second pendulum and compare them with the theoretical frequencies. Why is there a peak at the frequency f ¼ 1 Hz in Fig. 2.89
148
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.89 Graphs of the amplitude-frequency and phase-frequency characteristics of the pendulum 1: above—frequency response, below—phase response
2.15
Guidelines for “Computer Modeling of Double Pendulum”
A description of the virtual lab is given in Sect. 1.2.8. Modeling Guidelines The diagram of the component model of the double pendulum with two degrees of freedom is shown in Fig. 2.90. An example of a screenshot of a double pendulum animation is shown in Fig. 2.91. The diagram of the component model of the double pendulum with three degrees of freedom is shown in Fig. 2.92. To calculate this analytically, it would require some dedicated work. It is possible, but now it is starting to make sense to use modeling instead of analytical approaches to analyze a system, as shown in Fig. 2.93. Figure 2.94 is a picture of the 3D-double pendulum’s masses trajectories after 40 s of simulation. Two forces were applied, one in the X-direction with amplitude = 50 and frequency = 0.1 Hz, and one force in the z-direction with amplitude = 10 and frequency = 1 Hz. Tasks instructions Task 1. Carry out a numerical experiment with different initial velocities for two masses and see how the constructed model behaves. Draw conclusions. In Fig. 2.95 plots of time dependencies of angular displacements of two masses with different initial velocities and with (a) non-zero and (b) zero initial angular displacement are shown. Blue line indicates the dependencies of the first (upper) mass, yellow line—second (lower) mass. Plot a series of time dependencies of angular displacements of bodies. It is recommended to choose zero initial velocities for each mass and plot a series of
2.15
Guidelines for “Computer Modeling of Double Pendulum”
149
Fig. 2.90 Dual pendulum component model with two degrees of freedom
Fig. 2.91 Screenshot of double pendulum animation
graphs with the same angular positions, different angular positions, and equal in magnitude and opposite in sign for angular positions. In Fig. 2.96 we have (a) the same and (b) opposite initial angular displacements. Task 2. Plot a series of graphs of angular velocities of bodies depending on time. Draw conclusions.
150
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.92 Diagram of the component model of a double pendulum with three degrees of freedom
The task is carried out similarly to task 1. It is recommended to choose the same initial conditions as in the previous series of experiments. The checkbox for plotting graphs must be placed at angular velocities, not displacements. Task 3. Plot phase diagrams (dependence of the angular velocity on the angle of offset) of the first and second bodies for different values of parameters. Explain the type of received graphs. It is recommended to take the parameters from tasks 1 and 2, in particular, to consider cases of in-phase and antiphase oscillations and observation of beats. Figure 2.97 shows an example of a phase diagram for a single mass of a double 2D pendulum when observing beats. Task 4. Determine the natural frequency of the double pendulum using the tool “FFT analysis”.
2.15
Guidelines for “Computer Modeling of Double Pendulum”
151
Fig. 2.93 Screenshot of double 3D pendulum animation
Fig. 2.94 Screenshot of animation with the trajectories of motion of two masses of a double 3D pendulum
You can determine the oscillation frequency in Wolfram SystemModeler using the FFT analysis tool by analyzing the amplitude-frequency characteristic of the system. This method is applicable for finding the oscillation frequency in the case of a double pendulum, as shown in Fig. 2.98. Task 5. Apply to the second (lower) mass different external forces to study the behavior of the system. It is recommended to compare the behavior of the system in the absence of external forces and with an external force of a constant amplitude of 10 N, changing the frequency of its periodic component so as to try to observe the phenomenon of resonance. In Fig. 2.99, it is clearly seen how the amplitude of oscillations of the lower mass increases with a change in the frequency of the applied force.
152
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.95 Time dependencies of angular displacements of two masses with different initial velocities and a non-zero and b zero initial angular displacement
Fig. 2.96 Time dependencies of angular displacements of bodies with zero initial velocities and a the same and b opposite initial angular displacement
Task 6. Repeat experiments from tasks 1–5 for cases of different masses. Consider extreme cases of a very large lower mass and a very small lower mass. How did the change in this parameter affect the results of the experiment? (Fig. 2.100). Have the natural frequencies of the system changed? Perform additional FFT analysis. Record the resulting graphs. Draw conclusions. To conduct FFT analysis, look at the results of task 4. Task 7. Repeat experiments from tasks 1–5 for cases of different lengths of rods. Consider the limiting cases of a very large lower rod and a very small lower rod. How did the change in this parameter affect the results of the experiment? (Fig. 2.101).
2.15
Guidelines for “Computer Modeling of Double Pendulum”
153
Fig. 2.97 Phase diagram for one mass of the double 2D pendulum
Fig. 2.98 Frequency response of a double 2D pendulum
3D double pendulum Find the natural oscillation frequencies of the 3D double pendulum using the FFT analysis tool. Record the resulting graphs. Compare the results with the 2D case. Draw conclusions (Fig. 2.102).
154
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.99 The angular displacement of the lower mass in the absence of external force (blue line) and at a frequency of external force of 0.25 and 0. 5 Hz (yellow and green lines)
Fig. 2.100 Displacement of the lower mass with the same mass of 5 kg (dark blue graph), with the lower mass 0.1 kg (yellow graph), with the lower mass 50 kg (light blue graph)
2.15
Guidelines for “Computer Modeling of Double Pendulum”
155
Fig. 2.101 Displacement of the lower mass with the same suspension length of 1 m (dark blue graph), with lower and upper suspensions of 10 m and 0.1 m, respectively (yellow graph), and with the lower and upper suspensions of 0.1 m and 10 m, respectively (light blue graph)
Tasks for modeling a complex pendulum system. Running a numerical experiment in the Simulation Center window should result in the creation of the 3D animation (see Fig. 2.103): Task 1. Qualitative analysis of system behavior. Upper bodies tracing is presented in Fig. 2.104. Tracing for lower bodies. Task 2. The study of the kinematic behavior of the system. The task is performed in the same way as for the coupled pendulum. From the qualitative analysis, it only makes sense to investigate the movement of upper loads, since it does not have a pronounced chaotic character. The graph of changes in the angles of displacement of bodies as function of time (20 s) is shown in Fig. 2.105, the graph of the angular velocity as function of time is shown in Fig. 2.106. Phase diagrams of both bodies are shown in Fig. 2.107. An FFT analysis of this system, modeled for 1000 s, will reveal the chaotic behavior of this very complex system (Fig. 2.108): This system has a very large number of natural frequencies that are difficult to separate.
156
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.102 Frequency response of a double 3D pendulum
Fig. 2.103 3D animation of a complex pendulum system
Fig. 2.104 3D animation of a complex pendulum system with tracing the movement of upper and middle bodies
2.16
Guidelines for “Computer Modeling of Rotating Swing”
157
Fig. 2.105 Angles of displacement of the upper bodies as function of time: blue is the first body, yellow is the second body
Fig. 2.106 Angular velocity of the upper bodies as function of time: blue is the first body, yellow is the second body
2.16
Guidelines for “Computer Modeling of Rotating Swing”
A description of the virtual lab is given in Sect. 1.2.9. Modeling Guidelines Let’s start with building the simplest component model, consisting of only one cradle, rotating on the rod in a circle (Fig. 2.109). Connect a three-dimensional double pendulum on the diagram layer. Connect to it the vertical and horizontal rods connected by the FixedRotation. Fix the
158
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.107 Phase diagrams of the upper bodies: blue is the first body, yellow is the second body
Fig. 2.108 Amplitude-frequency characteristics of a complex pendulum system
Fig. 2.109 Simplest component model of Rotating Swing
2.16
Guidelines for “Computer Modeling of Rotating Swing”
159
horizontal rod in the revolute, and apply an external constant torque that will rotate the entire structure. The diagram of the component model of swing on a rigid rod is shown in Fig. 2.110. The easiest way to get the swing construction to rotate in the way you want, is to use a PID controller to control the torque. It can be found under Modelica.Blocks. Continuous.LimPID. Details on creating a control loop can be found in Sect. 2.1. The control loop will look like below, as shown in Fig. 2.111. Next, you need to create a model of the rope and replace a hard rod with it. Details on the modeling of the rope can be found in Sect. 2.1. Run simulation of your model with the component “fivePend” and see if the “rope” will behave better, as shown in Fig. 2.112.
Fig. 2.110 The diagram of the component model of swing on a rigid rod
160
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.111 The control loop of Rotating Swing
Fig. 2.112 Screenshot of the animation of “rope”, modelled by 5 pendulums
Assemble the same model again, placing instead of the simple Body components new “fivePend” components i.e. four connected components of five pendulums, as shown in Fig. 2.113. The “rope” is now 20 pendulums. You can create a component model of the swing using many pendulums. The five-tiered rope with the cradle, which you modeled in the second part of the work will be used in this part as a new component. Connect 8 “ropes” with the cradles. Connect the swing with three revolutes, as described in the Sect. 2.1. Apply constant torques to the revolutes and connect an angular velocity control module. The diagram of component model of the swing is shown in Fig. 2.114. A screenshot of the animation of a rotating swing is shown in Fig. 2.115.
2.16
Guidelines for “Computer Modeling of Rotating Swing”
161
Fig. 2.113 Diagram of component model “Rope”, consisting of twenty pendulums
Tasks instructions Tasks for modeling a five-linked rope with a cradle. Task 1. Plot the kinematic behavior of the five-link “rope”. Use the “trace” option to make sure your results are correct. Figure 2.116 shows an example of the kinematic dependence for the five-link “rope”. Figure 2.117 shows an example of the movement tracing. Task 2. Plot the angular offset and angular velocity of each of the five links of your “rope”.
162
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.114 The diagram of component model of the swing
Fig. 2.115 Animation of a rotating swing at 15 and 28 s of experiment
The task is performed in the same way as task 1. Tasks for modeling of Rotating Swing. Task 1. Plot the offset of any three cradles on the ropes along the x-axis and along the y-axis. Figure 2.118 is an example of a graph illustrating the angular offset of the cradle over a time interval of 90 s. Task 2. Plot the angular offset of the cradle, graphs of angular velocities, and accelerations over a time interval of 90 s.
2.16
Guidelines for “Computer Modeling of Rotating Swing”
163
Fig. 2.116 An example of kinematic dependence for the five-link “rope” (the coordinates of the third (yellow) and fourth (blue) links of the “rope” are shown)
Fig. 2.117 Tracing the movement of the swing on the five-link “rope” and tracing the movement of each link separately
Task 2 is performed in the same way as task 1. Task 3. What will happen at 70 s? When performing animation, it looks like this, Fig. 2.119. At 70 s, the PID controller will reduce the angular velocity of rotation of the swing, so that the movement at 80 s coincides with the movement at 15 s. Task 4. Plot a graph of the projection of the motion path of the cradles on the XY plane. In Fig. 2.120, an example of the trajectory of the first swing cradle is shown (projections of the trajectory on the XY plane).
164
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.118 The angular offset of the cradle over a time interval of 90 s
Fig. 2.119 Animation of swing for 15, 70, and 80 s. Illustration of the operation of the PID controller
2.17
Guidelines for “Computer Modeling of Gyroscopic Precession”
165
Fig. 2.120 Trajectory of the first swing cradle (projections of the trajectory on the XY plane)
2.17
Guidelines for “Computer Modeling of Gyroscopic Precession”
A description of the virtual lab is given in Sect. 1.2.10. Modeling Guidelines Due to the complexity of both the mathematical description and the component modeling of the gyroscope, when constructing a diagram, you can use the list of connectors. The gyroscope component model diagram is shown in Fig. 2.121. A screenshot of the gyro animation is shown in Fig. 2.122. Tasks instructions Task 1. By simulating the model, you can try different values of the parameters and see how the gyro behaves. One of the most interesting parameters is the degreeOfForce, which will put the force on the inner ring at the degree specified, where 0 degrees is “3 o’clock”, 90° is “12 o’clock”, etc. Try different values and check for yourself that the force always gets delayed by 90°. Try to explain what you are observing. Run the animation in real time and make sure that your assumptions about the nature of the movement of the gyroscope are correct. Model the external force at the angles of application of force degOfForce = 45°, 90°, 120°. Examples with the different angles of force application is shown in Fig. 2.123.
166
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler
Fig. 2.121 Gyro component model diagram
Fig. 2.122 A screenshot of the gyro animation
Task 2. Also try different values of the strength of the force (here called forceMagnitude) and the angular speed (here called spin) of the rotor and see how this affects the motion.
2.17
Guidelines for “Computer Modeling of Gyroscopic Precession”
167
Fig. 2.123 The green arrow indicates the direction of the applied force
Fig. 2.124 Angular displacement relative to the X-axis (blue line) and Y-axis (yellow line) with different external forces
Do the modified parameters affect the gyro precession? Explain what you observed. Observe the results when animating the gyroscope. Screenshot animation record in the report. Task 3. Plot the angle of rotation of the rotor around the X-axis and the Y-axis at various magnitudes and angles of the applied force. Angular displacements are given in Fig. 2.124. Task 4. Change the angular velocity of the rotor and see how it affects its rotation around the X- and Y-axes and try to explain what you see. Observe the results when animating the gyroscope.
References 1. Wolfram SystemModeler. http://www.wolfram.com/system-modeler/ 2. Rozhdestvensky, K., Ryzhov, V., Fedorova, T., Safronov, K., Tryaskin, N., Sulaiman, Sh. A., Ovinis, M., Hassan, S.: Computer Modeling and Simulation of Dynamic Systems Using
168
3. 4.
5.
6.
7.
8.
9. 10. 11.
12.
13. 14.
2 Guidelines for Performing Virtual Labs in Wolfram SystemModeler Wolfram SystemModeler. Springer Nature Singapore Pte Ltd. (2020). https://link.springer. com/book/. https://doi.org/10.1007/978-981-15-2803-3 Modelica. https://www.modelica.org/ Petzold, L.R.: A description of DASSL: a differential/algebraic system solver. In: 10th International Mathematics and Computers Simulation Congress on Systems Simulation and Scientific Computation (Montreal, Canada, August 9, 1982)—Sandia Report, 1982, 10 p. https://www.osti.gov/servlets/purl/5882821/ Hairer, E., Wanner, G.: Solving ordinary differential II. Stiff and differential-algebraic problems. Springer Series in Computational Mathematics, Vol. 14. Springer, Berlin Heidelberg (1996) Hindmarsh, A.C., Petzold, L.R.: Algorithms and software for ordinary differential equations and differential- algebraic equations. Part II: Higher-order methods and software packages. United States: N. p., 1995. Web. https://doi.org/10.1063/1.168540. https://hal.inria.fr/tel01144469v1/html_references Serban, R.: CVODES, The Sensitivity-Enabled ODE Solver in SUNDIALS. In: Serban, R., Hindmash, A.C., ASME 2005 International Design Engineering Technical Conferences and Computers and Information in Engineering Conference. Volume 6: 5th International Conference on Multibody Systems, Nonlinear Dynamics, and Control, Parts A, B, and C (Long Beach, California, USA, September 24–28, 2005)—ASME, pp 257–269. http:// citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.528.2241&rep=rep1&type=pdf CVODES: An ODE Solver with sensitivity analysis capabilities. In: Serban, R., Hindmash, A. C., University of California, Lawrence Livermore National Laboratory, Technical Information Department’s Digital Library, Livermore CA 94551, Preprint UCRL-JP-200039 Samarsky, A.A., Gulin, A.V.: Numerical methods: a tutorial. Nauka, 432 p (1989) Hairer, E., Nørsett, S., Wanner, G.: Solving Ordinary Differential I. Nonstiff Problems. Springer Series in Computational Mathematics, Vol. 8. Springer, Berlin Heidelberg (1993) Hindmarsh, A.C., Petzold, L.R.: Algorithms and software for ordinary differential equations and differential-algebraic equations. Part I: Euler methods and error estimation. United States: N. p. Web. https://doi.org/10.1063/1.168536 (1995) Numerical Methods for Solving Differential Equations. Heun’s Method. Mathematics & Science Learning Center. Computer Laboratory —URL: http://calculuslab.deltacollege.edu/ ODE/7-C-2/7-C-2-h Modern Numerical Methods for Ordinary Differential Equations. In: Hall, G., Watt, J.M., Clarendon Press, Oxford (1976) Wolfram Mathematica. http://www.wolfram.com/mathematica/