summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/ngspicetoModelica/Mapping.json7
-rw-r--r--src/ngspicetoModelica/NgspicetoModelica.py13
2 files changed, 14 insertions, 6 deletions
diff --git a/library/ngspicetoModelica/Mapping.json b/library/ngspicetoModelica/Mapping.json
index e254d66a..b7c8df5d 100644
--- a/library/ngspicetoModelica/Mapping.json
+++ b/library/ngspicetoModelica/Mapping.json
@@ -13,10 +13,11 @@
},
"Sources":{
"v":{
- "pulse":"Analog.Sources.TrapezoidVoltage",
- "sine":"Analog.Sources.SineVoltage",
+ "pulse" : "Analog.Sources.TrapezoidVoltage",
+ "sine" : "Analog.Sources.SineVoltage",
"pwl" : "Analog.Sources.TableVoltage",
- "dc" : "Analog.Sources.ConstantVoltage"
+ "dc" : "Analog.Sources.ConstantVoltage",
+ "ac" : "Analog.Sources.ConstantVoltage"
},
"i":{
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