ADM/[ADM] Integrated Logic/ADM_Integrated_Logic_ert_rtw/ADM_Integrated_Logic.h
3minbe 8412b85796 ver 25.10.15.1
- 1채널 DBC 수정
  : 0x140
  : EstMass 신호 Length 수정(15 → 14)
  : EstMassFlag 신호 Length 수정(1 → 2)
  : EstMassFlag 신호 Value Table 추가
- DBC 수정에 따른 can.c 및 관련 변수 수정
- 질량 추정 로직 개선
  : R 행렬 중 Ax 분산 실차 데이터 적용
  : Flag 신호 개선
2025-10-15 21:04:46 +09:00

332 lines
19 KiB
C

/*
* 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.
*
* File: ADM_Integrated_Logic.h
*
* Code generated for Simulink model 'ADM_Integrated_Logic'.
*
* Model version : 14.42
* Simulink Coder version : 24.2 (R2024b) 21-Jun-2024
* C/C++ source code generated on : Wed Oct 15 20:57:40 2025
*
* Target selection: ert.tlc
* Embedded hardware selection: NXP->Cortex-M4
* Code generation objectives:
* 1. Execution efficiency
* 2. RAM efficiency
* 3. Debugging
* Validation result: Not run
*/
#ifndef ADM_Integrated_Logic_h_
#define ADM_Integrated_Logic_h_
#ifndef ADM_Integrated_Logic_COMMON_INCLUDES_
#define ADM_Integrated_Logic_COMMON_INCLUDES_
#include <stdbool.h>
#include <stdint.h>
#endif /* ADM_Integrated_Logic_COMMON_INCLUDES_ */
/* 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
/* Forward declaration for rtModel */
typedef struct tag_RTM_ADM_Integrated_Logic_T RT_MODEL_ADM_Integrated_Logic_T;
/* Block signals and states (default storage) for system '<Root>' */
typedef struct {
double Delay_DSTATE_c[2]; /* '<S49>/Delay' */
double Delay3_DSTATE[2]; /* '<S49>/Delay3' */
double Delay_DSTATE_p[2]; /* '<S41>/Delay' */
double Delay3_DSTATE_h[2]; /* '<S41>/Delay3' */
double x_hat[3]; /* '<S1>/MATLAB Function' */
double M; /* '<S10>/MATLAB Function' */
double d1_DSTATE; /* '<S14>/d1' */
double d_DSTATE; /* '<S14>/d' */
double DiscreteTimeIntegrator_DSTATE;/* '<S26>/Discrete-Time Integrator' */
double UD_DSTATE; /* '<S29>/UD' */
double Memory_DSTATE; /* '<S11>/Memory' */
double DiscreteTransferFcn_states; /* '<S1>/Discrete Transfer Fcn' */
double Integrator_2_DSTATE; /* '<S12>/Integrator_2' */
double Delay_DSTATE; /* '<S62>/Delay' */
double Delay_DSTATE_i; /* '<S61>/Delay' */
double d1_DSTATE_c; /* '<S35>/d1' */
double d_DSTATE_l; /* '<S35>/d' */
double d_DSTATE_i; /* '<S45>/d' */
double d1_DSTATE_p; /* '<S45>/d1' */
double d_DSTATE_c; /* '<S46>/d' */
double d1_DSTATE_h; /* '<S46>/d1' */
double d_DSTATE_d; /* '<S47>/d' */
double d1_DSTATE_l; /* '<S47>/d1' */
double Delay1_DSTATE; /* '<S49>/Delay1' */
double Delay2_DSTATE; /* '<S49>/Delay2' */
double d1_DSTATE_e; /* '<S48>/d1' */
double d_DSTATE_ij; /* '<S48>/d' */
double d_DSTATE_ir; /* '<S37>/d' */
double d1_DSTATE_o; /* '<S37>/d1' */
double d_DSTATE_m; /* '<S38>/d' */
double d1_DSTATE_hm; /* '<S38>/d1' */
double d_DSTATE_mw; /* '<S39>/d' */
double d1_DSTATE_g; /* '<S39>/d1' */
double d1_DSTATE_ej; /* '<S40>/d1' */
double d_DSTATE_j; /* '<S40>/d' */
double Delay1_DSTATE_c; /* '<S41>/Delay1' */
double Delay2_DSTATE_n; /* '<S41>/Delay2' */
double d1_DSTATE_ob; /* '<S56>/d1' */
double d_DSTATE_e; /* '<S56>/d' */
double d1_DSTATE_i; /* '<S57>/d1' */
double d_DSTATE_p; /* '<S57>/d' */
double d1_DSTATE_o1; /* '<S58>/d1' */
double d_DSTATE_n; /* '<S58>/d' */
double Integrator_1_DSTATE; /* '<S12>/Integrator_1' */
double d1_DSTATE_a; /* '<S59>/d1' */
double d_DSTATE_d1; /* '<S59>/d' */
double Delay_DSTATE_c4; /* '<S23>/Delay' */
double Delay_DSTATE_i1; /* '<S24>/Delay' */
double PrevY; /* '<S2>/Rate Limiter' */
double PrevY_o; /* '<S7>/Brake_Out_RateLimiter' */
double PrevY_a; /* '<S25>/Input_Vx_RateLimiter' */
double PrevY_ak; /* '<S7>/TargetSpd_RateLimiter' */
double Memory_PreviousInput; /* '<S7>/Memory' */
double prev_EstMass; /* '<S1>/MATLAB Function3' */
double HAC_ON_FLAG; /* '<S12>/HAC_OFF_OK_Func' */
double Smoothed_Torque; /* '<S12>/HAC_OFF_OK_Func' */
double HAC_Desired_Torque; /* '<S12>/HAC_OFF_OK_Func' */
double HAC_ON_Timer; /* '<S12>/HAC_OFF_OK_Func' */
uint8_t is_active_c6_ADM_Integrated_Log;/* '<S12>/Chart' */
uint8_t is_c6_ADM_Integrated_Logic; /* '<S12>/Chart' */
bool icLoad; /* '<S62>/Delay' */
bool icLoad_e; /* '<S61>/Delay' */
bool icLoad_l; /* '<S23>/Delay' */
bool icLoad_d; /* '<S24>/Delay' */
bool prev_EstMass_not_empty; /* '<S1>/MATLAB Function3' */
} DW_ADM_Integrated_Logic_T;
/* Invariant block signals (default storage) */
typedef struct {
const double W_value; /* '<S55>/Multiply' */
const double W_Value_for_Brake; /* '<S55>/Multiply4' */
} ConstB_ADM_Integrated_Logic_T;
/* External inputs (root inport signals with default storage) */
typedef struct {
double GV_MCU_RPM; /* '<Root>/GV_MCU_RPM' */
double GV_BrakeTorqueCommand; /* '<Root>/GV_BrakeTorqueCommand' */
double GV_IMU_AX_Val; /* '<Root>/GV_IMU_AX_Val' */
double GV_IMU_AY_Val; /* '<Root>/GV_IMU_AY_Val' */
double GV_IMU_AZ_Val; /* '<Root>/GV_IMU_AZ_Val' */
double GV_IMU_PitchRtVal; /* '<Root>/GV_IMU_PitchRtVal' */
double GV_Vx_Command; /* '<Root>/GV_Vx_Command' */
double GV_VCU_GearSelStat; /* '<Root>/GV_VCU_GearSelStat' */
double GV_MCU_EstTrq; /* '<Root>/GV_MCU_EstTrq' */
double GV_Vx_Limit; /* '<Root>/GV_Vx_Limit' */
double GV_Vx_Fbk; /* '<Root>/GV_Vx_Fbk' */
double GV_RWA_RackAngleCommand; /* '<Root>/GV_RWA_RackAngleCommand' */
double GV_RWS_RackAngleCommand; /* '<Root>/GV_RWS_RackAngleCommand' */
double GV_Drive_Mode; /* '<Root>/GV_Drive_Mode' */
double GV_ACU_Fault_Flag; /* '<Root>/GV_ACU_Fault_Flag' */
double GV_MCU_Actuator_Fault_Flag; /* '<Root>/GV_MCU_Actuator_Fault_Flag' */
double GV_IDB_ECU_Fault_Flag; /* '<Root>/GV_IDB_ECU_Fault_Flag' */
double GV_RCU_ECU_Fault_Flag; /* '<Root>/GV_RCU_ECU_Fault_Flag' */
double GV_RWA1_ECU_Fault_Flag; /* '<Root>/GV_RWA1_ECU_Fault_Flag' */
double GV_RWA2_ECU_Fault_Flag; /* '<Root>/GV_RWA2_ECU_Fault_Flag' */
double GV_RWA_Actuator_Fault; /* '<Root>/GV_RWA_Actuator_Fault' */
double GV_ACU_ECU_Fault_Flag; /* '<Root>/GV_ACU_ECU_Fault_Flag' */
double GV_ACU_ECU_Fault_Flag1; /* '<Root>/GV_ACU_ECU_Fault_Flag1' */
double GV_ACU_ECU_Fault_Flag2; /* '<Root>/GV_ACU_ECU_Fault_Flag2' */
double GV_ACU_ECU_Fault_Flag3; /* '<Root>/GV_ACU_ECU_Fault_Flag3' */
double GV_Drive_ACC_Cmd; /* '<Root>/GV_Drive_ACC_Cmd' */
double GV_VCU_AccControlFlag; /* '<Root>/GV_VCU_AccControlFlag' */
double GV_VCU_Acc_Limit; /* '<Root>/GV_VCU_Acc_Limit' */
} ExtU_ADM_Integrated_Logic_T;
/* External outputs (root outports fed by signals with default storage) */
typedef struct {
double GV_Brake_Command; /* '<Root>/GV_Brake_Command' */
double GV_Master_Rack_Angle_Cmd; /* '<Root>/GV_Master_Rack_Angle_Cmd' */
double GV_Hill_Torque_Assist; /* '<Root>/GV_Hill_Torque_Assist' */
double GV_Motor_Torque_Cmd; /* '<Root>/GV_Motor_Torque_Cmd' */
double Debug_HAC_FLAG; /* '<Root>/Debug_HAC_FLAG' */
double Debug_HAC_RPM_Decision; /* '<Root>/Debug_HAC_RPM_Decision' */
double Debug_HAC_Pitch_angle; /* '<Root>/Debug_HAC_Pitch_angle' */
double Debug_HAC_Brake_Output; /* '<Root>/Debug_HAC_Brake_Output' */
double Debug_CC_Brake_Output; /* '<Root>/Debug_CC_Brake_Output' */
double GV_RWS_RackAngleCmd1; /* '<Root>/GV_RWS_RackAngleCmd1' */
double GV_Speed_Limit; /* '<Root>/GV_Speed_Limit' */
double GV_Gear_Postion_Out; /* '<Root>/GV_Gear_Postion_Out' */
double Act_Fault_Exist; /* '<Root>/Act_Fault_Exist' */
double Target_RWA_Out; /* '<Root>/Target_RWA_Out' */
double Target_IDB_Out; /* '<Root>/Target_IDB_Out' */
double Target_MCU_Out; /* '<Root>/Target_MCU_Out' */
double GV_VCU_EstMass; /* '<Root>/GV_VCU_EstMass' */
double GV_VCU_EstMassFlag; /* '<Root>/GV_VCU_EstMassFlag' */
} ExtY_ADM_Integrated_Logic_T;
/* Real-time Model Data Structure */
struct tag_RTM_ADM_Integrated_Logic_T {
const char * volatile errorStatus;
};
/* Block signals and states (default storage) */
extern DW_ADM_Integrated_Logic_T ADM_Integrated_Logic_DW;
/* External inputs (root inport signals with default storage) */
extern ExtU_ADM_Integrated_Logic_T ADM_Integrated_Logic_U;
/* External outputs (root outports fed by signals with default storage) */
extern ExtY_ADM_Integrated_Logic_T ADM_Integrated_Logic_Y;
extern const ConstB_ADM_Integrated_Logic_T ADM_Integrated_Logic_ConstB;/* constant block i/o */
/* Model entry point functions */
extern void ADM_Integrated_Logic_initialize(void);
extern void ADM_Integrated_Logic_step(void);
/* Real-time Model object */
extern RT_MODEL_ADM_Integrated_Logic_T *const ADM_Integrated_Logic_M;
/*-
* These blocks were eliminated from the model due to optimizations:
*
* Block '<S29>/Data Type Duplicate' : Unused code path elimination
* Block '<S28>/Data Type Duplicate' : Unused code path elimination
* Block '<S28>/Data Type Propagation' : Unused code path elimination
* Block '<S32>/BW_PI' : Unused code path elimination
* Block '<S32>/Constant1' : Unused code path elimination
* Block '<S32>/Constant16' : Unused code path elimination
* Block '<S32>/Constant17' : Unused code path elimination
* Block '<S32>/Constant2' : Unused code path elimination
* Block '<S55>/Brake_Saturation' : Unused code path elimination
* Block '<S55>/Multiply5' : Unused code path elimination
* Block '<S55>/Radius1' : Unused code path elimination
* Block '<S61>/FixPt Data Type Duplicate' : Unused code path elimination
* Block '<S66>/Data Type Duplicate' : Unused code path elimination
* Block '<S66>/Data Type Propagation' : Unused code path elimination
* Block '<S62>/FixPt Data Type Duplicate' : Unused code path elimination
* Block '<S67>/Data Type Duplicate' : Unused code path elimination
* Block '<S67>/Data Type Propagation' : Unused code path elimination
* Block '<S12>/Scope2' : Unused code path elimination
* Block '<S23>/FixPt Data Type Duplicate' : Unused code path elimination
* Block '<S68>/Data Type Duplicate' : Unused code path elimination
* Block '<S68>/Data Type Propagation' : Unused code path elimination
* Block '<S24>/FixPt Data Type Duplicate' : Unused code path elimination
* Block '<S69>/Data Type Duplicate' : Unused code path elimination
* Block '<S69>/Data Type Propagation' : Unused code path elimination
* Block '<S7>/ControlFlag' : Eliminated nontunable gain of 1
* Block '<S32>/FBGain' : Eliminated nontunable gain of 1
* Block '<S43>/FFGain' : Eliminated nontunable gain of 1
* Block '<S1>/Data Type Conversion1' : Eliminate redundant data type conversion
* Block '<S1>/Data Type Conversion3' : Eliminate redundant data type conversion
* Block '<S55>/HAC_Gain' : Eliminated nontunable gain of 1
* Block '<S61>/Zero-Order Hold' : Eliminated since input and output rates are identical
* Block '<S62>/Zero-Order Hold' : Eliminated since input and output rates are identical
* Block '<S23>/Zero-Order Hold' : Eliminated since input and output rates are identical
* Block '<S24>/Zero-Order Hold' : Eliminated since input and output rates are identical
*/
/*-
* 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.
*
* Use the MATLAB hilite_system command to trace the generated code back
* to the model. For example,
*
* hilite_system('<S3>') - opens system 3
* hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
*
* Here is the system hierarchy for this model
*
* '<Root>' : 'ADM_Integrated_Logic'
* '<S1>' : 'ADM_Integrated_Logic/Delivery_Mobility'
* '<S2>' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control'
* '<S3>' : 'ADM_Integrated_Logic/Delivery_Mobility/Actuator_Fault_Decision'
* '<S4>' : 'ADM_Integrated_Logic/Delivery_Mobility/Compare To Constant'
* '<S5>' : 'ADM_Integrated_Logic/Delivery_Mobility/Compare To Constant1'
* '<S6>' : 'ADM_Integrated_Logic/Delivery_Mobility/Compare To Constant2'
* '<S7>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1'
* '<S8>' : 'ADM_Integrated_Logic/Delivery_Mobility/Emergency_Brake_Func'
* '<S9>' : 'ADM_Integrated_Logic/Delivery_Mobility/Emergency_Motor_Func'
* '<S10>' : 'ADM_Integrated_Logic/Delivery_Mobility/Enabled Subsystem'
* '<S11>' : 'ADM_Integrated_Logic/Delivery_Mobility/Gear_Position'
* '<S12>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1'
* '<S13>' : 'ADM_Integrated_Logic/Delivery_Mobility/IDB_Fault_Injection'
* '<S14>' : 'ADM_Integrated_Logic/Delivery_Mobility/LPFM5'
* '<S15>' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function'
* '<S16>' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function1'
* '<S17>' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function2'
* '<S18>' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function3'
* '<S19>' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function5'
* '<S20>' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function6'
* '<S21>' : 'ADM_Integrated_Logic/Delivery_Mobility/MCU_Fault_Injection'
* '<S22>' : 'ADM_Integrated_Logic/Delivery_Mobility/RWA_Actuator_Fault_Injection'
* '<S23>' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic'
* '<S24>' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic1'
* '<S25>' : 'ADM_Integrated_Logic/Delivery_Mobility/Vx_Logic'
* '<S26>' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/Controller'
* '<S27>' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/MATLAB Function'
* '<S28>' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/Saturation Dynamic'
* '<S29>' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/Controller/Discrete Derivative'
* '<S30>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB'
* '<S31>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB_Gain'
* '<S32>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller'
* '<S33>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/GearCondition_Brake'
* '<S34>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/Gear_pos_out'
* '<S35>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/LPFM'
* '<S36>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/Target_RPM'
* '<S37>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Dot3'
* '<S38>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Dot4'
* '<S39>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Dot5'
* '<S40>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/LPFM'
* '<S41>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Second order LPF'
* '<S42>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FB'
* '<S43>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF'
* '<S44>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FB/P'
* '<S45>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Dot'
* '<S46>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Dot2'
* '<S47>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Dot3'
* '<S48>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/LPFM'
* '<S49>' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Second order LPF'
* '<S50>' : 'ADM_Integrated_Logic/Delivery_Mobility/Enabled Subsystem/MATLAB Function'
* '<S51>' : 'ADM_Integrated_Logic/Delivery_Mobility/Gear_Position/Compare To Constant'
* '<S52>' : 'ADM_Integrated_Logic/Delivery_Mobility/Gear_Position/Gear_FUNCTION1'
* '<S53>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Chart'
* '<S54>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/HAC_OFF_OK_Func'
* '<S55>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2'
* '<S56>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM'
* '<S57>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM1'
* '<S58>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM2'
* '<S59>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM3'
* '<S60>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Pitch_calculate'
* '<S61>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic'
* '<S62>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic1'
* '<S63>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2/Calculate_F_R'
* '<S64>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2/Calculate_F_c'
* '<S65>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2/Calculate_F_c1'
* '<S66>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic/Saturation Dynamic'
* '<S67>' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic1/Saturation Dynamic'
* '<S68>' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic/Saturation Dynamic'
* '<S69>' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic1/Saturation Dynamic'
* '<S70>' : 'ADM_Integrated_Logic/Delivery_Mobility/Vx_Logic/Compare To Constant'
* '<S71>' : 'ADM_Integrated_Logic/Delivery_Mobility/Vx_Logic/Vx_OutPut_Function'
*/
/*-
* Requirements for '<Root>': ADM_Integrated_Logic
*/
#endif /* ADM_Integrated_Logic_h_ */
/*
* File trailer for generated code.
*
* [EOF]
*/