Beispiel #1
0
 def __init__ (self, eid, mask, ts, ack, otp):
   self.msg_type = MSG_OTP_ACK
   self.eid = IPAddr(eid)		#EID to register
   #self.mask = struct.pack('>I', mask)#EID mask
   self.mask = mask
   gammaplain = Gamma(eid, mask, ts, ack, otp)
   self.gamma = gammaplain.encrypt()
   return
Beispiel #2
0
def Test2():
    env=simpy.Environment()
    gamma = Gamma([2,3],[0.4,0.6])
    B = EmbeddedBuffer(env,gamma)
    Source = Source_Geo(env,"Source",0.6,B)
    Server = Server_Geo(env,"Server",0.2,B)
    env.run(until=20)
    print ("Buffer average length = ",B.average_length)
    print ("Average throughput = ",Server.average_throughput)
    print ("Blocking probability = ",Source.blocking_probability)
Beispiel #3
0
def Simulate(y, rand_seed, simulation_length):

    env = simpy.Environment()
    random.seed(rand_seed)

    stencil, alphas = get_stencil_and_alphas(y, y_min_bound, y_max_bound,
                                             stencil_size, s, r)
    gamma = Gamma(stencil, alphas)
    C = EmbeddedBuffer(env, gamma)
    Source = Source_Geo(env, "Source", arrival_probability, C)
    Server = Server_Geo(env, "Server", service_probability, C)
    env.run(until=simulation_length)

    average_length = C.average_length
    average_throughput = Server.average_throughput
    blocking_probability = Source.blocking_probability

    return average_length, average_throughput, blocking_probability
Beispiel #4
0
def gamma(x):
    return Gamma(float(x))