summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFahim2015-08-18 21:23:43 +0530
committerFahim2015-08-18 21:23:43 +0530
commit829df641dd9c13928b73e45ab4e11229b5336fd8 (patch)
treece46e8ca7d20f5a50d351057acf0de67eb329025
parent3be4e7e563ae0b71904cb12899ecb7b8fed78bdc (diff)
downloadeSim-829df641dd9c13928b73e45ab4e11229b5336fd8.tar.gz
eSim-829df641dd9c13928b73e45ab4e11229b5336fd8.tar.bz2
eSim-829df641dd9c13928b73e45ab4e11229b5336fd8.zip
Subject: Model Editor Bug fixing
Description: Modify model editor to save xml file for device library
-rw-r--r--kicadSchematicLibrary/eSim_Devices.dcm13
-rw-r--r--kicadSchematicLibrary/eSim_Devices.lib57
-rw-r--r--src/modelEditor/ModelEditor.py15
3 files changed, 80 insertions, 5 deletions
diff --git a/kicadSchematicLibrary/eSim_Devices.dcm b/kicadSchematicLibrary/eSim_Devices.dcm
index bcdca7fe..af8323d6 100644
--- a/kicadSchematicLibrary/eSim_Devices.dcm
+++ b/kicadSchematicLibrary/eSim_Devices.dcm
@@ -1,9 +1,17 @@
EESchema-DOCLIB Version 2.0
#
+$CMP C
+D Unpolarized capacitor
+$ENDCMP
+#
$CMP D
D Diode
$ENDCMP
#
+$CMP L
+D Inductor
+$ENDCMP
+#
$CMP MOS_N
D Transistor N-MOSFET, collector connected to mounting plane (general)
K nmos n-mos n-mosfet transistor
@@ -34,4 +42,9 @@ D Transistor PNP (general)
K pnp transistor
$ENDCMP
#
+$CMP R
+D Resistor
+K R DEV
+$ENDCMP
+#
#End Doc Library
diff --git a/kicadSchematicLibrary/eSim_Devices.lib b/kicadSchematicLibrary/eSim_Devices.lib
index 9c093d3a..1ea1ab4c 100644
--- a/kicadSchematicLibrary/eSim_Devices.lib
+++ b/kicadSchematicLibrary/eSim_Devices.lib
@@ -1,6 +1,28 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
+# C
+#
+DEF C C 0 10 N Y 1 F N
+F0 "C" 25 100 50 H V L CNN
+F1 "C" 25 -100 50 H V L CNN
+F2 "" 38 -150 30 H V C CNN
+F3 "" 0 0 60 H V C CNN
+$FPLIST
+ C?
+ C_????_*
+ C_????
+ SMD*_c
+ Capacitor*
+$ENDFPLIST
+DRAW
+P 2 0 1 20 -80 -30 80 -30 N
+P 2 0 1 20 -80 30 80 30 N
+X ~ 1 0 150 110 D 40 40 1 1 P
+X ~ 2 0 -150 110 U 40 40 1 1 P
+ENDDRAW
+ENDDEF
+#
# D
#
DEF D D 0 40 N N 1 F N
@@ -23,6 +45,23 @@ X K 2 150 0 100 L 40 40 1 1 P
ENDDRAW
ENDDEF
#
+# L
+#
+DEF L L 0 40 N N 1 F N
+F0 "L" 1950 500 50 H V C CNN
+F1 "L" 1950 650 50 H V C CNN
+F2 "" 1950 550 60 V V C CNN
+F3 "" 1950 550 60 V V C CNN
+DRAW
+A 1802 550 48 11 -1811 0 1 0 N 1849 551 1754 551
+A 1899 550 51 11 -1811 0 1 0 N 1949 551 1848 551
+A 1999 550 51 11 -1811 0 1 0 N 2049 551 1948 551
+A 2100 550 50 11 -1811 0 1 0 N 2149 551 2050 551
+X 1 1 1650 550 100 R 70 70 1 1 P
+X 2 2 2250 550 100 L 70 70 1 1 P
+ENDDRAW
+ENDDEF
+#
# MOS_N
#
DEF MOS_N M 0 0 Y N 1 F N
@@ -153,4 +192,22 @@ X E 3 100 -200 100 U 50 50 1 1 E
ENDDRAW
ENDDEF
#
+# R
+#
+DEF R R 0 0 N Y 1 F N
+F0 "R" 50 130 50 H V C CNN
+F1 "R" 50 50 50 H V C CNN
+F2 "" 50 -20 30 H V C CNN
+F3 "" 50 50 30 V V C CNN
+$FPLIST
+ R_*
+ Resistor_*
+$ENDFPLIST
+DRAW
+S 150 10 -50 90 0 1 10 N
+X ~ 1 -100 50 50 R 60 60 1 1 P
+X ~ 2 200 50 50 L 60 60 1 1 P
+ENDDRAW
+ENDDEF
+#
#End Library
diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py
index 2cc9761c..2015798d 100644
--- a/src/modelEditor/ModelEditor.py
+++ b/src/modelEditor/ModelEditor.py
@@ -422,14 +422,19 @@ class ModelEditorclass(QtGui.QWidget):
libfile.write('+ ' + tags + '=' + text +'\n')
libfile.write(')')
libfile.close()
- for params in self.tree.findall('param'):
- self.root.remove(params)
- param = ET.SubElement(self.root,'param')
+
+ root = ET.Element("library")
+ ET.SubElement(root, "model_name").text = self.model_name
+ ET.SubElement(root, "ref_model").text = self.ref_model
+ param = ET.SubElement(root, "param")
for tags, text in self.modeldict.items():
ET.SubElement(param, tags).text = text
- self.tree.write(editfile)
- self.obj_appconfig.print_info('Updated library ' + libpath)
+ tree = ET.ElementTree(root)
+
+ tree.write(os.path.join(xmlpath,filename +".xml"))
+ self.obj_appconfig.print_info('Updated library ' + libpath)
+
def removeparameter(self):
self.savebtn.setDisabled(False)
index = self.modeltable.currentIndex()