diff options
Diffstat (limited to 'src/kicadtoNgspice/Processing.py')
-rw-r--r-- | src/kicadtoNgspice/Processing.py | 84 |
1 files changed, 72 insertions, 12 deletions
diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 63847761..bd1b45dc 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -13,15 +13,29 @@ class PrcocessNetlist: def __init__(self): pass + """ + - Read the circuit file and return splitted lines + """ + def readNetlist(self, filename): f = open(filename) data = f.read() f.close() + print("=============================================================") + print("readNetList called, from Processing") + print("=============================================================") + print("NETLIST", data.splitlines()) + print("=============================================================") return data.splitlines() + """ + - Read Parameter information and store it into dictionary + - kicadNetlis is the .cir file content + """ + def readParamInfo(self, kicadNetlis): - """Read Parameter information and store it into dictionary""" param = {} + print("=========================KICADNETLIST========================") for eachline in kicadNetlis: print(eachline) eachline = eachline.strip() @@ -32,10 +46,18 @@ class PrcocessNetlist: for i in range(1, len(words), 1): paramList = words[i].split('=') param[paramList[0]] = paramList[1] + print("=============================================================") + print("readParamInfo called, from Processing") + print("=============================================================") + print("PARAM", param) + print("=============================================================") return param + """ + - Preprocess netlist (replace parameters) + """ + def preprocessNetlist(self, kicadNetlis, param): - """Preprocess netlist (replace parameters)""" netlist = [] for eachline in kicadNetlis: # Remove leading and trailing blanks spaces from line @@ -66,6 +88,12 @@ class PrcocessNetlist: # Copy information line infoline = netlist[0] netlist.remove(netlist[0]) + print("=============================================================") + print("preprocessNetList called, from Processing") + print("=============================================================") + print("NETLIST", netlist) + print("INFOLINE", infoline) + print("=============================================================") return netlist, infoline def separateNetlistInfo(self, netlist): @@ -78,14 +106,24 @@ class PrcocessNetlist: optionInfo.append(eachline) else: schematicInfo.append(eachline) + print("=============================================================") + print("separateNetlistInfo called, from Processing") + print("=============================================================") + print("OPTIONINFO", optionInfo) + print("SCHEMATICINFO", schematicInfo) + print("=============================================================") return optionInfo, schematicInfo + """ + - Insert Special source parameter + - As per the parameters passed create source list + """ + def insertSpecialSourceParam(self, schematicInfo, sourcelist): - # Inser Special source parameter schematicInfo1 = [] - + print("=============================================================") print("Reading schematic info for source details") - + print("=============================================================") for compline in schematicInfo: words = compline.split() compName = words[0] @@ -171,10 +209,17 @@ class PrcocessNetlist: schematicInfo = schematicInfo + schematicInfo1 print("Source List : ", sourcelist) # print schematicInfo + print("=============================================================") + print("insertSpecialSourceParam called, from Processing") + print("=============================================================") + print("SCHEMATICINFO", schematicInfo) + print("SOURCELIST", sourcelist) + print("=============================================================") return schematicInfo, sourcelist def convertICintoBasicBlocks( self, schematicInfo, outputOption, modelList, plotText): + print("=============================================================") print("Reading Schematic info for Model") # Insert details of Ngspice model unknownModelList = [] @@ -228,6 +273,8 @@ class PrcocessNetlist: unknownModelList.append(compType) elif count == 1: try: + print("==========================================\ + ===========================") print( "Start Parsing Previous Values XML\ for ngspice model :", modelPath) @@ -265,7 +312,7 @@ class PrcocessNetlist: if 'default' in item.attrib: paramDict[item.tag + ":" + item.attrib['default']] \ - = temp_list + = temp_list else: paramDict[item.tag] = item.text @@ -273,7 +320,7 @@ class PrcocessNetlist: if 'default' in item.attrib: paramDict[item.tag + ":" + item.attrib['default']]\ - = item.text + = item.text else: paramDict[item.tag] = item.text @@ -288,6 +335,8 @@ class PrcocessNetlist: modelLine += compName else: + print("=====================================\ + ================================") print("Split Details :", splitDetail) modelLine = "a" + str(k) + " " vectorDetail = splitDetail.split(':') @@ -302,7 +351,7 @@ class PrcocessNetlist: for i in range(0, int( item.split("-")[0])): modelLine += words[pos] +\ - " " + " " pos += 1 modelLine += ") " else: @@ -310,7 +359,7 @@ class PrcocessNetlist: for i in range(0, int( item.split("-")[0])): modelLine += words[pos] + \ - " " + " " pos += 1 modelLine += "] " elif item.split("-")[1] == 'NV': @@ -436,16 +485,27 @@ class PrcocessNetlist: else: schematicInfo.insert(index, "* " + compline) - + print("=====================================================") print( "UnknownModelList Used in the Schematic", unknownModelList) + print("=====================================================") print( "Multiple Model XML file with same name ", multipleModelList) + print("=====================================================") print("Model List Details : ", modelList) - + print("=============================================================") + print("convertICIntoBasicBlocks called, from Processing") + print("=============================================================") + print("SCHEMATICINFO", schematicInfo) + print("OUTPUTOPTION", outputOption) + print("MODELLIST", modelList) + print("UNKOWNMODELLIST", unknownModelList) + print("MULTIPLEMODELLIST", multipleModelList) + print("PLOTTEST", plotText) + print("=============================================================") return ( schematicInfo, outputOption, modelList, unknownModelList, multipleModelList, plotText - ) + ) |