Skip to content

Commit

Permalink
Merge pull request #93 from FROM-THE-EARTH/develop
Browse files Browse the repository at this point in the history
Release v1.9.1
  • Loading branch information
KondoA9 authored Aug 9, 2022
2 parents 43249d8 + 39e9457 commit 2677b4d
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 40 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ jobs:
run: echo "1" "1" "1" "1" | ${{ matrix.config.launch_command }}
working-directory: ./application

#- name: "[Test] Multi/Detail/Parachute/0[m]/0[deg]"
# run: echo "1" "2" "2" "0" "0" "1" | ${{ matrix.config.launch_command }} --dry-run
# working-directory: ./application
- name: "[Test] Multi/Detail/Parachute/0[m]/0[deg]"
run: echo "1" "2" "2" "0" "0" "1" | ${{ matrix.config.launch_command }} --dry-run
working-directory: ./application

#- name: "[Test] Multi/Scatter/Parachute"
# run: echo "1" "1" "2" "1" | ${{ matrix.config.launch_command }} --dry-run
# working-directory: ./application
- name: "[Test] Multi/Scatter/Parachute"
run: echo "1" "1" "2" "1" | ${{ matrix.config.launch_command }} --dry-run
working-directory: ./application
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
"files.associations": {
".clang-format": "yaml"
},
"cmake.debugConfig": {
"console": "integratedTerminal"
},
"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools",
"files.encoding": "utf8bom"
}
},
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Latest Update: 2022/08/09

Version: 1.9.0
Version: 1.9.1

[**Download**](https://github.com/FROM-THE-EARTH/Prologue/releases/latest)

Expand Down
18 changes: 6 additions & 12 deletions src/dynamics/WindModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <fstream>
#include <iostream>
#include <stdexcept>

#include "app/AppSetting.hpp"
#include "app/CommandLine.hpp"
Expand Down Expand Up @@ -171,11 +172,8 @@ double WindModel::getTemperature() {
}
}

CommandLine::PrintInfo(PrintInfoType::Error,
"Current height is " + std::to_string(m_height) + "m",
"Wind model is not defined above 32000m");

exit(1);
throw std::runtime_error{"Current height is " + std::to_string(m_height) + " m. "
+ "Wind model is not defined above 32000 m."};
}

// Formula from: https://pigeon-poppo.com/standard-atmosphere/#i-4
Expand All @@ -191,19 +189,15 @@ double WindModel::getPressure() {
} else if (i == 2) {
k = pow(216.65 / (m_temperature - Constant::AbsoluteZero), 34.163);
} else {
CommandLine::PrintInfo(PrintInfoType::Error, "In WindModel::getPressure()", "Index out of range");
exit(1);
throw std::runtime_error{"WindModel::getPressure(): Detected unhandled layer."};
}

return Atmospehre::Layers[i].basePressure * k;
}
}

CommandLine::PrintInfo(PrintInfoType::Error,
"Current height is " + std::to_string(m_height) + "m",
"Wind model is not defined above 32000m");

exit(1);
throw std::runtime_error{"Current height is " + std::to_string(m_height) + " m. "
+ "Wind model is not defined above 32000 m."};
}

// Formula from: https://pigeon-poppo.com/standard-atmosphere/#i-5
Expand Down
13 changes: 9 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
// ------------------------------------------------

#include <iostream>
#include <stdexcept>
#include <string>

#include "app/AppSetting.hpp"
#include "app/CommandLine.hpp"
#include "app/Option.hpp"
#include "simulator/SimulatorFactory.hpp"

const auto VERSION = "1.9.0";
const auto VERSION = "1.9.1";

void ShowSettingInfo();

