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.

HOPSAN
Simulation Environment for Fluid Power Systems


The HOPSAN simulation package has been developed at the division of Fluid- and Mechanical Engineering Systems, Linköping University, since 1977. It was developed from the onset for modelling, simulation and analysis of hydraulic systems. Over the years it was developed to a more general environment for system development. As a result it is now a package with a comprehensive library of models, and a set of powerful analysis tools. HOPSAN has been used extensively at several companies and in a range of thesis projects and is freely available.

Introduction

A unique feature of HOPSAN is that it does not make use of a centralised solver. Rather, the component- and subsystem models have embedded solvers and are connected through so called bi-lateral delay lines. These lines correspond to physical components with wave propagation, such as pipes, rods, hoses and wires.

The lines provide numerical robustness and the possibility to use large time steps in simulation. This leads to high simulation performance that scales linearly to the model size and have predictable and consistent numerical properties.
The high and predictable performance of HOPSAN makes it suitable for real-time applications and optimisation. The optimisation algorithms that have been implemented in HOPSAN provide the possibility to optimise the behaviour of a system, subject to constraints. Optimisation can also be used for off-line parameter estimation, where the algorithm compares the results from a simulation with a measurement and minimises the differences.

To perform simulation experiments in an efficient way there is a powerful command interpreter. This enables, for instance, automated simulation series for parameter variation studies. There are also interesting post processing tools such as frequency analysis and the possibility to transfer data to Matlab.

Although a great deal of progress has been made in tools for defining system-level models for simulation, creating the components at the detailed equation level is still a rather unsupported task. This has been addressed in the HOPSAN case through the use of Mathematica as a code generator for component models.

Finally, HOPSAN is equipped with a flexible interface towards other simulation environments. The complete command interpreter and thus most of the functionality of HOPSAN is available through a messagepassing solution which makes it possible to, for instance, perform coupled simulation with ease.

Working with HOPSAN

The HOPSAN software has a graphical user interface in which component models can be combined into system models, such as the pump servo in Fig. 1. Each component picture represents a Fortran subroutine. The code for such a model can be generated from the component generator in Mathematica, or by hand. Subsystems can also be created from a system model using the HOPSAN graphical user interface by combining existing components. The latter approach is suitable for beginners and can be used for example to create complex pressure-compensated pumps and valves from standard components. Since the generated components have embedded solvers, they can be run at their own, and possibly with a different (smaller) time step than the over all simulation loop. This leads to improved simulation performance compared to the case where one time step is used for all component models. The picture for a component can be customized by providing a Windows Meta File (WMF).



Fig. 1: A HOPSAN system model

The component models can be grouped arbitrarily into libraries, which are shown graphically as in Fig. 2. The standard library contains




Fig. 2: A HOPSAN component library

After simulation, the results can be plotted as shown in Fig. 3 using a dedicated post-processing utility. This application can be used to combine and compare the simulation results of different models and simulation generations and be used to plot Bode and Nyquist diagrams for any model part of interest.



Fig. 3: The plotting and post-processing utility

Component model generator

Although a great deal of progress has been made in tools for defining system-level models for simulation, creating the components at the detailed equation level is still a rather unsupported task.Particularly in the case where the models have embedded solvers, it may take considerable effort and skill to create even rather simple component models. The advent of symbolic math programs represents a breakthrough in this area since they can be used to transform an equation-based representation into a mathematical implementation of the component in an automated fashion. The use of symbolic math packages finally allows for the implementation of efficient numerically robust methods even for highly non-linear systems.

In case the user needs a new model not existing in the library, he/she can make use of a component model creator. In HOPSAN this is a program in Mathematica, see Fig. 4. The model and its documentation are written in an acausal form, just by writing down the equations needed, from which the generator delivers a working model. As Mathematica makes use of symbolic algebra the code generated will be very robust. For more details, see (Krus, 1996). Below is an excerpt from a model describing a pressure relief valve.



Fig. 4: A part of the Mathematica code generator program

Once the model is tested it can be connected to the user component library as a special purpose model. If the model is considered to be of general interest it can later on be included in the standard component library.

How HOPSAN works

In a contact between two parts of a physical system,the "information" of flow and pressure, in the hydraulic case, flows continuously in time in both directions. If the two parts are separated by an element of a certain length in space, the information will still propagate continuously but with a time delay between the two ends determined by the speed of sound and the element length. In the hydraulic case, such an element could be a volume, as is illustrated in Fig. 5. In the figure, q(t) is the incoming flow, p(t) is pressure and c(t) is the information flow through the element. The indexes 1 and 2 indicate the two parts that are connected.



