Products & Services Solutions Academia Support User Community Company

Learn more about SimPowerSystems   

Building and Customizing Nonlinear Models

Introduction

SimPowerSystems software provides a wide collection of nonlinear models. It can happen, however, that you need to interface your own nonlinear model with the standard models provided in the powerlib library. This model could be a simple nonlinear resistance simulating an arc or a varistor, a saturable inductor, a new type of motor, etc.

In the following section you learn how to build such a nonlinear model. A simple saturable inductance and a nonlinear resistance serve as examples.

Modeling a Nonlinear Inductance

Consider an inductor of 2 henries designed to operate at a nominal voltage, Vnom = 120 V RMS, and a nominal frequency, fnom = 60 Hz. From zero to 120 V RMS the inductor has a constant inductance, L = 2 H. When voltage exceeds its nominal voltage, the inductor saturates and its inductance is reduced to Lsat = 0.5 H. The nonlinear flux-current characteristic is plotted in the next figure. Flux and current scales are in per units. The nominal voltage and nominal current are chosen as base values for the per-unit system.

Flux-Current Characteristic of the Nonlinear Inductance

The current i flowing in the inductor is a nonlinear function of flux linkage ψ that, in turn, is a function of v appearing across its terminals. These relations are given by the following equations:

The model of the nonlinear inductance can therefore be implemented as a controlled current source, where current i is a nonlinear function of voltage v, as shown.

Model of a Nonlinear Inductance

Implementation of a Nonlinear Inductance shows a circuit using a 2 H nonlinear inductance. The nonlinear inductance is connected in series with two voltage sources (an AC Voltage Source block of 120 volts RMS, 60 Hz, and a DC Voltage Source block) and a 5 ohm resistor.

All the elements used to build the nonlinear model have been grouped in a subsystem named Nonlinear Inductance. The inductor terminals are labeled In and Out. Notice that a second output returning the flux has been added to the subsystem. You can use this output to observe the flux by connecting it to a Simulink Scope block.

The nonlinear model uses two powerlib blocks and two Simulink blocks. The two powerlib blocks are a Voltage Measurement block to read the voltage at the inductance terminals and a Controlled Current Source block. The direction of the arrow of the current source is oriented from input to output according to the model shown above.

The two Simulink blocks are an Integrator block computing the flux from the voltage input and a Look-Up Table block implementing the saturation characteristic i = f(ψ) described by Flux-Current Characteristic of the Nonlinear Inductance.

Implementation of a Nonlinear Inductance

Two Fourier blocks from the Measurements library of powerlib_extras are used to analyze the fundamental component and the DC component of the current.

Using blocks of the powerlib and Simulink libraries, build the circuit shown above. To implement the i =f(ψ) relation, specify the following vectors in the Look-Up Table block:

Vector of input values (flux)

[-1.25 -1 1 1.25 ] *(120*sqrt(2)/(2π*60))

Vector of output values (current)

[-2 -1 1 2]*(120*sqrt(2)/(4π*60))

Save your circuit as circuit7.

Set the following parameters for the two sources:

AC source

 

Peak amplitude

120*sqrt(2)

 

Phase

90 degrees

 

Frequency

60 Hz

DC source

 

Amplitude

0 V

Adjust the simulation time to 1.5 s and select the ode33tb integration algorithm with default parameters. Start the simulation.

As expected, the current and the flux are sinusoidal. Their peak values correspond to the nominal values.

Current and flux waveforms are shown.

Current and Flux Waveforms Obtained with VDC = 0 V and VDC=1 V

Now change the DC voltage to 1 V and restart the simulation. Observe that the current is distorted. The 1 V DC voltage is now integrated, causing a flux offset, which makes the flux enter into the nonlinear region of the flux-current characteristic (ψ > 0.450 V.s). As a result of this flux saturation, the current contains harmonics. Zoom in on the last three cycles of the simulation. The peak value of the current now reaches 0.70 A and the fundamental component has increased to 0.368 A. As expected, the DC component of the current is 1 V/ 0.5 Ω = 0.2. The current and flux waveforms obtained with and without saturation are superimposed in the figure above.

Customizing Your Nonlinear Model

Simulink software provides the Masking facilities to create a dialog box for your models. You can create a mask that specifies the following prompts and variables:

Nominal voltage (Volts rms):

Vnom

Nominal frequency (Hz):

Fnom

Unsaturated inductance (H):

L

Saturation characteristic [i1(pu) phi1(pu); i2 phi2; ...]:

sat

The resulting mask for your nonlinear inductance block is shown in the next figure.

Dialog Box of the Nonlinear Inductance Block

The following code in the mask initializations of the block prepares the two vectors Current_vect and Flux_vect to be used in the Look-Up Table block of the model.

% Define base current and Flux for pu system
I_base = Vnom*sqrt(2)/(L*2*pi*fnom);
Phi_base = Vnom*sqrt(2)/(2*pi*fnom); 

