==Creating a New Device from Scratch==[[File:rfspice_banner.png|right|640px]][[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D | Back to RF.Spice A/D Wiki Gateway]]'''
A device consists of a simulation model and a symbol[[Image:Tutorial_icon. The devicepng|40px]] 's simulation model can be either a process model or a subcircuit model. The model may have one or more nodes or terminals. Accordingly, the device's symbol may have one or more pins. These pins are mapped onto the terminals or nodes of the part's simulation model[[RF. In order to create a new device from scratch, you must already have a simulation model and a symbolSpice_A/D#RF. You can use the existing models and symbols in the Parts Database, or you can create entirely new models or draw your own new symbols from the ground upSpice_A. Here we assume that you are using an existing model and an existing symbol2FD_Tutorials | RF. Creating new models and drawing new symbols will be discussed later separately. Spice A/D Tutorial Gateway]]'''==Importing a New Simulation Model==
From Both process models and subcircuit models can be imported from simple plain text files with a ".TXT' file extension. Importing a simulation model from a text file is a very simple and straightforward procedure. Under the File Menu of the Device Editor Manager, choose "New DeviceImport Simulation Model from Text File...". The An "Edit DeviceOpen" dialog opens upbox will appear for you to locate the model text file. Fill in Locate the "Device Name" field file and specify click OK. Follow the program prompts to choose a category, manufacturer, and enter a description to help identify and keyword and choose a manufacturer for the devicenew model to be imported. These fields can may be left blank. The description and keywords are helpful for searching for filled out later through the device. To choose the simulation model, click on the "Select Edit ModelDialog.Click OK when you are done.." button. This A message will bring up indicate that you have loaded your (subcircuit or process) model file, and that a list of simulation models model was created assuming that it was successfully loaded. The program will then fix the polynomial controlled sources, if any, and notify you can choose fromof encountered problems. Choose Click OK after each message box. When your model is loaded successfully, the symbol from program will notify you of the list completion of symbols in a similar manner by clicking on the "Select Symbol..." buttonimport process.
For the part to be validIf your file does not load, make sure the pins (terminals) of the simulation source file is not open in another application. Your model must match up with text file can contain the pins on the symbol". If you let the program automatically create a symbol model" lines or Netlist subcircuit codes for an existing simulation model, then there is several different models. All of these models can be imported together in a guaranteed matchsingle process. HoweverIn that case, there the program will be cases when guide you need to specify through the pin names on the simulation same process for each individual model so that they match up with those of the symbol. The button labeled "Connect Symbol Pins to Model Pins" is provided for this very purpose. See the next section on Setting & Matching Device Pins for more details.
==Setting & Matching Device PinsResolving SPICE Language Incompatibilities==
[[File:b2MAN_Fig45.png|thumb|400px| "Connect Symbol Pins to Model Pins" Dialog.]]When creating a new simulation model as will be discussed later, you can also instruct the Device Editor to create a default (simple and basic) symbol for a it. Normally, if you have already set the simulation model pin or terminal names, the symbol pins will automatically match the model pins. In many other cases, you may create the models and symbols separately and independently. In such cases, you need set and match the symbol pins with the corresponding model pins. ===Polynomial-Controlled Sources===
In the "Edit Device" dialog, click the button labeled "Connect Symbol Pins to Model Pins"[[RF. Spice A new dialog opens up/D]] does not support polynomial controlled sources within subcircuits. The pin names for the simulation model will appear on the left side of dialog. The default pin names will be the same as the pin numbers if this is When you edit a subcircuit model; otherwisein the Device Editor, they will be the default pin names you can check for built-in simulation model types. The next table to the right shows a list of symbol pin name. A select/highlight a model pin and then select/highlight the corresponding symbol pin. Click incompatible polynomial sources using the button labeled "Add New ==>Check Controlled Sources" to move the pair to the "Connections" window on the right side of the dialog. This window shows all the pin mappings. You can reassign the pin at any time by selecting In addition, there is a row from the Connections Window and clicking the "Remove <==" button. This will return the selected model and symbol pin pair back to the origin tables, whereby you can change and redefine use to fix these sources wherever possible within the pin associationssubcircuit.
It is important to match up the pins correctly because the simulator will need this information to be correct to simulate the part correctly. Limit pin names to 10 characters or less. For spaces use underscore ( _ ). Dashes The polynomial sources are not accepted. Click OK when all lines of the pins have been matched up correctly.form:
==Creating a New Part from Your Circuit== (E|F|G|H)xxx node node POLY(n) inputs coefficient-list
[[RF.Spice A/D]] allows you to take a circuit and turn it into a "reusable" part. In other words, it converts your circuit into a device that An example of this is saved and added to the Parts Database. Almost any circuit can be turned into a database device with just a few steps.following:
<b>Step E1 1 - Setting Up the Circuit for Part Creation</b>2 poly(3) (3,0) 1 0 0 3
Using WorkshopThe SPICE line above means a voltage-controlled voltage source where the voltage across nodes 1 and 2 is determined by the function: v(1,2) = 1 + 0 + 0 + 3* v(3)^3. SPICE 3, on which [[RF.Spice A/D]] is based , create or Open supports a circuit that you wish to turn into more general form of controlled source which includes polynomial controlled sources as a partsubset. This new "device" is the nonlinear dependent source with the following general Form:
For Mixed Mode circuits, the first thing you will need to do is to insert Markers into the circuit to designate where pins for the new part should go. Markers can be found under the Devices menu or the Virtual Devices menu in the Parts Chooser.Bxxx N+ N- < I=EXPR > < V=EXPR >
Once the markers are placed, double click on each one and type in a name in the Part Title field. This will be the name An example of the pin once the circuit is turned into a part. Then in the same dialog box, check the Use as Subcircuit Port box. This lets Workshop know that this marker is to be used as a port in the new part. The Marker Properties box should look similar to the one below.following:
For Digital circuits, Input and Output ports take the place of Markers. You can simply double click on the Input/Output port, name it, and check the "Use as Subcircuit Port" checkbox.B1 0 1 I=cos(v(1)) + sin(v(2)) + v(1)^2
<b>Step 2 - Creating With the Part</b>SPICE 2 example given above, i.e.
Once the MarkersE1 1 2 poly(3) (3, or Input/Output ports in Digital mode, are in place and set up correctly, go to the File menu and choose Create Part from Circuit. The program will then prompt you for a name. Enter the name you wish for the new part and click OK. Then the program will ask if you would like it to create a symbol for your part. If you already have a symbol ready, click NO and Workshop will then ask you to select a symbol from the Parts Database. Otherwise, click YES and Workshop will create a generic box symbol to be used with your part. The new part is now in the database and you're ready to customize the part. 0) 1 0 0 3
<b>Step 3 - Modifying the New Part<corresponding SPICE 3 (and [[RF.Spice A/b>D]]) implementation is:
Run the Database Editor and select Edit Simulation Model under the Edit menu. Select the part that you just created in the Workshop and click Edit. BE1 1 2 V= 1 + 3 * V(3)^3
For Mixed Mode parts, Click on the Set Model Pins and you should see the dialog box below:
If all [[RF.Spice A/D]] has the parts in your circuit capability to convert from SPICE 2 polynomial-controlled syntax to SPICE 3 nonlinear source syntax when they are pure analog partsembedded in subcircuit models. Using the Device Editor, then create the simulation model from the text file containing the subcircuit model. Depending on how you should check do this, the pins over to see if they're correctDevice Editor may automatically convert the polynomials for you. If not, choose the button labeled "Fix Controlled Sources" and the Device Editor will perform the conversion.
If your circuit contained XSpice parts, you will have to designate whether the pin The following is digital or analogan example of this kind of conversion. If the pin The first line is Digital, then you must also designate whether commented out because it is an Input or Output pin. If the pin is Analog, then input and output direction designation do not apply. Click accept when you're done with each pin. Click OK when you're done setting was the pinsold polynomial controlled source.
For Digital parts* egnd 99 0 poly(2) (3, Select and edit the [[Digital Simulation|digital simulation]] model you just created. In the Edit Simulation Model dialog box0) (4, click the Edit Pin Properties button to access the list of digital pin. You should set each pin's direction, state, and propagation delay. Click the Accept button to accept changes and move on to the next pin0) 0 . Refer to the Database Editor Menu's Edit simulation model section for more information5 .5
Once you're done setting the pin propertiesbegnd 99 0 v =0 + .5 * v(3, close all the dialog boxes. All that remains is to alter the symbol if you want to rearrange the symbol pins and exit the Database Editor. In the Workshop pull up your new part and use it like any other part0) + .5 * v(4,0)
==Importing a New Simulation =Incompatible ModelTypes===
Both process Some Netlist languages such as that from Pspice use models and subcircuit models can be imported from simple plain text files that are either not in RF.SpiceA/D or are defined with a "different set of parameters.TXT' file extension. Importing When you edit a simulation subcircuit model from a text file is a very simple and straightforward procedure. Under the File Menu of in the Device Editor, choose "Import Simulation Model from Text File...". An "Open" dialog box will appear you can check for you to locate incompatible models using the model text fileappropriate button. Locate the file and click OK. Follow the program prompts to choose a categoryIn addition, enter there is a description and keyword and choose a manufacturer for the new model button you can use to be imported. These fields may be left blank and filled out later through fix these models wherever possible within the Edit Model Dialog. Click OK when you are done. A message will indicate that you have loaded your (subcircuit or process) model file, and that a simulation model was created assuming that it was successfully loaded. The program will then fix the polynomial controlled sources, if any, and notify you of encountered problems. Click OK after each message box. When your model is loaded successfully, the program will notify you of the completion of the import process.
If your file does not load, make sure the source file is not open in another application. Your model text file can contain the ".model" lines or Netlist subcircuit codes for several different models. All of these models can be imported together in a single process. In that case, the program will guide you through the same process for each individual model. ==Creating a New Simulation Model from ScratchImporting RF Device Models ==
From the File Menu Multiport Network device, i.e. one-ports, two-ports, three-ports and four-ports, are all modeled based on their frequency-domain S-parameters. Most active and passive RF devices can be modeled as multipart networks. For example, RF diodes can be modeled as one-ports, while RF transistors (BJTs, JFETs, MOSFETs, and MESFETs) can be modeled as two-ports. Many semiconductor manufacturers publish S-parameter data sets for their RF devices. The manufacturer data sheets usually contain S-parameters in Mag/Phase format tabulated as a function of frequency expressed in GHz. On the Device Editor choose "New Simulation Modelother hand, you can model many passive devices such as filters, directional couplers, hybrids, etc.as multiport structures using full-wave electromagnetic simulators like [[EM.Cube]]."The port characteristics of such devices are typically written into data files as a function of frequency. You will be presented A particular case of interest is transmission line components with complex geometries or material composition, for which [[RF.Spice A/D]] does not provide any database models. as an example, consider the case of a "Finline" transmission line. In a finline-based circuit, you may need one of more of the following dialog boxgeneral transmission line components:
Select the appropriate Model type and click OK.* Open End
The Edit Model window will appear* Bend (right-angled or mitered)
Fill in the Name field to specify the simulation mode's name. Specify the category, manufacturer, and description. These fields can be left blank. Specify the Model Type by using the scroll arrow button* Step Junction
For the Category click on the ellipse button. The SELECT CATEGORY window will appear. Click on the Category you want and click SELECT.* Tee Junction (symmetric or asymmetric, possibly with a notch)
Next, to set the simulation guts for the simulation model, click on the Simulation Guts tab.* Cross Junction (symmetric or asymmetric)
If your model type is a SUBCIRCUIT the simulation guts will be blankRF. You will need to enter the subcircuit text Spice currently does not provide any models for this part into the empty text fieldfinline components. If you already have this text in another fileHowever, you can copy use [[EM.Cube]] to analyze various finline structures over a frequency range of interest and paste the subcircuit textgenerate S-parameter data sets for them.
If your model type is other than a Subcircuit you will need to set [[parametersRF.Spice A/D]] for allows you to import S-parameter-based models of RF devices from text files. Before describing how to import S-parameter data files, let us first discuss the deviceformat of the data files in more detail. If you need help S-parameter data files must have a ".TXT" file extension. These files must start with thisa ".model", see a ".symbol" statement, and a format statement starting with the section character "#". The model text file can have any number of comment lines at the beginning of the file or elsewhere. Comment lines are preceded by "*" or "!". All the text after these characters on entering [[parameters]]the rest of the line will be ignored.
Some devices or parts require that a process model be set. To set the process model click on the ellipsis button, and then select a process model from the list that appears. If the process model for your simulation model is not in the list, then you need to add a new process model. ==Creating a New Device from an Existing Simulation Model==Format:
From the File menu of the Database Editor, choose New Device Based on Simulation Model to open the Select Model window. Choose a simulation model from the Model Bin and click the Select Button.<model_name>
When you select the simulation model, the program automatically creates a new part with this simulation model as its model, and with the same name, category, manufacturer, description, and keywords as those of the simulation model. Next, the program will ask you if you would like to edit the pin names for the simulation model. If you have not set the pin names yet, or would like to edit the pin names, click YES.symbol <symbol_name>
All that'#<frequency_units> s left to do is specify the symbol for this part. The program will ask you if you would like to create a new symbol for the part. Click YES, if you would like the program to create a symbol for you. Click NO, if you would like to choose an existing symbol for the part. <complex_data_format> r <reference_impedance_value>
NOTE: If you get a warning message that reads Inconsistency between symbol and simulation modelfreq s11 s21 s31 . Try another combination or change simulation model or pin names, most likely your pin names do not match with the symbol. Double check your pin names to see if they are consistent with the symbol. For more information, see the section on Setting Model Pins s12 s22 s32 ... s13 s23 s33 ...
==Creating a New Symbol Based on an Existing Simulation Model==Example:
You can create a new symbol once your simulation model ! This is loaded into the library. From the File Menu an example of the Database Editor choose New Symbol an RF BJT model based on Simulation Model to open the Select Model dialog boxmeasured S-parameters.
Select the model for which you would like to create a symbol and click Edit to open the Edit Model dialog box. Click on the Create Symbol button the program will automatically create a symbol for you. When you import your simulation model into the database using the New Device from text file feature or the Import Simulation Models feature, the program will automatically ask you if you would like to create a symbol.MyNewRFBJT
Your new symbol will be named the same name as your model name. If you create a new symbol by clicking on the Create Symbol button you will be notified that a symbol has been created successfully. ==Creating a Parameterized Subcircuit Part==bjt_npn
Parameterized Subcircuit Parts are parts whose behavior can be modified with one or more [[parameters]]. In some cases, you will want to turn your subcircuit defined parts into parameterized subcircuits.#ghz s ma r 50
In this example, we will be creating a battery as a Parameterized Subcircuit Model part.! GHz MAG ANG MAG ANG MAG ANG MAG ANG
<b>Step 0.500 0.6943 -122.1 4.977 105.7 0.0901 33.0 0.6170 - Create a Parameterized Subcircuit Model Type</b>37.8
Run the Database Editor and go File1.000 0.6470 -169.7 2.820 76.8 0.0975 23.3 0.4862 ->New Parameterized Subcircuit Model Definition45.5
This should bring up the dialog box shown below1. In the Model Type Name, enter the name you would like to identify your new model by, making sure that there are no spaces in the name500 0.6586 162.9 1.959 57.6 0.0978 25.6 0.4468 -54.5
Then click on the [[Parameters]] tab2. In the Parameter Name field, enter the name of the 1st parameter that you will be using, in this case, Voltage000 0. In the data type, select the type of data of the parameter6854 142. Usually this will be a real or integer0 1. In this example, the Data Type will be Real481 41. Units and defaults are optional5 0. Make sure the Use For Input box is checked1055 32. Leaving it unchecked will cause the parameter to not show up in other dialog boxes2 0. The "Is Required" checkbox is for when you want Workshop to specifically use this parameter. If you check the box, then you also must enter a Default Value4315 -65. 1
Click Accept when you're finished with the particular parameter2. Note that you must click New Parameter to enter and edit a new parameter500 0. Not doing so will overwrite the parameter that happens to be highlighted7070 128.1 1.246 30.1 0.1175 37.7 0.4261 -75.5
Then click on the Subcircuit Text tab3. This is where you will be entering the actual subcircuit that you will be using your [[parameters]] in000 0.7449 110.9 0.985 15.5 0.1475 41.9 0.4218 -93.3
If you know what you're doing, you can start entering your subcircuit starting with The model statement specifies the name of your RF device model, in this case, MyNewRFBJT.SUBCKT The symbol statement determines the device type and ending schematic symbol. The symbol_name can only be one of the choice given in the table below.ENDS statementThe frequency units can be hz, khz, mhz or ghz. This subcircuit will need "s" implies the s-parameters. If the complex_data_format is left blank, the S-parameters are interpreted to be in Berkeley Spice 3f5 have Mag/Phase format , with XSpice extensionsthe magnitude on a linear scale and phase expressed in degrees. OtherwiseThe other options for complex_data_format are "ma" for magnitude expressed in dB, copy and paste a subcircuit into or "ri" for Real/Imag format. The last part specifies the windowreference impedance value, which must come after letter "r". You can get In the subcircuit text for an existing simulation model by editing above example, the simulation model and copying its textreference impedance is 50 Ohms.
Now all you have to do is incorporate your own [[parameters]] into the subcircuitImage:Info_icon. Enter your [[parameterspng|40px]] in the form of Click here to see a parameter or formula. All custom '''[[parametersAn_Overview_of_RF_Circuit_Simulation#List_of_Standard_Imported_RF_Devices | List of Standard Imported RF Devices]] must go in between the curly brackets {}. For example, if you had two [[parameters]] called X and Y and wish to have them added together in a subcircuit, the formula would be {X + Y}. Or getting fancier, you add X and Y and then multiply by 2. The formula would look like this: {(X + Y) * 2}. All standard mathematical operations are supported (+,-,/,*), power of (^), and any other operation supported in the graphing plot expression module of the Workshop. In the example below, note that the {voltage} has replaced the regular voltage number'''.
Once you're satisfied that everything is correct, click OK and continue to the next step. <b>Step 2 == Using Device Manager for Importing S- Make a simulation model using the Parameterized Subcircuit Model you just created</b>Parameter Data ==
Go File->New Simulation Model and then click on the The Device Editor of RF. Spice or XSpice parameterized subcircuit and click OKA/D lets you import S-parameter text files in a variety of ways.There are three menu items for this purpose:
Enter the model name, and in the * Import S-Parameter Model Type, select the parameterized subcircuit type that you had created in the previous stepfrom Text File.. In this case, we will be using "Battery" in the Model Type.
the Set Model Pins* Create New Generic Multiport from S-Parameter Text File... button allows you to edit the pins in your simulation model, if wish. The Create Symbol will create a new generic symbol using the pins in your subcircuit for symbol pins and named the same as your Simulation Model
Click on the "[[Parameters]]" tab, you can enter values for the [[parameters]] that you specified earlier* Create New RF Device from S-Parameter Text File. Or you can leave them blank for now and change it once you have the part in the schematic. For this example, we'll enter a default voltage of 10. Enter 10 in the Value box and click Accept. The window should look like the window below. Once you're done editing the simulation model, click OK to accept it.
<b>Step 3 - * Create a new Part with the simulation model</b>New Generic T-Line Discontinuity from S-Parameter Text File...
Go FileThe first item in the above list simply lets you import an S->New Deviceparameter ".TXT" file and saves it as a simulation model in [[RF.Spice A/D]]'s parts database. You can use this model later to build a new device or share it among several devices. The next three items in the above list create new devices complete with simulation models and schematic symbols. The newly create devices are permanently stored in your [[RF.Spice A/D]] parts database and can be used as new parts in your RF circuits. For example, an imported RF BJT device has the same BJT symbol with the same pin map as the other BJT devices of [[RF.Spice A/D]]. The main difference is that instead of a technology process models or a Netlist subcircuit model, the RF BJT is modeled by its imported, measured S-parameters. In a similar manner, you can import Multiport Network devices or T-Line Discontinuity models from S-parameter text files that are generated at the end of full-wave simulations of such structures using an electromagnetic modeling tool like [[EM.Cube]].
In the Part Name, enter the name you would like your new part have.==Creating a New Simulation Model from Scratch==
Select a symbol to use by clicking on From the Select Symbol buttonFile Menu of the Device Editor choose "New Simulation Model. If you had used the Create Symbol button in the previous step, look for a symbol ..". You will be presented with the same name as the simulation model. If you have an existing symbol you would like to use instead, select that.following dialog box:
Select the simulation model you created earlier by clicking on the Select button in the Simulation appropriate Model fieldtype and click OK.
Now you will have to match the simulation model pins to the symbol pin by clicking on the Connect Symbol Pins to The Edit Model Pins button. You window will get a dialog like the one below. Click on a model pin in the left most box, click on a symbol pin in the middle box, and make the pairing by clicking on the Add New ==> button. If you mess up, you can select the pairing in the right box and click the <==Remove button to unmatch the pair. Click OK once you have used all the simulation pins.appear
Click OK Fill in the Name field to accept specify the partsimulation mode's name.Specify the category, manufacturer, and description. These fields can be left blank. Specify the Model Type by using the scroll arrow button
And that's it. To access your new part in For the Workshop, go to Devices->Choose Part by Name and type in the name of your part. Pull your part up in the Workshop and double Category click on it to change your custom [[parameters]]the ellipse button. The [[parameters]] SELECT CATEGORY window will be evaluated automatically as appear. Click on the Category you run a simulationwant and click SELECT.
You can assign packages and pairings by using Next, to set the drop down box to select a packagesimulation guts for the simulation model, typing in how many parts come in a package, and then clicking click on the Connect Part Pins to Package Pins button. More information about Packages can be found in the PCB tutorialSimulation Guts tab.
==Resolving SPICE Language Incompatibilities==If your model type is a SUBCIRCUIT the simulation guts will be blank. You will need to enter the subcircuit text for this part into the empty text field. If you already have this text in another file, you can copy and paste the subcircuit text.
===Polynomial-Controlled Sources===If your model type is other than a Subcircuit you will need to set parameters for the device. If you need help with this, see the section on entering parameters.
[[RF.Spice A/D]] does not support polynomial controlled sources within subcircuits. When you edit Some devices or parts require that a subcircuit process model in be set. To set the Device Editor, you can check for incompatible polynomial sources using process model click on the ellipsis button labeled "Check Controlled Sources". In addition, there is and then select a button process model from the list that appears. If the process model for your simulation model is not in the list, then you can use need to fix these sources wherever possible within the subcircuitadd a new process model.
The polynomial sources are lines of the form:==Creating a New Device from Scratch==
(E|F|G|H)xxx node node POLY(n) inputs coefficient-listA device consists of a simulation model and a symbol. The device's simulation model can be either a process model or a subcircuit model. The model may have one or more nodes or terminals. Accordingly, the device's symbol may have one or more pins. These pins are mapped onto the terminals or nodes of the part's simulation model. In order to create a new device from scratch, you must already have a simulation model and a symbol. You can use the existing models and symbols in the Parts Database, or you can create entirely new models or draw your own new symbols from the ground up. Here we assume that you are using an existing model and an existing symbol. Creating new models and drawing new symbols will be discussed later separately.
An example From the File Menu of the Device Editor choose "New Device...". The "Edit Device" dialog opens up. Fill in the "Device Name" field and specify the category, manufacturer, and description to help identify the device. These fields can be left blank. The description and keywords are helpful for searching for the device. To choose the simulation model, click on the "Select Model..." button. This will bring up a list of simulation models that you can choose from. Choose the symbol from the list of this is symbols in a similar manner by clicking on the following:"Select Symbol..." button.
E1 1 2 polyFor the part to be valid, the pins (3terminals) (3of the simulation model must match up with the pins on the symbol. If you let the program automatically create a symbol for an existing simulation model,0) 1 0 0 3then there is a guaranteed match. However, there will be cases when you need to specify the pin names on the simulation model so that they match up with those of the symbol. The button labeled "Connect Symbol Pins to Model Pins" is provided for this very purpose. See the next section on Setting & Matching Device Pins for more details.
The SPICE line above means a voltage-controlled voltage source where the voltage across nodes 1 and 2 is determined by the function: v(1,2) = 1 + 0 + 0 + 3* v(3)^3. SPICE 3, on which [[B2.Spice A/D]] is based , supports a more general form of controlled source which includes polynomial controlled sources as a subset. This new "device" is the nonlinear dependent source with the following general Form:=Setting & Matching Device Pins==
Bxxx N+ N- < I=EXPR > < V=EXPR >When creating a new simulation model as will be discussed later, you can also instruct the Device Editor to create a default (simple and basic) symbol for a it. Normally, if you have already set the simulation model pin or terminal names, the symbol pins will automatically match the model pins. In many other cases, you may create the models and symbols separately and independently. In such cases, you need set and match the symbol pins with the corresponding model pins.
An example In the "Edit Device" dialog, click the button labeled "Connect Symbol Pins to Model Pins". A new dialog opens up. The pin names for the simulation model will appear on the left side of dialog. The default pin names will be the same as the pin numbers if this is a subcircuit model; otherwise, they will be the default pin names for built-in simulation model types. The next table to the right shows a list of symbol pin name. A select/highlight a model pin and then select/highlight the corresponding symbol pin. Click the button labeled "Add New ==>" to move the pair to the "Connections" window on the right side of the dialog. This window shows all the pin mappings. You can reassign the pin at any time by selecting a row from the Connections Window and clicking the "Remove <==" button. This will return the selected model and symbol pin pair back to the origin tables, whereby you can change and redefine the following:pin associations.
B1 0 1 I=cosIt is important to match up the pins correctly because the simulator will need this information to be correct to simulate the part correctly. Limit pin names to 10 characters or less. For spaces use underscore (v(1)) + sin(v(2)) + v(1_ )^2. Dashes are not accepted. Click OK when all the pins have been matched up correctly.
<table>With the SPICE 2 example given above, i<tr><td> [[File:b2MAN_Fig45.epng|thumb|left|720px| "Connect Symbol Pins to Model Pins" Dialog. ]]</td></tr></table>
E1 1 2 poly(3) (3,0) 1 0 0 3==Creating a New Device from an Existing Simulation Model==
From the corresponding SPICE 3 (File menu of the Database Editor, choose New Device Based on Simulation Model to open the Select Model window. Choose a simulation model from the Model Bin and B2click the Select Button.Spice) implementation is:
BE1 1 2 V= 1 + 3 * V(3)^3When you select the simulation model, the program automatically creates a new part with this simulation model as its model, and with the same name, category, manufacturer, description, and keywords as those of the simulation model. Next, the program will ask you if you would like to edit the pin names for the simulation model. If you have not set the pin names yet, or would like to edit the pin names, click YES.
All that's left to do is specify the symbol for this part. The program will ask you if you would like to create a new symbol for the part. Click YES, if you would like the program to create a symbol for you. Click NO, if you would like to choose an existing symbol for the part.
[[RFNOTE: If you get a warning message that reads Inconsistency between symbol and simulation model.Spice A/D]] has Try another combination or change simulation model or pin names, most likely your pin names do not match with the capability symbol. Double check your pin names to convert from SPICE 2 polynomial-controlled syntax to SPICE 3 nonlinear source syntax when see if they are embedded in subcircuit models. Using consistent with the Device Editorsymbol. For more information, create see the simulation model from the text file containing the subcircuit model. Depending section on how you do this, the Device Editor may automatically convert the polynomials for you. If not, choose the button labeled "Fix Controlled Sources" and the Device Editor will perform the conversionSetting Model Pins.
The following is ==Creating a New Symbol Based on an example of this kind of conversion. The first line is commented out because it was the old polynomial controlled source.Existing Simulation Model==
* egnd 99 0 poly(2) (3,0) (4,0) 0 You can create a new symbol once your simulation model is loaded into the library.5 From the File Menu of the Database Editor choose New Symbol based on Simulation Model to open the Select Model dialog box.5
begnd 99 0 v =0 + Select the model for which you would like to create a symbol and click Edit to open the Edit Model dialog box.5 * v(3,0) + Click on the Create Symbol button the program will automatically create a symbol for you.5 * v(4When you import your simulation model into the database using the New Device from text file feature or the Import Simulation Models feature,0)the program will automatically ask you if you would like to create a symbol.
===Incompatible Model Types===Â Some Netlist languages such Your new symbol will be named the same name as that from Pspice use models that are either not in B2.SpiceA/D or are defined with a different set of [[parameters]]your model name. When If you edit create a subcircuit model in new symbol by clicking on the Device Editor, Create Symbol button you can check for incompatible models using the appropriate button. In addition, there is will be notified that a button you can use to fix these models wherever possible within the subcircuitsymbol has been created successfully.
== Importing RF Device Models Creating a New Part from Your Circuit==
Multiport Network device, i.e. one-ports, two-ports, three-ports and four-ports, are all modeled based on their frequency-domain S-[[parameters]]. Most active and passive RF devices can be modeled as multipart networks. For example, RF diodes can be modeled as one-ports, while RF transistors (BJTs, JFETs, MOSFETs, and MESFETs) can be modeled as two-ports. Many semiconductor manufacturers publish S-parameter data sets for their RF devices. The manufacturer data sheets usually contain S-[[parametersSpice A/D]] in Mag/Phase format tabulated as allows you to take a circuit and turn it into a function of frequency expressed in GHz"reusable" part. On the In other handwords, you can model many passive devices such as filters, directional couplers, hybrids, etc. as multiport structures using full-wave electromagnetic simulators like [[EM.Cube]]. The port characteristics of such devices are typically written it converts your circuit into data files as a function of frequency. A particular case of interest device that is transmission line components with complex geometries or material composition, for which [[RFsaved and added to the Parts Database.Spice]] does not provide Almost any circuit can be turned into a database models. as an example, consider the case of device with just a "Finline" transmission linefew steps. In a finline-based circuit, you may need one of more of the following general transmission line components:
* Open End<b>Step 1 - Setting Up the Circuit for Part Creation</b>
* Bend (right-angled Using Workshop, create or mitered)Open a circuit that you wish to turn into a part.
* Step JunctionFor Mixed Mode circuits, the first thing you will need to do is to insert Markers into the circuit to designate where pins for the new part should go. Markers can be found under the Devices menu or the Virtual Devices menu in the Parts Chooser.
* Tee Junction (symmetric or asymmetricOnce the markers are placed, possibly with double click on each one and type in a notch)name in the Part Title field. This will be the name of the pin once the circuit is turned into a part. Then in the same dialog box, check the Use as Subcircuit Port box. This lets Workshop know that this marker is to be used as a port in the new part. The Marker Properties box should look similar to the one below.
* Cross Junction (symmetric or asymmetric)For Digital circuits, Input and Output ports take the place of Markers. You can simply double click on the Input/Output port, name it, and check the "Use as Subcircuit Port" checkbox.
RF. Spice currently does not provide any models for finline components. However, you can use [[EM.Cube]] to analyze various finline structures over a frequency range of interest and generate S<b>Step 2 -parameter data sets for them. Creating the Part</b>
[[RF.Spice]] allows you Once the Markers, or Input/Output ports in Digital mode, are in place and set up correctly, go to import S-parameter-based models of RF devices the File menu and choose Create Part from text filesCircuit. Before describing how to import S-parameter data files, let us first discuss The program will then prompt you for a name. Enter the format of name you wish for the data files in more detailnew part and click OK. S-parameter data files must have Then the program will ask if you would like it to create a "symbol for your part.TXT" file extension. These files must start with If you already have a ".model"symbol ready, click NO and Workshop will then ask you to select a ".symbol" statementfrom the Parts Database. Otherwise, click YES and Workshop will create a format statement starting generic box symbol to be used with the character "#"your part. The model text file can have any number of comment lines at new part is now in the beginning of database and you're ready to customize the file or elsewhere. Comment lines are preceded by "*" or "!". All the text after these characters on the rest of the line will be ignoredpart.
Format:<b>Step 3 - Modifying the New Part</b>
Run the Database Editor and select Edit Simulation Model under the Edit menu. Select the part that you just created in the Workshop and click Edit.model <model_name>
.symbol <symbol_name> For Mixed Mode parts, Click on the Set Model Pins and you should see the dialog box below:
#<frequency_units> s <complex_data_format> r <reference_impedance_value>If all the parts in your circuit are pure analog parts, then you should check the pins over to see if they're correct.
freq s11 s21 s31 If your circuit contained XSpice parts, you will have to designate whether the pin is digital or analog.If the pin is Digital, then you must also designate whether it is an Input or Output pin.If the pin is Analog, then input and output direction designation do not apply. s12 s22 s32 ... s13 s23 s33 .Click accept when you're done with each pin.Click OK when you're done setting the pins.
Example:For Digital parts, Select and edit the digital simulation model you just created. In the Edit Simulation Model dialog box, click the Edit Pin Properties button to access the list of digital pin. You should set each pin's direction, state, and propagation delay. Click the Accept button to accept changes and move on to the next pin. Refer to the Database Editor Menu's Edit simulation model section for more information.
! This Once you're done setting the pin properties, close all the dialog boxes. All that remains is an example of an RF BJT model based on measured S-[[parameters]]to alter the symbol if you want to rearrange the symbol pins and exit the Database Editor. In the Workshop pull up your new part and use it like any other part.
.model MyNewRFBJT== Creating a Parameterized Subcircuit Device ==
Parameterized Subcircuit Parts are parts whose behavior can be modified with one or more parameters. In some cases, you will want to turn your subcircuit defined parts into parameterized subcircuits.symbol bjt_npn
#ghz s ma r 50In this example, we will be creating a battery as a Parameterized Subcircuit Model part.
! GHz MAG ANG MAG ANG MAG ANG MAG ANG<b>Step 1 - Create a Parameterized Subcircuit Model Type</b>
0.500 0.6943 -122.1 4.977 105.7 0.0901 33.0 0.6170 Run the Database Editor and go File-37>New Parameterized Subcircuit Model Definition.8
1This should bring up the dialog box shown below.000 0In the Model Type Name, enter the name you would like to identify your new model by, making sure that there are no spaces in the name.6470 -169.7 2.820 76.8 0.0975 23.3 0.4862 -45.5
1Then click on the Parameters tab.500 0In the Parameter Name field, enter the name of the 1st parameter that you will be using, in this case, Voltage.6586 162In the data type, select the type of data of the parameter.9 1Usually this will be a real or integer.959 57In this example, the Data Type will be Real.6 0Units and defaults are optional.0978 25Make sure the Use For Input box is checked.6 0Leaving it unchecked will cause the parameter to not show up in other dialog boxes.4468 -54The "Is Required" checkbox is for when you want Workshop to specifically use this parameter. If you check the box, then you also must enter a Default Value.5
2Click Accept when you're finished with the particular parameter.000 0Note that you must click New Parameter to enter and edit a new parameter.6854 142Not doing so will overwrite the parameter that happens to be highlighted.0 1.481 41.5 0.1055 32.2 0.4315 -65.1
2Then click on the Subcircuit Text tab.500 0This is where you will be entering the actual subcircuit that you will be using your parameters in.7070 128.1 1.246 30.1 0.1175 37.7 0.4261 -75.5
3If you know what you're doing, you can start entering your subcircuit starting with the .000 0SUBCKT statement and ending the .7449 110ENDS statement.9 0This subcircuit will need to be in Berkeley Spice 3f5 format with XSpice extensions.985 15Otherwise, copy and paste a subcircuit into the window.5 0You can get the subcircuit text for an existing simulation model by editing the simulation model and copying its text.1475 41.9 0.4218 -93.3
The model statement specifies Now all you have to do is incorporate your own parameters into the name of subcircuit. Enter your RF device model, parameters in this case, MyNewRFBJT. The symbol statement determines the device type and schematic symbol. The symbol_name can only be one form of the choice given in the table below. The frequency units can be hz, khz, mhz a parameter or ghzformula. "s" implies All custom parameters must go in between the s-[[parameters]]curly brackets {}. If the complex_data_format is left blankFor example, the S-[[if you had two parameters]] are interpreted called X and Y and wish to have Mag/Phase formatthem added together in a subcircuit, with the magnitude on a linear scale formula would be {X + Y}. Or getting fancier, you add X and phase expressed in degreesY and then multiply by 2. The other options for complex_data_format formula would look like this: {(X + Y) * 2}. All standard mathematical operations are "ma" for magnitude expressed in dBsupported (+,-, or "ri" for Real/Imag format. The last part specifies the reference impedance value, which must come after letter "r"*), power of (^), and any other operation supported in the graphing plot expression module of the Workshop. In the above examplebelow, note that the reference impedance is 50 Ohms{voltage} has replaced the regular voltage number.
[[Image:Info_iconOnce you're satisfied that everything is correct, click OK and continue to the next step.png|40px]] Click here to see <b>Step 2 - Make a '''[[List of Standard Imported RF Devices]]'''.simulation model using the Parameterized Subcircuit Model you just created</b>
== Using Device Manager for Importing SGo File-Parameter Data ==>New Simulation Model and then click on the Spice or XSpice parameterized subcircuit and click OK.
The Device Editor of RF. Spice A/D lets Enter the model name, and in the Model Type, select the parameterized subcircuit type that you import S-parameter text files had created in a variety of waysthe previous step. There are three menu items for In this purpose:case, we will be using "Battery" in the Model Type.
* Import S-Parameter the Set Model from Text FilePins...button allows you to edit the pins in your simulation model, if wish. The Create Symbol will create a new generic symbol using the pins in your subcircuit for symbol pins and named the same as your Simulation Model
* Create New Generic Multiport from S-Parameter Text FileClick on the "Parameters" tab, you can enter values for the parameters that you specified earlier.Or you can leave them blank for now and change it once you have the part in the schematic.For this example, we'll enter a default voltage of 10. Enter 10 in the Value box and click Accept. The window should look like the window below. Once you're done editing the simulation model, click OK to accept it.
* Create New RF Device from S<b>Step 3 -Parameter Text File...Create a new Part with the simulation model</b>
* Create Go File->New Generic T-Line Discontinuity from S-Parameter Text File..Device.
The first item In the Part Name, enter the name you would like your new part have. Select a symbol to use by clicking on the Select Symbol button. If you had used the Create Symbol button in the above list simply lets previous step, look for a symbol with the same name as the simulation model. If you import have an S-parameter "existing symbol you would like to use instead, select that.TXT" file and saves it as a  Select the simulation model you created earlier by clicking on the Select button in [[RFthe Simulation Model field.Spice]]'s parts database. You can use this  Now you will have to match the simulation model later pins to build the symbol pin by clicking on the Connect Symbol Pins to Model Pins button. You will get a new device or share it among several devicesdialog like the one below. The next three items Click on a model pin in the above list create new devices complete with simulation models and schematic symbols. The newly create devices are permanently stored left most box, click on a symbol pin in your [[RF.Spice A/D]] parts database the middle box, and can be used as new parts in your RF circuitsmake the pairing by clicking on the Add New ==> button. For exampleIf you mess up, an imported RF BJT device has you can select the same BJT symbol with pairing in the same pin map as right box and click the other BJT devices of [[RF<==Remove button to unmatch the pair.Spice A/D]]Click OK once you have used all the simulation pins. The main difference is  Click OK to accept the part. And that instead of a technology process models or a Netlist subcircuit model, 's it. To access your new part in the RF BJT is modeled by its importedWorkshop, measured Sgo to Devices->Choose Part by Name and type in the name of your part. Pull your part up in the Workshop and double click on it to change your custom [[parameters]]. In The parameters will be evaluated automatically as you run a similar mannersimulation. You can assign packages and pairings by using the drop down box to select a package, you typing in how many parts come in a package, and then clicking on the Connect Part Pins to Package Pins button. More information about Packages can import Multiport Network devices or T-Line Discontinuity models from S-parameter text files that are generated at be found in the end of full-wave simulations of such structures using an electromagnetic modeling tool like [[EMPCB tutorial.Cube]]
<p> </p>
[[Image:Tutorial_icon.png|40px]] '''[[RF.Spice_A/D#RF.Spice_A.2FD_Tutorials | RF.Spice A/D Tutorial Gateway]]'''
Â
[[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D | Back to RF.Spice A/D Wiki Gateway]]'''