|
@@ -1,9 +1,9 @@
|
|
|
#include "DAM.h"
|
|
|
#include <math.h>
|
|
|
-#include "DAM_private.h"
|
|
|
#include "rtwtypes.h"
|
|
|
#include "BCUDisp.h"
|
|
|
#include "BCUCal.h"
|
|
|
+#include "DAM_private.h"
|
|
|
|
|
|
MdlrefDW_DAM_T DAM_MdlrefDW;
|
|
|
B_DAM_c_T DAM_B;
|
|
@@ -11,6 +11,7 @@ DW_DAM_f_T DAM_DW;
|
|
|
void DAM_Init(void)
|
|
|
{
|
|
|
DAM_DW.If_ActiveSubsystem = -1;
|
|
|
+ DAM_DW.UnitDelay_DSTATE_a = true;
|
|
|
}
|
|
|
|
|
|
void DAM_Disable(void)
|
|
@@ -23,16 +24,12 @@ void DAM(void)
|
|
|
real32_T rtb_Product;
|
|
|
real32_T rtb_Product_tmp;
|
|
|
int8_T rtPrevAction;
|
|
|
- boolean_T rtb_Switch2_j;
|
|
|
- if (DAM_DW.UnitDelay_DSTATE + 1.0 <= DAM_ConstB.Add) {
|
|
|
- DAM_DW.UnitDelay_DSTATE++;
|
|
|
- } else {
|
|
|
- DAM_DW.UnitDelay_DSTATE = DAM_ConstB.Add;
|
|
|
- }
|
|
|
-
|
|
|
- if (DAM_DW.UnitDelay_DSTATE == 1.0) {
|
|
|
+ boolean_T rtb_RelationalOperator;
|
|
|
+ rtb_RelationalOperator = DAM_DW.UnitDelay_DSTATE_a;
|
|
|
+ DAM_DW.UnitDelay_DSTATE_a = false;
|
|
|
+ if (rtb_RelationalOperator) {
|
|
|
uint8_T rtb_Merge10;
|
|
|
- if (ihv_flg_EESt[3]) {
|
|
|
+ if (ihv_flg_EESt[0]) {
|
|
|
DAM_B.Merge = 0.0F;
|
|
|
DAM_B.Merge1 = 0.0F;
|
|
|
DAM_B.Merge2 = 0.0F;
|
|
@@ -41,8 +38,11 @@ void DAM(void)
|
|
|
DAM_B.Merge5 = 0.0F;
|
|
|
DAM_B.Merge6 = 0.0F;
|
|
|
DAM_B.Merge7 = 0.0F;
|
|
|
+ DAM_B.Merge11 = 0.0F;
|
|
|
+ DAM_B.Merge12 = 0.0F;
|
|
|
DAM_B.Merge8 = 0U;
|
|
|
DAM_B.Merge9 = 0U;
|
|
|
+ DAM_B.Merge13 = 0U;
|
|
|
rtb_Merge10 = 0U;
|
|
|
} else {
|
|
|
DAM_B.Merge = damd_E_totalChrgEngEi;
|
|
@@ -53,8 +53,11 @@ void DAM(void)
|
|
|
DAM_B.Merge5 = damd_Q_totalRegenCpEi;
|
|
|
DAM_B.Merge6 = damd_E_totalVehChrgEngEi;
|
|
|
DAM_B.Merge7 = damd_E_totalSatChrgEngEi;
|
|
|
+ DAM_B.Merge11 = damd_Q_totalVehChrgCpEi;
|
|
|
+ DAM_B.Merge12 = damd_Q_totalSatChrgCpEi;
|
|
|
DAM_B.Merge8 = damd_Nr_totalChgEi;
|
|
|
DAM_B.Merge9 = damd_Nr_totalVehChrgEi;
|
|
|
+ DAM_B.Merge13 = damd_Nr_totalStaChrgEi;
|
|
|
rtb_Merge10 = damd_st_chgCnctObjEi;
|
|
|
}
|
|
|
|
|
@@ -64,22 +67,26 @@ void DAM(void)
|
|
|
rtb_Product_tmp = fabsf(ihd_I_battCurr_T2);
|
|
|
rtb_Product = rtb_Product_tmp * ihd_V_battU_T2;
|
|
|
if (dcmd_st_chrgSt_T2 == chrging) {
|
|
|
+ boolean_T rtb_Switch1_m;
|
|
|
DAM_DW.UnitDelay_DSTATE_d += rtb_Product_tmp;
|
|
|
- DAM_B.Gain_m = DAM_DW.UnitDelay_DSTATE_d * damc_tm_step * 0.000277777785F;
|
|
|
DAM_DW.UnitDelay1_DSTATE_p += rtb_Product;
|
|
|
+ rtb_RelationalOperator = (hvmd_st_chgCnctObj_T2 == vehicle);
|
|
|
+ rtb_Switch1_m = (hvmd_st_chgCnctObj_T2 == chgStation);
|
|
|
+ DAM_B.Gain_m = DAM_DW.UnitDelay_DSTATE_d * damc_tm_step * 0.000277777785F;
|
|
|
DAM_B.Gain1_b = DAM_DW.UnitDelay1_DSTATE_p * damc_tm_step * 2.77777787E-7F;
|
|
|
- DAM_B.Product2 = (real32_T)(hvmd_st_chgCnctObj_T2 == vehicle) *
|
|
|
- DAM_B.Gain1_b;
|
|
|
- DAM_B.Product3 = (real32_T)(hvmd_st_chgCnctObj_T2 == chgStation) *
|
|
|
- DAM_B.Gain1_b;
|
|
|
+ DAM_B.Product2 = DAM_B.Gain1_b * (real32_T)rtb_RelationalOperator;
|
|
|
+ DAM_B.Product3 = DAM_B.Gain1_b * (real32_T)rtb_Switch1_m;
|
|
|
+ DAM_B.Product4 = DAM_B.Gain_m * (real32_T)rtb_RelationalOperator;
|
|
|
+ DAM_B.Product5 = DAM_B.Gain_m * (real32_T)rtb_Switch1_m;
|
|
|
} else {
|
|
|
boolean_T rtb_Switch1_m;
|
|
|
- rtb_Switch2_j = (ihd_I_battCurr_T2 < 0.0F);
|
|
|
- DAM_DW.UnitDelay1_DSTATE_o += rtb_Product_tmp * (real32_T)rtb_Switch2_j;
|
|
|
+ rtb_RelationalOperator = (ihd_I_battCurr_T2 < 0.0F);
|
|
|
+ DAM_DW.UnitDelay1_DSTATE_o += rtb_Product_tmp * (real32_T)
|
|
|
+ rtb_RelationalOperator;
|
|
|
rtb_Switch1_m = (ihd_I_battCurr_T2 > 0.0F);
|
|
|
DAM_DW.UnitDelay4_DSTATE_g += rtb_Product_tmp * (real32_T)rtb_Switch1_m;
|
|
|
DAM_DW.UnitDelay7_DSTATE_l += rtb_Product * (real32_T)rtb_Switch1_m;
|
|
|
- DAM_DW.UnitDelay2_DSTATE_e += rtb_Product * (real32_T)rtb_Switch2_j;
|
|
|
+ DAM_DW.UnitDelay2_DSTATE_e += rtb_Product * (real32_T)rtb_RelationalOperator;
|
|
|
DAM_B.Gain1_n = DAM_DW.UnitDelay1_DSTATE_o * damc_tm_step * 0.000277777785F;
|
|
|
DAM_B.Gain2 = DAM_DW.UnitDelay4_DSTATE_g * damc_tm_step * 0.000277777785F;
|
|
|
DAM_B.Gain3 = DAM_DW.UnitDelay7_DSTATE_l * damc_tm_step * 2.77777787E-7F;
|
|
@@ -90,12 +97,16 @@ void DAM(void)
|
|
|
damd_E_totalChrgEngEo = damd_E_totalChrgEng;
|
|
|
damd_Q_totalChrgCp = DAM_B.Merge1 + DAM_B.Gain_m;
|
|
|
damd_Q_totalChrgCpEo = damd_Q_totalChrgCp;
|
|
|
- DAM_DW.UnitDelay1_DSTATE_k = (uint8_T)((uint32_T)((DAM_DW.UnitDelay_DSTATE_a ==
|
|
|
+ DAM_DW.UnitDelay1_DSTATE_k = (uint8_T)((uint32_T)((DAM_DW.UnitDelay_DSTATE_ac ==
|
|
|
noChrg) && (dcmd_st_chrgSt_T2 == chrging)) + DAM_DW.UnitDelay1_DSTATE_k);
|
|
|
- rtb_Switch2_j = (hvmd_st_chgCnctObj_T2 == vehicle);
|
|
|
- damd_Nr_totalVehChrg = (uint16_T)(DAM_B.Merge9 + (uint32_T)(rtb_Switch2_j ?
|
|
|
- (int32_T)DAM_DW.UnitDelay1_DSTATE_k : 0));
|
|
|
+ rtb_RelationalOperator = (hvmd_st_chgCnctObj_T2 == vehicle);
|
|
|
+ damd_Nr_totalVehChrg = (uint16_T)(DAM_B.Merge9 + (uint32_T)
|
|
|
+ (rtb_RelationalOperator ? (int32_T)DAM_DW.UnitDelay1_DSTATE_k : 0));
|
|
|
damd_Nr_totalVehChrgEo = damd_Nr_totalVehChrg;
|
|
|
+ damd_Q_totalVehChrgCp = DAM_B.Merge11 + DAM_B.Product4;
|
|
|
+ damd_Q_totalVehChrgCpEo = damd_Q_totalVehChrgCp;
|
|
|
+ damd_Q_totalSatChrgCp = DAM_B.Merge12 + DAM_B.Product5;
|
|
|
+ damd_Q_totalSatChrgCpEo = damd_Q_totalSatChrgCp;
|
|
|
damd_E_totalDisChrgEng = DAM_B.Merge2 + DAM_B.Gain3;
|
|
|
damd_E_totalDisChrgEngEo = damd_E_totalDisChrgEng;
|
|
|
damd_Q_totalDisChrgCp = DAM_B.Merge3 + DAM_B.Gain2;
|
|
@@ -104,11 +115,14 @@ void DAM(void)
|
|
|
damd_E_totalRegenEngEo = damd_E_totalRegenEng;
|
|
|
damd_Q_totalRegenCp = DAM_B.Merge5 + DAM_B.Gain1_n;
|
|
|
damd_Q_totalRegenCpEo = damd_Q_totalRegenCp;
|
|
|
+ damd_Nr_totalStaChrg = (uint16_T)((uint32_T)(hvmd_st_chgCnctObj_T2 ==
|
|
|
+ chgStation ? (int32_T)DAM_DW.UnitDelay1_DSTATE_k : 0) + DAM_B.Merge13);
|
|
|
+ damd_Nr_totalStaChrgEo = damd_Nr_totalStaChrg;
|
|
|
damd_E_totalVehChrgEng = DAM_B.Merge6 + DAM_B.Product2;
|
|
|
damd_E_totalVehChrgEngEo = damd_E_totalVehChrgEng;
|
|
|
damd_E_totalSatChrgEng = DAM_B.Merge7 + DAM_B.Product3;
|
|
|
damd_E_totalSatChrgEngEo = damd_E_totalSatChrgEng;
|
|
|
- damd_Nr_totalChg = (uint16_T)((uint32_T)(rtb_Switch2_j &&
|
|
|
+ damd_Nr_totalChg = (uint16_T)((uint32_T)(rtb_RelationalOperator &&
|
|
|
(DAM_B.DataTypeConversion == chgStation)) + DAM_B.Merge8);
|
|
|
damd_Nr_totalChgEo = damd_Nr_totalChg;
|
|
|
damd_st_chgCnctObjEo = hvmd_st_chgCnctObj_T2;
|
|
@@ -126,7 +140,7 @@ void DAM(void)
|
|
|
DAM_B.Gain1 = DAM_DW.UnitDelay1_DSTATE_c * damc_tm_step * 2.77777787E-7F;
|
|
|
} else {
|
|
|
if (rtPrevAction != 1) {
|
|
|
- DAM_DW.UnitDelay_DSTATE_b = 0.0F;
|
|
|
+ DAM_DW.UnitDelay_DSTATE = 0.0F;
|
|
|
DAM_DW.UnitDelay1_DSTATE = 0.0F;
|
|
|
DAM_DW.UnitDelay4_DSTATE = 0.0F;
|
|
|
DAM_DW.UnitDelay5_DSTATE = 0.0F;
|
|
@@ -136,18 +150,18 @@ void DAM(void)
|
|
|
DAM_DW.UnitDelay7_DSTATE = 0.0F;
|
|
|
}
|
|
|
|
|
|
- DAM_DW.UnitDelay_DSTATE_b += rtb_Product_tmp;
|
|
|
+ DAM_DW.UnitDelay_DSTATE += rtb_Product_tmp;
|
|
|
DAM_DW.UnitDelay1_DSTATE += rtb_Product;
|
|
|
DAM_DW.UnitDelay4_DSTATE += rtb_Product_tmp;
|
|
|
DAM_DW.UnitDelay5_DSTATE += rtb_Product;
|
|
|
- if (ihd_I_battCurr_T2 > 0.0F) {
|
|
|
- DAM_DW.UnitDelay2_DSTATE = DAM_DW.UnitDelay_DSTATE_b * damc_tm_step *
|
|
|
+ if (ihd_I_battCurr_T2 < 0.0F) {
|
|
|
+ DAM_DW.UnitDelay2_DSTATE = DAM_DW.UnitDelay_DSTATE * damc_tm_step *
|
|
|
0.000277777785F;
|
|
|
DAM_DW.UnitDelay3_DSTATE = DAM_DW.UnitDelay1_DSTATE * damc_tm_step *
|
|
|
2.77777787E-7F;
|
|
|
}
|
|
|
|
|
|
- if (ihd_I_battCurr_T2 < 0.0F) {
|
|
|
+ if (ihd_I_battCurr_T2 > 0.0F) {
|
|
|
DAM_DW.UnitDelay6_DSTATE = DAM_DW.UnitDelay4_DSTATE * damc_tm_step *
|
|
|
0.000277777785F;
|
|
|
DAM_DW.UnitDelay7_DSTATE = DAM_DW.UnitDelay5_DSTATE * damc_tm_step *
|
|
@@ -161,7 +175,7 @@ void DAM(void)
|
|
|
damd_Q_disChrgCp = DAM_DW.UnitDelay6_DSTATE;
|
|
|
damd_E_regenEng = DAM_DW.UnitDelay3_DSTATE;
|
|
|
damd_Q_regenCp = DAM_DW.UnitDelay2_DSTATE;
|
|
|
- DAM_DW.UnitDelay_DSTATE_a = dcmd_st_chrgSt_T2;
|
|
|
+ DAM_DW.UnitDelay_DSTATE_ac = dcmd_st_chrgSt_T2;
|
|
|
}
|
|
|
|
|
|
void DAM_initialize(const char_T **rt_errorStatus)
|