You are on page 1of 33

Buildingdevicemodelsandcircuitmacromodelswith

theQucsGPLcircuitsimulator:Ademonstration
M.E.Brinson:FacultyofComputing,LondonMetropolitanUniversity,UK;
Qucsdevelopmentteam:mbrin72043@yahoo.co.uk
S.Jahn:Qucsprojectmanager,Munich,Germany;stefan@lkcc.org

Background
IntroductiontocircuitsimulationwithQucs
Buildingacompactsemiconductormodelofannpnbipolar
phototransistor
CompilingandlinkingVerilogAcodetoQucs

Summary

PresentedonApril2,2009,attheCOMONmeeting,IHP,Frankfurt(Oder),Germany

Background
Qucsisanopensourcecircuitsimulatorwithagraphicaluserinterface(GUI)
basedonQTbyTrolltech

Qucsisavailablefromhttp://qucs.sourceforge.net/

Qucsaimstosupportawiderangeofcircuitsimulation,includingDC,AC,
transient,Sparameter,noiseanalysis,HarmonicBalanceanalysisanddigital
systemsimulation
DevelopedusingGNU/LinuxundertheGeneralPublicLicense(GPL)
Availableformostofthepopularcomputeroperatingsystems,including
GNU/Linux,Windows,Solaris,NetBSD,FreeBSDandMacOS
QucsisoneoftheGPLcircuitsimulatorstakingpartintheMOSAKVerilogA
standardizationinitiative

Developers:Loosegroupofinternationalengineers,scientistsandprogrammers

Qucsismultilingualandhasbeentranslatedinto:Romanian,German
Italian,Polish,French,Portuguese,Spanish,Japanese,Hungarian,Hebrew,
Swedish,Turkish,Russian,CzechandCatalan

IntroductiontocircuitsimulationwithQucs
Qucscurrentversions:production0.0.14;development0.0.15
StartQucsbyissuingthecommand#qucs
ORbyclickingtheappropriateicononyourstartmenuordesktop

File>Application
settings
Drawingtoolbar
Openprojects
folders

Dropdownmenus
Schematiccircuitdrawing
window

IntroductiontocircuitsimulationwithQucs
Toolsuite:Qucsconsistsofagroupofstandaloneprogramswhichinteractwitheach
otherthroughagraphicaluserinterface(GUI)
theGUI:usedtocreateschematics,setupsimulations,displaysimulationresults
andwritingVHDL/Verilogcodeamongstothertasks

theanaloguesimulator:acommandlineprogramwhichisrunbytheGUI
tosimulateusergeneratedschematics

asimpletexteditor:whichisusedtodisplaynetlists,simulationlogfilesandtoedit
SPICE,Touchstoneandothertextfiles

afiltersynthesisprogram:usedforthedesignofpassivefilters

atransmissionlinecalculator:usedforthedesignandanalysisoftransmissionlines

acomponentlibrary

anattenuatorsynthesisprogram:usedforthedesignofpassiveattenuators

acommandlineconversionprogram:thisprogramactsasatoolfortheimportand
exportofdatasets,netlistsandschematicsfromandtootherCAD/EDAsoftware

