frispy
Submodules
Package Contents
Classes
Flying spinning disc object. The disc object contains only physical |
|
The environment in which the disc is flying in. This object contains |
|
|
|
Coefficient model for a disc. Holds all of the aerodynamic |
|
Class for computing the disc flight trajectory. Takes initial values |
Attributes
- class frispy.Disc(model: frispy.model.Model = Model(), eom: Optional[frispy.equations_of_motion.EOM] = None, **kwargs)[source]
Flying spinning disc object. The disc object contains only physical parameters of the disc and environment that it exists (e.g. gravitational acceleration and air density). Note that the default area, mass, and inertial moments are for Discraft Ultrastars (175 grams or 0.175 kg).
All masses are kg, lengths are meters (m) and times are seconds (s). That is, these files all use mks units. Angular units use radians (rad), and angular velocities are in rad/s.
- Parameters
- _default_initial_conditions
- compute_trajectory(self, flight_time: float = 3.0, return_scipy_results: bool = False, **kwargs)[source]
Call the differential equation solver to compute the trajectory. The kinematic variables and timesteps are saved as the current_trajectory attribute, which is a dictionary, which is also returned by this function.
See the scipy docs for more information on the solver.
Warning
You cannot pass a flight_time if t_span is a key in solver_args.
- Parameters
flight_time (float, optional) – time in seconds that the simulation will run over. Default is 3 seconds.
return_scipy_results (bool, optional) – Default is False. Flag to indicate whether to return the full results object of the solver. See the scipy docs for more information.
kwargs – extra keyword arguments to pass to the
scipy.integrate.solver_ivp()
- reset_initial_conditions(self) None [source]
Set the initial_conditions of the disc to the default and clear the trajectory.
- property environment(self) frispy.environment.Environment
- property trajectory_object(self) frispy.trajectory.Trajectory
- property coordinate_names(self) List[str]
Names of the kinematic variables
- class frispy.Environment[source]
Bases:
NamedTuple
The environment in which the disc is flying in. This object contains information on the magnitude and direction of gravity, properties of the wind, and also intrinsic properties of the disc such as its area and mass.
- Parameters
air_density (float) – default is 1.225 kg/m^3
area (float) – default is 0.057 m^2
g (float) – default is 9.81 m/s^2; gravitational acceleration on Earth
I_zz (float) – default is 0.002352 kg*m^2; z-axis moment of inertia
I_xx (float) – default is 0.001219 kg*m^2; x and y-axis moments of inertia (i.e. is the same as I_yy and the cross components I_xy)
mass (float) – defualt is 0.175 kg
- air_density :float = 1.225
- area :float = 0.058556
- g :float = 9.81
- I_zz :float = 0.002352
- I_xx :float = 0.001219
- mass :float = 0.175
- property grav_unit_vector(self) numpy.ndarray
Gravitational direction.
- property diameter(self) float
Disc diameter.
- class frispy.EOM(environment: frispy.environment.Environment = Environment(), model: frispy.model.Model = Model(), trajectory: frispy.trajectory.Trajectory = Trajectory())[source]
EOM
is short for “equations of motion” is used to run the ODE solver from scipy. It takes in a model for the disc, the trajectory object, the environment, and implements the functions for calculating forces and torques.- compute_forces(self, phi: float, theta: float, velocity: numpy.ndarray, ang_velocity: numpy.ndarray) Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]] [source]
Compute the lift, drag, and gravitational forces on the disc.
- compute_torques(self, velocity: numpy.ndarray, ang_velocity: numpy.ndarray, res: Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]]) Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]] [source]
Compute the torque around each principle axis.
- compute_derivatives(self, time: float, coordinates: numpy.ndarray) numpy.ndarray [source]
Right hand side of the ordinary differential equations. This is supplied to
scipy.integrate.solve_ivp()
. See this page for more information about its fun argument.- Parameters
time (float) – instantanious time of the system
coordinates (np.ndarray) – kinematic variables of the disc
- Returns
derivatives of all coordinates
- class frispy.Model[source]
Coefficient model for a disc. Holds all of the aerodynamic parameters coupling the kinematic variables (spins and angles) to the force magnitudes.
- PL0 :float = 0.33
- PLa :float = 1.9
- PD0 :float = 0.18
- PDa :float = 0.69
- PTxwx :float = 0.43
- PTxwz :float
- PTy0 :float
- PTya :float
- PTywy :float
- PTzwz :float
- alpha_0 :float
- C_lift(self, alpha: float) float [source]
Lift force scale factor. Linear in the angle of attack (alpha).
- Parameters
alpha (float) – angle of attack in radians
- Returns
(float) lift force scale factor
- C_drag(self, alpha: float) float [source]
Drag force scale factor. Quadratic in the angle of attack (alpha).
- Parameters
alpha (float) – angle of attack in radians
- Returns
(float) drag force scale factor
- C_x(self, wx: float, wz: float) float [source]
‘x’-torque scale factor. Linearly additive in the ‘z’ angular velocity (w_z) and the ‘x’ angular velocity (w_x).
- Parameters
wx (float) – ‘x’ angular velocity in radians per second
wz (float) – ‘z’ angular velocity in radians per second
- Returns
(float) ‘x’-torque scale factor
- C_y(self, alpha: float, wy: float) float [source]
‘y’-torque scale factor. Linearly additive in the ‘y’ angular velocity (w_y) and the angle of attack (alpha).
- Parameters
alpha (float) – angle of attack in radians
wy (float) – ‘y’ angular velocity in radians per second
- Returns
(float) ‘y’-torque scale factor
- class frispy.Trajectory[source]
Class for computing the disc flight trajectory. Takes initial values and interfaces with an ODE solver.
Units are meters [m] for length, kilograms [kg] for mass, seconds [s] for time, and radians [rad] for angles.
- Parameters
x (float) – horizontal position; default is 0 m
y (float) – horizontal position; default is 0 m
z (float) – vertical position; default is 1 m
vx (float) – x-velocity; default is 10 m/s
vy (float) – y-velocity; default is 0 m/s
vz (float) – z-velocity; default is 0 m/s
phi (float) – 1st Euler angle (pitch); default is 0 rad
theta (float) – 2nd Euler angle (roll); default is 0 rad
gamma (float) – 3rd Euler angle (spin); default is 0 rad
phidot (float) – phi angular velocity; default is 0 rad/s
thetadot (float) – theta angular velocity; default is 0 rad/s
gammadot (float) – gamma angular velocity; default is 50 rad/s
- x :float = 0
- y :float = 0
- z :float = 1
- vx :float = 10
- vy :float = 0
- vz :float = 0
- phi :float = 0
- theta :float = 0
- gamma :float = 0
- phidot :float = 0
- thetadot :float = 0
- gammadot :float = 50
- property velocity(self) numpy.ndarray
- property angular_velocity(self) numpy.ndarray
- frispy.__author__ = Tom McClintock thmsmcclintock@gmail.com
- frispy.__version__ = 1.0.4
- frispy.__docs__ = Simulates flying spinning discs.