Skip to content

Commit

Permalink
Merge pull request #682 from ut-issl/feature/rename-preprocessor-for-…
Browse files Browse the repository at this point in the history
…ini-file

Rename INI_FILE_DIR_FROM_EXE to SETTINGS_DIR_FROM_EXE
  • Loading branch information
200km authored Aug 25, 2024
2 parents bb0a2f7 + 0c9ddc3 commit 5177e13
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ jobs:
shell: cmd
run: |
cl.exe
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DINI_FILE_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake --build .
- name: build 64bit
if: matrix.build_bit == 'BUILD_64BIT=ON' && matrix.use_c2a == 'USE_C2A=OFF'
shell: cmd
run: |
cl.exe
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DINI_FILE_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake --build .
- name: fix simulation config
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
CC: ${{ steps.compiler.outputs.CC }}
CXX: ${{ steps.compiler.outputs.CXX }}
run: |
cmake . -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DINI_FILE_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -D${{ matrix.build_bit }}
cmake . -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -D${{ matrix.build_bit }}
cmake --build .
- name: fix simulation config
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ if(NOT DEFINED C2A_NAME)
endif()

## Directory path for ini files
if(NOT DEFINED INI_FILE_DIR_FROM_EXE)
set(INI_FILE_DIR_FROM_EXE ../../settings)
if(NOT DEFINED SETTINGS_DIR_FROM_EXE)
set(SETTINGS_DIR_FROM_EXE ../../settings)
endif()

if(NOT DEFINED EXT_LIB_DIR_FROM_EXE)
Expand Down
2 changes: 1 addition & 1 deletion common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${S2E_DIR}/src)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

# Directory path setting
target_compile_definitions(${PROJECT_NAME} PRIVATE "INI_FILE_DIR_FROM_EXE=\"${INI_FILE_DIR_FROM_EXE}\"")
target_compile_definitions(${PROJECT_NAME} PRIVATE "SETTINGS_DIR_FROM_EXE=\"${SETTINGS_DIR_FROM_EXE}\"")
target_compile_definitions(${PROJECT_NAME} PRIVATE "EXT_LIB_DIR_FROM_EXE=\"${EXT_LIB_DIR_FROM_EXE}\"")
target_compile_definitions(${PROJECT_NAME} PRIVATE "CORE_DIR_FROM_EXE=\"${CORE_DIR_FROM_EXE}\"")

Expand Down
2 changes: 1 addition & 1 deletion settings/environment/sample_gnss.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[GNSS_SATELLITES]
directory_path = INI_FILE_DIR_FROM_EXE/environment/gnss/final_products/
directory_path = SETTINGS_DIR_FROM_EXE/environment/gnss/final_products/
calculation = DISABLE
logging = DISABLE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tx_antenna_gain_model = ISOTROPIC
tx_gain_dBi = 12.0

// Antenna radiation pattern CSV file path
tx_antenna_radiation_pattern_file = INI_FILE_DIR_FROM_EXE/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
tx_antenna_radiation_pattern_file = SETTINGS_DIR_FROM_EXE/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
// General information of the CSV file
tx_length_theta = 360
tx_length_phi = 181
Expand Down Expand Up @@ -65,7 +65,7 @@ rx_antenna_gain_model = ISOTROPIC
rx_gain_dBi = 43.27

// Antenna radiation pattern CSV file path
rx_antenna_radiation_pattern_file = INI_FILE_DIR_FROM_EXE/sample_ground_station/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
rx_antenna_radiation_pattern_file = SETTINGS_DIR_FROM_EXE/sample_ground_station/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
// General information of the CSV file
rx_length_theta = 360
rx_length_phi = 181
Expand Down
4 changes: 2 additions & 2 deletions settings/sample_ground_station/ground_station.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ height_m = 3.4
elevation_limit_angle_deg = 5.0

[COMPONENT_FILES]
ground_station_antenna_file = INI_FILE_DIR_FROM_EXE/sample_ground_station/components/ground_station_antenna.ini
ground_station_calculator_file = INI_FILE_DIR_FROM_EXE/sample_ground_station/components/ground_station_calculator.ini
ground_station_antenna_file = SETTINGS_DIR_FROM_EXE/sample_ground_station/components/ground_station_antenna.ini
ground_station_calculator_file = SETTINGS_DIR_FROM_EXE/sample_ground_station/components/ground_station_calculator.ini
4 changes: 2 additions & 2 deletions settings/sample_satellite/components/reaction_wheel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jitter_logging = DISABLE
// prescaler for calculation of RW jitter
// To calculate the jitter, set the update cycle to about 0.1 ms.
fast_prescaler = 1
radial_force_harmonics_coefficient_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/rw_disturbance_csv_files/radial_force_harmonics_coefficients.csv
radial_torque_harmonics_coefficient_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/rw_disturbance_csv_files/radial_torque_harmonics_coefficients.csv
radial_force_harmonics_coefficient_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/rw_disturbance_csv_files/radial_force_harmonics_coefficients.csv
radial_torque_harmonics_coefficient_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/rw_disturbance_csv_files/radial_torque_harmonics_coefficients.csv
harmonics_degree = 12
considers_structural_resonance = DISABLE
structural_resonance_frequency_Hz = 585.0 //[Hz]
Expand Down
4 changes: 2 additions & 2 deletions settings/sample_satellite/components/spacecraft_antenna.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tx_antenna_gain_model = RADIATION_PATTERN_CSV
tx_gain_dBi = 8.0

// Antenna radiation pattern CSV file path
tx_antenna_radiation_pattern_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
tx_antenna_radiation_pattern_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
// General information of the CSV file
tx_length_theta = 360
tx_length_phi = 181
Expand Down Expand Up @@ -65,7 +65,7 @@ rx_antenna_gain_model = RADIATION_PATTERN_CSV
rx_gain_dBi = 43.27

// Antenna radiation pattern CSV file path
rx_antenna_radiation_pattern_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
rx_antenna_radiation_pattern_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/antenna_radiation_pattern_csv_files/sample_antenna_radiation_pattern.csv
// General information of the CSV file
rx_length_theta = 360
rx_length_phi = 181
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[WINGS_COMMAND_SENDER_TO_C2A]
command_send_enable = ENABLE
prescaler = 1
c2a_command_database_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv
wings_operation_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/wings_command_sender_to_c2a/example.ops
c2a_command_database_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv
wings_operation_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/wings_command_sender_to_c2a/example.ops
4 changes: 2 additions & 2 deletions settings/sample_satellite/disturbance.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
calculation = DISABLE
logging = ENABLE
degree = 4
coefficients_file_path = INI_FILE_DIR_FROM_EXE/environment/gravity_field/egm96_to360.ascii
coefficients_file_path = SETTINGS_DIR_FROM_EXE/environment/gravity_field/egm96_to360.ascii

[LUNAR_GRAVITY_FIELD]
// Enable only when the center object is defined as the Moon
calculation = DISABLE
logging = ENABLE
degree = 10
coefficients_file_path = INI_FILE_DIR_FROM_EXE/environment/gravity_field/gggrx_1200a_sha.tab
coefficients_file_path = SETTINGS_DIR_FROM_EXE/environment/gravity_field/gggrx_1200a_sha.tab