% Check first two points of the saturation characteristic
if ~all(all(sat(1:2,:)==[0 0; 1 1])),
    h=errordlg('The first two points of the characteristic must 
be [0 0; 1 1]','Error');
    uiwait(h);
end 

% Complete negative part of saturation characteristic
[npoints,ncol]=size(sat);
sat1=[sat ; -sat(2:npoints,:)];
sat1=sort(sat1); 

% Current vector (A)  and flux vector (V.s)
Current_vect=sat1(:,1)*I_base;
Flux_vect=sat1(:,2)*Phi_base;

As the saturation characteristic is specified only in the first quadrant, three lines of code are added to complete the negative part of the saturation characteristic. Notice also how the validity of the first segment of the saturation characteristic is verified. This segment must be defined by two points [0 0; 1 1] specifying a 1 pu inductance (nominal value) for the first segment.

Before you can use the masked block, you must apply the two internal variables defined in the initialization section of the block. Open the Look-Up Table block dialog box and enter the following variable names in the two fields:

Vector of input values (flux)

Flux_vect

Vector of output values (current)

Current_vect

Close the Nonlinear Inductance subsystem and start the simulation. You should get the same waveforms as shown in Current and Flux Waveforms When Energizing the Nonlinear Inductance with Maximum Flux Offset.

Modeling a Nonlinear Resistance

The technique for modeling a nonlinear resistance is similar to the one used for the nonlinear inductance.

A good example is a metal-oxide varistor (MOV) having the following V-I characteristic:

where

v, i =

Instantaneous voltage and current

Vo =

Protection voltage

Io =

Reference current used to specify the protection voltage

α =

Exponent defining the nonlinear characteristic (typically between 10 and 50)

The following figure shows an application of such a nonlinear resistance to simulate a MOV used to protect equipment on a 120 kV network. To keep the circuit simple, only one phase of the circuit is represented.

Nonlinear Resistance Applied on a 120 kV Network

Using blocks of the powerlib and Simulink libraries, build this circuit. Group all components used to model the nonlinear model in a subsystem named Nonlinear Resistance. Use an X-Y Graph block to plot the V-I characteristic of the Nonlinear Resistance subsystem.

The model does not use a Look-Up Table block as in the case of the nonlinear inductance model. As the analytical expression of current as a function of voltage is known, the nonlinear I(V) characteristic is implemented directly with a Fcn block from the User-Defined Functions Simulink library.

This purely resistive model contains no states. It produces an algebraic loop in the state-space representation of the circuit, as shown in the next figure.

Algebraic Loop Introduced by the Nonlinear Resistance Model

Algebraic loops often lead to slow simulation times. You should break the loop with a block that does not change the nonlinear characteristic. Here a first-order transfer function H(s) = 1/(1+Ts) is introduced into the system, using a fast time constant (T = 0.01 µs).

Use the technique explained for the nonlinear inductance block to mask and customize your nonlinear resistance block as shown.

Dialog Box of the Nonlinear Resistance Block

Open the dialog box of your new masked block and enter the parameters shown in the figure above. Notice that the protection voltage Vo is set at 2 pu of the nominal system voltage. Adjust the source voltage at 2.3 pu by entering the following peak amplitude:

120e3/sqrt(3)*sqrt(2)*2.3

Save your circuit as circuit8.

Using the ode23tb integration algorithm, simulate your circuit8 system for 0.1 s. The results are shown below.

Current and Voltage Waveforms and V-I Characteristic Plotted by the X-Y Graph Block

Creating Your Own Library

You can create your own block libraries. To create a library, in the File menu choose New Library. A new Simulink window named Library: untitled opens. Now copy the Nonlinear Inductance block of your circuit7 system and the Nonlinear Resistance block of your circuit8 system into that library. Save this library as my_powerlib. Next time you develop a new model, you can add it to your personal library. You can also organize your library in different sublibraries according to their functions, as is done in the powerlib library.

Nonlinear Inductance and Resistance Blocks in my_powerlib

One advantage of using a library is that all blocks that you copy from that library are referenced to the library. In other words, if you make a correction in your library block, the correction is automatically applied to all circuits using that block.

Connecting Your Model with Other Nonlinear Blocks

You now learn how to avoid error messages that can appear with nonlinear blocks when they are simulated by a current source. Obviously, a current source cannot be connected in series with an inductor, another current source, or an open circuit. Such circuit topologies are forbidden in SimPowerSystems models.

Similarly, if your nonlinear model uses a Controlled Voltage Source block, this model could not be short-circuited or connected across a capacitor.

Suppose, for example, that you want to study the inrush current in a nonlinear inductance when it is energized on a voltage source. Using blocks from powerlib library and my_powerlibrary, you can build the circuit shown here. Change the Breaker block parameters as follows:

Snubber resistance Rs

inf (no snubber)

Snubber capacitance Cs

0

External control

Not selected

Switching times

[1/60]

Circuit Topology Causing an Error

If you try to simulate this circuit, you get the following error message.

This topology is forbidden because two nonlinear elements simulated by current sources are connected in series: the Breaker block and the Nonlinear Inductance block. To be able to simulate this circuit, you must provide a current path around one of the two nonlinear blocks. You could, for example, connect a large resistance, say 1 MΩ, across the Breaker block or the Inductance block.

In this case, it is more convenient to choose the Breaker block because a series RC snubber circuit is provided with the model. Open the Breaker block dialog box and specify the following snubber parameters:

Snubber resistance Rs (ohms)

1e6

Snubber capacitance Cs (F)

inf

Notice that to get a purely resistive snubber you have to use an infinite capacitance.

Make sure that the phase angle of the voltage source is zero. Use the ode23tb integration algorithm and simulate the circuit for 1 second. Voltage and current waveforms are shown here.

Current and Flux Waveforms When Energizing the Nonlinear Inductance with Maximum Flux Offset

The figure above shows that energizing the inductor at a zero crossing of voltage results in a maximum flux offset and saturation.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS