You are on page 1of 16

Computer Aided Analysis of a Load-Sensing Circuit Using Modelica and HyLib

FPN Simulation Benchmark (2001)

Peter Beater Universitt - GH Paderborn, Abt. Soest, Germany Lbecker Ring 2, D 59494 Soest

Abstract To solve the FPN Benchmark Problem 2001 a simulation model is built that describes the power hydraulics part very detailed, choosing pump, valves and cylinders from a hydraulics library for Modelica. For the control part a generic LS-Control-System is used, modeled by a set of simple equations. This approach gives the required results and keeps the time needed for analysing the problem on a reasonable level. 1 Introduction There are several approaches when simulating a system. Depending on the task it may be necessary to build a very detailed model, containing every detail of the system and needing a lot of information, e. g. parameters. These kind of models are very expensive but on the other hand very useful if parameters of a well defined system have to be modified. A typical example is the optimization of parameters of a counterbalance valve in an excavator [8]. The other kind of model is needed for a first study of a system. In our case some properties of the pump, cylinders and loads are specified. Required is information about the performance of that system, e. g. the speed of the pistons or the necessary input power at the pump shaft, to make a decision whether this design can be used in principle for the task at hand. This model has therefore to be cheap, e. g. it must be possible to build it in a short time without detailed knowledge of particular components. The author intended to build a model of the second type, run it and have first results with a time of less than ten hours spent. To achieve this goal the modelling language Mode-

- 1 -

lica [18], the tool Dymola [16] and the library of hydraulic components HyLib [17] was used. The model consists of a detailed description of the power hydraulics and a generic LS-system as controller. 2 The proposed Circuit The proposed circuit is given in Fig 1 [15].

Figure 1 Schematic of proposed circuit [15]

Some hard data is given, e. g. cylinder dimensions, loads and maximum pump flow rate. Added is information that is not needed for a first study, but a detailed analysis, e. g. the nominal pressure of the pump and the nominal speed. One attempt could be to make a complete design of the whole system. This would require either a lot of experience with similar systems to have a good estimate of the valve data or a huge amount of work to calculate all the required parameters. However, even then the model would be academic because one very important component, the Diesel engine, is not specified. Neither torque characteristics nor maximum power is known. 3 Generic Load-Sensing System For this study another approach is chosen: Model the cylinder and to a certain extent the pump and metering valve very detailed and use a generic LS-system for control purposes.

This LS-system can be characterized as follows [9]: ! ! ! ! Keep the pressure differential across the metering orifices of the directional valves at a nominal value of 1.5 MPa. Use load compensators if the load pressures of the two cylinders differ. Reduce the nominal pressure differential if the maximum pump flow rate is reached. Limit the maximum pump pressure to 28 MPa. - 2 -

This control system can be set up using meshed control loops. As there is (almost) no way to implement phase shifting behaviour in purely hydraulic control systems the generic LSsystem uses only proportional controllers. To implement it 10 equations and 1 assignment statement are used.

Table 1 Modelica code for definition for constants, parameters and variable // Definition of variables, parameters and constants Real delta_p1; Real delta_p2; Real pump_ls; Real pump_ls1; Real pump_ls2; Real dp_ref(start=15e5); Boolean pump_q_max; Boolean pump_p_max(start=false); parameter Real tau_pump=1e-5; constant Real k_LS=1e-5;

Table 2 Modelica code for LS-Controller // Set of equations to model the LS-controller equation // define pressure differential across the two metering orifices // for load compensator and documentation purposes delta_p1 = if (Z1.outPort.signal[1] <= 0) then Pump.IFE.port_B.p else (MeteringOri1.MOrnS.port_A.p - MeteringOri1.MOrnS.port_B.p); delta_p2 = if (Z2.outPort.signal[1] <= 0) then 0.0 else (MeteringOri2.MOrnS.port_A.p - MeteringOri2.MOrnS.port_B.p); // calculate load pressure for pump controller pump_ls1 = if (Z1.outPort.signal[1] <= 0) then Pump.IFE.port_B.p else (MeteringOri1.port_A.p - Compensator1.port_B.p); pump_ls2 = if (Z2.outPort.signal[1] <= 0) then Pump.IFE.port_B.p else (MeteringOri2.port_A.p - Compensator2.port_B.p); pump_ls = min(pump_ls1, pump_ls2); // define Boolean state for pump controller pump_q_max = k_LS*(15e5 - pump_ls) > 1.7e-3; // calculate command signal for pump Pump.inPort.signal[1] = if pump_p_max then min(1.7e-3, 1.7e-3 + k_LS*1e-2* (280e5 - Pump.IFE.port_B.p)) else if (pump_q_max) then 1.7e-3 else (k_LS*(15e5 - pump_ls)); // modify reference signal if maximum pump flow rate is exceeded dp_ref = if (pump_q_max and not pump_p_max) then pump_ls else 15e5;

- 3 -

Table 2 continued Modelica code for LS-Controller // calculate conductance of pressure compensator Compensator1.InPort1.signal[1] = min(1e-8, max(1e-13, 1e-8 - (delta_p1 - dp_ref)*5e-14)); Compensator2.InPort1.signal[1] = min(1e-8, max(1e-13, 1e-8 - (delta_p2 - dp_ref)*5e-14)); // external force on rods as given in the paper Force1.inPort.signal[1] = -(50e3 - 160e3*(C1.Piston.s*1.25 - 0.5)^2); Force2.inPort.signal[1] = -(30e3 + 80e3*(C2.Piston.s*1.25 - 0.5)^2); // set Boolean state if max. pump pressure is reached algorithm when (not pump_p_max and Pump.IFE.port_B.p > 280e5) then pump_p_max := true; end when;

4 The object-oriented modelling language Modelica The starting point of the development of Modelica in 1996 was the interoperability problem amongst the large variety of modelling and simulation environments available then, especially with the trend towards ever more complex and heterogeneous systems to be simulated. The main cause of this problem was the absence of a state-of-the-art, standardized external model representation. Modelling languages, where employed, often do not adequately support the structuring of large, complex models and the process of model evolution in general. This support is usually provided by sophisticated graphical user interfaces - an approach which is capable of greatly improving the users productivity. Among the recent research results in modelling and simulation, two concepts have strong relevance to this problem: ! Object oriented modelling languages already demonstrated how object oriented concepts can be successfully employed to support hierarchical structuring, reuse and evolution of large and complex models independent from the application domain and specialized graphical formalisms. ! Non-causal modelling demonstrated that the traditional simulation abstraction - the input/output block - can be generalized by relaxing the causality constraints, i.e., by not committing ports to an input or output role early, and that this generalization enables both more simple models and more efficient simulation while retaining the capability to include submodels with fixed input/output roles.

A working group made up of simulation tool builders, users from different application domains, and computer scientists unified the concepts and introduced a common modelling - 4 -

language. This language, called Modelica, is intended for modelling within many application domains (for example: electrical circuits, multi-body systems, drive trains, hydraulics, thermodynamic systems and chemical systems) and possibly using several formalisms (for example: ODE, DAE, bond graphs, finite state automata and Petri nets). Tools which might be general purpose or specialized to certain formalism and/or domain will store the models in the Modelica format in order to allow exchange of models between tools and between users. Much of the Modelica syntax will be hidden from the end-user because, in most cases, a graphical user interface will be used to build models by selecting icons for model components, using dialogue boxes for parameter entry and connecting components graphically [5].

