Hydraulic actuator exerting force in both directions
Hydraulic Cylinders

The Double-Acting Hydraulic Cylinder block models a device that converts hydraulic energy into mechanical energy in the form of translational motion. Hydraulic fluid pumped under pressure into one of the two cylinder chambers forces the piston to move and exert force on the cylinder rod. Double-acting cylinders transfer force and motion in both directions.
Connections R and C are mechanical translational conserving ports corresponding to the cylinder rod and cylinder clamping structure, respectively. Connections A and B are hydraulic conserving ports. Port A is connected to converter A and port B is connected to converter B.
The energy through hydraulic port A or B is directed to the appropriate Translational Hydro-Mechanical Converter block. The converter transforms hydraulic energy into mechanical energy and accounts for the fluid compressibility in the cylinder chamber. The rod motion is limited with the mechanical Translational Hard Stop block in such a way that the rod can travel only between cylinder caps.
The piston displacement is measured as the position at port R
relative to port C. The Cylinder orientation
identifies the direction of piston displacement. The piston displacement is neutral, or
0, when the chamber A volume is equal to the chamber dead volume. When
displacement is received as an input, ensure that the derivative of the position is equal to
the piston velocity. This is automatically the case when the input is received from a Translational Multibody Interface block connection to a
Simscape Multibody joint.
The model of the cylinder is built of Simscape™ Foundation library blocks. The schematic diagram of the model is shown below.

No leakage, internal or external, is taken into account.
No loading on piston rod, such as inertia, friction, spring, and so on, is taken into account. If necessary, you can easily add them by connecting an appropriate building block to cylinder port R.
Chamber A effective piston area. The default value is 1e-3
m^2.
Chamber B effective piston area. The default value is 0.5e-3
m^2.
Piston maximum travel between caps. The default value is 0.1
m.
Fluid volume in chamber A that remains in the chamber after the rod is fully
retracted. The default value is 1e-4 m^3.
Fluid volume in chamber B that remains in the chamber after the rod is fully
extended. The default value is 1e-4 m^3.
Gas-specific heat ratio for the Hydraulic Piston Chamber blocks. The default value
is 1.4.
Specifies cylinder orientation with respect to the globally assigned positive
direction. The cylinder can be installed in two different ways, depending upon whether
it exerts force in the positive or in the negative direction when pressure is applied
at its inlet. If pressure applied at port A exerts force in negative direction, set
the parameter to Pressure at A causes negative displacement of R relative to
C. The default value is Pressure at A causes positive
displacement of R relative to C.
Specifies the elastic property of colliding bodies for the Translational Hard Stop
block. The greater the value of the parameter, the less the bodies penetrate into each
other, the more rigid the impact becomes. Lesser value of the parameter makes contact
softer, but generally improves convergence and computational efficiency. The default
value is 1e6 N/m.
Specifies dissipating property of colliding bodies for the Translational Hard Stop block. At zero damping, the impact is close to an absolutely elastic one. The greater the value of the parameter, the more energy dissipates during an interaction. Keep in mind that damping affects slider motion as long as the slider is in contact with the stop, including the period when slider is pulled back from the contact. For computational efficiency and convergence reasons, MathWorks recommends that you assign a nonzero value to this parameter. The default value is 150 N*s/m.
Modeling approach for hard stops. Options include:
Stiffness and damping applied smoothly through transition
region (default) — Scale the magnitude of the contact force from
zero to its full value over a specified transition length. The scaling is
polynomial in nature. The polynomial scaling function is numerically smooth and
it produces no zero crossings of any kind.
Full stiffness and damping applied at bounds, undamped
rebound — Apply the full value of the calculated contact force
when the hard-stop location is breached. The contact force is a mix of spring
and damping forces during penetration and a spring force—without a damping
component—during rebound. No smoothing is applied.
Full stiffness and damping applied at bounds, damped
rebound — Apply the full value of the calculated contact force
when the hard-stop location is breached. The contact force is a mix of spring
and damping forces during both penetration and rebound. No smoothing is applied.
This is the hard-stop model used in previous releases.
Distance below which scaling is applied to the hard-stop force. The contact force
is zero when the distance to the hard stop is equal to the value specified here. It is
at its full value when the distance to the hard stop is zero. The default value is 0.1
mm.
Method for determining the piston position. The block can receive the position
from a Multibody block when set to Provide input signal from Multibody
joint, which exposes the physical signal port p.
The default value is Calculate from velocity of port R relative to port
C.
The distance that the piston is extended at the beginning of simulation. You can
set the piston position to any point within its stroke. The default value is
0, which corresponds to the fully retracted position. To enable
this parameter, set Piston displacement from cap A to
Calculate from velocity of port R relative to port
C.
Pressure in the cylinder chamber A at the beginning of simulation. The default
value is 0.
Pressure in the cylinder chamber B at the beginning of simulation. The default
value is 0.
Parameter determined by the type of working fluid:
Fluid bulk modulus
Use the Hydraulic Fluid block or the Custom Hydraulic Fluid block to specify the fluid properties.
The block has the following ports:
AHydraulic conserving port associated with the cylinder chamber A.
BHydraulic conserving port associated with the cylinder chamber B.
RMechanical translational conserving port associated with the cylinder rod.
CMechanical translational conserving port associated with the cylinder clamping structure.
pPiston position, received as a physical signal from a Simscape
Multibody™ block. To expose this port, set Piston displacement from cap
A to Provide input signal from Multibody
joint.
The Hydraulic Cylinder with Flexible Mount example illustrates simulation of a cylinder whose clamping is too flexible to be neglected. The structure compliance is represented with a spring and a damper, installed between the cylinder case and reference point. The cylinder performs forward and return strokes, and is loaded with inertia, viscous friction, and constant opposing load of 400 N.
The Custom Hydraulic Cylinder example demonstrates the use of a 4-way valve in combination with a double-acting cylinder in a simple closed-loop actuator. The example shows how to connect the blocks and set the initial orifice openings for the 4-way valve to model the forward and return strokes of the cylinder under load.
Ideal Translational Motion Sensor | Single-Acting Hydraulic Cylinder | Translational Hard Stop | Translational Hydro-Mechanical Converter