Skip to content

Add scale factor for keba p40#3766

Open
wedwincode wants to merge 1 commit into
OpenEMS:developfrom
wedwincode:feature/keba-p40-bug-fix
Open

Add scale factor for keba p40#3766
wedwincode wants to merge 1 commit into
OpenEMS:developfrom
wedwincode:feature/keba-p40-bug-fix

Conversation

@wedwincode

Copy link
Copy Markdown

fixes issue #3765 by applying the correct scale factor for the energy limit register (5010) of the keba p40.
the register uses a unit of 10 Wh, so without a scale factor the written value would be interpreted off by a factor of 10.

@Frischid

Copy link
Copy Markdown

If I'm not mistaken, SCALE_FACTOR_1 scales by a factor of 1 and not by 1/10=0.1, maybe using mult() instead might work, unfortunately, I currently don't have the time to fix it myself.

@wedwincode

Copy link
Copy Markdown
Author

Thanks for checking this. I rechecked the conversion direction, and I think SCALE_FACTOR_1 should be correct here, unless I am misunderstanding the mapper logic.

Since this is a write register, it looks like the converter is used in the reverse direction via channelToElement(). So for SCALE_FACTOR_1, the read direction would be element -> channel = * 10, but the write direction should be channel -> element = / 10.

That seems to match register 5010, because its unit is 10 Wh. An OpenEMS value of 50000 Wh should be written as 5000.

Please correct me if I am missing something here, since I haven't worked much with this converter logic before.

@sfeilmeier

Copy link
Copy Markdown
Contributor

@johannk24 Could you validate this please?

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.

3 participants