Commit 6ccd5026 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Ioannis Papagiannopoulos

corrections and tests

parent 8cdf3ca8
......@@ -38,6 +38,16 @@ class RandomNumberGenerator(object):
# ...
# },
def __init__(self, obj, distribution):
# check in case an inknown distrbution was given
unknownDistribution=True
for key in distribution.keys():
if key in ['Fixed', 'Normal','Exp','Gamma','Logistic','Erlang',
'Geometric','Lognormal','Weibull','Cauchy']:
unknownDistribution=False
break
if unknownDistribution:
raise ValueError("Unknown distribution %r used in %s %s" %
(distribution, obj.__class__, obj.id))
# pop irrelevant keys
for key in distribution.keys():
if key not in ['Fixed', 'Normal','Exp','Gamma','Logistic','Erlang',
......
......@@ -84,7 +84,7 @@ class Source(CoreObject):
def __init__(self, id, name, interArrivalTime=None, entity='Dream.Part',**kw):
# Default values
if not interArrivalTime:
interArrivalTime = {'distributionType': 'Fixed', 'mean': 1}
interArrivalTime = {'Fixed': {'mean': 1}}
if 'Normal' in interArrivalTime.keys() and\
interArrivalTime['Normal'].get('max', None) is None:
interArrivalTime['Normal']['max'] = interArrivalTime['Normal']['mean'] + 5 * interArrivalTime['Normal']['stdev']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment