diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/CMakeLists.txt b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9218d4ba5e990eb4ba64dc747f825e601fa5e3c6 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/CMakeLists.txt @@ -0,0 +1,105 @@ +###################################################################### +# CMakeLists.txt generated for component run_ADA +# Product type: executable +###################################################################### +cmake_minimum_required(VERSION 3.12) +project(run_ADA) +if(DEFINED ENV{CMAKE_EXPORT_COMPILE_COMMANDS} AND NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS) + set(CMAKE_EXPORT_COMPILE_COMMANDS $ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) +endif() + + +###################################################################### +## Path variables +###################################################################### +get_filename_component(START_DIR .. ABSOLUTE) +set(MATLAB_ROOT C:/Program\ Files/MATLAB/R2023a CACHE PATH "") +if(${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + set(BUILDING_IN_SOURCE_DIR TRUE) + set(BINARY_START_DIR "${START_DIR}") +else() + set(BUILDING_IN_SOURCE_DIR FALSE) + set(BINARY_START_DIR "${CMAKE_BINARY_DIR}") +endif() +if(WIN32 AND NOT MINGW) + set(SYSLIB_PREFIX "lib") +else() + set(SYSLIB_PREFIX "") +endif() + +###################################################################### +## System libraries +###################################################################### +find_library(FOUND_LIBM m NO_SYSTEM_ENVIRONMENT_PATH PATHS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES} + ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) + +###################################################################### +## Target definition and commands +###################################################################### +add_executable(run_ADA ${START_DIR}/run_ADA_grt_rtw/run_ADA.cpp + ${START_DIR}/run_ADA_grt_rtw/run_ADA_data.cpp + ${MATLAB_ROOT}/rtw/c/src/common/rt_cppclass_main.cpp) +set_target_properties(run_ADA PROPERTIES + PREFIX "" + POSITION_INDEPENDENT_CODE ON + RUNTIME_OUTPUT_DIRECTORY "${BINARY_START_DIR}/./$<0:>" + LIBRARY_OUTPUT_DIRECTORY "${BINARY_START_DIR}/./$<0:>" + ARCHIVE_OUTPUT_DIRECTORY "${BINARY_START_DIR}/./$<0:>") +target_compile_features(run_ADA PUBLIC cxx_std_11) +target_compile_definitions(run_ADA PRIVATE -DMODEL=run_ADA + -DNUMST=1 + -DNCSTATES=0 + -DHAVESTDIO + -DRT + -DUSE_RTMODEL + -DCLASSIC_INTERFACE=0 + -DALLOCATIONFCN=0 + -DTID01EQ=0 + -DMAT_FILE=0 + -DONESTEPFCN=1 + -DTERMFCN=1 + -DMULTI_INSTANCE_CODE=1 + -DINTEGER_CODE=0 + -DMT=0) +target_include_directories(run_ADA PRIVATE ${START_DIR} + ${START_DIR}/run_ADA_grt_rtw + ${MATLAB_ROOT}/extern/include + ${MATLAB_ROOT}/simulink/include + ${MATLAB_ROOT}/rtw/c/src + ${MATLAB_ROOT}/rtw/c/src/ext_mode/common) +target_link_libraries(run_ADA PRIVATE $<$<BOOL:${FOUND_LIBM}>:m>) +if(WIN32) + target_link_libraries(run_ADA PRIVATE kernel32 + ws2_32 + mswsock + advapi32) +endif() + +###################################################################### +## Extract debug symbols +###################################################################### +if(APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")) + string(APPEND _dsymutilcmd "$<IF:$<CONFIG:DEBUG,RELWITHDEBINFO>," + "xcrun;dsymutil;$<TARGET_FILE:run_ADA>;--flat," + "true" + >) + add_custom_command(TARGET run_ADA + POST_BUILD + COMMAND "${_dsymutilcmd}" + COMMAND_EXPAND_LISTS + BYPRODUCTS run_ADA.dwarf) +endif() + + +###################################################################### +## Build success message +###################################################################### +add_custom_command(TARGET run_ADA POST_BUILD + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "\\#\\#\\# Created executable: $<TARGET_FILE:run_ADA>") + +###################################################################### +## Call toolchain hook function if defined +###################################################################### +if(COMMAND toolchain_target_hook) + toolchain_target_hook(run_ADA) +endif() diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/buildInfo.mat b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/buildInfo.mat new file mode 100644 index 0000000000000000000000000000000000000000..003c26d1bbf82b717b08edb897e43d006ab0bba0 Binary files /dev/null and b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/buildInfo.mat differ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/multiword_types.h b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/multiword_types.h new file mode 100644 index 0000000000000000000000000000000000000000..7baddd2136789271a7d1e471b8de22807ce8a068 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/multiword_types.h @@ -0,0 +1,1167 @@ +/* + * multiword_types.h + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#ifndef MULTIWORD_TYPES_H +#define MULTIWORD_TYPES_H +#include "rtwtypes.h" + +/* + * MultiWord supporting definitions + */ +typedef long int long_T; + +/* + * MultiWord types + */ +typedef struct { + uint32_T chunks[2]; +} int64m_T; + +typedef struct { + int64m_T re; + int64m_T im; +} cint64m_T; + +typedef struct { + uint32_T chunks[2]; +} uint64m_T; + +typedef struct { + uint64m_T re; + uint64m_T im; +} cuint64m_T; + +typedef struct { + uint32_T chunks[3]; +} int96m_T; + +typedef struct { + int96m_T re; + int96m_T im; +} cint96m_T; + +typedef struct { + uint32_T chunks[3]; +} uint96m_T; + +typedef struct { + uint96m_T re; + uint96m_T im; +} cuint96m_T; + +typedef struct { + uint32_T chunks[4]; +} int128m_T; + +typedef struct { + int128m_T re; + int128m_T im; +} cint128m_T; + +typedef struct { + uint32_T chunks[4]; +} uint128m_T; + +typedef struct { + uint128m_T re; + uint128m_T im; +} cuint128m_T; + +typedef struct { + uint32_T chunks[5]; +} int160m_T; + +typedef struct { + int160m_T re; + int160m_T im; +} cint160m_T; + +typedef struct { + uint32_T chunks[5]; +} uint160m_T; + +typedef struct { + uint160m_T re; + uint160m_T im; +} cuint160m_T; + +typedef struct { + uint32_T chunks[6]; +} int192m_T; + +typedef struct { + int192m_T re; + int192m_T im; +} cint192m_T; + +typedef struct { + uint32_T chunks[6]; +} uint192m_T; + +typedef struct { + uint192m_T re; + uint192m_T im; +} cuint192m_T; + +typedef struct { + uint32_T chunks[7]; +} int224m_T; + +typedef struct { + int224m_T re; + int224m_T im; +} cint224m_T; + +typedef struct { + uint32_T chunks[7]; +} uint224m_T; + +typedef struct { + uint224m_T re; + uint224m_T im; +} cuint224m_T; + +typedef struct { + uint32_T chunks[8]; +} int256m_T; + +typedef struct { + int256m_T re; + int256m_T im; +} cint256m_T; + +typedef struct { + uint32_T chunks[8]; +} uint256m_T; + +typedef struct { + uint256m_T re; + uint256m_T im; +} cuint256m_T; + +typedef struct { + uint32_T chunks[9]; +} int288m_T; + +typedef struct { + int288m_T re; + int288m_T im; +} cint288m_T; + +typedef struct { + uint32_T chunks[9]; +} uint288m_T; + +typedef struct { + uint288m_T re; + uint288m_T im; +} cuint288m_T; + +typedef struct { + uint32_T chunks[10]; +} int320m_T; + +typedef struct { + int320m_T re; + int320m_T im; +} cint320m_T; + +typedef struct { + uint32_T chunks[10]; +} uint320m_T; + +typedef struct { + uint320m_T re; + uint320m_T im; +} cuint320m_T; + +typedef struct { + uint32_T chunks[11]; +} int352m_T; + +typedef struct { + int352m_T re; + int352m_T im; +} cint352m_T; + +typedef struct { + uint32_T chunks[11]; +} uint352m_T; + +typedef struct { + uint352m_T re; + uint352m_T im; +} cuint352m_T; + +typedef struct { + uint32_T chunks[12]; +} int384m_T; + +typedef struct { + int384m_T re; + int384m_T im; +} cint384m_T; + +typedef struct { + uint32_T chunks[12]; +} uint384m_T; + +typedef struct { + uint384m_T re; + uint384m_T im; +} cuint384m_T; + +typedef struct { + uint32_T chunks[13]; +} int416m_T; + +typedef struct { + int416m_T re; + int416m_T im; +} cint416m_T; + +typedef struct { + uint32_T chunks[13]; +} uint416m_T; + +typedef struct { + uint416m_T re; + uint416m_T im; +} cuint416m_T; + +typedef struct { + uint32_T chunks[14]; +} int448m_T; + +typedef struct { + int448m_T re; + int448m_T im; +} cint448m_T; + +typedef struct { + uint32_T chunks[14]; +} uint448m_T; + +typedef struct { + uint448m_T re; + uint448m_T im; +} cuint448m_T; + +typedef struct { + uint32_T chunks[15]; +} int480m_T; + +typedef struct { + int480m_T re; + int480m_T im; +} cint480m_T; + +typedef struct { + uint32_T chunks[15]; +} uint480m_T; + +typedef struct { + uint480m_T re; + uint480m_T im; +} cuint480m_T; + +typedef struct { + uint32_T chunks[16]; +} int512m_T; + +typedef struct { + int512m_T re; + int512m_T im; +} cint512m_T; + +typedef struct { + uint32_T chunks[16]; +} uint512m_T; + +typedef struct { + uint512m_T re; + uint512m_T im; +} cuint512m_T; + +typedef struct { + uint32_T chunks[17]; +} int544m_T; + +typedef struct { + int544m_T re; + int544m_T im; +} cint544m_T; + +typedef struct { + uint32_T chunks[17]; +} uint544m_T; + +typedef struct { + uint544m_T re; + uint544m_T im; +} cuint544m_T; + +typedef struct { + uint32_T chunks[18]; +} int576m_T; + +typedef struct { + int576m_T re; + int576m_T im; +} cint576m_T; + +typedef struct { + uint32_T chunks[18]; +} uint576m_T; + +typedef struct { + uint576m_T re; + uint576m_T im; +} cuint576m_T; + +typedef struct { + uint32_T chunks[19]; +} int608m_T; + +typedef struct { + int608m_T re; + int608m_T im; +} cint608m_T; + +typedef struct { + uint32_T chunks[19]; +} uint608m_T; + +typedef struct { + uint608m_T re; + uint608m_T im; +} cuint608m_T; + +typedef struct { + uint32_T chunks[20]; +} int640m_T; + +typedef struct { + int640m_T re; + int640m_T im; +} cint640m_T; + +typedef struct { + uint32_T chunks[20]; +} uint640m_T; + +typedef struct { + uint640m_T re; + uint640m_T im; +} cuint640m_T; + +typedef struct { + uint32_T chunks[21]; +} int672m_T; + +typedef struct { + int672m_T re; + int672m_T im; +} cint672m_T; + +typedef struct { + uint32_T chunks[21]; +} uint672m_T; + +typedef struct { + uint672m_T re; + uint672m_T im; +} cuint672m_T; + +typedef struct { + uint32_T chunks[22]; +} int704m_T; + +typedef struct { + int704m_T re; + int704m_T im; +} cint704m_T; + +typedef struct { + uint32_T chunks[22]; +} uint704m_T; + +typedef struct { + uint704m_T re; + uint704m_T im; +} cuint704m_T; + +typedef struct { + uint32_T chunks[23]; +} int736m_T; + +typedef struct { + int736m_T re; + int736m_T im; +} cint736m_T; + +typedef struct { + uint32_T chunks[23]; +} uint736m_T; + +typedef struct { + uint736m_T re; + uint736m_T im; +} cuint736m_T; + +typedef struct { + uint32_T chunks[24]; +} int768m_T; + +typedef struct { + int768m_T re; + int768m_T im; +} cint768m_T; + +typedef struct { + uint32_T chunks[24]; +} uint768m_T; + +typedef struct { + uint768m_T re; + uint768m_T im; +} cuint768m_T; + +typedef struct { + uint32_T chunks[25]; +} int800m_T; + +typedef struct { + int800m_T re; + int800m_T im; +} cint800m_T; + +typedef struct { + uint32_T chunks[25]; +} uint800m_T; + +typedef struct { + uint800m_T re; + uint800m_T im; +} cuint800m_T; + +typedef struct { + uint32_T chunks[26]; +} int832m_T; + +typedef struct { + int832m_T re; + int832m_T im; +} cint832m_T; + +typedef struct { + uint32_T chunks[26]; +} uint832m_T; + +typedef struct { + uint832m_T re; + uint832m_T im; +} cuint832m_T; + +typedef struct { + uint32_T chunks[27]; +} int864m_T; + +typedef struct { + int864m_T re; + int864m_T im; +} cint864m_T; + +typedef struct { + uint32_T chunks[27]; +} uint864m_T; + +typedef struct { + uint864m_T re; + uint864m_T im; +} cuint864m_T; + +typedef struct { + uint32_T chunks[28]; +} int896m_T; + +typedef struct { + int896m_T re; + int896m_T im; +} cint896m_T; + +typedef struct { + uint32_T chunks[28]; +} uint896m_T; + +typedef struct { + uint896m_T re; + uint896m_T im; +} cuint896m_T; + +typedef struct { + uint32_T chunks[29]; +} int928m_T; + +typedef struct { + int928m_T re; + int928m_T im; +} cint928m_T; + +typedef struct { + uint32_T chunks[29]; +} uint928m_T; + +typedef struct { + uint928m_T re; + uint928m_T im; +} cuint928m_T; + +typedef struct { + uint32_T chunks[30]; +} int960m_T; + +typedef struct { + int960m_T re; + int960m_T im; +} cint960m_T; + +typedef struct { + uint32_T chunks[30]; +} uint960m_T; + +typedef struct { + uint960m_T re; + uint960m_T im; +} cuint960m_T; + +typedef struct { + uint32_T chunks[31]; +} int992m_T; + +typedef struct { + int992m_T re; + int992m_T im; +} cint992m_T; + +typedef struct { + uint32_T chunks[31]; +} uint992m_T; + +typedef struct { + uint992m_T re; + uint992m_T im; +} cuint992m_T; + +typedef struct { + uint32_T chunks[32]; +} int1024m_T; + +typedef struct { + int1024m_T re; + int1024m_T im; +} cint1024m_T; + +typedef struct { + uint32_T chunks[32]; +} uint1024m_T; + +typedef struct { + uint1024m_T re; + uint1024m_T im; +} cuint1024m_T; + +typedef struct { + uint32_T chunks[33]; +} int1056m_T; + +typedef struct { + int1056m_T re; + int1056m_T im; +} cint1056m_T; + +typedef struct { + uint32_T chunks[33]; +} uint1056m_T; + +typedef struct { + uint1056m_T re; + uint1056m_T im; +} cuint1056m_T; + +typedef struct { + uint32_T chunks[34]; +} int1088m_T; + +typedef struct { + int1088m_T re; + int1088m_T im; +} cint1088m_T; + +typedef struct { + uint32_T chunks[34]; +} uint1088m_T; + +typedef struct { + uint1088m_T re; + uint1088m_T im; +} cuint1088m_T; + +typedef struct { + uint32_T chunks[35]; +} int1120m_T; + +typedef struct { + int1120m_T re; + int1120m_T im; +} cint1120m_T; + +typedef struct { + uint32_T chunks[35]; +} uint1120m_T; + +typedef struct { + uint1120m_T re; + uint1120m_T im; +} cuint1120m_T; + +typedef struct { + uint32_T chunks[36]; +} int1152m_T; + +typedef struct { + int1152m_T re; + int1152m_T im; +} cint1152m_T; + +typedef struct { + uint32_T chunks[36]; +} uint1152m_T; + +typedef struct { + uint1152m_T re; + uint1152m_T im; +} cuint1152m_T; + +typedef struct { + uint32_T chunks[37]; +} int1184m_T; + +typedef struct { + int1184m_T re; + int1184m_T im; +} cint1184m_T; + +typedef struct { + uint32_T chunks[37]; +} uint1184m_T; + +typedef struct { + uint1184m_T re; + uint1184m_T im; +} cuint1184m_T; + +typedef struct { + uint32_T chunks[38]; +} int1216m_T; + +typedef struct { + int1216m_T re; + int1216m_T im; +} cint1216m_T; + +typedef struct { + uint32_T chunks[38]; +} uint1216m_T; + +typedef struct { + uint1216m_T re; + uint1216m_T im; +} cuint1216m_T; + +typedef struct { + uint32_T chunks[39]; +} int1248m_T; + +typedef struct { + int1248m_T re; + int1248m_T im; +} cint1248m_T; + +typedef struct { + uint32_T chunks[39]; +} uint1248m_T; + +typedef struct { + uint1248m_T re; + uint1248m_T im; +} cuint1248m_T; + +typedef struct { + uint32_T chunks[40]; +} int1280m_T; + +typedef struct { + int1280m_T re; + int1280m_T im; +} cint1280m_T; + +typedef struct { + uint32_T chunks[40]; +} uint1280m_T; + +typedef struct { + uint1280m_T re; + uint1280m_T im; +} cuint1280m_T; + +typedef struct { + uint32_T chunks[41]; +} int1312m_T; + +typedef struct { + int1312m_T re; + int1312m_T im; +} cint1312m_T; + +typedef struct { + uint32_T chunks[41]; +} uint1312m_T; + +typedef struct { + uint1312m_T re; + uint1312m_T im; +} cuint1312m_T; + +typedef struct { + uint32_T chunks[42]; +} int1344m_T; + +typedef struct { + int1344m_T re; + int1344m_T im; +} cint1344m_T; + +typedef struct { + uint32_T chunks[42]; +} uint1344m_T; + +typedef struct { + uint1344m_T re; + uint1344m_T im; +} cuint1344m_T; + +typedef struct { + uint32_T chunks[43]; +} int1376m_T; + +typedef struct { + int1376m_T re; + int1376m_T im; +} cint1376m_T; + +typedef struct { + uint32_T chunks[43]; +} uint1376m_T; + +typedef struct { + uint1376m_T re; + uint1376m_T im; +} cuint1376m_T; + +typedef struct { + uint32_T chunks[44]; +} int1408m_T; + +typedef struct { + int1408m_T re; + int1408m_T im; +} cint1408m_T; + +typedef struct { + uint32_T chunks[44]; +} uint1408m_T; + +typedef struct { + uint1408m_T re; + uint1408m_T im; +} cuint1408m_T; + +typedef struct { + uint32_T chunks[45]; +} int1440m_T; + +typedef struct { + int1440m_T re; + int1440m_T im; +} cint1440m_T; + +typedef struct { + uint32_T chunks[45]; +} uint1440m_T; + +typedef struct { + uint1440m_T re; + uint1440m_T im; +} cuint1440m_T; + +typedef struct { + uint32_T chunks[46]; +} int1472m_T; + +typedef struct { + int1472m_T re; + int1472m_T im; +} cint1472m_T; + +typedef struct { + uint32_T chunks[46]; +} uint1472m_T; + +typedef struct { + uint1472m_T re; + uint1472m_T im; +} cuint1472m_T; + +typedef struct { + uint32_T chunks[47]; +} int1504m_T; + +typedef struct { + int1504m_T re; + int1504m_T im; +} cint1504m_T; + +typedef struct { + uint32_T chunks[47]; +} uint1504m_T; + +typedef struct { + uint1504m_T re; + uint1504m_T im; +} cuint1504m_T; + +typedef struct { + uint32_T chunks[48]; +} int1536m_T; + +typedef struct { + int1536m_T re; + int1536m_T im; +} cint1536m_T; + +typedef struct { + uint32_T chunks[48]; +} uint1536m_T; + +typedef struct { + uint1536m_T re; + uint1536m_T im; +} cuint1536m_T; + +typedef struct { + uint32_T chunks[49]; +} int1568m_T; + +typedef struct { + int1568m_T re; + int1568m_T im; +} cint1568m_T; + +typedef struct { + uint32_T chunks[49]; +} uint1568m_T; + +typedef struct { + uint1568m_T re; + uint1568m_T im; +} cuint1568m_T; + +typedef struct { + uint32_T chunks[50]; +} int1600m_T; + +typedef struct { + int1600m_T re; + int1600m_T im; +} cint1600m_T; + +typedef struct { + uint32_T chunks[50]; +} uint1600m_T; + +typedef struct { + uint1600m_T re; + uint1600m_T im; +} cuint1600m_T; + +typedef struct { + uint32_T chunks[51]; +} int1632m_T; + +typedef struct { + int1632m_T re; + int1632m_T im; +} cint1632m_T; + +typedef struct { + uint32_T chunks[51]; +} uint1632m_T; + +typedef struct { + uint1632m_T re; + uint1632m_T im; +} cuint1632m_T; + +typedef struct { + uint32_T chunks[52]; +} int1664m_T; + +typedef struct { + int1664m_T re; + int1664m_T im; +} cint1664m_T; + +typedef struct { + uint32_T chunks[52]; +} uint1664m_T; + +typedef struct { + uint1664m_T re; + uint1664m_T im; +} cuint1664m_T; + +typedef struct { + uint32_T chunks[53]; +} int1696m_T; + +typedef struct { + int1696m_T re; + int1696m_T im; +} cint1696m_T; + +typedef struct { + uint32_T chunks[53]; +} uint1696m_T; + +typedef struct { + uint1696m_T re; + uint1696m_T im; +} cuint1696m_T; + +typedef struct { + uint32_T chunks[54]; +} int1728m_T; + +typedef struct { + int1728m_T re; + int1728m_T im; +} cint1728m_T; + +typedef struct { + uint32_T chunks[54]; +} uint1728m_T; + +typedef struct { + uint1728m_T re; + uint1728m_T im; +} cuint1728m_T; + +typedef struct { + uint32_T chunks[55]; +} int1760m_T; + +typedef struct { + int1760m_T re; + int1760m_T im; +} cint1760m_T; + +typedef struct { + uint32_T chunks[55]; +} uint1760m_T; + +typedef struct { + uint1760m_T re; + uint1760m_T im; +} cuint1760m_T; + +typedef struct { + uint32_T chunks[56]; +} int1792m_T; + +typedef struct { + int1792m_T re; + int1792m_T im; +} cint1792m_T; + +typedef struct { + uint32_T chunks[56]; +} uint1792m_T; + +typedef struct { + uint1792m_T re; + uint1792m_T im; +} cuint1792m_T; + +typedef struct { + uint32_T chunks[57]; +} int1824m_T; + +typedef struct { + int1824m_T re; + int1824m_T im; +} cint1824m_T; + +typedef struct { + uint32_T chunks[57]; +} uint1824m_T; + +typedef struct { + uint1824m_T re; + uint1824m_T im; +} cuint1824m_T; + +typedef struct { + uint32_T chunks[58]; +} int1856m_T; + +typedef struct { + int1856m_T re; + int1856m_T im; +} cint1856m_T; + +typedef struct { + uint32_T chunks[58]; +} uint1856m_T; + +typedef struct { + uint1856m_T re; + uint1856m_T im; +} cuint1856m_T; + +typedef struct { + uint32_T chunks[59]; +} int1888m_T; + +typedef struct { + int1888m_T re; + int1888m_T im; +} cint1888m_T; + +typedef struct { + uint32_T chunks[59]; +} uint1888m_T; + +typedef struct { + uint1888m_T re; + uint1888m_T im; +} cuint1888m_T; + +typedef struct { + uint32_T chunks[60]; +} int1920m_T; + +typedef struct { + int1920m_T re; + int1920m_T im; +} cint1920m_T; + +typedef struct { + uint32_T chunks[60]; +} uint1920m_T; + +typedef struct { + uint1920m_T re; + uint1920m_T im; +} cuint1920m_T; + +typedef struct { + uint32_T chunks[61]; +} int1952m_T; + +typedef struct { + int1952m_T re; + int1952m_T im; +} cint1952m_T; + +typedef struct { + uint32_T chunks[61]; +} uint1952m_T; + +typedef struct { + uint1952m_T re; + uint1952m_T im; +} cuint1952m_T; + +typedef struct { + uint32_T chunks[62]; +} int1984m_T; + +typedef struct { + int1984m_T re; + int1984m_T im; +} cint1984m_T; + +typedef struct { + uint32_T chunks[62]; +} uint1984m_T; + +typedef struct { + uint1984m_T re; + uint1984m_T im; +} cuint1984m_T; + +typedef struct { + uint32_T chunks[63]; +} int2016m_T; + +typedef struct { + int2016m_T re; + int2016m_T im; +} cint2016m_T; + +typedef struct { + uint32_T chunks[63]; +} uint2016m_T; + +typedef struct { + uint2016m_T re; + uint2016m_T im; +} cuint2016m_T; + +typedef struct { + uint32_T chunks[64]; +} int2048m_T; + +typedef struct { + int2048m_T re; + int2048m_T im; +} cint2048m_T; + +typedef struct { + uint32_T chunks[64]; +} uint2048m_T; + +typedef struct { + uint2048m_T re; + uint2048m_T im; +} cuint2048m_T; + +#endif /* MULTIWORD_TYPES_H */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/rtmodel.h b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/rtmodel.h new file mode 100644 index 0000000000000000000000000000000000000000..10431a4cc05bfdeb2e903e965ee8c27a3e01d773 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/rtmodel.h @@ -0,0 +1,39 @@ +/* + * rtmodel.h: + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#ifndef RTW_HEADER_rtmodel_h_ +#define RTW_HEADER_rtmodel_h_ +#include "run_ADA.h" +#define MODEL_CLASSNAME run_ADA +#define MODEL_STEPNAME step +#define GRTINTERFACE 0 + +/* + * ROOT_IO_FORMAT: 0 (Individual arguments) + * ROOT_IO_FORMAT: 1 (Structure reference) + * ROOT_IO_FORMAT: 2 (Part of model data structure) + */ +#define ROOT_IO_FORMAT 2 + +/* Macros generated for backwards compatibility */ +#ifndef rtmGetStopRequested +#define rtmGetStopRequested(rtm) ((void*) 0) +#endif +#endif /* RTW_HEADER_rtmodel_h_ */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/rtwtypes.h b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/rtwtypes.h new file mode 100644 index 0000000000000000000000000000000000000000..1ffac7ee7ff6d6f51c0db2fd7c0b806bc69d2221 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/rtwtypes.h @@ -0,0 +1,41 @@ +/* + * rtwtypes.h + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#ifndef RTWTYPES_H +#define RTWTYPES_H +#include "tmwtypes.h" +#ifndef POINTER_T +#define POINTER_T + +typedef void * pointer_T; + +#endif + +/* Logical type definitions */ +#if (!defined(__cplusplus)) +#ifndef false +#define false (0U) +#endif + +#ifndef true +#define true (1U) +#endif +#endif +#endif /* RTWTYPES_H */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA.cpp b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA.cpp new file mode 100644 index 0000000000000000000000000000000000000000..79e57b2fa2a38fbaef8e7f268607009138e8bc0e --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA.cpp @@ -0,0 +1,347 @@ +/* + * run_ADA.cpp + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#include "run_ADA.h" +#include "rtwtypes.h" +#include <cstring> +#include <cmath> +#include <emmintrin.h> + +/* System initialize for atomic system: '<Root>/run_ADA' */ +void run_ADA::run_ADA_run_ADA_Init(DW_run_ADA_run_ADA_T *localDW) +{ + /* InitializeConditions for Memory: '<S1>/H_memory' */ + localDW->H_memory_PreviousInput[0] = 1.0; + localDW->H_memory_PreviousInput[1] = 0.0; + localDW->H_memory_PreviousInput[2] = 0.0; + + /* InitializeConditions for Memory: '<S1>/F_memory' */ + std::memcpy(&localDW->F_memory_PreviousInput[0], + &run_ADA_ConstP.F_memory_InitialCondition[0], 9U * sizeof(real_T)); + + /* InitializeConditions for Memory: '<S1>/P_memory' */ + std::memcpy(&localDW->P_memory_PreviousInput[0], &run_ADA_ConstP.pooled5[0], + 9U * sizeof(real_T)); + + /* InitializeConditions for Memory: '<S1>/Q_memory' */ + std::memcpy(&localDW->Q_memory_PreviousInput[0], + &run_ADA_ConstP.Q_memory_InitialCondition[0], 9U * sizeof(real_T)); + + /* InitializeConditions for Memory: '<S1>/H_memory1' */ + localDW->H_memory1_PreviousInput = 4000.0; + + /* InitializeConditions for Memory: '<S1>/x_memory' */ + localDW->x_memory_PreviousInput[0] = 0.0; + localDW->x_memory_PreviousInput[1] = 0.0; + localDW->x_memory_PreviousInput[2] = 1.0; +} + +/* Output and update for atomic system: '<Root>/run_ADA' */ +void run_ADA::run_ADA_run_ADA(real_T rtu_Pressure, B_run_ADA_run_ADA_T *localB, + DW_run_ADA_run_ADA_T *localDW) const +{ + __m128d tmp_0; + __m128d tmp_1; + __m128d tmp_2; + real_T rtb_Add[9]; + real_T tmp[9]; + real_T rtb_K[3]; + real_T rtb_MatrixMultiply[3]; + real_T F_memory_PreviousInput; + real_T F_memory_PreviousInput_0; + real_T F_memory_PreviousInput_1; + real_T P_memory_PreviousInput; + real_T P_memory_PreviousInput_0; + real_T rtb_MatrixMultiply_0; + real_T rtb_Product_n; + real_T x_memory_PreviousInput; + int32_T i; + int32_T i_0; + int32_T rtb_Add_tmp; + + /* Product: '<S3>/Matrix Multiply1' incorporates: + * Math: '<S3>/Transpose' + * Memory: '<S1>/F_memory' + * Memory: '<S1>/P_memory' + */ + for (i_0 = 0; i_0 < 3; i_0++) { + rtb_Product_n = localDW->P_memory_PreviousInput[i_0 + 3]; + P_memory_PreviousInput = localDW->P_memory_PreviousInput[i_0]; + P_memory_PreviousInput_0 = localDW->P_memory_PreviousInput[i_0 + 6]; + for (i = 0; i < 3; i++) { + tmp[i_0 + 3 * i] = (localDW->F_memory_PreviousInput[i + 3] * rtb_Product_n + + P_memory_PreviousInput * + localDW->F_memory_PreviousInput[i]) + + localDW->F_memory_PreviousInput[i + 6] * P_memory_PreviousInput_0; + } + } + + /* Product: '<S2>/Matrix Multiply' */ + rtb_Product_n = 0.0; + for (i_0 = 0; i_0 < 3; i_0++) { + /* Sum: '<S3>/Add' incorporates: + * Memory: '<S1>/F_memory' + * Product: '<S3>/Matrix Multiply1' + */ + F_memory_PreviousInput = localDW->F_memory_PreviousInput[i_0 + 3]; + F_memory_PreviousInput_0 = localDW->F_memory_PreviousInput[i_0]; + F_memory_PreviousInput_1 = localDW->F_memory_PreviousInput[i_0 + 6]; + + /* Product: '<S2>/Matrix Multiply' */ + P_memory_PreviousInput = 0.0; + for (i = 0; i < 3; i++) { + /* Sum: '<S3>/Add' incorporates: + * Memory: '<S1>/Q_memory' + * Product: '<S3>/Matrix Multiply1' + */ + rtb_Add_tmp = 3 * i + i_0; + P_memory_PreviousInput_0 = ((tmp[3 * i + 1] * F_memory_PreviousInput + + tmp[3 * i] * F_memory_PreviousInput_0) + tmp[3 * i + 2] * + F_memory_PreviousInput_1) + localDW->Q_memory_PreviousInput[rtb_Add_tmp]; + rtb_Add[rtb_Add_tmp] = P_memory_PreviousInput_0; + + /* Product: '<S2>/Matrix Multiply' incorporates: + * Memory: '<S1>/H_memory' + */ + P_memory_PreviousInput += P_memory_PreviousInput_0 * + localDW->H_memory_PreviousInput[i]; + } + + /* Product: '<S2>/Matrix Multiply' incorporates: + * Memory: '<S1>/H_memory' + */ + rtb_Product_n += localDW->H_memory_PreviousInput[i_0] * + P_memory_PreviousInput; + } + + /* Sum: '<S2>/Add' incorporates: + * Memory: '<S1>/H_memory1' + * Product: '<S2>/Matrix Multiply' + */ + rtb_Product_n += localDW->H_memory1_PreviousInput; + + /* Product: '<S2>/Matrix Multiply1' incorporates: + * Memory: '<S1>/H_memory' + */ + P_memory_PreviousInput = localDW->H_memory_PreviousInput[0] / rtb_Product_n; + P_memory_PreviousInput_0 = localDW->H_memory_PreviousInput[1] / rtb_Product_n; + F_memory_PreviousInput = localDW->H_memory_PreviousInput[2] / rtb_Product_n; + + /* Product: '<S2>/Matrix Multiply4' */ + rtb_Product_n = 0.0; + + /* Memory: '<S1>/x_memory' incorporates: + * Product: '<S3>/Matrix Multiply' + */ + F_memory_PreviousInput_0 = localDW->x_memory_PreviousInput[1]; + F_memory_PreviousInput_1 = localDW->x_memory_PreviousInput[0]; + x_memory_PreviousInput = localDW->x_memory_PreviousInput[2]; + for (i_0 = 0; i_0 < 3; i_0++) { + /* Product: '<S3>/Matrix Multiply' incorporates: + * Memory: '<S1>/F_memory' + * Memory: '<S1>/x_memory' + */ + rtb_MatrixMultiply_0 = (localDW->F_memory_PreviousInput[i_0 + 3] * + F_memory_PreviousInput_0 + localDW->F_memory_PreviousInput[i_0] * + F_memory_PreviousInput_1) + localDW->F_memory_PreviousInput[i_0 + 6] * + x_memory_PreviousInput; + rtb_MatrixMultiply[i_0] = rtb_MatrixMultiply_0; + + /* Product: '<S2>/Matrix Multiply1' incorporates: + * Sum: '<S3>/Add' + */ + rtb_K[i_0] = (rtb_Add[i_0 + 3] * P_memory_PreviousInput_0 + rtb_Add[i_0] * + P_memory_PreviousInput) + rtb_Add[i_0 + 6] * + F_memory_PreviousInput; + + /* Product: '<S2>/Matrix Multiply4' incorporates: + * Memory: '<S1>/H_memory' + * Product: '<S3>/Matrix Multiply' + */ + rtb_Product_n += localDW->H_memory_PreviousInput[i_0] * rtb_MatrixMultiply_0; + } + + /* Sum: '<S2>/Subtract' incorporates: + * Product: '<S2>/Matrix Multiply4' + */ + rtb_Product_n = rtu_Pressure - rtb_Product_n; + + /* DigitalClock: '<S1>/Digital Clock' */ + localB->BusCreator.timestamp = ((((&run_ADA_M)->Timing.clockTick0+(&run_ADA_M + )->Timing.clockTickH0* 4294967296.0)) * 0.02); + for (i = 0; i < 3; i++) { + /* Sum: '<S2>/Add2' incorporates: + * Product: '<S2>/Matrix Multiply1' + * Product: '<S2>/Matrix Multiply5' + * Product: '<S3>/Matrix Multiply' + */ + localDW->x_memory_PreviousInput[i] = rtb_K[i] * rtb_Product_n + + rtb_MatrixMultiply[i]; + + /* Memory: '<S1>/H_memory' incorporates: + * Product: '<S2>/Matrix Multiply2' + */ + P_memory_PreviousInput = localDW->H_memory_PreviousInput[i]; + + /* Sum: '<S2>/Add1' incorporates: + * Constant: '<S2>/I' + * Memory: '<S1>/H_memory' + * Product: '<S2>/Matrix Multiply1' + * Product: '<S2>/Matrix Multiply2' + */ + tmp[3 * i] = run_ADA_ConstP.pooled5[3 * i] - rtb_K[0] * + P_memory_PreviousInput; + i_0 = 3 * i + 1; + tmp[i_0] = run_ADA_ConstP.pooled5[i_0] - rtb_K[1] * P_memory_PreviousInput; + i_0 = 3 * i + 2; + tmp[i_0] = run_ADA_ConstP.pooled5[i_0] - rtb_K[2] * P_memory_PreviousInput; + } + + /* Math: '<S4>/Pow' incorporates: + * Constant: '<S4>/P_ref' + * Math: '<S5>/Pow' + * Product: '<S4>/Divide1' + */ + P_memory_PreviousInput = std::pow(localDW->x_memory_PreviousInput[0] / + 101325.0, 0.19025441011522382); + + /* Product: '<S4>/Product' incorporates: + * Constant: '<S4>/Constant' + * Math: '<S4>/Pow' + * Sum: '<S4>/Subtract' + */ + rtb_Product_n = (1.0 - P_memory_PreviousInput) * 44330.769230769227; + + /* Sum: '<S1>/Subtract' incorporates: + * Constant: '<S1>/Constant' + */ + localB->BusCreator.aglAltitude = rtb_Product_n - 160.0; + + /* BusCreator: '<S1>/Bus Creator' incorporates: + * Constant: '<S5>/Constant1' + * Constant: '<S5>/T_ref' + * Constant: '<S5>/a' + * Gain: '<S5>/Gain' + * Product: '<S5>/Divide' + * Product: '<S5>/Product' + * Product: '<S5>/Product1' + */ + localB->BusCreator.mslAltitude = rtb_Product_n; + localB->BusCreator.verticalSpeed = -(1.0 / (0.0012366536657489548 * + localDW->x_memory_PreviousInput[0]) * (288.15 * + localDW->x_memory_PreviousInput[1] * P_memory_PreviousInput)); + localB->BusCreator.x0 = localDW->x_memory_PreviousInput[0]; + localB->BusCreator.x1 = localDW->x_memory_PreviousInput[1]; + localB->BusCreator.x2 = localDW->x_memory_PreviousInput[2]; + + /* Update for Memory: '<S1>/P_memory' incorporates: + * Product: '<S2>/Matrix Multiply3' + */ + for (i_0 = 0; i_0 < 3; i_0++) { + /* Product: '<S2>/Matrix Multiply3' incorporates: + * Sum: '<S3>/Add' + */ + P_memory_PreviousInput = rtb_Add[3 * i_0 + 1]; + P_memory_PreviousInput_0 = rtb_Add[3 * i_0]; + rtb_Product_n = rtb_Add[3 * i_0 + 2]; + for (i = 0; i <= 0; i += 2) { + tmp_0 = _mm_loadu_pd(&tmp[i + 3]); + tmp_1 = _mm_loadu_pd(&tmp[i]); + tmp_2 = _mm_loadu_pd(&tmp[i + 6]); + _mm_storeu_pd(&localDW->P_memory_PreviousInput[i + 3 * i_0], _mm_add_pd + (_mm_add_pd(_mm_mul_pd(_mm_set1_pd(P_memory_PreviousInput), + tmp_0), _mm_mul_pd(_mm_set1_pd(P_memory_PreviousInput_0), tmp_1)), + _mm_mul_pd(_mm_set1_pd(rtb_Product_n), tmp_2))); + } + + for (i = 2; i < 3; i++) { + localDW->P_memory_PreviousInput[i + 3 * i_0] = (tmp[i + 3] * + P_memory_PreviousInput + P_memory_PreviousInput_0 * tmp[i]) + tmp[i + 6] + * rtb_Product_n; + } + } + + /* End of Update for Memory: '<S1>/P_memory' */ +} + +/* Model step function */ +void run_ADA::step() +{ + /* Outputs for Atomic SubSystem: '<Root>/run_ADA' */ + + /* Inport: '<Root>/Pressure' */ + run_ADA_run_ADA(run_ADA_U.Pressure, &run_ADA_B.run_ADA_e, + &run_ADA_DW.run_ADA_e); + + /* End of Outputs for SubSystem: '<Root>/run_ADA' */ + + /* Outport: '<Root>/ADAState' */ + run_ADA_Y.ADAState_o = run_ADA_B.run_ADA_e.BusCreator; + + /* Update absolute time for base rate */ + /* The "clockTick0" counts the number of times the code of this task has + * been executed. The resolution of this integer timer is 0.02, which is the step size + * of the task. Size of "clockTick0" ensures timer will not overflow during the + * application lifespan selected. + * Timer of this task consists of two 32 bit unsigned integers. + * The two integers represent the low bits Timing.clockTick0 and the high bits + * Timing.clockTickH0. When the low bit overflows to 0, the high bits increment. + */ + (&run_ADA_M)->Timing.clockTick0++; + if (!(&run_ADA_M)->Timing.clockTick0) { + (&run_ADA_M)->Timing.clockTickH0++; + } +} + +/* Model initialize function */ +void run_ADA::initialize() +{ + /* SystemInitialize for Atomic SubSystem: '<Root>/run_ADA' */ + run_ADA_run_ADA_Init(&run_ADA_DW.run_ADA_e); + + /* End of SystemInitialize for SubSystem: '<Root>/run_ADA' */ +} + +/* Model terminate function */ +void run_ADA::terminate() +{ + /* (no terminate code required) */ +} + +/* Constructor */ +run_ADA::run_ADA() : + run_ADA_U(), + run_ADA_Y(), + run_ADA_B(), + run_ADA_DW(), + run_ADA_M() +{ + /* Currently there is no constructor body generated.*/ +} + +/* Destructor */ +/* Currently there is no destructor body generated.*/ +run_ADA::~run_ADA() = default; + +/* Real-Time Model get method */ +RT_MODEL_run_ADA_T * run_ADA::getRTM() +{ + return (&run_ADA_M); +} diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA.h b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA.h new file mode 100644 index 0000000000000000000000000000000000000000..a8c397ba8d159563c3524f6ec946b2967371f6ab --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA.h @@ -0,0 +1,212 @@ +/* + * run_ADA.h + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#ifndef RTW_HEADER_run_ADA_h_ +#define RTW_HEADER_run_ADA_h_ +#include "rtwtypes.h" +#include "rtw_continuous.h" +#include "rtw_solver.h" +#include "run_ADA_types.h" + +/* Macros for accessing real-time model data structure */ +#ifndef rtmGetErrorStatus +#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) +#endif + +#ifndef rtmSetErrorStatus +#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) +#endif + +/* Block signals for system '<Root>/run_ADA' */ +struct B_run_ADA_run_ADA_T { + ADAState BusCreator; /* '<S1>/Bus Creator' */ +}; + +/* Block states (default storage) for system '<Root>/run_ADA' */ +struct DW_run_ADA_run_ADA_T { + real_T H_memory_PreviousInput[3]; /* '<S1>/H_memory' */ + real_T F_memory_PreviousInput[9]; /* '<S1>/F_memory' */ + real_T P_memory_PreviousInput[9]; /* '<S1>/P_memory' */ + real_T Q_memory_PreviousInput[9]; /* '<S1>/Q_memory' */ + real_T H_memory1_PreviousInput; /* '<S1>/H_memory1' */ + real_T MatrixMultiply1_DWORK4; /* '<S2>/Matrix Multiply1' */ + real_T x_memory_PreviousInput[3]; /* '<S1>/x_memory' */ +}; + +/* Block signals (default storage) */ +struct B_run_ADA_T { + B_run_ADA_run_ADA_T run_ADA_e; /* '<Root>/run_ADA' */ +}; + +/* Block states (default storage) for system '<Root>' */ +struct DW_run_ADA_T { + DW_run_ADA_run_ADA_T run_ADA_e; /* '<Root>/run_ADA' */ +}; + +/* Constant parameters (default storage) */ +struct ConstP_run_ADA_T { + /* Expression: [1 0.02 0.5*0.02^2; 0 1 0.02; 0 0 1] + * Referenced by: '<S1>/F_memory' + */ + real_T F_memory_InitialCondition[9]; + + /* Pooled Parameter (Expression: eye(3)) + * Referenced by: + * '<S1>/P_memory' + * '<S2>/I' + */ + real_T pooled5[9]; + + /* Expression: [30 0 0; 0 10 0; 0 0 2.5] + * Referenced by: '<S1>/Q_memory' + */ + real_T Q_memory_InitialCondition[9]; +}; + +/* External inputs (root inport signals with default storage) */ +struct ExtU_run_ADA_T { + real_T Pressure; /* '<Root>/Pressure' */ +}; + +/* External outputs (root outports fed by signals with default storage) */ +struct ExtY_run_ADA_T { + ADAState ADAState_o; /* '<Root>/ADAState' */ +}; + +/* Real-time Model Data Structure */ +struct tag_RTM_run_ADA_T { + const char_T *errorStatus; + + /* + * Timing: + * The following substructure contains information regarding + * the timing information for the model. + */ + struct { + uint32_T clockTick0; + uint32_T clockTickH0; + } Timing; +}; + +/* Constant parameters (default storage) */ +extern const ConstP_run_ADA_T run_ADA_ConstP; + +/* Class declaration for model run_ADA */ +class run_ADA final +{ + /* public data and function members */ + public: + /* Copy Constructor */ + run_ADA(run_ADA const&) = delete; + + /* Assignment Operator */ + run_ADA& operator= (run_ADA const&) & = delete; + + /* Move Constructor */ + run_ADA(run_ADA &&) = delete; + + /* Move Assignment Operator */ + run_ADA& operator= (run_ADA &&) = delete; + + /* Real-Time Model get method */ + RT_MODEL_run_ADA_T * getRTM(); + + /* Root inports set method */ + void setExternalInputs(const ExtU_run_ADA_T *pExtU_run_ADA_T) + { + run_ADA_U = *pExtU_run_ADA_T; + } + + /* Root outports get method */ + const ExtY_run_ADA_T &getExternalOutputs() const + { + return run_ADA_Y; + } + + /* Initial conditions function */ + void initialize(); + + /* model step function */ + void step(); + + /* model terminate function */ + static void terminate(); + + /* Constructor */ + run_ADA(); + + /* Destructor */ + ~run_ADA(); + + /* private data and function members */ + private: + /* External inputs */ + ExtU_run_ADA_T run_ADA_U; + + /* External outputs */ + ExtY_run_ADA_T run_ADA_Y; + + /* Block signals */ + B_run_ADA_T run_ADA_B; + + /* Block states */ + DW_run_ADA_T run_ADA_DW; + + /* private member function(s) for subsystem '<Root>/run_ADA'*/ + static void run_ADA_run_ADA_Init(DW_run_ADA_run_ADA_T *localDW); + void run_ADA_run_ADA(real_T rtu_Pressure, B_run_ADA_run_ADA_T *localB, + DW_run_ADA_run_ADA_T *localDW) const; + + /* Real-Time Model */ + RT_MODEL_run_ADA_T run_ADA_M; +}; + +/*- + * These blocks were eliminated from the model due to optimizations: + * + * Block '<S2>/Reshape' : Reshape block reduction + * Block '<S2>/Reshape2' : Reshape block reduction + */ + +/*- + * The generated code includes comments that allow you to trace directly + * back to the appropriate location in the model. The basic format + * is <system>/block_name, where system is the system number (uniquely + * assigned by Simulink) and block_name is the name of the block. + * + * Note that this particular code originates from a subsystem build, + * and has its own system numbers different from the parent model. + * Refer to the system hierarchy for this subsystem below, and use the + * MATLAB hilite_system command to trace the generated code back + * to the parent model. For example, + * + * hilite_system('test_ada/run_ADA') - opens subsystem test_ada/run_ADA + * hilite_system('test_ada/run_ADA/Kp') - opens and selects block Kp + * + * Here is the system hierarchy for this model + * + * '<Root>' : 'test_ada' + * '<S1>' : 'test_ada/run_ADA' + * '<S2>' : 'test_ada/run_ADA/Correction' + * '<S3>' : 'test_ada/run_ADA/Prediction' + * '<S4>' : 'test_ada/run_ADA/getAltitude' + * '<S5>' : 'test_ada/run_ADA/getVelocity' + */ +#endif /* RTW_HEADER_run_ADA_h_ */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_data.cpp b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_data.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c75ebc634061d20e6835af64bd7e5aa8a5b5acc9 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_data.cpp @@ -0,0 +1,41 @@ +/* + * run_ADA_data.cpp + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#include "run_ADA.h" + +/* Constant parameters (default storage) */ +const ConstP_run_ADA_T run_ADA_ConstP{ + /* Expression: [1 0.02 0.5*0.02^2; 0 1 0.02; 0 0 1] + * Referenced by: '<S1>/F_memory' + */ + { 1.0, 0.0, 0.0, 0.02, 1.0, 0.0, 0.0002, 0.02, 1.0 }, + + /* Pooled Parameter (Expression: eye(3)) + * Referenced by: + * '<S1>/P_memory' + * '<S2>/I' + */ + { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 }, + + /* Expression: [30 0 0; 0 10 0; 0 0 2.5] + * Referenced by: '<S1>/Q_memory' + */ + { 30.0, 0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 2.5 } +}; diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_private.h b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_private.h new file mode 100644 index 0000000000000000000000000000000000000000..f8ee91da1731a77cd15ff86c9cbc0153aa94aa01 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_private.h @@ -0,0 +1,26 @@ +/* + * run_ADA_private.h + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#ifndef RTW_HEADER_run_ADA_private_h_ +#define RTW_HEADER_run_ADA_private_h_ +#include "rtwtypes.h" +#include "multiword_types.h" +#include "run_ADA_types.h" +#endif /* RTW_HEADER_run_ADA_private_h_ */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_types.h b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_types.h new file mode 100644 index 0000000000000000000000000000000000000000..bf526cd986bb1b7b20ee948be1569f053a47107e --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/ADA/run_ADA_grt_rtw/run_ADA_types.h @@ -0,0 +1,43 @@ +/* + * run_ADA_types.h + * + * Academic License - for use in teaching, academic research, and meeting + * course requirements at degree granting institutions only. Not for + * government, commercial, or other organizational use. + * + * Code generation for model "run_ADA". + * + * Model version : 1.25 + * Simulink Coder version : 9.9 (R2023a) 19-Nov-2022 + * C++ source code generated on : Wed Oct 25 17:58:39 2023 + * + * Target selection: grt.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Windows64) + * Code generation objective: Execution efficiency + * Validation result: Not run + */ + +#ifndef RTW_HEADER_run_ADA_types_h_ +#define RTW_HEADER_run_ADA_types_h_ +#include "rtwtypes.h" +#ifndef DEFINED_TYPEDEF_FOR_ADAState_ +#define DEFINED_TYPEDEF_FOR_ADAState_ + +struct ADAState +{ + real_T timestamp; + real_T mslAltitude; + real_T aglAltitude; + real_T verticalSpeed; + real_T x0; + real_T x1; + real_T x2; +}; + +#endif + +/* Forward declaration for rtModel */ +typedef struct tag_RTM_run_ADA_T RT_MODEL_run_ADA_T; + +#endif /* RTW_HEADER_run_ADA_types_h_ */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/extern/include/tmwtypes.h b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/extern/include/tmwtypes.h new file mode 100644 index 0000000000000000000000000000000000000000..e7f52fc38ebb6c400c2b423daef3910ae11a7cfa --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/extern/include/tmwtypes.h @@ -0,0 +1,888 @@ +/* + * Copyright 1984-2018 The MathWorks, Inc. + */ + +#if defined(_MSC_VER) +# pragma once +#endif +#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) +# pragma once +#endif + +#ifndef tmwtypes_h +#define tmwtypes_h + +#ifndef __TMWTYPES__ +#define __TMWTYPES__ +/* + * File : tmwtypes.h + * Abstract: + * Data types for use with MATLAB/SIMULINK and the Real-Time Workshop. + * + * When compiling stand-alone model code, data types can be overridden + * via compiler switches. + * + * Define NO_FLOATS to eliminate reference to real_T, etc. + */ + +#ifdef MW_LIBTOOLING +#include "mwstdint.h" +#endif + +#include <limits.h> + +/* __STDC_VERSION__ version check below means "check for a C99 compiler". + + Visual Studio (checked on versions 2015 and 2017) does + not define __STDC_VERSION__, however it has stdbool.h available, + thus a separate check for _MSC_VER below. + */ +#if defined(__APPLE_CC__) \ + || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) \ + || (defined(_MSC_VER) && (_MSC_VER >= 1900)) +#ifndef tmwtypes_do_not_include_stdbool +#include <stdbool.h> +#endif +#endif + +#define LOGICAL_IS_A_TYPE +#define SPARSE_GENERALIZATION + +#ifdef NO_FLOATS +# define double double_not_allowed +# define float float_not_allowed +#endif /*NO_FLOATS*/ + +#ifndef NO_FLOATS + +#ifndef __MWERKS__ +# ifdef __STDC__ +# include <float.h> +# else +# ifndef FLT_MANT_DIG +# define FLT_MANT_DIG 24 +# endif +# ifndef DBL_MANT_DIG +# define DBL_MANT_DIG 53 +# endif +# endif +#endif + +#endif /*NO_FLOATS*/ + +/* + * The following data types cannot be overridden when building MEX files. + */ +#ifdef MATLAB_MEX_FILE +# undef CHARACTER_T +# undef INTEGER_T +# undef BOOLEAN_T +# undef REAL_T +# undef TIME_T +#endif + +/* + * The uchar_T, ushort_T and ulong_T types are needed for compilers which do + * not allow defines to be specified, at the command line, with spaces in them. + */ + +typedef unsigned char uchar_T; +typedef unsigned short ushort_T; +typedef unsigned long ulong_T; + +#if (defined(_MSC_VER) && _MSC_VER >= 1500) \ + || defined(__x86_64__) || defined(__LP64__) \ + || defined(__LCC64__) + +typedef unsigned long long ulonglong_T; +#endif + + + +/*=======================================================================* + * Fixed width word size data types: * + * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * + * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * + * real32_T, real64_T - 32 and 64 bit floating point numbers * + *=======================================================================*/ + +/* When used with Real Time Workshop generated code, this + * header file can be used with a variety of compilers. + * + * The compiler could be for an 8 bit embedded processor that + * only had 8 bits per integer and 16 bits per long. + * In that example, a 32 bit integer size is not even available. + * This header file should be robust to that. + * + * For the case of an 8 bit processor, the preprocessor + * may be limited to 16 bit math like its target. That limitation + * would mean that 32 bit comparisons can't be done accurately. + * To increase robustness to this, comparisons are done against + * smaller values first. An inaccurate 32 bit comparison isn't + * attempted if the 16 bit comparison has already succeeded. + * + * Limitations on preprocessor math can also be stricter than + * for the target. There are known cases where a compiler + * targeting processors with 64 bit longs can't do accurate + * preprocessor comparisons on more than 32 bits. + */ + +/* Determine the number of bits for int, long, short, and char. + * If one fails to be determined, set the number of bits to -1 + */ + +#ifndef TMW_BITS_PER_INT +# if INT_MAX == 0x7FL +# define TMW_BITS_PER_INT 8 +# elif INT_MAX == 0x7FFFL +# define TMW_BITS_PER_INT 16 +# elif INT_MAX == 0x7FFFFFFFL +# define TMW_BITS_PER_INT 32 +# else +# define TMW_BITS_PER_INT -1 +# endif +#endif + +#ifndef TMW_BITS_PER_LONG +# if LONG_MAX == 0x7FL +# define TMW_BITS_PER_LONG 8 +# elif LONG_MAX == 0x7FFFL +# define TMW_BITS_PER_LONG 16 +# elif LONG_MAX == 0x7FFFFFFFL +# define TMW_BITS_PER_LONG 32 +# else +# define TMW_BITS_PER_LONG -1 +# endif +#endif + +#ifndef TMW_BITS_PER_SHRT +# if SHRT_MAX == 0x7FL +# define TMW_BITS_PER_SHRT 8 +# elif SHRT_MAX == 0x7FFFL +# define TMW_BITS_PER_SHRT 16 +# elif SHRT_MAX == 0x7FFFFFFFL +# define TMW_BITS_PER_SHRT 32 +# else +# define TMW_BITS_PER_SHRT -1 +# endif +#endif + +#ifndef TMW_BITS_PER_SCHAR +# if SCHAR_MAX == 0x7FL +# define TMW_BITS_PER_SCHAR 8 +# elif SCHAR_MAX == 0x7FFFL +# define TMW_BITS_PER_SCHAR 16 +# elif SCHAR_MAX == 0x7FFFFFFFL +# define TMW_BITS_PER_SCHAR 32 +# else +# define TMW_BITS_PER_SCHAR -1 +# endif +#endif + +#ifndef TMW_CHAR_SIGNED +# if SCHAR_MAX == CHAR_MAX +# define TMW_CHAR_SIGNED 1 +# else +# define TMW_CHAR_SIGNED 0 +# endif +#endif + +/* It is common for one or more of the integer types + * to be the same size. For example, on many embedded + * processors, both shorts and ints are 16 bits. On + * processors used for workstations, it is quite common + * for both int and long to be 32 bits. + * When there is more than one choice for typdef'ing + * a portable type like int16_T or uint32_T, in + * concept, it should not matter which choice is made. + * However, some style guides and some code checking + * tools do identify and complain about seemingly + * irrelevant differences. For example, a code + * checking tool may complain about an implicit + * conversion from int to short even though both + * are 16 bits. To reduce these types of + * complaints, it is best to make int the + * preferred choice when more than one is available. + */ + +#ifndef INT8_T +# if defined(MW_LIBTOOLING) +# define INT8_T int8_t +# elif TMW_BITS_PER_INT == 8 +# define INT8_T int +# elif TMW_BITS_PER_LONG == 8 +# define INT8_T long +# elif TMW_BITS_PER_SCHAR == 8 +# define INT8_T signed char +# elif TMW_BITS_PER_SHRT == 8 +# define INT8_T short +# endif +#endif +#ifdef INT8_T + typedef INT8_T int8_T; +#endif + +#ifndef UINT8_T +# if defined(MW_LIBTOOLING) +# define UINT8_T uint8_t +# elif TMW_BITS_PER_INT == 8 +# define UINT8_T unsigned int +# elif TMW_BITS_PER_LONG == 8 +# define UINT8_T unsigned long +# elif TMW_BITS_PER_SCHAR == 8 +# define UINT8_T unsigned char +# elif TMW_BITS_PER_SHRT == 8 +# define UINT8_T unsigned short +# endif +#endif +#ifdef UINT8_T + typedef UINT8_T uint8_T; +#endif + + +#ifndef INT16_T +# if defined(MW_LIBTOOLING) +# define INT16_T int16_t +# elif TMW_BITS_PER_INT == 16 +# define INT16_T int +# elif TMW_BITS_PER_LONG == 16 +# define INT16_T long +# elif TMW_BITS_PER_SCHAR == 16 +# define INT16_T signed char +# elif TMW_BITS_PER_SHRT == 16 +# define INT16_T short +# endif +#endif +#ifdef INT16_T + typedef INT16_T int16_T; +#endif + + +#ifndef UINT16_T +# if defined(MW_LIBTOOLING) +# define UINT16_T uint16_t +# elif TMW_BITS_PER_INT == 16 +# define UINT16_T unsigned int +# elif TMW_BITS_PER_LONG == 16 +# define UINT16_T unsigned long +# elif TMW_BITS_PER_SCHAR == 16 +# define UINT16_T unsigned char +# elif TMW_BITS_PER_SHRT == 16 +# define UINT16_T unsigned short +# endif +#endif +#ifdef UINT16_T + typedef UINT16_T uint16_T; +#endif + + +#ifndef INT32_T +# if defined(MW_LIBTOOLING) +# define INT32_T int32_t +# elif TMW_BITS_PER_INT == 32 +# define INT32_T int +# elif TMW_BITS_PER_LONG == 32 +# define INT32_T long +# elif TMW_BITS_PER_SCHAR == 32 +# define INT32_T signed char +# elif TMW_BITS_PER_SHRT == 32 +# define INT32_T short +# endif +#endif +#ifdef INT32_T + typedef INT32_T int32_T; +#endif + + +#ifndef UINT32_T +# if defined(MW_LIBTOOLING) +# define UINT32_T uint32_t +# elif TMW_BITS_PER_INT == 32 +# define UINT32_T unsigned int +# elif TMW_BITS_PER_LONG == 32 +# define UINT32_T unsigned long +# elif TMW_BITS_PER_SCHAR == 32 +# define UINT32_T unsigned char +# elif TMW_BITS_PER_SHRT == 32 +# define UINT32_T unsigned short +# endif +#endif +#ifdef UINT32_T + typedef UINT32_T uint32_T; +#endif + +/* The following is used to emulate smaller integer types when only + * larger types are available. For example, compilers for TI C3x/C4x DSPs + * define char and short to be 32 bits, so 8 and 16 bits are not directly + * available. This target is commonly used with RTW rapid prototyping. + * Other DSPs define char to be 16 bits, so 8 bits is not directly + * available. + */ +#ifndef INT8_T +# ifdef INT16_T +# define INT8_T INT16_T + typedef INT8_T int8_T; +# else +# ifdef INT32_T +# define INT8_T INT32_T + typedef INT8_T int8_T; +# endif +# endif +#endif + +#ifndef UINT8_T +# ifdef UINT16_T +# define UINT8_T UINT16_T + typedef UINT8_T uint8_T; +# else +# ifdef UINT32_T +# define UINT8_T UINT32_T + typedef UINT8_T uint8_T; +# endif +# endif +#endif + +#ifndef INT16_T +# ifdef INT32_T +# define INT16_T INT32_T + typedef INT16_T int16_T; +# endif +#endif + +#ifndef UINT16_T +# ifdef UINT32_T +# define UINT16_T UINT32_T + typedef UINT16_T uint16_T; +# endif +#endif + + +#ifndef NO_FLOATS + +#ifndef REAL32_T +# ifndef __MWERKS__ +# if FLT_MANT_DIG >= 23 +# define REAL32_T float +# endif +# else +# define REAL32_T float +# endif +#endif +#ifdef REAL32_T + typedef REAL32_T real32_T; +#endif + + +#ifndef REAL64_T +# ifndef __MWERKS__ +# if DBL_MANT_DIG >= 52 +# define REAL64_T double +# endif +# else +# define REAL64_T double +# endif +#endif +#ifdef REAL64_T + typedef REAL64_T real64_T; +#endif + +#endif /* NO_FLOATS*/ + +/*=======================================================================* + * Fixed width word size data types: * + * int64_T - signed 64 bit integers * + * uint64_T - unsigned 64 bit integers * + *=======================================================================*/ + +# if defined(MW_LIBTOOLING) +# ifdef INT64_T +# undef INT64_T +# endif +# define INT64_T int64_t +# ifdef UINT64_T +# undef UINT64_T +# endif +# define UINT64_T uint64_t +# endif +#if !defined(INT64_T) || !defined(UINT64_T) || !defined(FMT64) +# if defined(__APPLE__) || defined(__clang__) +# ifndef INT64_T +# define INT64_T long long +# endif +# ifndef UINT64_T +# define UINT64_T unsigned long long +# endif +# ifndef FMT64 +# define FMT64 "ll" +# endif +# if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG) +# define INT_TYPE_64_IS_LONG +# endif +# elif (defined(__x86_64__) || defined(__LP64__))&& !defined(__MINGW64__) +# ifndef INT64_T +# define INT64_T long +# endif +# ifndef UINT64_T +# define UINT64_T unsigned long +# endif +# ifndef FMT64 +# define FMT64 "l" +# endif +# if !defined(INT_TYPE_64_IS_LONG) +# define INT_TYPE_64_IS_LONG +# endif +# elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ + || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) +# ifndef INT64_T +# define INT64_T __int64 +# endif +# ifndef UINT64_T +# define UINT64_T unsigned __int64 +# endif +# ifndef FMT64 +# define FMT64 "I64" +# endif +# elif defined(__GNUC__) || defined(TMW_ENABLE_INT64) \ + || defined(__LCC64__) +# ifndef INT64_T +# define INT64_T long long +# endif +# ifndef UINT64_T +# define UINT64_T unsigned long long +# endif +# ifndef FMT64 +# define FMT64 "ll" +# endif +# endif + +#endif + +#if defined(INT64_T) +# if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9))) + __extension__ +# endif + typedef INT64_T int64_T; +#endif + +#if defined(_WIN64) || (defined(__APPLE__) && defined(__LP64__)) \ + || defined(__x86_64__) \ + || defined(__LP64__) +# define INT_TYPE_64_IS_SUPPORTED +#endif + +#if defined(UINT64_T) +# if defined(__GNUC__) && \ + ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9))) + __extension__ +# endif + typedef UINT64_T uint64_T; +#endif + +/*===========================================================================* + * Format string modifiers for using size_t variables in printf statements. * + *===========================================================================*/ + +#ifndef FMT_SIZE_T +# if (defined( __GNUC__ ) || defined(_STDC_C99))&& !defined(__MINGW64__) +# define FMT_SIZE_T "z" +# elif defined (__WATCOMC__) +# define FMT_SIZE_T "l" +# elif defined (_WIN32 ) +# define FMT_SIZE_T "I" +# else +# define FMT_SIZE_T "l" +# endif +#endif + +#ifndef FMT_PTRDIFF_T +# if defined(__APPLE__) +# define FMT_PTRDIFF_T "l" +# elif defined( __GNUC__ ) || defined(_STDC_C99) +# define FMT_PTRDIFF_T "t" +# elif defined (__WATCOMC__) +# define FMT_PTRDIFF_T "l" +# elif defined (_WIN32 ) +# define FMT_PTRDIFF_T "I" +# else +# define FMT_PTRDIFF_T "l" +# endif +#endif + +/*===========================================================================* + * General or logical data types where the word size is not guaranteed. * + * real_T - possible settings include real32_T or real64_T * + * time_T - possible settings include real32_T or real64_T * + * boolean_T * + * char_T * + * int_T * + * uint_T * + * byte_T * + *===========================================================================*/ + +#ifndef NO_FLOATS + +#ifndef REAL_T +# ifdef REAL64_T +# define REAL_T real64_T +# else +# ifdef REAL32_T +# define REAL_T real32_T +# endif +# endif +#endif +#ifdef REAL_T + typedef REAL_T real_T; +#endif + +#ifndef TIME_T +# ifdef REAL_T +# define TIME_T real_T +# endif +#endif +#ifdef TIME_T + typedef TIME_T time_T; +#endif + +#endif /* NO_FLOATS */ + +#ifndef BOOLEAN_T +# if defined(UINT8_T) +# define BOOLEAN_T UINT8_T +# else +# define BOOLEAN_T unsigned int +# endif +#endif +typedef BOOLEAN_T boolean_T; + + +#ifndef CHARACTER_T +# define CHARACTER_T char +#endif +typedef CHARACTER_T char_T; + + +#ifndef INTEGER_T +# define INTEGER_T int +#endif +typedef INTEGER_T int_T; + + +#ifndef UINTEGER_T +# define UINTEGER_T unsigned +#endif +typedef UINTEGER_T uint_T; + + +#ifndef BYTE_T +# define BYTE_T unsigned char +#endif +typedef BYTE_T byte_T; + + +/*===========================================================================* + * Define Complex Structures * + *===========================================================================*/ +#ifndef NO_FLOATS + +#ifndef CREAL32_T +# ifdef REAL32_T + typedef struct { + real32_T re, im; + } creal32_T; +# define CREAL32_T creal32_T +# endif +#endif + +#ifndef CREAL64_T +# ifdef REAL64_T + typedef struct { + real64_T re, im; + } creal64_T; +# define CREAL64_T creal64_T +# endif +#endif + +#ifndef CREAL_T +# ifdef REAL_T + typedef struct { + real_T re, im; + } creal_T; +# define CREAL_T creal_T +# endif +#endif + +#endif /* NO_FLOATS */ + +#ifndef CINT8_T +# ifdef INT8_T + typedef struct { + int8_T re, im; + } cint8_T; +# define CINT8_T cint8_T +# endif +#endif + +#ifndef CUINT8_T +# ifdef UINT8_T + typedef struct { + uint8_T re, im; + } cuint8_T; +# define CUINT8_T cuint8_T +# endif +#endif + +#ifndef CINT16_T +# ifdef INT16_T + typedef struct { + int16_T re, im; + } cint16_T; +# define CINT16_T cint16_T +# endif +#endif + +#ifndef CUINT16_T +# ifdef UINT16_T + typedef struct { + uint16_T re, im; + } cuint16_T; +# define CUINT16_T cuint16_T +# endif +#endif + +#ifndef CINT32_T +# ifdef INT32_T + typedef struct { + int32_T re, im; + } cint32_T; +# define CINT32_T cint32_T +# endif +#endif + +#ifndef CUINT32_T +# ifdef UINT32_T + typedef struct { + uint32_T re, im; + } cuint32_T; +# define CUINT32_T cuint32_T +# endif +#endif + +#ifndef CINT64_T +# ifdef INT64_T + typedef struct { + int64_T re, im; + } cint64_T; +# define CINT64_T cint64_T +# endif +#endif + +#ifndef CUINT64_T +# ifdef UINT64_T + typedef struct { + uint64_T re, im; + } cuint64_T; +# define CUINT64_T cuint64_T +# endif +#endif + +/*=======================================================================* + * Min and Max: * + * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * + * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * + *=======================================================================*/ + +#define MAX_int8_T ((int8_T)(127)) /* 127 */ +#define MIN_int8_T ((int8_T)(-128)) /* -128 */ +#define MAX_uint8_T ((uint8_T)(255)) /* 255 */ +#define MIN_uint8_T ((uint8_T)(0)) + +#define MAX_int16_T ((int16_T)(32767)) /* 32767 */ +#define MIN_int16_T ((int16_T)(-32768)) /* -32768 */ +#define MAX_uint16_T ((uint16_T)(65535)) /* 65535 */ +#define MIN_uint16_T ((uint16_T)(0)) + +#define MAX_int32_T ((int32_T)(2147483647)) /* 2147483647 */ +#define MIN_int32_T ((int32_T)(-2147483647-1)) /* -2147483648 */ +#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) /* 4294967295 */ +#define MIN_uint32_T ((uint32_T)(0)) + +#if defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ + || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) \ + || defined(__LCC64__) +# ifdef INT64_T +# define MAX_int64_T ((int64_T)(9223372036854775807LL)) +# define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) +# endif +# ifdef UINT64_T +# define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) +# define MIN_uint64_T ((uint64_T)(0)) +# endif +#else +# ifdef INT64_T +# ifdef INT_TYPE_64_IS_LONG +# define MAX_int64_T ((int64_T)(9223372036854775807L)) +# define MIN_int64_T ((int64_T)(-9223372036854775807L-1L)) +# else +# define MAX_int64_T ((int64_T)(9223372036854775807LL)) +# define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) +# endif +# endif +# ifdef UINT64_T +# ifdef INT_TYPE_64_IS_LONG +# define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFUL)) +# define MIN_uint64_T ((uint64_T)(0)) +# else +# define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) +# define MIN_uint64_T ((uint64_T)(0)) +# endif +# endif +#endif + +#if (defined(_MSC_VER) && !defined(__clang__)) + +/* Conversion from unsigned __int64 to double is not implemented in Visual Studio + * and results in a compile error, thus the value must first be cast to + * signed __int64, and then to double. + * + * If the 64 bit int value is greater than 2^63-1, which is the signed int64 max, + * the macro below provides a workaround for casting a uint64 value to a double + * in windows. + */ +# define uint64_to_double(u) ( ((u) > _I64_MAX) ? \ + (double)(__int64)((u) - _I64_MAX - 1) + (double)_I64_MAX + 1: \ + (double)(__int64)(u) ) + +/* The following inline function should only be used in the macro double_to_uint64, + * as it only handles the specfic range of double between 2^63 and 2^64-1 */ +__forceinline +uint64_T double_to_uint64_helper(double d) { + union double_to_uint64_union_type { + double dd; + uint64_T i64; + } di; + di.dd = d; + return (((di.i64 & 0x000fffffffffffff) | 0x0010000000000000) << 11); +} + +/* The largest double value that can be cast to uint64 in windows is the + * signed int64 max, which is 2^63-1. The macro below provides + * a workaround for casting large double values to uint64 in windows. + */ +/* The magic number 18446744073709551616.0 is 2^64 */ +/* The magic number 9223372036854775808.0 is 2^63 */ +# define double_to_uint64(d) ( ((d) >= 18446744073709551616.0) ? \ + 0xffffffffffffffffULL : \ + ((d) >= 0.0) ? \ + ((d) >= 9223372036854775808.0) ? \ + double_to_uint64_helper(d) : \ + (unsigned __int64)(d) : \ + 0ULL ) +#else +# define uint64_to_double(u) ((double)(u)) +# if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__TICCSC__) +/* double_to_uint64 defined only for MSVC and UNIX */ +# else +# define double_to_uint64(d) ( ((d) >= 18446744073709551616.0) ? \ + (unsigned long long) 0xffffffffffffffffULL : \ + ((d) >= 0) ? (unsigned long long)(d) : (unsigned long long) 0 ) +# endif +#endif + +#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) + +#ifndef _bool_T +#define _bool_T + +typedef boolean_T bool; + +#ifndef false +#define false (0) +#endif +#ifndef true +#define true (1) +#endif + +#endif /* _bool_T */ + +#endif /* !__cplusplus */ + +/* + * This software assumes that the code is being compiled on a target using a + * 2's complement representation for signed integer values. + */ +#if ((SCHAR_MIN + 1) != -SCHAR_MAX) +#error "This code must be compiled using a 2's complement representation for signed integer values" +#endif + +/* + * Maximum length of a MATLAB identifier (function/variable/model) + * including the null-termination character. + */ +#define TMW_NAME_LENGTH_MAX 64 + +/* + * Maximum values for indices and dimensions + */ +#include <stddef.h> + +#ifdef MX_COMPAT_32 +typedef int mwSize; +typedef int mwIndex; +typedef int mwSignedIndex; +#else +typedef size_t mwSize; /* unsigned pointer-width integer */ +typedef size_t mwIndex; /* unsigned pointer-width integer */ +typedef ptrdiff_t mwSignedIndex; /* a signed pointer-width integer */ +#endif + + /* for the individual dim */ +/* If updating SLSize or SLIndex, update defintions in sl_types_def.h + as well. */ +#ifndef SLSIZE_SLINDEX + #define SLSIZE_SLINDEX + #ifdef INT_TYPE_64_IS_SUPPORTED + typedef int64_T SLIndex; + typedef int64_T SLSize; + #else + typedef int SLIndex; + typedef int SLSize; + #endif +#endif + +/* for the total size */ +#define SLIndexType size_t +#define INVALID_SIZET_VALUE (std::numeric_limits<SLIndexType>::max()) +#define MAX_VALID_SIZET_VALUE (std::numeric_limits<SLIndexType>::max() -1) + + +#if (defined(_LP64) || defined(_WIN64)) && !defined(MX_COMPAT_32) +/* Currently 2^48 based on hardware limitations */ +# define MWSIZE_MAX 281474976710655UL +# define MWINDEX_MAX 281474976710655UL +# define MWSINDEX_MAX 281474976710655L +# define MWSINDEX_MIN -281474976710655L +#else +# define MWSIZE_MAX 2147483647UL +# define MWINDEX_MAX 2147483647UL +# define MWSINDEX_MAX 2147483647L +# define MWSINDEX_MIN -2147483647L +#endif +#define MWSIZE_MIN 0UL +#define MWINDEX_MIN 0UL + +/** UTF-16 character type */ + +#if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT) +typedef char16_t CHAR16_T; +#define U16_STRING_LITERAL_PREFIX u +#elif defined(_MSC_VER) +typedef wchar_t CHAR16_T; +#define U16_STRING_LITERAL_PREFIX L +#else +typedef UINT16_T CHAR16_T; +#endif + +#endif /* __TMWTYPES__ */ + +#endif /* tmwtypes_h */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/common/rt_cppclass_main.cpp b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/common/rt_cppclass_main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d0fb4a3c26804fca6db4bf02e0befad9068810b --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/common/rt_cppclass_main.cpp @@ -0,0 +1,452 @@ +/* + * Copyright 2013-2022 The MathWorks, Inc. + * + * File: rt_cppclass_main.cpp + * + * Abstract: + * + * A real-time main that runs generated Simulink Coder code under most + * operating systems. Based on the definition of MULTITASKING, a single-task + * or multitask step function is employed. + * + * This file is a useful starting point for creating a custom main when + * targeting a custom floating point processor or integer micro-controller. + * + * Alternatively for ERT targets, you can generate a sample ert_main.cpp file + * with the generated code by selecting the "Generate an example main program" + * option. In this case, ert_main.cpp is precisely customized to the + * model requirements. + * + * Required Defines: + * + * MODEL - Model name + * NUMST - Number of sample times + * + */ + +/*==================* + * Required defines * + *==================*/ + +#ifndef MODEL +# error Must specify a model name. Define MODEL=name. +#else +/* create generic macros that work with any model */ +# define EXPAND_CONCAT(name1,name2) name1 ## name2 +# define CONCAT(name1,name2) EXPAND_CONCAT(name1,name2) +# define MODEL_INSTANCE CONCAT(MODEL,_Obj) +#endif + +#ifndef NUMST +# error Must specify the number of sample times. Define NUMST=number. +#endif + +#if CLASSIC_INTERFACE == 1 +# error "Classic call interface is not supported by rt_cppclass_main.cpp." +#endif + +#if ONESTEPFCN==0 +#error Separate output and update functions are not supported by rt_cppclass_main.cpp. \ +You must update rt_cppclass_main.cpp to suit your application needs, or select \ +the 'Single output/update function' option. +#endif + +#if TERMFCN==0 +#error The terminate function is required by rt_cppclass_main.cpp. \ +Select model configuration parameter 'Terminate function required' \ +or 'Generate an example main program' or modify rt_cppclass_main.cpp to \ +meet your application requirements. +#endif + +#define QUOTE1(name) #name +#define QUOTE(name) QUOTE1(name) /* need to expand name */ + +#ifndef SAVEFILE +# define MATFILE2(file) #file ".mat" +# define MATFILE1(file) MATFILE2(file) +# define MATFILE MATFILE1(MODEL) +#else +# define MATFILE QUOTE(SAVEFILE) +#endif + +/*==========* + * Includes * + *==========*/ + +#include "rtwtypes.h" +#if !defined(INTEGER_CODE) || INTEGER_CODE == 0 +# include <stdio.h> /* optional for printf */ +#else +extern "C" { + extern int printf(const char *, ...); + extern int fflush(void *); +} +#endif +#include <string.h> /* optional for strcmp */ +#include "rtmodel.h" /* includes model.h */ + +#include "rt_logging.h" +#ifdef UseMMIDataLogging +#include "rt_logging_mmi.h" +#endif + +#include "ext_work.h" + +#ifdef MODEL_STEP_FCN_CONTROL_USED +#error rt_cppclass_main.cpp does not support model step function prototype control. +#endif + +/*========================* + * Setup for multitasking * + *========================*/ + +/* + * Let MT be synonym for MULTITASKING (to shorten command line for DOS) + */ +#if defined(MT) +# if MT == 0 +# undef MT +# else +# define MULTITASKING 1 +# endif +#endif + +#if defined(TID01EQ) && TID01EQ == 1 +#define FIRST_TID 1 +#else +#define FIRST_TID 0 +#endif + +/*====================* + * External functions * + *====================*/ + +#if !defined(MULTITASKING) + /* single-rate step function */ + #define MODEL_STEP(obj) obj.MODEL_STEPNAME() +#else + /* multirate step function */ + #define MODEL_STEP MODEL_STEPNAME +#endif + + +/*==================================* + * Global data local to this module * + *==================================*/ +#ifndef MULTITASKING +static uint_T OverrunFlags[1]; /* ISR overrun flags */ +static uint_T eventFlags[1]; /* necessary for overlapping preemption */ +#else +static uint_T OverrunFlags[NUMST]; +static uint_T eventFlags[NUMST]; +#endif + +/* Create model instance */ +static MODEL_CLASSNAME MODEL_INSTANCE; + + +/*===================* + * Visible functions * + *===================*/ + +#if !defined(MULTITASKING) /* single task */ + +/* Function: rtOneStep ======================================================== + * + * Abstract: + * Perform one step of the model. This function is modeled such that + * it could be called from an interrupt service routine (ISR) with minor + * modifications. + */ +static void rt_OneStep(MODEL_CLASSNAME & mdl) +{ + /* Disable interrupts here */ + + /*********************************************** + * Check and see if base step time is too fast * + ***********************************************/ + if (OverrunFlags[0]++) { + rtmSetErrorStatus(mdl.getRTM(), "Overrun"); + } + + /************************************************* + * Check and see if an error status has been set * + * by an overrun or by the generated code. * + *************************************************/ + if (rtmGetErrorStatus(mdl.getRTM()) != NULL) { + return; + } + + /* Save FPU context here (if necessary) */ + /* Re-enable interrupts here */ + /* Set model inputs here */ + + /************** + * Step model * + **************/ + MODEL_STEP(mdl); + + /* Get model outputs here */ + + /************************** + * Decrement overrun flag * + **************************/ + OverrunFlags[0]--; + + rtExtModeCheckEndTrigger(); + + /* Disable interrupts here */ + /* Restore FPU context here (if necessary) */ + /* Re-enable interrupts here */ + +} /* end rtOneStep */ + +#else /* multitask */ + +/* Function: rtOneStep ======================================================== + * + * Abstract: + * Perform one step of the model. This function is modeled such that + * it could be called from an interrupt service routine (ISR) with minor + * modifications. + * + * Note that error checking is only necessary when this routine is + * attached to an interrupt. + * + * Also, you may wish to unroll any or all of for and while loops to + * improve the real-time performance of this function. + */ +static void rt_OneStep(MODEL_CLASSNAME & mdl) +{ + int_T i; + + /* Disable interrupts here */ + + /*********************************************** + * Check and see if base step time is too fast * + ***********************************************/ + if (OverrunFlags[0]++) { + rtmSetErrorStatus(mdl.getRTM(), "Overrun"); + } + + /************************************************* + * Check and see if an error status has been set * + * by an overrun or by the generated code. * + *************************************************/ + if (rtmGetErrorStatus(mdl.getRTM()) != NULL) { + return; + } + + /* Save FPU context here (if necessary) */ + /* Re-enable interrupts here */ + + /************************************************* + * Update EventFlags and check subrate overrun * + *************************************************/ + for (i = FIRST_TID+1; i < NUMST; i++) { + if (rtmStepTask(mdl.getRTM(),i) && eventFlags[i]++) { + OverrunFlags[0]--; + OverrunFlags[i]++; + /* Sampling too fast */ + rtmSetErrorStatus(mdl.getRTM(), "Overrun"); + return; + } + if (++rtmTaskCounter(mdl.getRTM(),i) == rtmCounterLimit(mdl.getRTM(),i)) + rtmTaskCounter(mdl.getRTM(), i) = 0; + } + + /* Set model inputs associated with base rate here */ + + /******************************************* + * Step the model for the base sample time * + *******************************************/ + MODEL_STEP(mdl,0); + + /* Get model outputs associated with base rate here */ + + /************************************************************************ + * Model step complete for base sample time, now it is okay to * + * re-interrupt this ISR. * + ************************************************************************/ + OverrunFlags[0]--; + + /********************************************************* + * Step the model for any other sample times (subrates) * + *********************************************************/ + for (i = FIRST_TID+1; i < NUMST; i++) { + /************************************************************* + * If task "i" is running, don't run any lower priority task * + *************************************************************/ + if (OverrunFlags[i]) return; + + if (eventFlags[i]) { + OverrunFlags[i]++; + + /* Set model inputs associated with subrate here */ + + /****************************************** + * Step the model for sample time "i" * + ******************************************/ + MODEL_STEP(mdl,i); + + /* Get model outputs associated with subrate here */ + + /********************************************** + * Indicate task complete for sample time "i" * + **********************************************/ + OverrunFlags[i]--; + eventFlags[i]--; + } + } + + rtExtModeCheckEndTrigger(); + /* Disable interrupts here */ + /* Restore FPU context here (if necessary) */ + /* Enable interrupts here */ + +} /* end rtOneStep */ + +#endif /* MULTITASKING */ + +/* Function: rt_InitModel ==================================================== + * + * Abstract: + * Initialized the model and the overrun flags + * + */ +static void rt_InitModel(MODEL_CLASSNAME & mdl) +{ +#if defined(MULTITASKING) + int i; + for(i=0; i < NUMST; i++) { + OverrunFlags[i] = 0; + eventFlags[i] = 0; + } +#else + OverrunFlags[0] = 0; + eventFlags[0] = 0; +#endif + + /************************ + * Initialize the model * + ************************/ + mdl.initialize(); +} + +/* Function: rt_TermModel ==================================================== + * + * Abstract: + * Terminates the model and prints the error status + * + */ +static int_T rt_TermModel(MODEL_CLASSNAME & mdl) +{ + mdl.terminate(); + + { + const char_T *errStatus = (const char_T *) (rtmGetErrorStatus(mdl.getRTM())); + + if (errStatus != NULL && strcmp(errStatus, "Simulation finished")) { + (void)printf("%s\n", errStatus); +#if defined(MULTITASKING) + int_T i; + for (i = 0; i < NUMST; i++) { + if (OverrunFlags[i]) { + (void)printf("ISR overrun - sampling rate too" + "fast for sample time index %d.\n", i); + } + } +#else + if (OverrunFlags[0]) { + (void)printf("ISR overrun - base sampling rate too fast.\n"); + } +#endif + + return(1); + } + } + + return(0); +} + +/* Function: main ============================================================= + * + * Abstract: + * Execute model on a generic target such as a workstation. + */ +int_T main(int_T argc, const char *argv[]) +{ + int_T ret; + + /* External mode */ + rtParseArgsForExtMode(argc, argv); + + /******************************************* + * warn if the model will run indefinitely * + *******************************************/ +#ifndef EXT_MODE +# define EXT_MODE 0 +#endif + +#if MAT_FILE==0 && EXT_MODE==0 + printf("warning: the simulation will run with no stop time; " + "to change this behavior select the 'MAT-file logging' option\n"); + fflush(NULL); +#endif + + /************************ + * Initialize the model * + ************************/ + rt_InitModel(MODEL_INSTANCE); + + /* External mode */ + rtSetTFinalForExtMode(&rtmGetTFinal(MODEL_INSTANCE.getRTM())); + rtExtModeCheckInit(NUMST); + rtExtModeWaitForStartPkt(rtmGetRTWExtModeInfo(MODEL_INSTANCE.getRTM()), + NUMST, + (boolean_T *)&rtmGetStopRequested(MODEL_INSTANCE.getRTM())); + + (void)printf("\n** starting the model **\n"); + + /*********************************************************************** + * Execute (step) the model. You may also attach rtOneStep to an ISR, * + * in which case you replace the call to rtOneStep with a call to a * + * background task. Note that the generated code sets error status * + * to "Simulation finished" when MatFileLogging is specified in TLC. * + ***********************************************************************/ + while (rtmGetErrorStatus(MODEL_INSTANCE.getRTM()) == NULL && + !rtmGetStopRequested(MODEL_INSTANCE.getRTM())) { + + rtExtModePauseIfNeeded(rtmGetRTWExtModeInfo(MODEL_INSTANCE.getRTM()), + NUMST, + (boolean_T *)&rtmGetStopRequested(MODEL_INSTANCE.getRTM())); + + if (rtmGetStopRequested(MODEL_INSTANCE.getRTM())) break; + + /* external mode */ + rtExtModeOneStep(rtmGetRTWExtModeInfo(MODEL_INSTANCE.getRTM()), + NUMST, + (boolean_T *)&rtmGetStopRequested(MODEL_INSTANCE.getRTM())); + + rt_OneStep(MODEL_INSTANCE); + } + + /******************************* + * Cleanup and exit (optional) * + *******************************/ + +#ifdef UseMMIDataLogging + rt_CleanUpForStateLogWithMMI(rtmGetRTWLogInfo(MODEL_INSTANCE.getRTM())); +#endif + rt_StopDataLogging(MATFILE,rtmGetRTWLogInfo(MODEL_INSTANCE.getRTM())); + + ret = rt_TermModel(MODEL_INSTANCE); + + rtExtModeShutdown(NUMST); + + return ret; +} + +/* [EOF] rt_cppclass_main.cpp */ + + diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/ext_mode/common/ext_work.h b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/ext_mode/common/ext_work.h new file mode 100644 index 0000000000000000000000000000000000000000..e7f1322384f25f86eca8b53220eb6d3995e09787 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/ext_mode/common/ext_work.h @@ -0,0 +1,127 @@ +/* + * Copyright 1994-2012 The MathWorks, Inc. + * + * File: ext_work.h + * + * Abstract: + * + */ + +#ifndef __EXT_WORK_OBJECT__ +#define __EXT_WORK_OBJECT__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef EXT_MODE +#include "ext_types.h" + +#if defined(VXWORKS) + /*VxWorks headers*/ + #include <vxWorks.h> + #include <taskLib.h> + #include <sysLib.h> + #include <semLib.h> + #include <rebootLib.h> + #include <logLib.h> + + extern void rtExtModeTornadoStartup(RTWExtModeInfo *ei, + int_T numSampTimes, + boolean_T *stopReqPtr, + int_T priority, + int32_T stack_size, + SEM_ID startStopSem); + + extern void rtExtModeTornadoCleanup(int_T numSampTimes); + + extern void rtExtModeTornadoSetPortInExtUD(const int_T port); + +#elif defined(C6000_EXT_MODE) + /* C6000 headers*/ + #include <std.h> + #include <stddef.h> + #include <sem.h> + + extern void rtExtModeC6000Startup( RTWExtModeInfo *ei, + int_T numSampTimes, + boolean_T *stopReqPtr); + + extern void rtExtModeC6000Cleanup(int_T numSampTimes); +#else + extern void rtExtModePauseIfNeeded(RTWExtModeInfo *ei, + int_T numSampTimes, + boolean_T *stopReqPtr); + + extern void rtExtModeWaitForStartPkt(RTWExtModeInfo *ei, + int_T numSampTimes, + boolean_T *stopReqPtr); + void rtExtModeInitUD(void); +#endif /* #if defined(VXWORKS) */ + +extern void rtExtModeOneStep(RTWExtModeInfo *ei, + int_T numSampTimes, + boolean_T *stopReqPtr); + +extern void rtExtModeCheckEndTrigger(void); + +extern void rtExtModeUploadCheckTrigger(int_T numSampTimes); + +extern void rtExtModeUpload(int_T tid, + real_T taskTime); + +extern void rtExtModeCheckInit(int_T numSampTimes); + +extern void rtExtModeShutdown(int_T numSampTimes); + +extern void rtExtModeParseArgs(int_T argc, + const char_T *argv[], + real_T *rtmFinal); + +extern void rtERTExtModeSetTFinal(real_T *rtmTFinal); +extern void rtSetTFinalForExtMode(real_T *rtmTFinal); + +extern void rtParseArgsForExtMode(int_T argc, + const char_T *argv[]); + +extern void rtERTExtModeStartMsg(void); + +#else /* #ifdef EXTMODE */ + +#if defined(VXWORKS) + #define rtExtModeTornadoStartup(ei, \ + numSampTimes, \ + stopReqPtr, \ + priority, \ + stack_size, \ + startStopSem) /* do nothing */ + #define rtExtModeTornadoCleanup(numSampTimes); /* do nothing */ + #define rtExtModeTornadoSetPortInExtUD(port); /* do nothing */ +#elif defined(C6000_EXT_MODE) + #define rtExtModePauseIfNeeded(ei,st,sr) /* do nothing */ + #define rtExtModeWaitForStartPkt(ei,st,sr) /* do nothing */ +#else + #define rtExtModePauseIfNeeded(ei,st,sr) /* do nothing */ + #define rtExtModeWaitForStartPkt(ei,st,sr) /* do nothing */ +#endif /* #ifdef VXWORKS */ + +#define rtExtModeOneStep(ei,st,sr) /* do nothing */ +#define rtExtModeCheckEndTrigger() /* do nothing */ +#define rtExtModeUploadCheckTrigger(numSampTimes) /* do nothing */ +#define rtExtModeUpload(t,ttime) /* do nothing */ +#define rtExtModeCheckInit(numSampTimes) /* do nothing */ +#define rtExtModeShutdown(numSampTimes) /* do nothing */ +#define rtExtModeParseArgs(argc, argv, tf); /* do nothing */ +#define rtERTExtModeSetTFinal(tf); /* do nothing */ +#define rtSetTFinalForExtMode(tf); /* do nothing */ +#define rtParseArgsForExtMode(argc, argv); (void)(argc); \ + (void)(argv); +#define rtERTExtModeStartMsg(); /* do nothing */ + +#endif /* #ifdef EXTMODE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __EXT_WORK_OBJECT__ */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/rt_logging.h b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/rt_logging.h new file mode 100644 index 0000000000000000000000000000000000000000..954f55ee546c30fdad5bda231ea7e566c574c1f5 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/rtw/c/src/rt_logging.h @@ -0,0 +1,290 @@ +/* Copyright 2012-2022 The MathWorks, Inc. */ + +#ifndef rt_logging_h +#define rt_logging_h + +#if defined(_MSC_VER) +# pragma once +#endif +#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) +# pragma once +#endif + +#if !defined(MAT_FILE) || (defined(MAT_FILE) && MAT_FILE == 1) + +#include <stddef.h> /* size_t */ +#include "rtwtypes.h" +#include "builtin_typeid_types.h" +#include "multiword_types.h" +#ifdef IS_RAPID_ACCEL +#include "matrix.h" +#else +#include "rt_mxclassid.h" +#endif +#include "rtw_matlogging.h" + +#ifndef TMW_NAME_LENGTH_MAX +#define TMW_NAME_LENGTH_MAX 64 +#endif +#define mxMAXNAM TMW_NAME_LENGTH_MAX /* maximum name length */ + +/*=========* + * Defines * + *=========*/ + +/* + * Logging related functions and data structures + */ +typedef double MatReal; /* "real" data type used in model.mat */ +typedef struct LogVar_Tag LogVar; +typedef struct StructLogVar_Tag StructLogVar; + +typedef struct MatrixData_Tag { + char_T name[mxMAXNAM]; /* Name of the variable */ + int_T nRows; /* number of rows */ + int_T nCols; /* number of columns */ + int_T nDims; /* number of dimensions */ + int_T _dims[2]; /* most cases, dimensions are 2 */ + int_T *dims; /* dimensions of the log variable we + write to at each simulation time step. + E.g: (1) Non-frame data - + Signal dimension = [2 X 3] + numDims = 2 + dims[0] = 2, dims[1] = 3 + (2) Frame data - + Signal dimension = [2 X 3] + numDims = 1 + dims[0] = 3 */ + void *re; /* pointer to real part of the data */ + void *im; /* pointer to imaginary part, if complex */ + DTypeId dTypeID; /* data type id */ + size_t elSize; /* element size in bytes */ + + RTWLogDataTypeConvert dataTypeConvertInfo; + + mxClassID mxID; /* mxId corresponding to this dTypeID */ + uint32_T logical; /* is this a logical array ? */ + uint32_T complex; /* is this a complex matrix? */ + uint32_T frameData; /* is this data frame based? */ + uint32_T frameSize; /* is this data frame based? */ +} MatrixData; + +typedef struct ValDimsData_Tag { + char_T name[mxMAXNAM]; /* Name of the variable */ + int_T nRows; /* number of rows */ + int_T nCols; /* number of columns */ + void **currSigDims; /* dimensions of current output */ + int_T *currSigDimsSize; /* size in bytes of current sig dims */ + real_T *dimsData; /* pointer to the value of dimension */ +} ValDimsData; + +struct LogVar_Tag { + MatrixData data; /* Container for name, data etc., */ + ValDimsData *valDims; /* field of valueDimensions + 1. If all logging signals are fixed-size, + then we set this field to NULL; + 2. If any logging signal is variable-size, + then this field will be needed: + 1) For fixed-size signal, this field is + an empty matrix; + 2) Otherwise, it contains the dimension + information of the logging signal. + */ + int_T rowIdx; /* current row index */ + int_T wrapped; /* number of times the circular buffer + * has wrapped around */ + int_T nDataPoints; /* total number of data points logged */ + int_T usingDefaultBufSize; /* used to print a message at end */ + int_T okayToRealloc; /* reallocate during sim? */ + int_T decimation; /* decimation factor */ + int_T numHits; /* decimation hit count */ + + int_T *coords; + int_T *strides; + int_T *currStrides; /* coords, strides and currStrides will be + needed when logging variable-size + signal to calculate whether the + currently logging value is in the range. + If the current signal is fixed-size, + these pointers will be set to NULLs; + otherwise, we allocate memory for them. + (the size will be nDims in this case) + */ + + LogVar *next; +}; + +typedef struct SignalsStruct_Tag { + int_T numActiveFields; /* number of active fields */ + const char_T *fieldNames; + int_T numSignals; + LogVar *values; + MatrixData *dimensions; + MatrixData *labels; + MatrixData *plotStyles; + MatrixData *titles; + MatrixData *blockNames; + MatrixData *stateNames; + MatrixData *crossMdlRef; + + boolean_T logValueDimensions; /* If there's any variable-size signal + we also should log 'valueDimensions' + field */ + boolean_T *isVarDims; /* is this signal a variable-size signal? */ + +} SignalsStruct; + +struct StructLogVar_Tag { + char_T name[mxMAXNAM]; /* Name of the ML Struct variable */ + int_T numActiveFields; /* number of active fields */ + boolean_T logTime; + void *time; + SignalsStruct signals; + MatrixData *blockName; + + StructLogVar *next; +}; + +#define matUNKNOWN 0 +#define matINT8 1 +#define matUINT8 2 +#define matINT16 3 +#define matUINT16 4 +#define matINT32 5 +#define matUINT32 6 +#define matFLOAT 7 +#define matDOUBLE 9 +#define matINT64 12 +#define matUINT64 13 +#define matMATRIX 14 + +/* status of logging "valueDimensions" field */ +/* + NO_LOGVALDIMS: + No need to log valueDimensions: + All signals are fixed-sized. + + LOGVALDIMS_EMPTYMX: + Signals with mixed dimension modes, + and the signal logged currently + is fixed-sized. So set valueDimensions + field to an empty matrix. + + LOGVALDIMS_VARDIMS: + Signal logged currently is variable-sized. +*/ +typedef enum { + NO_LOGVALDIMS, + LOGVALDIMS_EMPTYMX, + LOGVALDIMS_VARDIMS +} LogValDimsStat; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern mxClassID rt_GetMxIdFromDTypeIdForRSim(BuiltInDTypeId dTypeID); + +extern mxClassID rt_GetMxIdFromDTypeId(BuiltInDTypeId dTypeID); + +extern LogVar *rt_CreateLogVarWithConvert( + RTWLogInfo *li, + const real_T startTime, + const real_T finalTime, + const real_T inStepSize, + const char_T **errStatus, + const char_T *varName, + BuiltInDTypeId inpDataTypeID, + const RTWLogDataTypeConvert *pDataTypeConvertInfo, + int_T logical, + int_T complex, + int_T frameData, + int_T nCols, + int_T nDims, + const int_T *dims, + LogValDimsStat logValDimsStat, + void **currSigDims, + int_T *currSigDimsSize, + int_T maxRows, + int_T decimation, + real_T sampleTime, + int_T appendToLogVarsList); + + +extern LogVar *rt_CreateLogVar(RTWLogInfo *li, + const real_T startTime, + const real_T finalTime, + const real_T inStepSize, + const char_T **errStatus, + const char_T *varName, + BuiltInDTypeId inpDataTypeID, + int_T logical, + int_T complex, + int_T frameData, + int_T nCols, + int_T nDims, + const int_T *dims, + LogValDimsStat logValDimsStat, + void **currSigDims, + int_T *currSigDimsSize, + int_T maxRows, + int_T decimation, + real_T sampleTime, + int_T appendToLogVarsList); + +extern StructLogVar *rt_CreateStructLogVar(RTWLogInfo *li, + const real_T startTime, + const real_T finalTime, + const real_T inStepSize, + const char_T **errStatus, + const char_T *varName, + boolean_T logTime, + int_T maxRows, + int_T decimation, + real_T sampleTime, + const RTWLogSignalInfo *sigInfo, + const char_T *blockName); + + +extern const char_T *rt_StartDataLoggingWithStartTime(RTWLogInfo *li, + const real_T startTime, + const real_T finalTime, + const real_T stepSize, + const char_T **errStatus); + +extern const char_T *rt_StartDataLogging(RTWLogInfo *li, + const real_T finalTime, + const real_T stepSize, + const char_T **errStatus); + +extern void rt_UpdateLogVar(LogVar *var, const void *data, boolean_T isVarDims); + +extern void rt_UpdateStructLogVar(StructLogVar *var, const real_T *t, const void *data); + +extern const char_T *rt_UpdateTXYLogVars(RTWLogInfo *li, time_T *tPtr); +extern const char_T *rt_UpdateTXXFYLogVars(RTWLogInfo *li, time_T *tPtr, boolean_T updateTXY); + +extern void rt_StopDataLoggingImpl(const char_T *file, RTWLogInfo *li, boolean_T isRaccel); + +extern void rt_StopDataLogging(const char_T *file, RTWLogInfo *li); + + +#ifdef __cplusplus +} +#endif + + +#else /*!defined(MAT_FILE) || (defined(MAT_FILE) && MAT_FILE == 1)*/ + +#define rt_StartDataLogging(li, finalTime, stepSize, errStatus) NULL /* do nothing */ +#define rt_UpdateTXYLogVars(li, tPtr) NULL /* do nothing */ +#define rt_StopDataLogging(file, li); /* do nothing */ + +#endif /*!defined(MAT_FILE) || (defined(MAT_FILE) && MAT_FILE == 1)*/ + +#endif /* rt_logging_h */ + +/* LocalWords: curr LOGVALDIMS EMPTYMX VARDIMS + */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/simulink/include/rtw_continuous.h b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/simulink/include/rtw_continuous.h new file mode 100644 index 0000000000000000000000000000000000000000..510f33f9a29bc3fec497ba061e055ad077ffb4e3 --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/simulink/include/rtw_continuous.h @@ -0,0 +1,109 @@ +/* Copyright 1990-2022 The MathWorks, Inc. */ + +/* + * File: rtw_continuous.h + * + * Abstract: + * Type definitions for continuous-time support. + * + */ + +#ifndef RTW_CONTINUOUS_H__ +#define RTW_CONTINUOUS_H__ + +#ifdef MATLAB_MEX_FILE +#include "tmwtypes.h" +#else +#include "rtwtypes.h" +#endif + +/* For models registering MassMatrix */ +typedef enum { + SS_MATRIX_NONE, + SS_MATRIX_CONSTANT, + SS_MATRIX_TIMEDEP, + SS_MATRIX_STATEDEP +} ssMatrixType; + +typedef enum { + SOLVER_MODE_AUTO, /* only occurs in + mdlInitializeSizes/mdlInitializeSampleTimes */ + SOLVER_MODE_SINGLETASKING, + SOLVER_MODE_MULTITASKING +} SolverMode; + +typedef enum { MINOR_TIME_STEP, MAJOR_TIME_STEP } SimTimeStep; + +/* ============================================================================= + * Model methods object + * ============================================================================= + */ +typedef void (*rtMdlInitializeSizesFcn)(void* rtModel); +typedef void (*rtMdlInitializeSampleTimesFcn)(void* rtModel); +typedef void (*rtMdlStartFcn)(void* rtModel); +typedef void (*rtMdlOutputsFcn)(void* rtModel, int_T tid); +typedef void (*rtMdlUpdateFcn)(void* rtModel, int_T tid); +typedef void (*rtMdlDerivativesFcn)(void* rtModel); +typedef void (*rtMdlProjectionFcn)(void* rtModel); +typedef void (*rtMdlMassMatrixFcn)(void* rtModel); +typedef void (*rtMdlForcingFunctionFcn)(void* rtModel); +typedef void (*rtMdlTerminateFcn)(void* rtModel); +#ifdef RT_MALLOC +typedef real_T (*rtMdlDiscreteEventsFcn)(void* pModel, + int_T rtmNumSampTimes, + void* rtmTimingData, + int_T* rtmSampleHitPtr, + int_T* rtmPerTaskSampleHits); +#endif + +typedef struct _RTWRTModelMethodsInfo_tag { + void* rtModelPtr; + rtMdlInitializeSizesFcn rtmInitSizesFcn; + rtMdlInitializeSampleTimesFcn rtmInitSampTimesFcn; + rtMdlStartFcn rtmStartFcn; + rtMdlOutputsFcn rtmOutputsFcn; + rtMdlUpdateFcn rtmUpdateFcn; + rtMdlDerivativesFcn rtmDervisFcn; + rtMdlProjectionFcn rtmProjectionFcn; + rtMdlMassMatrixFcn rtmMassMatrixFcn; + rtMdlForcingFunctionFcn rtmForcingFunctionFcn; + rtMdlTerminateFcn rtmTerminateFcn; +#ifdef RT_MALLOC + rtMdlDiscreteEventsFcn rtmDiscreteEventsFcn; +#endif +} RTWRTModelMethodsInfo; + +#define rtmiSetRTModelPtr(M, rtmp) ((M).rtModelPtr = (rtmp)) +#define rtmiGetRTModelPtr(M) (M).rtModelPtr + +#define rtmiSetInitSizesFcn(M, fp) ((M).rtmInitSizesFcn = ((rtMdlInitializeSizesFcn)(fp))) +#define rtmiSetInitSampTimesFcn(M, fp) \ + ((M).rtmInitSampTimesFcn = ((rtMdlInitializeSampleTimesFcn)(fp))) +#define rtmiSetStartFcn(M, fp) ((M).rtmStartFcn = ((rtMdlStartFcn)(fp))) +#define rtmiSetOutputsFcn(M, fp) ((M).rtmOutputsFcn = ((rtMdlOutputsFcn)(fp))) +#define rtmiSetUpdateFcn(M, fp) ((M).rtmUpdateFcn = ((rtMdlUpdateFcn)(fp))) +#define rtmiSetDervisFcn(M, fp) ((M).rtmDervisFcn = ((rtMdlDerivativesFcn)(fp))) +#define rtmiSetProjectionFcn(M, fp) ((M).rtmProjectionFcn = ((rtMdlProjectionFcn)(fp))) +#define rtmiSetMassMatrixFcn(M, fp) ((M).rtmMassMatrixFcn = ((rtMdlMassMatrixFcn)(fp))) +#define rtmiSetForcingFunctionFcn(M, fp) \ + ((M).rtmForcingFunctionFcn = ((rtMdlForcingFunctionFcn)(fp))) +#define rtmiSetTerminateFcn(M, fp) ((M).rtmTerminateFcn = ((rtMdlTerminateFcn)(fp))) +#ifdef RT_MALLOC +#define rtmiSetDiscreteEventsFcn(M, fp) ((M).rtmDiscreteEventsFcn = ((rtMdlDiscreteEventsFcn)(fp))) +#endif + +#define rtmiInitializeSizes(M) ((*(M).rtmInitSizesFcn)((M).rtModelPtr)) +#define rtmiInitializeSampleTimes(M) ((*(M).rtmInitSampTimesFcn)((M).rtModelPtr)) +#define rtmiStart(M) ((*(M).rtmStartFcn)((M).rtModelPtr)) +#define rtmiOutputs(M, tid) ((*(M).rtmOutputsFcn)((M).rtModelPtr, tid)) +#define rtmiUpdate(M, tid) ((*(M).rtmUpdateFcn)((M).rtModelPtr, tid)) +#define rtmiDerivatives(M) ((*(M).rtmDervisFcn)((M).rtModelPtr)) +#define rtmiProjection(M) ((*(M).rtmProjectionFcn)((M).rtModelPtr)) +#define rtmiMassMatrix(M) ((*(M).rtmMassMatrixFcn)((M).rtModelPtr)) +#define rtmiForcingFunction(M) ((*(M).rtmForcingFunctionFcn)((M).rtModelPtr)) +#define rtmiTerminate(M) ((*(M).rtmTerminateFcn)((M).rtModelPtr)) +#ifdef RT_MALLOC +#define rtmiDiscreteEvents(M, x1, x2, x3, x4) \ + ((*(M).rtmDiscreteEventsFcn)((M).rtModelPtr, (x1), (x2), (x3), (x4))) +#endif +#endif /* __RTW_CONTINUOUS_H__ */ diff --git a/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/simulink/include/rtw_solver.h b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/simulink/include/rtw_solver.h new file mode 100644 index 0000000000000000000000000000000000000000..40e4d9aa9b45a1da31e8f64d7d770ff190ed6afb --- /dev/null +++ b/src/boards/Main/StateMachines/ADAController/run_ADA/R2023a/simulink/include/rtw_solver.h @@ -0,0 +1,292 @@ +/* + * File: rtw_solver.h + * + * Abstract: + * Type definitions for continuous-time solver support. + * + */ + +/* Copyright 1990-2021 The MathWorks, Inc. */ + +#ifndef RTW_SOLVER_H__ +#define RTW_SOLVER_H__ + +#include "rtw_continuous.h" + +/* ============================================================================= + * Solver object + * ============================================================================= + */ +#ifndef NO_FLOATS /* ERT integer-only */ +/* + * Enum for solver tolerance + */ +typedef enum { + SL_SOLVER_TOLERANCE_AUTO = 0, /* Set Automatically by Solver */ + SL_SOLVER_TOLERANCE_LOCAL = 1, /* Set Locally, e.g., by Blocks */ + SL_SOLVER_TOLERANCE_GLOBAL = 2, /* Set Globally, e.g., by Block Diagram */ + SL_SOLVER_TOLERANCE_UNDEFINED = 255 /* Signal uninitialized */ +} SL_SolverToleranceControlFlag_T; + + +/* + * Enum for jacobian method control + */ +typedef enum { + SL_JM_BD_AUTO = 0, + SL_JM_BD_SPARSE_PERTURBATION, + SL_JM_BD_FULL_PERTURBATION, + SL_JM_BD_SPARSE_ANALYTICAL, + SL_JM_BD_FULL_ANALYTICAL +} slJmBdControl; + + +typedef struct _ssSolverInfo_tag { + void* rtModelPtr; + + SimTimeStep* simTimeStepPtr; + void* solverData; + const char_T* solverName; + boolean_T isVariableStepSolver; + boolean_T solverNeedsReset; + SolverMode solverMode; + + time_T solverStopTime; + time_T* stepSizePtr; + time_T minStepSize; + time_T maxStepSize; + time_T fixedStepSize; + + int_T solverShapePreserveControl; + int_T solverMaxConsecutiveMinStep; + int_T maxNumMinSteps; + int_T solverMaxOrder; + real_T solverConsecutiveZCsStepRelTol; + int_T solverMaxConsecutiveZCs; + + int_T solverExtrapolationOrder; + int_T solverNumberNewtonIterations; + + int_T solverRefineFactor; + real_T solverRelTol; + real_T unused_real_T_1; + + real_T** dXPtr; + time_T** tPtr; + + int_T* numContStatesPtr; + real_T** contStatesPtr; + + int_T* numPeriodicContStatesPtr; + int_T** periodicContStateIndicesPtr; + real_T** periodicContStateRangesPtr; + + real_T* zcSignalVector; + uint8_T* zcEventsVector; + uint8_T* zcSignalAttrib; + int_T zcSignalVectorLength; + uint8_T* reserved; + + boolean_T foundContZcEvents; + boolean_T isAtLeftPostOfContZcEvent; + boolean_T isAtRightPostOfContZcEvent; + boolean_T adaptiveZcDetection; + + int_T numZcSignals; + + boolean_T stateProjection; + boolean_T robustResetMethod; /* user's preference */ + boolean_T updateJacobianAtReset; /* S-Fcn request (sticky) */ + boolean_T consistencyChecking; + + ssMatrixType massMatrixType; + int_T massMatrixNzMax; + int_T* massMatrixIr; + int_T* massMatrixJc; + real_T* massMatrixPr; + + const char_T** errStatusPtr; + + RTWRTModelMethodsInfo* modelMethodsPtr; + real_T zcThreshold; + int_T reserved_1; + int_T consecutiveZCsError; + boolean_T CTOutputIncnstWithState; + boolean_T isComputingJacobian; + slJmBdControl solverJacobianMethodControl; + int_T ignoredZcDiagnostic; + int_T maskedZcDiagnostic; + boolean_T isOutputMethodComputed; + int_T maxZcBracketingIterations; + boolean_T isMinorTimeStepWithModeChange; + int_T maxZcPerStep; + real_T** zcSignalPtr; +} ssSolverInfo; + +/* Support old name RTWSolverInfo */ +typedef ssSolverInfo RTWSolverInfo; + +#define rtsiSetRTModelPtr(S, rtmp) ((S)->rtModelPtr = (rtmp)) +#define rtsiGetRTModelPtr(S) (S)->rtModelPtr + +#define rtsiSetSimTimeStepPtr(S, stp) ((S)->simTimeStepPtr = (stp)) +#define rtsiGetSimTimeStepPtr(S) ((S)->simTimeStepPtr) +#define rtsiGetSimTimeStep(S) *((S)->simTimeStepPtr) +#define rtsiSetSimTimeStep(S, st) (*((S)->simTimeStepPtr) = (st)) + +#define rtsiSetSolverData(S, sd) ((S)->solverData = (sd)) +#define rtsiGetSolverData(S) (S)->solverData + +#define rtsiSetSolverName(S, sn) ((S)->solverName = (sn)) +#define rtsiGetSolverName(S) (S)->solverName + +#define rtsiSetVariableStepSolver(S, vs) ((S)->isVariableStepSolver = (vs)) +#define rtsiIsVariableStepSolver(S) (S)->isVariableStepSolver + +#define rtsiSetSolverNeedsReset(S, sn) ((S)->solverNeedsReset = (sn)) +#define rtsiGetSolverNeedsReset(S) (S)->solverNeedsReset + +#define rtsiSetContTimeOutputInconsistentWithStateAtMajorStep(S, sn) \ + ((S)->CTOutputIncnstWithState = (sn)) +#define rtsiGetContTimeOutputInconsistentWithStateAtMajorStep(S) (S)->CTOutputIncnstWithState + +#define rtsiSetBlkStateChange(S, sn) ((S)->CTOutputIncnstWithState = (sn)) +#define rtsiGetBlkStateChange(S) (S)->CTOutputIncnstWithState + +#define rtsiSetBlockStateForSolverChangedAtMajorStep(S, sn) ((S)->solverNeedsReset = (sn)) +#define rtsiGetBlockStateForSolverChangedAtMajorStep(S) (S)->solverNeedsReset + +#define rtsiSetSolverMode(S, sm) ((S)->solverMode = (sm)) +#define rtsiGetSolverMode(S) (S)->solverMode + +#define rtsiSetSolverStopTime(S, st) ((S)->solverStopTime = (st)) +#define rtsiGetSolverStopTime(S) (S)->solverStopTime + +#define rtsiSetStepSizePtr(S, ssp) ((S)->stepSizePtr = (ssp)) +#define rtsiSetStepSize(S, ss) (*((S)->stepSizePtr) = (ss)) +#define rtsiGetStepSize(S) *((S)->stepSizePtr) + +#define rtsiSetMinStepSize(S, ss) (((S)->minStepSize = (ss))) +#define rtsiGetMinStepSize(S) (S)->minStepSize + +#define rtsiSetMaxStepSize(S, ss) ((S)->maxStepSize = (ss)) +#define rtsiGetMaxStepSize(S) (S)->maxStepSize + +#define rtsiSetFixedStepSize(S, ss) ((S)->fixedStepSize = (ss)) +#define rtsiGetFixedStepSize(S) (S)->fixedStepSize + +#define rtsiSetMaxNumMinSteps(S, mns) ((S)->maxNumMinSteps = (mns)) +#define rtsiGetMaxNumMinSteps(S) (S)->maxNumMinSteps + +#define rtsiSetSolverMaxOrder(S, smo) ((S)->solverMaxOrder = (smo)) +#define rtsiGetSolverMaxOrder(S) (S)->solverMaxOrder + +#define rtsiSetSolverJacobianMethodControl(S, smcm) \ + (ssGetSolverInfo(S)->solverJacobianMethodControl = (smcm)) +#define rtsiGetSolverJacobianMethodControl(S) ssGetSolverInfo(S)->solverJacobianMethodControl + +#define rtsiSetSolverShapePreserveControl(S, smcm) \ + (ssGetSolverInfo(S)->solverShapePreserveControl = (smcm)) +#define rtsiGetSolverShapePreserveControl(S) ssGetSolverInfo(S)->solverShapePreserveControl + +#define rtsiSetSolverConsecutiveZCsStepRelTol(S, scr) \ + (ssGetSolverInfo(S)->solverConsecutiveZCsStepRelTol = (scr)) +#define rtsiGetSolverConsecutiveZCsStepRelTol(S) ssGetSolverInfo(S)->solverConsecutiveZCsStepRelTol + +#define rtsiSetSolverMaxConsecutiveZCs(S, smcz) \ + (ssGetSolverInfo(S)->solverMaxConsecutiveZCs = (smcz)) +#define rtsiGetSolverMaxConsecutiveZCs(S) ssGetSolverInfo(S)->solverMaxConsecutiveZCs + +#define rtsiSetSolverMaxConsecutiveMinStep(S, smcm) \ + (ssGetSolverInfo(S)->solverMaxConsecutiveMinStep = (smcm)) +#define rtsiGetSolverMaxConsecutiveMinStep(S) ssGetSolverInfo(S)->solverMaxConsecutiveMinStep + +#define rtsiSetSolverExtrapolationOrder(S, seo) ((S)->solverExtrapolationOrder = (seo)) +#define rtsiGetSolverExtrapolationOrder(S) (S)->solverExtrapolationOrder + +#define rtsiSetSolverNumberNewtonIterations(S, nni) ((S)->solverNumberNewtonIterations = (nni)) +#define rtsiGetSolverNumberNewtonIterations(S) (S)->solverNumberNewtonIterations + +#define rtsiSetSolverRefineFactor(S, smo) ((S)->solverRefineFactor = (smo)) +#define rtsiGetSolverRefineFactor(S) (S)->solverRefineFactor + +#define rtsiSetSolverRelTol(S, smo) ((S)->solverRelTol = (smo)) +#define rtsiGetSolverRelTol(S) (S)->solverRelTol + +#define rtsiSetSolverMassMatrixType(S, type) ((S)->massMatrixType = (type)) +#define rtsiGetSolverMassMatrixType(S) (S)->massMatrixType + +#define rtsiSetSolverMassMatrixNzMax(S, nzMax) ((S)->massMatrixNzMax = (nzMax)) +#define rtsiGetSolverMassMatrixNzMax(S) (S)->massMatrixNzMax + +#define rtsiSetSolverMassMatrixIr(S, ir) ((S)->massMatrixIr = (ir)) +#define rtsiGetSolverMassMatrixIr(S) (S)->massMatrixIr + +#define rtsiSetSolverMassMatrixJc(S, jc) ((S)->massMatrixJc = (jc)) +#define rtsiGetSolverMassMatrixJc(S) (S)->massMatrixJc + +#define rtsiSetSolverMassMatrixPr(S, pr) ((S)->massMatrixPr = (pr)) +#define rtsiGetSolverMassMatrixPr(S) (S)->massMatrixPr + +#define rtsiSetdXPtr(S, dxp) ((S)->dXPtr = (dxp)) +#define rtsiSetdX(S, dx) (*((S)->dXPtr) = (dx)) +#define rtsiGetdX(S) *((S)->dXPtr) + +#define rtsiSetTPtr(S, tp) ((S)->tPtr = (tp)) +#define rtsiSetT(S, t) ((*((S)->tPtr))[0] = (t)) +#define rtsiGetT(S) (*((S)->tPtr))[0] + +#define rtsiSetContStatesPtr(S, cp) ((S)->contStatesPtr = (cp)) +#define rtsiGetContStates(S) *((S)->contStatesPtr) + +#define rtsiSetNumContStatesPtr(S, cp) ((S)->numContStatesPtr = (cp)) +#define rtsiGetNumContStates(S) *((S)->numContStatesPtr) + +#define rtsiSetNumPeriodicContStatesPtr(S, cp) ((S)->numPeriodicContStatesPtr = (cp)) +#define rtsiGetNumPeriodicContStates(S) *((S)->numPeriodicContStatesPtr) + +#define rtsiSetPeriodicContStateIndicesPtr(S, cp) ((S)->periodicContStateIndicesPtr = (cp)) +#define rtsiGetPeriodicContStateIndices(S) *((S)->periodicContStateIndicesPtr) + +#define rtsiSetPeriodicContStateRangesPtr(S, cp) ((S)->periodicContStateRangesPtr = (cp)) +#define rtsiGetPeriodicContStateRanges(S) *((S)->periodicContStateRangesPtr) + +#define rtsiSetErrorStatusPtr(S, esp) ((S)->errStatusPtr = (esp)) +#define rtsiSetErrorStatus(S, es) (*((S)->errStatusPtr) = (es)) +#define rtsiGetErrorStatus(S) *((S)->errStatusPtr) + +#define rtsiSetModelMethodsPtr(S, mmp) ((S)->modelMethodsPtr = (mmp)) +#define rtsiGetModelMethodsPtr(S) (S)->modelMethodsPtr + +#define rtsiSetSolverComputingJacobian(S, val) ((S)->isComputingJacobian = (val)) +#define rtsiIsSolverComputingJacobian(S) (S)->isComputingJacobian + +#define rtsiSetSolverOutputComputed(S, val) ((S)->isOutputMethodComputed = (val)) +#define rtsiIsSolverOutputComputed(S) (S)->isOutputMethodComputed + +#define rtsiSetIsMinorTimeStepWithModeChange(S, sn) ((S)->isMinorTimeStepWithModeChange = (sn)) +#define rtsiGetIsMinorTimeStepWithModeChange(S) (S)->isMinorTimeStepWithModeChange + +#define rtsiIsModeUpdateTimeStep(S) \ + (rtsiGetSimTimeStep(S) == MAJOR_TIME_STEP || rtsiGetIsMinorTimeStepWithModeChange(S)) + +#define rtsiSetSolverZcSignalPtr(S, zcp) ((S)->zcSignalPtr = (zcp)) +#define rtsiSetSolverZcSignalVector(S, zcp) (*((S)->zcSignalPtr) = (zcp)) +#define rtsiGetSolverZcSignalVector(S) *((S)->zcSignalPtr) + + +#define rtsiSetSolverZcEventsVector(S, ptr) ((S)->zcEventsVector = (ptr)) +#define rtsiGetSolverZcEventsVector(S) ((S)->zcEventsVector) + +#define rtsiSetSolverZcSignalAttrib(S, ptr) ((S)->zcSignalAttrib = (ptr)) +#define rtsiGetSolverZcSignalAttrib(S) ((S)->zcSignalAttrib) + +#define rtsiSetSolverZcSignalVectorLength(S, n) ((S)->zcSignalVectorLength = (n)) +#define rtsiGetSolverZcSignalVectorLength(S) ((S)->zcSignalVectorLength) + +#define rtsiSetSolverFoundContZcEvents(S, val) ((S)->foundContZcEvents = (val)) +#define rtsiGetSolverFoundContZcEvents(S) ((S)->foundContZcEvents) + +#endif /* !NO_FLOATS */ + +#endif /* RTW_SOLVER_H__ */