summaryrefslogtreecommitdiff
path: root/src/ngspicetoModelica/NgspicetoModelica.py
diff options
context:
space:
mode:
authorrahulp132020-04-13 16:55:31 +0530
committerrahulp132020-04-13 16:55:31 +0530
commitaa75ea9814d9893fc02564dc25e5444ce5ea3439 (patch)
tree7fd041516ceb0f906f000008366065cc7e905db5 /src/ngspicetoModelica/NgspicetoModelica.py
parent6a0ef73be748b4e885d4288dede37fc76ad95158 (diff)
downloadeSim-aa75ea9814d9893fc02564dc25e5444ce5ea3439.tar.gz
eSim-aa75ea9814d9893fc02564dc25e5444ce5ea3439.tar.bz2
eSim-aa75ea9814d9893fc02564dc25e5444ce5ea3439.zip
merged PR #131
Diffstat (limited to 'src/ngspicetoModelica/NgspicetoModelica.py')
-rw-r--r--src/ngspicetoModelica/NgspicetoModelica.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py
index a78bad1b..5dff56e0 100644
--- a/src/ngspicetoModelica/NgspicetoModelica.py
+++ b/src/ngspicetoModelica/NgspicetoModelica.py
@@ -365,9 +365,9 @@ class NgMoConverter:
stat = stat + \
self.getUnitVal(words[i - 1]) + ',' + \
self.getUnitVal(words[i]) + ';'
- stat = stat + ']);'
+ stat = stat[:-1] + ']);'
modelicaCompInit.append(stat)
- if typ[0] == words[3] and typ[0] != "dc":
+ if typ[0] == words[3] and typ[0] != "dc" and typ[0] != "ac":
# It is DC constant but no dc keyword
val_temp = typ[0].split('v')
stat = self.mappingData["Sources"][sourceType]["dc"] + \
@@ -382,10 +382,17 @@ class NgMoConverter:
'(V = ' + \
self.getUnitVal(words[4]) + ');' # check this
modelicaCompInit.append(stat)
+ elif typ[0] == words[3] and typ[0] == "ac":
+ stat = self.mappingData["Sources"][sourceType][typ[0]] + \
+ ' ' + \
+ compName + \
+ '(V = ' + \
+ self.getUnitVal((words[4])) + ');'
+ modelicaCompInit.append(stat)
elif sourceType == 'i':
stat = self.mappingData["Sources"][sourceType]["dc"] + \
- ' ' + compName + '(I=' + self.getUnitVal(words[3]) + ');'
+ ' ' + compName + '(I=' + self.getUnitVal(words[4]) + ');'
modelicaCompInit.append(stat)
# Now empty the source list as it may be used by subcircuit