diff options
author | Jayaram Pai | 2014-05-19 11:02:57 +0530 |
---|---|---|
committer | Jayaram Pai | 2014-05-19 11:02:57 +0530 |
commit | 8377256e7d90aa7ba1cb51f6164e99f81e2eb53c (patch) | |
tree | 5afcc8e82d7f7d4f6fbff900520bd8f05eb343ca /OSCAD/modelEditor | |
download | FreeEDA-8377256e7d90aa7ba1cb51f6164e99f81e2eb53c.tar.gz FreeEDA-8377256e7d90aa7ba1cb51f6164e99f81e2eb53c.tar.bz2 FreeEDA-8377256e7d90aa7ba1cb51f6164e99f81e2eb53c.zip |
initial commit
Diffstat (limited to 'OSCAD/modelEditor')
31 files changed, 1108 insertions, 0 deletions
diff --git a/OSCAD/modelEditor/1n4007.lib b/OSCAD/modelEditor/1n4007.lib new file mode 100644 index 0000000..1e66174 --- /dev/null +++ b/OSCAD/modelEditor/1n4007.lib @@ -0,0 +1,4 @@ +.model 1n4007 D( Vj=.75 Nbvl=14.976 Cjo=175p Rs=.25 Isr=1.859n ++ Eg=1.11 M=.5516 Nbv=1.6989 N=1 Tbv1=-21.277u ++ Bv=8.1 Fc=.5 Ikf=0 Nr=2 Ibv=20.245m ++ Is=880.5E-18 Xti=3 Ibvl=1.9556m )
\ No newline at end of file diff --git a/OSCAD/modelEditor/CORE.lib b/OSCAD/modelEditor/CORE.lib new file mode 100755 index 0000000..c48c4b5 --- /dev/null +++ b/OSCAD/modelEditor/CORE.lib @@ -0,0 +1,2 @@ +.model K3019PL_3C8 Core(MS=415.2K A=44.82 C=.4112 K=25.74 ++ Area=1.38 Path=4.52) diff --git a/OSCAD/modelEditor/D.hlp b/OSCAD/modelEditor/D.hlp new file mode 100755 index 0000000..fd0b2f8 --- /dev/null +++ b/OSCAD/modelEditor/D.hlp @@ -0,0 +1,16 @@ + name parameter units default example +1 IS saturation current A 1.0e-14 1.0e-14 +2 RS ohmic resistanc Ohm 0 10 +3 N emission coefficient - 1 1.0 +4 TT transit-time sec 0 0.1ns +5 CJO zero-bias junction capacitance F 0 2pF +6 VJ junction potential V 1 0.6 +7 M grading coefficient - 0.5 0.5 +8 EG band-gap energy eV 1.11 1.11 Si +9 XTI saturation-current temp.exp - 3.0 3.0 pn/ 2.0 Schottky +10 KF flicker noise coefficient - 0 +11 AF flicker noise exponent - 1 +12 FC coefficient for forward-bias depletion capacitance formula - 0.5 +13 BV reverse breakdown voltage V infinite 40.0 +14 IBV current at breakdown voltage V 1.0e-3 +15 TNOM parameter measurement temperature deg C 27 50 diff --git a/OSCAD/modelEditor/D.lib b/OSCAD/modelEditor/D.lib new file mode 100755 index 0000000..890c37f --- /dev/null +++ b/OSCAD/modelEditor/D.lib @@ -0,0 +1,3 @@ +.model D1N750 D( Is=880.5E-18 Rs=.25 Ikf=0 N=1 Xti=3 Eg=1.11 Cjo=175p M=.5516 ++ Vj=.75 Fc=.5 Isr=1.859n Nr=2 Bv=8.1 Ibv=20.245m Nbv=1.6989 Ibvl=1.9556m ++ Nbvl=14.976 Tbv1=-21.277u) diff --git a/OSCAD/modelEditor/NIGBT.lib b/OSCAD/modelEditor/NIGBT.lib new file mode 100755 index 0000000..8c09dcb --- /dev/null +++ b/OSCAD/modelEditor/NIGBT.lib @@ -0,0 +1,10 @@ +.MODEL IXGH40N60 NIGBT ( ++ TAU=287.56E-9 ++ KP=50.034 ++ AREA=37.500E-6 ++ AGD=18.750E-6 ++ VT=4.1822 ++ KF=.36047 ++ CGS=31.942E-9 ++ COXD=53.188E-9 ++ VTD=2.6570) diff --git a/OSCAD/modelEditor/NJF.lib b/OSCAD/modelEditor/NJF.lib new file mode 100755 index 0000000..dbb2cba --- /dev/null +++ b/OSCAD/modelEditor/NJF.lib @@ -0,0 +1,4 @@ +.model J2N3819 NJF(Beta=1.304m Betatce=-.5 Rd=1 Rs=1 Lambda=2.25m Vto=-3 ++ Vtotc=-2.5m Is=33.57f Isr=322.4f N=1 Nr=2 Xti=3 Alpha=311.7u ++ Vk=243.6 Cgd=1.6p M=.3622 Pb=1 Fc=.5 Cgs=2.414p Kf=9.882E-18 ++ Af=1) diff --git a/OSCAD/modelEditor/NMOS-0.5um.lib b/OSCAD/modelEditor/NMOS-0.5um.lib new file mode 100644 index 0000000..2e6f463 --- /dev/null +++ b/OSCAD/modelEditor/NMOS-0.5um.lib @@ -0,0 +1,6 @@ +.model mos_n NMOS( TPG=1 TOX=9.5n CJ=550u ETA=0.02125 VMAX=1.8E05 ++ GAMMA=0.62 CGSO=0.3n LD=50n MJSW=0.35 PB=1.1 ++ CGBO=0.45n XJ=0.2U CGDO=0.3n KAPPA=0.1 LEVEL=3 ++ VTO=0.6 NFS=7.20E11 THETA=0.23 CJSW=0.3n PHI=0.7 ++ RSH=2.0 MJ=0.6 UO=420 KP=156u DELTA=0.88 ++ NSUB=1.40E17 )
\ No newline at end of file diff --git a/OSCAD/modelEditor/NMOS-180nm.lib b/OSCAD/modelEditor/NMOS-180nm.lib new file mode 100644 index 0000000..51e9b11 --- /dev/null +++ b/OSCAD/modelEditor/NMOS-180nm.lib @@ -0,0 +1,13 @@ +.model CMOSN NMOS (LEVEL=8 VERSION=3.2 TNOM=27 TOX=4.1E-9 XJ=1E-7 NCH=2.3549E17 VTH0=0.3823463 K1=0.5810697 ++ K2=4.774618E-3 K3=0.0431669 K3B=1.1498346 W0=1E-7 NLX=1.910552E-7 DVT0W=0 DVT1W=0 DVT2W=0 ++ DVT0=1.2894824 DVT1=0.3622063 DVT2=0.0713729 U0=280.633249 UA=-1.208537E-9 UB=2.158625E-18 ++ UC=5.342807E-11 VSAT=9.366802E4 A0=1.7593146 AGS=0.3939741 B0=-6.413949E-9 B1=-1E-7 KETA=-5.180424E-4 ++ A1=0 A2=1 RDSW=105.5517558 PRWG=0.5 PRWB=-0.1998871 WR=1 WINT=7.904732E-10 LINT=1.571424E-8 XL=0 ++ XW=-1E-8 DWG=1.297221E-9 DWB=1.479041E-9 VOFF=-0.0955434 NFACTOR=2.4358891 CIT=0 CDSC=2.4E-4 CDSCD=0 ++ CDSCB=0 ETA0=3.104851E-3 ETAB=-2.512384E-5 DSUB=0.0167075 PCLM=0.8073191 PDIBLC1=0.1666161 PDIBLC2=3.112892E-3 ++ PDIBLCB=-0.1 DROUT=0.7875618 PSCBE1=8E10 PSCBE2=9.213635E-10 PVAG=3.85243E-3 DELTA=0.01 RSH=6.7 MOBMOD=1 ++ PRT=0 UTE=-1.5 KT1=-0.11 KT1L=0 KT2=0.022 UA1=4.31E-9 UB1=-7.61E-18 UC1=-5.6E-11 AT=3.3E4 WL=0 WLN=1 ++ WW=0 WWN=1 WWL=0 LL=0 LLN=1 LW=0 LWN=1 LWL=0 CAPMOD=2 XPART=0.5 CGDO=7.08E-10 CGSO=7.08E-10 CGBO=1E-12 ++ CJ=9.68858E-4 PB=0.8 MJ=0.3864502 CJSW=2.512138E-10 PBSW=0.809286 MJSW=0.1060414 CJSWG=3.3E-10 PBSWG=0.809286 ++ MJSWG=0.1060414 CF=0 PVTH0=-1.192722E-3 PRDSW=-5 PK2=6.450505E-5 WKETA=-4.27294E-4 LKETA=-0.0104078 ++ PU0=6.3268729 PUA=2.226552E-11 PUB=0 PVSAT=969.1480157 PETA0=1E-4 PKETA=-1.049509E-3) diff --git a/OSCAD/modelEditor/NMOS-5um.lib b/OSCAD/modelEditor/NMOS-5um.lib new file mode 100755 index 0000000..a237e1f --- /dev/null +++ b/OSCAD/modelEditor/NMOS-5um.lib @@ -0,0 +1,5 @@ +* 5um technology + +.model mos_n NMOS( Cgso=0.4n Tox=85n Vto=1 phi=0.7 ++ Level=1 ++ Mj=.5 UO=750 Cgdo=0.4n Gamma=1.4 LAMBDA=0.01 LD=0.7u JS=1u CJ=0.4m CJSW=0.8n MJSW=0.5 PB=0.7 CGBO=0.2n ) diff --git a/OSCAD/modelEditor/NMOS.lib b/OSCAD/modelEditor/NMOS.lib new file mode 100755 index 0000000..51e9b11 --- /dev/null +++ b/OSCAD/modelEditor/NMOS.lib @@ -0,0 +1,13 @@ +.model CMOSN NMOS (LEVEL=8 VERSION=3.2 TNOM=27 TOX=4.1E-9 XJ=1E-7 NCH=2.3549E17 VTH0=0.3823463 K1=0.5810697 ++ K2=4.774618E-3 K3=0.0431669 K3B=1.1498346 W0=1E-7 NLX=1.910552E-7 DVT0W=0 DVT1W=0 DVT2W=0 ++ DVT0=1.2894824 DVT1=0.3622063 DVT2=0.0713729 U0=280.633249 UA=-1.208537E-9 UB=2.158625E-18 ++ UC=5.342807E-11 VSAT=9.366802E4 A0=1.7593146 AGS=0.3939741 B0=-6.413949E-9 B1=-1E-7 KETA=-5.180424E-4 ++ A1=0 A2=1 RDSW=105.5517558 PRWG=0.5 PRWB=-0.1998871 WR=1 WINT=7.904732E-10 LINT=1.571424E-8 XL=0 ++ XW=-1E-8 DWG=1.297221E-9 DWB=1.479041E-9 VOFF=-0.0955434 NFACTOR=2.4358891 CIT=0 CDSC=2.4E-4 CDSCD=0 ++ CDSCB=0 ETA0=3.104851E-3 ETAB=-2.512384E-5 DSUB=0.0167075 PCLM=0.8073191 PDIBLC1=0.1666161 PDIBLC2=3.112892E-3 ++ PDIBLCB=-0.1 DROUT=0.7875618 PSCBE1=8E10 PSCBE2=9.213635E-10 PVAG=3.85243E-3 DELTA=0.01 RSH=6.7 MOBMOD=1 ++ PRT=0 UTE=-1.5 KT1=-0.11 KT1L=0 KT2=0.022 UA1=4.31E-9 UB1=-7.61E-18 UC1=-5.6E-11 AT=3.3E4 WL=0 WLN=1 ++ WW=0 WWN=1 WWL=0 LL=0 LLN=1 LW=0 LWN=1 LWL=0 CAPMOD=2 XPART=0.5 CGDO=7.08E-10 CGSO=7.08E-10 CGBO=1E-12 ++ CJ=9.68858E-4 PB=0.8 MJ=0.3864502 CJSW=2.512138E-10 PBSW=0.809286 MJSW=0.1060414 CJSWG=3.3E-10 PBSWG=0.809286 ++ MJSWG=0.1060414 CF=0 PVTH0=-1.192722E-3 PRDSW=-5 PK2=6.450505E-5 WKETA=-4.27294E-4 LKETA=-0.0104078 ++ PU0=6.3268729 PUA=2.226552E-11 PUB=0 PVSAT=969.1480157 PETA0=1E-4 PKETA=-1.049509E-3) diff --git a/OSCAD/modelEditor/NMOS12.lib b/OSCAD/modelEditor/NMOS12.lib new file mode 100755 index 0000000..721c592 --- /dev/null +++ b/OSCAD/modelEditor/NMOS12.lib @@ -0,0 +1,5 @@ +.model IRF150 NMOS(Level=3 Gamma=0 Delta=0 Eta=0 Theta=0 Kappa=0 Vmax=0 Xj=0 ++ Tox=100n Uo=600 Phi=.6 Rs=1.624m Kp=20.53u W=.3 L=2u Vto=2.831 ++ Rd=1.031m Rds=444.4K Cbd=3.229n Pb=.8 Mj=.5 Fc=.5 Cgso=9.027n ++ Cgdo=1.679n Rg=13.89 Is=194E-18 N=1 Tt=288n) + diff --git a/OSCAD/modelEditor/NPN.hlp b/OSCAD/modelEditor/NPN.hlp new file mode 100755 index 0000000..e492ea1 --- /dev/null +++ b/OSCAD/modelEditor/NPN.hlp @@ -0,0 +1,17 @@ +1) BF Forward active current gain +2) VJE Base-emitter built-in potential +3) BR Reverse active current gain +4) VJC Base-collector built-in potential +5) IS Transport saturation current +6) VAF Forward mode Early voltage +7) CJE Base-emitter zero-bias Junction capacitance +8) VAR Reverse mode Early voltage +9) NF Forward mode ideality factor +10) CJC Base-collector zero-bias Junction capacitance +11) NR Reverse mode ideality factor +12) RB zero bias base resistance +13) MJE base-emitter capacitance exponent +14) RE emitter resistance +15) MJC base-collector capacitance exponent +16) RC collector resistance +17) EG energy gap for temperature effect on IS diff --git a/OSCAD/modelEditor/NPN.lib b/OSCAD/modelEditor/NPN.lib new file mode 100755 index 0000000..6509fe7 --- /dev/null +++ b/OSCAD/modelEditor/NPN.lib @@ -0,0 +1,4 @@ +.model Q2N2222 NPN( Is=14.34f Xti=3 Eg=1.11 Vaf=74.03 Bf=400 Ne=1.307 ++ Ise=14.34f Ikf=.2847 Xtb=1.5 Br=6.092 Nc=2 Isc=0 Ikr=0 Rc=1 Cjc=7.306p ++ Mjc=.3416 Vjc=.75 Fc=.5 Cje=22.01p Mje=.377 Vje=.75 Tr=46.91n Tf=411.1p ++ Itf=.6 Vtf=1.7 Xtf=3 Rb=10) diff --git a/OSCAD/modelEditor/PIGBT.lib b/OSCAD/modelEditor/PIGBT.lib new file mode 100755 index 0000000..d4f9e81 --- /dev/null +++ b/OSCAD/modelEditor/PIGBT.lib @@ -0,0 +1,10 @@ +.MODEL IXGH40N60 PIGBT ( ++ TAU=287.56E-9 ++ KP=50.034 ++ AREA=37.500E-6 ++ AGD=18.750E-6 ++ VT=4.1822 ++ KF=.36047 ++ CGS=31.942E-9 ++ COXD=53.188E-9 ++ VTD=2.6570) diff --git a/OSCAD/modelEditor/PJF.lib b/OSCAD/modelEditor/PJF.lib new file mode 100755 index 0000000..5589571 --- /dev/null +++ b/OSCAD/modelEditor/PJF.lib @@ -0,0 +1,5 @@ +.model J2N3820 PJF(Beta=1.304m Betatce=-.5 Rd=1 Rs=1 Lambda=2.25m Vto=-3 ++ Vtotc=-2.5m Is=33.57f Isr=322.4f N=1 Nr=2 Xti=3 Alpha=311.7u ++ Vk=243.6 Cgd=1.6p M=.3622 Pb=1 Fc=.5 Cgs=2.414p Kf=9.882E-18 ++ Af=1) + diff --git a/OSCAD/modelEditor/PMOS .lib b/OSCAD/modelEditor/PMOS .lib new file mode 100755 index 0000000..6c9bb83 --- /dev/null +++ b/OSCAD/modelEditor/PMOS .lib @@ -0,0 +1,4 @@ +.model IRF9140 PMOS(Level=3 Gamma=0 Delta=0 Eta=0 Theta=0 Kappa=0 Vmax=0 Xj=0 ++ Tox=100n Uo=300 Phi=.6 Rs=70.6m Kp=10.15u W=1.9 L=2u Vto=-3.67 ++ Rd=60.66m Rds=444.4K Cbd=2.141n Pb=.8 Mj=.5 Fc=.5 Cgso=877.2p ++ Cgdo=369.3p Rg=.811 Is=52.23E-18 N=2 Tt=140n) diff --git a/OSCAD/modelEditor/PMOS-0.5um.lib b/OSCAD/modelEditor/PMOS-0.5um.lib new file mode 100644 index 0000000..848e8b0 --- /dev/null +++ b/OSCAD/modelEditor/PMOS-0.5um.lib @@ -0,0 +1,6 @@ +.model mos_p PMOS( TPG=-1 TOX=9.5n CJ=950u ETA=0.025 VMAX=0.3u ++ GAMMA=0.52 CGSO=0.35n LD=70n MJSW=0.25 PB=1 ++ CGBO=0.45n XJ=0.2U CGDO=0.35n KAPPA=8.0 LEVEL=3 ++ VTO=-0.6 NFS=6.50E11 THETA=0.2 CJSW=0.2n PHI=0.7 ++ RSH=2.5 MJ=0.5 UO=130 KP=48u DELTA=0.25 ++ NSUB=1.0E17 )
\ No newline at end of file diff --git a/OSCAD/modelEditor/PMOS-180nm.lib b/OSCAD/modelEditor/PMOS-180nm.lib new file mode 100644 index 0000000..032b5b9 --- /dev/null +++ b/OSCAD/modelEditor/PMOS-180nm.lib @@ -0,0 +1,11 @@ +.model CMOSP PMOS (LEVEL=8 VERSION=3.2 TNOM=27 TOX=4.1E-9 XJ=1E-7 NCH=4.1589E17 VTH0=-0.3938813 K1=0.5479015 ++ K2=0.0360586 K3=0.0993095 K3B=5.7086622 W0=1E-6 NLX=1.313191E-7 DVT0W=0 DVT1W=0 DVT2W=0 DVT0=0.4911363 ++ DVT1=0.2227356 DVT2=0.1 U0=115.6852975 UA=1.505832E-9 UB=1E-21 UC=-1E-10 VSAT=1.329694E5 A0=1.7590478 ++ AGS=0.3641621 B0=3.427126E-7 B1=1.062928E-6 KETA=0.0134667 A1=0.6859506 A2=0.3506788 RDSW=168.5705677 ++ PRWG=0.5 PRWB=-0.4987371 WR=1 WINT=0 LINT=3.028832E-8 XL=0 XW=-1E-8 DWG=-2.349633E-8 DWB=-7.152486E-9 ++ VOFF=-0.0994037 NFACTOR=1.9424315 CIT=0 CDSC=2.4E-4 CDSCD=0 CDSCB=0 ETA0=0.0608072 ETAB=-0.0426148 ++ DSUB=0.7343015 PCLM=3.2579974 PDIBLC1=7.229527E-6 PDIBLC2=0.025389 PDIBLCB=-1E-3 DROUT=0 PSCBE1=1.454878E10 ++ PSCBE2=4.202027E-9 PVAG=15 DELTA=0.01 RSH=7.8 MOBMOD=1 PRT=0 UTE=-1.5 KT1=-0.11 KT1L=0 KT2=0.022 UA1=4.31E-9 ++ UB1=-7.61E-18 UC1=-5.6E-11 AT=3.3E4 WL=0 WLN=1 WW=0 WWN=1 WWL=0 LL=0 LLN=1 LW=0 LWN=1 LWL=0 CAPMOD=2 XPART=0.5 ++ CGDO=6.32E-10 CGSO=6.32E-10 CGBO=1E-12 CJ=1.172138E-3 PB=0.8421173 MJ=0.4109788 CJSW=2.242609E-10 PBSW=0.8 + MJSW=0.3752089 CJSWG=4.22E-10 PBSWG=0.8 MJSWG=0.3752089 CF=0 PVTH0=1.888482E-3 PRDSW=11.5315407 PK2=1.559399E-3 ++ WKETA=0.0319301 LKETA=2.955547E-3 PU0=-1.1105313 PUA=-4.62102E-11 PUB=1E-21 PVSAT=50 PETA0=1E-4 PKETA=-4.346368E-3) diff --git a/OSCAD/modelEditor/PMOS-5um.lib b/OSCAD/modelEditor/PMOS-5um.lib new file mode 100755 index 0000000..9c3ed97 --- /dev/null +++ b/OSCAD/modelEditor/PMOS-5um.lib @@ -0,0 +1,5 @@ +*5um technology + +.model mos_p PMOS( Cgso=0.4n Tox=85n Vto=-1 phi=0.65 ++ Level=1 ++ Mj=.5 UO=250 Cgdo=0.4n Gamma=0.65 LAMBDA=0.03 LD=0.6u JS=1u CJ=0.18m CJSW=0.6n MJSW=0.5 PB=0.7 CGBO=0.2n ) diff --git a/OSCAD/modelEditor/PMOS.lib b/OSCAD/modelEditor/PMOS.lib new file mode 100755 index 0000000..032b5b9 --- /dev/null +++ b/OSCAD/modelEditor/PMOS.lib @@ -0,0 +1,11 @@ +.model CMOSP PMOS (LEVEL=8 VERSION=3.2 TNOM=27 TOX=4.1E-9 XJ=1E-7 NCH=4.1589E17 VTH0=-0.3938813 K1=0.5479015 ++ K2=0.0360586 K3=0.0993095 K3B=5.7086622 W0=1E-6 NLX=1.313191E-7 DVT0W=0 DVT1W=0 DVT2W=0 DVT0=0.4911363 ++ DVT1=0.2227356 DVT2=0.1 U0=115.6852975 UA=1.505832E-9 UB=1E-21 UC=-1E-10 VSAT=1.329694E5 A0=1.7590478 ++ AGS=0.3641621 B0=3.427126E-7 B1=1.062928E-6 KETA=0.0134667 A1=0.6859506 A2=0.3506788 RDSW=168.5705677 ++ PRWG=0.5 PRWB=-0.4987371 WR=1 WINT=0 LINT=3.028832E-8 XL=0 XW=-1E-8 DWG=-2.349633E-8 DWB=-7.152486E-9 ++ VOFF=-0.0994037 NFACTOR=1.9424315 CIT=0 CDSC=2.4E-4 CDSCD=0 CDSCB=0 ETA0=0.0608072 ETAB=-0.0426148 ++ DSUB=0.7343015 PCLM=3.2579974 PDIBLC1=7.229527E-6 PDIBLC2=0.025389 PDIBLCB=-1E-3 DROUT=0 PSCBE1=1.454878E10 ++ PSCBE2=4.202027E-9 PVAG=15 DELTA=0.01 RSH=7.8 MOBMOD=1 PRT=0 UTE=-1.5 KT1=-0.11 KT1L=0 KT2=0.022 UA1=4.31E-9 ++ UB1=-7.61E-18 UC1=-5.6E-11 AT=3.3E4 WL=0 WLN=1 WW=0 WWN=1 WWL=0 LL=0 LLN=1 LW=0 LWN=1 LWL=0 CAPMOD=2 XPART=0.5 ++ CGDO=6.32E-10 CGSO=6.32E-10 CGBO=1E-12 CJ=1.172138E-3 PB=0.8421173 MJ=0.4109788 CJSW=2.242609E-10 PBSW=0.8 + MJSW=0.3752089 CJSWG=4.22E-10 PBSWG=0.8 MJSWG=0.3752089 CF=0 PVTH0=1.888482E-3 PRDSW=11.5315407 PK2=1.559399E-3 ++ WKETA=0.0319301 LKETA=2.955547E-3 PU0=-1.1105313 PUA=-4.62102E-11 PUB=1E-21 PVSAT=50 PETA0=1E-4 PKETA=-4.346368E-3) diff --git a/OSCAD/modelEditor/PMOS11.lib b/OSCAD/modelEditor/PMOS11.lib new file mode 100755 index 0000000..6c9bb83 --- /dev/null +++ b/OSCAD/modelEditor/PMOS11.lib @@ -0,0 +1,4 @@ +.model IRF9140 PMOS(Level=3 Gamma=0 Delta=0 Eta=0 Theta=0 Kappa=0 Vmax=0 Xj=0 ++ Tox=100n Uo=300 Phi=.6 Rs=70.6m Kp=10.15u W=1.9 L=2u Vto=-3.67 ++ Rd=60.66m Rds=444.4K Cbd=2.141n Pb=.8 Mj=.5 Fc=.5 Cgso=877.2p ++ Cgdo=369.3p Rg=.811 Is=52.23E-18 N=2 Tt=140n) diff --git a/OSCAD/modelEditor/PNP.lib b/OSCAD/modelEditor/PNP.lib new file mode 100755 index 0000000..7edda0e --- /dev/null +++ b/OSCAD/modelEditor/PNP.lib @@ -0,0 +1,4 @@ +.model Q2N2907A PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=231.7 Ne=1.829 ++ Ise=54.81f Ikf=1.079 Xtb=1.5 Br=3.563 Nc=2 Isc=0 Ikr=0 Rc=.715 ++ Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 ++ Tr=111.3n Tf=603.7p Itf=.65 Vtf=5 Xtf=1.7 Rb=10) diff --git a/OSCAD/modelEditor/exportModel.py b/OSCAD/modelEditor/exportModel.py new file mode 100755 index 0000000..1249197 --- /dev/null +++ b/OSCAD/modelEditor/exportModel.py @@ -0,0 +1,77 @@ +#!/usr/bin/python +# exportModel.py is a python script to export a component model to the library. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com). +# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from setPath import OSCAD_HOME +from Tkinter import * +from Tkinter import * +import template +import tkMessageBox +import os.path +import os +import Pmw +from string import maketrans + +class ExportModel(): + """Class for exporting the model to the model library""" + def __init__(self,parent): + self.parent=parent + self.modelName="" + # Collect model information available in the project directory + fileList=os.listdir(".") + modelList=[] + + for fileName in fileList: + if "lib" in fileName: + modelList.append(fileName) + + # Create the dialog. + self.dialog = Pmw.SelectionDialog(parent, + title = 'Model Selector', + buttons = ('OK', 'Cancel'), + defaultbutton = 'OK', + scrolledlist_labelpos = 'n', + label_text = 'Please select the model', + scrolledlist_items=modelList, + command = self.apply, + ) + self.dialog.pack(fill = 'both', expand=1, padx=5, pady=5) + self.dialog.activate() + + # ProtGocol when window is deleted. + self.dialog.protocol("WM_DELETE_WINDOW",self.cancel) + + def apply(self,result): + sels = self.dialog.getcurselection() + if result=="OK": + if len(sels) == 0: + print 'You clicked on', result, '(no selection)' + return + else: + self.modelName=sels[0] + self.status=1 + else: + self.status=0 + self.dialog.withdraw() + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.dialog.deactivate() + +# Action taken when cancel pressed + def cancel(self, event=None, status=0): + # Catch the status + self.status=status + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.destroy() + +if __name__=='__main__': + root=Tk() + model= ExportModel(root,"xxx") + mainloop() + diff --git a/OSCAD/modelEditor/helpEditor.py b/OSCAD/modelEditor/helpEditor.py new file mode 100755 index 0000000..b855cca --- /dev/null +++ b/OSCAD/modelEditor/helpEditor.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# helpEditor.py is a python script to display help for the model editor. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com) and Shalini Shrivastava. +# Copyright (C) 2012 Yogesh Dilip Save and Shalini Shrivastava, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from Tkinter import * +import template +import tkMessageBox +import os.path +from string import maketrans +from newModel import readSpecs + +class HelpInfo(template.MyTemplate): + """ Class for displaying help information """ + def body(self, master): + # Help heading + master.configure(width=768, height=576) + Label(master, text="Ngspice Model Editor Help", font=("Helvetica", 16), padx=20, pady=20).grid(row=0) + +# Add standard button box (OK) + def buttonbox(self): + # Construct a new frame + box = Frame(self) + # Create buttons + w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE) + w.pack(padx=5, pady=5) + + # Bind Return and escape keys + self.bind("<Return>", self.ok) + self.bind("<Escape>", self.ok) + # Create the frame "box" + box.pack() + + def statusBar(self): + pass + +if __name__=='__main__': + root=Tk() + model= HelpInfo(root) + mainloop() + diff --git a/OSCAD/modelEditor/importModel.py b/OSCAD/modelEditor/importModel.py new file mode 100755 index 0000000..43f9c2e --- /dev/null +++ b/OSCAD/modelEditor/importModel.py @@ -0,0 +1,86 @@ +#!/usr/bin/python +# importModel.py is a python script to import a component model from library. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com). +# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from setPath import OSCAD_HOME +from Tkinter import * +from Tkinter import * +import template +import tkMessageBox +import os.path +import os +import Pmw +from string import maketrans + +class ImportModel(): + """Class for importing a model from the library""" + def __init__(self,parent): + self.parent=parent + self.modelName="" + # Collect model information available in the model library + try: + self.OSCAD_HOME=OSCAD_HOME + except NameError: + try: + self.OSCAD_HOME=os.environ["OSCAD_HOME"] + except KeyError: + tkMessageBox.showerror("Error OSCAD_HOME is not set","Please set OSCAD_HOME variable in .bashrc\n\nStep to set OSCAD_HOME variable:\n 1) Open ~/.bashrc using text editor (vi ~/.bash).\n 2) Add the line \"Export OSCAD_HOME=<path_of_oscad>\" to it.\n 3) source ~/.bashrc") + exit(0) + + fileList=os.listdir(self.OSCAD_HOME+"/modelLibrary") + modelList=[] + + for fileName in fileList: + if "lib" in fileName: + modelList.append(fileName) + + # Create the dialog. + self.dialog = Pmw.SelectionDialog(parent, + title = 'Model Selector', + buttons = ('OK', 'Cancel'), + defaultbutton = 'OK', + scrolledlist_labelpos = 'n', + label_text = 'Please select the model', + scrolledlist_items=modelList, + command = self.apply, + ) + self.dialog.pack(fill = 'both', expand=1, padx=5, pady=5) + self.dialog.activate() + + # Protocol when window is deleted. + self.dialog.protocol("WM_DELETE_WINDOW",self.cancel) + + def apply(self,result): + sels = self.dialog.getcurselection() + if result=="OK": + if len(sels) == 0: + print 'You clicked on', result, '(no selection)' + return + else: + self.modelName=sels[0] + self.status=1 + else: + self.status=0 + self.dialog.withdraw() + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.dialog.deactivate() + +# Action taken when cancel pressed + def cancel(self, event=None, status=0): + # Catch the status + self.status=status + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.destroy() + +if __name__=='__main__': + root=Tk() + model= ImportModel(root,"xxx") + mainloop() + diff --git a/OSCAD/modelEditor/modelEditor.py b/OSCAD/modelEditor/modelEditor.py new file mode 100755 index 0000000..ce2d88b --- /dev/null +++ b/OSCAD/modelEditor/modelEditor.py @@ -0,0 +1,166 @@ +#!/usr/bin/python +# modelEditor.py is a python script to display fornt end of the model editor. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com) and Shalini Shrivastava. +# Copyright (C) 2012 Yogesh Dilip Save and Shalini Shrivastava, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from setPath import OSCAD_HOME +from Tkinter import * +import tkMessageBox +import newModel +import openModel +import selectModel +import importModel +import exportModel +import os +import sys + +# Create a new model +def newEditor(e=None): +# Read model information (name and type) + model= newModel.ModelInfo(root) +# Create model file + if model.status: + modelParam = newModel.ModelParam(root,model.modelName,model.modelType) + +# Open an existing model +def openEditor(e=None): + model= openModel.ExistingModelInfo(root) +# Open model file + if model.status: + modelParam = openModel.ExistingModelParam(root,model.modelName) + +# Import an existing model from library +def importEditor(e=None): + model=importModel.ImportModel(root) + temp_model_name=model.modelName + if temp_model_name.startswith('NMOS',0,4): + if os.system("cp "+OSCAD_HOME+"/modelLibrary/"+model.modelName+" mos_n.lib"): + tkMessageBox.showerror("Import Failed","Unable to import model file "+model.modelName) + else: + tkMessageBox.showinfo("Successfully imported","Model file "+model.modelName+" is successfully imported to the project.") + elif temp_model_name.startswith('PMOS',0,4): + if os.system("cp "+OSCAD_HOME+"/modelLibrary/"+model.modelName+" mos_p.lib"): + tkMessageBox.showerror("Import Failed","Unable to import model file "+model.modelName) + else: + tkMessageBox.showinfo("Successfully imported","Model file "+model.modelName+" is successfully imported to the project.") + elif temp_model_name.startswith('D',0,1): + if os.system("cp "+OSCAD_HOME+"/modelLibrary/"+model.modelName+" 1n4007.lib"): + tkMessageBox.showerror("Import Failed","Unable to import model file "+model.modelName) + else: + tkMessageBox.showinfo("Successfully imported","Model file "+model.modelName+" is successfully imported to the project.") + else: + if os.system("cp "+OSCAD_HOME+"/modelLibrary/"+model.modelName+" ."): + tkMessageBox.showerror("Import Failed","Unable to import model file "+model.modelName) + else: + tkMessageBox.showinfo("Successfully imported","Model file "+model.modelName+" is successfully imported to the project.") + + +# Export an existing model to library +def exportEditor(e=None): + model=exportModel.ExportModel(root) + if os.system("cp "+model.modelName+" "+OSCAD_HOME+"/modelLibrary/"): + tkMessageBox.showerror("Export Failed","Unable to export model file "+model.modelName) + else: + tkMessageBox.showinfo("Successfully exported","Model file "+model.modelName+" is successfully exported to the model library") + +# Exit an model editor +def exitEditor(e=None): + if tkMessageBox.askokcancel("QUIT","Do you really wish to quit?"): + root.destroy() + +# Display help content +def helpEditor(e=None): + pass + +# Display help content +def aboutEditor(): + tkMessageBox.showinfo("About Editor","Created by Yogesh Dilip Save and Shalini Shrivastava") + +##Function to open select model from the list to modify it +def openSelectModel(e=None): + filename=sys.argv[1] + #Getting lenght of Model List and clicked result + lenght_modlist,result=callModel(root,filename) + response=result + if result=="OK": + for item in range(lenght_modlist-1): + if response=="OK": + temp_lenght,temp_result=callModel(root,filename) + response=temp_result + else: + break + + else: + pass + +def callModel(root,filename): + model=selectModel.ModelNameList(root, filename) + if model.status: + # Open the circuit file + modelFile=model.modelName+".lib" + # Check model file already exists + if os.path.exists(modelFile): + if tkMessageBox.askokcancel("Model already exists","Do you want to edit?"): + modelParam = openModel.ExistingModelParam(root,model.modelName) + else: + modelParam = newModel.ModelParam(root,model.modelName,model.modelType) + return len(model.modelList),model.click_result + + +root = Tk() +root.title("Ngspice Model Editor") +root.geometry("600x400+300+125") + +# Create and configure a menu +menu = Menu(root) +root.config(menu=menu) + +# Create File menu +filemenu= Menu(menu) +menu.add_cascade(label="File", menu=filemenu) +filemenu.add_command(label="New F2", command=newEditor) +#filemenu.add_command(label="Open F3", command=openEditor) +filemenu.add_command(label="Edit F7",command=openSelectModel) +filemenu.add_separator() +filemenu.add_command(label="Import F4", command=importEditor) +filemenu.add_command(label="Export F5", command=exportEditor) +filemenu.add_separator() +filemenu.add_command(label="Exit F6", command=exitEditor) + +# Create help menu +helpmenu=Menu(menu) +menu.add_cascade(label="Help", menu=helpmenu) +helpmenu.add_command(label="Help F1",command=helpEditor) +helpmenu.add_command(label="About...",command=aboutEditor) + +# Select device from devices in circuit file + +"""model=selectModel.ModelNameList(root, filename) +print "Model",model.modelList + + +if model.status: + # Open the circuit file + modelFile=model.modelName+".lib" + # Check model file already exists + if os.path.exists(modelFile): + if tkMessageBox.askokcancel("Model already exists","Do you want to edit?"): + modelParam = openModel.ExistingModelParam(root,model.modelName) + else: + modelParam = newModel.ModelParam(root,model.modelName,model.modelType) +""" +# Protocol for deletion of main window +root.protocol("WM_DELETE_WINDOW",exitEditor) + +# Create shortcut keys +root.bind("<F2>", newEditor) +#root.bind("<F3>", openEditor) +root.bind("<F4>", importEditor) +root.bind("<F5>", exportEditor) +root.bind("<F6>", exitEditor) +root.bind("<F1>", helpEditor) +root.bind("<F7>", openSelectModel) + +mainloop() diff --git a/OSCAD/modelEditor/newModel.py b/OSCAD/modelEditor/newModel.py new file mode 100755 index 0000000..93d7578 --- /dev/null +++ b/OSCAD/modelEditor/newModel.py @@ -0,0 +1,187 @@ +#!/usr/bin/python +# newModel.py is a python script to create a new model. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com) and Shalini Shrivastava. +# Copyright (C) 2012 Yogesh Dilip Save and Shalini Shrivastava, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from setPath import OSCAD_HOME +from Tkinter import * +import template +import tkMessageBox +import os.path +from string import maketrans + +class ModelInfo(template.MyTemplate): + """ Class for accept model information from user """ + def body(self, master): + # Define component type and set it to Diode + self.component = StringVar() + self.component.set("D") + + # Ask for compoent name + Label(master, text="Enter Component name:").grid(row=0) + self.e1 = Entry(master) + self.e1.grid(row=0, column=1,pady=10,columnspan=2) + + # Ask for component type + Label(master, text="Enter type of Component:").grid(row=1) + Label(master,text="Diode").grid(row=2,column=1,columnspan=2,sticky=W) + Radiobutton(master, text="Diode", variable=self.component, value="D").grid(row=3,column=1,columnspan=2,sticky=W) + Label(master, text="Bipolar Junction Transistor (BJT)").grid(row=4,column=1,columnspan=2,sticky=W) + Radiobutton(master, text="NPN", variable=self.component, value="NPN").grid(row=5,column=1,sticky=W) + Radiobutton(master, text="PNP", variable=self.component, value="PNP").grid(row=5,column=2,sticky=W) + Label(master, text="Metal Oxide Semiconductor (MOS)").grid(row=6,column=1,columnspan=2,sticky=W) + Radiobutton(master, text="NMOS(Level-1 5um)", variable=self.component, value="NMOS-5um").grid(row=7,column=1,sticky=W) + Radiobutton(master, text="PMOS(Level-1 5um)", variable=self.component, value="PMOS-5um").grid(row=7,column=2,sticky=W) + Radiobutton(master, text="NMOS(Level-3 0.5um)", variable=self.component, value="NMOS-0.5um").grid(row=8,column=1,sticky=W) + Radiobutton(master, text="PMOS(Level-3 0.5um)", variable=self.component, value="PMOS-0.5um").grid(row=8,column=2,sticky=W) + Radiobutton(master, text="NMOS(Level-8 180nm)", variable=self.component, value="NMOS-180nm").grid(row=9,column=1,sticky=W) + Radiobutton(master, text="PMOS(Level-8 180nm)", variable=self.component, value="PMOS-180nm").grid(row=9,column=2,sticky=W) + Label(master, text="Junction Field Effect Transistor (JFET)").grid(row=10,column=1,columnspan=2,sticky=W) + Radiobutton(master, text="N-JFET", variable=self.component, value="NJF").grid(row=11,column=1,sticky=W) + Radiobutton(master, text="P-JFET", variable=self.component, value="PJF").grid(row=11,column=2,sticky=W) + Label(master, text="IGBT").grid(row=12,column=1,columnspan=2,sticky=W) + Radiobutton(master, text="N-IGBT", variable=self.component, value="NIGBT").grid(row=13,column=1,sticky=W) + Radiobutton(master, text="P-IGBT", variable=self.component, value="PIGBT").grid(row=13,column=2,sticky=W) + Label(master, text="Magnetic Core").grid(row=14,column=1,columnspan=2,sticky=W) + Radiobutton(master, text="Magnetic Core", variable=self.component, value="CORE").grid(row=15,column=1,columnspan=2,sticky=W) + +# Collect model information + def apply(self): + self.modelType=self.component.get() + +# Validate the model information + def validate(self): + # Remove trailing and leading spaces from modelName + self.modelName=self.e1.get().strip() + if len(self.modelName): + return 1 + else: + tkMessageBox.showwarning("Bad input","Component Name is not specified, please try again") + return 0 + +class ModelParam(template.MyTemplate): + """Class for specifying parameter of the model""" + def __init__(self,parent,name,type): + # Collect model information + self.modelName=name + self.modelType=type + + # Call base class MyTemplate + template.MyTemplate.__init__(self,parent) + + def body(self, master): + try: + self.OSCAD_HOME=OSCAD_HOME + except NameError: + try: + self.OSCAD_HOME=os.environ["OSCAD_HOME"] + except KeyError: + tkMessageBox.showerror("Error OSCAD_HOME is not set","Please set OSCAD_HOME variable in .bashrc\n\nStep to set OSCAD_HOME variable:\n 1) Open ~/.bashrc using text editor (vi ~/.bash).\n 2) Add the line \"Export OSCAD_HOME=<path_of_oscad>\" to it.\n 3) source ~/.bashrc") + exit(0) + + HOME=self.OSCAD_HOME+"/modelEditor/" + # Open template of the library file corresponding model + fileName=HOME+self.modelType+".lib" + # Find model information and parameters + self.info, self.params=readSpecs(fileName) + + # Construct parameter editor window + i,j=0,0 + for each in self.params.keys(): + # Display parameter name + Label(master, text=each, padx=5, pady=5).grid(row=j, column=2*i, sticky=W) + + # Create entry for parameter value + vars(self)[each] = Entry(master) + vars(self)[each].insert(0,self.params[each]) + vars(self)[each].grid(row=j, column=2*i+1) + + # Display help information in the status bar + vars(self)[each].bind('<Enter>', self.enterSpec) + vars(self)[each].bind('<Leave>', self.leaveSpec) + + # Column and row adjustment for proper display + i+=1 + if i%5==0: + i,j=0,j+1 + + def enterSpec(self,event): + self.statusbar.configure(text="Find help in the " +self.modelType+".hlp file") + + def leaveSpec(self,event): + self.statusbar.configure(text='') + + def apply(self): + # Copy model infomation + self.info[1]=self.modelName + self.info[2]=self.modelType + # Write model parameters to file + if self.writeModelFile(): + tkMessageBox.showinfo("Info","Model file " +self.modelName+" is created") + + def writeModelFile(self): + """ a method for writing model file""" + # Create model file for writing + try: + f = open(self.info[1]+".lib","w") + except : + tkMessageBox.showwarning("Error","Model file can not be wriiten. please check the file system permission") + return 0 + f.write(".model " + self.info[1] + " " + self.info[2] + "( ") + i=0 + for param in self.params.keys(): + paramName = getattr(self,param) + paramValueGet = getattr(paramName,'get') + f.write(param + "=" + paramValueGet()+" ") + i+=1 + # Column and row adjustment for proper display + if i%5==0: + i=0 + f.write("\n+ ") + f.write(")") + f.close() + return 1 + +def readSpecs(fileName): + """Read parameters and model information""" +# Variable to store parameter and model information + params={} + info=[] + +# Open parameter file + if os.path.exists(fileName): + try: + f = open(fileName) + except : + tkMessageBox.showwarning("Bad input","Model file does not exit, please try again") + return info, params + else: + tkMessageBox.showwarning("Bad input","Model file does not exit, please try again") + return info, params + data=f.read() + f.close() + +# Seperate model and parameter information + data=data.split('(') + infoData=data[0] + paramsData=data[1] + +# Collect model information in the list + info=infoData.split() + +# Collect model parameter in the dictionary + paramsData=paramsData.translate(maketrans('\n+)',' ')) + paramsData=paramsData.split() + for each in paramsData: + paramdata=each.split('=') + params[paramdata[0]]=paramdata[1] + return info, params + +if __name__=='__main__': + root=Tk() + model= ModelInfo(root) + modelParam = ModelParam(root,model.modelName,model.modelType) + mainloop() + diff --git a/OSCAD/modelEditor/openModel.py b/OSCAD/modelEditor/openModel.py new file mode 100755 index 0000000..6ba5947 --- /dev/null +++ b/OSCAD/modelEditor/openModel.py @@ -0,0 +1,116 @@ +#!/usr/bin/python +# openModel.py is a python script to open an existing model. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com) and Shalini Shrivastava. +# Copyright (C) 2012 Yogesh Dilip Save and Shalini Shrivastava, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from Tkinter import * +import template +import tkMessageBox +import os.path +from string import maketrans +from newModel import readSpecs + +class ExistingModelInfo(template.MyTemplate): + """ Class for accept model information from user """ + def body(self, master): + # Ask for compoent name + Label(master, text="Enter Component name:").grid(row=0) + self.e1 = Entry(master) + self.e1.grid(row=0, column=1,pady=10,columnspan=2) + +# Collect model information + def apply(self): + pass + +# Validate the model information + def validate(self): + # Remove trailing and leading spaces from modelName + self.modelName=self.e1.get().strip() + if len(self.modelName): + return 1 + else: + tkMessageBox.showwarning("Bad input","Component Name is not specified, please try again") + return 0 + +class ExistingModelParam(template.MyTemplate): + """Class for specifying parameter of the model""" + def __init__(self,parent,name): + # Collect model information + self.modelName=name + + # Call base class MyTemplate + template.MyTemplate.__init__(self,parent) + + + def body(self, master): + # Open template of the library file corresponding model + fileName=self.modelName+".lib" + # Find model information and parameters + self.info, self.params=readSpecs(fileName) + + # Return if model information is not available + if len(self.info) == 0: + self.cancel() + + # Construct parameter editor window + i,j=0,0 + for each in self.params.keys(): + # Display parameter name + Label(master, text=each, padx=5, pady=5).grid(row=j, column=2*i, sticky=W) + + # Create entry for parameter value + vars(self)[each] = Entry(master) + vars(self)[each].insert(0,self.params[each]) + vars(self)[each].grid(row=j, column=2*i+1) + + # Display help information in the status bar + vars(self)[each].bind('<Enter>', self.enterSpec) + vars(self)[each].bind('<Leave>', self.leaveSpec) + + # Column and row adjustment for proper display + i+=1 + if i%5==0: + i,j=0,j+1 + + def enterSpec(self,event): + self.statusbar.configure(text="Find help in the " +self.info[2]+".hlp file") + + def leaveSpec(self,event): + self.statusbar.configure(text='') + + def apply(self): + # Write model parameters to file + if self.writeModelFile(): + tkMessageBox.showinfo("Info","Model file " +self.modelName+" is modified") + + def writeModelFile(self): + """ a method for writing model file""" + # Create model file for writing + try: + f = open(self.info[1]+".lib","w") + except : + tkMessageBox.showwarning("Error","Model file can not be wriiten. please check the file system permission") + return 0 + f.write(".model " + self.info[1] + " " + self.info[2] + "( ") + i=0 + for param in self.params.keys(): + paramName = getattr(self,param) + paramValueGet = getattr(paramName,'get') + f.write(param + "=" + paramValueGet()+" ") + i+=1 + # Column and row adjustment for proper display + if i%5==0: + i=0 + f.write("\n+ ") + f.write(")") + f.close() + return 1 + +if __name__=='__main__': + root=Tk() + model= ExistingModelInfo(root) + modelParam = ExistingModelParam(root,model.modelName) + mainloop() + diff --git a/OSCAD/modelEditor/selectModel.py b/OSCAD/modelEditor/selectModel.py new file mode 100755 index 0000000..1ca1e86 --- /dev/null +++ b/OSCAD/modelEditor/selectModel.py @@ -0,0 +1,155 @@ +#!/usr/bin/python +# selectModel.py is a python script to select a component to create a model. It developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com). +# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay. +# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from setPath import OSCAD_HOME +from Tkinter import * +import template +import tkMessageBox +import os.path +import os +import Pmw +from string import maketrans + +class ModelNameList(): + """Class for specifying parameter of the model""" + def __init__(self,parent,filename): + self.parent=parent + self.modelName="" + self.modelType="" + self.modelList=[] + self.click_result="" + + # Collect model information from the circuit file + try: + self.OSCAD_HOME=OSCAD_HOME + except NameError: + try: + self.OSCAD_HOME=os.environ["OSCAD_HOME"] + except KeyError: + tkMessageBox.showerror("Error OSCAD_HOME is not set","Please set OSCAD_HOME variable in .bashrc\n\nStep to set OSCAD_HOME variable:\n 1) Open ~/.bashrc using text editor (vi ~/.bash).\n 2) Add the line \"Export OSCAD_HOME=<path_of_oscad>\" to it.\n 3) source ~/.bashrc") + exit(0) + + HOME=self.OSCAD_HOME="/modelEditor/" + # Open the circuit file + self.fileName=filename + # Open parameter file + if os.path.exists(self.fileName): + try: + f = open(self.fileName) + except : + tkMessageBox.showwarning("Bad input","Circuit netlist does not exit, please try again") + return + else: + tkMessageBox.showwarning("Bad input","Circuit netlist does not exit, please try again") + return + + # Read the data from file + data=f.read() + + # Close the file + f.close() + netlist=data.splitlines() + # Find the various model library required + self.modelInfo={} + + for eachline in netlist: + eachline=eachline.strip() + if len(eachline)>1: + eachline=eachline.lower() + words=eachline.split() + if eachline[0]=='d': + modelName=words[3] + modelType=words[3] + self.modelList.append(words[0]+":"+modelName) + self.modelInfo[modelName]=modelType + elif eachline[0]=='q': + modelName=words[4] + if words[4]=='npn': + modelType="NPN" + elif words[4]=='pnp': + modelType="PNP" + else: + modelType=words[4] + + self.modelList.append(words[0]+":"+modelName) + self.modelInfo[modelName]=modelType + + elif eachline[0]=='m': + modelName=words[4] + if words[4]=='nmos': + modelType="NMOS" + elif words[4]=='pmos': + modelType="PMOS" + else: + modelType=words[4] + self.modelList.append(words[0]+":"+modelName) + self.modelInfo[modelName]=modelType + + elif eachline[0]=='j': + modelName=words[4] + if words[4]=='pjf': + modelType='PJF' + elif words[4]=='njf': + modelType='NJF' + else: + modelType=words[4] + self.modelList.append(words[0]+":"+modelName) + self.modelInfo[modelName]=modelType + else: + continue + + # Create the dialog. + + self.dialog = Pmw.SelectionDialog(parent, + title = 'Model Selector', + buttons = ('OK', 'Cancel'), + defaultbutton = 'OK', + scrolledlist_labelpos = 'n', + label_text = 'Please select the model', + scrolledlist_items=self.modelList, + command = self.apply, + ) + self.dialog.pack(fill = 'both', expand=1, padx=5, pady=5) + self.dialog.activate() + + # Protocol when window is deleted. + self.dialog.protocol("WM_DELETE_WINDOW",self.cancel) + + def apply(self,result): + sels = self.dialog.getcurselection() + self.click_result=result + if result=="OK": + if len(sels) == 0: + print 'You clicked on', result, '(no selection)' + return + else: + self.modelName=sels[0].partition(':')[2] + self.modelType=self.modelInfo[self.modelName] + self.status=1 + + else: + self.status=0 + self.dialog.withdraw() + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.dialog.deactivate() + +# Action taken when cancel pressed + def cancel(self, event=None, status=0): + # Catch the status + self.status=status + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.destroy() + +if __name__=='__main__': + root=Tk() + model= ModelNameList(root,"xxx") + mainloop() + diff --git a/OSCAD/modelEditor/setPath.py b/OSCAD/modelEditor/setPath.py new file mode 100755 index 0000000..839d518 --- /dev/null +++ b/OSCAD/modelEditor/setPath.py @@ -0,0 +1,2 @@ +#!/usr/bin/python +OSCAD_HOME="/home/ambi/OSCAD" diff --git a/OSCAD/modelEditor/template.py b/OSCAD/modelEditor/template.py new file mode 100755 index 0000000..5b2ee06 --- /dev/null +++ b/OSCAD/modelEditor/template.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +from Tkinter import * +import os + + +class MyTemplate(Toplevel): + """Template to construct new window""" +# Define constructor + def __init__(self, parent, title=None): + # Set new window properties same as parent + Toplevel.__init__(self, parent) + # Create a new window on top of the parent such that don't appear in taskbar + self.transient(parent) + + # Set the title + if title: + self.title(title) + # Set Parent of active window + self.parent =parent + + # Create a new frame + body =Frame (self) + + # Call body method + self.initial_focus = self.body(body) + # Display body + body.pack(padx=5, pady=5) + + # Create buttons + self.buttonbox() + # Create status bar + self.statusBar() + # Take control of all the events + self.grab_set() + + # Take control of all the keyboard events + if not self.initial_focus: + self.initial_focus=self + + # Protocol when window is deleted. + self.protocol("WM_DELETE_WINDOW",self.cancel) + + # Position the geometry respect to main window + self.geometry("+%d+%d" % (parent.winfo_rootx()+50,parent.winfo_rooty()+50)) + self.initial_focus.focus_set() + + + # Wait for widget to be destroyed + self.wait_window(self) + +# Construction of body of the window + def body(self, master): + # Create dialog body. This method should be overridden + pass + +# Add standard button box (OK, Cancel). Override if you don't want the standard buttons + def buttonbox(self): + # Construct a new frame + box = Frame(self) + # Create buttons + w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE) + w.pack(side=LEFT, padx=5, pady=5) + w = Button(box, text="Cancel", width=10, command=self.cancel) + w.pack(side=LEFT, padx=5, pady=5) + + # Bind Return and escape keys + self.bind("<Return>", self.ok) + self.bind("<Escape>", self.cancel) + # Create the frame "box" + box.pack() + +# Add standard status bar. Override if you don't want the status bar + def statusBar(self): + self.statusbar = Label(self, text="", bd=1, relief=SUNKEN, anchor=W) + self.statusbar.pack(side=BOTTOM, fill=X) + +# Template for action taken when OK is pressed + def ok(self, event=None): + # If data is not valid then put the focus back + if not self.validate(): + self.initial_focus.focus_set() + return + # Remove the window from the screen (without destroying it) + self.withdraw() + # Call all pending idle tasks, without processing any other events. + self.update_idletasks() + # Perform required task (collection of result, inputs etc.) + self.apply() + # Take action when all task has finished + self.cancel(status=1) + +# Template for action taken when cancel pressed + def cancel(self, event=None, status=0): + # Catch the status + self.status=status + # Put focus back to the parent window + self.parent.focus_set() + # Destroy child window + self.destroy() + +# Template for validation of data + def validate(self): + return 1 + +# Template for required action (Saving Data, results) + def apply(self): + pass + +# Test case +if __name__=='__main__': + root=Tk() + d =MyTemplate(root) + mainloop() + |