Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change voltage graph to dual axis #165

Closed
wants to merge 1 commit into from

Conversation

longzheng
Copy link
Contributor

In countries with 230V electric grids (e.g. Australia), the voltage graph is a bit odd because the grid voltages and Powerwall voltages are entirely separated, because the Powerwall always operates at 120V. I imagine this is not a problem in 120V electric grids (e.g. USA).

image

This makes it pretty hard to see the changes in voltage because the axis is quite large.

Initially I thought about splitting this graph into two, one for the grid voltages and another for the Powerwall voltages, but then I remembered one graph can have two axis.

So I put all the Powerwall voltages on the right axis (using a field name regex), which actually works out pretty well because they're always in-sync with the grid voltages anway, just halved.

image

I had to change the visualization from "Graph (Old)" to "Time series" because the legacy graph did not allow for overriding the axis placement by field. I used the migration button which seems to have worked. I wonder if all the other graphs should also be updated?

image

@BJReplay
Copy link
Contributor

I had a similar issue, but took a different approach - I modified the chart to add the two lines (as that is exactly what the powerwall does electrically to supply the house anyway):

SELECT mean("PW1_PINV_VSplit1") + mean("PW1_PINV_VSplit2") FROM "vitals"."http" WHERE $timeFilter GROUP BY time($__interval) fill(null) and named it PW Voltage

The other thing I found is I can still assign to different axes with the Graph (old).

image

(in my case, I've combined frequency and voltage charts on the same graph to fit more charts on the same dashboard)

@longzheng
Copy link
Contributor Author

longzheng commented Jan 28, 2023

I had a similar issue, but took a different approach - I modified the chart to add the two lines (as that is exactly what the powerwall does electrically to supply the house anyway):

SELECT mean("PW1_PINV_VSplit1") + mean("PW1_PINV_VSplit2") FROM "vitals"."http" WHERE $timeFilter GROUP BY time($__interval) fill(null) and named it PW Voltage

I think in a 120V grid system, it's my understanding the PW1_PINV_VSplit1 and PW1_PINV_VSplit2 are still 120V each so summing them will produce 240V which will have the opposite problem where their grid is at 120V but the PW will be at 240V.

(See the sample screenshot from @jasonacox https://user-images.githubusercontent.com/836718/214475204-d049c0c8-1b2c-4fb7-b015-0a638a33adde.png)

I think dual axis is the only solution that works for both 120V and 240V grids.

@BJReplay
Copy link
Contributor

BJReplay commented Jan 28, 2023 via email

@jasonacox
Copy link
Owner

Great discussion and good insight.

Thanks for submitting the PR @longzheng . However, one of the benefits of having all of the voltages aligned (either in the US with 120V or using the method @BJReplay suggested) is that it allows you to visually see the current flow between the power island/gateway components. A higher PW voltage than the Grid is evident when the PW is powering the house, and the Grid voltage will equal or exceed the PW voltage when it is powering the house (or charging the PW). In other words, comparing the data points on the same axis and axis scale allows you to see the potential difference driving current. To be fair, I may be the only person doing this comparison. 🤷

image

Having said that, your concern is still valid. The current panel doesn't accommodate the 230V grid. We need a better way to represent that yet preserve the comparison. In fact, I wonder if there is a way to inject a filter or conditional that looks for nominal grid voltage > 200 and has logic to sum the PW values. Alternatively, we could have two different panels and disable the one not needed for your region (grid voltage).

I'll do some research but welcome ideas. Alternatively, we host a 120V and 230V dashboard.json for people to choose baed on their grid voltage, and use the algorithm that @BJReplay mentions.

@BJReplay
Copy link
Contributor

BJReplay commented Jan 28, 2023

To be fair, I may be the only person doing this comparison.

No, you're not.

This is a busy chart, but I don't mind them 🤣

I've combined voltage and frequency on one chart to see how both interact - both when the Powerwall is charging and discharging normally, as well as during VPP events (which, for me, are primarily frequency support).

image

P.S. to the far left of the chart you can see some straight lines - pyPowerwall was timing out - as it turns out my gateway was timing out for web access, as well. Not sure why, but there was a period over a few hours, when it was pretty non-responsive. I thought it might be staging an update, or updating, but nope.

@longzheng
Copy link
Contributor Author

I don't have a lot of experience with Grafana but does the import JSON support some sort of "choice" like it prompts you to select the data source, which can be used to conditionally set some logic?

@mcbirse
Copy link
Collaborator

mcbirse commented Jan 29, 2023

I like the idea of aligning the voltages, especially for us in 230V land... this has always annoyed me, since due to the large differences in voltages the axis range is huge, so at a glance the graph is not very helpful.

However, just to add another consideration to the mix - the current suggested fixes would not help with mine?

I don't know why, but my Home L2 / Grid L2 voltages have always been around only 6V-8V, as you can see below - anyone know why this is?

image

@BJReplay
Copy link
Contributor

Home L2 / Grid L2 voltages have always been around only 6V-8V

With no basis other than a gut feeling, my instantaneous response is bad wiring and some sort of earth leak or insulation breakdown - possibly with your solar array not properly earthed, or with an isolation breakdown.

Of course, the more likely explanation is a bad meter or bad calibration, but presumably they have a 0V reference (earth / neutral) and both home and grid are never at that reference.

That's what makes me think bad wiring or an earth leak. But you'd expect that to trip an ELCB.

@mcbirse
Copy link
Collaborator

mcbirse commented Jan 29, 2023

@BJReplay - it's been like this since installation in Apr 2021, and I just assumed it was normal. Not seeing any faults or alerts as such, and the system has been working flawlessly.

My knowledge of wiring and electrical systems is extremely limited which doesn't help. What is the purpose of L1 vs L2 voltages and what affect could this possibly have on the system if it was wrong?

@BJReplay
Copy link
Contributor

BJReplay commented Jan 29, 2023

I'm only guessing here; I'm guessing that the way it is designed is that the Powerwall can work on a 230/240 V single phase, or a 110/120V single phase, and also a 110/120V split phase system, and in a split phase set up, that's when L2 comes into play.

In our nominal 230V system, the outputs of the inverters are summed (i.e. in series, in phase) to give us the 230V output to match the grid and the home, even though they're reported as 113.9 and 114.0 in your picture above. L1 is the only one in play in my system.

In my case, the values for L2 are zero. I removed them from my charts.

@longzheng
Copy link
Contributor Author

I don't know why, but my Home L2 / Grid L2 voltages have always been around only 6V-8V, as you can see below - anyone know why this is?

Are you on single phase? I'm not sure but maybe because I have three phase, my L2 is actually live. I think for a single phase only L1 is live.

@mcbirse
Copy link
Collaborator

mcbirse commented Jan 29, 2023

@BJReplay - Thanks, not sure why my L2 doesn't show zero volts, but it appears probably I should just remove it from my graphs.

@longzheng - Correct. My setup is 230V single-phase only, with 1x Powerwall and 2x 5kW inverters, and whole house as backup.

I found the below from the install manual which seems to confirm L1, L2, L3 use is for three-phase systems:

image

And below, which is interesting in my case perhaps?

image

Reading the above it appears Neutral is supposed to be connected to L2 on single-phase systems. With mine showing a non-zero voltage, I wonder if it has been wired correctly?

And just back on topic regarding this PR - it would appear users with single-phase installs will need to remove the L2 voltages from their graphs(?) or they will still be facing the same issue with the large axis scale.

@BJReplay
Copy link
Contributor

I wonder if it has been wired correctly?

I'd be betting No.

And just back on topic regarding this PR

Yes, agreed. I think because of the way the vitals reports this, it reports zero, so it does show up. At least it did when I added it back it just now to check 🤣

You can probably configure the graph not to graph zero (or maybe the graph was already configured not to do this).

jasonacox added a commit that referenced this pull request Jan 30, 2023
@jasonacox
Copy link
Owner

Thanks @longzheng @BJReplay @mcbirse !

I have an idea... We could create two different PW queries with a WHERE conditional that selects it in/out based on the Grid voltage (eg. METER_X_VL1N) being > 200 or < 200. For the 230V grid, we would add the VSplits (or ?) so that they are aligned to the Grid and House numbers.

230V Grid - Powerwall Queries

SELECT mean("PW1_PINV_VSplit1") +  mean("PW1_PINV_VSplit2")  
     FROM "vitals"."http" 
     WHERE "METER_X_VL1N" > 200.0 AND  $timeFilter GROUP BY time($__interval) fill(null)

(Could alias these as PW1, PW2, ... PW6)

120V Grid - Powerwall Queries

SELECT mean("PW1_PINV_VSplit1") 
    FROM "vitals"."http" 
    WHERE "METER_X_VL1N" < 200.0 AND  $timeFilter GROUP BY time($__interval) fill(null)

(Could use existing aliases, PW1 L1, PW1 L2, PW2 L1, ... PW6 L2)

By doing it that way, even though all the queries are defined in the panel, it will only show the ones that match your Grid voltage.

Try it out?

I create a v230 branch and pushed an updated dashboard.json with the WHERE logic above: https://github.com/jasonacox/Powerwall-Dashboard/blob/230v/dashboard.json - If you can, download it and tell me if this is getting closer to what we want.

@BJReplay
Copy link
Contributor

If you can, download it and tell me if this is getting closer to what we want.

Job for tomorrow.

I've just re-created everything!

My gateway has been playing up, and while trouble-shooting that (which required a gateway reset - my gateway is that old that it doesn't have a power button, so that means a complete power down of my house), my docker install corrupted as my aging UPS died (it has never had to do anything more than bridge a Powerwall cutover from mains to powerwall for the last 5 years) and my server shut down un-gracefully.

Ugh.

Powerwall-Dashboard came up well enough, but my ToU customisations needed a re-install from scratch as I hadn't put the MySQL database on a host volume.

Anyway, I've got that scripted now (for next time), and the rest of today is allocated to UPS shopping :)

@longzheng
Copy link
Contributor Author

I have an idea... We could create two different PW queries with a WHERE conditional that selects it in/out based on the Grid voltage (eg. METER_X_VL1N) being > 200 or < 200. For the 230V grid, we would add the VSplits (or ?) so that they are aligned to the Grid and House numbers.

I'll test it out tonight but I wonder if this logic will break if/when the grid is down, I presume then METER_X_VL1N will be 0

@jasonacox
Copy link
Owner

Yes, that is good point. It will flip to the 120V grid view for that timeframe (adding PW1 L1, etc to the graph). Alternative, we could use the house voltage (ISLAND_VL1N_Load).

@longzheng
Copy link
Contributor Author

Yes, that is good point. It will flip to the 120V grid view for that timeframe (adding PW1 L1, etc to the graph). Alternative, we could use the house voltage (ISLAND_VL1N_Load).

House voltage makes sense for me, but looking at the data I'm a bit confused what ISLAND_VL1N_Load actually is.

I don't get a lot of blackouts where I live but on my last occurence of a backup event, I actually logged my Home L2 voltage dropping significantly rather than the Grid L2.

image

I'm not sure if this is some other situation than a grid blackout. Anyone else who have the voltage readings from a blackout report something different?

@BJReplay
Copy link
Contributor

I'm not sure if this is some other situation than a grid blackout. Anyone else who have the voltage readings from a blackout report something different?

OK, I loaded up the dashboard

I can't get any of the Grid (METER_X_VL1N) series to show any data.

Background: the green trace at the top of the first chart that drops to the bottom and back up is the grid status line. The outage was at 11:43pm

image

Next image is the new dashboard from @jasonacox a couple of posts above. First thing - the 230V logic seems to work as expected, even over the blackout.

image

Note that the 60Hz frequency and 0V showing up for L2 was what started me down the path of editing these panels in the first place.

This is what my combined voltage and frequency chart shows (you can see the drop from normal grid voltage back down to nominal 230V at the far right):

image

@jasonacox
Copy link
Owner

@longzheng - Tesla doesn't give us any insight of course, but they use the term "Island" to refer to anything past the gateway (or switch) indicating things that are controllable detached from the grid. The ISLAND_VL1N_Load is the first leg (VL1) and since it says "Load" refers to the House load. I puzzled at your graph too for the second leg (VL2). I would expect that to cause serious problems in your home if it sustained, but it looks like just one sample point so maybe it was an anomaly?

I can't get any of the Grid (METER_X_VL1N) series to show any data.

Do you mean that the graph is not rendering anything for PW1 ? It occurs to me that there are possibly others (I show 6). Can you look at your vitals (eg. http://pypowerwall:8675/vitals) to see what you have for METER and ISLAND readings?

Mine in TESYNC:

        "METER_X_VL1N": 119.86,
        "METER_X_VL2N": 120.19,
        "METER_X_VL3N": 0.0,
        "METER_Y_VL1N": 119.87,
        "METER_Y_VL2N": 120.19,
        "METER_Y_VL3N": 0.0,

        "ISLAND_VL1N_Load": 120.5,
        "ISLAND_VL1N_Main": 120.5,
        "ISLAND_VL2N_Load": 120.5,
        "ISLAND_VL2N_Main": 120.5,
        "ISLAND_VL3N_Load": 0.0,
        "ISLAND_VL3N_Main": 0.0,

If it varies, we could add an OR conditional and use the ISLAND Load values:

SELECT mean("PW1_PINV_VSplit1") +  mean("PW1_PINV_VSplit2")  
     FROM "vitals"."http" 
     WHERE ( "ISLAND_VL1N_Load" > 200.0 OR "ISLAND_VL2N_Load" > 200.0 OR "ISLAND_VL3N_Load" > 200.0 )
          AND  $timeFilter 
     GROUP BY time($__interval) fill(null)

@jasonacox
Copy link
Owner

@BJReplay Ah, I would love to see METER and ISLAND readings from your vitals too.

@BJReplay
Copy link
Contributor

@BJReplay Ah, I would love to see METER and ISLAND readings from your vitals too.

Your wish is my command (XXXXs replace real serials, "Just in case"™:

{
    "NEURIO--OBBXXXXXXXXXXX": {
        "NEURIO_CT0_InstRealPower": -3.1700000762939453,
        "NEURIO_CT0_Location": "site",
        "NEURIO_CT3_InstRealPower": 3406.639892578125,
        "NEURIO_CT3_Location": "solar",
        "componentParentDin": "STSTSM--XXXXXXX-01-F--XXXXXXX",
        "firmwareVersion": "1.7.2-Tesla",
        "lastCommunicationTime": 1675131811,
        "manufacturer": "NEURIO",
        "meterAttributes": {
            "meterLocation": [
                1,
                4
            ]
        },
        "serialNumber": "OBBXXXXXXXXXXX"
    },
    "STSTSM--XXXXXXX-01-F--XXXXXXX": {
        "STSTSM-Location": "Gateway",
        "alerts": [
            "PodCommissionTime",
            "SystemConnectedToGrid",
            "GridCodesWrite",
            "FWUpdateSucceeded"
        ],
        "firmwareVersion": "2022-10-24-g64e8c689f9",
        "lastCommunicationTime": 1675131811,
        "manufacturer": "TESLA",
        "partNumber": "1118431-01-F",
        "serialNumber": "XXXXXXX",
        "teslaEnergyEcuAttributes": {
            "ecuType": 207
        }
    },
    "TEPINV--XXXXXXX-79-J--XXXXXXX": {
        "PINV_EnergyCharged": 8993940.0,
        "PINV_EnergyDischarged": 7937360.0,
        "PINV_Fout": 49.994,
        "PINV_GridState": "Grid_Compliant",
        "PINV_HardwareEnableLine": true,
        "PINV_PllFrequency": 49.976,
        "PINV_PllLocked": true,
        "PINV_Pout": -2.93,
        "PINV_PowerLimiter": "PWRLIM_POD_Power_Limit",
        "PINV_Qout": 0.01,
        "PINV_ReadyForGridForming": true,
        "PINV_State": "PINV_GridFollowing",
        "PINV_VSplit1": 123.5,
        "PINV_VSplit2": 124.7,
        "PINV_Vout": 248.10000000000002,
        "componentParentDin": "TETHC--XXXXXXX-03-G--XXXXXXX",
        "firmwareVersion": "8cd8cac4b9cb48",
        "lastCommunicationTime": 1675131811,
        "manufacturer": "TESLA",
        "partNumber": "1081100-79-J",
        "serialNumber": "XXXXXXX",
        "teslaEnergyEcuAttributes": {
            "ecuType": 253
        }
    },
    "TEPOD--XXXXXXX-79-J--XXXXXXX": {
        "POD_ActiveHeating": false,
        "POD_CCVhold": false,
        "POD_ChargeComplete": false,
        "POD_ChargeRequest": false,
        "POD_DischargeComplete": false,
        "POD_PermanentlyFaulted": false,
        "POD_PersistentlyFaulted": false,
        "POD_available_charge_power": 7000.0,
        "POD_available_dischg_power": 7000.0,
        "POD_enable_line": true,
        "POD_nom_energy_remaining": 9648.0,
        "POD_nom_energy_to_be_charged": 3856.0,
        "POD_nom_full_pack_energy": 13354.0,
        "POD_state": "POD_ACTIVE",
        "componentParentDin": "TETHC--XXXXXXX-03-G--XXXXXXX",
        "firmwareVersion": "8cd8cac4b9cb48",
        "lastCommunicationTime": 1675131810,
        "manufacturer": "TESLA",
        "partNumber": "1081100-79-J",
        "serialNumber": "XXXXXXX",
        "teslaEnergyEcuAttributes": {
            "ecuType": 226
        }
    },
    "TESYNC--XXXXXXX-01-F--XXXXXXX": {
        "ISLAND_FreqL1_Load": 49.980000000000004,
        "ISLAND_FreqL1_Main": 49.980000000000004,
        "ISLAND_FreqL2_Load": 53.17,
        "ISLAND_FreqL2_Main": 53.22,
        "ISLAND_FreqL3_Load": 0.0,
        "ISLAND_FreqL3_Main": 0.0,
        "ISLAND_GridConnected": true,
        "ISLAND_GridState": "ISLAND_GridState_Grid_Compliant",
        "ISLAND_L1L2PhaseDelta": -256.0,
        "ISLAND_L1L3PhaseDelta": -256.0,
        "ISLAND_L1MicrogridOk": true,
        "ISLAND_L2L3PhaseDelta": -256.0,
        "ISLAND_L2MicrogridOk": false,
        "ISLAND_L3MicrogridOk": false,
        "ISLAND_PhaseL1_Main_Load": 0.0,
        "ISLAND_PhaseL2_Main_Load": 160.0,
        "ISLAND_PhaseL3_Main_Load": -256.0,
        "ISLAND_ReadyForSynchronization": true,
        "ISLAND_VL1N_Load": 247.5,
        "ISLAND_VL1N_Main": 247.5,
        "ISLAND_VL2N_Load": 0.0,
        "ISLAND_VL2N_Main": 0.0,
        "ISLAND_VL3N_Load": 0.0,
        "ISLAND_VL3N_Main": 0.0,
        "SYNC_ExternallyPowered": false,
        "SYNC_SiteSwitchEnabled": true,
        "alerts": [
            "SYNC_a044_IslanderDisconnectWithin2s"
        ],
        "componentParentDin": "STSTSM--XXXXXXX-01-F--XXXXXXX",
        "firmwareVersion": "8cd8cac4b9cb48",
        "lastCommunicationTime": 1675131811,
        "manufacturer": "TESLA",
        "partNumber": "1118431-01-F",
        "serialNumber": "XXXXXXX",
        "teslaEnergyEcuAttributes": {
            "ecuType": 259
        }
    },
    "TETHC--XXXXXXX-03-G--XXXXXXX": {
        "THC_AmbientTemp": 31.700000000000003,
        "THC_State": "THC_STATE_AUTONOMOUSCONTROL",
        "componentParentDin": "STSTSM--XXXXXXX-01-F--XXXXXXX",
        "firmwareVersion": "8cd8cac4b9cb48",
        "lastCommunicationTime": 1675131811,
        "manufacturer": "TESLA",
        "partNumber": "1092170-03-G",
        "serialNumber": "XXXXXXX",
        "teslaEnergyEcuAttributes": {
            "ecuType": 224
        }
    }
}

@longzheng
Copy link
Contributor Author

longzheng commented Jan 31, 2023

I puzzled at your graph too for the second leg (VL2). I would expect that to cause serious problems in your home if it sustained, but it looks like just one sample point so maybe it was an anomaly?

Actually come to think of it, because I have three phase power and Powerwall only backs up one phase, L1 is the only phase that's active during backup.

Sorry I just realized the L3 values are recorded but hidden on the graph by default. If I enable it then I can confirm that L2 and L3 are both the same which confirms the single backup phase theory.

image

Also it looks like this backup event was caused by a frequency spike, which explains why the grid voltage was still nominal and active throughout this time.

image

@jasonacox
Copy link
Owner

Fascinating! Thanks @BJReplay ! This is a good sign:

        "ISLAND_VL1N_Load": 247.5,
        "ISLAND_VL1N_Main": 247.5,
        "ISLAND_VL2N_Load": 0.0,
        "ISLAND_VL2N_Main": 0.0,
        "ISLAND_VL3N_Load": 0.0,
        "ISLAND_VL3N_Main": 0.0,

That means that we can detect > 200 voltage using the ISLAND data points. This means that for your system, it only has/monitors one voltage line (VL1).

The question I have is...where are the METER data points for Grid? It seems like @longzheng is getting that based on his graph above but you don't have that. I have often speculated that the ISLAND "Main" data points are the incoming grid and we could use that to represent the Grid voltage instead of METER.

Yes! Just tested my theory on my system by physically cutting the power to the house and checking my ISLAND data. I used the "Go off grid" before but that didn't drop the voltage on "Main". That made me pursue the METER path but I now believe that was a mistake. The best indication of grid voltage appears to be the ISLAND_*_Main data - here is the result:

        "ISLAND_VL1N_Load": 119.0,
        "ISLAND_VL1N_Main": 0.0,
        "ISLAND_VL2N_Load": 121.5,
        "ISLAND_VL2N_Main": 0.5,
        "ISLAND_VL3N_Load": 0.0,
        "ISLAND_VL3N_Main": 0.0,

That means we can replace METER data with ISLAND data for both load (house) and grid (main). Thankfully that is all in InfluxDB based on the http://pypowerwall:8675/freq call telegraf uses, but the CQs are not there so I will need to add a CQ.

Another interesting observation that is the same as @longzheng is that I do see a drop in voltage for Grid data when I simulated a blackout (using METER data):

image

However, when I switch it to use ISLAND_VLxN_Load data (using raw since it is not in the vitals CQ), I get a clean, and as expected, complete dropout of the grid voltage (which is what we would want to see):

image

I'm going to work on the CQs and an updated dashboard that uses ISLAND voltage data instead of METER data. I'll update the Powerwall logic to do the same... I may have something to test for you later this afternoon (depending on where you are in Australia).

@jasonacox
Copy link
Owner

Thanks @longzheng , do you mind sharing your vitals data too (just METER and ISLAND data is fine). I want to see what the 3 phase looks like. I only have 2 legs (single phase).

@BJReplay
Copy link
Contributor

I'm going to work on the CQs and an updated dashboard that uses ISLAND voltage data instead of METER data. I'll update the Powerwall logic to do the same... I may have something to test for you later this afternoon (depending on where you are in Australia).

Look forward to testing it.

The question I have is...where are the METER data points for Grid?

I wonder whether it is related to the ECU type, and whether it is because I have a fairly early gateway 2 (no reset hole) and a fairly early (September 2017) install, or whether they are only part of the Powerwall+ setup when you have solar?

@longzheng
Copy link
Contributor Author

Thanks @longzheng , do you mind sharing your vitals data too (just METER and ISLAND data is fine). I want to see what the 3 phase looks like. I only have 2 legs (single phase).

{
"ISLAND_FreqL1_Load": 49.96,
"ISLAND_FreqL1_Main": 49.96,
"ISLAND_FreqL2_Load": 49.980000000000004,
"ISLAND_FreqL2_Main": 49.980000000000004,
"ISLAND_FreqL3_Load": 49.980000000000004,
"ISLAND_FreqL3_Main": 49.980000000000004,
"ISLAND_GridConnected": true,
"ISLAND_GridState": "ISLAND_GridState_Grid_Compliant",
"ISLAND_L1L2PhaseDelta": -256,
"ISLAND_L1L3PhaseDelta": -120,
"ISLAND_L1MicrogridOk": true,
"ISLAND_L2L3PhaseDelta": 120,
"ISLAND_L2MicrogridOk": true,
"ISLAND_L3MicrogridOk": true,
"ISLAND_PhaseL1_Main_Load": 1,
"ISLAND_PhaseL2_Main_Load": 1,
"ISLAND_PhaseL3_Main_Load": 1,
"ISLAND_ReadyForSynchronization": true,
"ISLAND_VL1N_Load": 243.5,
"ISLAND_VL1N_Main": 243,
"ISLAND_VL2N_Load": 243.5,
"ISLAND_VL2N_Main": 243.5,
"ISLAND_VL3N_Load": 243,
"ISLAND_VL3N_Main": 243,
"METER_X_CTA_I": 14.7385,
"METER_X_CTA_InstReactivePower": 756,
"METER_X_CTA_InstRealPower": -3462,
"METER_X_CTB_I": 17.5165,
"METER_X_CTB_InstReactivePower": 1158,
"METER_X_CTB_InstRealPower": -4051,
"METER_X_CTC_I": 17.0915,
"METER_X_CTC_InstReactivePower": 838,
"METER_X_CTC_InstRealPower": -4037,
"METER_X_LifetimeEnergyExport": 7563407,
"METER_X_LifetimeEnergyImport": 4481819,
"METER_X_VL1N": 243.53,
"METER_X_VL2N": 244.20000000000002,
"METER_X_VL3N": 243.04,
"METER_Y_CTA_I": 16.48,
"METER_Y_CTA_InstReactivePower": -520,
"METER_Y_CTA_InstRealPower": 3991,
"METER_Y_CTB_I": 16.802500000000002,
"METER_Y_CTB_InstReactivePower": -533,
"METER_Y_CTB_InstRealPower": 4044,
"METER_Y_CTC_I": 16.7835,
"METER_Y_CTC_InstReactivePower": -531,
"METER_Y_CTC_InstRealPower": 4041,
"METER_Y_LifetimeEnergyExport": 23896,
"METER_Y_LifetimeEnergyImport": 11683258,
"METER_Y_VL1N": 243.63,
"METER_Y_VL2N": 244.18,
"METER_Y_VL3N": 242.97,
"SYNC-Phase1Usage": "Backup",
"SYNC-Phase2Usage": "NonBackup",
"SYNC-Phase3Usage": "NonBackup",
"SYNC_ExternallyPowered": false,
"SYNC_SiteSwitchEnabled": false
}

@longzheng
Copy link
Contributor Author

I did a go off-grid

"ISLAND_FreqL1_Load": 55.09,
"ISLAND_FreqL1_Main": 50.019999999999996,
"ISLAND_FreqL2_Load": 49.99,
"ISLAND_FreqL2_Main": 50.019999999999996,
"ISLAND_FreqL3_Load": 50.04,
"ISLAND_FreqL3_Main": 50.01,
"ISLAND_GridConnected": false,
"ISLAND_GridState": "ISLAND_GridState_Grid_Compliant",
"ISLAND_L1L2PhaseDelta": -256,
"ISLAND_L1L3PhaseDelta": -120,
"ISLAND_L1MicrogridOk": true,
"ISLAND_L2L3PhaseDelta": 120,
"ISLAND_L2MicrogridOk": false,
"ISLAND_L3MicrogridOk": false,
"ISLAND_PhaseL1_Main_Load": -71,
"ISLAND_PhaseL2_Main_Load": -33.5,
"ISLAND_PhaseL3_Main_Load": -1.5,
"ISLAND_ReadyForSynchronization": true,
"ISLAND_VL1N_Load": 237,
"ISLAND_VL1N_Main": 242,
"ISLAND_VL2N_Load": 1,
"ISLAND_VL2N_Main": 242.5,
"ISLAND_VL3N_Load": 1,
"ISLAND_VL3N_Main": 241.5,
"METER_X_CTA_I": 0.0385,
"METER_X_CTA_InstReactivePower": -5,
"METER_X_CTA_InstRealPower": 2,
"METER_X_CTB_I": 0,
"METER_X_CTB_InstReactivePower": 0,
"METER_X_CTB_InstRealPower": 0,
"METER_X_CTC_I": 0,
"METER_X_CTC_InstReactivePower": 0,
"METER_X_CTC_InstRealPower": 0,
"METER_X_LifetimeEnergyExport": 7564662,
"METER_X_LifetimeEnergyImport": 4481819,
"METER_X_VL1N": 242.25,
"METER_X_VL2N": 242.85,
"METER_X_VL3N": 241.8,
"METER_Y_CTA_I": 0.20700000000000002,
"METER_Y_CTA_InstReactivePower": 43,
"METER_Y_CTA_InstRealPower": -11,
"METER_Y_CTB_I": 0,
"METER_Y_CTB_InstReactivePower": 0,
"METER_Y_CTB_InstRealPower": 0,
"METER_Y_CTC_I": 0.0045000000000000005,
"METER_Y_CTC_InstReactivePower": 0,
"METER_Y_CTC_InstRealPower": 0,
"METER_Y_LifetimeEnergyExport": 23896,
"METER_Y_LifetimeEnergyImport": 11684574,
"METER_Y_VL1N": 236.69,
"METER_Y_VL2N": 1.2,
"METER_Y_VL3N": 1.22,
"SYNC-Phase1Usage": "Backup",
"SYNC-Phase2Usage": "NonBackup",
"SYNC-Phase3Usage": "NonBackup",
"SYNC_ExternallyPowered": false,
"SYNC_SiteSwitchEnabled": false,

Then I actually turned off my grid circuit breaker

"ISLAND_FreqL1_Load": 55.32,
"ISLAND_FreqL1_Main": 50,
"ISLAND_FreqL2_Load": 50.019999999999996,
"ISLAND_FreqL2_Main": 50,
"ISLAND_FreqL3_Load": 50,
"ISLAND_FreqL3_Main": 50.01,
"ISLAND_GridConnected": false,
"ISLAND_GridState": "ISLAND_GridState_Grid_Uncompliant",
"ISLAND_L1L2PhaseDelta": -256,
"ISLAND_L1L3PhaseDelta": 3,
"ISLAND_L1MicrogridOk": true,
"ISLAND_L2L3PhaseDelta": 90,
"ISLAND_L2MicrogridOk": false,
"ISLAND_L3MicrogridOk": false,
"ISLAND_PhaseL1_Main_Load": 84.5,
"ISLAND_PhaseL2_Main_Load": -135.5,
"ISLAND_PhaseL3_Main_Load": 134.5,
"ISLAND_ReadyForSynchronization": false,
"ISLAND_VL1N_Load": 230,
"ISLAND_VL1N_Main": 0,
"ISLAND_VL2N_Load": 1,
"ISLAND_VL2N_Main": 0.5,
"ISLAND_VL3N_Load": 1,
"ISLAND_VL3N_Main": 1,
"METER_X_CTA_I": 0,
"METER_X_CTA_InstReactivePower": 0,
"METER_X_CTA_InstRealPower": 0,
"METER_X_CTB_I": 0,
"METER_X_CTB_InstReactivePower": 0,
"METER_X_CTB_InstRealPower": 0,
"METER_X_CTC_I": 0,
"METER_X_CTC_InstReactivePower": 0,
"METER_X_CTC_InstRealPower": 0,
"METER_X_LifetimeEnergyExport": 7564662,
"METER_X_LifetimeEnergyImport": 4481820,
"METER_X_VL1N": 0,
"METER_X_VL2N": 0.48,
"METER_X_VL3N": 1.6500000000000001,
"METER_Y_CTA_I": 0.199,
"METER_Y_CTA_InstReactivePower": 40,
"METER_Y_CTA_InstRealPower": -10,
"METER_Y_CTB_I": 0,
"METER_Y_CTB_InstReactivePower": 0,
"METER_Y_CTB_InstRealPower": 0,
"METER_Y_CTC_I": 0.0045000000000000005,
"METER_Y_CTC_InstReactivePower": 0,
"METER_Y_CTC_InstRealPower": 0,
"METER_Y_LifetimeEnergyExport": 23896,
"METER_Y_LifetimeEnergyImport": 11684574,
"METER_Y_VL1N": 229.52,
"METER_Y_VL2N": 1.16,
"METER_Y_VL3N": 1.2,
"SYNC-Phase1Usage": "Backup",
"SYNC-Phase2Usage": "NonBackup",
"SYNC-Phase3Usage": "NonBackup",
"SYNC_ExternallyPowered": false,
"SYNC_SiteSwitchEnabled": false,

Looks like ISLAND_VL2N_Main and ISLAND_VL3N_Main doesn't get zeroed when just going off-grid in Powerwall.

@longzheng
Copy link
Contributor Author

longzheng commented Jan 31, 2023

Here's what it looked like graph wise

image

image

image

In conclusion, the Grid L1/L2/L3 seems to be correct as you currently have it.

I suspect the reason why my previous backup event showed grid voltage was that it was an instantenous blip and the grid wasn't actually down for more than a second.

@jasonacox
Copy link
Owner

jasonacox commented Jan 31, 2023

Thanks @longzheng ! Super helpful. You have METER values which I suspect is how the Powerwall+ works (same as mine but you have 3 phase). Based on @BJReplay 's data, we see that ISLAND*Main reflects the grid as well. Your vitals data shows that as well:

ON Grid

"ISLAND_VL1N_Main": 243,
"ISLAND_VL2N_Main": 243.5,
"ISLAND_VL3N_Main": 243,

OFF Grid

"ISLAND_VL1N_Main": 0,
"ISLAND_VL2N_Main": 0.5,
"ISLAND_VL3N_Main": 1,

Also, I found the cause to the curve "blip" instead of dropping to zero, the CQ sampling of 1m would average out the zero so that it never reaches zero. I've struggled with the right down-sampling amount for compression without losing too much fidelity. I think grid voltage may be one that could use more fidelity as those outage events can be brief. I'll set the ISLAND*Main CQ to 15s (4x more resolution).

jasonacox added a commit that referenced this pull request Jan 31, 2023
jasonacox added a commit that referenced this pull request Jan 31, 2023
@jasonacox
Copy link
Owner

The update is ready. You will need to manually pull down the new influxdb/influxdb.sql and influxdb/sample.sql files from the 230v branch and run the influxdb command to activate the CQs for the ISLAND_VLxN_Main voltage data we will use for Grid.

# pull down the latest
git pull

# switch to 230v branch
git checkout 230v

# run upgrade.sh or do these steps
# ./upgrade.sh

# Add downsample continuous queries to InfluxDB
docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/influxdb.sql"

# Downsampling current raw data in InfluxDB
docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/sample.sql"

Import the new dashboard.json (https://github.com/jasonacox/Powerwall-Dashboard/blob/230v/dashboard.json)

@BJReplay
Copy link
Contributor

Last Hour (I have alerts!!!)

image

Last two days - L2 frequency drifts to 60Hz - I did a complete reset yesterday)

image

Hiding L2 traces - last two days.

image

Last 30 minutes - you can see when I got it set up:

image

@jasonacox
Copy link
Owner

jasonacox commented Jan 31, 2023

Thanks @BJReplay ! This looks good! The logic is summing your PW voltages which will keep it in line with the Home and Grid voltages.

The only missing bit is that the manual downsampling part doesn't seem to have worked. We should see the grid and PW voltage data for the last few days too. Did you get an error on this?

docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/sample.sql"

Oh yes... and welcome to Alerts! :)

@BJReplay
Copy link
Contributor

Did you get an error on this?

docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/sample.sql"
2023/01/31 06:15:26 error: error parsing query: found USE, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET, KILL at line 1, char 1

I commented out the USE and ran it again, and it ran without error.

I also got some unhelpful errors on the first sql:

docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/influxdb.sql"
2023/01/31 06:03:04 error: continuous query already exists
2023/01/31 06:03:04 error: continuous query already exists

@jasonacox
Copy link
Owner

The "already exists" errors are "normal" (yeah, sorry). The "USE" error was the key.

Do you see more history now for the voltage?

@BJReplay
Copy link
Contributor

Did you get an error on this?

OK, so I fired up the teminal and ran it line by line.

# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> USE powerwall
Using database powerwall
> SELECT mean(ISLAND_VL1N_Main) AS ISLAND_VL1N_Main, mean(ISLAND_VL2N_Main) AS ISLAND_VL2N_Main, mean(ISLAND_VL3N_Main) AS ISLAND_VL3N_Main INTO powerwall.vitals.:MEASUREMENT FROM (SELECT ISLAND_VL1N_Main, ISLAND_VL2N_Main, ISLAND_VL3N_Main FROM raw.http) GROUP BY time(15s), month, year fill(linear)
name: result
time written
---- -------
0    18887

image

@BJReplay
Copy link
Contributor

Do you see more history now for the voltage?

Not at first, but now that I've run it again, with the USE, it looks like it has worked.

That said, I'm going to run the setup script line by line as well.

@BJReplay
Copy link
Contributor

Not at first, but now that I've run it again, with the USE, it looks like it has worked.

That said, I'm going to run the setup script line by line as well.

No errors on a line by line of the influxdb.sql (excluding the CREATE DATABASE powerwall line) nor a repeat of sample.sql, but no increase in the period covered with data. Grid L1 and PW1 spring into existence at 11am on the 28th (GMT 00:00 on the 28th)

image

@jasonacox
Copy link
Owner

Thanks. Do you happen to see the field ISLAND_VL1N_Main in the "raw"."http" data? if so, select it and see if it goes earlier.

image

Sadly, I must sign off the night. Thanks for your help. I think we are close to releasing this. :)

@BJReplay
Copy link
Contributor

Do you happen to see the field ISLAND_VL1N_Main in the "raw"."http" data? if so, select it and see if it goes earlier.

That starts on the 28th at 11am too.

Hmmm, I wonder if I did something then (like pulled an updated pypowerwall then, which started picking up new vitals)? or something else to break this before this date / time?

jasonacox added a commit that referenced this pull request Jan 31, 2023
jasonacox added a commit that referenced this pull request Jan 31, 2023
@jasonacox
Copy link
Owner

Two updates:

  • I switched the dashboard from using the grid voltage (ISLAND_VL1N_Main) to using the house voltage (ISLAND_VL1N_Load) to determine a 230V grid condition for PW graphing.
  • I found the bug in the sample.sql where the SELECT from was missing the "powerwall." explicit database name. The upgrade script should now work... or
# pull latest
git pull
# git checkout 230v # if you haven't done this already

# run resample
docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/sample.sql"

@BJReplay thanks for your help! The fact that the raw data was missing is a good thing. That means you were likely on an older pypowerwall until recently, but more important, we aren't missing something in the resample script. :) Since moving to this new dashboard (from METER to ISLAND data) will remove history outside of raw data, I am going to see if I can add a script to port the METER data into ISLAND for those who have that (otherwise they will be missing historical data).

If you get a chance, test and let me know if the new dashboard.json behaves correctly.

@madkiwinz
Copy link

I’ve found this thread very interesting as my single phase (230VAC) Powerwall which is also showing voltages on the L2 & L3.

Our powerwalls (x2( were installed in June 2022, and the historical data from the Powerwall-Dashboard shows that these values have been consistent overtime.

    "ISLAND_VL1N_Load": 239.5,
    "ISLAND_VL1N_Main": 240.5,
    "ISLAND_VL2N_Load": 6.5,
    "ISLAND_VL2N_Main": 6.0,
    "ISLAND_VL3N_Load": 1.5,
    "ISLAND_VL3N_Main": 0.5,

"TESYNC—XXXXXX-04-F--XXXXXXXXXX": {
    "ISLAND_FreqL1_Load": 50.0,
    "ISLAND_FreqL1_Main": 50.0,
    "ISLAND_FreqL2_Load": 50.0,
    "ISLAND_FreqL2_Main": 50.0,
    "ISLAND_FreqL3_Load": 50.0,
    "ISLAND_FreqL3_Main": 50.01,
    "ISLAND_GridConnected": true,
    "ISLAND_GridState": "ISLAND_GridState_Grid_Compliant",
    "ISLAND_L1L2PhaseDelta": -256.0,
    "ISLAND_L1L3PhaseDelta": -112.5,
    "ISLAND_L1MicrogridOk": true,
    "ISLAND_L2L3PhaseDelta": -25.0,
    "ISLAND_L2MicrogridOk": false,
    "ISLAND_L3MicrogridOk": false,
    "ISLAND_PhaseL1_Main_Load": -0.5,
    "ISLAND_PhaseL2_Main_Load": -11.5,
    "ISLAND_PhaseL3_Main_Load": -60.0,
    "ISLAND_ReadyForSynchronization": true,
    "ISLAND_VL1N_Load": 239.5,
    "ISLAND_VL1N_Main": 240.5,
    "ISLAND_VL2N_Load": 6.5,
    "ISLAND_VL2N_Main": 6.0,
    "ISLAND_VL3N_Load": 1.5,
    "ISLAND_VL3N_Main": 0.5,
    "METER_X_CTA_I": 13.231,
    "METER_X_CTA_InstReactivePower": 3099.0,
    "METER_X_CTA_InstRealPower": 20.0,
    "METER_X_CTB_I": 0.0,
    "METER_X_CTB_InstReactivePower": 0.0,
    "METER_X_CTB_InstRealPower": 0.0,
    "METER_X_CTC_I": 0.0,
    "METER_X_CTC_InstReactivePower": 0.0,
    "METER_X_CTC_InstRealPower": 0.0,
    "METER_X_LifetimeEnergyExport": 2056549.0,
    "METER_X_LifetimeEnergyImport": 6975657.0,
    "METER_X_VL1N": 239.67000000000002,
    "METER_X_VL2N": 6.390000000000001,
    "METER_X_VL3N": 0.41000000000000003,
    "METER_Y_CTA_I": 20.3115,
    "METER_Y_CTA_InstReactivePower": -215.0,
    "METER_Y_CTA_InstRealPower": 4829.0,
    "METER_Y_CTB_I": 0.0,
    "METER_Y_CTB_InstReactivePower": 0.0,
    "METER_Y_CTB_InstRealPower": 0.0,
    "METER_Y_CTC_I": 0.0,
    "METER_Y_CTC_InstReactivePower": 0.0,
    "METER_Y_CTC_InstRealPower": 0.0,
    "METER_Y_LifetimeEnergyExport": 28962.0,
    "METER_Y_LifetimeEnergyImport": 6866779.0,
    "METER_Y_VL1N": 238.48000000000002,
    "METER_Y_VL2N": 6.4,
    "METER_Y_VL3N": 1.43,
    "SYNC-Phase1Usage": "Backup",
    "SYNC-Phase2Usage": "NotConfigured",
    "SYNC-Phase3Usage": "NotConfigured",
    "SYNC_ExternallyPowered": false,
    "SYNC_SiteSwitchEnabled": false,
    "alerts": [
        "SYNC_a001_SW_App_Boot",
        "SYNC_a046_DoCloseArguments"
    ],
    "componentParentDin": "STSTSM—XXXXXX-14-J--XXXXXXXXXX",
    "firmwareVersion": "8cd8cac4b9cb48",
    "lastCommunicationTime": 1675208475,
    "manufacturer": "TESLA",
    "partNumber": "1493315-04-F",
    "serialNumber": “XXXXXXXXXXXX",
    "teslaEnergyEcuAttributes": {
        "ecuType": 259
    }
},

@madkiwinz
Copy link

Has anyone seen the over voltage Neutral Chassis alert before?

"TEPINV--XXXXX-32-V--XXXXXXXX": {
    "PINV_EnergyCharged": 2453120.0,
    "PINV_EnergyDischarged": 2150990.0,
    "PINV_Fout": 50.043,
    "PINV_GridState": "Grid_Compliant",
    "PINV_HardwareEnableLine": true,
    "PINV_PllFrequency": 50.028,
    "PINV_PllLocked": true,
    "PINV_Pout": -0.12,
    "PINV_PowerLimiter": "PWRLIM_POD_Power_Limit",
    "PINV_Qout": -3.08,
    "PINV_ReadyForGridForming": true,
    "PINV_State": "PINV_GridFollowing",
    "PINV_VSplit1": 121.60000000000001,
    "PINV_VSplit2": 121.60000000000001,
    "PINV_Vout": 243.10000000000002,
    "alerts": [
        "PINV_a043_gridResistanceTooHigh",
        "PINV_a067_overvoltageNeutralChassis"
    ],

@jasonacox
Copy link
Owner

Hi @leemj001 welcome to the thread...

Has anyone seen the over voltage Neutral Chassis alert before?
"PINV_a067_overvoltageNeutralChassis"

Yes, it is common (nominal).

I’ve found this thread very interesting as my single phase (230VAC) Powerwall which is also showing voltages on the L2 & L3.

"ISLAND_VL1N_Load": 239.5,
"ISLAND_VL1N_Main": 240.5,
"ISLAND_VL2N_Load": 6.5,
"ISLAND_VL2N_Main": 6.0,
"ISLAND_VL3N_Load": 1.5,
"ISLAND_VL3N_Main": 0.5,

I have single phase (2 power legs) and see phantom voltage on the third leg as well. I recommend muting L2 and L3 in the dashboard panel.

jasonacox added a commit that referenced this pull request Feb 1, 2023
@jasonacox
Copy link
Owner

I wrote a query to port over the old METER_X_VLxN data (if your system has that) to ISLAND_VLxN_Main, which will be used to represent grid voltage going forward. By copying this over, it will preserve the historic data (if you had any). I also added a concept of a "run-once" query to the upgrade.sh to prevent this query from being run every time someone upgrades.

If you want to test, pull down the latest and run it manually:

git pull
git checkout 230v # if you haven't already

docker exec --tty influxdb sh -c "influx -import -path=/var/lib/influxdb/run-once-2.8.0.sql"

I'm running tests before releasing as v2.8.0.

@jasonacox
Copy link
Owner

Team:

I just merged the influxdb updates, upgrade.sh script and dashboard.json. I completed several successful test. Please report any issues.

I'm rather happy with the update:

  • Now using ISLAND_VLxN_Main data for Grid voltage (instead of METER_x_VLxN) as this appears to be more common across systems. Upgrade script executes a run-once query to copy historic data over.
  • Added logic to Voltage panel to sum Powerwall L1 and L2 voltages for 230V grid users thanks to @longzheng

First of all, this is all thanks to @longzheng , who opened this PR! Thanks for helping nudge the project forward.

I am going to close this PR but please continue to comment or raise any question or issues here.

@jasonacox jasonacox closed this Feb 1, 2023
@longzheng longzheng deleted the patch-2 branch February 2, 2023 10:28
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.

5 participants