The rules that you must follow when building a physical model with Simscape™ software are described in Basic Principles of Modeling Physical Networks. This section briefly reviews these rules.
Build your physical model by using a combination of blocks from the Simscape Foundation and Utilities libraries. Simscape software lets you create a network representation of the system under design, based on the Physical Network approach. According to this approach, each system is represented as consisting of functional elements that interact with each other by exchanging energy through their ports.
Each Simscape diagram (or each topologically distinct physical network in a diagram) must contain a Solver Configuration block from the Simscape Utilities library.
If you have hydraulic elements in your model, the working fluid used in the hydraulic circuit defines their global parameters, such as fluid density, fluid kinematic viscosity, fluid bulk modulus, and so on. To specify the working fluid, attach a Custom Hydraulic Fluid block (or a Hydraulic Fluid block, available with Simscape Fluids™ block libraries) to each topologically distinct hydraulic circuit. If no Hydraulic Fluid block or Custom Hydraulic Fluid block is attached to a circuit, the hydraulic blocks use the default fluid, which is equivalent to fluid defined by a Custom Hydraulic Fluid block with the default parameter values.
If you have gas elements in your model, default gas properties are for dry air. Attach a Gas Properties (G) block to each topologically distinct circuit to change gas properties.
To connect regular Simulink® blocks (such as sources or scopes) to your physical network diagram, use the converter blocks, as described in Using the Physical Signal Ports.
Use the incremental modeling approach. Start with a simple model, run and troubleshoot it, then add the desired special effects. For example, you can start developing your system by using the Resistive Tube block from the Foundation library, which accounts only for friction losses. At a later stage in development, you may want to account for fluid compressibility. You can then replace it with a Hydraulic Pipeline block, available with Simscape Fluids block libraries, or, depending on your application, even with a Segmented Pipeline block if you also need to account for fluid inertia. For all these different mathematical models, the element configuration (that is, the number and type of ports and the associated Through and Across variables) would remain the same, meaning that the Physical Network approach lets you substitute models of different levels of complexity without introducing any changes to the schematic.
Simscape blocks, in general, feature both Conserving ports and Physical Signal inports and outports .
The following rules apply to Conserving ports:
There are different types of Physical Conserving ports used in Simscape block diagrams, such as hydraulic, electrical, mechanical translational, mechanical rotational, and so on. Each type has specific Through and Across variables associated with it. For more information, see Variable Types.
You can connect Conserving ports only to other Conserving ports of the same type. Domain-specific line styles and colors help distinguish between different domains and facilitate the connection process. For more information, see Domain-Specific Line Styles.
The Physical connection lines that connect Conserving ports together are nondirectional lines that carry physical variables (Across and Through variables, as described above) rather than signals. You cannot connect Physical lines to Simulink ports or to Physical Signal ports.
Two directly connected Conserving ports must have the same values for all their Across variables (such as voltage or angular velocity).
You can branch Physical connection lines. When you do so, components directly connected with one another continue to share the same Across variables. Any Through variable (such as current or torque) transferred along the Physical connection line is divided among the multiple components connected by the branches. How the Through variable is divided is determined by the system dynamics.
For each Through variable, the sum of all its values flowing into a branch point equals the sum of all its values flowing out.
The following rules apply to Physical Signal ports:
You can connect Physical Signal ports to other Physical Signal ports with regular connection lines, similar to Simulink signal connections. These connection lines carry physical signals between Simscape blocks.
You can connect Physical Signal ports to Simulink ports through special converter blocks. Use the Simulink-PS Converter block to connect Simulink outports to Physical Signal inports. Use the PS-Simulink Converter block to connect Physical Signal outports to Simulink inports.
Physical Signals can have units associated with them. Simscape block dialogs let you specify the units along with the parameter values, where appropriate. Use the converter blocks to associate units with an input signal and to specify the desired output signal units.
For examples of applying these rules when creating an actual physical model, see the tutorial Creating and Simulating a Simple Model.