Simscape™ Fluids™ block diagrams are like other Simscape models. They represent fluid systems by means of blocks and connection lines. Each block represents a physical component and its salient attributes. Each line represents a physical connection or interaction between components—including any exchanges in mass, energy, and momentum. Lines connect through ports representing inlets, outlets, and other component features.
Blocks as Components and Lines as Connections
You can model fluid components using blocks from the Simscape Foundation or Simscape Fluids libraries. Simscape Foundation blocks represent idealized components such as local restrictions, mechanical converters, and constant-volume chambers. Simscape Fluids blocks represent specialized components with detailed component physics, such as directional valves, single-acting actuators, and gas-charged accumulators.
Like the systems they represent, Simscape Fluids models are often multi-domain in nature. The hydraulic actuator model is one example. The model contains a hydraulic network representing the hydraulic actuation system and a Mechanical Translational network representing the actuator load. To model components from different domains, you can use blocks from the various Simscape Foundation libraries or from the several specialized physical modeling products.
Lines can join blocks through physical conserving ports, , or physical signal ports, . A line between physical conserving ports represents a physical connection bound by physical conservation principles. A line between physical signal ports represents a component input, such as a change in valve position, or sensing output, such as a fluid pressure measurement.
Conserving and Physical Signal Ports
Physical connection lines are nondirectional. They apply constraints between the Across and Through variables of the connected conserving ports, but do not transmit numerical values in any particular direction. Physical signal lines are directional. They pass numerical signals and associated physical units in a specific direction from one block to another, often as block inputs or outputs.
Blocks and physical connection lines are color-coded by physical domain. The various colors help to differentiate the physical domains comprising a Simscape model. Use them as visual guides when deciding if a physical connection between components is valid. All physical connection lines must join conserving ports of the same domain. The figure shows the color legend for the physical domains associated with Simscape Fluids blocks.
Simscape Fluids Color Coding
For more information, see Domain-Specific Line Styles (Simscape).
Ports always connect to like ports. A physical conserving port connects only to other physical conserving port—and only if they belong to the same physical domain. Conserving ports are associated with specific Across and Through variables and cannot connect to conserving ports associated with different variables. You can directly connect a Hydraulic conserving port to another Hydraulic conserving port but not to a Thermal Liquid conserving port.
To interconnect different physical domains, you must use multi-domain blocks with ports representing different domains. The Single-Acting Hydraulic Cylinder block, shown in the figure, is one such block. A Hydraulic conserving port connects to a Hydraulic network, shown in yellow. A Mechanical Translational conserving port connects to a Mechanical Translational network, shown in green.
Physical signal ports similarly connect only to other physical signal ports. Physical signals can arise from blocks representing physical components, such as 2-Position Valve Actuator, from Simscape sources, such as PS Constant, or from Simulink® signals that have been converted into physical signals. The expected signal dimensions must be the same for all connected ports.
You must convert Simulink signals into physical signals if you intend to use them as Simscape block inputs. You perform this conversion using the Simscape Simulink-PS Converter block. The figure shows an example of such a conversion. A Simulink Sine Wave block generates a signal that the Simulink-PS Converter block converts for use in the Simscape Fluids 2-Position Valve Actuator block.
You must convert physical signals into Simulink signals if you intend to use them as Simulink block inputs. You perform this conversion using the Simscape PS-Simulink Converter block. The figure shows an example of such a conversion. A Simscape Fluids Single-Acting Hydraulic Cylinder block generates a signal that the PS-Simulink Converter block converts for plotting with a Simulink Scope block.
Simscape Fluids models are at their core systems of differential and algebraic equations that a numerical solver computes in terms of unknown variables. The equations come from blocks and domain definition files. Simscape software assembles the system of equations during model compilation and solves them for each time step during simulation.
Block equations are component-specific. They are often statements of mass, momentum, and energy conservation but can include equations such as heat transfer correlations and component geometry expressions. Domain equations apply model-wide and are based on general circuit analysis principles, often referred to as Kirchhoff's rules. These rules constrain the Across and Through variables so that:
The Across variables of all directly connected conserving ports always have the same value.
The Through variables at a junction between two or more connection lines always sum to zero.
For more information on how Simscape software assembles and solves the governing equations of a model, see How Simscape Simulation Works (Simscape)
The figure shows a Simscape Fluids model of a simple hydraulic actuator. The model has two physical networks—one hydraulic, indicated in yellow, and one Mechanical Translational, indicated in green. The Hydraulic network models the hydraulic power system that drives the actuator. The Mechanical Translational network models a damped mass-spring oscillator that the actuator pushes against.
Hydraulic Actuator Simscape Fluids Model
The Hydraulic blocks represent the components of the hydraulic power system—a hydraulic pressure source, a directional valve, a relief valve, and the hydraulic fluid. The Mechanical Translational blocks represent the components of the damped mass-spring oscillator—a mass, a translational spring, and a translational damper.
The connection lines represent the physical connections between the components. For example, the connection line between the Hydraulic Pressure Source and 3-Way Directional Valve blocks indicates a direct connection between the actual components. This connection enables the flow of mass, energy, and momentum between the source and valve during simulation.
The physical connection lines join conserving ports of the same type. Hydraulic conserving ports connect to other Hydraulic conserving ports. Mechanical Translational conserving ports connect to other Mechanical Translational conserving ports. Hydraulic and Mechanical Translational components connect through a multi-domain component represented by the Single-Acting Hydraulic Cylinder block.
The physical signal lines represent Simscape block inputs. The physical signal line between the Control Unit subsystem and the 3-Way Directional Valve blocks specifies the valve position as a function of time. The subsystem block generates the position signal with Simulink blocks that a Simulink-PS Converter block then converts into a physical signal.
For more information about Simscape modeling rules, see Basic Principles of Modeling Physical Networks (Simscape). For a tutorial showing how to model an isothermal hydraulic actuator, see Model an Isothermal Hydraulic Actuator.