def test_instantiation_error(): ambient = Ambient(temperature=0) with pytest.raises(ValueError) as e_info: air_density = ambient.air_density ambient = Ambient(humidity=104) with pytest.raises(ValueError) as e_info: air_density = ambient.air_density ambient = Ambient(pressure=-3) with pytest.raises(ValueError) as e_info: air_density = ambient.air_density
def freebody_component(): freebody_component = FreeBody(name='component', type='generic_component', mass=3.4, angle=math.radians(5), position_cg=Vector2(-0.7, 0.2), pitch_rot_inertia=30.0, ambient=Ambient()) return freebody_component
def plane(): env = Ambient() plane = FreeBody( name='plane', type='plane', mass=23.4, position_cg=Vector2(-0.2, 0.02), pitch_rot_inertia=5.2, ambient=env, ) return plane
def freebody(): env = Ambient() freebody = FreeBody( name='freebody', type='generic_freebody', mass=23.4, position_cg=Vector2(-0.2, 0.02), pitch_rot_inertia=5.2, ambient=env, ) return freebody
def base_ambient(): base_ambient = Ambient(temperature=288.15, pressure=101325, humidity=30) return base_ambient
import math from vec import Vector2 from adr.World import Ambient from adr.Components import FreeBody, AttachedComponent ambient = Ambient() plane = FreeBody(name='plane', mass=0.0, position_cg=Vector2(x=-0.05, y=0), pitch_rot_inertia=30.0, ambient=ambient) wing = AttachedComponent( name='wing', relative_position=Vector2(x=-0.10, y=0), relative_angle=math.radians(+5), mass=0.370, ) wing.set_parent(plane) print(plane.wing.mass)