fix error with EMANE CommEffect model with loss/duplicate % string values

(Boeing r1800)
This commit is contained in:
ahrenholz 2013-12-03 19:48:06 +00:00
parent 5390f280e3
commit 6babc9895e

View file

@ -23,13 +23,6 @@ try:
except Exception, e:
pass
def z(x):
''' Helper to use 0 for None values. '''
if x is None:
return 0
else:
return x
class EmaneCommEffectModel(EmaneModel):
def __init__(self, session, objid = None, verbose = False):
EmaneModel.__init__(self, session, objid, verbose)
@ -96,7 +89,16 @@ class EmaneCommEffectModel(EmaneModel):
loss = None, duplicate = None, jitter = None, netif2 = None):
''' Generate CommEffect events when a Link Message is received having
link parameters.
'''
'''
def z(x):
''' Helper to use 0 for None values. '''
if type(x) is str:
x = float(x)
if x is None:
return 0
else:
return int(x)
service = self.session.emane.service
if service is None:
self.session.warn("%s: EMANE event service unavailable" % \
@ -106,6 +108,7 @@ class EmaneCommEffectModel(EmaneModel):
self.session.warn("%s: missing NEM information" % self._name)
return
# TODO: batch these into multiple events per transmission
# TODO: may want to split out seconds portion of delay and jitter
event = emaneeventcommeffect.EventCommEffect(1)
index = 0
e = self.session.obj(self.objid)