Skip to content

Commit d947443

Browse files
authored
Automatic reconnection to devices proviided.
1 parent 6184a19 commit d947443

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

iec61850_client/Main.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace OSHMI_IEC61850_Client
3636
{
3737
class Program
3838
{
39-
static public string Version = "OSHMI IEC61850 Client Driver Version 0.8";
39+
static public string Version = "OSHMI IEC61850 Client Driver Version 0.9";
4040
static public string HmiConfigFile = "c:\\oshmi\\conf\\hmi.ini";
4141
static public string OtherHmiIp = "";
4242
static public string ConfigFile = "c:\\oshmi\\conf\\iec61850_client.conf";
@@ -778,6 +778,12 @@ static void Process(Iec61850Server srv)
778778

779779
do
780780
{
781+
// when device disconnected, will abort and keep trying to reconnect
782+
if (con.GetState() != IedConnectionState.IED_STATE_CONNECTED)
783+
{
784+
throw new Exception(srv.name + " Connection error detected!");
785+
}
786+
781787
// foreach (IEC61850_entry entry in srv.entries)
782788
for (int i = 0; i < srv.entries.Count; i++)
783789
{
@@ -1314,7 +1320,7 @@ static void CheckCommands(Iec61850Server srv, IedConnection con)
13141320
Log(srv.name + " Error: " + control.GetLastApplError().error);
13151321
Log(srv.name + " Addit.Cause: " + control.GetLastApplError().addCause);
13161322
break;
1317-
}
1323+
}
13181324
}
13191325
Log(srv.name + " Selected successfully!");
13201326
Thread.Sleep(100);

0 commit comments

Comments
 (0)