From 53103ac15e42e1c94436fa205066bbd95f66c75a Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Sun, 19 Mar 2017 19:34:54 +0100 Subject: [PATCH 1/3] YASim: update CLI usage message. --- src/FDM/YASim/yasim-test.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/FDM/YASim/yasim-test.cpp b/src/FDM/YASim/yasim-test.cpp index 71c4ac8ef..5b2b8e2f5 100644 --- a/src/FDM/YASim/yasim-test.cpp +++ b/src/FDM/YASim/yasim-test.cpp @@ -174,12 +174,15 @@ void yasim_drag(Airplane* a, const float aoa, const float alt, int cfg = CONFIG_ int usage() { - fprintf(stderr, "Usage: yasim [-g [-a alt] [-s kts] [-approach | -cruise] ]\n"); - fprintf(stderr, " yasim [-d [-a alt] [-approach | -cruise] ]\n"); - fprintf(stderr, " yasim [-m]\n"); - fprintf(stderr, " -g print lift/drag table: aoa, lift, drag, lift/drag \n"); - fprintf(stderr, " -d print drag over TAS: kts, drag\n"); - fprintf(stderr, " -m print mass distribution table: id, x, y, z, mass \n"); + fprintf(stderr, "Usage: \n"); + fprintf(stderr, " yasim [-g [-a meters] [-s kts] [-approach | -cruise] ]\n"); + fprintf(stderr, " yasim [-d [-a meters] [-approach | -cruise] ]\n"); + fprintf(stderr, " yasim [-m]\n"); + fprintf(stderr, " -g print lift/drag table: aoa, lift, drag, lift/drag \n"); + fprintf(stderr, " -d print drag over TAS: kts, drag\n"); + fprintf(stderr, " -a set altitude in meters!\n"); + fprintf(stderr, " -s set speed in knots\n"); + fprintf(stderr, " -m print mass distribution table: id, x, y, z, mass \n"); return 1; } From f7359d969910ad71abb38638905e75aa49970a58 Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Tue, 21 Mar 2017 22:46:33 +0100 Subject: [PATCH 2/3] YASim: add bug warning messages. --- src/FDM/YASim/FGFDM.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 40bf6efa2..d981eb516 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -832,7 +832,12 @@ Wing* FGFDM::parseWing(XMLAttributes* a, const char* type, Version * version) w->setSweep(attrf(a, "sweep", 0) * DEG2RAD); w->setTaper(attrf(a, "taper", 1)); w->setDihedral(attrf(a, "dihedral", defDihed) * DEG2RAD); - w->setCamber(attrf(a, "camber", 0)); + + float camber = attrf(a, "camber", 0); + if (!version->isVersionOrNewer(Version::YASIM_VERSION_2017_2) && (camber == 0)) { + SG_LOG(SG_FLIGHT, SG_DEV_WARN, "YASIM warning: versions before 2017.2 are buggy for wings with camber=0"); + } + w->setCamber(camber); // These come in with positive indicating positive AoA, but the // internals expect a rotation about the left-pointing Y axis, so From 50110b0cd6f9aebb34e1e9c7077a3ab7e6837430 Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Tue, 21 Mar 2017 22:47:07 +0100 Subject: [PATCH 3/3] YASIM: minor change to allow RigidBody addMass and setMass to trigger aggregation correctly. (not a problem up to now, just to be safe in future) --- src/FDM/YASim/RigidBody.cpp | 3 +-- src/FDM/YASim/RigidBody.hpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FDM/YASim/RigidBody.cpp b/src/FDM/YASim/RigidBody.cpp index e1fb94b70..495098525 100644 --- a/src/FDM/YASim/RigidBody.cpp +++ b/src/FDM/YASim/RigidBody.cpp @@ -55,13 +55,12 @@ void RigidBody::setMass(int handle, float mass) void RigidBody::setMass(int handle, float mass, const float* pos, bool isStatic) { - _masses[handle].m = mass; _masses[handle].isStatic = isStatic; Math::set3(pos, _masses[handle].p); + setMass(handle, mass); if (_bodyN != 0) { SGPropertyNode_ptr n = _bodyN->getChild("mass", handle, true); n->getNode("isStatic", true)->setValue(isStatic); - n->getNode("mass", true)->setFloatValue(mass); n->getNode("pos-x", true)->setFloatValue(pos[0]); n->getNode("pos-y", true)->setFloatValue(pos[1]); n->getNode("pos-z", true)->setFloatValue(pos[2]); diff --git a/src/FDM/YASim/RigidBody.hpp b/src/FDM/YASim/RigidBody.hpp index d7ca39939..4b982e070 100644 --- a/src/FDM/YASim/RigidBody.hpp +++ b/src/FDM/YASim/RigidBody.hpp @@ -82,7 +82,7 @@ public: void setBodySpin(const float* rotation) { Math::set3(rotation, _spin); } // Returns the center of gravity of the masses, in the body - // coordinate system. + // coordinate system. valid only after recalc() void getCG(float* cgOut) { Math::set3(_cg, cgOut); } // Returns the acceleration of the body's c.g. relative to the