fix error with EMANE CommEffect model with loss/duplicate % string values
(Boeing r1800)
This commit is contained in:
parent
5390f280e3
commit
6babc9895e
1 changed files with 11 additions and 8 deletions
|
@ -23,13 +23,6 @@ try:
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def z(x):
|
|
||||||
''' Helper to use 0 for None values. '''
|
|
||||||
if x is None:
|
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
return x
|
|
||||||
|
|
||||||
class EmaneCommEffectModel(EmaneModel):
|
class EmaneCommEffectModel(EmaneModel):
|
||||||
def __init__(self, session, objid = None, verbose = False):
|
def __init__(self, session, objid = None, verbose = False):
|
||||||
EmaneModel.__init__(self, session, objid, verbose)
|
EmaneModel.__init__(self, session, objid, verbose)
|
||||||
|
@ -96,7 +89,16 @@ class EmaneCommEffectModel(EmaneModel):
|
||||||
loss = None, duplicate = None, jitter = None, netif2 = None):
|
loss = None, duplicate = None, jitter = None, netif2 = None):
|
||||||
''' Generate CommEffect events when a Link Message is received having
|
''' Generate CommEffect events when a Link Message is received having
|
||||||
link parameters.
|
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
|
service = self.session.emane.service
|
||||||
if service is None:
|
if service is None:
|
||||||
self.session.warn("%s: EMANE event service unavailable" % \
|
self.session.warn("%s: EMANE event service unavailable" % \
|
||||||
|
@ -106,6 +108,7 @@ class EmaneCommEffectModel(EmaneModel):
|
||||||
self.session.warn("%s: missing NEM information" % self._name)
|
self.session.warn("%s: missing NEM information" % self._name)
|
||||||
return
|
return
|
||||||
# TODO: batch these into multiple events per transmission
|
# TODO: batch these into multiple events per transmission
|
||||||
|
# TODO: may want to split out seconds portion of delay and jitter
|
||||||
event = emaneeventcommeffect.EventCommEffect(1)
|
event = emaneeventcommeffect.EventCommEffect(1)
|
||||||
index = 0
|
index = 0
|
||||||
e = self.session.obj(self.objid)
|
e = self.session.obj(self.objid)
|
||||||
|
|
Loading…
Reference in a new issue