Expand All @@ -27,13 +28,17 @@ int main(int argc, char* argv[]) {

// インスタンスの生成に失敗したかどうか(simulator == nullptrと同値)
if (!simulator) {
CommandLine::PrintInfo(PrintInfoType::Error, "Failed to initialize simulator");
CommandLine::PrintInfo(PrintInfoType::Error, "Failed to initialize simulator.");
return 1;
}

// シミュレーション実行
if (!simulator->run(option.saveResult && !option.dryRun)) {
CommandLine::PrintInfo(PrintInfoType::Error, "Failed to simulate");
try {
if (!simulator->run(option.saveResult && !option.dryRun)) {
throw std::runtime_error{"Failed to simulate."};
}
} catch (const std::exception& e) {
CommandLine::PrintInfo(PrintInfoType::Error, e.what());
return 1;
}

Expand Down
12 changes: 7 additions & 5 deletions src/rocket/Rocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ struct Body {
Vector3D moment_b;

// status
double elapsedTime = 0.0; // [s]
size_t parachuteIndex = 0;
bool parachuteOpened = false;
bool waitForOpenPara = false;
bool detectPeak = false;
double elapsedTime = 0.0; // [s]
size_t parachuteIndex = 0;
bool parachuteOpened = false;
bool waitForOpenPara = false;
bool detectPeak = false;
double maxAltitude = 0; // [m]
double maxAltitudeTime = 0; // [s]

// calculated
Vector3D airSpeed_b; // [m/s]
Expand Down
8 changes: 6 additions & 2 deletions src/simulator/SimulatorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ namespace SimulatorFactory {

namespace _internal {
std::string setSpecFile() {
std::cout << "<!===Set Specification File===!>" << std::endl;

std::vector<std::string> specificationFiles;

for (const std::filesystem::directory_entry& x : std::filesystem::directory_iterator(specDirectoryPath)) {
specificationFiles.push_back(x.path().filename().string());
}

if (specificationFiles.size() == 0) {
throw std::runtime_error{"Specification file not found in input/spec/."};
}

std::cout << "<!===Set Specification File===!>" << std::endl;

for (size_t i = 0; i < specificationFiles.size(); i++) {
std::cout << i + 1 << ": " << specificationFiles[i] << std::endl;
}
Expand Down
11 changes: 6 additions & 5 deletions src/solver/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ void Solver::update() {
}

void Solver::updateParachute() {
const bool detectpeakConditon = m_maxAltitude > THIS_BODY.pos.z + AppSetting::Simulation::detectPeakThreshold;
const bool detectpeakConditon =
THIS_BODY.maxAltitude > THIS_BODY.pos.z + AppSetting::Simulation::detectPeakThreshold;

if (detectpeakConditon && !THIS_BODY.detectPeak) {
THIS_BODY.detectPeak = true;
Expand All @@ -150,7 +151,7 @@ void Solver::updateParachute() {
}

const bool time_from_detect_peakCondition =
THIS_BODY.elapsedTime - m_detectPeakTime > THIS_BODY_SPEC.parachutes[0].openingTime;
THIS_BODY.elapsedTime - THIS_BODY.maxAltitudeTime > THIS_BODY_SPEC.parachutes[0].openingTime;

if (time_from_detect_peak) {
if (!THIS_BODY.waitForOpenPara && detectpeakConditon) {
Expand Down Expand Up @@ -368,9 +369,9 @@ void Solver::organizeResult() {
*m_windModel.get(),
THIS_BODY_SPEC.engine.isCombusting(THIS_BODY.elapsedTime));

if (m_maxAltitude < THIS_BODY.pos.z) {
m_maxAltitude = THIS_BODY.pos.z;
m_detectPeakTime = THIS_BODY.elapsedTime;
if (THIS_BODY.maxAltitude < THIS_BODY.pos.z) {
THIS_BODY.maxAltitude = THIS_BODY.pos.z;
THIS_BODY.maxAltitudeTime = THIS_BODY.elapsedTime;
}
}

Expand Down
4 changes: 0 additions & 4 deletions src/solver/Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ class Solver {
size_t m_currentBodyIndex = 0; // index of the body being solved
size_t m_detachCount = 0;

// calc
double m_maxAltitude = 0;
double m_detectPeakTime = 0;

// Simulation
size_t m_steps = 0;

Expand Down

0 comments on commit 2677b4d

Please sign in to comment.