diff options
-rwxr-xr-x | src/frontEnd/ViewManagement.py | 9 | ||||
-rw-r--r-- | src/frontEnd/ViewManagement.pyc | bin | 3139 -> 3151 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Analysis.py | 353 | ||||
-rw-r--r-- | src/kicadtoNgspice/Analysis.pyc | bin | 7363 -> 11712 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 52 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 15 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.pyc | bin | 4289 -> 4646 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Processing.py | 78 | ||||
-rw-r--r-- | src/kicadtoNgspice/TrackWidget.py | 8 | ||||
-rw-r--r-- | src/modelParamXML/Analog/gain.xml | 2 |
10 files changed, 379 insertions, 138 deletions
diff --git a/src/frontEnd/ViewManagement.py b/src/frontEnd/ViewManagement.py index 8264c033..8299e295 100755 --- a/src/frontEnd/ViewManagement.py +++ b/src/frontEnd/ViewManagement.py @@ -46,6 +46,8 @@ class ViewManagement(QtGui.QSplitter): self.addView(QtGui.QTextEdit, 'ProjectExplorer') self.addView(QtGui.QTextEdit, 'ProjectToolbar') self.addView(QtGui.QTextEdit, 'CurrentProject') + self.addView(QtGui.QTextEdit, 'Browser') + def setupView(self): #setup views to define various areas, such as placement of individual views @@ -93,6 +95,8 @@ class ViewManagement(QtGui.QSplitter): self.pcb_btn.clicked.connect(self.obj_kicad.openLayout) self.grid.addWidget(self.pcb_btn,1,1) + #self.temp = QtGui.QSplitter() + #self.temp.setOrientation(QtCore.Qt.Vertical) # bind the top level views into the framework self.views['ProjectExplorer'].setParent(self) @@ -104,9 +108,12 @@ class ViewManagement(QtGui.QSplitter): self.views['CurrentProject'].setParent(self.right) self.views['CurrentProject'].setReadOnly(True) + #self.views['Browser'].setParent(self.right) + #self.views['Browser'].setReadOnly(True) + self.right.setParent(self) self.right.setSizes([20, 5]) - self.setSizes([5, 20]) + #self.setSizes([5, 20]) def addView(self, settype, name): diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc Binary files differindex 9c1cdf20..5decaa9e 100644 --- a/src/frontEnd/ViewManagement.pyc +++ b/src/frontEnd/ViewManagement.pyc diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index d16b5494..3684507c 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -1,15 +1,26 @@ -from PyQt4 import QtGui - +from PyQt4 import QtGui,QtCore +from PyQt4.Qt import QRect +import TrackWidget class Analysis(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) + self.track_obj= TrackWidget.TrackWidget() + self.count =0 + self.parameter_cnt=0 + self.ac_entry_var={} + self.dc_entry_var={} + self.tran_entry_var={} + self.ac_parameter={} + self.dc_parameter={} + self.tran_parameter= {} self.createAnalysisWidget() - + + def createAnalysisWidget(self): self.grid = QtGui.QGridLayout() - self.grid.addWidget(self.createCheckBobx(),0,0) + self.grid.addWidget(self.createCheckBox(),0,0) self.grid.addWidget(self.createACgroup(),1,0) self.grid.addWidget(self.createDCgroup(),2,0) self.grid.addWidget(self.createTRANgroup(),3,0) @@ -37,9 +48,8 @@ class Analysis(QtGui.QWidget): self.setLayout(self.grid) self.show() - - - def createCheckBobx(self): + + def createCheckBox(self): self.checkbox = QtGui.QGroupBox() self.checkbox.setTitle("Select Analysis Type") self.checkgrid = QtGui.QGridLayout() @@ -58,8 +68,7 @@ class Analysis(QtGui.QWidget): self.checkgrid.addWidget(self.checkDC,0,1) self.checkgrid.addWidget(self.checkTRAN,0,2) self.checkbox.setLayout(self.checkgrid) - - + #CSS ''' self.checkbox.setStyleSheet(" \ @@ -76,86 +85,114 @@ class Analysis(QtGui.QWidget): self.acbox.setDisabled(False) self.dcbox.setDisabled(True) self.trbox.setDisabled(True) + self.track_obj.set_CheckBox["ITEMS"]="AC" + elif self.checkDC.isChecked(): self.dcbox.setDisabled(False) self.acbox.setDisabled(True) self.trbox.setDisabled(True) - + self.track_obj.set_CheckBox["ITEMS"]="DC" + elif self.checkTRAN.isChecked(): self.trbox.setDisabled(False) self.acbox.setDisabled(True) self.dcbox.setDisabled(True) - - + self.track_obj.set_CheckBox["ITEMS"]="TRAN" + def createACgroup(self): self.acbox = QtGui.QGroupBox() self.acbox.setTitle("AC Analysis") self.acgrid = QtGui.QGridLayout() + self.radiobuttongroup= QtGui.QButtonGroup() self.Lin = QtGui.QRadioButton("Lin") self.Dec = QtGui.QRadioButton("Dec") self.Oct = QtGui.QRadioButton("Oct") + self.radiobuttongroup.addButton(self.Lin) + self.radiobuttongroup.addButton(self.Dec) + self.radiobuttongroup.addButton(self.Oct) + self.radiobuttongroup.setExclusive(True) + self.radiobuttongroup.buttonClicked.connect(self.set_ac_type) self.acgrid.addWidget(self.Lin,1,1) self.acgrid.addWidget(self.Dec,1,2) self.acgrid.addWidget(self.Oct,1,3) self.acbox.setDisabled(True) self.acbox.setLayout(self.acgrid) - - self.Scale = QtGui.QLabel("Scale") - self.Start_Frequency = QtGui.QLabel("Start Frequency") - self.Stop_Frequency = QtGui.QLabel("Stop Frequency") - self.No_of_Points = QtGui.QLabel("No.of Points") - #self.Scale.setMaximumWidth(150) - #self.Start_Frequency.setMaximumWidth(150) - #self.Stop_Frequency.setMaximumWidth(150) - #self.No_of_Points.setMaximumWidth(150) - self.acgrid.addWidget(self.Scale,1,0) - self.acgrid.addWidget(self.Start_Frequency,2,0) - self.acgrid.addWidget(self.Stop_Frequency,3,0) - self.acgrid.addWidget(self.No_of_Points,4,0) - - self.Start_Frequency = QtGui.QLineEdit(self) - self.Stop_Frequency = QtGui.QLineEdit() - self.No_of_Points = QtGui.QLineEdit() - self.acgrid.addWidget(self.Start_Frequency,2,1) - self.acgrid.addWidget(self.Stop_Frequency,3,1) - self.acgrid.addWidget(self.No_of_Points,4,1) - self.Start_Frequency.setMaximumWidth(150) - self.Stop_Frequency.setMaximumWidth(150) - self.No_of_Points.setMaximumWidth(150) - - #self.lineEdit1.setGeometry() - - self.Start_Frequency = QtGui.QComboBox() - self.Start_Frequency.addItem("Hz",) - self.Start_Frequency.addItem("KHz") - self.Start_Frequency.addItem("MHz") - self.Start_Frequency.addItem("GHz") - self.Start_Frequency.addItem("THz") - #self.Start_Frequency.setMaximumWidth(150) - self.acgrid.addWidget(self.Start_Frequency,2,2) - self.Stop_Frequency = QtGui.QComboBox() - self.Stop_Frequency.addItem("Hz") - self.Stop_Frequency.addItem("KHz") - self.Stop_Frequency.addItem("MHz") - self.Stop_Frequency.addItem("GHz") - self.Stop_Frequency.addItem("THz") - self.Stop_Frequency.setMaximumWidth(150) - self.acgrid.addWidget(self.Stop_Frequency,3,2) - - - - - + + self.scale = QtGui.QLabel("Scale") + self.start_fre_lable = QtGui.QLabel("Start Frequency") + self.stop_fre_lable = QtGui.QLabel("Stop Frequency") + self.no_of_points = QtGui.QLabel("No.of Points") + self.acgrid.addWidget(self.scale,1,0) + self.acgrid.addWidget(self.start_fre_lable,2,0) + self.acgrid.addWidget(self.stop_fre_lable,3,0) + self.acgrid.addWidget(self.no_of_points,4,0) + + self.count=0 + self.ac_entry_var[self.count] = QtGui.QLineEdit() + self.acgrid.addWidget(self.ac_entry_var[self.count],2,1) + self.ac_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.ac_entry_var[self.count] = QtGui.QLineEdit() + self.acgrid.addWidget(self.ac_entry_var[self.count],3,1) + self.ac_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.ac_entry_var[self.count] = QtGui.QLineEdit() + self.acgrid.addWidget(self.ac_entry_var[self.count],4,1) + self.ac_entry_var[self.count].setMaximumWidth(150) + + self.parameter_cnt=0 + self.start_fre_combo = QtGui.QComboBox() + self.start_fre_combo.addItem("Hz",) + self.start_fre_combo.addItem("KHz") + self.start_fre_combo.addItem("MHz") + self.start_fre_combo.addItem("GHz") + self.start_fre_combo.addItem("THz") + self.start_fre_combo.setMaximumWidth(150) + self.acgrid.addWidget(self.start_fre_combo,2,2) + self.ac_parameter[self.parameter_cnt]= self.start_fre_combo.currentText() + self.start_fre_combo.activated[str].connect(self.start_combovalue) + + self.parameter_cnt=self.parameter_cnt + 1 + self.stop_fre_combo = QtGui.QComboBox() + self.stop_fre_combo.addItem("Hz") + self.stop_fre_combo.addItem("KHz") + self.stop_fre_combo.addItem("MHz") + self.stop_fre_combo.addItem("GHz") + self.stop_fre_combo.addItem("THz") + self.stop_fre_combo.setMaximumWidth(150) + self.acgrid.addWidget(self.stop_fre_combo,3,2) + self.ac_parameter[self.parameter_cnt]= self.stop_fre_combo.currentText() + self.stop_fre_combo.activated[str].connect(self.stop_combovalue) + + self.track_obj.AC_entry_var["ITEMS"]=self.ac_entry_var + self.track_obj.AC_Parameter["ITEMS"]=self.ac_parameter #CSS self.acbox.setStyleSheet(" \ QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \ - ") - + ") return self.acbox + def start_combovalue(self, text): + self.ac_parameter[self.parameter_cnt]= str(text) + + def stop_combovalue(self, text): + self.ac_parameter[self.parameter_cnt+1]= str(text) + + def set_ac_type(self): + self.parameter_cnt=0 + if self.Lin.isChecked(): + self.track_obj.AC_type["ITEMS"]="lin" + elif self.Dec.isChecked(): + self.track_obj.AC_type["ITEMS"]= "dec" + elif self.Oct.isChecked(): + self.track_obj.AC_type["ITEMS"]="oct" + else: + pass + print "AC type is ", self.Lin.isChecked + def createDCgroup(self): self.dcbox = QtGui.QGroupBox() self.dcbox.setTitle("DC Analysis") @@ -166,19 +203,37 @@ class Analysis(QtGui.QWidget): self.source_name= QtGui.QLabel('Enter Source Name',self) self.source_name.setMaximumWidth(150) - self.start= QtGui.QLabel('Start', self) + self.start= QtGui.QLabel('start', self) self.start.setMaximumWidth(150) self.increment=QtGui.QLabel('Increment',self) self.increment.setMaximumWidth(150) - self.stop=QtGui.QLabel('Stop',self) + self.stop=QtGui.QLabel('stop',self) self.stop.setMaximumWidth(150) - self.start_spin= QtGui.QSpinBox() - self.increment_spin= QtGui.QSpinBox() - self.stop_spin= QtGui.QSpinBox() - self.inputbox=QtGui.QLineEdit(self) - self.inputbox.setMaximumWidth(200) - self.check=QtGui.QCheckBox('Operating Point Analysis',self) + + self.dcgrid.addWidget(self.source_name,1,0) + self.dcgrid.addWidget(self.start,2,0) + self.dcgrid.addWidget(self.increment,3,0) + self.dcgrid.addWidget(self.stop,4,0) + + self.count=0 + self.dc_entry_var[self.count] = QtGui.QLineEdit() + self.dcgrid.addWidget(self.dc_entry_var[self.count],1,1) + self.dc_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.dc_entry_var[self.count] = QtGui.QLineEdit() + self.dcgrid.addWidget(self.dc_entry_var[self.count],2,1) + self.dc_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.dc_entry_var[self.count] = QtGui.QLineEdit() + self.dcgrid.addWidget(self.dc_entry_var[self.count],3,1) + self.dc_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.dc_entry_var[self.count] = QtGui.QLineEdit() + self.dcgrid.addWidget(self.dc_entry_var[self.count],4,1) + self.dc_entry_var[self.count].setMaximumWidth(150) + + self.parameter_cnt=0 self.start_combo=QtGui.QComboBox(self) self.start_combo.setMaximumWidth(150) self.start_combo.addItem('volts or Amperes') @@ -186,6 +241,10 @@ class Analysis(QtGui.QWidget): self.start_combo.addItem('uV or uA') self.start_combo.addItem("nV or nA") self.start_combo.addItem("pV or pA") + self.dcgrid.addWidget(self.start_combo,2,2) + self.dc_parameter[self.parameter_cnt]= self.start_combo.currentText() + self.start_combo.activated[str].connect(self.start_changecombo) + self.parameter_cnt= self.parameter_cnt+1 self.increment_combo=QtGui.QComboBox(self) self.increment_combo.setMaximumWidth(150) @@ -194,6 +253,10 @@ class Analysis(QtGui.QWidget): self.increment_combo.addItem("uV or uA") self.increment_combo.addItem("nV or nA") self.increment_combo.addItem("pV or pA") + self.dcgrid.addWidget(self.increment_combo,3,2) + self.dc_parameter[self.parameter_cnt]= str(self.increment_combo.currentText()) + self.increment_combo.activated[str].connect(self.increment_changecombo) + self.parameter_cnt= self.parameter_cnt+1 self.stop_combo=QtGui.QComboBox(self) self.stop_combo.setMaximumWidth(150) @@ -202,27 +265,20 @@ class Analysis(QtGui.QWidget): self.stop_combo.addItem("uV or uA") self.stop_combo.addItem("nV or nA") self.stop_combo.addItem("pV or pA") - - self.dcgrid.addWidget(self.source_name,1,0) - self.dcgrid.addWidget(self.inputbox,1,1) - - self.dcgrid.addWidget(self.start,2,0) - self.dcgrid.addWidget(self.start_spin,2,1) - self.dcgrid.addWidget(self.start_combo,2,2) - - self.dcgrid.addWidget(self.increment,3,0) - self.dcgrid.addWidget(self.increment_spin,3,1) - self.dcgrid.addWidget(self.increment_combo,3,2) - - self.dcgrid.addWidget(self.stop,4,0) - self.dcgrid.addWidget(self.stop_spin,4,1) self.dcgrid.addWidget(self.stop_combo,4,2) + self.stop_combo.activated[str].connect(self.stop_changecombo) + self.dc_parameter[self.parameter_cnt]= str(self.stop_combo.currentText()) + self.parameter_cnt= self.parameter_cnt+1 + self.check=QtGui.QCheckBox('Operating Point Analysis',self) + if(self.check.isChecked()): + self.flagcheck = 1 + + else: + self.flagcheck= 2 self.dcgrid.addWidget(self.check,5,1,5,2) - #self.dcgrid.addWidget(self.simulation_button,6,1,6,2)''' - - - + self.track_obj.DC_entry_var["ITEMS"]=self.dc_entry_var + self.track_obj.DC_Parameter["ITEMS"]=self.dc_parameter #CSS self.dcbox.setStyleSheet(" \ @@ -233,55 +289,82 @@ class Analysis(QtGui.QWidget): return self.dcbox + def start_changecombo(self,text): + self.parameter_cnt=0 + self.dc_parameter[self.parameter_cnt]=text + + def increment_changecombo(self,text): + self.dc_parameter[self.parameter_cnt+1]=text + + def stop_changecombo(self,text): + self.dc_parameter[self.parameter_cnt+2]=text + def createTRANgroup(self): self.trbox = QtGui.QGroupBox() self.trbox.setTitle("Transient Analysis") self.trgrid = QtGui.QGridLayout() - + self.trbox.setDisabled(True) self.trbox.setLayout(self.trgrid) - self.Start_Time = QtGui.QLabel("Start Time") - self.Step_Time = QtGui.QLabel("Step Time") - self.Stop_Time = QtGui.QLabel("Stop Time") - self.trgrid.addWidget(self.Start_Time,1,0) - self.trgrid.addWidget(self.Step_Time,2,0) - self.trgrid.addWidget(self.Stop_Time,3,0) - - self.Start_Time = QtGui.QLineEdit() - self.Step_Time = QtGui.QLineEdit() - self.Stop_Time = QtGui.QLineEdit() - self.trgrid.addWidget(self.Start_Time,1,1) - self.trgrid.addWidget(self.Step_Time,2,1) - self.trgrid.addWidget(self.Stop_Time,3,1) - - self.Start_Time = QtGui.QComboBox() - self.Start_Time.addItem("Sec") - self.Start_Time.addItem("ms") - self.Start_Time.addItem("us") - self.Start_Time.addItem("ns") - self.Start_Time.addItem("ps") - self.trgrid.addWidget(self.Start_Time,1,2) - - self.Step_Time = QtGui.QComboBox() - self.Step_Time.addItem("Sec") - self.Step_Time.addItem("ms") - self.Step_Time.addItem("us") - self.Step_Time.addItem("ns") - self.Step_Time.addItem("ps") - self.trgrid.addWidget(self.Step_Time,2,2) - - self.Stop_Time = QtGui.QComboBox() - self.Stop_Time.addItem("Sec") - self.Stop_Time.addItem("ms") - self.Stop_Time.addItem("us") - self.Stop_Time.addItem("ns") - self.Stop_Time.addItem("ps") - self.trgrid.addWidget(self.Stop_Time,3,2) - - - - + self.start = QtGui.QLabel("start Time") + self.step = QtGui.QLabel("Step Time") + self.stop = QtGui.QLabel("stop Time") + self.trgrid.addWidget(self.start,1,0) + self.trgrid.addWidget(self.step,2,0) + self.trgrid.addWidget(self.stop,3,0) + self.count=0 + + self.tran_entry_var[self.count] = QtGui.QLineEdit() + self.trgrid.addWidget(self.tran_entry_var[self.count],1,1) + self.tran_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.tran_entry_var[self.count] = QtGui.QLineEdit() + self.trgrid.addWidget(self.tran_entry_var[self.count],2,1) + self.tran_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + self.tran_entry_var[self.count] = QtGui.QLineEdit() + self.trgrid.addWidget(self.tran_entry_var[self.count],3,1) + self.tran_entry_var[self.count].setMaximumWidth(150) + self.count= self.count+1 + + self.parameter_cnt=0 + self.start_combobox = QtGui.QComboBox() + self.start_combobox.addItem("Sec") + self.start_combobox.addItem("ms") + self.start_combobox.addItem("us") + self.start_combobox.addItem("ns") + self.start_combobox.addItem("ps") + self.trgrid.addWidget(self.start_combobox,1,3) + self.tran_parameter[self.parameter_cnt]=self.start_combobox.currentText() + self.start_combobox.activated[str].connect(self.start_combo_change) + self.parameter_cnt= self.parameter_cnt+1 + + self.step_combobox = QtGui.QComboBox() + self.step_combobox.addItem("Sec") + self.step_combobox.addItem("ms") + self.step_combobox.addItem("us") + self.step_combobox.addItem("ns") + self.step_combobox.addItem("ps") + self.trgrid.addWidget(self.step_combobox,2,3) + self.tran_parameter[self.parameter_cnt]=self.step_combobox.currentText() + self.step_combobox.activated[str].connect(self.step_combo_change) + self.parameter_cnt= self.parameter_cnt+1 + + self.stop_combobox = QtGui.QComboBox() + self.stop_combobox.addItem("Sec") + self.stop_combobox.addItem("ms") + self.stop_combobox.addItem("us") + self.stop_combobox.addItem("ns") + self.stop_combobox.addItem("ps") + self.trgrid.addWidget(self.stop_combobox,3,3) + self.tran_parameter[self.parameter_cnt]=self.stop_combobox.currentText() + self.stop_combobox.activated[str].connect(self.stop_combo_change) + self.parameter_cnt= self.parameter_cnt+1 + + self.track_obj.TRAN_entry_var["ITEMS"]=self.tran_entry_var + self.track_obj.TRAN_Parameter["ITEMS"]=self.tran_parameter + #CSS self.trbox.setStyleSheet(" \ QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \ @@ -289,4 +372,14 @@ class Analysis(QtGui.QWidget): ") - return self.trbox
\ No newline at end of file + return self.trbox + + def start_combo_change(self,text): + self.parameter_cnt=0 + self.tran_parameter[self.parameter_cnt]=text + + def step_combo_change(self,text): + self.tran_parameter[self.parameter_cnt+1]=text + + def stop_combo_change(self,text): + self.tran_parameter[self.parameter_cnt+2]=text diff --git a/src/kicadtoNgspice/Analysis.pyc b/src/kicadtoNgspice/Analysis.pyc Binary files differindex d5883762..e1a12cda 100644 --- a/src/kicadtoNgspice/Analysis.pyc +++ b/src/kicadtoNgspice/Analysis.pyc diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 26010d9e..fff00dab 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -1,4 +1,5 @@ - +import os +import sys class Convert: def __init__(self,sourcelisttrack,source_entry_var,schematicInfo): @@ -107,4 +108,51 @@ class Convert: return self.schematicInfo def addModelParameter(self,schematicInfo): - print "Schematic info after adding source detail",schematicInfo
\ No newline at end of file + print "Schematic info after adding source detail",schematicInfo + + def analysisInsertor(self,ac_entry_var,dc_entry_var, tran_entry_var,set_checkbox,ac_parameter,dc_parameter,tran_parameter,ac_type): + self.ac_entry_var = ac_entry_var + self.dc_entry_var = dc_entry_var + self.tran_entry_var = tran_entry_var + self.set_checkbox = set_checkbox + self.ac_parameter= ac_parameter + self.dc_parameter= dc_parameter + self.trans_parameter = tran_parameter + self.ac_type= ac_type + self.no=0 + + self.variable=self.set_checkbox + self.direct= sys.argv[1] + (filepath, filemname)= os.path.split(self.direct) + self.Fileopen = os.path.join(filepath, "analysis") + self.writefile= open(self.Fileopen,"w") + + if self.variable== 'AC': + self.no=0 + self.writefile.write(".ac " + self.ac_type + ' ' + str(self.ac_entry_var[self.no].text()) + ' ' + self.ac_parameter[self.no]+ ' ' + str(self.ac_entry_var[self.no+1].text()) + ' '+ self.ac_parameter[self.no+1] + ' ' + str(self.ac_entry_var[self.no+2].text())) + + elif self.variable=='DC': + self.no=0 + self.writefile.write(".dc " + str(self.dc_entry_var[self.no+1].text())+ ' ' + self.converttosciform(self.dc_parameter[self.no]) + ' '+ str(self.dc_entry_var[self.no+2].text())+ ' ' + self.converttosciform(self.dc_parameter[self.no+1]) + ' '+ str(self.dc_entry_var[self.no+3].text())+ ' ' + self.converttosciform(self.dc_parameter[self.no+2])) + + elif self.variable == 'TRAN': + self.no= 0 + self.writefile.write(".tran " + str(self.tran_entry_var[self.no].text())+ ' ' + self.converttosciform(self.trans_parameter[self.no]) + ' ' + str(self.tran_entry_var[self.no+1].text()) + ' ' + self.converttosciform(self.trans_parameter[self.no+1]) + ' ' + str(self.tran_entry_var[self.no+2].text()) + ' '+ self.converttosciform(self.trans_parameter[self.no+2])) + + else: + pass + self.writefile.close() + + def converttosciform(self, string_obj): + self.string_obj = string_obj + if self.string_obj[0] == 'm': + return "e-03" + elif self.string_obj[0] == 'u': + return "e-06" + elif self.string_obj[0] == 'n': + return "e-09" + elif self.string_obj[0] == 'p': + return "e-12" + else: + return "e-00" +
\ No newline at end of file diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 55e6c360..94d044db 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -16,6 +16,7 @@ # REVISION: --- #=============================================================================== import sys +import os from PyQt4 import QtGui,QtCore from Processing import PrcocessNetlist import Analysis @@ -31,7 +32,7 @@ class MainWindow(QtGui.QWidget): QtGui.QWidget.__init__(self) #Create object of track widget self.obj_track = TrackWidget.TrackWidget() - + print "Init Kicad to Ngspice" #print "Current Project",sys.argv[1] @@ -87,6 +88,7 @@ class MainWindow(QtGui.QWidget): Calling Convert Class Constructor """ global schematicInfo + global analysisoutput self.obj_convert = Convert.Convert(self.obj_track.sourcelisttrack["ITEMS"], self.obj_track.source_entry_var["ITEMS"], schematicInfo) @@ -95,6 +97,16 @@ class MainWindow(QtGui.QWidget): schematicInfo = self.obj_convert.addSourceParameter() #print "Schematic After adding source parameter",schematicInfo schematicInfo = self.obj_convert.addModelParameter(schematicInfo) + + analysisoutput = self.obj_convert.analysisInsertor(self.obj_track.AC_entry_var["ITEMS"], + self.obj_track.DC_entry_var["ITEMS"], + self.obj_track.TRAN_entry_var["ITEMS"], + self.obj_track.set_CheckBox["ITEMS"], + self.obj_track.AC_Parameter["ITEMS"], + self.obj_track.DC_Parameter["ITEMS"], + self.obj_track.TRAN_Parameter["ITEMS"], + self.obj_track.AC_type["ITEMS"]) + @@ -153,6 +165,7 @@ def main(args): schematicInfo,outputOption,modelList,unknownModelList,multipleModelList = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList) print "Unknown Model List",unknownModelList print "Multple Model List",multipleModelList + print "Model List",modelList diff --git a/src/kicadtoNgspice/KicadtoNgspice.pyc b/src/kicadtoNgspice/KicadtoNgspice.pyc Binary files differindex 5a3f1e57..7fc34021 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.pyc +++ b/src/kicadtoNgspice/KicadtoNgspice.pyc diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 3a2bcb37..ce19877f 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -216,6 +216,7 @@ class PrcocessNetlist: index=schematicInfo.index(compline) compType=words[len(words)-1]; schematicInfo.remove(compline) + paramDict = {} print "Compline",compline print "CompType",compType print "Words",words @@ -230,20 +231,89 @@ class PrcocessNetlist: if xmlfile in all_file: count += 1 modelPath.append(os.path.join(each_dir,xmlfile)) - + if count > 1: multipleModelList.append(modelPath) elif count == 0: unknownModelList.append(compType) elif count == 1: try: + print "Start Parsing :",modelPath tree = ET.parse(modelPath[0]) - #root = parsemodel.getroot() + + root = tree.getroot() + #Getting number of nodes for model and title for child in tree.iter(): - print "Child Item",child + if child.tag == 'node_number': + num_of_nodes = int(child.text) + elif child.tag == 'title': + title = child.text+" "+compName + elif child.tag == 'name': + modelname = child.text + elif child.tag == 'type': + #Checking for Analog and Digital + type = child.text + elif child.tag == 'split': + splitDetail = child.text + + #print "Child Item",child #print "Tag",child.tag #print "Tag Value",child.text - + + for param in tree.findall('param'): + for item in param: + #print "Tags ",item.tag + #print "Value",item.text + paramDict[item.tag] = item.text + + + print "Number of Nodes : ",num_of_nodes + print "Title : ",title + print "Parameters",paramDict + #Creating line for adding model line in schematic + if splitDetail == 'None': + modelLine = "a"+str(k)+" " + for i in range(1,num_of_nodes+1): + modelLine += words[i]+" " + modelLine += compName + + else: + print "Split Details :",splitDetail + modelLine = "a"+str(k)+" " + vectorDetail = splitDetail.split(':') + print "Vector Details",vectorDetail + pos = 1 #Node position + for item in vectorDetail: + try: + if item.split("-")[1] == 'V': + print "Vector" + modelLine += "[" + for i in range(0,int(item.split("-")[0])): + modelLine += words[pos]+" " + pos += 1 + modelLine += "] " + elif item.split("-")[1] == 'NV': + print "Non Vector" + for i in range(0,int(item.split("-")[0])): + modelLine += words[pos]+" " + pos += 1 + + except: + print "There is error while processing Vector Details" + sys.exit(2) + modelLine += compName + + print "Final Model Line :",modelLine + try: + schematicInfo.append(modelLine) + k=k+1 + except Exception as e: + print "Error while appending ModelLine ",modelLine + print "Excpetion Message : ",str(e) + #Insert comment at remove line + schematicInfo.insert(index,"* "+compline) + comment = "* "+modelname+" "+compType + modelList.append([index,compline,compType,compName,comment,title,type,paramDict]) except: print "Unable to parse the model, Please check your your xml file" sys.exit(2) diff --git a/src/kicadtoNgspice/TrackWidget.py b/src/kicadtoNgspice/TrackWidget.py index 1c600d79..e2321656 100644 --- a/src/kicadtoNgspice/TrackWidget.py +++ b/src/kicadtoNgspice/TrackWidget.py @@ -5,4 +5,12 @@ class TrackWidget: """ sourcelisttrack = {"ITEMS":"None"} source_entry_var = {"ITEMS":"None"} + AC_entry_var = {"ITEMS":"None"} + AC_Parameter = {"ITEMS":"None"} + DC_entry_var = {"ITEMS":"None"} + DC_Parameter = {"ITEMS":"None"} + TRAN_entry_var = {"ITEMS":"None"} + TRAN_Parameter = {"ITEMS":"None"} + set_CheckBox = {"ITEMS":"None"} + AC_type = {"ITEMS":"None"}
\ No newline at end of file diff --git a/src/modelParamXML/Analog/gain.xml b/src/modelParamXML/Analog/gain.xml index 2bce2a66..6e5788ed 100644 --- a/src/modelParamXML/Analog/gain.xml +++ b/src/modelParamXML/Analog/gain.xml @@ -3,9 +3,11 @@ <type>Analog</type> <node_number>2</node_number> <title>Add Parameter for model gain</title> +<split>None</split> <param> <in_offset>Enter offset for input (default=0.0):</in_offset> <gain>Enter gain (default=1.0):</gain> + <gain abc="OK">Enter gain (default=1.0):</gain> <out_offset>Enter offset for output (default=0.0):</out_offset> </param> </model>
\ No newline at end of file |