RF Toolbox 2.6
Modeling a High-Speed Backplane (Part 3: Rational Function Model to a Simulink® Model)
This demo shows how to use Simulink® to simulate a differential high-speed backplane channel. The demo first reads a Touchstone® data file that contains single-ended 4-port S-parameters for a differential high-speed backplane and converts them to 2-port differential S-parameters. It computes the transfer function of the differential circuit and uses the RATIONALFIT function to fit a closed-form rational function model to the circuit's transfer function. Then, the demo converts the poles and residues of the rational function model into the numerators and denominators of the Laplace Transform S-Domain transfer functions that it uses to build the Simulink model of the rational function.
To run this demo, you must have Simulink installed.
Contents
- Read the Single-Ended 4-Port S-Parameters and Convert Them to Differential 2-Port S-Parameters
- Compute the Transfer Function and Its Rational Function Representation
- Get the Numerator and Denominator of the Laplace Transform S-Domain Transfer Functions
- Build the Simulink Model of the Backplane
- Simulate the Simulink Model of the Rational Function
- Close the Model
Read the Single-Ended 4-Port S-Parameters and Convert Them to Differential 2-Port S-Parameters
Read a Touchstone data file into an RFDATA.DATA object using the object's READ method. The parameters in this data file are the 50-ohm S-parameters of a single-ended 4-port passive circuit, measured at 1496 frequencies ranging from 50 MHz to 15 GHz. Then, get the single-ended 4-port S-parameters from the data object, and use the matrix conversion function S2SDD to convert them to differential 2-port S-parameters.
FileName = 'default.s4p';
SingleEndedData = read(rfdata.data, FileName);
SingleEndedSparams = SingleEndedData.S_Parameters;
Freq = SingleEndedData.Freq;
DifferentialSparams = s2sdd(SingleEndedSparams);
Compute the Transfer Function and Its Rational Function Representation
First, use the S2TF function to compute the differential transfer function. Then, use the RATIONALFIT function to compute the closed form of the transfer function and store it in an RFMODEL.RATIONAL object. The RATIONALFIT function fits a rational function model to the specified data over the specified frequencies.
DifferentialTransFunc = s2tf(DifferentialSparams); FittingTolerance = -30; % Rational fitting tolerance in dB DelayFactor = 0.9; % Delay factor RationalFuncModel = ... rationalfit(Freq, DifferentialTransFunc, FittingTolerance, [], DelayFact or) nPoles = length(RationalFuncModel.A); disp(sprintf('The derived rational function contains %d poles.', nPoles));
RationalFuncModel =
Name: 'Rational Function'
A: [22x1 double]
C: [22x1 double]
D: 0
Delay: 6.0172e-009
The derived rational function contains 22 poles.
Get the Numerator and Denominator of the Laplace Transform S-Domain Transfer Functions
This demo uses Laplace Transform S-Domain transfer functions to represent the backplane in the Simulink model. Convert the poles and corresponding residues of the rational function model into numerator and denominator form for use in the Laplace Transform transfer function blocks. Each transfer function block represents either one real pole and the corresponding real residue, or a pair of complex conjugate poles and residues, so the transfer function block always has real coefficients. For this demo, the rational function model contains 2 real poles/residues and 10 pairs of complex poles/residues, so the Simulink model contains 12 transfer function blocks.
A = RationalFuncModel.A; C = RationalFuncModel.C; den = cell(size(A)); num = cell(size(A)); k = 1; % Index of poles and residues n = 0; % Index of numerators and denominators while k <= nPoles if isreal(A(k)) % Real poles n = n + 1; num{n} = C(k); den{n} = [1, -A(k)]; k = k + 1; else % Complex poles n = n + 1; real_a = real(A(k)); imag_a = imag(A(k)); real_c = real(C(k)); imag_c = imag(C(k)); num{n} = [2*real_c, -2*(real_a*real_c+imag_a*imag_c)]; den{n} = [1, -2*real_a, real_a^2+imag_a^2]; k = k + 2; end end den = den(1:n); num = num(1:n);
Build the Simulink Model of the Backplane
Build a Simulink model of the backplane using the Laplace Transform transfer functions. Then, connect a random source to the input of the backplane and a scope to its input and output.
ModelName = fliplr(strtok(fliplr(tempname), filesep)); simulink_rfmodel_build_rational_system_helper(ModelName , numel(num)) simulink_rfmodel_add_source_sink_helper(ModelName)
Figure 1. Simulink model for a rational function
Simulate the Simulink Model of the Rational Function
When you simulate the model, the Scope shows the impact of the differential backplane on the random input signal.
set_param([ModelName,'/Rational Model Output'], 'Open', 'on') set(findall(0, 'Type', 'Figure', 'Name', 'Rational Model Output'), ... 'Position', [200, 216, 901, 442]) sim(ModelName);
Close the Model
close_system(ModelName, 0)
Store