## Essential Physical Modeling Techniques

### Building Your Model

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.

• For fluid system modeling, specify the working fluid for each topologically distinct circuit, as described in Specifying the Working Fluid.

• 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 Pipe (IL) block from the Foundation library, which accounts only for friction losses and fluid compressibility. If you also need to account for fluid inertia, you can turn on this effect after your simplified model works as expected. At a later stage in development, you may want to account for other effects, such as pipe wall compliance, various cross-sectional geometries, elevation, or curvature. You can then replace the Foundation library block with one of the blocks available with the Simscape Fluids™ block libraries, such as Pipe (IL), Partially Filled Pipe (IL), or Pipe Bend (IL). 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 .

### Using the Conserving Ports

The following rules apply to Conserving ports:

• There are different types of Physical Conserving ports used in Simscape block diagrams, such as electrical, mechanical translational, mechanical rotational, isothermal liquid, 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.

### Using the Physical Signal Ports

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 and Property Inspector 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.