Fig. 5: A fluid volume as an information carrier

The time delays present in physical systems is exploited for simulation in the method of bilateral delay lines, first described in (Auslander, 1968). The equations describing these lines are explored below and brought into the context of HOPSAN, as was shown in (Krus et al, 1990).
If an infinite number of inductance and capacitance elements are connected in series, and the relation between pressure and flow, in the hydraulic case, are derived, the following expressions are found.

p1(t)=Zcq1(t)+p2(t-T)+Zcq2(t-T) (1)

p2(t)=Zcq2(t)+p1(t-T)+Zcq1(t-T) (2)

The time it takes for information to travel from one end to the other is denoted T. The parameter Zc is T over C where C is the capacitance of the line, which in this case is volume over bulk modulus. Let us now denote the old information from node 1 with c2 and from node 2 with c1. These "waves" of information are shown in Fig. 5 and are expressed below.

c1(t)=p2(t-T)+Zcq2(t-T) (3)

c2(t)=p1(t-T)+Zcq1(t-T) (4)

Equations (1) and (2) then become

p1(t) = Zcq1(t)+ c1(t) (5)

p2(t) = Zcq2(t)+ c2(t) (6)

So, if two components in HOPSAN are connected by such a delay line, the pressure and flow in one of them can be computed given the pressure and flow from the other the time T earlier. The components have been made decoupled without worsening the overall numerical convergence. This allows for parallel computation, see (Jansson et al, 1991). Also, increasing the time step results in increased lengths of the delay lines and thus larger inertias, rather than the exponentially increasing numerical error that is often the result in coupled simulation.

Simulation-Based Optimisation


The high efficiency of the HOPSAN package allowed for simulation based direct optimization at an early stage. Such direct optimisation methods require that the object function (minimization criteria) is evaluated using simulation a large number of times, but they are very attractive since they can optimise complete non-linear systems and do not rely on grossly simplified models as more analytical methods do. The general increase in hardware performance has further emphasized that design methods based on different kinds of direct optimisation for system design, are becoming more important. This is done within the HOPSAN package where it has been shown that optimisation can be used both for parameter optimisation and for component sizing, see (Krus et al, 1991).

In order to optimise the servo system in Fig. 6, an object function has to be defined. This can to a large extent be done in the graphical user interface. In this case the servo is optimised for control accuracy, load pressure oscillation and power consumption. In general the requirements of a position servo are such that it must reach a reference position in a certain time and after that the position error should be small.



Fig. 6: Simulation model of a servo with calculation of object function

If both input- and output spectra is known, thetransfer function can be calculated as



Fig. 7:Evolution of objective function and one of the parameters (dashed)



Fig. 8:Transfer function analysis of a hydraulic servo. The time domain result is shown to the left. The open and closed loop transfer functions are shown in the middle. The corresponding Nyquist diagram is shown to the right

Frequency analysis

Frequency analysis is one example of post processing being of great value as fluid power systems are often used for control purposes and the design of such systems requires the access to frequency analysis.

In the frequency domain the output spectra can be written as a function of the transfer function G and the input spectrum U.

If both input- and output spectra is known, the transfer function can be calculated as

If a signal y is known in the time domain, the spectra can be obtained using the Fourier transform of the time signal.

An effective algorithm for this is the Fast Fourier transform FFT. The transfer function can then be calcualted as

In this way open and closed loop transfer functions can be calculated directly from simulated results. Some restrictions should be noted. The transfer function is valid in a strict sense, only if the system is linear, which is usually not the case, therefore care must be taken when interpreting the results. Nevertheless, this has been proven to be a very useful tool since it does not rely on a simplified linear model. Figure 8 shows a simulation of the hydraulic servo in Fig. 6 with the corresponding open and closed loop transfer functions. More details on the integrated use of frequency analysis in measurements and simulation is found in (Krus et al, 1986; Krus et al 1989).

Application Interface

When a simulation is initiated in HOPSAN, the choice exists to run it as a coupled simulation. In the latter case, HOPSAN makes itself available to other applications by the use of simple function calls through a DLL file or direct socket communication from the same or other computers. The other applications then send string-based messages and receive feedback in terms of for example the value of a variable. It is the built-in command interpreter of HOPSAN that receives the messages, so most of the commands of HOPSAN are available. One such command continues the simulation from where it ended last time HOPSAN was called and continues to a certain end time. This makes it possible to perform coupled simulation and has been implemented towards Matlab/Simulink and Microsoft Excel.

