Skip to content

Commit ebafcac

Browse files
committed
added Discover CAN binding
1 parent 7ca7b30 commit ebafcac

File tree

5 files changed

+52
-232
lines changed

5 files changed

+52
-232
lines changed

bms-discover-can/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target/
2+
/.settings/
3+
/.classpath
4+
/.project

bms-discover-can/src/main/java/com/airepublic/bmstoinverter/bms/discover/can/DiscoverBmsCANProcessor.java

+3-39
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ public void collectData(final Port port) {
5858
case 0x35C:
5959
requestChargeDischargeConfigChange(pack, data);
6060
break;
61-
case 0x370:
62-
readMinMaxTemperatureVoltage(pack, data);
63-
break;
64-
case 0x371:
65-
readTemperatureIds(pack, data);
66-
break;
6761
case 0x35E:
6862
readManufacturer(pack, data);
6963
break;
@@ -95,9 +89,9 @@ protected void readChargeDischargeInfo(final BatteryPack pack, final ByteBuffer
9589
// 0x354
9690
protected void readCapacity(final BatteryPack pack, final ByteBuffer data) {
9791
// Battery capacity (0.1Ah) - uint_16
98-
pack.ratedCapacitymAh = data.getChar() * 100;
92+
pack.ratedCapacitymAh = data.getChar() * 10;
9993
// Remaining capacity (0.1Ah) - uint_16
100-
pack.remainingCapacitymAh = data.getChar() * 100;
94+
pack.remainingCapacitymAh = data.getChar() * 10;
10195

10296
LOG.debug("\nCapacity \tRemaining\n \t{}\t\t{}", pack.ratedCapacitymAh / 1000f, pack.remainingCapacitymAh / 1000f);
10397
}
@@ -117,7 +111,7 @@ protected void readSOC(final BatteryPack pack, final ByteBuffer data) {
117111
// 0x356
118112
protected void readBatteryVoltage(final BatteryPack pack, final ByteBuffer data) {
119113
// Battery voltage (0.01V) - sint_16
120-
pack.packVoltage = data.getShort() / 10;
114+
pack.packVoltage = data.getShort();
121115
// Battery current (0.1A) - sint_16
122116
pack.packCurrent = data.getShort();
123117
// Battery current (0.1C) - sint_16
@@ -149,36 +143,6 @@ protected void requestChargeDischargeConfigChange(final BatteryPack pack, final
149143
}
150144

151145

152-
// 0x370
153-
protected void readMinMaxTemperatureVoltage(final BatteryPack pack, final ByteBuffer data) {
154-
// Maximum cell temperature (0.1C) - uint_16
155-
pack.tempMax = data.getShort();
156-
// Minimum cell temperature (0.1C) - uint_16
157-
pack.tempMin = data.getShort();
158-
// Maximum cell voltage (0.1V) - uint_16
159-
pack.maxCellmV = data.getShort();
160-
// Minimum cell voltage (0.1V) - uint_16
161-
pack.minCellmV = data.getShort();
162-
163-
LOG.debug("\nMax Temp \tMin Temp \tMax Cell mV \tMin Cell mV\n{} \t {}\t\t{}\t\t{}", pack.tempMax / 10f, pack.tempMin / 10f, pack.maxCellmV, pack.minCellmV);
164-
}
165-
166-
167-
// 0x371
168-
protected void readTemperatureIds(final BatteryPack pack, final ByteBuffer data) {
169-
// Maximum cell temperature (0.1C) - uint_16
170-
// pack.tempMax = data.getShort();
171-
// Minimum cell temperature (0.1C) - uint_16
172-
// pack.tempMin = data.getShort();
173-
// Maximum cell voltage id - uint_16
174-
pack.maxCellVNum = data.getShort();
175-
// Minimum cell voltage id - uint_16
176-
pack.minCellVNum = data.getShort();
177-
178-
LOG.debug("\nMax V Cell \t Min V Cell\n\t{}\t\t{}", pack.maxCellVNum, pack.minCellVNum);
179-
}
180-
181-
182146
// 0x35E
183147
protected void readManufacturer(final BatteryPack pack, final ByteBuffer data) {
184148
pack.manufacturerCode = "";

bms-discover-can/src/test/java/com/airepublic/bmstoinverter/bms/discover/can/DiscoverPylonBmsCANProcessorTest.java

-83
This file was deleted.

bms-to-inverter-main/src/main/resources/config.properties

+44-110
Original file line numberDiff line numberDiff line change
@@ -7,139 +7,73 @@
77
###################################################################
88

99
#### Simple single port configuration ####
10+
# bms.pollIntervall - is the interval to request BMS data (in seconds)
1011
# bms.x.type - can be (DALY_CAN, DALY_RS485, JK_CAN, PYLON_CAN or SEPLOS_CAN
1112
# bms.x.portLocator - is the locator/device to use to communicate to the BMS, eg. can0, /dev/ttyUSB0, com3, etc.
12-
# bms.x.pollIntervall - is the interval to request BMS data (in seconds)
13+
# bms.x.baudRate - is the locator/device baudrate to use to communicate to the BMS, eg. 9600, 500000, etc.
1314
# bms.x.delayAfterNoBytes - is the delay after receiving no data (in ms)
14-
bms.pollInterval=2
15+
bms.pollInterval=1
1516

16-
#bms.1.type=DALY_RS485
17-
#bms.1.id=1
18-
#bms.1.portLocator=/dev/ttyS0
19-
#bms.1.delayAfterNoBytes=500
20-
21-
bms.1.type=DALY_CAN
17+
bms.1.type=NONE
2218
bms.1.id=1
23-
bms.1.portLocator=can0
19+
bms.1.portLocator=adf
2420
bms.1.baudRate=500000
25-
bms.1.delayAfterNoBytes=500
26-
27-
bms.2.type=DALY_CAN
28-
bms.2.id=2
29-
bms.2.portLocator=can0
30-
bms.2.baudRate=500000
31-
bms.2.delayAfterNoBytes=500
32-
33-
bms.3.type=DALY_CAN
34-
bms.3.id=3
35-
bms.3.portLocator=can0
36-
bms.3.baudRate=500000
37-
bms.3.delayAfterNoBytes=500
38-
39-
bms.4.type=DALY_CAN
40-
bms.4.id=4
41-
bms.4.portLocator=can0
42-
bms.4.baudRate=500000
43-
bms.4.delayAfterNoBytes=500
44-
45-
bms.5.type=DALY_CAN
46-
bms.5.id=5
47-
bms.5.portLocator=can0
48-
bms.5.baudRate=500000
49-
bms.5.delayAfterNoBytes=500
50-
51-
bms.6.type=DALY_CAN
52-
bms.6.id=6
53-
bms.6.portLocator=can0
54-
bms.6.baudRate=500000
55-
bms.6.delayAfterNoBytes=500
56-
57-
bms.7.type=DALY_CAN
58-
bms.7.id=7
59-
bms.7.portLocator=can0
60-
bms.7.baudRate=500000
61-
bms.7.delayAfterNoBytes=500
62-
63-
bms.8.type=DALY_CAN
64-
bms.8.id=8
65-
bms.8.portLocator=can0
66-
bms.8.baudRate=500000
67-
bms.8.delayAfterNoBytes=500
68-
69-
#bms.1.type=DALY_RS485
70-
#bms.1.id=1
71-
#bms.1.portLocator=com3
72-
##bms.1.portLocator=/dev/ttyAMA0
73-
#bms.1.baudRate=9600
74-
#bms.1.delayAfterNoBytes=200
75-
#
76-
#bms.2.type=JK_CAN
77-
#bms.2.id=1
78-
#bms.2.portLocator=can1
79-
#bms.2.baudRate=500000
80-
#bms.2.delayAfterNoBytes=200
81-
#...
82-
21+
bms.1.delayAfterNoBytes=200
8322

8423
###################################################################
8524
### Inverter settings ###
8625
###################################################################
8726
# The inverter type can be NONE, DEYE_CAN, GROWATT_CAN, SMA_SI_CAN, SOLARK_CAN
88-
inverter.type=NONE
27+
inverter.type=PYLON_RS485
8928
# The port name/device to use to communicate to the inverter
90-
inverter.portLocator=can1
91-
# The port name/device baud rate to use to communicate to the inverter
92-
inverter.baudRate=500000
29+
inverter.portLocator=com4
30+
# The port baud rate to use to communicate to the inverter
31+
inverter.baudRate=9600
9332
# Interval to send data to the inverter (in seconds)
9433
inverter.sendInterval=1
9534

9635
###################################################################
97-
### Optional services settings ###
36+
### Plugin settings ###
9837
###################################################################
38+
plugin.inverter.1.class=com.airepublic.bmstoinverter.core.plugin.inverter.ManipulateBatteryPackDataPlugin
39+
plugin.inverter.1.property.1.name=SOC
40+
plugin.inverter.1.property.1.value=
41+
plugin.inverter.1.property.1.description=The configured preset batterypack SOC (unit 0.1%)
42+
plugin.inverter.1.property.2.name=SOH
43+
plugin.inverter.1.property.2.value=
44+
plugin.inverter.1.property.2.description=The configured preset batterypack SOH (unit 0.1%)
45+
plugin.inverter.1.property.3.name=Current
46+
plugin.inverter.1.property.3.value=
47+
plugin.inverter.1.property.3.description=The configured preset batterypack current (unit 0.1A)
48+
plugin.inverter.1.property.4.name=Voltage
49+
plugin.inverter.1.property.4.value=
50+
plugin.inverter.1.property.4.description=The configured preset batterypack voltage (unit 0.1V)
51+
plugin.inverter.1.property.5.name=Max. charge current
52+
plugin.inverter.1.property.5.value=2990
53+
plugin.inverter.1.property.5.description=The configured preset batterypack maximum charge current (unit 0.1A)
54+
plugin.inverter.1.property.6.name=Max. discharge current
55+
plugin.inverter.1.property.6.value=1999
56+
plugin.inverter.1.property.6.description=The configured preset batterypack maximum discharge current (unit 0.1A)
57+
plugin.inverter.1.property.7.name=Max. voltage limit
58+
plugin.inverter.1.property.7.value=
59+
plugin.inverter.1.property.7.description=The configured preset batterypack maximum voltage limit (unit 0.1V)
60+
plugin.inverter.1.property.8.name=Min. voltage lime
61+
plugin.inverter.1.property.8.value=
62+
plugin.inverter.1.property.8.description=The configured preset batterypack minimum voltage limit (unit 0.1V)
63+
plugin.inverter.1.property.9.name=Average Temperature
64+
plugin.inverter.1.property.9.value=
65+
plugin.inverter.1.property.9.description=The configured preset batterypack average temperature (unit 0.1C)
9966

67+
###################################################################
68+
### Optional services settings ###
69+
###################################################################
10070

101-
#### MQTT properties ####
102-
# Activate the MQTT broker if you have other consumers connecting to your MQTT broker
103-
mqtt.broker.enabled=false
104-
# The URL of the MQTT broker server for other consumers to connect to
105-
mqtt.broker.locator=tcp://127.0.0.1:61616
106-
# The topic name on the MQTT broker to provide
107-
mqtt.broker.topic=energystorage
108-
# Activate the MQTT producer if you want to send your BMS data to a MQTT broker, e.g. HomeAssistant
109-
mqtt.producer.enabled=false
110-
# The URL of the MQTT broker to send to
111-
mqtt.producer.locator=tcp://127.0.0.1:61616
112-
# The topic name on the MQTT broker to send to
113-
mqtt.producer.topic=energystorage
114-
# The username of the external MQTT broker to send to
115-
mqtt.producer.username=
116-
# The password on the external MQTT broker to send to
117-
mqtt.producer.password=
11871

119-
#### Email properties ####
120-
mail.service.enabled=false
121-
mail.out.debug=true
122-
# SMTP or IMAP address of the outgoing server
123-
mail.out.host=smtp.gmail.com
124-
# The port of the outgoing server
125-
mail.out.port=587
126-
# smtp for TLS, smtps for SSL
127-
mail.out.type=smtp
128-
# User name to authenticate at the outgoing server
129-
mail.out.username=[email protected]
130-
# Password to authenticate at the outgoing server
131-
mail.out.password=mypassword
132-
# Disable if using TLS
133-
mail.out.sslEnable=false
134-
# Disable if using SSL
135-
mail.out.tlsEnable=true
136-
# The email address to use when sending emails
137-
mail.out.defaultEmail=[email protected]
138-
# A (comma separated) list of pre-configured email recipients
139-
mail.out.recipients=[email protected]
14072

14173
#### Webserver properties ####
14274
webserver.service.enabled=true
14375
# The webserver port
14476
webserver.http.port=8080
14577
webserver.https.port=8443
78+
webserver.username=admin
79+
webserver.password=admin

configurator/src/main/resources/META-INF/services/com.airepublic.bmstoinverter.core.BMSDescriptor

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
com.airepublic.bmstoinverter.bms.byd.can.BYDBmsCANDescriptor
22
com.airepublic.bmstoinverter.bms.daly.can.DalyBmsCANDescriptor
33
com.airepublic.bmstoinverter.bms.daly.rs485.DalyBmsRS485Descriptor
4+
com.airepublic.bmstoinverter.bms.discover.can.DiscoverBmsCANDescriptor
45
com.airepublic.bmstoinverter.bms.dummy.DummyBmsDescriptor
56
com.airepublic.bmstoinverter.bms.growatt.can.GrowattBmsCANDescriptor
67
com.airepublic.bmstoinverter.bms.growatthv.can.GrowattHVBmsCANDescriptor

0 commit comments

Comments
 (0)