From fa480619f5a5d3035a922607f293d1daa5a01dc8 Mon Sep 17 00:00:00 2001 From: fahim Date: Tue, 9 Jun 2015 15:20:37 +0530 Subject: Subject: Adding functionality of .op analysis Description: Adding functionality of .op analysis --- src/kicadtoNgspice/Analysis.py | 18 ++++++++++++------ src/kicadtoNgspice/Convert.py | 12 ++++++++---- src/kicadtoNgspice/KicadtoNgspice.py | 3 ++- src/kicadtoNgspice/TrackWidget.py | 2 +- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index b679188d..22383c5b 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -322,11 +322,11 @@ class Analysis(QtGui.QWidget): 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.track_obj.op_check.append(0) + #QtCore.QObject.connect(check,SIGNAL("stateChanged()"),check,SLOT("checkedSlot")) + self.check.stateChanged.connect(self.setflag) + #self.flagcheck = 1 + #self.flagcheck= 2 self.dcgrid.addWidget(self.check,5,1,5,2) self.track_obj.DC_entry_var["ITEMS"]=self.dc_entry_var self.track_obj.DC_Parameter["ITEMS"]=self.dc_parameter @@ -365,7 +365,13 @@ class Analysis(QtGui.QWidget): def stop_changecombo(self,text): self.dc_parameter[2]=str(text) - + + def setflag(self): + if self.check.isChecked(): + self.track_obj.op_check.append(1) + else: + self.track_obj.op_check.append(0) + def createTRANgroup(self): kicadFile = sys.argv[1] (projpath,filename)=os.path.split(kicadFile) diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 25576f53..50b2f98b 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -117,7 +117,7 @@ class Convert: return self.schematicInfo - def analysisInsertor(self,ac_entry_var,dc_entry_var, tran_entry_var,set_checkbox,ac_parameter,dc_parameter,tran_parameter,ac_type): + def analysisInsertor(self,ac_entry_var,dc_entry_var, tran_entry_var,set_checkbox,ac_parameter,dc_parameter,tran_parameter,ac_type,op_check): """ This function creates an analysis file in current project """ @@ -129,6 +129,7 @@ class Convert: self.dc_parameter= dc_parameter self.trans_parameter = tran_parameter self.ac_type= ac_type + self.op_check = op_check self.no=0 self.variable=self.set_checkbox @@ -141,9 +142,12 @@ class Convert: self.writefile.write(".ac"+' ' + self.ac_type + ' '+ str(self.defaultvalue(self.ac_entry_var[self.no+2].text()))+' ' + str(self.defaultvalue(self.ac_entry_var[self.no].text())) + self.ac_parameter[self.no]+ ' ' + str(self.defaultvalue(self.ac_entry_var[self.no+1].text())) + self.ac_parameter[self.no+1] ) elif self.variable=='DC': - self.no=0 - self.writefile.write(".dc" +' '+ str(self.dc_entry_var[self.no].text())+ ' '+ str(self.defaultvalue(self.dc_entry_var[self.no+1].text())) + self.converttosciform(self.dc_parameter[self.no]) + ' '+ str(self.defaultvalue(self.dc_entry_var[self.no+3].text()))+ self.converttosciform(self.dc_parameter[self.no+2]) + ' '+ str(self.defaultvalue(self.dc_entry_var[self.no+2].text())) + self.converttosciform(self.dc_parameter[self.no+1])) - + if self.op_check[-1] == 1: + self.no=0 + self.writefile.write(".op") + elif self.op_check[-1] == 0: + self.no=0 + self.writefile.write(".dc" +' '+ str(self.dc_entry_var[self.no].text())+ ' '+ str(self.defaultvalue(self.dc_entry_var[self.no+1].text())) + self.converttosciform(self.dc_parameter[self.no]) + ' '+ str(self.defaultvalue(self.dc_entry_var[self.no+3].text()))+ self.converttosciform(self.dc_parameter[self.no+2]) + ' '+ str(self.defaultvalue(self.dc_entry_var[self.no+2].text())) + self.converttosciform(self.dc_parameter[self.no+1])) elif self.variable == 'TRAN': self.no= 0 self.writefile.write(".tran" + ' '+ str(self.defaultvalue(self.tran_entry_var[self.no+1].text())) + self.converttosciform(self.trans_parameter[self.no+1]) + ' ' + str(self.defaultvalue(self.tran_entry_var[self.no+2].text())) + self.converttosciform(self.trans_parameter[self.no+2])+' '+ str(self.defaultvalue(self.tran_entry_var[self.no].text()))+ self.converttosciform(self.trans_parameter[self.no])) diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 7c5f46b4..4677c20d 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -397,7 +397,8 @@ class MainWindow(QtGui.QWidget): self.obj_track.AC_Parameter["ITEMS"], self.obj_track.DC_Parameter["ITEMS"], self.obj_track.TRAN_Parameter["ITEMS"], - self.obj_track.AC_type["ITEMS"]) + self.obj_track.AC_type["ITEMS"], + self.obj_track.op_check) #print "SchematicInfo after adding Model Details",schematicInfo #Calling netlist file generation function diff --git a/src/kicadtoNgspice/TrackWidget.py b/src/kicadtoNgspice/TrackWidget.py index f6c4969d..23991a37 100644 --- a/src/kicadtoNgspice/TrackWidget.py +++ b/src/kicadtoNgspice/TrackWidget.py @@ -15,7 +15,7 @@ class TrackWidget: TRAN_Parameter = {"ITEMS":"None"} set_CheckBox = {"ITEMS":"None"} AC_type = {"ITEMS":"None"} - + op_check = [] #Track widget for Model detail modelTrack = [] model_entry_var = {} -- cgit