Through Matlab it is possible to connect also to other application such as ADAMS, which was exploited in the simulation of a complete wheel loader. The models are shown in Fig. 9. In that project, the hydraulics system was simulated in HOPSAN, the driveline in Simulink and the chassis in ADAMS. The models were connected by delay lines to improve the numerical properties of the simulation. Without the delay lines, the simulation produced an increasing numerical error, but with them, a fast simulation with a satisfactory error level was produced, as is discussed in (Larsson, 2003).





Fig. 9b:The HOPSAN and ADAMS models of a coupledsimulation of a wheel loader

The Excel connection, which consists of a small Visual Basic macro in Excel, has been used to perform coupled simulation with Working Model. This is a solution that works for simpler mechanisms where interactivity is of value. In the example below, the valve position is controlled during simulation by the user from the interface in Working Model.



Fig. 10:Coupled simulation involving HOPSAN, Excel as a flexible "signal router" (not shown) and Working Model for the mechanical model


On-going development: Modelith

There is an increasing need for portable simulation models, that is, that they can be run and edited in various simulation environments. This can be achieved if the models are written in acausal form. This means that the models are defined by equation sets rather than by explicit computations. One example of such a way of defining models is the equation-based modelling language Modelica, which is the source of inspiration in this case. Efforts are thus made to provide the tools needed to utilize an XML-based Modelica-like representation as a means of neutral storage of simulation models. These efforts are summarized in the project name Modelith. One thing missing today is how to make use of one and the same component-level model in several simulation environments without the need to redefine the model. This and related issues are discussed in (Larsson et al, 2002; Larsson, 2003).

Conclusions

The HOPSAN package has been developed as a research platform during nearly three decades. It has been used to develop methods for component based system modelling and for distributed solvers. Parallel simulation has also been demonstrated. Furthermore, hardware in the loop simulation and efficient methods for co-simulation where other simulation packages has been used to simulate parts of the system has also been developed. HOPSAN also includes tools for postsimulation analysis and for simulation based optimisation. The present thrust is towards connectivity with other simulation environments and design tools.

Acknowledgements

The work presented in the paper is a joint effort between of many phd-students and researcher at the Linköping University. Major contributions has been made, apart from the authors (Jonas Larsson, Petter Krus and Jan-Ove Palmberg), by Leif Jansson, Per-Axel Roth, Arne Jansson, Kenneth Weddfedt, Magnus Sethson, and Magnus Elfving.

References



Auslander, D.M. 1968. Distributed System Simulation with Bilateral Delay-Line Models, Journal of Basic Engineering, Trans. of ASME, Vol. 90, pp. 195- 200.

Jansson, A., Krus, P. and Palmberg, J-O. 1991. Real Time Simulation Using Parallel Processing, Proceedings of The 2nd Tampere International Conference on Fluid Power, Tamerfors Finland.

Krus, P. and Palmberg J-O. 1986. Simulation of Fluid Power Systems in the Time and Frequency domains, Proceedings of the 7 th International Fluid Power Symposium BHRA, Bath, UK.

Krus, P. and Palmberg, J-O. 1989. Integration of Simulation and Measurement in Time and Frequency Domains, Proceedings of the International Conference on Fluid Power Transmission and Control, Zhejiang University Hangzhou, China.

Krus, P., Jansson, A., Palmberg, J-O. and Weddfelt,K. 1990. Distributed Simulation of Hydromechanical Systems, Proceedings of the Third Bath International Fluid Power Workshop, Bath, UK.

Krus, P., Jansson, A. and Palmberg, J-O. 1991. Optimizationfor Component Selection in Hydraulic Systems, Proceedings of the Fourth Bath International Fluid Power Workshop, Bath, UK.

Krus, P. 1996. An Automated Approach for Creating Components and Subsystems for Simulation of Distributed Systems, Proceeedings of the Nineth Bath International Fluid Power Workshop, Bath, UK.

Larsson, J., Johansson, B., Krus, P. and Sethson, M. 2002. Modelith: A Framework Enabling Tool- Independent Modelling and Simulation, Proceedings of the European Simulation Symposium 2002, Dresden, Germany, SCS Europe BVBA.

Larsson, J. 2003. Interoperability in Modelling and Simulation, Dissertation, Linköping Studies in Science and Technology, Dissertation No. 854, Linköping University, Linköping, Sweden.


 

BACK



©2005 Fluid Power Net All rights reserved. Disclaimer