![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
/******************************************************************************
* Copyright (c) ATTX INC 2025. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the
* proprietary and confidential information of ATTX, INC. The Software is
* furnished under a license agreement between ATTX and the user organization
* and may be used or copied only in accordance with the terms of the agreement.
* Refer to 'license/attx_license.adoc' for standard license terms.
*
* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
* transmitted in any form or by any means, for any purpose, without the express
* written permission of ATTX, INC.
******************************************************************************/
/*
Simple disturbance wind model header file
Author: James Tabony
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/
#ifndef MODELS_ENVIRONMENT_SIMPLE_DISTURBANCE_WIND_MODEL_H
#define MODELS_ENVIRONMENT_SIMPLE_DISTURBANCE_WIND_MODEL_H
#include "simulation/Model.h"
#include "simulation/NormalRandom.hpp"
#include "utils/Interpolate2D.h"
namespace warptwin {
/**
* @brief Simple disturbance wind model
*
* This model generates an objects experienced mean wind through a pseudo-deterministic process.
* The mean wind magnitude is based an a power function sclaled by a reference wind spead at
* a given altitude.
*
* $$ V(h) = V_{ref} * \left( \frac{h}{h_{ref}} \right)^\alpha $$
*
* The wind direction perturbed around a provided value (wind direction at reference altitude)
* in a continuous (not smooth) manner. By a function f(h) with uniformly distributed outputs
* for select altitudes between the values of [-1, 1]. This relationship is:
*
* $$ \theta(h) = \theta_0 + \Delta \theta \cdot f(h) \qquad f:h \in \mathbb{R} \mapsto [-1, 1] \, \, \text{and} \, f(0) := 0 $$
*
* Author: James Tabony <james.tabony@attx.tech>
*/
MODEL(SimpleDisturbanceWindModel)
public:
// Model params
// NAME TYPE DEFAULT VALUE
START_PARAMS
/** Wind speed at 20 feet altitude from surface NOT WGS84 ellipsoid. Defaults to 30 knots which corresponds to moderate turbulence. (meters/second) */
SIGNAL(wind_speed_ref, double, 15.4333)
/** Altitude of the surface relative to the WGS84 model. (meters) */
SIGNAL(altitude_surface, double, 0.0)
/** Value to seed the internal RNG for this model. */
SIGNAL(seed_value, int, 0)
END_PARAMS
// Model inputs
// NAME TYPE DEFAULT VALUE
START_INPUTS
/** Altitude of the object as relative to the WGS84 model. (meters) */
SIGNAL(altitude, double, 0.0)
END_INPUTS
// Model outputs
// NAME TYPE DEFAULT VALUE
START_OUTPUTS
/** The disturbance wind vector of the object expressed in the mean wind frame (meters/second), defined as:
* X : In the direction of the mean wind
* Y : Cross-wind, perpendicular to the direction of mean wind but in local surface horizontal plane (Z cross X = Y)
* Z : Aligned with the mean wind frame. Perpendicular to surface.
* The velocity is expressed relative to a planet rotating frame. */
SIGNAL(wind_dist__MWF, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
END_OUTPUTS
protected:
int16 start() override;
int16 execute() override;
/// @brief Function to configure sensor -- runs in all constructors
void _configureInternal();
// Internal variables for turbulence intensity and scale length in each direction
double _turb_intensity_u;
double _turb_intensity_v;
double _turb_intensity_w;
double _scale_length_u;
double _scale_length_v;
double _scale_length_w;
// Interal variable for the altitude in feet
double _altitude_feet;
// Internal variables for the output wind components (feet/second)
double _wind_u_feet;
double _wind_v_feet;
double _wind_w_feet;
// Internal model for generating a random number under a uniform distribution
NormalRandom<double>* _normal_random;
// Internal model for linear interlopolation
Interpolate2D _interpolate2D_model;
};
}
#endif