[feature-12986, 15300]Unacknowledged Alarm Sound

I am working on Perspective module, 8.0.1(but I am going to be updating it to 8.0.2 today). I would like to play an alarm sound when there is an unacknowledged alarm. I have been researching this, but this scripting environment is all new to me and very greek. I am really hoping someone can give me a simple way of doing this start to finish.

One problem I am encountering is how this is going to work across platforms. I have looked into the system.util.playSoundClip but from everything I read so far I am not sure how that will work with different devices. I would like to have the alarm play whether someone is on a desktop pc, an android tablet, or an iPhone.

Is this doable? Seems it should be since the program is represented to be used for SCADA systems. I would assume most people with these systems would want audible alarms for the times that someone is not sitting directly in front of a screen.

I suppose that having the audible alarm sound is not detrimental to have on the mobile devices since they will mostly be used for intermediate tasks. But if it’s possible that would be great.

Thanks for the help in advance. I really want to make the switch over to this software for our system, and so far I am being able to figure out a lot of the things that will make it work for us, but little things like this seem to keep me hanging up.

Perspective actually doesn’t yet have the ability to play sounds unsolicited. system.util.playSoundClip only works from inside a Vision client (the system.util designation is a little misleading, but can’t be changed due to backwards compatibility). It’s on our feature roadmap, but at a fairly low priority. I’ll add this thread to the ticket, but another way to increase visibility would be to post on ideas.inductiveautomation.com so we can evaluate community interest in the idea.

Use an invisible IFrame, and bind src to (don’t take this literally :wink: ):

if(something = 1,
   'http://path/to/some/noise.mp3',
   ''
  )
3 Likes

Thanks for the info. I have been out the last few days so I did not have a chance to respond yet. I’ll post over there on the other site to gain some interest. Seems odd to me though, but maybe we just have a different type of SCADA system. I could not really imagine having a full fledged SCADA system that did not have sound associated with an alarm. We only have so many people on staff so sometimes they are not sitting in front of the screen. During those times its nice to have an audible alarm to let them know something is taking place so they can get back to the screen and check it out.

This will work inside of perspective?

If you wouldn’t mind, I am really new to scripting, if there is anyway you could give me a little more steps on how to link it to an alarm that would be a tremendous help. I am just lost in how to do that part.

Thanks

Sure! This attachment of a view uses a checkbox to illustrate the idea.

alarm_test_perspective_view_2019-06-04_1217.zip (2.7 KB)

In the iFrame component, named Sound, because I’m tired and lacking imagination, the src property uses an expression to bind to the selected property of the checkbox.

if({../Checkbox.props.selected},
	"http://www.reelclassics.com/Audio_Video/Music7q/clips/bernstein_greatescapemarch_clip.mp3",
	""
	)

If you want to tie it to a tag alarm:

if({[default]Test/TagName/Alarms/AlarmName.IsActive},
	"http://www.reelclassics.com/Audio_Video/Music7q/clips/bernstein_greatescapemarch_clip.mp3",
	""
	)

Thanks! I will play around with this. I think I get the jist of it.

Only problem(small, I think I’ll be able to figure it out) is how to import/view that file you sent. Most of all this is very new to me, I’ve only come from a windows point and click system, not a programming type one. If that makes sense.

Go under File → Import and follow the prompts. :slight_smile:

Ok, wow, I officially feel like I really don’t know anything.

I tried that earlier, but I had already unzipped the file and put it in my documents. So when I went to import(which I figured it was the thing to do) I did not see the right file extensions. Never hit me that at the bottom there it has .zip for an option…:man_facepalming:

Thanks again. I really want to make this software work for us. I love the look and feel of it for using it as our interface, but the programing/setting up of it has really been a learning curve for me.

Got it up. I think this will be the workaround for sure. I plan on just linking it to play only when there is an alarm that is unacknowledged.

I am going to have to definitely play around with it. I am going to have to believe there will be a way to loop a sound until the alarm is acknowledged.

I haven't had a chance to play with perspective yet, but I'm guessing you can add a time condition to the binding something like below to cause it to loop:

if({[default]Test/TagName/Alarms/AlarmName.IsActive} && {[default]Test/AlarmLoopSeconds} < 5),
	"http://www.reelclassics.com/Audio_Video/Music7q/clips/bernstein_greatescapemarch_clip.mp3",
	""
	)

This assumes the sound is less than five seconds long and that you have a tag that increments by one each second and resets to zero when it reaches the number of seconds you'd like for the repeat rate.

Thanks. I am not sure that will work for me though. I just want it to activate when there is any alarm that is not acknowledged. Seems that would be easier than binding it to each and every tag that has an alarm?

I was looking around and saw that there is a ‘while loop’ in Python? I have to wonder if that would not work.

On another note, a guy I work with brought up the idea that if we use an external sound source then we would not get an audible alarm. So I started up the Microsoft IIS web server and put the sound file on it. Now, we can loose outside internet at our facility but still have an audible alarm.

Just have to figure out a loop and this one will be solved for me.

If you just want to trigger an event when there are any active, unacked alarms, then bind to the [System]Gateway/Alarming/Active and Unacked tag - whenever it’s greater than 0, you have cleared, unacked alarms.

Thanks. I figured there was something like that because the sample Perspective project had the icon up in the corner that would flash when there was an unacknowledged alarm.

I went ahead and configured a tag that is based on a timer that resets after it reaches 5. However, I am having trouble with the expression working. When I put the script in that witman gave me, it gives me an "Error_Configuration".

if({[System]Gateway/Alarming/Active and Unacked} && {[Tags]Front Panel RTU/Alarm Repeater} < 5),
"http://192.168.247.213/alarm.wav",
""
)

Eureka!!!! I played around long enough I got it. Thanks to all for the help!

Here is the final expression

if({[System]Gateway/Alarming/Active and Unacked} && {Front Panel RTU/Alarm Repeater} < 5,
"http://192.168.247.213/alarm.wav",
""
)

Also, I had to up the timer to 6 seconds as my sound clip is exactly 5 seconds. It would not repeat until I did this.

Thanks again. On to the next step in my project.

1 Like

Yes, for this logic to work the value must go above the less than value check by at least one otherwise the condition will not go false at the end of a cycle. The false to true transition is required to cause the repeat.

That makes complete sense.

Is there a way to make an internal tag count up and then reset after a certain number? This way I would not have to depend on an external tag.

By internal tag I’m thinking you mean a memory or expression tag rather than an OPC tag. You could use an expression tag based on time for this–something like the following, which would loop 0-9 repeatedly, incrementing each second:
image
Alternatively, you could use a memory tag and increment/reset it via a gateway timer script.

Yes, that is exactly what I mean. I apologize, I am still learning the Ignition language versus the other software I have used.

I am gonna try that and see how it works. Many thanks.

Works like a charm. Thanks again.

Makes me realize I have a LOT to learn.