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

3 Phase 230V calculations are wrong #17

Closed
Dezzorex opened this issue Feb 3, 2021 · 9 comments
Closed

3 Phase 230V calculations are wrong #17

Dezzorex opened this issue Feb 3, 2021 · 9 comments

Comments

@Dezzorex
Copy link

Dezzorex commented Feb 3, 2021

I just got installed a 3 Phase IT charger for my Tesla Model 3. It is charging at 230V 11.4kW, but if I set phases to 3 in the config, it calculates wrong. I Suspect calculations are for 3 phase 400V TN which is common in europe, but in norway we have 230V IT (only Norway and Albania I believe have this, newer areas in Norway do have 400V though). This causes it to calculate wrong amount of kW and therefor also wrong usage. If I take the calulated amount for 3 phase, and divide it by 1,73 (difference between 400/230), it results in more accurate number compared to TeslaMate. Basically all calculations here will be wrong on IT network with 3 phase.

Would it be possible to add calculations/and config for 230V?

Example from calculations based on 1-2-3 phase:

1 Phase:

  Calculating cost for charges 02/03/2021 00:03:03 UTC - 02/03/2021 04:21:30 UTC
  Calculated cost 13.68 and energy 27.51 kWh for charging process 57
  Mismatch between TeslaMate calculated energy used of 47.65 and ours of 27.51

2-Phase:

  Calculating cost for charges 02/03/2021 00:03:03 UTC - 02/03/2021 04:21:30 UTC
  Calculated cost 27.36 and energy 55.02 kWh for charging process 57
  Mismatch between TeslaMate calculated energy used of 47.65 and ours of 55.02

3-Phase:

  Calculating cost for charges 02/03/2021 00:03:03 UTC - 02/03/2021 04:21:30 UTC
  Calculated cost 41.04 and energy 82.53 kWh for charging process 57
  Mismatch between TeslaMate calculated energy used of 47.65 and ours of 82.53
@Dezzorex Dezzorex changed the title 3 Phase IT issue 3 Phase 230V calculations are wrong Feb 3, 2021
@MattJeanes
Copy link
Owner

I suspected the 3-phase support would be a bit off, unfortunately I was unable to test it! Could you if possible provide an export of a 3-phase charge from the charges and charging_process table? I see how TeslaMate is calculating it and performing voltage correction but I was never able to implement it without access to some test data.

If you're not sure how to export data, try using pgAdmin and essentially doing this:
image
image

There is no sensitive data like location in these tables, that is stored elsewhere so this is fine to export but please review the exported data yourself just to make sure

@Dezzorex
Copy link
Author

Dezzorex commented Feb 4, 2021

Added results in uploaded zip (in CSV format)

Charge.zip

@MattJeanes
Copy link
Owner

That's perfect thank you, I'll take a look into this now - do you mind if I commit a version of this to the project as part of a unit test?

@MattJeanes
Copy link
Owner

MattJeanes commented Feb 4, 2021

I've implemented the phase calculation as per TeslaMate itself now, can you try the new RC version v1.5.0-rc.1? you can remove the TeslaMate__Phases environment variable too now as it is no longer required.

It calculates the same energy usage as TeslaMate itself now for your example you sent me, so can you give it a go and see if it's working well for you? Set the costs in the database to NULL to get TeslaMateAgile to calculate them again.

If all goes well I'll publish it properly :)

@Dezzorex
Copy link
Author

Dezzorex commented Feb 4, 2021

Fantastic, but how do I install the pre-release version via docker?

@MattJeanes
Copy link
Owner

Use the tag v1.5.0-rc.1 on docker

@Dezzorex
Copy link
Author

Dezzorex commented Feb 5, 2021

Thanks, seems to work on the main charges now, but getting 0 amount on short charges now, so might be a bug there?

info: TeslaMateAgile.PriceHelper[0]
Calculated cost 0 and energy 0 kWh for charging process 63

image

@MattJeanes
Copy link
Owner

Yeah it's kind of intentional, TeslaMate should do the same thing with the energy used column I believe? It requires a minimum data set to accurately calculate phases. If you see - in 'Used' on the Charges page in Grafana it means TeslaMate has had the same issue while calculating energy usage. I could lower the threshold but I want to keep the behaviour identical to TeslaMate if posible.

@MattJeanes
Copy link
Owner

I have now released this as v1.5.0 - if the short charges is causing you an issue please raise a new issue and we can work something out.

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

No branches or pull requests

2 participants