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.

## 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,
• Relative permeability of core,
• Number of winding turns,
• Effective magnetic core length,
• Effective magnetic core cross-sectional area,
• Core saturation begins,
• Core fully saturated,
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,
• Magnetic field strength,

Linear representation:

Nonlinear representation (including coefficient, a):

% 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,
• Current,

Linear representation:

Nonlinear representation:

% 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, . Current, I, and magnetic flux, , 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' );