def removeEntity(self, entity):
     activeEntity = Machine.removeEntity(self, entity)
     if self.state == -1:
         activeEntity.status = "Bad"
     else:
         self.numGoodParts += 1
     return activeEntity
Beispiel #2
0
 def removeEntity(self, entity=None):
     # run the default method
     activeEntity = Machine.removeEntity(self, entity)
     # count the number of parts in the server.
     # If it is empty have one internal queue to signal the queue before the compound object
     if not self.countInternalParts():
         self.sendSignal(receiver=QB, signal=QB.canDispose, sender=Q1)
     return activeEntity
Beispiel #3
0
 def getEntity(self):
     activeEntity = Machine.getEntity(self)
     for queue in G.InternalQueueList:
         station = queue.next[0]
         # do not send the signal if it is already triggered
         if not queue.canDispose.triggered:
             self.sendSignal(receiver=queue, signal=queue.canDispose, sender=station)
     return activeEntity
Beispiel #4
0
 def getEntity(self):
     activeEntity = Machine.getEntity(
         self)  # call the parent method to get the entity
     part = self.getActiveObjectQueue()[0]  # retrieve the obtained part
     part.machineId = (
         self.id
     )  # create an attribute to the obtained part and give it the value of the object's id
     return activeEntity  # return the entity obtained
Beispiel #5
0
 def haveToDispose(self, callerObject=None):
     for object in G.InternalProcessList:
         # if there is one other machine processing return False
         if object.isProcessing:
             return False
     return Machine.haveToDispose(self, callerObject)
Beispiel #6
0
 def canAccept(self, callerObject=None):
     # do not start processing unless there are enough parts
     # (i.e. equal to the number of processes) in the compound machine
     if not self.countInternalParts() == len(G.InternalProcessList):
         return False
     return Machine.canAccept(self, callerObject)
Beispiel #7
0
    def countInternalParts(self):
        totalParts = 0
        for object in G.InternalProcessList + G.InternalQueueList:
            totalParts += len(object.getActiveObjectQueue())
        return totalParts


QB = Queue("QB", "QueueBefore", capacity=float("inf"))
Q1 = InternalQueue("Q1", "Q1", capacity=1)
M1 = InternalProcess("M1", "M1", processingTime={"Exp": {"mean": 1}})
Q2 = InternalQueue("Q2", "Q2", capacity=1)
M2 = InternalProcess("M2", "M2", processingTime={"Exp": {"mean": 1}})
Q3 = InternalQueue("Q3", "Q3", capacity=1)
M3 = InternalProcess("M3", "M3", processingTime={"Exp": {"mean": 1}})
QA = Queue("QA", "QueueAfter", capacity=float("inf"))
MA = Machine("MA", "MachineAfter", processingTime={"Exp": {"mean": 1}})
E = Exit("E", "Exit")

QB.defineRouting(successorList=[Q1, Q2, Q3])
Q1.defineRouting(predecessorList=[QB], successorList=[M1])
Q2.defineRouting(predecessorList=[QB], successorList=[M2])
Q3.defineRouting(predecessorList=[QB], successorList=[M3])
M1.defineRouting(predecessorList=[Q1], successorList=[QA])
M2.defineRouting(predecessorList=[Q2], successorList=[QA])
M3.defineRouting(predecessorList=[Q3], successorList=[QA])
QA.defineRouting(predecessorList=[M1, M2, M3], successorList=[MA])
MA.defineRouting(predecessorList=[QA], successorList=[E])
E.defineRouting(predecessorList=[MA])

P1 = Part("P1", "P1", currentStation=QB)
P2 = Part("P2", "P2", currentStation=QB)
Beispiel #8
0
from manpy.simulation.imports import Machine, Source, Exit, Part, Queue, Failure
from manpy.simulation.Globals import runSimulation

# define the objects of the model
S = Source(
    "S", "Source", interArrivalTime={"Fixed": {"mean": 0.5}}, entity="manpy.Part"
)
Q = Queue("Q", "Queue", capacity=float("inf"))
M1 = Machine("M1", "Milling1", processingTime={"Fixed": {"mean": 0.25}})
M2 = Machine("M2", "Milling2", processingTime={"Fixed": {"mean": 0.25}})
E = Exit("E1", "Exit")
F = Failure(
    victim=M1,
    distribution={"TTF": {"Fixed": {"mean": 60.0}}, "TTR": {"Fixed": {"mean": 5.0}}},
)

# define predecessors and successors for the objects
S.defineRouting([Q])
Q.defineRouting([S], [M1, M2])
M1.defineRouting([Q], [E])
M2.defineRouting([Q], [E])
E.defineRouting([M1, M2])


def main(test=0):

    # add all the objects in a list
    objectList = [S, Q, M1, M2, E, F]
    # set the length of the experiment
    maxSimTime = 1440.0
    # call the runSimulation giving the objects and the length of the experiment
 def canAccept(self, callerObject=None):
     if self.locked:
         return False
     if self.state == 0:
         return False
     return Machine.canAccept(self, callerObject)
Beispiel #10
0
 def initialize(self):
     Machine.initialize(self)
     self.numGoodParts = 0
     self.state = 1
Beispiel #11
0
 def postProcessing(self):
     Machine.postProcessing(self, MaxSimtime=maxSimTime)
     self.GoodExits.append(self.numGoodParts)
Beispiel #12
0
    Machine,
    Source,
    Exit,
    Part,
    Repairman,
    Queue,
    Failure,
)
from manpy.simulation.Globals import runSimulation

# define the objects of the model
R = Repairman("R1", "Bob")
S = Source(
    "S1", "Source", interArrivalTime={"Fixed": {"mean": 0.5}}, entity="manpy.Part"
)
M1 = Machine("M1", "Machine1", processingTime={"Fixed": {"mean": 0.25}})
Q = Queue("Q1", "Queue")
M2 = Machine("M2", "Machine2", processingTime={"Fixed": {"mean": 1.5}})
E = Exit("E1", "Exit")
# create failures
F1 = Failure(
    victim=M1,
    distribution={"TTF": {"Fixed": {"mean": 60.0}}, "TTR": {"Fixed": {"mean": 5.0}}},
    repairman=R,
)
F2 = Failure(
    victim=M2,
    distribution={"TTF": {"Fixed": {"mean": 40.0}}, "TTR": {"Fixed": {"mean": 10.0}}},
    repairman=R,
)
Beispiel #13
0
from manpy.simulation.imports import (
    Machine,
    Source,
    Exit,
    Part,
    Queue,
    NonStarvingEntry,
)
from manpy.simulation.Globals import runSimulation

# define the objects of the model
NS = NonStarvingEntry("NS1", "Entry", entityData={"_class": "manpy.Part"})
M1 = Machine("M1", "Machine1", processingTime={"Exp": {"mean": 1}})
Q2 = Queue("Q2", "Queue2")
M2 = Machine("M2", "Machine2", processingTime={"Exp": {"mean": 3}})
Q3 = Queue("Q3", "Queue3")
M3 = Machine("M3", "Machine3", processingTime={"Exp": {"mean": 5}})
E = Exit("E1", "Exit")


# define predecessors and successors for the objects
NS.defineRouting(successorList=[M1])
M1.defineRouting(predecessorList=[NS], successorList=[Q2])
Q2.defineRouting(predecessorList=[M1], successorList=[M2])
M2.defineRouting(predecessorList=[Q2], successorList=[Q3])
Q3.defineRouting(predecessorList=[M2], successorList=[M3])
M3.defineRouting(predecessorList=[Q3], successorList=[E])
E.defineRouting(predecessorList=[M3])


def main(test=0):
Beispiel #14
0
    interArrivalTime={"Fixed": {
        "mean": 1.5
    }},
    entity="manpy.Batch",
    batchNumberOfUnits=100,
)
Q = Queue("Q", "StartQueue", capacity=100000)
BD = BatchDecomposition(
    "BC",
    "BatchDecomposition",
    numberOfSubBatches=4,
    processingTime={"Fixed": {
        "mean": 1
    }},
)
M1 = Machine("M1", "Machine1", processingTime={"Fixed": {"mean": 0.5}})
Q1 = Queue("Q1", "Queue1", capacity=2)
M2 = Machine("M2", "Machine2", processingTime={"Fixed": {"mean": 1}})
BRA = BatchReassembly(
    "BRA",
    "BatchReassembly",
    numberOfSubBatches=4,
    processingTime={"Fixed": {
        "mean": 0
    }},
)
M3 = Machine("M3", "Machine3", processingTime={"Fixed": {"mean": 1}})
E = Exit("E", "Exit")

# define the predecessors and successors for the objects
S.defineRouting([Q])
Beispiel #15
0
# define the objects of the model
Frame.capacity = 4
Sp = Source("SP",
            "Parts",
            interArrivalTime={"Fixed": {
                "mean": 0.5
            }},
            entity="manpy.Part")
Sf = Source("SF",
            "Frames",
            interArrivalTime={"Fixed": {
                "mean": 2
            }},
            entity="manpy.Frame")
M = Machine("M", "Machine", processingTime={"Fixed": {"mean": 0.25}})
A = Assembly("A", "Assembly", processingTime={"Fixed": {"mean": 2}})
E = Exit("E1", "Exit")

F = Failure(
    victim=M,
    distribution={
        "TTF": {
            "Fixed": {
                "mean": 60.0
            }
        },
        "TTR": {
            "Fixed": {
                "mean": 5.0
            }
Beispiel #16
0
from manpy.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler
from manpy.simulation.Globals import runSimulation

# define the objects of the model
S = Source(
    "S1", "Source", interArrivalTime={"Fixed": {"mean": 0.5}}, entity="manpy.Part"
)
M = Machine("M1", "Machine", processingTime={"Fixed": {"mean": 3}})
E = Exit("E1", "Exit")

SS = ShiftScheduler(victim=M, shiftPattern=[[0, 5], [10, 15]])

# define predecessors and successors for the objects
S.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[S], successorList=[E])
E.defineRouting(predecessorList=[M])


def main(test=0):

    # add all the objects in a list
    objectList = [S, M, E, SS]
    # set the length of the experiment
    maxSimTime = 20.0
    # call the runSimulation giving the objects and the length of the experiment
    runSimulation(objectList, maxSimTime)

    # calculate metrics
    working_ratio = (M.totalWorkingTime / maxSimTime) * 100
    off_shift_ratio = (M.totalOffShiftTime / maxSimTime) * 100
from manpy.simulation.Globals import runSimulation

# define the objects of the model
R = Repairman("R1", "Bob")
S = Source("S1",
           "Source",
           interarrivalTime={"Exp": {
               "mean": 0.5
           }},
           entity="manpy.Part")
M1 = Machine(
    "M1",
    "Machine1",
    processingTime={
        "Normal": {
            "mean": 0.25,
            "stdev": 0.1,
            "min": 0.1,
            "max": 1
        }
    },
)
M2 = Machine(
    "M2",
    "Machine2",
    processingTime={
        "Normal": {
            "mean": 1.5,
            "stdev": 0.3,
            "min": 0.5,
            "max": 5
        }