Commit 97167b70 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

examples updated to import using imports.py

parent 66dbc47c
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, Source, Exit, Part, Frame, Assembly, G
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Frame import Frame
from dream.simulation.Assembly import Assembly
from dream.simulation.Globals import G
#define the objects of the model #define the objects of the model
Frame.capacity=4 Frame.capacity=4
......
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, Queue, G
from dream.simulation.Batch import Batch from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.BatchDecomposition import BatchDecomposition
from dream.simulation.BatchSource import BatchSource
from dream.simulation.Machine import Machine
from dream.simulation.Exit import Exit
from dream.simulation.Queue import Queue
from dream.simulation.Globals import G
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',mean=0.5, item=Batch,batchNumberOfUnits=4) S=BatchSource('S','Source',mean=0.5, item=Batch,batchNumberOfUnits=4)
......
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, Source, Exit, Batch, BatchDecomposition,\
BatchSource, BatchReassembly, Queue, LineClearance, ExcelHandler, G, ExcelHandler
from dream.simulation.Globals import G from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.Machine import Machine
from dream.simulation.Exit import Exit
from dream.simulation.Queue import Queue
from dream.simulation.Batch import Batch
from dream.simulation.BatchDecomposition import BatchDecomposition
from dream.simulation.BatchReassembly import BatchReassembly
from dream.simulation.BatchSource import BatchSource
from dream.simulation.LineClearance import LineClearance
import dream.simulation.ExcelHandler
# choose to output trace or not # choose to output trace or not
G.trace='Yes' G.trace='Yes'
...@@ -52,7 +42,7 @@ simulate(until=G.maxSimTime) ...@@ -52,7 +42,7 @@ simulate(until=G.maxSimTime)
for object in G.ObjList: for object in G.ObjList:
object.postProcessing() object.postProcessing()
# print trace # print trace
dream.simulation.ExcelHandler.outputTrace('Trace') ExcelHandler.outputTrace('Trace')
# print the results # print the results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100 print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100
......
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G
from dream.simulation.MachineJobShop import MachineJobShop from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.QueueJobShop import QueueJobShop
from dream.simulation.ExitJobShop import ExitJobShop
from dream.simulation.Job import Job
from dream.simulation.Globals import G
import dream.simulation.Globals as Globals
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity) Q1=QueueJobShop('Q1','Queue1', capacity=infinity)
......
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G, ExcelHandler
from dream.simulation.MachineJobShop import MachineJobShop from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.QueueJobShop import QueueJobShop
from dream.simulation.ExitJobShop import ExitJobShop
from dream.simulation.Job import Job
from dream.simulation.Globals import G
import dream.simulation.ExcelHandler
import dream.simulation.Globals as Globals
G.trace="Yes" G.trace="Yes"
...@@ -60,5 +54,5 @@ for record in J.schedule: ...@@ -60,5 +54,5 @@ for record in J.schedule:
print J.name, "got into", name, "at", record[1] print J.name, "got into", name, "at", record[1]
dream.simulation.ExcelHandler.outputTrace('TRACE') ExcelHandler.outputTrace('TRACE')
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G
from dream.simulation.MachineJobShop import MachineJobShop from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.QueueJobShop import QueueJobShop
from dream.simulation.ExitJobShop import ExitJobShop
from dream.simulation.Job import Job
from dream.simulation.Globals import G
import dream.simulation.Globals as Globals
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="EDD") Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="EDD")
......
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G
from dream.simulation.MachineJobShop import MachineJobShop from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.QueueJobShop import QueueJobShop
from dream.simulation.ExitJobShop import ExitJobShop
from dream.simulation.Job import Job
from dream.simulation.Globals import G
import dream.simulation.Globals as Globals
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="MC-Priority-EDD") Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="MC-Priority-EDD")
......
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G
from dream.simulation.MachineJobShop import MachineJobShop from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.QueueJobShop import QueueJobShop
from dream.simulation.ExitJobShop import ExitJobShop
from dream.simulation.Job import Job
from dream.simulation.Globals import G
import dream.simulation.Globals as Globals
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="Priority") Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="Priority")
......
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G
from dream.simulation.MachineJobShop import MachineJobShop from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.QueueJobShop import QueueJobShop
from dream.simulation.ExitJobShop import ExitJobShop
from dream.simulation.Job import Job
from dream.simulation.Globals import G
import dream.simulation.Globals as Globals
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="LPT") Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="LPT")
......
from SimPy.Simulation import simulate, activate, initialize, infinity from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.Queue import Queue
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Globals import G
#define the objects of the model #define the objects of the model
S=Source('S','Source', mean=0.5, item=Part) S=Source('S','Source', mean=0.5, item=Part)
......
from SimPy.Simulation import simulate, activate, initialize, infinity from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Globals
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.Queue import Queue
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Globals import G
#the custom queue #the custom queue
class SelectiveQueue(Queue): class SelectiveQueue(Queue):
def haveToDispose(self,callerObject=None): def haveToDispose(self,callerObject=None):
caller=callerObject caller=callerObject
#if the caller is Milling1 then we return true if there are parts queued # if the caller is M1 then return true if there is an Entity to give
if caller.id=='M1': if caller.id=='M1':
return len(self.getActiveObjectQueue())>0 return len(self.getActiveObjectQueue())>0
#if the caller is Milling2 then we have to check Milling1's condition. # else return true only if M1 cannot accept the Entity
#we return true if there are parts queued AND Milling1 cannot accept them
self.M1=None
if caller.id=='M2': if caller.id=='M2':
#loop through the objects to identify Milling1 # find M1
for object in G.ObjList: M1=Globals.findObjectById('M1') # global method to obtain an object from the id
if object.id=='M1': return len(self.getActiveObjectQueue())>0 and (not (M1.canAccept()))
self.M1=object
#check Queue's status and also if Milling1 can accept
return len(self.getActiveObjectQueue())>0 and (not (self.M1.canAccept()))
#define the objects of the model #define the objects of the model
S=Source('S','Source', mean=0.5, item=Part) S=Source('S','Source', mean=0.5, item=Part)
......
from SimPy.Simulation import simulate, activate, initialize, infinity, now from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Globals
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize, infinity
from dream.simulation.Queue import Queue
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Globals import G
import dream.simulation.Globals as Globals
#the custom queue #the custom queue
class SelectiveQueue(Queue): class SelectiveQueue(Queue):
......
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, BatchReassembly, Queue, G
from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.Globals import G
from dream.simulation.Machine import Machine
from dream.simulation.Exit import Exit
from dream.simulation.Queue import Queue
from dream.simulation.Batch import Batch
from dream.simulation.BatchDecomposition import BatchDecomposition
from dream.simulation.BatchReassembly import BatchReassembly
from dream.simulation.BatchSource import BatchSource
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',mean=1.5, item=Batch,batchNumberOfUnits=100) S=BatchSource('S','Source',mean=1.5, item=Batch,batchNumberOfUnits=100)
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, simulate, activate, initialize from dream.simulation.imports import Machine, Source, Exit, Part, G
from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model #define the objects of the model
S=Source('S1','Source',distribution='Fixed', mean=0.5, item=Part) S=Source('S1','Source',distribution='Fixed', mean=0.5, item=Part)
......
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Repairman import Repairman
from dream.simulation.Queue import Queue
from dream.simulation.Globals import G
from dream.simulation.Failure import Failure
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
......
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Repairman import Repairman
from dream.simulation.Queue import Queue
from dream.simulation.Globals import G
from dream.simulation.Failure import Failure
#import Graphs #import Graphs
from outputanalysis.Plots import Graphs from dream.KnowledgeExtraction.Plots import Graphs
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
......
from SimPy.Simulation import simulate, activate, initialize from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure
from dream.simulation.Machine import Machine from dream.simulation.imports import simulate, activate, initialize
from dream.simulation.Source import Source
from dream.simulation.Exit import Exit
from dream.simulation.Part import Part
from dream.simulation.Repairman import Repairman
from dream.simulation.Queue import Queue
from dream.simulation.Globals import G
from dream.simulation.Failure import Failure
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
......
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