1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #include "IH100.h"
- #include "rtwtypes.h"
- #include "IH100_private.h"
- #include "look1_iu8lu16n16tu16_binlcase.h"
- #include "BCUDisp.h"
- MdlrefDW_IH100_T IH100_MdlrefDW;
- B_IH100_c_T IH100_B;
- DW_IH100_f_T IH100_DW;
- void IH100(uint16_T *rty_ihd_tm_parkTime)
- {
- ihd_tm_yearEo = rted_tm_year;
- ihd_tm_monthEo = rted_tm_month;
- ihd_tm_dayEo = rted_tm_day;
- ihd_tm_hourEo = rted_tm_hour;
- ihd_tm_minEo = rted_tm_min;
- ihd_tm_secEo = rted_tm_sec;
- if (IH100_DW.UnitDelay_DSTATE + 1.0 <= IH100_ConstB.Add) {
- IH100_DW.UnitDelay_DSTATE++;
- } else {
- IH100_DW.UnitDelay_DSTATE = IH100_ConstB.Add;
- }
- if (IH100_DW.UnitDelay_DSTATE == 1.0) {
- uint32_T rtb_Product3_f;
- uint16_T rtb_Add_j;
- uint8_T rtb_Divide1;
- uint8_T rtb_Divide_e;
- uint8_T rtb_Merge1;
- uint8_T rtb_Merge2;
- uint8_T rtb_Merge3;
- uint8_T rtb_Merge4;
- uint8_T rtb_Merge5;
- boolean_T rtb_LogicalOperator1;
- rtb_LogicalOperator1 = ((((uint16_T)(rted_tm_year % 4) == 0) && ((uint16_T)
- (rted_tm_year % 100) != 0)) || ((uint16_T)(rted_tm_year % 400) == 0));
- if (rtb_LogicalOperator1) {
- rtb_Add_j = look1_iu8lu16n16tu16_binlcase((uint8_T)(rted_tm_month - 1),
- rtCP_uDLookupTable1_bp01Data, rtCP_uDLookupTable1_tableData, 11U);
- } else {
- rtb_Add_j = look1_iu8lu16n16tu16_binlcase((uint8_T)(rted_tm_month - 1),
- rtCP_uDLookupTable_bp01Data, rtCP_uDLookupTable_tableData, 11U);
- }
- IH100_B.Add1 = ((((((uint16_T)(((int32_T)((uint32_T)rted_tm_year >> 2) -
- (int32_T)(rted_tm_year / 100U)) - rtb_LogicalOperator1) + rted_tm_year *
- 365U) + rtb_Add_j) + (uint8_T)(rted_tm_day - 1)) *
- 86400U + rted_tm_hour * 3600U) + rted_tm_min * 60U) +
- rted_tm_sec;
- if (rtev_flg_EESt[0]) {
- rtb_Divide_e = ihd_tm_yearEi;
- rtb_Merge1 = ihd_tm_monthEi;
- rtb_Merge3 = ihd_tm_dayEi;
- rtb_Merge2 = ihd_tm_hourEi;
- rtb_Merge4 = ihd_tm_minEi;
- rtb_Merge5 = ihd_tm_secEi;
- } else {
- rtb_Divide_e = rted_tm_year;
- rtb_Merge1 = rted_tm_month;
- rtb_Merge3 = rted_tm_day;
- rtb_Merge2 = rted_tm_hour;
- rtb_Merge4 = rted_tm_min;
- rtb_Merge5 = rted_tm_sec;
- }
- rtb_Add_j = rtb_Divide_e;
- rtb_Product3_f = rtb_Divide_e * 365U;
- rtb_Divide_e = (uint8_T)((uint32_T)rtb_Divide_e >> 2);
- rtb_Divide1 = (uint8_T)(rtb_Add_j / 100U);
- rtb_LogicalOperator1 = ((((uint16_T)(rtb_Add_j % 4) == 0) && ((uint16_T)
- (rtb_Add_j % 100) != 0)) || ((uint16_T)(rtb_Add_j % 400) == 0));
- if (rtb_LogicalOperator1) {
- rtb_Add_j = look1_iu8lu16n16tu16_binlcase((uint8_T)(rtb_Merge1 - 1),
- rtCP_uDLookupTable1_bp01Data_o, rtCP_uDLookupTable1_tableData_g, 11U);
- } else {
- rtb_Add_j = look1_iu8lu16n16tu16_binlcase((uint8_T)(rtb_Merge1 - 1),
- rtCP_uDLookupTable_bp01Data_b, rtCP_uDLookupTable_tableData_k, 11U);
- }
- *rty_ihd_tm_parkTime = (uint16_T)(((((int32_T)IH100_B.Add1 - (int32_T)
- (((((uint16_T)((rtb_Divide_e - rtb_Divide1) - rtb_LogicalOperator1) +
- rtb_Product3_f) + rtb_Add_j) + (uint8_T)(rtb_Merge3 - 1)) * 86400U)) -
- (int32_T)(rtb_Merge2 * 3600U)) - (int32_T)(rtb_Merge4 * 60U)) - rtb_Merge5);
- }
- IH100_DW.UnitDelay1_DSTATE++;
- ihd_tm_realTime = IH100_DW.UnitDelay1_DSTATE / 10U + IH100_B.Add1;
- ihv_flg_EESt[0] = rtev_flg_EESt[0];
- ihv_flg_EESt[1] = rtev_flg_EESt[1];
- ihv_flg_EESt[2] = rtev_flg_EESt[2];
- ihv_flg_EESt[3] = rtev_flg_EESt[3];
- }
- void IH100_initialize(const char_T **rt_errorStatus)
- {
- RT_MODEL_IH100_T *const IH100_M = &(IH100_MdlrefDW.rtm);
- rtmSetErrorStatusPointer(IH100_M, rt_errorStatus);
- }
|