Qucs File Formats

This document describes the schematic and library file formats of Qucs.

Schematic file format

This format is used for schematics (usually with suffix .sch) and for data displays (usually with suffix .dpl). The following text shows a short example of a schematic file.

<Qucs Schematic 0.0.6>
<Properties>
  <View=0,0,800,800,1,0,0>
</Properties>
<Symbol>
  <.ID -20 14 SUB>
</Symbol>
<Components>
  <R R1 1 180 150 15 -26 0 1 "50 Ohm" 1 "26.85" 0 "european" 0>
  <GND * 1 180 180 0 0 0 0>
</Components>
<Wires>
  <180 100 180 120 "" 0 0 0 "">
  <120 100 180 100 "Input" 170 70 21 "">
</Wires>
<Diagrams>
  <Polar 300 250 200 200 1 #c0c0c0 1 00 1 0 1 1 1 0 5 15 1 0 1 1 315 0 225 "" "" "">
    <"acnoise2:S[2,1]" #0000ff 0 3 0 0 0>
    <Mkr 6e+09 118 -195 3 0 0>
  </Polar>
</Diagrams>
<Paintings>
  <Arrow 210 320 50 -100 20 8 #000000 0 1>
</Paintings>

このファイルにはいくつかのセクションが入っています。以下でそれぞれを説明します。すべての行は、小なり記号(<)で始まり大なり記号(>)で終わる1つを 超えることのない情報ブロックから構成されます。

プロパティー

この最初のセクションは <Properties> で始まり、 </Properties> で終わります。 これには、ファイルの文書としてのプロパティが含まれます。以下のようなプロパティがサポートされています:

  • <View=x1,y1,x2,y2,scale,xpos,ypos> には、最初の4つの数字で、回路図ウィンドウのピクセルの位置、(最後の2つの数で)現在のスケール、それから現在の左上のコーナの位置が入っています。
  • <Grid=x,y,on> には、グリッドの距離をピクセルで(最初の2つの数字)、それからグリッドがオン(最後の数字が1)かオフ(最後の数字が0)かを含んでいます。
  • <DataSet=name.dat> は、この回路図に関係したデータセットの名前を含みます。
  • <DataDisplay=name.dpl> には、この回路図に関係したデータ表示のページのファイル名(または、文書がデータ表示であるなら、回路図の名前)が含まれます。
  • <OpenDisplay=yes> には、もしもデータ表示のページがシミュレーション後に自動的に開くなら1、そうでなければ0が入ります。
  • <Script=name.m> contains the file name of the octave script associated with this schematic.
  • <RunScript=0> contains 1 if the octave script is executed after the simulation.
  • <showFrame=0> specify if a frame is drawn and if so which size it is. valid values are 0 (do not show a frame), 1 (A5 landscape), 2 (A5 portrait), 3 (A4 landscape), 4 (A4 portrait), 5 (A3 landscape), 6 (A3 portrait), 7 (letter landscape) and 8 (letter portrait).
  • <FrameText0=NE555 sub-circuit model>, FrameText1=Draw by: anonymous, FrameText2=Date: 1984, and <FrameText3=Revision: 42> specifiy the texts to be placed into the frame text boxes.

Symbol

このセクションは <Symbol> ではじまり </Symbol> で終わります。これには、ファイルに対する回路図シンボルを生成する作図要素が含まれます。これは、通常サブサーキットのための回路図ファイルのためだけに使われます。

Refers to “Symbol definition” in the “Shared file format” section at the end of this document.

部品

このセクションは``<Components>`` で始まり </Components> で終わります。 これには、回路図の回路部品を含みます。各行のフォーマットは以下の通りです:

<type name active x y xtext ytext mirrorX rotate "Value1" visible "Value2" visible ...>
  • type は、部品の識別するもので、例えば抵抗なら R 、キャパシタなら C です。
  • name は、回路図中の部品のユニークな識別子、例えば最初の抵抗なら``R1`` です。
  • active 欄の 1 は、その部品がアクティブであること、すなわち回路図で使われることを示します。 0 は、アクティブでないという意味です。
  • 次の2つの数字は、部品の中心のx座標とy座標です。
  • その次の2つの数字は、部品についてのテキストの左上のコーナのx座標とy座標です。それらは、部品の中心に対する相対位置です。
  • その次の2つの数字は、x軸についてのミラーの有無(1 ならミラーあり、0はなし)と逆時計回りの回転(90度の倍数、つまり0...3)を示します。
  • その後は、部品のプロパティの値(引用符の中)とそれに続いて、プロパティが回路図上に表示されるなら 1 (そうでなければ 0 )という項目が続きます。