5 The tool Dymola From members of the Modelica Design Group several implementations of Modelica were made. One of the most advanced and for industrial application most suited tools is Dymola [16] from the Swedish company Dynasim. The program was written in 1978 as a research tool [4], became a commercial product in 1992 and supports Modelica since 1999. It offers all standard capabilities of modern simulation programs e. g. computation of steady state, linearisation, runs stable and produces very efficient simulation code. 6 The hydraulics library HyLib To help users to quickly build a model a number of libraries for Modelica is available [7, 18]. Beside the ModelicaStandardLibrary there are dedicated libraries for certain domains, e. g. thermo hydraulic flow or hydraulics [12, 2]. The later is used to model the pump, metering orifice, load compensator and cylinder for the benchmark problem. All these components are standard components for hydraulic circuits and can be obtained from many manufacturers. Models of all of them are contained in the hydraulics library for Modelica, HyLib [2]. These mathematical models include both standard textbook models [e. g. 3, 8, 13] and the most advanced published models that take the behaviour of real components into account [10, 14]. An example is the general pump model where the output flow is reduced if pressure at the inlet port falls below atmospheric pressure. Numerical properties were also considered when selecting a model [1]. One point worth mentioning is the fact that all models can be viewed at source code level and are documented by approx. 100 references form publicly available literature. - 5 -

After opening the library the main window is displayed (Fig. 2). A double click on the pumps icon opens the selection for all components that are needed to originate or end an oil flow (Fig. 3).

Fig. 2 Overview of Hydraulics library HyLib

Fig. 3 Pump models in HyLib

For the benchmark problem a hydraulic flow source with internal leakage and externally commanded flow rate was used. The left blue triangle is a connector for a signal input, giving the commanded flow rate. The right red square is a connector for the hydraulic pressure and the flow rate.

Fig. 4 Icon for pump model

The metering orifice in the directional valve can be modeled with the library model
MeteringOrifice that describes the relation between flow rate and pressure drop.

Fig. 5 Icon for model of metering orifice

- 6 -

Most textbooks and simulation packages use the simple equation: Q = A Cd 2 P (1)

with: Q flow rate through orifice, 2 A = D 0 / 4 area, Cd discharge coefficient, fluid density, P = P1 - P2 pressure differential.

The gain of the orifice, i. e. dQ / d(P), is given by: 2 d A C d P A C d 2 dQ = = d P d P 2 P o p


with: P op pressure drop evaluated at the operating point.

(2)

Equation 2 shows that the gain goes to infinity as the pressure drop P|op goes towards zero. The reason for this effect is the fact that Equ. 1 is a good model for turbulent flow but a very bad one for laminar which exists for small values of P. Another effect is that the infinite gain may lead to severe numerical problems for algorithms with variable step size. In the library a model based on the former German national standard TGL 38188 [11] is used. The cylinder can be modeled with the library model Cylinder, see Fig. 6. An object diagram of this model is given in Fig. 7. The complete mass of the moving parts is lumped into the Piston.

- 7 -

Fig. 6 Model of cylinder

Fig. 7 Object diagram of library model Cylinder

Modelica is an object-oriented language that supports hierarchical modelling of physical systems. For the cylinder that means that the component consists of several simple submodels, both from the mechanical and the hydraulic domain. Figure 7 shows the object diagram of the cylinder. The green connectors and connection lines are mechanical parts, the red ones are hydraulic components. This is an example how complicated systems can be easily composed from the libraries using the graphical interface. For submodels it is usually more convenient to use textual input instead of graphical icons as the next section demonstrates. 7 Hierachical modelling A very simple hydraulic component is a restriction with laminar flow. In the cylinder model one is used to describe the leakage between the two chambers. The LaminarResistance is a typical example of a component that has two ports. To get a structured library it makes sense to start modelling this kind of component with a class that models a component with two ports and no energy storage (s. Fig. 9). The Modelica code looks like (graphical information omitted)
model TwoPortComp Superclass of circuits with TWO hydraulic ports Modelica.SIunits.Pressure dp Pressure drop; Modelica.SIunits.VolumeFlowRate q Flow rate through component; Modelica.SIunits.Pressure pA_limited; Modelica.SIunits.Pressure pB_limited; HyLib.Interfaces.Port_A port_A Port A, were oil flows into the component ;

- 8 -

