You are on page 1of 156

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS

1. INTRODUCTION TO MECHATRONICS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

DEFINING MECHATRONICS
The word mechatronics as a compositon of mecha from mechanics and tronics from electronics originated in Japan around 1970 to describe the integration of mechanical and electronic components in consumer products.

MECHANICS ELETRONICS
The meaning of this word continuously evolves after the original definition. Today it has come to mean multidisciplinary systems engineering. The definition that mechatronics is simply the combination of different technologies is no longer sufficient to explain mechatronics
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

DEFINING MECHATRONICS
Integration is the key element in mechatronic design as complexity has been transferred from the mechanical domain to the electronic and computer software domains. Mechatronics, as an engineering discipline, is the synergistic combination of mechanical engineering, electronics, control engineering, and computers, all integrated through the design process.

Aerial Venn diagram from Rensselaer Polytechnic Institute (Troy, New York) website describes the various fields that make up f p Mechatronics

Mechatronics is the integration of the different technologies to obtain the best solution to a given technological problem, which is the realization of a product. It is really nothing but good design practice. It means using modern, costeffective technology to improve product and process performance and flexibility.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

DEFINING MECHATRONICS
Mechatronics gained legitimacy in academic circles with the publication of the first refereed f d journal: j l IEEE/ASME /AS Transactions on Mechat ronics, where the following definition was given: Mechatronics is the synergistic combination of precision mechanical engineering, electronic control and systems thinking in the design of products and manufacturing processes processes.

Aerial Venn diagram from Rensselaer Polytechnic Institute (Troy, New York) website describes the various fields that make up Mechatronics

Mechatronics is an evolutionary design development that demands horizontal integration among the various engineering disciplines as well as vertical integration between design and manufacturing. It is the best practice for synthesis by engineers driven by the needs of industry and human beings.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

DEFINING MECHATRONICS
All of the known definitions and statements about mechatronics are accurate and informative, yet each one in and of itself fails to capture the totality of mechatronics. Although, an all-encompassing definition of mechatronics does not exist, but in reality, engineers understand from the known definitions and from their own personal experiences the essence of the philosophy of mechatronics. It should be understood that mechatronics is a way of life in modern engineering practice.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

KEY ELEMENTS OF MECHATRONICS


The conception of mechatronics arises from the integration of knowledge from different areas of physics and technical disciplines. The purpose of mechatronics is to use this integration in order to achieve a synergic effect, i.e. to obtain a product with highest possible technical and economical parameters. In this light, the study of mechatronic systems can be divided into the following areas of specialty: Physical Systems Modeling; Sensors and Actuators; Signals and Systems; Computers and Logic Systems; Software and Data Acquisition
RPI (Troy, New York) website
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

KEY ELEMENTS OF MECHATRONICS

INTRODUCTION TO MECHATRONICS

Bishop, ed, The Mechatronics Handbook


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

KEY ELEMENTS OF MECHATRONICS


The key elements of the mechatronics approach are presented in the figure:

Mechatronics is the result of applying information systems to physical systems. The physical system, the rightmost dotted block, consists of mechanical, electrical, and computer (electronic) systems as well as actuators, sensors, and real time interfacing. Sensors and actuators are used to transduce energy from high power, usually the mechanical side, to low power, the electrical and computer or electronic side. The block labeled mechanical systems frequently consists of more than just mechanical components and may include fluid, pneumatic, thermal, acoustic, chemical, and other disciplines as well.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

RPI (Troy, New York) website

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

APPLICATIONS OF MECHATRONIC SYSTEMS


Today, mechatronic systems are commonly found in homes, offices, schools, shops, and of course, in industrial applications.
M Machine-tool hi t l construction t ti and d equipment i t for f automation t ti of f technological processes Robotics (industrial and special) Aviation, space and military techniques Automotive (climate control, antilock brake, active suspension, cruise control, air bags, engine management, safety, etc.) Office equipment (for example, copy and fax machines) Computer facilities (for example, printers, plotters, disk drives) Home appliances (microwave ovens ovens, washing machines machines, vacuum cleaners, dishwashers, air conditioning units, security systems).

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

THE PURPOSE OF MODELLING AND


SIMULATION OF MECHATRONIC SYSTEMS
There two different purposes for modeling of a physical system:
To predict the dynamic behavior of the system as accurately as possible 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.

The mathematical models are need because: Do not require a physical system
Can treat new designs/technologies without prototype Do not disturb operation of existing system

Support safety
Experiments may be dangerous Operators need to be trained for extreme situations

Easier to work with than real world


Easy to check many approaches, parameter, values, ... Flexible to time-scales Can access un-measurable quantities
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Help to gain insight and better understanding Analogous Systems


Can have the same mathematical model though different types of physical systems Common analysis methods and tools can be used.
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

THE PURPOSE OF MODELLING AND


SIMULATION OF MECHATRONIC SYSTEMS
Mechatronic systems' behavior is determined by interdependencies between different components. Therefore, an integrated and interdisciplinary engineering approach is necessary. Communication i i across the h traditional di i l boundaries b d i between b mechanical, h i l electrotechnical and computational engineering has to take place in an early design process stage. The importance of modeling and analysis in the design process has never been more important. Designs are usually the result of the improvement of an existing system, the innovative combination of existing systems, or the application of new technology or new k knowledge l d to t an existing i ti system. t In I all ll this, thi understanding d t di what h t exists i t is i paramount t and modeling is essential to that understanding. Once a concept has been developed in the conceptual phase of design it is evaluated through modeling , not by building and testing the physical system, sensors, actuators, and controls, all integrated into the design concept.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MECHATRONICS

THE PURPOSE OF MODELLING AND


SIMULATION OF MECHATRONIC SYSTEMS
Mechatronics design is more than just the combination of mechanical, electronic and software design, so the mechatronic designer must optimize a design solution across these disparate fields. fields This requires a sufficient understanding of each of these fields to determine which portions of an engineering problem are best solved in each of these domains given the current state of technology. In turn, this requires the ability to model the problem and potential solutions using techniques that are domain independent or at least permit easy comparison of solutions and tools from different domains. Through system modeling and simulation, the Mechatronic System Design Process facilitates:
understanding d di the h behavior b h i of f the h proposed d system concept; optimizing the system design parameters; developing optimal control algorithms, both local and supervisory; testing control algorithms under various scenarios; and qualifying the production controller with a simulated version of the plant running in real time (hardware-in-the-loop testing), before connecting it to the real plant.
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

INTRODUCTION TO MECHATRONICS

THE PURPOSE OF MODELLING AND


SIMULATION OF MECHATRONIC SYSTEMS
More and more, simulation is being used to detect and eliminate integration issues. Simulation has been used on individual components and subsystems for quite some time, i but b the h real l value l becomes b apparent with i h the h ability bili of f virtual i l integration i i of f those h individual systems. The tremendous cost savings of finding problems before you commit to hardware are well-known. What's more important, however, is being able to optimize system performance. That's something you can only achieve in simulation when you can combine those different domains with the controllers in a single simulation environment. By running simulations early in the design process, engineers can try out new technologies and see if they will improve the design. Experimental study on physical prototypes is expensive and time consuming. Virtual prototyping, as a new way of dynamic simulation of the controlled machine, is more compliant with time and budget constraints of R&D industrial centers. If design choices on the mechanical as well as on the electronic side can be tested before assembling the physical prototype, the time to market is shortened and the knowledge of the system is improved, obviously as long as the simulation plant is a reliable replication of reality and the simulation tool is reasonably easy to use for people coming from different areas.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


2. BASICS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASICS
MODELS AND SIMULATION: THE VIRTUAL REALITY
Many technical problems can not be resolved by observations or experiments:
yet exists, , or Process is not y It can not be carried out without financial or technical risk.

In order to save time and money and not taking any unnecessary risks, it is desirable to get answers on the basis of a model instead of carried out experiments. The model has the form of a mathematical description that allows performing a numerical simulation on the computer.
The modeling of mechatronic systems plays an important role in the development process of a mechatronic product. Generally, a model is required for:
Simulation purposes, Analyzing the system, Designing a controller.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASICS
MODELS AND SIMULATION: THE VIRTUAL REALITY
Through system modeling and simulation, the engineers have a powerful tool which allows them to:
Answer essential issues and also examine the border areas without risk Test in advance the characteristics and modify if necessary, when the system is a concept in the design process.

Besides their advantages, the modeling and simulation also have some pitfalls:
Too simple model can not describe all aspects of the real system (process) p model requires q too much time and effort in the creation and Too complex simulation A model can also be not valid Selection of appropriate integration algorithm is very important and only in this way a correct simulation is ensured.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASICS
MODELS AND SIMULATION: THE VIRTUAL REALITY
Reality is initially an entity, situation or system to be investigated by simulation. Its modelling can be viewed as a two-stage process:
Establishing a conceptual model through analyzed and modeled the reality by using verbal descriptions, equations, relationships or laws of nature; Transforming the conceptual model into an executable model (model that can be used for simulation) as p part of implementation p .

Model generation, simulation, validation and verification in context (Georg Pelz, Mechatronic Systems y )

Model verification investigates whether the executable model reflects the conceptual model within the field of application. Model validation should tell us whether the executable model is suitable for fulfilling the envisaged task within its field of application.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASICS
MODELS AND SIMULATION: THE VIRTUAL REALITY
There are actually two distinct models of an actual dynamic physical system and the distinction between them is most important
Ph Physical i l model d l an imaginary i i physical h i l system t a slice li of f reality, lit which hi h is i an approximation i ti of the actual system capturing the essential elements in as much detail as the need for the model requires. In modeling dynamic physical systems we use engineering judgment and simplifying assumptions to develop a physical model. Mathematical model The laws of nature (physics, chemistry, biology) are applied to the physical model (not the physical system) and the mathematical equations describing the system are derived.

HierarchyofModels,dependingontheparticularneedforthemodel p ,morerealistic, ,lesseasily ysolved morecomplex, Truth Model Design Model

lesscomplex,lessrealistic,moreeasilysolved
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASICS
MODELS AND SIMULATION: THE VIRTUAL REALITY
There are two basic approaches to build mathematical modes:
Th Theoretical ti l modeling d li - carried i d out t from f the th physical-technical h i l t h i l basic b i equations Experimental modeling - carried out from measured input and output data (Need prototype or real system!)

Simulation: Calculation of the behavior of a system model in dependence


on time, and the state of a system and environment. The simulation provides projections about the behavior of the real system with the aid of a model, which can be executed in a computer. Simulation is thus an inexpensive and safe way to experiment with the system. However, the value of the simulation results depends completely on the quality of the model of the system.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

SYSTEMS AND MODELS


System: set of elements, which are interconnected in different interactions. A system is a combination of components which are coordinated together f ifi objective. bj i to perform a specific Disturbance Inputs Subsystem System Outputs

System
Control C l Inputs I Subsystem: a component of a larger system
A system is a defined part of the real world. Essential for defining a system is the system boundary to the environment. Interactions with the environment are described by system inputs and system outputs.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

SYSTEMS AND MODELS


For the modeling it is necessary to abstract the given real problem, i.e. to y which can then be used as a model for the original g define a suitable system, problem. It can be noted here that the experience is playing a great role in model development

Model: A description of the system. The model should capture the essential information about the system.
The model, which defines a system, must also give a mathematical description of the internal and external interactions. Although some software already provides graphical elements, the mathematical formula is the basis for numerical implementation and interchangeability of information (regardless of computer platforms!). This step can be done easier with experience, but a systematic approach is recommended from the very beginning.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


InputInput -output model versus state space model
Inputs, u: External influences on the system y ( (force, current, ) ) Outputs, y: Variables of interest to be calculated or measured (position, velocity, )

Inputoutputsystemmodel Input-output models, regardless of the complexity of the context, described the output variables y directly by the inputs u. A system is considered as a device that transformed inputs to outputs. The state space p model includes additional internal variables state variables, ,x State variables, x: Represent the status or memory of the system. The state is a collection of variables that summarize the past of a system for the purpose of prediction the future. Initial states x(t0) and inputs u(t) completely determine future outputs y(t) and states x(t), tt0 .
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Static versus dynamic systems
In a static system, the outputs are defined by algebraic combinations of the inputs. Dependencies of variables upon one another are fixed (independent of time).
Example: V=i R and even V(t) =i(t)R that is, the fact that current must be multiplied by resistance to give voltage (the dependency) is independent of time.

In dynamic systems, the output variables due to memory effects show complex dependencies. The present output of the system depends on past inputs. Dependencies of variables upon one another change with time. A slightly narrower definition: A dynamic system is a system that is described by differential and/or difference equations.
Example: A capacitor connected to a resistor with an external voltage V The voltage over the capacitor depends on the charge and thereby on earlier values of the current and voltage V
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


A (loose) classification of dynamic models

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Lumped versus Distributed parameters
Both properties are related to systems of dynamic nature. In a lumped-parameter model, system dependent variables are assumed uniform over finite regions of space. Time is the only independent variable and the mathematical model is an ordinary differential equation. The events are described by a finite number of changing variable In a distributed-parameter model, time and spatial variables are independent variables and the mathematical model is a partial differential equation. The events in the system are so to speak dispersed over the space variables.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Linear versus nonlinear models
Th The mathematical th ti l description d i ti of f a linear li model d l consists i t of f a linear li combination bi ti of inputs and outputs. Linear models, both analytically and numerically, are much more efficient to deal with, especially stability analysis can be performed easily and closed. Unfortunately, linearity is only one ideal shape, real systems are almost always non-linear. All other models are called nonlinear. Nearly all physical elements or systems are inherently nonlinear if there are no restrictions at all placed on the allo able values allowable al es of the inputs, inp ts e.g., e g saturation, sat ration dead-zone, dead one sq square-law are la nonlinearities

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Linear versus nonlinear models
A linear system satisfies the properties of superposition and homogeneity The superposition property states that for a system initially at rest with zero energy the response to several inputs applied simultaneously is the sum of the individual responses to each input applied separately When the system at rest is subjected to an excitation x1(t), it provides a response y1(t). Furthermore, when the system is subjected to an excitation x2(t), it provides a corresponding response y2(t). For a linear system, it is necessary that the excitation x1(t) + x2(t) result in a response y1(t) + y2(t). This is usually called the principle of superposition. The property of homogeneity: the magnitude scale factor must be preserved, i.e. multiplying lti l i the th inputs i t by b any constant t t multiplies lti li the th outputs t t by b the th same constant. t t For a system with an input x(t) that results in an output y(t), the response of a linear system to a constant multiple of an input x must be equal to the response to the input multiplied by the same constant so that the output is equal to y Non-linear systems do not satisfy both these criteria
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Linear versus nonlinear models
Often, the theoretical modeling goes through a nonlinear model, which is then linearized around an operating point. If the values of the inputs are confined to a sufficiently small range, th original the i i l nonlinear li model d l of f the th system t may often ft be b replaced l d by b a linear li model d l whose h response closely approximates that of the nonlinear model. A linear approximation is as accurate as the assumption of small signals is applicable to the specific problem.

Example:
The normal operating point of the system consists of mass M sitting on a nonlinear spring is the equilibrium position that occurs when the spring force balances the gravitational force M g (g is the gravitational constant). Thus, f0 = M g. For the nonlinear spring with f = y 2, the equilibrium position i i is i y0 = (M g)1/2. The h li linear model d l for f small ll deviation is f = m y, where Thus, m = 2 y0.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Continuous versus discrete models
The distinction continuous discrete dates back to the controversy between analog (=continuous) ( ) and digital g (=discrete) ( ) simulation. However, use of these attributes without further precision may causes confusion, so it should be avoid. Both, dynamic systems and models have dependent and independent variables and one, several or all may change continuously or in discrete way. The contrast continuous-time and discrete-time is not a precise. Systems may change at discrete instants of time in a deterministic manner or, such changes may occur stochastically. Therefore, it is better to make distinction between three properties: continuous-time and discrete-time discrete-event hybrid: There are systems which change continuously with time. time Other systems change only at certain instants of time or during rather short intervals. Moreover, there are systems subjected to a sequence of countable events where it can be assumed that nothing of interest take place between them (discrete-event system or model, respectively). Furthermore, there are systems where both continuous time and discrete-events are present (hybrid systems).
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


ContinuousContinuous -time versus discrete discrete-time models
A mathematical model that describes the relationship between time continuous signals is called time continuous. Differential equations q are often used to describe such a relationship. A model that directly expresses the relationships between the values of the signals at the sampling instants is called a discrete time or sampled model. Such a model is typically described by difference equation.
For processing by digital computers, all signals are, both, quantized value and discretized in time (sampling time Ts). I practice, In ti the th signals i l of f interest i t t are most often obtained in sampled form, which is a result of discrete time measurements.
Sampling a continuous signal: a) continuous-time signal, b) time-discretized (sampled) signal.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


ContinuousContinuous -time versus discrete discrete-time models
Example
A continuous-time model of a damped linear oscillator is given by the differential equation The discretization of this model with a sampling time Ts =0.25 s results in a difference equation of the form where k is an abbreviated form for all time points t = k Ts . The numerical coefficients of the discrete model depend not only on the continuous model, but the choice of sampling time Ts also plays an important role! In Figure, the step responses of both models are shown. Note that the discrete-time model output is a constant on a sampling interval, which means a loss of information compared to the continuous model.
Step response of a damped oscillator. Left: continuous-time model. Right: time-discrete model with a sampling time Ts =0.25 s

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Deterministic versus stochastic models
Deterministic system - all system inputs are explicitly known during the time and the system parameters are either constant or their variations are also known known. A model is called deterministic if it works with an exact relationship between measurable and derived variables and expresses itself without uncertainty. Deterministic systems show in principle predictable behavior, if modeled exactly; the future behavior can be computed from its present state and the known influence on it. Stochastic system the system inputs or parameters are known only from statistical measurements or can be specified only probabilistically. A model is stochastic if it works with uncertainty or probability concepts. A stochastic, mathematical model contains quantities that are described using stochastic variables or stochastic processes.
The stochastic models are especially important because in every measurement noise occurs. To get models or to estimate optimal experimental conditions from these noisy measurements, the stochastic system theory must be considered. The important area of system identification is therefore also dependent on stochastic models.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS


Summary
The most realistic physical model of a dynamic system leads to differential equations of motion that are: nonlinear, partial differential equations with time-varying and space-varying parameters These equations are the most difficult to solve. The simplifying assumptions lead to a physical model of a dynamic system that is less realistic and to equations of motion that are: linear, ordinary differential equations with constant coefficients These Th equations ti are easier i to t solve l and d design d i with ith
This dilemma between easy-to-handle and realistic has been formulated very nicely by Pindyck already in 1972: Our preoccupation with linear time-invariant systems is not a reflection of a belief in a linear time-invariant real world, but instead a reflection of the present state of the art of describing the real world.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

BASIC CONCEPTS

TYPES OF MATHEMATICAL MODELS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BASIC CONCEPTS

MODEL VALIDATION
Model validation procedure After the model creation, it must be examine whether the model fulfills its purpose well, i.e. whether the model reflects the reality sufficiently well. A model is not useful until its validity has been tested and established. Models have been developed to help in solving certain problems. We call a model that is useful in this way valid with regard to the purpose in mind. Deciding if a certain model is valid is called model validation. The model validation is not a one step, but an iterative process that is closely associated with the actual modeling task.

