Analysis and Simulation of Simple Dynamic Systems
by Forhad Ahmed
Columbus Alternative High School
2632 McGuffey Road
Columbus, Ohio 43211
U.S.A
email : thesoccerstar2k3@hotmail.com
This worksheet demonstrates the use of Maple for studying dynamic systems.
Background and Program Code Usage
Dynamic Systems
Dynamic Systems (as they are used in this worksheet) are mechanical systems comprising of masses and constraints. Constraints are a set of rules that have to be followed as the masses are allowed to move freely. For example, a very simple dynamic system might be that of a pendulum. The constraint of a pendulum is that one mass has to stay at a fixed distance from a fixed mass (rigid-rod constraint). Examples of more complex system are a double pendulum and a triple pendulum. A Simple Example: Study of dynamic systems is done by analyzing the differential equations that govern every mass in the system. For a very simple example, consider only one point object of mass 2 [kg] located at the origin, and the only force acting on it is a 2 [N] force 60 degrees above the x-axis. This is indeed a very simple system and Newton's second law can be used easily to find the differential equations of motion. The solutions to these equations will be the functions that represent the motion of the mass object.
The solution to the preceding problem can be found easily using analytic methods, but in order to do so, initial conditions for the system must be defined. These are the values of functions at initial times needed to successfully integrate the equations and find a particular solution. The initial conditions needed for each mass in a system are its initial x and y positions (x0, y0) and its initial velocities (vx0 , vy0) In this case, the initial position is the origin (0,0) and the initial velocity is also (vx0 , vy0) = (0,0) because the object is not given an initial velocity. When analyzing more complex systems however, the differential equations are not so simple. The more masses, constraints, vibrations, pin joints etc. are present in the system, the more complex the equations are. Solving them by hand is nearly impossible, but computers have the ability to find numerical answers given the proper instructions and the equations.
Program Design
This entire project is based on a program code written in Maple 7. Maple enables solving of differential equations (DE's) in either symbolic or numeric form. For most simple DE's, Maple is able to find analytic solutions but for complex DE's, Maple uses its numerical algorithms to find a numeric answer. My objective as a programmer is to set up the differential equations that govern a dynamic system that the user defines through Maple. Defining can be thought of as describing to the computer a system of masses, constraints and initial conditions, and the job of the computer, then, is to simulate and analyze the motion of the system.
Program Diagram:
Program Usage
The Maple program is made up of modules or procedures that perform specific tasks when called upon. The user defines a dynamic system using the following commands in the proper format indicated below. Also shown here are different commands that are used to utilize this program. 1) (restart/initialize): Initialize ( ): 2) (define gravity and viscosity): GravityViscosity (g, ): 3) (define a mass object): Mass (n, x0, y0, vx0, vy0, m): 4) (define a Hooke's spring ): Spring (A1, A2, k, L): 5) (add horizontal forceto a mass object): AddForceX (n, Fx): 6) (add vertical force: AddForce Y(n, Fy): to a mass object) 7) (anchor a mass object so: Fixed (n): that it remains fixed) 8) (add constraint that allows a : SlideX (n): mass object to only slide horizontally ) 9) (add constraint that allows a : SlideY (n): vertically )
10) (cause a mass object to vibrate: VibrateX (n, A, ) horizontally)
11) (cause a mass object to vibrate: VibrateY (n, A, ) vertically)
12) (create differential equations CreateEquation s( ) for the specified dynamic system. Issue this command after all masses, constraints etc. have been defined) 13) solve the DE's that have been: SolveEquations ( ) created and store the solution in a list format) 14) (animate the simulation): RunSimulation (tf, dt ) 15) (visualize graphs of position: Visualize (v1, v2, tf)
Initializations
For running this program, the following packages are required:
Warning, the name changecoords has been redefined
Warning, the name arrow has been redefined
Warning, the assigned name Group now has a global binding
Warning, the name translate has been redefined
Program Code
Execute the following code in order for this program to work correctly
Case Study 1 (Damped Oscillation)
This program is used for studying simple mechanical systems, especially systems that involve vibrations. Consider a simple system consisting of two mass objects of mass 1 [kg]; one fixed and one free (with mass-numbers 1 and 2 respectively) , connected by a spring of stiffness 50 [N/m] and length one. The free mass is given an initial velocity downwards of 0.5 [m/s]. Viscosity (air-resistance) is present and the coefficient of dampening is = 0.3. Gravity is present and the gravitational constant is the usual -9.8 [m/ ]. How will this system behave?
In the above picture of the model, the masses are blue circles and the spring is the set of dots connecting the masses. Here is the Maple input for defining this system (the masses are located at (0,0) and (0,-1); the red cross indicates that the mass is anchored or fixed):
After entering these commands, Maple has created the differential equations that govern the motion of the system. Issuing the
RunSimulation (finaltime, increment) command animates the system from t = 0 to t = finaltime with the given increment. Let's run this simulation upto time = 6 seconds with an increment of .1
This program also allows you to plot the position of a mass object versus time. Suppose you want to graph the y-position of the bottom mass (mass # 2) versus time upto time = 6 seconds. This following command is used:
As predicted, the air-resistance causes the vibration of mass-2 to decrease with time.
Case Study 2 (Resonance)
Consider a similar model to the previous one; instead of the top mass being fixed, it is forced to vibrate vertically with an amplitude of .2 meters and a frequency of 6. Also, the length of the spring is increased to 3 meters. There is no air resistance. Here is a visual representation of the model. The red arrows indicate that the mass is vibrating:
The top mass (vibrating) is mass 1 and the bottom is mass 2. Their coordinates are (0,0) and (0,-3) respectively. Here is the Maple input for defining this model:
Animate the model until time = 4 seconds with .1 second increments:
Graph the y-position of the bottom mass (mass 2) versus time upto time = 20 seconds:
It can be seen that the amplitude of the vibration of the bottom mass increases, then drecreases and increases etc. within the 20 second period. However, if the vibration of the top mass matched the natural freqency of the system, the bottom mass will continue vibrate with increasing amplitude (resonance). The natural frequency of a spring-mass system is so in this case that frequency would be or about 7.07. Let's try this model again only changing the vibrational frequency of the top mass to match the natural frequency so resonance can occur.
Maple Input:
Graph the y-position of mass 2 versus time upto time = 8 seconds:
The bottom mass object's vibrational amplitude increses with time: it is resonating.
Case Study 3 (Bead-on-wire)
Consider a mass object with a mass of 0.1 [kg] located at the origin and it is only allowed to slide horizontally as if it were a bead on a frictionless wire. It is connected to a fixed mass (located at (-1,0)) and a free mass (located at (-1, -1)) by springs of stiffness 1 and 200 [N/m] respectively. One of the two connections (with the stiffer spring) forms a pendulum in which the free mass is allowed to swing freely. Our goal is to model this scenario. Here is a picture of the model:
The masses are labeled for clarity. The horizontal dotted line through mass-1 indicates that it is only allowed to slide horizontally. Mass-1 is connected to mass-2 and mass-3. The first connection (between 1 and 2) is made with a spring of stiffness 5 [N/m] and the second connection (between 1 and 3) is made with a spring of stiffnes 200 [N/m] (stiff springs are used as approximations of rigid rods for modeling a pendulm). Ther gravitational constant is -9.8 and there is no air resistance ( = 0).
Let's run this simulation until time = 3 seconds with .1 second increments:
Here is a graph of the horizontal vibration of mass-1 versus time upto time = 8 seconds:
Here is a graph of the horizontal vibration of mass-3 (swinging mass) versus its vertical vibration upto time = 3 seconds:
Case Study 4 (Vibrating Tower)
Consider a system of 8 masses connected by springs. They are aligned vertically (resembling a tower) and the lowest of the masses are forced to vibrate horizontally with a given amplitude and frequency:
All mass objects (in blue) have a mass-number (from 1 to 8) and a mass of 0.1 [kg] and the springs have stiffness 400. The bottom two masses are 1 & 2; the top 2 masses are 7 & 8. The bottom two masses (1 & 2) are forced to vibrate at an amplitude of .2 meters and a frequency of 10. The goal is to see how much the tower vibrates and how the vibration can be minimized. This program allows you to model this dynamic system and analyze its motion. Here is the Maple input:
Let's run this simulation upto time = 3 seconds with increments of .1 and see the motion (this may take a LONG time):
This program also allows you to plot the position of a mass object versus time. Suppose you want to graph the x-position of the top right mass (mass # 8) versus time upto time = 2 seconds. This following command is used:
The preceding is a graph of the x-position of the top right mass object versus time upto 2 seconds. It can be seen that witin that time period, the maximum displacement of the mass object was about .4 meters. Now you can try different values for stiffness of the springs and try to see which ones cause the tower to vibrate less. There is a value of stiffness of the springs that, if given the right frequency of vibration of the two bottom masses, will cause the tower to resonate and become unstable! Its up to you to experiment.
Practice Problem
The preceding examples are only a small part of what this program can do. This worksheet may be considered as a sum of many worksheets that are present in this website because it allows for the study of not just one case but of infinately many cases. You can define a system as simple or as complex as you like and this program will model it for you! The beauty lies within its versatility.
Practice Problem : Use this worksheet to solve the following problem:
Consider the above model of a bridge. Number the masses (in blue) in any way you like and connect them as they are connected in the picture by springs of different stiffnesses. All mass objects have a mass of 0.1 [kg]. The two masses that have gray arrowheads pointing to them are fixed masses. Define all the masses and all the springs. Set the gravitational constant to -9.8 and the coefficient of air-resistance to 0.1. Try different values for the stiffness of the springs and notice which ones lead to a stable bridge and which ones cause the bridge to collapse. (For example, weak springs in the middle of the bridge will probably cause the structure to collapse). Have patience using this program because animating the preceding model will take time.
I am a high school student and would be honored to hear criticisms of this worksheet from professors, mathematicians and scientists. Also, if you have any questions or comments about this program, please feel free to email me. I will be glad to know and help you.
Also, I know Maple has brought about Maplets as a tool for integration of the Maple platform with Java applets. I do not own a copy of Maplets but I know enough about it to say that it would be a great tool to combine with the program in this worksheet. The user can define masses, springs and other constraints through the Maplets Graphical Interface as input and the program can display the animation of graphs of motion as output. If anyone is interested in making such a Maplet and wants to use this program as the basis of their project, feel free to contact me. I think it would be a great application for studying mechanics!
Disclaimer: While every effort has been made to validate the solutions in this worksheet, Waterloo Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material.