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

Multiple cars #4

Open
flodorn opened this issue Nov 23, 2018 · 0 comments
Open

Multiple cars #4

flodorn opened this issue Nov 23, 2018 · 0 comments

Comments

@flodorn
Copy link

flodorn commented Nov 23, 2018

Love your work cdragon, thanks a lot. Been working with your code for a couple of days setting everything up (RPi3B), got two brandnew TWCs (Firmware 4.5.3 / Model EVW2T32HL) and two Teslas (X and S) on european 3 phases. I noticed everything is working fine if I power only one TWC (got relays to cut them off individually). However, If I power both TWCs I found that the cars don't start/stop charging reliably and index.php doesn't display the multiple TWCs correctly. The fix on index.php is the following:

342                     for($i = 1; $i <= $status[$statusIdx]; $i++) {
343                     $subStatus = explode('~', $status[$statusIdx + $i]);
344                     $twcModelMaxAmps = $subStatus[1];
345                     print("<br /><strong>TWC " . $subStatus[0] . ':</strong> ');

The fix on TWCManager.py is the following:

I replaced this
2141 desiredAmpsOffered = minAmpsToOffer

with the following code:

if(maxAmpsToDivideAmongSlaves < 1):
    desiredAmosOffered = 0
else: desiredAmpsOffered = minAmpsToOffer

Without this line I had the following issue: one car is at home trying to STOP charging (due to solar input), the other car is not at home and not plugged in anywhere. This caused the logic on lines 2064-2074 to set minAmpsToOffer to 6 on the TWC with no car plugged in, which in turn led the logic on line 1818 and 1819 to believe that is should start charging which set
queue_background_task({'cmd':'charge', 'charge':True})
right after the car at home which is plugged in into the second TWC set it to 'false' trying to stop charging.

This of course set startOrStop to 'start' and the API cmd kept trying to start the car at home which was already charging at minAmps and which I was trying to stop.

For now this is working fine. Of course it would be much neater to implement a mapping to know which car is on which TWC to be able to start/stop them induvidually. Or better yet, to use the bytearray to start/stop charging but after reading through the 20 pages of the TWCManager post on TMC, I understand that this may not be possible.

ngardiner referenced this issue in ngardiner/TWCManager Sep 12, 2019
applied fix for multiple chargers per flodorn's pull request upstream
deece pushed a commit to InfernoEmbedded/TWCManager that referenced this issue Jan 12, 2022
With this change, you can fill in, for example, `socket://localhost:7778` as the RS485 port in config.json. This opens up some possibilities:
- You have an RS485 to tcp converter near your TWC, and run TWCManager somewhere else, only connected with TCP/IP
  I would only recommend this on a secure LAN, since you have no autentication/authorization
- For testing TWCManager, you can run 2 instances of TWCManager, one as a master and one as a slave. I use this for example with the help of socat:
    `socat TCP-LISTEN:7777,reuseaddr TCP-LISTEN:7778,reuseaddr` to open 2 listening ports 7778 and 7777 that are connected to one another.
    Then, it is just a matter of having 2 TWCManagers, where you connect to 7777 first and then to 7778 with the second instance.

If you use a normal device, like `/dev/ttyUSB0` as port, this works exactly as before

Related to dracoventions#4
deece pushed a commit to InfernoEmbedded/TWCManager that referenced this issue Jan 12, 2022
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

1 participant