CamEra Posted September 28, 2011 Share Posted September 28, 2011 Hi, I have a ICPCON PET 7017 Modbus unit that is connected to DaqFactory using the standard Modbus TCP protocol with standard addressing. Both this unit and the PC are on our internal network and both have static IP addresses. I am not fully sure just when the problem occurs but it is either when the power is turned off then on again on the PC, the Modbus unit or the Hub that both are connected to, but DaqFactory fails to see the Modbus unit and I need to manually go to QuicK/Device Configuration/mydevice then open configure option then back out using the Save and OK buttons. Any ideas how to prevent this? Thanks George Link to comment Share on other sites More sharing options...
AzeoTech Posted September 29, 2011 Share Posted September 29, 2011 Sounds like the socket is getting closed and Windows isn't notifying DAQFactory. You can reinit the port in script by just doing: device.myDevice.initComm() You can detect it by looking for timeout errors, or just looking at your data stream and if data gets old (say older than 10 seconds or something), you trigger an initcomm(). Just make sure and give it another 10 seconds or so to reestablish comms before doing initComm() a second time. Link to comment Share on other sites More sharing options...
CamEra Posted September 29, 2011 Author Share Posted September 29, 2011 Hi, I should have known you would a very simple answer and as always so quick. Thanks. George Link to comment Share on other sites More sharing options...
Livewire Posted July 13, 2012 Share Posted July 13, 2012 Hi Guru, How do I check for timeout errors? By Device.MyDevice.Timeout() ? I have a project I'm currently working on where I need to notify the client via email when the device has a connection error but I dont know how to trigger it?? Please help. Thanks Link to comment Share on other sites More sharing options...
Livewire Posted July 17, 2012 Share Posted July 17, 2012 Hi Guru, How do I check for a timeout error? Im using ModbusTCP connection and want to send an email when I lose the connection, do I check for this by looking for a timeout error? Please help. Link to comment Share on other sites More sharing options...
AzeoTech Posted July 17, 2012 Share Posted July 17, 2012 It depends. If you are using Channels, you'd have to use the OnAlert() system event (see 5.28 in user's guide). If you are using script to poll the device, you can simply catch() the error. Link to comment Share on other sites More sharing options...
Livewire Posted July 19, 2012 Share Posted July 19, 2012 Hi I'm still very new to the software and can't seem to find to much info on how to use onAlert(), could you maybe give me an example? And also how do I implement this into my alarms? Link to comment Share on other sites More sharing options...
AzeoTech Posted July 20, 2012 Share Posted July 20, 2012 See attached sample (will require the latest 5.87a release). All I did was create a modbusRTU device on comm port 20, which, unless you happen to have a comm port 20 with a Modbus device attached, will cause a timeout every 10 seconds. I then created an OnAlert sequence with the following code to display a different message. You can do what you want inside the if(). If you want to capture other errors, use a similar pattern in OnAlert. Note that this technique isn't for capturing errors in sequences. Use try/catch for that. if (strAlert == "P-ModbusRTU 0010: Timeout") ? "Device read timed out"endif[/CODE]I can't quite say how to integrate with your alarms since I don't know how you are doing alarms. If you are using built in alarms, you can either create a Test D to A channel and set it to some value that triggers an alarm, or use a variable.onalertSample.ctl Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.