Test of the validity


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

BASIC CONCEPTS

MODEL AND SIMULATION


Simulation models are a special subset of mathematical or physical models that allow the user to ask "what if" questions about the system. Changes are made in the physical conditions diti or their th i mathematical th ti l representation t ti and d the th model d l is i run many times ti to t "simulate" the impacts of the changes in the conditions. The model results are then compared to gain insight into the behavior of the system. The form in which a model must be brought for a simulation crucially depends on the simulation software that is used. In graphical interfaces, a block diagram representation is sufficient (e.g. Simulink), other programs require a specific mathematical description of programming (Matlab, ACSL). Nevertheless, the essential core of a simulation is the mathematical description which is completely platform independent. The simulation provides a numerical experiment on a suitably prepared model. Each experiment must provide the same result under the same conditions regardless of experimenter, time and place of performing. But all experiment defining parameters must be known. Therefore, it is particularly important the simulation parameters such as initial conditions, integration algorithm, step size, tolerances, etc. to be saved and reproducible.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


3. INTRODUCTION TO MATLAB, Simulink and LabVIEW

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB MATLAB Environment


MATLAB, coined from MATrix LABoratory, is a mathematical computing software developed by MathWorks. MathWorks MATLAB is supported on Unix, Unix Macintosh, Macintosh and Windows environments; a student version of MATLAB is available for personal computers. For more information on MATLAB, contact the MathWorks Simply speaking, MATLAB can be thought as a calculator which is powerful in matrix operations. To a further extent, it is a powerful programming language equipped with various built-in functions and (optional) tool boxes and can be used to build a customized program. MATLAB is an interactive system y and p programming g g language g g for general g scientific and engineering computation. Its basic element is a matrix (array). It excels at numerical calculations and graphics. MATLAB has tools (functions) to solve common problems plus toolboxes (collections of specialized programs) for specific types of problems.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB
MATLAB Environment
Command window Click on the MATLAB icon/start menu initialises the Matlab environment: The main window is the dynamic command interpreter which allows the user to issue Matlab commands The variable browser shows which variables currently exist in the workspace Command history
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Variable browser

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB Vectors


Let's start off by creating something simple, like a vector Enter each element of the vector (separated by a space) between brackets brackets, and set it equal to a variable.
Forexample,tocreatethevectora,enter intotheMATLABcommandwindow
a = [1 2 3 4 5 6 9 8 7]

MATLABshouldreturn:
a= 123456987

Let'ssayyouwanttocreateavector with i helements l between b 0and d20evenly l spacedinincrementsof2(thismethodis frequentlyusedtocreateatimevector):


t = 0:2:20

t=

0 2 4 6 8 10 12 14 16 18 20
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB
Vectors
Basic operations on vectors: Manipulating vectors is almost as easy as creating them.
Forexample,supposeyouwouldliketoaddaconstant(e.g.3)toeachoftheelementsin vector'a'.Theequationforthatlookslike:
b=a+3

MATLABshouldreturn:
b= 4 5 6 7 8 9 12 11 10

Nowsuppose,youwouldliketoaddtwo vectorstogether.Ifthetwovectorsare thesamelength,itiseasy.Simplyaddthe twoasshownbelow:


c=a+b

c=

5 7 9 11 13 15 21 19 17

Subtraction of vectors of the same length works exactly the same way
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB Functions


To make life easier, MATLAB includes many standard functions. Each function is a block of code that accomplishes a specific task Matlab contains all of the standard functions such as sin, cos, log, exp, sqrt, as well as many others. Commonly used constants such as pi, and i or j for the square root of -1, are also incorporated into Matlab.

sin(pi/4) ans = 0.7071


To determine the usage of any function, type help [function name] at the Matlab command window.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB Plotting


Suppose you wanted to plot a sine wave as a function of time. First make a time vector t=0:0.25:7; compute the sin value at each time y = sin(t); plot(t,y) The plot command has extensive add-on capabilities Recommendation: visit the plotting page to learn more about it
Two Useful Symbols: Semicolon ; (If a semicolon is typed at the end of a command, the output of the command is not displayed). Percent Sign % (When the % is typed in the beginning of a line, the line is designated as a comment. Comments are frequently used in programs to add explanations or descriptions).
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB Polynomials


In MATLAB, a polynomial is represented by a vector. To create a polynomial in p y enter each coefficient of the p polynomial y into the vector in MATLAB, simply descending order.
x = [1 3 -15 -2 9]

x=

1 3 -15 -2 9

If the polynomial is missing any coefficients, you must enter zeros in the appropriate place in the vector.
y = [1 0 0 0 1]

polyval function - gives the polynomial value at certain value of independent variable. For example, the value of the above polynomial at s=2
z = polyval([1 0 0 0 1],2) z = 17
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB
Polynomials
The p product of two p polynomials y is found by y taking the convolution of their coefficients. MATLAB's function conv is doing this.

x y z z

= [1 2]; = [1 4 8]; = conv(x,y) = 1 6 16

16

The deconv function is using to divide two polynomials. It will return the remainder as well as the result result.

Let's divide z by y and see if we get x. [xx, R] = deconv(z,y) xx = 1 2 R = 0 0 0 0

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB Matrices


Entering matrices into MATLAB is the same as entering a vector, except p each row of elements is separated p by y a semicolon (;) or a return B = [1 2 3 4;5 6 7 8;9 10 11 12] B = 1 5 9 2 6 10 3 7 11 4 8 12

B = [ 1 2 3 4 5 6 7 8 9 10 11 12] B = 1 5 9
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

2 6 10

3 7 11

4 8 12

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB
Matrices
Transpose The transpose of a matrix can be found using the apostrophe key Matrix Inverse In MatLab, we execute inv(E) to find the inverse of the matrix E C = B' C = 1 2 3 4 5 6 7 8 9 10 11 12

E = [1 2;3 4] X = inv(E) X = -2.0000 1 5000 1.5000 det(E) ans = -2 1.0000 -0.5000 -0 5000

Determinant In MatLab, we execute det(E) to find the determinant of the matrix E


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

E = [1 2;3 4]

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB B = Matrices C =


Matrix Multiplication Remember that order matters when multiplying matrices

[1 2 3 4;5 6 7 8;9 10 11 12] B

D = B * C D = 30 70 110 70 174 278 110 278 446

Another option for matrix manipulation is that you can multiply the corresponding elements of two matrices using the .* operator (the matrices must be the same E = [1 2;3 4]; size i to t do d this). thi )
G = [2 3;4 5]; M = E.* F M = 2 12
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

F = C * B F = 107 122 137 152 122 140 158 176 137 158 179 200 152 176 200 224

6 20
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB
Matrices
Matrix Powers If E is a matrix matrix, the operation E. E ^2 2 squares each element in E. To square the matrix, i.e., compute E*E, E must be a square matrix and we use the operation E^2. If you have a square matrix, like E, you can also multiply it by itself as many times as you like by raising it to a given power.
E = [1 2;3 4]; E.^3 % element-by-element cubing ans = 1 8 27 64 E^3 % multiply matrix by itself ans = 37 54 81 118 eig(E) ans = -0.3723 5.3723 p = poly(E)

You can also find the eigenvalues of a matrix.

The "poly" function creates a vector that p = includes the coefficients of the characteristic 1.0000 -5.0000 -2.0000 polynomial. Remember that the eigenvalues roots(p) of a matrix are the same as the roots of its ans = 5.3723 characteristic polynomial.
-0.3723
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB Script Files or M M-Files


Rather than entering commands in the non-interactive command window, where the commands cannot be saved and executed again, it is better to first create a file with a list of commands (a program), save it, and then run (execute) the file. Commands in the file can be corrected or changed and the file can be saved and run again. The commands in the file are executed in the order listed. Files used for this purpose are called script files or m-files (extension .m is used when the file is saved). To create a M-File: File New M-File. The file must be saved before it can be executed. To execute it, chose the Run icon, or type the file name in the Command Window and press Enter.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO MATLAB
Getting help in MATLAB
MATLAB has a fairly good on on-line line help; type: help commandname for more information on any given command. You do need to know the name of the command that you are looking for. MatLab includes extensive help tools, which are especially useful for interpreting function syntax. y to get g help p from within MatLab: There are 3 ways Command-line help function help Windowed help screen Help MatLab Help MatLabs Internet help

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simulink is a graphical extension to MATLAB for modeling and simulation y Simulink is supported pp on Unix, Macintosh, and Windows of systems. environments; and is included in the student version of MATLAB for personal computers. For more information on Simulink, contact the MathWorks. Simulink is an extension to MatLab that allows engineers to rapidly and accurately build computer models of dynamic physical systems using block diagram notation. In Simulink, systems are drawn on screen as block diagrams. Many elements of f bl block k diagrams di are available, il bl such h as transfer t f functions, f ti summing i junctions, etc., as well as virtual input and output devices such as function generators and oscilloscopes. Simulink is integrated with MATLAB and data can be easily transferred between the programs.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Starting SIMULINK
Simulink is started from the MATLAB command prompt by entering the command: simulink Alternatively, you can hit the New Simulink Model button at the top of the MATLAB command window.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Starting SIMULINK
When it starts, SIMULINK brings up two windows. The first is the main Simulink window The second window is a blank, untitled, model window. This is the window into which a new model can be drawn

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK Basic Elements


There are two major classes of items in Simulink: Blocks are used to g generate, , modify, y, combine, , output, p , and display p y signals; g ; and Lines are used to transfer signals from one block to another. Blocks - There are several general classes of blocks: Sources: Used to generate various signals Sinks: Used to output or display signals Discrete: Linear, discrete-time system elements (transfer functions, state-space models, etc.) Linear: Linear, continuous-time system elements and connections (summing junctions, gains, etc.) Nonlinear: Nonlinear operators (arbitrary functions, saturation, delay, etc.) Connections: Multiplex, Demultiplex, System Macros, etc. Lines - transmit signals in the direction indicated by the arrow. Lines must always transmit signals from the output terminal of one block to the input terminal of another block.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Basic Elements

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simple Example
The simple model consists of three blocks: Step, Transfer Fcn, and Scope. The Step is a source block from which a step input signal originates. originates This signal is transferred through the line in the direction indicated by the arrow to the Transfer Function linear block. The Transfer Function modifies its input signal and outputs a new signal on a line to the Scope. The Scope is a sink block used to display a signal much like an oscilloscope.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simple Example
Modifying Blocks
A block can be modified by double-clicking on it. F example, For l if you double-click d bl li k on the th "Transfer "T f Fcn" block in the simple model, you will see the following dialog box.

This dialog box contains fields for the numerator and the denominator of the block's transfer function. By entering a vector containing the coefficients of the desired numerator or denominator polynomial, the desired transfer function can be entered. For example, to change the denominator to s^2+2s+1, enter the following into the denominator field: [1 2 1].
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simple Example
Modifying Blocks
The "step" block can also be double-clicked, bringing up the following dialog box. The default parameters in this dialog box generate a step function occurring at time=1 sec, from an initial level of zero to a level of 1. (in other words, a unit step at t=1). Each of these parameters can be changed.

The most complicated of these three blocks is the "Scope" Scope block. block Double clicking on this brings up a blank oscilloscope screen. When a simulation is performed, the signal which feeds into the scope will be displayed in this window.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simple Example
Running Simulations
Before running a simulation of this system, first open the scope window by double-clicking on the scope block. Then, to start the simulation, either select Start from the Simulation menu or click the Start simulation button in the model window. The simulation should run very quickly and the scope window will appear as shown.

Start Simulation

Note that the simulation output (shown in yellow) is at a very low level relative to the axes of the scope. To fix this, hit the autoscale button (binoculars), which will rescale the axes.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simple Example
Configuration Parameters
Now, we will change the parameters of the system and simulate the system again. Double-click on the "Transfer Fcn" block in the model window and change the denominator to [1 20 400] Re-run the simulation and you should see what appears as a flat line in the scope window. Hit the autoscale button, and you should see the following in the scope window. Notice that the autoscale button only changes the vertical axis. Since the new transfer function has a very fast response, it is compressed into a very narrow part of the scope window. This is not really a problem with the scope, but with the simulation itself. Simulink simulated the system for a full ten seconds even though the system had reached steady state shortly after one second.

To correct this, you need to change the parameters of the simulation itself. In the model window, select Configuration Parameters from the Simulation menu.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO SIMULINK
Simple Example
Configuration Parameters
There are many simulation parameter options; we will only be concerned with the start and stop times, which tell Simulink over what time period to perform the simulation. Change Start time from 0.0 to 0.8 (since the step doesn't occur until t=1.0. Change Stop time from 10.0 to 2.0, which should be only shortly after the system settles. After rerunning the simulation and hitting the autoscale button, the scope window should provide a much better display of the step response.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

13

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
LabVIEW (Laboratory Virtual Instrument Engineering Workbench) relies on graphical symbols rather than textual language to describe programming actions. LabVIEW is a software, which uses graphical programming language for data acquisition, data analysis, presentation of result and instrument control. The principle of dataflow, in which functions execute only after receiving the necessary data, governs execution in a straightforward manner. LabVIEW programs are called: Virtual Instruments (VIs) because their appearance and operation imitate actual instruments, such as oscilloscopes and multimeters. However, they are analogous to main programs, functions and subroutines from popular language like C, Fortran, Pascal, . . . Each VI contains three main parts: Front Panel an interactive user interface of a VI, so named because it can simulates the front panel of a physical instrument. Block Diagram VIs source code, constructed in LabVIEWs graphical programming language, G. It is the actual executable program Icon/Connector means of connecting a VI to other VIs.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW VI Front Panel


The front panel is the user interface of the VI A front panel contains controls for input and indicators for output or data presentation. The Front Panel is used to interact with the user when the program is running. Users can control the program, change inputs, and see data updated in real time. Controls are knobs, pushbuttons, dials, and other input devices Controls simulate instrument input devices and supply data to the block diagram of the VI. Stress that controls are used for inputs- adjusting a slide control to set an alarm value, turning a switch on or off, or stopping a program. Indicators are graphs, LEDs, and other displays Indicators simulate instrument output devices and display data the block diagram acquires or generates. Indicators are used as outputs. Thermometers, lights, and other indicators indicate values from the program. These may include data, program states, and other information.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

14

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
VI Front Panel
When you run a VI, you must have the front panel open so that you can input data to the executing program. The front panel is where you see your programs output. Front Panel Controls = Inputs Indicators = Outputs Front Panel Toolbar Boolean Control Icon

Graph Legend

Waveform Graph Plot Legend g Scale Legend

In this picture, the Power switch is a boolean control. A boolean contains either a true or false value. The value is false until the switch is pressed. When the switch is pressed, the value becomes true. The temperature history indicator is a waveform graph. It displays multiple numbers. In this case, the graph will plot Deg F versus Time (sec). The front panel also contains a toolbar.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW Block diagram


Every front panel control or indicator has a corresponding terminal on the block diagram When a VI is run diagram. run, values from controls flow through the block diagram, diagram where they are used in the functions on the diagram, and the results are passed into other functions or indicators. The block diagram contains this graphical source code. Front panel objects appear as terminals on the block diagram. Additionally, the block diagram contains functions and structures from built-in LabVIEW VI libraries. Wires connect each of the nodes on the block diagram, including control and indicator terminals, functions, and structures Block Diagram Accompanying program for front panel Components wired together.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

15

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
Block diagram
The block diagram window h ld the holds h graphical hi l source code of a LabVIEW VI it is the actual executable code You construct the block diagram by wiring together objects that perform specific functions. The various components of a block diagram are terminals, nodes and wires.
Block Diagram Toolbar SubVI Graph Terminal Wire Data While Loop Structure Numeric Constant Timing Function Boolean Control Terminal Divide de Function

In this block diagram, the subVI Temp calls the subroutine which retrieves a temperature from a Data Acquisition (DAQ) board. This temperature is plotted along with the running average temperature on the waveform graph Temperature History. The Power switch is a boolean control on the Front Panel which will stop execution of the While Loop. The While Loop also contains a Timing Function to control how frequently the loop iterates.
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
Icon and connector pane
Identifies the VI so that you can use the VI in another VI. A VI within another VI is called a sub-VI Provide the connectors for wiring.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

16

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
Three LabVIEW Palettes
The Tools palette is available on the front panel and the block diagram. A tool is a special operating mode of the mouse cursor. The Controls palette is available only on the front panel The Controls palette contains the controls and indicators you use to create the front panel. The Functions palette is available only on the block diagram. The Functions palette contains the VIs and functions you use to build the block diagram.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW LabVIEW Palettes


The Tools palette is available on the front panel and the block diagram. A tool is a special operating mode of the mouse cursor. Select View Show Tools Palette to display the Tools palette FloatingPalette Usedtooperateandmodifyfrontpanelandblockdiagramobjects. AutomaticSelectionTool OperatingTool Positioning/ResizingTool LabelingTool WiringTool ShortcutMenuTool
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

ScrollingTool BreakpointTool ProbeTool ColorCopyTool ColoringTool

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

17

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
LabVIEW Palettes
The Controls palette Use the Controls palette to place controls and indicators on the front panel. Select View Show Controls Palette or right-click the front panel workspace to display the Controls palette I th In the front f t panel l mode, d right i ht click any empty place, the control palette will be shown. After you choose proper screen, you can pin that screen
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
LabVIEW Palettes
Functions Palette - Use the Functions palette, to build the block diagram. Select View Show Functions Palette or right-click g the block diagram g workspace to display the Functions palette. In the Block diagram mode, right click any empty place, the function palette will be shown. After you choose proper screen, you can pin that screen.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

18

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW Status Toolbar

RunButton ContinuousRunButton AbortExecution

Additi Additional l Buttons B tt on the th Di Diagram Toolbar T lb


ExecutionHighlightingButton RetainWireValuesButton StepFunctionButtons

Click the Run button to run the VI. While the VI runs, the Run button appears with a black arrow if the VI is a top-level VI, meaning it has no callers and therefore is not a subVI. Click the Continuous Run button to run the VI until you abort or pause it. You also can click the button again to disable continuous running. While the VI runs, the Abort Execution button appears. Click this button to stop the VI immediately. Click the Pause button to pause a running VI. When you click the Pause button, LabVIEW highlights on the block diagram the location where you paused execution. Click the Pause button again to continue running the VI. Select the Text Settings pull-down menu to change the font settings for the VI, including size, style, and color. Select the Align Objects pull-down menu to align objects along axes, including vertical, top edge, left, and so on. Select the Distribute Objects pull-down menu to space objects evenly, including gaps, compression, and so on. Select the Resize Objects pull-down menu to change the width and height of front panel objects.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW Show context Help

When you point at any icon (graphical code), the description of the icon will be shown if the show context help is checked.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

19

INTRODUCTION TO MATLAB, SIMULINK AND LABVIEW

INTRODUCTION TO LABVIEW
Help Options

Context Help
Online help Lock help Simple/Complex Diagram help Ctrl + H

Online reference
All menus online Pop up on functions in diagram to access online info directly

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

20

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


4. THEORETICAL MODELING

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL PARAMETERS AND SIGNALS


A model of a dynamic system contains a number of quantities of different types. Certain quantities in the model which do not vary in time are called Constant. Those quantities that vary in time are called variables or signals. It is practical to distinguish two types of constants in models: System parameters are constants that are considered given by the system y and cannot be chosen by y the designer. g Design parameters are constants that can be chosen in order to give the system / model desired properties. The purpose of the simulation study is often to decide suitable values for the design parameters.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL PARAMETERS AND SIGNALS


In systems/models, there are usually signals and variables that influence other variables in the system, but are not themselves influenced by the behavior of the system. Those variables are called external signals. In a block diagram the external signals are always marked by arrows coming from outside. An external signal can be one of two types: Input or control signal: An external signal in the system whose time variations we can choose. Denoted by u1(t), u2(t) ... uR(t). If we assign these inputs in vector form, we obtain the input vector u(t) Disturbance signal: An external signal in the system y that we cannot influence. Denoted by z1(t), z2(t) . . . zQ(t) , respectively
Disturbance Inputs
Subsystem

System Outputs

Control Inputs
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

System

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL PARAMETERS AND SIGNALS


A model and a dynamic system always contain a number of variables, or signals, whose behavior is our primary interest. Such signals are called ll d outputs and d usually ll denoted d db by yl(t), ) y2(t),..., ) yM(t). ) The h individual signals can be combined to form an output vector y(t)
It is important to emphasize that the outputs of a model are not defined by the model itself, but that can be freely determined depending on the question what is going to be considered as output.

