Skip to content

Commit

Permalink
pressure units, EADI maximum flap extension speed, indicated airspeed…
Browse files Browse the repository at this point in the history
…, autopilot - ARM/ALT mode switch condition, deb package scripts
  • Loading branch information
marek-cel committed Dec 7, 2019
1 parent 7f048bd commit 28052bc
Show file tree
Hide file tree
Showing 46 changed files with 1,821 additions and 998 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG
@@ -1,3 +1,17 @@
2019-12-08 Marek M. Cel <marekcel@marekcel.pl>

* pressure units

* EADI maximum flap extension speed

* indicated airspeed

* autopilot - ARM/ALT mode switch condition

* deb package scripts



2019-11-30 Marek M. Cel <marekcel@marekcel.pl>

* layer clouds
Expand Down
16 changes: 16 additions & 0 deletions deb_clean.sh
@@ -0,0 +1,16 @@
#!/bin/bash

################################################################################

APP_NAME=mscsim

################################################################################

APP_DIR=${APP_NAME}_*_bionic_amd64

sudo rm -R $APP_DIR
sudo rm $APP_DIR.deb

################################################################################

read -p "Press any key to continue..." -n1 -s
10 changes: 10 additions & 0 deletions create_dpkg.sh → deb_create.sh
Expand Up @@ -16,12 +16,22 @@ mkdir $APP_DIR
mkdir $APP_DIR/DEBIAN
mkdir $APP_DIR/usr
mkdir $APP_DIR/usr/bin
mkdir $APP_DIR/usr/share
mkdir $APP_DIR/usr/share/applications
mkdir $APP_DIR/usr/share/icons
mkdir $APP_DIR/usr/share/icons/hicolor
mkdir $APP_DIR/usr/share/icons/hicolor/128x128
mkdir $APP_DIR/usr/share/icons/hicolor/128x128/apps

cp deb_mscsim_amd64.control $APP_DIR/DEBIAN/control
cp bin/mscsim $APP_DIR/usr/bin/
cp mscsim.desktop $APP_DIR/usr/share/applications/
cp mscsim.png $APP_DIR/usr/share/icons/hicolor/128x128/apps/

sudo chown root:root -R $APP_DIR
sudo chmod 0755 $APP_DIR/usr/bin/mscsim
sudo chmod 0755 $APP_DIR/usr/share/applications/mscsim.desktop
sudo chmod 0755 $APP_DIR/usr/share/icons/hicolor/128x128/apps/mscsim.png

dpkg -b $APP_DIR/

Expand Down
11 changes: 11 additions & 0 deletions mscsim.desktop
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Version=0.2
Name=MScSim
GenericName=Flight Simulator
Exec=mscsim
Terminal=false
Categories=Game;Simulation
Comment=open-source flight simulator
Keywords=
Icon=mscsim
Binary file added mscsim.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/Data.h
Expand Up @@ -222,8 +222,6 @@ class Data
/** VOR TO/FROM indicator. */
enum NAV_CDI { NONE = 0, TO, FROM };

double course; ///< [rad]

bool adf_visible; ///<
double adf_bearing; ///< [rad]

Expand Down Expand Up @@ -270,6 +268,7 @@ class Data
double slipSkidAngle; ///< [rad] slip/skid angle

double airspeed; ///< [m/s] airspeed
double ias; ///< [m/s] indicated airspeed
double machNumber; ///< [-] Mach number
double climbRate; ///< [m/s] climb rate

Expand Down
19 changes: 2 additions & 17 deletions src/Manager.cpp
Expand Up @@ -42,10 +42,6 @@ Manager::Manager() :
_sim ( NULLPTR ),
_win ( NULLPTR ),

# ifdef SIM_NETWORKING
_net ( NULLPTR ),
# endif

_timer ( 0 ),
_timerId ( 0 ),
_timeStep ( 0.0 )
Expand All @@ -54,10 +50,6 @@ Manager::Manager() :
_sim = new Simulation();
_win = new MainWindow();

# ifdef SIM_NETWORKING
_net = new Networking();
# endif

_timer = new QElapsedTimer();
}

Expand All @@ -80,10 +72,6 @@ Manager::~Manager()
DELPTR( _nav );
DELPTR( _sim );
DELPTR( _win );

# ifdef SIM_NETWORKING
DELPTR( _net );
# endif
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -176,10 +164,6 @@ void Manager::timerEvent( QTimerEvent *event )
Data::get()->propulsion.engine[ i ].propeller = hid::Manager::instance()->getPropeller( i );
}

# ifdef SIM_NETWORKING
_net->update();
# endif

///////////////////////////////////
emit dataInpUpdated( Data::get() );
///////////////////////////////////
Expand All @@ -201,7 +185,7 @@ void Manager::onDataOutUpdated( const fdm::DataOut &dataOut )
Data::get()->cgi.hud.climbRate = dataOut.flight.climbRate;
Data::get()->cgi.hud.radioAlt = dataOut.flight.altitude_agl;

Data::get()->cgi.hud.airspeed = dataOut.flight.airspeed;
Data::get()->cgi.hud.airspeed = dataOut.flight.ias;
Data::get()->cgi.hud.machNumber = dataOut.flight.machNumber;
Data::get()->cgi.hud.g_force = dataOut.flight.g_force_z;

Expand Down Expand Up @@ -231,6 +215,7 @@ void Manager::onDataOutUpdated( const fdm::DataOut &dataOut )
Data::get()->ownship.slipSkidAngle = dataOut.flight.slipSkidAngle;

Data::get()->ownship.airspeed = dataOut.flight.airspeed;
Data::get()->ownship.ias = dataOut.flight.ias;
Data::get()->ownship.machNumber = dataOut.flight.machNumber;
Data::get()->ownship.climbRate = dataOut.flight.climbRate;

Expand Down
8 changes: 0 additions & 8 deletions src/Manager.h
Expand Up @@ -31,10 +31,6 @@

#include <Simulation.h>

#ifdef SIM_NETWORKING
# include <Networking.h>
#endif

////////////////////////////////////////////////////////////////////////////////

/**
Expand Down Expand Up @@ -66,10 +62,6 @@ class Manager : public QObject
Simulation *_sim; ///< simulation
MainWindow *_win; ///< GUI

# ifdef SIM_NETWORKING
Networking *_net; ///< networking
# endif

QElapsedTimer *_timer; ///< elapsed timer

int _timerId; ///< timer Id
Expand Down
4 changes: 2 additions & 2 deletions src/Simulation.cpp
Expand Up @@ -27,12 +27,12 @@
////////////////////////////////////////////////////////////////////////////////

Simulation::Simulation() :
QThread ( 0 ),
QThread ( NULLPTR ),

_timeoutTimer ( NULLPTR ),
_elapsedTimer ( NULLPTR ),

_fdm ( 0 ),
_fdm ( NULLPTR ),

_timeStep ( 0.0 ),
_timeCoef ( 1.0 ),
Expand Down
1 change: 1 addition & 0 deletions src/cgi/cgi.pri
Expand Up @@ -15,6 +15,7 @@ HEADERS += \
$$PWD/cgi_Mercator.h \
$$PWD/cgi_Models.h \
$$PWD/cgi_Module.h \
$$PWD/cgi_Singleton.h \
$$PWD/cgi_Textures.h \
$$PWD/cgi_WGS84.h

Expand Down
10 changes: 5 additions & 5 deletions src/cgi/cgi_Singleton.h
Expand Up @@ -42,24 +42,24 @@ class Singleton
/** */
static TYPE* instance()
{
if ( !m_instance )
if ( !_instance )
{
m_instance = new TYPE();
_instance = new TYPE();
}

return m_instance;
return _instance;
}

private:

static TYPE *m_instance; ///<
static TYPE *_instance; ///<
};

} // end of cgi namespace

////////////////////////////////////////////////////////////////////////////////

template < class TYPE > TYPE* cgi::Singleton< TYPE >::m_instance = NULLPTR;
template < class TYPE > TYPE* cgi::Singleton< TYPE >::_instance = NULLPTR;

////////////////////////////////////////////////////////////////////////////////

Expand Down
3 changes: 0 additions & 3 deletions src/cgi/map/cgi_Layers.cpp
Expand Up @@ -128,10 +128,7 @@ Layers::Layers( const Module *parent ) :
initLayer( _borders .get() , Map::_colorBorders );

createOcean();

# ifndef SIM_MARBLE_MAPS
readLayers();
# endif
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions src/fdm/auto/fdm_Autopilot.h
Expand Up @@ -94,10 +94,10 @@ class FDMEXPORT Autopilot
inline void disengage() { _engaged = false; }
inline void engage() { _engaged = true; }

inline double getMinAltitude() const { return _min_alt; }
inline double getMaxAltitude() const { return _max_alt; }
inline double getMinClimbRate() const { return _min_vs; }
inline double getMaxClimbRate() const { return _max_vs; }
inline double getMinAltitude() const { return _min_alt; }
inline double getMaxAltitude() const { return _max_alt; }
inline double getMinClimbRate() const { return _min_vs; }
inline double getMaxClimbRate() const { return _max_vs; }

inline double getAltitude() const { return _fd->getAltitude(); }
inline double getAirspeed() const { return _fd->getAirspeed(); }
Expand Down
4 changes: 2 additions & 2 deletions src/fdm/auto/fdm_FlightDirector.h
Expand Up @@ -89,8 +89,8 @@ class FDMEXPORT FlightDirector

protected:

double _cmd_roll; ///< roll command
double _cmd_pitch; ///< pitch command
double _cmd_roll; ///< [rad] roll command
double _cmd_pitch; ///< [rad] pitch command

double _altitude; ///< [m] desired altitude
double _airspeed; ///< [m/s] desired airspeed
Expand Down
1 change: 1 addition & 0 deletions src/fdm/fdm_DataOut.h
Expand Up @@ -79,6 +79,7 @@ struct DataOut
double slipSkidAngle; ///< [rad] slip/skid angle

