Exemplo n.º 1
0
 def makeStation(self, index, envy):
     name = 'STAT_' + str(index)
     cin = Store(envy)
     cout = Store(envy)
     v = Vision('VIS_' + str(index), self.accuracyParameter)
     s = Station(name, cin, cout)
     s.setVision(v)
     Blackboard().get('[Shared]packages')[name] = None
     Blackboard().get('[Shared]packages.dirtybit')[name] = True
     return name, s
Exemplo n.º 2
0
 def __init__(self, nname, mmtbf=0, mmttr=0):
     super().__init__(nname)
     self.owner = None
     self.mtbf = mmtbf
     self.mttr = mmttr
     board = Blackboard()
     self.finalTime = board.get('stoptime')
     self.debugLevel = board.get('debugLevel')
     self.working = True
     self.process = self.env.process(self.run())
Exemplo n.º 3
0
 def __init__(self, orderchannel):
     super().__init__('AGV', 0, 0)
     b = Blackboard()
     transportationTime = b.get('[agv]time')
     num = b.get('[agv]number')
     self.env = b.get('enviro')
     self.vehicles = list()
     for i in range(0, num):
         vchannel = Store(self.env)
         v = Vehicle('Vehicle_' + str(i), transportationTime, vchannel)
         self.vehicles.append((v, vchannel))
     self.orderChannel = orderchannel
Exemplo n.º 4
0
 def do(self):
     if (self.onrun == True):
         query = yield self.inqueue.get()
         #self.log('got packet;'+str(query)+';',0)
         yield self.env.process(self.movement())
         Blackboard().get('[Shared]packages')[self.name[:-3]] = query
         Blackboard().get('[Shared]packages.dirtybit')[
             self.name[:-3]] = False
         query = yield self.inqueue.get()
         #self.log('got remove;;',0)
         yield self.env.process(self.movement())
         self.outqueue.put(
             Blackboard().get('[Shared]packages')[self.name[:-3]])
         Blackboard().get('[Shared]packages')[self.name[:-3]] = None
         Blackboard().get('[Shared]packages.dirtybit')[
             self.name[:-3]] = True
Exemplo n.º 5
0
 def run(self):
     while True:
         time = self.env.now
         received = yield self.order.get()
         Recorder().addMC('agv', 'vehicle1', self.env.now - time)
         movorder, putchannel, getchannel = received
         b = Blackboard()
         black_cap = b.get('[pallet]capacity')
         black_flag = b.get('[pallet]homogeneous')
         pallet = None
         if (movorder == MovementOrder.DRPI) or (movorder
                                                 == MovementOrder.INBD):
             black_size = b.get('[requirements]ordersize')
             pallet = PalletFactory.generate(black_cap, black_size,
                                             black_flag, None)
         else:
             requirements = CustomerRequirementFactory.generate(
                 b.get('[requirements]ordersize'))
             pallet = PalletFactory.generate(black_cap, 0, black_flag,
                                             requirements)
         if (movorder == MovementOrder.DRPI) or (movorder
                                                 == MovementOrder.DRPO):
             putchannel.put('REMOVE')
             yield self.env.timeout(self.transportationTime)
             package = yield getchannel.get()
         self.log('loading station;;', 2)
         yield self.env.timeout(self.transportationTime)
         putchannel.put(pallet)
Exemplo n.º 6
0
 def __init__(self, name, commchannel):
     b = Blackboard()
     self.controller = RobotProgram(name + '_sw', commchannel,
                                    b.get('[robot]time'),
                                    b.get('[robot]precision'))
     self.structure = Performing(name + '_hw', self.controller,
                                 b.get('[robot]mtbf'), b.get('[robot]mttr'))
Exemplo n.º 7
0
 def __init__(self, nname, fin, fout):
     self.name = nname
     self.channelIN = fin
     self.channelOUT = fout
     b = Blackboard()
     self.controller = StationLogic(nname + '_sw', b.get('[gate]opentime'),
                                    b.get('[gate]belttime'), fin, fout)
     self.structure = Performing(nname + '_hw', self.controller,
                                 b.get('[gate]mtbf'), b.get('[gate]mttr'))
Exemplo n.º 8
0
 def do(self):
     if (self.onrun == True):
         self.log('is waiting to get work;;', 1)
         time = self.env.now
         (iname, inpacket, kind, oname, outpacket,
          accuracy) = yield self.channel.get()
         Recorder().add('robot_idle', self.env.now - time)
         self.log(
             'getting the product from;' + iname + ' ' + str(inpacket) +
             ';', 1)
         #self.log('putting the product to;' + oname + ' ' + str(outpacket)+ ';',1)
         inpacket = Blackboard().get('[Shared]packages')[iname]
         outpacket = Blackboard().get('[Shared]packages')[oname]
         #self.log('getting the product from;' + iname + ' ' + str(inpacket)+ ';',1)
         #self.log('putting the product to;' + oname + ' ' + str(outpacket)+ ';',1)
         p = inpacket.pop()
         yield self.env.timeout(self.movementTime)
         newi = self.gripManagement(p.integrity, accuracy)
         p.integrity = newi
         outpacket.add(p)
         #self.log('got the product from;' + iname + ' ' + str(inpacket)+ ';',1)
         self.log(
             'put the product to;' + oname + ' ' + str(outpacket) + ';', 1)
         self.channel.put('DONE')
Exemplo n.º 9
0
 def dirt(self):
     Blackboard().get('[Shared]packages.dirtybit')[self.name] = True
Exemplo n.º 10
0
 def operative(self):
     return Blackboard().get('[Shared]packages.dirtybit')[
         self.name] == False
Exemplo n.º 11
0
 def getPallet(self):
     return Blackboard().get('[Shared]packages')[self.name]
Exemplo n.º 12
0
 def getMissingProducts(self):
     return Blackboard().get('[Shared]packages')[
         self.name].getMissingProducts()
Exemplo n.º 13
0
 def __init__(self, nname, agvcommchannel):
     super().__init__(nname)
     b = Blackboard()
     self.rbs = RuleBasedSystem(b.get('[RBS]maxattempts'))
     envy = b.get('enviro')
     self.accuracyParameter = b.get('[vision]accuracy')
     self.toagv = agvcommchannel
     #robot
     self.robotcomm = Store(envy)
     self.robot = Robot('robot', self.robotcomm)
     # stations
     ninputs = b.get('[stations]inumber')
     noutputs = b.get('[stations]onumber')
     nspas = b.get('[stations]spa')
     self.stations = dict()
     b.put('[Shared]packages', dict())
     b.put('[Shared]packages.dirtybit', dict())
     for sindex in range(0, ninputs):
         sname, stat = self.makeStation(sindex, envy)
         self.stations[sname] = (stat, StationDir.INPUT)
     for sindex in range(0, noutputs):
         sname, stat = self.makeStation(sindex + ninputs, envy)
         self.stations[sname] = (stat, StationDir.OUTPUT)
Exemplo n.º 14
0
 def __init__(self, name, agvchannel):
     b = Blackboard()
     self.controller = MainController(name + '_sw', agvchannel)
     self.structure = Performing(name + '_hw', self.controller,
                                 b.get('[controller]mtbf'),
                                 b.get('[controller]mttr'))