Commit 65bff7b4 authored by jthu's avatar jthu

正式测通版本 修改网络规模 调节网络拓扑 增加展示布局

parent 6e3cac7c
package top.ninwoo.cloud.controller; package top.ninwoo.cloud.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
...@@ -21,6 +22,7 @@ import java.util.HashMap; ...@@ -21,6 +22,7 @@ import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Controller @Controller
public class DataCtrl { public class DataCtrl {
...@@ -70,9 +72,15 @@ public class DataCtrl { ...@@ -70,9 +72,15 @@ public class DataCtrl {
func[i] = Integer.parseInt(funs[i]); func[i] = Integer.parseInt(funs[i]);
} }
System.out.println();
log.info("//////////////////////////////////////////////");
System.out.println();
LinkedList<CnfData> cnfData = cpcTrans.packageData(picture,link,func); LinkedList<CnfData> cnfData = cpcTrans.packageData(picture,link,func);
//发送 //发送
Date time = new Date();
starTime = time.getTime();
System.out.println("开始路径计算: "+starTime);
for (CnfData data : cnfData) { for (CnfData data : cnfData) {
cpcTrans.sendData(data, data.getNextIPHop()); cpcTrans.sendData(data, data.getNextIPHop());
} }
...@@ -244,8 +252,9 @@ public class DataCtrl { ...@@ -244,8 +252,9 @@ public class DataCtrl {
public String getDate(@RequestParam("message") String message) { public String getDate(@RequestParam("message") String message) {
System.out.println("返回收到信息:" + message); System.out.println("返回收到信息:" + message);
Date time = new Date(); Date time = new Date();
System.out.println("时间间隔:" + (time.getTime() - starTime)); System.out.println("时间间隔:" + (time.getTime() - starTime)/1000 + "s");
return "backEarth sucess";
return "backEarth success";
} }
//收到图片时的时间 //收到图片时的时间
......
...@@ -123,13 +123,31 @@ public class Bpso { ...@@ -123,13 +123,31 @@ public class Bpso {
dev = num*slotnum; dev = num*slotnum;
n2 = dev - N_STABLE*slotnum; n2 = dev - N_STABLE*slotnum;
//1组装最短路矩阵 加权时间扩展图 //1组装最短路矩阵 加权时间扩展图
double[][] edgeWeight = Wteg.getWteg(num*slotnum); // double[][] edgeWeight = Wteg.getWteg(num*slotnum);
double[][] edgeWeight = Wteg.getIridiumWteg(num*slotnum);
InterSlotDijstraV2 dijs = new InterSlotDijstraV2(num, slot); InterSlotDijstraV2 dijs = new InterSlotDijstraV2(num, slot);
InterSlotDijstraV2.pathRecord pathRecord = dijs.dijstra(edgeWeight, testLatency); InterSlotDijstraV2.pathRecord pathRecord = dijs.dijstra(edgeWeight, testLatency);
//2最短路由矩阵 时间扩展图最短路由时延矩阵 //2最短路由矩阵 时间扩展图最短路由时延矩阵
double[][] lt = pathRecord.pathWeight; double[][] lt = pathRecord.pathWeight;
double maxLatency = 0;
for (int j = 0;j<lt.length;j++) {
for (int i = 0; i < lt.length; i++) {
if (lt[j][i]!=MAXWEIGHT && lt[j][i]>maxLatency){
maxLatency = lt[j][i];
}
}
}
//将不可达路由时延设置为较高时延
for (int j = 0;j<lt.length;j++) {
for (int i = 0; i < lt.length; i++) {
if (lt[j][i]==MAXWEIGHT){
lt[j][i] = maxLatency + 500;
}
}
}
lastHop = pathRecord.lastHop; lastHop = pathRecord.lastHop;
// 原本求的是最后一跳路由,但是现在求得是下一跳路由
for (int j = 0;j<lastHop.length;j++){ for (int j = 0;j<lastHop.length;j++){
for(int i = 0;i<lastHop.length;i++){ for(int i = 0;i<lastHop.length;i++){
int tmp0 = lastHop[j][i]; int tmp0 = lastHop[j][i];
...@@ -139,6 +157,14 @@ public class Bpso { ...@@ -139,6 +157,14 @@ public class Bpso {
} }
} }
} }
//将不可达路由连接,隐藏网络不连通性,搞成环了
for (int j = 0;j<lastHop.length;j++){
for(int i = 0;i<lastHop.length;i++){
if (lastHop[j][i] == 0) {
lastHop[j][i] = i;
}
}
}
// 一跳路由转发表 // 一跳路由转发表
String[][] routetest = new String[lastHop.length][lastHop[0].length]; String[][] routetest = new String[lastHop.length][lastHop[0].length];
for (int l = 0; l < lastHop.length/num; l++) { for (int l = 0; l < lastHop.length/num; l++) {
...@@ -161,7 +187,7 @@ public class Bpso { ...@@ -161,7 +187,7 @@ public class Bpso {
Bpso doMap = new Bpso(); Bpso doMap = new Bpso();
Par best_par = doMap.main_bpso(k, c, dev, n1, n2, D, lt, nt, link, n, s, c1, c2, num, slot, mapdev); Par best_par = doMap.main_bpso(k, c, dev, n1, n2, D, lt, nt, link, n, s, c1, c2, num, slot, mapdev);
if ((1/best_par.fit) != 0){ if ((1/best_par.fit) != 0){
log.info("规划最短时延:"+(1/best_par.fit)); // log.info("规划最短时延:"+(1/best_par.fit));
//赋值节点映射结果 //赋值节点映射结果
int itemp = 0; int itemp = 0;
for (int a:best_par.taskfinal for (int a:best_par.taskfinal
...@@ -277,8 +303,8 @@ public class Bpso { ...@@ -277,8 +303,8 @@ public class Bpso {
par_array[j] = temp[0]; par_array[j] = temp[0];
best_par = temp[1]; best_par = temp[1];
} }
log.info("当前迭代次数:"+i); /* log.info("当前迭代次数:"+i);
log.info("最佳粒子时延:"+(1/best_par.fit)); log.info("最佳粒子时延:"+(1/best_par.fit));*/
} }
return best_par; return best_par;
......
...@@ -82,13 +82,35 @@ public class CpcTrans implements TransService { ...@@ -82,13 +82,35 @@ public class CpcTrans implements TransService {
//int[] func = {0, 2, 3, 3, 1, 1, 4, 0}; //int[] func = {0, 2, 3, 3, 1, 1, 4, 0};
//任务表 //任务表
String[] tasks = {"start/end","binaryProcess", "cutProcess", "greyProcess", "mergeProcess","tailorProcess", "distributeProcess"}; String[] tasks = {"start/end","binaryProcess", "cutProcess", "greyProcess", "mergeProcess","tailorProcess", "distributeProcess"};
//卫星名列表
String[] iridiums = {"IRIDIUM 103",
"IRIDIUM 102",
"IRIDIUM 104",
"IRIDIUM 108",
"IRIDIUM 113",
"IRIDIUM 120",
"IRIDIUM 117",
"IRIDIUM 128",
"IRIDIUM 133",
"IRIDIUM 122",
"IRIDIUM 119",
"IRIDIUM 132",
"IRIDIUM 139",
"IRIDIUM 135",
"IRIDIUM 116",
"IRIDIUM 151",
"IRIDIUM 137",
"IRIDIUM 153",
"IRIDIUM 144",
"IRIDIUM 157" };
Bpso doMap = new Bpso(); Bpso doMap = new Bpso();
doMap.doMapApp(link,func,bpsoConfig); doMap.doMapApp(link,func,bpsoConfig);
//映射结果 //映射结果
int[] result = doMap.result; int[] result = doMap.result;
// System.out.println("optimal mapping scheme"+ Arrays.toString(result)); // System.out.println("optimal mapping scheme"+ Arrays.toString(result));
log.info("optimal mapping scheme"+ Arrays.toString(result)); // log.info("optimal mapping scheme"+ Arrays.toString(result));
//路径表 //路径表
String[] path = new String[link[0].length]; String[] path = new String[link[0].length];
...@@ -110,7 +132,22 @@ public class CpcTrans implements TransService { ...@@ -110,7 +132,22 @@ public class CpcTrans implements TransService {
//左为边起点,右为边终点 //左为边起点,右为边终点
path[tm] = startHop+"->"+endHop; path[tm] = startHop+"->"+endHop;
} }
log.info("任务规划结果:"+Arrays.toString(path)); // log.info("任务规划结果:"+Arrays.toString(path));
// 向展示效果低头
String[] pathTable = new String[link[0].length];
for (int tm = 0;tm<link[0].length;tm++) {
// pathTable[tm] = result
String[] split = path[tm].split("->");
StringBuffer stringBuffer = new StringBuffer();
if (split[0].equals("D1")) {
stringBuffer.append(iridiums[0]);
}else stringBuffer.append(iridiums[Integer.parseInt(split[0].split("sate")[1])]);
stringBuffer.append("->");
stringBuffer.append(iridiums[Integer.parseInt(split[1].split("sate")[1])]);
pathTable[tm] = stringBuffer.toString();
}
log.info("pathTable: "+Arrays.toString(pathTable));
System.out.println();
//任务表 //任务表
ConcurrentHashMap<String,String> taskTable = new ConcurrentHashMap(); ConcurrentHashMap<String,String> taskTable = new ConcurrentHashMap();
...@@ -129,7 +166,15 @@ public class CpcTrans implements TransService { ...@@ -129,7 +166,15 @@ public class CpcTrans implements TransService {
taskTable.put(hop,tasks[func[tm]]); taskTable.put(hop,tasks[func[tm]]);
} }
log.info("子任务功能执行卫星列表:"+taskTable.toString()); // log.info("子任务功能执行卫星列表:"+taskTable.toString());
// 向展示效果低头
ConcurrentHashMap<String,String> taskTableIrid = new ConcurrentHashMap();
for (int tm = 0;tm<result.length;tm++){
String hop = iridiums[result[tm]];
taskTableIrid.put(hop,tasks[func[tm]]);
}
log.info("taskTable: "+taskTableIrid.toString());
System.out.println();
//T3路由表 //T3路由表
String[][] route = new String[lastHop.length][lastHop[0].length]; String[][] route = new String[lastHop.length][lastHop[0].length];
for(int i =0;i<lastHop.length;i++){ for(int i =0;i<lastHop.length;i++){
...@@ -148,7 +193,15 @@ public class CpcTrans implements TransService { ...@@ -148,7 +193,15 @@ public class CpcTrans implements TransService {
}*/ }*/
} }
} }
log.info("跨时隙路由表:"+Arrays.deepToString(route)); // log.info("跨时隙路由表:"+Arrays.deepToString(route));
// 向展示效果低头
String[][] routeIrid = new String[lastHop.length][lastHop[0].length];
for(int i =0;i<lastHop.length;i++){
for (int j=0;j<lastHop[0].length;j++) {
routeIrid[i][j] = iridiums[lastHop[i][j]];
}
}
// log.info("route: "+Arrays.deepToString(routeIrid));
boolean flag = false; boolean flag = false;
// 防止形成自环,比如route[1][2] = sate1 那么发往sate2的数据包将永远在sate1自环 // 防止形成自环,比如route[1][2] = sate1 那么发往sate2的数据包将永远在sate1自环
...@@ -160,7 +213,7 @@ public class CpcTrans implements TransService { ...@@ -160,7 +213,7 @@ public class CpcTrans implements TransService {
} }
} }
if (flag==false){ if (flag==false){
System.out.println("correct"); // System.out.println("correct");
} }
CnfData dataPackage = new CnfData(); CnfData dataPackage = new CnfData();
...@@ -178,11 +231,15 @@ public class CpcTrans implements TransService { ...@@ -178,11 +231,15 @@ public class CpcTrans implements TransService {
//ip池 //ip池
// dataPackage.setIpPool(findService.findIPool()); // dataPackage.setIpPool(findService.findIPool());
String[] routeself = findService.findRoute(dataPackage.getCurrentSataHop(), dataPackage.getRoute()); String[] routeself = findService.findRoute(dataPackage.getCurrentSataHop(), dataPackage.getRoute());
log.info("该节点转发路由表:"+Arrays.toString(routeself)); log.info("route of current sate: "+ Arrays.toString(routeIrid[0]));
System.out.println();
ArrayList<String> destinSataHops = findService.findDestinSataHops(path,"D1"); ArrayList<String> destinSataHops = findService.findDestinSataHops(path,"D1");
log.info("该子任务边终止卫星:"+destinSataHops); // log.info("该子任务边终止卫星:"+destinSataHops);
for(String des : destinSataHops) { for(String des : destinSataHops) {
CnfData transferPackage = dataPackage; CnfData transferPackage = dataPackage;
log.info("next Task exec sate: "+ iridiums[Integer.parseInt(des.split("sate")[1])]);
System.out.println();
//目的 //目的
transferPackage.setDestinSataHop(des); transferPackage.setDestinSataHop(des);
//当前 //当前
...@@ -219,7 +276,8 @@ public class CpcTrans implements TransService { ...@@ -219,7 +276,8 @@ public class CpcTrans implements TransService {
String IP = "172.17.0.2:8083"; String IP = "172.17.0.2:8083";
// String IP =url+":8083"; // String IP =url+":8083";
log.info("目标地址:"+IP); log.info("nextHopIp: "+url);
System.out.println();
ResponseEntity<String> res = restTemplate.postForEntity("http://" + IP + "/transfer", cnfData, String.class); ResponseEntity<String> res = restTemplate.postForEntity("http://" + IP + "/transfer", cnfData, String.class);
if (!res.getStatusCode().is2xxSuccessful()) { if (!res.getStatusCode().is2xxSuccessful()) {
throw new RuntimeException("send Error!"); throw new RuntimeException("send Error!");
......
...@@ -2,6 +2,10 @@ package top.ninwoo.cloud.service.csv; ...@@ -2,6 +2,10 @@ package top.ninwoo.cloud.service.csv;
import top.ninwoo.cloud.service.bpso.Bpso; import top.ninwoo.cloud.service.bpso.Bpso;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -124,5 +128,55 @@ public class Wteg { ...@@ -124,5 +128,55 @@ public class Wteg {
return edgeWeight; return edgeWeight;
} }
public static double[][] getIridiumWteg(int dev){
int maxweight = Bpso.MAXWEIGHT;
int[][] result = readTxtFile("hjt1.txt",dev);
double[][] resultD = new double[dev][dev];
for (int i = 0;i<result.length;i++) {
for (int j =0;j<result[0].length;j++) {
if (i == j) {
resultD[i][j] = 0;
}else if (result[i][j] == 1) {
resultD[i][j] = 500;
}else {
resultD[i][j] = maxweight;
}
}
}
return resultD;
}
public static int[][] readTxtFile(String filePath,int dev){
try {
String encoding="GBK";
File file=new File(filePath);
if(file.isFile() && file.exists()){ //判断文件是否存在
InputStreamReader read = new InputStreamReader(
new FileInputStream(file),encoding);//考虑到编码格式
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
int[][] topo = new int[dev][dev];
int index = 0;
while((lineTxt = bufferedReader.readLine()) != null){
// System.out.println(lineTxt);
for (int i = 0;i<lineTxt.length();i++){
topo[index][i] = lineTxt.charAt(i)-'0';
}
index++;
//
}
read.close();
return topo;
}else{
System.out.println("找不到指定的文件");
}
} catch (Exception e) {
System.out.println("读取文件内容出错");
e.printStackTrace();
}
return new int[0][];
}
} }
...@@ -23,6 +23,6 @@ bps.c=10 ...@@ -23,6 +23,6 @@ bps.c=10
# 子任务数据量 与任务总数一致 # 子任务数据量 与任务总数一致
bps.D=10,10,1,3,0.8,2.4,0.7,1.2,0.4,1.2 bps.D=10,10,1,3,0.8,2.4,0.7,1.2,0.4,1.2
# 设备总数 # 设备总数
bps.dev=12 bps.dev=20
# 设备计算能力 与设备数量一致 # 设备计算能力 与设备数量一致
bps.nt=1,1.112341341313,0.5196272109574349,0.675827555541419,0.7637869915859579,0.7998320296858645,0.638652700648973,0.6396760676518485,0.5615337810185533,0.6356797503522186,0.8266103444996542,0.8102279249524735,1.17057296148341216,1 bps.nt=1,1.112341341313,0.5196272109574349,0.675827555541419,0.7637869915859579,0.7998320296858645,0.638652700648973,0.6396760676518485,0.5615337810185533,0.6356797503522186,0.8266103444996542,0.8102279249524735,1.17057296148341216,1,1.112341341313,0.5196272109574349,0.675827555541419,0.7637869915859579,0.7998320296858645,0.638652700648973,0.6396760676518485,0.5615337810185533,0.6356797503522186,0.8266103444996542,0.8102279249524735,1.17057296148341216,1
\ No newline at end of file \ No newline at end of file
...@@ -43,10 +43,40 @@ public class DataController { ...@@ -43,10 +43,40 @@ public class DataController {
@RequestMapping(value = "/transfer", method = RequestMethod.POST) @RequestMapping(value = "/transfer", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public String Transfer(@RequestBody CnfData cnfData) throws IOException { public String Transfer(@RequestBody CnfData cnfData) throws IOException {
System.out.println();
log.info("//////////////////////////////////////////////"); log.info("//////////////////////////////////////////////");
log.info("receive cnfdata"); System.out.println();
/* System.out.println("//////////////////////////////////////////////"); log.info("receive pathCompData");
System.out.println("receive cnfdata");*/ System.out.println();
//卫星名列表
String[] iridiums = {"IRIDIUM 103",
"IRIDIUM 102",
"IRIDIUM 104",
"IRIDIUM 108",
"IRIDIUM 113",
"IRIDIUM 120",
"IRIDIUM 117",
"IRIDIUM 128",
"IRIDIUM 133",
"IRIDIUM 122",
"IRIDIUM 119",
"IRIDIUM 132",
"IRIDIUM 139",
"IRIDIUM 135",
"IRIDIUM 116",
"IRIDIUM 151",
"IRIDIUM 137",
"IRIDIUM 153",
"IRIDIUM 144",
"IRIDIUM 157" };
//向展示效果低头
String currentSate = iridiums[Integer.parseInt(cnfData.getCurrentSataHop().split("sate")[1])];
log.info("currentSateHop: "+currentSate);
System.out.println();
String endSate = iridiums[Integer.parseInt(cnfData.getDestinSataHop().split("sate")[1])];
log.info("endSateHop: "+endSate);
System.out.println();
// 表示当前节点瞬时业务状态,同时将输入图片载入,及子任务名称 // 表示当前节点瞬时业务状态,同时将输入图片载入,及子任务名称
/* /*
* error 数据包错误 * error 数据包错误
...@@ -57,23 +87,31 @@ public class DataController { ...@@ -57,23 +87,31 @@ public class DataController {
* */ * */
String res = transService.parseData(cnfData); String res = transService.parseData(cnfData);
log.info("current task status:"+res); log.info("current task status:"+res);
System.out.println();
FindServiceImpl findService = new FindServiceImpl(); FindServiceImpl findService = new FindServiceImpl();
switch (res) { switch (res) {
//仅做转发节点 //仅做转发节点
case "pass": case "pass":
log.info("just transfer"); // log.info("just transfer");
// System.out.println("just transfer"); // System.out.println("just transfer");
//装包 get0很奇怪 //装包 get0很奇怪
CnfData newtransData = transService.packageData(cnfData).get(0); CnfData newtransData = transService.packageData(cnfData).get(0);
log.info("next sate name: "+newtransData.getNextSataHop()); // log.info("nextSateHop: "+newtransData.getNextSataHop());
String nextSate = iridiums[Integer.parseInt(cnfData.getNextSataHop().split("sate")[1])];
log.info("nextSateHop: "+nextSate);
System.out.println();
// System.out.println("nextsataHop: "+newtransData.getNextSataHop()); // System.out.println("nextsataHop: "+newtransData.getNextSataHop());
//发包 //发包
log.info("next sate ip: "+newtransData.getNextIPHop()); // log.info("next sate ip: "+newtransData.getNextIPHop());
log.info("nextHopIP: "+newtransData.getNextIPHop());
System.out.println();
transService.sendData(newtransData, newtransData.getNextIPHop()); transService.sendData(newtransData, newtransData.getNextIPHop());
log.info("transfer success!"); // log.info("transfer success!");
System.out.println("transfer sucess"); // System.out.println("transfer success");
log.info("transfer success!");
System.out.println();
return "transfer sucess"; return "transfer sucess";
//出错 //出错
...@@ -86,9 +124,10 @@ public class DataController { ...@@ -86,9 +124,10 @@ public class DataController {
//储存图片节点 //储存图片节点
saveToFile(cnfData.getPicture(), "/pic/out-"+cnfData.getPicture().getSliceId()+".jpg"); saveToFile(cnfData.getPicture(), "/pic/out-"+cnfData.getPicture().getSliceId()+".jpg");
String message = cnfData.getCurrentSataHop(); String message = cnfData.getCurrentSataHop();
log.info("current node is the end node:"+message); // log.info("current node is the end node:"+message);
log.info("Task exec & save success");
transService.backEarth(message); transService.backEarth(message);
System.out.println("end hop"); // System.out.println("end hop");
return "end"; return "end";
//需要多个数据包 //需要多个数据包
...@@ -98,20 +137,29 @@ public class DataController { ...@@ -98,20 +137,29 @@ public class DataController {
//完成路径计算 //完成路径计算
case "pathComputing": case "pathComputing":
System.out.println("pathComputing task process..."); // System.out.println("pathComputing task process...");
log.info("invoking picture process subTask: "+PicServiceImpl.taskName);
System.out.println();
//完成图像处理功能 //完成图像处理功能
picService.PicTask(); picService.PicTask();
//得到图像 //得到图像
LinkedList<Picture> pictures = picService.getPicPara(); LinkedList<Picture> pictures = picService.getPicPara();
//装包 //装包
for (CnfData newData:transService.packageData(cnfData, pictures)) { for (CnfData newData:transService.packageData(cnfData, pictures)) {
log.info("next sate name:"+newData.getNextSataHop()); // log.info("next sate name:"+newData.getNextSataHop());
System.out.println("nextSate: "+newData.getNextSataHop()); String nextSate2 = iridiums[Integer.parseInt(newData.getNextSataHop().split("sate")[1])];
log.info("nextSateHop: "+nextSate2);
System.out.println();
// System.out.println("nextSate: "+newData.getNextSataHop());
log.info("nextHopIP: "+newData.getNextIPHop());
System.out.println();
//发包 //发包
transService.sendData(newData, newData.getNextIPHop()); transService.sendData(newData, newData.getNextIPHop());
} }
System.out.println("cpc transfer success"); // System.out.println("cpc transfer success");
log.info("cpc & transfer success");
log.info("exec"+PicServiceImpl.taskName+" & transfer success");
System.out.println();
return "cpc task&transfer success"; return "cpc task&transfer success";
case "distributeProcess": case "distributeProcess":
......
...@@ -26,7 +26,7 @@ public class PicServiceImpl { ...@@ -26,7 +26,7 @@ public class PicServiceImpl {
//清空图像 //清空图像
delPicPara(); delPicPara();
// 创建图像处理功能对象 // 创建图像处理功能对象
log.info("prepare to invoke "+taskName); // log.info("prepare to invoke "+taskName);
picRes = getPicService(taskName,1,picOrigin); //sliceNum 参数没用到 picRes = getPicService(taskName,1,picOrigin); //sliceNum 参数没用到
picOrigin.clear(); picOrigin.clear();
} }
...@@ -36,8 +36,9 @@ public class PicServiceImpl { ...@@ -36,8 +36,9 @@ public class PicServiceImpl {
private LinkedList<Picture> getPicService(String taskName, int SliceNum, LinkedList<Picture> picOrigin) { private LinkedList<Picture> getPicService(String taskName, int SliceNum, LinkedList<Picture> picOrigin) {
String in = (taskName.substring(0, 1).toUpperCase() + taskName.substring(1)+"Impl") String in = (taskName.substring(0, 1).toUpperCase() + taskName.substring(1)+"Impl")
.replace("Process","Service"); .replace("Process","Service");
String packagePath = "top.ninwoo.edge.service.impl.picService."; String packagePath = "top.ninwoo.edge.service.impl.picService.";
log.info("subtask class name:"+(packagePath+in)); // log.info("subtask class name:"+(packagePath+in));
LinkedList<Picture> result = null; LinkedList<Picture> result = null;
try { try {
Class<?> name = Class.forName(packagePath+in); Class<?> name = Class.forName(packagePath+in);
......
...@@ -16,7 +16,6 @@ import top.ninwoo.edge.service.impl.PicServiceImpl; ...@@ -16,7 +16,6 @@ import top.ninwoo.edge.service.impl.PicServiceImpl;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
@Service @Service
...@@ -43,7 +42,7 @@ public class TransServiceImpl implements TransferService { ...@@ -43,7 +42,7 @@ public class TransServiceImpl implements TransferService {
if (!res.getStatusCode().is2xxSuccessful()) { if (!res.getStatusCode().is2xxSuccessful()) {
throw new RuntimeException("send Error!"); throw new RuntimeException("send Error!");
} }
System.out.println("send picRes sucess"); // System.out.println("send picRes sucess");
return "success"; return "success";
} }
...@@ -86,9 +85,6 @@ public class TransServiceImpl implements TransferService { ...@@ -86,9 +85,6 @@ public class TransServiceImpl implements TransferService {
} }
//是否为该边节点 //是否为该边节点
log.info("current sate: "+cnfData.getCurrentSataHop());
log.info("Destination sate: "+cnfData.getDestinSataHop());
if (cnfData.getCurrentSataHop().equals(cnfData.getDestinSataHop())){ if (cnfData.getCurrentSataHop().equals(cnfData.getDestinSataHop())){
// 通过任务分配表和当前卫星名寻找当前任务 // 通过任务分配表和当前卫星名寻找当前任务
String task = findService.findTask(cnfData.getCurrentSataHop(),cnfData.getTaskTable()); String task = findService.findTask(cnfData.getCurrentSataHop(),cnfData.getTaskTable());
...@@ -134,7 +130,7 @@ public class TransServiceImpl implements TransferService { ...@@ -134,7 +130,7 @@ public class TransServiceImpl implements TransferService {
LinkedList<CnfData> newData = new LinkedList<>(); LinkedList<CnfData> newData = new LinkedList<>();
//找到路由 //找到路由
String[] route = findService.findRoute(cnfData.getCurrentSataHop(), cnfData.getRoute()); String[] route = findService.findRoute(cnfData.getCurrentSataHop(), cnfData.getRoute());
log.info("current sate route: "+ Arrays.toString(route)); // log.info("current sate route: "+ Arrays.toString(route));
CnfData newDataPackage = cnfData; CnfData newDataPackage = cnfData;
//设置下一跳地址 //设置下一跳地址
newDataPackage.setNextSataHop(findService.findNextHop(newDataPackage.getDestinSataHop(), route)); newDataPackage.setNextSataHop(findService.findNextHop(newDataPackage.getDestinSataHop(), route));
...@@ -184,6 +180,6 @@ public class TransServiceImpl implements TransferService { ...@@ -184,6 +180,6 @@ public class TransServiceImpl implements TransferService {
public void backEarth(String message){ public void backEarth(String message){
String IP = "192.168.253.130" + ":8082"; String IP = "192.168.253.130" + ":8082";
String res = restTemplate.postForObject("http://" + IP + "/getDate?message=", message, String.class); String res = restTemplate.postForObject("http://" + IP + "/getDate?message=", message, String.class);
System.out.println(res); // System.out.println(res);
} }
} }
...@@ -30,7 +30,7 @@ public class StaticSateDeploy { ...@@ -30,7 +30,7 @@ public class StaticSateDeploy {
@Test @Test
public void testSendSeparateConfig() { public void testSendSeparateConfig() {
int sateNum = 12; int sateNum = 20;
ArrayList<SeparatedClusterConfig> clusterConfigs = new ArrayList<>(); ArrayList<SeparatedClusterConfig> clusterConfigs = new ArrayList<>();
SeparatedClusterConfig separatedClusterConfig = new SeparatedClusterConfig(); SeparatedClusterConfig separatedClusterConfig = new SeparatedClusterConfig();
......
00000000011111000000
00000000011111000000
00000111100000000000
00000000011111000000
00000000011111000000
00100000000000000001
00100000000000000001
00100000000000000001
00100000000000000001
11011000000000111110
11011000000000000000
11011000000000111110
11011000000000000000
11011000000000111110
00000000010101000000
00000000010101000000
00000000010101000000
00000000010101000000
00000000010101000000
00000111100000000000
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