Skip to content

Commit

Permalink
Update to v4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sbowman-mitre committed Jun 9, 2023
1 parent d86ab50 commit 4dc9da7
Show file tree
Hide file tree
Showing 253 changed files with 17,407 additions and 12,484 deletions.
47 changes: 47 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# BasedOnStyle: Google
AccessModifierOffset: -1
ConstructorInitializerIndentWidth: 3
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: false
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 3
TabWidth: 6
UseTab: Never
BreakBeforeBraces: Attach
IndentFunctionDeclarationAfterType: true
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 6
SortIncludes: Never
---
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ include/build_info.h
cmake-build-debug/
CPackConfig.cmake
CPackSourceConfig.cmake
.DS_Store
**/.DS_Store
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fail_fast: false
repos:
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: [--style=file, -i] # -i does inline formatting and will rewrite the files
# - id: cpplint
# args:
# [
# --verbose=3,
# "--filter=-legal/copyright, -build/namespaces, -build/storage_class, -build/c++11, -build/include_what_you_use, -build/include, -build/include_subdir, -runtime/string, -runtime/int, -build/header_guard, -whitespace/ending_newline, -whitespace/operators, -whitespace/comma, -whitespace/indent, -whitespace/semicolon, -whitespace/newline, -whitespace/blank_line, -whitespace/braces, -whitespace/comments, -whitespace/parens, -runtime/explicit, -build/include_order, -readability/casting, -readability/inheritance, -readability/braces, -readability/utf8, -readability/multiline_comment, -runtime/printf",
# ]
# files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
27 changes: 13 additions & 14 deletions AircraftDynamicsTestFramework/AircraftIntentFromFile.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
// ****************************************************************************
// NOTICE
//
// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001
// and is subject to Federal Aviation Administration Acquisition Management System
// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001
// and is subject to Federal Aviation Administration Acquisition Management System
// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996).
//
// The contents of this document reflect the views of the author and The MITRE
// Corporation and do not necessarily reflect the views of the Federal Aviation
// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA
// nor the DOT makes any warranty or guarantee, expressed or implied, concerning
// The contents of this document reflect the views of the author and The MITRE
// Corporation and do not necessarily reflect the views of the Federal Aviation
// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA
// nor the DOT makes any warranty or guarantee, expressed or implied, concerning
// the content or accuracy of these views.
//
// For further information, please contact The MITRE Corporation, Contracts Management
// For further information, please contact The MITRE Corporation, Contracts Management
// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.
//
// 2022 The MITRE Corporation. All Rights Reserved.
// ****************************************************************************

#include "framework/AircraftIntentFromFile.h"

#include "public/HfpReader2020.h"
#include "framework/HfpReader2020.h"

using std::string;

AircraftIntentFromFile::AircraftIntentFromFile() = default;

AircraftIntentFromFile::~AircraftIntentFromFile() = default;

