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

Fix for #304 - use plc_tag_create_ex for Initialization #307

Merged
merged 5 commits into from
Nov 24, 2022
Merged

Conversation

timyhac
Copy link
Collaborator

@timyhac timyhac commented Nov 23, 2022

This PR modifies the Initialize/InitializeAsync methods to make use of plc_tag_create_ex instead of plc_tag_create - which allows us to capture events early in the tag lifecycle.

@timyhac timyhac mentioned this pull request Nov 23, 2022
Copy link
Member

@jkoplo jkoplo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that I'm unsure of is if moving SetUpEvents() earlier in the methods results in a different sequence and potentially an issue in a corner case? I just looked at the GH review so I don't have the full codebase in front of me right now.

Good enough for an alpha release at least...

@kyle-github
Copy link
Member

Over the holiday weekend (here in the US), I'll do some testing to make sure that the Modbus code is actually generating the right events. That will tackle this problem from the other end.

@jkoplo
Copy link
Member

jkoplo commented Nov 24, 2022

@kyle-github do you have a good modbus simulator or even some automated tests for modbus?

@kyle-github
Copy link
Member

In the src/tests/ directory I have a couple files that do testing. One is a small wrapper (in Python) around libmodbus which is a C-based library that is very, very widely used for Modbus on Linux. This sets up a small Modbus server with some registers. The other is run_tests.sh which is just a shell script that runs 20+ specific tests against my real hardware and this Modbus simulator and against my CIP simulator. The CI system runs a subset of these since there is no PLC hardware in GitHub's test runner pool.

That said, I don't have the ability to inject delays or faults into the Modbus tests like I do with the CIP tests (delays are supported and used to test timeouts).

@timyhac timyhac merged commit 259f409 into master Nov 24, 2022
@timyhac timyhac deleted the #304 branch November 24, 2022 21:44
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

Successfully merging this pull request may close these issues.

None yet

3 participants