# Documentation

## Simulating Discretized Electrical Systems

### Introduction

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.

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

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

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.

With the Trapezoidal iterative model, you obtain the highest accuracy. This model produces an algebraic loop, which forces the Simulink® solver to iterate, resulting in a higher accuracy 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. 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 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 Simulation type = discrete, and specify a sample time of Ts = 50 μs.

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

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.

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

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.