Question:
How can I change, at runtime, the sub-conditions messages (in and out) of a discrete alarm inside an Elipse E3‘s XObject? For example, can I add the Name property of the instanced object to the sub-conditions messages?
Solution:
Firstly, XObjects are data libraries where you can set up a data structure to be executed at server level. This structure is responsible for calculations, associations, communications, alarms checking, historic record, etc.; these don’t depend on an open and/or running graphic interface (Viewer) to take place. In order to create an XObject, right-click the .lib file in the Organizer and then choose the option Add–XObject.
To tie the name of the XObject to the sub-condition messages (in/out), you can use an association at DiscreteReturnMessageText property.
The DiscreteReturnMessageText property represents this alarm’s return message.
DiscreteReturnMessageText <- "Falha Motor_" & XOMotor.Name
The input messages for the sub-conditions can receive a fixed value directly to the Alarm's properties screen; to do so, access Discrete tab, and then edit the Message text column.
In order to change the sub-conditions messages at runtime, you will need to use scripts. The discrete alarm's source SubConditions property will return an object that is itself a collection of this alarm's sub-conditions.
Example:
For each obj in Application.GetObject("Dados1.AlarmeDiscreto1").SubConditions msgbox obj.Message Next
Therefor, a possible solution would be to edit the text of all sub-conditions messages directly at the XObject's Constructor event:
Sub XOMotor_Constructor() Set Alarme = Item("cfgAlarm").Item("cav").Item("AlarmeDiscreto").SubConditions For each obj in Alarme obj.Message = Name & " – " & obj.Message Next End Sub
Related articles: