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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
alex037yang
openXG-WIC-Cnf
Commits
d97aae8f
Commit
d97aae8f
authored
Aug 12, 2020
by
Hu Jintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
显示拓扑变化
parent
83edb31a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
199 additions
and
62 deletions
+199
-62
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopo.java
...nCloud/src/main/java/top/ninwoo/test/doMap/CycleTopo.java
+56
-42
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
...ud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
+130
-7
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/entity/SimData.java
...rc/main/java/top/ninwoo/test/sateTopo/entity/SimData.java
+5
-3
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/entity/WeiXingData.java
...ain/java/top/ninwoo/test/sateTopo/entity/WeiXingData.java
+1
-1
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/service/impl/ToponetImpl.java
...va/top/ninwoo/test/sateTopo/service/impl/ToponetImpl.java
+1
-1
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/service/impl/WeixingImpl.java
...va/top/ninwoo/test/sateTopo/service/impl/WeixingImpl.java
+6
-8
No files found.
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopo.java
View file @
d97aae8f
...
...
@@ -17,73 +17,87 @@ public class CycleTopo {
ToponetImpl
tp
=
new
ToponetImpl
();
SimData
sd
=
new
SimData
();
//tp.delHistory();
File
file
=
new
File
(
"topusim_1.txt"
);
//D:\LabratoryJavaPro\codingDownload\latestCoding\
File
file
=
new
File
(
"D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt"
);
List
<
WeiXingData
>
wxData
=
null
;
{
try
{
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
//初始topo
double
[][]
toponet
=
tp
.
getWeightedTopology
(
wxData
,
sd
);
//去掉ovs
double
[][]
topoNet
=
new
double
[
30
][
30
];
for
(
int
i
=
0
;
i
<
topoNet
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
i
][
j
]
=
toponet
[
i
][
j
];
}
try
{
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
sd
.
setJiange
(
20
);
sd
.
setC0
(
3
e10
);
//存储全周期拓扑
HashMap
<
Integer
,
double
[][]>
TopoStore
=
new
HashMap
<>();
TopoStore
.
put
(
0
,
topoNet
);
for
(
int
i
=
1
;
i
<
sd
.
getZhouqi
()/
sd
.
getJiange
();
i
++)
{
out:
for
(
int
i
=
0
;
i
<
sd
.
getZhouqi
()/
sd
.
getJiange
();
i
++)
{
//Thread.sleep(2000);
int
time
=
i
*
sd
.
getJiange
();
List
<
WeiXingData
>
changetp
=
wx
.
changeTopo
(
wxData
,
time
);
double
[][]
changeTopo
=
tp
.
getWeightedTopology
(
changetp
,
sd
);
double
[][]
topoChange
=
tp
.
getWeightedTopology
(
changetp
,
sd
);
/*//输出topo
for(int m = 0;m<topoChange.length;m++){
for(int n= 0;n<topoChange[0].length;n++){
System.out.print(topoChange[m][n] + " ");
}
System.out.println(" ");
}*/
//去掉ovs
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
//去掉ovs
double
[][]
topoNet
=
new
double
[
30
][
30
];
for
(
int
p
=
0
;
p
<
topoNet
.
length
;
p
++){
for
(
int
j
=
0
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
k
][
j
]
=
changeTopo
[
k
][
j
];
topoNet
[
p
][
j
]
=
topoChange
[
p
][
j
];
}
}
//补全对称矩阵
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
for
(
int
j
=
k
+
1
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
k
][
j
]
=
topoNet
[
j
][
k
];
}
}
TopoStore
.
put
(
i
,
topoNet
);
}
/*
* 对比全周期拓扑
* count记录重复拓扑行数
* count2记录不同拓扑数目
* */
int
count
=
0
;
int
count2
=
-
1
;
int
count2
=
0
;
Iterator
<
Map
.
Entry
<
Integer
,
double
[][]>>
iterator
=
TopoStore
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
()){
while
(
iterator
.
hasNext
()){
double
[][]
value
=
iterator
.
next
().
getValue
();
for
(
int
i
=
0
;
i
<
value
.
length
;
i
++){
if
(
i
>
0
){
boolean
equals
=
Arrays
.
equals
(
value
[
i
],
topoNet
[
i
]);
System
.
out
.
println
(
Arrays
.
deepToString
(
value
));
System
.
out
.
println
(
"========================================="
);
System
.
out
.
println
(
count2
);
while
(
iterator
.
hasNext
()){
double
[][]
valueNext
=
iterator
.
next
().
getValue
();
for
(
int
i
=
0
;
i
<
value
.
length
;
i
++){
boolean
equals
=
Arrays
.
equals
(
value
[
i
],
valueNext
[
i
]);
count
+=
(
equals
?
1
:
0
);
}
for
(
int
j
=
0
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
i
][
j
]
=
value
[
i
][
j
];
}
}
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
for
(
int
j
=
k
+
1
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
k
][
j
]
=
topoNet
[
j
][
k
];
}
if
(
count
!=
30
){
System
.
out
.
println
(
Arrays
.
deepToString
(
valueNext
));
System
.
out
.
println
(
"========================================="
);
System
.
out
.
println
(
count2
);
count2
++;
}
count
=
0
;
value
=
valueNext
;
}
if
(
count
!=
30
){
count2
++;
}
/* System.out.println(Arrays.deepToString(topoNet));
System.out.println("=========================================");
System.out.println(count2);*/
}
System
.
out
.
println
(
"所有topo完成"
);
return
TopoStore
;
}
}
}
\ No newline at end of file
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
View file @
d97aae8f
package
top.ninwoo.test.doMap
;
import
top.ninwoo.test.sateTopo.entity.SimData
;
/*
import top.ninwoo.test.sateTopo.entity.SimData;
import top.ninwoo.test.sateTopo.entity.WeiXingData;
import top.ninwoo.test.sateTopo.service.impl.ToponetImpl;
import top.ninwoo.test.sateTopo.service.impl.WeixingImpl;
...
...
@@ -16,8 +16,10 @@ public class CycleTopoUnit {
WeixingImpl wx = new WeixingImpl();
ToponetImpl tp = new ToponetImpl();
SimData sd = new SimData();
sd.setJiange(60);
sd.setC0(3e10);
//tp.delHistory();
File
file
=
new
File
(
"topusim_1.txt"
);
File file = new File("
D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\
topusim_1.txt");
//D:\LabratoryJavaPro\codingDownload\latestCoding\
List<WeiXingData> wxData = null;
{
...
...
@@ -36,6 +38,7 @@ public class CycleTopoUnit {
topoNet[i][j] = toponet[i][j];
}
}
//存储全周期拓扑
HashMap<Integer, int[][]> TopoStore = new HashMap<>();
TopoStore.put(0,topoNet);
...
...
@@ -56,12 +59,36 @@ public class CycleTopoUnit {
}
TopoStore.put(i,topoNet);
}
*//*
* 对比全周期拓扑
* count记录重复拓扑行数
* count2记录不同拓扑数目
* *//*
int count = 0;
int count2 = -1;
Iterator<Map.Entry<Integer, int[][]>> iterator = TopoStore.entrySet().iterator();
while
(
iterator
.
hasNext
()){
while
(iterator.hasNext()){
int[][] value = iterator.next().getValue();
for
(
int
i
=
0
;
i
<
value
.
length
;
i
++){
System.out.println(Arrays.deepToString(value));
System.out.println("=========================================");
while (iterator.hasNext()){
int[][] valueNext = iterator.next().getValue();
for (int i = 0;i<value.length;i++){
boolean equals = Arrays.equals(value[i], valueNext[i]);
count += (equals?1:0);
}
if (count != 30){
System.out.println(Arrays.deepToString(valueNext));
System.out.println("=========================================");
count2++;
}
count=0;
value=valueNext;
}
System.out.println(count2);
}
*//*for (int i = 0;i<value.length;i++){
if (i>0){
boolean equals = Arrays.equals(value[i], topoNet[i]);
count += (equals?1:0);
...
...
@@ -69,8 +96,8 @@ public class CycleTopoUnit {
for (int j = 0;j<topoNet.length;j++){
topoNet[i][j] = value[i][j];
}
}
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
}
*//*
*//*
for (int k = 0;k<topoNet.length;k++){
for (int j = k+1;j<topoNet.length;j++){
topoNet[k][j] = topoNet[j][k];
}
...
...
@@ -78,11 +105,107 @@ public class CycleTopoUnit {
}
if (count != 30){
count2++;
}*//*
*//* System.out.println(Arrays.deepToString(topoNet));
System.out.println("=========================================");
System.out.println(count2);*//*
return TopoStore;
}
}*/
import
top.ninwoo.test.sateTopo.entity.SimData
;
import
top.ninwoo.test.sateTopo.entity.WeiXingData
;
import
top.ninwoo.test.sateTopo.service.impl.ToponetImpl
;
import
top.ninwoo.test.sateTopo.service.impl.WeixingImpl
;
import
java.io.File
;
import
java.util.*
;
public
class
CycleTopoUnit
{
public
static
void
main
(
String
[]
args
)
throws
IllegalAccessException
{
cycleTp
();
}
public
static
HashMap
<
Integer
,
int
[][]>
cycleTp
()
throws
IllegalAccessException
{
//从文本中获取卫星的数据
WeixingImpl
wx
=
new
WeixingImpl
();
ToponetImpl
tp
=
new
ToponetImpl
();
SimData
sd
=
new
SimData
();
//tp.delHistory();
File
file
=
new
File
(
"D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt"
);
List
<
WeiXingData
>
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
/*int[][] topoInit = tp.getTopology(wxData,sd);
//输出topo
for(int j = 0;j<topoInit.length;j++){
for(int k= 0;k<topoInit[0].length;k++){
System.out.print(topoInit[j][k] + " ");
}
System
.
out
.
println
(
Arrays
.
deepToString
(
topoNet
));
System.out.println(" ");
} */
sd
.
setJiange
(
60
);
sd
.
setC0
(
3
e10
);
//存储全周期拓扑
HashMap
<
Integer
,
int
[][]>
TopoStore
=
new
HashMap
<>();
out:
for
(
int
i
=
0
;
i
<
sd
.
getZhouqi
()/
sd
.
getJiange
();
i
++)
{
//Thread.sleep(2000);
int
time
=
i
*
sd
.
getJiange
();
List
<
WeiXingData
>
changetp
=
wx
.
changeTopo
(
wxData
,
time
);
int
[][]
topoChange
=
tp
.
getTopology
(
changetp
,
sd
);
/*//输出topo
for(int m = 0;m<topoChange.length;m++){
for(int n= 0;n<topoChange[0].length;n++){
System.out.print(topoChange[m][n] + " ");
}
System.out.println(" ");
}*/
TopoStore
.
put
(
i
,
topoChange
);
}
/*
* 对比全周期拓扑
* count记录重复拓扑行数
* count2记录不同拓扑数目
* */
int
count
=
0
;
int
count2
=
0
;
Iterator
<
Map
.
Entry
<
Integer
,
int
[][]>>
iterator
=
TopoStore
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
()){
int
[][]
value
=
iterator
.
next
().
getValue
();
System
.
out
.
println
(
Arrays
.
deepToString
(
value
));
System
.
out
.
println
(
"========================================="
);
System
.
out
.
println
(
count2
);
while
(
iterator
.
hasNext
()){
int
[][]
valueNext
=
iterator
.
next
().
getValue
();
for
(
int
i
=
0
;
i
<
value
.
length
;
i
++){
boolean
equals
=
Arrays
.
equals
(
value
[
i
],
valueNext
[
i
]);
count
+=
(
equals
?
1
:
0
);
}
if
(
count
!=
30
){
System
.
out
.
println
(
Arrays
.
deepToString
(
valueNext
));
System
.
out
.
println
(
"========================================="
);
System
.
out
.
println
(
count2
);
count2
++;
}
count
=
0
;
value
=
valueNext
;
}
}
System
.
out
.
println
(
"所有topo完成"
);
return
TopoStore
;
}
}
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/entity/SimData.java
View file @
d97aae8f
...
...
@@ -7,9 +7,11 @@ import lombok.Data;
*/
@Data
public
class
SimData
{
//设置时间,默认为 2020-01-01 00-00-00
//24小时制
private
String
defaultDate
=
"2020-01-01 00-00-00"
;
//时间间隔,默认值为10
private
int
jiange
=
20
;
private
int
jiange
=
10
;
//周期值,默认值为100分钟,即为6000秒
private
int
zhouqi
=
6000
;
//todo:这里因该预设默认值
...
...
@@ -27,7 +29,7 @@ public class SimData {
private
double
lamda
=
0.05
;
//星间信道容量最低容限
private
double
c0
=
4
*
10
e7
;
private
double
c0
=
10
e9
;
public
double
ptGtGr
(){
return
pt
*
gt
*
gr
;
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/entity/WeiXingData.java
View file @
d97aae8f
...
...
@@ -22,7 +22,7 @@ public class WeiXingData {
//卫星的序列号
private
Integer
index
;
//运行时间
private
Integer
lastime
=
0
;
private
int
lastime
=
0
;
@Override
public
String
toString
(){
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/service/impl/ToponetImpl.java
View file @
d97aae8f
...
...
@@ -82,7 +82,7 @@ public class ToponetImpl implements Toponet {
double
r
=
this
.
distance
(
a
,
b
);
double
channelCapacity
;
channelCapacity
=
sd
.
getBandwidth
()*
Math
.
log
(
1
+(
sd
.
ptGtGr
()/(
Math
.
pow
(
4
*
Math
.
PI
*
r
*
sd
.
getJiange
()
/
sd
.
getLamda
(),
2
)*
sd
.
n0B
())))/
Math
.
log
(
2
);
channelCapacity
=
sd
.
getBandwidth
()*
Math
.
log
(
1
+(
sd
.
ptGtGr
()/(
Math
.
pow
(
4
*
Math
.
PI
*
r
/
sd
.
getLamda
(),
2
)*
sd
.
n0B
())))/
Math
.
log
(
2
);
return
channelCapacity
;
}
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/sateTopo/service/impl/WeixingImpl.java
View file @
d97aae8f
package
top.ninwoo.test.sateTopo.service.impl
;
import
top.ninwoo.test.sateTopo.entity.SimData
;
import
top.ninwoo.test.sateTopo.entity.WeiXingData
;
import
top.ninwoo.test.sateTopo.service.Weixing
;
...
...
@@ -16,8 +15,6 @@ import java.util.Map;
public
class
WeixingImpl
implements
Weixing
{
SimData
simData
=
new
SimData
();
@Override
public
List
<
Map
>
parseTxt
(
File
file
)
{
String
str
;
...
...
@@ -77,10 +74,11 @@ public class WeixingImpl implements Weixing {
}
@Override
public
List
<
WeiXingData
>
addWSpeed
(
List
<
WeiXingData
>
wx
,
int
zhouqi
)
{
public
List
<
WeiXingData
>
addWSpeed
(
List
<
WeiXingData
>
wx
,
int
zhouqi
)
{
for
(
int
i
=
0
;
i
<
wx
.
size
();
i
++){
if
(
wx
.
get
(
i
).
getTag
().
equals
(
true
)){
wx
.
get
(
i
).
setSpeed
(
2
*
Math
.
PI
*(
1
/
zhouqi
));}
Double
speed
=
2
*
Math
.
PI
/
zhouqi
;
wx
.
get
(
i
).
setSpeed
(
speed
);}
else
{
wx
.
get
(
i
).
setSpeed
((-
1
)*
2
*
Math
.
PI
*(
1
/
zhouqi
));}
}
return
wx
;
...
...
@@ -90,7 +88,7 @@ public class WeixingImpl implements Weixing {
public
List
<
WeiXingData
>
addAxis
(
List
<
WeiXingData
>
wx
)
{
for
(
int
i
=
0
;
i
<
wx
.
size
();
i
++)
{
Float
High
=
wx
.
get
(
i
).
getHigh
();
Double
hudu
=
Math
.
toRadians
(
wx
.
get
(
i
).
getSpeed
()
*
wx
.
get
(
i
).
getLastime
()
);
Double
hudu
=
wx
.
get
(
i
).
getSpeed
()
*
wx
.
get
(
i
).
getLastime
(
);
Double
Alpha
=
Math
.
toRadians
(
wx
.
get
(
i
).
getAlpha
());
Double
Beta
=
Math
.
toRadians
(
wx
.
get
(
i
).
getBeta
());
Double
Gamma
=
Math
.
toRadians
(
wx
.
get
(
i
).
getGamma
());
...
...
@@ -212,7 +210,7 @@ public class WeixingImpl implements Weixing {
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public
List
<
WeiXingData
>
iniTopo
(
File
file
,
int
zhouqi
)
throws
IllegalAccessException
{
public
List
<
WeiXingData
>
iniTopo
(
File
file
,
int
zhouqi
)
throws
IllegalAccessException
{
List
<
Map
>
maps
=
this
.
parseTxt
(
file
);
List
<
WeiXingData
>
wxData
=
this
.
initNet
(
maps
);
wxData
=
this
.
initChangeTopo
(
wxData
,
zhouqi
);
...
...
@@ -233,7 +231,7 @@ public class WeixingImpl implements Weixing {
}
@Override
public
List
<
WeiXingData
>
initChangeTopo
(
List
<
WeiXingData
>
wxData
,
int
zhouqi
)
{
public
List
<
WeiXingData
>
initChangeTopo
(
List
<
WeiXingData
>
wxData
,
int
zhouqi
)
{
wxData
=
this
.
addWSpeed
(
wxData
,
zhouqi
);
wxData
=
this
.
addAxis
(
wxData
);
this
.
checkWX
(
wxData
);
...
...
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