Commit 8143f174 authored by Elf's avatar Elf

修改好bug,可见test/Parsetest/test1

parent 462fc42f
......@@ -22,7 +22,7 @@ public class WeiXingData {
//卫星的序列号
private Integer index;
//运行时间
private Integer lastime = 0;
private int lastime = 0;
@Override
public String toString(){
......
......@@ -15,7 +15,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@Component
public class Initapp implements CommandLineRunner {
@Autowired
......
......@@ -61,7 +61,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;
}
......
package top.ninwoo.weixingsim.service.impl;
import top.ninwoo.weixingsim.entity.SimData;
import top.ninwoo.weixingsim.entity.WeiXingData;
import top.ninwoo.weixingsim.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;
......@@ -80,7 +77,8 @@ public class WeixingImpl implements Weixing {
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());
......
package top.ninwoo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import top.ninwoo.weixingsim.WxMain;
import top.ninwoo.weixingsim.entity.SimData;
import top.ninwoo.weixingsim.entity.WeiXingData;
import top.ninwoo.weixingsim.service.impl.ToponetImpl;
import top.ninwoo.weixingsim.service.impl.WeixingImpl;
import java.io.File;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WxMain.class)
public class ParseTests {
@Test
public void test1() throws IllegalAccessException {
//从文本中获取卫星的数据
WeixingImpl wx = new WeixingImpl();
ToponetImpl tp = new ToponetImpl();
SimData sd = new SimData();
//tp.delHistory();
File file = new File("C:\\WorkSpace\\TXT\\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(" ");
} */
sd.setJiange(60);
sd.setC0(3e10);
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(" ");
}
}
System.out.println("所有topo完成");
}
}
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