HyLib.Interfaces.Port_B port_B Port B, were oil leaves the component; equation pA_limited = max(port_A.p, HyLib.Interfaces.FluidProp.pvapour); pB_limited = max(port_B.p, HyLib.Interfaces.FluidProp.pvapour); dp = pA_limited - pB_limited; q = port_A.q; port_A.q + port_B.q = 0; end TwoPortComp;

It is worth to note that Modelica uses equations and not assignment statements as programming languages usually do. That means that the sequence of equations in a model doesn't matter. It also means that every variable has to be defined by exactly one equation; the number of variables and the number of equations must be equal. The symbolic engine that makes this modelling approach possible can also break algebraic loops, either by solving the system of (linear) equations or by numerical iteration. This capability enables the modeller to just write the equations without having to simplify of solve them by hand. The equations of the generic LS-system are a good example. With block-oriented, assignment statements using simulation languages this time-saving way could not be used. The max operator limits the lower value of the pressure because the pressure of a technical fluid cannot fall below vapour pressure; a technical fluid can transmit only positive forces. This is a very crude model of the very complex effects of cavitation but is has proven helpful especially when starting a simulation.

Fig. 8 Object diagram of TwoPortComp

Using this class it is simple to model a laminar resistance. Only the equation that describes the relation between pressure drop P (already defined as dp and computed) and flow rate q has to be added. The key word for this inheritance is extends.
model LamResNoStates Resistance with laminar flow. extends HyLib.Interfaces.TwoPortComp; parameter HyLib.Interfaces.HyLibUnits.Conductance G=4.2e-13 conductance of laminar resistance; equation q = G*dp; end LamResNoStates;

The class TwoPortComp can also be used for other components, e. g. a relief valve. The example shows how easy relations can be expressed in Modelica (if ... then ... else). These

- 9 -

statements are translated into elaborated machine code that uses switching functions and not the simple if ... then ... else statements from programming languages.
model ReliefValveNoStates Ideal model of a relief valve. extends HyLib.Interfaces.TwoPortComp; parameter Modelica.SIunits.Pressure pclosed(final min=0) = 190e5 valve closed if dp smaller; parameter Modelica.SIunits.Pressure popen=205e5 valve wide open if dp higher; parameter HyLib.Interfaces.HyLibUnits. Conductance GLeak=1.111e-12 conductance of closed valve, i. e. leakage; parameter HyLib.Interfaces.HyLibUnits. Conductance GOpen=1.666e-9 conductance of wide open valve; Boolean closed(start=false) closed: .true. => valve closed, only leakage; Boolean open(start=false) open : .true. => valve wide open; equation closed = dp < pclosed; open = dp > popen; q = if closed then dp*GLeak else if open then (dp - pclosed)*GOpen + dp*GLeak else (dp - pclosed)^2*GOpen/(popen pclosed) + dp*GLeak; assert(popen > pclosed, Parameter popen MUST be greater than parameter pclosed.); end ReliefValveNoStates;

The relief valve model uses an assert statement to make sure that the selected parameters make sense. The pressure that opens the valve completely must be greater than the pressure when the valve is completely closed. The discrete states closed and open help the user to determine the state of the valve during a simulation run. These kind of models (Fig. 9) can already be used to build a system and are contained in the Basic library windows. When connecting them to a system the user has to add manually lumped volumes to model the pressure dynamics, however. The ports of a real component are oil filled and therefore lumped volumes are added at the ports for the main library model
LamRes (Fig. 10) or ReliefValve.

Fig. 9 Library model of a laminar resistance, LamResNoStates

Fig. 10 Main Model, volumes (states) at the ports, LamRes

- 10 -

This approach makes it very easy to build a model because the user only has to select components, input parameters and connect them. The user doesnt have to include lumped volumes as with other hydraulic simulation packages. The reason that it can be done this way is that Dymola can cope with the resulting higher index system. During the system analysis Dymola finds volumes that are connected in parallel and lumps them together. 8 Computer Model of Benchmark Problem

Fig. 11 Object diagram of simulation model

The object diagram in Fig. 11 shows the graphically composed part of the model. The submodels were chosen from the appropriate libraries, connected and the parameters input. As the friction model of the cylinder supports only speed dependent (viscous) friction a submodel from the translational Modelica library was added to model a constant friction force of 4,000 N that the author has identified in cylinders of this size and this application area (excavators). The input signals Z1 and Z2 are given by the tables, specifying the diameter of the metering orifice. The maximum diameter was calculated to be 5.75 mm and a linear interpolation between the given points was used. To demonstrate how simple signal processing can be implemented the calculation of the hydraulic power is shown. Two measuring devices give the pressure and flow rate, re-

- 11 -

spectively, and those values are multiplied. Another approach was used for Fig. 15 were the pressure and flow rate trajectories from the simulation were used for a post processing with a detailed mathematical model of the torque and volumetric losses of a typical pump [1]. This mixed approach - simple loss model in the simulation and detailed one afterwards - has proven to be very time efficient. A detailed pump model would have increased the simulation time considerably. The generic LS controller uses the variables from the hydraulic part. They can be accessed directly, using a dot notation. The pressure at port A of the first metering orifice is named MeteringOri1.port_A.p. The calculated values of the controller, e. g. the pump flow rate, is input at the filled blue triangles, e. g. Pump.inPort.signal[1] = ... . The mathematical effort to analyse the textual and graphical input and set up a system of equations that can be successfully solved numerically is immense. The user doesn't notice that however. For the model in Fig. 11 translation of the Modelica model to C code, compiling and linking takes 12 s on a Pentium III with 566 MHz, simulating the model for 9 s takes 10 s computing time. All this is simply done by pressing the appropriate buttons. Then Dymola starts, giving the following message:
- translateModel("BenchA") Translation started DAE with 371 unknown scalars and 371 scalar equations. 11 constants found. 33 parameter bound variables found. 151 alias variables found. 176 remaining time dependent variables.

The next step is the index reduction, i. e. lumping directly connected volumes together. An example is:
Constraint equation found. Reduced state space. equation MeteringOri2.VolumeA.port_A.p = MeteringOri1.VolumeA.port_A.p; Non-state variable chosen: MeteringOri2.VolumeA.port_A.p Differentiated the equation MeteringOri2.VolumeA.port_A.p = MeteringOri1.VolumeA.port_A.p; giving der(MeteringOri2.VolumeA.port_A.p) = der(MeteringOri1.VolumeA.port_A.p);

- 12 -

Finally there are 11 states left for the simulation model


/* There are 11 continuous time states: Stop2.s Stop2.v C2.Chamber_B.port_A.p C2.Chamber_A.port_A.p Stop1.s Stop1.v C1.Chamber_B.port_A.p MeteringOri1.VolumeB.port_A.p C1.Chamber_A.port_A.p MeteringOri2.VolumeB.port_A.p MeteringOri1.VolumeA.port_A.p End of list of continuous time states. */ Finished

9 Results Two typical results are shown in Fig. 12 and 13. Plotted are the position of the cylinders and the relevant pressure, i. e. pump pressure, pressure in cylinder chambers, pressure differential across the metering orifices. Used are SI-Units.

Fig. 12 Simulation result from Dymola. Piston position in m over time in s

- 13 -

Fig. 13 Simulation result from Dymola. Pressures in Pa over time in s

The required plots of the velocity of the cylinders in cm/s and the power on the pump shaft were made with Matlab to have the required scaling of the variables and a postprocessing of the simulation result for the power, respectively. The required data was read from a file in Matlab-format generated by Dymola.

35 30 25 Velocity in cm/s 20 15 10 5 0 0 1 2 3 4 5 6 Time in s 7 8 9 10 cylinder 1 cylinder 2

60

50 Power on pump shaft in kW

40

30

20

10

0 0 1 2 3 4 5 6 Time in s 7 8 9 10

Fig. 14 Velocity of cylinders, experiment A

Fig. 15 Power on the pump shaft, experiment A

- 14 -

35 30 25 20 15 10 5 0 0 1 2 3 4 5 Time in s 6 7 8 9 10 cylinder 1 cylinder 2

