Skip to content

Commit

Permalink
Merge pull request #562 from ut-issl/develop
Browse files Browse the repository at this point in the history
Minor update v7.2.0
  • Loading branch information
200km authored Dec 27, 2023
2 parents 980293f + bf1e8ae commit c6e4cc0
Show file tree
Hide file tree
Showing 18 changed files with 4,167 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ jobs:
ver=$(grep python_version ./Pipfile | sed -e 's/^python_version\s=\s"\(.*\)"$/\1/')
echo "version=$ver" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v4.7.1
- uses: actions/setup-python@v5.0.0
with:
python-version: ${{ steps.python-version.outputs.version }}

Expand All @@ -265,7 +265,7 @@ jobs:
- name: comment imgs
if: contains(matrix.compiler, 'clang') && contains(matrix.build_bit, 'OFF') && contains(github.event.pull_request.labels.*.name, 'automation::comment-graph')
uses: actions/github-script@v6.4.1
uses: actions/github-script@v7.0.1
with:
script: |
const output = `## \`position.png\`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
ver=$(grep python_version ./Pipfile | sed -e 's/^python_version\s=\s"\(.*\)"$/\1/')
echo "version=${ver}" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v4.7.1
- uses: actions/setup-python@v5.0.0
with:
python-version: ${{ steps.python-version.outputs.version }}

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.13)
project(S2E
LANGUAGES CXX
DESCRIPTION "S2E: Spacecraft Simulation Environment"
VERSION 7.1.1
VERSION 7.2.0
)

# build config
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@

## Examples of User side repository

- [S2E-USER-EXAMPLE](https://github.com/ut-issl/s2e-user-example)
- Sample codes for tutorials in the s2e-documents
- [S2E-FF](https://github.com/ut-issl/s2e-ff)
- An example of S2E user side repository for Formation Flying study.
- [S2E-AOBC](https://github.com/ut-issl/s2e-aobc)
Expand Down
3 changes: 3 additions & 0 deletions src/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ add_library(${PROJECT_NAME} STATIC
gnss/sp3_file_reader.cpp
gnss/gnss_satellite_number.cpp
gnss/antex_file_reader.cpp
gnss/bias_sinex_file_reader.cpp

initialize/initialize_file_access.cpp
initialize/c2a_command_database.cpp
Expand Down Expand Up @@ -40,6 +41,8 @@ add_library(${PROJECT_NAME} STATIC
planet_rotation/moon_rotation_utilities.cpp

time_system/date_time_format.cpp
time_system/epoch_time.cpp
time_system/gps_time.cpp

external/igrf/igrf.cpp
external/inih/ini.c
Expand Down
244 changes: 244 additions & 0 deletions src/library/gnss/bias_sinex_file_reader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
/**
* @file bias_sinex_file_reader.cpp
* @brief Read bias SINEX format file
* @note Ref. https://files.igs.org/pub/data/format/sinex_bias_100.pdf
*/

#include "bias_sinex_file_reader.hpp"

#include <fstream>
#include <iostream>

bool BiasSinexFileReader::ReadFile(const std::string file_name) {
// File open
std::ifstream bias_sinex_file(file_name);
if (!bias_sinex_file.is_open()) {
std::cout << "[Warning] Bias SINEX file not found: " << file_name << std::endl;
return false;
}

while (bias_sinex_file.peek() != EOF) {
std::string line;
std::getline(bias_sinex_file, line);
// Skip comments
if (line.find("*") == 0) {
continue;
}
// Footer
if (line.find("%=ENDBIA") == 0) {
break;
}
// Header
if (line.find("%=BIA") == 0) {
// TODO: read header information
continue;
}
// File/Reference
if (line.find("+FILE/REFERENCE") == 0) {
ReadFileReference(bias_sinex_file);
continue;
}
// File/Comment
if (line.find("+FILE/COMMENT") == 0) {
ReadFileComment(bias_sinex_file);
continue;
}
// Input/Acknowledgments
if (line.find("+INPUT/ACKNOWLEDGMENTS") == 0) {
ReadInputAcknowledgments(bias_sinex_file);
continue;
}
// Bias/Description
if (line.find("+BIAS/DESCRIPTION") == 0) {
ReadBiasDescription(bias_sinex_file);
continue;
}
// Bias/ReceiverInformation
if (line.find("+BIAS/RECEIVER_INFORMATION") == 0) {
ReadBiasReceiverInformation(bias_sinex_file);
continue;
}
// Bias/Solution
if (line.find("+BIAS/SOLUTION") == 0) {
ReadBiasSolution(bias_sinex_file);
continue;
}
}

// Read epoch wise data
bias_sinex_file.close();
return true;
}

void BiasSinexFileReader::ReadFileReference(std::ifstream& bias_sinex_file) {
std::string line;
while (1) {
std::getline(bias_sinex_file, line);
// End of data
if (line.find("-FILE/REFERENCE") == 0) {
break;
}
// TODO: read information
}
}

void BiasSinexFileReader::ReadFileComment(std::ifstream& bias_sinex_file) {
std::string line;
while (1) {
std::getline(bias_sinex_file, line);
// End of data
if (line.find("-FILE/COMMENT") == 0) {
break;
}
// TODO: read information
}
}

void BiasSinexFileReader::ReadInputAcknowledgments(std::ifstream& bias_sinex_file) {
std::string line;
while (1) {
std::getline(bias_sinex_file, line);
// End of data
if (line.find("-INPUT/ACKNOWLEDGMENTS") == 0) {
break;
}
// TODO: read information
}
}

void BiasSinexFileReader::ReadBiasDescription(std::ifstream& bias_sinex_file) {
std::string line;
while (1) {
std::getline(bias_sinex_file, line);
// End of data
if (line.find("-BIAS/DESCRIPTION") == 0) {
break;
}
// TODO: read information
}
}

void BiasSinexFileReader::ReadBiasReceiverInformation(std::ifstream& bias_sinex_file) {
std::string line;
while (1) {
std::getline(bias_sinex_file, line);
// End of data
if (line.find("-BIAS/RECEIVER_INFORMATION") == 0) {
break;
}
// TODO: read information
}
}

void BiasSinexFileReader::ReadBiasSolution(std::ifstream& bias_sinex_file) {
std::string line;

while (1) {
std::getline(bias_sinex_file, line);
// End of data
if (line.find("-BIAS/SOLUTION") == 0) {
break;
}
// Skip comments
if (line.find("*") == 0) {
continue;
}
// data read
BiasSolutionData solution_data;
size_t read_point = 1;
size_t read_size = 4;

solution_data.SetIdentifier(line.substr(read_point, read_size));
read_point += read_size + 1;

read_size = 4;
solution_data.SetSatelliteSvnCode(line.substr(read_point, read_size));
read_point += read_size + 1;

read_size = 3;
solution_data.SetSatelliteNumber(line.substr(read_point, read_size));
read_point += read_size + 1;

read_size = 9;
solution_data.SetStationName(line.substr(read_point, read_size));
read_point += read_size + 1;

read_size = 4;
std::string obs1 = line.substr(read_point, read_size);
read_point += read_size + 1;
read_size = 4;
std::string obs2 = line.substr(read_point, read_size);
read_point += read_size + 1;
solution_data.SetTargetSignal(obs1, obs2);

read_size = 14;
std::string start_time = line.substr(read_point, read_size);
read_point += read_size + 1;

read_size = 14;
std::string end_time = line.substr(read_point, read_size);
read_point += read_size + 1;

read_size = 4;
solution_data.SetUnit(line.substr(read_point, read_size));
read_point += read_size + 1;

read_size = 21;
solution_data.SetBias(std::stod(line.substr(read_point, read_size)));
read_point += read_size + 1;

read_size = 12;
solution_data.SetBiasStandardDeviation(std::stod(line.substr(read_point, read_size)));
read_point += read_size + 1;

if (read_point + 21 < line.size()) {
read_size = 21;
solution_data.SetSlope_ns_s(std::stod(line.substr(read_point, read_size)));
read_point += read_size + 1;
}
if (read_point + 12 < line.size()) {
read_size = 12;
solution_data.SetSlopeStandardDeviation_ns_s(std::stod(line.substr(read_point, read_size)));
read_point += read_size + 1;
}

solution_data_.push_back(solution_data);
}
}

void BiasSolutionData::SetIdentifier(const std::string identifier) {
if (identifier == "DSB ") {
identifier_ = BiasIdentifier::kDsb;
} else if (identifier == "ISB ") {
identifier_ = BiasIdentifier::kIsb;
} else if (identifier == "OSB ") {
identifier_ = BiasIdentifier::kOsb;
} else {
identifier_ = BiasIdentifier::kError;
}
}

void BiasSolutionData::SetUnit(const std::string unit) {
if (unit == "ns ") {
unit_ = BiasUnit::kNs;
} else if (unit == "cyc ") {
unit_ = BiasUnit::kCycle;
} else {
unit_ = BiasUnit::kError;
}
}

void BiasSolutionData::SetTargetSignal(const std::string signal1, const std::string signal2) {
// TODO: Add other target combination
if (signal1 == "C1W " && signal2 == "C2W ") {
target_signal_ = BiasTargetSignal::kP1P2;
} else if (signal1 == "C1P " && signal2 == "C2P ") {
target_signal_ = BiasTargetSignal::kP1P2;
} else if (signal1 == "C1P " && signal2 == "C1C ") {
target_signal_ = BiasTargetSignal::kP1C1;
} else if (signal1 == "C2P " && signal2 == "C2C ") {
target_signal_ = BiasTargetSignal::kP2C2;
} else {
target_signal_ = BiasTargetSignal::kError;
}
}
Loading

0 comments on commit c6e4cc0

Please sign in to comment.