Internal variable: A variable in the system that is neither an output nor an external signal. In a system there is always a (not unique) number of internal or system state variables that allow a complete description Disturbance of f system t dynamics. d i If we assign i these th System Inputs states in vector form, we obtain the state Outputs Subsystem vector x(t)
Control Inputs
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

System

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

PHASES OF MODELING
Modeling is, in common with other scientific and engineering activities, as much an art as a science. Successful modeling is based as much on a good f li for feeling f the h problem bl and d common sense as on the h formal f l aspects that h can be taught. In order to achieve purposeful mathematical descriptions the process of modeling can be divided into three phases: 1. The problem is structured and broken down 2. The basic equations are formulated 3. By rearranging, the state-space or transfer function model will be achieved hi d One difficulty is that the modeling sometimes ranges over completely different types of physical systems. It is then useful to draw on the analogies that exist between different physical phenomena. The general structuring of the modeling into three phases will also be relevant in that context.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

PHASES OF MODELING
Phase 1: Structuring the Problem
Phase 1 consists of an attempt to divide the system into subsystems, an effort to determine cause and effect effect, what variables are important and how they interact. interact When doing this work, it is important to know the intended use of the model. The result of phase 1 is a block diagram or some similar description. This phase puts the greatest demands on the modeler in terms of the understanding of and intuition for the physical system. It is also in this phase that the level of complexity and degree of approximation are determine. In summary, Phase 1 can be formulated by the following requirements: Determine the external signals and outputs of the system. Decide what internal variables are important for the system description Formulate the interaction between external signals, internal variables and outputs using a block diagram
For more complex systems, it is more efficient to first divide the system into subsystems and then divide the subsystems further into blocks.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

PHASES OF MODELING
Phase 2: Setting up the Basic Equations
Phase 2 involves the examination of the subsystems, the blocks, that the structuring g of p phase 1 p produced. The relationships p between constants and variables in the subsystems have to be formulated. For this purpose, those laws of nature and basic physical equations that are assumed to hold in the appropriate areas are used. This often means that certain approximations and idealizations (point mass, ideal gas, and the like) have to be made in order to avoid too complicated expressions. For non technical systems, for which generally accepted basic equations are often lacking, this phase gives the opportunity for new hypotheses and innovative thinking. A proven approach in formulating the basic equations of a block or subsystem is : Writing down the conservation laws that are relevant for the particular block Using appropriate constitutive relations to express the conservation laws by means of the model variables. A dimension control at this point eliminates tedious debugging later It may be possible to carry out a linearization of the equations at this point
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

PHASES OF MODELING
Phase 3: Forming the final model
Phase 3 in contrast to the other phases, is a more formal step aiming at the suitable organization of the equations and relationships left by phase 2. Even if the model in some sense is i defined d fi d already l d after ft phase h 2, 2 this thi step t i is usually ll necessary to t give i a model d l suitable it bl for analysis and simulation. It is not always necessary to carry the work all the way to an explicit form. For the purpose of simulation it might be enough to achieve state-space models for the subsystems together with instructions for the interconnection. State-Space Model Suitable choice of state variables (state vector x(t)) Express the time derivative of the state vector dx(t)/dt by the state vector x(t) itself and the input vector u(t) Express the output vector y(t) by the state vector x(t) and input vector u(t)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

1. 2.

1. 2. 3.

3.

4.

Transfer Function Selection of input signal ui(t) and output signal yj(t) Laplace transform of differential equations Forming the (algebraic) equations with elimination of all variables except Ui(s) and Yj(s) Formulate the transfer function

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Electrical Systems


For many engineering applications it turns out that the same type of equations appear despite the diversity of the physical systems Starting from these analogies it is possible to do systematic modeling for a broad class of systems. Because of these analogies, the electrical systems are discussed here in the first place. Consider electrical circuits consisting of resistors, capacitors, inductors, and transformers. The basic equations used to describe such circuits consist of relationships between the fundamental quantities: Voltage u (volt, V) Current C t i (ampere, ( A) Electrical components are described in terms of their voltage / current relations.
RLC parallel circuit RLC series circuit
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Electrical Systems
Memory elements
In these (idealized) elements, elements energy can be stored. An ideal inductor is described by: An ideal capacitor is described by:

where u(t) and i(t) are voltage and current at time t. The constant L is the inductance (henry, h). The relationship is sometimes called the law of inductance and it can also be written as:

where C is the capacitance (farad, F) . The relationship can also be written as:

Energy stored in an inductor EL [J] is defined by:


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Energy stored in a capacity EC is expressed by:

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Electrical Systems


Resistance element
For a linear resistor with resistance R (ohm, ) the relationship between current and voltage is given by the well known Ohm's law: In general, a resistance can also be a non-linear resistance described by the form: In the resistor, energy is lost (as heat). The power is: (P is measured in watts, 1 W = 1 J/s.)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Transformer
An ideal transformer transforms voltage and current in such a way that their product is constant:

where is the ratio of the number of turns on each side

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Electrical Systems


Other basic laws
Kirchhoff's Ki hh ff' laws l are basic b i to t the th analyses l of f electrical circuits: a) Kirchhoff's Current Node Law In a given node the sum of currents must be zero:
RLC series circuit RLC parallel circuit

b) Kirchhoff's Voltage Loop Law The summation of voltage drops around a closed loop must be zero:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Mechanical Systems


Motion and force are concepts used to describe the behavior of engineering systems that employ mechanical components aspects that can be taught taught. Motion is a term used to describe the movement of a point relative to another and it is described using the terms distance, velocity, and acceleration. Motion in mechanical systems can be: Translational Rotational, or Combination of above Mechanical systems can be of two types: Translational systems. Rotational system.

The three basic mechanical elements are: Spring (elastic) element Damper (frictional) element Mass (inertia) element
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Mechanical Systems


Translational Mechanical Systems
Mechanical translation is governed by the laws of mechanics, mechanics which are relationships between the variables: Force F (newton, N) Velocity v (meters per second, m/s) In general, these quantities are three dimensional vectors. Most of the following relationships can be formulated as vector equations, but for simplicity here are limited to the representation of scalar relations. Each of the elements has one of two p possible energy gy behaviors: stores all the energy supplied to it dissipates all energy into heat by some kind of frictional effect Spring stores energy as potential energy Mass stores energy as kinetic energy Damper dissipates energy into heat
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Mechanical Systems


Translational Mechanical Systems
Memory elements
Even with mechanical translational elements, energy can be saved; the ideal inductance here is obviously the mass m [kg] . Newton's second law gives: The above equation can also be written as In the previous equations, F(t) has to be understood as a sum of forces acting on a body Energy stored in a moving mass is kinetic energy Ek [J] :
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

For an ideal (linear) spring, the reciprocal value of spring constant 1/k [m/N] can be considered as capacity. The spring force is proportional to the elongation (or compression), i.e. it is proportional to the integral of the difference in velocity between the end points: i t

Energy stored in a spring is potential energy Ep [J] :

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Mechanical Systems
Translational Mechanical Systems Resistance element Transformer
At translational motion in real systems, friction is always present. In general, friction is described by: The most common case perhaps is dry friction: Air resistance is often described by : and viscous friction : The power lost as heat through friction is :
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

The ideal transformer corresponds to a rigid lever. For an ideal transformer with the lever ratio , therefore, the following equations can be applied:

Rigid lever as an ideal mechanicaltranslational transformer


MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Mechanical Systems
Translational Mechanical Systems Other Oth basic b i laws l
For a translational mechanical system at rest, the sum of attacking forces is always zero: This is the equivalent of Kirchhoff's voltage law; an analogous relationship for the velocities does not exist!
Law of reaction forces (Newtons 3rd law) All forces occur in equal and opposite pairs (action/reaction). Force exerted by an element is equal and opposite to the force on the element. If the ends of two elements are connected, connected these ends are forced to move with the same displacement, velocity, and acceleration

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Mechanical Systems
Rotational Mechanical Systems
Mechanical systems with rotational parts like motor and gear boxes, are very common. For these systems the laws of mechanics relate the basic variables: Torque M (newton-meter, Nm) Angular velocity (radians per second, s-1) Memory elements
The ideal inductance here is the moment of inertia J [Nm/s2], while the torque on the axis is proportional to the angular acceleration, i.e.:

M, M,

This can be written as: Energy stored in a rotating mass Ek [J] is given by:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

M,

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Mechanical Systems
Rotational Mechanical Systems
Memory elements
Torsion is the twisting of an object due to an applied torque. The torsional stiffness k [Nm] is defined by the relationship between the angular velocity and the torque:

M, M,

The torsion of an axis gives rise to a torque described by:

The integral corresponds to the angular displacement between the ends. Due to torsion, energy is stored as a potential energy Ep [J] expressed by:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

M,

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Mechanical Systems


Resistance element

Rotational Mechanical Systems

The rotational friction is a function of the angular velocity: with different functions r analogous to translational friction. The power dissipation at rotation is:

Transformer
The ideal transformer corresponds to a friction-free pair of gears. For an ideal transformer with the ratio , therefore, the following equations can be applied:
Friction-free pair of gears as an ideal mechanical-rotational transformer

Other basic laws


For a rotational mechanical system at rest, the sum of all torques must be zero:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Fluid Systems


The fluid systems discussed here are limited to flows of incompressible fluids in pipes and tanks. (Incompressible fluids are those for which the volume is unaffected by the pressure.) Typical applications are in chemical industrial systems and hydraulic systems. The treatment of compressible fluids is more complicated, partly because there are temperature changes when the volume is altered. Fluid systems are described by two basic quantities: Pressure p (newtons per square meter, N/m2) Flow Q (cubic meters per second, m3/s) Volume flow Q multiplied by the density gives a mass flow in [kg/s]. For incompressible flows there is no essential difference.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Fluid Systems
Memory elements

For a fluid flow through a tube, the pressure difference p between the end points of the tube results in a force that accelerates the fluid. fluid The force is where A is the cross-sectional area. If the density of the fluid is , than the mass to be accelerated is lA. Newton's force law gives:

Flow through a tube. p1 and p2 are the pressures at the end points of the tube

where v(t) is the velocity of the fluid. The velocity corresponds to a fluid flow Q = v(t)A, therefore the above equation can be written as: or in integral notation: where is the fluid inertia [kg/m4] represents the pipe.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

The frictionless flow through a tube corresponds to a stored kinetic energy E [J] defined by

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Fluid Systems
Memory elements

Consider a fluid that is accumulated in a tank. The volume V in the tank is the integral of the flow: The pressure at the bottom of the tank is equal to the level h (h = V/A) multiplied by the density and the gravitational acceleration g :

A tank as a fluid store

The parameter: Cf = A/g [m4s2/kg] is called the fluid capacitance. The potential energy E [J] stored in the tank is expressed by:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Fluid Systems Resistance element


When liquid flows through a tube there is normally a loss of power through friction against g the walls and internal friction in the fluid. This leads to a p pressure drop over the tube. Conversely, it can be said that a pressure drop is needed to maintain a certain flow. The pressure drop depends on the flow. In general it can be written: The function r(Q) depends on the tube geometry.
If the tube is thin or filled with a porous medium, d'Arcy's law applies: where Rf [kg/m4s] is called the flow resistance. If the tube contains a sudden change in area (an orifice or a valve), than: with a constant H.

p1

Q p = p1 p 2
Flow through an orifice

p2

The energy loss through friction phenomena is given by:


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Fluid Systems


Transformer
The ideal transformer f corresponds p to a friction-free double piston. For an ideal transformer with the ratio , therefore, the following equations can be applied:

Friction-free double piston as an ideal flow transformer

Other basic laws


For incompressible F i ibl fluid fl id completely l t l analogous l laws l apply l as for f electric l t i circuits, i it so that Kirchhoff's laws can be adapted accordingly. The total pressure over a series When flows are connected in a junction connected pipes must be the their sum must be zero: sum of the pressure drops
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS Thermal Systems


Thermal systems involve heating of objects and transport of thermal energy. The laws governing these phenomena are typically expressed as relationships between the quantities: Temperature T (kelvin, K) Heat flow rate q (watt, W)

Memory elements
Heating of a body means that the temperature increases as heat flows into it. C [J/K] is the thermal capacity This relationship Thi l ti hi can b be written itt as:

Other basic laws

Heat transfer between two bodies with temperatures T1 and T2 is often assumed to be proportional to the temperature difference T = T2 T1 : W [J/Ks] is called the heat transfer coefficient Furthermore, the sum of all heat flow rates at one point must be zero:

In thermal systems, the heat flow corresponds to a self-resistance (energy dissipation). A transformer is indeed realized in thermal systems (heat pumps, refrigeration unit), but can not be discussed even in a rough approximation as an ideal transformer.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

13

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Analogies between physical subsub-areas
Obviously there are strong analogies between the different areas of modeling. A common basic structure can therefore be found in all areas: There are always two variables sufficient to completely describe the systems, which are commonly used as: Effort variables e Flow variables f The relationships between these variables have the following forms: Effort storage: Flow storage: Static relationship: Inductive energy storage: Capacitive energy storage:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Power dissipation: S Sum of f fl flows equal l to t zero: Sum of efforts (with signs) equal to zero: Transformation of variables:

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

SOME BASIC RELATIONSHIPS IN PHYSICS


Analogies between physical subsub-areas
Some Physical Analogies
System Electrical Mechanical: Translational Rotational Hydraulic Thermal Force Torque Pressure Temperature Velocity Angular velocity Flow Heat flow rate Mass Moment of inertia Tube Spring Torsion spring Tank Heating Friction Friction Orifice Heat flow Effort Voltage Flow Current Inductance Inductor (coil) Capacitance Capacitor Resistance Resistor

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

14

THEORETICAL MODELING

MODEL SIMPLIFICATION
All models contain simplifications of the real processes. The model must be manageable for our purposes. A model with thousands of variables is impossible to use for f analysis l i and d requires i long l execution i times i for f simulation. i l i Simple i l model d l primarily means a model whose order (the dimension of the state vector) is small. Simple could also mean that the relationships between variables are easily computable or that the model is linear rather than nonlinear. The model simplification can be done under the first two phases of modeling but also in the completed model to reduce complexity. The model simplification can be done by: 1. Neglect of small effects - Approximations 2. Separation of time constants HierarchyofModels,dependingontheparticularneedforthemodel morecomplex,morerealistic,lesseasilysolved 3. Aggregation of State Variables 4. Linearization Design Truth Model Model 5. Model reduction for linear systems
lesscomplex,lessrealistic,moreeasilysolved
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL SIMPLIFICATION
Neglect of small effects - Approximations It is often clear that certain effects are more important p than others. The decisions which effects can be neglected may be done after an extensive expertise or after detailed preliminary investigations. Many relationships between variables in an engineering system are complicated and do not fit the idealized situations for which physical laws are formulated. Real gases are not ideal, real liquids are not incompressible, real flow is not laminar, and so on. When modeling a nontechnical system, the difficulties of getting a reliable description are even greater. In practice, practice we have to accept working with approximate relationships. The degree of approximation that we can tolerate depends on the desired accuracy of the model. We must also have some balance between approximations in different subsystems.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

HierarchyofModels,dependingontheparticularneedforthemodel morecomplex,morerealistic,lesseasilysolved
Truth Model Design

Model

lesscomplex,lessrealistic,moreeasilysolved

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

15

THEORETICAL MODELING

MODEL SIMPLIFICATION
Separation of Time Constant
In the same system there are often time constants of different orders of magnitude. Still, the interest might be focused on a certain time scale. The following rules can be applied: Concentrate the modeling on phenomena whose time constants are of interest when considering the intended use of the model Subsystems whose dynamics are considerably faster are approximated with static relationships Variables of subsystems whose dynamics are appreciably slower are approximated as constant By observing these rules, rules there are two major advantages: 1. Due to the neglect of very fast and very slow dynamics, the order of the model is lower 2. A model with time constants of the same magnitude is easier to simulate numerically For some systems there might really be interest in time constants of quite different magnitude. In such a case, the possibility of using two different models (one for each time scale) should be considered, and each one of them should be simplified using the preceding procedure.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL SIMPLIFICATION
Aggregation of State Variables
An example of aggregation of state variables: To merge g several similar variables into one state variable. Often this variable plays the role of average or total value. Aggregation is a very common method for reducing the number of state variables in a model.
A typical example is thermodynamics. To know the state of a volume of gas, we would strictly speaking have to know the speed and position of every molecule. Instead we use pressure and temperature when dealing with a gas on a macro level. Those variables are aggregated state variables connected to the average distance between molecules and the average velocity.

A number of physical phenomena are described by partial differential equations (PDE). Typical examples are field equations, waves, flow, and heat conduction problems. In mathematical models of dynamic systems to be used in simulation, PDEs are often unsuitable. Often partial differential equations are reduced to ordinary differential equations via difference approximations of the spatial variables. This corresponds to aggregation.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

16

THEORETICAL MODELING

MODEL SIMPLIFICATION
Aggregation of State Variables
Example: Heat Conduction Consider a metal rod whose left end point is heated by an external source.
Model with distributed parameters The third-order model with lumped parameters

- temperature at time t at the distance x a - heat conductivity coefficient of the metal Boundary conditions:
The linear state-space model - the state vector

The mathematical model does not define a state, but a continuous function T (x, t) in two variables. Therefore, systems described by partial differential equations are often called infinite-dimensional systems.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL SIMPLIFICATION
Linearization
The linearization of a mathematical model is often used simplification when deviations are viewed from an operating point (steady state, time derivatives equal to zero). The linearization of a nonlinear dynamical system can be done analytically or numerically.

