diff options
author | GauravSupal | 2015-06-30 14:43:38 +0530 |
---|---|---|
committer | GauravSupal | 2015-06-30 14:43:38 +0530 |
commit | f2201054f1602c2252228adcbc9335d8aa18dbac (patch) | |
tree | 25611e8878b6c0131128eede5916661c71d4aaf9 /src/kicadtoNgspice/Convert.py | |
parent | f7cf0e9a67627ed6ce73892a75445ba84e6b9b21 (diff) | |
parent | 0dfbb704aa843baeb75b1f20acbe72fc57ee7707 (diff) | |
download | eSim-f2201054f1602c2252228adcbc9335d8aa18dbac.tar.gz eSim-f2201054f1602c2252228adcbc9335d8aa18dbac.tar.bz2 eSim-f2201054f1602c2252228adcbc9335d8aa18dbac.zip |
Merge pull request #1 from FOSSEE/master
Update
Diffstat (limited to 'src/kicadtoNgspice/Convert.py')
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index baf842d9..3b87e863 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -227,8 +227,24 @@ class Convert: modelParamValue.append([line[0],addmodelLine,line[4]]) addmodelLine=".model "+line[3]+"_secondary lcouple (num_turns ="+num_turns2+ ")" modelParamValue.append([line[0],addmodelLine,line[4]]) - except: + except Exception as e: print "Caught an exception in transfo model ",line[1] + print "Exception Message : ",str(e) + + elif line[2] == 'ic': + try: + start=line[5] + end=line[6] + for key,value in line[9].iteritems(): + initVal = str(self.obj_track.model_entry_var[value].text()) + if initVal=="":initVal="0" + node = line[1].split()[1] #Extracting node from model line + addmodelLine = ".ic v("+node+")="+initVal + modelParamValue.append([line[0],addmodelLine,line[4]]) + except Exception as e: + print "Caught an exception in initial condition ",line[1] + print "Exception Message : ",str(e) + else: try: @@ -264,21 +280,24 @@ class Convert: addmodelLine += param+"="+paramVal+" " - - - + addmodelLine += ") " modelParamValue.append([line[0],addmodelLine,line[4]]) - except: - print "Caught an exception in gain model ",line[1] + except Exception as e: + print "Caught an exception in model ",line[1] + print "Exception Message : ",str(e) #Adding it to schematic for item in modelParamValue: - schematicInfo.append(item[2]) #Adding Comment - schematicInfo.append(item[1]) #Adding model line - + if ".ic" in item[1]: + schematicInfo.insert(0,item[1]) + schematicInfo.insert(0,item[2]) + else: + schematicInfo.append(item[2]) #Adding Comment + schematicInfo.append(item[1]) #Adding model line + print "MYSCH------->",schematicInfo return schematicInfo def addDeviceLibrary(self,schematicInfo,kicadFile): |