Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
380 views

Modeling and Simulation of Dynamic Systems: Lecture Notes of ME 862

The document provides lecture notes on modeling and simulation of dynamic systems. It discusses modeling dynamic systems using differential equations, linearizing nonlinear models, and numerically solving differential equations using methods like Euler's method and Runge-Kutta methods. Examples are given on modeling a robotic manipulator and electrical network and linearizing a nonlinear system. Numerical integration of differential equations is needed to simulate nonlinear dynamic systems in time domain.

Uploaded by

Rajrdb
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
380 views

Modeling and Simulation of Dynamic Systems: Lecture Notes of ME 862

The document provides lecture notes on modeling and simulation of dynamic systems. It discusses modeling dynamic systems using differential equations, linearizing nonlinear models, and numerically solving differential equations using methods like Euler's method and Runge-Kutta methods. Examples are given on modeling a robotic manipulator and electrical network and linearizing a nonlinear system. Numerical integration of differential equations is needed to simulate nonlinear dynamic systems in time domain.

Uploaded by

Rajrdb
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Lecture Notes of ME 862

Modeling and Simulation of Dynamic Systems

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

1. Modeling of Dynamic System


A model of a system can be physical or mathematical. The model accuracy needed (closeness to the actual system) depends on the purpose. Generally, a simplified model is needed to study the main characteristics of the system. A detailed model is needed for accurate simulation and prediction studies. In this class, modeling refers to the mathematical model of a system. The mathematical model of a dynamic system is generally in the form of differential equations. Therefore, modeling of dynamic system refers to the use of the physical laws to set up differential equations for a given dynamic system. Once we have the model of the system, we are interested in studying its behavior. The behavior of a dynamic system in time is described by the solution of its differential equations. There two different purposes for modeling of a physical system. Develop a mathematical model in order to predict the dynamic behavior of the system as accurately as possible, using numerical methods. Such a model serves as a tool for extensive evaluation of system behavior without actually using or building the actual system. Develop model to gain insight into the dynamic behavior qualitatively instead of exact response prediction, i.e., knowledge of stability margin, controllability and observability of states, and sensitivity of response to parameter changes. Such models do not contain all the detail of an actual system, but only the most essential features so as to provide good insight from an engineering standpoint. Therefore, we may develop simplified linear models for controller design and analysis purposes, and use more detailed, possibly nonlinear, models in testing and predicting the dynamic system response as accurately as possible. For instance, consider the robotic manipulator schematically shown in Figure 1. The dynamic model is a set of differential equations which describe the relationship between the applied torques at the joints and motion of the joint angles in time. The set of nonlinear differential equations can be used to predict the behavior of the robotic manipulator under various initial conditions and joint torque inputs. Quite often, the dynamics models of physical systems are nonlinear. Most control system design methods and analytical methods are applicable only to linear systems. Therefore, for the sake of being able to analyze various controller alternatives, we need to obtain approximate linearized modes from the nonlinear models. Figure 1: Robotic manipulator model
Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

2. Differential Equations
2.1 Basics of Differential Equations Continuous time dynamic systems are described by differential equations. A differential equation is an equation involving derivatives of dependent variables with respect to independent variables, for example,

dy (t ) + ay (t ) = u(t ) dt where t is an independent variable, y is a dependent variable (e.g. the system output), and u is another dependent variable (e.g., the system input). If there is only one independent variable, then the differential equation is called an ordinary differential equation (ODE). If there are two or more independent variables, then it is called a partial differential equation (PDE). The highest derivative in the equation is the order of the equation. Solution of an nthorder differential equation contains n-arbitrary constants. These constants are determined by n-conditions on dependent variable (i.e., the initial conditions)
2.2 Nonlinearities and Linearization

