summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfahim-oscad2016-05-06 12:53:50 +0530
committerfahim-oscad2016-05-06 12:53:50 +0530
commitc5a108d361ea264cbe33b8486e8ad0b6b32d252b (patch)
treec3509316d2bc7015046d73c5b88de4aeb9daa353
parente53b087fbe87c1857b3b04b0dbd4030e774f404d (diff)
downloadeSim-c5a108d361ea264cbe33b8486e8ad0b6b32d252b.tar.gz
eSim-c5a108d361ea264cbe33b8486e8ad0b6b32d252b.tar.bz2
eSim-c5a108d361ea264cbe33b8486e8ad0b6b32d252b.zip
Added JFET model
-rw-r--r--src/ngspicetoModelica/Mapping.json41
-rw-r--r--src/ngspicetoModelica/NgspicetoModelica.py49
2 files changed, 81 insertions, 9 deletions
diff --git a/src/ngspicetoModelica/Mapping.json b/src/ngspicetoModelica/Mapping.json
index 5d5d84d1..2600d65a 100644
--- a/src/ngspicetoModelica/Mapping.json
+++ b/src/ngspicetoModelica/Mapping.json
@@ -120,10 +120,43 @@
}
},
- "a" : "Analog.Semiconductors.Diode",
- "b" : "Analog.Semiconductors.Diode",
- "M" :"BondLib.Electrical.Analog.Spice"
-
+
+ "j":{
+ "import":"Analog.Semiconductors",
+ "mapping":{
+ "bf":"Bf",
+ "br":"Br",
+ "is":"Is",
+ "vak":"Vak",
+ "tf":"Tauf",
+ "tr":"Taur",
+ "cjs":"Ccs",
+ "cje":"Cje",
+ "cjc":"Cjc",
+ "vje":"Phie",
+ "mje":"Me",
+ "vjc":"Phic",
+ "mjc":"Mc"
+ },
+ "default":{
+ "Bf":"50",
+ "Br":"0.1",
+ "Is":"1e-16",
+ "Tauf":"1.2e-10",
+ "Taur":"5e-9",
+ "Vak":"0.02",
+ "Ccs":"1e-12",
+ "Cje":"4e-12",
+ "Cjc":"5e-13",
+ "Phie":"0.8",
+ "Me":"0.4",
+ "Phic":"0.8",
+ "Mc":"0.333"
+
+ }
+
+ }
+
},
diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py
index 3aabc72d..1e67c07b 100644
--- a/src/ngspicetoModelica/NgspicetoModelica.py
+++ b/src/ngspicetoModelica/NgspicetoModelica.py
@@ -74,6 +74,7 @@ class NgMoConverter:
self.ifMOS = True
schematicInfo.append(eachline)
self.deviceDetail.append(eachline)
+ print "Device Detail--------->",self.deviceDetail
elif eachline[0]=='x' or eachline[0]=='X':
schematicInfo.append(eachline)
self.subCktDetail.append(eachline)
@@ -121,7 +122,7 @@ class NgMoConverter:
trans = templine[1]
transInfo[trans] = []
templine[2] = templine[2].lower()
- if templine[2] in ['npn', 'pnp', 'pmos', 'nmos']:
+ if templine[2] in ['npn', 'pnp', 'pmos', 'nmos','njf','pjf']:
transInfo[trans] = templine[2]
else:
inbuiltModelDict[model]=templine[2]
@@ -154,7 +155,7 @@ class NgMoConverter:
trans_f = templine_f[1]
transInfo[trans_f] = []
templine_f[2] = templine_f[2].lower()
- if templine_f[2] in ['npn', 'pnp', 'pmos', 'nmos']:
+ if templine_f[2] in ['npn', 'pnp', 'pmos', 'nmos','njf','pjf']:
transInfo[trans_f] = templine_f[2]
refModelName = trans_f
@@ -171,6 +172,8 @@ class NgMoConverter:
modelInfo[refModelName][info[0]] = info[1]
f.close()
+ print "Model Info----->",modelInfo
+
return modelName, modelInfo, subcktName, paramInfo ,transInfo,inbuiltModelDict
@@ -393,7 +396,7 @@ class NgMoConverter:
elif trans == 'pnp':
start = self.mappingData["Devices"][deviceName]["import"]+".PNP"
else:
- print "Transistor "+trans+" Not found"
+ print "Transistor "+str(trans)+" Not found"
sys.exit(1)
stat = start+" "+words[0]+"("
@@ -444,7 +447,7 @@ class NgMoConverter:
elif trans=='pmos' :
start = self.mappingData["Devices"][deviceName]["import"]+".Mp"
else:
- print "MOSFET "+trans+" not found"
+ print "MOSFET "+str(trans)+" not found"
sys.exit(1)
@@ -508,7 +511,43 @@ class NgMoConverter:
stat += ",".join(str(item) for item in tempstatList)+");"
modelicaCompInit.append(stat)
-
+
+ elif deviceName=='j':
+ print "TransInfo---->",transInfo
+ trans = transInfo[words[4]]
+ if trans == 'njf':
+ start = self.mappingData["Devices"][deviceName]["import"]+".NJF"
+ elif trans == 'pjf':
+ start = self.mappingData["Devices"][deviceName]["import"]+".PJF"
+ else:
+ print "JFET "+str(trans)+" Not found"
+ sys.exit(1)
+
+ stat = start+" "+words[0]+"("
+ tempstatList=[]
+ userDeviceParamList=[]
+ refName = words[4]
+ for key in modelInfo[refName]:
+ #If parameter is not mapped then it will just pass
+ try:
+ actualModelicaParam = self.mappingData["Devices"][deviceName]["mapping"][key]
+ tempstatList.append(actualModelicaParam+"="+self.getUnitVal(modelInfo[refName][key])+" ")
+ userDeviceParamList.append(str(actualModelicaParam))
+ except:
+ pass
+ #Running loop over default parameter of OpenModelica
+ for default in self.mappingData["Devices"][deviceName]["default"]:
+ if default in userDeviceParamList:
+ continue
+ else:
+ defaultValue = self.mappingData["Devices"][deviceName]["default"][default]
+ tempstatList.append(default+"="+self.getUnitVal(defaultValue)+" ")
+
+ stat += ",".join(str(item) for item in tempstatList)+");"
+ modelicaCompInit.append(stat)
+
+
+
#Empty device details as well
self.deviceDetail[:]=[]