UtilitechAS / amsreader-firmware

ESP8266 and ESP32 compatible firmware to read, interpret and publish data to MQTT from smart electrical meters, both DLMS and DSMR is supported
Other
380 stars 73 forks source link

Landis+Gyr E450 as provisioned by Regionalwerke Baden: Reactive energy and phase currents #740

Closed avandorp closed 6 months ago

avandorp commented 7 months ago

Is your feature request related to a problem? Please describe. For the Landis+Gyr E450 as provisioned by Regionalwerke Baden Switzerland, AMS reader already shows import and export power, thanks! Reactive energy and phase current values are missing, but should be reported by the meter.

Describe the solution you'd like If reactive power and phase current values could be parsed that would be tremendous.

Additional context The power utility provides more info regarding the OBIS codes at https://www.regionalwerke.ch/fileadmin/dok/services/RWB_Flyer_SmartMeter_Bedienungsanleitung.pdf. I've translated the important parts:

OBIS Code; Attribute index  Register
Transmission interval 05s
0-8:25.9.0; 2   Object list push settings end user information 1
0-8:25.9.0; 1   OBIS Code  Push Settings end user information 1
0-0:96.1.0; 2   Device identification 1 (Producer serial number)
1-0:1.7.0; 2    Power import +P
1-0:2.7.0; 2    Power export -P
1-1:1.8.0; 2    Energy import +A (QI + QIV)
1-1:2.8.0; 2    Energy export  -A (QII + QIII)
1-1:5.8.0; 2    Reactive energy +Ri (QI)
1-1:6.8.0; 2    Reactive energy +Rc (QII)
1-1:7.8.0; 2    Reactive energy -Ri (QIII)
1-1:8.8.0; 2    Reactive energy -Rc (QIV)
1-0:31.7.0; 2   Current L1
1-0:51.7.0; 2   Current L2
1-0:71.7.0; 2   Current L3
Transmission interval 60s
0-9:25.9.0; 2   Object list push settings end user information 2
0-9:25.9.0; 1   OBIS Code  Push Settings end user information 2
1-1:1.8.1; 2    Energy import +A (QI + QIV) Tariff 1
1-1:1.8.2; 2    Energy import +A (QI + QIV) Tariff 2
1-1:2.8.1; 2    Energy export -A (QII + QIII) Tariff 1
1-1:2.8.2; 2    Energy export -A (QII + QIII) Tariff 2
Transmission interval 15min
(Other M-Bus values if wireless M-Bus capable devices are read by the meter)

I've added a file with a few frames from my reader. Please tell me, if you need more or different data. RegionalwerkeBadenSwitzerlandFrames.txt

ArnieO commented 7 months ago

Thank you for precise report and documentation, we will look into this.

ArnieO commented 6 months ago

This format will be supported in v2.3 - which should soon be released. Test version is available here: https://github.com/UtilitechAS/amsreader-firmware/discussions/738 (Test version may lack some parameters.)

gskjold commented 6 months ago

One thing I suddenly notice here, this meter is sending OBIS 5.8.0 through 8.8.0 which are capacitive and inductive reactive energy, how does this relate to 3.8.0 and 4.8.0 reactive energy? Can it be converted? We do not have any internal registers for capacitive and inductive energy.

avandorp commented 6 months ago

They can be added. The question is: Which ones? As I'm not an electrical engineer, I don't know those notations. I'll ask my power utility.

ArnieO commented 6 months ago

One thing I suddenly notice here, this meter is sending OBIS 5.8.0 through 8.8.0 which are capacitive and inductive reactive energy, how does this relate to 3.8.0 and 4.8.0 reactive energy? Can it be converted? We do not have any internal registers for capacitive and inductive energy.

I think the reactive parameters are of very little value for most of our users, except large industrial users that could be charged extra for reactive energy - as the grid has to be dimensioned for it. (Reactive power/energy is sometimes compared to the foam on top of the beer in a glass: The glass must be large enough to handle the foam, but the user is really mostly interested in what is under the foam. 😆)

To understand this, we need to return to "basics": Power/energy in the real world has an active and a reactive component. This can be illustrated by vectors in a current/voltage diagram.

Then:

In other words: This meter gives the added information whether the reactive power P is inductive or capacitive, while meters that report OBIS codes 3.8.0/4.8.0 only gives the amount of reactive energy, disregarding whether it is inductive or capacitive (unless they also report phase angle; see below).

This means that for this meter: 3.8.0 = 5.8.0 + 6.8.0 and 4.8.0 = 7.8.0 + 8.8.0

In this illustration, current is the horizontal axis, voltage is the vertical axis. fig1-1 (Illustration from https://www.securemeters.com/uk/white_papers/import-and-export-of-electrical-energy/ )

We received the below information by email from Netz Burgenland some time ago. It is somewhat (but not quite) on the same topic, at least it illustrates the quadrants. Those meters report phase angle for the reactive energy. The phase angle tells whether the reactive energy is inductive or capacitive.

image

ArnieO commented 6 months ago

To conclude: My proposition is to sum the parameters into our two "Reactive energy" registers (import and export).

gskjold commented 6 months ago

Thanks, just what I needed!

avandorp commented 6 months ago

I think the reactive parameters are of very little value for most of our users, except large industrial users that could be charged extra for reactive energy - as the grid has to be dimensioned for it.

Ah, but the value can simply be educative, or in satisfying curiosity, or identifying something that's unexpected or even dangerous. I've learned a lot by simply looking at incoming data.

Looking forward to v2.3. Thanks for all your work.

gskjold commented 6 months ago

Latest build in #738 has current sensors added

avandorp commented 6 months ago

Firmware upload seems to work, but after "Device is upgrading, please wait" it still says v2.2.28 without voltage and amperage. EDIT: Boot reason is always "Software reset". It might not have enough memory or power during upload? OTA worked with older versions, so I'm not sure. I can always flash it via USB, it's just more hassle as I've got to dismantle the installation in a somewhat inaccessible service room. Or might there be another reaseon it fails?

gskjold commented 6 months ago

I am not sure what hardware you have, might be running out of power. Also, are you sure you are using correct bin file?

avandorp commented 6 months ago

No luck. I've dismantled my installation and flashed via USB. But with the new firmware the device doesn't come up (esp32c3), no LEDs blinking or anything. Reflashing with 2.2.28 works, but I can't get the new firmware to do anything. Tried both an upgrade and a full flash with partitions and everything.

EDIT: I wonder, if it has anything to do with the flash size. esptool says "Flash will be erased from 0x00010000 to 0x00133fff..." for 2.2.28 and "Flash will be erased from 0x00010000 to 0x00133fff..." for the beta version.

EDIT2: As to the firmware version: I've downloaded the esp32c3.zip. I've tried a debugging session during OTA update with level debug. But all I've got is: ... (lots of handleFileUpload) (D) handleFileUpload Written: 1436 (D) handleFileUpload Writing: 1376 (D) handleFileUpload Written: 1376 (D) handleFileUpload Ended (D) Handling firmware post... (W) Used 24254ms to handle web (W) loop() used 24287ms (I) MQTT SSL is configured (207368kb free heap) (D) MQTT SSL setup complete (205556kb free heap) (I) Connecting to MQTT xxxxxx:8883 (I) Successfully connected to MQTT (I) Subscribing to [homeassistant/status] (D) Serving /data.json over http... (I) Received online status from HA, resetting sensor status (D) Serving /data.json over http... (D) Serving /index.html over http... (D) Serving /sysinfo.json over http... (I) Rebooting ... After rebooting it is still at version 2.2.28.