adding doxygen comments
This commit is contained in:
parent
ed5ecc766c
commit
32c9cda4b8
@ -12,14 +12,9 @@ AnalysisWindow::AnalysisWindow(QWidget *parent) :
|
|||||||
this->hide();
|
this->hide();
|
||||||
this->show();
|
this->show();
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket();
|
std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket();
|
||||||
const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates();
|
const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates();
|
||||||
/*
|
|
||||||
for(const auto& i : res)
|
|
||||||
{
|
|
||||||
std::cout << i.first << ": " << "(" << i.second[0] << ", " << i.second[1] << ", " << i.second[2] << ")\n";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
auto& plot = ui->plotWidget;
|
auto& plot = ui->plotWidget;
|
||||||
plot->setInteraction(QCP::iRangeDrag, true);
|
plot->setInteraction(QCP::iRangeDrag, true);
|
||||||
plot->setInteraction(QCP::iRangeZoom, true);
|
plot->setInteraction(QCP::iRangeZoom, true);
|
||||||
|
@ -18,14 +18,21 @@ class AnalysisWindow;
|
|||||||
/**
|
/**
|
||||||
* @brief The AnalysisWindow class.
|
* @brief The AnalysisWindow class.
|
||||||
*
|
*
|
||||||
* The Analysis Windows class shows a plot of data. This allows visual inspection of
|
* The Analysis Window class shows a plot of rocket state data. This allows visual inspection of
|
||||||
* data
|
* flight data such as altitude vs. time.
|
||||||
*/
|
*/
|
||||||
class AnalysisWindow : public QDialog
|
class AnalysisWindow : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief AnalysisWindow constructor.
|
||||||
|
* @param parent Parent widget
|
||||||
|
*
|
||||||
|
* @note The constructor will make a call to QtRocket and grab the current Rocket model
|
||||||
|
* and automatically plot altitude vs time
|
||||||
|
*/
|
||||||
explicit AnalysisWindow(QWidget *parent = nullptr);
|
explicit AnalysisWindow(QWidget *parent = nullptr);
|
||||||
~AnalysisWindow();
|
~AnalysisWindow();
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_actionAbout_triggered();
|
void on_actionAbout_triggered();
|
||||||
|
|
||||||
void on_testButton1_clicked();
|
void on_testButton1_clicked();
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
#ifndef MODEL_MOTORCASE_H
|
#ifndef MODEL_MOTORCASE_H
|
||||||
#define MODEL_MOTORCASE_H
|
#define MODEL_MOTORCASE_H
|
||||||
|
|
||||||
enum class MotorManufacturerEnum
|
|
||||||
{
|
|
||||||
AEROTECH,
|
|
||||||
CESARONI,
|
|
||||||
LOKI,
|
|
||||||
AMW,
|
|
||||||
ESTES
|
|
||||||
};
|
|
||||||
|
|
||||||
class MotorCase
|
class MotorCase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -20,4 +11,4 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODEL_MOTORCASE_H
|
#endif // MODEL_MOTORCASE_H
|
||||||
|
@ -9,9 +9,3 @@ MotorModel::~MotorModel()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorModel::setDataFromJsonString(const std::string& jsonString)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -8,45 +8,98 @@
|
|||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
// For boost serialization. We're using boost::serialize to save
|
// For boost serialization. We're using boost::serialize to save
|
||||||
// and load Motor data to file
|
// and load Motor data to file. (CURRENTLY UNUSED)
|
||||||
#include <boost/archive/text_iarchive.hpp>
|
//#include <boost/archive/text_iarchive.hpp>
|
||||||
#include <boost/archive/text_oarchive.hpp>
|
//#include <boost/archive/text_oarchive.hpp>
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
// qtrocke theaders
|
// qtrocket theaders
|
||||||
#include "Thrustcurve.h"
|
#include "ThrustCurve.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The MotorModel class
|
||||||
|
*
|
||||||
|
* The MotorModel class defines a structure that holds data relating to a hobby
|
||||||
|
* rocket motor such as the manufacturer, burn time, maximum thrust, propellant
|
||||||
|
* weight, etc. It also holds a ThrustCurve object that contains thrust sample data
|
||||||
|
* for that motor.
|
||||||
|
*
|
||||||
|
* There are several additional classes defined within the MotorModel class designed
|
||||||
|
* to encapsulate and define several pieces of motor related data as well.
|
||||||
|
*/
|
||||||
class MotorModel
|
class MotorModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief MotorModel constructor
|
||||||
|
*/
|
||||||
MotorModel();
|
MotorModel();
|
||||||
|
/**
|
||||||
|
* @brief MotorModel copy constructor is defaulted
|
||||||
|
*/
|
||||||
MotorModel(const MotorModel&) = default;
|
MotorModel(const MotorModel&) = default;
|
||||||
|
/**
|
||||||
|
* @brief MotorModel move constructor is defaulted
|
||||||
|
*/
|
||||||
MotorModel(MotorModel&&) = default;
|
MotorModel(MotorModel&&) = default;
|
||||||
~MotorModel();
|
~MotorModel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy assignment operator is defaulted
|
||||||
|
* @return Copy of MotorModel
|
||||||
|
*/
|
||||||
MotorModel& operator=(const MotorModel&) = default;
|
MotorModel& operator=(const MotorModel&) = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Move assignment operator is defaulted
|
||||||
|
* @return Moved MotorModel
|
||||||
|
*/
|
||||||
MotorModel& operator=(MotorModel&&) = default;
|
MotorModel& operator=(MotorModel&&) = default;
|
||||||
|
|
||||||
void setDataFromJsonString(const std::string& jsonString);
|
/**
|
||||||
|
* @brief The AVAILABILITY enum class identifies whether a motor is
|
||||||
|
* out of production, or still available
|
||||||
|
*/
|
||||||
enum class AVAILABILITY
|
enum class AVAILABILITY
|
||||||
{
|
{
|
||||||
REGULAR, // available
|
REGULAR, /// available
|
||||||
OOP // Out of Production
|
OOP /// Out of Production
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The MOTORMANUFACTURER enum class identifies the motor
|
||||||
|
* manufacturer
|
||||||
|
*/
|
||||||
|
enum class MOTORMANUFACTURER
|
||||||
|
{
|
||||||
|
AEROTECH,
|
||||||
|
CESARONI,
|
||||||
|
LOKI,
|
||||||
|
AMW,
|
||||||
|
ESTES,
|
||||||
|
APOGEE,
|
||||||
|
UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The CERTORG enum class identifies the Certification Organization
|
||||||
|
* that certified the motor
|
||||||
|
*/
|
||||||
enum class CERTORG
|
enum class CERTORG
|
||||||
{
|
{
|
||||||
AMRS,
|
AMRS, /// Australian Model Rocket Society
|
||||||
CAR,
|
CAR, /// Canadian Association of Rocketry
|
||||||
NAR,
|
NAR, /// National Association of Rocketry
|
||||||
TRA,
|
TRA, /// Tripoli
|
||||||
UNC,
|
UNC, /// Uncertified
|
||||||
UNK
|
UNK /// Unknown Certification
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The MOTORTYPE enum class identifies the motor type, either
|
||||||
|
* Single-Use, Reload, or Hybrid
|
||||||
|
*/
|
||||||
enum class MOTORTYPE
|
enum class MOTORTYPE
|
||||||
{
|
{
|
||||||
SU,
|
SU,
|
||||||
@ -54,6 +107,11 @@ public:
|
|||||||
HYBRID
|
HYBRID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The MotorAvailability struct wraps the AVAILABILITY enum and
|
||||||
|
* provides a helper function to return a string representation
|
||||||
|
* of the AVAILABILITY enum.
|
||||||
|
*/
|
||||||
struct MotorAvailability
|
struct MotorAvailability
|
||||||
{
|
{
|
||||||
MotorAvailability(const AVAILABILITY& a) : availability(a) {}
|
MotorAvailability(const AVAILABILITY& a) : availability(a) {}
|
||||||
@ -65,6 +123,10 @@ public:
|
|||||||
MotorAvailability& operator=(MotorAvailability&&) = default;
|
MotorAvailability& operator=(MotorAvailability&&) = default;
|
||||||
|
|
||||||
AVAILABILITY availability{AVAILABILITY::REGULAR};
|
AVAILABILITY availability{AVAILABILITY::REGULAR};
|
||||||
|
/**
|
||||||
|
* @brief str Returns a string representation of AVAILABILITY enum
|
||||||
|
* @return string representation
|
||||||
|
*/
|
||||||
std::string str()
|
std::string str()
|
||||||
{
|
{
|
||||||
if(availability == AVAILABILITY::REGULAR)
|
if(availability == AVAILABILITY::REGULAR)
|
||||||
@ -74,6 +136,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The CertOrg struct wraps the CERTORG enum and
|
||||||
|
* provides a helper function to return a string representation
|
||||||
|
* of the CERTORG enum.
|
||||||
|
*/
|
||||||
struct CertOrg
|
struct CertOrg
|
||||||
{
|
{
|
||||||
CertOrg(const CERTORG& c) : org(c) {}
|
CertOrg(const CERTORG& c) : org(c) {}
|
||||||
@ -85,6 +152,10 @@ public:
|
|||||||
CertOrg& operator=(CertOrg&&) = default;
|
CertOrg& operator=(CertOrg&&) = default;
|
||||||
|
|
||||||
CERTORG org{CERTORG::UNC};
|
CERTORG org{CERTORG::UNC};
|
||||||
|
/**
|
||||||
|
* @brief str Returns a string representation of CERTORG enum
|
||||||
|
* @return string representation
|
||||||
|
*/
|
||||||
std::string str()
|
std::string str()
|
||||||
{
|
{
|
||||||
if(org == CERTORG::AMRS)
|
if(org == CERTORG::AMRS)
|
||||||
@ -102,6 +173,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The MotorType struct wraps the MOTORTYPE enum and
|
||||||
|
* provides a helper function to return a string representation
|
||||||
|
* of the MOTORTYPE enum.
|
||||||
|
*/
|
||||||
struct MotorType
|
struct MotorType
|
||||||
{
|
{
|
||||||
MotorType(const MOTORTYPE& t) : type(t) {}
|
MotorType(const MOTORTYPE& t) : type(t) {}
|
||||||
@ -113,6 +189,10 @@ public:
|
|||||||
MotorType& operator=(MotorType&&) = default;
|
MotorType& operator=(MotorType&&) = default;
|
||||||
|
|
||||||
MOTORTYPE type;
|
MOTORTYPE type;
|
||||||
|
/**
|
||||||
|
* @brief str Returns a string representation of MOTORTYPE enum
|
||||||
|
* @return string representation
|
||||||
|
*/
|
||||||
std::string str()
|
std::string str()
|
||||||
{
|
{
|
||||||
if(type == MOTORTYPE::SU)
|
if(type == MOTORTYPE::SU)
|
||||||
@ -124,60 +204,79 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: make these private. Public just for testing
|
/**
|
||||||
|
* @brief The MotorManufacturer struct wraps the MOTORMANUFACTURER enum and
|
||||||
|
* provides a helper function to return a string representation
|
||||||
|
* of the MOTORMANUFACTURER enum.
|
||||||
|
*/
|
||||||
|
struct MotorManufacturer
|
||||||
|
{
|
||||||
|
MotorManufacturer(const MOTORMANUFACTURER& m) : manufacturer(m) {}
|
||||||
|
MotorManufacturer() : manufacturer(MOTORMANUFACTURER::UNKNOWN) {}
|
||||||
|
MotorManufacturer(const MotorManufacturer&) = default;
|
||||||
|
MotorManufacturer(MotorManufacturer&&) = default;
|
||||||
|
|
||||||
|
MotorManufacturer& operator=(const MotorManufacturer&) = default;
|
||||||
|
MotorManufacturer& operator=(MotorManufacturer&&) = default;
|
||||||
|
|
||||||
|
MOTORMANUFACTURER manufacturer;
|
||||||
|
/**
|
||||||
|
* @brief str Returns a string representation of MOTORMANUFACTURER enum
|
||||||
|
* @return string representation
|
||||||
|
*/
|
||||||
|
std::string str()
|
||||||
|
{
|
||||||
|
switch(manufacturer)
|
||||||
|
{
|
||||||
|
case MOTORMANUFACTURER::AEROTECH:
|
||||||
|
return std::string("AeroTech");
|
||||||
|
case MOTORMANUFACTURER::AMW:
|
||||||
|
return std::string("AMW");
|
||||||
|
case MOTORMANUFACTURER::CESARONI:
|
||||||
|
return std::string("Cesaroni");
|
||||||
|
case MOTORMANUFACTURER::ESTES:
|
||||||
|
return std::string("Estes");
|
||||||
|
case MOTORMANUFACTURER::LOKI:
|
||||||
|
return std::string("Loki");
|
||||||
|
case MOTORMANUFACTURER::APOGEE:
|
||||||
|
return std::string("Apogee");
|
||||||
|
case MOTORMANUFACTURER::UNKNOWN:
|
||||||
|
default:
|
||||||
|
return std::string("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// TODO: make these MotorModel members private. Public just for testing
|
||||||
//private:
|
//private:
|
||||||
// Needed for boost serialize
|
|
||||||
friend class boost::serialization::access;
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive& ar, const unsigned int version);
|
|
||||||
|
|
||||||
MotorAvailability availability{AVAILABILITY::REGULAR};
|
MotorAvailability availability{AVAILABILITY::REGULAR}; /// Motor Availability
|
||||||
double avgThrust{0.0};
|
double avgThrust{0.0}; /// Average thrust in Newtons
|
||||||
double burnTime{0.0};
|
double burnTime{0.0}; /// Burn time in seconds
|
||||||
CertOrg certOrg{CERTORG::UNC};
|
CertOrg certOrg{CERTORG::UNC}; /// The certification organization, defaults to Uncertified
|
||||||
std::string commonName{""};
|
std::string commonName{""}; /// Common name, e.g. A8 or J615
|
||||||
// int dataFiles
|
// int dataFiles
|
||||||
std::vector<int> delays; // -1 delay means no ejection charge
|
std::vector<int> delays; /// 1000 delay means no ejection charge
|
||||||
std::string designation{""};
|
std::string designation{""}; /// Other name, usually includes prop type, e.g. H110W
|
||||||
double diameter{0};
|
double diameter{0}; /// motor diameter in mm
|
||||||
std::string impulseClass; // 'A', 'B', '1/2A', 'M', etc
|
std::string impulseClass; /// Motor letter, e.g. 'A', 'B', '1/2A', 'M', etc
|
||||||
std::string infoUrl{""};
|
std::string infoUrl{""}; /// TODO: ???
|
||||||
double length{0.0};
|
double length{0.0}; /// motor length in mm
|
||||||
std::string manufacturer{""};
|
MotorManufacturer manufacturer{MOTORMANUFACTURER::UNKNOWN}; /// Motor Manufacturer
|
||||||
|
|
||||||
double maxThrust{0.0};
|
double maxThrust{0.0}; /// Max thrust in Newtons
|
||||||
std::string motorIdTC{""}; // 24 character hex string used by thrustcurve to ID a motor
|
std::string motorIdTC{""}; /// 24 character hex string used by thrustcurve.org to ID a motor
|
||||||
std::string propType{""}; // black powder, etc
|
std::string propType{""}; /// Propellant type, e.g. black powder
|
||||||
double propWeight{0.0};
|
double propWeight{0.0}; /// Propellant weight in grams
|
||||||
bool sparky{false};
|
bool sparky{false}; /// true if the motor is "sparky", false otherwise
|
||||||
double totalImpulse{0.0};
|
double totalImpulse{0.0}; /// Total impulse in Newton-seconds
|
||||||
double totalWeight{0.0};
|
double totalWeight{0.0}; /// Total weight in grams
|
||||||
MotorType type{MOTORTYPE::SU};
|
MotorType type{MOTORTYPE::SU}; /// Motor type, e.g. single-use, reload, or hybrid
|
||||||
std::string lastUpdated{""};
|
std::string lastUpdated{""}; /// Date last updated on ThrustCurve.org
|
||||||
|
|
||||||
// Thrust parameters
|
// Thrust parameters
|
||||||
Thrustcurve thrust;
|
ThrustCurve thrust; /// The measured motor thrust curve
|
||||||
|
|
||||||
// Physical dimensions
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Archive>
|
|
||||||
void MotorModel::serialize(Archive& ar, const unsigned int version)
|
|
||||||
{
|
|
||||||
|
|
||||||
ar & manufacturer;
|
|
||||||
ar & impulseClass;
|
|
||||||
ar & propType;
|
|
||||||
ar & sparky;
|
|
||||||
ar & totalImpulse;
|
|
||||||
ar & delays;
|
|
||||||
ar & burnTime;
|
|
||||||
ar & thrust;
|
|
||||||
ar & diameter;
|
|
||||||
ar & length;
|
|
||||||
ar & totalWeight;
|
|
||||||
ar & propWeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // MODEL_MOTORMODEL_H
|
#endif // MODEL_MOTORMODEL_H
|
||||||
|
@ -1,22 +1,49 @@
|
|||||||
#ifndef MOTORMODELDATABASE_H
|
#ifndef MOTORMODELDATABASE_H
|
||||||
#define MOTORMODELDATABASE_H
|
#define MOTORMODELDATABASE_H
|
||||||
|
|
||||||
|
/// \cond
|
||||||
|
// C headers
|
||||||
|
// C++ headers
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
// 3rd party headers
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
|
// qtrocket headers
|
||||||
#include "model/MotorModel.h"
|
#include "model/MotorModel.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The MotorModelDatabase class provides a storage and search mechanism for
|
||||||
|
* MotorModels
|
||||||
|
*/
|
||||||
class MotorModelDatabase
|
class MotorModelDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief MotorModelDatabase constructor
|
||||||
|
*/
|
||||||
MotorModelDatabase();
|
MotorModelDatabase();
|
||||||
|
|
||||||
std::vector<MotorModel> findMotorsByManufacturer(const std::string& manu);
|
/**
|
||||||
|
* @brief MotorModelDatabase destructor is defaulted
|
||||||
|
*/
|
||||||
|
~MotorModelDatabase() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief findMotorsByManufacturer returns a vector of MotorModel from a given
|
||||||
|
* manufacturer
|
||||||
|
* @param manufacturer The manufacturer to search for
|
||||||
|
* @return vector of MotorModels from a given manufacturer
|
||||||
|
*/
|
||||||
|
std::vector<MotorModel> findMotorsByManufacturer(const std::string& manufacturer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief findMotersByImpulseClass returns a vector of MotorModels with a given
|
||||||
|
* impulse class
|
||||||
|
* @param imClass Impulse class to search for
|
||||||
|
* @return vector of MotorModels with a given Impulse class
|
||||||
|
*/
|
||||||
std::vector<MotorModel> findMotersByImpulseClass(const std::string& imClass);
|
std::vector<MotorModel> findMotersByImpulseClass(const std::string& imClass);
|
||||||
|
|
||||||
MotorModel getMotorByName(const std::string& name);
|
|
||||||
|
|
||||||
std::vector<std::pair<double, double>> getThrustCurveByName(const std::string& motorName);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<MotorModel> motors;
|
std::vector<MotorModel> motors;
|
||||||
|
@ -36,7 +36,7 @@ double Rocket::getThrust(double t)
|
|||||||
return tc.getThrust(t);
|
return tc.getThrust(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rocket::setThrustCurve(const Thrustcurve& curve)
|
void Rocket::setThrustCurve(const ThrustCurve& curve)
|
||||||
{
|
{
|
||||||
tc = curve;
|
tc = curve;
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,19 @@
|
|||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "model/Thrustcurve.h"
|
#include "model/ThrustCurve.h"
|
||||||
#include "sim/Propagator.h"
|
#include "sim/Propagator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Rocket class holds all rocket components
|
||||||
|
*
|
||||||
|
*/
|
||||||
class Rocket
|
class Rocket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Rocket class constructor
|
||||||
|
*/
|
||||||
Rocket();
|
Rocket();
|
||||||
|
|
||||||
void launch();
|
void launch();
|
||||||
@ -31,7 +38,7 @@ public:
|
|||||||
double getDragCoefficient() const { return dragCoeff; }
|
double getDragCoefficient() const { return dragCoeff; }
|
||||||
|
|
||||||
double getThrust(double t);
|
double getThrust(double t);
|
||||||
void setThrustCurve(const Thrustcurve& curve);
|
void setThrustCurve(const ThrustCurve& curve);
|
||||||
|
|
||||||
bool terminateCondition(const std::pair<double, std::vector<double>>& cond);
|
bool terminateCondition(const std::pair<double, std::vector<double>>& cond);
|
||||||
|
|
||||||
@ -43,7 +50,7 @@ private:
|
|||||||
double dragCoeff;
|
double dragCoeff;
|
||||||
double mass;
|
double mass;
|
||||||
|
|
||||||
Thrustcurve tc;
|
ThrustCurve tc;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
#include "Thrustcurve.h"
|
#include "ThrustCurve.h"
|
||||||
|
|
||||||
|
|
||||||
Thrustcurve::Thrustcurve(std::vector<std::pair<double, double>>& tc)
|
ThrustCurve::ThrustCurve(std::vector<std::pair<double, double>>& tc)
|
||||||
: thrustCurve(tc),
|
: thrustCurve(tc),
|
||||||
maxTime(0.0),
|
maxTime(0.0),
|
||||||
ignitionTime(0.0)
|
ignitionTime(0.0)
|
||||||
@ -23,16 +23,16 @@ Thrustcurve::Thrustcurve(std::vector<std::pair<double, double>>& tc)
|
|||||||
})->first;
|
})->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thrustcurve::Thrustcurve()
|
ThrustCurve::ThrustCurve()
|
||||||
{
|
{
|
||||||
thrustCurve.emplace_back(0.0, 0.0);
|
thrustCurve.emplace_back(0.0, 0.0);
|
||||||
maxTime = 0.0;
|
maxTime = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thrustcurve::~Thrustcurve()
|
ThrustCurve::~ThrustCurve()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Thrustcurve::setThrustCurveVector(const std::vector<std::pair<double, double>>& v)
|
void ThrustCurve::setThrustCurveVector(const std::vector<std::pair<double, double>>& v)
|
||||||
{
|
{
|
||||||
thrustCurve.clear();
|
thrustCurve.clear();
|
||||||
thrustCurve.resize(v.size());
|
thrustCurve.resize(v.size());
|
||||||
@ -45,13 +45,13 @@ void Thrustcurve::setThrustCurveVector(const std::vector<std::pair<double, doubl
|
|||||||
})->first;
|
})->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thrustcurve::setIgnitionTime(double t)
|
void ThrustCurve::setIgnitionTime(double t)
|
||||||
{
|
{
|
||||||
ignitionTime = t;
|
ignitionTime = t;
|
||||||
//maxTime += ignitionTime;
|
//maxTime += ignitionTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Thrustcurve::getThrust(double t)
|
double ThrustCurve::getThrust(double t)
|
||||||
{
|
{
|
||||||
// calculate t relative to the start time of the motor
|
// calculate t relative to the start time of the motor
|
||||||
t -= ignitionTime;
|
t -= ignitionTime;
|
@ -11,24 +11,24 @@
|
|||||||
#include <boost/archive/text_oarchive.hpp>
|
#include <boost/archive/text_oarchive.hpp>
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
class Thrustcurve
|
class ThrustCurve
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor takes a vector of pairs. The first item a timestamp,
|
* Constructor takes a vector of pairs. The first item a timestamp,
|
||||||
* the second the thrust in newtons.
|
* the second the thrust in newtons.
|
||||||
*/
|
*/
|
||||||
Thrustcurve(std::vector<std::pair<double, double>>& tc);
|
ThrustCurve(std::vector<std::pair<double, double>>& tc);
|
||||||
/**
|
/**
|
||||||
* Default constructor. Will create an empty thrustcurve, always returning 0.0
|
* Default constructor. Will create an empty thrustcurve, always returning 0.0
|
||||||
* for all requested times.
|
* for all requested times.
|
||||||
*/
|
*/
|
||||||
Thrustcurve();
|
ThrustCurve();
|
||||||
Thrustcurve(const Thrustcurve&) = default;
|
ThrustCurve(const ThrustCurve&) = default;
|
||||||
Thrustcurve(Thrustcurve&&) = default;
|
ThrustCurve(ThrustCurve&&) = default;
|
||||||
~Thrustcurve();
|
~ThrustCurve();
|
||||||
|
|
||||||
Thrustcurve& operator=(const Thrustcurve& rhs)
|
ThrustCurve& operator=(const ThrustCurve& rhs)
|
||||||
{
|
{
|
||||||
if(this != &rhs)
|
if(this != &rhs)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thrustcurve& operator=(Thrustcurve&& rhs)
|
ThrustCurve& operator=(ThrustCurve&& rhs)
|
||||||
{
|
{
|
||||||
thrustCurve = std::move(rhs.thrustCurve);
|
thrustCurve = std::move(rhs.thrustCurve);
|
||||||
maxTime = std::move(rhs.maxTime);
|
maxTime = std::move(rhs.maxTime);
|
||||||
@ -76,7 +76,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
void Thrustcurve::serialize(Archive& ar, const unsigned int version)
|
void ThrustCurve::serialize(Archive& ar, const unsigned int version)
|
||||||
{
|
{
|
||||||
ar & maxTime;
|
ar & maxTime;
|
||||||
ar & thrustCurve;
|
ar & thrustCurve;
|
@ -21,7 +21,7 @@ SOURCES += \
|
|||||||
model/MotorModel.cpp \
|
model/MotorModel.cpp \
|
||||||
model/MotorModelDatabase.cpp \
|
model/MotorModelDatabase.cpp \
|
||||||
model/Rocket.cpp \
|
model/Rocket.cpp \
|
||||||
model/Thrustcurve.cpp \
|
model/ThrustCurve.cpp \
|
||||||
sim/ConstantGravityModel.cpp \
|
sim/ConstantGravityModel.cpp \
|
||||||
sim/GravityModel.cpp \
|
sim/GravityModel.cpp \
|
||||||
sim/Propagator.cpp \
|
sim/Propagator.cpp \
|
||||||
@ -51,7 +51,7 @@ HEADERS += \
|
|||||||
model/MotorModel.h \
|
model/MotorModel.h \
|
||||||
model/MotorModelDatabase.h \
|
model/MotorModelDatabase.h \
|
||||||
model/Rocket.h \
|
model/Rocket.h \
|
||||||
model/Thrustcurve.h \
|
model/ThrustCurve.h \
|
||||||
sim/AtmosphericModel.h \
|
sim/AtmosphericModel.h \
|
||||||
sim/ConstantAtmosphere.h \
|
sim/ConstantAtmosphere.h \
|
||||||
sim/ConstantGravityModel.h \
|
sim/ConstantGravityModel.h \
|
||||||
|
@ -59,7 +59,17 @@ void RSEDatabaseLoader::buildAndAppendMotorModel(boost::property_tree::ptree& v)
|
|||||||
// infoUrl not present in RSE file
|
// infoUrl not present in RSE file
|
||||||
mm.infoUrl = "";
|
mm.infoUrl = "";
|
||||||
mm.length = v.get<double>("<xmlattr>.len", 0.0);
|
mm.length = v.get<double>("<xmlattr>.len", 0.0);
|
||||||
mm.manufacturer = v.get<std::string>("<xmlattr>.mfg", "");
|
{
|
||||||
|
std::string manufacturer = v.get<std::string>("<xmlattr>.mfg", "");
|
||||||
|
MotorModel::MotorManufacturer manu(MotorModel::MOTORMANUFACTURER::UNKNOWN);
|
||||||
|
if(manufacturer == "Aerotech")
|
||||||
|
manu = MotorModel::MOTORMANUFACTURER::AEROTECH;
|
||||||
|
else if(manufacturer == "Animal Motor Works")
|
||||||
|
manu = MotorModel::MOTORMANUFACTURER::AMW;
|
||||||
|
else if(manufacturer == "Apogee")
|
||||||
|
manu = MotorModel::MOTORMANUFACTURER::APOGEE;
|
||||||
|
mm.manufacturer = manu;
|
||||||
|
}
|
||||||
mm.maxThrust = v.get<double>("<xmlattr>.peakThrust", 0.0);
|
mm.maxThrust = v.get<double>("<xmlattr>.peakThrust", 0.0);
|
||||||
mm.propWeight = v.get<double>("<xmlattr>.propWt", 0.0);
|
mm.propWeight = v.get<double>("<xmlattr>.propWt", 0.0);
|
||||||
mm.totalImpulse = v.get<double>("<xmlattr>.Itot", 0.0);
|
mm.totalImpulse = v.get<double>("<xmlattr>.Itot", 0.0);
|
||||||
|
@ -34,8 +34,8 @@ MotorModel ThrustCurveAPI::getMotorData(const std::string& motorId)
|
|||||||
|
|
||||||
std::string res = curlConnection.get(endpoint.str(), extraHeaders);
|
std::string res = curlConnection.get(endpoint.str(), extraHeaders);
|
||||||
|
|
||||||
|
/// TODO: fix this
|
||||||
MotorModel mm;
|
MotorModel mm;
|
||||||
mm.setDataFromJsonString(res);
|
|
||||||
return mm;
|
return mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,10 @@ std::vector<MotorModel> ThrustCurveAPI::searchMotors(const SearchCriteria& c)
|
|||||||
mm.diameter = (*iter)["diameter"].asDouble();
|
mm.diameter = (*iter)["diameter"].asDouble();
|
||||||
mm.impulseClass = (*iter)["impulseClass"].asString();
|
mm.impulseClass = (*iter)["impulseClass"].asString();
|
||||||
mm.length = (*iter)["length"].asDouble();
|
mm.length = (*iter)["length"].asDouble();
|
||||||
mm.manufacturer = (*iter)["manufacturer"].asString();
|
std::string manu = (*iter)["manufacturer"].asString();
|
||||||
|
if(manu == "AeroTech")
|
||||||
|
mm.manufacturer = MotorModel::MOTORMANUFACTURER::AEROTECH;
|
||||||
|
//mm.manufacturer = (*iter)["manufacturer"].asString();
|
||||||
mm.maxThrust = (*iter)["maxThrustN"].asDouble();
|
mm.maxThrust = (*iter)["maxThrustN"].asDouble();
|
||||||
mm.motorIdTC = (*iter)["motorId"].asString();
|
mm.motorIdTC = (*iter)["motorId"].asString();
|
||||||
mm.propType = (*iter)["propInfo"].asString();
|
mm.propType = (*iter)["propInfo"].asString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user