eWon alarm for BOOL point

Hi,

I am curious if it is possible to make an alarm on a BOOLEAN point inside the flexy 205, where the BOOLEAN is used as a ‘heartbeat’ to verify comms between eWon and outstation device. Example, the BOOL alternates between 0/1 every 1 second, and I would like to raise an alarm when the BOOL either stays ‘0’ or stays ‘1’ for xx seconds without changing. (The value 0/1 does not matter, rather the fact that it does not change is what matters for the alarm).

Is this possible?

BOOL%20point%20Flexy205

Hello,

I think something like this should be possible in the BASIC IDE. I might need a little time to be able to write this up. Just to clarify, you’re going to be reading these boolean values from another device right?

Hi Tim,

Correct - the BOOL value is read into the eWon from a Modbus outstation. Any help you can provide would be great, thank you!

Hello,

I think that this code should be able to work. The only difference would be that you would get rid of the first timer and substitute in your tag reading the heartbeat.

Let me try and explain what I was doing with this too:

  • The first Onchange for @heart was used to create a heartbeat so you won’t need that part
  • The second Onchange for Counter will create an incrementer that will go up 1 each time that the heartbeat tag changes. There is also another tag in there that I called check. This one takes the value of the counter and subtracts a few from it.
  • The Heartbeat function works by taking that value of Check and increments it by 1 each time. This makes it so that if the boolean tag isn’t changing, that the timer will eventually cause the two tags to become equal. If they do become equal from a lack of a heartbeat, it will go into the next function.
  • The noconnect function will then send you out an email that lets you know that there is no more connection. You can also increase the amount of time that it takes to send this by either increasing timer2. It’s currently set to every 30 seconds. So with the 30 seconds and the 5 times it would need to go through without seeing a heartbeat it’ll need to be offline for 2 minutes and 30 seconds.

TSET 1,1
REM This uses the first timer and sets it to happen every 1 second
Onchange “test”, “@heart()”
Onchange “tag1”, “@Counter()”
Onchange “Check”,"@noconnect()"
ONTIMER 1,"@test2()"
TSET 2,30
ONTIMER 2, “@HeartBeat()”
REM This code is executed every time the timer begins (every 1 second)
Function test2()
test@ = test@ + 1
IF test@ > 5 THEN
test@ = 0
ENDIF
//print test@ // Seeing if this function worked
Endfn

Function heart()

If test@ < 3 Then
tag1@ = 0
Else
tag1@ = 1
Endif
//Print tag1@ // Seeing if tag1@ is changing
EndFn

Function Counter()

Counter@ = Counter@+1

If Counter@ > 1000 Then
Counter@ = 0
Check@ = Counter@-5
Endif
//Print Counter@ // Checking that it’s counting up after each change
EndFn

Function HeartBeat()
Check@ = Check@ + 1
Print Check@
EndFn

Function noconnect()
If Check@ = Counter@ Then
Sendmail “Person@email.com”, “ccperson@email.com”, “No Heartbeat From Machine”, “”
Print “Mail Sent”
EndFN

Hi acj,

Just wanted to see if this code worked for you before I close out this ticket

-Tim

Hi Tim,

I’m working through the program today. This is my first time using the IDE, and i’m struggling a bit.

Is there a ‘hello world’ program sample you can point me to so I can figure out how the IDE works?

Thanks!

Hello,

Here’s a basic one that might help you out a little bit

the // acts as the comment system in eWON’s BASIC IDE

TSET 2,10 // The 2 means it’s the second timer and the 30 means it’ll execute every 30 seconds

Ontimer 2, “@HelloWorld()” // This will cause the function to be run based off of Timer 2

Function HelloWorld()

Print “Hello World”

EndFn

Thanks - i’m starting to figure out the Heartbeat program, can you tell me if I need to declare the variables ‘check, test, and counter’ ?
And if yes, how they should be declared?

If you want to use them as variables I would just declare them as 0 somewhere near the top of the code. In my case I made them be tags.

For example:
test = 0
print test

this will give you an output. But if you don’t give the variable an initial value then it will run into errors.

If you do it as a tag it can be done like this:
print test@

The @ symbol will call the tag if it’s put at the end of the string.

Got it, thank you.

Question: I’ve been working with and testing the logic program all day, and now the alarm emails (that were previously working) from Modbus tags no longer work. I can set an alarm condition and no emails are sent.

Any chance this is related to my logic testing?

Are there any logs I can look at in the unit to see why emails aren’t going out?

I already checked my spam filter and they aren’t in there.

The scheduled actions log (see attached image) show the emails going out, but I don’t receive any email. I checked my spam folders / etc, but nothing there.
Anything else I can check?

Hey Acj,

Can I jump on a teamviewer with you and take a look?

That would be great; i’ll let you know when i’m in the office (will be around 9 AM mountain time)

Hi Tim,

Ready when you are. Please give me a call and i’ll share the Teamviewer info.

Hi Tim,

Thanks so much for your help today.

A follow up question: I want to get an email notification when the alarm occurs, as well as when the alarm returns to normal state.

I’ve found this is only possible if ‘Auto acknowledge on RTN’ is NOT checked - but in order for the alarm timestamp to be accurate, it has to be checked. (If not checked, the original timestamp of when the first alarm activated is shown on the email).

Any thoughts on how to do this?

Regards,

Anthony Johnson

Ageto, LLC

Hey Anthony,

You should be able to do this by either moving the tag from a Boolean type to an Integer or Floating Point type, and then setting the alarm low level as well as alarm high level. If the only two values it can receive are a 0 and a 1 you can do this by just setting these values below. This will cause it to send out an alarm saying Alarm Low if the value is 0 and Alarm high if the value is 1.

Great, thanks!

Topic closed due to inactivity.

Hi, How to interlink two boolean tags.

For example
if the Tag 1 value is ‘0’ (digital input), Tag 2 should be ‘0’ (Digital output )
if the Tag 1 value is ‘1’ (digital input) Tag 2 should be ‘1’ (Digital output )

Tag 2 value should be change based on the Tag 1 value

Flexy 102 With ViewON 4.5