I'm reading and trying to understand Autosar specification for DEM, and stumbled over at the point how the Dem_EventStstusType is defined. It only says the cases,
but there's no such a status which can represnet the "Gray zone" which is neither prepassed nor prefailed. For my case, the gray zone is defined to ensure clear pass or clear fail state and avoid ambiguous state by using a single border in failure threshold. So, the question is, for instance, the sensor voltage was once in a failed zone(=prefailed) then it changed over to the gray zone but not in pass zone, how can I represent this state? Shall it be still prefailed, or prepassed? or shall I define a new using reservied bit(0x05-0xFF)? even is this allowed to do?
I tried to find the solution by googling and GPT, but not successful.
You should be able to handle this in your monitor:
// As defined in EFX libary
boolean Efx_HystCenterHalfDelta_u16_u8(uint16 X, uint16 center, uint16 halfDelta, boolean* state) {
boolean ret = state;
if (X > (center + halfDelta)) {
ret = TRUE;
} else if (X < (center - halfDelta)) {
ret = FALSE;
} else {
ret = state;
}
*state = ret;
return ret;
}
static boolean hyst_state = FALSE;
const uint16 center = 8000; // mV
const uint16 half = 500; // mV
void mon_func(void) {
uint16 v = IoHwAb_GetVoltageX();
boolean state = Efx_HystCenterHalfDelta_u16_u8(v, center, half, &hyst_state);
if (state == FALSE) {
Dem_SetEventStatus(DemEvt_VoltageX_LL, DEM_EVENT_STATUS_FAILED);
} else {
Dem_SetEventStatus(DemEvt_VoltageX_LL, DEM_EVENT_STATUS_PASSED);
}
}
So, it will only report passed/failed, if it is definitely outside your greyzone center-halfDelta < X < center-halfDelta
the changed status.