LTspice Lesson 4d: Generate Waveforms used in Electric Circuits: PWL FILE

LTspice Lesson 4c discussed creating a waveform using a handful of discrete points, but by using PWL FILE as shown below, large number of points can be easily imported into LTspice simulator to generate more sophisticated waveforms. In this lesson, we will create a practical system level ESD stimulus waveform as specified in IEC61000_4_2. Data points will created from an equation in IEC61000_4_2 standard using a Matlab script (download at the end if you interested).

Screen Shot 2019-12-10 at 11.14.06 AM.png

First of all why we need such a simulation in a first place? Electrostatic Discharged (ESD) is a big issue and a threat when it comes to designing products that interface with human beings (i.e usb ports, antenna, various connectors etc) . All of these paths connect to sensitive ICs inside the system and ESD discharge can easily ruin them. So various standard got develop to test real word use case scenarios. In particular IEC 61000-4-2 is a industry standard; your product won’t get UL certified if you don’t meet this standard [1] Standard spells out type of ESD pulses that need to be tested and it proposes type of ESD pulses that need to tested and could be simulated using RLC type models[1]. But the problem is some of the RLC models may not accurately model the type of pulse that is needed as shown below:

Screen Shot 2019-12-10 at 11.25.36 AM.png

Standard specifies test voltages ±2kV, ±4kV,±6kV,±8kV. We will create a discharge pulse under the ±4kV. The values of the parameters are I1 =16.6A, I2 =9.3A, τ1 =1.1ns, τ2 =2ns, τ3 =12ns, τ4 =37ns, and n=1.8 [2].

Equations to generate an ESD pulse are specified below [2]

Screen Shot 2019-12-10 at 11.29.27 AM.png

Matlab script to generate the data points is following:

Screen Shot 2019-12-10 at 1.14.55 PM.png

Let’s load this file into PWL File for verification :

Screen Shot 2019-12-10 at 1.18.49 PM.png

Screen Shot 2019-12-10 at 1.26.31 PM.png

Following values are extracted from the plot and seem well matched with the IEC61000-4-2 standard

Screen Shot 2019-12-10 at 1.27.23 PM.png

In general, a lot of complicated waveforms can be generated using PieceWise Linear approximation. This is especially useful if circuit or system need to be model for a non-standard waveforms.

Download Matlab and LTspice.



  1. International Electrotechnical Commission. International Standard IEC 61000-4-2: “Electromagnetic Compatibility (EMC), Part 4: Testing and Measurement Techniques, Section 2: Electrostatic Discharge Immunity Test–Basic EMC Publication”; 2008.
  2. Katsivelis, Pavlos & Fotis, G.P. & Gonos, Ioannis & Koussiouris, Trifon & Stathopulos, Ioannis. (2010). Electrostatic Discharge Current Linear Approach and Circuit Design Method. Energies. 3. 1728-1740. 10.3390/en3111728.


To discuss or provide a comment:


About ExploreSilicon

My name is Kashif. I live in the heart of silicon valley and have been living here for a very long time. My passion is engineering, technology and traveling. My email is Please feel free to contact if you have any suggestion or comments on any of my posts.
This entry was posted in LTspice for EE students and tagged , , . Bookmark the permalink.

3 Responses to LTspice Lesson 4d: Generate Waveforms used in Electric Circuits: PWL FILE

  1. Roshan says:

    could you share the PWL file as well

  2. Hi Roshan, added a link on the bottom to download the file.

  3. Tino says:

    Hi Kashif,
    Could you please also generate files for 2kV, 6kV and 8kV? I can’t find any values for I1 and I2 for these voltages.
    Thanks Tino

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s