1732 lines
57 KiB
C
1732 lines
57 KiB
C
/*
|
||
* File: Model_actuator.c
|
||
*
|
||
* Code generated for Simulink model 'Model_actuator'.
|
||
*
|
||
* Model version : 1.588
|
||
* Simulink Coder version : 24.1 (R2024a) 19-Nov-2023
|
||
* C/C++ source code generated on : Thu Feb 12 13:08:42 2026
|
||
*
|
||
* Target selection: ert.tlc
|
||
* Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||
* Emulation hardware selection:
|
||
* Differs from embedded hardware (MATLAB Host)
|
||
* Code generation objectives: Unspecified
|
||
* Validation result: Not run
|
||
*/
|
||
|
||
#include "Model_actuator.h"
|
||
#include <stdint.h>
|
||
#include "Model_actuator_private.h"
|
||
#include <stdbool.h>
|
||
#include "Model_actuator_types.h"
|
||
|
||
/* Exported block states */
|
||
ActuatorCmdBus controllerData; /* '<S139>/Data Store Memory15' */
|
||
CmdBusStatus Status_Sensor_Model; /* '<S1>/Data Store Memory' */
|
||
CmdBusError CCU_Errors_Model; /* '<S1>/Data Store Memory3' */
|
||
|
||
/* Block signals (default storage) */
|
||
B rtB;
|
||
|
||
/* Block states (default storage) */
|
||
DW rtDW;
|
||
|
||
/* Real-time model */
|
||
static RT_MODEL rtM_;
|
||
RT_MODEL *const rtM = &rtM_;
|
||
int16_t look1_iu16tdIs16_binlcs(uint16_t u0, const uint16_t bp0[], const double
|
||
table[], uint32_t maxIndex)
|
||
{
|
||
double frac;
|
||
double yL_0d0;
|
||
int32_t tmp_1;
|
||
uint32_t iLeft;
|
||
int16_t tmp;
|
||
int16_t tmp_0;
|
||
|
||
/* Column-major Lookup 1-D
|
||
Search method: 'binary'
|
||
Use previous index: 'off'
|
||
Interpolation method: 'Linear point-slope'
|
||
Extrapolation method: 'Clip'
|
||
Use last breakpoint for index at or above upper limit: 'off'
|
||
Remove protection against out-of-range input in generated code: 'off'
|
||
*/
|
||
/* Prelookup - Index and Fraction
|
||
Index Search method: 'binary'
|
||
Extrapolation method: 'Clip'
|
||
Use previous index: 'off'
|
||
Use last breakpoint for index at or above upper limit: 'off'
|
||
Remove protection against out-of-range input in generated code: 'off'
|
||
*/
|
||
if (u0 <= bp0[0U]) {
|
||
iLeft = 0U;
|
||
frac = 0.0;
|
||
} else if (u0 < bp0[maxIndex]) {
|
||
uint32_t bpIdx;
|
||
uint32_t iRght;
|
||
|
||
/* Binary Search */
|
||
bpIdx = maxIndex >> 1U;
|
||
iLeft = 0U;
|
||
iRght = maxIndex;
|
||
while (iRght - iLeft > 1U) {
|
||
if (u0 < bp0[bpIdx]) {
|
||
iRght = bpIdx;
|
||
} else {
|
||
iLeft = bpIdx;
|
||
}
|
||
|
||
bpIdx = (iRght + iLeft) >> 1U;
|
||
}
|
||
|
||
uint16_t bpLeftVar;
|
||
bpLeftVar = bp0[iLeft];
|
||
frac = (double)((uint32_t)u0 - bpLeftVar) / (double)((uint32_t)bp0[iLeft +
|
||
1U] - bpLeftVar);
|
||
} else {
|
||
iLeft = maxIndex - 1U;
|
||
frac = 1.0;
|
||
}
|
||
|
||
/* Column-major Interpolation 1-D
|
||
Interpolation method: 'Linear point-slope'
|
||
Use last breakpoint for index at or above upper limit: 'off'
|
||
Overflow mode: 'saturate'
|
||
*/
|
||
yL_0d0 = table[iLeft];
|
||
if (yL_0d0 < 32768.0) {
|
||
if (yL_0d0 >= -32768.0) {
|
||
tmp = (int16_t)yL_0d0;
|
||
} else {
|
||
tmp = INT16_MIN;
|
||
}
|
||
} else {
|
||
tmp = INT16_MAX;
|
||
}
|
||
|
||
frac *= table[iLeft + 1U] - yL_0d0;
|
||
if (frac < 32768.0) {
|
||
if (frac >= -32768.0) {
|
||
tmp_0 = (int16_t)frac;
|
||
} else {
|
||
tmp_0 = INT16_MIN;
|
||
}
|
||
} else {
|
||
tmp_0 = INT16_MAX;
|
||
}
|
||
|
||
tmp_1 = tmp + tmp_0;
|
||
if (tmp_1 > 32767) {
|
||
tmp_1 = 32767;
|
||
} else if (tmp_1 < -32768) {
|
||
tmp_1 = -32768;
|
||
}
|
||
|
||
return (int16_t)tmp_1;
|
||
}
|
||
|
||
/*
|
||
* Output and update for action system:
|
||
* '<S149>/If Action Subsystem3'
|
||
* '<S148>/If Action Subsystem3'
|
||
* '<S147>/If Action Subsystem3'
|
||
* '<S141>/If Action Subsystem3'
|
||
* '<S144>/If Action Subsystem3'
|
||
* '<S146>/If Action Subsystem3'
|
||
* '<S140>/If Action Subsystem3'
|
||
*/
|
||
void IfActionSubsystem3(int8_t rtu_stepIn, int8_t *rty_step, uint8_t
|
||
rtd_com_loc[9])
|
||
{
|
||
int32_t i;
|
||
|
||
/* DataStoreWrite: '<S179>/Data Store Write3' */
|
||
for (i = 0; i < 9; i++) {
|
||
rtd_com_loc[i] = 0U;
|
||
}
|
||
|
||
/* End of DataStoreWrite: '<S179>/Data Store Write3' */
|
||
|
||
/* SignalConversion generated from: '<S179>/stepIn' */
|
||
*rty_step = rtu_stepIn;
|
||
}
|
||
|
||
/*
|
||
* Output and update for atomic system:
|
||
* '<S141>/MAX POSITION'
|
||
* '<S140>/MAX POSITION'
|
||
*/
|
||
void MAXPOSITION(const int16_t rtu_step[9], int16_t rty_y[9])
|
||
{
|
||
int32_t i;
|
||
|
||
/* : y = step; */
|
||
for (i = 0; i < 9; i++) {
|
||
rty_y[i] = rtu_step[i];
|
||
}
|
||
|
||
/* : fprintf('SIMULINK POSITION '); */
|
||
printf("SIMULINK POSITION ");
|
||
fflush(stdout);
|
||
|
||
/* : for i = 1:numel(step) */
|
||
for (i = 0; i < 9; i++) {
|
||
/* : fprintf('%d ', int16(step(i))); */
|
||
printf("%d ", rtu_step[i]);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* : fprintf('\n'); */
|
||
printf("\n");
|
||
fflush(stdout);
|
||
}
|
||
|
||
/*
|
||
* Output and update for atomic system:
|
||
* '<S141>/MAX POSITION1'
|
||
* '<S140>/MAX POSITION1'
|
||
*/
|
||
void MAXPOSITION1(const int8_t rtu_step[9], int8_t rty_y[9])
|
||
{
|
||
int32_t i;
|
||
|
||
/* : y = step; */
|
||
for (i = 0; i < 9; i++) {
|
||
rty_y[i] = rtu_step[i];
|
||
}
|
||
|
||
/* : fprintf('SIMULINK Stall_Slave '); */
|
||
printf("SIMULINK Stall_Slave ");
|
||
fflush(stdout);
|
||
|
||
/* : for i = 1:numel(step) */
|
||
for (i = 0; i < 9; i++) {
|
||
/* : fprintf('%d ', int16(step(i))); */
|
||
printf("%d ", (int16_t)rtu_step[i]);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* : fprintf('\n'); */
|
||
printf("\n");
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* Model step function */
|
||
void Model_actuator_step(void)
|
||
{
|
||
double rtb_Divide1;
|
||
int32_t i;
|
||
int16_t rtb_y_ff[9];
|
||
int16_t rtb_Switch_f;
|
||
int8_t rtb_y_b[9];
|
||
bool rtb_RelationalOperator_j[9];
|
||
bool rtb_FailCond;
|
||
bool rtb_LogicalOperator1;
|
||
bool rtb_LogicalOperator1_b;
|
||
bool rtb_LogicalOperator1_f;
|
||
bool rtb_LogicalOperator1_i;
|
||
bool rtb_LogicalOperator1_k;
|
||
bool rtb_LogicalOperator1_ln;
|
||
bool rtb_LogicalOperator1_n;
|
||
bool tmp;
|
||
|
||
/* Product: '<S3>/Divide1' incorporates:
|
||
* Constant: '<S3>/Constant'
|
||
* Constant: '<S3>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S3>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Ambient_Temp / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S3>/Logical Operator' incorporates:
|
||
* Constant: '<S44>/Constant'
|
||
* Constant: '<S45>/Constant'
|
||
* RelationalOperator: '<S44>/Compare'
|
||
* RelationalOperator: '<S45>/Compare'
|
||
*/
|
||
rtb_FailCond = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Logic: '<S3>/Logical Operator1' incorporates:
|
||
* Constant: '<S46>/Constant'
|
||
* DataStoreRead: '<S47>/Data Store Read4'
|
||
* RelationalOperator: '<S46>/Compare'
|
||
* Sum: '<S47>/Subtract'
|
||
* UnitDelay: '<S47>/t_start_delay_private '
|
||
*/
|
||
rtb_LogicalOperator1 = (rtb_FailCond && (rtDW.t_now -
|
||
rtDW.t_start_delay_private_DSTATE >= 3000U));
|
||
|
||
/* Switch: '<S3>/Switch' incorporates:
|
||
* Constant: '<S3>/Constant2'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Lookup_n-D: '<S3>/1-D Lookup Table'
|
||
*/
|
||
if (rtb_LogicalOperator1) {
|
||
rtb_Switch_f = 100;
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs
|
||
(rtDW.ADC_Data_Model.Sensor_Ambient_Temp, rtConstP.pooled14,
|
||
rtConstP.uDLookupTable_tableData, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S3>/Switch' */
|
||
|
||
/* MATLAB Function: '<S3>/Write Ambient' */
|
||
/* : fprintf('Ambient = %d * 0.1<EFBFBD>C\n',Ambient); */
|
||
printf("Ambient = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S3>/Write ERROR' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : if(AmbientErr) */
|
||
if (rtb_LogicalOperator1) {
|
||
/* : fprintf('CCU_Body_Err.CCU_AmbienTemptSenErr_Stat = 0x1 (Failure), Sensor_Ambient_Temp = %u\n',Sensor_Ambient_Temp); */
|
||
printf("CCU_Body_Err.CCU_AmbienTemptSenErr_Stat = 0x1 (Failure), Sensor_Ambient_Temp = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Ambient_Temp);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* End of MATLAB Function: '<S3>/Write ERROR' */
|
||
|
||
/* Switch: '<S47>/Switch' incorporates:
|
||
* DataStoreRead: '<S47>/Data Store Read4'
|
||
* Logic: '<S47>/Logical Operator3'
|
||
* Logic: '<S47>/Logical Operator4'
|
||
* UnitDelay: '<S47>/Cond_prev_private '
|
||
* UnitDelay: '<S47>/t_start_delay_private '
|
||
*/
|
||
if (rtb_FailCond && (!rtDW.Cond_prev_private_DSTATE)) {
|
||
rtDW.t_start_delay_private_DSTATE = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S47>/Switch' */
|
||
|
||
/* Product: '<S4>/Divide1' incorporates:
|
||
* Constant: '<S4>/Constant'
|
||
* Constant: '<S4>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S4>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Evap_Temp / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S4>/Logical Operator' incorporates:
|
||
* Constant: '<S53>/Constant'
|
||
* Constant: '<S54>/Constant'
|
||
* RelationalOperator: '<S53>/Compare'
|
||
* RelationalOperator: '<S54>/Compare'
|
||
*/
|
||
rtb_LogicalOperator1 = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Switch: '<S4>/Switch' incorporates:
|
||
* Constant: '<S4>/Constant2'
|
||
* Constant: '<S55>/Constant'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* DataStoreRead: '<S56>/Data Store Read4'
|
||
* Logic: '<S4>/Logical Operator1'
|
||
* Lookup_n-D: '<S4>/1-D Lookup Table'
|
||
* MATLAB Function: '<S4>/Write ERROR'
|
||
* RelationalOperator: '<S55>/Compare'
|
||
* Sum: '<S56>/Subtract'
|
||
* UnitDelay: '<S56>/t_start_delay_private '
|
||
*/
|
||
/* : if(EvapFErr) */
|
||
if (rtb_LogicalOperator1 && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_p >=
|
||
3000U)) {
|
||
rtb_Switch_f = -100;
|
||
|
||
/* : fprintf('CCU_Body_Err.CCU_EvaTempSenErrF_Stat = 0x1 (Failure), Sensor_Evap_Temp = %u\n',Sensor_Evap_Temp); */
|
||
printf("CCU_Body_Err.CCU_EvaTempSenErrF_Stat = 0x1 (Failure), Sensor_Evap_Temp = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Evap_Temp);
|
||
fflush(stdout);
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Evap_Temp,
|
||
rtConstP.pooled14, rtConstP.pooled1, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S4>/Switch' */
|
||
|
||
/* MATLAB Function: '<S4>/Write Eva_F' */
|
||
/* : fprintf('Eva_F = %d * 0.1<EFBFBD>C\n',Eva_F); */
|
||
printf("Eva_F = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S56>/Switch' incorporates:
|
||
* DataStoreRead: '<S56>/Data Store Read4'
|
||
* Logic: '<S56>/Logical Operator3'
|
||
* Logic: '<S56>/Logical Operator4'
|
||
* UnitDelay: '<S56>/Cond_prev_private '
|
||
* UnitDelay: '<S56>/t_start_delay_private '
|
||
*/
|
||
if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_h)) {
|
||
rtDW.t_start_delay_private_DSTATE_p = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S56>/Switch' */
|
||
|
||
/* Product: '<S5>/Divide1' incorporates:
|
||
* Constant: '<S5>/Constant'
|
||
* Constant: '<S5>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S5>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S5>/Logical Operator' incorporates:
|
||
* Constant: '<S62>/Constant'
|
||
* Constant: '<S63>/Constant'
|
||
* RelationalOperator: '<S62>/Compare'
|
||
* RelationalOperator: '<S63>/Compare'
|
||
*/
|
||
rtb_LogicalOperator1_f = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Switch: '<S5>/Switch' incorporates:
|
||
* Constant: '<S5>/Constant2'
|
||
* Constant: '<S64>/Constant'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* DataStoreRead: '<S65>/Data Store Read4'
|
||
* Logic: '<S5>/Logical Operator1'
|
||
* Lookup_n-D: '<S5>/1-D Lookup Table'
|
||
* MATLAB Function: '<S5>/Write ERROR'
|
||
* RelationalOperator: '<S64>/Compare'
|
||
* Sum: '<S65>/Subtract'
|
||
* UnitDelay: '<S65>/t_start_delay_private '
|
||
*/
|
||
/* : if(EvapRErr) */
|
||
if (rtb_LogicalOperator1_f && (rtDW.t_now -
|
||
rtDW.t_start_delay_private_DSTATE_pk >= 3000U)) {
|
||
rtb_Switch_f = -100;
|
||
|
||
/* : fprintf('CCU_Body_Err.CCU_EvaTempSenErrR_Stat = 0x1 (Failure), Sensor_Rear_Evap_Temp = %u\n',Sensor_Rear_Evap_Temp); */
|
||
printf("CCU_Body_Err.CCU_EvaTempSenErrR_Stat = 0x1 (Failure), Sensor_Rear_Evap_Temp = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp);
|
||
fflush(stdout);
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs
|
||
(rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp, rtConstP.pooled14,
|
||
rtConstP.pooled1, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S5>/Switch' */
|
||
|
||
/* MATLAB Function: '<S5>/Write Eva_F' */
|
||
/* : fprintf('Eva_R = %d * 0.1<EFBFBD>C\n',Eva_R); */
|
||
printf("Eva_R = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S65>/Switch' incorporates:
|
||
* DataStoreRead: '<S65>/Data Store Read4'
|
||
* Logic: '<S65>/Logical Operator3'
|
||
* Logic: '<S65>/Logical Operator4'
|
||
* UnitDelay: '<S65>/Cond_prev_private '
|
||
* UnitDelay: '<S65>/t_start_delay_private '
|
||
*/
|
||
if (rtb_LogicalOperator1_f && (!rtDW.Cond_prev_private_DSTATE_i)) {
|
||
rtDW.t_start_delay_private_DSTATE_pk = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S65>/Switch' */
|
||
|
||
/* Product: '<S6>/Divide1' incorporates:
|
||
* Constant: '<S6>/Constant'
|
||
* Constant: '<S6>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S6>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S6>/Logical Operator' incorporates:
|
||
* Constant: '<S71>/Constant'
|
||
* Constant: '<S72>/Constant'
|
||
* RelationalOperator: '<S71>/Compare'
|
||
* RelationalOperator: '<S72>/Compare'
|
||
*/
|
||
rtb_LogicalOperator1_k = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Switch: '<S6>/Switch' incorporates:
|
||
* Constant: '<S6>/Constant2'
|
||
* Constant: '<S73>/Constant'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* DataStoreRead: '<S74>/Data Store Read4'
|
||
* Logic: '<S6>/Logical Operator1'
|
||
* Lookup_n-D: '<S6>/1-D Lookup Table'
|
||
* MATLAB Function: '<S6>/Write ERROR'
|
||
* RelationalOperator: '<S73>/Compare'
|
||
* Sum: '<S74>/Subtract'
|
||
* UnitDelay: '<S74>/t_start_delay_private '
|
||
*/
|
||
/* : if(IncarFLErr) */
|
||
if (rtb_LogicalOperator1_k && (rtDW.t_now -
|
||
rtDW.t_start_delay_private_DSTATE_b >= 3000U)) {
|
||
rtb_Switch_f = 200;
|
||
|
||
/* : fprintf('CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_FL = %u\n',Sensor_Incar_Temp_FL); */
|
||
printf("CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_FL = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL);
|
||
fflush(stdout);
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs
|
||
(rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL, rtConstP.pooled14,
|
||
rtConstP.pooled2, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S6>/Switch' */
|
||
|
||
/* MATLAB Function: '<S6>/Write IncarFL' */
|
||
/* : fprintf('IncarFL = %d * 0.1<EFBFBD>C\n',IncarFL); */
|
||
printf("IncarFL = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S74>/Switch' incorporates:
|
||
* DataStoreRead: '<S74>/Data Store Read4'
|
||
* Logic: '<S74>/Logical Operator3'
|
||
* Logic: '<S74>/Logical Operator4'
|
||
* UnitDelay: '<S74>/Cond_prev_private '
|
||
* UnitDelay: '<S74>/t_start_delay_private '
|
||
*/
|
||
if (rtb_LogicalOperator1_k && (!rtDW.Cond_prev_private_DSTATE_c)) {
|
||
rtDW.t_start_delay_private_DSTATE_b = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S74>/Switch' */
|
||
|
||
/* Product: '<S7>/Divide1' incorporates:
|
||
* Constant: '<S7>/Constant'
|
||
* Constant: '<S7>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S7>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S7>/Logical Operator' incorporates:
|
||
* Constant: '<S80>/Constant'
|
||
* Constant: '<S81>/Constant'
|
||
* RelationalOperator: '<S80>/Compare'
|
||
* RelationalOperator: '<S81>/Compare'
|
||
*/
|
||
rtb_LogicalOperator1_b = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Switch: '<S7>/Switch' incorporates:
|
||
* Constant: '<S7>/Constant2'
|
||
* Constant: '<S82>/Constant'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* DataStoreRead: '<S83>/Data Store Read4'
|
||
* Logic: '<S7>/Logical Operator1'
|
||
* Lookup_n-D: '<S7>/1-D Lookup Table'
|
||
* MATLAB Function: '<S7>/Write ERROR'
|
||
* RelationalOperator: '<S82>/Compare'
|
||
* Sum: '<S83>/Subtract'
|
||
* UnitDelay: '<S83>/t_start_delay_private '
|
||
*/
|
||
/* : if(IncarFRErr) */
|
||
if (rtb_LogicalOperator1_b && (rtDW.t_now -
|
||
rtDW.t_start_delay_private_DSTATE_g >= 3000U)) {
|
||
rtb_Switch_f = 200;
|
||
|
||
/* : fprintf('CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_FR = %u\n',Sensor_Incar_Temp_FR); */
|
||
printf("CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_FR = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR);
|
||
fflush(stdout);
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs
|
||
(rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR, rtConstP.pooled14,
|
||
rtConstP.pooled2, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S7>/Switch' */
|
||
|
||
/* MATLAB Function: '<S7>/Write IncarFR' */
|
||
/* : fprintf('IncarFR = %d * 0.1<EFBFBD>C\n',IncarFR); */
|
||
printf("IncarFR = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S83>/Switch' incorporates:
|
||
* DataStoreRead: '<S83>/Data Store Read4'
|
||
* Logic: '<S83>/Logical Operator3'
|
||
* Logic: '<S83>/Logical Operator4'
|
||
* UnitDelay: '<S83>/Cond_prev_private '
|
||
* UnitDelay: '<S83>/t_start_delay_private '
|
||
*/
|
||
if (rtb_LogicalOperator1_b && (!rtDW.Cond_prev_private_DSTATE_hm)) {
|
||
rtDW.t_start_delay_private_DSTATE_g = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S83>/Switch' */
|
||
|
||
/* Product: '<S8>/Divide1' incorporates:
|
||
* Constant: '<S8>/Constant'
|
||
* Constant: '<S8>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S8>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S8>/Logical Operator' incorporates:
|
||
* Constant: '<S89>/Constant'
|
||
* Constant: '<S90>/Constant'
|
||
* RelationalOperator: '<S89>/Compare'
|
||
* RelationalOperator: '<S90>/Compare'
|
||
*/
|
||
rtb_LogicalOperator1_ln = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Switch: '<S8>/Switch' incorporates:
|
||
* Constant: '<S8>/Constant2'
|
||
* Constant: '<S91>/Constant'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* DataStoreRead: '<S92>/Data Store Read4'
|
||
* Logic: '<S8>/Logical Operator1'
|
||
* Lookup_n-D: '<S8>/1-D Lookup Table'
|
||
* MATLAB Function: '<S8>/Write ERROR'
|
||
* RelationalOperator: '<S91>/Compare'
|
||
* Sum: '<S92>/Subtract'
|
||
* UnitDelay: '<S92>/t_start_delay_private '
|
||
*/
|
||
/* : if(IncarRLErr) */
|
||
if (rtb_LogicalOperator1_ln && (rtDW.t_now -
|
||
rtDW.t_start_delay_private_DSTATE_j >= 3000U)) {
|
||
rtb_Switch_f = 200;
|
||
|
||
/* : fprintf('CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_RL = %u\n',Sensor_Incar_Temp_RL); */
|
||
printf("CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_RL = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL);
|
||
fflush(stdout);
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs
|
||
(rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL, rtConstP.pooled14,
|
||
rtConstP.pooled2, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S8>/Switch' */
|
||
|
||
/* MATLAB Function: '<S8>/Write IncarRL' */
|
||
/* : fprintf('IncarRL = %d * 0.1<EFBFBD>C\n',IncarRL); */
|
||
printf("IncarRL = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S92>/Switch' incorporates:
|
||
* DataStoreRead: '<S92>/Data Store Read4'
|
||
* Logic: '<S92>/Logical Operator3'
|
||
* Logic: '<S92>/Logical Operator4'
|
||
* UnitDelay: '<S92>/Cond_prev_private '
|
||
* UnitDelay: '<S92>/t_start_delay_private '
|
||
*/
|
||
if (rtb_LogicalOperator1_ln && (!rtDW.Cond_prev_private_DSTATE_b)) {
|
||
rtDW.t_start_delay_private_DSTATE_j = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S92>/Switch' */
|
||
|
||
/* Product: '<S9>/Divide1' incorporates:
|
||
* Constant: '<S9>/Constant'
|
||
* Constant: '<S9>/Constant1'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Product: '<S9>/Divide'
|
||
*/
|
||
rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR / 4095.0 * 5.0;
|
||
|
||
/* Logic: '<S9>/Logical Operator' incorporates:
|
||
* Constant: '<S98>/Constant'
|
||
* Constant: '<S99>/Constant'
|
||
* RelationalOperator: '<S98>/Compare'
|
||
* RelationalOperator: '<S99>/Compare'
|
||
*/
|
||
rtb_LogicalOperator1_i = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9));
|
||
|
||
/* Logic: '<S9>/Logical Operator1' incorporates:
|
||
* Constant: '<S100>/Constant'
|
||
* DataStoreRead: '<S101>/Data Store Read4'
|
||
* RelationalOperator: '<S100>/Compare'
|
||
* Sum: '<S101>/Subtract'
|
||
* UnitDelay: '<S101>/t_start_delay_private '
|
||
*/
|
||
rtb_LogicalOperator1_n = (rtb_LogicalOperator1_i && (rtDW.t_now -
|
||
rtDW.t_start_delay_private_DSTATE_c >= 3000U));
|
||
|
||
/* BusCreator: '<S97>/Bus Creator' incorporates:
|
||
* DataStoreWrite: '<S97>/Data Store Write'
|
||
* DataTypeConversion: '<S97>/Data Type Conversion'
|
||
*/
|
||
CCU_Errors_Model.CCU_IncarTempErrF_Stat = 0U;
|
||
CCU_Errors_Model.CCU_IncarTempErrR_Stat = rtb_LogicalOperator1_n;
|
||
CCU_Errors_Model.CCU_DuctTempSenErrF_Stat = 0U;
|
||
CCU_Errors_Model.CCU_DuctTempSenErrR_Stat = 0U;
|
||
CCU_Errors_Model.CCU_EvaTempSenErrF_Stat = 0U;
|
||
CCU_Errors_Model.CCU_EvaTempSenErrR_Stat = 0U;
|
||
CCU_Errors_Model.CCU_DeflectorSwErrF_Stat = 0U;
|
||
CCU_Errors_Model.CCU_DeflectorSwErrR_Stat = 0U;
|
||
CCU_Errors_Model.CCU_PressSenErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_AmbienTemptSenErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_SealingValveErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_ETXVerr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_HVACfanOrTXVerrF_Stat = 0U;
|
||
CCU_Errors_Model.CCU_HVACfanOrTXVerrR_Stat = 0U;
|
||
CCU_Errors_Model.CCU_ActuatorErrF_Stat = 0U;
|
||
CCU_Errors_Model.CCU_ActuatorErrR_Stat = 0U;
|
||
CCU_Errors_Model.CCU_UltravioletErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_VinRecordErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_AirQualSenErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_CommErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_TWVerr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_IonizationErr_Stat = 0U;
|
||
CCU_Errors_Model.CCU_AromaErr_Stat = 0U;
|
||
|
||
/* Switch: '<S9>/Switch' incorporates:
|
||
* Constant: '<S9>/Constant2'
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
* Lookup_n-D: '<S9>/1-D Lookup Table'
|
||
*/
|
||
if (rtb_LogicalOperator1_n) {
|
||
rtb_Switch_f = 200;
|
||
} else {
|
||
rtb_Switch_f = look1_iu16tdIs16_binlcs
|
||
(rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR, rtConstP.pooled14,
|
||
rtConstP.pooled2, 1023U);
|
||
}
|
||
|
||
/* End of Switch: '<S9>/Switch' */
|
||
|
||
/* BusCreator: '<S102>/Bus Creator' incorporates:
|
||
* DataStoreWrite: '<S102>/Data Store Write'
|
||
*/
|
||
Status_Sensor_Model.Battery = 0;
|
||
Status_Sensor_Model.AMB = 0;
|
||
Status_Sensor_Model.Incar_FL = 0;
|
||
Status_Sensor_Model.Incar_FR = 0;
|
||
Status_Sensor_Model.Incar_RL = 0;
|
||
Status_Sensor_Model.Incar_RR = rtb_Switch_f;
|
||
Status_Sensor_Model.Eva_F = 0;
|
||
Status_Sensor_Model.Eva_R = 0;
|
||
Status_Sensor_Model.Pressure = 0;
|
||
Status_Sensor_Model.Duct_FL_Upper = 0;
|
||
Status_Sensor_Model.Duct_FL_Lower = 0;
|
||
Status_Sensor_Model.Duct_FR_Upper = 0;
|
||
Status_Sensor_Model.Duct_FR_Lower = 0;
|
||
Status_Sensor_Model.Duct_RL = 0;
|
||
Status_Sensor_Model.Duct_RR = 0;
|
||
Status_Sensor_Model.Duct_Side_FL = 0;
|
||
Status_Sensor_Model.Duct_Side_FR = 0;
|
||
Status_Sensor_Model.Duct_Side_RL = 0;
|
||
Status_Sensor_Model.Duct_Side_RR = 0;
|
||
Status_Sensor_Model.AQS = 0;
|
||
|
||
/* MATLAB Function: '<S9>/Write ERROR' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : if(IncarRRErr) */
|
||
if (rtb_LogicalOperator1_n) {
|
||
/* : fprintf('CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_RR = %u\n',Sensor_Incar_Temp_RR); */
|
||
printf("CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_RR = %u\n",
|
||
rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* End of MATLAB Function: '<S9>/Write ERROR' */
|
||
|
||
/* MATLAB Function: '<S9>/Write IncarFL' */
|
||
/* : fprintf('IncarRR = %d * 0.1<EFBFBD>C\n',IncarRR); */
|
||
printf("IncarRR = %d * 0.1�C\n", rtb_Switch_f);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S101>/Switch' incorporates:
|
||
* DataStoreRead: '<S101>/Data Store Read4'
|
||
* Logic: '<S101>/Logical Operator3'
|
||
* Logic: '<S101>/Logical Operator4'
|
||
* UnitDelay: '<S101>/Cond_prev_private '
|
||
* UnitDelay: '<S101>/t_start_delay_private '
|
||
*/
|
||
if (rtb_LogicalOperator1_i && (!rtDW.Cond_prev_private_DSTATE_g)) {
|
||
rtDW.t_start_delay_private_DSTATE_c = rtDW.t_now;
|
||
}
|
||
|
||
/* End of Switch: '<S101>/Switch' */
|
||
|
||
/* MATLAB Function: '<S10>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5120_2EKA_ShutoffValvePowerTXV1 = %u\n',data); */
|
||
printf("ACP BTS5120_2EKA_ShutoffValvePowerTXV1 = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5120_2EKA_ShutoffValvePowerTXV1);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S11>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5120_2EKA_ShutoffValvePowerTXV2 = %u\n',data); */
|
||
printf("ACP BTS5120_2EKA_ShutoffValvePowerTXV2 = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5120_2EKA_ShutoffValvePowerTXV2);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S12>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_ChannelPTCPower1 = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_ChannelPTCPower1 = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_ChannelPTCPower1);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S13>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_ChannelPTCPower2 = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_ChannelPTCPower2 = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_ChannelPTCPower2);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S14>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_FrontIncarMotor = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_FrontIncarMotor = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_FrontIncarMotor);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S15>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_RearIncarMotor = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_RearIncarMotor = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_RearIncarMotor);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S16>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_ReservePowerSupply = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_ReservePowerSupply = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_ReservePowerSupply);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S17>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_ShutOFFValveFront = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_ShutOFFValveFront = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_ShutOFFValveFront);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S18>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_ShutOFFValveRear = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_ShutOFFValveRear = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_ShutOFFValveRear);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S19>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP BTS5180_2EKA_TwoWayValve = %u\n',data); */
|
||
printf("ACP BTS5180_2EKA_TwoWayValve = %u\n",
|
||
rtDW.ADC_Data_Model.BTS5180_2EKA_TwoWayValve);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S20>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP IGN_ANS = %u\n',IGN_ANS); */
|
||
printf("ACP IGN_ANS = %u\n", rtDW.ADC_Data_Model.IGN_ANS);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S21>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Ignition = %u\n',Ignition); */
|
||
// printf("ACP Ignition = %u\n", rtDW.ADC_Data_Model.Ignition);
|
||
// fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S22>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP PBATT_CHECK = %u\n',data); */
|
||
printf("ACP PBATT_CHECK = %u\n", rtDW.ADC_Data_Model.PBATT_CHECK);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S23>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Pressure_DIAG = %u\n',data); */
|
||
printf("ACP Pressure_DIAG = %u\n", rtDW.ADC_Data_Model.Pressure_DIAG);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S24>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Reserve_Sensor_Duct_Temp_1 = %u\n',data); */
|
||
printf("ACP Reserve_Sensor_Duct_Temp_1 = %u\n",
|
||
rtDW.ADC_Data_Model.Reserve_Sensor_Duct_Temp_1);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S25>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Reserve_Sensor_Duct_Temp_2 = %u\n',data); */
|
||
printf("ACP Reserve_Sensor_Duct_Temp_2 = %u\n",
|
||
rtDW.ADC_Data_Model.Reserve_Sensor_Duct_Temp_2);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S26>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_AC_Pressure = %u\n',Sensor_AC_Pressure); */
|
||
printf("ACP Sensor_AC_Pressure = %u\n", rtDW.ADC_Data_Model.Sensor_AC_Pressure);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S27>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Front_Duct1 = %u\n',Sensor_Front_Duct1); */
|
||
printf("ACP Sensor_Front_Duct1 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct1);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S28>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Front_Duct2 = %u\n',Sensor_Front_Duct2); */
|
||
printf("ACP Sensor_Front_Duct2 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct2);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S29>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Front_Duct3 = %u\n',Sensor_Front_Duct3); */
|
||
printf("ACP Sensor_Front_Duct3 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct3);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S30>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Front_Duct4 = %u\n',Sensor_Front_Duct4); */
|
||
printf("ACP Sensor_Front_Duct4 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct4);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S31>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Front_Duct5 = %u\n',data); */
|
||
printf("ACP Sensor_Front_Duct5 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct5);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S32>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Front_Duct6 = %u\n',data); */
|
||
printf("ACP Sensor_Front_Duct6 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct6);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S33>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Rear_Duct1 = %u\n',Sensor_Rear_Duct1); */
|
||
printf("ACP Sensor_Rear_Duct1 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct1);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S34>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Rear_Duct2 = %u\n',Sensor_Rear_Duct2); */
|
||
printf("ACP Sensor_Rear_Duct2 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct2);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S35>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Rear_Duct3 = %u\n',Sensor_Rear_Duct3); */
|
||
printf("ACP Sensor_Rear_Duct3 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct3);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S36>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Rear_Duct4 = %u\n',Sensor_Rear_Duct4); */
|
||
printf("ACP Sensor_Rear_Duct4 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct4);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S37>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Rear_Duct5 = %u\n',Sensor_Rear_Duct5); */
|
||
printf("ACP Sensor_Rear_Duct5 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct5);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S38>/Write Ignition' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP Sensor_Rear_Duct6 = %u\n',Sensor_Rear_Duct6); */
|
||
printf("ACP Sensor_Rear_Duct6 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct6);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S39>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB = %u\n',data); */
|
||
printf("ACP VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB = %u\n",
|
||
rtDW.ADC_Data_Model.VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S40>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP VN7008AJ_DIAG_RearLINActuatorPowerDriverC = %u\n',data); */
|
||
printf("ACP VN7008AJ_DIAG_RearLINActuatorPowerDriverC = %u\n",
|
||
rtDW.ADC_Data_Model.VN7008AJ_DIAG_RearLINActuatorPowerDriverC);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S41>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP VN7008AJ_FrontLINActuatorPowerDriverAB = %u\n',data); */
|
||
printf("ACP VN7008AJ_FrontLINActuatorPowerDriverAB = %u\n",
|
||
rtDW.ADC_Data_Model.VN7008AJ_FrontLINActuatorPowerDriverAB);
|
||
fflush(stdout);
|
||
|
||
/* MATLAB Function: '<S42>/Write' incorporates:
|
||
* DataStoreRead: '<S1>/Data Store Read1'
|
||
*/
|
||
/* : fprintf('ACP VN7008AJ_RearLINActuatorPowerDriverC = %u\n',data); */
|
||
printf("ACP VN7008AJ_RearLINActuatorPowerDriverC = %u\n",
|
||
rtDW.ADC_Data_Model.VN7008AJ_RearLINActuatorPowerDriverC);
|
||
fflush(stdout);
|
||
|
||
/* Switch: '<S139>/Switch' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read'
|
||
*/
|
||
if (rtDW.stepSig < 1) {
|
||
/* Switch: '<S139>/Switch' incorporates:
|
||
* Constant: '<S139>/Constant1'
|
||
*/
|
||
rtDW.UnitDelay_DSTATE = 1;
|
||
}
|
||
|
||
/* End of Switch: '<S139>/Switch' */
|
||
|
||
/* SwitchCase: '<S139>/Switch Case' */
|
||
switch (rtDW.UnitDelay_DSTATE) {
|
||
case 1:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Stop Mode' incorporates:
|
||
* ActionPort: '<S149>/Action Port'
|
||
*/
|
||
/* If: '<S149>/If1' incorporates:
|
||
* DataStoreRead: '<S149>/Data Store Read1'
|
||
* DataStoreRead: '<S149>/Data Store Read2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) {
|
||
/* Outputs for IfAction SubSystem: '<S149>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S178>/Action Port'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
/* DataStoreWrite: '<S178>/Data Store Write2' */
|
||
rtDW.mode_loc[i] = 2U;
|
||
|
||
/* DataStoreWrite: '<S178>/Data Store Write3' */
|
||
rtDW.com_loc[i] = 1U;
|
||
}
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S178>/Constant'
|
||
* Merge: '<S149>/Merge'
|
||
* SignalConversion generated from: '<S178>/step'
|
||
* Sum: '<S178>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* MATLAB Function: '<S178>/stop mode' */
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Stop Mode\n'); */
|
||
printf("SIMULINK Stop Mode\n");
|
||
fflush(stdout);
|
||
|
||
/* End of Outputs for SubSystem: '<S149>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S149>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S179>/Action Port'
|
||
*/
|
||
/* Merge: '<S139>/Merge' */
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S149>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S149>/If1' */
|
||
/* End of Outputs for SubSystem: '<S139>/Stop Mode' */
|
||
break;
|
||
|
||
case 2:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Initial CPOS Min' incorporates:
|
||
* ActionPort: '<S145>/Action Port'
|
||
*/
|
||
/* If: '<S145>/If' incorporates:
|
||
* DataStoreRead: '<S145>/Data Store Read'
|
||
* DataStoreRead: '<S145>/Data Store Read1'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) {
|
||
/* Outputs for IfAction SubSystem: '<S145>/If Action Subsystem' incorporates:
|
||
* ActionPort: '<S166>/Action Port'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
/* DataStoreWrite: '<S166>/Data Store Write' */
|
||
rtDW.pos_loc[i] = 6000U;
|
||
|
||
/* DataStoreWrite: '<S166>/Data Store Write1' */
|
||
rtDW.com_loc[i] = 2U;
|
||
}
|
||
|
||
/* MATLAB Function: '<S166>/Initial CPOS Min' */
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Initial CPOS Min - 6000\n'); */
|
||
printf("SIMULINK Initial CPOS Min - 6000\n");
|
||
fflush(stdout);
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S166>/Constant'
|
||
* Merge: '<S145>/Merge'
|
||
* SignalConversion generated from: '<S166>/step'
|
||
* Sum: '<S166>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* End of Outputs for SubSystem: '<S145>/If Action Subsystem' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S145>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S167>/Action Port'
|
||
*/
|
||
/* DataStoreWrite: '<S167>/Data Store Write3' */
|
||
for (i = 0; i < 9; i++) {
|
||
rtDW.com_loc[i] = 0U;
|
||
}
|
||
|
||
/* End of DataStoreWrite: '<S167>/Data Store Write3' */
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Merge: '<S145>/Merge'
|
||
* SignalConversion generated from: '<S167>/stepIn1'
|
||
*/
|
||
rtB.Merge = rtDW.UnitDelay_DSTATE;
|
||
|
||
/* End of Outputs for SubSystem: '<S145>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S145>/If' */
|
||
/* End of Outputs for SubSystem: '<S139>/Initial CPOS Min' */
|
||
break;
|
||
|
||
case 3:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Normal Mode' incorporates:
|
||
* ActionPort: '<S148>/Action Port'
|
||
*/
|
||
/* If: '<S148>/If1' incorporates:
|
||
* DataStoreRead: '<S148>/Data Store Read1'
|
||
* DataStoreRead: '<S148>/Data Store Read2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) {
|
||
/* Outputs for IfAction SubSystem: '<S148>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S175>/Action Port'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
/* DataStoreWrite: '<S175>/Data Store Write' */
|
||
rtDW.mode_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S175>/Data Store Write2' */
|
||
rtDW.com_loc[i] = 1U;
|
||
}
|
||
|
||
/* MATLAB Function: '<S175>/Normal Mode' */
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Normal Mode\n'); */
|
||
printf("SIMULINK Normal Mode\n");
|
||
fflush(stdout);
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S175>/Constant'
|
||
* SignalConversion generated from: '<S175>/step'
|
||
* Sum: '<S175>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* End of Outputs for SubSystem: '<S148>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S148>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S176>/Action Port'
|
||
*/
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S148>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S148>/If1' */
|
||
/* End of Outputs for SubSystem: '<S139>/Normal Mode' */
|
||
break;
|
||
|
||
case 4:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Move to position Min' incorporates:
|
||
* ActionPort: '<S147>/Action Port'
|
||
*/
|
||
/* If: '<S147>/If1' incorporates:
|
||
* DataStoreRead: '<S147>/Data Store Read1'
|
||
* DataStoreRead: '<S147>/Data Store Read2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) {
|
||
/* Outputs for IfAction SubSystem: '<S147>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S172>/Action Port'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
/* DataStoreWrite: '<S172>/Data Store Write1' */
|
||
rtDW.stall_set_loc[i] = 1U;
|
||
|
||
/* DataStoreWrite: '<S172>/Data Store Write3' incorporates:
|
||
* Constant: '<S172>/Constant2'
|
||
*/
|
||
rtDW.lnoise_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S172>/Data Store Write2' */
|
||
rtDW.com_loc[i] = 3U;
|
||
|
||
/* DataStoreWrite: '<S172>/Data Store Write4' incorporates:
|
||
* Constant: '<S172>/Constant4'
|
||
*/
|
||
rtDW.autos_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S172>/Data Store Write5' incorporates:
|
||
* Constant: '<S172>/Constant5'
|
||
*/
|
||
rtDW.speed_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S172>/Data Store Write6' incorporates:
|
||
* Constant: '<S172>/Constant6'
|
||
*/
|
||
rtDW.coils_stop_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S172>/Data Store Write' */
|
||
rtDW.pos_loc[i] = 1U;
|
||
}
|
||
|
||
/* MATLAB Function: '<S172>/Move to position Min' */
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Move to position Min - 1\n'); */
|
||
printf("SIMULINK Move to position Min - 1\n");
|
||
fflush(stdout);
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S172>/Constant'
|
||
* SignalConversion generated from: '<S172>/step'
|
||
* Sum: '<S172>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* End of Outputs for SubSystem: '<S147>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S147>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S173>/Action Port'
|
||
*/
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S147>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S147>/If1' */
|
||
/* End of Outputs for SubSystem: '<S139>/Move to position Min' */
|
||
break;
|
||
|
||
case 5:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Check Stall Min' incorporates:
|
||
* ActionPort: '<S141>/Action Port'
|
||
*/
|
||
/* RelationalOperator: '<S141>/Relational Operator1' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write5'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
rtb_RelationalOperator_j[i] =
|
||
(rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0[i] == 1);
|
||
}
|
||
|
||
/* End of RelationalOperator: '<S141>/Relational Operator1' */
|
||
|
||
/* Logic: '<S141>/Logical Operator2' */
|
||
rtb_LogicalOperator1_n = rtb_RelationalOperator_j[0];
|
||
for (i = 0; i < 8; i++) {
|
||
rtb_LogicalOperator1_n = (rtb_LogicalOperator1_n ||
|
||
rtb_RelationalOperator_j[i + 1]);
|
||
}
|
||
|
||
/* RelationalOperator: '<S141>/Relational Operator' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
rtb_RelationalOperator_j[i] = (rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]
|
||
== 1);
|
||
}
|
||
|
||
/* End of RelationalOperator: '<S141>/Relational Operator' */
|
||
|
||
/* Logic: '<S141>/Logical Operator1' */
|
||
tmp = rtb_RelationalOperator_j[0];
|
||
for (i = 0; i < 8; i++) {
|
||
tmp = (tmp || rtb_RelationalOperator_j[i + 1]);
|
||
}
|
||
|
||
/* If: '<S141>/If2' incorporates:
|
||
* DataStoreRead: '<S141>/Data Store Read1'
|
||
* DataStoreRead: '<S141>/Data Store Read2'
|
||
* DataTypeConversion: '<S141>/Data Type Conversion'
|
||
* DataTypeConversion: '<S141>/Data Type Conversion1'
|
||
* Logic: '<S141>/Logical Operator'
|
||
* Logic: '<S141>/Logical Operator1'
|
||
* Logic: '<S141>/Logical Operator2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0) &&
|
||
(rtb_LogicalOperator1_n || tmp)) {
|
||
/* Outputs for IfAction SubSystem: '<S141>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S156>/Action Port'
|
||
*/
|
||
/* DataStoreWrite: '<S156>/Data Store Write1' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
rtDW.Min_position_Ch0[i] = rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i];
|
||
}
|
||
|
||
/* End of DataStoreWrite: '<S156>/Data Store Write1' */
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S156>/Constant'
|
||
* Sum: '<S156>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* MATLAB Function: '<S156>/MIN POSITION' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Min_position_Ch0 '); */
|
||
printf("SIMULINK Min_position_Ch0 ");
|
||
fflush(stdout);
|
||
|
||
/* : for i = 1:numel(step) */
|
||
for (i = 0; i < 9; i++) {
|
||
/* : fprintf('%d ', int16(step(i))); */
|
||
printf("%d ", rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* : fprintf('\n'); */
|
||
printf("\n");
|
||
fflush(stdout);
|
||
|
||
/* End of MATLAB Function: '<S156>/MIN POSITION' */
|
||
/* End of Outputs for SubSystem: '<S141>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S141>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S157>/Action Port'
|
||
*/
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S141>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S141>/If2' */
|
||
|
||
/* MATLAB Function: '<S141>/MAX POSITION' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
MAXPOSITION(rtDW.controllerDataInput.in_CPOS_ALL_Ch0, rtb_y_ff);
|
||
|
||
/* MATLAB Function: '<S141>/MAX POSITION1' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write5'
|
||
*/
|
||
MAXPOSITION1(rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0, rtb_y_b);
|
||
|
||
/* End of Outputs for SubSystem: '<S139>/Check Stall Min' */
|
||
break;
|
||
|
||
case 6:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Initial CPOS Max' incorporates:
|
||
* ActionPort: '<S144>/Action Port'
|
||
*/
|
||
/* If: '<S144>/If1' incorporates:
|
||
* DataStoreRead: '<S144>/Data Store Read1'
|
||
* DataStoreRead: '<S144>/Data Store Read2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) {
|
||
/* Outputs for IfAction SubSystem: '<S144>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S163>/Action Port'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
/* DataStoreWrite: '<S163>/Data Store Write' */
|
||
rtDW.pos_loc[i] = 1U;
|
||
|
||
/* DataStoreWrite: '<S163>/Data Store Write1' */
|
||
rtDW.com_loc[i] = 2U;
|
||
}
|
||
|
||
/* MATLAB Function: '<S163>/Initial CPOS Max' */
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Initial CPOS Max - 1\n'); */
|
||
printf("SIMULINK Initial CPOS Max - 1\n");
|
||
fflush(stdout);
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S163>/Constant'
|
||
* SignalConversion generated from: '<S163>/step'
|
||
* Sum: '<S163>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* End of Outputs for SubSystem: '<S144>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S144>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S164>/Action Port'
|
||
*/
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S144>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S144>/If1' */
|
||
/* End of Outputs for SubSystem: '<S139>/Initial CPOS Max' */
|
||
break;
|
||
|
||
case 7:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Move to position Max' incorporates:
|
||
* ActionPort: '<S146>/Action Port'
|
||
*/
|
||
/* If: '<S146>/If1' incorporates:
|
||
* DataStoreRead: '<S146>/Data Store Read1'
|
||
* DataStoreRead: '<S146>/Data Store Read2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) {
|
||
/* Outputs for IfAction SubSystem: '<S146>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S169>/Action Port'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
/* DataStoreWrite: '<S169>/Data Store Write1' */
|
||
rtDW.stall_set_loc[i] = 1U;
|
||
|
||
/* DataStoreWrite: '<S169>/Data Store Write3' incorporates:
|
||
* Constant: '<S169>/Constant2'
|
||
*/
|
||
rtDW.lnoise_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S169>/Data Store Write2' */
|
||
rtDW.com_loc[i] = 3U;
|
||
|
||
/* DataStoreWrite: '<S169>/Data Store Write4' incorporates:
|
||
* Constant: '<S169>/Constant4'
|
||
*/
|
||
rtDW.autos_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S169>/Data Store Write5' incorporates:
|
||
* Constant: '<S169>/Constant5'
|
||
*/
|
||
rtDW.speed_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S169>/Data Store Write6' incorporates:
|
||
* Constant: '<S169>/Constant6'
|
||
*/
|
||
rtDW.coils_stop_set_loc[i] = 0U;
|
||
|
||
/* DataStoreWrite: '<S169>/Data Store Write' */
|
||
rtDW.pos_loc[i] = 6000U;
|
||
}
|
||
|
||
/* MATLAB Function: '<S169>/Move to position Max' */
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Move to position Max - 6000\n'); */
|
||
printf("SIMULINK Move to position Max - 6000\n");
|
||
fflush(stdout);
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S169>/Constant'
|
||
* SignalConversion generated from: '<S169>/step'
|
||
* Sum: '<S169>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* End of Outputs for SubSystem: '<S146>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S146>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S170>/Action Port'
|
||
*/
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S146>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S146>/If1' */
|
||
/* End of Outputs for SubSystem: '<S139>/Move to position Max' */
|
||
break;
|
||
|
||
case 8:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Check Stall Max' incorporates:
|
||
* ActionPort: '<S140>/Action Port'
|
||
*/
|
||
/* RelationalOperator: '<S140>/Relational Operator1' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write5'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
rtb_RelationalOperator_j[i] =
|
||
(rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0[i] == 1);
|
||
}
|
||
|
||
/* End of RelationalOperator: '<S140>/Relational Operator1' */
|
||
|
||
/* Logic: '<S140>/Logical Operator2' */
|
||
rtb_LogicalOperator1_n = rtb_RelationalOperator_j[0];
|
||
for (i = 0; i < 8; i++) {
|
||
rtb_LogicalOperator1_n = (rtb_LogicalOperator1_n ||
|
||
rtb_RelationalOperator_j[i + 1]);
|
||
}
|
||
|
||
/* RelationalOperator: '<S140>/Relational Operator' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
rtb_RelationalOperator_j[i] = (rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]
|
||
== 6000);
|
||
}
|
||
|
||
/* End of RelationalOperator: '<S140>/Relational Operator' */
|
||
|
||
/* Logic: '<S140>/Logical Operator1' */
|
||
tmp = rtb_RelationalOperator_j[0];
|
||
for (i = 0; i < 8; i++) {
|
||
tmp = (tmp || rtb_RelationalOperator_j[i + 1]);
|
||
}
|
||
|
||
/* If: '<S140>/If2' incorporates:
|
||
* DataStoreRead: '<S140>/Data Store Read3'
|
||
* DataStoreRead: '<S140>/Data Store Read4'
|
||
* DataTypeConversion: '<S140>/Data Type Conversion'
|
||
* DataTypeConversion: '<S140>/Data Type Conversion1'
|
||
* Logic: '<S140>/Logical Operator'
|
||
* Logic: '<S140>/Logical Operator1'
|
||
* Logic: '<S140>/Logical Operator2'
|
||
*/
|
||
if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0) &&
|
||
(rtb_LogicalOperator1_n || tmp)) {
|
||
/* Outputs for IfAction SubSystem: '<S140>/If Action Subsystem2' incorporates:
|
||
* ActionPort: '<S151>/Action Port'
|
||
*/
|
||
/* DataStoreWrite: '<S151>/Data Store Write1' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
rtDW.Max_position_Ch0[i] = rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i];
|
||
}
|
||
|
||
/* End of DataStoreWrite: '<S151>/Data Store Write1' */
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* Constant: '<S151>/Constant'
|
||
* Sum: '<S151>/step inc'
|
||
*/
|
||
rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1);
|
||
|
||
/* MATLAB Function: '<S151>/MIN POSITION' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK Max_position_Ch0 '); */
|
||
printf("SIMULINK Max_position_Ch0 ");
|
||
fflush(stdout);
|
||
|
||
/* : for i = 1:numel(step) */
|
||
for (i = 0; i < 9; i++) {
|
||
/* : fprintf('%d ', int16(step(i))); */
|
||
printf("%d ", rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* : fprintf('\n'); */
|
||
printf("\n");
|
||
fflush(stdout);
|
||
|
||
/* End of MATLAB Function: '<S151>/MIN POSITION' */
|
||
/* End of Outputs for SubSystem: '<S140>/If Action Subsystem2' */
|
||
} else {
|
||
/* Outputs for IfAction SubSystem: '<S140>/If Action Subsystem3' incorporates:
|
||
* ActionPort: '<S152>/Action Port'
|
||
*/
|
||
IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc);
|
||
|
||
/* End of Outputs for SubSystem: '<S140>/If Action Subsystem3' */
|
||
}
|
||
|
||
/* End of If: '<S140>/If2' */
|
||
|
||
/* MATLAB Function: '<S140>/MAX POSITION' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write1'
|
||
*/
|
||
MAXPOSITION(rtDW.controllerDataInput.in_CPOS_ALL_Ch0, rtb_y_ff);
|
||
|
||
/* MATLAB Function: '<S140>/MAX POSITION1' incorporates:
|
||
* DataStoreRead: '<S139>/Data Store Read1'
|
||
* DataStoreWrite: '<S139>/Data Store Write5'
|
||
*/
|
||
MAXPOSITION1(rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0, rtb_y_b);
|
||
|
||
/* End of Outputs for SubSystem: '<S139>/Check Stall Max' */
|
||
break;
|
||
|
||
case 9:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Homing' incorporates:
|
||
* ActionPort: '<S142>/Action Port'
|
||
*/
|
||
/* DataStoreWrite: '<S142>/Data Store Write3' */
|
||
for (i = 0; i < 9; i++) {
|
||
rtDW.com_loc[i] = 0U;
|
||
}
|
||
|
||
/* End of DataStoreWrite: '<S142>/Data Store Write3' */
|
||
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* SignalConversion generated from: '<S142>/stepIn1'
|
||
*/
|
||
rtB.Merge = 0;
|
||
|
||
/* MATLAB Function: '<S142>/MAX POSITION' incorporates:
|
||
* DataStoreRead: '<S142>/Data Store Read2'
|
||
*/
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK MAX POSITION '); */
|
||
printf("SIMULINK MAX POSITION ");
|
||
fflush(stdout);
|
||
|
||
/* : for i = 1:numel(step) */
|
||
for (i = 0; i < 9; i++) {
|
||
/* : fprintf('%d ', int16(step(i))); */
|
||
printf("%d ", rtDW.Max_position_Ch0[i]);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* : fprintf('\n'); */
|
||
printf("\n");
|
||
fflush(stdout);
|
||
|
||
/* End of MATLAB Function: '<S142>/MAX POSITION' */
|
||
|
||
/* MATLAB Function: '<S142>/MIN POSITION' incorporates:
|
||
* DataStoreRead: '<S142>/Data Store Read3'
|
||
*/
|
||
/* : y = step; */
|
||
/* : fprintf('SIMULINK MIN POSITION '); */
|
||
printf("SIMULINK MIN POSITION ");
|
||
fflush(stdout);
|
||
|
||
/* : for i = 1:numel(step) */
|
||
for (i = 0; i < 9; i++) {
|
||
/* : fprintf('%d ', int16(step(i))); */
|
||
printf("%d ", rtDW.Min_position_Ch0[i]);
|
||
fflush(stdout);
|
||
}
|
||
|
||
/* : fprintf('\n'); */
|
||
printf("\n");
|
||
fflush(stdout);
|
||
|
||
/* End of MATLAB Function: '<S142>/MIN POSITION' */
|
||
/* End of Outputs for SubSystem: '<S139>/Homing' */
|
||
break;
|
||
|
||
case 0:
|
||
/* Outputs for IfAction SubSystem: '<S139>/Homing1' incorporates:
|
||
* ActionPort: '<S143>/Action Port'
|
||
*/
|
||
/* Merge: '<S139>/Merge' incorporates:
|
||
* SignalConversion generated from: '<S143>/stepIn'
|
||
*/
|
||
rtB.Merge = rtDW.UnitDelay_DSTATE;
|
||
|
||
/* End of Outputs for SubSystem: '<S139>/Homing1' */
|
||
break;
|
||
}
|
||
|
||
/* End of SwitchCase: '<S139>/Switch Case' */
|
||
|
||
/* DataStoreWrite: '<S139>/Start write stepSig' incorporates:
|
||
* Constant: '<S139>/Constant1'
|
||
*/
|
||
rtDW.stepSig = 1;
|
||
|
||
/* BusCreator: '<S150>/Bus Creator' incorporates:
|
||
* DataStoreRead: '<S150>/Data Store Read1'
|
||
* DataStoreRead: '<S150>/Data Store Read2'
|
||
* DataStoreRead: '<S150>/Data Store Read3'
|
||
* DataStoreRead: '<S150>/Data Store Read4'
|
||
* DataStoreRead: '<S150>/Data Store Read5'
|
||
* DataStoreRead: '<S150>/Data Store Read6'
|
||
* DataStoreRead: '<S150>/Data Store Read7'
|
||
* DataStoreRead: '<S150>/Data Store Read8'
|
||
* DataStoreRead: '<S150>/Data Store Read9'
|
||
* DataStoreWrite: '<S150>/Data Store Write'
|
||
*/
|
||
for (i = 0; i < 9; i++) {
|
||
controllerData.POS[i] = rtDW.pos_loc[i];
|
||
controllerData.BUS_ADR[i] = rtDW.busAdr_loc[i];
|
||
controllerData.MODE[i] = rtDW.mode_loc[i];
|
||
controllerData.COM[i] = rtDW.com_loc[i];
|
||
controllerData.Stall_SET[i] = rtDW.stall_set_loc[i];
|
||
controllerData.Lnoise_SET[i] = rtDW.lnoise_set_loc[i];
|
||
controllerData.Autos_SET[i] = rtDW.autos_set_loc[i];
|
||
controllerData.Speed_SET[i] = rtDW.speed_set_loc[i];
|
||
controllerData.Coils_Stop_SET[i] = rtDW.coils_stop_set_loc[i];
|
||
}
|
||
|
||
/* End of BusCreator: '<S150>/Bus Creator' */
|
||
|
||
/* Update for UnitDelay: '<S47>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE = rtb_FailCond;
|
||
|
||
/* Update for UnitDelay: '<S56>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE_h = rtb_LogicalOperator1;
|
||
|
||
/* Update for UnitDelay: '<S65>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE_i = rtb_LogicalOperator1_f;
|
||
|
||
/* Update for UnitDelay: '<S74>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE_c = rtb_LogicalOperator1_k;
|
||
|
||
/* Update for UnitDelay: '<S83>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE_hm = rtb_LogicalOperator1_b;
|
||
|
||
/* Update for UnitDelay: '<S92>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE_b = rtb_LogicalOperator1_ln;
|
||
|
||
/* Update for UnitDelay: '<S101>/Cond_prev_private ' */
|
||
rtDW.Cond_prev_private_DSTATE_g = rtb_LogicalOperator1_i;
|
||
|
||
/* Update for Switch: '<S139>/Switch' incorporates:
|
||
* UnitDelay: '<S139>/Unit Delay'
|
||
*/
|
||
rtDW.UnitDelay_DSTATE = rtB.Merge;
|
||
}
|
||
|
||
/* Model initialize function */
|
||
void Model_actuator_initialize(void)
|
||
{
|
||
/* (no initialization code required) */
|
||
}
|
||
|
||
/* Model terminate function */
|
||
void Model_actuator_terminate(void)
|
||
{
|
||
/* (no terminate code required) */
|
||
}
|
||
|
||
/*
|
||
* File trailer for generated code.
|
||
*
|
||
* [EOF]
|
||
*/
|