To download the examples for Module 5, click Module_5_Examples.zip.
In this topic:
There are several ways to pass parameters into subcircuits. In the previous topic, 5.0 About Parameters, you used the .GLOBALVAR statement to define a global parameter. A drawback to global parameters is that every instance uses the same parameter value. In this topic, you will learn how to pass parameters through the symbol-to-subcircuit interface, which allows you to pass the same parameter name with different values for each instance.
In this exercise, you will learn how to do the following:
The schematic component param_rc.sxcmp used in this exercise requires a single parameter, with the parameter name FC. This parameter will set the filter's -3dB cutoff frequency. The example schematics are already prepared and ready to run, only the parameter passing part is missing.
The PARAMS symbol property is a special property which the netlister detects and uses to add parameters to the netlist instantiation line for the symbol. In this exercise you will add the PARAMS property to the param_rc.sxcmp symbol.
To add the PARAMS symbol property to the FC parameter, follow these steps:
In Exercise #1, you added a symbol property PARAMS to the symbol stored in the schematic component file. The PARAMS property is a special symbol property and the netlister handles this property differently than the other properties. When the symbol template is resolved and the netlist entry is made, the value of the PARAMS property (in this case, FC=10k) is added to the instantiation line for the symbol after the vars: keyword. In the next exercise you will examine how the PARAMS value can be different on each instantiated symbol and how the resulting netlist entry and simulation results are affected.
In this section, you will change the value of PARAMS property and look at how the netlist and the simulation results change.
To edit the property PARAMS value on the U2 instantiated symbol, follow these steps:
You have now edited the local, instantiated value of the PARAMS property on one of the rc_filter.sxcmp schematic components. This edit passes 30kHz as the pole frequency parameter into the subcircuit for the U2 instantiation. In the next exercise, you will see how the netlist is affected by this change.
The key concept here is that a single parameter can passed into the subcircuit on the netlist instantiation line. Multiple instantiations can use the same subcircuit (param_rc) with different parameter values. This allows a single schematic model to be configured with the passed parameter value.
The param_rc schematic component file uses three parameters:
You can pass multiple parameters using the PARAMS symbol property, and in the next exercise you will add the two global parameters to the PARAMS property.
To open the symbol for the schematic component param_rc.sxcmp and add the two global parameters, follow these steps:
*** ERROR *** ( 5.2_parametrized_rc_filters.net): Parameter 'R_VAR' for subcircuit instance 'X$U1' has already been defined as a global parameter *** ERROR *** (5.2_parametrized_rc_filters.net): Parameter 'GAIN' for subcircuit instance 'X$U1' has already been defined as a global parameter *** ERROR *** (5.2_parametrized_rc_filters.net): Parameter 'R_VAR' for subcircuit instance 'X$U2' has already been defined as a global parameter *** ERROR *** ( 5.2_parametrized_rc_filters.net): Parameter 'GAIN' for subcircuit instance 'X$U2' has already been defined as a global parameter
These errors tell you that once a parameter name is defined to be global, the name is reserved and cannot be used as a local parameter name. When you added model parameter names to the PARAMS property, you defined parameters local to the param_rc.sxcmp schematic component. These errors protect you from simulating a design with two different parameter values, one global and one local.
To correct these errors, you need to comment out the .GLOBALVAR parameters and change the value of the FC parameter for U2 to 30k. To make these changes, follow these steps:
*.GLOBALVAR R_VAR=1k *.GLOBALVAR GAIN=1 *.GLOBALVAR FC=10k
The key concept here is that multiple parameters can be passed on the netlist instantiation line. Individual instantiations can use the same subcircuit (param_rc) with different parameter values. This allows a single subcircuit model to be used in multiple instantiations where each instantiation can be configured with different parameter values.
The recommended way to pass parameters is described in the 5.1 Passing Parameters into Subcircuits Using the SIMPLIS_TEMPLATE Property topic.
At the end of the module, please fill out the Module # 5 Evaluation form.