If the dependent variables or their derivatives appear in nonlinear functions in the equations, then the differential equation is nonlinear; otherwise it is linear. For example, the following equation is nonlinear
dy 2 (t ) dy (t ) + + ay (t ) = u(t ) dt 2 dt A system is called a linear dynamic system if its dynamics is described by linear differential equation(s). A linear system possesses two properties: superposition and Homogeneity. The property of superposition means the output response of a system to the sum of inputs is the sum of the responses to the individual inputs. Thus, if an input of r1(t) yields an output of c1(t) and an input of r2(t) yields an output of c2(t), then an input of r1(t)+r2(t) will yield an output of c1(t)+c2(t). The property of homogeneity describes the response of the system to a multiplication of the input by a scalar. Specifically, in a linear system, the property of homogeneity is demonstrated if for an input of r(t) that yields an output of c(t), an input of Kr(t) will yield an output of Kc(t). In other words, the multiplication of an input by a scalar (i.e., K) yields a response that is multiplied by the same scalar. Quite Often, a designer needs to make a linear approximation to a nonlinear system. Linear approximations simplify the analysis and design of a system and are used as long
3
2

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

as the results yield a good approximation to reality. For example, if a system consists of nonlinear components, we must linearize the system before we can find its transfer function. Now, lets see how to linearize a nonlinear system in order to obtain its transfer function. The first step is to write the nonlinear differential equation and linearize it. When we linearize a nonlinear differential equation, we linearize it for small changes in the input about the operating point A, as shown in Figure 2, where the system input and the output are x0 and f(x0), respectively. Small changes in the input can be related to changes in the output about the point by way of the slope of the curve at the point A. Thus, if the slope of the curve at pint A is ma, then small excursions of the input about pint A, x, yield small changes in the output, f(x), related the slope at point A. Thus,

f ( x ) = f ( x ) f ( x0 ) = ma ( x x0 )
where ma = Figure 2: Linearization about the operating point A. Once we have the linearized differential equation, next we take the Laplace transform of the equation(s), assuming zero initial conditions. Finally, we separate input and output variables and form the transfer function.
Example 1

df ( x ) dx

x = x0

(a) Write the differential equation for the simple pendulum shown in the following figure, where all the mass is concentrated at the endpoint. (b) Linearize the system about the operating point of =0 and then find its transfer function. (c) Use SIMULINK to determine the time response of to a step input Tc of 1 Nm. Assume l =1 m, m = 0.5 kg, and g = 9.81 m/s2.

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

Example 2

Find the transfer function, VL(s)/ V(s), for the electrical network shown in the following figure, which contains a nonlinear resistor whose voltage-current relationship is defined by i r = 2e 0.1v r , where ir and vr are the resistor current and voltage, respectively. Also, it is know that v(t) is a small-signal source. Use SIMULINK to determine the time response of vL(t) to a step input v(t) of 0.1 V.

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

3. Numerical Systems

Simulation

of

Nonlinear

Dynamic

The behavior of a dynamic system in the time domain can be predicted by the solution of its mathematical model, which typically is a set of ordinary differential equations (ODEs). Analytical solution of ODEs is available for only linear ODEs and very simple nonlinear ODEs. Therefore, time domain response of any dynamic system model with reasonable complexity must be solved using numerical methods. The primary tool is the numerical integration of ODEs in the time domain. Numerical integration is performed by discretizing ODEs using various approximations to differentiation.
3.1 Basics for Solving a First-Order ODE

Given that a dynamic system is describe by the following first-order ODE


& = f ( y, u ) y

The task at hand is to solve for y(t) given the initial condition y (t0 ) = y0 and the input u(t). The fundamental idea behind numerical integration is illustrated in Figure 3, in which
y (t i +1 ) = y (t i ) + where
t i +1

ti

& dt y

t i +1

ti

& dt can be obtained by using various approximations, such as the Eulers and y

Runge-Kutta methods introduced in the following.

& y

& y
& d y
0 t

& y

Figure 3: Graphical interpretation of numerical integration for solving a first-order ODE.

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

3.2 Eulers Method and Runge-Kutta Methods Eulers method is based on the definition of a derivative, i.e.,
dy y = lim dt t 0 t

