Documentation‎ > ‎

Creating Mason-TinyCAD Models

Creating library components for new simulation components is not difficult, but does require a number of steps. This guide will hopefully cover the main points. TinyCAD actually has pretty good documentation, so I will not cover aspect of the TinyCAD interface.

General Model Information

Creating TinyCAD Libraries


Types of Model

Circuit Mason uses several different model types.  This guide will cover two: static models and dynamic models.  

"Static models" are commonly known as S-Parameter files, Touchstone files, or SNP (S2P, S3P, S4P, etc) files.  These files are usually based on measured data.  If you generate your own S-Parameter files, please review the "Touchstone File Format Specification Version 2.0" to make sure you get the parameters in the right order.

"Dynamic models" are not standard format files (though they use XML and are documented in this Wiki).  These models, coupled with a math parser, allow a mapping from physical or electrical properties to S-Parameters.  For example, there are models for microstrip lines and lumped element components.  

    Location of Models

By default, Mason installs models in a hierarchical structure somewhere in Documents and Settings.  The specific location can be found in a soft link under the Circuit Mason entry in the Start Menu.  This is one of the paths that Mason will use when trying to find a file.  

In the above folder, the default installation of Mason (before additional parts libraries are added) will include a "lumped_elements" folder, a "microstrip" folder, a "simple_transmission_lines" folder, and a "stripline" folder.  Each of these folders contains dynamic models.  If a model in Mason references "microstrip\mline.xml", then Mason will look for the file at: "C:\Documents and Settings\All Users\Application Data\CircuitMason\mason_models\microstrip\mline.xml"

If you install the "Panasonic" parts library, a "panasonic" folder will also be created.  If you drill down in the sub-folders, you will find a lot of Touchstone (S2P) files.  As with dynamic models, Mason will look for  "panasonic\cap_ecd_0603\ECDGZE1R0B.s2p" at "C:\Documents and Settings\All Users\Application Data\CircuitMason\mason_models\panasonic\cap_ecd_0603\ECDGZE1R0B.s2p".

There is nothing magical about this particular directory, it's simply a convenient place to store application data.  It is relatively simple to add more directories to the default search list.  Within the Mason install directory (by default, C:\Program Files\CircuitMason), append a new folder location to the file "paths.txt".  So, if you add "C:\data\bin\mason_models", Mason will look for files using that root path as well.

Creating a New Model

The process for creating a new static model is fairly straightforward, if a little tedious.  

As mentioned above, static models are generally results from measurements or other codes.  As mentioned above, make sure the format is compatible with the "Touchstone File Format Specification Version 2.0".  

Dynamic models are defined here.  The muParser functions are compatible with C; I recommend testing your code with C (or Matlab/Octave) before porting it into the dynamic model.  

Location of Models

First, decide where to put your new models.  

If this is a static model, let's examine the Panasonic 0402 caps (1005 is the metric, 0402 is the English). For this example, all of the S2P files are in "C:\Documents and Settings\All Users\Application Data\CircuitMason\mason_models\panasonic\cap_ecd_1005", which can be simply referenced as "panasonic\cap_ecd_1005" from within Mason or TinyCAD.  If the Pansonic parts library is installed, thirty S2P files should be in that folder.

If this is a dynamic model, let's examine the Microstrip model "microstrip\mline.xml", which is located at "C:\Documents and Settings\All Users\Application Data\CircuitMason\mason_models\microstrip\mline.xml"

Creating the Symbol

First, we need to create a new symbol by accessing the Library Setup dialog by hitting the "Libraries..." button, which is located at the top of the symbol selection toolbox.  The button is located in the upper left hand corner of Figure 1.

Figure 1: Accessing the Library Setup

Second, either create a "New" library or "Edit" the symbols in an existing library (see Figure 1).  If you create a "New" library, you will still need to "Edit" the symbols within a library on the list.  It is possible to "Add" an existing database, several TinyCAD libraries exist from which one can borrow artwork.  

When you "Edit" a selected library (see Figure 1), the menu in Figure 2 is displayed.  The "right-click" options are shown, which includes copying a symbol to another (or the same) library.  This makes reusing artwork from existing TinyCAD libraries easy.  
Figure 2: Editing the library

Forging a Static Symbol

Assuming a symbol has been duplicated, copied, or a new symbol has been created, it is time to edit the symbol properties (Figure 3).  For static symbols, the following Parameters need to be defined (case sensitive):
  1. Name
    1. The name of the device
    2. Could be a part name, or the name for a family of parts
  2. Reference
    1. the reference designator, such as "C?"  
    2. The question mark is a placeholder for a number which should be unique among all "C" components.
  3. Package
    1. This relates to the footprint used in PADS
    2. This is mostly important if this device will ever be exported to Layout
  4. Argument
    1. The component "value", which for a static device indicates which file is linked to this device
    2. Multiple files can be associated with a symbol
    3. One can optimize over this value, and search over a family of components for the best value
    4. This list is one-indexed (no 0th file)
    5. The Devices page explains how to write the argument.
  5. File
    1. Either one, or multiple files can be associated with a symbol
    2. One file per "File"
    3. A filename which may use either an absolute path, or a relative path based on a root folder in "paths.txt"
  6. File_desc
    1. Link the file-based "value" to a human readable value
    2. Order of "File_desc" is correlated with the order of "File" entries

Figure 3: Update Library Symbol Properties for a Family of Static Components

When Mason is run, it will append the file description (File_desc) to the schematic after you run Mason (the "M" button) and update the schematic (the "U" button).  One does not have to use the optimizer to take advantage of the "U" button.  Hit "S" to save the updated schematic permanently.

One technique I use often: in Figure 2, one of the right-click options is "export to XML".  It is far easier to make a big model like this using copy and paste in a text editor, than it is using TinyCAD's interface.  Then "import to XML" to get your changes loaded.

Forging a Dynamic Symbol

Creating a dynamic symbol is similar, but requires a different set of Parameters.  
  1. Name
    1. Human readable, descriptive name of the component
    2. As a point of style, generally try to include the library name with the part name
  2. Reference
    1. the reference designator, such as "TL?"  
    2. The question mark is a placeholder for a number which should be unique among all "TL" components.
  3. Package
    1. If the PCB footprint is described in an XML file (as below), the "file: filename"
    2. A normal PADS footprint name is also valid
  4. Argument
    1. The component variables, which may reference numbers (with or without units) or variables
    2. Multiple variables can be associated with a symbol
    3. One can optimize over these values
    4. The Devices page explains how to write the argument
    5. Try to make sure that the number of variables in this symbol matches the number of variables in the dynamic model!
  5. Primitive
    1. One file can be associated with a symbol
    2. A filename which may use either an absolute path, or a relative path based on a root folder in "paths.txt"

Figure 4: Update Library Symbol Properties for a Dynamic Component