Essential Electronic Modeling Techniques

Overview of Modeling Rules

Simscape™ Electronics™ models are essentially Simscape block diagrams. To build a system-level model with electrical blocks, use a combination of Simscape Electronics blocks and other Simscape and Simulink® blocks. You can connect Simscape Electronics blocks directly to Simscape blocks. You can connect Simulink blocks through the Simulink-PS Converter and PS-Simulink Converter blocks from the Simscape Utilities library. These blocks convert electrical signals to and from Simulink mathematical signals.

The rules that you must follow when building an electronic or electromechanical model are described in Basic Principles of Modeling Physical Networks (Simscape). This section briefly reviews these rules.

  • Simscape Electronics blocks, in general, feature Conserving ports and Physical Signal inports and outports .

  • There are two main types of Physical Conserving ports used in Simscape Electronics blocks: electrical and mechanical rotational. Each type has specific Through and Across variables associated with it.

  • You can connect Conserving ports only to other Conserving ports of the same type.

  • 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.

  • 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 Electronics 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 Electronics 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 electromechanical model, see DC Motor Model.

MathWorks recommends that you build, simulate, and test your model incrementally. Start with an idealized, simplified model of your system, simulate it, verify that it works the way you expected. Then incrementally make your model more realistic, factoring in effects such as motor shaft compliance, hard stops, and the other things that describe real-world phenomena. Simulate and test your model at every incremental step. Use subsystems to capture the model hierarchy, and simulate and test your subsystems separately before testing the whole model configuration. This approach helps you keep your models well organized and makes it easier to troubleshoot them.

Required Blocks

Each topologically distinct physical network in a diagram requires exactly one Solver Configuration block, found in the Simscape Utilities library. The Solver Configuration block specifies global environment information for simulation and provides parameters for the solver that your model needs before you can begin simulation. For more information, see the Solver Configuration block reference page.

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 (Simscape).

Creating a New Model

An easy way to start a new Simscape Electronics model, prepopulated with the required blocks, is to use the Simscape function ssc_new with a domain type of electrical. For more information, see Creating a New Simscape Model (Simscape).

You can also use the Creating A New Circuit example (under Simscape examples) as a template for a new 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 ssc_new_elec in 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 Electronics software, your model may include Simulink blocks that create instantaneous changes to the physical system inputs through the Simulink-PS Converter block, such as those associated with events or discrete sampling. When you build this type of model, make sure 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 model instantaneous events, select Use local settings or Enable all for the Zero crossing control option under the model’s Solver Configuration Parameters to generate zero crossings. For more information about zero crossing control, see Zero-crossing control (Simulink).

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 of 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.

Was this topic helpful?