Commit a012d137 authored by panos's avatar panos

A new example inserted

parent 8f4d70c1
M1,M2
0.316191544,0.964730988
0.316191544,0.026733702
0.705934251,0.143290362
0.443313263,0.457859747
0.760824832,0.360404368
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.760824832,
0.183075027,0.766356281
0.316191544,0.026733702
0.705934251,0.143290362
0.443313263,0.457859747
0.760824832,0.360404368
0.053600175,0.724183619
0.705934251,
0.781035648,0.705351425
0.626433697,0.616910323
0.183075027,0.766356281
0.316191544,0.026733702
0.705934251,0.143290362
0.443313263,0.457859747
0.705934251,0.143290362
0.443313263,
0.760824832,0.360404368
1.549585958,2.874563823
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.183075027,0.766356281
0.316191544,0.026733702
0.705934251,
0.781035648,0.705351425
0.626433697,0.616910323
0.183075027,0.766356281
0.316191544,0.026733702
0.705934251,0.143290362
0.443313263,0.457859747
0.760824832,0.360404368
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.760824832,0.360404368
1.549585958,2.874563823
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.760824832,0.360404368
1.549585958,2.874563823
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.183075027,0.766356281
0.443313263,0.457859747
0.760824832,0.360404368
0.053600175,0.724183619
0.626433697,0.616910323
0.183075027,0.766356281
0.316191544,0.026733702
0.705934251,0.143290362
0.443313263,0.457859747
0.760824832,0.360404368
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.760824832,0.360404368
1.549585958,2.874563823
0.053600175,0.724183619
0.781035648,0.705351425
0.626433697,0.616910323
0.760824832,0.360404368
1.549585958,2.874563823
0.053600175,0.724183619
\ No newline at end of file
S1
0.605703539
0.316191544
0.705934251
0.443313263
0.760824832
0.781035648
0.626433697
0.183075027
0.964730988
0.026733702
0.143290362
0.457859747
0.360404368
0.360404368
0.766356281
0.616910323
0.760824832
0.781035648
0.626433697
0.183075027
0.964730988
0.026733702
0.143290362
0.360404368
0.766356281
0.616910323
0.760824832
0.053600175
0.781035648
0.626433697
0.183075027
0.964730988
0.026733702
0.143290362
0.457859747
0.360404368
0.781035648
0.626433697
0.183075027
0.964730988
0.026733702
0.143290362
0.360404368
0.766356281
0.616910323
0.760824832
0.053600175
0.626433697
0.183075027
0.760824832
0.053600175
0.781035648
0.183075027
0.964730988
0.026733702
0.143290362
0.457859747
0.360404368
0.781035648
0.626433697
0.183075027
0.964730988
0.026733702
0.143290362
0.360404368
0.766356281
0.760824832
0.053600175
0.781035648
0.626433697
0.183075027
0.964730988
0.026733702
0.143290362
0.457859747
0.360404368
0.781035648
0.626433697
0.183075027
0.026733702
\ No newline at end of file
{
"graph": {
"node": {
"S1": {
"name": "Raw Material",
"top": 0.9534313725490196,
"entity": "Dream.Part",
"interArrivalTime": {
"Fixed": {
"mean": 0.5
}
},
"interruptions": {},
"_class": "Dream.Source",
"left": 0.30208333333333337
},
"M1": {
"name": "Machine1",
"top": 0.5906862745098039,
"processingTime": {
"Fixed": {
"mean": 0.25
}
},
"interruptions": {
"failure": {
"TTR": {
"Fixed": {
"mean": 5
}
},
"TTF": {
"Fixed": {
"mean": 60
}
}
}
},
"_class": "Dream.Machine",
"left": 0.5625
},
"W1": {
"capacity": 1,
"name": "W1",
"top": 0.7720588235294118,
"interruptions": {},
"_class": "Dream.Repairman",
"left": 0.8489583333333334
},
"M2": {
"name": "Machine2",
"top": 0.2279411764705882,
"processingTime": {
"Fixed": {
"mean": 1.5
}
},
"interruptions": {
"failure": {
"TTR": {
"Fixed": {
"mean": 10
}
},
"TTF": {
"Fixed": {
"mean": 40
}
}
}
},
"_class": "Dream.Machine",
"left": 0.7083333333333333
},
"C1": {
"name": "C1",
"top": 0.40931372549019607,
"length": "8",
"interruptions": {},
"_class": "Dream.Conveyer",
"speed": "1",
"left": 0.5625
},
"DummyQ": {
"capacity": 1,
"name": "DummyQ",
"top": 0.7720588235294118,
"isDummy": "1",
"interruptions": {},
"_class": "Dream.Queue",
"left": 0.30208333333333337
},
"E1": {
"interruptions": {},
"top": 0.04656862745098034,
"_class": "Dream.Exit",
"name": "Stock",
"left": 0.7083333333333333
}
},
"edge": {
"1": {
"source": "W1",
"destination": "M2",
"data": {},
"_class": "Dream.Edge"
},
"0": {
"source": "W1",
"destination": "M1",
"data": {},
"_class": "Dream.Edge"
},
"3": {
"source": "M1",
"destination": "C1",
"data": {},
"_class": "Dream.Edge"
},
"2": {
"source": "S1",
"destination": "DummyQ",
"data": {},
"_class": "Dream.Edge"
},
"5": {
"source": "DummyQ",
"destination": "M1",
"data": {},
"_class": "Dream.Edge"
},
"4": {
"source": "M2",
"destination": "E1",
"data": {},
"_class": "Dream.Edge"
},
"6": {
"source": "C1",
"destination": "M2",
"data": {},
"_class": "Dream.Edge"
}
}
},
"_class": "Dream.Simulation",
"general": {
"maxSimTime": "1440",
"_class": "Dream.Configuration",
"confidenceLevel": "0.95",
"trace": "No",
"numberOfReplications": "1"
}
}
\ No newline at end of file
'''
Created on 4 Apr 2015
@author: Panos
'''
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
from dream.KnowledgeExtraction.ImportCSVdata import Import_CSV
from dream.KnowledgeExtraction.DistributionFitting import Distributions
from dream.KnowledgeExtraction.DistributionFitting import DistFittest
from dream.KnowledgeExtraction.JSONOutput import JSONOutput
from dream.KnowledgeExtraction.DetectOutliers import HandleOutliers
from dream.KnowledgeExtraction.ReplaceMissingValues import HandleMissingValues
import json
################### Import data using the ImportCSVdataobject ###################################
filename1=("DataSet.csv")
filename2=("InterArrivalData.csv")
CSV=Import_CSV() #call the Import_CSV module and using its method Input_data import the data set from the CSV file to the tool
procData=CSV.Input_data(filename1)
sourceData=CSV.Input_data(filename2)
M1=procData.get('M1',[]) #get from the returned Python dictionary the data sets
M2=procData.get('M2',[])
S1=sourceData.get('S1',[])
################### Processing of the data sets calling the following objects ###################################
#Replace missing values calling the corresponding object
missingValues=HandleMissingValues()
M1=missingValues.DeleteMissingValue(M1)
M2=missingValues.DeleteMissingValue(M2)
S1=missingValues.ReplaceWithMean(S1)
#Detect outliers calling the DetectOutliers object
outliers=HandleOutliers()
M1=outliers.DeleteExtremeOutliers(M1)
M2=outliers.DeleteExtremeOutliers(M2)
S1=outliers.DeleteOutliers(S1)
#Conduct distribution fitting calling the Distributions object and DistFittest object
MLE=Distributions()
KStest=DistFittest()
M1=KStest.ks_test(M1)
M2=KStest.ks_test(M2)
S1=MLE.Exponential_distrfit(S1)
#================================= Output preparation: output the updated values in the JSON file of this example =========================================================#
jsonFile = open('JSON_ConveyerLine.json','r') #It opens the JSON file
data = json.load(jsonFile) #It loads the file
jsonFile.close()
exportJSON=JSONOutput()
stationId1='M1'
stationId2='M2'
stationId3='S1'
data=exportJSON.ProcessingTimes(data, stationId1, M1)
data1=exportJSON.ProcessingTimes(data, stationId2, M2)
data2=exportJSON.InterarrivalTime(data1, stationId3, S1)
jsonFile = open('JSON_ConveyerLine_Output.json',"w") #It opens the JSON file
jsonFile.write(json.dumps(data2, indent=True)) #It writes the updated data to the JSON file
jsonFile.close() #It closes the file
\ No newline at end of file
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