Change energy channel assignment based on meter type

HI Philipp,

Thanks for starting this discussion and for the in-depth analysis and explanation. It’s definitely true, that some things feel mixed up and implementations are not always consistent throughout the code. Clear and better definition of Channels will definitely help here.

To answer the question on how power flows are interpreted in OpenEMS, you are completely right. In SymmetricMeter we state “Range: negative values for Consumption (power that is ‘leaving the system’, e.g. feed-to-grid); positive for Production (power that is ‘entering the system’)”. This definition is unfortunately quite misleading (or even wrong) for meters that actually measure Consumption.

  1. The idea for power flow was - just like you (and @tsicking in #2159) described - to think ‘from the middle’. This can best be seen and followed in the _sum calculations for Energy and Power.

  2. We always assumed positive ActivePower to relate with ProductionActiveEnergy and negative ActivePower to relate with ConsumptionActiveEnergy. See e.g. this calculation in GoodWeGridMeterImpl:

This same approach is used also in the CONSUMPTION_METERED GoodWeEmergencyPowerMeterImpl. Consequently in the UI History chart we also show ActiveProductionEnergy for consumption energy and not ActiveConsumptionEnergy.

Additionally as you found, for many meters we have a invert configuration option, that inverts ActivePower and should consequently also invert all related fields. But from your findings it seems this is not the case everywhere.

I understand that all of this is confusing; on the other side it is also currently working in production with thousands of systems. As you alread assumed, we are just using the ‘invert’ configuration in these cases to ‘fix’ consumption meters.

So as always, the complicated part is to improve the code (by refactoring or documentation) and still stay as backwards-compatible as possible. Especially as this issue relates also to historic data in a timeseries database we as FENECON and others who use this will have big issues fixing it.

From my point of view it could be sufficient to fix the invert configuration option in all meters and make it invert everything (Power, Current, Energy) and document in the READMEs, that if a meter is used as Consumption meter (and it is wired according to the manual), the invert configuration has to be set.

Additionally it might make sense to rename the Energy channels. I’ve read e.g. “ImportEnergy” and “ExportEnergy” in the past in Modbus protocols. Some research might help here to find a suitable name.

On the other side, if the Community agrees that a real proper solution would be to introduce a isWiringDirectionReversed configuration option everywhere, I will also support it. For the moment I am unsure on what the best solution is.

Regards,
Stefan

1 Like