Changes

Creating New Devices and Models

78 bytes added, 17:51, 1 December 2015
/* Creating a Parameterized Subcircuit Device */
== 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.
In this example, we will be creating a battery as a Parameterized Subcircuit Model part.
This should bring up the dialog box shown below. 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 name.
Then click on the [[Parameters]] tab. In the Parameter Name field, enter the name of the 1st parameter that you will be using, in this case, Voltage. In the data type, select the type of data of the parameter. Usually this will be a real or integer. In this example, the Data Type will be Real. Units and defaults are optional. Make sure the Use For Input box is checked. Leaving it unchecked will cause the parameter to not show up in other dialog boxes. 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 Value.
Click Accept when you're finished with the particular parameter. Note that you must click New Parameter to enter and edit a new parameter. Not doing so will overwrite the parameter that happens to be highlighted.
Then click on the Subcircuit Text tab. This is where you will be entering the actual subcircuit that you will be using your [[parameters]] in.
If you know what you're doing, you can start entering your subcircuit starting with the .SUBCKT statement and ending the .ENDS statement. This subcircuit will need to be in Berkeley Spice 3f5 format with XSpice extensions. Otherwise, copy and paste a subcircuit into the window. You can get the subcircuit text for an existing simulation model by editing the simulation model and copying its text.
Now all you have to do is incorporate your own [[parameters]] into the subcircuit. Enter your [[parameters]] in the form of a parameter or formula. All custom [[parameters]] 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.
the Set Model Pins... 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. 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>
Click OK to accept the part.
And that's it. To access your new part in 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 click on it to change your custom [[parameters]]. The [[parameters]] will be evaluated automatically as you run a simulation.
You can assign packages and pairings by using the drop down box to select a package, 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 be found in the PCB tutorial.
<p>&nbsp;</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]]'''
28,333
edits