Professional Documents
Culture Documents
How To Play A Sound File Triggered by An Alarm
How To Play A Sound File Triggered by An Alarm
Question
Background
RSView SE does not support RSMessenger at this time, and playing a specific wave file based on a
specific alarmed tag’s alarmed status is not handled by native RSView SE functions.
However, an ActiveX control is available to implement this feature, documented in 7779 - How to play a
sound file triggered by an Alarm.
According to 122207 - FactoryTalk View SE - Internal bell does not sound when HMI alarm is
triggered internal bell does not work in environment FactoryTalk View SE v 6.0, 6.10, 7.00, 8.00 on
Windows Server 2008, Windows Vista or Windows 7 Professional therefore it is necessary to use
workaround.
Solution
This note shows one how to configure an HMI Server so that one can fire a wave file on an SE client PC
via an individual or set of tags alarmed status.
One can set this up by taking advantage of an Event, by using a startup macro, and by silently running a
client display screen that takes advantage of some VBA code bound to a numeric display object. This
example will show how to play a wave file called TAG1isALARMED.WAV, a wave file that we have
created or copied to Client PC's " C:\ " for this purpose. In this example we want to play the
TAG1isALARMED.WAV on a remote client, when a basic alarmed tag, we'll call it TAG1, goes into alarm.
2. In your SE application, create an Event and save it as an event file. We'll start it in a client
startup macro later. We'll use two rows in our event to toggle the trigger back and forth.
We could have also used other Alarm Acknowledgment conditions, if the application called for
it.
Note that if all we had were digital alarms, then TAG1_TRIGGER and TAG1 could be replaced by
just TAG1 instead, but this example, as is, applies to an analog tag too.
Also note that we can use wildcards in the expression syntax, to monitor of group of alarmed
tags.
3. Be sure to start this Event by setting it up appropriately in a startup macro or in the HMI server's
components setup.
To play the file WAV more than one time, you can use this code:
If NumericDisplay1.Value = 1 Then
For x = 1 To 10
If NumericDisplay1.Value = 1 Then
ExecuteCommand "Playwave C:\TAG1isALARMED.WAV"
Else
'Exit from loop
Exit For
End If
Next x
End If
End Sub
5. In the startup macro of the Test Client, insert the Display MONITOR_CLIENT_1 /ZA
command. This will run the display screen and enable VBA monitoring of our TAG1_TRIGGER
Tag, which we are Event monitoring. This can fire off the WAV file locally.
6. On the test client’s PC, copy the file TAG1isALARMED.WAV to c:\. This will be the file played
when TAG1 goes into alarm. The user may want to decide which wave files he would like played
per alarmed tag, and organize those files on the client PC accordingly in advance.
7. Test the HMI client under an alarmed state to be sure that native computer wave file playback is
functional.
Caution
Running more than one SE Client instance on a computer and issuing the 'PlayWave' commands may
cause them to get queued up which will affect the display screen callup times - which over time will
become slower and slower. VBA code. or other method should be used to allow only one of the
instances of the SE Client to run the PlayWave commands.
NOTE: With FactoryTalk Alarms and Events, an Alarm Banner object can play a sound. See 60568-
Playing a sound file triggered by a FactoryTalk Alarm and Events alarm for details.
Comments (1)
Mr.Ric
09/11/2013 12:17 PM [Edited]
Because VBA in the project is single threaded, if you are using any other VBA (such as for
navigation or Display_AnimationStart), the above "To play the file WAV more than one time..."
will not work. Here is a better way:
1. Create 8 HMI Digital Device Tags (not memory tags) called "SevTrig1" to "SevTrig8".
2. Create 8 HMI String Memory Tags called "SevSound1" to "SevSound8" (retentive) and set
initial value to your your wav files including full path (Ex: C:\AlmSound\Sound.wav)
3. In the Alarm Setup / Severities tab: Place "SevTrig#" tags in External Bell for Severity 1 thru 8.
5. In the NumericDisplay Properties / Expression, place the following expression (adjust for 2-7):
* SeverityInd1 Expression:
IF system\AlarmSummaryItemsUnacked == 0 THEN 0
ELSE IF SevTrig1 AND interval( "5 Sec" ) THEN 1
ELSE 0
* SeverityInd8 Expression:
IF system\AlarmSummaryItemsUnacked == 0 THEN 0
ELSE IF SevTrig1 THEN 0
ELSE IF SevTrig2 THEN 0
ELSE IF SevTrig3 THEN 0
ELSE IF SevTrig4 THEN 0
ELSE IF SevTrig5 THEN 0
ELSE IF SevTrig6 THEN 0
ELSE IF SevTrig7 THEN 0
ELSE IF SevTrig8 AND interval( "5 Sec" ) THEN 1
ELSE 0
Sub SeverityInd1_Change()
On Error Goto Exit_Err
If SeverityInd1.Value = 1 Then
DisplayClient.Application.ExecuteCommand "PlayWave " & ThisDisplay.SevSndFile1.Value
End if
Exit_Err:
End Sub
By following this pattern, the individual playwave above will then fire once every five seconds
only for the most important severity active. That will allow other VBA code to run during page
changes, etc.
In my system this hidden page is called "AlmHornCtrl". I also have a page "AlmHornSelect" that
allows adjustment of the sound files used during runtime (use either VBA or StringInput).
Post a Comment
DISCLAIMER
This knowledge base web site is intended to provide general technical information on a particular
subject or subjects and is not an exhaustive treatment of such subjects. Accordingly, the information in
this web site is not intended to constitute application, design, software or other professional
engineering advice or services. Before making any decision or taking any action, which might affect your
equipment, you should consult a qualified professional advisor.