How To Create A New PSPICE Model
How To Create A New PSPICE Model
WINTER2008
HowtoCreateyourown.libFile:
Openanylibraryfile(.libfile)inPSpiceModelEditor,typeinthenetlistforthesubcircuitandsaveasafilewith thesamenameasthesubcircuit.ThenuseCreateCapturePartsinthefilemenutocreatethelibrary.Notethat .libfilesaretextfiles,butcreatinga.libfilewithatexteditorsuchasNotepadandsavingitwithlibextensionwill leaveoutsomespecialcharactersthatPSpiceModelEditoraddstothefile. Forexample,inordertogenerateapartforidealOpAmp:
ECE443PSPICETUTORIAL
WINTER2008
13. Editthepartasyouwish,e.g.drawatriangle,placethreepinsandnamethem+,,andout.Numberthem
inthesamewayastheyhavenumberedinthesubcircuitdefinition.
SummaryofPSPICEcommands:
ForECE443Assignmentsprobablyyouwillonlyneedcommandsforsubcircuitdefinition,Dependentvoltageand currentsources,resistorsandcapacitors,butforsakeofcompleteness,thesyntaxforallimportantcommandsis broughthere.
IndependentDCVoltageandCurrentSources
SYNTAX(Voltage)Vxxxn+nDCvalue SYNTAX(Current)Ixxxn+nDCvalue Wherevalueisthedcvoltageinvoltsforthevoltagesourceandthedccurrentforthecurrentsource.
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
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