summaryrefslogtreecommitdiff
path: root/src/ngspicetoModelica/NgspicetoModelica.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ngspicetoModelica/NgspicetoModelica.py')
-rw-r--r--src/ngspicetoModelica/NgspicetoModelica.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py
index c89c742b..6fe75516 100644
--- a/src/ngspicetoModelica/NgspicetoModelica.py
+++ b/src/ngspicetoModelica/NgspicetoModelica.py
@@ -214,12 +214,17 @@ class NgMoConverter:
def getUnitVal(self,compValue):
print "Received compValue--------> ",compValue
- regExp = re.compile("([0-9]+)([a-zA-Z]+)")
+ #regExp = re.compile("([0-9]+)([a-zA-Z]+)")
+ regExp = re.compile("([0-9]+)\.?([0-9]+)?([a-zA-Z])?")
matchString = regExp.match(str(compValue)) #separating number and string
try:
- numValue = matchString.group(1)
- unitValue = matchString.group(2)
- modifiedcompValue = numValue+self.mappingData["Units"][unitValue]
+ valBeforeDecimal = matchString.group(1)
+ valAfterDecimal = matchString.group(2)
+ unitValue = matchString.group(3)
+ if str(valAfterDecimal)=='None':
+ modifiedcompValue = valBeforeDecimal+self.mappingData["Units"][unitValue]
+ else:
+ modifiedcompValue = valBeforeDecimal+'.'+valAfterDecimal+self.mappingData["Units"][unitValue]
return modifiedcompValue
except:
return compValue