Robyn Posted October 7, 2012 Share Posted October 7, 2012 Hi, I have tried to find something on this topic in the forums as I thought it would be a common theme. I am looking for the best way of finding that a device is working, is online and communicating. In my case I have many Modbus devices on a serieal radio connection but the problem is general. I want to determine if the device is actually communicating. I noticed a post using the OnAlert() function to look at strings in the alert window. Your example there works fine but I don't see how it would tell me which device on a daisy chain was not talking. There is nothing in the alert which gives the station address or name. I guess I can try checking data from reads and see if it is out of date, I could even force a read of a dummy point at regular intervals and check for a return on each station, but as a general rule, what would you suggest as the neatest way. Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted October 8, 2012 Share Posted October 8, 2012 The best way is to use data age. Look at the time stamp on the most recent data point and compare to the current system time. You can do all channels using a pretty basic script: private string chanList = channel.listall()for (private i = 0, i < numrows(chanList), i++) if (systime() - evaluate(chanList[i] + ".time[0]") > 300) ? chanList[i] + " hasn't received data in over 5 minutes!" endifendfor[/CODE]That's just a basic sample. You can do a lot more with it. If you have output channels, you'll probably want to put them in a different group. You can then pass the group name for your input channels to the listAll() function (as a string). Link to comment Share on other sites More sharing options...
mike72 Posted November 30, 2012 Share Posted November 30, 2012 hi guru ive been looking around but cant find an answer to this, but i would love to put a discriptive text, or at least an indication,on one of my pages telling me when a channel loses its input after a certain time. how would i go about this and can you show me an example please. mike Link to comment Share on other sites More sharing options...
AzeoTech Posted November 30, 2012 Share Posted November 30, 2012 Do you want the descriptive text to display all the time? The general expression would be, for example: systime() - myChannel.Time[0] > 600 where myChannel is the name of the channel, and 600 is the number of seconds before the indicator changes from OK to overdue (or goes from invisible to visible). If you just want the text to change, put this in the main expression. If you want the control to disappear, put this in the Visible property (strVisible if accessing from script) Link to comment Share on other sites More sharing options...
mike72 Posted December 1, 2012 Share Posted December 1, 2012 yip, that does it guru, thanks a ton mike Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.