MATLAB Examples

Custom Inductor (B-H Curve)

This example shows a comparison in behavior of a linear and nonlinear inductor. Starting with fundamental parameter values, the parameters for linear and nonlinear representations are derived. These parameters are then used in a Simscape™ model and the simulation outputs compared.

Contents

Open Model

modelName = 'pe_custom_inductor';
open_system( modelName );

Specification of Parameters

Fundamental parameter values used as the basis for subsequent calculations:

  • Permeability of free space, $\mu_0, \rm{H/m}$
  • Relative permeability of core, $\mu_r$
  • Number of winding turns, $N_w$
  • Effective magnetic core length, $l_e, \rm{m}$
  • Effective magnetic core cross-sectional area, $A_e, \rm{m^2}$
  • Core saturation begins, $B_{sat_{begin}}, \rm{T}$
  • Core fully saturated, $B_{sat}, \rm{T}$
mu_0 = pi*4e-7;
mu_r = 3000;
Nw = 100;
le = 0.02;
Ae = 1e-05;
B_sat_begin = 0.75;
B_sat = 1.5;

Calculate Magnetic Flux Density and Magnetic Field Strength Data

Where:

  • Magnetic flux density, $B, \rm{T}$
  • Magnetic field strength, $H, \rm{A/m}$

Linear representation:

  • $B = \mu_0 \mu_r H$

Nonlinear representation (including coefficient, a):

  • $B = B_{sat} \tanh(a.H)$
% Use linear representation to find value of H corresponding to B_sat_begin
H_sat_begin = B_sat_begin/(mu_0*mu_r);
% Rearrange nonlinear representation to calculate coefficient, a
a = atanh( B_sat_begin/B_sat )/H_sat_begin;

% Linear representation
H_linear = [-500 500];
B_linear = mu_0*mu_r*H_linear;

% Nonlinear representation
H_nonlinear = -5*H_sat_begin:H_sat_begin:5*H_sat_begin;
B_nonlinear = B_sat*tanh(a*H_nonlinear);

Display Magnetic Flux Density Versus Magnetic Field Strength

The linear and nonlinear representations can be overlaid.

figure,plot( H_linear, B_linear, H_nonlinear, B_nonlinear );
grid( 'on' );
title( 'Magnetic flux density, B, versus Magnetic field strength, H' );
xlabel( 'Magnetic field strength, H (A/m)' );
ylabel( 'Magnetic flux density, B (T)' );
legend( 'B=\mu_0 \mu_r H', 'B-H curve', 'Location', 'NorthWest' )

Calculate Magnetic Flux and Current Data

Where:

  • Magnetic flux, $\phi, \rm{Wb}$
  • Current, $I, \rm{A}$

Linear representation:

  • $L = \mu_0 \mu_r A_e N_w^2/l_e$
  • $\phi = I L/N_w$

Nonlinear representation:

  • $I = H l_e/N_w$
  • $\phi = B A_e$
% Linear inductance
L_linear = mu_0*mu_r*Ae*Nw^2/le;

% Linear representation
I_linear = [-1.5 1.5];
phi_linear = I_linear.*L_linear/Nw;

% Nonlinear representation
I_nonlinear = le.*H_nonlinear./Nw;
phi_nonlinear = B_nonlinear.*Ae;

Display Magnetic Flux Versus Current

The linear and nonlinear representations can be overlaid.

figure, plot( I_linear, phi_linear, I_nonlinear, phi_nonlinear );
grid( 'on' );
title( 'Magnetic flux, \phi, versus current, I' );
xlabel( 'Current, I (A)' );
ylabel( 'Magnetic flux, \phi (Wb)' );
xlim([-0.2 0.2]);
ylim([-2e-5 2e-5]);
legend( '\phi=I L/N_w', '\phi-I curve', 'Location', 'NorthWest' );

Use Parameters in Simscape Model

The parameters calculated can now be used in a Simscape model. Once simulated, the model is set to create a Simscape logging variable, simlog.

sim( modelName );

Conclusion

The state variable for both representations is magnetic flux, $\phi$. Current, I, and magnetic flux, $\phi$, can be obtained from the Simscape logging variable, simlog, for each representation. Overlaying the simulation results from the representations permits direct comparison.

figure, plot( ...
    simlog.Inductor_linear_magnetic_flux.i.series.values,...
    simlog.Inductor_linear_magnetic_flux.phi.series.values,...
    simlog.Inductor_B_H_curve.i.series.values,...
    simlog.Inductor_B_H_curve.phi.series.values );
grid( 'on' );
title( 'Magnetic flux, \phi, versus current, I' );
xlabel( 'Current, I (A)' );
ylabel( 'Magnetic flux, \phi (Wb)' );
xlim([-0.2 0.2]);
ylim([-2e-5 2e-5]);
legend( 'Linear (single inductance)', 'B-H characteristic', 'Location', 'NorthWest' );