Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-charging-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a5c48b6a
authored
Nov 10, 2023
by
chenxi
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
实现功能:充电过程 BMS 需求与充电机输出、充电过程 BMS 信息、参数配置协议对接
1 parent
32460bdd
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
642 additions
and
0 deletions
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/base/TcpMapper.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/ChargingBmsMachineReqData.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/ChargingBmsReqData.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/MachineParamConfigReqData.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/ChargingBmsMachineRspHandler.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/ChargingBmsRspHandler.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/MachineParamConfigRspHandler.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/protocol/ChargingBmsMachineReq.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/protocol/ChargingBmsReq.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/protocol/MachineParamConfigReq.java
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/ChargingBmsMachineTest.java
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/ChargingBmsTest.java
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/MachineParamConfigTest.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/base/TcpMapper.java
View file @
a5c48b6
...
@@ -48,6 +48,8 @@ public final class TcpMapper {
...
@@ -48,6 +48,8 @@ public final class TcpMapper {
public
static
TcpMapper
CMD_REQ_CHARGING_HAND_SHAKE
=
regist
(
0x15
,
"充电握手"
,
ChargingHandshakeReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_CHARGING_HAND_SHAKE
=
regist
(
0x15
,
"充电握手"
,
ChargingHandshakeReqHandler
.
class
);
public
static
TcpMapper
CMD_RSP_MACHINE_PARAM_CONFIG
=
regist
(
0x17
,
"参数配置"
,
MachineParamConfigRspHandler
.
class
);
public
static
TcpMapper
CMD_REQ_CHARGING_COMPLETION
=
regist
(
0x19
,
"充电结束"
,
ChargingCompletionReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_CHARGING_COMPLETION
=
regist
(
0x19
,
"充电结束"
,
ChargingCompletionReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_ERROR_MESSAGE
=
regist
(
0x1B
,
"错误报文"
,
ErrorMessageReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_ERROR_MESSAGE
=
regist
(
0x1B
,
"错误报文"
,
ErrorMessageReqHandler
.
class
);
...
@@ -56,6 +58,10 @@ public final class TcpMapper {
...
@@ -56,6 +58,10 @@ public final class TcpMapper {
public
static
TcpMapper
CMD_REQ_MACHINE_ABORT_CHARGING
=
regist
(
0x21
,
"充电阶段充电机中止"
,
MachineChargingReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_MACHINE_ABORT_CHARGING
=
regist
(
0x21
,
"充电阶段充电机中止"
,
MachineChargingReqHandler
.
class
);
public
static
TcpMapper
CMD_RSP_CHARGING_BMS_MACHINE
=
regist
(
0x23
,
"充电过程BMS需求与充电机输出"
,
ChargingBmsMachineRspHandler
.
class
);
public
static
TcpMapper
CMD_RSP_CHARGING_BMS
=
regist
(
0x25
,
"充电过程BMS信息"
,
ChargingBmsRspHandler
.
class
);
// public static TcpMapper CMD_NOTIFY_TIME = regist(0x56, "对时设置", TimeNotifyHandler.class);
// public static TcpMapper CMD_NOTIFY_TIME = regist(0x56, "对时设置", TimeNotifyHandler.class);
// 运营交互帧类型码数据定义 0x31~0x47
// 运营交互帧类型码数据定义 0x31~0x47
...
...
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/ChargingBmsMachineReqData.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
data
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpData
;
import
lombok.Data
;
/**
* @Author: chenx
* @Description: 充电过程BMS需求与充电机输出-上报实体类
* @Date: 2023/11/10 17:55
* @Version: 1.0
*/
@Data
public
class
ChargingBmsMachineReqData
extends
TcpData
{
/**
* 交易流水号
* 数据类型:byte[] (BCD码)
* 长度(Byte):16
* 备注:
*/
private
byte
[]
transactionSerialNumber
=
new
byte
[
16
];
/**
* 桩编号
* 数据类型:byte[] (BCD码)
* 长度(Byte):7
* 备注:不足7位补0
*/
private
byte
[]
pileId
=
new
byte
[
7
];
/**
* 枪号
* 数据类型:byte[] (BCD码)
* 长度(Byte):1
* 备注:
*/
private
byte
gunNumber
;
/**
* BMS 电压需求
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 V/位,0 V 偏移量
*/
private
byte
[]
bmsRequiredVoltage
=
new
byte
[
2
];
/**
* BMS 电流需求
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 A/位,-400 A 偏移量
*/
private
byte
[]
bmsRequiredCurrent
=
new
byte
[
2
];
/**
* BMS 充电模式
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:0x01:恒压充电;0x02:恒流充电
*/
private
byte
bmsChargingMode
;
/**
* BMS 充电电压测量值
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 V/位,0 V 偏移量
*/
private
byte
[]
bmsChargingMeasuredVoltage
=
new
byte
[
2
];
/**
* BMS 充电电流测量值
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 A/位,-400 A 偏移量
*/
private
byte
[]
bmsChargingMeasuredCurrent
=
new
byte
[
2
];
/**
* BMS 最高单体动力蓄电池电压及组号
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电
* 压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15
*/
private
byte
[]
bmsHighestVoltageAndNumber
=
new
byte
[
2
];
/**
* BMS 当前荷电状态 SOC( %)
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1%/位,0%偏移量;数据范围:0~100%
*/
private
byte
bmsChargingSoc
;
/**
* BMS 估算剩余充电时间
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 1 min/位,0 min 偏移量;数据范围:0~600 min
*/
private
byte
[]
bmsLeftChargingTime
=
new
byte
[
2
];
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/ChargingBmsReqData.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
data
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpData
;
import
lombok.Data
;
/**
* @Author: chenx
* @Description: 充电过程BMS信息-上报实体类
* @Date: 2023/11/10 18:08
* @Version: 1.0
*/
@Data
public
class
ChargingBmsReqData
extends
TcpData
{
/**
* 交易流水号
* 数据类型:byte[] (BCD码)
* 长度(Byte):16
* 备注:
*/
private
byte
[]
transactionSerialNumber
=
new
byte
[
16
];
/**
* 桩编号
* 数据类型:byte[] (BCD码)
* 长度(Byte):7
* 备注:不足7位补0
*/
private
byte
[]
pileId
=
new
byte
[
7
];
/**
* 枪号
* 数据类型:byte[] (BCD码)
* 长度(Byte):1
* 备注:
*/
private
byte
gunNumber
;
/**
* BMS 最高单体动力蓄电池电压所在编号
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1/位,1 偏移量;数据范围:1~256
*/
private
byte
bmsHighestVoltageNumber
;
/**
* BMS 最高单体动力蓄电池温度
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1ºC/位,-50 ºC 偏移量;数据范围:-50 ºC ~+200 ºC
*/
private
byte
bmsBatteryTemperature
;
/**
* BMS 最高温度检测点编号
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1/位,1 偏移量;数据范围:1~128
*/
private
byte
highestBatteryTemperatureNumber
;
/**
* BMS 最低动力蓄电池温度
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1ºC/位,-50 ºC 偏移量;数据范围:-50 ºC ~+200 ºC
*/
private
byte
lowestTemperatureNumber
;
/**
* BMS 最低单体动力蓄电池电压所在编号
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1/位,1 偏移量;数据范围:1~256
*/
private
byte
lowestBatteryTemperatureNumber
;
/**
* BMS 单体动力蓄电池电压过高/过低
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:(<00>:=正常; <01>:=过高; <10>:=过低)
*/
private
byte
[]
bmsBatteryVoltageStatus
=
new
byte
[
2
];
/**
* BMS 整车动力蓄电池荷电状态SOC 过高/过低
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:(<00>:=正常; <01>:=过高; <10>:=过低)
*/
private
byte
[]
bmsBatteryChargingStatus
=
new
byte
[
2
];
/**
* BMS 动力蓄电池充电过电流
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:(<00>:=正常; <01>:=过流; <10>:=不可信状态)
*/
private
byte
[]
bmsBatteryOverCurrent
=
new
byte
[
2
];
/**
* BMS 动力蓄电池温度过高
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:(<00>:=正常; <01>:=过流; <10>:=不可信状态)
*/
private
byte
[]
bmsBatteryTemperatureStatus
=
new
byte
[
2
];
/**
* BMS 动力蓄电池绝缘状态
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:(<00>:=正常; <01>:=过流; <10>:=不可信状态)
*/
private
byte
[]
bmsBatteryInsulationState
=
new
byte
[
2
];
/**
* 充电禁止
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:(<00>:=禁止; <01>:=允许)
*/
private
byte
[]
chargingProhibition
=
new
byte
[
2
];
/**
* 预留位
* 数据类型:byte (bin码)
* 长度(Byte):2
* 备注:00
*/
private
byte
[]
reserved
=
new
byte
[
2
];
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/MachineParamConfigReqData.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
data
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpData
;
import
lombok.Data
;
/**
* @Author: chenx
* @Description: 参数配置-上报实体类
* @Date: 2023/11/10 17:39
* @Version: 1.0
*/
@Data
public
class
MachineParamConfigReqData
extends
TcpData
{
/**
* 交易流水号
* 数据类型:byte[] (BCD码)
* 长度(Byte):16
* 备注:
*/
private
byte
[]
transactionSerialNumber
=
new
byte
[
16
];
/**
* 桩编号
* 数据类型:byte[] (BCD码)
* 长度(Byte):7
* 备注:不足7位补0
*/
private
byte
[]
pileId
=
new
byte
[
7
];
/**
* 枪号
* 数据类型:byte[] (BCD码)
* 长度(Byte):1
* 备注:
*/
private
byte
gunNumber
;
/**
* BMS 单体动力蓄电池最高允许充电电压
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.01 V/位,0 V 偏移量; 数据范围:0~24 V
*/
private
byte
[]
bmsBatteryHighestVoltage
=
new
byte
[
2
];
/**
* BMS最高允许充电电流
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 A/位,-400A 偏移量
*/
private
byte
[]
bmsBatteryHighestCurrent
=
new
byte
[
2
];
/**
* BMS 最高允许充电总电压
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 V/位,0 V 偏移量
*/
private
byte
[]
bmsBatteryHighestTotalVoltage
=
new
byte
[
2
];
/**
* BMS 最高允许温度
* 数据类型:byte (bin码)
* 长度(Byte):1
* 备注:1ºC/位,-50 ºC 偏移量;数据范围:-50 ºC ~+200 ºC
*/
private
byte
bmsBatteryHighestTemperature
;
/**
* BMS 整车动力蓄电池荷电状态(soc)
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1%/位,0%偏移量;数据范围:0~100%
*/
private
byte
[]
bmsBatteryStatus
=
new
byte
[
2
];
/**
* BMS 整车动力蓄电池当前电池电压
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:整车动力蓄电池总电压
*/
private
byte
[]
bmsBatteryCurrentVoltage
=
new
byte
[
2
];
/**
* 电桩最高输出电压
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 V /位,0 V 偏移量
*/
private
byte
[]
pileHighestOutputVoltage
=
new
byte
[
2
];
/**
* 电桩最低输出电压
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 V /位,0 V 偏移量
*/
private
byte
[]
pileLowestOutputVoltage
=
new
byte
[
2
];
/**
* 电桩最大输出电流
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 A/位,-400A 偏移量
*/
private
byte
[]
pileHighestCurrent
=
new
byte
[
2
];
/**
* 电桩最小输出电流
* 数据类型:byte[] (bin码)
* 长度(Byte):2
* 备注:0.1 A/位,-400A 偏移量
*/
private
byte
[]
pileLowestCurrent
=
new
byte
[
2
];
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/ChargingBmsMachineRspHandler.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
handler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpHandler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ChargingBmsMachineReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ChargingBmsMachineReq
;
import
io.netty.channel.Channel
;
import
java.util.Objects
;
/**
* @Author: chenx
* @Description: 充电过程BMS需求与充电机输出 rsp handler
* @Date: 2023/11/10 18:26
* @Version: 1.0
*/
public
class
ChargingBmsMachineRspHandler
implements
TcpHandler
<
ChargingBmsMachineReq
,
ChargingBmsMachineReq
>
{
@Override
public
ChargingBmsMachineReq
handle
(
Channel
channel
,
ChargingBmsMachineReq
chargingBmsMachineReq
)
{
ChargingBmsMachineReqData
data
=
chargingBmsMachineReq
.
getData
();
if
(
Objects
.
isNull
(
data
))
{
log
.
info
(
"充电过程BMS需求与充电机输出为空"
);
return
null
;
}
log
.
info
(
"充电过程BMS需求与充电机输出:{}"
,
data
);
return
null
;
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/ChargingBmsRspHandler.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
handler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpHandler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ChargingBmsReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ChargingBmsReq
;
import
io.netty.channel.Channel
;
import
java.util.Objects
;
/**
* @Author: chenx
* @Description: 充电过程BMS信息rsp handler
* @Date: 2023/11/10 18:26
* @Version: 1.0
*/
public
class
ChargingBmsRspHandler
implements
TcpHandler
<
ChargingBmsReq
,
ChargingBmsReq
>
{
@Override
public
ChargingBmsReq
handle
(
Channel
channel
,
ChargingBmsReq
chargingBmsReq
)
{
ChargingBmsReqData
data
=
chargingBmsReq
.
getData
();
if
(
Objects
.
isNull
(
data
))
{
log
.
info
(
"充电过程BMS信息为空"
);
return
null
;
}
log
.
info
(
"充电过程BMS信息:{}"
,
data
);
return
null
;
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/MachineParamConfigRspHandler.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
handler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpHandler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.MachineParamConfigReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.MachineParamConfigReq
;
import
io.netty.channel.Channel
;
import
java.util.Objects
;
/**
* @Author: chenx
* @Description: 参数配置 rsp handler
* @Date: 2023/11/10 18:25
* @Version: 1.0
*/
public
class
MachineParamConfigRspHandler
implements
TcpHandler
<
MachineParamConfigReq
,
MachineParamConfigReq
>
{
@Override
public
MachineParamConfigReq
handle
(
Channel
channel
,
MachineParamConfigReq
machineParamConfigReq
)
{
MachineParamConfigReqData
data
=
machineParamConfigReq
.
getData
();
if
(
Objects
.
isNull
(
data
))
{
log
.
info
(
"参数配置消息为空"
);
return
null
;
}
log
.
info
(
"参数配置消息:{}"
,
data
);
return
null
;
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/protocol/ChargingBmsMachineReq.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
protocol
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpMapper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpReq
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ChargingBmsMachineReqData
;
/**
* @Author: chenx
* @Description: 充电过程BMS需求与充电机输出 req
* @Date: 2023/11/10 18:23
* @Version: 1.0
*/
public
class
ChargingBmsMachineReq
extends
TcpReq
<
ChargingBmsMachineReqData
>
{
public
ChargingBmsMachineReq
()
{
super
(
TcpMapper
.
CMD_RSP_CHARGING_BMS_MACHINE
.
getType
());
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/protocol/ChargingBmsReq.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
protocol
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpMapper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpReq
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ChargingBmsReqData
;
/**
* @Author: chenx
* @Description: 充电过程BMS信息 req
* @Date: 2023/11/10 18:24
* @Version: 1.0
*/
public
class
ChargingBmsReq
extends
TcpReq
<
ChargingBmsReqData
>
{
public
ChargingBmsReq
()
{
super
(
TcpMapper
.
CMD_RSP_CHARGING_BMS
.
getType
());
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/protocol/MachineParamConfigReq.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
protocol
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpMapper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpReq
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.MachineParamConfigReqData
;
/**
* @Author: chenx
* @Description:
* @Date: 2023/11/10 18:23
* @Version: 1.0
*/
public
class
MachineParamConfigReq
extends
TcpReq
<
MachineParamConfigReqData
>
{
public
MachineParamConfigReq
()
{
super
(
TcpMapper
.
CMD_RSP_MACHINE_PARAM_CONFIG
.
getType
());
}
}
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/ChargingBmsMachineTest.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
gbt
.
ocpp16
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.ClientMain
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.Ocpp16Helper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.client.TcpClient
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ChargingBmsMachineReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ChargingBmsMachineReq
;
/**
* 充电过程BMS需求与充电机输出-上报测试类
* @author chenxi
* @date 2023年11月10日 18:42:00
**/
public
class
ChargingBmsMachineTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Ocpp16Helper
.
scan
();
String
host
=
"localhost"
;
int
port
=
8888
;
TcpClient
client
=
ClientMain
.
getInstance
(
host
,
port
);
Thread
.
sleep
(
3000
);
ChargingBmsMachineReq
req
=
new
ChargingBmsMachineReq
();
ChargingBmsMachineReqData
data
=
new
ChargingBmsMachineReqData
();
data
.
setTransactionSerialNumber
(
Ocpp16Helper
.
strToBcd
(
"3201020000000011151116155535026"
,
data
.
getTransactionSerialNumber
()));
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
"32010200000001"
,
data
.
getPileId
()));
data
.
setGunNumber
((
byte
)
1
);
byte
[]
bmsRequiredVoltage
=
new
byte
[]{(
byte
)
0x00
,
0x00
};
data
.
setBmsRequiredVoltage
(
bmsRequiredVoltage
);
data
.
setBmsRequiredCurrent
(
bmsRequiredVoltage
);
data
.
setBmsChargingMode
((
byte
)
0
);
data
.
setBmsChargingMeasuredVoltage
(
bmsRequiredVoltage
);
data
.
setBmsChargingMeasuredCurrent
(
bmsRequiredVoltage
);
data
.
setBmsHighestVoltageAndNumber
(
bmsRequiredVoltage
);
data
.
setBmsChargingSoc
((
byte
)
0
);
data
.
setBmsLeftChargingTime
(
bmsRequiredVoltage
);
req
.
setData
(
data
);
client
.
sendSync
(
req
);
}
}
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/ChargingBmsTest.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
gbt
.
ocpp16
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.ClientMain
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.Ocpp16Helper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.client.TcpClient
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ChargingBmsReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ChargingBmsReq
;
/**
* 充电过程BMS信息上报测试类
* @author chenxi
* @date 2023年11月10日 18:43:39
**/
public
class
ChargingBmsTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Ocpp16Helper
.
scan
();
String
host
=
"localhost"
;
int
port
=
8888
;
TcpClient
client
=
ClientMain
.
getInstance
(
host
,
port
);
Thread
.
sleep
(
3000
);
ChargingBmsReq
req
=
new
ChargingBmsReq
();
ChargingBmsReqData
data
=
new
ChargingBmsReqData
();
data
.
setTransactionSerialNumber
(
Ocpp16Helper
.
strToBcd
(
"3201020000000011151116155535026"
,
data
.
getTransactionSerialNumber
()));
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
"32010200000001"
,
data
.
getPileId
()));
data
.
setGunNumber
((
byte
)
1
);
data
.
setBmsHighestVoltageNumber
((
byte
)
0
);
data
.
setBmsBatteryTemperature
((
byte
)
0
);
data
.
setHighestBatteryTemperatureNumber
((
byte
)
0
);
data
.
setLowestTemperatureNumber
((
byte
)
0
);
data
.
setLowestBatteryTemperatureNumber
((
byte
)
0
);
byte
[]
bmsBatteryVoltageStatus
=
new
byte
[]{(
byte
)
0x00
,
0x00
};
data
.
setBmsBatteryVoltageStatus
(
bmsBatteryVoltageStatus
);
data
.
setBmsBatteryChargingStatus
(
bmsBatteryVoltageStatus
);
data
.
setBmsBatteryOverCurrent
(
bmsBatteryVoltageStatus
);
data
.
setBmsBatteryTemperatureStatus
(
bmsBatteryVoltageStatus
);
data
.
setBmsBatteryInsulationState
(
bmsBatteryVoltageStatus
);
data
.
setChargingProhibition
(
bmsBatteryVoltageStatus
);
data
.
setReserved
(
bmsBatteryVoltageStatus
);
req
.
setData
(
data
);
client
.
sendSync
(
req
);
}
}
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/MachineParamConfigTest.java
0 → 100644
View file @
a5c48b6
package
cn
.
com
.
glsx
.
charging
.
gbt
.
ocpp16
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.ClientMain
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.Ocpp16Helper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.client.TcpClient
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.MachineParamConfigReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.MachineParamConfigReq
;
/**
* @Author: chenx
* @Description: 参数配置上报
* @Date: 2023/11/10 18:45
* @Version: 1.0
*/
public
class
MachineParamConfigTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Ocpp16Helper
.
scan
();
String
host
=
"localhost"
;
int
port
=
8888
;
TcpClient
client
=
ClientMain
.
getInstance
(
host
,
port
);
Thread
.
sleep
(
3000
);
MachineParamConfigReq
req
=
new
MachineParamConfigReq
();
MachineParamConfigReqData
data
=
new
MachineParamConfigReqData
();
data
.
setTransactionSerialNumber
(
Ocpp16Helper
.
strToBcd
(
"3201020000000011151116155535026"
,
data
.
getTransactionSerialNumber
()));
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
"32010200000001"
,
data
.
getPileId
()));
data
.
setGunNumber
((
byte
)
1
);
byte
[]
bmsBatteryLowestVoltage
=
new
byte
[]{(
byte
)
0x00
,
0x00
};
data
.
setBmsBatteryHighestVoltage
(
bmsBatteryLowestVoltage
);
data
.
setBmsBatteryHighestCurrent
(
bmsBatteryLowestVoltage
);
data
.
setBmsBatteryHighestTotalVoltage
(
bmsBatteryLowestVoltage
);
data
.
setBmsBatteryHighestTemperature
((
byte
)
0
);
data
.
setBmsBatteryStatus
(
bmsBatteryLowestVoltage
);
data
.
setBmsBatteryCurrentVoltage
(
bmsBatteryLowestVoltage
);
data
.
setPileHighestOutputVoltage
(
bmsBatteryLowestVoltage
);
data
.
setPileLowestOutputVoltage
(
bmsBatteryLowestVoltage
);
data
.
setPileHighestCurrent
(
bmsBatteryLowestVoltage
);
data
.
setPileLowestCurrent
(
bmsBatteryLowestVoltage
);
req
.
setData
(
data
);
client
.
sendSync
(
req
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment