init
This commit is contained in:
@@ -0,0 +1,460 @@
|
||||
/*
|
||||
* File: SIL_capi.c
|
||||
*
|
||||
* Code generated for Simulink model 'SIL'.
|
||||
*
|
||||
* Model version : 1.150
|
||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||
* C/C++ source code generated on : Wed Sep 30 08:44:27 2020
|
||||
*
|
||||
* Target selection: ert_shrlib.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives: Unspecified
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "rtw_capi.h"
|
||||
#ifdef HOST_CAPI_BUILD
|
||||
#include "SIL_capi_host.h"
|
||||
#define sizeof(s) ((size_t)(0xFFFF))
|
||||
#undef rt_offsetof
|
||||
#define rt_offsetof(s,el) ((uint16_T)(0xFFFF))
|
||||
#define TARGET_CONST
|
||||
#define TARGET_STRING(s) (s)
|
||||
#else /* HOST_CAPI_BUILD */
|
||||
#include "builtin_typeid_types.h"
|
||||
#include "SIL.h"
|
||||
#include "SIL_capi.h"
|
||||
#include "SIL_private.h"
|
||||
#ifdef LIGHT_WEIGHT_CAPI
|
||||
#define TARGET_CONST
|
||||
#define TARGET_STRING(s) (NULL)
|
||||
#else
|
||||
#define TARGET_CONST const
|
||||
#define TARGET_STRING(s) (s)
|
||||
#endif
|
||||
#endif /* HOST_CAPI_BUILD */
|
||||
|
||||
/* Individual block tuning is not valid when inline parameters is *
|
||||
* selected. An empty map is produced to provide a consistent *
|
||||
* interface independent of inlining parameters. *
|
||||
*/
|
||||
static const rtwCAPI_BlockParameters rtBlockParameters[] = {
|
||||
/* addrMapIndex, blockPath,
|
||||
* paramName, dataTypeIndex, dimIndex, fixPtIdx
|
||||
*/
|
||||
{
|
||||
0, (NULL), (NULL), 0, 0, 0
|
||||
}
|
||||
};
|
||||
|
||||
/* Tunable variable parameters */
|
||||
static const rtwCAPI_ModelParameters rtModelParameters[] = {
|
||||
/* addrMapIndex, varName, dataTypeIndex, dimIndex, fixPtIndex */
|
||||
{ 0, TARGET_STRING("AccelBias"), 0, 0, 0 },
|
||||
|
||||
{ 1, TARGET_STRING("AccelScaleMatrix"), 0, 1, 0 },
|
||||
|
||||
{ 2, TARGET_STRING("GyroBias"), 0, 0, 0 },
|
||||
|
||||
{ 3, TARGET_STRING("GyroGBias"), 0, 0, 0 },
|
||||
|
||||
{ 4, TARGET_STRING("GyroScaleMatrix"), 0, 1, 0 },
|
||||
|
||||
{ 5, TARGET_STRING("IMUloc"), 0, 0, 0 },
|
||||
|
||||
{ 6, TARGET_STRING("hground"), 0, 2, 0 },
|
||||
|
||||
{ 7, TARGET_STRING("CLa"), 1, 2, 0 },
|
||||
|
||||
{ 8, TARGET_STRING("Clda"), 1, 2, 0 },
|
||||
|
||||
{ 9, TARGET_STRING("Clp"), 1, 2, 0 },
|
||||
|
||||
{ 10, TARGET_STRING("Cmde"), 1, 2, 0 },
|
||||
|
||||
{ 11, TARGET_STRING("Cmq"), 1, 2, 0 },
|
||||
|
||||
{ 12, TARGET_STRING("Ixx"), 1, 2, 0 },
|
||||
|
||||
{ 13, TARGET_STRING("Iyy"), 1, 2, 0 },
|
||||
|
||||
{ 14, TARGET_STRING("RefArea"), 1, 2, 0 },
|
||||
|
||||
{ 15, TARGET_STRING("RefLen"), 1, 2, 0 },
|
||||
|
||||
{ 16, TARGET_STRING("RefSpan"), 1, 2, 0 },
|
||||
|
||||
{ 17, TARGET_STRING("ksi_v2tht"), 1, 2, 0 },
|
||||
|
||||
{ 18, TARGET_STRING("m"), 1, 2, 0 },
|
||||
|
||||
{ 19, TARGET_STRING("max_as"), 1, 2, 0 },
|
||||
|
||||
{ 20, TARGET_STRING("max_az"), 1, 2, 0 },
|
||||
|
||||
{ 21, TARGET_STRING("max_hdot"), 1, 2, 0 },
|
||||
|
||||
{ 22, TARGET_STRING("max_p"), 1, 2, 0 },
|
||||
|
||||
{ 23, TARGET_STRING("max_q"), 1, 2, 0 },
|
||||
|
||||
{ 24, TARGET_STRING("max_tht"), 1, 2, 0 },
|
||||
|
||||
{ 25, TARGET_STRING("min_hdot"), 1, 2, 0 },
|
||||
|
||||
{ 26, TARGET_STRING("min_tht"), 1, 2, 0 },
|
||||
|
||||
{ 27, TARGET_STRING("w_as"), 1, 2, 0 },
|
||||
|
||||
{ 28, TARGET_STRING("w_ay"), 1, 2, 0 },
|
||||
|
||||
{ 29, TARGET_STRING("w_v"), 1, 2, 0 },
|
||||
|
||||
{ 30, TARGET_STRING("w_v2tht"), 1, 2, 0 },
|
||||
|
||||
{ 31, TARGET_STRING("w_x"), 1, 2, 0 },
|
||||
|
||||
{ 32, TARGET_STRING("w_y"), 1, 2, 0 },
|
||||
|
||||
{ 33, TARGET_STRING("CD0UncertPct"), 0, 2, 0 },
|
||||
|
||||
{ 34, TARGET_STRING("CG_bias_m"), 0, 0, 0 },
|
||||
|
||||
{ 35, TARGET_STRING("CL0UncertVal"), 0, 2, 0 },
|
||||
|
||||
{ 36, TARGET_STRING("CLaUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 37, TARGET_STRING("CLdeUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 38, TARGET_STRING("CLqUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 39, TARGET_STRING("Cc0UncertVal"), 0, 2, 0 },
|
||||
|
||||
{ 40, TARGET_STRING("CcbUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 41, TARGET_STRING("CcdrUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 42, TARGET_STRING("CcrUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 43, TARGET_STRING("Cl0UncertVal"), 0, 2, 0 },
|
||||
|
||||
{ 44, TARGET_STRING("ClbUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 45, TARGET_STRING("CldaUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 46, TARGET_STRING("ClpUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 47, TARGET_STRING("Cm0UncertVal"), 0, 2, 0 },
|
||||
|
||||
{ 48, TARGET_STRING("CmaUncertPct"), 0, 2, 0 },
|
||||
|
||||
{ 49, TARGET_STRING("CmdeUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 50, TARGET_STRING("CmqUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 51, TARGET_STRING("Cn0UncertVal"), 0, 2, 0 },
|
||||
|
||||
{ 52, TARGET_STRING("CnbUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 53, TARGET_STRING("CndrUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 54, TARGET_STRING("CnrUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 55, TARGET_STRING("InertiaMoments_bias_kg_m2"), 0, 1, 0 },
|
||||
|
||||
{ 56, TARGET_STRING("ThrustUncertGain"), 0, 2, 0 },
|
||||
|
||||
{ 57, TARGET_STRING("engine_att_rad"), 0, 0, 0 },
|
||||
|
||||
{ 58, TARGET_STRING("engine_pos_m"), 0, 0, 0 },
|
||||
|
||||
{ 59, TARGET_STRING("actuator_k"), 1, 3, 0 },
|
||||
|
||||
{ 60, TARGET_STRING("ias_qc"), 1, 2, 0 },
|
||||
|
||||
{ 61, TARGET_STRING("max_da"), 1, 2, 0 },
|
||||
|
||||
{ 62, TARGET_STRING("max_de"), 1, 2, 0 },
|
||||
|
||||
{ 63, TARGET_STRING("max_dr"), 1, 2, 0 },
|
||||
|
||||
{ 64, TARGET_STRING("max_thr"), 1, 2, 0 },
|
||||
|
||||
{ 65, TARGET_STRING("rot2pwm_0"), 1, 2, 0 },
|
||||
|
||||
{ 66, TARGET_STRING("rot2pwm_1"), 1, 2, 0 },
|
||||
|
||||
{ 67, TARGET_STRING("rot2pwm_2"), 1, 2, 0 },
|
||||
|
||||
{ 68, TARGET_STRING("actuator_hi"), 2, 3, 0 },
|
||||
|
||||
{ 69, TARGET_STRING("actuator_lo"), 2, 3, 0 },
|
||||
|
||||
{ 70, TARGET_STRING("actuator_trim"), 2, 3, 0 },
|
||||
|
||||
{ 71, TARGET_STRING("map_pwm"), 3, 4, 0 },
|
||||
|
||||
{ 0, (NULL), 0, 0, 0 }
|
||||
};
|
||||
|
||||
#ifndef HOST_CAPI_BUILD
|
||||
|
||||
/* Declare Data Addresses statically */
|
||||
static void* rtDataAddrMap[] = {
|
||||
&SIL_P.AccelBias[0], /* 0: Model Parameter */
|
||||
&SIL_P.AccelScaleMatrix[0], /* 1: Model Parameter */
|
||||
&SIL_P.GyroBias[0], /* 2: Model Parameter */
|
||||
&SIL_P.GyroGBias[0], /* 3: Model Parameter */
|
||||
&SIL_P.GyroScaleMatrix[0], /* 4: Model Parameter */
|
||||
&SIL_P.IMUloc[0], /* 5: Model Parameter */
|
||||
&SIL_P.hground, /* 6: Model Parameter */
|
||||
&SIL_P.CLa, /* 7: Model Parameter */
|
||||
&SIL_P.Clda, /* 8: Model Parameter */
|
||||
&SIL_P.Clp, /* 9: Model Parameter */
|
||||
&SIL_P.Cmde, /* 10: Model Parameter */
|
||||
&SIL_P.Cmq, /* 11: Model Parameter */
|
||||
&SIL_P.Ixx, /* 12: Model Parameter */
|
||||
&SIL_P.Iyy, /* 13: Model Parameter */
|
||||
&SIL_P.RefArea, /* 14: Model Parameter */
|
||||
&SIL_P.RefLen, /* 15: Model Parameter */
|
||||
&SIL_P.RefSpan, /* 16: Model Parameter */
|
||||
&SIL_P.ksi_v2tht, /* 17: Model Parameter */
|
||||
&SIL_P.m, /* 18: Model Parameter */
|
||||
&SIL_P.max_as, /* 19: Model Parameter */
|
||||
&SIL_P.max_az, /* 20: Model Parameter */
|
||||
&SIL_P.max_hdot, /* 21: Model Parameter */
|
||||
&SIL_P.max_p, /* 22: Model Parameter */
|
||||
&SIL_P.max_q, /* 23: Model Parameter */
|
||||
&SIL_P.max_tht, /* 24: Model Parameter */
|
||||
&SIL_P.min_hdot, /* 25: Model Parameter */
|
||||
&SIL_P.min_tht, /* 26: Model Parameter */
|
||||
&SIL_P.w_as, /* 27: Model Parameter */
|
||||
&SIL_P.w_ay, /* 28: Model Parameter */
|
||||
&SIL_P.w_v, /* 29: Model Parameter */
|
||||
&SIL_P.w_v2tht, /* 30: Model Parameter */
|
||||
&SIL_P.w_x, /* 31: Model Parameter */
|
||||
&SIL_P.w_y, /* 32: Model Parameter */
|
||||
&CD0UncertPct, /* 33: Model Parameter */
|
||||
CG_bias_m, /* 34: Model Parameter */
|
||||
&CL0UncertVal, /* 35: Model Parameter */
|
||||
&CLaUncertGain, /* 36: Model Parameter */
|
||||
&CLdeUncertGain, /* 37: Model Parameter */
|
||||
&CLqUncertGain, /* 38: Model Parameter */
|
||||
&Cc0UncertVal, /* 39: Model Parameter */
|
||||
&CcbUncertGain, /* 40: Model Parameter */
|
||||
&CcdrUncertGain, /* 41: Model Parameter */
|
||||
&CcrUncertGain, /* 42: Model Parameter */
|
||||
&Cl0UncertVal, /* 43: Model Parameter */
|
||||
&ClbUncertGain, /* 44: Model Parameter */
|
||||
&CldaUncertGain, /* 45: Model Parameter */
|
||||
&ClpUncertGain, /* 46: Model Parameter */
|
||||
&Cm0UncertVal, /* 47: Model Parameter */
|
||||
&CmaUncertPct, /* 48: Model Parameter */
|
||||
&CmdeUncertGain, /* 49: Model Parameter */
|
||||
&CmqUncertGain, /* 50: Model Parameter */
|
||||
&Cn0UncertVal, /* 51: Model Parameter */
|
||||
&CnbUncertGain, /* 52: Model Parameter */
|
||||
&CndrUncertGain, /* 53: Model Parameter */
|
||||
&CnrUncertGain, /* 54: Model Parameter */
|
||||
InertiaMoments_bias_kg_m2, /* 55: Model Parameter */
|
||||
&ThrustUncertGain, /* 56: Model Parameter */
|
||||
engine_att_rad, /* 57: Model Parameter */
|
||||
engine_pos_m, /* 58: Model Parameter */
|
||||
actuator_k, /* 59: Model Parameter */
|
||||
&ias_qc, /* 60: Model Parameter */
|
||||
&max_da, /* 61: Model Parameter */
|
||||
&max_de, /* 62: Model Parameter */
|
||||
&max_dr, /* 63: Model Parameter */
|
||||
&max_thr, /* 64: Model Parameter */
|
||||
&rot2pwm_0, /* 65: Model Parameter */
|
||||
&rot2pwm_1, /* 66: Model Parameter */
|
||||
&rot2pwm_2, /* 67: Model Parameter */
|
||||
actuator_hi, /* 68: Model Parameter */
|
||||
actuator_lo, /* 69: Model Parameter */
|
||||
actuator_trim, /* 70: Model Parameter */
|
||||
map_pwm, /* 71: Model Parameter */
|
||||
};
|
||||
|
||||
/* Declare Data Run-Time Dimension Buffer Addresses statically */
|
||||
static int32_T* rtVarDimsAddrMap[] = {
|
||||
(NULL)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* Data Type Map - use dataTypeMapIndex to access this structure */
|
||||
static TARGET_CONST rtwCAPI_DataTypeMap rtDataTypeMap[] = {
|
||||
/* cName, mwName, numElements, elemMapIndex, dataSize, slDataId, *
|
||||
* isComplex, isPointer */
|
||||
{ "double", "real_T", 0, 0, sizeof(real_T), SS_DOUBLE, 0, 0 },
|
||||
|
||||
{ "float", "real32_T", 0, 0, sizeof(real32_T), SS_SINGLE, 0, 0 },
|
||||
|
||||
{ "unsigned short", "uint16_T", 0, 0, sizeof(uint16_T), SS_UINT16, 0, 0 },
|
||||
|
||||
{ "unsigned char", "uint8_T", 0, 0, sizeof(uint8_T), SS_UINT8, 0, 0 }
|
||||
};
|
||||
|
||||
#ifdef HOST_CAPI_BUILD
|
||||
#undef sizeof
|
||||
#endif
|
||||
|
||||
/* Structure Element Map - use elemMapIndex to access this structure */
|
||||
static TARGET_CONST rtwCAPI_ElementMap rtElementMap[] = {
|
||||
/* elementName, elementOffset, dataTypeIndex, dimIndex, fxpIndex */
|
||||
{ (NULL), 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
/* Dimension Map - use dimensionMapIndex to access elements of ths structure*/
|
||||
static const rtwCAPI_DimensionMap rtDimensionMap[] = {
|
||||
/* dataOrientation, dimArrayIndex, numDims, vardimsIndex */
|
||||
{ rtwCAPI_VECTOR, 0, 2, 0 },
|
||||
|
||||
{ rtwCAPI_MATRIX_COL_MAJOR, 2, 2, 0 },
|
||||
|
||||
{ rtwCAPI_SCALAR, 4, 2, 0 },
|
||||
|
||||
{ rtwCAPI_VECTOR, 6, 2, 0 },
|
||||
|
||||
{ rtwCAPI_VECTOR, 8, 2, 0 }
|
||||
};
|
||||
|
||||
/* Dimension Array- use dimArrayIndex to access elements of this array */
|
||||
static const uint_T rtDimensionArray[] = {
|
||||
1, /* 0 */
|
||||
3, /* 1 */
|
||||
3, /* 2 */
|
||||
3, /* 3 */
|
||||
1, /* 4 */
|
||||
1, /* 5 */
|
||||
1, /* 6 */
|
||||
4, /* 7 */
|
||||
1, /* 8 */
|
||||
5 /* 9 */
|
||||
};
|
||||
|
||||
/* Fixed Point Map */
|
||||
static const rtwCAPI_FixPtMap rtFixPtMap[] = {
|
||||
/* fracSlopePtr, biasPtr, scaleType, wordLength, exponent, isSigned */
|
||||
{ (NULL), (NULL), rtwCAPI_FIX_RESERVED, 0, 0, 0 },
|
||||
};
|
||||
|
||||
/* Sample Time Map - use sTimeIndex to access elements of ths structure */
|
||||
static const rtwCAPI_SampleTimeMap rtSampleTimeMap[] = {
|
||||
/* samplePeriodPtr, sampleOffsetPtr, tid, samplingMode */
|
||||
{
|
||||
(NULL), (NULL), 0, 0
|
||||
}
|
||||
};
|
||||
|
||||
static rtwCAPI_ModelMappingStaticInfo mmiStatic = {
|
||||
/* Signals:{signals, numSignals,
|
||||
* rootInputs, numRootInputs,
|
||||
* rootOutputs, numRootOutputs},
|
||||
* Params: {blockParameters, numBlockParameters,
|
||||
* modelParameters, numModelParameters},
|
||||
* States: {states, numStates},
|
||||
* Maps: {dataTypeMap, dimensionMap, fixPtMap,
|
||||
* elementMap, sampleTimeMap, dimensionArray},
|
||||
* TargetType: targetType
|
||||
*/
|
||||
{ (NULL), 0,
|
||||
(NULL), 0,
|
||||
(NULL), 0 },
|
||||
|
||||
{ rtBlockParameters, 0,
|
||||
rtModelParameters, 72 },
|
||||
|
||||
{ (NULL), 0 },
|
||||
|
||||
{ rtDataTypeMap, rtDimensionMap, rtFixPtMap,
|
||||
rtElementMap, rtSampleTimeMap, rtDimensionArray },
|
||||
"float",
|
||||
|
||||
{ 2012445173U,
|
||||
4005592062U,
|
||||
1822150728U,
|
||||
3775601177U },
|
||||
(NULL), 0,
|
||||
0
|
||||
};
|
||||
|
||||
/* Function to get C API Model Mapping Static Info */
|
||||
const rtwCAPI_ModelMappingStaticInfo*
|
||||
SIL_GetCAPIStaticMap(void)
|
||||
{
|
||||
return &mmiStatic;
|
||||
}
|
||||
|
||||
/* Cache pointers into DataMapInfo substructure of RTModel */
|
||||
#ifndef HOST_CAPI_BUILD
|
||||
|
||||
void SIL_InitializeDataMapInfo(void)
|
||||
{
|
||||
/* Set C-API version */
|
||||
rtwCAPI_SetVersion(SIL_M->DataMapInfo.mmi, 1);
|
||||
|
||||
/* Cache static C-API data into the Real-time Model Data structure */
|
||||
rtwCAPI_SetStaticMap(SIL_M->DataMapInfo.mmi, &mmiStatic);
|
||||
|
||||
/* Cache static C-API logging data into the Real-time Model Data structure */
|
||||
rtwCAPI_SetLoggingStaticMap(SIL_M->DataMapInfo.mmi, (NULL));
|
||||
|
||||
/* Cache C-API Data Addresses into the Real-Time Model Data structure */
|
||||
rtwCAPI_SetDataAddressMap(SIL_M->DataMapInfo.mmi, rtDataAddrMap);
|
||||
|
||||
/* Cache C-API Data Run-Time Dimension Buffer Addresses into the Real-Time Model Data structure */
|
||||
rtwCAPI_SetVarDimsAddressMap(SIL_M->DataMapInfo.mmi, rtVarDimsAddrMap);
|
||||
|
||||
/* Cache the instance C-API logging pointer */
|
||||
rtwCAPI_SetInstanceLoggingInfo(SIL_M->DataMapInfo.mmi, (NULL));
|
||||
|
||||
/* Set reference to submodels */
|
||||
rtwCAPI_SetChildMMIArray(SIL_M->DataMapInfo.mmi, (NULL));
|
||||
rtwCAPI_SetChildMMIArrayLen(SIL_M->DataMapInfo.mmi, 0);
|
||||
}
|
||||
|
||||
#else /* HOST_CAPI_BUILD */
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
void SIL_host_InitializeDataMapInfo(SIL_host_DataMapInfo_T *dataMap, const
|
||||
char *path)
|
||||
{
|
||||
/* Set C-API version */
|
||||
rtwCAPI_SetVersion(dataMap->mmi, 1);
|
||||
|
||||
/* Cache static C-API data into the Real-time Model Data structure */
|
||||
rtwCAPI_SetStaticMap(dataMap->mmi, &mmiStatic);
|
||||
|
||||
/* host data address map is NULL */
|
||||
rtwCAPI_SetDataAddressMap(dataMap->mmi, NULL);
|
||||
|
||||
/* host vardims address map is NULL */
|
||||
rtwCAPI_SetVarDimsAddressMap(dataMap->mmi, NULL);
|
||||
|
||||
/* Set Instance specific path */
|
||||
rtwCAPI_SetPath(dataMap->mmi, path);
|
||||
rtwCAPI_SetFullPath(dataMap->mmi, NULL);
|
||||
|
||||
/* Set reference to submodels */
|
||||
rtwCAPI_SetChildMMIArray(dataMap->mmi, (NULL));
|
||||
rtwCAPI_SetChildMMIArrayLen(dataMap->mmi, 0);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif /* HOST_CAPI_BUILD */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
||||
Reference in New Issue
Block a user