From bf38d1d118fd164ad9de654558f07ceaa51218a8 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Thu, 17 Sep 2020 16:16:28 -0300 Subject: [PATCH 1/2] Add test for Flap component Testing: - instantiation --- tests/Components/Aerodynamic/test_Flap.py | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/Components/Aerodynamic/test_Flap.py diff --git a/tests/Components/Aerodynamic/test_Flap.py b/tests/Components/Aerodynamic/test_Flap.py new file mode 100644 index 0000000..763c74d --- /dev/null +++ b/tests/Components/Aerodynamic/test_Flap.py @@ -0,0 +1,24 @@ +import pytest +import math +from vec import Vector2 + +from adr.Components.Aerodynamic import Flap + + +@pytest.fixture +def flap(): + flap = Flap( + name='flap', + mass=0.05, + relative_position=Vector2(-0.34, 0), + relative_angle=math.radians(0), + width=0.25, + height=0.06 + ) + return flap + + +def test_instantiation(flap): + assert(flap.type == 'flap') + assert(flap.width == 0.25) + assert(flap.height == 0.06) From 76758294a709962eca11328a752ba4ea31460601 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Thu, 17 Sep 2020 16:27:48 -0300 Subject: [PATCH 2/2] Add docs to Flap component Create doc file and add an path to it on the docs structure. --- docs/Components/Aerodynamic/Flap.md | 29 +++++++++++++++++++++++++++++ mkdocs.yml | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 docs/Components/Aerodynamic/Flap.md diff --git a/docs/Components/Aerodynamic/Flap.md b/docs/Components/Aerodynamic/Flap.md new file mode 100644 index 0000000..9cb9e81 --- /dev/null +++ b/docs/Components/Aerodynamic/Flap.md @@ -0,0 +1,29 @@ +# Flap + +The Flap class is intended to be a modifier for the lift and drag calculation on wings. Currently it only has height and width properties that can afterwards be used to calculate its correct aerodynamic behaviour. + +## Instantiation +To instantiate a Flap one can pass the same arguments used to instantiate an AttachedComponent plus its height and width: + +``` python +import math +from vec import Vector2 + +from adr.Components.Aerodynamic import Flap + +flap = Flap( + name='flap', + mass=0.05, + relative_position=Vector2(-0.34, 0), + relative_angle=math.radians(0), + width=0.25, + height=0.06 +) + +print(flap.type) +>>> flap +print(f'Flap dimensions are: {100*flap.width} x {100*flap.height} [cm].') +>>> Flap dimensions are: 25.0 x 6.0 [cm]. +``` + +Remember that a Flap component represents only one physical flap, so one probably wants to always have at least two simetrically positioned flap instances on each aerodynamic surface. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 4992d03..8e20082 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,6 +7,8 @@ nav: BaseComponent: Components/BaseComponent.md FreeBody: Components/FreeBody.md AttachedComponent: Components/AttachedComponent.md + Aerodynamic: + Flap: Components/Aerodynamic/Flap.md World: Ambient: World/Ambient.md constants: World/constants.md