Skip to content

Commit

Permalink
Added simulation run status bar.
Browse files Browse the repository at this point in the history
Added #define BOOST_BIND_GLOBAL_PLACEHOLDERS in Propagator.h and HIL_interface.cpp.
Explicit initialization of struct members of SYS_Parameters in Subsystem.cpp.
Fixed bug in orbit propulsion class for thrust resolution and execution of negative continuous maneuvers.
Implemented first version of Ctrl execution by orbit propulsion system in main file orbprop.cpp.
Implemented header option in I/O function read_csvfile.
Created variable type struct Pass.
Implemented generation of lists of GS, TG and GS + TG passes sorted by time for each spacecraft and all spacecraft.
Modified headers in events output files.
Updated Eigen, spice and xerces libraries. Implemented check and error message on duration of attitude propagation.
Updated environment and auxiliary files in data folder.
Updated user guide.
  • Loading branch information
Sergio De Florio committed Jan 26, 2022
1 parent 3e75aeb commit ecf290e
Show file tree
Hide file tree
Showing 989 changed files with 75,167 additions and 36,074 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ events: $(TARGET_EVE) silent
##include all rules generated by gcc into the makefile
#-include $(DEPS)

#dummy target to that we don't get unnecessary mesages ( target is up to date & co)
#dummy target to that we don't get unnecessary messages ( target is up to date & co)
silent:
@:

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SpOCK
# SpOCK 1.2
The Spacecraft Orbital Computations Kit (SpOCK) is an open source tool for spacecraft mission analysis and simulation. SpOCK allows the simulation of spacecrafts' hardware, orbital and attitude dynamics, and the computations of mission events (ground station contacts, payload data-takes and eclipses). The ambition of the author is to develop an operational tool (mission analysis, flight dynamics and operations) which includes only few but accurate simulations features and which can be easily further developed and customized. For this reason the software is developed with a (hopefully) clear structure with elements which can be easily read and reproduced and without a graphical user interface. For detailed information about installation, configuration and use please read the user guide.

---
Expand All @@ -15,7 +15,7 @@ Precise orbit and attitude propagation, mission events computation, atmospheric

*Orbit environment models*

Gravity field (EIGEN-6S, GGM02C), atmospheric density (JB2008, NRLMSISE-00), Earth's magnetic field (IGRF13, WMM2020), solar radiation pressure, third body (JPL planet ephemerides), gravity gradient.
Gravity field (all GGM0\*, EIGEN\* and models with .gfc files format of this type), atmospheric density (JB2008, NRLMSISE-00), Earth's magnetic field (IGRF13, WMM2020), solar radiation pressure, third body (JPL planet ephemerides), gravity gradient.

*Customizability*

Expand Down Expand Up @@ -53,11 +53,11 @@ make events

All the executable will be generated in the 'bin' folder. Command 'make clean' will delete all executables in 'bin' folder and folder 'obj'.

Download file de438.bsp from SPICE library kernels ftp (ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/) and put it into folder data/cspice (file de438.bsp is too big for the repository)
Download file de440.bsp from SPICE library kernels ftp (ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/) and put it into folder data/cspice (file de440.bsp is too big for the repository)

*Remarks:*

Installation and run were tested successfully on different real and virtual machines (VMware on Windows 10) running Linux Ubuntu 19.04 or higher. It is possible but not guaranteed that the installation on Ubuntu < 19 or other Linux distributions could work
Installation and run were tested successfully on different real and virtual machines (VMware on Windows 10) running Linux Ubuntu 19.04 or higher. It is likely but not guaranteed that the installation on Ubuntu < 19 or other Linux distributions could work

Coomands make install_atmo and install_mag are used to compile external Fortran libraries and could give some Fortran compilation warnings.

Expand Down
12 changes: 2 additions & 10 deletions attprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ int main(int argc, char *argv[])
sensorTCs SensorReadings;
sensorTCs* sensorTCs_ptr = &SensorReadings;


//////////////////////////////////////////////////////
///////////////// SOLAR PANELS OUTPUT ///////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -918,9 +917,7 @@ int main(int argc, char *argv[])
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

VectorXd prop_state;

double part_dur = SIM_DURATION/10.0;
double sim_done = 10.0;
int barwidth = 100;

for( double t = 0.0 ; t < SIM_DURATION ; t += SIM_STEP )
{
Expand Down Expand Up @@ -969,12 +966,7 @@ int main(int argc, char *argv[])
#endif

//////////////// Display propagation progress /////////////////
if( (t - part_dur) >= 0)
{
cout << (int)sim_done << "% done" << endl;
part_dur = part_dur + SIM_DURATION/10.0;
sim_done = sim_done + 10.0;
}
RunStatusBar(t, SIM_DURATION, barwidth);

/////////////// ADCS sensors/actuators inputs/outputs ////////////////

Expand Down
620 changes: 620 additions & 0 deletions data/atmosphere/JB2008/DSTFILE.TXT

Large diffs are not rendered by default.

809 changes: 715 additions & 94 deletions data/atmosphere/JB2008/DTCFILE.TXT

Large diffs are not rendered by default.

10,443 changes: 5,531 additions & 4,912 deletions data/atmosphere/JB2008/SOLFSMY.TXT

Large diffs are not rendered by default.

Binary file added data/cspice/earth_000101_220328_220103.bpc
Binary file not shown.
16,511 changes: 16,511 additions & 0 deletions data/gravityfield/GGM03S.gfc

Large diffs are not rendered by default.

43,903 changes: 22,347 additions & 21,556 deletions data/spaceweather/CssiSpaceWeather_indices.txt

Large diffs are not rendered by default.

Binary file modified doc/UserGuide/SPOCK_UserGuide.pdf
Binary file not shown.
59 changes: 59 additions & 0 deletions etq
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
commit 3e75aeb54639d4fc724c1097677ee348fdff52c8 (HEAD -> master, origin/master, origin/HEAD)
Author: deflorio <[email protected]>
Date: Sat May 2 01:59:42 2020 +0200

Corrected typos in user guide.

commit 5458c9d7a631d60ee002fda23b1078436cf60143
Author: deflorio <[email protected]>
Date: Fri May 1 23:43:36 2020 +0200

Deleted EMM folder in doc. New entry in user guide.

commit 863f224e0d2acbcd17386ea03c47e782c0647e79
Author: deflorio <[email protected]>
Date: Fri May 1 16:13:08 2020 +0200

New entries in README and user guide.

commit e48c805ebb41be66d0d30da142a786da53e53e10
Author: deflorio <[email protected]>
Date: Wed Apr 29 16:38:06 2020 +0200

New entries in README and user guide.

commit 0046d19e491756d82c10b4fcbe53e4d542c0962c
Author: deflorio <[email protected]>
Date: Wed Apr 29 01:25:26 2020 +0200

Modified Makefile for automatic compilation of Fortran libraries. Modified Readme and user guide. Implemented error message for duration of attitude propagation. New entries in gitignore.

commit f9046a426c0d0fa0c35a8181ba8872980a519477
Author: deflorio <[email protected]>
Date: Tue Apr 28 23:00:45 2020 +0200

Modified README, user guide and sample input XML files. Added 'bin' folder to repository.

commit ca764c5e93f61d10996d92564fb785ab543286d1
Author: deflorio <[email protected]>
Date: Mon Apr 27 18:35:29 2020 +0200

Created README.md file. Modified user guide.

commit ce4fefc7fad5525f9d6c41e839a19573fb5999d7
Author: deflorio <[email protected]>
Date: Mon Apr 27 01:23:20 2020 +0200

Modified gitignore and user guide.

commit 7e2c3945d7ef1d391464224ae357b80213a62f69 (tag: v1.0)
Author: deflorio <[email protected]>
Date: Mon Apr 27 00:48:14 2020 +0200

First upload of code.

commit 28f293329b061c6ef28afe7450b16ce7e88c17fe
Author: deflorio <[email protected]>
Date: Mon Apr 27 00:22:03 2020 +0200

First commit
73 changes: 63 additions & 10 deletions eventscomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ using namespace solarsystem;
using namespace constants;
using namespace mathconst;
using namespace math;
using namespace events;

using namespace Eigen;

Expand Down Expand Up @@ -113,7 +114,11 @@ int main(int argc, char *argv[])
// Input files path
string ephem_file, Orbit_ephemeris_path, Orbit_ephemeris_rootname, Data_path, planetephemeris, eop, pck_data, leapsecond;
// Output files path
string TG_filename, GS_filename, Eclipse_filename;
string TG_filename, GS_filename, Time_sorted_GS_filename, Eclipse_filename;
// Vector of GS contacts structs
vector<Pass> GS_passes;
// Vector of TG contacts structs
vector<Pass> TG_passes;

XML_parser_events(XML_events_file, simstep, duration, FOV_cross, FOV_along, SC_start, SC_end, PL_start, PL_end, TGs_on, GSs_on, TGs_grid_on, Eclipse_on, TG_grid_limits, gridstep, TGs_list, GSs_list, Orbit_ephemeris_path, Orbit_ephemeris_rootname, Data_path, planetephemeris, eop, pck_data, leapsecond, TG_filename, GS_filename, Eclipse_filename);
//const string ReadXML_TXT_file = "../input/readXMLevents.txt";
Expand Down Expand Up @@ -232,15 +237,25 @@ int main(int argc, char *argv[])
{
AllContacts_file.open(TG_filename);

AllContacts_file << "TG,Epoch UTC in,GPS time [s] in,Duration [s],El. in,El. out,Epoch UTC Max. El.,Max. El. [deg],Az. in [deg],Az. out [deg],Az. Max El. [deg],lon [deg],lat [deg],Orbital plane,Spacecraft" << endl;
AllContacts_file << "TG,Epoch UTC in,Epoch UTC out,GPS time in [s],Duration [min],El. in [deg],El. out [deg],Epoch UTC Max. El.,Max. El. [deg],Az. in [deg],Az. out [deg],Az. Max El. [deg],lon [deg],lat [deg],P#,S#" << endl;
}

ofstream GS_AllContacts_file;
if(GSs_on)
{
GS_AllContacts_file.open(GS_filename);

GS_AllContacts_file << "GS,AOS UTC,LOS UTC,AOS [GPS secs],Duration [m],Epoch UTC Max. El.,Max Elevation [deg],Az. AOS [deg],Az. LOS [deg],Az. Max El. [deg],lon [deg],lat [deg],Orbital plane,Spacecraft" << endl;
GS_AllContacts_file << "GS,AOS UTC,LOS UTC,AOS [GPS secs],Duration [min],Epoch UTC Max. El.,Max Elevation [deg],Az. AOS [deg],Az. LOS [deg],Az. Max El. [deg],lon [deg],lat [deg],P#,S#" << endl;
}

string TG_GS_filename;
ofstream TG_GS_AllContacts_file;
if( GSs_on && (TGs_on || TGs_grid_on) )
{
TG_GS_filename = TG_output_path + "/All_TG_GS_Contacts.csv";
TG_GS_AllContacts_file.open(TG_GS_filename);

TG_GS_AllContacts_file << "Pass type,Location,Epoch UTC in,Epoch UTC out,GPS time [s] in,Duration [min],El. in [deg],El. out [deg],Epoch UTC Max. El.,Max. El. [deg],Az. in [deg],Az. out [deg],Az. Max El. [deg],lon [deg],lat [deg],P#,S#" << endl;
}

SOLSYS Suncompute;
Expand All @@ -250,7 +265,7 @@ int main(int argc, char *argv[])
{
AllUmbras_file.open(Eclipse_filename);

AllUmbras_file << "Penumbra start UTC,Umbra start UTC,Umbra end UTC,Penumbra end UTC,Umbra duration [m],Penumbra duration [m],Orbital plane,Spacecraft" << endl;
AllUmbras_file << "Penumbra start UTC,Umbra start UTC,Umbra end UTC,Penumbra end UTC,Umbra duration [min],Penumbra duration [min],P#,S#" << endl;
}

if(TGs_on) cout << "Compute TG contacts (list)" << endl;
Expand Down Expand Up @@ -282,7 +297,7 @@ int main(int argc, char *argv[])
bool valid;
Vec4d a_ex_ey_i;
ephem_file = Orbit_ephemeris_path + "/" + "S" + to_string(s_ind) + "-P" + to_string(p_ind) + "_" + Orbit_ephemeris_rootname;
if(PL_start == 1 || PL_end == 1 || SC_start == 1 || SC_end == 1) ephem_file = Orbit_ephemeris_path + "/" + Orbit_ephemeris_rootname;
if(PL_start == 1 && PL_end == 1 && SC_start == 1 && SC_end == 1) ephem_file = Orbit_ephemeris_path + "/" + Orbit_ephemeris_rootname;
//cout << ephem_file << endl;
loaded_ephem = read_csvfile(ephem_file.c_str(),15);
matrows = loaded_ephem.rows();
Expand Down Expand Up @@ -314,23 +329,61 @@ int main(int argc, char *argv[])
orbstateECEF(i,0) = GPStime;
}

if(TGs_on || TGs_grid_on) TGsContacts(s_ind, p_ind, a_ex_ey_i, orbstateECEF, TGs_grid_lons, TGs_grid_lats, TGs_list, TG_output_path, FOV_cross, FOV_along, duration, simstep, TGs_on, TGs_grid_on, AllContacts_file);
if(TGs_on || TGs_grid_on) TGsContacts(s_ind, p_ind, a_ex_ey_i, orbstateECEF, TGs_grid_lons, TGs_grid_lats, TGs_list, TG_output_path, FOV_cross, FOV_along, duration, simstep, TGs_on, TGs_grid_on, TG_passes);

if(GSs_on) GSsContacts(s_ind, p_ind, a_ex_ey_i, orbstateECEF, GSs_list, GS_output_path, duration, simstep, GS_AllContacts_file);
if(GSs_on) GSsContacts(s_ind, p_ind, a_ex_ey_i, orbstateECEF, GSs_list, GS_output_path, duration, simstep, GS_passes);

if(Eclipse_on) Umbras(s_ind, p_ind, Suncompute, time_posECI, Umbras_output_path, duration, simstep, AllUmbras_file);
}
}

//////////////////////////////////////////////////////////////////////
/////////////// WRITE FILE WITH ALL CONTACTS INFORMATION /////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////