60

50 Power on pump shaft in kW

40

Velocity in cm/s

30

20

10

0 0 1 2 3 4 5 Time in s 6 7 8 9 10

Fig. 16 Velocity of cylinders, experiment B

Fig. 17 Power on the pump shaft, experiment B

10 Conclusion Using a modern simulation tool a model was built that describes the behaviour of the cylinders very detailed while using a generic LS-system as controller. The model uses both a graphical interface for standard hydraulic or mechanical components and a textual input for the specific control algorithms. This approach made it possible to give an answer to the posted questions in reasonable time. References
[1] Beater, P. (1999) Entwurf hydraulischer Maschinen Modellbildung, Stabilittsanalyse und Simulation hydrostatischer Antriebe und Steuerungen. Springer Verlag. [2] Beater, P. (2000) Modeling and Digital Simulation of Hydraulic Systems in Design and Engineering Education using Modelica and HyLib. pp. 33 - 40. Modelica Workshop 2000, October 23 24, 2000, Lund, Sweden. [3] Dransfield, P. (1981) Hydraulic Control Systems - Design and Analysis of Their Dynamics. Springer, Berlin, Heidelberg New York. [4] Elmqvist, H. (1978) A Structured Model Language for Large Continous Systems. . PhD-Thesis Lund Institute of Technology, Lund, Sweden. [5] Elmqvist, H., B. Bachmann, F. Boudaud, J. Broenink, D. Brck, T. Ernst, R. Franke, P. Fritzson, A.Jeandel, P. Grozman, K. Juslin, D. Kgedahl, M. Klose, N. Loubere, S. E. Mattsson, P.Mostermann, H. Nilsson, M. Otter, P. Sahlin, A. Schneider, H. Tummescheit, H.Vangheluwe. (1999) Modelica - A Unified ObjectOriented Language for Physical Systems Modeling.TUTORIAL and RATIONALE. Version 1.3. December 15, 1999. [6] Kraft, W. (1996) Experimentelle und analytische Untersuchungen hydrostatischer Fahrantriebe am Beispiel eines Radbaggers. PhD-Thesis RWTH Aachen, Germany.

- 15 -

[7] Larsson, M. (2000) ObjectStab - A Modelica Library for Power System Stability Studies. pp. 13 - 22. Modelica Workshop 2000, October 23 24, 2000, Lund, Sweden. [8] Merrit, H. E. (1967) Hydraulic Control Systems. New York: John Wiley & Sons. [9] Nikolaus, H. W. (1994) Loadsensing - lastunabhngige Dosierung von Verbraucherstrmen. lhydraulik und Pneumatik, o+p, 38, pp. 196- 201. [10] Schulz, R. (1979) Berechnung des dynamischen Verhaltens hydraulischer Antriebe groer Leistung fr Umformmaschinen. PhD-Thesis. RWTH Aachen. [11] TGL 38 188. (1982) Widerstandscharakteristik fester hydraulischer Widerstnde - Ermittlung. [12] Tummescheidt, H. (2000) Development of a Modelica Base Library for Modeling of Thermo-hydraulic Systems. pp. 41 - 52. Modelica Workshop 2000, October 23 24, 2000, Lund, Sweden. [13] Viersma, T. J. (1980) Analysis, Synthesis and Design of Hydraulic Servosystems and Pipelines. Amsterdam: Elsevier Scientific Publishing Company. [14] Will, D. (1968) Der Einflu der ltemperatur auf das Durchfluverhalten von Drosselventilen unter besonderer Bercksichtigung der Kavitation. PhD thesis. Technische Universitt Dresden. [15] FPN Simulation Benchmark (2001). Bench case problem for 2nd Intl Workshop on Computer Software for Fluid Power Systems. Malenovice, Czech Republic, September 5-7, 2001, http://fluid.power.net/fpn/simula2001/Bench_2000.pdf . [16] www.Dynasim.se [17] www.HyLib.com [18] www.Modelica.org

- 16 -

You might also like