diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ngspicetoModelica/NgspicetoModelica.py | 13 |
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 |