How can I access S7-200 SMART using PLC4x in Java?

194 Views Asked by At

I want to access S7-200 Smart using PLC4x. I have tested PLC4x on S7-1200, and it works. However, when I try to access S7-200, it always fails.

The CPU of the PLC is 6ES7 288.

Here are the code snippets:

plc.connectionURL = "s7://192.168.1.34";

PlcConnection plcConnection = driverManager.getConnection(plc.connectionURL);

When I try to connect, an error occurs and the following exception is thrown:

23:13:45.914 [nioEventLoopGroup-2-1] WARN i.n.channel.DefaultChannelPipeline - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.

Caused by: java.util.concurrent.ExecutionException: org.apache.plc4x.java.api.exceptions.PlcIoException: Connection terminated by remote.

I have also tried accessing the same PLC using the tool from http://www.hslcommunication.cn/ and it works properly. Therefore, the PLC does not seem to be the problem.

I have also tried using the s7connector library, but it only works on S7-1200, not on S7-200 Smart.

Please help me and thanks very much!

1

There are 1 best solutions below

1
On

Please try the following

If you want to use the S7200 smart thing ... you need to tell the driver about the type of plc, so it will not ask the PLC. Because in case of the S7200 it just hangs up (which you are seeing in your exception) ... so please add: ?controller-type=S7_200 To your connection string.

See detail plc4x/issues/731