Exemplo n.º 1
0
Arquivo: web.py Projeto: cdkkim/omf
def cymeImportBackground(owner, feederName, stdString, seqString):
	''' Function to run in the background for Milsoft import. '''
	newFeeder = dict(**feeder.newFeederWireframe)
	[newFeeder["tree"], xScale, yScale] = cymeToGridlab.convertCymeModel(stdString, seqString)
	newFeeder["layoutVars"]["xScale"] = xScale
	newFeeder["layoutVars"]["yScale"] = yScale
	with open("./schedules.glm","r") as schedFile:
		newFeeder["attachments"] = {"schedules.glm":schedFile.read()}
	with open("data/Feeder/" + owner + "/" + feederName + ".json", "w") as outFile:
		json.dump(newFeeder, outFile, indent=4)
	os.remove("data/Conversion/" + owner + "/" + feederName + ".json")
Exemplo n.º 2
0
def cymeImportBackground(owner, modelName, feederName, feederNum, mdbNetString, mdbEqString):
	''' Function to run in the background for Milsoft import. '''
	modelDir = "data/Model/"+owner+"/"+modelName
	feederDir = modelDir+"/"+feederName+".omd"
	newFeeder = dict(**feeder.newFeederWireframe)
	[newFeeder["tree"], xScale, yScale] = cymeToGridlab.convertCymeModel(mdbNetString, mdbEqString)
	newFeeder["layoutVars"]["xScale"] = xScale
	newFeeder["layoutVars"]["yScale"] = yScale
	with open("./schedules.glm","r") as schedFile:
		newFeeder["attachments"] = {"schedules.glm":schedFile.read()}
	try: os.remove(feederDir)
	except: pass
	with open(feederDir, "w") as outFile:
		json.dump(newFeeder, outFile, indent=4)
	os.remove("data/Conversion/" + owner + "/" + feederName + ".json")
	removeFeeder(modelName, feederNum)
	writeToInput(modelDir, feederName, 'feederName'+str(feederNum))