if(TGs_on || TGs_grid_on) AllContacts_file.close();
if(GSs_on) GS_AllContacts_file.close();
//if(TGs_on || TGs_grid_on) AllContacts_file.close();
//if(GSs_on) GS_AllContacts_file.close();

if(TGs_on || TGs_grid_on)
{
sort(TG_passes.begin(), TG_passes.end());
for(unsigned int i = 0 ; i < TG_passes.size(); i++)
{
AllContacts_file << TG_passes[i].Location_name << "," << TG_passes[i].Epoch_in << "," << TG_passes[i].Epoch_out << "," << fixed << TG_passes[i].GPSsecs_in << "," << TG_passes[i].duration << "," << TG_passes[i].elev_in << "," << TG_passes[i].elev_out << "," << TG_passes[i].maxel_time << "," << TG_passes[i].maxel << "," << TG_passes[i].Az_in << "," << TG_passes[i].Az_out << "," << TG_passes[i].Az_maxel << "," << TG_passes[i].lon << "," << TG_passes[i].lat << "," << TG_passes[i].PP << "," << TG_passes[i].SS << endl;
}

AllContacts_file.close();
}

if(Eclipse_on) AllUmbras_file.close();

if(GSs_on)
{
sort(GS_passes.begin(), GS_passes.end());
for(unsigned int i = 0 ; i < GS_passes.size(); i++)
{
GS_AllContacts_file << GS_passes[i].Location_name << "," << GS_passes[i].Epoch_in << "," << GS_passes[i].Epoch_out << "," << fixed << GS_passes[i].GPSsecs_in << "," << GS_passes[i].duration << "," << GS_passes[i].maxel_time << "," << GS_passes[i].maxel << "," << GS_passes[i].Az_in << "," << GS_passes[i].Az_out << "," << GS_passes[i].Az_maxel << "," << GS_passes[i].lon << "," << GS_passes[i].lat << "," << GS_passes[i].PP << "," << GS_passes[i].SS << endl;

GS_passes[i].pass_type = "GS";
}

GS_AllContacts_file.close();
}

if( GSs_on && (TGs_on || TGs_grid_on) )
{
TG_passes.insert( TG_passes.end(), GS_passes.begin(), GS_passes.end() );
sort(TG_passes.begin(), TG_passes.end());

for(unsigned int i = 0 ; i < TG_passes.size(); i++)
{
TG_GS_AllContacts_file << TG_passes[i].pass_type << "," << TG_passes[i].Location_name << "," << TG_passes[i].Epoch_in << "," << TG_passes[i].Epoch_out << "," << fixed << TG_passes[i].GPSsecs_in << "," << TG_passes[i].duration << "," << TG_passes[i].elev_in << "," << TG_passes[i].elev_out << "," << TG_passes[i].maxel_time << "," << TG_passes[i].maxel << "," << TG_passes[i].Az_in << "," << TG_passes[i].Az_out << "," << TG_passes[i].Az_maxel << "," << TG_passes[i].lon << "," << TG_passes[i].lat << "," << TG_passes[i].PP << "," << TG_passes[i].SS << endl;
}

TG_GS_AllContacts_file.close();
}

clockend = chrono::high_resolution_clock::now();

chrono::duration<double,milli> elapsed_millisecs = clockend - clockstart;
Expand Down
19 changes: 0 additions & 19 deletions extlib/Eigen/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion extlib/Eigen/Cholesky
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@
#include "src/Core/util/ReenableStupidWarnings.h"

#endif // EIGEN_CHOLESKY_MODULE_H
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
31 changes: 27 additions & 4 deletions extlib/Eigen/Core
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef EIGEN_CORE_H
#define EIGEN_CORE_H

// first thing Eigen does: stop the compiler from committing suicide
// first thing Eigen does: stop the compiler from reporting useless warnings.
#include "src/Core/util/DisableStupidWarnings.h"

// then include this file where all our macros are defined. It's really important to do it first because
Expand All @@ -22,7 +22,7 @@
#include "src/Core/util/ConfigureVectorization.h"

// We need cuda_runtime.h/hip_runtime.h to ensure that
// the EIGEN_USING_STD_MATH macro works properly on the device side
// the EIGEN_USING_STD macro works properly on the device side
#if defined(EIGEN_CUDACC)
#include <cuda_runtime.h>
#elif defined(EIGEN_HIPCC)
Expand All @@ -36,10 +36,17 @@

// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3)
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details.
#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6)
#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6) && EIGEN_GNUC_AT_MOST(5,5)
#pragma GCC optimize ("-fno-ipa-cp-clone")
#endif

// Prevent ICC from specializing std::complex operators that silently fail
// on device. This allows us to use our own device-compatible specializations
// instead.
#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \
&& !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_)
#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1
#endif
#include <complex>

// this include file manages BLAS and MKL related macros
Expand All @@ -51,6 +58,10 @@
#define EIGEN_HAS_GPU_FP16
#endif

#if defined(EIGEN_HAS_CUDA_BF16) || defined(EIGEN_HAS_HIP_BF16)
#define EIGEN_HAS_GPU_BF16
#endif

#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE)
#define EIGEN_HAS_OPENMP
#endif
Expand All @@ -72,6 +83,7 @@
#include <cmath>
#include <cassert>
#include <functional>
#include <sstream>
#ifndef EIGEN_NO_IO
#include <iosfwd>
#endif
Expand Down Expand Up @@ -107,7 +119,7 @@
#undef isnan
#undef isinf
#undef isfinite
#include <SYCL/sycl.hpp>
#include <CL/sycl.hpp>
#include <map>
#include <memory>
#include <utility>
Expand Down Expand Up @@ -162,6 +174,7 @@ using std::ptrdiff_t;
#include "src/Core/arch/Default/ConjHelper.h"
// Generic half float support
#include "src/Core/arch/Default/Half.h"
#include "src/Core/arch/Default/BFloat16.h"
#include "src/Core/arch/Default/TypeCasting.h"
#include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h"

Expand Down Expand Up @@ -202,6 +215,10 @@ using std::ptrdiff_t;
#include "src/Core/arch/NEON/TypeCasting.h"
#include "src/Core/arch/NEON/MathFunctions.h"
#include "src/Core/arch/NEON/Complex.h"
#elif defined EIGEN_VECTORIZE_SVE
#include "src/Core/arch/SVE/PacketMath.h"
#include "src/Core/arch/SVE/TypeCasting.h"
#include "src/Core/arch/SVE/MathFunctions.h"
#elif defined EIGEN_VECTORIZE_ZVECTOR
#include "src/Core/arch/ZVector/PacketMath.h"
#include "src/Core/arch/ZVector/MathFunctions.h"
Expand Down Expand Up @@ -329,6 +346,12 @@ using std::ptrdiff_t;
#include "src/Core/CoreIterators.h"
#include "src/Core/ConditionEstimator.h"

#if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX)
#include "src/Core/arch/AltiVec/MatrixProduct.h"
#elif defined EIGEN_VECTORIZE_NEON
#include "src/Core/arch/NEON/GeneralBlockPanelKernel.h"
#endif

#include "src/Core/BooleanRedux.h"
#include "src/Core/Select.h"
#include "src/Core/VectorwiseOp.h"
Expand Down
1 change: 0 additions & 1 deletion extlib/Eigen/Eigenvalues
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@
#include "src/Core/util/ReenableStupidWarnings.h"

#endif // EIGEN_EIGENVALUES_MODULE_H
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
Loading

0 comments on commit ecf290e

Please sign in to comment.