{"id":146,"date":"2011-07-11T18:33:16","date_gmt":"2011-07-11T18:33:16","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/2011\/07\/11\/model-based-design-of-a-hydraulic-press\/"},"modified":"2017-01-04T15:27:46","modified_gmt":"2017-01-04T20:27:46","slug":"model-based-design-of-a-hydraulic-press","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2011\/07\/11\/model-based-design-of-a-hydraulic-press\/","title":{"rendered":"Model-Based Design of a Hydraulic Press"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/ArnaudMiege.png\" alt=\"Arnaud Miege, guest blogger\" style=\"float: left; margin-right: 1em;\">\r\n\r\nToday guest blogger <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/63166-arnaud-miege\">Arnaud Miege<\/a> presents a great example of adopting Model-Based Design.\r\n\r\n\r\n<br><br>\r\n\r\nAs 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: <\/p>\r\n\r\n<ul>\r\n\t<li>Better system simulation to avoid in-field service problems;<\/li>\r\n\t<li>Being able to quickly iterate the design of the system;<\/li>\r\n\t<li>Improving accuracy of the system and reducing overall cost.<\/li>\r\n<\/ul>\r\n\r\n\r\n<p>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\u2019s what the system-level model looks like. It includes a representation of the mechanical assembly, the hydraulic actuation system and the PLC controller:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/MainModel.png\" alt=\"Simulink model representing an hydraulic press\"><\/p>\r\n\r\n<p><strong>Hydraulic Press Model<\/strong><\/p>\r\n\r\n<p>I used <a href=\"https:\/\/www.mathworks.com\/products\/simmechanics\/\">SimMechanics<\/a> 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:<p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/hydraulic_press.gif\" alt=\"SimMechanics animation of an hydraulic press\">\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/hydraulic_press_2.gif\" alt=\"SimMechanics animation of an hydraulic press\"><\/p>\r\n\r\n<p><strong>Hydraulic Actuation Model<\/strong><\/p>\r\n\r\n<p>Once the mechanical assembly has been modeled and validated, we can turn our attention to modeling and designing the hydraulic actuation system with <a href=\"https:\/\/www.mathworks.com\/products\/simhydraulics\/\">SimHydraulics<\/a>, starting with one cylinder before scaling up the three required:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/simHydraulicsNetwork.png\" alt=\"SimHydraulics model of an hydraulic press\"><\/p>\r\n\r\n<p>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.<\/p>\r\n\r\n<p><strong>Influence of the Pipe Diameter<\/strong><\/p>\r\n\r\n<p>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. <\/p>\r\n\r\n<p>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 <a href=\"https:\/\/www.mathworks.com\/products\/parallel-computing\/\">Parallel Computing Toolbox<\/a> 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 <a href=\"https:\/\/www.mathworks.com\/products\/distriben\/\">MATLAB Distributed Computing Server<\/a>.<\/p> \r\n\r\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/parameterSweep_full.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/parameterSweep.png\" alt=\"Pipe diameter study for an hydraulic press\"><\/a>\r\n<a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/EnergyConsumption_full.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/EnergyConsumption.png\" alt=\"Energy consumption study for an hydraulic press\"><\/a><br>\r\n<em>Click to enlarge images.<\/em><\/p>\r\n\r\n<p><strong>Pipe Diameter Optimization<\/strong><\/p>\r\n\r\n<p>To illustrate another option available, I have used <a href=\"https:\/\/www.mathworks.com\/products\/sl-design-optimization\/\">Simulink Design Optimization<\/a> 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 <a href=\"https:\/\/www.mathworks.com\/products\/parallel-computing\/\">Parallel Computing Toolbox<\/a> allowed me to distribute the multiple iterations of the models across the 4 cores of my machine, thereby speeding up the process.\r\n\r\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/top_position_full.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/top_position.png\" alt=\"Optimization for an hydraulic press\"><\/a>\r\n<a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/ModelOptimization_full.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/ModelOptimization.png\" alt=\"Energy consumption optimization for an hydraulic press\"><\/a><br>\r\n<em>Click to enlarge images.<\/em><\/p>\r\n\r\n<p><strong>PLC Implementation<\/strong><\/p>\r\n\r\n<p>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 <a href=\"https:\/\/www.mathworks.com\/products\/sl-plc-coder\/\">Simulink PLC Coder<\/a> 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.\r\n\r\n<p><code>(*<br>\r\n *<br>\r\n * File: hyd_press_model.exp<br>\r\n *<br>\r\n * IEC 61131-3 Structured Text (ST) code generated for Simulink model \"hyd_press_model.mdl\"<br>\r\n *<br>\r\n * Model version                   : 1.215<br>\r\n * Sample time                     : 0.1s<br>\r\n * Simulink PLC Coder version      : 1.2 (R2011a) 09-Mar-2011<br>\r\n * ST code generated on            : Fri Jun 03 16:57:46 2011<br>\r\n *<br>\r\n * Target IDE selection            : 3S CoDeSys 2.3<br>\r\n * Test Bench included             : No<br>\r\n *<br>\r\n *)<br>\r\nFUNCTION_BLOCK PLC<br>\r\nVAR_INPUT<br>\r\n    ssMethodType: SINT;<br>\r\n    Positions: ARRAY [0..2] OF LREAL;<br>\r\n    Setpoint: ARRAY [0..2] OF LREAL;<br>\r\nEND_VAR<br>\r\n...<br>\r\n<\/tt><\/code><\/p>\r\n\r\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q2\/PLCCode.txt\">Click here to view the full generated code for this example<\/a><\/p>\r\n\r\n<p><strong>Now it\u2019s your turn<\/strong><\/p>\r\n\r\n<p>What is your process for developing and implementing a control strategy on a PLC?  How do you tune the control algorithm?  Do you use simulation or tune the system on site while commissioning the PLC installation?  Tell me about it in a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=146&#comment\">comment here<\/a>.<\/p>\r\n\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>\r\n\r\nToday guest blogger Arnaud Miege presents a great example of adopting Model-Based Design.\r\n\r\n\r\n\r\n\r\nAs an application engineer, I meet lots of customers applying MathWorks tools in many different... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2011\/07\/11\/model-based-design-of-a-hydraulic-press\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[21,65,24,39],"tags":[207,208,209,79],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/146"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=146"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/146\/revisions"}],"predecessor-version":[{"id":6240,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/146\/revisions\/6240"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}