Parameterize Gate Driver from SPICE Netlist
This example shows how to parameterize the Simscape Electrical Gate Driver block from a manufacturer netlist using LTspice.
Gate Driver Parameterization
You can use a gate driver to drive the power electronics devices in any electrical converters. Gate drivers impact the switching characteristics, including turn-on losses, turn-on time, turn-off losses, and turn-off time. This diagram shows the workflow you follow in this example to parameterize the Simscape Electrical Gate Driver block. First you select a gate driver model netlist from the manufacturer website. Then you import this netlist subcircuit into LTspice, convert it into an LTspice block, and create a test harness circuit. For a given PWM input voltage, you simulate this netlist subcircuit in LTspice to obtain the gate driver output voltage. You then import the gate driver input and output voltage data in MATLAB® and use them as input arguments for the parameterization MATLAB® function. The parameterization function estimates the parameters of the Gate driver block. Finally, to validate the gate driver parameterization, you compare the output voltage of the Gate Driver block to the LTspice output for the same PWM input voltage.
Test Harness for Gate Driver in LTspice
In this example, you convert the gate driver netlist into an LTspice block. The manufacturer datasheet shows how to connect the LTspice Gate Driver block to the test circuit. Specify the values of the input voltage, resistance, and load capacitor from the datasheet. LTspice records the logical PWM input and gate driver output voltage across the load capacitance and exports the simulation data in a text file.
To open the GateDriverParameterizationBipolar
TXT file that contains the exported LTspice bipolar voltage simulation data, at the MATLAB Command Window, run:
edit 'GateDriverParameterizationBipolar.txt'
This figure shows the test harness circuit of the gate driver with unipolar output voltage:
This figure shows the test harness circuit of the gate driver with bipolar output voltage:
Test Harness for Gate Driver in Simscape
This figure shows the test harness circuit for the gate driver in Simscape™ Electrical™. The input to the gate driver is a pulse width modulation (PWM) signal. The output connects to a load capacitance that emulates the gate capacitor of the power electronics device.
open_system('GateDriverParameterization');
Import LTspice Simulation Data in MATLAB
Import the LTspice simulation data text file in MATLAB.
ltspiceDataFilename = 'GateDriverParameterizationBipolar.txt'; % Use GateDriverParameterizationBipolar.txt for bipolar simulation data % Use GateDriverParameterizationUnipolar for unipolar simulation data outputData = GateDriverParameterizationImportLTspice(ltspiceDataFilename,3);
Parameterize Gate Driver from LTspice Data
The GateDriverParameterizationFunction
MATLAB function uses the LTspice simulation data to parameterize the Simscape Electrical Gate Driver block.
To open the parameterization function, at the MATLAB Command Window, run:
edit 'GateDriverParameterizationFunction.m'
These are the estimated gate driver parameters:
Rise time
Fall time
ON propagation delay
OFF propagation delay
ON state voltage
OFF state voltage
Logic 1 input
Logic 0 input
outputData.Properties.VariableNames = ["time","pwmInput","gateDriverOutput"]; ltspice.pwmInput = outputData.pwmInput; % PWM pulse data from LTspice ltspice.gateDriverOutput = outputData.gateDriverOutput; % Gate driver output simulated from LTspice ltspice.timeArray = outputData.time; pwmThreshold = 1.5; % Parameterize gate driver block gateDriver = GateDriverParameterizationFunction(ltspice.timeArray,ltspice.pwmInput,ltspice.gateDriverOutput, pwmThreshold); % Input the load capacitor value used in the LTspice simulations gateDriver.loadCapacitor = 100e-12; % Load capacitance value in F disp(gateDriver);
riseTime: 2.4347e-09 onPropagationDelay: 8.9112e-08 offStateVoltage: -8.0000 onStateVoltage: 15 fallTime: 2.5158e-09 offPropagationDelay: 9.2386e-08 logic1: 2.7000 logic0: 0.3000 loadCapacitor: 1.0000e-10
Validate Gate Driver Parameterization
To validate the parameterized gate driver, use the Simscape Electrical test harness circuit. The test harness circuit is used to compare the Simscape gate driver output voltage with the LTspice gate driver output voltage for the same PWM input voltage. To open the comparison code, at a MATLAB Command Window, run:
edit 'GateDriverParameterizationCompare.m'
% Comparing the results % LTspice PWM input voltage pwmInputToSimulation = timetable(ltspice.pwmInput,'RowTimes',seconds(double(ltspice.timeArray))); ltspiceOutput = timetable(ltspice.gateDriverOutput,'RowTimes',seconds(double(ltspice.timeArray))); % Threshold value for PWM input pulse pwmThreshold = 1.5; simulationTime = ltspice.timeArray(end); % Comparing the result GateDriverParameterizationCompare;
Comparison between LTspice and simscapeResult Parameter LTspice simscapeOutput _________________________ __________ ______________ {'Rise Time' } 2.4347e-09 2.462e-09 {'Fall Time' } 2.5158e-09 2.5341e-09 {'ON Propagation Delay' } 8.9112e-08 8.923e-08 {'OFF Propagation Delay'} 9.2386e-08 9.5044e-08