summaryrefslogtreecommitdiff
path: root/SA_POP/utils/SANetGenerator/Net_Complete.py
diff options
context:
space:
mode:
Diffstat (limited to 'SA_POP/utils/SANetGenerator/Net_Complete.py')
-rwxr-xr-xSA_POP/utils/SANetGenerator/Net_Complete.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/SA_POP/utils/SANetGenerator/Net_Complete.py b/SA_POP/utils/SANetGenerator/Net_Complete.py
index 7986eabe903..09bc5362d6a 100755
--- a/SA_POP/utils/SANetGenerator/Net_Complete.py
+++ b/SA_POP/utils/SANetGenerator/Net_Complete.py
@@ -18,8 +18,10 @@ outname = sys.argv[6]
output = outname + ".dot"
outSAN = outname + ".xml"
+outTM = outname + ".tm" + ".xml"
ofile = open(output, 'w')
+tfile = open(outTM, 'w')
ofile.write("strict digraph testGraph {\n")
SANet = nx.DiGraph()
@@ -77,24 +79,38 @@ for each in tasks:
cnode = 2001
for each in conds:
ctonum[each] = cnode
- nfile.write("\n\t<condNode>\n\t\t<nodeID>" + str(cnode) + "</nodeID>\n\t\t<name>" + each + "</name>\n\t\t<probTrue>" + str(0) + "</priorProb>\n\t\t<utility>0</utility>\n\t\t<kind />\n\t\t<attenFactor />\n\t</condNode>\n" )
+ nfile.write("\n\t<condNode>\n\t\t<nodeID>" + str(cnode) + "</nodeID>\n\t\t<name>" + each + "</name>\n\t\t<probTrue>" + str(0) + "</probTrue>\n\t\t<utility>0</utility>\n\t\t<kind />\n\t\t<attenFactor />\n\t</condNode>\n" )
cnode += 1
for each in conds:
- plinks = ParamInfo[2][each]
- for link in plinks:
- nfile.write("\n\t<precondLink>\n\t\t<condID>" + str(ctonum[each]) + "</condID>\n\t\t<taskID>" + str(ttonum[link[0]]) + "</taskID>\n\t\t<portID>Port</portID>\n\t\t<trueProb>" + str(link[1]) + "</trueProb>\n\t\t<falseProb>0</falseProb>\n\t\t</precondLink>\n")
+ if each in ParamInfo[2]:
+ plinks = ParamInfo[2][each]
+ for link in plinks:
+ nfile.write("\n\t<precondLink>\n\t\t<condID>" + str(ctonum[each]) + "</condID>\n\t\t<taskID>" + str(ttonum[link[0]]) + "</taskID>\n\t\t<portID>Port</portID>\n\t\t<trueProb>" + str(link[1]) + "</trueProb>\n\t\t<falseProb>0</falseProb>\n\t\t</precondLink>\n")
for each in tasks:
- elinks = ParamInfo[3][each]
- for link in elinks:
- nfile.write("\n\t<effectLink>\n\t\t<taskID>" + str(ttonum[each]) + "</taskID>\n\t\t<condID>" + str(ctonum[link[0]]) + "</condID>\n\t\t<portID>Port</portID>\n\t\t<weight>" + str(link[1]) + "</weight>\n\t</effectLink>\n")
+ if each in ParamInfo[3]:
+ elinks = ParamInfo[3][each]
+ for link in elinks:
+ nfile.write("\n\t<effectLink>\n\t\t<taskID>" + str(ttonum[each]) + "</taskID>\n\t\t<condID>" + str(ctonum[link[0]]) + "</condID>\n\t\t<portID>Port</portID>\n\t\t<weight>" + str(link[1]) + "</weight>\n\t</effectLink>\n")
nfile.write("</SANet:network>")
nfile.close()
-
-
+tfile.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<SA-POP:taskMap\n\txmlns:SA-POP=\"http://www.vanderbilt.edu/SA-POP\"\n")
+tfile.write("\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://www.vanderbilt.edu/SA-POP Task_Map.xsd\"\n\txmlns=\"http://www.vanderbilt.edu/SA-POP\">")
+tfile.write("\n\n\t")
+
+for each in tasks:
+ tfile.write("\n\t<taskImpl>\n\t\t<implID>" + each + "_1" + "</implID>\n\t\t<param>\n\t\t\t<paramID></paramID>\n\t\t\t<kind></kind>\n\t\t\t<value></value>\n\t\t</param>\n\t</taskImpl>\n" )
-
- \ No newline at end of file
+tfile.write("\n\t<resource>\n\t\t<resourceID>Dack</resourceID>\n\t\t<kind>DISCRETE</kind>\n\t\t<capacity>1</capacity>\n\t</resource>\n")
+
+for each in tasks:
+ tfile.write("\n\t<taskToImpl>\n\t\t<taskID>" + str(ttonum[each]) + "</taskID>\n\t\t<implID>" + each + "_1" + "</implID>\n\t\t<duration>1</duration>\n\t</taskToImpl>\n")
+
+for each in tasks:
+ tfile.write("\n\t<implToResource>\n\t\t<implID>" + each + "_1</implID>\n\t\t<resourceID>Dack</resourceID>\n\t\t<utilization>1</utilization>\n\t</implToResource>")
+
+tfile.write("</SA-POP:taskMap>")
+tfile.close() \ No newline at end of file