Сделана документация на то, что есть сейчас

This commit is contained in:
2024-10-16 16:03:37 +03:00
parent 6a08b0462d
commit 8939ab257f
750 changed files with 10725 additions and 350180 deletions

View File

@@ -1,17 +1,40 @@
/**
**************************************************************************
* @file MCU.c
* @brief Исходный код S-Function.
**************************************************************************
@details
Данный файл содержит функции S-Function, который вызывает MATLAB.
**************************************************************************
@note
Описание функций по большей части сгенерировано MATLAB'ом, поэтому на английском
**************************************************************************/
/**
* @addtogroup WRAPPER_SFUNC S-Function funtions
* @ingroup MCU_WRAPPER
* @brief Дефайны и функции блока S-Function
* @details Здесь собраны функции, с которыми непосредственно работает S-Function
* @note Описание функций по большей части сгенерировано MATLAB'ом, поэтому на английском
* @{
*/
#define S_FUNCTION_NAME MCU
#define S_FUNCTION_LEVEL 2
#include "mcu_wrapper_conf.h"
#define MDL_UPDATE
/* Function: mdlUpdate ====================================================
* Abstract:
#define MDL_UPDATE ///< для подключения mdlUpdate()
/**
* @brief Update S-Function at every step of simulation
* @param S - pointer to S-Function (library struct from "simstruc.h")
* @details Abstract:
* This function is called once for every major integration time step.
* Discrete states are typically updated here, but this function is useful
* for performing any tasks that should only take place once per
* integration step.
*/
static void mdlUpdate(SimStruct *S, int_T tid)
static void mdlUpdate(SimStruct *S)
{
// get time of simulation
time_T TIME = ssGetT(S);
@@ -21,13 +44,15 @@ static void mdlUpdate(SimStruct *S, int_T tid)
//------------------------------------------
}//end mdlUpdate
/* Function: mdlOutputs ===================================================
* Abstract:
/**
* @brief Writting outputs of S-Function
* @param S - pointer to S-Function (library struct from "simstruc.h")
* @details Abstract:
* In this function, you compute the outputs of your S-function
* block. Generally outputs are placed in the output vector(s),
* ssGetOutputPortSignal.
*/
static void mdlOutputs(SimStruct *S, int_T tid)
static void mdlOutputs(SimStruct *S)
{
SIM_writeOutputs(S);
}//end mdlOutputs
@@ -117,8 +142,10 @@ static void mdlInitializeSizes(SimStruct *S)
#define MDL_START /* Change to #undef to remove function */
#if defined(MDL_START)
/* Function: mdlStart =====================================================
* Abstract:
/**
* @brief Initialize S-Function at start of simulation
* @param S - pointer to S-Function (library struct from "simstruc.h")
* @details Abstract:
* This function is called once at start of model execution. If you
* have states that should be initialized once, this is the place
* to do it.
@@ -129,8 +156,10 @@ static void mdlStart(SimStruct *S)
}
#endif // MDL_START
/* Function: mdlInitializeSampleTimes =========================================
* Abstract:
/**
* @brief Initialize Sample Time of Simulation
* @param S - pointer to S-Function (library struct from "simstruc.h")
* @details Abstract:
* This function is used to specify the sample time(s) for your
* S-function. You must register the same number of sample times as
* specified in ssSetNumSampleTimes.
@@ -145,20 +174,28 @@ static void mdlInitializeSampleTimes(SimStruct *S)
ssSetOffsetTime(S, 0, 0.0);
}
/* Function: mdlTerminate =====================================================
* Abstract:
/**
* @brief Terminate S-Function at the end of simulation
* @param S - pointer to S-Function (library struct from "simstruc.h")
* @details Abstract:
* In this function, you should perform any actions that are necessary
* at the termination of a simulation. For example, if memory was
* allocated in mdlStart, this is the place to free it.
*/
static void mdlTerminate(SimStruct *S)
{
hmcu.MCU_Stop = 1;
hmcu.fMCU_Stop = 1;
ResumeThread(hmcu.hMCUThread);
WaitForSingleObject(hmcu.hMCUThread, 10000);
SIM_deInitialize_Simulation();
mexUnlock();
}
/** WRAPPER_SFUNC
* @}
*/
#ifdef MATLAB_MEX_FILE /* Is this file being compiled as a
MEX-file? */
#include "simulink.c" /* MEX-file interface mechanism */