PowerUsage, and return values without a P1 meter

Post Reply
gajotnt
Posts: 58
Joined: Monday 06 February 2017 13:48
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Azores
Contact:

PowerUsage, and return values without a P1 meter

Post by gajotnt » Wednesday 11 July 2018 14:05

Hello, i recently adquired some solar panels, and sometimes i give power to the grid (the power company doesnt buy), since i have a pzem004T sensor (connected to a sonoff basic with Tasmota) that only knows one direction, when im giving 300w to the grid it show has 300w consumption.
I ordered a SDM120 that can see both directions, but since i havent received the SDM120 sensor, im guessing it will give negative values when im giving power to the grid.

Is there any way to:
- set the negative values to Zero
- Send the negative values to another virtual sensor, so that i can know how mutch im wasting.
- (or) like the (i think) the P1 hardware shows usage and return on the graphs.
Screenshot 2018-07-06 14.43.29-Recovered.jpg
Power usage, with negative values, due to sending power to the grid
Screenshot 2018-07-06 14.43.29-Recovered.jpg (86.62 KiB) Viewed 47 times
Last edited by gajotnt on Friday 13 July 2018 17:52, edited 1 time in total.

Toulon7559
Posts: 445
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: PowerUsage, and return values without a P1 meter

Post by Toulon7559 » Wednesday 11 July 2018 16:55

For getting pulses from the S0-interface of a kWh-meter while measuring consumption, you would wire the SDM120C as drawn on the connection diagram provided with your SDM120C: load-to-loadinterface + grid-to-gridinterface.
For getting pulses from the S0-interface of a kWh-meter during PV-production, you have to connect it 'in reverse' (= grid-to-loadinterface and inverter-to-gridinterface).
In the Wiki you get info to read out the RS485-interface of SDM120C, which online provides you with much more data/info.
As described above, for 'normal' wiring you are right that 'delivery to grid' will be negative, but if you 'reversely' wire, obviously 'delivery to grid' will become positive.
;-) But you have to carefully check in the script!
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

gajotnt
Posts: 58
Joined: Monday 06 February 2017 13:48
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Azores
Contact:

Re: PowerUsage, and return values without a P1 meter

Post by gajotnt » Wednesday 11 July 2018 18:38

Ok, but is there anyway of creating two virtual meters:

- One that only displays the positive values (So that i have an accurate reading of what im consuming, by deleting the negative and showing it has zero)
- Another that displays only the negative values (so that i know how much energy im wasting by giving it to the network)

markk
Posts: 426
Joined: Tuesday 14 January 2014 15:50
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PowerUsage, and return values without a P1 meter

Post by markk » Thursday 12 July 2018 23:39

I collect my generation data from the panels and my energy consumption then use this method to upload the data to PVOutput.org: http://www.domoticz.com/wiki/Upload_ene ... o_PVoutput

PV Output then calculates the export figures from the data I’ve provided and it is all stored there.
7F690EE0-6F7F-4E16-88F2-DC6A4114AF74.png
7F690EE0-6F7F-4E16-88F2-DC6A4114AF74.png (142.04 KiB) Viewed 78 times
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.

gajotnt
Posts: 58
Joined: Monday 06 February 2017 13:48
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Azores
Contact:

Re: PowerUsage, and return values without a P1 meter

Post by gajotnt » Thursday 12 July 2018 23:43

Thanks, will look into this :)

gajotnt
Posts: 58
Joined: Monday 06 February 2017 13:48
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Azores
Contact:

Re: PowerUsage, and return values without a P1 meter

Post by gajotnt » Friday 13 July 2018 18:19

I did the Math, just dont know how to program it -.-

Things I know:
- Solar energy being generated;
- Energy Consumption/return of/to the grid;

So if:
Example: if solar being generated is 600w, and im returing 100w (gives a negative value) to the grid

SOLAR + (EnergyUsed/Returned) = Consumption

Then i know that the house is using 500w:
600 + (-100) = 500w (being consumed by the house)

So then I can calculate the amount im losing (by returing it to the grid)

SOLAR - Consumption = "Waste"
Using the example:
600 - 500 = 100w (of "wasted energy")

Now if its night time, this would not work correctly, so any negative values would have to be set to zero? or discarded?, because the idea of the "wasted energy counter" would be to see how to better use and know how much money is being wasted by sending it to the grid.
because:
If SOLAR = 0 and Consumption= 500w
0 - 500 = -500w

Can anyone give some insight
I guess this code would work for calculating the Consumption part:

Code: Select all

-- demo time script

-- Get current date & time
t1 = os.time()
local currentDate = os.date("*t");  -- sets up currentDate.[table] 
-- (currentDate.year [full], .month [1-12], .day [1-31], .hour [0-23], .min [0-59], .sec [0-59], .wday [0-6 {Sun-Sat}])
sCurrentTime = currentDate.year .. "-" .. currentDate.month .. "-" .. currentDate.day .. " " .. currentDate.hour .. ":" .. currentDate.min .. ":" .. currentDate.sec

function update(device, id, power, energy, index)
commandArray[index] = {['UpdateDevice'] = id .. "|0|" .. power .. ";" .. energy}
end 

commandArray = {}

TotalPowerUsage, TotalEnergyUsage = otherdevices_svalues["Total"]:match("([^;]+);([^;]+)")

SolarPowerUsage, SolarEnergyUsage = otherdevices_svalues["Solar"]:match("([^;]+);([^;]+)")

CurrentPowerBalance = SolarPowerUsage + TotalPowerUsage
CurrentEnergyBalance = SolarEnergyUsage + TotalEnergyUsage

update("Consumption", 50, CurrentPowerBalance, CurrentEnergyBalance, 2) -- 50 is the ID of the dummy consumption device


return commandArray

Calculating the "waste" part im stuck :(

above script taken from here: viewtopic.php?t=18705
And simplified

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests