Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests and docs for Flap component #277

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/Components/Aerodynamic/Flap.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions tests/Components/Aerodynamic/test_Flap.py
Original file line number Diff line number Diff line change
@@ -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)