Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To perform a discrete simulation, open the powergui block and set
**Simulation type** to `Discrete`

, and
specify the sample time. The electrical system is discretized using the
Tustin/Backward Euler (TBE) method. This method combines the Tustin method and the
Backward Euler method. It allows you to simulate snubberless diode and thyristor
converters. It eliminates numerical oscillations seen with the Tustin method and
provides better accuracy than the Backward Euler method.

The TBE discretization method combines the accuracy of the Tustin method and the numerical oscillation damping property of the Backward-Euler method. It allows you to simulate power electronic circuits with virtually no snubber, using purely resistive snubbers with a very large resistance value resulting in negligible leakage currents.

The precision of the simulation is controlled by the time step that you choose for the discretization. Usually sample times of 20 µs to 50 µs give good results for simulation of switching transients on 50 Hz or 60 Hz power systems or on systems using line-commutated power electronic devices such as diodes and thyristors. Systems using forced-commutated power electronic switches are usually operating at high switching frequencies and require smaller sample times. For example, simulating a pulse-width-modulated (PWM) inverter operating at 5 kHz requires a maximum time step of 1 µs.

Even if you discretize your electric circuit, you can still use a continuous control system. However, the simulation speed is improved by use of a discrete control system.

Switches and power electronic devices are nonlinear elements which are represented by a purely resistive element having a low Ron resistance when the switch is closed and an infinite resistance when the switch is opened. Each time a switch status is changed during the simulation, the discrete state-space model of the linear part of the circuit is re-evaluated to take into account the change in circuit topology.

Due to the way the state-space model is computed, switches cannot be connected in series with inductive circuits. In such situations, snubber circuits have to be connected across power electronic devices. For forced-commutated devices, the snubber circuit can be made negligible by using purely resistive snubbers with a high resistance. However, for circuits containing naturally commutated devices such as diodes and thyristors, because a fixed simulation time step is used, when the device is blocked, the current zero-crossing is not detected accurately.

Electrical machines are nonlinear elements simulated as current sources. These elements cannot be connected to an inductive network unless a parasitic resistive or capacitive element is connected at machine terminals. When using electrical machines in discrete systems, you might have to increase these parasitic resistive load to avoid numerical oscillations. The amount of parasitic load depends on the sample time and on the integration method used to discretize the electrical machine.

The Synchronous Machine model and the Asynchronous Machine model
use a Trapezoidal discretization method. All other machine models
use a Forward Euler discretization method. For the Synchronous Machine
and the Asynchronous Machine, you select the machine discretization
method in the **Advanced** tab of the block menu.

In the R2018b and earlier versions, two integration methods were available in the
**Advanced** tab of the Synchronous Machine and
Asynchronous Machine blocks: the Trapezoidal noniterative method
or the Trapezoidal iterative method.

The Trapezoidal non iterative method provides a stable and fast solution. However, to preserve simulation stability, a resistive parasitic load must be connected at machine terminals. For example, for a sample time of 50 ms, the minimum resistive load can be as large as 5 to 10% of machine nominal power. For some applications, the only way to reduce these loads to an acceptable level, say below 0.1% of nominal power, was to simulate machines with the Trapezoidal iterative method. But, with this method, simulation becomes very slow and even fails to converge when the number of machines is increased in a model.

In R2019a, two additional methods have been introduced to discretize the machine models: the Trapezoidal robust method and the Backward Euler robust method. These methods are part of a robust solver that allows simulating machines faster and more accurately. This solver allows you to eliminate the parasitic load and simulate a machine at no load or with a circuit breaker directly connected in series (a circuit topology that was not possible in previous releases). This robust solver does not use an iterative technique, making it suitable for real time applications.

The new solver addresses a stability problem of the Trapezoidal non iterative method that occurs when large parasitic load are used, and convergence and slow simulation problems of the Trapezoidal iterative method. The following example demonstrates the advantages of using the robust solver.

The following example illustrates impact of the machine discretization methods and amount of parallel load on model stability.

Open the Emergency Diesel-Generator and Asynchronous Motor example model. This model contains a synchronous machine (SM) and an asynchronous machine (ASM) connected at the same bus in parallel with a 1 MW load.

In the Powergui menu, select

**Simulation type**=**discrete**, and specify a**sample time**of Ts = 50 μs. In the**Preferences**tab, select`Tustin/Backward Euler discrete solver`

.Use the Load Flow tool to initialize the machine models.

Start the simulation and observe that the model starts in a steady-state.

In this model, the default discretization method specified in the Advanced Tab of the synchronous machine block and of the asynchronous machine block is Trapezoidal noniterative. The model is stable because a relative large load of 1 MW is connected at the machine terminals. This load represents 32% of the SM nominal power and 60% of the ASM nominal power.

Now simulate this discrete model with virtually no load connected at machine terminals. You may try decreasing the 1 MW load to say 1 kW (representing respectively 0.032% and 0.06% of SM and ASM machine nominal powers).

Change the resistive load from 1MW to 1 kW and start simulation. Notice the numerical oscillations, because the 1 kW load is too small to guarantee stability of the machine models.

