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 | |
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
39 files changed, 616 insertions, 117 deletions
diff --git a/kicadSchematicLibrary/eSim_Devices.dcm b/kicadSchematicLibrary/eSim_Devices.dcm index fb0e8ff6..bcdca7fe 100644 --- a/kicadSchematicLibrary/eSim_Devices.dcm +++ b/kicadSchematicLibrary/eSim_Devices.dcm @@ -1,13 +1,37 @@ EESchema-DOCLIB Version 2.0 # +$CMP D +D Diode +$ENDCMP +# +$CMP MOS_N +D Transistor N-MOSFET, collector connected to mounting plane (general) +K nmos n-mos n-mosfet transistor +$ENDCMP +# +$CMP MOS_P +D Transistor P-MOSFET, collector connected to mounting plane (general) +K pmos p-mos p-mosfet transistor +$ENDCMP +# $CMP NJF D Transistor N-JFET (general) K njfet n-jfet transistor $ENDCMP # +$CMP NPN +D Transistor NPN (general) +K npn transistor +$ENDCMP +# $CMP PJF D Transistor P-JFET (general) K pjfet p-jfet transistor $ENDCMP # +$CMP PNP +D Transistor PNP (general) +K pnp transistor +$ENDCMP +# #End Doc Library diff --git a/kicadSchematicLibrary/eSim_Devices.lib b/kicadSchematicLibrary/eSim_Devices.lib index d5d3af9f..442795e7 100644 --- a/kicadSchematicLibrary/eSim_Devices.lib +++ b/kicadSchematicLibrary/eSim_Devices.lib @@ -1,11 +1,87 @@ EESchema-LIBRARY Version 2.3 #encoding utf-8 # +# D +# +DEF D D 0 40 N N 1 F N +F0 "D" 0 100 50 H V C CNN +F1 "D" 0 -100 50 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + Diode_* + D-Pak_TO252AA + *SingleDiode + *_Diode_* + *SingleDiode* +$ENDFPLIST +DRAW +P 2 0 1 6 50 50 50 -50 N +P 3 0 1 0 -50 50 50 0 -50 -50 F +X A 1 -150 0 100 R 40 40 1 1 P +X K 2 150 0 100 L 40 40 1 1 P +ENDDRAW +ENDDEF +# +# MOS_N +# +DEF MOS_N M 0 0 Y N 1 F N +F0 "M" 0 -150 50 H V R CNN +F1 "MOS_N" 100 -50 50 H V R CNN +F2 "" 300 -300 29 H V C CNN +F3 "" 100 -200 60 H V C CNN +DRAW +C 150 -200 111 0 1 10 N +P 2 0 1 10 130 -290 130 -250 N +P 2 0 1 0 130 -270 200 -270 N +P 2 0 1 10 130 -220 130 -180 N +P 2 0 1 0 130 -200 200 -200 N +P 2 0 1 10 130 -150 130 -110 N +P 2 0 1 0 130 -130 200 -130 N +P 2 0 1 0 200 -300 200 -270 N +P 2 0 1 0 200 -130 200 -100 N +P 3 0 1 10 110 -275 110 -125 110 -125 N +P 3 0 1 0 200 -200 300 -200 300 -250 N +P 4 0 1 0 140 -200 180 -215 180 -185 140 -200 F +X D 1 200 0 100 D 50 50 1 1 E +X G 2 -100 -200 210 R 50 50 1 1 I +X S 3 200 -400 100 U 50 50 1 1 C +X B 4 300 -350 98 U 47 47 1 1 I +ENDDRAW +ENDDEF +# +# MOS_P +# +DEF MOS_P M 0 0 Y N 1 F N +F0 "M" -50 50 50 H V R CNN +F1 "MOS_P" 50 150 50 H V R CNN +F2 "" 250 100 29 H V C CNN +F3 "" 50 0 60 H V C CNN +DRAW +C 100 0 111 0 1 10 N +P 2 0 1 0 80 -70 150 -70 N +P 2 0 1 10 80 -50 80 -90 N +P 2 0 1 0 80 0 150 0 N +P 2 0 1 10 80 20 80 -20 N +P 2 0 1 0 80 70 150 70 N +P 2 0 1 10 80 90 80 50 N +P 2 0 1 0 150 -70 150 -100 N +P 2 0 1 0 150 100 150 70 N +P 3 0 1 10 60 75 60 -75 60 -75 N +P 3 0 1 0 150 0 250 0 250 -50 N +P 4 0 1 0 140 0 100 -15 100 15 140 0 F +X D 1 150 200 100 D 50 50 1 1 C +X G 2 -150 0 210 R 50 50 1 1 I +X S 3 150 -200 100 U 50 50 1 1 E +X B 4 250 -150 100 U 50 50 1 1 I +ENDDRAW +ENDDEF +# # NJF # DEF NJF J 0 0 Y N 1 F N -F0 "J" 250 0 50 H V R CNN -F1 "NJF" -50 100 50 H V R CNN +F0 "J" -100 50 50 H V R CNN +F1 "NJF" -50 150 50 H V R CNN F2 "" 200 100 29 H V C CNN F3 "" 0 0 60 H V C CNN DRAW @@ -20,11 +96,30 @@ X S 3 100 -200 100 U 50 50 1 1 E ENDDRAW ENDDEF # +# NPN +# +DEF NPN Q 0 0 Y N 1 F N +F0 "Q" -100 50 50 H V R CNN +F1 "NPN" -50 150 50 H V R CNN +F2 "" 200 100 29 H V C CNN +F3 "" 0 0 60 H V C CNN +DRAW +C 50 0 111 0 1 10 N +P 2 0 1 0 25 25 100 100 N +P 3 0 1 0 25 -25 100 -100 100 -100 N +P 3 0 1 20 25 75 25 -75 25 -75 N +P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F +X C 1 100 200 100 D 50 50 1 1 C +X B 2 -200 0 225 R 50 50 1 1 I +X E 3 100 -200 100 U 50 50 1 1 E +ENDDRAW +ENDDEF +# # PJF # DEF PJF J 0 0 Y N 1 F N -F0 "J" 250 0 50 H V R CNN -F1 "PJF" -50 100 50 H V R CNN +F0 "J" -100 50 50 H V R CNN +F1 "PJF" -50 150 50 H V R CNN F2 "" 200 100 29 H V C CNN F3 "" 0 0 60 H V C CNN DRAW @@ -39,4 +134,45 @@ X S 3 100 -200 100 U 50 50 1 1 E ENDDRAW ENDDEF # +# PNP +# +DEF PNP Q 0 0 Y N 1 F N +F0 "Q" -100 50 50 H V R CNN +F1 "PNP" -50 150 50 H V R CNN +F2 "" 200 100 29 H V C CNN +F3 "" 0 0 60 H V C CNN +DRAW +C 50 0 111 0 1 10 N +P 2 0 1 0 25 25 100 100 N +P 3 0 1 0 25 -25 100 -100 100 -100 N +P 3 0 1 20 25 75 25 -75 25 -75 N +P 5 0 1 0 90 -70 70 -90 50 -50 90 -70 90 -70 F +X C 1 100 200 100 D 50 50 1 1 C +X B 2 -200 0 225 R 50 50 1 1 I +X E 3 100 -200 100 U 50 50 1 1 E +ENDDRAW +ENDDEF +# +# PORT +# +DEF PORT U 0 40 Y Y 8 F N +F0 "U" 50 100 30 H V C CNN +F1 "PORT" 0 0 30 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +DRAW +A 325 225 285 -1421 -1278 0 1 0 N 100 50 150 0 +A 376 -275 356 1294 1408 0 1 0 N 150 0 100 -50 +S -100 50 100 -50 0 1 0 N +X ~ 1 250 0 100 L 30 30 1 1 B +X ~ 2 250 0 100 L 30 30 2 1 B +X ~ 3 250 0 100 L 30 30 3 1 B +X ~ 4 250 0 100 L 30 30 4 1 B +X ~ 5 250 0 100 L 30 30 5 1 B +X ~ 6 250 0 100 L 30 30 6 1 B +X ~ 7 250 0 100 L 30 30 7 1 B +X ~ 8 250 0 100 L 30 30 8 1 B +ENDDRAW +ENDDEF +# #End Library diff --git a/kicadSchematicLibrary/eSim_Sources.dcm b/kicadSchematicLibrary/eSim_Sources.dcm new file mode 100644 index 00000000..5f3ed79b --- /dev/null +++ b/kicadSchematicLibrary/eSim_Sources.dcm @@ -0,0 +1,3 @@ +EESchema-DOCLIB Version 2.0 +# +#End Doc Library diff --git a/kicadSchematicLibrary/eSim_Sources.lib b/kicadSchematicLibrary/eSim_Sources.lib new file mode 100644 index 00000000..cf328d51 --- /dev/null +++ b/kicadSchematicLibrary/eSim_Sources.lib @@ -0,0 +1,216 @@ +EESchema-LIBRARY Version 2.3 +#encoding utf-8 +# +# AC +# +DEF AC v 0 40 Y Y 1 F N +F0 "v" -200 100 60 H V C CNN +F1 "AC" -200 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +A -50 0 50 1 1799 0 1 0 N 0 0 -100 0 +A 50 0 50 -1799 -1 0 1 0 N 0 0 100 0 +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 0 1 1 I +X - 2 0 -450 300 U 50 0 1 1 I +ENDDRAW +ENDDEF +# +# CCCS +# +DEF CCCS F 0 40 Y Y 1 F N +F0 "F" 0 150 50 H V C CNN +F1 "CCCS" -200 -50 50 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +S -100 100 100 -100 0 1 0 N +X + 1 -300 50 200 R 35 35 1 1 P +X - 2 300 50 200 L 35 35 1 1 P +X +c 3 -50 -200 100 U 35 35 1 1 P +X -c 4 50 -200 100 U 35 35 1 1 P +ENDDRAW +ENDDEF +# +# CCVS +# +DEF CCVS H 0 40 Y Y 1 F N +F0 "H" 0 150 50 H V C CNN +F1 "CCVS" -200 -50 50 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +S -100 100 100 -100 0 1 0 N +X + 1 -300 50 200 R 35 35 1 1 P +X - 2 300 50 200 L 35 35 1 1 P +X +c 3 -50 -200 100 U 35 35 1 1 P +X -c 4 50 -200 100 U 35 35 1 1 P +ENDDRAW +ENDDEF +# +# DC +# +DEF DC v 0 40 Y Y 1 F N +F0 "v" -200 100 60 H V C CNN +F1 "DC" -200 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 50 1 1 P +X - 2 0 -450 300 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# VCCS +# +DEF VCCS G 0 40 Y Y 1 F N +F0 "G" 0 150 50 H V C CNN +F1 "VCCS" -200 -50 50 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +S -100 100 100 -100 0 1 0 N +X + 1 -300 50 200 R 35 35 1 1 P +X - 2 300 50 200 L 35 35 1 1 P +X +c 3 -50 -200 100 U 35 35 1 1 P +X -c 4 50 -200 100 U 35 35 1 1 P +ENDDRAW +ENDDEF +# +# VCVS +# +DEF VCVS E 0 40 Y Y 1 F N +F0 "E" 0 150 50 H V C CNN +F1 "VCVS" -200 -50 50 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +S -100 100 100 -100 0 1 0 N +X + 1 -300 50 200 R 35 35 1 1 P +X - 2 300 50 200 L 35 35 1 1 P +X +c 3 -50 -200 100 U 35 35 1 1 P +X -c 4 50 -200 100 U 35 35 1 1 P +ENDDRAW +ENDDEF +# +# exp +# +DEF exp v 0 40 Y Y 1 F N +F0 "v" -200 100 60 H V C CNN +F1 "exp" -200 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +A 1 -50 100 905 1800 0 1 0 N 0 50 -100 -50 +A 100 51 100 -1794 -900 0 1 0 N 0 50 100 -50 +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 0 1 1 I +X - 2 0 -450 300 U 50 0 1 1 I +ENDDRAW +ENDDEF +# +# idc +# +DEF idc IDC 0 40 Y Y 1 F N +F0 "IDC" -200 100 60 H V C CNN +F1 "idc" -200 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 50 1 1 P +X - 2 0 -450 300 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# pulse +# +DEF pulse v 0 40 Y Y 1 F N +F0 "v" -200 100 60 H V C CNN +F1 "pulse" -200 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +A -25 -450 501 928 871 0 1 0 N -50 50 0 50 +A 25 400 451 -931 -868 0 1 0 N 0 -50 50 -50 +A 75 600 551 -926 -873 0 1 0 N 50 50 100 50 +A 350 0 403 -1728 1728 0 1 0 N -50 -50 -50 50 +A 450 0 453 1736 -1736 0 1 0 N 0 50 0 -50 +A 600 0 552 -1748 1748 0 1 0 N 50 -50 50 50 +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 50 1 1 P +X - 2 0 -450 300 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# pwl +# +DEF pwl v 0 40 Y Y 1 F N +F0 "v" -200 100 60 H V C CNN +F1 "pwl" -250 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +A -1144 -561 1253 291 240 0 1 0 N -50 50 0 -50 +A -765 421 941 -300 -232 0 1 0 N 50 -50 100 50 +A -75 -700 750 919 880 0 1 0 N -100 50 -50 50 +A 25 450 501 -928 -871 0 1 0 N 0 -50 50 -50 +A 1096 -609 1366 1511 1558 0 1 0 N -100 50 -150 -50 +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 0 1 1 I +X - 2 0 -450 300 U 50 0 1 1 I +ENDDRAW +ENDDEF +# +# sine +# +DEF sine v 0 40 Y Y 1 F N +F0 "v" -200 100 60 H V C CNN +F1 "sine" -200 -50 60 H V C CNN +F2 "R1" -300 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +$FPLIST + 1_pin +$ENDFPLIST +DRAW +A -50 0 50 1 1799 0 1 0 N 0 0 -100 0 +A 50 0 50 -1799 -1 0 1 0 N 0 0 100 0 +C 0 0 150 0 1 0 N +X + 1 0 450 300 D 50 0 1 1 I +X - 2 0 -450 300 U 50 0 1 1 I +ENDDRAW +ENDDEF +# +#End Library 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 |