ModelSpace
Documentation for ModelSpace models and classes.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
/******************************************************************************
* Copyright (c) ATTX LLC 2024. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the 
* proprietary and confidential information of ATTX, LLC. 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, LLC.
******************************************************************************/
/*
Effective Solar Area model header file
Author: Alex Jackson
*/
/*
Metadata for MS GUI:
imdata = {"displayname" : "Effective Solar Area",
          "exclude" : False,
          "category" : "Power"
}
aliases = {"pos_sc_sun__sun" : "Sun Rel. Position",
           "face_normal_vector__body" : "Panel Body Normal",
           "area" : "Surface Area",
           "quat_body_solar" : "Attitude Body/Solar",
           "eff_solar_area" : "Effective Area"
}
*/

#ifndef MODELS_SUPPORT_EFFECTIVE_SOLAR_AREA_H
#define MODELS_SUPPORT_EFFECTIVE_SOLAR_AREA_H

#include "simulation/Model.h"
#include "core/CartesianVector.hpp"
#include "dynamics/Quaternion.h"

namespace modelspace {

    /**
     * @brief   Effective Solar Area model
     * 
     * This model defines simple solar area of a flat surface. This is computed by
     * taking the dot product of the normal vector of the surface and the solar vector. 
     * This value is expected to be negative if the panel is illuminated. If the value is 
     * positive, then the value is set to zero. If the value is negative, then the value is
     * negated to become positive. This value is then multiplied by the area of the surface.
     * 
     * Author: Alex Jackson
     * Email: alex.jackson@attx.tech 
    */
    MODEL(EffectiveSolarAreaModel)
    public:

        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
        END_PARAMS

        // Model inputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_INPUTS
            /** The solar vector in the solar frame (Sun to spacecraft)*/
            SIGNAL(pos_sc_sun__sun,          CartesianVector3,        CartesianVector3({0.0, 0.0, 0.0}))
            /** The normal vector pointing out of the surface in the body frame*/
            SIGNAL(face_normal_vector__body, CartesianVector3,        CartesianVector3({0.0, 0.0, 0.0}))
            /** The area of the surface */
            SIGNAL(area,                     double,                   1.0)
            /** The quaternion relating the body frame to the solar frame */
            SIGNAL(quat_body_solar,          clockwerk::Quaternion,    clockwerk::Quaternion({1.0, 0.0, 0.0, 0.0}))
        END_INPUTS

        // Model outputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_OUTPUTS
            /** The effective solar area */
            SIGNAL(eff_solar_area,          double,                 0.0)
        END_OUTPUTS

    protected:
        int16 execute() override; 

        /// @brief Temp variable to hold normalized vector on body
        CartesianVector3 _face_normal_vector__body;

        /// @brief Temporary variable to hold the vector that is normal to the surface after converting to the solar frame
        CartesianVector3 _face_normal_vector__sun;

        /// @brief Temporary variable to hold the result of the dot product between the normal vector and solar vector
        double _dot_product_normal_solar;
    };

}

#endif