/* * 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.2 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Tue Mar 10 17:51:08 2026 * * 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 #include #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 '' */ typedef struct { double Delay_DSTATE_c[2]; /* '/Delay' */ double Delay3_DSTATE[2]; /* '/Delay3' */ double Delay_DSTATE_p[2]; /* '/Delay' */ double Delay3_DSTATE_h[2]; /* '/Delay3' */ double x_hat[3]; /* '/MATLAB Function' */ double M; /* '/MATLAB Function' */ double d1_DSTATE; /* '/d1' */ double d_DSTATE; /* '/d' */ double Integrator_2_DSTATE; /* '/Integrator_2' */ double Delay_DSTATE; /* '/Delay' */ double Delay_DSTATE_i; /* '/Delay' */ double Memory_DSTATE; /* '/Memory' */ double DiscreteTimeIntegrator_DSTATE;/* '/Discrete-Time Integrator' */ double UD_DSTATE; /* '/UD' */ double DiscreteTransferFcn_states; /* '/Discrete Transfer Fcn' */ double d1_DSTATE_c; /* '/d1' */ double d_DSTATE_l; /* '/d' */ double d_DSTATE_i; /* '/d' */ double d1_DSTATE_p; /* '/d1' */ double d_DSTATE_c; /* '/d' */ double d1_DSTATE_h; /* '/d1' */ double d_DSTATE_d; /* '/d' */ double d1_DSTATE_l; /* '/d1' */ double Delay1_DSTATE; /* '/Delay1' */ double Delay2_DSTATE; /* '/Delay2' */ double d1_DSTATE_e; /* '/d1' */ double d_DSTATE_ij; /* '/d' */ double d_DSTATE_ir; /* '/d' */ double d1_DSTATE_o; /* '/d1' */ double d_DSTATE_m; /* '/d' */ double d1_DSTATE_hm; /* '/d1' */ double d_DSTATE_mw; /* '/d' */ double d1_DSTATE_g; /* '/d1' */ double d1_DSTATE_ej; /* '/d1' */ double d_DSTATE_j; /* '/d' */ double Delay1_DSTATE_c; /* '/Delay1' */ double Delay2_DSTATE_n; /* '/Delay2' */ double d1_DSTATE_ob; /* '/d1' */ double d_DSTATE_e; /* '/d' */ double d1_DSTATE_i; /* '/d1' */ double d_DSTATE_p; /* '/d' */ double d1_DSTATE_o1; /* '/d1' */ double d_DSTATE_n; /* '/d' */ double Integrator_1_DSTATE; /* '/Integrator_1' */ double d1_DSTATE_a; /* '/d1' */ double d_DSTATE_d1; /* '/d' */ double Delay_DSTATE_c4; /* '/Delay' */ double Delay_DSTATE_i1; /* '/Delay' */ double PrevY; /* '/Input_Vx_RateLimiter' */ double PrevY_b; /* '/Rate Limiter' */ double PrevY_o; /* '/Brake_Out_RateLimiter' */ double PrevY_a; /* '/TargetSpd_RateLimiter' */ double Memory_PreviousInput; /* '/Memory' */ double Memory_PreviousInput_f; /* '/Memory' */ double currentEstMass; /* '/MATLAB Function3' */ double HAC_ON_FLAG; /* '/HAC_OFF_OK_Func' */ double Smoothed_Torque; /* '/HAC_OFF_OK_Func' */ double HAC_Desired_Torque; /* '/HAC_OFF_OK_Func' */ double HAC_ON_Timer; /* '/HAC_OFF_OK_Func' */ uint8_t is_active_c6_ADM_Integrated_Log;/* '/Chart' */ uint8_t is_c6_ADM_Integrated_Logic; /* '/Chart' */ bool icLoad; /* '/Delay' */ bool icLoad_e; /* '/Delay' */ bool icLoad_l; /* '/Delay' */ bool icLoad_d; /* '/Delay' */ bool isConverged; /* '/MATLAB Function3' */ } DW_ADM_Integrated_Logic_T; /* Invariant block signals (default storage) */ typedef struct { const double W_value; /* '/Multiply' */ const double W_Value_for_Brake; /* '/Multiply4' */ } ConstB_ADM_Integrated_Logic_T; /* External inputs (root inport signals with default storage) */ typedef struct { double GV_MCU_RPM; /* '/GV_MCU_RPM' */ double GV_BrakeTorqueCommand; /* '/GV_BrakeTorqueCommand' */ double GV_IMU_AX_Val; /* '/GV_IMU_AX_Val' */ double GV_IMU_AY_Val; /* '/GV_IMU_AY_Val' */ double GV_IMU_AZ_Val; /* '/GV_IMU_AZ_Val' */ double GV_IMU_PitchRtVal; /* '/GV_IMU_PitchRtVal' */ double GV_Vx_Command; /* '/GV_Vx_Command' */ double GV_VCU_GearSelStat; /* '/GV_VCU_GearSelStat' */ double GV_MCU_EstTrq; /* '/GV_MCU_EstTrq' */ double GV_Vx_Limit; /* '/GV_Vx_Limit' */ double GV_Vx_Fbk; /* '/GV_Vx_Fbk' */ double GV_RWA_RackAngleCommand; /* '/GV_RWA_RackAngleCommand' */ double GV_RWS_RackAngleCommand; /* '/GV_RWS_RackAngleCommand' */ double GV_Drive_Mode; /* '/GV_Drive_Mode' */ double GV_ACU_Fault_Flag; /* '/GV_ACU_Fault_Flag' */ double GV_MCU_Actuator_Fault_Flag; /* '/GV_MCU_Actuator_Fault_Flag' */ double GV_IDB_ECU_Fault_Flag; /* '/GV_IDB_ECU_Fault_Flag' */ double GV_RCU_ECU_Fault_Flag; /* '/GV_RCU_ECU_Fault_Flag' */ double GV_RWA1_ECU_Fault_Flag; /* '/GV_RWA1_ECU_Fault_Flag' */ double GV_RWA2_ECU_Fault_Flag; /* '/GV_RWA2_ECU_Fault_Flag' */ double GV_RWA_Actuator_Fault; /* '/GV_RWA_Actuator_Fault' */ double GV_ACU_ECU_Fault_Flag; /* '/GV_ACU_ECU_Fault_Flag' */ double GV_ACU_ECU_Fault_Flag1; /* '/GV_ACU_ECU_Fault_Flag1' */ double GV_ACU_ECU_Fault_Flag2; /* '/GV_ACU_ECU_Fault_Flag2' */ double GV_ACU_ECU_Fault_Flag3; /* '/GV_ACU_ECU_Fault_Flag3' */ double GV_Drive_ACC_Cmd; /* '/GV_Drive_ACC_Cmd' */ double GV_VCU_AccControlFlag; /* '/GV_VCU_AccControlFlag' */ double GV_VCU_Acc_Limit; /* '/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; /* '/GV_Brake_Command' */ double GV_Master_Rack_Angle_Cmd; /* '/GV_Master_Rack_Angle_Cmd' */ double GV_Hill_Torque_Assist; /* '/GV_Hill_Torque_Assist' */ double GV_Motor_Torque_Cmd; /* '/GV_Motor_Torque_Cmd' */ double Debug_HAC_FLAG; /* '/Debug_HAC_FLAG' */ double Debug_HAC_RPM_Decision; /* '/Debug_HAC_RPM_Decision' */ double Debug_HAC_Pitch_angle; /* '/Debug_HAC_Pitch_angle' */ double Debug_HAC_Brake_Output; /* '/Debug_HAC_Brake_Output' */ double Debug_CC_Brake_Output; /* '/Debug_CC_Brake_Output' */ double Debug_AccControl_TorqueCmd; /* '/Debug_AccControl_TorqueCmd' */ double GV_RWS_RackAngleCmd1; /* '/GV_RWS_RackAngleCmd1' */ double GV_Speed_Limit; /* '/GV_Speed_Limit' */ double GV_Gear_Postion_Out; /* '/GV_Gear_Postion_Out' */ double Act_Fault_Exist; /* '/Act_Fault_Exist' */ double Target_RWA_Out; /* '/Target_RWA_Out' */ double Target_IDB_Out; /* '/Target_IDB_Out' */ double Target_MCU_Out; /* '/Target_MCU_Out' */ double GV_VCU_EstMass; /* '/GV_VCU_EstMass' */ double GV_VCU_EstMassFlag; /* '/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 '/Fault' : Unused code path elimination * Block '/Input_Acc_RateLimiter' : Unused code path elimination * Block '/Non_Fault' : Unused code path elimination * Block '/Product' : Unused code path elimination * Block '/Data Type Duplicate' : Unused code path elimination * Block '/Data Type Propagation' : Unused code path elimination * Block '/Switch' : Unused code path elimination * Block '/Data Type Duplicate' : Unused code path elimination * Block '/BW_PI' : Unused code path elimination * Block '/Constant1' : Unused code path elimination * Block '/Constant16' : Unused code path elimination * Block '/Constant17' : Unused code path elimination * Block '/Constant2' : Unused code path elimination * Block '/Brake_Saturation' : Unused code path elimination * Block '/Multiply5' : Unused code path elimination * Block '/Radius1' : Unused code path elimination * Block '/FixPt Data Type Duplicate' : Unused code path elimination * Block '/Data Type Duplicate' : Unused code path elimination * Block '/Data Type Propagation' : Unused code path elimination * Block '/FixPt Data Type Duplicate' : Unused code path elimination * Block '/Data Type Duplicate' : Unused code path elimination * Block '/Data Type Propagation' : Unused code path elimination * Block '/Scope2' : Unused code path elimination * Block '/FixPt Data Type Duplicate' : Unused code path elimination * Block '/Data Type Duplicate' : Unused code path elimination * Block '/Data Type Propagation' : Unused code path elimination * Block '/FixPt Data Type Duplicate' : Unused code path elimination * Block '/Data Type Duplicate' : Unused code path elimination * Block '/Data Type Propagation' : Unused code path elimination * Block '/ControlFlag' : Eliminated nontunable gain of 1 * Block '/FBGain' : Eliminated nontunable gain of 1 * Block '/FFGain' : Eliminated nontunable gain of 1 * Block '/Data Type Conversion1' : Eliminate redundant data type conversion * Block '/Data Type Conversion3' : Eliminate redundant data type conversion * Block '/HAC_Gain' : Eliminated nontunable gain of 1 * Block '/Zero-Order Hold' : Eliminated since input and output rates are identical * Block '/Zero-Order Hold' : Eliminated since input and output rates are identical * Block '/Zero-Order Hold' : Eliminated since input and output rates are identical * Block '/Zero-Order Hold' : Eliminated since input and output rates are identical * Block '/Constant5' : Unused code path elimination */ /*- * The generated code includes comments that allow you to trace directly * back to the appropriate location in the model. The basic format * is /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('') - opens system 3 * hilite_system('/Kp') - opens and selects block Kp which resides in S3 * * Here is the system hierarchy for this model * * '' : 'ADM_Integrated_Logic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acc_Logic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Actuator_Fault_Decision' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Compare To Constant' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Emergency_Brake_Func' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Emergency_Motor_Func' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Enabled Subsystem' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Gear_Position' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/IDB_Fault_Injection' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/LPFM5' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function2' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function3' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function4' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function5' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MATLAB Function6' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/MCU_Fault_Injection' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/RWA_Actuator_Fault_Injection' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Vx_Logic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acc_Logic/Acc_OutPut_Function' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acc_Logic/Saturation Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/Controller' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/MATLAB Function' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/MATLAB Function1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/Controller/Discrete Derivative' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Acceleration_Control/Controller/MATLAB Function' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB_Gain' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/GearCondition_Brake' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/Gear_pos_out' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/LPFM' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/Target_RPM' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Dot3' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Dot4' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Dot5' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/LPFM' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/DOB/Second order LPF' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FB' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FB/P' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Dot' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Dot2' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Dot3' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/LPFM' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Cruise_Control1/FF_PID_Controller/FF/Second order LPF' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Enabled Subsystem/MATLAB Function' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Gear_Position/Compare To Constant' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Gear_Position/Gear_FUNCTION1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Chart' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/HAC_OFF_OK_Func' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM2' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/LPFM3' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Pitch_calculate' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2/Calculate_F_R' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2/Calculate_F_c' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Hill_Required_Torque2/Calculate_F_c1' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic/Saturation Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/HAC_Logic1/Rate Limiter Dynamic1/Saturation Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic/Saturation Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Rate Limiter Dynamic1/Saturation Dynamic' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Vx_Logic/Compare To Constant' * '' : 'ADM_Integrated_Logic/Delivery_Mobility/Vx_Logic/Vx_OutPut_Function' */ /*- * Requirements for '': ADM_Integrated_Logic */ #endif /* ADM_Integrated_Logic_h_ */ /* * File trailer for generated code. * * [EOF] */