Ejemplo n.º 1
0
 def run(self, model):
     create1 = model.modules["create1"]
     create2 = model.modules["create2"]
     rp_crea1 = create1.create_report_socket()
     rp_crea2 = create2.create_report_socket()
     dates1 = [0, 1, 3, 7, 12, 20, 30]
     requests1 = [
         emulation.Request("create1",
                           "create",
                           params={
                               'productType': 'type1',
                               'date': d
                           }) for d in dates1
     ]
     dates2 = [5, 6, 7, 9, 11, 23, 35]
     requests2 = [
         emulation.Request("create2",
                           "create",
                           params={
                               'productType': 'type1',
                               'date': d
                           }) for d in dates2
     ]
     yield emulation.put, self, create1.request_socket, requests1
     yield emulation.get, self, rp_crea1, 7
     yield emulation.put, self, create2.request_socket, requests2
     yield emulation.get, self, rp_crea2, 7
Ejemplo n.º 2
0
 def run(self, model):
     disposeModule = model.modules["dispose1"]
     observerModule = model.modules["observer1"]
     report = observerModule.create_report_socket()
     while True:
         yield emu.get, self, report, 1
         yield emu.put, self, disposeModule.request_socket, [emu.Request("dispose1","dispose",date=emu.now()+4)]
Ejemplo n.º 3
0
 def run(self, model):
     n = 0
     createModule = model.modules["create1"]
     while n < 10:
         m = emu.Request("create1", "create")
         yield emu.put, self, createModule.request_socket, [m]
         yield emu.hold, self, 10
Ejemplo n.º 4
0
 def run(self, model):
     rq = emu.Request("create1", "create")
     yield emu.hold, self, 5
     model.insert_request(rq)
     yield emu.hold, self, 10
     model.insert_request(rq)
     yield emu.hold, self, 15
     model.insert_request(rq)
Ejemplo n.º 5
0
 def run(self, model):
     n = 0
     createModule = model.modules["create1"]
     report = createModule.create_report_socket()
     while n < 10:
         m = emu.Request("create1", "create")
         yield emu.put, self, createModule.request_socket, [m]
         yield emu.get, self, report, 1
         yield emu.hold, self, 10
Ejemplo n.º 6
0
 def run(self, model):
     del pos_list[:]
     obs = model.modules["observer2"]
     report = obs.create_report_socket()
     while True:
         yield emu.put, self, obs.request_socket, [emu.Request("observer2","observe", date = emu.now() + 0.5)]
         yield emu.get, self, report, 1
         r = self.got[0]
         pos_list.append((r.when, r.how['ID_by_position']))
Ejemplo n.º 7
0
 def run(self, model):
     trans = model.modules["trans"]
     assy = model.modules["assy"]
     rp_assy = assy.create_report_socket()
     obs1 = model.modules["obs_source1"]
     obs2 = model.modules["obs_source2"]
     rp_obs1 = obs1.create_report_socket()
     rp_obs2 = obs2.create_report_socket()
     obs_assy = model.modules["obs_assy"]
     rp_obs_assy = obs_assy.create_report_socket()
     while True:
         ##attente de l'arrivée d'un pièce
         logger.info("attente d'une piece")
         yield emulation.get, self, rp_obs1, 1
         logger.info("pce 1 prete")
         ev = self.got[0]
         logger.info("chargement")
         rq = emulation.Request("trans", "move", params={'program': 'load'})
         yield emulation.put, self, trans.request_socket, [rq]
         ##pièces prêtes
         yield emulation.get, self, rp_obs2, 1
         logger.info("pce 2 prete")
         yield emulation.get, self, rp_obs_assy, 1
         logger.info("pce assy chargée")
         #print self.got[0]
         #yield emulation.put, self, assy.request_socket, [emulation.Request("assy","setup", params={"program":'p'})]
         ##début process
         logger.info("process")
         yield emulation.put, self, assy.request_socket, [
             emulation.Request("assy", "assy", params={"program": 'p'})
         ]
         ##attente fin process
         fin = False
         while not fin:
             yield emulation.get, self, rp_assy, 1
             logger.info(self.got[0])
             fin = self.got[0].what == "idle"
         ##déchargement
         logger.info("dechargement")
         yield emulation.put, self, trans.request_socket, [
             emulation.Request("trans",
                               "move",
                               params={"program": 'unload'})
         ]
Ejemplo n.º 8
0
 def run(self, model):
     createModule = model.modules["create1"]
     requests = [emu.Request("create1", "create", date = t) for t in [0., 2., 4., 5., 6., 7., 7.5, 8.]]
     yield emu.put, self, createModule.request_socket, requests