WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
PowerLoad.h
/******************************************************************************
* Copyright (c) ATTX INC 2026. 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.
******************************************************************************/
/*
Power Load model header file

Author: Ryan Hughes
*/
/*
Metadata for MS GUI:
imdata = {"displayname" : "Power Load",
          "exclude" : False,
          "category" : "Power"
}
aliases = {"active_power_draw_W" : "Active Power Draw",
           "idle_power_draw_W" : "Idle Power Draw",
           "off_power_draw_W" : "Off Power Draw",
           "mode" : "Current Power Mode",
           "power_draw_W" : "Current Power Draw",
}
*/

#ifndef MODELS_POWER_POWERLOAD_H
#define MODELS_POWER_POWERLOAD_H

#include "simulation/Model.h"

namespace warptwin {

    enum power_load_mode_e {
        OFF = 0,
        IDLE = 1,
        ACTIVE = 2
    };

    /**
     * @brief Model of a power load
     *
     * The power load model is a simple model of a power load meant to represent the power draw of
     * components that are otherwise unmodeled (such as heaters or scientific instruments). The
     * model accounts for power draw in three modes: active, idle, and off (no power draw).
     */
    MODEL(PowerLoad)
    public:
        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
            /** Power draw while in ACTIVE mode, in Watts */
            SIGNAL(active_power_draw_W,     double,                 0.0)
            /** Power draw while in IDLE mode, in Watts */
            SIGNAL(idle_power_draw_W,       double,                 0.0)
            /** Power draw while in OFF mode, in Watts */
            SIGNAL(off_power_draw_W,        double,                 0.0)
        END_PARAMS

        // Model inputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_INPUTS
            /** The current mode of the power load: 0 = off, 1 = idle, 2 = active */
            SIGNAL(mode,                    int,                    0)
        END_INPUTS

        // Model outputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_OUTPUTS
            /** Instantaneous power draw of the power load, in Watts */
            SIGNAL(power_draw_W,            double,                 0.0)
        END_OUTPUTS

        int16 activate() override;
        int16 deactivate() override;

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

#endif