0% found this document useful (0 votes)
262 views7 pages

How To Create A New PSPICE Model

.lib files are text files, but creating a.lib file with a text editor such as Notepad will leave out some special characters that "PSpice Model Editor" adds to the file. Replace the model text with your own sub-circuit model, e.g. Draw a triangle, place three pins and name them "+", "-", and "out"

Uploaded by

habyara
Copyright
© Public Domain
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
262 views7 pages

How To Create A New PSPICE Model

.lib files are text files, but creating a.lib file with a text editor such as Notepad will leave out some special characters that "PSpice Model Editor" adds to the file. Replace the model text with your own sub-circuit model, e.g. Draw a triangle, place three pins and name them "+", "-", and "out"

Uploaded by

habyara
Copyright
© Public Domain
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ECE443PSPICETUTORIAL

WINTER2008

HowtoCreateyourown.libFile:
Openanylibraryfile(.libfile)inPSpiceModelEditor,typeinthenetlistforthesubcircuitandsaveasafilewith thesamenameasthesubcircuit.ThenuseCreateCapturePartsinthefilemenutocreatethelibrary.Notethat .libfilesaretextfiles,butcreatinga.libfilewithatexteditorsuchasNotepadandsavingitwithlibextensionwill leaveoutsomespecialcharactersthatPSpiceModelEditoraddstothefile. Forexample,inordertogenerateapartforidealOpAmp:

1. StartPSpiceModelEditor 2. File>New> 3. Model>CopyFrom> 4. BrowsetoC:\ProgramFiles\OrcadLite\Capture\Library\PSpice\Eval.Lib 5. Fromthemodellist,finduA741andclickonit.Modeltextopensinanewwindow. 6. Typeinthenewmodelname(IdealOpAmp)andclickokay. 7. Replacethemodeltextwithyourownsubcircuitmodel.Forexamplethemodelforanopampwith160dBDC


gain(withgoodapproximationanidealopamp)is:

*----------------------------------------------------------------------------* connections: * * * * * non-inverting input | inverting input | | output | | | | | | | | |

.subckt IdealOpAmp 1 2 3 * Eamp 3 0 1 2 1e8 .ends

8. File>CreateCaptureParts 9. InputModelLibrary:C:\...\IdealOpAmp.lib&OutputPartLibrary:C:\...\IdealOpAmp.olb,thenclickokay. 10. ExitPspiceModelEditorandstartCaptureCISLiteEdition. 11. Open>Library>C:\...\IdealOpAmp.olb 12. Doubleclickonthepartname.Parteditorwindowopens.


1

ECE443PSPICETUTORIAL

WINTER2008

13. Editthepartasyouwish,e.g.drawatriangle,placethreepinsandnamethem+,,andout.Numberthem
inthesamewayastheyhavenumberedinthesubcircuitdefinition.

14. Doubleclickonthepart,UserPropertieswindowopens. 15. Doubleclickontheimplementationandchangethedisplayformattovalueonly. 16. Dothesamewithpartreference. 17. ChangethePSpicetemplateasfollows:X^@REFDES%+%%Out@MODEL


Nowthemodelisreadytobeused. Inthefirstprojectthatyouaregoingtousetheselibraryfiles,dothefollowing: PSpice>NewSimulationProfile(orEditSimulationProfileifyoureeditingit)>Libraries>Browsetothelocationofthe generatedlibraryfile>AddasGlobal

SummaryofPSPICEcommands:
ForECE443Assignmentsprobablyyouwillonlyneedcommandsforsubcircuitdefinition,Dependentvoltageand currentsources,resistorsandcapacitors,butforsakeofcompleteness,thesyntaxforallimportantcommandsis broughthere.

IndependentDCVoltageandCurrentSources
SYNTAX(Voltage)Vxxxn+nDCvalue SYNTAX(Current)Ixxxn+nDCvalue Wherevalueisthedcvoltageinvoltsforthevoltagesourceandthedccurrentforthecurrentsource.

DESCRIPTION:Providesaconstantsourceofvoltageorcurrenttothecircuit. EXAMPLES:V_innode_no1node_no2DC3.5 I_sourcenode_no30DC0.25

IndependentACVoltageandCurrentSources
SYNTAX(Voltage)Vxxxn+nACmag[phase] SYNTAX(Current)Ixxxn+nACmag[phase] Wheremagisthemagnitudeoftheacwaveforminvoltsforthevoltagesourceandinamperesforthe currentsourceandphaseisthephaseangleoftheacwaveformindegreesandhasadefaultvalueof0. DESCRIPTION:Suppliesasinusoidalvoltageorcurrentatafixedfrequencytothecircuit. EXAMPLES:V_abnode_no3node_no2AC1090 I_abnode_no4node_no6AC0.5 2

ECE443PSPICETUTORIAL
IndependentTransientVoltageandCurrentSources
SYNTAX(Voltage)Vxxxn+ntrans_type SYNTAX(Current)Ixxxn+ntrans_type

WINTER2008

