同步轨道模型的修改
parent
b6802aec9e
commit
508919dcaf
|
@ -128,6 +128,9 @@ struct Point3 {
|
|||
double x = 0;
|
||||
double y = 0;
|
||||
double z = 0;
|
||||
void setX(double ix) { x = ix; }
|
||||
void setY(double iy) { y = iy; }
|
||||
void setZ(double iz) { z = iz; }
|
||||
};
|
||||
|
||||
struct DemBox {
|
||||
|
|
|
@ -37,7 +37,15 @@
|
|||
|
||||
|
||||
|
||||
QString longDoubleToQStringScientific(long double value) {
|
||||
std::ostringstream stream;
|
||||
|
||||
// 设置流的精度为35位有效数字,并使用科学计数法
|
||||
stream << std::scientific << std::setprecision(35) << value;
|
||||
|
||||
// 将标准字符串转换为 QString
|
||||
return QString::fromStdString(stream.str());
|
||||
}
|
||||
|
||||
QString getCurrentTimeString() {
|
||||
struct tm ConversionTime;
|
||||
|
|
|
@ -27,9 +27,17 @@
|
|||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include "LogInfoCls.h"
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
///////////////////////////////////// 运行时间打印
|
||||
/////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////// 基础数学函数 /////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
QString longDoubleToQStringScientific(long double value);
|
||||
|
||||
///////////////////////////////////// 运行时间打印 /////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
QString BASECONSTVARIABLEAPI getCurrentTimeString();
|
||||
|
|
|
@ -2121,7 +2121,7 @@ gdalImageComplex::gdalImageComplex(const QString& raster_path)
|
|||
|
||||
this->projection = rasterDataset->GetProjectionRef();
|
||||
|
||||
// 斤拷投影
|
||||
// 释放投影
|
||||
GDALFlushCache((GDALDatasetH)rasterDataset);
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
rasterDataset = NULL; // 指矫匡拷
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE PolynomialOrbitModel>
|
||||
<PolynomialOrbitModel>
|
||||
<CoefficientsX>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>-3.87361e-22</Value>
|
||||
</CoefficientsX>
|
||||
<CoefficientsY>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>1.02335e-21</Value>
|
||||
</CoefficientsY>
|
||||
<CoefficientsZ>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>9.98733e-22</Value>
|
||||
</CoefficientsZ>
|
||||
<CoefficientsVx>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>7.26583e-25</Value>
|
||||
</CoefficientsVx>
|
||||
<CoefficientsVy>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>-8.25398e-25</Value>
|
||||
</CoefficientsVy>
|
||||
<CoefficientsVz>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>0</Value>
|
||||
<Value>1.1246e-24</Value>
|
||||
</CoefficientsVz>
|
||||
</PolynomialOrbitModel>
|
|
@ -4,6 +4,9 @@
|
|||
#include "ui_QSimulationSARPolynomialOrbitModel.h"
|
||||
#include <QFileDialog>
|
||||
#include "OribtModelOperator.h"
|
||||
#include "LogInfoCls.h"
|
||||
#include "SARSatelliteSimulationAbstractCls.h"
|
||||
#include "SatelliteOribtModel.h"
|
||||
|
||||
QSimulationPolynomialSAROrbitModel::QSimulationPolynomialSAROrbitModel(QWidget *parent)
|
||||
: QDialog(parent),ui(new Ui::QSimulationSARPolynomialOrbitModelClass)
|
||||
|
@ -56,10 +59,32 @@ void QSimulationPolynomialSAROrbitModel::onbtnaccepted()
|
|||
qDebug() << "Input GPS Xml:\t" << gpsxmlpath;
|
||||
qDebug() << "out Model Xml:\t" << outmodelpath;
|
||||
|
||||
PolynomialOrbitModel model;
|
||||
QList<SatellitePos> sateposes = loadNodesFromXml(gpsxmlpath);
|
||||
model.fitPolynomial(sateposes);
|
||||
model.saveToXml(outmodelpath);
|
||||
//2. ¶ÁÈ¡GPS½Úµã
|
||||
std::vector<SatelliteOribtNode> nodes;
|
||||
ErrorCode stateCode = ReadSateGPSPointsXML(gpsxmlpath, nodes);
|
||||
|
||||
if (stateCode != ErrorCode::SUCCESS)
|
||||
{
|
||||
qWarning() << QString::fromStdString(errorCode2errInfo(stateCode));
|
||||
return;
|
||||
}
|
||||
else {}
|
||||
std::shared_ptr<PolyfitSatelliteOribtModel> ployfitOribtModel = std::make_shared< PolyfitSatelliteOribtModel>();
|
||||
double startTime = 0;
|
||||
for (long i = 0; i < nodes.size(); i++) {
|
||||
ployfitOribtModel->addOribtNode(nodes[i]);
|
||||
startTime += nodes[i].time / nodes.size();
|
||||
}
|
||||
long polynum = 3;
|
||||
qDebug() << "refrence time " << startTime;
|
||||
qDebug() << "poly degree " << polynum;
|
||||
|
||||
ployfitOribtModel->setSatelliteOribtStartTime(startTime);
|
||||
ErrorCode stateCode = ployfitOribtModel->polyFit(polynum, false);
|
||||
if (stateCode != ErrorCode::SUCCESS) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(stateCode));
|
||||
return ;
|
||||
}
|
||||
qDebug() << "PolynomialSAROrbitModel fit finished!!";
|
||||
QMessageBox::information(this, u8"信息", u8"模型拟合成功");
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <boost/math/tools/polynomial.hpp> // 多项式
|
||||
#include "BaseTool.h"
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
|
||||
|
||||
|
@ -448,3 +450,101 @@ std::shared_ptr<AbstractSatelliteOribtModel> CreataPolyfitSatelliteOribtModel
|
|||
|
||||
|
||||
|
||||
void PolyfitSatelliteOribtModel::saveToXml(const QString& filePath) {
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
// Handle error
|
||||
return;
|
||||
}
|
||||
|
||||
QXmlStreamWriter xmlWriter(&file);
|
||||
xmlWriter.setAutoFormatting(true);
|
||||
xmlWriter.writeStartDocument();
|
||||
xmlWriter.writeStartElement("PolyfitSatelliteOribtModel");
|
||||
|
||||
// Write basic properties
|
||||
xmlWriter.writeTextElement("oribtStartTime", QString::number(oribtStartTime, 'e', 35)); // 科学计数法,保留35位有效数字
|
||||
|
||||
// Write polyfit parameters
|
||||
xmlWriter.writeStartElement("PolyfitParameters");
|
||||
xmlWriter.writeAttribute("Pxchisq", QString::number(Pxchisq));
|
||||
xmlWriter.writeAttribute("Pychisq", QString::number(Pychisq));
|
||||
xmlWriter.writeAttribute("Pzchisq", QString::number(Pzchisq));
|
||||
xmlWriter.writeAttribute("Vxchisq", QString::number(Vxchisq));
|
||||
xmlWriter.writeAttribute("Vychisq", QString::number(Vychisq));
|
||||
xmlWriter.writeAttribute("Vzchisq", QString::number(Vzchisq));
|
||||
|
||||
writeVector(xmlWriter, "polyfitPx", polyfitPx);
|
||||
writeVector(xmlWriter, "polyfitPy", polyfitPy);
|
||||
writeVector(xmlWriter, "polyfitPz", polyfitPz);
|
||||
writeVector(xmlWriter, "polyfitVx", polyfitVx);
|
||||
writeVector(xmlWriter, "polyfitVy", polyfitVy);
|
||||
writeVector(xmlWriter, "polyfitVz", polyfitVz);
|
||||
xmlWriter.writeEndElement();
|
||||
|
||||
xmlWriter.writeEndElement(); // End of PolyfitSatelliteOribtModel
|
||||
xmlWriter.writeEndDocument();
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
void PolyfitSatelliteOribtModel::writeVector(QXmlStreamWriter& xmlWriter, const QString& name, const std::vector<double>& vec) {
|
||||
xmlWriter.writeStartElement(name);
|
||||
for (double val : vec) {
|
||||
xmlWriter.writeTextElement("Value", QString::number(val));
|
||||
}
|
||||
xmlWriter.writeEndElement();
|
||||
}
|
||||
|
||||
|
||||
void PolyfitSatelliteOribtModel::readVector(QXmlStreamReader& xmlReader, const QString& name, std::vector<double>& vec) {
|
||||
if (xmlReader.name() == name) {
|
||||
while (xmlReader.readNextStartElement()) {
|
||||
if (xmlReader.name() == "Value") {
|
||||
vec.push_back(xmlReader.readElementText().toDouble());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PolyfitSatelliteOribtModel::loadFromXml(const QString& filePath) {
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// Handle error
|
||||
return false;
|
||||
}
|
||||
|
||||
QXmlStreamReader xmlReader(&file);
|
||||
while (!xmlReader.atEnd() && !xmlReader.hasError()) {
|
||||
QXmlStreamReader::TokenType token = xmlReader.readNext();
|
||||
if (token == QXmlStreamReader::StartElement) {
|
||||
if (xmlReader.name() == "oribtStartTime") {
|
||||
oribtStartTime = xmlReader.readElementText().toDouble();
|
||||
}
|
||||
else if (xmlReader.name() == "PolyfitParameters") {
|
||||
Pxchisq = xmlReader.attributes().value("Pxchisq").toDouble();
|
||||
Pychisq = xmlReader.attributes().value("Pychisq").toDouble();
|
||||
Pzchisq = xmlReader.attributes().value("Pzchisq").toDouble();
|
||||
Vxchisq = xmlReader.attributes().value("Vxchisq").toDouble();
|
||||
Vychisq = xmlReader.attributes().value("Vychisq").toDouble();
|
||||
Vzchisq = xmlReader.attributes().value("Vzchisq").toDouble();
|
||||
|
||||
readVector(xmlReader, "polyfitPx", polyfitPx);
|
||||
readVector(xmlReader, "polyfitPy", polyfitPy);
|
||||
readVector(xmlReader, "polyfitPz", polyfitPz);
|
||||
readVector(xmlReader, "polyfitVx", polyfitVx);
|
||||
readVector(xmlReader, "polyfitVy", polyfitVy);
|
||||
readVector(xmlReader, "polyfitVz", polyfitVz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xmlReader.hasError()) {
|
||||
// Handle error
|
||||
return false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#include "SARSatelliteSimulationAbstractCls.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <QFile>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 多项式轨道模型
|
||||
|
@ -20,6 +23,12 @@ class PolyfitSatelliteOribtModel:public AbstractSatelliteOribtModel
|
|||
public:
|
||||
PolyfitSatelliteOribtModel();
|
||||
~PolyfitSatelliteOribtModel() override;
|
||||
|
||||
void saveToXml(const QString& filePath) ;
|
||||
bool loadFromXml(const QString& filePath);
|
||||
void readVector(QXmlStreamReader& xmlReader, const QString& name, std::vector<double>& vec);
|
||||
void writeVector(QXmlStreamWriter& xmlWriter, const QString& name, const std::vector<double>& vec);
|
||||
|
||||
public:
|
||||
QString getSatelliteOribtModelParamsString();
|
||||
|
||||
|
@ -47,7 +56,7 @@ public: //
|
|||
virtual ErrorCode getAntnnaDirection(SatelliteOribtNode& node) override; // 获取天线指向方向
|
||||
virtual ErrorCode getZeroDopplerAntDirect(SatelliteOribtNode& node) override;
|
||||
private: // 变量
|
||||
long double oribtStartTime; // 卫星模型参考时间
|
||||
|
||||
double beamAngle; // 波位角
|
||||
bool RightLook; // 左右视
|
||||
double cycletime; // 方位角变换循环时间
|
||||
|
@ -60,15 +69,10 @@ private: //
|
|||
Point3 AntnnaAxisY; // 天线Y轴指向
|
||||
Point3 AntnnaAxisZ; // 天线Z轴指向
|
||||
|
||||
|
||||
public: // 增加节点
|
||||
void addOribtNode(SatelliteOribtNode node);
|
||||
ErrorCode polyFit(int polynum = 3, bool input_timeFromReferenceTime = false);
|
||||
|
||||
|
||||
private: // 轨道节点
|
||||
private: // 轨道模型
|
||||
std::vector<SatelliteOribtNode> oribtNodes;
|
||||
|
||||
long double oribtStartTime; // 卫星模型参考时间
|
||||
std::vector<double> polyfitPx; // 空间坐标
|
||||
std::vector<double> polyfitPy;
|
||||
std::vector<double> polyfitPz;
|
||||
|
@ -82,7 +86,16 @@ private: //
|
|||
double Vxchisq;
|
||||
double Vychisq;
|
||||
double Vzchisq;
|
||||
private:
|
||||
double Pt; // 发射电压
|
||||
double Gri;// 系统增益
|
||||
|
||||
|
||||
public: // 增加节点
|
||||
void addOribtNode(SatelliteOribtNode node);
|
||||
ErrorCode polyFit(int polynum = 3, bool input_timeFromReferenceTime = false);
|
||||
|
||||
|
||||
public:
|
||||
virtual double getPt() override;
|
||||
virtual double getGri() override;
|
||||
|
@ -96,9 +109,7 @@ public:
|
|||
|
||||
|
||||
|
||||
private:
|
||||
double Pt; // 发射电压
|
||||
double Gri;// 系统增益
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue