Commit 80eca556 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

LineGenerationCMSD.py updated to match the new argument notation for the Machine

parent 80aed260
......@@ -114,20 +114,6 @@
</Property>
</Property>
</Resource>
************************************Resource Q1***********************************************
<Resource>
<Identifier>Q1</Identifier>
<Description>The queue of the topology</Description>
<ResourceType>other</ResourceType>
<ResourceClass>
<ResourceClassIdentifier>Queue</ResourceClassIdentifier>
</ResourceClass>
<Name>Q1</Name>
<Property>
<Name>capacity</Name>
<Value>1</Value>
</Property>
</Resource>
**********************************Resource M2***************************************************
<Resource>
<Identifier>M2</Identifier>
......@@ -233,10 +219,10 @@
<ProcessIdentifier>A020</ProcessIdentifier>
</Process>
<Process>
<ProcessIdentifier>A040</ProcessIdentifier>
<ProcessIdentifier>A030</ProcessIdentifier>
</Process>
<Process>
<ProcessIdentifier>A050</ProcessIdentifier>
<ProcessIdentifier>A040</ProcessIdentifier>
</Process>
</SubProcessGroup>
</Process>
......@@ -267,8 +253,7 @@
<ResourceIdentifier>S1</ResourceIdentifier>
</Resource>
</ResourcesRequired>
</Process>
</Process>
<Process>
<Identifier>A020</Identifier>
<Description>Process 2</Description>
......@@ -278,22 +263,10 @@
<ResourceIdentifier>M1</ResourceIdentifier>
</Resource>
</ResourcesRequired>
</Process>
</Process>
<Process>
<Identifier>A030</Identifier>
<Description>Process 3</Description>
<ResourcesRequired>
<Description>Queue1.</Description>
<Resource>
<ResourceIdentifier>Q1</ResourceIdentifier>
</Resource>
</ResourcesRequired>
</Process>
<Process>
<Identifier>A040</Identifier>
<Description>Process 4</Description>
<ResourcesRequired>
<Description>Machine2.</Description>
<Resource>
......@@ -303,8 +276,8 @@
</Process>
<Process>
<Identifier>A050</Identifier>
<Description>Process 5</Description>
<Identifier>A040</Identifier>
<Description>Process 4</Description>
<ResourcesRequired>
<Description>Exit.</Description>
<Resource>
......
......@@ -25,10 +25,33 @@ Created on 27 May 2013
main script. Reads data from the CMSD xml files that Panos creates,
generates and runs the simulation and prints the results to excel
'''
from warnings import warn
import logging
logger = logging.getLogger("dream.platform")
from SimPy.Simulation import *
try:
import scipy
except ImportError:
class scipy:
class stats:
@staticmethod
def bayes_mvs(*args, **kw):
warn("Scipy is missing, using fake implementation")
serie, confidence = args
import numpy
mean = numpy.mean(serie), (numpy.min(serie), numpy.max(serie))
var = 0, (0, 0)
std = 0, (0, 0)
return mean, var, std
import sys
sys.modules['scipy.stats'] = scipy.stats
sys.modules['scipy'] = scipy
logger.error("Scipy cannot be imported, using dummy implementation")
from SimPy.Simulation import activate, initialize, simulate, now, infinity
from Globals import G
from Source import Source
from Globals import G
from Machine import Machine
from Exit import Exit
from Queue import Queue
......@@ -39,13 +62,16 @@ from Frame import Frame
from Assembly import Assembly
from Dismantle import Dismantle
from Conveyer import Conveyer
from Job import Job
from MachineJobShop import MachineJobShop
from QueueJobShop import QueueJobShop
from ExitJobShop import ExitJobShop
import xlwt
import xlrd
import time
import numpy as np
import json
from random import Random
import sys
import os.path
from xml.dom.minidom import parseString
from xml.dom.minidom import parse
......@@ -215,8 +241,9 @@ def readResources():
if(G.RepairmanList[j].id==repairmanID):
repairman=G.RepairmanList[j]
M=Machine(id, name, 1, distributionType, [mean,stdev,min,max], failureDistribution,
MTTF, MTTR, availability, repairman)
M=Machine(id, name, 1, distribution=distributionType, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, repairman=repairman,
mean=mean,stdev=stdev,min=min,max=max)
G.MachineList.append(M)
G.ObjList.append(M)
......@@ -380,17 +407,16 @@ def main():
G.ObjList=[]
#user inputs the id of the JSON file
topologyId=raw_input("give the topology id\n")
topologyId=raw_input("give the path to the CMSD file\n")
try:
#G.CMSDFile=open('CMSDInputs/Topology01.xml', "r")
G.CMSDFile=open('CMSDInputs/Topology'+str(topologyId)+'.xml', "r")
G.CMSDFile=open(str(topologyId), "r")
except IOError:
print "no such topology file. The programm is terminated"
print "no such file. The programm is terminated"
sys.exit()
start=time.time() #start counting execution time
#read the input from the JSON file and create the line
#read the input from the CMSD file and create the line
G.InputData=G.CMSDFile.read()
G.CMSDData=parseString(G.InputData)
readGeneralInput()
......@@ -405,12 +431,10 @@ def main():
for i in range(G.numberOfReplications):
print "start run number "+str(i+1)
G.seed+=1
G.Rnd=Random(G.seed)
G.Rnd=Random(G.seed)
initialize() #initialize the simulation
initializeObjects()
activateObjects()
activateObjects()
simulate(until=G.maxSimTime) #start the simulation
#carry on the post processing operations for every object in the topology
......
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