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

Modbus simulator - Added support for additional datatypes #2202

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

pnl-jseb
Copy link

This update adds native support for some of the most commonly found datatypes in OT systems. This includes support for bitfields, unsigned integers, signed integers, and floating point numbers in multiple word sizes (16 bit, 32 bit and 64 bit).

Relevant changes include:
A reworked version of simulator.py that relies on struct.unpack, struct.pack, and other native functions to simplifly datatype handling while also incorportating additional checks to ensure the register layout behaves as expected.
In order to simplifly future work development, the Bits field has been renamed bitfield16, while also adding support for 32 and 64 bit fields. To help facilitate adoption, several changes have been done to the project files to ensure a smooth transition. This includes:
- Updated documentation to reflect new datatypes, including examples.
- Updated unit tests, to ensure the code works as expected.
- Updated the simulator example to illustrate how the new datatypes can be used

Resolves [discussion]: #1458
Partially addresses: #1284

This update adds native support for some of the most commonly found
datatypes in OT systems. This includes support for bitfields, unsigned
integers, signed integers, and floating point numbers in multiple word
sizes (16 bit, 32 bit and 64 bit).

Relevant changes include:
A reworked version of simulator.py  that relies on struct.unpack,
struct.pack, and other native functions to simplifly datatype handling
while also incorportating additional checks to ensure the register layout
behaves as expected.
In order to simplifly future work development, the Bits field has been
renamed bitfield16, while also adding support for 32 and 64 bit fields.
To help facilitate adoption, several changes have been done to the project
files to ensure a smooth transition. This includes:
	- Updated documentation to reflect new datatypes, including examples.
	- Updated unit tests, to ensure the code works as expected.
	- Updated the simulator example to illustrate how the new datatypes
	  can be used
	- Performed linting on 3.12

Resolves [discussion]: pymodbus-dev#1458
Partially addresses: pymodbus-dev#1284
@pnl-jseb pnl-jseb force-pushed the Extended_datatypes branch 2 times, most recently from 740878b to d4146df Compare May 22, 2024 04:34
@janiversen
Copy link
Collaborator

janiversen commented May 22, 2024

This is a very big PR, which will be very hard to review ! splitting it into a number of smaller PRs is needed.

This smaller PR are needed not only for review but also for regression testing.

The rename of bitfield to bitfield16 ... is illogical since a bit field can be anything from 1bit to 10of thousands,

There seems to be a lot of good stuff in this PR, which would be nice to merge in smaller chunks.

@pnl-jseb
Copy link
Author

Thanks for the feedback, I will do a rollback of the bitfieldXX structures and just keep the bits. As for breaking into smaller chunks, I'm unsure of the best course of action, but I can certainly try to work with you to ensure a smooth merge.

@janiversen
Copy link
Collaborator

Any progress on this PR ?

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

2 participants