diff options
author | fahim | 2015-04-09 14:58:02 +0530 |
---|---|---|
committer | fahim | 2015-04-09 14:58:02 +0530 |
commit | 09278fca52c3d9779b86c97005f762c5719b88d9 (patch) | |
tree | 102d66c4cecfcae783da25ae3c29689a15cea778 /src/kicadtoNgspice/Convert.py | |
parent | e10b2de0bec4836b2dc134d56ed573ad1d633ce3 (diff) | |
download | eSim-09278fca52c3d9779b86c97005f762c5719b88d9.tar.gz eSim-09278fca52c3d9779b86c97005f762c5719b88d9.tar.bz2 eSim-09278fca52c3d9779b86c97005f762c5719b88d9.zip |
Subject: Analysis inserter functionality
Description: Added by Komal
Diffstat (limited to 'src/kicadtoNgspice/Convert.py')
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 52 |
1 files changed, 50 insertions, 2 deletions
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 |