ModelSpace
Documentation for ModelSpace models and classes.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
/******************************************************************************
* 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.
******************************************************************************/
/*
Composite wind model header file

Author: James Tabony
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/

#ifndef MODELS_ENVIRONMENT_COMPOSITE_WIND_MODEL_H 
#define MODELS_ENVIRONMENT_COMPOSITE_WIND_MODEL_H

#include "simulation/Model.h"

namespace modelspace {

    /**
     * @brief   Composite wind model
     * 
     * This model takes in the three major components to a high fidelity wind model:
     * 1). Mean wind: the average steady-state wind velocity vector
     * 2). Gust wind: the stochastic and time dependent busts of intense wind
     * 3). Disturbance wind: the stochastic and time dependent random fluctuations in the wind
     * 
     * The model takes the three components and their respective frames and outputs the
     * composite wind (sum of all components) in the desired output frame.
     * 
     * Author: James Tabony <james.tabony@attx.tech>
    */
    MODEL(CompositeWindModel)
    public:
        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
            /** The frame of the mean wind input vector. */
            SIGNAL(mean_wind_frame,         Frame*,                nullptr)
            /** The frame of the gust wind input vector. */
            SIGNAL(gust_wind_frame,         Frame*,                nullptr)
            /** The frame of the disturbance wind input vector. If left as nullptr, 
             *  the model assumes the disturbance frame is the direct mean wind frame:
             *   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. */
            SIGNAL(dist_wind_frame,         Frame*,                nullptr)
            /** The frame of the composite wind output vector. */
            SIGNAL(comp_wind_frame,         Frame*,                nullptr)
        END_PARAMS

        // Model inputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_INPUTS
            /** Mean wind vector expressed in the frame specified by the params. 
             *  Velocity must be relative to a planet rotating frame. (meters/second) */
            SIGNAL(mean_wind_vec,           CartesianVector3,      CartesianVector3({0.0, 0.0, 0.0}))
            /** Gust wind vector expressed in the frame specified by the params. 
             *  Velocity must be relative to a planet rotating frame. (meters/second) */
            SIGNAL(gust_wind_vec,           CartesianVector3,      CartesianVector3({0.0, 0.0, 0.0}))
            /** Disturbance wind vector expressed in the frame specified by the params. 
             *  Velocity must be relative to a planet rotating frame. (meters/second) */
            SIGNAL(dist_wind_vec,           CartesianVector3,      CartesianVector3({0.0, 0.0, 0.0}))
        END_INPUTS

        // Model outputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_OUTPUTS
            /** The composite wind vector expressed in the frame specifiec by the params. 
             *  The velocity is expressed relative to the planet rotating frame. (meters/second)*/
            SIGNAL(comp_wind_vec,           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 rotated vectors
        CartesianVector3 _mean_wind__comp;
        CartesianVector3 _dist_wind__comp;
        CartesianVector3 _gust_wind__comp;

        /// Internal variable for the rotation from the direct mean wind frame to the mean wind vector representation frame
        clockwerk::DCM _DCM_directMeanWindFrame_to_meanWindFrame;

        /// Internal variable for the mean wind frame rotation angle
        double _mean_wind_rot_angle;
    };

}

#endif