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

Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/

#ifndef MONITORS_TIME_TRIGGER_MONITOR_H
#define MONITORS_TIME_TRIGGER_MONITOR_H

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

namespace warptwin {

    /// @brief  Monitor to trigger at a particular rate

    /// The rate monitor is a simple implementation of the monitor
    /// that triggers at a set rate. The rate is set upon construction,
    /// but may be changed during run via function.

    /// If the simulation run rate is less than the monitor rate, 
    /// the monitor will simply trigger every step
    MODEL(TimeTriggerMonitor)
    public:

        /// Our input trigger time for calculation
        START_PARAMS
            /// This is the variable indicating when the monitor should trigger
            SIGNAL(trigger_time,    clockwerk::Time,    clockwerk::Time(UINT32_MAX, 0))
        END_PARAMS

        /// Our input trigger time for calculation
        START_INPUTS
            /// This is the current time in the simulation
            SIGNAL(current_time, clockwerk::Time, clockwerk::Time(0,0))
        END_INPUTS

        START_OUTPUTS
            ///  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:
        /// @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