mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/SPATZ.git
synced 2025-12-17 17:48:02 +00:00
Major rework using rocketpy
This commit is contained in:
74
spatz/simulations/data_source.py
Normal file
74
spatz/simulations/data_source.py
Normal file
@@ -0,0 +1,74 @@
|
||||
import numpy as np
|
||||
|
||||
from spatz.simulations.advanceable import Advanceable
|
||||
|
||||
from numpy.typing import NDArray
|
||||
from abc import abstractmethod
|
||||
from typing import Literal
|
||||
|
||||
from ambiance import Atmosphere
|
||||
|
||||
|
||||
class DataSource(Advanceable):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def get_speed_of_sound(self) -> float:
|
||||
return Atmosphere(self.get_altitude()).speed_of_sound
|
||||
|
||||
def get_mach_number(self) -> float:
|
||||
speed = np.linalg.norm(self.get_velocity('global'))
|
||||
|
||||
return speed / self.get_speed_of_sound()
|
||||
|
||||
@abstractmethod
|
||||
def get_length(self) -> float:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_position(self) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_velocity(self, frame: Literal['global', 'local']) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_acceleration(self, frame: Literal['global', 'local']) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_attitude(self) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def local_to_global(self) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def global_to_local(self) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_angular_velocity(self) -> NDArray:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_static_pressure(self) -> float:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_temperature(self) -> float:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_longitude(self) -> float:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_latitude(self) -> float:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_altitude(self) -> float:
|
||||
pass
|
||||
Reference in New Issue
Block a user