60 lines
2.0 KiB
C++
60 lines
2.0 KiB
C++
/*
|
|
* Code generation for system model 'PWMGenerator'
|
|
*
|
|
* Model : PWMGenerator
|
|
* Model version : 1.7
|
|
* Simulink Coder version : 24.1 (R2024a) 19-Nov-2023
|
|
* C++ source code generated on : Wed Oct 16 10:45:22 2024
|
|
*
|
|
* Note that the functions contained in this file are part of a Simulink
|
|
* model, and are not self-contained algorithms.
|
|
*/
|
|
|
|
#include "PWMGenerator.h"
|
|
#include "rtwtypes.h"
|
|
#include "PWMGenerator_cal.h"
|
|
#include "PWMGenerator_private.h"
|
|
|
|
/* Output and update for referenced model: 'PWMGenerator' */
|
|
void PWMGenerator(const real_T *rtu_Ondaobjetivo, const real_T
|
|
*rtu_Ondaportadora, const real_T *rtu_Amplitud, real_T
|
|
*rty_SealPWM, real_T *rty_MonitoreoPortadoraAmp, real_T
|
|
*rty_MonitoreoPWMAmp1, B_PWMGenerator_c_T *localB)
|
|
{
|
|
/* Product: '<Root>/Amplificación portadora' */
|
|
*rty_MonitoreoPortadoraAmp = *rtu_Ondaportadora * *rtu_Amplitud;
|
|
|
|
/* DataTypeConversion: '<Root>/Fijación Double' */
|
|
localB->FijacinDouble = *rtu_Ondaobjetivo;
|
|
|
|
/* RelationalOperator: '<Root>/PWM' */
|
|
localB->PWM = (localB->FijacinDouble >= *rty_MonitoreoPortadoraAmp);
|
|
|
|
/* DataTypeConversion: '<Root>/Fijación Double PWM' */
|
|
*rty_MonitoreoPWMAmp1 = localB->PWM;
|
|
|
|
/* Sum: '<Root>/Sum1' incorporates:
|
|
* Constant: '<Root>/Constant3'
|
|
*/
|
|
localB->Sum1 = *rty_MonitoreoPWMAmp1 - PWMGenerator_cal->Constant3_Value;
|
|
|
|
/* Product: '<Root>/Simetrización PWM' incorporates:
|
|
* Constant: '<Root>/Constant4'
|
|
*/
|
|
*rty_SealPWM = localB->Sum1 * PWMGenerator_cal->Constant4_Value;
|
|
}
|
|
|
|
/* Model initialize function */
|
|
void PWMGenerator_initialize(const char_T **rt_errorStatus,
|
|
RT_MODEL_PWMGenerator_T *const PWMGenerator_M, B_PWMGenerator_c_T *localB)
|
|
{
|
|
/* Registration code */
|
|
|
|
/* initialize error status */
|
|
rtmSetErrorStatusPointer(PWMGenerator_M, rt_errorStatus);
|
|
|
|
/* block I/O */
|
|
(void) std::memset((static_cast<void *>(localB)), 0,
|
|
sizeof(B_PWMGenerator_c_T));
|
|
}
|