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

Tian power BMS is reading amperage incorrectly #79

Open
aren opened this issue Nov 5, 2024 · 8 comments · May be fixed by #80
Open

Tian power BMS is reading amperage incorrectly #79

aren opened this issue Nov 5, 2024 · 8 comments · May be fixed by #80

Comments

@aren
Copy link

aren commented Nov 5, 2024

According to my inverter, my two batteries are producing ~650W of power right now. At 52 volts, that's 12.5 amps, or 6.25 amps each.

But the logs are showing 648 Amps per battery. That can't be right.

2024-11-05 08:31:07.719 | DEBUG | Thread-10  | o.ModbusRTUTransport:266   | Sent: 01 04 10 00 00 17 B4 C4
2024-11-05 08:31:07.789 | DEBUG | Thread-10  | o.ModbusRTUTransport:443   | Response: 01 04 2E 14 57 FD 44 1A CD 00 C5 00 D2 00 00 00 00 1E 00 02 8C 03 E8 29 16 00 0C 27 10 0C B8 0C B5 00 00 00 C8 00 BE 00 DC 00 00 15 E0 27 10 00 00 22 E9
2024-11-05 08:31:07.789 | INFO  | Thread-10  | verter.BmsToInverter:320   |
BMS     SOC       V       A      CellMinV        CellMaxV       CellDiff
#1       65.2   52.0    648.3   3.253(#0)       3.256(#0)       0.003
#2       64.2   52.0    648.4   3.253(#0)       3.256(#0)       0.003

2024-11-05 08:31:07.789 | INFO  | Thread-10  | verter.BmsToInverter:390   | BMS alarms:
        NONE
2024-11-05 08:31:07.789 | INFO  | Thread-10  | verter.BmsToInverter:268   | Reading BMS #2 TIAN_MODBUS on /dev/ttyAMA0...
2024-11-05 08:31:07.839 | DEBUG | Thread-10  | o.ModbusRTUTransport:266   | Sent: 02 04 10 00 00 17 B4 F7
2024-11-05 08:31:07.911 | DEBUG | Thread-10  | o.ModbusRTUTransport:443   | Response: 02 04 2E 14 57 FD 4D 1A 11 00 C8 00 D2 00 00 00 00 1E 00 02 82 03 E8 28 98 00 24 27 10 0C B9 0C B3 00 00 00 C8 00 C8 00 DC 00 00 15 E0 27 10 00 00 4F CA
2024-11-05 08:31:07.911 | INFO  | Thread-10  | verter.BmsToInverter:320   |
BMS     SOC       V       A      CellMinV        CellMaxV       CellDiff
#1       65.2   52.0    648.3   3.253(#0)       3.256(#0)       0.003
#2       64.2   52.0    648.4   3.251(#0)       3.257(#0)       0.006
@aren aren changed the title Tian power BMS is reading Amperage incorrectly Tian power BMS is reading amperage incorrectly Nov 5, 2024
@aren
Copy link
Author

aren commented Nov 5, 2024

Ah here's the issue. The bytes are FD 4D. The code is interpreting them as unsigned short, which is 64845. However, the TianPower BMS docs show this is a signed short, so it should be -691 (or -6.91A).

This makes sense, because the cells are producing power so the current would be negative.

@ai-republic
Copy link
Owner

ai-republic commented Nov 10, 2024

Hi @aren,
could you attach the Tian ModBus spec again. I can't seem to find it - thanks!
I'm wondering if the registers are actaully all 2 bytes long (u_int_16 or s_int_16) and not 4 byte (u_int_32 or s_int_32). I've got a lot of specs that are basically the same as the Tian and all use 2 byte registers which are also really the ModBus standard.
But I remember my surprise when I implemented it that they were stated as each register holding 4 bytes

@aren
Copy link
Author

aren commented Nov 10, 2024

See #71

@ai-republic
Copy link
Owner

Thanks, I found that in my specs collection but wasn't sure which manufacturer that belongs to 😉
Here it actually states the registers are holding 2 bytes - hmm, where did I see that with the 4 bytes 🤔

@ai-republic
Copy link
Owner

I changed it according to the spec. Could you do a Clean install and check what the Tian BMS binding comes up with?

@aren
Copy link
Author

aren commented Nov 14, 2024

It's way off now.

2024-11-13 19:44:07.899 | DEBUG | Thread-10  | o.ModbusRTUTransport:443   | Response: 02 04 2E 14 82 00 00 15 A4 00 AF 00 C8 00 00 00 00 1C 00 03 D3 02 30 16 19 00 1A 27 10 0C D3 0C CF 00 00 00 B4 00 AA 00 C8 00 00 15 E0 27 10 00 00 07 AA
2024-11-13 19:44:07.900 | INFO  | Thread-10  | verter.BmsToInverter:320   |
BMS	SOC	  V  	  A  	 CellMinV 	 CellMaxV	CellDiff
#1	 0.0	0.0	52.5	0.0(#0) 	0.0(#0)	0.0
#2	 0.0	0.0	52.5	0.0(#0) 	0.0(#0)	0.0

2024-11-13 19:44:07.900 | INFO  | Thread-10  | verter.BmsToInverter:388   | BMS alarms:
	BMS #1:	WARNING -> PACK_TEMPERATURE_HIGH
	BMS #1:	WARNING -> PACK_TEMPERATURE_LOW
	BMS #1:	WARNING -> DISCHARGE_CURRENT_HIGH
	BMS #1:	WARNING -> CHARGE_MODULE_TEMPERATURE_HIGH
	BMS #2:	ALARM -> FAILURE_SENSOR_PACK_TEMPERATURE
	BMS #2:	WARNING -> ENCASING_TEMPERATURE_HIGH
	BMS #2:	WARNING -> PACK_TEMPERATURE_LOW
	BMS #2:	WARNING -> DISCHARGE_CURRENT_HIGH
	BMS #2:	WARNING -> CHARGE_MODULE_TEMPERATURE_HIGH
	BMS #2:	ALARM -> FAILURE_COMMUNICATION_INTERNAL

@ai-republic
Copy link
Owner

oh 😮 - let me change it back and try the s_int_16

@ai-republic
Copy link
Owner

@aren please try now with a Clean install

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 a pull request may close this issue.

2 participants