Analytical linearization
If the analytical description of a nonlinear dynamical system is given by a nonlinear ordinary differential equation, a Taylor series expansion can be calculated, and than higher derivatives can be neglected (this applies to the continuous non-linearities).
( kn ) ( k1 ) ( k2 ) &1 ,..., x1 , x2 , x & 2 ,..., x2 ,......., x & n ,..., xn = 0 F x1 , x

Taylor series around the operating point is


F = F0 +
( k1 ) F F F & + ........ + ( k ) x1 + x1 + x 1 &1 0 1 x1 0 x x1 0

Linear differential equation:

&1 + . . . . + a1k1 x1 + F = a10 x1 + a11 x ( k2 ) & 2 + . . . . + a 2 k2 x2 + + a 20 x 2 + a 21 x

( k1 )

( k2 ) F F F & + ........ + ( k ) x 2 + + x 2 + x 2 &2 0 2 x 2 0 x x2 0

& n + . . . . + a nk n x n = 0 + a n 0 x n + a n1 x

( kn )

F F F & + ........ + ( k ) x n = 0 x n + x n &n 0 n x n 0 x x2 0


( kn )

where the coefficients aij apparently arising from the partial derivatives in the operating point
a ij =

F
( j) 0

xi

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

17

THEORETICAL MODELING

MODEL SIMPLIFICATION
Linearization Example
A simple model for an air heating The formal linearization yields to the equation T - output temperature q - supplied heat flux c - specific heat capacity of air - mass flow Te input temperature The implicit form of the equation:

Now we calculate the partial derivatives and remembering that we obtain the linearized differential equation

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THEORETICAL MODELING

MODEL SIMPLIFICATION
Linearization Numerical linearization Prerequisite is the existence of a nonlinear simulation model. The linearization procedure than is applying to each state and each input of the model as follows: 1. The value of the state vector in the operation point is sets as initial condition 2. All inputs are equal to zero 3. A single state or input is excited by a disturbance of small amplitude. To do this, the model should be integrated numerically 4. From the recorded changes in the remaining states, the corresponding difference quotient between excited variable and the remaining variables is determined numerically This process leads to discrete linear state space model describing the dynamics for small deviations around the operating point.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

18

THEORETICAL MODELING

MODEL SIMPLIFICATION
Model reduction for linear systems
For linear, stable and observable systems there is possibility to transform originally received state-space model into special form so-called balanced realization. In this state representation, the system states are treated by an energy criterion in their meaning, i.e. using a weight the significance of the individual states can be determine. This choice of weights is therefore a quantitative criterion for deciding which states you can omit. Even very large order systems (n> 100) can thus be efficiently y reduced to small models ( (n <10). ) The choice of those states whose weight is smaller than a certain limit leads to a reduced-state model of lower order, which has essentially the same dynamics as the original model.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

19

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


5. BOND GRAPHS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS INTRODUCTION


Similar forms of equations are generated by dynamic systems in a wide variety of domains. Such systems are analogous. There are far reaching analogies between electrical, mechanical, hydraulic, and thermal systems. Based on these analogies, a systematic modeling scheme can be found. One way of doing this is to use bond graphs.
In the 1960s Professor H. M. Paynter proposed a method of system modeling that was both unifying and algorithmic. He called the technique bond graphs, and it is based on power flow diagrams (as opposed to signal flow) and is p of physical p y domain. independent

The bond graph method is a graphical approach to modeling in which component energy ports are connected by bonds that specify the transfer of energy between system components. Power, the rate of energy transport between components, is the universal currency of physical systems.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS EFFORTS


AND

FLOWES
Graphical format for bonds Half Arrow

The basic idea of bond graphs is that many models d l can be b described d ib d in i terms of f effort ff t variables e and flow variables f.

e
Subsystem 1 Subsystem 2

f
Effort and flow Bond

u i
electrical

F v
mechanical Efforts and flows

p Q
hydraulic

e f
general

The products ui, Fv, pQ, and e f have the dimension of power. The horizontal line, the bond, is therefore interpreted as a connection between subsystems that exchange energy.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS EFFORTS


AND

FLOWES

Flow Storage Many physical elements can be modeled as flow storage, storage for example, a capacitor for electric current or a tank for water flow. With bond graphs this is represented according to figure, where the C denotes the storage element (C as in capacitive). The bond symbolizes the energy flow from the rest of the system into the element. If the relationship between e and f is linear, then the coefficient is often included in the graph. graph or
Fl storage Flow

e f e f C

C:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS EFFORTS


AND

FLOWES
Effort storage

Effort Storage
An inductor could be regarded as an effort storage with a relationship (in the linear case)

e f

I:

Elements of this type are often called inductive or inertial.

Resistive Elements
Static relations between effort and flow

Resistive element

e f R: e=h(f)

Sources

Th are i There in general l inputs, i t that th t are, externally t ll generated t d signals. i l When Wh dealing d li with ith bond graphs, they are called sources. They can be of two types, depending on whether the input is an effort or a flow.
Effort source Flow source

e Se
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

e
System

Sf

System

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS JUNCTIONS


Series Junction
Consider the electric circuit Regard d voltage l u as an input i signal i l The energy flowing into the system is divided between the resistor, the capacitor, and the inductor. Resistor u1 i Se u i u3 i s u2 i Inductor Se Efforts satisfy the relation: u u1 u2 u3 = 0 u i u3 i
Effort source

u Se
System

i R : R1 u1 i s u2 i I : L1

Capacitor s represents a series connection


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

C : C1
Power flow in an electric circuit
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS JUNCTIONS


Series Junction
In general, I l series i junction j ti (an ( s junction) j ti ) is i characterized h t i d by: b The same flow: f1 = f2 = . . . = fn The sum of efforts equal to zero: e1 + e2 + . . . + en = 0 It is natural to have the convention that an outward pointing arrow gives a change of sign for the effort variable. The following graph, for example, has the equation: e1 + e2 e3 = 0

s junction
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS JUNCTIONS


Parallel Junction
Analogously to the previous, previous it is natural to define a junction where e and f have changed roles. A parallel junction (p junction) is define with the following rules: Identical efforts : e1 = e2 = . . . = en Sum of flow equal to zero: R : R1 f1 + f2 + . . . + fn = 0 u Sf u i u f1 + f2 f3 = 0 p junction
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Electric parallel circuit

Flow source

u Sf
System

i1 p i3 u i2 C : C1
It is: i i1 i2 i3 = 0 , and there is the same voltage (effort) at all the bonds.

I : L1

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS JUNCTIONS


Simplifications in Bond Graphs
In a number of cases, bond graphs can be simplified. p For example: p Junctions that have only two bonds (with the half arrows pointing in the same direction) can be removed. A direct application of the definitions shows that two adjacent junctions of the same kind can be merged.
Merging of junctions

Removal of junctions
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SIMPLE BOND GRAPHS


Mechanical system
Consider the mechanical system. A body, which is moving without friction with the velocity v, is pulled with the force F. F is regarded as the input (effort source). In this case, all energy is stored as kinetic energy (effort storage, an I element). v

F
Effort source

F Se
System

F Se v I:m

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SIMPLE BOND GRAPHS


Mechanical system with spring
F is represented as an effort source. Now, the energy is divided between kinetic energy and energy stored in the spring. This corresponds to effort and flow storage, respectively, that is, I and C elements. Since these elements have the Se velocity in common, this is a junction with common flow - a series junction. F v F2 v F = F1 + F2
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

v k

m
F v

Kinetic energy

Se

F1 v

I:m

Energy in spring

C : (1/k)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

BOND GRAPHS SIMPLE BOND GRAPHS


Mechanical system with spring and friction
In this case, the mass slides along the surface with a certain friction. It is assumed that the friction is a nonlinear function of the velocity Ff (t) = r (v (t)) The energy supplied by F is now divided into three components. The friction loss is an R element. The velocity v is common to all bonds, that is a junction with common flow - a series junction. v k

R : F f = r (v ) Ff v Se F v F2 v C : (1/k) s F1 v I:m

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SIMPLE BOND GRAPHS


Electrical system
The voltage g u is regarded g as input. p This corresponds to an effort source. There is a series connection between R1 and L1, where R1 and L1 are R and I elements respectively. In the subsystem consisting of R2 and C1 the energy is divided between I : L1 R2 (R element) and C1 (C element) in a p junction (a common voltage). Se u s R2 C1 Se u
Effort source

u Se I : L1
System

C : C1

R : R1
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

R : R1

R : R2

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS TRANSFORMERS AND GYRATORS


Transformer
The ideal electrical transformer with the relationships: u2 = n u1 , i2 = (1/n) i1 also has counterparts for mechanical and hydraulic systems. In bond graphs it is usually symbolized as shown in figure, with the relationships: e2 = n e1 f 2 = (1/n) f 1 The transformer can be used to describe connections between different types of physical variables. An example is a hydraulic cylinder. The relationships between the mechanical variables, the force F and the velocity v, and the hydraulic variables, the pressure p and the flow Q , are p = F/A and Q=vA (A the cylinder cross section) Since p and F are effort variables and Q and v are flow variables, this is a transformer.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Ideal transformer

v F

Area A p Q

F v

p TF 1/A Q

A mechanical-hydraulic conversion

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS TRANSFORMERS AND GYRATORS


Gyrator
A gyrator is an element similar to the transformer in which efforts and flows have a "crosswise dependence. It is characterized h t i d by b the th equations: ti e2 = r f1 , f2 = (1/r) e1 Note that e2 f2 = e1 f1 , so power is conserved, as in the transformer. An example of a gyrator conversion between electrical and rotational energy in electric motor. A wire carrying the current i rotates with the angular velocity in a magnetic field. It is turned by a moment M proportional p p to the current M=ki At the same time an emf proportional to the angular velocity is generated. u = k Since M = u i if there are no energy losses, than k = k Thus, the system can be symbolized with a gyrator.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

e1 f1

GY r
Gyrator

e2 f2

u i

GY k

An electromechanical example of a gyrator

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SYSTEMS WITH MIXED PHYSICAL VARIABLES


DC Motor
The motor is controlled by an external voltage u, giving rise to a current i and a rotation with the angular velocity . Assumption: the windings have a resistance R1 and an inductance L1. The rotating parts have a moment of inertia J. There is also some friction.
The supplied energy will be: partially stored in the inductor, and partially lost in the resistor, while the remainder will be converted into mechanical energy. This energy in its turn will be: stored as rotational energy, or lost by friction
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Inductor

Rotation

Source

C Conversion i

Resistor

Friction

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SYSTEMS WITH MIXED PHYSICAL VARIABLES


DC Motor
The storages in the inductor and also rotational energy gy correspond p to I elements, while the resistor and the friction are R elements. Both junctions have common flow variables, so they are s junctions. The conversion between electrical and mechanical energy is a gyrator. Assumption: a general nonlinear relationship for the friction: M f = r ()

BOND GRAPHS
Inductor Rotation

Source

Conversion

Resistor

Friction

I : L1

I:J MJ

Se

u i

GY k

s Mf

R : R1
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

R : Mf = r ( )

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SYSTEMS WITH MIXED PHYSICAL VARIABLES


Mechanical Hydraulic System
The force F acts on a piston with mass ml and cross section A1.This This results in a flow Q1, which is partly stored in a tank with cross section A3 and partly goes on as Q2 to a piston with cross section A2. This piston moves the mass m2 with velocity v2 over a surface with friction Ff = r (v2). The pressure in the connecting tube is p. Starting with the left cylinder, we see that the energy is partly stored in the mass ml and partly transferred to the hydraulic subsystem. This transfer of energy is, as we have seen, represented by a transformer.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Se

F v1

p s TF 1/A1 Q1 System

I : m1

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SYSTEMS WITH MIXED PHYSICAL VARIABLES


Mechanical Hydraulic System
The energy flow to the right is partly stored in the tank and partly taken to the cylinder on the right. A common pressure means a p junction. Se
F v1 p s TF 1/A1 Q1 System

I : m1 Se
F v1 s p TF 1/A1 Q1 p System

I : m1
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

C : (A3/g)

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS SYSTEMS WITH MIXED PHYSICAL VARIABLES


Mechanical Hydraulic System
At the cylinder to the right there is are conversion to mechanical energy which is divided into kinetic energy and friction losses. Se
F v1 s p TF 1/A1 Q1 p System

I : m1 Se
F s v1 p TF 1/A1 Q1 p p p Q2

C : (A3/g) R : Ff = r (v2) Ff
TF A2 s v2 v2 v2

I : m1
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

C : (A3/g)

I : m2

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

BOND GRAPHS CAUSALITY : SIGNALS BETWEEN SUBSYSTEMS


We regard e as a signal from A to B e and f as a signal from B to A. If e we want to view the bonds in this A A f B B f way, we put a cross stroke on the bond adjacent to subsystem B, that e is, adjacent to the subsystem that e A A f has effort as input. A cross stroke at B B f the opposite side of the bond, means that e is regarded as input of Signals between subsystem A and f as input of B. This p process of assigning g g inputs p and outputs p to subsystems y is often called causality y assignment - the input can be regarded as the cause of the output. The cross strokes are often called causal strokes.
Effort source Flow source

Causality of Sources
Se
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

e f Sf

e f

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS CAUSALITY : SIGNALS BETWEEN SUBSYSTEMS


Causality of Energy Storage
Effort storage is described by Regarding e as the input gives the block diagram shown in the figure
e f

Choosing f as the input gives instead the following block diagram


f e

Causal strokes for I , C and R element


e f I e f C e f R e f R

It is natural to let e be the input and then get the causality (fig.a). Since e and f change roles for a flow storage, the natural choice of input is f (fig.b). For a resistive element there is a static relationship between e and f. If this is the case than we are free to choose either e or f as input.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

BOND GRAPHS CAUSALITY : SIGNALS BETWEEN SUBSYSTEMS


Causality of Junction
For an s junction there is a common fl and flow d the h sum of f the h efforts ff is i zero: f1 = f2 = . . . = fn and e1 + e2 + . . . + en = 0 All bonds of an s junction except one shall have the causal stroke at the s

Causality of an s junction

For an p junction the roles of effort and flow change places and the rule therefore becomes: Precisely one of the bonds of a p junction shall have the causal stroke at the p.

Causality of Transformers and Gyrator

Possible causalities of a transformer


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Possible causalities of a gyrator


MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS CAUSALITY : SIGNALS BETWEEN SUBSYSTEMS


Causality of Transformers and Gyrator
For an s junction there is a common flow and the sum of the efforts is zero: and f1 = f2 = . . . = fn e1 + e2 + . . . + en = 0 All bonds of an s junction except one shall have the causal stroke at the s

Possible causalities of a transformer

For an p junction the roles of effort and flow change places and the rule therefore becomes: Precisely one of the bonds of a p junction shall have the causal stroke at the p.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

BOND GRAPHS CAUSALITY : SIGNALS BETWEEN SUBSYSTEMS


Propagating Causality in a Graph
1 Ch 1. Choose a source and d mark k its i automatic i causality li 2. Some adjacent bonds have only one possible causality because of the rules for junctions, transformers, and gyrators. Mark these causalities as far into the graph as possible 3. Repeat steps 1 and 2 for all sources 4. Choose an I or C element and mark its natural causality 5. Mark the causalities that are now fixed analogous to step 2 6. Repeat steps 4 and 5 for all I and C elements 7 Choose some R element that has no causality mark and fix an arbitrary 7. one 8. Do the analogy of step 2 9. Repeat steps 7 and 8 for all remaining R elements

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS CAUSALITY : SIGNALS BETWEEN SUBSYSTEMS Causality for an Electrical System
Step 5, according to the rule we must mark causalities at the l ft junction left j ti

Finally, step 5, gives causality to the last bond. Step 1 in the algorithm by marking the causality at the effort source Steps 2 and 3 of the algorithm do not give anything new. Step 4 - causality to the bond at the I element.

Step 6, we have to repeat step 4 for the C element.

Now, causality is given to all bonds without conflict with the rules.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

13

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS


A great advantage of bond graphs is that the choice of state variables is natural. The memory of the system lies in the I and C elements. It is natural to associate one state variable with each such element. element For an effort storage It is natural to choose the state variable x as For a flow storage It is natural to choose the state variable x as or or

If we introduce above state equations for all I and C elements, we get a state-space description as soon as all flows of C elements and all efforts of I elements are expressed in states and inputs. We can then do calculations as if the I elements were flow sources and the C elements effort sources. We can then propagate the signals through the graph using the causality marks as local information whether a signal is to be regarded as an input or an output.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS Relations among variables for an electrical system
We now know the inputs of h R elements l with i h values l R1 the and R2 so that their outputs R1i and vc/ R2 can be calculated. Since we now know the three efforts that are inputs to the s junction, the fourth one, which is an output, can be computed to be v R1i vc. At the p junction we analogously calculate the current into the capacitor to be i vc/ R2.

At the s junction we have the flow i as input. Then all the other flows are given as outputs (=i). In the same way, vc at the p junction determines all other efforts to be equal to vc .

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

14

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS


Relations among variables for an electrical system
If we introduce the state variables xl= i and x2= vc, we get directly, directly by reading the bonds at the I and C elements, the equations

or equivalently

This is a state space description with input v. The procedure of this example can be formalized into analgorithm.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS


Algorithm for Equation Sorting
1. Choose a source and write its input signal in the forward list and the equation of the other bond variable in the backward list. list 2. Check adjacent bonds. If some variable is defined in terms of already calculated variables, write its equation in the forward list and the equation of the other bond variable in the backward list. Do this as far into the bond graph as possible 3. Repeat steps 1 and 2 until all sources have been treated in the forward list and 4. Choose an I and write the equation in the backward list 5. 6. 7. 8. 9. Do the analogy to step 2 Repeat steps 4 and 5 for all I elements have been processed Do the analogy of steps 4, 5, and 6 for all C element Do the analogy of step 2 Reverse the order of the backward list and put it after the forward list
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

15

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS


DC Motor
State variables:

Step 1 2 2 2 2 4 5

Forward list u 1= u i2=(1/L1)x1 i3=i2 i4=i2 M1=k i4 2=(1/J) x2 3=2

Backward list i1=i2

Bond graph for a DC motor

I : L1 u2 i2 Se:u u1 i1 s u3 i3 R : R1 u4 i4 GY k M1 1

I:J M2 2 s M3 3 R : M3 = r (3)

u3=R1i3 u4=k 1 1=2

M3 = r (3)

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS


DC Motor
The complete list of equations is obtained by putting the reverse backward list after the forward list giving
u1= u i2=(1/L1)x1 i3=i2 i4=i2 M1=k i4 2=(1/J) x2 I:J M 2 2 u4 i4 u 3 i3 R : R1
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Bond graph for a DC motor

I : L1 u 2 i2 S e :u u1 i1 s GY k M1 1

3 = 2 M3 = r (3) 1 = 2 u4=k 1 u3=R1i3 i1=i2 This is a complete description of the dynamic system.

s M 3 3

R : M3 = r (3)

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

16

BOND GRAPHS STATE EQUATIONS FROM BOND GRAPHS