[MAGNETIC_DISTURBANCE]
Expand Down
4 changes: 2 additions & 2 deletions settings/sample_satellite/local_environment.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[MAGNETIC_FIELD_ENVIRONMENT]
calculation = ENABLE
logging = ENABLE
coefficient_file = INI_FILE_DIR_FROM_EXE/environment/magnetic_field/igrf13.coef
coefficient_file = SETTINGS_DIR_FROM_EXE/environment/magnetic_field/igrf13.coef
magnetic_field_random_walk_standard_deviation_nT = 10.0
magnetic_field_random_walk_limit_nT = 400.0
magnetic_field_white_noise_standard_deviation_nT = 50.0
Expand All @@ -26,7 +26,7 @@ logging = ENABLE
// NRLMSISE00: NRLMSISE00 model
// HARRIS_PRIESTER: Harris-Priester model
model = STANDARD
nrlmsise00_table_file = INI_FILE_DIR_FROM_EXE/environment/space_weather/SpaceWeather-v1.2.txt
nrlmsise00_table_file = SETTINGS_DIR_FROM_EXE/environment/space_weather/SpaceWeather-v1.2.txt
// Whether using user-defined f10.7 and ap value
// Ref of f10.7: https://www.swpc.noaa.gov/phenomena/f107-cm-radio-emissions
// Ref of ap: http://wdc.kugi.kyoto-u.ac.jp/kp/kpexp-j.html
Expand Down
40 changes: 20 additions & 20 deletions settings/sample_satellite/satellite.ini
Original file line number Diff line number Diff line change
Expand Up @@ -128,27 +128,27 @@ error_tolerance = 0.0001
calculation = DISABLE
debug = DISABLE
solar_calc_setting = DISABLE
thermal_file_directory = INI_FILE_DIR_FROM_EXE/sample_satellite/thermal_csv_files/
thermal_file_directory = SETTINGS_DIR_FROM_EXE/sample_satellite/thermal_csv_files/

[SETTING_FILES]
local_environment_file = INI_FILE_DIR_FROM_EXE/sample_satellite/local_environment.ini
disturbance_file = INI_FILE_DIR_FROM_EXE/sample_satellite/disturbance.ini
structure_file = INI_FILE_DIR_FROM_EXE/sample_satellite/structure.ini
local_environment_file = SETTINGS_DIR_FROM_EXE/sample_satellite/local_environment.ini
disturbance_file = SETTINGS_DIR_FROM_EXE/sample_satellite/disturbance.ini
structure_file = SETTINGS_DIR_FROM_EXE/sample_satellite/structure.ini

[COMPONENT_FILES]
gyro_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/gyro_sensor.ini
magnetometer_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/magnetometer.ini
stt_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/star_sensor.ini
ss_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/sun_sensor.ini
gnss_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/gnss_receiver.ini
magnetorquer_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/magnetorquer.ini
rw_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/reaction_wheel.ini
thruster_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/thruster.ini
force_generator_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/force_generator.ini
torque_generator_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/torque_generator.ini
angular_velocity_observer_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/angular_velocity_observer.ini
attitude_observer_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/attitude_observer.ini
orbit_observer_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/orbit_observer.ini
antenna_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/spacecraft_antenna.ini
component_interference_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/component_interference.ini
telescope_file = INI_FILE_DIR_FROM_EXE/sample_satellite/components/telescope.ini
gyro_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/gyro_sensor.ini
magnetometer_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/magnetometer.ini
stt_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/star_sensor.ini
ss_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/sun_sensor.ini
gnss_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/gnss_receiver.ini
magnetorquer_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/magnetorquer.ini
rw_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/reaction_wheel.ini
thruster_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/thruster.ini
force_generator_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/force_generator.ini
torque_generator_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/torque_generator.ini
angular_velocity_observer_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/angular_velocity_observer.ini
attitude_observer_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/attitude_observer.ini
orbit_observer_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/orbit_observer.ini
antenna_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/spacecraft_antenna.ini
component_interference_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/component_interference.ini
telescope_file = SETTINGS_DIR_FROM_EXE/sample_satellite/components/telescope.ini
18 changes: 9 additions & 9 deletions settings/sample_simulation_base.ini
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ rotation_mode(10) = DISABLE

