# Model-Based Design of a Hydraulic Press

Today guest blogger Arnaud Miege presents a great example of adopting Model-Based Design.

As an application engineer, I meet lots of customers applying MathWorks tools in many different and cool ways. Recently, a customer who manufactures hydraulic components and large-scale hydraulic systems, such as hydraulic presses, wanted to adopt Model-Based Design as part of his development process. We identified with the customer a number of key benefits for doing so:

• Better system simulation to avoid in-field service problems;
• Being able to quickly iterate the design of the system;
• Improving accuracy of the system and reducing overall cost.

In preparation for the visit, I put together a simple demo to showcase some key technical points and illustrate the concept of Model-Based Design. Here’s what the system-level model looks like. It includes a representation of the mechanical assembly, the hydraulic actuation system and the PLC controller:

Hydraulic Press Model

I used SimMechanics to model the mechanical assembly, which allowed me to produce some cool animations, as well as test it by using force actuation and measuring the resulting motion and conversely, constraining the motion to determine the forces required by the hydraulic actuators:

Hydraulic Actuation Model

Once the mechanical assembly has been modeled and validated, we can turn our attention to modeling and designing the hydraulic actuation system with SimHydraulics, starting with one cylinder before scaling up the three required:

We can now integrate the mechanical assembly model with the hydraulic actuation system and close the loop to control the position of the actuator displacements.

Influence of the Pipe Diameter

A typical problem that hydraulic design engineers try to address is to minimize the pipe diameter (to minimize manufacturing costs and/or energy consumption), while maintaining a certain level of performance.

To study this relation, one option is to perform a parameter sweep over a range of pipe diameters to determine the trade-off between energy consumption and rise time. To speed up the process, I used the Parallel Computing Toolbox to distribute the iterations of the model across the multiple cores on my machine. If needed, this can be scaled up to a computer cluster with the MATLAB Distributed Computing Server.

Click to enlarge images.

Pipe Diameter Optimization

To illustrate another option available, I have used Simulink Design Optimization to tune the pipe diameter and controller gains in order to reduce the hydraulic energy consumed by the system below a set threshold, while maintaining the performance requirements on the step response of the system (rise time, overshoot, etc...). Once again, the Parallel Computing Toolbox allowed me to distribute the multiple iterations of the models across the 4 cores of my machine, thereby speeding up the process.

Click to enlarge images.

PLC Implementation

One of the key benefits of Model-Based Design is the return on investment when using automatic code generation for implementation. Here, I have used Simulink PLC Coder to automatically convert the closed-loop control algorithm to hardware-independent IEC 61131 Structured Text (ST). In addition Simulink PLC Coder also allows you to import and verify the generated ST in one of the many supported PLC IDEs.

(* * * File: hyd_press_model.exp * * IEC 61131-3 Structured Text (ST) code generated for Simulink model "hyd_press_model.mdl" * * Model version : 1.215 * Sample time : 0.1s * Simulink PLC Coder version : 1.2 (R2011a) 09-Mar-2011 * ST code generated on : Fri Jun 03 16:57:46 2011 * * Target IDE selection : 3S CoDeSys 2.3 * Test Bench included : No * *) FUNCTION_BLOCK PLC VAR_INPUT ssMethodType: SINT; Positions: ARRAY [0..2] OF LREAL; Setpoint: ARRAY [0..2] OF LREAL; END_VAR ...