Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
65bff7b4
Commit
65bff7b4
authored
Mar 16, 2021
by
jthu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
正式测通版本 修改网络规模 调节网络拓扑 增加展示布局
parent
6e3cac7c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
253 additions
and
41 deletions
+253
-41
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/controller/DataCtrl.java
...d/src/main/java/top/ninwoo/cloud/controller/DataCtrl.java
+11
-2
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/bpso/Bpso.java
...oud/src/main/java/top/ninwoo/cloud/service/bpso/Bpso.java
+30
-4
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/cpcTrans/CpcTrans.java
...main/java/top/ninwoo/cloud/service/cpcTrans/CpcTrans.java
+66
-8
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/csv/Wteg.java
...loud/src/main/java/top/ninwoo/cloud/service/csv/Wteg.java
+54
-0
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/application.properties
...pp-docker-cloud/src/main/resources/application.properties
+2
-2
apps/cnf-pathComp-app/app-docker-edge/src/main/java/top/ninwoo/edge/controller/DataController.java
.../main/java/top/ninwoo/edge/controller/DataController.java
+63
-15
apps/cnf-pathComp-app/app-docker-edge/src/main/java/top/ninwoo/edge/service/impl/PicServiceImpl.java
...ain/java/top/ninwoo/edge/service/impl/PicServiceImpl.java
+3
-2
apps/cnf-pathComp-app/app-docker-edge/src/main/java/top/ninwoo/edge/service/impl/transferService/TransServiceImpl.java
...o/edge/service/impl/transferService/TransServiceImpl.java
+3
-7
cnf-test/src/test/java/top/ninwoo/StaticSateDeploy.java
cnf-test/src/test/java/top/ninwoo/StaticSateDeploy.java
+1
-1
hjt1.txt
hjt1.txt
+20
-0
No files found.
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/controller/DataCtrl.java
View file @
65bff7b4
package
top.ninwoo.cloud.controller
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
...
...
@@ -21,6 +22,7 @@ import java.util.HashMap;
import
java.util.LinkedList
;
import
java.util.concurrent.ConcurrentHashMap
;
@Slf4j
@Controller
public
class
DataCtrl
{
...
...
@@ -70,9 +72,15 @@ public class DataCtrl {
func
[
i
]
=
Integer
.
parseInt
(
funs
[
i
]);
}
System
.
out
.
println
();
log
.
info
(
"//////////////////////////////////////////////"
);
System
.
out
.
println
();
LinkedList
<
CnfData
>
cnfData
=
cpcTrans
.
packageData
(
picture
,
link
,
func
);
//发送
Date
time
=
new
Date
();
starTime
=
time
.
getTime
();
System
.
out
.
println
(
"开始路径计算: "
+
starTime
);
for
(
CnfData
data
:
cnfData
)
{
cpcTrans
.
sendData
(
data
,
data
.
getNextIPHop
());
}
...
...
@@ -244,8 +252,9 @@ public class DataCtrl {
public
String
getDate
(
@RequestParam
(
"message"
)
String
message
)
{
System
.
out
.
println
(
"返回收到信息:"
+
message
);
Date
time
=
new
Date
();
System
.
out
.
println
(
"时间间隔:"
+
(
time
.
getTime
()
-
starTime
));
return
"backEarth sucess"
;
System
.
out
.
println
(
"时间间隔:"
+
(
time
.
getTime
()
-
starTime
)/
1000
+
"s"
);
return
"backEarth success"
;
}
//收到图片时的时间
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/bpso/Bpso.java
View file @
65bff7b4
...
...
@@ -123,13 +123,31 @@ public class Bpso {
dev
=
num
*
slotnum
;
n2
=
dev
-
N_STABLE
*
slotnum
;
//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
.
pathRecord
pathRecord
=
dijs
.
dijstra
(
edgeWeight
,
testLatency
);
//2最短路由矩阵 时间扩展图最短路由时延矩阵
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
;
// 原本求的是最后一跳路由,但是现在求得是下一跳路由
for
(
int
j
=
0
;
j
<
lastHop
.
length
;
j
++){
for
(
int
i
=
0
;
i
<
lastHop
.
length
;
i
++){
int
tmp0
=
lastHop
[
j
][
i
];
...
...
@@ -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
];
for
(
int
l
=
0
;
l
<
lastHop
.
length
/
num
;
l
++)
{
...
...
@@ -161,7 +187,7 @@ public class 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
);
if
((
1
/
best_par
.
fit
)
!=
0
){
log
.
info
(
"规划最短时延:"
+(
1
/
best_par
.
fit
));
//
log.info("规划最短时延:"+(1/best_par.fit));
//赋值节点映射结果
int
itemp
=
0
;
for
(
int
a:
best_par
.
taskfinal
...
...
@@ -277,8 +303,8 @@ public class Bpso {
par_array
[
j
]
=
temp
[
0
];
best_par
=
temp
[
1
];
}
log
.
info
(
"当前迭代次数:"
+
i
);
log
.
info
(
"最佳粒子时延:"
+(
1
/
best_par
.
fit
));
/*
log.info("当前迭代次数:"+i);
log.info("最佳粒子时延:"+(1/best_par.fit));
*/
}
return
best_par
;
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/cpcTrans/CpcTrans.java
View file @
65bff7b4
...
...
@@ -82,13 +82,35 @@ public class CpcTrans implements TransService {
//int[] func = {0, 2, 3, 3, 1, 1, 4, 0};
//任务表
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
();
doMap
.
doMapApp
(
link
,
func
,
bpsoConfig
);
//映射结果
int
[]
result
=
doMap
.
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
];
...
...
@@ -110,7 +132,22 @@ public class CpcTrans implements TransService {
//左为边起点,右为边终点
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
();
...
...
@@ -129,7 +166,15 @@ public class CpcTrans implements TransService {
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路由表
String
[][]
route
=
new
String
[
lastHop
.
length
][
lastHop
[
0
].
length
];
for
(
int
i
=
0
;
i
<
lastHop
.
length
;
i
++){
...
...
@@ -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
;
// 防止形成自环,比如route[1][2] = sate1 那么发往sate2的数据包将永远在sate1自环
...
...
@@ -160,7 +213,7 @@ public class CpcTrans implements TransService {
}
}
if
(
flag
==
false
){
System
.
out
.
println
(
"correct"
);
//
System.out.println("correct");
}
CnfData
dataPackage
=
new
CnfData
();
...
...
@@ -178,11 +231,15 @@ public class CpcTrans implements TransService {
//ip池
// dataPackage.setIpPool(findService.findIPool());
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"
);
log
.
info
(
"该子任务边终止卫星:"
+
destinSataHops
);
// log.info("该子任务边终止卫星:"+destinSataHops);
for
(
String
des
:
destinSataHops
)
{
CnfData
transferPackage
=
dataPackage
;
log
.
info
(
"next Task exec sate: "
+
iridiums
[
Integer
.
parseInt
(
des
.
split
(
"sate"
)[
1
])]);
System
.
out
.
println
();
//目的
transferPackage
.
setDestinSataHop
(
des
);
//当前
...
...
@@ -219,7 +276,8 @@ public class CpcTrans implements TransService {
String
IP
=
"172.17.0.2: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
);
if
(!
res
.
getStatusCode
().
is2xxSuccessful
())
{
throw
new
RuntimeException
(
"send Error!"
);
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/csv/Wteg.java
View file @
65bff7b4
...
...
@@ -2,6 +2,10 @@ package top.ninwoo.cloud.service.csv;
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.SimpleDateFormat
;
import
java.util.Date
;
...
...
@@ -124,5 +128,55 @@ public class Wteg {
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
][];
}
}
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/application.properties
View file @
65bff7b4
...
...
@@ -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.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
\ No newline at end of file
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
apps/cnf-pathComp-app/app-docker-edge/src/main/java/top/ninwoo/edge/controller/DataController.java
View file @
65bff7b4
...
...
@@ -43,10 +43,40 @@ public class DataController {
@RequestMapping
(
value
=
"/transfer"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
String
Transfer
(
@RequestBody
CnfData
cnfData
)
throws
IOException
{
System
.
out
.
println
();
log
.
info
(
"//////////////////////////////////////////////"
);
log
.
info
(
"receive cnfdata"
);
/* System.out.println("//////////////////////////////////////////////");
System.out.println("receive cnfdata");*/
System
.
out
.
println
();
log
.
info
(
"receive pathCompData"
);
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 数据包错误
...
...
@@ -57,23 +87,31 @@ public class DataController {
* */
String
res
=
transService
.
parseData
(
cnfData
);
log
.
info
(
"current task status:"
+
res
);
System
.
out
.
println
();
FindServiceImpl
findService
=
new
FindServiceImpl
();
switch
(
res
)
{
//仅做转发节点
case
"pass"
:
log
.
info
(
"just transfer"
);
//
log.info("just transfer");
// System.out.println("just transfer");
//装包 get0很奇怪
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());
//发包
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
());
log
.
info
(
"transfer success!"
);
System
.
out
.
println
(
"transfer sucess"
);
// log.info("transfer success!");
// System.out.println("transfer success");
log
.
info
(
"transfer success!"
);
System
.
out
.
println
();
return
"transfer sucess"
;
//出错
...
...
@@ -86,9 +124,10 @@ public class DataController {
//储存图片节点
saveToFile
(
cnfData
.
getPicture
(),
"/pic/out-"
+
cnfData
.
getPicture
().
getSliceId
()+
".jpg"
);
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
);
System
.
out
.
println
(
"end hop"
);
//
System.out.println("end hop");
return
"end"
;
//需要多个数据包
...
...
@@ -98,20 +137,29 @@ public class DataController {
//完成路径计算
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
();
//得到图像
LinkedList
<
Picture
>
pictures
=
picService
.
getPicPara
();
//装包
for
(
CnfData
newData:
transService
.
packageData
(
cnfData
,
pictures
))
{
log
.
info
(
"next sate name:"
+
newData
.
getNextSataHop
());
System
.
out
.
println
(
"nextSate: "
+
newData
.
getNextSataHop
());
// log.info("next sate name:"+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
());
}
System
.
out
.
println
(
"cpc transfer success"
);
log
.
info
(
"cpc & transfer success"
);
// System.out.println("cpc transfer success");
log
.
info
(
"exec"
+
PicServiceImpl
.
taskName
+
" & transfer success"
);
System
.
out
.
println
();
return
"cpc task&transfer success"
;
case
"distributeProcess"
:
...
...
apps/cnf-pathComp-app/app-docker-edge/src/main/java/top/ninwoo/edge/service/impl/PicServiceImpl.java
View file @
65bff7b4
...
...
@@ -26,7 +26,7 @@ public class PicServiceImpl {
//清空图像
delPicPara
();
// 创建图像处理功能对象
log
.
info
(
"prepare to invoke "
+
taskName
);
//
log.info("prepare to invoke "+taskName);
picRes
=
getPicService
(
taskName
,
1
,
picOrigin
);
//sliceNum 参数没用到
picOrigin
.
clear
();
}
...
...
@@ -36,8 +36,9 @@ public class PicServiceImpl {
private
LinkedList
<
Picture
>
getPicService
(
String
taskName
,
int
SliceNum
,
LinkedList
<
Picture
>
picOrigin
)
{
String
in
=
(
taskName
.
substring
(
0
,
1
).
toUpperCase
()
+
taskName
.
substring
(
1
)+
"Impl"
)
.
replace
(
"Process"
,
"Service"
);
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
;
try
{
Class
<?>
name
=
Class
.
forName
(
packagePath
+
in
);
...
...
apps/cnf-pathComp-app/app-docker-edge/src/main/java/top/ninwoo/edge/service/impl/transferService/TransServiceImpl.java
View file @
65bff7b4
...
...
@@ -16,7 +16,6 @@ import top.ninwoo.edge.service.impl.PicServiceImpl;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
@Service
...
...
@@ -43,7 +42,7 @@ public class TransServiceImpl implements TransferService {
if
(!
res
.
getStatusCode
().
is2xxSuccessful
())
{
throw
new
RuntimeException
(
"send Error!"
);
}
System
.
out
.
println
(
"send picRes sucess"
);
//
System.out.println("send picRes sucess");
return
"success"
;
}
...
...
@@ -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
())){
// 通过任务分配表和当前卫星名寻找当前任务
String
task
=
findService
.
findTask
(
cnfData
.
getCurrentSataHop
(),
cnfData
.
getTaskTable
());
...
...
@@ -134,7 +130,7 @@ public class TransServiceImpl implements TransferService {
LinkedList
<
CnfData
>
newData
=
new
LinkedList
<>();
//找到路由
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
;
//设置下一跳地址
newDataPackage
.
setNextSataHop
(
findService
.
findNextHop
(
newDataPackage
.
getDestinSataHop
(),
route
));
...
...
@@ -184,6 +180,6 @@ public class TransServiceImpl implements TransferService {
public
void
backEarth
(
String
message
){
String
IP
=
"192.168.253.130"
+
":8082"
;
String
res
=
restTemplate
.
postForObject
(
"http://"
+
IP
+
"/getDate?message="
,
message
,
String
.
class
);
System
.
out
.
println
(
res
);
//
System.out.println(res);
}
}
cnf-test/src/test/java/top/ninwoo/StaticSateDeploy.java
View file @
65bff7b4
...
...
@@ -30,7 +30,7 @@ public class StaticSateDeploy {
@Test
public
void
testSendSeparateConfig
()
{
int
sateNum
=
12
;
int
sateNum
=
20
;
ArrayList
<
SeparatedClusterConfig
>
clusterConfigs
=
new
ArrayList
<>();
SeparatedClusterConfig
separatedClusterConfig
=
new
SeparatedClusterConfig
();
...
...
hjt1.txt
0 → 100644
View file @
65bff7b4
00000000011111000000
00000000011111000000
00000111100000000000
00000000011111000000
00000000011111000000
00100000000000000001
00100000000000000001
00100000000000000001
00100000000000000001
11011000000000111110
11011000000000000000
11011000000000111110
11011000000000000000
11011000000000111110
00000000010101000000
00000000010101000000
00000000010101000000
00000000010101000000
00000000010101000000
00000111100000000000
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment