public virtual void SetLimitState(
ISystemContext context,
LimitAlarmStates limit)
{
if (this.HighState != null)
{
UpdateState(this.HighState, ((limit & LimitAlarmStates.High) != 0 || (limit & LimitAlarmStates.HighHigh) != 0));
}
if (this.HighHighState != null)
{
UpdateState(this.HighHighState, (limit & LimitAlarmStates.HighHigh) != 0);
}
if (this.LowState != null)
{
UpdateState(this.LowState, ((limit & LimitAlarmStates.Low) != 0 || (limit & LimitAlarmStates.LowLow) != 0));
}
if (this.LowLowState != null)
{
UpdateState(this.LowLowState, (limit & LimitAlarmStates.LowLow) != 0);
}
// select an appropriate effective display name for the active state.
TranslationInfo displayName = null;
if ((limit & LimitAlarmStates.HighHigh) != 0)
{
displayName = new TranslationInfo(
"ConditionStateHighHighActive",
"en-US",
ConditionStateNames.HighHighActive);
}
else if ((limit & LimitAlarmStates.LowLow) != 0)
{
displayName = new TranslationInfo(
"ConditionStateLowLowActive",
"en-US",
ConditionStateNames.LowLowActive);
}
else if ((limit & LimitAlarmStates.High) != 0)
{
displayName = new TranslationInfo(
"ConditionStateHighActive",
"en-US",
ConditionStateNames.HighActive);
}
else if ((limit & LimitAlarmStates.Low) != 0)
{
displayName = new TranslationInfo(
"ConditionStateLowActive",
"en-US",
ConditionStateNames.LowActive);
}
else
{
displayName = new TranslationInfo(
"ConditionStateInactive",
"en-US",
ConditionStateNames.Inactive);
}
// update the active superstae.
SetActiveEffectiveSubState(context, new LocalizedText(displayName), DateTime.UtcNow);
UpdateEffectiveState(context);
}
#endregion