Skip to content

Subcircuit Search Path (Experimental)

crobarcro edited this page Jan 6, 2015 · 1 revision

Subcircuit Search Path (Experimental)

Qucs has an experimental subcircuit search path feature. This means your subcircuit schematics do not have to reside in the .qucs folder, or have an absolute path to work. Instead you can provide Qucs with a list of directories to search and just provide the name of the subcircuit. If you are familiar with the PYTHONPATH or the Matlab or Octave search path for functions, or the wndows PATH, it is intended to work in a similar way to this.

How it works:

  1. Add a directory to the search path. You can do this by going to

    File->Application Settings

    and opening the 'Locations' tab. There you can use the "Add Path" and "Add Path with Subfolders" buttons to add a path to the search path list. The current search path is also shown on this page. "Add Path" adds just the top level path selected to the list, while "Add Path with Subfolders" adds that folder and all subdirectories recursively.

    Click ok, or apply to save the new path.

  2. Create a Qucs subcircuit schematic in one of the paths you added in the previous stage.

  3. Now, when adding this subcircuit to a new higher level schematic you can set the name of the Qucs schematic file to either

    a) The absolute file path

    b) A file path relative to the Qucs working directory ( .qucs )

    c) Just the subcircuit file name including the '.sch' extension (e.g. just "mysubcircuit.sch")

    In the final case, Qucs looks for the circuit from a list of all the schematics in all the search paths you have provided. If also looks in two other places, the Qucs working directory (.qucs) and the same directory as containing schematic with the subcircuit in it.

If more than one circuit with that name exists in the list of paths, the circuit which is in the path lower in the list is chosen (in Octave this is known as shadowing). The lookup is performed on the schematic file name except the final extension, so you could avoid shadowing by creating crude 'namespaces' with your circuit names, e.g. naming some subcircuits in different folders in the path

audio.filter.sch
audio.rectifier.sch
power.rectifier.sch

would allow you to put power.rectifier in the subcircuit component and audio.rectifier in another without clashing.

What's the Point?

The purpose of all this is to make schematic files more portable. Previously, absolute file paths were used, which means a set of circuits moved from one computer to another would no longer work -- the file paths would be wrong. Now you can just use the file name, and ensure the other files are on the search path.

Clone this wiki locally