summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py11
-rw-r--r--src/kicadtoNgspice/Processing.py32
2 files changed, 36 insertions, 7 deletions
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index a3e41a5f..df776e7e 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -92,11 +92,12 @@ class MainWindow(QtGui.QWidget):
print "SCHEMATICINFO",schematicInfo
#List storing model detail
- global modelList,outputOption,unknownModelList,multipleModelList
+ global modelList,outputOption,unknownModelList,multipleModelList,plotText
modelList = []
outputOption = []
- schematicInfo,outputOption,modelList,unknownModelList,multipleModelList = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList)
+ plotText = []
+ schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList,plotText)
print "Unknown Model List",unknownModelList
print "Multiple Model List",multipleModelList
print "Model List",modelList
@@ -495,7 +496,7 @@ class MainWindow(QtGui.QWidget):
print "Analysis OutPut------>",analysisoutput
#Calling netlist file generation function
- self.createNetlistFile(store_schematicInfo)
+ self.createNetlistFile(store_schematicInfo,plotText)
self.msg = "The Kicad to Ngspice Conversion completed successfully!!!!!!"
QtGui.QMessageBox.information(self, "Information", self.msg, QtGui.QMessageBox.Ok)
@@ -513,7 +514,7 @@ class MainWindow(QtGui.QWidget):
if self.clarg2 == "sub":
self.createSubFile(subPath)
- def createNetlistFile(self,store_schematicInfo):
+ def createNetlistFile(self,store_schematicInfo,plotText):
print "Creating Final netlist"
#print "INFOLINE",infoline
#print "OPTIONINFO",optionInfo
@@ -603,6 +604,8 @@ class MainWindow(QtGui.QWidget):
#out.writelines(outputOption)
out.writelines('print allv > plot_data_v.txt\n')
out.writelines('print alli > plot_data_i.txt\n')
+ for item in plotText:
+ out.writelines(item+'\n')
out.writelines('.endc\n')
out.writelines('.end\n')
out.close()
diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py
index b0f60826..123dce1e 100644
--- a/src/kicadtoNgspice/Processing.py
+++ b/src/kicadtoNgspice/Processing.py
@@ -152,10 +152,12 @@ class PrcocessNetlist:
return schematicInfo,sourcelist
- def convertICintoBasicBlocks(self,schematicInfo,outputOption,modelList):
+ def convertICintoBasicBlocks(self,schematicInfo,outputOption,modelList,plotText):
#Insert details of Ngspice model
unknownModelList = []
multipleModelList = []
+ plotList = ['plot_v1','plot_v2','plot_i2','plot_log','plot_db']
+
k = 1
for compline in schematicInfo:
words = compline.split()
@@ -177,7 +179,7 @@ class PrcocessNetlist:
print "Words",words
print "compName",compName
#Looking if model file is present
- if compType != "port" and compType != "ic":
+ if compType != "port" and compType != "ic" and compType not in plotList:
xmlfile = compType+".xml" #XML Model File
count = 0 #Check if model of same name is present
modelPath = []
@@ -304,14 +306,38 @@ class PrcocessNetlist:
text = "Enter initial voltage at node for "+compline
paramDict[title] = text
modelList.append([index,compline,modelname,compName,comment,title,type,paramDict])
+
+ elif compType in plotList:
+ print "Plot Data---------->"
+ schematicInfo.insert(index,"* "+compline)
+ if compType == 'plot_v1':
+ words = compline.split()
+ plotText.append("plot v("+words[1]+")")
+ elif compType == 'plot_v2':
+ words = compline.split()
+ plotText.append("plot v("+words[1]+","+words[2]+")")
+ elif compType == 'plot_i2':
+ words = compline.split()
+ #Adding zero voltage source to netlist
+ schematicInfo.append("v_"+words[0]+" "+words[1]+" "+words[2]+" "+"0")
+ plotText.append("plot i(v_"+words[0]+")")
+ elif compType == 'plot_log':
+ words = compline.split()
+ plotText.append("plot log("+words[1]+")")
+ elif compType == 'plot_db':
+ words = compline.split()
+ plotText.append("plot db("+words[1]+")")
+
else:
schematicInfo.insert(index,"* "+compline)
+
+
#print "Count",count
#print "UnknownModelList",unknownModelList
#print "MultipleModelList",multipleModelList
- return schematicInfo,outputOption,modelList,unknownModelList,multipleModelList
+ return schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText
\ No newline at end of file