Wheretrans_typeisoneofthefollowingtransientwaveformtypes: PulsedPULSE(minmaxrisefallwidthperiod) o Ministheminimumvalueofthewaveforminvoltsforthevoltagesourceandinamperesforthe currentsource. o Maxisthemaximumvalueofthewaveforminvoltsforthevoltagesourceandinamperesforthe currentsource. o Delayisthetimeinsecondspriortotheonsetofthepulsetrain,whichhasadefaultof0seconds, Riseisthetimeinsecondsforthewaveformtotransitionfrommintomax. o o o Fallisthetimeinsecondsforthewaveformtotransitionfrommaxtomin. Widthisthetimeinsecondsthatthewaveformremainsatthemaximumvalue. Periodisthetimeinsecondsthatseparatesthepulsesinthepulsetrain.

DESCRIPTION:Suppliesatimevaryingvoltageorcurrenttothecircuit. EXAMPLE:V_snode_no1node_no0PULSE(0.30.300.010.0112)

DependentVoltageControlledVoltageSource
SYNTAXExxxn+ncn+cngain Wherecn+isthepositivenodeforthecontrollingvoltage,cnisthenegativenodeforthecontrolling voltageandgainistheratioofthesourcevoltage(betweenn+andn)tothecontrollingvoltage(between cn+andcn). DESCRIPTION:Providesavoltagesourcewhosevaluedependsonavoltagemeasuredelsewhereinthecircuit. EXAMPLES:E_opnode_no1node_no2node_no4node_no00.5

DependentCurrentControlledCurrentSource
SYNTAXFxxxn+nVyyygain WhereVyyyisthenameofthevoltagesourcethroughwhichthecontrollingcurrentflowsandgainisthe ratioofthesourcecurrent(flowingfromn+ton)tothecontrollingcurrent(flowingthroughVyyy) DESCRIPTION:Providesacurrentsourcewhosevaluedependsonthemagnitudeofacurrentflowingthrougha voltagesourceelsewhereinthecircuit. EXAMPLES:F_depnode_no3node_no2V_control10 3

ECE443PSPICETUTORIAL
DependentVoltageControlledCurrentSource
SYNTAXGxxxn+ncn+cngain

WINTER2008

Wherecn+isthepositivenodeforthecontrollingvoltage,cnisthenegativenodeforthecontrolling voltageandgainistheratioofthesourcecurrent(flowingfromn+ton)tothecontrollingvoltage (betweencn+andcn),in1/ohm.

DESCRIPTION:Providesacurrentsourcewhosevaluedependsonthemagnitudeofavoltagemeasuredelsewherein thecircuit. EXAMPLES:G_onnode_no3node_no6node_no4node_no10.35

DependentCurrentControlledVoltageSource
SYNTAXHxxxn+nVyyygain WhereVyyyisthenameofthevoltagesourcethroughwhichthecontrollingcurrentflowsandgainisthe ratioofthesourcevoltage(betweenn+andn)tothecontrollingcurrent(flowingthroughVyyy),inohms DESCRIPTION:Providesavoltagesourcewhosevaluedependsonthemagnitudeofacurrentflowingthrough anothervoltagesourceelsewhereinthecircuit. EXAMPLES:H_outnode_no7node_no2V_dummy2.5E3

Resistor
SYNTAXRxxxn+nvalue Wherevalueistheresistanceinohms.

DESCRIPTION:Modelsaresistor,acircuitelementwhosevoltageandcurrentarelinearlydependent. EXAMPLES:R_fornode_no3node_no416E3

Inductor
SYNTAXLxxxn+nvalue[IC=icval] Wherevalueistheinductanceinhenriesandicvalistheinitialvalueofthecurrentintheinductor,in amperes(thisparameterisoptional) DESCRIPTION:Modelsaninductor,acircuitelementwhosevoltageislinearlydependentonthederivativeofits current. EXAMPLES:L_44node_no1node_no93E3IC=1E2

Capacitor
SYNTAXCxxxn+nvalue[IC=icval] 4

ECE443PSPICETUTORIAL

WINTER2008

Wherevalueisthecapacitanceinfaradsandicvalistheinitialvalueofthevoltageacrossthecapacitorin volts(thisparameterisoptional)

DESCRIPTION:Modelsacapacitor,acircuitelementwhosecurrentislinearlydependentonthederivativeofits voltage. EXAMPLES:C_twonode_no4node_no02E6 MutualInductance SYNTAXKxxxLyyyLzzzvalue WhereLyyyisthenameoftheinductorontheprimarysideofthecoil,Lzzzisthenameoftheinductor onthesecondarysideofthecoilandvalueisthemutualcouplingcoefficient,k,whichhasavaluesuchthat 0<=k<=1. DESCRIPTION:Modelsthemagneticcouplingbetweenanytwoinductorcoilsinacircuit. EXAMPLES:K_abL_aL_b0.5

SubcircuitDefinition
SYNTAX.SUBCKTname[nodes].ENDS wherenameisthenameofthesubcircuit,asreferencedbyanXstatement(seesubcircuitcall),nodes inthelistofnodesusedtoidentifytheconnectionstothesubcircuitand.ENDSsignifiestheendofthe subcircuitdefinition. DESCRIPTION:Usedtoprovidesubroutinetypedefinitionsofportionsofacircuit.Whenthesubcircuitisreferenced inanXstatement,thedefinitionbetweenthe.SUBCKTstatementandthe.ENDSstatementreplacestheXstatement inthesourcefile. EXAMPLES:.SUBCKTopampnode_no1node_no2node_no3node_no4node_no5 .ENDS

SubcircuitCall
SYNTAXXxxx[nodes]name wherenodesinthelistofnodesusedtoconnectthesubcircuitintotherestofthecircuit,theremustbeas manynodesinthislistasthereareinthesubcircuitdefinition(seesubcircuitdefinition)andnameisthe nameofthesubcircuit,asdefinedina.SUBCKTstatement. DESCRIPTION:ReplacestheXstatementwiththedefinitionofasubcircuti,whichpermitsasubcircuittobedefined onceandusedmanytimeswithinagivensourcefile. EXAMPLE:X_ampnode_no4node_no2node_no8node_no5node_no1opamp

ECE443PSPICETUTORIAL
LibraryFile
SYNTAX.LIB[fname]

WINTER2008

wherefnameisthenameofthelibraryfilecontaining.MODELor.SUBCKTstatementsreferencedinthe sourcefile,whichbydefaultisthenominalorevaluationlibraryfile.

DESCRIPTION:Usedtoreferencemodelsorsubcircuits. EXAMPLE:.LIBmylib.lib

DeviceModels
SYNTAX:.MODELmnamemtype[(par=value)] wheremnameisauniquemodelname,whichisalsousedinthedevicestatementthatincorporatesthis model,mtypeisoneofthemodeltypesavailableandpar=valueisanoptinallyspecifiedlistof parametersandtheirassignedvalues,specifictothemodeltype. 1.RES,whichmodelsaresistorandhastheparameterR,theresistancemultiplier,whosedefault valueis1. 2.IND,whichmodelsaninductorandhastheparameterL,theinductancemultiplier,whosedefault valueis1. 3.CAP,whichmodelsacapacitorandhastheparameterC,thecapacitancemultiplier,whosedefault valueis1. DESCRIPTION:Definesstandarddevicesthatcanbeusedinacircuitandsetsparametervaluesthatcharacterizethe specificdevicebeingmodeled. EXAMPLE:.MODELlmodelIND(L=2) .MODELresistRES

ACAnalysis(CONTROLSTATEMENT)
SYNTAX:.AC[type]numstartend wheretypeisthetypeofsweep,whichmustbeoneofthefollowingkeywords: LINforlinearsweepinfrequency,whichisthedefault; OCTforalogarithmicsweepinfrequencybyoctaves; DECforlogarithmicsweepinfrequencybydecades; numisthetotalnumberofpointsinthesweepforalinearsweepandthenumberofpointsperoctaveor decadeforlogarithmicsweep,startisthestartingfrequencyandendistheendfrequencybothinhertz. DESCRIPTION:Computesthefrequencyresponseofthecircuitdescribedinthesourcefileasthefrequencyisswept eitherlinearlyorlogarithmicallyfromaninitialvaluetoafinalvalue. 6

ECE443PSPICETUTORIAL
EXAMPLE:.ACLIN300101000

WINTER2008

PrintResults(OUTPUTSTATEMENT)
SYNTAX:.PRINTtypevname wheretypeisoneoftheperformedanalysiswhichmustbeoneofthekeywordsDC,AC,TRAN. InourcasewewillbefocusingontheACanalysis.vnameisthevariablenameorthelistofvariablenames forwhichvaluesaretobeprinted. DESCRIPTION:Printstheresultsofcircuitanalysisintableformtoanoutputfileforeachprogramvariablespecified. EXAMPLE:.PRINTACV(R_in)I(V_source)

Probe(OUTPUTSTATEMENT)
SYNTAX.PROBE[vname] WherevnameistheoptionallyspecifiedvariableorlistofvariableswhosevaluefromAC(inourcase)will bestoredinthefilethatPROBEusestogenerateplots.Ifnovariablenameisincluded,valuesofallcircuit variableswillbestoredinthePROBEfile. DESCRIPTION:GenerateafileofdatafromAC,DC,transientanalysisusedbyPROBEtogeneratehighqualityplots. EXAMPLE:.PROBEV(node_no2)I(R_out)

TitleLine(MISCELLANEOUSSTATEMENTS)
DESCRIPTION:Eachsourcefilemusthaveatitlelineasitsfirstline. EXAMPLE:ActiveBandPassFilter

EndStatement(MISCELLANEOUSSTATEMENTS)
SYNTAX.END DESCRIPTION:Eachsourcefilemusthavean.ENDstatementasitsfinalline. EXAMPLE:.END

You might also like