LTspice-Circuit hierarchy(blocked)

In this article, we will explain how to hierarchize(block) the circuit drawn by LTspice's schematic editor.
When circuits are large and complex, some circuits can be hierarchized(blocked) to improve the readability of the schematic.
In addition, block circuits created hierarchically can be used in multiple applications within the same schematic or in other schematics.
What is circuit hierarchy(blocked)?
In this article, we will try to hierarchize(block) the amplification part surrounded by the red frame of the "Inverting Amplifier Circuit" created in the following article.



It is hierarchized as follows, and the block circuit below the hierarchy is included in the schematic above the hierarchy.

We have prepared a schematic of "op amp inverting circuit", so if you want to hierarchize(block) the circuit immediately, please download it by clicking the link below.
Create block circuit

Open the schematic(sample-circuit-lt1028.asc) of the "op amp inverting circuit" and delete all circuits except red frame.

Click "Label Net" on the toolbar and wire the label to each terminal as above. This completes the block circuit.

Click "File"-"Save As" on the menu bar to save.

It does not matter what storage location or name. In this article, it was saved as "inverting-amp-block.asc" in "C:\Users\USER\Documents\LTspiceXVII".
Create symbol

Click "Hierachy-Open this Sheet's Symbol" to automatically create a schematic symbol for the block circuit.

"Couldn't find this sheet's symbol. Shall I try to automatically generate one?"
Is displayed, click “Yes”.

As mentioned above, schematic symbols are created automatically.

Also, it is saved with the same name in the same folder as the schematic. In this case, it is saved as "inverting-amp-block.asy" in "C:\Users\USER\Documents\LTspiceXVII".

However, since it is difficult to wire with this pin arrangement, change the pin arrangement.
See the following articles for more information, including moving pin locations.

After placing the pins, save them by "Save" on the toolbar.
How to use block circuit

Open the schematic(sample-circuit-lt1028.asc) of the "Inverting Amplifier Circuit" and delete all circuits in red frame.

Click "Component" on the toolbar.

Change the Top Directory to "LTspiceXVII" and select "inverting-amp-block".

As above, place "inverting-amp-block" and wire each part, label and GND respectively.

Click "File"-"Save As" on the menu bar to save.

It does not matter what storage location or name. In this article, it was saved as "sample-circuit-lt1028-block.asc" in "C:\Users\USER\Documents\LTspiceXVII".
This completes the hierarchization(blocking) of the circuit. The block circuit placed can be used as a "2x inverting amplifier".
Parameter passing between hierarchies
The circuit has been hierarchized(blocked), but it is difficult to use it in other circuits because the gain of "2-fold inverting amplifier" is fixed.
So, let's make it easy to set the gain in the circuit above the hierarchy by passing parameters between hierarchies.

Right-click of the mouse on the block circuit to open the "Navigate / Edit Schematic Block" screen.

Click "Open Schematic".

A schematic of the block circuit is displayed. Right click of the mouse R2 and change "Resistance[Ω]" to "{gain*100}".

Return to the circuit above the hierarchy, right-click of the mouse on the block circuit and open the "Navigate / Edit Schematic Block" screen.
By inputting "gain" to PARAMS, you can freely set the block circuit gain. For example, if "gain = 2", the amplification factor will be doubled.

Now that parameter passing between hierarchies is complete, save the block circuit.

Similarly, save the circuit above the hierarchy.
You can download the hierarchized(blocked) schematic from the link below.