import copy
from datetime import datetime
from datetime import timedelta
from dateutil import parser
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import numpy as np
from numpy import mean
from tkinter import *
import time
import math
satellite=["sat0","sat1","sat2","sat3","sat4","sat5","sat6","sat7","sat8"]
address_name=["Abidjan","Accra","Asmara","Balikpapan","Bozeman","Crystal-Lake","Elk-City","Hanahan","Iquique",
"Lhasa","Madras","Manaus","Mangalore","Minsk","Munchen","Parole","Recife","Rio-de-Janeiro",
"Sarajevo","Wallingford-Center","Yaounde","北京","南宁","武汉"]
address_position={"Abidjan":[-4.02+360,5.32],"Accra":[-0.2+360,5.56],"Asmara":[15.33,38.97],"Balikpapan":[116.86,-1.21],
"Bozeman":[-111.04+360,45.68],"Crystal-Lake":[-88.33+360,42.23],"Elk-City":[-99.41+360,35.4],"Hanahan":[-80.01+360,32.93],
"Iquique":[-69.91+360,-20.26],"Lhasa":[91.13,29.65],"Madras":[80.25,13.06],"Manaus":[-60.01+360,-3.12],
"Mangalore":[75.16,12.95],"Minsk":[27.58,53.9],"Munchen":[11.54,48.14],"Parole":[-76.55+360,38.98],
"Recife":[-34.91+360,-8.09],"Rio-de-Janeiro":[-43.46+360,-22.72],"Sarajevo":[18.43,43.87],"Wallingford-Center":[-72.82+360,41.45],
"Yaounde":[11.51,3.87],"北京":[116.39,39.91],"南宁":[108.33,22.8],"武汉":[114.28,30.57]}
dict_circle={"sat0":[],"sat1":[],"sat2":[],"sat3":[],"sat4":[],"sat5":[],"sat6":[],"sat7":[],"sat8":[]}#每个卫星覆盖的圆,【时间,经度,纬度】
address_timewindow={"Abidjan":[],"Accra":[],"Asmara":[],"Balikpapan":[],"Bozeman":[],"Crystal-Lake":[],"Elk-City":[],"Hanahan":[],"Iquique":[],
"Lhasa":[],"Madras":[],"Manaus":[],"Mangalore":[],"Minsk":[],"Munchen":[],"Parole":[],"Recife":[],"Rio-de-Janeiro":[],"Sarajevo":[],"Wallingford-Center":[],"Yaounde":[],"北京":[],"南宁":[],"武汉":[]}#每个地点对应的窗口时间
address_single_timewindow={}
address_double_timewindow = {"Abidjan": [], "Accra": [], "Asmara": [], "Balikpapan": [], "Bozeman": [],
"Crystal-Lake": [], "Elk-City": [], "Hanahan": [], "Iquique": [],
"Lhasa": [], "Madras": [], "Manaus": [], "Mangalore": [], "Minsk": [], "Munchen": [],
"Parole": [], "Recife": [], "Rio-de-Janeiro": [], "Sarajevo": [],
"Wallingford-Center": [], "Yaounde": [], "北京": [], "南宁": [], "武汉": []}
address_freetime = {"Abidjan": [], "Accra": [], "Asmara": [], "Balikpapan": [], "Bozeman": [], "Crystal-Lake": [],
"Elk-City": [], "Hanahan": [], "Iquique": [],
"Lhasa": [], "Madras": [], "Manaus": [], "Mangalore": [], "Minsk": [], "Munchen": [],
"Parole": [], "Recife": [], "Rio-de-Janeiro": [], "Sarajevo": [], "Wallingford-Center": [],
"Yaounde": [], "北京": [], "南宁": [], "武汉": []}#间隙
max_freetime=[]#最大时间间隙
ave_freetime=[]#平均时间间隙
def getshijiancha(str1,str2):
#datetime.strptime是日期形式,相减之后变成datedelta时间差形式
#输入str,返回时间差
timetmp1=datetime.strptime(str(datetime.strptime(str1, '%Y/%m/%d,%H:%M:%S')-datetime.strptime(str2, '%Y/%m/%d,%H:%M:%S')),'%H:%M:%S')
return(timetmp1.hour * 3600 + timetmp1.minute * 60 + timetmp1.second)
def date2second(str):
str=datetime.strptime(str, '%Y/%m/%d,%H:%M:%S')
return (str.hour * 3600 + str.minute * 60 + str.second)
def dataprocessing():#传入相关的卫星和地点
global address_single_timewindow
for sat in dict_circle:
time = datetime(2022, 1, 1, 0, 0, 0) # 起始时间
file = open('Data/SatelliteInfo/SatCoverInfo_' + sat[3] + '.txt')
lines = file.readlines()
i = 0
while (i < len(lines)):
point = [] # 时间,圆心精度,圆心维度,半径
min1 = lines[i + 6].split() # 前为经度最小值,后为纬度
max1 = lines[i + 16].split() # 前为经度最大值,后为纬度
r = (float(max1[0]) - float(min1[0])) / 2
center = r + float(min1[0]) # 圆心的经度
point.append(time.strftime("%Y/%m/%d,%H:%M:%S"))
point.append(center)
point.append(float(min1[1]))
point.append(r)
dict_circle[sat].append(point)
time = time + timedelta(seconds=1) # 时间+1s
i += 22
# break#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1测试点,记得删掉
start = 0
end = 0
# 地点经度:address_position[address][0],地点纬度:address_position[address][1]
# 卫星覆盖圆心:dict_circle[circle][t][1],dict_circle[circle][t][2]
# 半径:dict_circle[circle][t][3]
for address in address_position:
for circle in dict_circle:
for t in range(0, 86401):
if (start == 0): # 还没找到开始的时间窗口,则加入开始时间
if ((address_position[address][0] - dict_circle[circle][t][1]) ** 2 +
(address_position[address][1] - dict_circle[circle][t][2]) ** 2) <= 49.07:
start = dict_circle[circle][t][0]
elif ((start != 0) and (end == 0)): # 还没找到结束的时间窗口,则加入结束时间
if ((address_position[address][0] - dict_circle[circle][t][1]) ** 2 +
(address_position[address][1] - dict_circle[circle][t][2]) ** 2) > 49.07:
end = dict_circle[circle][t][0]
address_timewindow[address].append([circle, start, end])
start = end = 0
# print(address_timewindow["Abidjan"])
# 计算时间窗口
# repeat:重叠时间段
repeat = {"Abidjan": [], "Accra": [], "Asmara": [], "Balikpapan": [], "Bozeman": [], "Crystal-Lake": [],
"Elk-City": [], "Hanahan": [], "Iquique": [],
"Lhasa": [], "Madras": [], "Manaus": [], "Mangalore": [], "Minsk": [], "Munchen": [], "Parole": [],
"Recife": [], "Rio-de-Janeiro": [], "Sarajevo": [], "Wallingford-Center": [], "Yaounde": [], "北京": [],
"南宁": [], "武汉": []}
tmp = 0
for address in address_timewindow:
for i in range(0, len(address_timewindow[address])):
for t in range(i + 1, len(address_timewindow[address])):
if ((address_timewindow[address][t][2] <= address_timewindow[address][i][1]) or (
address_timewindow[address][t][1] >= address_timewindow[address][i][2])):
continue
repeat[address].append([i, t])#记录重叠的时间窗口的序号,以配对形式记录
# for address in address_timewindow:
# address_single_timewindow[address]=address_timewindow[address]
address_single_timewindow=copy.deepcopy(address_timewindow)
jiaoji = []
# for address in repeat:
# print(repeat[address])
for address in repeat:
if (repeat[address]):
# 按照重叠卫星的第二个降序排列,这样先删除后面的元素不会影响前面的元素
repeat[address] = sorted(repeat[address], key=lambda x: x[1], reverse=True)
for timedui in repeat[address]:
# print(type(address_single_timewindow[address][timedui[0]][1]))
# print(address_single_timewindow[address][timedui[0]][1])
# 求并集
address_single_timewindow[address][timedui[0]][1] = min(address_timewindow[address][timedui[0]][1],
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1.项目代码功能经验证ok,确保稳定可靠运行。欢迎下载使用!在使用过程中,如有问题或建议,请及时私信沟通。 2.主要针对各个计算机相关专业,包括计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网等领域的在校学生、专业教师或企业员工使用。 3.项目具有丰富的拓展空间,不仅可作为入门进阶,也可直接作为毕设、课程设计、大作业、初期项目立项演示等用途。 4.当然也鼓励大家基于此进行二次开发。 5.期待你能在项目中找到乐趣和灵感,也欢迎你的分享和反馈! 【资源说明】 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip 基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于python实现的卫星对地覆盖计算+任务规划项目源码+详细注释.zip (4个子文件)
说明.md 315B
code
说明.md 315B
satellite.py 13KB
satellite.py 13KB
共 4 条
- 1
资源评论
- 2301_798057552024-06-14资源不错,很实用,内容全面,介绍详细,很好用,谢谢分享。
.whl
- 粉丝: 3830
- 资源: 4675
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功