Commit 6145eaf1 authored by Jérome Perrin's avatar Jérome Perrin

DemandPlanning: Use KE for demand profile xlsx

parent d7fcb763
...@@ -27,6 +27,8 @@ module that creates the future demand and appends it to buffers ...@@ -27,6 +27,8 @@ module that creates the future demand and appends it to buffers
import xlrd import xlrd
import json import json
import urllib
from Globals import G from Globals import G
from JobMA import JobMA from JobMA import JobMA
...@@ -53,8 +55,9 @@ class FutureDemandCreator(): ...@@ -53,8 +55,9 @@ class FutureDemandCreator():
# PPOS initial disaggregation profile # PPOS initial disaggregation profile
G.demandFile = ( '/home/jerome/src/dream/dream/simulation/GUI/DemandProfile.xlsx' ) # XXX this issue arbitrary requests
wbin = xlrd.open_workbook(G.demandFile) demand_data = urllib.urlopen(G.demandFile).read()
wbin = xlrd.open_workbook(file_contents=demand_data)
MAData=G.RouteDict MAData=G.RouteDict
for k in range(2): for k in range(2):
......
...@@ -26,7 +26,6 @@ test script to convert the static excels to JSON. It does not communicate with G ...@@ -26,7 +26,6 @@ test script to convert the static excels to JSON. It does not communicate with G
''' '''
import xlwt import xlwt
import xlrd
import json import json
from dream.simulation.AllocationManagement import AllocationManagement from dream.simulation.AllocationManagement import AllocationManagement
from dream.simulation.LineGenerationJSON import main as simulate_line_json from dream.simulation.LineGenerationJSON import main as simulate_line_json
...@@ -137,8 +136,6 @@ def readGeneralInput(data): ...@@ -137,8 +136,6 @@ def readGeneralInput(data):
def writeOutput(): def writeOutput():
wbin = xlwt.Workbook() wbin = xlwt.Workbook()
for k in range(G.ReplicationNo): for k in range(G.ReplicationNo):
#export info on lateness #export info on lateness
sheet1=wbin.add_sheet('Lateness'+str(k+1)) sheet1=wbin.add_sheet('Lateness'+str(k+1))
sheet1.write(0,0,'replication') sheet1.write(0,0,'replication')
...@@ -180,7 +177,6 @@ def writeOutput(): ...@@ -180,7 +177,6 @@ def writeOutput():
profile = G.FutureProfile[k] profile = G.FutureProfile[k]
alloc = G.AllocationFuture[k] alloc = G.AllocationFuture[k]
sheet = wbin.add_sheet(shName) sheet = wbin.add_sheet(shName)
sheet.write_merge(0,0,0,4,itemName) sheet.write_merge(0,0,0,4,itemName)
sheet.write(1,0,'Order ID') sheet.write(1,0,'Order ID')
...@@ -345,6 +341,9 @@ class Simulation(DefaultSimulation): ...@@ -345,6 +341,9 @@ class Simulation(DefaultSimulation):
"_class": "Dream.Property", "_class": "Dream.Property",
"_default": 10 "_default": 10
}) })
prop_list.append(overloaded_property(schema['ke_url'],
{'_default':
'http://git.erp5.org/gitweb/dream.git/blob_plain/HEAD:/dream/simulation/Examples/DemandProfile.xlsx'}))
return conf return conf
def run(self, data): def run(self, data):
...@@ -389,6 +388,7 @@ class Simulation(DefaultSimulation): ...@@ -389,6 +388,7 @@ class Simulation(DefaultSimulation):
inputDict['nodes']['AM']['argumentDict']['MAList']=IG.RouteDict inputDict['nodes']['AM']['argumentDict']['MAList']=IG.RouteDict
G.argumentDictString=json.dumps(inputDict, indent=5) G.argumentDictString=json.dumps(inputDict, indent=5)
G.demandFile = data['general']['ke_url']
out = json.loads(simulate_line_json(input_data=(G.argumentDictString))) out = json.loads(simulate_line_json(input_data=(G.argumentDictString)))
......
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