TheGUIisalsousedbyQucstolaunchotherEDAtools:FreeHDL(http://www.freehdl.seul.org)
fordigitalVHDL,IcurusVerilog(http://icarus.com/eda/verilog/)fordigitalVerilogand
ASCO(http://asco.sourceforge.net/)forcircuitoptimization

IntroductiontocircuitsimulationwithQucs
Settingupschematics

EitherpresstheNewbuttonabovetheprojectsfolderorusethemenuentry
ProjectNewProjectandentertheprojectname

ConfirmthedialogbypressingCreatebutton.QucsthenopensthePhototransistor
projectanddisplaysablankprojectwindowwiththeContenttabopen.

IntroductiontocircuitsimulationwithQucs
Buildingasimpleschematic

Emptydrawingpad

Postsimulation

Addsimulation

dataprocessing

controls
ComponenttabON

Draganddrop

Fromcomponentlibrary

Wiringtool
Rotationtools

Placecomponents

Builtincomponents

Positioncomponents,connectcomponents
andeditvalues

IntroductiontocircuitsimulationwithQucs
Qucsbuiltinanaloguecomponents:1

Lumpedcomponents

Sources

IntroductiontocircuitsimulationwithQucs
Qucsbuiltinanaloguecomponents:2
Nonlinearcomponents

VerilogAcomponents

Filecomponents

IntroductiontocircuitsimulationwithQucs
Qucsbuiltinanaloguecomponents:3

IntroductiontocircuitsimulationwithQucs
Qucsbuiltinanaloguecomponents:4
Simulations

Diagrams

CartesianPolarTabular
SmithChartAdmittanceSmith
PolarSmithCombi
SmithPolarCombi
3DCartesian
Locuscurve
TimingDiagram
TruthTable
Paintings

LineArrowText
EllipseRectangle
filledEllipse
filledRectangle
EllipticArc
10

IntroductiontocircuitsimulationwithQucs
Qucsbuiltindigitalcomponents

11

IntroductiontocircuitsimulationwithQucs
Qucsbuiltinlibrariesofcomponents

12

IntroductiontocircuitsimulationwithQucs
GenerationofcircuitsusingQucsdesigntoolsuite:
passivefiltersynthesisexample

Lowpassfilter
synthesis

Othersynthesis/designtools:

TextEditor,LineCalculator,MatchingCircuitsandAttenuatorSynthesis

13

IntroductiontocircuitsimulationwithQucs
Launchingasimulation

Simulationcontrolmenu

Plotteddata

Postsimulation
processedand
plotteddata

Datasets

S[1,1]

Sparametervalue

nodename.V

DCvoltageatnodenodename

name.I

DCcurrentthroughcomponentname

nodename.v

ACvoltageatnodenodename

name.i

ACcurrentthroughcomponentname

nodename.vn

ACnoisevoltageatnodenodename

name.in

ACnoisecurrentthroughcomponentname

nodename.Vt

Transientvoltageatnodenodename

name.It

Transientcurrentthroughcomponentname

14

IntroductiontocircuitsimulationwithQucs

Qucs:PostsimulationdataprocessingMATLAB*/Octavestyle**
Equationblocks>dataprocessing>Plots/Tables
Simulationdatasetsplusanyofthefollowing
Constants:i,j,pi,e,kB,q
Numbersuffixes:E,P,T,G,M,k,m,u,n,p,f,a
Immediate:2.5,1.4+j5.1,[1,3,4,5,7],[11,12;21,22]
Matrices:M,M[2,3],M[:,3]
Ranges:Lo:Hi,:Hi,Lo:,:
Arithmeticoperators:+x,x,x+y,xy,x*y,x/y,x%y,x^y
Logicaloperators:!x,x&&y,x||y,x^^y,x?y:z,x==y,x!=y,
x<y,x<=y,x>y,x>=y

Functions:

absadjointanglearccosarccosecarccotarcosecharcosharcotharcsecarcsinarctanargarsech
arsinhartanhavgbesseli0besseljbesselyceilconjcoscoseccosechcoshcotcothcumavgcumprod
cumsumdBdbmdbm2wdeg2raddetdftdifferferfcerfcinverfinvexpeyefftfixfloorFreq2TimeGaCircle
GpCirclehypotidftifftimagintegrateinterpolateinversekbdlimexplinspacelnlog10log2logspacemag
maxminMuMu2NoiseCirclenormphasePlotVspolarprodrad2degrandomrealrmsRolletroundrtoswr
rtoyrtozrunavgsecsechsignsinsincsinhsqrsqrtsrandomStabCircleLStabCircleSStabFactor
StabMeasurestddevstepstosstoystozsumtantanhTime2Freqtransposetwoportunwrapvariancevt
w2dbmxvalueytorytosytozyvalueztorztosztoy

*MATLAB,Mathworks,http://www.mathworks.com/

**Octave,http://www.gnu.org/software/octave/

15

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Schematicsymbol,defaultparameterlistandequivalent
Lightbus

circuitofannpnbipolarphototransistor

Thephototransistor
consistsofanEbersMoll
bipolarjunctiontransistor
modelwhichhasbeen
extendedtoinclude
depletionanddiffusion
capacitance,forwardand
reverseEarlyeffects,
highcurrentforwardand
reversebetadegradation,
thermalandshotnoise,
plusalightbuswhich
connectsexternallight
signalstothe
phototransistor

16

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Phototransistormodelparameters

Name

Symbol

Description

Unit

BF
BR

f
r

Forwardbeta
Reversebeta

Is
Nf

Is
Nf

Saturationcurrent
Forwardemissioncoefficient

Nr

Nr

Reverseemissioncoefficient

Var
Vaf

Var
Vaf

ReverseEarlyvoltage
ForwardEarlyvoltage

Mje
Vje

Mje
Vje

Baseemitterexponentialfactor
Baseemitterbuiltinpotential

Cje
Mjc

Cje
Mjc

Baseemitterzerobiasdepletioncapacitance
Basecollectorexponentialfactor

1p
0.33

Vjc
Cjc

Vjc
Cjc

Basecollectorbuiltinpotential
Basecolectorzerobiasdepletioncapacitance

V
F

0.75
1p

Tr
Tf

Tr
Tf

Idealreversetransittime
Idealforwardtransittime

s
s

100n
0.1n

Ikf
Ikr

Ikf
Ikr

Highcurrentcornerforforwardbeta
Highcurrentcornerforreversebeta

A
A

0.5
0.5

Rc

Rc

Collectorseriesresistance

Re
Rb

Re
Rb

Emitterseriesresistance
Baseseriesresistance

1
100

Kf
Ffe

Kf
Ffe

Flickernoisecoefficient
Flickernoisefrequencyexponent

100
0.1
A

1e10
1
1

V
V

100
100

0.33
0.75

1e12
1

Af
Af
Flickernoiseexponent
Responsivity Responsivity Responsivityatpeakwavelength

A/W

P0

P0

Relativeselectivitypolynomialcoefficient

P1

P1

Relativeselectivitypolynomialcoefficient

P2

P2

Relativeselectivitypolynomialcoefficient

P3

P3

P4

P4

Relativeselectivitypolynomialcoefficient

Relativeselectivitypolynomialcoefficient

Default

1
1.5

2.6122x103
%/nm 1.4893x101
%/nm2 3.0332x102
%/nm32.5708x105
%/nm4 7.6923x109

17

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Bipolarphototransistormodelequations

DCI/Vcharacteristics

[
[

]
]

IEC= Is exp

IEC
V BI , CI
1 IDC 2= r GMINV BI , CI
Nrvt 300

ICC=Is exp

V BI , EI
1
Nfvt 300

CBC=

Capacitance

dQ BI , CI
=
dV BI , CI

=2 MjcCjc
CBE=

Noise

q1
1 14q2
2

V BI , CI
Vjc

Mjc

Tr

dIEC
dV BI , CI

V BI , CI

dQ BI , EI
=
dV BI , EI

q1=1

Cjc

Cje

V BI , EI
Vje

Mje

Tr

ICC
GMINV BI , EI
f

V BI , CI V BI , EI

Vaf
Var
ICC IEC
KT
q2=

vt T =
Ikf
Ikr
q

[ ICCIEC ]

2MjcV BI , CI
dIEC
1 Mjc Tr
Vjc
dV BI , CI

=2 MjeCje

Photocurrent

ICT =

IDE 2=

dICC
dV BI , EI

Vjc
2

V BI , CI >=
V BI , EI

Vjc
2

Vje
2

2MjeV BI , EI
Vje
1Mje + Tr dICC
V BI , EI >=
Vje
2
dV BI , EI

Iopt=GpbcPopt

Gpbc =

RelSensitivityRe sponsivity
f 100

RelSensitivity =P0P1P22P33P4 4
4KT
f
Rc
8KT
iRban 2=
f
Rb
iRcn 2=

4KT
f
Re
8KT
iRbbn2 =
f
Rb
i Re n2=

iICTsn 2=2qICf
ibsn2 =2qIBf

ibfn2= Kf

IB Af
f
f Ffe

WhereKistheBoltzmannconstant,TisthetemperatureinKelvin,qistheelectroncharge,GMINisasmall

admittanceinparallelwiththedevicejunctions,fisthenoisefrequencybandwidthinHzandisthelight
wavelengthinnm.Othersymbolsandnodenamesaredefinedinthepreviousslides.

18

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage1thebasicnpntransistormodel

Equationdefineddevice

LargesignalDCmodel

Generatesymbol
Clickrighthandmousebutton
ondrawingpad

Redrawnsymbol

dI
dV
Q=Q I ,V
dQ dQV dQ I
C=
=

g
dV
dV
dI
I =I V , g=

19

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage2DCsimulationtests

20

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage3Addingcapacitancetothephototransistormodel

Chargeequations
V BI ,CI

Q BI , CI

CBCdV =TrIEC2

[ {
[
[ {

V BI , CI
CjcVjc
= TrIEC
1 1
1Mjc
Vjc

V BI , EI

Q BI , EI

V BI , CI
Cjc Mjc
1Mjc V BI , CI
Vjc

Mjc

CBEdV

=TfICC2

= TfICC

} ]

1 Mjc

V BI , CI <=

V BI , EI
Cje Mje
1Mje V BI , EI
Vje

MjE

V BI , EI
CjeVje
1 1
1Mje
Vje

V BI , CI

} ]
1Mje

Vjc
2

V BI , EI

V BI , EI <=

Vjc
2

Vje
2

Vje
2

EDDblocks

21

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage4simulatingcapacitiveeffects

ACgain

CbeandRbeextraction

22

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage5Addingphotoelectriceffects

Siphototransistorrelative
sensitivitydata

Curvefittingprogram

Measureddata

RelSensitivity =P 0P 1 P22 P 33 P 44
Where P 0=2.6122e3, P 1 =1.4893e1, P2 =3.0332e-2, P 3 =2.5708e-5, P 4 =7.69e-9

EDDlight
busmodel

Iopt=

RelSensitivityResponsivitypower
f100

23

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage6simulatingphotoelectriceffects

Phototransistoroutput
characteristics

Phototransistorresponsivity
characteristics

24

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage7addingnoisetothephototransistormodel
Qucsnoisevoltagesource
ibsn= 2qIB A/ Hz

VPSD f =

U
acf e

Af

Kf
ibfn=
f Ffe

A/ Hz

WhereVPSD(f)isthevoltagespectral
densityatfrequencyfinV2/Hz,Uis
thevoltagespectraldensityasfgoes
tozero,a,candearecoefficientsthat
determinethetypeofnoisegenerated;
whiteandshotnoisewithU=1,e=0,
c=1anda=0,andflickernoisewith
U=Kf,e=Ffe,c=1anda=0.
iICTsn= 2qIC A/ Hz

Note:Resistorthermalnoise
isautomaticallygeneratedbyQucs

Noiseparameters

25

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage8simulatingphototransistornoise

Variablelightpower

Variablewavelength

26

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage9producingadistributionstandardmodel

Model
GenerateVerilogA
code

StoreinQucs
library

UseCreateLibraryfromProjectmenu

`include "disciplines.vams"
`include "constants.vams"
module phototransistor (Collector, Base, Emitter, Power, Wavelength);
inout Collector, Base, Emitter, Power, Wavelength;
electrical Collector, Base, Emitter, Power, Wavelength;
// Definition of internal local nodes
electrical CI, BI, BI2, EI;
// Parameter values and description text
`define attr(txt) (*txt*)
parameter real Bf=100 from [1:inf] `attr(info="forward beta");
parameter real Br=0.1 from [1e-6:inf] `attr(info="reverse beta");
:
parameter real P3=-2.5708e-5 from[-inf:inf]
`attr(info="relative selectivity polynomial coefficient" );
parameter real P4=7.6923e-9 from[-inf:inf]
`attr(info="relative selectivity polynomial coefficient" );
// Definition of internal variables and quantities
real VT, con1, con2, con3, con4, con5, con6, con7, con8, con9, con10, TwoQ, FourKT,
GMIN;
real ICC, IEC, q1, q2, IB, IC, IE, Q1, RelSensitivity;
// Quantities
analog begin
// Module initialisation code
@(initial_model)
begin
VT = `P_K*300/`P_Q; con1=1/(Nf*VT); con2=1/(Nr*VT); con3=1-Mje; // VT = vt(300)
con4=1-Mjc, con5=pow(2, Mje); con6=pow(2, Mjc); con7=Rb/2; con8=2/Rb;
con9=1/Rc; con10=1/Re; TwoQ=2*`P_Q; GMIN=1e-12;
// TwoQ = 2*q
FourKT=4*`P_K*$temperature;
// FourKT = 4*K*T
end;
// Model quantity equations and current contributions
ICC=Is*(limexp(V(BI,EI)*con1)-1); IEC=Is*(limexp(V(BI,CI)*con2)-1);
q1=1+V(BI,CI)/Vaf + V(BI,EI)/Var; q2=(ICC/Ikf) + (IEC/Ikr); IB=V(BI2,BI)*con8;
IC=V(Collector,CI)*con9; IE=V(EI,Emitter)*con10; I(Collector,CI) <+ IC;
I(Base,BI2) <+ V(Base, BI2)*con8; I(BI2, BI) <+ IB; I(EI, Emitter) <+ IE;
I(BI,CI) <+ (IEC/Br) + GMIN*V(BI,CI); I(BI,EI) <+ (ICC/Bf) + GMIN*V(BI,EI);
I(CI,EI) <+ (ICC-IEC)/(1e-20+(q1/2)*(1+sqrt(1+4*q2)));
Q1=(V(BI,CI) >Vjc/2) ? Tr*IEC+Cjc*con6*(Mjc*V(BI,CI)*V(BI,CI)/Vjc+con4*V(BI,CI))
: Tr*IEC+Cjc*((Vjc/con4)*(1-pow((1-V(BI,CI)/Vjc),con4)));
I(BI,CI) <+ ddt(Q1);
Q1=(V(BI,EI) >Vje/2) ? Tf*ICC+Cje*con5*(Mje*V(BI,EI)*V(BI,EI)/Vje+con3*V(BI,EI))
: Tf*ICC+Cje*((Vje/con3)*(1-pow((1-V(BI,EI)/Vje),con3)));
I(BI,EI) <+ ddt(Q1);
RelSensitivity = P0+P1*V(Wavelength)+P2*pow(V(Wavelength),2)
+P3*pow(V(Wavelength),3)+P4*pow(V(Wavelength),4);
I(CI,BI2) <+ ( (Responsivity*RelSensitivity)/(Bf*100) )*V(Power);
// Noise contributions
I(Collector,CI) <+ white_noise(FourKT*con9, "thermal");
I(Base,BI2)
<+ white_noise(FourKT*con8, "thermal");
I(BI2,BI)
<+ white_noise(FourKT*con8, "thermal");
I(EI,Emitter)
<+ white_noise(FourKT*con10, "thermal");
I(CI,EI)
<+ white_noise(TwoQ*IC, "shot");
I(BI,EI)
<+ white_noise(TwoQ*IB, "shot");
I(BI,EI)
<+ flicker_noise(Kf*pow(IB, Af), Ffe, "flicker");
end
endmodule

Phototransistor.va
file

27

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage10CompilingVerilogAcodetoC++
Compilephototransitor.vafile
withADMS*using

1.admsXmlphototransistor.vaequcsVersion.xmlequcsMODULEcore.xml
:generatesfilesphototransistor.core.cppandphototransistor.core.h
2.admsXmlphototransistor.vaequcsVersiom.xmlequcsMODULEdefs.xml
:generatesfilephototransistor.defs.h
3.admsXmlphototransistor.vaequcsVersion.xmlequcsMODULEgui.xml
:generatesfilesphototransistor.gui.cppphototransistor.gui.h
4.admsXmlphototransistor.vaeanalogfunction.xml
:generatesfilesphototransistor.analogfunction.cppand
phototransistor.analogfunction.h
Filephototransistor.vaandthegeneratedcompiledfilesmustbeinQucsdirectory
qucscore/src/components/verilog

*L.LemaitreandB.Gu,ADMSafullycustomizableVerilogAMScompilerapproach,2006.
Availablefromhttp://www.mosak.org/montreux/posters/17_Lemaitre_MOSAK06.pdf.

S.JahnandH.Parruitte,Qucs:Adescription,VerilogAMSinterface,2006.
Availablefrom:http://qucs.sourceforge.net/docs.html.

28

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage11MergingphototransistorC++codewiththe
Qucsatoranaloguecircuitsimulatorcode
11.1ModifyMakefile.amindirectoryqucscore/src/components/Verilog
(a)Addphototransitor.analogfunction.cppandphototransistor.core.cpp
toentrylibverilog_a_SOURCES
(b)Addphototransistor.analogfuncction.h,phototransistors.defs.h
andphototransistor.core.h
toentrynoinst_HEADERS
(c)Addphototransistor.va
toentryVERILOG_FILES
11.2Add#includeverilog/phototransistor.core.h
tofilequcscore/src/components/components.h
11.3Addunderheading//circuitcomponents
REGISTER_CIRCUIT(phototransistor)
tofilequcscore/src/module.cpp
11.4Addunderheading//verilogdevices(thisstepisoptionalbutrecommended)
CIR_phototransistor
tofilequcscore/src/components/component_id.h

29

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage12AddingthephototransistortotheQucsGUIcode:part1
12.1AddtoarraypInfoFuncVerilogAComps[]infile
qucs/qucs/qucs.cppentry&phototransistor::info
before0atandoflist
#include"phototransistor.h"
phototransistor::phototransistor()

12.2Renamephototransistor.gui.cpptophototransistor.cpp
andphototransistor.gui.htophototransistor.h,then
copyrenamedfilestodirectoryqucs/qucs/components

12.3Editphototransistor.cpptoincludeGUIdrawinginformation

{
Description=QObject::tr("phototransistorverilogdevice");
Props.append(newProperty("Bf","100",false,QObject::tr("forwardbeta")));
Props.append(newProperty("Br","0.1",false,QObject::tr("reversebeta")));
Props.append(newProperty("Is","1e10",false,QObject::tr("darkcurrent")+"("+QObject::tr("A")+")"));
..
Props.append(newProperty("Temp","26.85",false,QObject::tr("simulationtemperature")));
createSymbol();
tx=x2+4;
ty=y1+4;
Model="phototransistor";
Name="PT";
}
Component*phototransistor::newOne(){
phototransistor*p=newphototransistor();
p>Props.getFirst()>Value=Props.getFirst()>Value;
p>recreate(0);
returnp;
}
Element*phototransistor::info(QString&Name,char*&BitmapFile,boolgetNewOne){
Name=QObject::tr("phototransistor");
BitmapFile=(char*)"phototransistor";
if(getNewOne)returnnewphototransistor();

return0;
}

30

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage12AddingthephototransistortotheQucsGUIcode:part2
Editingphototransistor.cppcontinued
voidphototransistor::createSymbol()
{
Arcs.append(newArc(25,20,40,40,0,20*360,QPen(QPen::red,2)));

Lines.append(newLine(10,15,10,15,QPen(QPen::darkBlue,3)));
Lines.append(newLine(30,0,10,0,QPen(QPen::darkBlue,2)));
Lines.append(newLine(10,5,0,15,QPen(QPen::darkBlue,2)));
Lines.append(newLine(0,15,0,30,QPen(QPen::darkBlue,2)));
Lines.append(newLine(10,5,0,15,QPen(QPen::darkBlue,2)));
Lines.append(newLine(0,15,0,30,QPen(QPen::darkBlue,2)));

Symboldata
for
schematic
capture

Lines.append(newLine(6,15,0,15,QPen(QPen::darkBlue,2)));
Lines.append(newLine(0,9,0,15,QPen(QPen::darkBlue,2)));
Lines.append(newLine(55,55,40,55,QPen(QPen::green,2)));
Lines.append(newLine(40,55,40,25,QPen(QPen::green,2)));
Lines.append(newLine(40,25,55,25,QPen(QPen::green,2)));
Lines.append(newLine(40,40,15,15,QPen(QPen::green,2)));
Lines.append(newLine(15,15,15,20,QPen(QPen::green,2)));
Lines.append(newLine(15,15,20,15,QPen(QPen::green,2)));

Coordinates
markingareaofbox
surroundingsymbol

Symboloutline

Lines.append(newLine(60,60,60,70,QPen(QPen::black,2)));
Lines.append(newLine(60,70,55,70,QPen(QPen::black,2)));
Lines.append(newLine(55,70,55,65,QPen(QPen::black,2)));
Lines.append(newLine(60,65,55,65,QPen(QPen::black,2)));
Lines.append(newLine(63,35,60,30,QPen(QPen::black,2)));
Lines.append(newLine(60,30,57,35,QPen(QPen::black,2)));
Lines.append(newLine(57,35,54,30,QPen(QPen::black,2)));
Lines.append(newLine(54,30,51,35,QPen(QPen::black,2)));
Ports.append(newPort(0,30));//Collector
Ports.append(newPort(30,0));//Base
Ports.append(newPort(0,30));//Emitter
Ports.append(newPort(55,55));//Power

Portconnections

Ports.append(newPort(55,25));//Wavelength
x1=35;y1=55;
x2=35;y2=50;
}

31

Buildingacompactsemiconductormodelofannpnbipolarphototransistor
Construction:stage12AddingthephototransistortotheQucsgraphical
userinterfacecode:part3
phototransistor.png
12.3(a)Drawa32bitx32biticonpictureforthephototransistorandaddittodirectoryqucs/qucs/bitmaps
(b)Addphototransistor.pngtoXPMSentryinfilequcs/qucs/bitmaps/Makefile.am
12.4Addtofilequcs/qucs/components/component.cpp
(ingetComponentFromName,inswitch(first)statement)
aspartofcase'p'
elseif(cstr==hototransistor)c=newphototransistor();
12.5ModifyMakefile.amindirectoryqucs/qucs/components
(a)Addphototransistor.cpptoentrylibverilog_a_SOURCES
(b)Addphototransistor.htoentrynoinst_HEADERS
12.6Add#includephototransistor.h
tofilequcs/qucs/components/components.h

FINALSTEP

Compilequcsandqucscore

Runqucsandtestnew
phototransistormodel

32

Summary
1.Qucsisafreelyavailablecircuitsimulatordistributedasopensourcesoftware
undertheGNU/LinuxGeneralPublicLicence(GPL).
2.Thisdemonstrationhasattemptedtooutlinethefundamentalfeaturesofthepackage,
itsavailablecomponents,libraries,builtindesignaids,andanalysistypes.
3.Thedemonstrationalsointroducesanumberofbasicapproachestocircuitsimulation
usingQucs.
4.Thepresentationalsoshowedhowthecompactsemiconductormodelingand
circuitmacromodelingfeaturesimplementedinthecurrentQucsreleasecanbe
usedtodevelopequationdefinedcomponentmodelsofestablishedandemerging
technologydevices.
5.ThelattersectionsofthedemonstrationconcentratedonusingADMStocompile
VerilogAcompactdevicemodelsandthestepsneededtolinksuchmodels
withthemainbodyoftheQucsC++code.

33

You might also like