Parameterization is probably the most important topic presented in this course when it comes to developing reusable modeling blocks to flesh out your SIMetrix and SIMPLIS modeling toolkit. A library of properly parameterized subcircuits, whether in sub-schematic or ASCII text form, allows you and your team to spend less time re-implementing the "known" and more time developing your new design IP. In this topic you are introduced to the basics of parameterization, how the netlist preprocessor resolves expressions into real numbers and the scope of parameters.
To download the examples for Module 5, click Module_5_Examples.zip.
In this topic:
This topic addresses the following key concepts:
In this topic, you will learn the following:
Adding parameters to primitive models, such as resistors, capacitors, and inductors, is easy. You simply enclose the parameter value in curly braces when you enter it in the parameter-editing dialog. For example, the resistor pictured below uses the parameter RLoad for the resistance value:
The text {RLoad} is an expression. In this case, the expression is just the parameter itself; however, you can define the expression as any arbitrary mathematical expression involving parameters and functions as shown in the examples below:
Expression | Description |
{Vin} | Simple expression involving a single parameter |
{Vout_nom/Iload} | An expression using two parameters, in this case, to calculate a load resistor |
{C5_val*Gauss(0.05)} | An expression using a single parameter and a probability distribution function |
Parameters are often defined in the command (F11) window of the schematic using a .VAR statement. In the next exercise, you will learn how parameter values are used in a primitive capacitor model.
.var C5_val=22n
Parameters defined in the F11 window can be used to parameterize primitive models.
The capacitor C5 is a primitive capacitor, which is a built-in SIMPLIS model.
In the 3.0.1 What Happens When You Press F9? topic, you learned how the netlisting process works. In that topic you learned how the netlister substitutes symbol properties in the SIMPLIS_TEMPLATE or TEMPLATE property to generate the netlist entry for a symbol.
The resulting netlist instantiation line defines the electrical device used in the simulation. The instantiation line for the capacitor C5 is as follows:
C5 42 46 {C5_val*Gauss(0.05)} IC=-1.7
The capacitor value is stored on the VALUE symbol property which includes both the parameter expression and the initial condition:
The point here is that although the parameter value is defined in the F11 window, the expression containing the parameter must be stored on the VALUE symbol property so that the netlist entry can be generated. As the netlister processes each symbol, it does not know the parameter value is defined in the F11 window. Instead, the netlister simply substitutes the VALUE symbol property into the SIMPLIS_TEMPLATE in place of the text %VALUE%.
The capacitor in this example stores multiple electrical parameters on a single symbol property. This is the single property method and is covered in the Single-Property Method topic. One of the other ways to store parameters is the Multi-Property Method, which stores each electrical parameter on a single symbol property.
By default, parameters are local to the schematic where the parameter is defined. Separate files for each schematic create multiple hierarchy levels. At any schematic level, all parameters defined in the F11 window of the schematic can be used on symbols located on that schematic. Parameters defined in one schematic cannot be used in other schematics unless the parameter is passed down through the symbol or unless the parameter is global. This allows the same parameter name to be used in different schematic components with different values.
The next exercise explores the scope of parameters.
.VAR CTR=2
*.VAR CTR=2
*.VAR CTR=2
.VAR CTR=2
**************************************** <<<<<<<< Error Message ID: 1038 >>>>>>>> input file C:\Training\Module_5_Examples\SIMPLIS_Data/5.1_SelfOscillatingConverter_POP.deck, line 172: F1 9 6 VF1$TP_CCCS {CTR} A number to represent the value for `proportionality constant' is expected at the location where `{CTR}' occupies.
In this exercise, you attempted to use the parameter CTR in a hierarchical level other than the top level where CTR is defined. Since the parameters defined at each hierarchy level are independent of each other, the CTR parameter is undefined at the optocoupler level and an error is generated. In the next exercise, you will use the .GLOBALVAR statement to make CTR a global parameter.
*.VAR CTR=2 .GLOBALVAR CTR=2
When you define a parameter using the .GLOBALVAR statement, that parameter is available at that hierarchy level and at all lower levels in the hierarchy. This means that the parameter CTR is available at both the top level schematic and at the optocoupler hierarchy level. While this works, there are real and significant dangers of using .GLOBALVAR to parameterize the model.
In topic 5.1 Passing Parameters Into Subcircuits Using The SIMPLIS_TEMPLATE Property, you will learn the recommended way to pass parameters into subcircuits.