Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot write singe BOOL or BYTE to PLC with Object PLC Mapping #701

Open
floka94 opened this issue Dec 16, 2022 · 10 comments
Open

Cannot write singe BOOL or BYTE to PLC with Object PLC Mapping #701

floka94 opened this issue Dec 16, 2022 · 10 comments

Comments

@floka94
Copy link

floka94 commented Dec 16, 2022

I am trying to write a single BOOL value to a Siemens S7-400 PLC with the OPM Feature.

Here is my Entity:

@PlcEntity
public class NewDataSetReady {

    @PlcField("%DB9002:5.0:BOOL")
    public boolean isDataSetReady;

    public NewDataSetReady() {
        // For OPC
    }

}

Here is my write operation:

NewDataSetReady newDataSetReady = new NewDataSetReady();
newDataSetReady .setIsDataSetReady(false);
NewDataSetReady newDataSetReadyResponse = entityManager.write(NewDataSetReady.class, connectionString, newDataSetReady);

After the write operation i get the following warning and my value is not persisted:

[org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic] (nioEventLoopGroup-2-1) Got an error response from the PLC. This particular response code usually indicates that PUT/GET is not enabled on the PLC.

Here is a snapshot from the ISOTCP Protocoll communication between PLC4X and S7-400 (from Wireshark):

Write data to PLC:
image

Response from PLC:
image

I have also tried the whole thing with a single byte, but get the same error. For other datatypes like INT the write process works.

I tried the BIT write operation also on a S7-1500 and it worked.


PLC4X v. 0.10.0

@chrisdutz
Copy link
Contributor

Admittedly the person who wrote this part of PLC4J is currently not really active anymore ... would this be something you would be willing to look into?

@floka94
Copy link
Author

floka94 commented Jan 25, 2023

I thought that all this features will work. It seems that there are more bugs and problems with this library and is not ready for production usage :-(

@splatch
Copy link
Contributor

splatch commented Jan 25, 2023

@floka94 The S7 protocol is reverse engineered hence its stability can vary depending on many things. The OPM is just an utility which was invented more than three years ago and haven't received much of maintenance since then. If you run into troubles with protocols implemented by plc4x please raise issues with appropriate input.

In order to diagnose issues we need a PCAP capture or working test case with sample request and PLC response, if it generates one. You can copy packet contents into XML test suites we have for protocols (see serializer test for S7) to confirm frame is parsed and mapped properly.

Your screenshots are helpful but they can't help with bug fixes as correlation between them and problem is not possible.

@glcj
Copy link
Contributor

glcj commented Jan 26, 2023

Hi,

I was able to see the problem, tested with a S7-400.
I think it may be the "Return code" in the "Item" section, currently 0x77 and should be 0x00.
I inform you,

Best regards,

@floka94
Copy link
Author

floka94 commented Jan 28, 2023

I find the OPM tool very useful and would be happy to use it in our productive environment once the bugs are fixed. Are there plans to further develop or maintain the opm tool in the future?

@splatch
Copy link
Contributor

splatch commented Jan 28, 2023

@floka94 its open source project, so as for other open source tools motto is "bring your own effort". Since original maintainer lost interest in keeping it up, nothing blocks you from stepping in and fixing it.

@DamonDBT
Copy link

Is it true that PLC4X(version 0.10.0 called by java) cannot write boolean values to a S7-400 PLC? @chrisdutz
I encountered the same issue.
With Kepware, it is possible to write to the same DB address.
I would like to confirm this functionality to avoid attempting to write boolean variables to the 400 PLC in the future.
thanks.

@chrisdutz
Copy link
Contributor

Well it should be able to do so ... if it doesn't work, that's probably a bug someone should report and open a new issue for.

And then all it needs is someone willing to fix it ;-)

@chrisdutz
Copy link
Contributor

I extended the OPM example by quite a bit and added some (commented) out line to also write back the values ... I couldn't reproduce the error you were reporting. So could you please try it again with the latest SNAPSHOT and confirm if it's resolved or still present?

@chrisdutz
Copy link
Contributor

So ... I have tested the PLC4X functionality for writing values to boolean fields on 2 S7-1200 devices and one S7-1500 ... I can only say that it works on these devices. Unfortunately I don't have an S7-300 or S7-400, but @glcj ... can you provide any input on this matter? Is the current version still not able to write BOOL values to an S7-400?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants