How to play a sound file triggered by an Alarm

How to play a sound file triggered by an Alarm
How to play a sound file triggered by an Alarm
29298 | Date Created: 09/23/2004 | Last Updated: 05/30/2015
Access Level: TechConnect
Question


How to play a user specified sound file triggered by an Alarm?
How to play sound when alarm occurs in FactoryTalk View SE v 6.0, 6.10, 7.00, 8.00 on Windows
Server 2008, Windows Vista or Windows 7 Professional?
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.
1. In your SE application, create a digital memory tag, named TAG1_TRIGGER.
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.
EXPRESSION: alm_in_alarm ( TAG1 )
ACTION: &Set TAG1_TRIGGER 1
EXPRESSION: NOT(alm_in_alarm ( TAG1 )) ACTION: &Set TAG1_TRIGGER 0
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.
4. Create an HMI Display screen, called MONITOR_CLIENT_1.
On it, drop a numeric display for TAG1_TRIGGER.
Right click on the object, and select VBA. Edit it to be:
Private Sub NumericDisplay1_Change()
If NumericDisplay1.value = 1 Then
ExecuteCommand "Playwave C:\TAG1isALARMED.WAV"
End If
End Sub
To play the file WAV more than one time, you can use this code:
Private Sub NumericDisplay1_Change()
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 60568Playing 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.
4. Create an HMI Screen (that will be hidden with /ZA).
On this screen create 8 rows (1 per severity):
Severity 1 = # sssssssssssssssssssssssssssssssssssssss
where:
* "Severity 1 =" is text with Color Animation using tag "SevTrig1"
* "#" is a NumericDisplay named "SeverityInd1" (ExposeToVBA = "VBA Control") with the below
expression (step 5) and VBA code (step 6).
* "ssss..." is StringDisplay named "SevSndFile1" (ExposeToVBA = "Type Info Extension")
with Expression: "SevSound1"
Duplicate this line for 2 through 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
6. For NumericDisplay "SeverityInd1" thru "SeverityInd8", place the following in VBA:
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).
Ric Walker, Automation & Electronics, Inc. , Casper, WY
Reply | Flag as Inappropriate |

Post a Comment
Was this helpful?
Email this page
Print
Subscribe to Updates
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.
ROCKWELL AUTOMATION DOES NOT WARRANT THE COMPLETENESS, TIMELINESS OR ACCURACY OF
ANY OF THE DATA CONTAINED IN THIS WEB SITE AND MAY MAKE CHANGES THERETO AT ANY TIME IN
ITS SOLE DISCRETION WITHOUT NOTICE. FURTHER, ALL INFORMATION CONVEYED HEREBY IS PROVIDED
TO USERS "AS IS." IN NO EVENT SHALL ROCKWELL BE LIABLE FOR ANY DAMAGES OF ANY KIND
INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS PROFIT OR DAMAGE, EVEN IF
ROCKWELL AUTOMATION HAVE BEEN ADVISED ON THE POSSIBILITY OF SUCH DAMAGES.
ROCKWELL AUTOMATION DISCLAIMS ALL WARRANTIES WHETHER EXPRESSED OR IMPLIED IN RESPECT
OF THE INFORMATION (INCLUDING SOFTWARE) PROVIDED HEREBY, INCLUDING THE IMPLIED
WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, AND NON-INFRINGEMENT.
Note that certain jurisdictions do not countenance the exclusion of implied warranties; thus, this
disclaimer may not apply to you.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising