3. 3
EX. 2-12
Introduction
For thisprojectwe were givenacircuitdiagramto construct inPSpice consistingof a2 Ohmresistorin
serieswitha10 milliHenry inductor.The seriesRLispoweredbya periodicpulse voltagewave.This
pulse wave hasa periodof 20 millisecondsandisdefinedbythe followingequation:
𝑣𝑠( 𝑡) = {
20 𝑉 0 < 𝑡 < 8 𝑚𝑠
0 8 𝑚𝑠 < 𝑡 < 20 𝑚𝑠
} (eq. 1)
whichsimplystatesthatfrom0 to 8 millisecondsthe voltagesource providesaconstant20 volts,while
from8 to 20 milliseconds,the voltage source isoff. A diagramof the RL circuitwasprovidedandis
reproducedhere,asillustratedinFigure 1.
Figure 1: Provided diagram circuit complete with required PSpice parameters.
The texton the leftof the voltage source inFigure 1 are the requiredparametersforPSpice to
accuratelymodel ourperiodicpulse wave. Amongtheseare V1,or the minimumvoltage level of the
pulse wave,V2,orthe maximumvoltage level of the pulse wave,PW,orthe pulse width,andPER,or
the periodof the wave.These variablesare setto0, 20 volts,8 milliseconds,and 20 milliseconds
respectively.
In orderto construct thiscircuitwiththe givenparametersinPSpice,we beginbyfirstcreatinganew
project.Thisisdone by openingthe OrCADCapture CISprogramand selectthe “File”optionfollowedby
“New”and then “Project”.Afternamingthe projectand selectingthe type,ablankPSpice page will
open.To constructour circuit,we selectthe “Place”optionfromthe toolbarfollowedbythe “PSpice
Element”subsection.Fromhere we canplace our pulse wave voltage source,resistor,andinductor.
Afterplacingeachelement, the parametersof thatelementwillappearnexttoitas showninFigure 1.
In orderto setthe value fora givenparameter,yousimplydoubleclickthe text.Afterenteringthese
values,we adda groundand connecteach elementwithwirestocompletethe circuit.OurPSpice
reconstructionof the givencircuitiscontainedinFigure 2below.
4. 4
Figure 2: PSpice reconstruction of the given RL circuit.
Afterconstructingthe circuit,we were askedtoperformseveral tasksusingthe PSpice software.First,
we were askedtorun a time domainsimulationonthe circuitinorderto determineboththe steady-
state current acrossthe resistor(I(R1)) andthe RMS value of I(R1). We were thenaskedto findandplot
the FourierTransform(FFT) of I(R1) and to outputa file containingthe detailsof the FFT. All of these
taskswere completedandare detailedinfullinthe followingsections.
Methods
In orderto run the simulationonourcircuit,we clickon the “New SimulationProfile”buttonasshown
inFigure 3.
Figure 3: New Simulation Profile button is highlighted. Used to set the parameters and type of simulation.
5. 5
Selectingthisoptionwill openadialogbox thatallowsthe userto adjustthe parametersandtype of
simulation.Thisdialogbox aswell asthe parametersusedforoursimulationare showninFigure 4.
Figure 4: Simulation Settings dialog box. Stop time is set to 100 milliseconds, start time is set to 60 milliseconds, and maximum
step size is set to 10 microseconds.
By lookingatFigure 4 one can see thatthere are several optionsavailable tothe userinregardsto the
simulation.Firstof all, we canchoose the analysistype.Forourpurposes,we wanttoevaluate the
circuitin the Time Domain. Next,we canchoose boththe time to start collectingdatafromthe
simulationandthe time toendthe simulation.Forthiscircuitwe choose notto start collectingdatauntil
60 milliseconds afterthe simulationhasbegun,which allowsthe systemtoentersteady-statebeforewe
begintocollectdata. Additionally, the stoptime of the simulationischosentobe 100 milliseconds. This
allowsusto collecttwoperiods’worthof datain orderto ensure thatwe have an appropriate sample
size forour calculations. Once these parametersare set,we canchoose to eitherselect“Ok”and
prepare to runthe simulation,orwe can select“OutputFile Options”inordertocreate an outputfile
containingthe detailedFFTof the currentthroughthe resistor. Since we are alsoaskedtofindthe FFT,
we choose the latter.Selectingthe “OutputFileOptions”buttonopensanew dialogbox showninFigure
5.
6. 6
Figure 5: Output File Options dialog box. The fundamental frequency of our voltage source is 50 Hz and the output is set to be
the current through the resistor.
In thisdialogbox we are giventhe optiontoperforma Fourier analysis onanyvariable we wish. Forthis
projectwe are examiningthe currentthroughthe resistorsowe type I(R1) intothisfield. Inorderto
successfullyperformthe Fourieranalysis,we needtoinputthe fundamental,orcentral,frequencyinto
the system.The fundamental frequencyof anysignal isfoundusingthe followingequation:
𝑓𝑢𝑛𝑑𝑎𝑚𝑒𝑛𝑡𝑎𝑙 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 =
1
𝑇
𝐻𝑧 (eq. 2)
where T isthe periodof the system.Here the periodis20 millisecondssothe fundamentalfrequency
wouldbe equal to1/20 milliseconds,or50 Hertz. Once all of these parametersare enteredthe system,
we pressok and prepare torun our simulation. Clicking“Ok”inthe dialogbox showninFigure 4 will
take us back to the page containingourcircuitschematic.Inorder to run the simulationwe simplyclick
the “Run” buttonhighlightedinFigure6.
7. 7
Figure 6: The "Run" button highlighted. Pressing this button will run the simulation.
Selectingthe “RunPSpice”buttonillustrated inFigure 6will runthe simulationaccordingtothe chosen
parametersaswell ascreate the desiredoutputfiles.Once the simulationhasbeensuccessfully
completed,the probe featureof PSpice will automaticallyopen,asseeninFigure 7.
Figure 7: The blank probe screen will automatically open after the simulation has terminated successfully. Any desired
parameter can be chosen and observed from this screen.
From the probe screenwe can selectanyparameterinorderto observe itsbehaviorwithrespectto
time. To dothiswe start by firstselectingthe “AddTrace”optionformthe probe window,shownin
8. 8
Figure 8. Thiswill openanewwindowwhere we canchoose froma wide range of parametersaswell as
operationsthatcan be performedonthe parametersandthenplotted,asshowninFigure 9.
Figure 8: Highlighted "Add Trace" button allows the user to select and plot the values of several parameters with respect to
time.
Figure 9: Window to choose which parameters to display with the probe. For our purposes we wish to examine both the current
through the resister, I(R1), as well as the RMS value of I(R1).
9. 9
Completingall of these stepsallowsustoobtainthe desiredplotsandoutputfilestoproperlyexamine
the current throughthe resistoranditsFouriertransform.These plotsaswell asa thoroughdiscussion
are includedinthe followingsections.
Results
Afterpreformingthe precedingsteps,we obtainedthe plotof the currentthroughthe resistorandthe
RMS value of the currentthroughthe resistorwithrespecttotime.These plotsare illustratedinFigure
10. It isimportantto note that because oursystemisinsteady-state,the inductorinouroriginal circuit
acts like anopencircuitand all the current isdrawn throughthe resistor.
Figure 10: Plots of the current through the resistor, I(R1), and the RMS value of I(R1), RMS(I(R1)).
It isimportantto note that we can ensure oursystemisinsteady-state byobservingthe startingand
endingcurrentlevelsforeachperiod.Foroursystemto trulybe in steady-state,these valuesshouldbe
equal.A quickexaminationof Figure 10 showsthatthisis the case forboth of our waveforms. The RMS
value of I(R1) can be readfrom the endof each periodof the redcurve.As can be shownfromFigure 10,
thisvalue isthe same for bothof the periodsshowninthe plot.Therefore we cansafelysaythat
RMS(I(R1)) isequal to4.6389 amperes.These resultsare furtherdiscussedinthe nextsection.
For thisexample we were alsoaskedtoobtainthe FFTof I(R1) in botha graphical formas well asinan
outputfile.The outputfile iscreatedautomaticallyonce we runthe simulationbasedonthe optionswe
chose as showninFigures4 and 5. In orderto plotthe FFT we simplydelete the RMScurve fromthe
probe and selectthe “Fourier”buttonshowninFigure 11.
10. 10
Figure 11: Highlighting the "Fourier" button which is used to obtain the FFT of the parameter currently displayed by the probe.
Selectingthisoptioninstantlydisplaysthe FFTof I(R1) as a functionof frequency.Aftersome minor
adjustmentstothe scale of the axes,we obtainthe plotcontainedinFigure 12.
Figure 12: FFT of the current through the resistor.
Form Figure 12 it can easilybe seenthatthere isan initial offsetof 4.001 amperes inthe FFT. Thisis the
DC componentof the FFT. It can alsobe seenthat the magnitude of the FFTsteadilydecreasesasthe
frequencyincreases.Bothof these resultswill be furtherexploredinthe nextsection.
For completeness,we will alsoproduce inthissectionthe detailedFFTtable containedinthe generated
outputfile. Thistable isshowninTable 1 below.
11. 11
Table 1: Fourier Components of Transient Response I(R1)
The resultsdetailedinTable 1will be discussedinthe followingsection.
Discussion/Conclusion
We will beginthisdiscussionbycomparingthe resultscontainedinTable 1to those showninFigure 12.
A quickexaminationof the twoimmediatelyrevealsseveral similarities.First,aswasnotedinthe
precedingsection,the plotof the FFThas a y-interceptof 4.001 amperes,whichrepresentsthe DC
componentof the signal.Table 1 agreeswiththisresultas a note above the table propershowsthe DC
componenttobe 4.000 amperes.The difference betweenthesetwovaluesissmall enoughtobe
essentially ignored. Next,we cansee thatTable 1 givesthe Fouriercomponentof the firsttwo
harmonicsto be 3.2515 amperes at 50 Hertz,and 567.5 milliamperesat100 Hertz.Againwe can see
that these valuescloselycorrespondtothose showninFigure 12; 3.2523 amperesat50 Hertzand
657.635 milliamperesat100 Hertz. Once again,the differencesinthesevaluesare small enoughtobe
considered insignificant. The correlationof the resultsobtainedfromTable 1and Figure 12 allow usto
convince ourselvesthatwe didnotcommitan error whencollectingthe data.Thus,we shouldbe
assuredthat 4.6389 amperesisthe true RMS currentthroughthe resistor.
Thiscan furtherbe provedbyusingthe informationcontainedinTable 1to directlydetermine the RMS
value of the current.The formulaforfindingthe RMSvalue isshownineq.3:
𝐼 𝑅𝑀𝑆 = √ 𝐼 𝐷𝐶
2
+ (
𝐼1
√2
)
2
+ (
𝐼2
√2
)
2
+ ⋯+ (
𝐼 𝑛
√2
)
2
(eq. 3)
where nis the numberof harmonics. Plugginginthe valuesof the FouriercomponentfromTable 1into
eq.3 and evaluatinggivesus anRMW currentof roughly4.63 amperes,whichagreeswiththe value
foundgraphicallyinFigure 10.
The last bitof informationcontainedinTable 1isthe Total HarmonicDistortion,orTHD, of the Fourier
transform.The THD allowsustocharacterize the nonsinusoidal propertyof aperiodicsignal asaratio of
12. 12
the RMS value of all the non-fundamental frequencytermstothe RMS value of the fundamental
frequencyterm.Inequationform thiscanbe expressedas:
𝑇𝐻𝐷 = √
∑ 𝐼 𝑛,𝑅𝑀𝑆
2
𝑛≠1
𝐼1,𝑅𝑀𝑆
2 (eq. 4)
where againn isthe numberof harmonics.For our systemthe THD isshownto be 20.92%.
Afterconstructingthe circuitshowninFigure 1 and runningthe requestedsimulation,we have gained
valuable insightintothe innerworkingsof RLcircuit poweredbyaperiodicpulse voltagesource. In
addition,we have familiarizedourselveswiththe PSpice ideologyandworkspace.Thisfirstexample has
preparedusto construct andanalyze largerandmore complex circuitslaterinthe semester.
EX. 2-13
Introduction
For the secondexample of thisfirstlabwe are askedto constructand simulate afairlymore complex
circuitthan that inthe firstexample.Thisisdue tothe additionof several new circuitcomponentsnot
includedinexample 2-12.These componentsinclude aswitch,adiode,anda Dc voltage source. We
were givenafigure detailingthe constructionof thisnew circuit,asshowninFigure 13 below.
Figure 13: Provided diagram of the circuit to be built and simulated in PSpice for EX 2-13.
It isimportantto note that there are a couple of typosin the diagramshowninFigure 13; V1 shouldbe
setto 0 insteadof -10 and VCCshouldbe 90 voltsinsteadof 30 volts.These changeswere made inthe
constructionof our circuit inPSpice,asis showninFigure 14.
13. 13
Figure 14: Fully constructed circuit in PSpice. All typos from the given diagram were corrected when constructing the circuit.
The stepstakento construct the circuitshowninFigure 14 are exactlyidentical tothose detailedinthe
Introductionsectionof EX2-12. The onlydifference isthe additional componentsthatwere notincluded
inthat example.Fortunately,all of these canbe foundunderthe “Place”tab,and more specificallythe
“PSpice Element”subsection. Once the circuitisconstructed,we are askedtoPSpice to simulate one
periodof the periodicpulse voltagesource,whichisdefinedtobe 100 milliseconds.We then use the
probe feature of PSpice inordertomeasure a myriadof differentvaluesinthe circuitsuchas the
currentthrough the inductor,the average powerabsorbedbythe DCvoltage source,the energystored
inthe inductor,the RMS currentthroughthe resistor,andsoon. All of these measurementsare detailed
and discussedinthe followingsections.
Methods
Before we beginusingthe probe tofindthe variousmeasurementswe are interestedin,we firstneedto
simulate the circuit.Thisagaindone usingthe exactsame stepsdetailedinthe Methodssectionof EX2-
12. The onlydifferencebeingthatforthisexamplewe wishtobegincollectingdataat0 seconds;there
isno needtowait forthe systemtoenterthe steady-state before we begincollectingdataas we wishto
examine the behaviorof the circuitoverthe entire 100 millisecondperiod. There isalsononeedforus
to change the outputfile optionsaswe are not interestedinfindingthe FourierTransformof anyof our
measurements.Once the parametersof the simulationhave beenset,we simplyclickonthe green“Run
Simulation”buttonjustlikebefore.Once the simulationhasbeensuccessfullyrun,the probe window
will automaticallyopen.Fromhere we canuse the “AddTrace” optioninorder to plotanyvariable we
are interestedin.
14. 14
Results
For thisexample,inordertoensure thatwe performall of the precedingstepscorrectly,we were also
givena table displayingall the valueswe are interestedinfinding,the probe commandthatwouldallow
us to plotthese values,andthe actual numerical value thatwe shouldfindusingthe probe.Thistable is
showninTable 2 below.
Table 2: Desired Quantities and Actual Values
Simplylookingatthe table above doesnot reveal muchuseful information.Therefore,inordertoget a
clearerpicture of exactlyhowthe circuitbehaves,we needtouse the probe functiontoplotthese
quantities. Beginningatthe topof the table andworkingour waydown,we enteredeachcommand
listedinthe middle columninthe probe functioninordertoproduce the desiredplots. The plotof the
currentthrough the inductor,aswell asits maximumvalue,isshowninFigure15. In thissectionwe will
onlyproduce ourgraphs and discussthemgenerally.A full discussionof ourresultsiscontainedinthe
concludingsection.
Figure 15: The plot of the current through the inductor. The maximum of this current is also shown.
The firstthingto note from Figure 15 is that the maximumvalue we foundforthe inductorcurrentis
identical tothe value listedinTable 2.We shouldtake thisto meanthatour resultsare indeedcorrect.
15. 15
We nextturnedtothe energystoredinthe inductor.Usingthe formulaprovidedinTable 2we produced
the graph showninFigure 16.
Figure 16: The energy stored in the inductor with respect to time as well as the maximum value are shown in the figure.
Again,a simple glance atFigure 16 assuresus thatour resultsare correct as the maximumvalue found
on our plotequalsthe value showninTable 2.We shouldalsonote thatthe maximumforthisplot
occurs at 10 milliseconds,whichisthe same time thatthe current throughthe inductorreachesits
maximum.Once again,thiscorrelationconvincesusthatourresultsare indeedcorrect.
It isnow importanttonote that for all of the remainingquantities,we will onlyworryaboutthe value at
the endof the 100 millisecondperiod. We will now lookatthe average powerabsorbedbyeach
elementbeginningwiththe switch.The graphof thisquantityisshowninFigure 17.
Figure 17: The average power absorbed by the switch. The value is only just greater than 0 Watts.
It isdifficulttosee fromFigure 17, butthe powerabsorbedbythe switchis justgreaterthan0 Watts,
whichisalsoshownin Table 2. The reasonfor thiswill be discussedinthe followingsection.
Figure 18 showsthe average powerabsorbedbythe DCpowersource,VCC.
Figure 18: Plot of the average power absorbed by the DC voltage source. The negative value indicates that the voltage source is
supplying power.
Here the negative value indicatesthatthe voltage source issupplyingpower,whichisbynature what
voltage sourcesdo. Italso shouldbe notedthateventhoughitisnot showninFigure 18, the power
absorbedbythe source peaksat -203 Watts at 10 milliseconds,the same time asthe currentthrough
the inductorand the energystoredbythe inductorreach theirmaximum.Again,thiswillbe discussedin
the nextsection.Also,we see thatonce againthe value we foundisidentical tothe value providedin
Table 2.
Figure 19 illustratesthe average powerabsorbedbythe diode.
16. 16
Figure 19: Average power absorbed by the diode.
There isnot verymuch to discussinregardsto thisquantityotherthanto pointoutthat the value isvery
small.Thisisdesirable aswe wishtoavoidlossesinordertosupplymostof the powerin the circuitto
the inductorand resistor.
We nextexaminethe average inductorpowerasshowninFigure 20.
Figure 20: Average inductor power. The value is roughly 0 at the end of the period, which is what we would expect.
From Figure 20 we can see thatthe peak value is203 Watts at 10 millisecondswhichisexactlyequal,
but opposite,tothe average powerabsorbedbythe DCvoltage source.We can alsosee that the endof
one periodthe value isroughly0.Both of these resultsare logical andwill be discussedfurtherinthe
nextsection.
We nowwishto lookat the average voltage acrossthe inductor,whichisshowninFigure 21.
17. 17
Figure 21: Average voltage across the inductor. At the end of the period the voltage is again roughly 0.
From Figure 21 we can againsee that the value of the quantityat the endof the 100 millisecondperiod
isjust about0. Once again,thisisexpectedandmakessense since the average inductorpowerisalso0
at the endof the period.
Finally,we wishtolookatthe average resistorpower.ThisplotisshowninFigure 22.
Figure 22: Plot of the average resistor power. At the end of the period we see that the value of the resistor power is 19.9 Watts.
There are twoimportant takeawaysfromFigure 22. First,we see thatthe average powerof the resistor
isjust about0 Watts forthe first10 milliseconds.Thisisdue tothe inductorchargingand thusabsorbing
a majorityof the powerin the circuit.Finally,we cansee thatat the endof the periodthe average
powerabsorbedbythe resistoris19.9 Watts. The rest of the powerat thistime issplitbetweenlosses
inthe diode andthe switch.
Nowwe will lookatthe energyabsorbedbythe resistor,inductor,anddiode one ata time.We begin
withthe energyabsorbedbythe resistor,showninFigure 23.
18. 18
Figure 23: Energy absorbed by the resistor. At the end of the period the value is 1.99 joules.
First,itis importanttonote that Figure 23 ismislabeled.The label shouldread“EnergyAbsorbedbythe
Resistor”asresistorsdonot store energy.Thisissimplyatypo. We can see that at the endof the period
the energyabsorbedbythe resistoris1.99 joules.
Figure 24 showsthe energyabsorbedbythe diode.
Figure 24: Energy absorbed by the diode. At the end of the period the value is 0.046 joules.
We can see thatthe diode absorbsverylittle energythroughoutthe 100 millisecond period.Atthe end
of the period,the value is0.046 joules,whichisonce againdesirable forthe same reasonsstatedasfor
the average diode power.We canalso see thatbefore 10 millisecondsthe energyabsorbedbythe diode
is0 joules.Thisisagaindue to the nature of the inductor.
Figure 25 showsthe energyabsorbedbythe inductor.
Figure 25: Energy absorbed by the inductor. At the end of the period we can see that the value is 0 joules.
19. 19
We can easilysee thatat the endof the periodthe value of the energyabsorbedbythe inductor is0
jouleswhichagreeswiththe previouslyshownplotsforthe average inductorpowerandvoltage.We
can alsosee that the peakof the energyabsorbedbythe inductoroccursat 10 milliseconds,whichalso
agreeswithall the previousinductorplots.
Finally,we wishtoplotthe RMS value of the currentthroughthe resistor,whichisshowninFigure 26.
Figure 256: RMS current through the resistor. At the end of the period the value is 0.998 Amperes.
Once again,we see that the RMS currentthroughthe resistoris0 Amperesbefore 10millisecondswhile
the inductorischarging.We alsosee that the value at the endof the periodis0.998 Amperes.
For completeness,the resultsof the simulationonourcircuitare shownin Figure 27.
Figure 26: The circuit after running the simulation.
All of these resultsare discussedingreaterdetailinthe followingsection.
20. 20
Discussion/Conclusion
We will beginourdiscussionbyfocusingonthe inductorplots. The firstthingwe note whenexamining
Figures15, 16, 20, 21, and25 isthat the maximumof all of these plotsare locatedat 10 milliseconds.As
previouslystated,thisisdue tothe inductorchargingduringthe first10 milliseconds. Due tothe nature
of the inductor, the diode, andthe switch, all of the currentduringthistime followsthroughthe
inductor,as evidencedbyFigure 26whichshowsthat the RMS currentthroughthe resistorduringthe
first10 millisecondsis0. The inductorplotsalsoshow that after10 millisecondsall of the quantities
steadilydecreaseuntil theyfinallyreach0.Thisis the dischargingperiodof the inductor. Once an
inductorhas beenfullycharged,itenterssteady-state.Inthisstatthe inductoracts as an opencircuit,
whichmeansthat there isa voltage acrossit,but no currentthroughit. Again,thiscanbe showninthe
resistorplotsasall of the quantitiesare 0 before 10 millisecondsandsteadily increase afterwardsuntil
the endof the period.
We will nowturnourattentiontoFigures17 through22 whichdetail the average powerabsorbedby
each element.BeginningwithFigure 18whichshowsthe average powerabsorbedbythe DCvoltage
source we see that at the endof the periodthe source issupplying20.3 Watts.Comparingthisto the
average powerabsorbedbythe resistor,we see thatthere isroughly0.4 Watts of powerthat is
unaccountedfor. Aspreviously stated,there isnocurrentthroughthe inductorwhichthereformeans
that the inductorisnot absorbinganyenergy.ThisisalsoillustratedinFigure 21whichshowsthatthe
powerabsorbedbythe inductorat the endof the periodis0 Watts. Therefore,the onlypossible
remainingelementsthatcanaccount for the missingpowerare the diode andthe switch.Examining
Figures17 and 19 showsthat the total powerabsorbedbythese twoelementsis0.474 Watts,whichis
justabout equal tothe unaccountedpower. Comparingthisvalue tothe value of the powerabsorbedby
the resistorwe see thatthese lossesare justaboutsmall enoughtobe inconsequential.Thisisespecially
true for the switchwhichabsorbsa meager0.01 Watts. Thisis due to our attemptstoidealize the switch
by settingthe on resistance toa mere 0.001 ohms.Usually,thisvalue isthe range of 1 ohm to 1
Megaohm.
Performingbothof these examplesinthisfirstlabhasallowedustofamiliarizeourselveswiththe
particularsassociatedwithPSpice aswell asthe PSpice workenvironment.We have alsoexaminedthe
innerworkingsof botha relativelysimple RLcircuitaswell asa slightlymore complex RLcircuit
consistingof a switch,adiode,anda DC voltage source.We are now preparedtoconstruct and simulate
much more complicatedcircuits.