A Tutorial On Creating A Custom SPICE Component For Multisim - Apr 8th 2011
A Tutorial On Creating A Custom SPICE Component For Multisim - Apr 8th 2011
NI Multisim Component Evaluator Analog Devices Edition Patrick Noonan, National Instruments
Apr 8 , 2011
th
Introduction The Multisim Component Evaluator SPICE simulation environment allows a user to create a custom SPICE component (perhaps a model that was downloaded via the internet) along with using some of the standard components as well. You can only create 1 custom part per schematic and the part cannot be saved back to the database. For other possible methods of using custom modeling elements within the Multisim Component Evaluator see the last section titled, Other Considerations. Here are the steps involved for creating a custom part after opening up the Multisim Component Evaluator edition. For the purposes of this exercise, let us assume that we are going to create a custom ideal 1:1 balun for use in one of our front end A/D Converter input designs. 1. Open up the Component Wizard From the menu, go to Tools -> Component Wizard and a dialog box will appear allowing you to enter in basic details about the component you are creating. Enter in the Component name and the Function (description) of the component as needed and press Next when complete.
2. Add pin number information Simply enter the number of pins used in the symbol. Extra symbol pins can be used that are not included in the associated SPICE model; however these obviously can only be used for schematic drawing purposes. In this case we will be including a transformer symbol with a primary and a center tapped secondary. All pins will be modeled.
3. Add or create symbol for new part Now you can create a symbol for your new component. A default rectangular symbol will automatically be created. You may choose to use this symbol, you can optionally modify or create a new symbol from scratch by choosing the Edit button (which will launch the Symbol Editor) or you can select and modify an existing symbol by choosing the Copy from DB button. An existing symbol may likely be available for many standard part types. In this case I can choose to copy the symbol from the existing TS_MISC_VIRTUAL component. This is found in the Basic group under the TRANSFORMER family. Note: If copying an existing symbol it is highly recommended to press the Edit button and understand which pin names are mapped to the symbol using the Symbol Editor. By clicking the pin name in the spreadsheet view, the associated pin will be highlighted in the symbol window. It is also a good idea for accuracy, to rename the pins appropriately to match the application or the model names so that symbol to model mapping can be completed with less errors. In this example, by clicking the Edit button I can change the pin names from numeric names to custom labels that can be better understood during mapping. Note that the original pin 5 was actually connected to the center tapped pin, rather than pin 4 which may be guessed erroneously as the center tapped pin in the model mapping step if this action was not taken.
BEFORE 4. Assign pin types In this step you are allowed to assign pin types. Hidden pins can be added to allow for automatic connections to VCC and in the full version of the tool pin assignments allow the user to enable electrical rules checking (ERC) on the pins. ERC is not available in the Multisim Component Evaluator. Leaving the pin assignments to BIDIRECTIONAL is ok for most pin types.
AFTER
5. Add SPICE model You can now add a model directly within the Model data window or more likely copy an existing model into this area. It is also possible to select an existing model from the database and modify it by choosing the Select from DB button. The Model maker functionality is disabled on the Multisim Component Evaluator edition. Once the model is updated, a unique model name must be given. Makes sure your model has a valid .SUBCKT header and that the model is terminated by an .ENDS statement. Also for the last step it is often convenient to make a note of the pin order in the .SUBCKT command line. In this case p1 = position 1, p2 = position 2, s1 = position 3, s2 = position 4 and sct = position 5.
5. Adjust symbol pin to SPICE model pin mapping Here is one of the most important steps correctly mapping the model to the symbol. The symbol pin names are listed on the left column and the SPICE model pins (the order as found in the subckt header) are listed on the right column. Adjust the model pin order to correctly map the pins to the pins in the symbol. As shown above S1 maps to position 3, Sct maps to position 5, S2 maps to position 4, P2 maps to position 2 and P1 maps to position 1. The correct mapping order is shown below.
Once you press Finish the newly created part will automatically be placed in the Multisim schematic window for use. The newly created part can be copied multiple times as needed. It is also recommended to create a simple test circuit for your newly created component / SPICE model to ensure that there are no errors in the model or mapping of your component.
5. Testing your model Before using your model in a more complex circuit, it is highly recommended to create a simple test circuit to verify basic operation and performance of your newly created part. Here is a simple test circuit jig for testing the created 1:1 balun. Note the use of the 2 channel oscilloscope virtual instrument in Multisim which allows direct measurement of the input and output signals in the balun.
Once some simple tests verify the correct operation of your new component, you can then add additional components to complete your application circuit. Here is a completed front end circuit using 2 of the ideal 1:1 baluns for a buffered wideband A/D Converter application circuit. Also shown is the Bode Plotter virtual instrument in Multisim showing the AC frequency response of this circuit configuration.
Other Considerations When using models in Multisim also consider that there are other options for creating parts in Multisim with custom SPICE elements. Among the most capable are the Virtual components that are configurable by the user on an instance by instance basis. These components allow the user to configure pre-built Multisim models (in their simplest form these are basically parametric spice models but with a nice user interface) that can be adjusted to match a manufacturers datasheet. Virtual models exist for basic RLC components, diodes, transistors, mosfets, a select number of analog parts and several mixed signal parts. A few examples in the BASIC_VIRTUAL family are shown below.
In addition, there are a few other ways of creating components in Multisim. A user can create a top level macro model (similar to how the ADC equivalent RC model was shown above in the buffered wideband A/D Converter application circuit). Another method involves using the Function block components found in the Sources category (or should I say hidden in?). The ARBITRARY_LAPLACE_FUNCTION and the TRANSFER_FUNCTION_BLOCK and the FREQUENCY_TABLE_FUNCTION are all especially useful for generating a transfer function of a component or system block that can be described in the fore-mentioned ways. These and other system level modeling blocks can be found under the Sources group, within the CONTROL_FUNCTION_BLOCKS category. Also keep in mind you can create elaborate mixed signal simulations using Multisim since the tool has the ability to model analog and digital components in the same environment which can be used in a top level macro model of a component (see the TIL family of parts in the Misc Digital group). Enjoy and happy simulating. References: th Edward Herbert, Transformer SPICE Model, FMTT Inc, Feb 4 2008, (http://fmtt.com) L.G. Meares and Charles E. Hymowitz, SPICE Models for Power Electronics, EE Times India, April 22 2002, (www.eetindia.co.in) Rob Reeder and Ramya Ramachandran, Wideband A/D Converter Front-End Design Considerations When to Use a Double Transformer Configuration, Analog Dialogue Vol. 40, Number 3, 2006, Analog Devices (www.analog.com)
nd