DC Motor
u1= u i2=(1/ (1/L1)x1 i3=i2 i4=i2 M1=k i4 2=(1/J) x2 3 = 2 M3 = r (3) 1 = 2 u4=k 1 u3=R1i3 i1=i2
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Eliminating all variables that are not states gives: = u1 R1i3 k 1 = u1 R1i3 k 2 = u1 R1i3 (k/J) x2 = u1 R1i2 (k/J) x2 = u1 (R1/L1) x1 (k/J) x2 = u (R1/L1) x1 (k/J) x2 = M1 r (3) = M1 r (2) = M1 r((1/J) x2) = k i4 r (x2/J) = k i2 r(x2 /J) = (k/L1) x1 r(x2 /J)

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

BOND GRAPHS CONCLUSIONS

Bond graphs represent a very systematic method for the modeling of systems in physics and engineering. It is an advantage that the method is based on a central physical concept energy and that the same methodology is used for different types of systems. Another advantage is that we work locally, "one junction at a time. In this way, complex systems are in principle no more difficult than simple ones. The bond graph is also a complete description of a dynamic system. It can automatically be translated into state-space equations.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

17

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


6. EXPERIMENTAL MODELING - IDENTIFICATION

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

INTRODUCTION
During the process of modeling of a system, there can be system constants whose values are not known known. There can also be subsystems of such characteristics that it is difficult to describe their function by known physical laws. In such cases, data from the system have to be used to complete the model. These data consist of measurements of variables in the system: outputs, inputs and possibly also disturbances. Such measurements can be used to understand how the system works, to describe partial systems, and to compute values of system constants.

The technique to build and complement models from measurements is called identification (system identification) .

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

BASICS OF EXPERIMENTAL MODELING


Most practical problems dealing with systems with exactly one input or output (single-input, single-output: SISO systems). Therefore, the majority of procedures for such systems have been designed.

Transfer Function
Continuous-time domain A linear dynamic SISO system is described by differential equation in continuous-time domain:
& (t ) + b0 y (t ) = a m u (t ) + . . . . + a1u & (t ) + a 0 u (t ) bn y (t ) + ...... + b1 y
(n) (m)

where input signal u(t) and output y(t) are continuous-time functions. If u(t) and y(t) have the Laplace transforms U(s) and Y(s) respectively, and the initial conditions are eq equal al to zero ero (u(t) = y(t) = 0 t 0), 0) than the Laplace Transform of the above equation gives: Now, the transfer function as a rational function of the complex Laplace variables will be:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

BASICS OF EXPERIMENTAL MODELING


Transfer Function
Discrete-time domain A linear dynamic SISO system in discrete-time domain is described by a difference equation: The discrete-time difference equation is converted by the z-transform in: Quite similarly with definition of transfer function in continuous systems, the transfer function in discrete-time systems is also defined as pulse-transfer function of the complex p variable z: In both cases (continuous-time and discrete-time), the zeros of the transfer function numerator are called zeros of the transfer function, and the zeros of the denominator are called poles of the transfer function. Apparently, a transfer function (and thus the dynamic system behavior) is fully described through the poles and zeros.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

BASICS OF EXPERIMENTAL MODELING


Transfer Function
Continuous-time domain
Example: A continuous time linear dynamic model is given by the differential equation: To calculate the transfer function, first the Laplace transform is found: and the above equation is transformed to:

By the transfer function, the dynamic transition behavior of a linear system i described is d ib d in i frequency f domain. d i

Relationship between input U and output Y is: Note: According to the rules of Laplace transform, under the zero initial conditions, the following equations are applicable:

The poles and zeros of the transfer function can be immediately read from the factored representation of numerator and denominator: Zero is: q 1 = 3 Poles are: p1= 1, p2= 2 and p3= 4
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

BASICS OF EXPERIMENTAL MODELING


Transfer Function
Discrete-time domain
Example: A discrete time linear dynamic model is given by the difference equation: To calculate the pulse-transfer function, first the z-transform is computed: and than it is transformed to:

Discrete time system, z-transforms

Here, the representation is already in factored form. Zeros and poles of the transfer function are: No zero point The only pole at: p1 = 0.5
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Relationship between input U and output Y is:

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

BASICS OF EXPERIMENTAL MODELING


Transfer Function
Weight function and Transition function There are two test signals, which are particularly important as input u(t): the Dirac-delta pulse (t) and the unit step function (t). The system response to a pulse is called a weight function or sequence g(t) and g(k). The system response to a unit step input gives h(t) and h(k) as a transition function or sequence, which is also known as a step response.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Continuous-time system

Discrete-time system

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

SIMPLE PRELIMINARY IDENTIFICATION


In simple preliminary identification, the model accuracy is not in the foreground, but rapidly gained an impression of the main characteristics of a dynamic system.

Step-response analysis
The first step in modeling (structuring phase) is to decide which quantities and variables are important to describe what happens in the system. It is then also necessary to decide, or guess, how the variables affect each other, which time constants are important and which relationships can approximately be described as static ones. A simple and common kind of experiment that shows how and in what time span various variables affect each other is called step-response analysis or transient analysis. In such experiments the inputs vary (typically one at the time) as a step: u(t) = u0, t < t0; u(t) = u1, t t0. The other measurable variables in the system are recorded during this time. We thus study the step response of the system.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

SIMPLE PRELIMINARY IDENTIFICATION


Step-response analysis
The following information can be obtained from consideration of the step response: Concerned by the specific input outputs (variables) can be determined, and that is especially beneficial in MIMO system. This makes it easier to draw block diagrams for the system and to decide which influences can be neglected. The time constants of the system are clearly visible. From this we can see which parts of the model can be modeled statically (since they are much faster than the dynamics of interest). The system characteristics (oscillatory, weakly damped, a periodic, with dead time) ) is clear. Similarly, y, one can see the steady y gain. g
Because of the easy implementation and immediate information, this method is probably the most widely used method of identification in industrial practice. Disadvantage of this method is that the obtained information is somewhat limited. Practical limits in the amplitude of the input, together with disturbances and measurement errors may make it difficult to determine quantitative models with a reasonable degree of accuracy.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

SIMPLE PRELIMINARY IDENTIFICATION


Step-response analysis
Example For a step input u(t) = u(t) the output is y(t). Approaching the system behavior by a PT1 element with time delay (structural assumption!), the general form of the transfer function will be: The parameters Ks, T and Tt are determined from the step response using the following rules: , , The parameters u (input step size), y (steadystate value of output), Ta (compensation time) and Tu (delay time) can be read from Figure.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Note: There are also methods for model structures as a PT2 element:

and as a PTn element

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

SIMPLE PRELIMINARY IDENTIFICATION


Frequency Analysis
A linear system is uniquely determined by its impulse response or its frequency response G(i) (the Laplace transform of the impulse response evaluated at s = i ). If a linear system has the transfer function G(s) and the input is: then the stationary output will be: It is now important that the amplitude gain and phase shift of the output are determined by the frequency response: This relationship is so-called Bode plot clearly presented taking the frequency axis i (x-axis) ( i ) logarithmic l i h i scale, l while hil the amplitude gain A () = | G (i) | is measured in decibels. The phase shift () is generally indicated in degrees.
In Matlab bode command exists for the continuous-time systems and discrete-time systems. An example of a result from Matlab is shown in Fig.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

SIMPLE PRELIMINARY IDENTIFICATION


Frequency Analysis
This is a procedure which allows easy identification: 1. The system has been stimulated by a harmonic function with known frequency, amplitude and phase. 2. After possible transients have faded away, the amplitude y0 and phase are measured out from the output signal. 3. One point in the Bode diagram is determined with obtained A() and (), i the i.e. th complex l number b G(i1) can b be determined. 4. By repeating this procedure for a number of different , we can get a good estimate of the function G(i).
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

The method of frequency analysis is often used to build models of systems. The following advantages and disadvantages can be pointed out: Easy to use and requires no complicated data processing Requires no structural assumptions about the system, other than it being linear It is easy to concentrate on frequency ranges of special interest (for example q ) around resonance frequencies) The basic result is a table or a graph of the function G(ik) k=0,...,M. This cannot be used directly for simulation. Frequency analysis may need long periods of experimentation if G(i) has to be determined at many frequencies

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
As the name suggests,, the parameter estimation is using to estimate the numerical values of a parametric model. It is a well-known statistical problem to estimate parameters in different models. Such methods are also of great importance when building models of dynamic systems. The lack of knowledge about specific details or about general subsystems in the system will then be represented using parameters, whose numerical values have to be determined by statistical methods.

Basics of Parameter Estimation


A linear dynamic SISO system in discrete-time domain is described by a difference equation: This equation can be transformed so that the current output y(k) is represented only by past outputs y(k-i) and inputs u(k-j):

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Basics of Parameter Estimation
The previous equation can be written in vector notation, which results in:

This equation is valid for all time points k therefore can be written in matrix notation for all measurement data:

or in a much more compact symbolic notation:

y = X

where y is the vector of current outputs, X is the matrix of past outputs and inputs, and is the parameter vector that defines the system behavior. The last equation can rearranged in the form: = X1 y
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Basics of Parameter Estimation
The parameter vector can be obtained by the equation: = X1 y Note that the inverse matrix is defined only for square matrices. This case occurs if and only if the number of equations (rows) is the same as the number of unknown parameters. Then there is a deterministic problem that is occurring in the practical cases always solvable. Obviously this would make it required for the calculation of the parameter vector just as many times of measurement as it corresponds to the order of the system.
In practical measurements, however, measurement noise al a s occur. always occ r This problem is illustrated in Figure. Measurement noise n(k) always comes from imperfections, and we only can measure the real output

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Least-Squares (LS) algorithm
In ideal case without noise, the system output is determined by the equation:

y = X
Through the influence of the noise, however, there is a deviation from this ideal equation. To describe this deviation the equation can be written with an additional error e: y = X + e How to find out now the parameter vector ? An important objective is to minimize the sum of the squared error (least squares, LS). The corresponding criterion is

The estimated value of the unknown parameter (LS estimate):


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Least-Squares (LS) algorithm
The best known example of the application of the LS estimator is the regression g line. In this one-dimensional p problem, , there is a linear dependence of a variable y from the variable x according to the equation: y(x) = k x +d The parameters k (increase) and d (ordinate intersection) are estimated, although the measured points do not lie exactly on this line. In two-dimensional case, the output variable y are linearly d dependent d on two i inputs y(x1,x2) = k1 x1 + k2 x2 + d Parameters k1, k2, and d should be estimated in optimal way. The result corresponds to a plane which optimally approximates the measured points. This case corresponds to the first order dynamic system with input u(k) and the output y(k) = y(k-1) + u(k) where d = 0, and the two linear parameters and are estimated.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Least-Squares (LS) algorithm
Model structures A noise model is necessary to describe the real measurement noise noise. However, However the structure and parameters of this noise model is not a priori, but must first be determined together with the transfer function of the unknown dynamical system. The most general model, which includes all others as special cases, is the Box-Jenkins-Model (BJ-Model). The output Y(z) is described in the discrete frequency domain by where U(z) is the system input, and V(z) is white noise. Therefore, in this model there are parameters of 4 different polynomials (A, B, C and D) to estimate.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Least-Squares (LS) algorithm
Model structures An important special case is when the properties of the disturbance signals are not modeled, and the noise model is chosen so that its transfer function is equal to 1. This special case is known as an output-error model (OE-Model) since the noise source will then be the difference (error) between the actual output and the noise-free output.

Thus, only the polynomials A and B are to be estimated, the noise model is a priori defined as 1.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Least-Squares (LS) algorithm
Model structures Another popular variant is the ARMAX model (AutoRegression with MovingAverage of white noise and eXtra input); a common denominator for both transfer functions is assumed and the number of unknown polynomials is 3.
Physically, the difference between ARMAX and BJ models is that the noise and input are subjected to the same dynamics (same poles) in the ARMAX case. This is reasonable if the dominating disturbances enter early in the process (together with the input).

A further simplification of the ARMAX model is the ARX model. Here, the numerator of the noise model is selected to be D(z-1) = 1, so there are remain only two unknown polynomials

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Least-Squares (LS) algorithm
Model structures
Regarding g g the selection of appropriate pp p model structure, some g general points p of view can be listed: The ARX model is the easiest to estimate since the corresponding estimation problem is of a linear regression type. The foremost disadvantage is that the disturbance model comes along with the system's poles. It is therefore easy to get an incorrect estimate of the system dynamics because the A polynomial also has to describe the disturbance properties. Higher orders in A and B than necessary may be required. If the signal-tonoise ratio is good, this disadvantage is less important The OE model has the advantage that the system dynamics can be described separately and d th that t no parameters t are wasted t d on a disturbance di t b model. d l If the th system t operates t without feedback during the data collecting, a correct description of the transfer function can be obtained regardless of the nature of disturbance. However, minimization of the criterion function can be more difficult than in the ARMAX case. The BJ model is the "complete model in which the disturbance properties are modeled separately from the system dynamics
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Prediction Error Method (PEM)
In the I h case of f ARX and d ARMAX model, d l the h estimation i i of f the h parameter vector is found by linear methods. For BJ and OE models, the approach is not at all by the error e equation. In these models, we must use the general method of prediction errors . In this case, the objective is to minimize the sum of squared prediction errors

In general, the criterion J() depends nonlinearly on the parameter vector , and thus only a numerical approximation for the optimal estimate ( ) can be calculated. This is necessary in both cases: OE and BJ models.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

EXPERIMENTAL MODELING - IDENTIFICATION

PARAMETER ESTIMATION
Identification in the state space
In contrast to the identification in transfer function model, the identification in state space model involves estimation of more than one parameter. Moreover, the choice of states is not unique and the consideration of measurement noise is very complicated. An algorithm N4SID (pronounced 'enforce it') is implemented in Matlab. By using special mathematical methods for this the parameters of the linear state space model can be calculated without iteration. Alternatively, for the identification in the state space also exists a PEM, using the result of the N4SID algorithm as starting point for the numerical optimization.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION IN CLOSED LOOP


In closed loop, various problems arise: The controller transfer function has a full effect on the h i input-output data d Noise inputs act at first only to the output, but through the feedback they are returned again to the input: This results in a correlation between measurement noise and input signal.
Identification in closed loop - Indirect identification

However, closed-loop parameter estimation can be Identification in closed loop - Direct Identification performed correctly. Two methods can be distinguished: 1. Indirect identification: Only the output y(k) is measured, and the control variable must be w(k)=0 2. Direct Identification: Both the output y(k) and the manipulated variable u(k) are measured, ant there is no restrictions for the reference variable w(k).
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION AS A TOOL FOR MODEL BUILDING


In the previous a brief overview on methods for model building based on measurements is given given. In the following the role of identification as a practical tool for model building is discussed. The most important aspect is that there are now many interactive computer program packages for identification in which the methods and theories are packaged in a user-friendly way. The focus has thereby moved from algorithms for identification to understanding of the possibilities and limitations of identification. With given data the user's main task is to decide on a suitable model structure. Another main task is to construct and carry out experiments that give data with good information contents for the subsequent identification step.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION AS A TOOL FOR MODEL BUILDING


Program Packages for Identification
Building a model using identification is characterized by the following steps: 1. Specify a model structure 2. The computer delivers the best model in this structure 3. Evaluate the properties of this model 4. Test a new structure, go to step1. There are now many commercially available program packages for identification that supply help to compute the model and to evaluate its properties properties. They typically contain the following routine: Handling of data, plotting, and the like Nonparametric identification methods Parametric estimation methods Presentation of models Model validation
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

13

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION AS A TOOL FOR MODEL BUILDING


Construction of identification experiments
These three points give guidance for the construction of identification experiments: The experiment should be carried out under conditions that are as similar as possible to those under which the model is going to be used The inputs should excited all interesting aspects of the system The measurement y(t) and the input u(t) should be chosen so that the prediction will be as sensitive as possible with respect to .

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION AS A TOOL FOR MODEL BUILDING


Preparation of the data (pre-processing)
The first step in an identification application is to plot the data to make an initial inspection. One then often discovers that they have certain deficiencies. There can also be obvious faulty values (outliers) among the data. There may also be reasons to enhance certain frequency bands in the data in order to get a better model fit. An important aspect of the pre-processing is also to choose a part from the data that looks good and that thereby is suitable for model fit and model validation. Under different circumstances it may also be useful to undertake the pre-filtering of measurement data. data It is advisable to filter the data through a band-pass band pass filter that has a pass band covering the interesting frequencies (breaking points in the system's Bode diagram). The effects of low-frequency disturbances, drift, and so on, are thereby reduced. The focus on the model fit is also automatically moved to the most important frequency bands.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

14

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION AS A TOOL FOR MODEL BUILDING


Model Structure
The advantages and disadvantages of different model structures (ARX, ARMAX, BJ, OE state space) have already been discussed above. OE, above In practice usually there is not enough information to select a priori the most suitable model. Therefore, we tried with different model structures to obtain a good result. The validation of the various models is discussed later.

Model Order
To determine the order and delays of a model, the following procedure is quite useful: First get a reasonable estimate of the delay. Pick the delay that gives the best model performance (sum of squared prediction errors on a validation set) y ARX models of different orders with this delay. y Pick the orders that Then test many give the best model performance The model may be of unnecessarily high order to describe the system dynamics, since the poles of an ARX model also describe the noise properties. Thus plot the zeros and the poles of the resulting model (with uncertainty regions marked) and look for cancellations. The surviving numbers of poles and zeros give us indications of the necessary order for the dynamics from input to output.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

EXPERIMENTAL MODELING - IDENTIFICATION

IDENTIFICATION AS A TOOL FOR MODEL BUILDING


Model Validation
To validate a model is to investigate g if it can be accepted, p g given its intended use. This is closely related to the concept of model quality. Computing models from different measurement records and in different structures and then evaluating their input-output properties (for example in a Bode diagram or in simulation) is an important tool for gaining confidence in the model. If approximately the same model properties are obtained under such varied conditions, we should feel confident that the model found some significant features of the system. A natural test of the model's ability to reproduce the system's behavior is to simulate the model from input only and then compare the simulated output with the measured one. It is important to get as much advice as possible from available validation possibilities. The final validation criterion is, however, that the model is working well when it is used for its purpose: simulation, analysis, control design, or whatever.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

15

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


7. SIMULATION

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
USING MODELS FOR SIMULATION
In the previous parts a brief overview on methods for system modeling was given. These models can be used for a number of purposes, for example: Increasing the understanding of the system itself Predicting the future behavior of the system Carrying a technical computations for control design Optimizing construction Studying human-machine cooperation. Regardless of the purpose, we almost always want to study the solutions to the model equations. The classical way of attacking the problem has been to solve the equations using analog computers. Today the equations are most often solved numerically in a computer. Regardless of the method, the solving of the equations, together with the presentation of the result, is usually called simulation. Modern technology gives a wide range of possibilities for presenting the results from simulations in such a way so that the real system's behavior is illustrated.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Assumption: no matter how the model was entered by the user, the simulation language/program has been able to convert it to a standard state-space form.
Matlab for example always uses an internal state space representation even if only one transfer function is entered.

It should be noted that the intention was not to consider the numerical methods in details, but rather the most common algorithms with their properties essential for a simulation are discussed.

Fundamentals of numerical methods


A state-space form of a model: - state t t vector t - input vector If the input is fixed to a certain vector , than the influence of u can be expressed as a time variation off f and write:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

The vector of initial conditions is given, and we are now looking for an appro imation of the state vector approximation ector x at time points 0 < t1 < t2 < . . . < tN The algorithm will thus generate the values x1, x2, . . . , xN, which approximate x(t1), x(t2), . . . , x(tN)

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Eulers method
The simplest algorithm is obtained by approximating with a difference ratio: where: The term f (tj, xj) thus corresponds to the derivative of the function x at tj (slope of the tangent in onedimensional case). This gives the recursive equation which is called Euler's method. An algorithm for differential equations can, more generally, be described by the equation: This is known as a k-step method; and the integer k shows the number of previous steps that are utilized.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

One-step procedure

Three-step procedure

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Eulers method
If xj+1 is not included in the expression for F, xj+1 is obtained directly by evaluating the right side. The method is then said to be explicit. In other cases the method is implicit, and an equation system has to be solved to get xj+1. Euler's method is obviously an explicit one-step method. It is of course important to know how accurate a method is in solving differential equations, i.e. the error estimation is important for each numerical method. The one-step error, or the local error : ej = x(tj) zj where: zj = F (t, x(tjk), x(tjk+1), . . ., zj) For Euler's method it is: ej+1 = x(tj+1) xj+1 = x(tj+1) x(tj) t f (tj, xj) for tj < < tj+1
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

The fact that the region g of stability y of a differential equation does not necessarily coincide with the one valid for the numerical algorithm is something to remember when trying to determine the stability of a dynamic system by simulation.

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Method of Runge-Kutta
Again consider: which can also be written in integral form (for simplicity here a scalar notation is used, but all connections are, of course, also valid for a state vector):

If we approximate the value of the integral with the length of the interval times the value of the integrand in the center (i.e. using an intermediate step), we have:

However, this term can be approximated with Euler's method:

Combining the last two equations, we can write:

The problem here is unknown


TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

simple RungeKutta method


MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Methods of Adams
The methods of Adams form a family of multistep methods that can be written in the form:

The coefficients i are chosen so that the order of accuracy is as high as possible. If 0 = 0 is chosen, the method will be explicit. This variant is often called Adams-Bashforth, while the implicit form ( 0 0 ) is called Ad Adams-Moulton M l . For the explicit methods the order of accuracy is equal to k. For the implicit methods it is of order k + 1 .

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Methods with variable step length
It is often inefficient to use a constant step length when solving differential equations. A typical solution might contain segments with rapid changes, where small steps are required, and segments where slow changes make large steps possible. Methods for automatic step adjustment are often based on an estimate of the local error. The algorithm has a tolerance level for the local error (for example, determined by the user). If the error estimate exceeds the tolerance, the step length t is decreased decreased. If it is far belo below the tolerance tolerance, the step length is increased. Ideally, a given accuracy is obtained with a minimum amount of computational work.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Stiff Differential Equations
Stiff differential equations are characterized by the fact that their solutions contain both fast and slow components and that the difference between their time constants is large. An example is the differential equation:

which has the solution:

x1 = e t + e 10000 t x2 = e t 0.0001 e 10000

If we want to simulate this equation, equation we have to start with a very short step length in order to follow the fast term e 10000 t . This term is, however, soon close to zero, and the solution is only characterized by the term e t . Since it is much slower, we would now like to increase the step length. But then we have to take stability into account. Thus the number of efficient algorithms is drastically reduced. They must be still implicit algorithms because they have the same accuracy at a greater range of stability than explicit methods.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
NUMERICAL INTEGRATION ALGORITHMS
Choice of the integration method
For very simple systems, or for a quick overview, Euler's method can be used, but in any case here not too large step size must be ensured Runge-Kutta methods are most effective when the complexity is relatively low (when the calculation of the right side of the equation is not too complex). Procedure of 4. or 5. order offers a good compromise between accuracy and effort. Methods e ods of o Adams d s are e preferable p e e b e at high g complexities co p e es Methods for stiff problems are usually ineffective for non-stiff problems. These methods should thus be reserved for the problems where they really are needed.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
SCALING OF THE MODEL EQUATIONS
The simulation work is made easier through scaling of the equations. Scaling means that in the equation

a variable change is made corresponding to amplitude and time scaling, respectively. Differentiating the obtained expression gives the differential equations:

The scaling can be used to get the same order of magnitude of the variables and th b avoid thereby id numerical i l problems. bl Another A th use of f scaling li is i to t reduce d the th number b of f cases that we need to simulate. The amplitude and time scaling are useful as a way of making "standardized simulations". In addition the scaling can be physically necessary when the simulation takes place in terms of analog, physical quantities. Scaling can also give considerably better numerical properties in digital simulation.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
SCALING OF THE MODEL EQUATIONS
Tank with free outflow
A (m2) - tank cross section u ( (m3/s) ) - inflow a (m2) - outflow hole area q (m3/s) - outflow h (m) - level of the liquid The explicit nonlinear differential equation for the liquid level is:
u h Tank with free outflow q

We want to investigate how an originally empty tank is filled with a constant input flow u for different values of three parameters (a, A, and u) in the model. If each parameter has to assume N values, N3 simulations are, in principle, needed. However, if the model's behavior under scaling is utilized, utilized only one simulation is needed. needed Applying: where H and T are scaling factors, we get the scaled model equation:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
SCALING OF THE MODEL EQUATIONS
Tank with free outflow
u

We choose H and T so that : i.e. , then the model is reduced to equation:

q Tank with free outflow

and

Step response of a tank

All we need to do now is to simulate this equation and draw the result.
When we then want to utilize the curve for a special problem, we compute the values of H and T for the case in question and can then go from scaled time and scaled h to t and h.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
BLOCK DIAGRAMS AND SUBSYSTEMS
Block diagrams give a clear graphical representations of dependencies within and between dynamical systems. They help to illustrate the basic sub-models and their interaction in Phase 1 of modeling. On the other hand, many simulation programs perform a simulation using block diagram presentation (e.g. Simulink).

For preparation of detailed block diagrams, it is helpful to transform the differential equation:

The order of the system (number of states) corresponds exactly to the number of integrators.

u f1(x,u)

x1

into an integral representation:


u f2(x,u)

x2

This system of equations involves two types of operations: static nonlinear transformations and integration
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

fn(x,u)

xn

Block structure of a dynamic system

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
BLOCK DIAGRAMS AND SUBSYSTEMS
Block diagram for a linear system
A linear system in a state-space form is given by following equations:
Block diagram of a linear dynamic system of 3. order

The system is of the third order, therefore it can be realized with three integrators integrators.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
BLOCK DIAGRAMS AND SUBSYSTEMS
Connecting subsytems
Series circuit u y=v w

These two systems will be interconnected in a series circuit, i.e. v = y . It follows:

u
Block diagram of a series connection of two systems. The replacement system has the sum of the states of the original systems
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

y=v x z

[x z]

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
BLOCK DIAGRAMS AND SUBSYSTEMS
Connecting subsytems
Feedback x u=w z
Such a structure is hidden in any dynamic system, and only an approximate iterative solution can be found. found
Algebraic loop in a simulation can not be resolved directly. Simulink reports an algebraic loop in the Matlab Command Window, simultaneously, an iterative solution of the loop tries.

Block diagram of an algebraic loop

y=v

y=v [x z] [ ]
Block diagram of a feedback of two systems presented in state space form. The replacement system also consists of the sum of the states of the original systems, but the output from one is the same as the input in the other subsystem
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

SIMULATION
SIMULATION LANGUAGES
To make simulation possible, there must be a systematic way in which the user can enter a system description into the computer. We may call it a simulation language. S Several l approaches h are possible: ibl 1. The system is defined by subroutines written in a standard programming language 2. The system description might be entered graphically in terms of block diagrams 3. The system description is entered graphically in terms of bond graphs Basic components of Matlab and Simulink as a simulation tool are already discussed in previously parts. In summary it can be point out that modern computer and programming tools turn simulation into a relatively straight forward procedure compared to the modeling work. Difficulties can arise with models that are not in state-space form and that have very stiff systems. Complicated models can demand very large computer resources. In some cases the problem may need to be attended to on the modeling level, for example, by model reduction.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING
AND FRICTION

Train system EXAMPLE

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Physical Modeling
We will consider a toy train consisting of an engine and a car. Assuming that the train only travels in one direction, we want to apply control to the train so that it has a smooth start-up and stop, along with a constant-speed ride. The mass of the engine and the car will be represented by M1 and M2, respectively. The two are held together by a spring, which has the stiffness coefficient of k. F represents the force applied by the engine, and the Greek letter, , represents the coefficient of rolling friction.

Physical Model Parameters


For this example, we will assume the following values for the physical parameters: Mass of the engine M1 (M1 = 1 kg) Mass of the car M2 (M2 = 0.5 kg) Spring stiffness coefficient k (k = 1 N/m) Coefficient of rolling friction ( = 0.002 s/m) Force applied by the engine F input
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Mathematical Modeling
The system can be represented by following Free Body Diagrams:

According to Newton's law, the sum of forces acting on a mass equals the mass times its acceleration. In this case, the forces acting on M1 are the spring, the friction and the force applied by the engine. The forces acting on M2 are the spring and the friction. The equations of motion in the horizontal direction are the following :

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Transfer Function

Applying Laplace Transforms, the above equations can be expressed in terms of s:

The output is Y(s) = V1(s) = s X1(s). The variable X2 should be algebraically eliminated to leave an expression for Y(s)/F(s). When finding the transfer function, zero initial conditions must be assumed. The transfer function will be:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


State Space

This set of system equations can now be manipulated into state-variable form. The state variables are the positions, X1 and X2, and the velocities, V1 and V2; the input is F. The state variable equations will be:

Let the output of the system be the velocity of the engine. Then the output equation will be:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


MATLAB representation
Transfer Function

m-file
M1=1; M2=0.5; k=1; F=1; u=0.002; 0 002 g=9.8; num=[M2 M2*u*g k]; den=[M1*M2 2*M1*M2*u*g M1*k+M1*M2*u*u*g*g+M2*k M1*k*u*g+M2*k*u*g]; train=tf(num,den);

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


MATLAB representation
St t S State Space m-file
M1=1; M2=0.5; k=1; F=1; u=0.002; g=9.8; A=[ 0 1 0 0; -k/M1 -u*g k/M1 0; 0 0 0 1; k/M2 0 -k/M2 -u*g]; B=[ 0; 1/M1; 0; 0]; C=[0 1 0 0]; D=[0]; train=ss(A,B,C,D)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK
We will begin to construct the model simply from the expressions: i
Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

First, we will construct two copies (one for each mass) of the expressions sum_F=Ma or a=1/M*sum_F. The outputs of each of these Sum blocks represents the sum of the forces acting on each mass. Multiplying by 1/M will give us the acceleration.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

Since velocity is the integral of acceleration, and position is the integral of velocity, we can generate these signals using integrator blocks. Drag two Scopes into the model and connect them to the outputs of these integrators. Label them "View x1" and "View x2
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

Adding the forces acting on each mass: 3 forces acting on M1 (so change the Sum F1 to: +++) 2 forces acting on M2 The first force acting on M1 is just the input force, F. Drag a Signal Generator block from the Sources library and connect it to the uppermost input of the Sum F1 block
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

The next force acting on M1 is the friction force:


F_friction_1=mu*g*M1*v1

This force acts in the negative x1direction. Therefore, it must come into the Sum_F1 block with negative sign.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

The last force acting on M1 is the spring force between masses. This is equal to: k*(x1-x2) First, we need to generate (x1-x2) which we can then multiply by k to generate the force.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

Forces on M2: For the first force, we will use the same spring force we just generated (k*(x1-x2) (k (x1-x2) ) ), except that it adds in with positive sign. The last force to add is the friction on M2 (F_friction_2=mu*g*M2*v2). Now the model is complete. We simply need to supply the proper input and view the proper output.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in SIMULINK

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

The input of the system will be the force, F, provided by the engine. We already have placed the function generator at the input. input The output of the system will be the velocity of the engine. Drag a Scope block from the Sinks block library into your model. Tap a line off the output of the "v1" integrator block to view the output. Label the scope "View_v1"
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Running the Model
M1=1; M2=0.5; k=1; F=1; mu=0.002; g=9.8;

m-file

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Running the Model
M1=1; M2=0.5; k=1; F=1; mu=0.002; g=9.8;

m-file

The last step before running the simulation is to select an appropriate simulation time. To view one cycle of the .001Hz square wave, we should simulate for 1000 seconds.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Obtaining MATLAB Model
Extracting a MATLAB model (t t (state-space or transfer t f function) f ti ) from out simulink model: Delete the View_v1 scope and put an Out Block (from the Connections library) in its place. Also, delete the F function generator block and put an In Block (from the Connections library) in its place.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Obtaining MATLAB Model
Enter the following command at the MATLAB command window to extract a state-space model.
[A B C D]=linmod(train2) [A,B,C,D]=linmod( train2 )

You should get the following output which shows a state-space model.
A = -0.0196 0 0 1.0000 B = 1 0 0 0 C = 1 D = 0
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

0 -0.0196 1.0000 0

1.0000 -2.0000 0 0

-1.0000 2.0000 0 0

To obtain a transfer function model, enter the following command at the MATLAB command prompt

[num,den]=ss2tf(A,B,C,D)
The answer will be:
num = 0 0 0 den = 1.0000 1.0000 0.0392 0.0196 3.0004 2.0000 0.0588 0.0000 0.0000

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
1. Construct two copies (one for each mass) of the expressions sum_F sum F=Ma Ma or a a=1/M*sum 1/M sum_F. F Drag two Summation blocks (from the Signal Arithmetic section of the Simulation palette) into the Simulation Loop. Double-click in an empty part of the block diagram to create labels. Label these Summation blocks "Sum F1" and "Sum F2".

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

This set of system equations can now be represented graphically, without further manipulation. Begin by creating a Simulation Loop, Loop from the Simulation section of the Control Design & Simulation palette.

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
2. Multiplying p y g the outputs p of each of these Summation blocks by 1/M will give the acceleration. Drag two Gain blocks into the model (from the Signal Arithmetic section of the Simulation palette). Attach each one with a wire to the outputs of the Summation blocks. These Gain blocks should contain 1/M for each of the masses. Double-click on each Gain block, and change the Parameter Source f from C Configuration fi ti Dialog Di l Box B to t Terminal. Label these two Gain blocks "a1" and "a2".

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
3. Since velocity is the integral of acceleration, and position is the integral of velocity, we can generate these signals using integrator blocks. Drag two Integrator blocks (from the Linear Systems section of the Simulation palette) into the model for each of two accelerations. Label these integrators "v1", "x1", "v2", and "x2,

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
4. Drag two SimTime Waveform blocks from the Graph G h Utiliti Utilities section ti of f the th Simulation Si l ti palette, l tt and d connect them to the outputs of these integrators. Name them "x1 output" and "x2 output

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

5. Now, add in the forces acting on each mass. First, we need to adjust the inputs on each Sum block to represent the proper number of forces. There are a total of 3 forces acting on M1 double-click on the Sum F1 block and configure it to have 3 inputs (+ + +). here are only 2 forces acting on M2
http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
6. Input force, F: Insert a Signal Generator block from the Signal Generation section of the Simulation palette, and connect it to the uppermost input of the Sum F1 block. Label the Signal Generator "F"

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
7. The next force acting on M1 is the friction force: F( (friction 1) ) = mu*g*M1*v1 g Drag g a Gain block into the model window. Find the wire coming g from the v1 integrator and connect it to the input of the Gain block. Connect the output of the Gain block to the second input of Sum F1. Configure the Gain block so that it uses a Terminal for the Parameter Source instead of the Configuration Dialog Box. Name this block Friction 1. The gain of this Gain block will be mu*g*M1. To achieve this, switch to the front panel and create 3 Numeric Controls. Name them mu, g, and M1. On the block diagram, use a Compound Arithmetic VI from the Numeric palette to multiply these 3 variables. Wire the output to the new Gain block. Also, use the Reciprocal VI to invert M1, and wire this inverted output to the terminal of a1.

http://www.ni.com

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
This force, however, acts in the negative x1-direction. Therefore it must connect to the Sum F1 block with Therefore, a negative sign. Double-click on the Sum F1 block, and change the signs to + - + The last force acting on M1 is the spring force between masses. This is equal to k*(x1-x2). First, we need to generate (x1-x2) which we can then multiply by k to generate the force. Insert a Summation block below the rest of your model. Label it "(x1-x2)" and change its list of signs to - +. Si Since this thi summation ti comes f from right i ht to t left, l ft we need to flip the block around. Right-click the block and select Reverse Terminals. Now, tap off the x2 signal and connect it to the negative input of the (x1-x2) Summation block. Tap off the x1 signal and connect it to the positive input.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''
http://www.ni.com

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
Now, we can multiply this position difference by the spring constant to generate the spring force. Insert a Gain block into your model to the left of the Summation blocks. Configure the Gain block so that its Parameter Source is a Terminal. On the front panel, create a Numeric Control and name it k. On the block diagram, connect this control to the Gain block that you just created. Label the Gain block "spring". Connect the output of the (x1-x2) block to the input of the spring block, and connect the output of the spring block to the third input of Sum F1. Change the third sign of Sum F1 to negative (+ - -).

http://www.ni.com

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

13

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
Apply forces to M2: For the first force force, we will use the same spring force we just generated, except that it adds in with positive sign. Simply tap off the output of the spring block and connect it to the first input of Sum F2. The last force to add is the friction on M2. This is done in the exact same manner as the friction on M1: tapping off v2, multiplying by a gain of mu*g*M2 and adding to Sum F2 with negative sign. You will need to create a Numeric Control for M2 as well. Now the model is complete. We simply need to supply the proper input and view the proper output.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

http://www.ni.com

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Building the Model in LABVIEW
The input of the system will be the force, F provided by the engine F, engine. We already have placed the function generator at the input. The output of the system will be the velocity of the engine. Insert another SimTime Waveform block into the Simulation Loop, from the Graph Utilities section of the Simulation palette. Connect a wire from the output of the "v1" integrator block to this new Waveform Graph, p , to view the output. p

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

14

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Running the Model in LABVIEW
Before running the model, we need to assign g numerical values to each of the variables used in the model. For the train system, use the following values:
M1 = 1 kg M2 = 0.5 kg k = 1 N/sec F= 1 N u = 0.002 s/m g = 9.8 m/s^2

Enter these values using the front panel controls. l Now, we need to give an appropriate input to the engine. Double-click on the Signal Generator (F block). Select a square wave with frequency .001Hz and amplitude -1 (positive amplitude steps negative before stepping positive).
http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TRANSLATIONAL MECHANICAL SYSTEM WITH MASSES, SPRING AND FRICTION

TRAIN SYSTEM - EXAMPLE


Running the Model in LABVIEW
The last step before running the simulation is to select l an appropriate i simulation i l i time. i To view i one cycle of the .001Hz square wave, we should simulate for 1000 seconds. Double-click on the terminals located on the left side of the Simulation Loop. In the Simulation Timing section at the top of the dialog box, set the initial time to 0 seconds, and the final time to 1000 seconds. Close the dialog box. Now, switch to the front panel. Right-click on the xaxis of each Waveform Graph, and select AutoScale X X. Run the simulation and look at the v1 output graph to examine the velocity output. The input was a square wave with two steps, one positive and one negative. Physically, this means the engine first went forward, then in reverse. The velocity output reflects this behavior. http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Sum(forces_on_M1)=M1*x1'' Sum(forces_on_M2)=M2*x2''

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

15

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


DC MOTOR EXAMPLE

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Physical Modeling
DC motor directly provides rotary motion and, coupled with wheels or drums and cables, can provide transitional motion. The electric circuit of the armature and the free body diagram of the rotor are shown in the figure Physical Model Parameters Moment of inertia of the rotor J (J = 3.2284E-6 kgm2/s2) Damping coefficient of the mechanical system b (b = 3.5077E-6 Nms) Electromotive force constant K (K=Ke=Kt = 0.0274 Nm/Amp) Electric resistance R (R = 4 ) Electric inductance L (L = 2.75E-6 H) Source Voltage V input Position of shaft - output Assumption: The rotor and shaft are treated as a rigid
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Mathematical Modeling
The motor torque torque, T, is related to the armature current current, i, by a constant factor Kt. The back emf, e, is related to the rotational velocity by following equations:

According to the figure, the following equations based on Newton's law combined with Kirchhoff's law can be written:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Transfer Function

Applying Laplace Transforms, the above equations can be expressed in terms of s:

By eliminating I(s) we can get the following transfer function, where the rotating speed is the output and the voltage is an input:

In case: position to be the output, we just need to divide the transfer function by s, because by integrating the rotating speed we get the position

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


State Space

These equations can also be represented in state-space form. If we choose motor position, motor speed, and circuit current as state variables, we can write the equations as:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


MATLAB representation and open-loop response
Transfer Function m-file
J=3.2284E-6; b=3.5077E-6; K=0.0274; R=4; L=2.75E-6; num=K; den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) ^ 0]; motor=tf(num,den); step(motor,0:0.001:0.2)

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


MATLAB representation and open-loop response
State Space m-file fil
J=3.2284E-6; b=3.5077E-6; K=0.0274; R=4; L=2.75E-6; A=[0 1 0 0 -b/J K/J 0 -K/L K/L -R/L]; R/L] B=[0 ; 0 ; 1/L]; C=[1 0 0]; D=[0]; motor=ss(A,B,C,D); step(motor)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK
Newton's law and Kirchhoff's law applied to the motor system give the following equations:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK open loop responce

Since the time scales in this example are very small, this stiff system integration method is much more efficient than the default integration method ode45 (Dormand-Prince)

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK open loop responce
J=3.2284E-6; b=3.5077E-6; K=0.0274; R=4; L=2.75E-6;

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
MODELING DC MOTOR POSITION
Building the Model in SIMULINK
Extracting a Digital Model into MATLAB
EXAMPLE

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
MODELING DC MOTOR POSITION
Building the Model in SIMULINK
Extracting a Digital Model into MATLAB
[A,B,C,D]=dlinmod('motorposmodel',.001) [num den]=ss2tf(A B C D) [num,den]=ss2tf(A,B,C,D) A = 1.0000 0 0 B = 0.0010 0.2359 2.0589 C = 1 D = 0 num = 0 den = 1.0000 0.0010 0.0010 0.0000 0 0 0 0.0000 0.0000 0.0055 0.0010 -0.0065 0.9425
EXAMPLE

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

-1.9425

0.9425

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


Building the Model in SIMULINK
Extracting a Digital Model into MATLAB

To verify the model extraction, we will generate an open-loop step response of the extracted transfer function in MATLAB.
[x1] = dstep(num,den,201); t=0:0.001:0.2; stairs(t,x1) You should see the following plot which i equivalent is i l to the h Scope's S ' output

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
State-Space p Model in LabVIEW The state-space equations in LabVIEW can be represented using either a graphical or a hybrid graphical/textual approach.
LabVIEW Graphical Approach 1. Begin with a blank VI. Insert the CD Construct State Space Model VI from the Model Construction section of the Control Design palette, and create controls for each of the inputs.
http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
State-Space Model in LabVIEW
LabVIEW Graphical Approach 2. Add the CD Draw State-Space Equation VI. This will display the state-space equation on the front panel. Create an output for the Equation from the CD Draw State-Space Equation VI. 3. Add the CD Step Response VI from the Time Response section of the Control Design palette. Create a control for the Time Info input and an indicator for the Step Response Graph output.
http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
State-Space Model in LabVIEW
LabVIEW Graphical Approach The previously undertaken steps should result in a front panel that looks like:

State-Space Front Panel


http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

10

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
State-Space Model in LabVIEW
Hybrid Graphical/MathScript Approach Alternatively, we can get the same results with a hybrid approach, using the MathScript Node. 1. Begin with a blank VI, and insert a MathScript Node from the Structures palette. Add the following code to your MathScript Node:
J=3.2284E-6; b=3.5077E-6; K=0.0274; R=4; L=2.75E-6; A=[0 1 0 0 -b/J K/J 0 -K/L -R/L]; B=[0 ; 0 ; 1/L]; C=[1 0 0]; D=[0]; motor=ss(A,B,C,D);

2. Create a State-Space output from the Node, and add the CD Draw StateSpace Equation VI and the CD Step Response VI in the same way as it was done in the graphical approach.

http://www.ni.com MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
Transfer Function in LabVIEW
Another option is to represent the transfer function in LabVIEW, instead of using the state-space model. LabVIEW Graphical Approach 1. To represent the transfer function using a LabVIEW graphical approach, begin by inserting the CD Construct Transfer Function Model VI (from the Model Construction section of the Control Design palette) into a blank VI. Create controls for the Numerator, Denominator, and Variables inputs. 2. Add the CD Draw Transfer Function Equation VI to the block diagram, and create an indicator for the Equation output. This will display the transfer function equation on the front panel.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

http://www.ni.com

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

11

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
Transfer Function in LabVIEW
LabVIEW Graphical Approach 3. Add the CD Step Response VI from the Time Response section of the Control Design palette. Create a control for the Time Info input and an indicator for the Step Response Graph output.

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
Transfer Function in LabVIEW
LabVIEW Graphical Approach The previously undertaken steps should result in a front panel that looks like:

http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

12

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
Transfer Function in LabVIEW
Hybrid Graphical/MathScript Approach Alternatively, we can get the same results with a hybrid approach, using the MathScript Node. 1. Begin with a blank VI, and insert a MathScript Node from the Structures palette. Add the following code to your MathScript Node:
J=3.2284E-6; b=3.5077E-6; b 3.5077E 6; K=0.0274; R=4; L=2.75E-6; num=K; den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0]; motor=tf(num,den);
http://www.ni.com
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

2. Create a Transfer Function output from the Node, and add the CD Draw Transfer Function Equation VI and the CD Step Response VI in the same way as it was done in the graphical approach.

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

MODELING DC MOTOR POSITION


LabVIEW representation and open-loop response
Step p Response p for Open-Loop p p System y
Using either the state-space model or the transfer function, you should see the following step response graph on the front panel when you run the VI:

http://www.ni.com

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

13

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR

Physical Model Parameters Moment of inertia of the rotor J (J = 8.5E-6 kgm2/s2) Damping coefficient of the mechanical system b (b = 3.7E-6 Nms) Electromotive force constant K (K=Ke=Kt = 0.0424 Nm/Amp) Electric resistance R (R = 1.85 ) Electric inductance L (L = 1.97E-6 H) Source Voltage V Position of shaft
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR

My Computer New VI A blank front panel will appear, and behind that, an empty block diagram.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

14

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


We first need to add a simulation loop within which the equations will be implemented. Click Control Control Design and Simulation Simulation, , then click Simulation Simulation and finally click the Simulation Loop. Your cursor will change its icon and you can then click and drag to place the simulation loop onto the block diagram.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Before implementing the equations, click File Save Right-click to bring up the functions palette. From the Programming group (which is opened d by b default), d f lt) select l t Numeric N i N Numeric i C Constant t t and d place l thi this on th the block bl k diagram. Next, right-click on this block and select Change to Control. Right-click the control and select Representation Double Precision

This will convert the control from its standard integer to a double (decimal value). You may also wish to change the label of this control to Vapp Vapp. Do this by double-clicking the text, then typing. Once youve done this, repeat the procedure to create three more constant doubles, Kemf, R, and L, and one control, Theta dot. Make sure each of these are set to double precision.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

15

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


The block diagram should now look similar to:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Right-click to bring up the functions palette, then select Control Design and Simulation Simulation Signal Arithmetic Multiplication. Place two multiplication blocks next to the controls and constants you have created. Then, wire the inputs from Theta dot and Kemf into the terminals of one block. Wire R into the multiplication terminal of the other block.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

16

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Control Design and Simulation Simulation Simulation Arithmetic. Double-click on this block to open its properties window. Change the icon shape to Rectangle Rectangle then click on each of the input signs to change them to + +, -, -

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Wire the output from Vapp into the + input of the addition block, then wire the outputs from the two multiplication blocks into each of the - inputs. Next, add another multiplication block and change its terminals to x and by double-clicking to bring up the configuration window. Connect the output of the addition block to the x input and connect L to the input

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

17

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Right-click on the output of the latest multiplication block and select Create Indicator Re-label this block di/dt. We have now completed the basic block diagram for the electrical portion of our system. We will now add an integrator block to compute the value of I(t). Open the functions palette, select Control Design and Simulation Simulation Continuous Linear Systems Integrator Wire the input to this block to the output of the last multiplication block ( (to which our di/dt indicator is now connected.). Create a second indicator. Re-label it to I. Connect the integrator output to the empty terminal on the first multiplication block
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


In order to reduce the complexity of the block diagram, select all of the blocks that are placed inside the simulation loop by clicking and dragging a box around them. Then, select Edit Create Simulation Subsystem. The selected blocks have now been incorporated into a separate VI

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

18

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Now we will begin to diagram the equations for the mechanical part of the system. To do this, first add three constant doubles, three multiplication blocks, and one addition block. The three constants will be Kt, B and J. Wire them according to the equation given above.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Control Design and Simulation Simulation Continuous Linear Systems, add another integrator block, and connect it to the output of the final multiplication block. Right-click on this output and select Create Indicator. Delete the Theta dot control we created earlier. Connect in its place the output from the integrator Select the mechanical system blocks, and select blocks EditCreate Simulation Subsystem to create the mechanical subsystem

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

19

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Right-click to open the functions palette then navigate to Control Design and Simulation Simulation Graph Utilities. Select the SimTime Waveform blocks and place them on the block diagram. Select them, then while holding the control key, click and drag to create copies of both blocks. Now, connect the I and omega outputs to the inputs of the SimTime Waveform blocks.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Switch back to the front panel by pressing Ctrl+E. You will notice two graph windows, one input, and one output. Replace the default numeric control, Vapp, with a numeric slider. Right-click the control and select Replace Vertical Pointer Slide. Once that is done, right-click the slider and select Visible Items Digital g Display. p y This will allow to key in a precise value.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

20

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR

Before running the VI, we need d to t adjust dj t the th simulation i l ti parameters. Switch back to the block diagram, then rightclick on the simulation loop border and select Configure Simulation Parameters. Change the Final time to 0.1 seconds, ODE Solver to Runge-Kutta 1 (Euler), and Step Size to 0.00001 seconds. Then, click OK.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Before running the completed VI, you may wish to adjust the settings for the two graphs. graphs Switch back to the front panel, then rightclick on the graphs and select Chart History Length. Enter 50000 for this value. Right-click the graphs and select Properties. Under the Format and Precision tab, you can adjust the number of digits which appear on the x and y axes. You may also want to change the range for the x-axis. To do this, doubleclick the final value and change it to 0.10. Also change the y-axis on the I(t) plot to range from 0 to 5, and the y-axis on the omega plot to range from 0 to 150. You will also want to uncheck Autoscale Y Axis.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

21

DC MOTOR
EXAMPLE

LABVIEW SIMULATION OF DC MOTOR


Click the Run button (or press Ctrl+R) to run the simulation and get the results.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

22

MODELING AND SIMULATION OF MECHATRONIC SYSTEMS


FLUID FLOW RESERVOIR
MODELING EXAMPLE

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Physical Modeling
The reservoir (or tank) contains water that evacuates through an output port. Water is fed to the reservoir through a pipe controlled by an input valve. The variables of interest are: fluid velocity V [m/s] fluid height in the reservoir H [m] pressure p [N/m2]

EXAMPLE

Tank with free outflow

We want to construct a model of how the outflow depends on the inflow, i.e. to establish the system configuration and then obtain the appropriate mathematical models describing the fluid flow reservoir from an input-output perspective. The general equations of motion and energy describing fluid flow are quite complicated (coupled nonlinear partial differential equations). Some selective assumptions that reduce the complexity of the mathematical model have to be made.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Physical Modeling

EXAMPLE
Tank with free outflow

Key assumptions: The Th water t i in the th tank t k is i incompressible i ibl with ith constant density [kg/m3] The flow is inviscid (viscosity can be neglected in our model development) The flow is irrotational (the water in the tank is irrotational). For an inviscid fluid, an initially irrotational flow remains irrotational The water flow in the tank and output port is steady (the velocity does not change with time). If the output port area is too large, then the flow through the reservoir may not be slow enough to establish the steady-state steady state condition that we are assuming exists and our model will not accurately predict the fluid flow motion. Physical Model Parameters The constants for the reservoir system are:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Mathematical Modeling
To obtain a mathematical model of the flow within the reservoir, basic principles of science and engineering (for example, the principle of conservation of mass) should be used. The mass of water in the tank at any given time is: m = A1H

EXAMPLE
Tank with free outflow

Taking the time derivative, using the fact that we consider uncompressible fluid (=const.) and tank with area A1, which is not change with time, as well knowing that the change g in mass in the reservoir is equal q to the mass that enters the tank minus the mass that leaves the tank, we obtain following relation: Q1 steady-state input mass flow rate v2 exit velocity (it is a function of the water height)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Mathematical Modeling
From Bernoulli's equation, q it follows:

EXAMPLE
Tank with free outflow

where: v1 - water velocity at the mouth of the reservoir, p1 and p2 - pressures at the input and output, respectively. But p1 and p2 are equal to atmospheric pressure, and A2 is sufficiently small (A2=A1/100), so the water flows out slowly and the velocity v1 is negligible. Thus Bernoulli's equation reduces to: Substituting this equation into previous one yields to: Using equation for v2, the exit mass flow rate will be:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Mathematical Modeling
Introducing: g

EXAMPLE
Tank with free outflow

We obtain: These equations Th ti represent t our model d l of f the th water t tank t k system, t where h the th input i t is i Q1 and the output is Q2. It is a nonlinear, first-order, ordinary differential equation model. The nonlinearity comes from the H1/2 term. The model has the functional form :

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Mathematical Modeling
A set of linearized equations q describing g the height of the water in the reservoir is obtained using Taylor series expansions about an equilibrium flow condition. When the tank system is in equilibrium, we have:

EXAMPLE
Tank with free outflow

We can define Q* and H* as the equilibrium input mass flow rate and water level, respectively. The relationship between Q*and H* is given by :

We can write the water level and input mass flow rate as: where H and Q1 are small deviations from the equilibrium (steady-state) values.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING


EXAMPLE

FLUID FLOW RESERVOIR


Mathematical Modeling
The Taylor series expansion about the equilibrium conditions is given by:

And from the equation: it follows: (H*=const.) f(H*,Q*) is identically zero, by definition of the equilibrium condition. Neglecting the higher order terms in the Taylor series, we have:

We have: so that:
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

This equation is a linear model describing the deviation in water level H from the steady-state due to a deviation from the nominal input mass flow rate Q1
MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Mathematical Modeling
Similarly, y for the output p variable Q2 we have:

EXAMPLE
Tank with free outflow

Therefore, the linearized equation for the output variable Q2 is:

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Transfer function
It is convenient to obtain the input-output relationship in the form of a transfer function. Taking the time-derivative of:

EXAMPLE
Tank with free outflow

and substituting into yields the input-output relationship:

Taking the Laplace transform (with zero initial conditions), the transfer function will be: It describes the relationship between the change in the output mass flow rate Q2(s) due to a change in the input mass flow rate Q1(s)
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Transfer function
The transfer function relationship between the change in the input mass flow rate and the change in the water level in the tank, H(s) can also be obtained. The Laplace transform (with zero initial conditions) of: gives:

EXAMPLE
Tank with free outflow

Step response
Given the linear time-invariant model of the water tank system: the step response can be obtained. The input Q1(s) is actually a change in the input mass flow rate from the steady-state value Q*.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

Consider the step input: Q1(s) )=q0/s , where q0 is the magnitude of the step input, and the initial condition is Q2(0)=0. Then from the transfer function Q2/ Q1 , the thank response will be:

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Step response

EXAMPLE
Tank with free outflow

The partial fraction expansion gives:

and the inverse Laplace transform yields: Note that K > 0 , so the term eKt approaches zero as t approaches . Therefore, the steady-state output due to the step input of magnitude q0 is: We see that in the steady state, the deviation of the output mass flow rate from the equilibrium value is equal to the deviation of the input mass flow rate from the equilibrium value.

TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING

FLUID FLOW RESERVOIR


Step response
Similarly y for the water level it is:

EXAMPLE
Tank with free outflow

and taking the inverse Laplace transform we obtain: The steady state change in water level due to the step input of magnitude q0 is:

The above analytic analysis of the linear system model to step input is a valuable way to gain insight into the system response to test signals. Analytic analysis is limited, however, in the sense that a more complete representation can be obtained with carefully constructed numerical investigations using computer simulations of both the linear and nonlinear mathematical models.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

FLUID FLOW MODELING


EXAMPLE

FLUID FLOW RESERVOIR


Step response

Using the model parameters, the nonlinear model describing the water level flow rate is given by:
We can use the transfer function model to obtain the unit step response. The step response is shown in Figure for both the linear and nonlinear models.

With H(0)=0.5m and Q1(t)=34.77kg/s, we can numerically integrate the nonlinear model to obtain the response of the system.
TEMPUS IV Project: 158644 -JPCR Development of Regional Interdisciplinary Mechatronic Studies - DRIMS

MODELING AND SIMULTION OF MECHATRONIC SYSTEMS

THE MECHATRONICS HANDBOOK


Editor-in-Chief

Robert H. Bishop
The University of Texas at Austin Austin, Texas

CRC PR E S S
Boca Raton London New York Washington, D.C.

FIGURE 20.122

Scheme of a pneumatic servosystem with two-ways digital valves.

FIGURE 20.123

Scheme of a pneumatic servosystem with three-ways proportional valves.

a ow entering the servochamber 4 (see Fig. 20.120) while the other controls the ow exiting towards discharge. By means of appropriate action, the control signal is converted into a pressure proportional signal.

Modeling a Pneumatic Servosystem


