![]() |
ModelSpace
Documentation for ModelSpace models and classes.
|
/******************************************************************************
* 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.
******************************************************************************/
/*
Tabular thrust model header file
Author: Sam Matez
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/
#ifndef MODELS_SUPPORT_TABULAR_THRUST_MODEL_H
#define MODELS_SUPPORT_TABULAR_THRUST_MODEL_H
#include "simulation/Model.h"
#include "utils/Interpolate2D.h"
#include "locations.h"
namespace modelspace {
/**
* @brief Tabular thrust model
* This model reads and returns thrust on the basis of simulation time based
* on a predetermined thrust table provided for specific vehicles.
*
* The model reads from files in the format defined in cpp/test/thrust_text.txt,
* which is a txt format input.
*
* For values below and above the tabulated time range, the model returns a
* thrust value of zero to account for time before launch and after engine cutoff.
*
* Text file must be in the format
* t(s) T(N)
*
* Author: Sam Matez <sam.matez@attx.tech>
*/
MODEL(TabularThrustModel)
public:
// Model params
// NAME TYPE DEFAULT VALUE
START_PARAMS
/** The thrust data file which should be loaded. Default is TBD. */
SIGNAL(thrust_file, std::string, "")
/** The thrust data file which should be loaded. Default is 0N for prelaunch and touchdown purposes. */
SIGNAL(out_of_range_thrust, double, 0.0)
END_PARAMS
// Model inputs
// NAME TYPE DEFAULT VALUE
START_INPUTS
/** The reference time in seconds since sim start */
SIGNAL(time_s, clockwerk::Time, clockwerk::Time())
END_INPUTS
// Model outputs
// NAME TYPE DEFAULT VALUE
START_OUTPUTS
/** The thrust generated by the engine */
SIGNAL(thrust, double, 0.0)
END_OUTPUTS
TabularThrustModel();
protected:
int16 start() override;
int16 execute() override;
// Internal variables for thrust calculations.
std::vector<std::vector<double>> _thrust_table;
Interpolate2D _interp_thrust;
double _min_time_s;
double _max_time_s;
bool _out_of_range;
};
}
#endif