WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
BiasNoiseModel.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.
******************************************************************************/
/*
Bias and noise model header file
 
Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/

#ifndef MODELS_SUPPORT_BIAS_NOISE_MODEL_H
#define MODELS_SUPPORT_BIAS_NOISE_MODEL_H

#include "simulation/Model.h"
#include "simulation/NormalRandom.hpp"

namespace warptwin {

    /**
     * @brief   Bias and noise model
     * 
     * This model perturbs a single output according to a bias and noise value
     * configured at start time. Distribution is gaussian.
     * 
     * @author Alex Reynolds <alex.reynolds@attx.tech>
    */
    MODEL(BiasNoiseModel)
    public:
        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
            /** The bias in the object as a raw, constant error across all draws for the entire simulation */
            SIGNAL(bias,                    double,                 0.0)
            /** The standard deviation of noise in the object as a gaussian random noise */
            SIGNAL(noise_std,               double,                 0.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
            /** The input value to be perturbed by noise and bias */
            SIGNAL(input_val,               double,                 0.0)
        END_INPUTS

        // Model outputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_OUTPUTS
            /** The output value as perturbed by noise and bias */
            SIGNAL(output_val,              double,                 0.0)
        END_OUTPUTS

    protected:
        int16 start() override;
        int16 execute() override; 

        /// @brief RNG to produce our distribution.
        NormalRandom<double> *_rng = nullptr;
    };

}

#endif