WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
ProximityMonitor.h
/******************************************************************************
* 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.
******************************************************************************/
/*
Proximity Monitor header file

Author: Sam Matez
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/

#ifndef MONITORS_PROXIMITY_MONITOR_H
#define MONITORS_PROXIMITY_MONITOR_H

#include "core/CartesianVector.hpp"
#include "architecture/Time.h"
#include "core/clockwerkerrors.h"
#include "simulation/SimulationSteps.h"
#include "simulation/Model.h"

namespace warptwin {

    /// The time trigger monitor is a simple implementation of the monitor
    /// that triggers continuously after a set time. The time is set upon 
    /// construction, but may be changed during run via function.
    MODEL(ProximityMonitor)
    public:
        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
            /**  This is the variable at what difference between deputy and chief the monitor should trigger */
            SIGNAL(trigger_range,           double,                 1000.0)
        END_PARAMS

        // Model inputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_INPUTS
            /** Take chief position (position 1)*/
            SIGNAL(chief_position,          CartesianVector3,      CartesianVector3({0.0, 0.0, 0.0}))
            /** Take deputy position (position 2) */
            SIGNAL(deputy_position,         CartesianVector3,      CartesianVector3({0.0, 0.0, 0.0}))
        END_INPUTS

        START_OUTPUTS
            /** The range between the chief and deputy */
            SIGNAL(range,                   double,                 0.0)
            ///  Our trigger -- this is the flag set and unset by the monitor as
            ///  its ultimate output, and should be used downstream by events, etc.
            SIGNAL(trigger,         bool,               false)
        END_OUTPUTS

    protected:
        double _range; // stores calculated range
        CartesianVector3 _rel_position; // stores relative position vector

        /// @brief   Function to check our current (base) time against
        ///          our rate conditions
        /// @return  Error code corresponding to success/failure
        /// @note    Will NOT run if trigger and persistence are true
        int16 execute() override;
    };

}

#endif