cute70.jpg
CuteStudio Ltd.
madeonamac.png
Schematic
Dep Sources
Load Save
Models
Print
Subcircs

CREATING SUB-CIRCUITS

SUMO provides a simple method of symbolising circuits; so that instances of it can be drawn into circuits like any other class of component. All circuits can have pictures or symbols associated with them - which are edited using the symbol editor .

To create a sub-circuit do the following:

  1. Draw the circuit, with NODE s where connections are required
  2. Draw a symbol for the circuit, with legs for the connections
  3. Connect the legs to the NODEs
  4. Click-on SYMBOLISE ( FILE menu)
  5. Add any required parameters from PARAMS ( FILE menu)
  6. Save the circuit


The supplied circuits TONES is a good example of sub-circuit use. This is a circuit of a bass and treble control, of the type commonly found in many radios. It uses an active filter to alter the tonal characteristics of the input, with two linear potentiometers modelled as sub-circuits. These sub-circuits are named POT_LIN .

m_9_subcircs_html_7611cadd.png

Drawing the circuit symbol

Start by ensuring that the required circuit is open and has at least one NODE. To draw a symbol for it, you have to enter the symbol editor. Do this by going to the FILE menu, and clicking-on SYMBOL .

The fine grid that is visible is the snap-grid for the picture primitives . The coarse grid maps onto the circuit grid, and defines the position of the drawing origin and the legs .

The primitives that are available for drawing are:

  • Line
  • Perimeter
  • Box
  • Ellipse
  • Text (not the values or names - the specified text only)


The drawing action is similar to entering components. The required colour and picture object is selected, and the object drawn onto the symbol. For example, to draw a line:

  1. Click-on the LINE box
  2. Position the mouse pointer over the symbol drawing area
  3. Press the left mouse button
  4. Move the mouse
  5. Release the left mouse button.


The picture primitives are all pre-selectable. For text, the required text is entered in the box just below the TEXT button. The coloured box selects the default colour or the colour of selected primitives.

Pressing CTRL while drawing will slow down the mouse for fine positioning .

Drawing legs and the origin

The symbol is not only a picture, it also has electrical significance. This information is used to connect it to the netlist prior to simulation. The position of the origin affects drawing the component into the circuit; the position of the legs determine its electrical connections. Legs and the origin can be located on any coarse grid position.

  • Drawing position - the origin

    To set the drawing origin of the symbol (shown by the bright red square), click-on ORIGIN, and click-on the desired position on the symbol drawing area. For simple two-leg components such as resistors, the origin is simply set to the same position as the left-hand leg. For other components it is generally set to the left-bottom corner.

    The orientation shown in the symbol editor for a symbol is EAST, i.e. the same as it will appear in the Parts-Bin and the way it will appear in the circuit if drawn in from left to right.

  • Electrical connection - the legs

    Legs establish the electrical connection between the circuit symbol and the parent circuit that it will be used in. The leg positions tell the schematic about the electrical connections during both symbol entering and netlisting. Each leg is assigned to a named node (a NODE component) in the circuit to establish the contact - see later.

    Selecting LEG and using the mouse on the (coarse grid) symbol drawing area allows you to toggle the presence of a leg at that position, indicated by a bright yellow square. When a new leg is added, a reference number appears next to it in brackets.

  • Moving the symbol around

    The symbol will usually be correctly sized within the drawing area, but PAN and ZOOM (controlled by <<>> and >><<) can manipulate the size and position of the symbol in the drawing window. These work on the coarse grid.


Connecting a symbol to its circuit

Firstly, the circuit must have a NODE, at each point in the circuit that requires connecting to a leg on the symbol. If there are none, press OK to return to the circuit, and add them.

m_9_subcircs_html_m5c19c4de.png

Here in POT_LIN the NODEs are N1, N2 and N3


Legs are connected to circuit NODEs via their names . If you change the name of a NODE, re-connect the leg in the symbol editor.

m_9_subcircs_html_72d99b8a.png
Pressing CONNECT opens small menus to connect NODEs to legs.

Select the leg to connect and click-on SET . Select the NODE to connect to it and press OK . When you exit from the assignment menus (click-on CLOSE ) the picture is re-drawn to reflect the new leg names.

Names of legs are initially (1), (2) etc. but will become the NODE names such as N1, N2 and N3 in POT_LIN .
m_9_subcircs_html_32c40f6d.png

This completes the connection between a symbol picture and its underlying circuit. Click-on OK to return to the circuit.

Prefixes, names and values

All symbols in SUMO are drawn with a name, and usually with a value too. While whether or not to display names, values and tolerances is controlled from the OPTIONS menu, a symbols individual name and value positioning is controlled from the symbol editor.

Prefix

Names have a prefix . For instance, a resistor begins with an R. This prefix is not for netlisting, as the separate netlisting prefix is set as a property of the target simulator, and not of the symbol. Thus a prefix can be any character or short string that you like. For instance, if you are modelling a crystal, you may want a prefix of XL. Just click-on PREFIX, type in "XL" and press ENTER.

