Simscape™ Power Systems™ Specialized Technology provides a wide collection of models. It can happen, however, that you need to interface your own model with the standard models provided in the Specialized Technology 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 sections, a simple saturable inductance and a nonlinear resistance serve as examples.
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 fluxcurrent 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 perunit system.
FluxCurrent 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:
$$\begin{array}{l}v=L\cdot \frac{di}{dt}=\frac{d\psi}{dt}\text{or}\psi ={\displaystyle \int v\cdot dt}\\ i=\frac{\psi}{L\left(\psi \right)}\end{array}$$
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
. A Simulink^{®} output
returning the flux has been added to the subsystem. You can connect
this output to a Scope block to
observe the flux.
The nonlinear model uses 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.
An Integrator block computes the flux from the voltage input, and a 1D Lookup Table block implements the saturation characteristic i = f(ψ) described by FluxCurrent Characteristic of the Nonlinear Inductance.
Implementation of a Nonlinear Inductance
Two Fourier blocks from the Control and Measurements/Measurements library are used to analyze the fundamental component and the DC component of the current.
Using blocks of the Simscape Power Systems Specialized Technology and Simulink libraries, build the circuit shown above. To implement the i =f(ψ) relation, specify the following vectors in the 1D Lookup Table block:
Breakpoints 1 (flux)  [1.25 1 1 1.25 ] *(120*sqrt(2)/(2*pi*60)) 
Table data (current)  [2 1 1 2]*(120*sqrt(2)/(4*pi*60)) 
Set the following parameters for the two sources:
AC source  
Peak amplitude 
 
Phase 
 
Frequency 
 
DC source  
Amplitude 

Adjust the simulation time to 1.5 s
and select
the ode23tb
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.
$$Peak\text{}Current=\frac{120\cdot \sqrt{2}}{2\cdot 2\pi \cdot 60}=0.225\text{}A$$
$$Peak\text{}Flux=\frac{120\cdot \sqrt{2}}{2\pi \cdot 60}=0.450\text{}V\cdot s$$
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 fluxcurrent 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.
You can create a mask that specifies the following prompts, variables, and values:
Nominal voltage (Volts rms): 
 120 
Nominal frequency (Hz): 
 60 
Unsaturated inductance (H): 
 2 
Saturation characteristic [i1(pu) phi1(pu); i2 phi2; ...]: 
 [0, 0; 1, 1; 2, 1.25] 
The following code in the mask initializations of the block
prepares the two vectors Current_vect
and Flux_vect
to
be used in the LookUp 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.
The technique for modeling a nonlinear resistance is similar to the one used for the nonlinear inductance.
A good example is a metaloxide varistor (MOV) having the following VI characteristic:
$$i={I}_{0}\cdot {\left(\frac{v}{{V}_{0}}\right)}^{\alpha}$$
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
This model is available in the power_nonlinearresistor example.
The model does not use a LookUp 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 Simulink library.
This purely resistive model contains no states. It produces an algebraic loop in the statespace representation of the circuit.
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 firstorder transfer function H(s) = 1/(1+Ts) is introduced into the system, using a fast time constant (T = 0.01 µs).
Nonlinear models implemented as a current source cannot be connected in series with an inductor, another current source, or an open circuit. Such circuit topologies cause errors in Simscape Power Systems.
Similarly, if your nonlinear model uses a Controlled Voltage Source block, this model could not be shortcircuited or connected across a capacitor.
Suppose, for example, that you want to study the inrush current in the nonlinear resistance of the power_nonlinearresistor example model when it is energized on a voltage source:
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.
Using an inductive source impedance (RL series) instead of a purely resistive impedance would have produced another error message, because the current source modeling the nonlinear inductance would have been in series with an inductance, even with a resistive snubber connected across the breaker. In such a case, you could add either a parallel resistance across the source impedance or a large shunt resistance connected between one breaker terminal and the source neutral terminal.