The circuitry plan of a pneumatic servosystem capable of controlling the position, speed, or force can be similar to that shown in Fig. 20.109 for hydraulic actuation. The signal of the transducer of the desired magnitude must be specially fed back in a closed loop on the regulator depending on the controlled magnitudes. In the plan in Fig. 20.122, the axial position of the piston, fed back by means of the position transducer, is determined by controlling the pressure in thrust chambers 1 and 2 by means of the ow proportional interfaces. The position reference is compared with the feedback signal and the error is compensated in a control regulator. On the basis of the valve opening strategy used, the signal is sent to the regulating valves which feed the chambers of the piston, hypothesized to be symmetrical. The pressure forces acting on the thrust surfaces of the piston oppose the external force disturbance. The circuitry plan hypothesizes the use of four digital valves each with two unistable ways, electrically controlled. This solution makes it possible to use small-sized valves, with resulting high bandwidth, which must be compatible with the overall bandwidth requested by the pneumatic servosystem. In this solution, the proportionality of the opening of the valves is obtained by pulse width modulation of the digital signal. Each pair of valves V11, V12 and V21, V22 constitutes a three-way valve the output of which is connected to a piston chamber, so that the scheme in Fig. 20.122 can be equivalent to that in Fig. 20.123 with the three-way analogically controlled valves V1 and V2. The cylinder model envisages a system with three-differential equations, two of continuity of the air mass in the chambers and one of dynamic translation equilibrium.

2002 CRC Press LLC

The following magnitudes are differentiated (the subscripts 1 and 2 refer, respectively, to the rear 1 and front 2 chambers of the pistons): A Fe G M n P Pi Pamb R Ti x x0 xm piston thrust section disturbance of force acting on the piston rod mass ow rate of air entering the chamber mass of the translating parts of the piston air polytropic coefcient cylinder chamber pressure initial cylinder chamber pressure ambient pressure air constant initial cylinder chamber air temperature rod position measured starting from x0 piston half stroke dead band coefcient of viscous friction

The continuity and equilibrium equations are given by:

dP 1 P1 n G 1 nRT 1 i dx ------- = ---------------------------------------------------------------------------- -------------------------------(1 n)/n dt ( x 0 + x m 1 + x ) dt A1 ( x0 + xm 1 + x ) ( P1 / P1 i ) dP 2 P2 n G 2 nRT 2 i dx ------- = ------------------------------------------------------------------------ ----+ -------------------------------( 1 n ) / n dt ( x 0 + x m 2 x ) dt A2 ( x0 + xm 2 x ) ( P2 / P2 i )
2 ( P 1 P amb ) A 1 ( P 2 P amb ) A 2 F e g dx / dt dx ------- = -------------------------------------------------------------------------------------------------------2 M dt

(20.58)

(20.59)

(20.60)

The ow proportional valve V1 is modeled as a variable section pneumatic resistance. The equations used for calculating mass ow rate G through a pneumatic resistance, characterized by a conductance C and by a critical ration b, in accordance with ISO 6358, which connects two environments A and B, with respective pressures of PA and PB, taken to be positive in the A B direction, are

sonic flow:

G = r0 PA C

PB for 0 < ----b PA PB 1 for b < ----PA

(20.61)

subsonic flow:

P B / P A b 2 G = r 0 P A C 1 --------------------- 1b G = r0 PB C

(20.62)

sonic flow:

PA for 0 < ----b PB PA for b < ----1 PB

(20.63)

subsonic flow:

P A / P B b 2 G = r 0 P B C 1 --------------------- 1b

(20.64)

2002 CRC Press LLC

Hypothesizing a bipolar reference signal, it can be assumed that the range Vref > 0 corresponds to the supplyuser connection, while the eld Vref < 0 corresponds to the userdischarge connection. The appropriate equation of ow above must be rewritten in the same way. Calculation of the conductance of the ow proportional valve is made considering the static and dynamic link between the reference voltage Vref and the opening of the passage aperture A V in accordance with modeling of the second order of the type:

d AV dA V 2 2 ----------+ 2 zs n --------+ s n A V = K s s n V ref 2 dt dt

(20.65)

where is the damping factor, n is the valves natural frequency, and Ks is its area static gain. Assuming a static relation of the linear type between the opening A V and the conductance C, as an initial approximation, we get

C = K c A V = K c K s V ref = K V V ref

(20.66)

where K V is the ow static gain of the valve, function of the maximum conductance Cmax, and of the maximum value of the reference voltage Vref max:

C max K V = -------------V ref max


The complete dynamic relation between reference voltage and conductance is, therefore,

(20.67)

dC dC 2 2 -------- + 2 zs n ------ + s n C = K c s n V ref 2 dt dt

(20.68)

The nonlinear model of the pneumatic servosystem with the position reference xset and the force disturbance Fe as inputs, is made up of a nonlinear system of nine equations, of order eight overall, of the type: a) b) c) d) e) f) g) h) i) C1 = C1(Vref 1, t) C2 = C2(Vref 2, t) G1 = G1(C1, P1) G2 = G2(C2, P2) 1, x, x ) G1 = G1(P1, P 2, x, x ) G2 = G2(P2, P ) = x (Fe, P1, P2, x x Vref 1 = Vref 1 (xset , xret) Vref 2 = Vref 2(xset , xret) order 2 order 2 order 0 order 0 order 1 order 1 order 2 order 0 order 0 conductance of valve V1 (see (20.68)) ow rate of valve V1 (see (20.68)) ow rate of valve V1 (see (20.61)(20.64)) ow rate of valve V2 (see (20.61)(20.64)) continuity chamber 1 (see (20.58)) continuity chamber 2 (see (20.59)) piston equilibrium (see (20.60)) V1 valve control V2 valve control

If we want to carry out a linear analysis, it can be assumed that the equations a), b), g), h), i) are already written in linear form. As far as the ow rates of valves c) and d) are concerned, it is hypothesized that the ow rate for each of them is subsonic in feed, with Vref > 0, and sonic in discharge, with Vref < 0. This means that for valve V1, for example, the pressure P1 must be within the range bPs < P1 Ps in feed and in the range P1 Pamb/b

2002 CRC Press LLC

in discharge. This hypothesis is physically acceptable; hypothesizing b = 0.3, Ps = 10 bar, Pamb = 1 bar, we get that P1 can vary between 3.33 bar and 10 bar. It is the same for P2. Linearizing the subsonic feed ow rate curve with a secant passing through the points P1 = Ps, G1 = 0 and P1 = b 1Ps, G1 = G1 sonic, of angular coefcient KL1, we get

G1 = KL 1 ( Ps P1 )
where

(20.69)

rn C1 Ps rn C1 G 1sonic - = ---------------------- = ------------K L 1 = ------------------ Ps b1 Ps Ps ( 1 b1 ) 1 b1


or

(20.70)

rn ( Ps P1 ) - C1 G 1 = ------------------------ ( 1 b1 )
In the neighborhood P1 = P1r and C1 = C1r = 0 (the subscript r indicates of reference), we get

(20.71)

rn ( Ps P1 r ) - C 1 = K 11 C 1 G 1 = -------------------------- ( 1 b1 )
Equation (20.72) is valid for Vref1 > 0, to which C1 > 0 corresponds analytically. The ow rate discharge is expressed by

(20.72)

G1 = rn C1 P1
which in the neighborhood P1 = P1r becomes

(20.73)

G 1 = r n P 1 r C 1 = K 12 C 1
Equation (20.74) is valid for Vref1 < 0, to which C1 < 0 corresponds analytically. Calculating a mean of slopes K11 and K12 we get a mean slope Kmean given by

(20.74)

K 11 + K 12 rn ( Ps b1 P1 r ) - = -------------------------------K mean = ------------------- 2 2 ( 1 b1 )


The linearized ow rate as a function of C1 therefore becomes

(20.75)

rn ( Ps b1 P1 r ) - C1 = K1 C1 G 1 = ------------------------------- 2 ( 1 b1 )

(20.76)

2002 CRC Press LLC

FIGURE 20.124

Block diagram of the linearized model of a pneumatic servosystem with position control.

In the same way for the valve V2 we get

rn ( Ps b2 P2 r ) - C2 = K2 C2 G 2 = ------------------------------- 2 ( 1 b2 )

(20.77)

The continuity equations of the mass in the piston chambers e) and f ), linearized in the reference neighborhood dened by

x = x r, 1 = P 1 r = 0, P

P 1 = P 1 r,

P2 = P2 r , = x r = 0 x

2 = P 2 r = 0, P

x m 1 = x m 2 = 0,
become

n = 1

P1 r A1 x0 + xr + A 1 -------------- P1 x G 1 = ------------RT RT P2 r A2 x0 xr + A 2 -------------- P2 G 2 = ------------x RT RT

(20.78)

(20.79)

The block diagram of the linearized model is shown in Fig. 20.124. By applying the Laplace transforms of the system of linearized equations, assuming identical valves, we get:

sn sA sA = ----------------------------------------x -------------------------------------------- G c K OLV e -------------------------------------------- K OLF sF e + C.I. 2 2 2 2 2 2 ( s + 2 zs n s + s n ) ( s + 2 z A s A s + s A ) ( s + 2 zA sA s + sA )

(20.80)

where C.I. indicates the initial conditions, K OLV is the static gain in speed, K OLF is the gain of the force disturbance, A and A are, respectively, the actuators natural frequency and the damping factor, and Gc is the compensator law. This result is shown in the block diagram in Fig. 20.125. Figure 20.126, on the other hand, shows the closed loop block diagram with position feedback. Obvious similarities can be seen when this plan is
2002 CRC Press LLC

FIGURE 20.125

Block diagram of the open loop model.

FIGURE 20.126

Block diagram of the closed loop model.

compared with that for a hydraulic servosystem. In particular, hypothesizing that: P1r = P2r = Ps with 0.6 0.9 A1 = A2 = A double ended actuator n = 1 isothermal transformation we can express the signicant parameters of the pneumatic servosystem:
RT r n 1 1 (1/d b ) - K V ----------------------------------------K OLV = ----------- 2 (1 b ) A (1 b )

(20.81)

x0 [ 1 ( xr / x0 ) ] K OLF = -----------------------------------2 d Ps A
2

(20.82)

sA =

2 d Ps A ----------------------------------------2 x0 m [ 1 ( xr / x0 ) ]
2

(20.83)

x0 [ 1 ( xr / x0 ) ] z A = g -----------------------------------8 d P s Am

(20.84)

On the basis of the design specications, it is possible to choose the size and characteristics of the servosystem components, operating rst on the linearized model, and then checking the complete effectiveness of the choice made with a complete nonlinear system model.

References
Andersen, B. W., The analysis and design of pneumatic systems, Wiley, New York, 1967. Bouteille, D., Belforte, G., Automazione essibile, elettropneumatica e pneumatica, Tecniche Nuove, Milano, 1987.
2002 CRC Press LLC

Belforte, G., D Alo, N., Applicazioni e prove dellautomazione a uido, Levrotto & Bella, Torino, 1997. Belforte, G., Manuello Bertetto, A., Mazza, L., Pneumatica: corso completo, Tecniche Nuove, Milano, 1998. Blackburn, J. F., Reethof, G., Shearer, J. L., Fluid power control, MIT Press, Cambridge, 1960. Dranseld, P., Hydraulic control systemsdesign and analysis of their dynamics, Springer, Berlin, 1981. Esposito, A., Fluid power with applications, 5th ed., Prentice-Hall, Upper Saddle River, NJ, 2000. Gotz, W., Hydraulics. Theory and applications, Robert Bosch Automation Technology Division Training, Ditzingen, 1998. Hehn, A. H., Fluid power troubleshooting, 2nd ed., Dekker, New York, 1995. Introduction to hydraulic circuits and components, The University of Bath, Bath, 2000. Introduction to control for electrohydraulic systems, The University of Bath, Bath, 1999. Jacazio, G., Piombo, B., Meccanica applicata alle macchine 3: Regolazione e servomeccanismi, Levrotto & Bella, Torino, 1994. Johnson, J. E., Electrohydraulic servo systems, 2nd ed., Penton IPC, Cleveland, 1977. Johnson, J. L., Design of electrohydraulic systems for industrial motion control, Penton IPC, Cleveland, 1991. Johnson, J. L., Basic electronics for hydraulic motion control, Penton IPC, Cleveland, 1992. Lewis, E. E., Stern, H., Design of hydraulic control systems, McGraw-Hill, New York, 1962. Mang, T., Dresel, W., Lubricants and lubrications, Wiley-VCH, Weinheim, 2001. McCloy, D., Martin, H. R., The control of uid power, Longman, London, 1973. Merritt, H. E., Hydraulic control systems, Wiley, New York, 1967. Moog, Technical Bulletins, 101152, Moog, New York. Muller, R., Pneumatics. Theory and applications, Robert Bosch Automation Technology Division Training, Ditzingen, 1998. Nervegna, N., Oleodinamica e Pneumatica, Politeko, Torino, 1999. Parr, A., Hydraulics and pneumatics: a technicians and engineers guide, 2nd ed., Butterworth Heinemann, Oxford, 1998. Shetty, D., Kolk, R. A., Mechatronics system design, PWS publishing company, Boston, 1997. Tonyan, M. J., Electronically controlled proportional valves: selection and application, Dekker, New York, 1985. Viersma, T. J., Analysis, synthesis and design of hydraulic servosystems and pipelines, Elsevier, Amsterdam, 1980. Yeaple, F., Fluid power design handbook, 3rd ed., Dekker, New York, 1996.

20.5 MEMS: Microtransducers Analysis, Design, and Fabrication*


Sergey Edward Lyshevski
Introduction
In many applications (from medicine and biotechnology to aerospace and security), the use of nanoand microscale structures, devices, and systems is very important [14]. This chapter discusses the analysis, modeling, design, and fabrication of electromagnetic-based microscale structures and devices (microtransducers controlled by ICs). It is obvious that to attain our objectives and goals, the synergy of multidisciplinary engineering, science, and technology must be utilized. In particular, electromagnetic

This section is a part of the book: S. E. Lyshevski, MEMS and NEMS: Systems, Devices, and Structures, CRC Press, Boca Raton, FL, 2001.
2002 CRC Press LLC

Modeling and Simulation of a Pneumatic Servosystem for Position Control


M. A. Sharifi K.

BACKGROUND

The circuitry plan of a pneumatic servosystem capable of controlling position can be similar to that shown in Fig. 1. in homework 1 for hydraulic actuation. The signal of the transducer of the desired magnitude must be specially fed back in a closed loop on the regulator depending on the controlled magnitudes. In the plan in figure 2, the axial position of the piston, fed back by means of the position transducer, is determined by controlling the pressure in thrust chambers 1 and 2by means of the flow proportional interfaces. The position reference is compared with the feedback signal and the error is compensated in a control regulator. On the basis of the valve opening strategy used, the signal is sent to the regulating valves which feed the chambers of the piston, hypothesized to be symmetrical. The pressure forces acting on the thrust surfaces of the piston oppose the external force disturbance [1].

Fig. 1.

MODELING
The closed loop block diagram of the linearized model with position feedback is shown in Fig. 2. [1].

Fig. 2.

Parameters of model above are given bellow [1]:


1 1 (1 ) = 2 (1 ) (1 )

MODELING AND SIMULATION OF A PNEUMATIC SERVOSYSTEM FOR POSITION CONTROL 4/2/2010

0 [1 (

2 0 ) ]

2 0 [1 ( 0 )2 ] 0 [1 ( =

2 0 ) ]

for 1 = 1, =

1 1 = 1 in the reference neighborhood = in the reference neighborhood. Used variables in above equations are defined in Table 1.
TABLE I valve's natural frequency valve's damping factor air constant cylinder air temperature air density pneumatic conductance of servovalve reference voltage corresponding to mass flow rate of air entering chamber piston thrust section piston half stroke mass of the translating parts of piston coefficient of viscous friction

R T C G A 0 m

PARAMETERS
Parameters of servovalve are determined using [2]. Parameters of hydraulic actuator are derived from [3]. According to [2], the servovalve dynamic can be represented as a second-order transfer function 1 = 1 + 2 + ( )2 in which = 0.4 , = 250 , = 125 .

Comparing k from above transfer function (TF) to K from presented model, we find out that the output of above TF is not the same as that of corresponding block in model which is velocity (m/s). From the equations for in modeling, to make the outputs the same, we have = ( ). In equation above, = 4.84 9 3 /(. ) from [4]. Also, according to [1], an acceptable values for is 0.75. Parameters of actuator are as follows [3]:

MODELING AND SIMULATION OF A PNEUMATIC SERVOSYSTEM FOR POSITION CONTROL 4/2/2010

= 2.5 2 , 0 = = 5 , = 586 , and = 10


2

According to the fact that shows the influence of viscous friction, while other kinds of friction are neglected, it is reasonable to say that is the total friction coefficient. So, using [5], we have = 65 Also, to simplify calculations, I assumed that
0

= 0.75.

Table 2 shows the values of parameters of model shown in Fig. 2 using above values and equations of previous part.
TABLE II 16.94 Pa/mA 1.571e3 rad/sec 0.4 1.706e-4 m/N 24.21 rad/sec 0.134

SIMULATION
Now that we obtained the parameters of the model, we can simulate the servosystem. Following is the block diagram of the simulated system (Fig. 4.).

Fig. 4.

In above block diagram: = 0.0375 1 = 1000 1 = Followings are results of simulation for different values of k.

Fig. 5: k =1

MODELING AND SIMULATION OF A PNEUMATIC SERVOSYSTEM FOR POSITION CONTROL 4/2/2010

Fig. 6: k = 10

Fig. 7: k = 0.1

Fig. 8: k = 0.01

As results show, for (k = 1) system is unstable and increasing k (k = 10) does not solve this problem. However, decreasing k (k = 0.1) leads to system's stability and also a good response in which not only the effect of disturbance is almost completely compensated in steady state response, but also rising time is acceptable ( 1.25 ). More decrease in k (k = 0.01) leads to instability which is not desired. Finally, a sine wave and a saw-tooth wave with amplitude of 0.0375 and frequency of 0.5Hz are applied to the model. Fig. 9. and Fig. 10. show the output to sine and saw-tooth wave, respectively.

Fig. 9.

Fig. 10.
MODELING AND SIMULATION OF A PNEUMATIC SERVOSYSTEM FOR POSITION CONTROL 4/2/2010

As you can see the system does not response to periodic inputs above properly, because the frequency of inputs is big according to settling time of system ( 2.5 ); so, system cannot follow the input. Following figures are the output of system to sine and saw-tooth inputs with same amplitude but frequency of 0.25Hz. As shown, dividing the frequency of input down to 0.25Hz leads to a much better response .

Fig. 11.

Fig. 12.

REFERENCES
[1] THE MECHATRONICS HANDBOOK, pp.603-608 [2] TECHNICAL BULLETIN 103, TRANSFER FUNCTION FOR MOOG SERVOVALVES, pp.3-4 [3] E. J. Barth, J. Zhang, and M. Goldfarb, Control Design for Relative Stability in a PWM-Controlled Pneumatic System, pp.3 [4] K. Kawashima, Y. Ishii, T. Funaki, T. Kagawa, Determination of Flow Rate Characteristics of Pneumatic Solenoid Valves Using an Isothermal Chamber [5] Z. Situm, J. Petric, M. Crnecovic, Sliding Control Applied to Pneumatic Servo Drive, pp. 6

MODELING AND SIMULATION OF A PNEUMATIC SERVOSYSTEM FOR POSITION CONTROL 4/2/2010