Wires

このセクションは、 <Wires> で始まり、 </Wires> で終わります。これには、配線(回路部品の間の電気的な結線)とそれらのラベルとノードセット情報が含まれます。行の形式は以下のようになります:

<x1 y1 x2 y2 "label" xlabel ylabel dlabel "node set">
  • 最初の4つの数字は、配線のピクセル座標:開始点のx座標、開始点のy座標、終止点のx座標と終止点のy座標、です。すべての配線は、水平方向(両方のx座標が同じ)または垂直方向(y座標が同じ)でなくてはなりません。
  • 引用符に囲まれた最初の文字列はラベルの名前です。それは配線にラベルが 付けられていなければ 空白です。
  • 次の2つの数字は、ラベルのx座標とy座標であり、ラベルが 無ければ0です。
  • The next number is the distance between the wire starting point and the point where the label is set on the wire.
  • 最後の引用符に囲われた文字列は、この配線のノードセット電圧、すなわちシミュレーションエンジンが解を見つかるために使うノード電圧の初期値です。この配線がユーザによりノードセットされていなければ空白です。

Diagrams

このセクションは <Diagrams> で始まり </Diagrams> で終わります。これは、グラフとマーカの図を含みます。行の形式は以下の通りです(改行は禁止されてます):

<diatype x y width height grid gridcolor gridstyle log xAutoscale xmin
 xstep xmax yAutoscale ymin ystep ymax zAutoscale zmin zstep zmax
 xrotate yrotate zrotate "xlabel" "ylabel" "zlabel" "[freq Hz;]*">
    <"graphvar" color thickness precision numberformat style axisside>
    <Mkr x y precision numberformat transparent>
</diatype>

Diagram line format:

  • The diatype token specifies the type of diagram.
  • The x and y numbers are the coordinate of lower left corner.
  • The width and height numbers of diagram boundings.
  • The grid flags with 1 if grid is on and 0 if grid is off.
  • The gridColor in 24 bit hexadecimal RGB value, e.g. #FF0000 is red.
  • The gridstyle is the line style sued of the grid.
  • The log has two field to flag which axes have logarithmical scale.
  • The xAutoscale, xmin, xstep, xmax configure the x-axis scaling, limits.
  • The yAutoscale, ymin, ystep, ymax configure the y-axis scaling, limits.
  • The zAutoscale, zmin, zstep, zmax configure the z-axis scaling, limits.
  • The xrotate, yrotate, zrotate numbers set the 3D rotation.
  • The xlabel, ylabel, zlabel hold the labels used on each axis.
  • The list of frequencies "[freq Hz;]*" is used by Phasor and Waveac.

Here is a list of known diagram types:

  • Curve for a locus curve diagram.
  • Smith for an impedance Smith diagram.
  • ySmith for an admittance Smith diagram.
  • PS for a mixed polar/smith diagram.
  • SP for a upper-half mixed polar/smith diagram.
  • Polar for a polar diagram.
  • Rect for a 2D-cartesian diagram.
  • Rect3D for a 3D-cartesain diagram.
  • Tab for a tabular diagram.
  • Time for a timing diagram.
  • Truth for a truth-table diagram.
  • Phasor for a complex phasor diagram.
  • Waveac for a wave as temporal diagram.

Graph line format:

  • The graphvar specify the variable this graph is plotting for.
  • The color, thickness and style refers to the pen used to draw the curve.
  • The precision specify the number of digits used when displaying data values.
  • The numberformat is an integer that specify how the number are formated (0 for real/imag, 1 for polar/deg and 2 for polar/rad).
  • The axisside is an integer indicating on which side the Y axis should be placed ().

Marker line format:

  • The x and y are the location of the marker.
  • The precision ...
  • The numberformat ...
  • The transparent

Paintings

このセクションは <Paintings> で始まり、 </Paintings> で終わります。これには、回路図に含まれる絵柄が入っています。

Refers to “Shared file format” section below.

Library file format

This format is used for libraries (usually with suffix .lib). The following text shows a short example of a library file.

