# Electrical Systems

Explore examples that illustrate modeling, control, and simulation of electrical systems.

## Featured Examples

### RC Circuit in Simulink and Simscape

Two models of an RC circuit, one using Simulink® input/output blocks and one using Simscape™ physical networks.

### Cascaded RC Circuit in Simulink and Simscape

Two models of a cascaded RC circuit, one using Simulink® input/output blocks and one using Simscape™ physical networks.

### Shunt Motor

A model of a shunt motor. In a shunt motor, the field and armature windings are connected in parallel. Equivalent circuit parameters are armature resistance Ra = 110 Ohms, field resistance Rf = 2.46KOhms, and back emf coefficient Laf = 5.11. The back-emf is given by Laf*If*Ia*w, where If is the field current, Ia is the armature current, and w is the rotor speed in radians/s. The rotor inertia J is 2.2e-4kgm^2, and rotor damping B is 2.8e-6Nm/(radian/s).

### Permanent Magnet DC Motor

This model is based on a Faulhaber Series 0615 DC-Micromotor. The parameters values are set to match the 1.5V variant of this motor. The model uses these parameters to verify manufacturer-quoted no-load speed, no-load current, and stall torque.

### Lead-Acid Battery

Model a lead-acid battery cell using the Simscape™ language to implement the nonlinear equations of the equivalent circuit components. In this way, as opposed to modeling entirely in Simulink®, the connection between model components and the defining physical equations is more easily understood. For the defining equations and their validation, see Jackey, R. "A Simple, Effective Lead-Acid Battery Modeling Process for Electrical System Component Selection", SAE World Congress & Exhibition, April 2007, ref. 2007-01-0778.

### Lead-Acid Battery with Dashboard Blocks

Model a lead-acid battery cell using the Simscape™ language.

### Lithium-Ion Battery Pack with Fault

Simulate a battery pack consisting of multiple series-connected cells in an efficient manner. It also shows how a fault can be introduced into one of the cells to see the impact on battery performance and cell temperatures. For efficiency, identical series-connected cells are not just simply modeled by connecting cell models in series. Instead a single cell is used, and the terminal voltage scaled up by the number of cells. The fault is represented by changing the parameters for the Cell 10 Fault subsystem, reducing both capacity and open-circuit voltage, and increasing the resistance values.

### Lithium-Ion Battery Pack with Fault Using Arrays

Simulate a battery pack that consists of multiple series-connected cells. It also shows how you can introduce a fault into one of the cells to see the impact on battery performance and cell temperatures. The battery pack is modeled in Simscape™ language by connecting cell models in series using arrays. You can represent the fault by defining different parameters for the faulty cell.

### Lithium Battery Cell - One RC-Branch Equivalent Circuit

Model a lithium cell using the Simscape™ language to implement the elements of an equivalent circuit model with one RC branch. For the defining equations and their validation, see T. Huria, M. Ceraolo, J. Gazzarri, R. Jackey. "High Fidelity Electrical Model with Thermal Dependence for Characterization and Simulation of High Power Lithium Battery Cells," IEEE International Electric Vehicle Conference, March 2012.

### Lithium Battery Cell - Two RC-Branch Equivalent Circuit

Model a lithium cell using the Simscape™ language to implement the elements of an equivalent circuit model with two RC branches. For the defining equations and their validation, see T. Huria, M. Ceraolo, J. Gazzarri, R. Jackey. "High Fidelity Electrical Model with Thermal Dependence for Characterization and Simulation of High Power Lithium Battery Cells," IEEE International Electric Vehicle Conference, March 2012.

### Lithium Pack Thermal Runaway

Model a thermal runaway in a lithium-ion battery pack. The model measures the cell heat generation, the cell-to-cell heat cascade, and the subsequent temperature rise in the cells, based on the design. The cell thermal runaway abuse heat is calculated using calorimeter data. Simulation is run to evaluate the number of cells that go into runaway mode, when just one cell is abused. To delay or cancel the cell-to-cell thermal cascading, this example models a thermal barrier between the cells.

### Nonlinear Bipolar Transistor

An implementation of a nonlinear bipolar transistor based on the Ebers-Moll equivalent circuit. R1 and R2 set the nominal operating point, and the small signal gain is approximately set by the ratio R3/R4. The 1uF decoupling capacitors have been chosen to present negligible impedance at 1KHz. The model is configured for linearization so that a frequency response can be generated.

### Small-Signal Bipolar Transistor

The use of a small-signal equivalent transistor model to assess performance of a common-emitter amplifier. The 47K resistor is the bias resistor required to set nominal operating point, and the 470 Ohm resistor is the load resistor. The transistor is represented by a hybrid-parameter equivalent circuit with circuit parameters h_ie (base circuit resistance), h_oe (output admittance), h_fe (forward current gain), and h_re (reverse voltage transfer ratio). Parameters set are typical for a BC107 Group B transistor. The gain is approximately given by -h_fe*470/h_ie =-47. The 1uF decoupling capacitor has been chosen to present negligible impedance at 1KHz compared to the input resistance h_ie, so the output voltage should be 47*10mV = 0.47V peak.

### Band-Limited Op-Amp

How higher fidelity or more detailed component models can be built from the Foundation library blocks. The model implements a band-limited op-amp. It includes a first-order dynamic from inputs to outputs, and gives much faster simulation than if using a device-level equivalent circuit, which would normally include multiple transistors. This model also includes the effects of input and output impedance (Rin and Rout in the circuit), but does not include nonlinear effects such as slew-rate limiting.

### Finite-Gain Op-Amp

How higher fidelity or more detailed component models can be built from the Foundation library blocks. The Op-Amp block in the Foundation library models the ideal case whereby the gain is infinite, input impedance infinite, and output impedance zero. The Finite Gain Op-Amp block in this example has an open-loop gain of 1e5, input resistance of 100K ohms and output resistance of 10 ohms. As a result, the gain for this amplifier circuit is slightly lower than the gain that can be analytically calculated if the op-amp gain is assumed to be infinite.

### Op-Amp Circuit - Differentiator

A differentiator, such as might be used as part of a PID controller. It also illustrates how numerical simulation issues can arise in some idealized circuits. The model runs with the capacitor series parasitic resistance set to its default value of 1e-6 Ohms. Setting it to zero results in a warning and a very slow simulation. See the User's Guide for further information.

### Op-Amp Circuit - Inverting Amplifier

A standard inverting op-amp circuit. The gain is given by -R2/R1, and with the values set to R1=1K Ohm and R2=10K Ohm, the 0.1V peak-to-peak input voltage is amplified to 1V peak-to-peak. As the Op-Amp block implements an ideal (i.e. infinite gain) device, this gain is achieved regardless of output load.

### Op-Amp Circuit - Noninverting Amplifier

A noninverting op-amp circuit. The gain is given by 1+R2/R1, and with the values set to R1=1K Ohm and R2=10K Ohm, the 0.1V peak-to-peak input voltage is amplified to 1.1V peak-to-peak. As the Op-Amp block implements an ideal (i.e. infinite gain) device, this gain is achieved regardless of output load.

### Nonlinear Inductor

An implementation of a nonlinear inductor where the inductance depends on the current. For best numerical efficiency, the underlying behavior is defined in terms of a current-dependent flux. In order to differentiate the flux to get voltage, a magnetizing lag is included. Simulation results are relatively insensitive to this lag provided that it is at least an order of magnitude faster than the fastest frequency of interest. Parameters for the source and lag are defined in the MATLAB® workspace so that the expected voltage can be calculated analytically.

### Full-Wave Bridge Rectifier

An ideal AC transformer plus full-wave bridge rectifier. It converts 120 volts AC to 12 volts DC. The transformer has a turns ratio of 14, stepping the supply down to 8.6 volts rms, i.e. 8.6*sqrt(2) = 12 volts pk-pk. The full-wave bridge rectifier plus capacitor combination then converts this to DC. The resistor represents a typical load.

### Circuit Breaker

Model a circuit breaker. The electromechanical breaker mechanism is approximated with a first-order time constant, and it is assumed that the mechanical force is proportional to load current. This simple representation is suitable for use in a larger model of a complete system. When the 20V supply is applied at one second, it results in a current that exceeds the circuit breaker current rating, and hence the breaker trips. The reset is then pressed at three seconds, and the voltage is ramped up. The breaker then trips just beyond the circuit breaker current rating.

### Solenoid

A solenoid with a spring return. The solenoid is modeled as an inductance whose value L depends on the plunger position x. The back emf for a time-varying inductance is given by:

### Operating Point RLC Transient Response

The response of a DC power supply connected to a series RLC load. The goal is to plot the output voltage response when a load is suddenly attached to the fully powered-up supply. This is done using a Simscape operating point.

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)