Values

If drawing a symbol for a sub-circuit, the value is taken from the first parameter that the sub-circuit has (if any). Parameters can only be added to Sub-circuits after they have been symbolised from the FILE menu.

Positioning

Click-on NAMES . There are four positions for a symbol, they are east, south, west and north, and the direction depends upon how the symbol is drawn into the circuit.

m_9_subcircs_html_1f180182.png

m_9_subcircs_html_3ba03e6c.png

There is a separate position for the name, and the value, for each direction.

m_9_subcircs_html_m4c4cf487.png

m_9_subcircs_html_m1ca22cc9.png

Thus eight positions have to be defined.

For the value and the name there are four possible justifications for positioning the text. Each position can be justified for top-left, top-right, bottom-left and bottom-right. For examples look at existing component symbols by double-clicking on their entry in the Parts-Bin .

m_9_subcircs_html_m465b384e.png


So, to populate a symbol with the four name and values:

Go to the menu by clicking on NAMES.. .

For directions east, west, north and south:

  1. Click-on PLACE-NAME
  2. Select justification
  3. Click on the symbol to place the name
  4. Click-on PLACE-VALUE
  5. Select justification
  6. Click on the symbol to place value


Turning circuits into sub-circuits....

Once the symbol has been drawn, all legs have been connected to NODEs in the circuit, and the names and values have been positioned, the circuit can then be symbolised .

Open the FILE menu (ALT-F) and click-on SYMBOLISE . If all is well, the name of the circuit on the top menu-bar will change to indicate that the circuit is now a sub-circuit. e.g. if the name is "CIRCUIT", the name will change to "CIRCUIT (SUB)".

Once the (sub)circuit is closed, it cannot be opened for edit like a regular circuit via the FILE menu. To edit a sub-circuit, you must double-click on it's symbol in the Parts-Bin .

Local and Remote sub-circuits

All normal circuits are stored in a .GEN file - a SUMO generic data file. Thus a circuit called TEST will live in a file called TEST.GEN.

All sub-circuits are stored in a .SUB file . When a sub-circuit is created it is created in the current directory, and the original .GEN is removed. If the current directory is not the same as the directory that SUMO was installed into, there are two types of .SUB file:

  1. A local .SUB file lives in the current directory, and over-rides any remote .SUB files of the same name.
  2. A remote .SUB file lives in the SUMO installation directory, and is always accessible, unless masked by a local .SUB file of the same name.


Sub-circuit parameters

The PARAMETERS menu is used to set components parameters. It is opened by double-clicking on the component symbol, or selecting it and clicking-on PARAMS in the left-hand drawing menu.

Sub-circuits can use parameters just like any other component. A sub-circuit parameter is not related to the class PARAMETER in the Parts-Bin, although in a way its use is similar.

m_9_subcircs_html_674152cc.png


If the current circuit is a sub-circuit, the FILE menu contains a button labelled PARAMS . This opens a menu for the creation and editing of the sub-circuit's parameters.

m_9_subcircs_html_m4303ee63.png


Sub-circuit parameters require the following information:

  • The parameter name
  • A description of the parameter
  • The default value


Be careful however when editing a sub-circuit (or a component class) that is already in use, as re-naming parameters that have been used causes SUMO to issue errors .

What to do with the new parameter

Expressions are entered via the VALUE menu as described earlier. These expressions can contain variables . Acceptable variables are:

  • Names of parameters (if in a sub-circuit)
  • Names of other components (lower priority than parameters)


Therefore a sub-circuit parameter such as 'angle' in POT_LIN, can be used in expressions (used to set values and other parameters) within the sub-circuit. For instance within POT_LIN the resistors R1 and R2 have values based upon the two parameters 'angle' and 'value':

NameDescriptionDefault
"value""Value of potentiometer"100k
"angle""Angle, 0 -> 1, 0 is N1 = N2"500m

ResistorValue (Expression)
"R1""value * angle"
"R2""value - R1"

Thus POT_LINs two parameters can be set from the parent circuit that uses it, and those parameters can be used directly in the sub-circuit. The POT_LIN circuit therefore behaves like a new class of component:

m_9_subcircs_html_m342254af.png


Note: The PARAMETER components ([P] named 'value' and 'angle') in the sub-circuit 'pot_lin' are not used because sub-circuit parameters named 'value' and 'angle' have also been defined. These have higher priority in expressions. However, before a circuit becomes a sub-circuit it has no sub-circuit parameters, so PARAMETER components serve as useful surrogates for testing a circuit before it becomes a sub-circuit.

PARAMETERs can also be usefully employed in the sweeper part of the Monte-Carlo/Sweeper option (detailed in the sweeper section).
Copyright © 2007-2009, CuteStudio Ltd.
Page generated in 0.921s, Powered by Silk V1.1-1 from Cutestudio