If you vary the load by steps of 50 kW, you discover that the minimum load required to obtain a stable model with the Trapezoidal non iterative method is 300 kW, corresponding to 6.2% of the total machine nominal power (4.80 MVA = 3.125 MVA for ASM + 1.678 MVA for SM).

In the **Advanced** tab of the Synchronous
Machine block, change the solver to ```
Trapezoidal
iterative
```

, and leave the ```
Trapezoidal non
iterative
```

selection for the Asynchronous Machine block solver.
Simulate the model. Simulation results are the same and as accurate as for a
continuous model but return an algebraic loop warning. The drawback of using
this solver is the simulation speed. Moreover, if you attempt to use the
`Trapezoidal iterative`

solver for both machines,
you observe that Simulink^{®} fails to converge.

The only way to simulate this discrete model with a 1 kW load is to use either the Trapezoidal robust method or the Backward Euler robust method for both machine blocks. The Trapezoidal robust method is slightly more accurate than the Backward Euler robust method, especially for larger sample times. The Trapezoidal robust method tends to produce slight damped numerical oscillations on voltages when the machines are at no load. In such scenarios, the Backward Euler robust method prevents oscillations and maintains acceptable simulation accuracy. The robust solver allows you to eliminate the parallel load at the machine terminals.

Specify the Trapezoidal robust method in both machine blocks and comment out the load. Reconnect the voltage measurement block between phases A and B (otherwise, Simulink returns an error because the ground point that was defined by the load no longer exists). Start the simulation and zoom on the Vab machine voltage to observe small numerical oscillations when the fault is applied and cleared. These oscillations can be avoided if you use the Backward Euler robust method for both machines. The simulation speed obtained with the two types of robust solvers is approximately the same as the one obtained with the Trapezoid non iterative method.

The robust solver provides an accurate modeling of discretized nonlinear resistors
and nonlinear inductors by using an iterative method. When using the robust solver
to discretize nonlinear resistors and nonlinear inductors, the solution is usually
found in one or two iterations. For real time applications, you may need to limit
the number of iterations. See the **Solver details for nonlinear
elements** preference in the powergui block reference
page.

A nonlinear resistor is a resistive element where current (model output) is a nonlinear function of voltage (model input). This type of element contains no state. Its output varies instantaneously with input. This means that a direct feedthrough exists between input and output, producing an algebraic loop. Solving this algebraic loop requires an iterative method.

Nonlinear resistor is used, for example, to model the Surge
Arrester block. When the Simulation in the powergui
block type is set to `Discrete`

, the discretization
method is selected in the **Advanced** tab of the Surge
Arrester block. Three solution method options can be specified using
the **Break Algebraic loop** and **Use robust
solver** checkboxes in the discrete model.

When the two checkboxes are cleared, the robust solver is not enabled, and the model contains an algebraic loop solved by Simulink, which iterates until the solution is found. Although this method produces correct results, it is not recommended because simulation may fail to converge when the number of Surge Arrester blocks is increased in the model. This method cannot be used in real time applications due to the presence of algebraic loops.

When only the

**Break Algebraic loop**checkbox is selected, a delay is inserted at the current output of the nonlinear resistor model to break the algebraic loop. This delay requires using small sample times. This method is not recommended because it becomes unstable when sample time is increased.When the

**Use robust solver in discrete model**parameter is selected, the robust solver provides stable iterations and accurate simulation results. Starting with the R2019a release, this is the recommended method for discretizing Surge Arrester blocks.

A nonlinear inductor is an inductive element where the current (model output) is a nonlinear function of flux linkage corresponding to the integral of the voltage (model input). To achieve good accuracy, the flux linkage must be computed by using an implicit integration method, such as Trapezoidal or Backward Euler methods. The drawback is a direct feedthrough between input and output, which requires an iterative solution.

The nonlinear inductor is used to implement saturation in single-phase and
three-phase transformer blocks. When the **Simulation type** in
the powergui block is set to `Discrete`

,
the discretization method is selected in the **Advanced** tab
of the transformer blocks. You can specify four solution methods
using the **Break Algebraic loop in discrete model** check box
and the **Discrete solver model** parameter.

When the

**Break Algebraic loop in discrete model**parameter is selected, a delay is inserted at the output of the nonlinear inductor model to avoid iterations. This delay requires small sample times to remain stable and produce accurate results.When the

**Break Algebraic loop in discrete model**parameter is cleared and the`Trapezoidal iterative`

method is used to compute the flux (integration of voltage), Simulink iterates to find the solution. Although this method produces correct results, it is not recommended because simulation may fail to converge when the number of Saturable Transformer blocks is increased in the model. This method cannot be used in real time applications due to the presence of algebraic loops.When the

`Trapezoidal robust`

method is used to compute the flux, the robust solver iterates to find the solution.When the

`Backward Euler robust`

method is used to compute the flux, the robust solver iterates to find the solution.

Starting with the R2019a release, methods 3 and 4 are the recommended methods. The Trapezoidal robust method is slightly more accurate than the Backward Euler robust method. The Trapezoidal robust method may produce slightly damped numerical oscillations on transformer voltages when transformers are at no load. In this scenario, the Backward Euler robust method prevents oscillations while maintaining an acceptable accuracy.