diff options
Diffstat (limited to 'src/kicadtoNgspice')
-rw-r--r-- | src/kicadtoNgspice/Analysis.py | 47 | ||||
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 20 | ||||
-rw-r--r-- | src/kicadtoNgspice/DeviceModel.py | 2 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 1 | ||||
-rw-r--r-- | src/kicadtoNgspice/Model.py | 4 | ||||
-rw-r--r-- | src/kicadtoNgspice/Processing.py | 6 | ||||
-rw-r--r-- | src/kicadtoNgspice/Source.py | 21 |
7 files changed, 66 insertions, 35 deletions
diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index c5981f4d..eaa46390 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -8,17 +8,22 @@ import json class Analysis(QtGui.QWidget): """ - - This class create Analysis Tab in KicadtoNgspice Window. - - Set various track widget options here - - AC_entry_var - - AC_Parameter - - DC_entry_var - - DC_Parameter - - TRAN_entry_var - - TRAN_Parameter - - set_Checkbox - - AC_type - - op_check + - This class create Analysis Tab in KicadtoNgspice Window. 4 sections - + - - Select Analysis Type + - - AC Analysis + - - DC Analysis + - - Transient Analysis + - Set various track widget options here, for tracking purposes across\ + different functions and modules - + - - AC_entry_var + - - AC_Parameter + - - DC_entry_var + - - DC_Parameter + - - TRAN_entry_var + - - TRAN_Parameter + - - set_Checkbox + - - AC_type + - - op_check """ def __init__(self, clarg1): @@ -39,10 +44,11 @@ class Analysis(QtGui.QWidget): """ - Create the main anaylsis widget overwiew - - Checkbox for analysis type - - - Respective analysis type group, AC, DC, TRAN... + - - Place, `AC`, `DC` and `TRANSIENT` analysis tab + - - `self.acbox`, `self.dcbox`,`self.trbox`... - Check for `analysis` file, if any in projDir, extract data from it - Else set the default checkbox to `TRAN` - - Accordingly set state for track widget options + - Accordingly set state for track widget options, as `TRAN`, `AC` ... """ self.grid = QtGui.QGridLayout() self.grid.addWidget(self.createCheckBox(), 0, 0) @@ -138,7 +144,7 @@ class Analysis(QtGui.QWidget): def enableBox(self): """ - - Activate deactive analysis areas according to type + - Activate analysis areas according to checkBox marked - Add analysis data to track_obj from TrackWidget """ if self.checkAC.isChecked(): @@ -336,7 +342,7 @@ class Analysis(QtGui.QWidget): self.ac_parameter[1] = str(text) def set_ac_type(self): - """S + """ - Set track object for AC, according to the type of radio box selected """ self.parameter_cnt = 0 @@ -634,21 +640,27 @@ class Analysis(QtGui.QWidget): # Below 6 functions to handle combo boxes for the DC group def start_changecombo(self, text): + """Handle start combo box, ie. units, as mV, V...""" self.dc_parameter[0] = str(text) def increment_changecombo(self, text): + """Handle increment combo box, ie. units, as mV, V...""" self.dc_parameter[1] = str(text) def stop_changecombo(self, text): + """Handle stop combo box, ie. units, as mV, V...""" self.dc_parameter[2] = str(text) def start_changecombo2(self, text): + """Handle second start combo box, ie. units, as mV, V...""" self.dc_parameter[3] = str(text) def increment_changecombo2(self, text): + """Handle second increment combo box, ie. units, as mV, V...""" self.dc_parameter[4] = str(text) def stop_changecombo2(self, text): + """Handle second stop combo box, ie. units, as mV, V...""" self.dc_parameter[5] = str(text) def setflag(self): @@ -668,7 +680,7 @@ class Analysis(QtGui.QWidget): - - Step time - - Stop time - Input boxes for values, combo boxes for unit - - Accordingly also event handleres for combo boxes, creates 3 functions + - Accordingly also event handlers for combo boxes, creates 3 functions """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) @@ -803,10 +815,13 @@ class Analysis(QtGui.QWidget): ''' def start_combo_change(self, text): + """Handle start combo box, ie. units, as second, ms""" self.tran_parameter[0] = str(text) def step_combo_change(self, text): + """Handle step combo box, ie. units, as second, ms...""" self.tran_parameter[1] = str(text) def stop_combo_change(self, text): + """Handle stop combo box, ie. units, as second, ms...""" self.tran_parameter[2] = str(text) diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 8280f9e7..883ba534 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -8,8 +8,16 @@ from xml.etree import ElementTree as ET class Convert: """ - - This class has all the necessary function required to convert + - This class has all the necessary function required to convert \ kicad netlist to ngspice netlist. + - Method List + - - addDeviceLibrary + - - addModelParameter + - - addSourceParameter + - - addSubcircuit + - - analysisInsertor + - - converttosciform + - - defaultvalue """ def __init__(self, sourcelisttrack, source_entry_var, @@ -22,7 +30,15 @@ class Convert: def addSourceParameter(self): """ - - This function add the source details to schematicInfo + - This function extracts the source details to schematicInfo + - keywords recognised and parsed - + - - sine + - - pulse + - - pwl + - - ac + - - dc + - - exp + - Return updated schematic """ self.start = 0 diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index e1367181..7f63a43b 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -7,7 +7,7 @@ from . import TrackWidget class DeviceModel(QtGui.QWidget): """ - - This class creates Device Library Tab in KicadtoNgspice Window + - This class creates Device Library Tab in KicadtoNgspice Window It dynamically creates the widget for device like diode,mosfet, transistor and jfet. - Same function as the subCircuit file, except for diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index ef9201cb..f760bce2 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -41,7 +41,6 @@ class MainWindow(QtGui.QWidget): - clarg1 is the path to the .cir file - clarg2 is either None or "sub" depending on the analysis type """ - def __init__(self, clarg1, clarg2=None): QtGui.QWidget.__init__(self) print("==================================") diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index a182dd4e..6ebfcb52 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -115,8 +115,8 @@ class Model(QtGui.QWidget): self.obj_trac.model_entry_var [self.nextcount].setText( str(list(json_data - ["model"][mod]["values"] - [i].values())[0])) + ["model"][mod]["values"] + [i].values())[0])) ) i = i + 1 except BaseException: diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 216383e6..ebbd3429 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -16,7 +16,6 @@ class PrcocessNetlist: """ - Read the circuit file and return splitted lines """ - def readNetlist(self, filename): f = open(filename) data = f.read() @@ -32,7 +31,6 @@ class PrcocessNetlist: - Read Parameter information and store it into dictionary - kicadNetlis is the .cir file content """ - def readParamInfo(self, kicadNetlis): param = {} print("=========================KICADNETLIST========================") @@ -57,7 +55,6 @@ class PrcocessNetlist: - Preprocess netlist (replace parameters) - Separate infoline (first line) from the rest of netlist """ - def preprocessNetlist(self, kicadNetlis, param): netlist = [] for eachline in kicadNetlis: @@ -128,7 +125,6 @@ class PrcocessNetlist: - Then check for type whether ac, dc, sine, etc... - Handle starting with h and f as well """ - def insertSpecialSourceParam(self, schematicInfo, sourcelist): schematicInfo1 = [] print("=============================================================") @@ -466,7 +462,7 @@ class PrcocessNetlist: "a" + str(k) + " (" + words[1] + " " + words[2] + ") (interNode_" + str(interMediateNodeCount) + " " + words[3] + ") " - ) + ) modelLine += compName + "_primary" schematicInfo.append(modelLine) k = k + 1 diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py index c9d50a26..26555197 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -27,16 +27,21 @@ class Source(QtGui.QWidget): def createSourceWidget(self, sourcelist, sourcelisttrack): """ - - This function dynamically create source widget in the + - This function dynamically create source widget in the \ Source tab of KicadtoNgSpice window - - Depending on the type of source, ac, dc, sine, pwl, etc... - source tab is created - - All the entry fields, are kept into the entry_var + - Depending on the type of source, sourcetab is created + - - ac + - - dc + - - sine + - - pulse + - - pwl + - - exp + - All the entry fields, are kept into the entry_var \ tracked by self.count - - Finally after each of the sourcelist is mapped to its input component - we move to adding these to the track widget - - Also check if any default values present from previous analysis & add - them by default + - Finally after each of the sourcelist is mapped to its input \ + component we move to adding these to the track widget + - Also check if any default values present from previous analysis \ + & add them by default - Each line in sourcelist corresponds to a source - According to the source type modify the source and add it to the tab """ |