<Qucs Library 0.0.14 "Ideal">
<DefaultSymbol>
  <.ID -26 13 D>
  <Line -30 0 60 0 #000080 2 1>
  <Line -6 -9 0 18 #000080 2 1>
  <Line 6 -9 0 18 #000080 2 1>
  <Line -6 0 12 -9 #000080 2 1>
  <Line -6 0 12 9 #000080 2 1>
  <Line -6 9 4 0 #000080 2 1>
  <.PortSym -30 0 1 0>
  <.PortSym 30 0 2 180>
</DefaultSymbol>
<Component VSum>
  <Description>
Voltage adder
  </Description>
  <Model>
.Def:Ideal_AP1 _net3 _net2 fc="1E3"
Sub:VSUB1 _net0 _net1 _net2 Type="VSub"
Sub:LP1F1 _net3 _net0 Type="LP1" fc="fc2" V0="0"
Sub:HP1F1 _net3 _net1 Type="HP1" fc="fc2"
Eqn:Eqn1 fc2="fc/0.6436" Export="yes"
.Def:End
  </Model>
  <ModelIncludes "HP1.sch.lst" "LP1.sch.lst" "VSub.sch.lst">
  <Symbol>
    <Ellipse -20 -20 40 40 #000080 2 1 #c0c0c0 1 0>
    <Line -10 0 20 0 #000080 1 1>
    <Line 0 -10 0 20 #000080 1 1>
    <Line 0 30 0 -10 #000080 2 1>
    <.PortSym 0 30 2 0>
    <.PortSym 30 0 3 180>
    <Line 20 0 10 0 #000080 2 1>
    <.ID 10 14 VADD>
    <Line 0 -20 0 -10 #000080 2 1>
    <.PortSym 0 -30 1 0>
  </Symbol>
</Component>

The first line specify that this file is a Qucs library file generated by Qucs 0.0.14 and that the library is named “Ideal”.

The file contains on optional DefaultSymbol section, followed by Component sections. Each section is explained below.

Default symbol

This section starts with <DefaultSymbol> and ends with </DefaultSymbol>. It contains painting elements creating a default schematic symbol for any subsequent component declaration that doesn’t define its own.

Refers to “Shared file format” section below.

Component

This section starts with <Component> and ends with </Component>. It contains the component definition for use with schematic documents.

The component section is an aggregation of the following sub-sections:

  • <Description> and </Description> contain lines of free text describing the component function.
  • <Model> and </Model> contain the Qucsator netlist lines for this component.
  • <ModelIncludes "value0" "value1" ...> ...
  • <Spice> and </Spice>` are optional and contain the Spice netlist lines for this component.
  • <Symbol> and </Symbol> are optional and contain painting elements defining the schematic symbol to be used with this component. Refers to “Symbol definition” section below.

Shared file format

Painting elements

A painting line can be found in:

  • The Paintings section of a schematic file.
  • The Symbol sections of a schematic file.
  • The DefaultSymbol section of a library file.
  • The Symbol section (sub-section of Component) of a library file.

A painting line has one of the following format:

  • <Rectangle x y width height pencolor penwidth penstyle brushcolor brushstyle filled> ...
  • <Ellipse  x y width height pencolor penwidth penstyle brushcolor brushstyle filled> ...
  • <EArc x y startangle spanangle width height pencolor penwidth penstyle brushcolor brushstyle filled> ...
  • <Text x y size color angle "text"> ...
  • <Line x1 y1 x2 y2 pencolor penwidth penstyle > ...
  • <Arrow x1 y1 x2 y2 x3 y3 pencolor penwidth penstyle > ...

Symbol definition

A symbol definition can contains any painting element as described in the previous section. In addition to the painting elements, a symbol definition must contain one .ID line and one or more .PortSym lines.

The .ID line has the following format:

<.ID x y name "property1" "property2" ...>

Where:

  • x and y are the center coordinates of the symbol.
  • name will be used as a name prefix when instanciating this symbol on a schematic sheet.
  • propertyX are used for symbol definition within a schematic file, these parameter will be associated with the symbol instance and communicated to the sub-schematic. The format for such a property is `displayed=name=value=description=unknown`.

The .PortSym line has the following format:

<.PortSym x y caption angle>

Where:

  • x and y are the coordinates of the port.
  • caption is the name/caption of the port.
  • angle is an angle value, it is ignored (backward compatibility).

back to the top