double airspeed; ///< [m/s] airspeed
double ias; ///< [m/s] indicated airspeed
double machNumber; ///< [-] Mach number
double climbRate; ///< [m/s] climb rate

Expand Down
5 changes: 4 additions & 1 deletion src/fdm/main/fdm_Aircraft.cpp
Expand Up @@ -71,6 +71,7 @@ Aircraft::Aircraft( const DataInp *dataInp, DataOut *dataOut ) :
_trackAngle ( 0.0 ),
_slipSkidAngle ( 0.0 ),
_airspeed ( 0.0 ),
_ias ( 0.0 ),
_dynPress ( 0.0 ),
_machNumber ( 0.0 ),
_climbRate ( 0.0 ),
Expand Down Expand Up @@ -158,6 +159,7 @@ void Aircraft::updateOutputData()
_dataOut->flight.slipSkidAngle = _slipSkidAngle;

_dataOut->flight.airspeed = _airspeed;
_dataOut->flight.ias = _ias;
_dataOut->flight.machNumber = _machNumber;
_dataOut->flight.climbRate = _climbRate;

Expand Down Expand Up @@ -411,7 +413,7 @@ void Aircraft::detectCrash()
// detect overspeed
if ( _crash == DataOut::NoCrash )
{
if ( _airspeed > _airspeed_max )
if ( _ias > _airspeed_max )
{
_crash = DataOut::Overspeed;
}
Expand Down Expand Up @@ -619,6 +621,7 @@ void Aircraft::updateVariables( const StateVector &stateVect,

_airspeed = _vel_air_bas.getLength();
_dynPress = 0.5 * _envir->getDensity() * Misc::pow2( _airspeed );
_ias = sqrt( 2.0 * _dynPress / fdm::Atmosphere::_std_sl_rho );
_machNumber = _envir->getSpeedOfSound() > 0.0 ? ( _airspeed / _envir->getSpeedOfSound() ) : 0.0;
_climbRate = -_vel_ned.z();
}
6 changes: 3 additions & 3 deletions src/fdm/main/fdm_Aircraft.h
Expand Up @@ -77,8 +77,6 @@

#include <fdm/fdm_Base.h>

#include <fdm/fdm_Recorder.h>

#include <fdm/main/fdm_Environment.h>
#include <fdm/main/fdm_Intersections.h>

Expand Down Expand Up @@ -243,6 +241,7 @@ class FDMEXPORT Aircraft : public Base
inline double getTrackAngle() const { return _trackAngle; }
inline double getSlipSkidAngle() const { return _slipSkidAngle; }
inline double getAirspeed() const { return _airspeed; }
inline double getIAS() const { return _ias; }
inline double getDynPress() const { return _dynPress; }
inline double getMachNumber() const { return _machNumber; }
inline double getClimbRate() const { return _climbRate; }
Expand Down Expand Up @@ -294,7 +293,7 @@ class FDMEXPORT Aircraft : public Base

CollisionPoints _cp; ///< [m] collision points expressed in BAS

double _airspeed_max; ///< [m/s] maximum airspeed (exceeding this value causes crash)
double _airspeed_max; ///< [m/s] maximum indicated airspeed (exceeding this value causes crash)
double _load_aero_min; ///< [-] minimum (maximum negative) load factor due to aerodynamics (exceeding this value causes crash)
double _load_aero_max; ///< [-] maximum (maximum positive) load factor due to aerodynamics (exceeding this value causes crash)
double _load_gear_max; ///< [-] maximum absolute load factor due to landing gear (exceeding this value causes crash)
Expand Down Expand Up @@ -361,6 +360,7 @@ class FDMEXPORT Aircraft : public Base
double _slipSkidAngle; ///< [rad] slip/skid angle
double _airspeed; ///< [m/s] true airspeed
double _dynPress; ///< [Pa] dynamic pressure
double _ias; ///< [m/s] indicated airspeed
double _machNumber; ///< [-] Mach number
double _climbRate; ///< [m/s] climb rate
double _turnRate; ///< [rad/s] turn rate
Expand Down
4 changes: 3 additions & 1 deletion src/fdm/utils/fdm_Units.cpp
Expand Up @@ -71,6 +71,8 @@ Units::fptr Units::getConverter( const char *name )
return &Units::psi2pa;
else if ( 0 == String::icompare( name, "inHg" ) )
return &Units::inhg2pa;
else if ( 0 == String::icompare( name, "mb" ) )
return &Units::mb2pa;

else if ( 0 == String::icompare( name, "PS" ) )
return &Units::ps2w;
Expand All @@ -90,5 +92,5 @@ Units::fptr Units::getConverter( const char *name )
else if ( 0 == String::icompare( name, "g_kNs" ) )
return &Units::g_kNs_2_kg_Ns;

return &Units::dummy;
return FDM_NULLPTR;
}

0 comments on commit 28052bc

Please sign in to comment.