bool AircraftIntentFromFile::load(DecodedStream* input) {
bool AircraftIntentFromFile::load(DecodedStream *input) {
set_stream(input);

std::string csvfile;
Expand All @@ -42,7 +41,7 @@ bool AircraftIntentFromFile::load(DecodedStream* input) {
return loaded;
}

void AircraftIntentFromFile::PopulateWaypointsFromCsv(const std::string& csv_file) {
void AircraftIntentFromFile::PopulateWaypointsFromCsv(const std::string &csv_file) {
testvector::HfpReader2020 hfp_reader(csv_file, 1);

Units::MetersLength x_waypoint_location[128];
Expand Down Expand Up @@ -92,7 +91,7 @@ void AircraftIntentFromFile::PopulateWaypointsFromCsv(const std::string& csv_fil
int number_of_data_rows = irow + 1;
int forward_row_index = 0;

SetId(0); // hardcoding in this test framework, must match the id in TestFrameworkAircraft.cpp
SetId(0); // hardcoding in this test framework, must match the id in TestFrameworkAircraft.cpp
SetNumberOfWaypoints(number_of_data_rows);
for (int reverse_row_index = number_of_data_rows - 1; reverse_row_index >= 0; --reverse_row_index) {
m_route_data.m_name.push_back(string("F") + string(std::to_string(forward_row_index)));
Expand All @@ -104,14 +103,14 @@ void AircraftIntentFromFile::PopulateWaypointsFromCsv(const std::string& csv_fil
}
}

double AircraftIntentFromFile::LocalStringToDouble(const string& s) {
double AircraftIntentFromFile::LocalStringToDouble(const string &s) {
std::istringstream iss(s);
double val = 0;
iss >> val;
return val;
}

int AircraftIntentFromFile::LocalStringToInt(const string& s) {
int AircraftIntentFromFile::LocalStringToInt(const string &s) {
std::istringstream iss(s);
int val = 0;
iss >> val;
Expand Down
53 changes: 15 additions & 38 deletions AircraftDynamicsTestFramework/Bada.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// ****************************************************************************
// NOTICE
//
// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001
// and is subject to Federal Aviation Administration Acquisition Management System
// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001
// and is subject to Federal Aviation Administration Acquisition Management System
// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996).
//
// The contents of this document reflect the views of the author and The MITRE
// Corporation and do not necessarily reflect the views of the Federal Aviation
// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA
// nor the DOT makes any warranty or guarantee, expressed or implied, concerning
// The contents of this document reflect the views of the author and The MITRE
// Corporation and do not necessarily reflect the views of the Federal Aviation
// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA
// nor the DOT makes any warranty or guarantee, expressed or implied, concerning
// the content or accuracy of these views.
//
// For further information, please contact The MITRE Corporation, Contracts Management
// For further information, please contact The MITRE Corporation, Contracts Management
// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.
//
// 2022 The MITRE Corporation. All Rights Reserved.
// ****************************************************************************

#include "public/BadaUtils.h"
#include "aaesim/Bada.h"

#include <string.h>
Expand All @@ -30,44 +31,35 @@ char Bada::input_path[512];
* Maps the aircraft type to an 8-character file name (no extension).
* Multiple type codes may map to the same value.
*/
string Bada::get_file(char *type_code /** aircraft type abbreviation, e.g. B737 */) {
return (char *) NULL;
}
string Bada::get_file(char *type_code /** aircraft type abbreviation, e.g. B737 */) { return (char *)NULL; }

/**
* Reads the .OPF file, which contains all the thrust,
* drag and fuel coefficients to be used in TEM together
* with information on weights, speeds, maximum altitude, etc.
*/
bool Bada::read_OPF() {
return false;
}
bool Bada::read_OPF() { return false; }

/**
* Reads the .APF file, which contains a default operational
* climb, cruise and descent speed schedule that is likely
* to be used by an airline.
*/
bool Bada::read_APF() {
return false;
}
bool Bada::read_APF() { return false; }

/**
* Reads the .PTF file, which contains a table of performance
* data.
*/
bool Bada::read_PTF() {
return false;
}
bool Bada::read_PTF() { return false; }

/**
* The init() function reads in new data from somewhere
* based on type_code. It calls get_file to map the
* type to a file name and then read_APF, read_OPF, and
* read_PTF.
*/
void Bada::init(char *type_code /** aircraft type abbreviation, e.g. B737 */ ) {
}
void Bada::init(char *type_code /** aircraft type abbreviation, e.g. B737 */) {}

const Bada &Bada::operator=(const Bada &obj) {

Expand All @@ -94,18 +86,16 @@ const Bada &Bada::operator=(const Bada &obj) {

m_performance.speed = obj.m_performance.speed;
m_performance.mass = obj.m_performance.mass;
for (auto ix = 0; ix < FL_NMAX; ix++) {
for (auto ix = 0; ix < aaesim::open_source::bada_utils::FL_NMAX; ix++) {
m_performance.cruise[ix] = obj.m_performance.cruise[ix];
m_performance.climb[ix] = obj.m_performance.climb[ix];
m_performance.descent[ix] = obj.m_performance.descent[ix];
}

}

return *this;
}


bool Bada::operator==(const Bada &obj) const {
bool match(true);

Expand All @@ -119,22 +109,19 @@ bool Bada::operator==(const Bada &obj) const {

match = match && (base_name == obj.base_name);


// aircraft type

match = match && (m_aircraft_type.n_eng == obj.m_aircraft_type.n_eng);
match = match && (m_aircraft_type.engine_type == obj.m_aircraft_type.engine_type);
match = match && (m_aircraft_type.wake_category == obj.m_aircraft_type.wake_category);


// mass

match = match && (m_mass.m_ref == obj.m_mass.m_ref);
match = match && (m_mass.m_min == obj.m_mass.m_min);
match = match && (m_mass.m_max == obj.m_mass.m_max);
match = match && (m_mass.m_pyld == obj.m_mass.m_pyld);


// flight envelope

match = match && (m_flight_envelope.V_mo == obj.m_flight_envelope.V_mo);
Expand All @@ -143,7 +130,6 @@ bool Bada::operator==(const Bada &obj) const {
match = match && (m_flight_envelope.h_max == obj.m_flight_envelope.h_max);
match = match && (m_flight_envelope.G_w == obj.m_flight_envelope.G_w);


// m_aerodynamics

match = match && (m_aerodynamics.S == obj.m_aerodynamics.S);
Expand Down Expand Up @@ -173,7 +159,6 @@ bool Bada::operator==(const Bada &obj) const {

match = match && (m_aerodynamics.landing_gear.cd0 == obj.m_aerodynamics.landing_gear.cd0);


// engine thrust

match = match && (m_engine_thrust.max_climb.CT_c1 == obj.m_engine_thrust.max_climb.CT_c1);
Expand All @@ -190,7 +175,6 @@ bool Bada::operator==(const Bada &obj) const {
match = match && (m_engine_thrust.descent.V_ref == obj.m_engine_thrust.descent.V_ref);
match = match && (m_engine_thrust.descent.M_ref == obj.m_engine_thrust.descent.M_ref);


// fuel flow

match = match && (m_fuel_flow.C_f1 == obj.m_fuel_flow.C_f1);
Expand All @@ -199,15 +183,13 @@ bool Bada::operator==(const Bada &obj) const {
match = match && (m_fuel_flow.C_f4 == obj.m_fuel_flow.C_f4);
match = match && (m_fuel_flow.C_fcr == obj.m_fuel_flow.C_fcr);


// ground movement

match = match && (m_ground_movement.TOL == obj.m_ground_movement.TOL);
match = match && (m_ground_movement.LDL == obj.m_ground_movement.LDL);
match = match && (m_ground_movement.span == obj.m_ground_movement.span);
match = match && (m_ground_movement.length == obj.m_ground_movement.length);


// procedures

for (auto ix = 0; match && (ix < 3); ix++) {
Expand All @@ -224,7 +206,6 @@ bool Bada::operator==(const Bada &obj) const {
match = match && (m_procedures[ix].descent.M == obj.m_procedures[ix].descent.M);
}


// performance

match = match && (m_performance.speed.climb.CAS.LO == obj.m_performance.speed.climb.CAS.LO);
Expand All @@ -243,8 +224,7 @@ bool Bada::operator==(const Bada &obj) const {
match = match && (m_performance.mass.nominal == obj.m_performance.mass.nominal);
match = match && (m_performance.mass.high == obj.m_performance.mass.high);


for (auto ix = 0; match && (ix < FL_NMAX); ix++) {
for (auto ix = 0; match && (ix < aaesim::open_source::bada_utils::FL_NMAX); ix++) {
match = match && (m_performance.cruise[ix].FL == obj.m_performance.cruise[ix].FL);
match = match && ((isnan(Units::MetersPerSecondSpeed(m_performance.cruise[ix].TAS).value()) &&
isnan(Units::MetersPerSecondSpeed(obj.m_performance.cruise[ix].TAS).value())) ||
Expand All @@ -260,7 +240,6 @@ bool Bada::operator==(const Bada &obj) const {
isnan(Units::KilogramsPerHourMassFlowRate(obj.m_performance.cruise[ix].fuel.hi).value())) ||
(m_performance.cruise[ix].fuel.hi == obj.m_performance.cruise[ix].fuel.hi));


match = match && (m_performance.climb[ix].FL == obj.m_performance.climb[ix].FL);
match = match && ((isnan(Units::MetersPerSecondSpeed(m_performance.climb[ix].TAS).value()) &&
isnan(Units::MetersPerSecondSpeed(obj.m_performance.climb[ix].TAS).value())) ||
Expand All @@ -280,7 +259,6 @@ bool Bada::operator==(const Bada &obj) const {
isnan(Units::KilogramsPerHourMassFlowRate(obj.m_performance.climb[ix].fuel).value())) ||
(m_performance.climb[ix].fuel == obj.m_performance.climb[ix].fuel));


match = match && (m_performance.descent[ix].FL == obj.m_performance.descent[ix].FL);

match = match && ((isnan(Units::MetersPerSecondSpeed(m_performance.descent[ix].TAS).value()) &&
Expand All @@ -294,7 +272,6 @@ bool Bada::operator==(const Bada &obj) const {
match = match && ((isnan(Units::KilogramsPerHourMassFlowRate(m_performance.descent[ix].fuel).value()) &&
isnan(Units::KilogramsPerHourMassFlowRate(obj.m_performance.descent[ix].fuel).value())) ||
(m_performance.descent[ix].fuel == obj.m_performance.descent[ix].fuel));

}

return match;
Expand Down
Loading

0 comments on commit 4dc9da7

Please sign in to comment.