Essential Electrical Modeling Techniques
Overview of Modeling Rules
Simscape™ Electrical™ models are essentially Simscape block diagrams refined for modeling single- and multi-phase electronic, mechatronic, and electrical power systems. Simscape Electrical blocks feature these port types:
Three-phase ports, which connect the phases of a three-phase electrical system between Simscape Electrical blocks.
There are two three-phase port types in Simscape Electrical blocks, composite and expanded. You can connect a composite three-phase port only to another composite three-phase port. You can connect the individual electrical conserving ports of an expanded three-phase port only to other electrical conserving ports. For more information, see Three-Phase Ports.
Electrical and mechanical rotational conserving ports , which connect directly to Simscape foundation blocks.
Each port type has specific Across and Through variables associated with it. To learn about the rules to follow when building an electromechanical model, see Basic Principles of Modeling Physical Networks.
Physical signal ports , which connect to Simulink® blocks through Simulink-PS Converter and PS-Simulink Converter blocks from the Simscape Utilities library. These blocks convert physical signals to and from Simulink mathematical signals.
Keep these rules in mind when using each port type in Simscape Electrical blocks.
You can connect physical conserving ports only to other conserving ports of the same type. Electrical conserving ports in Simscape Electrical blocks can connect directly to Simscape electrical components. Mechanical rotational conserving ports in Simscape Electrical blocks can connect directly to Simscape mechanical rotational components.
The physical connection lines that connect conserving ports are nondirectional lines that carry physical variables (Across and Though variables) rather than signals. You cannot connect physical conserving ports to Simulink ports or to physical signal ports.
You can branch physical connection lines. When you do so, directly connected components have the same Across variables. The value of any Through variable (e.g., current or torque) transferred along the physical connection line is divided among the multiple components connected by the branches.
For each Through variable, the sum of the values flowing into a branch point equals the sum of the values flowing out.
You can connect physical signal ports to other physical signal ports using regular connection lines, similar to Simulink signal connections. These connection lines carry physical signals between Simscape Electrical blocks.
You can connect physical signal ports to Simulink ports through 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.
Unlike Simulink signals, physical signals can have units. In Simscape Electrical block dialog boxes, you can 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 an example of these rules applied to an electromechanical model, see Three-Phase Asynchronous Machine Starting.
Each topologically distinct physical network in a diagram requires exactly one Solver Configuration block from the Simscape Utilities library. The Solver Configuration block specifies global environment information for simulation and provides parameters for the solver that your model needs for simulation.
Each electrical network requires an Electrical Reference block. This block establishes the electrical ground for the circuit. Networks with electromechanical blocks also require a Mechanical Rotational Reference block. For more information about using reference blocks, see Grounding Rules.
Creating a New Model
Another way to start a new model is to use a Simscape template from the Simulink start page. The start page includes model templates that provide you with design patterns for modeling electrical, three-phase electrical, mechanical rotational, and mechanical translational networks using Simscape Electrical. For more information, see Modeling Analog Circuit Architectures, Mechatronic Systems, and Electrical Power Systems Using Simscape Electrical.
You can also use the Creating a New Circuit example as a template for a new
electronic circuit model. This example opens a simple electrical model, prepopulated
with some useful blocks, and also opens an Electrical Starter Palette, which contains
links to the most often used electrical components. Open the example by typing
the MATLAB® Command Window and use File > Save As to
save the example model under the desired name. Then delete the unwanted blocks and add
new ones from the Electrical Starter Palette and from the block libraries.
Modeling Instantaneous Events
When working with Simscape Electrical, your model may include Simulink blocks that are associated with events or discrete sampling. Such blocks can create instantaneous changes to the physical system inputs through the Simulink-PS Converter block that connects them. When you build this type of model, make sure that the corresponding zero crossings are generated.
Many blocks in the Simulink library generate these zero crossings by default. For example, the
Pulse Generator block produces a discrete-time output by default, and
generates the corresponding zero crossings. To generate zero crossings for all
Simulink blocks that model instantaneous events, in the Solver Configuration
Parameters for the model, expand Solver details and in the
Zero crossing options, for the Zero crossing
control option, select
Use local settings or
Enable all. For more information about zero crossing
control, see Zero-crossing control.
Using Simulink Blocks to Model Physical Components
To run a fast simulation that approximates the behavior of the physical components in a system, you may want to use Simulink blocks to model one or more physical components.
The Modeling an Integrated Circuit example uses Simulink to model a physical component. The 2-Input NOR (Behavioral Model) masked subsystem is a behavioral model, built using Simscape Foundation Library blocks.
This behavioral model contains a subsystem comprised of Simulink blocks, which implements the custom integrated-circuit behavior.
The Simulink Logical Operator block implements the behavioral model of the two-input NOR gate. Using Simulink in this manner introduces algebraic loops, unless you place a lag somewhere between the physical signal inputs and outputs. In this case, a first-order lag is included in the Propagation Delay subsystem to represent the delay due to gate capacitances. For applications where no lag is required, use blocks from the Physical Signals sublibrary in the Simscape Foundation Library to implement the desired functionality.