MAX_ROUT_Y = 4 sourc_x = 0 sourc_y = 1 dest_x = 3 dest_y = 3 GEN_TASK_START = """ """ GEN_TASK_END = """ """ REQ_TASK_START = """ """ REQ_TASK_END = " " LAST_TASK = """ """ REQ_TASK_REQ = """ """ REQ_TASK_GEN = """ """ DEST_HEADER = " " DEST_H_END = " " DELAY_TAG = " " INTERVAL_TAG = " " COUNT_TAG = " " TYPE_TAG = " " TASK_TAG = " " CONFIG_TAG = " " BIND = """ """ id = 0 print("**********************FOR data.xml**********************") print(GEN_TASK_START) for x in range(sourc_x, dest_x): print(DEST_HEADER.format(id)) print(DELAY_TAG) print(INTERVAL_TAG) print(COUNT_TAG) print(TYPE_TAG) print(TASK_TAG.format(id+1)) link = 0 if id==0 else 2 print(CONFIG_TAG.format(link, 1)) print(DEST_H_END) id+=1 for y in range(sourc_y, dest_y+1): print(DEST_HEADER.format(id)) print(DELAY_TAG) print(INTERVAL_TAG) print(COUNT_TAG) print(TYPE_TAG) print(TASK_TAG.format(id+1)) link = 2 if y == sourc_y else 4 dest = 0 if y == dest_y else 3 print(CONFIG_TAG.format(link, dest)) print(DEST_H_END) id+=1 print(GEN_TASK_END) for i in range(1, id): print() print(REQ_TASK_START.format(i)) print(REQ_TASK_REQ) print(REQ_TASK_GEN.format(id)) print(REQ_TASK_END) print() print(LAST_TASK.format(id, id-1, id-1)) print() print("**********************FOR map.xml**********************") x = sourc_x y = sourc_y for i in range (0, id+1): print(BIND.format(i, x*MAX_ROUT_Y+y)) if(y == dest_y): x = sourc_x y = sourc_y elif(x == dest_x): y += 1 else: x +=1