diff options
author | fahim | 2015-06-05 12:25:17 +0530 |
---|---|---|
committer | fahim | 2015-06-05 12:25:17 +0530 |
commit | 687a4bf4cd1e027df9fb371d5c173c02d7db767b (patch) | |
tree | 37c6391bd965b4e19cc2b31e0916d78221063a0c /src | |
parent | b5097249caa7bafd660e8e750db791b5f438b5b0 (diff) | |
download | eSim-687a4bf4cd1e027df9fb371d5c173c02d7db767b.tar.gz eSim-687a4bf4cd1e027df9fb371d5c173c02d7db767b.tar.bz2 eSim-687a4bf4cd1e027df9fb371d5c173c02d7db767b.zip |
Subject: Changes in device library,ModelEditor.py,Convert.py. Added more
kicad library
Description: Changes in device library,ModelEditor.py,Convert.py. Added more
Diffstat (limited to 'src')
35 files changed, 233 insertions, 113 deletions
diff --git a/src/deviceModelLibrary/Diode/D.lib b/src/deviceModelLibrary/Diode/D.lib index 890c37fe..ef18bb50 100755 --- a/src/deviceModelLibrary/Diode/D.lib +++ b/src/deviceModelLibrary/Diode/D.lib @@ -1,3 +1,20 @@ -.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) +.MODEL D1N750 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/src/deviceModelLibrary/Diode/D.xml b/src/deviceModelLibrary/Diode/D.xml index 61312a8a..8b806d17 100644 --- a/src/deviceModelLibrary/Diode/D.xml +++ b/src/deviceModelLibrary/Diode/D.xml @@ -1,24 +1,4 @@ <library> <model_name>D</model_name> -<refrence>D1N750</refrence> -<param> - <Is>880.5E-18</Is> - <Rs>.25</Rs> - <Ikf>0</Ikf> - <N>1</N> - <Xti>3</Xti> - <Eg>1.11</Eg> - <Cjo>175p</Cjo> - <M>.5516</M> - <Vj>.75</Vj> - <Fc>.5</Fc> - <Isr>1.859n</Isr> - <Nr>2</Nr> - <Bv>8.1</Bv> - <Ibv>20.245m</Ibv> - <Nbv>1.6989</Nbv> - <Ibvl>1.9556m</Ibvl> - <Nbvl>14.976</Nbvl> - <Tbv1>-21.277u</Tbv1> -</param> -</library> +<ref_model>D1N750</ref_model> +<param><Vj>.75</Vj><Nbvl>14.976</Nbvl><Cjo>175p</Cjo><Rs>.25</Rs><Isr>1.859n</Isr><Eg>1.11</Eg><M>.5516</M><Nbv>1.6989</Nbv><N>1</N><Tbv1>-21.277u</Tbv1><Bv>8.1</Bv><Fc>.5</Fc><Ikf>0</Ikf><Nr>2</Nr><Ibv>20.245m</Ibv><Is>880.5E-18</Is><Xti>3</Xti><Ibvl>1.9556m</Ibvl></param></library>
\ No newline at end of file diff --git a/src/deviceModelLibrary/IGBT/NIGBT.lib b/src/deviceModelLibrary/IGBT/NIGBT.lib index 8c09dcbc..86cd1b4e 100755 --- a/src/deviceModelLibrary/IGBT/NIGBT.lib +++ b/src/deviceModelLibrary/IGBT/NIGBT.lib @@ -1,10 +1,11 @@ -.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) +.MODEL IXGH40N60 NIGBT( ++ TAU=287.56E-9 ++ KF=.36047 ++ AREA=37.500E-6 ++ AGD=18.750E-6 ++ KP=50.034 ++ VT=4.1822 ++ CGS=31.942E-9 ++ COXD=53.188E-9 ++ VTD=2.6570 +)
\ No newline at end of file diff --git a/src/deviceModelLibrary/IGBT/NIGBT.xml b/src/deviceModelLibrary/IGBT/NIGBT.xml index a945522a..38d9d094 100644 --- a/src/deviceModelLibrary/IGBT/NIGBT.xml +++ b/src/deviceModelLibrary/IGBT/NIGBT.xml @@ -1,15 +1,4 @@ <library> <model_name>NIGBT</model_name> -<refrence>IXGH40N60</refrence> -<param> -<TAU>287.56E-9</TAU> -<KP>50.034</KP> -<AREA>37.500E-6</AREA> -<AGD>18.750E-6</AGD> -<VT>4.1822</VT> -<KF>.36047</KF> -<CGS>31.942E-9</CGS> -<COXD>53.188E-9</COXD> -<VTD>2.6570</VTD> -</param> -</library> +<ref_model>IXGH40N60</ref_model> +<param><TAU>287.56E-9</TAU><KF>.36047</KF><AREA>37.500E-6</AREA><AGD>18.750E-6</AGD><KP>50.034</KP><VT>4.1822</VT><CGS>31.942E-9</CGS><COXD>53.188E-9</COXD><VTD>2.6570</VTD></param></library>
\ No newline at end of file diff --git a/src/deviceModelLibrary/IGBT/PIGBT.xml b/src/deviceModelLibrary/IGBT/PIGBT.xml index 2e316860..1e57f2e3 100644 --- a/src/deviceModelLibrary/IGBT/PIGBT.xml +++ b/src/deviceModelLibrary/IGBT/PIGBT.xml @@ -1,6 +1,6 @@ <library> <model_name>PIGBT</model_name> -<refrence>IXGH40N60</refrence> +<ref_model>IXGH40N60</ref_model> <param> <TAU>287.56E-9</TAU> <KP>50.034</KP> diff --git a/src/deviceModelLibrary/JFET/NJF.xml b/src/deviceModelLibrary/JFET/NJF.xml index 1b73fc73..94753691 100644 --- a/src/deviceModelLibrary/JFET/NJF.xml +++ b/src/deviceModelLibrary/JFET/NJF.xml @@ -1,6 +1,6 @@ <library> <model_name>NJF</model_name> -<refrence>J2N3819</refrence> +<ref_model>J2N3819</ref_model> <param> <Beta>1.304m</Beta> <Betatce>-.5</Betatce> diff --git a/src/deviceModelLibrary/JFET/PJF.xml b/src/deviceModelLibrary/JFET/PJF.xml index 05184f6f..f682f8cb 100644 --- a/src/deviceModelLibrary/JFET/PJF.xml +++ b/src/deviceModelLibrary/JFET/PJF.xml @@ -1,6 +1,6 @@ <library> <model_name>PJF</model_name> -<refrence>J2N3820</refrence> +<ref_model>J2N3820</ref_model> <param> <Beta>1.304m </Beta> <Betatce>-.5</Betatce> diff --git a/src/deviceModelLibrary/MOS/NMOS-0.5um.xml b/src/deviceModelLibrary/MOS/NMOS-0.5um.xml index 9ee36496..08fdf0e3 100644 --- a/src/deviceModelLibrary/MOS/NMOS-0.5um.xml +++ b/src/deviceModelLibrary/MOS/NMOS-0.5um.xml @@ -1,6 +1,6 @@ <library> <model_name>NMOS</model_name> -<refrence>mos_n</refrence> +<ref_model>mos_n</ref_model> <param> <TPG>1</TPG> <TOX>9.5n </TOX> diff --git a/src/deviceModelLibrary/MOS/NMOS-180nm.xml b/src/deviceModelLibrary/MOS/NMOS-180nm.xml index fc3b7a47..d0249bb6 100644 --- a/src/deviceModelLibrary/MOS/NMOS-180nm.xml +++ b/src/deviceModelLibrary/MOS/NMOS-180nm.xml @@ -1,6 +1,6 @@ <library> <model_name>NMOS</model_name> -<refrence>CMOSN</refrence> +<ref_model>CMOSN</ref_model> <param> <LEVEL>8 </LEVEL> <VERSION>3.2 </VERSION> diff --git a/src/deviceModelLibrary/MOS/NMOS-5um.xml b/src/deviceModelLibrary/MOS/NMOS-5um.xml index a72abbf1..358fbdbe 100644 --- a/src/deviceModelLibrary/MOS/NMOS-5um.xml +++ b/src/deviceModelLibrary/MOS/NMOS-5um.xml @@ -1,6 +1,6 @@ <library> <model_name>NMOS</model_name> -<refrence>mos_n</refrence> +<ref_model>mos_n</ref_model> <param> <Cgso>0.4n</Cgso> <Tox>85n</Tox> diff --git a/src/deviceModelLibrary/MOS/PMOS-0.5um.xml b/src/deviceModelLibrary/MOS/PMOS-0.5um.xml index a4555169..013d461c 100644 --- a/src/deviceModelLibrary/MOS/PMOS-0.5um.xml +++ b/src/deviceModelLibrary/MOS/PMOS-0.5um.xml @@ -1,6 +1,6 @@ <library> <model_name>PMOS</model_name> -<refrence>mos_p</refrence> +<ref_model>mos_p</ref_model> <param> <TPG>-1 </TPG> <TOX>9.5n </TOX> diff --git a/src/deviceModelLibrary/MOS/PMOS-180nm.xml b/src/deviceModelLibrary/MOS/PMOS-180nm.xml index 99916972..6696752d 100644 --- a/src/deviceModelLibrary/MOS/PMOS-180nm.xml +++ b/src/deviceModelLibrary/MOS/PMOS-180nm.xml @@ -1,6 +1,6 @@ <library> <model_name>PMOS</model_name> -<refrence>CMOSP</refrence> +<ref_model>CMOSP</ref_model> <param> <LEVEL>8 </LEVEL> <VERSION>3.2 </VERSION> diff --git a/src/deviceModelLibrary/MOS/PMOS-5um.xml b/src/deviceModelLibrary/MOS/PMOS-5um.xml index b82c5ae6..f68bada2 100644 --- a/src/deviceModelLibrary/MOS/PMOS-5um.xml +++ b/src/deviceModelLibrary/MOS/PMOS-5um.xml @@ -1,6 +1,6 @@ <library> <model_name>PMOS</model_name> -<refrence>mos_p</refrence> +<ref_model>mos_p</ref_model> <param> <Cgso>0.4n </Cgso> <Tox>85n </Tox> diff --git a/src/deviceModelLibrary/Misc/CORE.lib b/src/deviceModelLibrary/Misc/CORE.lib index c48c4b51..a7581029 100755 --- a/src/deviceModelLibrary/Misc/CORE.lib +++ b/src/deviceModelLibrary/Misc/CORE.lib @@ -1,2 +1,9 @@ -.model K3019PL_3C8 Core(MS=415.2K A=44.82 C=.4112 K=25.74 -+ Area=1.38 Path=4.52) +.MODEL K3019PL_3C8 Core( ++ A=44.82 ++ C=.4112 ++ abc=123 ++ Area=1.38 ++ K=25.74 ++ MS=415.2K ++ Path=4.52 +)
\ No newline at end of file diff --git a/src/deviceModelLibrary/Misc/CORE.xml b/src/deviceModelLibrary/Misc/CORE.xml index 09129f74..c95d9db0 100644 --- a/src/deviceModelLibrary/Misc/CORE.xml +++ b/src/deviceModelLibrary/Misc/CORE.xml @@ -1,12 +1,4 @@ <library> <model_name>Core</model_name> -<refrence>K3019PL_3C8</refrence> -<param> -<MS>415.2K</MS> -<A>44.82 </A> -<C>.4112</C> -<K>25.74</K> -<Area>1.38</Area> -<Path>4.52</Path> -</param> -</library> +<ref_model>K3019PL_3C8</ref_model> +<param><A>44.82 </A><C>.4112</C><abc>123</abc><Area>1.38</Area><K>25.74</K><MS>415.2K</MS><Path>4.52</Path></param></library> diff --git a/src/deviceModelLibrary/Templates/CORE.lib b/src/deviceModelLibrary/Templates/CORE.lib index c48c4b51..a7581029 100755 --- a/src/deviceModelLibrary/Templates/CORE.lib +++ b/src/deviceModelLibrary/Templates/CORE.lib @@ -1,2 +1,9 @@ -.model K3019PL_3C8 Core(MS=415.2K A=44.82 C=.4112 K=25.74 -+ Area=1.38 Path=4.52) +.MODEL K3019PL_3C8 Core( ++ A=44.82 ++ C=.4112 ++ abc=123 ++ Area=1.38 ++ K=25.74 ++ MS=415.2K ++ Path=4.52 +)
\ No newline at end of file diff --git a/src/deviceModelLibrary/Templates/CORE.xml b/src/deviceModelLibrary/Templates/CORE.xml index 09129f74..c95d9db0 100644 --- a/src/deviceModelLibrary/Templates/CORE.xml +++ b/src/deviceModelLibrary/Templates/CORE.xml @@ -1,12 +1,4 @@ <library> <model_name>Core</model_name> -<refrence>K3019PL_3C8</refrence> -<param> -<MS>415.2K</MS> -<A>44.82 </A> -<C>.4112</C> -<K>25.74</K> -<Area>1.38</Area> -<Path>4.52</Path> -</param> -</library> +<ref_model>K3019PL_3C8</ref_model> +<param><A>44.82 </A><C>.4112</C><abc>123</abc><Area>1.38</Area><K>25.74</K><MS>415.2K</MS><Path>4.52</Path></param></library> diff --git a/src/deviceModelLibrary/Templates/D.xml b/src/deviceModelLibrary/Templates/D.xml index 61312a8a..546d1156 100644 --- a/src/deviceModelLibrary/Templates/D.xml +++ b/src/deviceModelLibrary/Templates/D.xml @@ -1,6 +1,6 @@ <library> <model_name>D</model_name> -<refrence>D1N750</refrence> +<ref_model>D1N750</ref_model> <param> <Is>880.5E-18</Is> <Rs>.25</Rs> diff --git a/src/deviceModelLibrary/Templates/NIGBT.xml b/src/deviceModelLibrary/Templates/NIGBT.xml index a945522a..97f33196 100644 --- a/src/deviceModelLibrary/Templates/NIGBT.xml +++ b/src/deviceModelLibrary/Templates/NIGBT.xml @@ -1,6 +1,6 @@ <library> <model_name>NIGBT</model_name> -<refrence>IXGH40N60</refrence> +<ref_model>IXGH40N60</ref_model> <param> <TAU>287.56E-9</TAU> <KP>50.034</KP> diff --git a/src/deviceModelLibrary/Templates/NJF.xml b/src/deviceModelLibrary/Templates/NJF.xml index 1b73fc73..94753691 100644 --- a/src/deviceModelLibrary/Templates/NJF.xml +++ b/src/deviceModelLibrary/Templates/NJF.xml @@ -1,6 +1,6 @@ <library> <model_name>NJF</model_name> -<refrence>J2N3819</refrence> +<ref_model>J2N3819</ref_model> <param> <Beta>1.304m</Beta> <Betatce>-.5</Betatce> diff --git a/src/deviceModelLibrary/Templates/NMOS-0.5um.xml b/src/deviceModelLibrary/Templates/NMOS-0.5um.xml index 9ee36496..08fdf0e3 100644 --- a/src/deviceModelLibrary/Templates/NMOS-0.5um.xml +++ b/src/deviceModelLibrary/Templates/NMOS-0.5um.xml @@ -1,6 +1,6 @@ <library> <model_name>NMOS</model_name> -<refrence>mos_n</refrence> +<ref_model>mos_n</ref_model> <param> <TPG>1</TPG> <TOX>9.5n </TOX> diff --git a/src/deviceModelLibrary/Templates/NMOS-180nm.xml b/src/deviceModelLibrary/Templates/NMOS-180nm.xml index fc3b7a47..d0249bb6 100644 --- a/src/deviceModelLibrary/Templates/NMOS-180nm.xml +++ b/src/deviceModelLibrary/Templates/NMOS-180nm.xml @@ -1,6 +1,6 @@ <library> <model_name>NMOS</model_name> -<refrence>CMOSN</refrence> +<ref_model>CMOSN</ref_model> <param> <LEVEL>8 </LEVEL> <VERSION>3.2 </VERSION> diff --git a/src/deviceModelLibrary/Templates/NMOS-5um.xml b/src/deviceModelLibrary/Templates/NMOS-5um.xml index a72abbf1..358fbdbe 100644 --- a/src/deviceModelLibrary/Templates/NMOS-5um.xml +++ b/src/deviceModelLibrary/Templates/NMOS-5um.xml @@ -1,6 +1,6 @@ <library> <model_name>NMOS</model_name> -<refrence>mos_n</refrence> +<ref_model>mos_n</ref_model> <param> <Cgso>0.4n</Cgso> <Tox>85n</Tox> diff --git a/src/deviceModelLibrary/Templates/NPN.xml b/src/deviceModelLibrary/Templates/NPN.xml index f0679885..b2698bb1 100644 --- a/src/deviceModelLibrary/Templates/NPN.xml +++ b/src/deviceModelLibrary/Templates/NPN.xml @@ -1,6 +1,6 @@ <library> <model_name>NPN</model_name> -<refrence>Q2N2222</refrence> +<ref_model>Q2N2222</ref_model> <param> <Is>14.34f </Is> <Xti>3 </Xti> diff --git a/src/deviceModelLibrary/Templates/PIGBT.xml b/src/deviceModelLibrary/Templates/PIGBT.xml index 2e316860..1e57f2e3 100644 --- a/src/deviceModelLibrary/Templates/PIGBT.xml +++ b/src/deviceModelLibrary/Templates/PIGBT.xml @@ -1,6 +1,6 @@ <library> <model_name>PIGBT</model_name> -<refrence>IXGH40N60</refrence> +<ref_model>IXGH40N60</ref_model> <param> <TAU>287.56E-9</TAU> <KP>50.034</KP> diff --git a/src/deviceModelLibrary/Templates/PJF.xml b/src/deviceModelLibrary/Templates/PJF.xml index 05184f6f..f682f8cb 100644 --- a/src/deviceModelLibrary/Templates/PJF.xml +++ b/src/deviceModelLibrary/Templates/PJF.xml @@ -1,6 +1,6 @@ <library> <model_name>PJF</model_name> -<refrence>J2N3820</refrence> +<ref_model>J2N3820</ref_model> <param> <Beta>1.304m </Beta> <Betatce>-.5</Betatce> diff --git a/src/deviceModelLibrary/Templates/PMOS-0.5um.xml b/src/deviceModelLibrary/Templates/PMOS-0.5um.xml index a4555169..013d461c 100644 --- a/src/deviceModelLibrary/Templates/PMOS-0.5um.xml +++ b/src/deviceModelLibrary/Templates/PMOS-0.5um.xml @@ -1,6 +1,6 @@ <library> <model_name>PMOS</model_name> -<refrence>mos_p</refrence> +<ref_model>mos_p</ref_model> <param> <TPG>-1 </TPG> <TOX>9.5n </TOX> diff --git a/src/deviceModelLibrary/Templates/PMOS-180nm.xml b/src/deviceModelLibrary/Templates/PMOS-180nm.xml index 99916972..6696752d 100644 --- a/src/deviceModelLibrary/Templates/PMOS-180nm.xml +++ b/src/deviceModelLibrary/Templates/PMOS-180nm.xml @@ -1,6 +1,6 @@ <library> <model_name>PMOS</model_name> -<refrence>CMOSP</refrence> +<ref_model>CMOSP</ref_model> <param> <LEVEL>8 </LEVEL> <VERSION>3.2 </VERSION> diff --git a/src/deviceModelLibrary/Templates/PMOS-5um.xml b/src/deviceModelLibrary/Templates/PMOS-5um.xml index b82c5ae6..f68bada2 100644 --- a/src/deviceModelLibrary/Templates/PMOS-5um.xml +++ b/src/deviceModelLibrary/Templates/PMOS-5um.xml @@ -1,6 +1,6 @@ <library> <model_name>PMOS</model_name> -<refrence>mos_p</refrence> +<ref_model>mos_p</ref_model> <param> <Cgso>0.4n </Cgso> <Tox>85n </Tox> diff --git a/src/deviceModelLibrary/Templates/PNP.xml b/src/deviceModelLibrary/Templates/PNP.xml index a25276a9..681b3fd9 100644 --- a/src/deviceModelLibrary/Templates/PNP.xml +++ b/src/deviceModelLibrary/Templates/PNP.xml @@ -1,6 +1,6 @@ <library> <model_name>PNP</model_name> -<refrence>Q2N2907A</refrence> +<ref_model>Q2N2907A</ref_model> <param> <Is>650.6E-18</Is> <Xti>3 </Xti> diff --git a/src/deviceModelLibrary/User Libraries/userDiode.lib b/src/deviceModelLibrary/User Libraries/userDiode.lib new file mode 100644 index 00000000..ef18bb50 --- /dev/null +++ b/src/deviceModelLibrary/User Libraries/userDiode.lib @@ -0,0 +1,20 @@ +.MODEL D1N750 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/src/deviceModelLibrary/User Libraries/userDiode.xml b/src/deviceModelLibrary/User Libraries/userDiode.xml new file mode 100644 index 00000000..d8584e1d --- /dev/null +++ b/src/deviceModelLibrary/User Libraries/userDiode.xml @@ -0,0 +1 @@ +<library><model_name>D</model_name><ref_model>D1N750</ref_model><param><Is>880.5E-18</Is><Nbvl>14.976</Nbvl><Cjo>175p</Cjo><Rs>.25</Rs><Isr>1.859n</Isr><Eg>1.11</Eg><M>.5516</M><Nbv>1.6989</Nbv><N>1</N><Tbv1>-21.277u</Tbv1><Bv>8.1</Bv><Fc>.5</Fc><Ikf>0</Ikf><Xti>3</Xti><Nr>2</Nr><Vj>.75</Vj><Ibv>20.245m</Ibv><Ibvl>1.9556m</Ibvl></param></library>
\ No newline at end of file diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index e4bddac9..c08c1974 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -29,7 +29,6 @@ import DockArea import os import sys import time -import shutil from PyQt4.Qt import QSize class Application(QtGui.QMainWindow): diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 3610382a..25576f53 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -356,7 +356,7 @@ class Convert: #Extracting Value from XML libtree = ET.parse(library) for child in libtree.iter(): - if child.tag == 'refrence': + if child.tag == 'ref_model': retVal = child.text else: pass diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 0ce32a61..68f0735c 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -3,6 +3,7 @@ from PyQt4.Qt import QTableWidgetItem import xml.etree.ElementTree as ET import os + class ModelEditorclass(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) @@ -12,6 +13,8 @@ class ModelEditorclass(QtGui.QWidget): self.splitter= QtGui.QSplitter() self.grid= QtGui.QGridLayout() self.splitter.setOrientation(QtCore.Qt.Vertical) + + self.modeltable = QtGui.QTableWidget() self.newbtn = QtGui.QPushButton('New') self.newbtn.clicked.connect(self.opennew) @@ -26,10 +29,12 @@ class ModelEditorclass(QtGui.QWidget): self.addbtn = QtGui.QPushButton('Add') self.addbtn.setHidden(True) self.addbtn.clicked.connect(self.addparameters) - #self.splitter.addWidget(self.newbtn) + self.uploadbtn = QtGui.QPushButton('Upload') + self.uploadbtn.clicked.connect(self.converttoxml) self.grid.addWidget(self.newbtn, 1,2) self.grid.addWidget(self.editbtn, 1,3) self.grid.addWidget(self.savebtn, 1,4) + self.grid.addWidget(self.uploadbtn, 1,5) self.grid.addWidget(self.removebtn, 8,4) self.grid.addWidget(self.addbtn, 5,4) @@ -70,10 +75,7 @@ class ModelEditorclass(QtGui.QWidget): self.grid.addWidget(self.jfet,6,1) self.grid.addWidget(self.igbt,7,1) self.grid.addWidget(self.magnetic,8,1) - - #self.layout.addWidget(self.splitter) self.setLayout(self.grid) - #self.setLayout(self.layout) self.show() '''To create New Model file ''' @@ -83,6 +85,7 @@ class ModelEditorclass(QtGui.QWidget): self.modeltable.setHidden(True) except: pass + os.chdir(self.savepathtest) text, ok = QtGui.QInputDialog.getText(self, 'New Model','Enter Model Name:') if ok: self.newflag=1 @@ -215,6 +218,7 @@ class ModelEditorclass(QtGui.QWidget): pass def openedit(self): + os.chdir(self.savepathtest) self.newflag=0 self.addbtn.setHidden(True) self.types.setHidden(True) @@ -225,7 +229,6 @@ class ModelEditorclass(QtGui.QWidget): self.bjt.setDisabled(True) self.magnetic.setDisabled(True) self.editfile=str(QtGui.QFileDialog.getOpenFileName(self)) - #self.path='/home/workspace/eSim/src/deviceModelLibrary/Diode' self.createtable(self.editfile) '''Creates the model table by parsinf th .xml file ''' @@ -244,8 +247,8 @@ class ModelEditorclass(QtGui.QWidget): self.tree = ET.parse(self.modelfile) self.root= self.tree.getroot() - for elem in self.tree.iter(tag='refrence'): - self.reference = elem.text + for elem in self.tree.iter(tag='ref_model'): + self.ref_model = elem.text for elem in self.tree.iter(tag='model_name'): self.model_name = elem.text row=0 @@ -311,7 +314,7 @@ class ModelEditorclass(QtGui.QWidget): def createXML(self,model_name): root = ET.Element("library") ET.SubElement(root, "model_name").text = model_name - ET.SubElement(root, "refrence").text = self.modelname + ET.SubElement(root, "ref_model").text = self.modelname param = ET.SubElement(root, "param") for tags, text in self.modeldict.items(): ET.SubElement(param, tags).text = text @@ -324,7 +327,7 @@ class ModelEditorclass(QtGui.QWidget): txtfile = open(self.modelname+'.lib', 'w') txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - txtfile.write('+ ' + tags + ' = ' + text +'\n') + txtfile.write('+ ' + tags + '=' + text +'\n') txtfile.write(')') tree.write(self.modelname +".xml") if self.mos.isChecked(): @@ -333,7 +336,7 @@ class ModelEditorclass(QtGui.QWidget): txtfile = open(self.modelname+'.lib', 'w') txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - txtfile.write('+ ' + tags + ' = ' + text +'\n') + txtfile.write('+ ' + tags + '=' + text +'\n') txtfile.write(')') tree.write(self.modelname +".xml") if self.jfet.isChecked(): @@ -342,7 +345,7 @@ class ModelEditorclass(QtGui.QWidget): txtfile = open(self.modelname+'.lib', 'w') txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - txtfile.write('+ ' + tags + ' = ' + text +'\n') + txtfile.write('+ ' + tags + '=' + text +'\n') txtfile.write(')') tree.write(self.modelname +".xml") if self.igbt.isChecked(): @@ -351,7 +354,7 @@ class ModelEditorclass(QtGui.QWidget): txtfile = open(self.modelname+'.lib', 'w') txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - txtfile.write('+ ' + tags + ' = ' + text +'\n') + txtfile.write('+ ' + tags + '=' + text +'\n') txtfile.write(')') tree.write(self.modelname +".xml") if self.magnetic.isChecked(): @@ -360,7 +363,7 @@ class ModelEditorclass(QtGui.QWidget): txtfile = open(self.modelname+'.lib', 'w') txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - txtfile.write('+ ' + tags + ' = ' + text +'\n') + txtfile.write('+ ' + tags + '=' + text +'\n') txtfile.write(')') tree.write(self.modelname +".xml") if self.bjt.isChecked(): @@ -369,7 +372,7 @@ class ModelEditorclass(QtGui.QWidget): txtfile = open(self.modelname+'.lib', 'w') txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - txtfile.write('+ ' + tags + ' = ' + text +'\n') + txtfile.write('+ ' + tags + '=' + text +'\n') txtfile.write(')') tree.write(self.modelname +".xml") txtfile.close() @@ -378,6 +381,7 @@ class ModelEditorclass(QtGui.QWidget): '''Checks if the file with the name already exists''' def validation(self,text): newfilename = text+'.xml' + all_dir = [x[0] for x in os.walk(self.savepathtest)] for each_dir in all_dir: all_files = os.listdir(each_dir) @@ -393,9 +397,9 @@ class ModelEditorclass(QtGui.QWidget): filename = os.path.splitext(file)[0] libpath = os.path.join(xmlpath,filename+'.lib') libfile = open(libpath, 'w') - libfile.write('.MODEL ' + self.reference +' ' + self.model_name + '(\n' ) + libfile.write('.MODEL ' + self.ref_model +' ' + self.model_name + '(\n' ) for tags, text in self.modeldict.items(): - libfile.write('+ ' + tags + ' = ' + text +'\n') + libfile.write('+ ' + tags + '=' + text +'\n') libfile.write(')') libfile.close() for params in self.tree.findall('param'): @@ -412,4 +416,115 @@ class ModelEditorclass(QtGui.QWidget): remove_item = self.modeltable.item(index.row(),0).text() self.modeltable.removeRow(index.row()) del self.modeldict[str(remove_item)] -
\ No newline at end of file + + def converttoxml(self): + os.chdir(self.savepathtest) + self.addbtn.setHidden(True) + self.removebtn.setHidden(True) + self.modeltable.setHidden(True) + model_dict = {} + stringof = [] + self.libfile = str(QtGui.QFileDialog.getOpenFileName(self)) + libopen = open(self.libfile) + filedata = libopen.read().split() + modelcount=0 + for words in filedata: + modelcount= modelcount +1 + if words.lower() == '.model': + print "model found" + break + ref_model = filedata[modelcount] + model_name = filedata[modelcount+1] + model_name = list(model_name) + modelnamecnt= 0 + flag= 0 + for chars in model_name: + modelnamecnt = modelnamecnt +1 + if chars == '(': + flag = 1 + break + if flag == 1 : + model_name = ''.join(model_name[0:modelnamecnt-1]) + else: + model_name = ''.join(model_name) + + libopen1 = open(self.libfile) + while True: + char = libopen1.read(1) + if not char: + break + stringof.append(char) + + count = 0 + for chars in stringof: + count = count +1 + if chars == '(': + break + count1=0 + for chars in stringof: + count1 = count1 +1 + if chars == ')': + break + stringof = stringof[count:count1-1] + stopcount=[] + listofname = [] + stopcount.append(0) + count = 0 + for chars in stringof: + count = count +1 + if chars == '=': + stopcount.append(count) + stopcount.append(count) + + i = 0 + for no in stopcount: + try: + listofname.append(''.join(stringof[int(stopcount[i]):int(stopcount[i+1])])) + i = i +1 + except: + pass + listoflist =[] + listofname2 = [el.replace('\t', '').replace('\n', ' ').replace('+', '').replace(')', '').replace('=', '') for el in listofname] + ''' + listofname = [el.replace('\n', ' ') for el in listofname2] + listofname2 = [el.replace('+', '') for el in listofname] + listofname = [el.replace(')', '') for el in listofname2] + listofname2 = [el.replace('=', '') for el in listofname] + ''' + listofname=[] + for item in listofname2: + listofname.append(item.rstrip().lstrip()) + for values in listofname: + valuelist = values.split(' ') + listoflist.append(valuelist) + for i in range(1, len(listoflist)): + model_dict[listoflist[0][0]]=listoflist[1][0] + try: + model_dict[listoflist[i][-1]]= listoflist[i+1][0] + except: + pass + root = ET.Element("library") + ET.SubElement(root, "model_name").text = model_name + ET.SubElement(root, "ref_model").text = ref_model + param = ET.SubElement(root, "param") + for tags, text in model_dict.items(): + ET.SubElement(param, tags).text = text + tree = ET.ElementTree(root) + + defaultcwd = os.getcwd() + savepath = os.path.join(self.savepathtest, 'User Libraries') + savefilepath= os.path.join(savepath, model_name +".xml") + #self.obj_valid.validateNewproj(savepath) + #self.reply = self.obj_valid.validateNewproj(savefilepath) + os.chdir(savepath) + text, ok1 = QtGui.QInputDialog.getText(self, 'Model Name','Enter Model Library Name') + if ok1: + tree.write(text+".xml") + fileopen = open(text+".lib",'w') + f = open(self.libfile) + fileopen.write(f.read()) + f.close() + fileopen.close() + os.chdir(defaultcwd) + libopen.close() + libopen1.close()
\ No newline at end of file |