Sinexcel PWS2-30 Modbus Protocol V120 sign reversal

The Newer model of Sinexcel PWS2-30 uses Modbus protocol V120. There are many, many changes between this and the one currently existing in OpenEMS. We have been updating this. We have hit one big problem:

Active & Reactive power have had their signs reversed. Fixing this is not trivial to us Java newbies. Can anyone suggest the code to achieve this please?

Lines 552 - 554

Thank you.

After some looking I have decrypted the somewhat cryptic constants in the java code.

The one we needed was SCALE_FACTOR_2_AND_INVERT, where INVERT refers to changing the sign, that is, multiplying my -1.

BTW: FACTOR_2 refers to 10^2, a scaling of 100. Adding to the confusion, FACTOR_MINUS2 refers to 10^-2, or 1/100 scaling. I think these could have been named better, but that’s just me :slight_smile:

1 Like

Hi,

the naming with FACTOR_2, etc. follows the definition of SunSpec (“Scale factor – Signed power of 10 multiplier (+) or divider (-)”, e.g. http://sunspec.org/wp-content/uploads/2019/08/SunSpecDeviceInformationModelSpecificationV1.0.pdf).

Anyway, thanks for documenting it here. I know not everybody is reading the Javadocs in the code → https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/ElementToChannelConverter.java :slight_smile:

Regards,
Stefan

1 Like