[CSPICE_KERNELS]
// CSPICE Kernel files definition
tls = INI_FILE_DIR_FROM_EXE/environment/cspice/generic_kernels/lsk/naif0010.tls
tpc1 = INI_FILE_DIR_FROM_EXE/environment/cspice/generic_kernels/pck/de-403-masses.tpc
tpc2 = INI_FILE_DIR_FROM_EXE/environment/cspice/generic_kernels/pck/gm_de431.tpc
tpc3 = INI_FILE_DIR_FROM_EXE/environment/cspice/generic_kernels/pck/pck00010.tpc
bsp = INI_FILE_DIR_FROM_EXE/environment/cspice/generic_kernels/spk/planets/de430.bsp
tls = SETTINGS_DIR_FROM_EXE/environment/cspice/generic_kernels/lsk/naif0010.tls
tpc1 = SETTINGS_DIR_FROM_EXE/environment/cspice/generic_kernels/pck/de-403-masses.tpc
tpc2 = SETTINGS_DIR_FROM_EXE/environment/cspice/generic_kernels/pck/gm_de431.tpc
tpc3 = SETTINGS_DIR_FROM_EXE/environment/cspice/generic_kernels/pck/pck00010.tpc
bsp = SETTINGS_DIR_FROM_EXE/environment/cspice/generic_kernels/spk/planets/de430.bsp


[HIPPARCOS_CATALOGUE]
catalogue_file_path = INI_FILE_DIR_FROM_EXE/environment/star_catalogue/hip_main.csv
catalogue_file_path = SETTINGS_DIR_FROM_EXE/environment/star_catalogue/hip_main.csv
max_magnitude = 3.0 // Max magnitude to read from Hip catalog
calculation = DISABLE
logging = DISABLE
Expand All @@ -144,7 +144,7 @@ save_initialize_files = ENABLE
// If you want to add a ground station, create the corresponding ground_station.ini, and specify it as ground_station_file(1), ground_station_file(2), ect.
number_of_simulated_spacecraft = 1
number_of_simulated_ground_station = 1
spacecraft_file(0) = INI_FILE_DIR_FROM_EXE/sample_satellite/satellite.ini
ground_station_file(0) = INI_FILE_DIR_FROM_EXE/sample_ground_station/ground_station.ini
gnss_file = INI_FILE_DIR_FROM_EXE/environment/sample_gnss.ini
spacecraft_file(0) = SETTINGS_DIR_FROM_EXE/sample_satellite/satellite.ini
ground_station_file(0) = SETTINGS_DIR_FROM_EXE/sample_ground_station/ground_station.ini
gnss_file = SETTINGS_DIR_FROM_EXE/environment/sample_gnss.ini
log_file_save_directory = ../../logs/
2 changes: 1 addition & 1 deletion src/s2e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int main(int argc, char *argv[])
start = system_clock::now();

std::string data_path = "../../";
std::string ini_path = INI_FILE_DIR_FROM_EXE;
std::string ini_path = SETTINGS_DIR_FROM_EXE;
std::string ini_file = ini_path + "/sample_simulation_base.ini";

// Parsing arguments: SatAttSim <data_path> [ini_file]
Expand Down
4 changes: 2 additions & 2 deletions src/setting_file_reader/initialize_file_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ std::string IniAccess::ReadString(const char* section_name, const char* key_name
std::regex inline_comment_pattern("\\s*//.*");
value = std::regex_replace(value, inline_comment_pattern, "");
// INI_FILE_DIR
std::string ini_path = INI_FILE_DIR_FROM_EXE;
value = std::regex_replace(value, std::regex("INI_FILE_DIR_FROM_EXE"), ini_path);
std::string ini_path = SETTINGS_DIR_FROM_EXE;
value = std::regex_replace(value, std::regex("SETTINGS_DIR_FROM_EXE"), ini_path);
// EXT_LIB_DIR
std::string ext_lib_path = EXT_LIB_DIR_FROM_EXE;
value = std::regex_replace(value, std::regex("EXT_LIB_DIR_FROM_EXE"), ext_lib_path);
Expand Down

0 comments on commit 5177e13

Please sign in to comment.