# Documentation

## Simulating Discretized Electrical Systems

### Introduction

You implement discretization by selecting Discretize electrical model in the Powergui block dialog box. The sample time is specified in the block dialog box. The electrical system is discretized using one of these methods: Tustin (equivalent to a fixed-step trapezoidal method), Backward Euler, or Tustin/Backward Euler (TBE).

The TBE discretization method combines the accuracy of the Tustin method and the numerical oscillation damping property of the Backward-Euler method. Tustin and Backward Euler methods are still available for compatibility. TBE method 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.

For the three-phase asynchronous and synchronous machines, you select the discretization method on the Advanced tab of the block dialog box. Use the trapezoidal method (either iterative or noniterative). For other machines, use the Forward Euler method to avoid algebraic loops.

The precision of the simulation is controlled by the time step that you choose for the discretization. If you use too large a sample time, the precision might not be sufficient. The only way to know if it is acceptable is to repeat the simulation with different sample times or to compare it with a continuous method and to find a compromise for the largest acceptable sample time. 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. However, for systems using forced-commutated power electronic switches, you must reduce the time step. These devices, the insulated-gate-bipolar transistor (IGBT), the field-effect transistor (FET), and the gate-turnoff thyristor (GTO) are usually operating at high switching frequencies. 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.

### Discretizing Switches and Power Electronics

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. For most applications, 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.

You select the discretization method in the Configure parameters menu of the Powergui block. The default discretization method is the Tustin/Backward Euler (TBE) method. This method combines the Tustin method and the Backward Euler method. The TBE method allows you to simulate snubberless diode and thyristor converters. It avoids numerical oscillations seen with the Tustin method and provides better accuracy than the Backward Euler method.

#### Comparison of Tustin, Backward Euler, and Tustin/Backward Euler Methods

Open the Comparison of Tustin, Backward Euler and Tustin/Backward Euler (TBE) with a Continuous Reference Model example model. This example uses a three-phase, half-wave diode rectifier model to compare the accuracy and stability of three discretization methods: Tustin, Backward Euler, and Tustin/Backward Euler (TBE).

Four identical models of the diode rectifier are simulated in four separate subsystems. Each subsystem contains its own Powergui block specifying the simulation type (Continuous or Discrete), the solver type (discretization method), and the sample time. The Scope block allows you to compare the load voltage (Vd) and the load current (Id) obtained with each discretization method. Reference waveforms are computed by the continuous solver.

The Continuous model uses the Ideal switching devices technique and no diode snubbers (snubbers disabled). The three discrete models use 1 MΩ resistive snubbers, resulting in negligible parasitic currents. The three discrete models can therefore also be considered snubberless. A 20 µs sample time is used for the three discrete models.

Run the simulation and observe waveforms on the Vd and Id Scopes. The Tustin method produces numerical oscillations on load voltage. The Backward Euler does not produce numerical oscillations but it provides too much damping, especially on the Id current. The TBE method eliminates the numerical oscillations while preserving accuracy.

### Discretizing Electrical Machines

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.

For the Synchronous Machine model and the Asynchronous Machine model, you can select either a Forward Euler or a Trapezoidal discretization method. All other machine models use the 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. When using an implicit solver, such as the Trapezoidal iterative model, you obtain the highest accuracy. Using this model produces an algebraic loop, which forces the Simulink® solver to iterate, resulting in a higher accuracy. However, this higher accuracy is at the expense of a slower simulation speed.

The Trapezoidal iterative model allows you to simulate machines with negligible parasitic loads while preserving numerical stability. However, if your model contains many machines and nonlinear elements such as power electronic devices, the Simulink solver might fail to solve the algebraic loop. In such a case you must use a noniterative discretization method such as the Forward Euler model or the Trapezoidal noniterative model (Trapezoidal model in which the algebraic loop is broken by introducing a Unit Delay).

Using noniterative solvers requires larger parasitic loads or a smaller sample time. The minimum resistive load is proportional to the sample time. Remember that with a 25 μs time step on a 60 Hz system, the minimum load is approximately 2.5% of the machine nominal power. For example, a 200 MVA synchronous machine in a power system discretized with a 50 μs sample time requires approximately 5% of resistive load or 10 MW. If the sample time is reduced to 20 μs, a resistive load of 4 MW is sufficient.

#### Example of discrete model using SM and ASM blocks

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

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

2. In the Powergui menu, select Configure parameters, select Simulation type = discrete, and specify a sample time of Ts = 50 μs.

3. Use the Load Flow tool to initialize the machine models (click the Compute and Apply buttons in the Powergui Load Flow window).

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

The following figure compares simulation results of the two noniterative discrete models (Forward Euler and Trapezoidal noniterative) with the reference waveforms obtained from the continuous model. In the figure, three sets of waveforms are shown for phase A voltage (trace 1), phase A current of ASM (trace 2), phase A current of SM (trace 3), and ASM and SM speeds (trace 4).

• Continuous model (blue)

• Discrete model using ASM and SM Forward Euler models (red)

• Discrete model using ASM and SM Trapezoidal noniterative models (green)

The Trapezoidal noniterative model provides better accuracy than the Forward Euler model. The simulation error is particularly visible on trace 2 and on trace 3 showing that the Forward Euler model fails to preserve the DC component of the ASM and SM currents.

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 Forward Euler machine models.

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

The only way to simulate this discrete model with a 1 kW load is to use the Trapezoidal iterative method for both machines. Simulink now displays a warning signalling an algebraic loop. Simulation results are exact and are as accurate as the Continuous model. The drawback is a much slower simulation speed.