Software for Fluid Power Technology
From Editor
The purpose of the Software Review section of the Journal is to present information to the reader about engineering software, including simulation programs, to highlight their specific features and their "fitness to purpose" in the unique field of fluid power and motion control. It is, of course, impossible to establish evaluation criteria matching the needs of all readers, therefore readers should not look for absolute ratings but more or less "fuzzy" opinions of the reviewer. A software program is like a wrench, just a tool to solve problems. It is good to solve some problems and not so good for others and this depends on both the nature of the problem and the users' attitude - and generally when we review software we do not know either. A software tool can be highly specialised and great for a some applications but not so well suited for others, on the other hand another software tool can be more flexible and generally applicable but without outstanding features. It is impossible, and even misleading, to say which one is better. What we hope to accomplish is to give the reader information necessary to take his/her own decision.
Modelling and Simulation of Fluid Power Systems
with MATLAB/Simulink®
1 Introduction
The origin of MATLAB dates back to the mid-1970s, when Cleve Moler and several col-leagues developed the FORTRAN subroutine libraries called LINPACK and EISPACK for solving linear equations and eigenvalue problems. Together, LIN-PACK and EISPACK represented the state of the art software for matrix computation. In the late 1970s Moler started to write a program that would provide simple interactive access to LINPACK and EISPACK, naming it MATLAB (MATrix LABoratory). In early 1983, John Little came into contact with MATLAB because of a visit of Moler at Stanford University. Little, an engineer, recognized the potential of MAT-LAB for engineering purposes.
So, Little, Moler and Steve Bangert developed a sec-ond generation, professional version of MATLAB written in C and integrated with graphics. The Math-works, Inc. was founded in 1984 to market and con-tinue development of MATLAB. The purpose of this review is to highlight the abilities of MATLAB and SIMULINK for system simulation and controller de-sign problems in the field of fluid power.
2 MATLAB
From 1984 until today MATLAB has evolved into an interactive system and programming language for general scientific and technical computation and visualization. Due to its open architecture a huge number of applications, toolboxes and improvements were developed, making the current version, MATLAB 6.1 (Release 12.1), suitable for a large number of scientific and engineering problems and applications.
The MATLAB’s features include:
- numerical computation routines for calculations with scalars, vectors and matrices
- routings for solving ordinary differential equa-tions numerically,
- 2D and 3D Graphic routines for data visualiza-tion,
- interactive language and programming environ-ment,
- tools for building custom GUIs,
- interface to external languages, like C, Fortran and Java (allows also interaction with e.g. multi-body-simulation environments like ADAMS),
- support for data acquisition and real time control via external toolboxes
The basic MATLAB data elements are scalars, vectors and matrices. MATLAB com-mands are written in a form very similar to that used in mathematics and engineering. For in-stance, b = Ax, where A, b, and x are vectors and matrices, is written "b = A*x". To solve for x in terms of A and b, write "x = A\b". Figure 1 shows a little example directly at the command prompt. There is no need to program matrix operations explicitly like multiplication or in-version. Consequently, solving problems in MATLAB is much faster than programming in a high-level language like C.
Fig. 1: The MATLAB command window
Hundreds of built-in functions come with the basic MATLAB and there are optional (commercial and non-commercial) toolboxes of functions for specific purposes. For automatic control, these are
- Control Systems Toolbox,
- Signal Processing Toolbox,
- Robust Control Toolbox and more.
For fluid power system simulation, you will find
- Simulink and perhaps the
- Hydraulic Block Set Toolbox
of particular interest.
Many of the functions in MATLAB and the toolboxes are written in the MATLAB language where the source code is readable.
3 Simulink
Simulink is an interactive design toolbox for the simulation of linear and nonlinear dynamic systems, available as toolbox at additional charge. The current version is Simulink 4.1. Simulink is a graphical, inter-active program that allows dynamic systems of almost any kind to be modelled by simply drawing a block diagram on the screen. It can handle linear, nonlinear, continuous-time, discrete-time and multivariable sys-tems as well as hybrid systems and conditionally exe-cution. The user has the choice of different integration methods, optimized for different kinds of problems, e.g. stiff systems. He also may choose between fixed and variable time step integration, where Simulink automatically optimises the time step according to desired tolerances. Simulink also supports bitwise logical operators and matrix signals and operations. SIMULINK is fully integrated with MATLAB, and, together with MATLAB and the Control System Tool-box, it gives a complete control system design and analysis environment, not only for fluid power systems but also for almost any problem of automatic control of technical processes.
Fig. 2: The SIMULINK environment
Figure 2 shows a block diagram for the first stage of a hydraulic servo valve (torque motor + flap-per/nozzle system). In this case the stage is simply modelled as a second order PT2 system, were, how-ever, limited integrators as nonlinear elements to in-clude the effects of limited velocity and position re-placed the standard integrators. The elements are sim-ply dragged from the Simulink library window to the block diagram editor and connected to each other. For generating input signals and viewing simulation data (e.g. step response) the Simulink libraries provide a number of input signal generators as well as display blocks for graphs and output blocks to the MATLAB workspace or a file for further processing, like filtering etc. Of course, Simulink also provides functionality for generating subsystems, for masking of subsystems and for the generation of custom libraries. All these func-tions help to keep track of things and the diagram "clean".
Fig. 3: Subsystems in SIMULINK
Even though Simulink is very easy to use and simulation models are created rather quickly, in some cases the block diagram may become very large, although the nonlinear algebraic or differential equations do not look very difficult, e.g. the throttle equation or cylinder friction forces in the equation of motion. For these cases Simulink offers to include C-code (or Fortran or Matlab language) into the block diagrams, called S-functions. When using C-code, these blocks have to be written in a Simulink-accessable format, called CMEX. This method is very simple, since the algebraic and differential equations are written into a template file in a state space like format, which is very familiar to all users with experience in state space sys-tem description and controller design. Figure 4 shows for example the complete code (headers and not re-quired functions are not shown) for a servo pump model used for the C-code block of Fig. 3.
The use of CMEX files has the additional benefit of much faster simulation execution times compared to block diagrams based upon the standard elements only, especially in cases of trigonometric functions of if-then-else-clauses, like needed for modelling saturation effects. For compiling the CMEX files, either the MATLAB C-Compiler (additional charge) or an exter-nal compiler like Microsoft Visual C/C++ can be used.
Fig. 4: CMEX file for pump simulation (C-Code)
It has to be mentioned, that ready-made component toolboxes, like the Hydraulic Block Set Toolbox (which is not very sophisticated from my point of view), are available at additional cost. This allows the user not to model every single component from the very beginning by writing down the differential equa-tions. On the other hand, modelling the system to be investigated from the basics, gives the user a much higher insight into the system’s behaviour and its char-acteristics, which is highly beneficial to controller design approaches, but does also require much more time.
After all, Simulink is a very powerful tool to model even large-scaled systems for dynamic simulations. Complex simulation models, like complete aircraft hydraulic systems, including actuators, aerodynamic forces and controllers or other hydraulic systems found in mobile machines, excavator, wheel loaders etc. can be simulated at very reasonable effort and simulation time. Especially for the last mentioned systems the ability of MATLAB/Simulink to to realize a co-simulation with the multi-body simulation tool AD-AMS has to be pointed out. This allows the simultane-ous simulation of reaction and inertia forces of the mechanical system and the hydraulic actuators.
4 Control System Toolbox
The Control Systems Toolbox is an add-on tool-box for control system design and analysis. It supports transfer functions and state-space forms (continu-ous/discrete time, frequency domain), as well as func-tions for step, impulse and other system responses. Functions for Bode, Nyquist, Nichols plots, design with root-locus, pole-placement, and LQR optimal control are also included. In combination with Simu-link it gives a handsome package for rapid controller design and simulation of controlled systems. Since version 5.x it provides an interactive controller design tool for root locus design, where the user can place controller poles and zeros directly into the s-plane and observe the influences on the root locus trajectories, the Bode plots and the time domain responses immedi-ately.
Fig. 5: Interactive controller design
Figure 5 illustrates this design process. The upper windows shows the root locus design tool, while the lower windows shows the according system step re-sponse of the system. Alternatively, the design tool would also show Bode plots for compensator or the closed loop as well as the Nyquist plot. After importing the open loop transfer function from the MATLAB workspace the design tool shows the root loci of all poles, assuming a proportional controller. The user can now modify the compensator by adding additional poles and zeros, while the tool adjusts the root loci and the plots immediately. This allows the user to study the influence of different control structures simultaneously. However, it has to be mentioned, that only the forward branch of the controller design can be modified inter-actively. Other elements, like pre-filter and sensor dynamics (in the feedback branch) can only be modified by re-importing a new or adjusted transfer function from the MATLAB workspace.
5 Summary
From the user’s perspective MATLAB/ Simulink is an incredible powerful tool for both, simulation of dynamic systems and control system design. It offers an incredible huge range of functions, is easily pro-grammable and extendable. Today, MATLAB can also be used for data acquisition, real time test rig control including hardware-in-the-loop simulation (giving similar benefits as dSpace at significant lower hard-ware costs), image processing, curve fitting, fuzzy logic, DSP programming, generation and control of virtual reality models, neural network design and much more. The key advantages of MATLAB/ Simulink are
- easy to use and efficient user interface,
- interactive design and modelling tools,
- almost unlimited extendibility, via C-Code, com-mercial and non commercial toolboxes and other add-on products,
- excellent documentation and help function.
On the other hand, the MATLAB/ Simulink package has also some disadvantages to keep in mind:
- the costs for a MATLAB license are rather high (especially for commercial users),
- most toolboxes come only at additional charge,
- educational versions (Student Edition and Class-room Kit) are not free of charge,
- the high number of functions makes it difficult for the user to get a complete overview of MAT-LAB’s capabilities.
However, according to The Mathworks, MATLAB has more than 500.000 users today and is used in a wide variety of industrial areas, making it a first choice tool for many engineering problems.
JG
Facts about Matlab, Simulink
| Internet Site |
http://www.mathworks.com |
| Vendor |
The Mathworks, Inc |
| Location |
3 Apple Hill Drive
Natick, MA 01760-2098, USA
|
| Educational Version |
Student Edition, Class Room Kit |
| Telephone number |
+1 508-647-7000 |
| Telefax number |
+1 508-647-7001 |
| E-mail |
info@mathworks.com
|
| Platforms |
All Windows environments, AIX, Digital UNIX, HP-UX, IRIX/IRIX64, Linux, Macintosh 68000, Power Macintosh, Open VMS, Solaris, SunOS |
BACK
©2001 Fluid
Power Net All rights reserved. Disclaimer