Added clauses c) and f) of 13.3.6 (out_of_range) algorithm and enabling transitions from high/low limit states to normal when Event_Enable = 0 for the basic Analog Value and Analog Input objects (#733)

This commit is contained in:
Tomasz Kazimierz Motyl
2024-08-21 20:36:37 +01:00
committed by GitHub
parent d92edd359f
commit cbd5f43684
2 changed files with 50 additions and 35 deletions
+24 -17
View File
@@ -995,10 +995,6 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
if (!CurrentAI) { if (!CurrentAI) {
return; return;
} }
/* check limits */
if (!CurrentAI->Limit_Enable) {
return; /* limits are not configured */
}
if (CurrentAI->Ack_notify_data.bSendAckNotify) { if (CurrentAI->Ack_notify_data.bSendAckNotify) {
/* clean bSendAckNotify flag */ /* clean bSendAckNotify flag */
CurrentAI->Ack_notify_data.bSendAckNotify = false; CurrentAI->Ack_notify_data.bSendAckNotify = false;
@@ -1065,13 +1061,18 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
the HighLimitEnable flag must be set in the Limit_Enable the HighLimitEnable flag must be set in the Limit_Enable
property, and (c) the TO-NORMAL flag must be set in the property, and (c) the TO-NORMAL flag must be set in the
Event_Enable property. */ Event_Enable property. */
if ((PresentVal < if (((PresentVal <
CurrentAI->High_Limit - CurrentAI->Deadband) && CurrentAI->High_Limit - CurrentAI->Deadband) &&
((CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) == ((CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) ==
EVENT_HIGH_LIMIT_ENABLE) && EVENT_HIGH_LIMIT_ENABLE) &&
((CurrentAI->Event_Enable & EVENT_ENABLE_TO_NORMAL) == ((CurrentAI->Event_Enable & EVENT_ENABLE_TO_NORMAL) ==
EVENT_ENABLE_TO_NORMAL)) { EVENT_ENABLE_TO_NORMAL)) ||
if (!CurrentAI->Remaining_Time_Delay) /* 13.3.6 (c) If pCurrentState is HIGH_LIMIT, and the
* HighLimitEnable flag of pLimitEnable is FALSE, then
* indicate a transition to the NORMAL event state. */
(!(CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE))) {
if ((!CurrentAI->Remaining_Time_Delay) ||
(!(CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE)))
CurrentAI->Event_State = EVENT_STATE_NORMAL; CurrentAI->Event_State = EVENT_STATE_NORMAL;
else else
CurrentAI->Remaining_Time_Delay--; CurrentAI->Remaining_Time_Delay--;
@@ -1090,12 +1091,18 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
set in the Limit_Enable property, and set in the Limit_Enable property, and
(c) the TO-NORMAL flag must be set in the Event_Enable (c) the TO-NORMAL flag must be set in the Event_Enable
property. */ property. */
if ((PresentVal > CurrentAI->Low_Limit + CurrentAI->Deadband) && if (((PresentVal >
((CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE) == CurrentAI->Low_Limit + CurrentAI->Deadband) &&
EVENT_LOW_LIMIT_ENABLE) && ((CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE) ==
((CurrentAI->Event_Enable & EVENT_ENABLE_TO_NORMAL) == EVENT_LOW_LIMIT_ENABLE) &&
EVENT_ENABLE_TO_NORMAL)) { ((CurrentAI->Event_Enable & EVENT_ENABLE_TO_NORMAL) ==
if (!CurrentAI->Remaining_Time_Delay) EVENT_ENABLE_TO_NORMAL)) ||
/* 13.3.6 (f) If pCurrentState is LOW_LIMIT, and the
* LowLimitEnable flag of pLimitEnable is FALSE, then
* indicate a transition to the NORMAL event state. */
(!(CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE))) {
if ((!CurrentAI->Remaining_Time_Delay) ||
(!(CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE)))
CurrentAI->Event_State = EVENT_STATE_NORMAL; CurrentAI->Event_State = EVENT_STATE_NORMAL;
else else
CurrentAI->Remaining_Time_Delay--; CurrentAI->Remaining_Time_Delay--;
+26 -18
View File
@@ -1030,10 +1030,6 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
if (!CurrentAV) { if (!CurrentAV) {
return; return;
} }
/* check limits */
if (!CurrentAV->Limit_Enable) {
return; /* limits are not configured */
}
if (CurrentAV->Ack_notify_data.bSendAckNotify) { if (CurrentAV->Ack_notify_data.bSendAckNotify) {
/* clean bSendAckNotify flag */ /* clean bSendAckNotify flag */
CurrentAV->Ack_notify_data.bSendAckNotify = false; CurrentAV->Ack_notify_data.bSendAckNotify = false;
@@ -1105,13 +1101,18 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
the HighLimitEnable flag must be set in the Limit_Enable the HighLimitEnable flag must be set in the Limit_Enable
property, and (c) the TO-NORMAL flag must be set in the property, and (c) the TO-NORMAL flag must be set in the
Event_Enable property. */ Event_Enable property. */
if ((PresentVal < if (((PresentVal <
CurrentAV->High_Limit - CurrentAV->Deadband) && CurrentAV->High_Limit - CurrentAV->Deadband) &&
((CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) == ((CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) ==
EVENT_HIGH_LIMIT_ENABLE) && EVENT_HIGH_LIMIT_ENABLE) &&
((CurrentAV->Event_Enable & EVENT_ENABLE_TO_NORMAL) == ((CurrentAV->Event_Enable & EVENT_ENABLE_TO_NORMAL) ==
EVENT_ENABLE_TO_NORMAL)) { EVENT_ENABLE_TO_NORMAL)) ||
if (!CurrentAV->Remaining_Time_Delay) /* 13.3.6 (c) If pCurrentState is HIGH_LIMIT, and the
* HighLimitEnable flag of pLimitEnable is FALSE, then
* indicate a transition to the NORMAL event state. */
(!(CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE))) {
if ((!CurrentAV->Remaining_Time_Delay) ||
(!(CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE)))
CurrentAV->Event_State = EVENT_STATE_NORMAL; CurrentAV->Event_State = EVENT_STATE_NORMAL;
else else
CurrentAV->Remaining_Time_Delay--; CurrentAV->Remaining_Time_Delay--;
@@ -1131,12 +1132,18 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
set in the Limit_Enable property, and set in the Limit_Enable property, and
(c) the TO-NORMAL flag must be set in the Event_Enable (c) the TO-NORMAL flag must be set in the Event_Enable
property. */ property. */
if ((PresentVal > CurrentAV->Low_Limit + CurrentAV->Deadband) && if (((PresentVal >
((CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE) == CurrentAV->Low_Limit + CurrentAV->Deadband) &&
EVENT_LOW_LIMIT_ENABLE) && ((CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE) ==
((CurrentAV->Event_Enable & EVENT_ENABLE_TO_NORMAL) == EVENT_LOW_LIMIT_ENABLE) &&
EVENT_ENABLE_TO_NORMAL)) { ((CurrentAV->Event_Enable & EVENT_ENABLE_TO_NORMAL) ==
if (!CurrentAV->Remaining_Time_Delay) EVENT_ENABLE_TO_NORMAL)) ||
/* 13.3.6 (f) If pCurrentState is LOW_LIMIT, and the
* LowLimitEnable flag of pLimitEnable is FALSE, then
* indicate a transition to the NORMAL event state. */
(!(CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE))) {
if ((!CurrentAV->Remaining_Time_Delay) ||
(!(CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE)))
CurrentAV->Event_State = EVENT_STATE_NORMAL; CurrentAV->Event_State = EVENT_STATE_NORMAL;
else else
CurrentAV->Remaining_Time_Delay--; CurrentAV->Remaining_Time_Delay--;
@@ -1184,7 +1191,8 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
ExceededLimit = 0; ExceededLimit = 0;
break; break;
} /* switch (ToState) */ } /* switch (ToState) */
debug_printf("Event_State for (%s,%u) goes from %s to %s.\n", debug_printf(
"Event_State for (%s,%u) goes from %s to %s.\n",
bactext_object_type_name(Object_Type), bactext_object_type_name(Object_Type),
(unsigned)object_instance, bactext_event_state_name(FromState), (unsigned)object_instance, bactext_event_state_name(FromState),
bactext_event_state_name(ToState)); bactext_event_state_name(ToState));