pfh.glidersim.extras.simulation#

Utility functions for generating glider simulations.

Functions

compute_euler_derivatives(Theta, omega)

Compute the derivatives of a sequence of Euler angles over time.

linear_control(pairs)

Helper function to build linear interpolators for control inputs.

Classes

CircularThermal(px, py, mag, radius5[, t_enable])

Functor to create circular thermals at specific <x,y> coordinates.

HorizontalShear(x_start, mag, smooth[, t_enable])

Functor to create increasing vertical wind when traveling north.

LateralGust(t_start, t_ramp, t_duration, mag)

Functor to create a global east-to-west gust with linear ramps up and down.

pfh.glidersim.extras.simulation.compute_euler_derivatives(Theta, omega)#

Compute the derivatives of a sequence of Euler angles over time.

Parameters
Thetandarray of float, shape (T,3)

Euler angles ([roll, pitch, yaw] or [phi, theta, gamma])

omegandarray of float, shape (T,3)

Angular velocities

pfh.glidersim.extras.simulation.linear_control(pairs: list[tuple[float, float | None]]) Callable#

Helper function to build linear interpolators for control inputs.

The input is a sequence of tuples encoding (duration, value). An initial value can be set with a leading (0, initial_value) tuple. To “hold” a value, use None to repeat the previous value.

For example, to ramp from 0 to 0.5 over the initial 15 seconds, then transition to 0.75 over a period of 2 seconds, hold for 10 seconds, then decrease to 0 over 10 seconds:

pairs = [(15, 0.5), (2, 0.75), (10, None), (10, 0)]

Parameters
pairslist of 2-tuples of float

Each tuple is (duration, value).

class pfh.glidersim.extras.simulation.CircularThermal(px: float, py: float, mag: float, radius5: float, t_enable: float = 0)#

Bases: object

Functor to create circular thermals at specific <x,y> coordinates.

Parameters
px, pyfloat [m]

The x and y coordinates of the thermal center

magfloat [m/s]

The magnitude of the thermal center

radius5float [m]

The distance from the center where the magnitude has dropped to 5%

t_enablefloat [sec], optional

The time the output magnitudes switches from zero to mag.

Methods

__call__(t, r)

Call self as a function.

__init__(px: float, py: float, mag: float, radius5: float, t_enable: float = 0) None#
__call__(t, r)#

Call self as a function.

class pfh.glidersim.extras.simulation.HorizontalShear(x_start: float, mag: float, smooth: float, t_enable: float = 0)#

Bases: object

Functor to create increasing vertical wind when traveling north.

Transitions from 0 to mag as a sigmoid function. The transition is stretch using smooth.

Parameters
x_startfloat [m]

Northerly position to begin the sigmoid transition.

magfloat [m/s]

The peak vertical windspeed.

smoothfloat

Scaling factor to stretch the transition. FIXME: explain (I forget!)

t_enablefloat [sec], optional

The time the output magnitudes switches from zero to mag.

Methods

__call__(t, r)

Call self as a function.

__init__(x_start: float, mag: float, smooth: float, t_enable: float = 0) None#
__call__(t, r)#

Call self as a function.

class pfh.glidersim.extras.simulation.LateralGust(t_start: float, t_ramp: float, t_duration: float, mag: float)#

Bases: object

Functor to create a global east-to-west gust with linear ramps up and down.

Parameters
t_startfloat [sec]

Time to start the ramp up.

t_rampfloat [sec]

Time duration for the linear ramps up/down to/from peak magnitude.

t_durationfloat [sec]

Time to hold the maximum magnitude gust.

magfloat [m/s]

The peak gust magnitude.

Methods

__call__(t, r)

Call self as a function.

__init__(t_start: float, t_ramp: float, t_duration: float, mag: float) None#
__call__(t, r)#

Call self as a function.