WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
GroundStationSensor.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.
******************************************************************************/
/*
Camera sensor model header file

Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"displayname" : "Ground Station Sensor",
          "exclude" : False,
          "category" : "Sensors"
}
aliases = {"range_bias" : "Range Bias",
           "range_rate_bias" : "Range Rate Bias",
           "range_gaussian_noise" : "Range Noise",
           "range_rate_gaussian_noise" : "Range Rate Noise",
           "rate_sec" : "Rate Sec",
           "seed_value" : "EXCLUDE",
           "time_in" : "Time",
           "range_in" : "Exact Range",
           "range_rate_in" : "Exact Range Rate",
           "time_measured" : "Time Stamp",
           "range_measured" : "Meas. Range",
           "range_rate_measured" : "Meas. Range Rate",
}
*/

#ifndef MODELS_SENSORS_SIMPLE_CAMERA_SENSOR_H
#define MODELS_SENSORS_SIMPLE_CAMERA_SENSOR_H

#include "simulation/Model.h"
#include "models/support/BiasNoiseModel.h"
#include "monitors/RateMonitor.h"

namespace warptwin {
    /**
     * @brief Wrapper for ground station model which perturbs range and range rate for navigation purposes
     * 
     * The ground station sensor model is a wrapper around the 
     * ground station model which perturbs the range and range
     * rate measurements according to the inputs to this model.
     * 
     * This model also downselects rate according to the input
     * to this model.
     * 
     * Author: Alex Reynolds <alex.reynolds@attx.tech>
    */
    class GroundStationSensor : public Model {
    public:
        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
            /** The bias in the range measurement output described as a single scalar
             *   Default is no bias. */
            SIGNAL(range_bias,              double,                 0.0)
            /** The bias in the range rate measurement output described as a single scalar
             *   Default is no bias. */
            SIGNAL(range_rate_bias,         double,                 0.0)
            /** The one-sigma gaussian noise in range measurement output described as a scalar
             *  Default is no noise. */
            SIGNAL(range_gaussian_noise,    double,                 0.0)
            /** The one-sigma gaussian noise in range rate measurement output described as a scalar
             *  Default is no noise. */
            SIGNAL(range_rate_gaussian_noise,double,                0.0)
            /** The rate at which the GS generates an output, in seconds. Setting this value
             *  to 0 forces the GS to output at the simulation rate. */
            SIGNAL(rate_sec,                clockwerk::Time,        clockwerk::Time(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
            /** This is the output time from the model. Will be left stale when not updated*/
            SIGNAL(time_in,                 clockwerk::Time,        clockwerk::Time(0))
            /** This is the input range from the ground station model*/
            SIGNAL(range_in,                double,                 0.0)
            /** This is the input range rate from the ground station model*/
            SIGNAL(range_rate_in,           double,                 0.0)
        END_INPUTS

        // Model outputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_OUTPUTS
            /** This is the time output every time a measurement is made. Left stale
             *  when ground station is masked or due to measurement rate*/
            SIGNAL(time_measured,           clockwerk::Time,        clockwerk::Time(0))
            /** This is the range output every time a measurement is made. Left stale
             *  when ground station is masked or due to measurement rate. Includes bias
             *  and noise */
            SIGNAL(range_measured,          double,                 0.0)
            /** This is the range rate output every time a measurement is made. Left stale
             *  when ground station is masked or due to measurement rate. Includes bias
             *  and noise */
            SIGNAL(range_rate_measured,     double,                 0.0)
        END_OUTPUTS

        /// @brief Accessor for the internal bias and noise model
        /// @return Pointer to the bias noise model
        warptwin::BiasNoiseModel* biasNoiseModel() {return &_sensor_bias_noise;}

        /// @brief Accessor for the internal rate monitor model
        /// @return Pointer to the rate monitor model
        warptwin::RateMonitor* rateMonitor() {return &_rate_monitor;}

        // Model-specific implementations of startup and derivative
        GroundStationSensor(Model &pnt, const std::string &m_name="ground_station_sensor");
        GroundStationSensor(SimulationExecutive &e, const std::string &m_name="ground_station_sensor");
        GroundStationSensor(Model &pnt, int schedule_slot, const std::string &m_name="ground_station_sensor");
        GroundStationSensor(SimulationExecutive &e, int schedule_slot, const std::string &m_name="ground_station_sensor");
        virtual ~GroundStationSensor() {} 
    protected:
        int16 start() override;
        int16 execute() override;

        /// @brief Function to configure sensor -- runs in all constructors
        void _configureInternal();

        /// @brief The bias and noise model for sensor output.
        BiasNoiseModel _sensor_bias_noise;

        /// @brief Rate monitor to control the rate at which the sensor runs
        RateMonitor _rate_monitor;
    };

}

#endif