Let us examine the differential equation for two values of time, ti and ti+1, where t is sufficiently close to zero that the above equation is approximated by
y i +1 y i = f ( y i , ui ) t which can be rewritten as y i +1 = y i + tf ( y i , ui ) Repeated evaluation of the above equation leads to the numerical solution. As the initial point, y i = y 0 and, for subsequent values of the index i+1, yi+1 takes on the value from the previous calculation of yi. Any arbitrary time history of the input ui can be used: steps, ramps, sinusoids, random sequences, or stock market indices. As the step size t decreases, the accuracy of the method improves and the required computation time increases. Figure 3 suggests that a more accurate formula is to use the average of the values of the & derivative at ti and ti+1. Because this is essentially a straight line approximation to the y curve between ti and ti+1, it is called the trapezoidal rule. Unfortunately, it is impossible to implement for numerical integration of nonlinear system because the derivative at ti+1 depends on y(ti+1), which is not known yet. Many different numerical integration schemes have been developed to approximate the area under the curve; and they are all iterative because the derivative at the endpoint is not initially known.
Runge-Kutta methods comprise one popular set of integration schemes. The secondorder Runge-Kutta method obtains an approximate value of the endpoint using the Euler method, estimates the derivative at the endpoint using the approximate yi+1, and then arrives at the final value for yi+1 using an average of the two derivatives:
k1 = f ( y i , u i ) k 2 = f ( y i + k1t, ui +1 ) y i +1 = y i + t ( k1 + k 2 ) 2

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

Third- and higher-order Runge-Kutta methods use this same basic idea; they differ from the second-order formula by using estimates of derivatives at mid-points as well as endpoints and including them in a weighted average to arrive at the final estimate of yi+1. Most computer-aided control system design software includes some form of numerical integration capability such as Runge-Kutta method and most will include some sort of automatic step size determination. Any method will be become more accurate as the step size decrease: however, initially, neither the computer algorithms nor the user knows what step size is the best compromise between accuracy and speed. A commonly used scheme is to integrate using two different methods (perhaps a second- and third-order Rung-Kutta formula), compare the difference, and then cut the step size in half if the error exceeds a certain tolerance. The step size will continue to be cut in half until the error tolerance is met.
3.3 Simulation of Nonlinear Dynamic Systems Using SIMULINK

In SIMULINK, we use a block, called Integrator, for continuous-time integration of its input signal, i.e., S out = S in dt , where t is the step size (specified in the Solver options
0 t

in SIMULINK). The initial condition of integration can be specified via the Function Block Parameters window of the block.

Sin

1 s

Sout

Figure 4: Integrator in SIMULINK.

Suppose a dynamic system is describe by the following n-order ODE y ( n ) = f ( y ( n 1) , y ( n 2 ) ,L, y , u ) with initial conditions:
( n 1) y ( n1) (t 0 ) = y0 , ( n 2 ) y ( n2 ) (t 0 ) = y0 ,

y ( t 0 ) = y0 .

The general process to solve the above ODE by means of SIMULINK is discussed in class.

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

Lecture Notes of ME 862

Example 3

Use SIMULINK to determine the time response of to a step input of 1 Nm of the pendulum in Example 1 based on the nonlinear differential equation obtained; and then compare it to the result from the transfer function after linearization.
Example 4

Consider the liquid level in a tank and its control system shown in the following figure. The purpose of control is to maintain the liquid height in the tank at a constant level. Let us consider a computer-controlled version of the system: the mechanism for manipulating the inflow rate to the tank is controlled by a level sensor, a digital controller, and a valve. The digital controller is an ON/OFF type one with hysteresis: the controller either fully turns ON or OFF the value, depending the error signal to the controller; and the hysteresis is added to the controller in order to make sure the controller does not switch the valve ON/OFF at high frequency due to small change in the liquid level. This type of controller is called relay with hysteresis. The inflow rate is proportional to the valve opening. Manipulated by the aforementioned ON/OFF controller, the flow rate has the value of either zero or maximum. The outflow rate is proportional to the liquid level in the tank by multiplying a constant of 1/R. Simulate the system for the following conditions: (1) the hysteresis band of the controller is [-0.05, 0.05], (2) the maximum inflow rate is 0.02 m3/s, (3) R has a value of 500 m/( m3/s), and (4) the cross-section area of the tank is 0.01 m2.

Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada

You might also like