Вы находитесь на странице: 1из 11

10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor

onics and Motor Control

LTspice IV hierarchical blocks (w/ example)


and Control Library
Posted on January 4, 2015

You all know the situation. You’d like to quickly simulate a new power electronics circuit or find
out how much unforeseen parasitic inductance would cause the ringing seen on the scope. This
calls for device-level, non-averaged SPICE simulations that contain all the parasitic capacitances
and inductances. The power electronics circuit itself usually takes very little time to draw but the
other blocks such as the PWM driver tend to take considerably longer to form and debug. In
Simulink we can make and debug such drivers once, create a subsystem and simply copy & paste
it from a project to the next one. This is considerably harder to do in LTspice IV (which is a nice
free alternative* to PLECS and Simulink). Well, it was until I figured out how to make my own
hierarchical, reusable blocks. Read further to see how to make one or download my library in the
link below. < control blocks for LTspice IV >

Blocks: phase leg PWM driver, signal sum, signal difference, signal gain, and signal saturation

(Figure above is taken from my library testbench)

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 1/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

* Yes, even places like my <current employer> or <previous employer> tend to utilize free
software. Sometimes it is a matter of personal preference but who would like to work with $100k+
software only? Since it was not immediately clear to me how to make hierachical blcoks, I have
written up a short tutorial.

How to make hierarchical blocks in LTspice IV?

1. Schematic
A. Create a new schematic (File – New Schematic, or CTRL-N).
B. Draw a circuit that will be the subsystem.
C. Assign input and output ports by placing a label on the nets (either right click or hit
“F4”).
D. Save the schematic under a descriptive name (sum, difference, PWM, gain, buck,…)
2. Symbol
A. Create a new symbol (File – New Symbol)
B. Add pins/ports (Edit – Add Pin/Port or “P”). These must be the same as the
schematic. Only the port polarity and name matter. Netlist order is generated
automatically.
C. Draw the symbol to your liking with rectangles (“R”), lines (“L”), circles (“C”), or arcs
(“A”). You can also add some text (“T”). I did not figure out how to change the text
font/color/size.
D. Add a name (attribute) and select the Symbol Type as “Block” (Edit – Attributes – Edit
Attributes or “CTRL-A”). You can also change the string “value” of the symbol in this
window.
E. Save the symbol under the same name (bar the extension) and the schematic name.
3. Done. Now you can use the symbol.

Synthesis of a PWM block follows:

1-A) Create a new schematic (File – New Schematic)

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 2/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

1-B) Draw a circuit that will be the subsystem. I have added some text and lines as well. The
default parameters are specified here as well. These can be overridden from the master level
schematic.

1-C) Assign input and output ports by putting a label on the nets (either right click or “F4”).

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 3/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

1-D) Save the schematic under a descriptive name (sum, difference, PWM, gain, buck,…)

2-A) Create a new symbol (File – New Symbol)

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 4/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

2-B) Add pins/ports (Edit – Add Pin/Port or “P”). These must be the same as the schematic. 2-C)
Draw the symbol to your liking with rectangles (“R”), lines (“L”), circles (“C”), or arcs (“A”). You can
also add some text (“T”).

2-D) Add a name (attribute) and select the Symbol Type as “Block”. You can also change the
string “value” of the symbol in this window (Edit – Attributes – Edit Attributes or “CTRL-A”). No
other changes are required.

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 5/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

2-E) Save the symbol under the same name (bar the extension) and the schematic name.

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 6/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

3) Done. Now you can use the symbol. Select “Component” or press “F2” when editing a new
schematic and change the Top Directory as shown below too see your new blocks.

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 7/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

How to pass a value to a hierarchical block:

1. Place the block. Default parameters should be .param inside the block itself. See step 1b
above.
2. Right click on the block and override the internal parameters:

See the example below – the PWM frequency is 300 kHz in the first block (default value) and 100
kHz in the second block.

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 8/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

Probing the hierarchical block Note: In order to probe the hierarchical subcircuit, it is
necessary enable saving the current and voltage simulation waveforms in the Control Panel:

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 9/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

And that is all for today, folks! Happy SPICE-ing!

© Tomas Sadilek 2014. Unauthorized use and/or duplication of this material without express and
written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links
may be used, provided that full and clear credit is given to Tomas Sadilek and “Tom’s Notes on
Power Electronics and Motor Control” with appropriate and specific direction to the original
content.

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 10/11
10/30/2017 LTspice IV hierarchical blocks (w/ example) and Control Library | Tom's Notes on Power Electronics and Motor Control

Advertisements

from $1,296

from $1,296

SHAR E T HIS:

 Twitter  Facebook

Like
Be the first to like this.

RELAT E D

FPGA / VHDL Enhanced Building Dyno, Part 3 - Building a Dyno, Part 4 –


PWM Generator Design - What has been happening? Closed-loop Current
Part 1 In "Power Electronics" Regulation
In "Power Electronics" In "Power Electronics"

This entry was posted in Power Electronics and tagged controls, knowledge, LTspice IV, pwm
by Tom. Bookmark the permalink [https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-
hierarchical-blocks-w-example-and-control-library/] .

https://tomontheroll.wordpress.com/2015/01/04/ltspice-iv-hierarchical-blocks-w-example-and-control-library/ 11/11

Вам также может понравиться