Commit 92873e1a authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

Merge branch 'master' of gitlab.servus.at:peda/droplet-sequence-generator

Conflicts:
	src/TestNloc.java

this is just a testdriver
parents 518c5732 a8f57fed
......@@ -52,7 +52,7 @@ public class Nloc {
currentSeq = resetPayloadDropletPosition(currentSeq);
} while (!possibleSequences.isEmpty() &&
dropletSequence.size() != currentSeq.size() &&
!sequenceFunctinal());
!this.sequenceFunctinal());
if (dropletSequence.size() != currentSeq.size()) {
pump = null;
......@@ -240,9 +240,9 @@ public class Nloc {
for (Droplet dr : drArr) {
//System.out.println("Droplet: " + dr.getName() + " Position: " + dr.getPosition().getChannel().getName() + ":" + dr.getPosition().getSteps());
dr.move();
System.out.println("Droplet: " + dr.getName() + " Position: " + dr.getPosition().getChannel().getName() + ":" + dr.getPosition().getSteps());
//System.out.println("Droplet: " + dr.getName() + " Position: " + dr.getPosition().getChannel().getName() + ":" + dr.getPosition().getSteps());
}
System.out.println("");
//System.out.println("");
for (Droplet dr: drArr) {
//System.out.println("Droplet: " + dr.getName() + " Position: " + dr.getPosition().getChannel().getName() + ":" + dr.getPosition().getSteps());
if (dr.coalesce()) {
......
......@@ -11,7 +11,7 @@ public class TestNloc {
public static void main(String[] args) {
//Nloc nl = new Nloc(getNlocS5());
List<Channel> chList = getNlocS5();
List<Channel> chList = getNlocSXX();
Nloc nl = new Nloc(chList);
//Pump pump = nl.getPump();
//pump.setSteps(2);
......@@ -39,7 +39,8 @@ public class TestNloc {
//}
List<List<Channel>> allPaths = nl.getAllPaths();
List<Channel> critPath = allPaths.get(4);
printPaths(allPaths);
//allPaths.remove(4);
//try {
// String[] mtv = {"f2", "m3", "h0", "m5"};
......@@ -73,22 +74,46 @@ public class TestNloc {
//System.out.println("Pathnum: " + count++);
//Pump p = nl.getShortestSequence(modulesToVisit);
//printPumpcontents(p);
String[] mtv = {"h0", "m1", "m2", "m3"};
try {
List<List<SequenceTuple>> stll = nl.getPossibleSequences(mtv);
printSequences(stll);
} catch (NoSuchModuleException e) {
System.out.println(e.getMessage());
}
//int count = 0;
//for (List<Channel> path: allPaths) {
// String[] modulesToVisit = extractModuleStringArrayFromPath(path);
// System.out.println("Modules to visit: ");
// for (String str: modulesToVisit) {
// System.out.print(str + " " );
// }
// System.out.println("Pathnum: " + count++);
// Pump p = nl.getShortestSequence(modulesToVisit);
// printPumpcontents(p);
//}
}
public static void printPumpcontents(Pump pump) {
List<Droplet> drlist = pump.getDropletList();
for (Droplet dr: drlist) {
System.out.print("Droplet: " + dr.getName() + " Pos: " + dr.getPosition().getSteps() + " Outlet: " + dr.getPumpOutlet().getName());
if (drlist.indexOf(dr) == drlist.size() - 1) {
if (pump == null) {
System.out.println("No Sequence Found");
} else {
List<Droplet> drlist = pump.getDropletList();
if (!drlist.isEmpty()) {
for (Droplet dr: drlist) {
System.out.print("Droplet: " + dr.getName() + " Pos: " + dr.getPosition().getSteps() + " Outlet: " + dr.getPumpOutlet().getName());
if (drlist.indexOf(dr) == drlist.size() - 1) {
System.out.println("");
} else {
System.out.print(" | ");
}
}
System.out.println("");
} else {
System.out.print(" | ");
}
}
System.out.println("");
}
public static String[] extractModuleStringArrayFromPath(List<Channel> path) {
List<String> strlist = new ArrayList<String>();
......@@ -1049,6 +1074,83 @@ public class TestNloc {
return chlist;
}
public static List<Channel> getNlocSXX() {
// channel(name, psteps, hsteps)
Channel ch1 = new Channel("ch1",1,1);
Channel ch2 = new Channel("ch2",1,1);
Channel ch3 = new Channel("ch3",3,3);
Channel ch4 = new Channel("ch4",1,1);
Channel ch5 = new Channel("ch5",1,1);
Channel ch6 = new Channel("ch6",1,1);
Channel ch7 = new Channel("ch7",1,1);
Channel ch8 = new Channel("ch8",3,3);
Channel ch9 = new Channel("ch9",1,1);
Channel ch10 = new Channel("ch10",1,1);
Channel ch11 = new Channel("ch11",1,1);
Channel ch12 = new Channel("ch12",3,3);
Channel ch13 = new Channel("ch13",1,1);
Channel ch14 = new Channel("ch14",1,1);
Channel ch15 = new Channel("ch15",1,1);
Channel ch16 = new Channel("ch16",1,1);
Channel ch17 = new Channel("ch17",1,1);
Module m0 = new Module("m0", 5,1);
Module m1 = new Module("m1", 5,1);
Module m2 = new Module("m2", 5,1);
Module m3 = new Module("m3", 5,1);
Module h0 = new Module("h0", 5,1);
Pump p0 = new Pump();
Sink s0 = new Sink();
List<Channel> chlist = Arrays.asList(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8,
ch9, ch10, ch11, ch12, ch13, ch14, ch15, ch16, ch17, m0, m1, m2, m3,
h0, p0, s0);
p0.addChild(ch1);
p0.addChild(ch2);
p0.addChild(ch17);
ch1.addChild(ch3);
ch1.addChild(ch4);
ch3.addChild(m0);
m0.addChild(ch6);
ch2.addChild(h0);
h0.addChild(ch5);
ch17.addChild(ch7);
ch5.addChild(ch7);
ch7.addChild(ch8);
ch7.addChild(ch9);
ch8.addChild(m1);
m1.addChild(ch10);
ch10.addChild(ch11);
ch9.addChild(ch11);
ch6.addChild(ch11);
ch4.addChild(ch11);
ch11.addChild(ch12);
ch11.addChild(ch13);
ch12.addChild(m2);
m2.addChild(ch14);
ch14.addChild(ch15);
ch13.addChild(ch15);
ch15.addChild(m3);
m3.addChild(ch16);
ch16.addChild(s0);
return chlist;
}
public static List<Channel> getNlocSC() {
// channel(name, psteps, hsteps)
......
Supports Markdown
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