# Custom Transformer (B-H Curve)

This example shows calculation and confirmation of a nonlinear transformer core magnetization characteristic. Starting with fundamental parameter values, the core characteristic is derived. This is then used in a Simscape™ model of an example test circuit which can be used to plot the core magnetization characteristic on an oscilloscope. Model outputs are then compared to the known values.

## Contents

## Open Model

```
modelName = 'pe_custom_transformer';
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 primary turns,
- Number of secondary 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; N1 = 100; N2 = 200; le = 0.1; Ae = 1e-4; B_sat_begin = 0.6; B_sat = 1.2;

## Calculate Magnetic Flux Density Versus Magnetic Field Strength Characteristic

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; % Nonlinear representation H_nonlinear = -750:25:750; B_nonlinear = B_sat*tanh(a*H_nonlinear);

## Use Parameters in Simscape Model

The parameters calculated can now be used in a Simscape model. Once simulated, the model is set to output a Simscape logging variable, simlog, and some signals using output ports, yout. Circuit parameters are:

- Voltage source magnitude,
- Voltage source frequency,
- Voltage source resistance,
- Operational amplifier input resistance,
- Operational amplifier feedback resistance,
- Operational amplifier feedback capacitance,

% Circuit parameters Vs = 10; Freq_Hz = 60; R_Vs = 10; R_1 = 1e3; R_2 = 1e6; C_2 = 1e-6; % Simulate model simOut = sim( modelName ); yout = get(simOut, 'yout'); simlog = get(simOut, 'simlog'); % Collect internal Simscape logging data for comparison I_simscape = simlog.Transformer_B_H_curve.L_m.i.series.values; phi_simscape = simlog.Transformer_B_H_curve.L_m.phi.series.values; % Collect model output data for comparison (as used for oscilloscope) I_primary = yout(:,1); int_V_secondary = yout(:,2);

## Calculations on Logging and Output Data

The data needs to be processed to provide the Magnetic field strength and Magnetic flux density data for comparison. Where:

- Magnetomotive force,
- Magnetic flux,
- Operational amplifier input voltage,
- Operational amplifier output voltage,

Equations to be used are as follows:

% Internal logging data H_simscape = I_simscape.*N1./le; B_simscape = phi_simscape./Ae; % Oscilloscope scaling and model output data H_measured = I_primary.*N1./le; phi_measured = (int_V_secondary.*R_1.*C_2)./N2; B_measured = phi_measured./Ae;

## Conclusion

The three characteristics can now be overlaid:

- Defined characteristic: calculated from fundamental parameters
- Characteristic from logging: calculated from internal Simscape logging data
- Characteristic from measurement: obtained by measurement and calculation using electronic test circuit

Due to leakage and parasitic parameters, the characteristic obtained from the electronic test circuit differs to the defined characteristic. However, the test circuit and its parameterization is shown to find the characteristic for the given transformer within suitable tolerances.

figure, plot( ... H_nonlinear,... B_nonlinear,... 'o',... H_simscape,... B_simscape,... H_measured,... B_measured,... '--'... ); 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( 'Defined characteristic', 'Characteristic from logging',... 'Characteristic from measurements', 'Location', 'NorthWest' );