加速计

This commit is contained in:
tiger_zhou 2024-01-26 17:57:35 +08:00
parent 97cf2bee11
commit 30ec740426
18 changed files with 1072 additions and 708 deletions

@ -1 +1 @@
Subproject commit 1a75420f049a7b5838d9024a3abb1b9c2e7b7074
Subproject commit 099d39589833465c09f01d83cd31d3f063b43089

View File

@ -70,6 +70,7 @@ type ThridPartyConfig struct {
BtmCanet BtmCanetConfig `json:"btmCanet" description:"BTM关联的网关设备CANET配置"`
CidcModbus []CidcModbusConfig `json:"cidcModbus" description:"联锁驱采Modbus接口配置"`
Radar RadarConfig `json:"radar" description:"车载雷达相关配置"`
Acc AccConfig `json:"acc" description:"车载加速计"`
}
type RadarConfig struct {
Open bool `json:"open" description:"是否开启"`
@ -77,6 +78,12 @@ type RadarConfig struct {
RemotePort uint32 `json:"remotePort" description:"远端接收列车信息端口"`
//LocalPort uint32 `json:"localPort" description:"本地端口"`
}
type AccConfig struct {
Open bool `json:"open" description:"是否开启"`
RemoteIp string `json:"remoteIp" description:"远端接收列车信息ip"`
RemotePort uint32 `json:"remotePort" description:"远端接收列车信息端口"`
}
type CidcModbusConfig struct {
Open bool `json:"open" description:"是否开启"`
Url string `json:"url" description:"接口URL【格式tcp://{ip}:{port}】" default:"tcp://127.0.0.1:502"` // 连接地址

View File

@ -2649,26 +2649,15 @@ const docTemplate = `{
"required": true
},
{
"type": "integer",
"description": "草稿数据的id",
"name": "draftId",
"in": "query"
},
{
"type": "boolean",
"description": "强制覆盖",
"name": "force",
"type": "string",
"description": "厂商",
"name": "category",
"in": "query"
},
{
"type": "string",
"description": "发布后的名称",
"name": "name",
"in": "query"
},
{
"type": "string",
"name": "note",
"description": "草稿名称",
"name": "draftName",
"in": "query"
}
],
@ -5106,6 +5095,14 @@ const docTemplate = `{
"description": "应答器ID",
"type": "integer"
},
"fixedTelegram": {
"description": "固定报文16进制字符串",
"type": "string"
},
"fixedUserTelegram": {
"description": "固定用户报文16进制字符串",
"type": "string"
},
"mapId": {
"description": "地图ID",
"type": "integer"
@ -5114,8 +5111,12 @@ const docTemplate = `{
"description": "仿真ID",
"type": "string"
},
"telegram": {
"description": "报文16进制字符串",
"variableTelegram": {
"description": "可变报文",
"type": "string"
},
"variableUserTelegram": {
"description": "可变用户报文",
"type": "string"
}
}
@ -5250,6 +5251,18 @@ const docTemplate = `{
"dto.ConfigTrainEnds": {
"type": "object",
"properties": {
"accCheckSpeedDiff": {
"description": "加速计速度差",
"type": "number"
},
"accCheckTime": {
"description": "加速计储蓄时间",
"type": "integer"
},
"accEnable": {
"description": "加速计是否有效",
"type": "boolean"
},
"radarCheckSpeedDiff": {
"description": "雷达测速数值",
"type": "number"
@ -6067,21 +6080,10 @@ const docTemplate = `{
"request_proto.PsdOperationReq": {
"type": "object",
"properties": {
"asdCodes": {
"description": "无法关闭/无法开启故障涉及的滑动门的编号",
"type": "array",
"items": {
"type": "integer"
}
},
"deviceId": {
"description": "设备id",
"type": "integer"
},
"group": {
"description": "开门操作的编组",
"type": "integer"
},
"mapId": {
"description": "图id",
"type": "integer"
@ -6094,66 +6096,93 @@ const docTemplate = `{
}
]
},
"param": {
"description": "屏蔽门参数,当operation为SetParams时有效",
"allOf": [
{
"$ref": "#/definitions/request_proto.PsdParam"
}
]
},
"simulationId": {
"description": "仿真id",
"type": "string"
}
}
},
"request_proto.Psd_Operation": {
"request_proto.PsdParam": {
"type": "object",
"properties": {
"asdCodes": {
"description": "涉及的滑动门的编号",
"type": "array",
"items": {
"type": "integer"
}
},
"fault": {
"description": "屏蔽门故障设置",
"allOf": [
{
"$ref": "#/definitions/request_proto.Psd_Fault"
}
]
},
"force": {
"description": "屏蔽门强制设置",
"allOf": [
{
"$ref": "#/definitions/request_proto.Psd_Force"
}
]
}
}
},
"request_proto.Psd_Fault": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-comments": {
"Psd_FA_NONE": "无故障",
"Psd_FA_Obstacle": "设置故障物"
},
"x-enum-varnames": [
"Psd_FA_NONE",
"Psd_FA_Obstacle"
]
},
"request_proto.Psd_Force": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6,
10,
11,
12,
13,
14,
15,
16,
17,
18
2
],
"x-enum-comments": {
"Psd_AsdCannotClose": "滑动门无法关闭",
"Psd_AsdCannotOpen": "滑动门无法开门",
"Psd_CancelAsdCannotClose": "取消滑动门无法关闭",
"Psd_CancelAsdCannotOpen": "取消滑动门无法开门",
"Psd_CancelForce": "取消强制",
"Psd_CancelGm": "取消关门",
"Psd_CancelKm": "取消开门",
"Psd_CancelQDTC": "取消启动探测",
"Psd_CancelTZTC": "取消停止探测",
"Psd_ForceGm": "强制关门",
"Psd_ForceKm": "强制开门",
"Psd_Gm": "关门",
"Psd_Km": "开门",
"Psd_QDTC": "启动探测",
"Psd_TZTC": "停止探测"
"Psd_F_ASD_GM": "滑动门强制关门",
"Psd_F_ASD_KM": "滑动门强制开门",
"Psd_F_NONE": "无强制"
},
"x-enum-varnames": [
"Psd_F_NONE",
"Psd_F_ASD_KM",
"Psd_F_ASD_GM"
]
},
"request_proto.Psd_Operation": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-comments": {
"Psd_SetParams": "设置参数"
},
"x-enum-varnames": [
"Psd_Undefined",
"Psd_Km",
"Psd_CancelKm",
"Psd_Gm",
"Psd_CancelGm",
"Psd_ForceKm",
"Psd_ForceGm",
"Psd_CancelForce",
"Psd_AsdCannotOpen",
"Psd_CancelAsdCannotOpen",
"Psd_AsdCannotClose",
"Psd_CancelAsdCannotClose",
"Psd_QDTC",
"Psd_CancelQDTC",
"Psd_TZTC",
"Psd_CancelTZTC"
"Psd_SetParams"
]
},
"request_proto.Section_Operation": {
@ -6161,26 +6190,17 @@ const docTemplate = `{
"enum": [
0,
1,
2,
3,
4,
5
4
],
"x-enum-comments": {
"Section_CancelDrst": "取消计轴直接复位",
"Section_CancelFaultOcc": "取消故障占用",
"Section_CancelPdrst": "取消计轴预复位",
"Section_SetDrst": "设置计轴直接复位",
"Section_SetFaultOcc": "设置故障占用",
"Section_SetPdrst": "设置计轴预复位"
"Section_SetParams": "设置参数",
"Section_Undefined": "未定义"
},
"x-enum-varnames": [
"Section_SetDrst",
"Section_CancelDrst",
"Section_SetPdrst",
"Section_CancelPdrst",
"Section_SetFaultOcc",
"Section_CancelFaultOcc"
"Section_Undefined",
"Section_SetParams",
"Section_SetFaultOcc"
]
},
"request_proto.SignalOperationReq": {

View File

@ -2643,26 +2643,15 @@
"required": true
},
{
"type": "integer",
"description": "草稿数据的id",
"name": "draftId",
"in": "query"
},
{
"type": "boolean",
"description": "强制覆盖",
"name": "force",
"type": "string",
"description": "厂商",
"name": "category",
"in": "query"
},
{
"type": "string",
"description": "发布后的名称",
"name": "name",
"in": "query"
},
{
"type": "string",
"name": "note",
"description": "草稿名称",
"name": "draftName",
"in": "query"
}
],
@ -5100,6 +5089,14 @@
"description": "应答器ID",
"type": "integer"
},
"fixedTelegram": {
"description": "固定报文16进制字符串",
"type": "string"
},
"fixedUserTelegram": {
"description": "固定用户报文16进制字符串",
"type": "string"
},
"mapId": {
"description": "地图ID",
"type": "integer"
@ -5108,8 +5105,12 @@
"description": "仿真ID",
"type": "string"
},
"telegram": {
"description": "报文16进制字符串",
"variableTelegram": {
"description": "可变报文",
"type": "string"
},
"variableUserTelegram": {
"description": "可变用户报文",
"type": "string"
}
}
@ -5244,6 +5245,18 @@
"dto.ConfigTrainEnds": {
"type": "object",
"properties": {
"accCheckSpeedDiff": {
"description": "加速计速度差",
"type": "number"
},
"accCheckTime": {
"description": "加速计储蓄时间",
"type": "integer"
},
"accEnable": {
"description": "加速计是否有效",
"type": "boolean"
},
"radarCheckSpeedDiff": {
"description": "雷达测速数值",
"type": "number"
@ -6061,21 +6074,10 @@
"request_proto.PsdOperationReq": {
"type": "object",
"properties": {
"asdCodes": {
"description": "无法关闭/无法开启故障涉及的滑动门的编号",
"type": "array",
"items": {
"type": "integer"
}
},
"deviceId": {
"description": "设备id",
"type": "integer"
},
"group": {
"description": "开门操作的编组",
"type": "integer"
},
"mapId": {
"description": "图id",
"type": "integer"
@ -6088,66 +6090,93 @@
}
]
},
"param": {
"description": "屏蔽门参数,当operation为SetParams时有效",
"allOf": [
{
"$ref": "#/definitions/request_proto.PsdParam"
}
]
},
"simulationId": {
"description": "仿真id",
"type": "string"
}
}
},
"request_proto.Psd_Operation": {
"request_proto.PsdParam": {
"type": "object",
"properties": {
"asdCodes": {
"description": "涉及的滑动门的编号",
"type": "array",
"items": {
"type": "integer"
}
},
"fault": {
"description": "屏蔽门故障设置",
"allOf": [
{
"$ref": "#/definitions/request_proto.Psd_Fault"
}
]
},
"force": {
"description": "屏蔽门强制设置",
"allOf": [
{
"$ref": "#/definitions/request_proto.Psd_Force"
}
]
}
}
},
"request_proto.Psd_Fault": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-comments": {
"Psd_FA_NONE": "无故障",
"Psd_FA_Obstacle": "设置故障物"
},
"x-enum-varnames": [
"Psd_FA_NONE",
"Psd_FA_Obstacle"
]
},
"request_proto.Psd_Force": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6,
10,
11,
12,
13,
14,
15,
16,
17,
18
2
],
"x-enum-comments": {
"Psd_AsdCannotClose": "滑动门无法关闭",
"Psd_AsdCannotOpen": "滑动门无法开门",
"Psd_CancelAsdCannotClose": "取消滑动门无法关闭",
"Psd_CancelAsdCannotOpen": "取消滑动门无法开门",
"Psd_CancelForce": "取消强制",
"Psd_CancelGm": "取消关门",
"Psd_CancelKm": "取消开门",
"Psd_CancelQDTC": "取消启动探测",
"Psd_CancelTZTC": "取消停止探测",
"Psd_ForceGm": "强制关门",
"Psd_ForceKm": "强制开门",
"Psd_Gm": "关门",
"Psd_Km": "开门",
"Psd_QDTC": "启动探测",
"Psd_TZTC": "停止探测"
"Psd_F_ASD_GM": "滑动门强制关门",
"Psd_F_ASD_KM": "滑动门强制开门",
"Psd_F_NONE": "无强制"
},
"x-enum-varnames": [
"Psd_F_NONE",
"Psd_F_ASD_KM",
"Psd_F_ASD_GM"
]
},
"request_proto.Psd_Operation": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-comments": {
"Psd_SetParams": "设置参数"
},
"x-enum-varnames": [
"Psd_Undefined",
"Psd_Km",
"Psd_CancelKm",
"Psd_Gm",
"Psd_CancelGm",
"Psd_ForceKm",
"Psd_ForceGm",
"Psd_CancelForce",
"Psd_AsdCannotOpen",
"Psd_CancelAsdCannotOpen",
"Psd_AsdCannotClose",
"Psd_CancelAsdCannotClose",
"Psd_QDTC",
"Psd_CancelQDTC",
"Psd_TZTC",
"Psd_CancelTZTC"
"Psd_SetParams"
]
},
"request_proto.Section_Operation": {
@ -6155,26 +6184,17 @@
"enum": [
0,
1,
2,
3,
4,
5
4
],
"x-enum-comments": {
"Section_CancelDrst": "取消计轴直接复位",
"Section_CancelFaultOcc": "取消故障占用",
"Section_CancelPdrst": "取消计轴预复位",
"Section_SetDrst": "设置计轴直接复位",
"Section_SetFaultOcc": "设置故障占用",
"Section_SetPdrst": "设置计轴预复位"
"Section_SetParams": "设置参数",
"Section_Undefined": "未定义"
},
"x-enum-varnames": [
"Section_SetDrst",
"Section_CancelDrst",
"Section_SetPdrst",
"Section_CancelPdrst",
"Section_SetFaultOcc",
"Section_CancelFaultOcc"
"Section_Undefined",
"Section_SetParams",
"Section_SetFaultOcc"
]
},
"request_proto.SignalOperationReq": {

View File

@ -133,14 +133,23 @@ definitions:
baliseId:
description: 应答器ID
type: integer
fixedTelegram:
description: 固定报文16进制字符串
type: string
fixedUserTelegram:
description: 固定用户报文16进制字符串
type: string
mapId:
description: 地图ID
type: integer
simulationId:
description: 仿真ID
type: string
telegram:
description: 报文16进制字符串
variableTelegram:
description: 可变报文
type: string
variableUserTelegram:
description: 可变用户报文
type: string
type: object
dto.BaliseMoveReqDto:
@ -234,6 +243,15 @@ definitions:
type: object
dto.ConfigTrainEnds:
properties:
accCheckSpeedDiff:
description: 加速计速度差
type: number
accCheckTime:
description: 加速计储蓄时间
type: integer
accEnable:
description: 加速计是否有效
type: boolean
radarCheckSpeedDiff:
description: 雷达测速数值
type: number
@ -795,71 +813,46 @@ definitions:
- $ref: '#/definitions/request_proto.Points_Force'
description: 道岔强制
type: object
request_proto.Psd_Operation:
request_proto.Psd_Fault:
enum:
- 0
- 1
type: integer
x-enum-comments:
Psd_FA_NONE: 无故障
Psd_FA_Obstacle: 设置故障物
x-enum-varnames:
- Psd_FA_NONE
- Psd_FA_Obstacle
request_proto.Psd_Force:
enum:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
type: integer
x-enum-comments:
Psd_AsdCannotClose: 滑动门无法关闭
Psd_AsdCannotOpen: 滑动门无法开门
Psd_CancelAsdCannotClose: 取消滑动门无法关闭
Psd_CancelAsdCannotOpen: 取消滑动门无法开门
Psd_CancelForce: 取消强制
Psd_CancelGm: 取消关门
Psd_CancelKm: 取消开门
Psd_CancelQDTC: 取消启动探测
Psd_CancelTZTC: 取消停止探测
Psd_ForceGm: 强制关门
Psd_ForceKm: 强制开门
Psd_Gm: 关门
Psd_Km: 开门
Psd_QDTC: 启动探测
Psd_TZTC: 停止探测
Psd_F_ASD_GM: 滑动门强制关门
Psd_F_ASD_KM: 滑动门强制开门
Psd_F_NONE: 无强制
x-enum-varnames:
- Psd_F_NONE
- Psd_F_ASD_KM
- Psd_F_ASD_GM
request_proto.Psd_Operation:
enum:
- 0
- 1
type: integer
x-enum-comments:
Psd_SetParams: 设置参数
x-enum-varnames:
- Psd_Undefined
- Psd_Km
- Psd_CancelKm
- Psd_Gm
- Psd_CancelGm
- Psd_ForceKm
- Psd_ForceGm
- Psd_CancelForce
- Psd_AsdCannotOpen
- Psd_CancelAsdCannotOpen
- Psd_AsdCannotClose
- Psd_CancelAsdCannotClose
- Psd_QDTC
- Psd_CancelQDTC
- Psd_TZTC
- Psd_CancelTZTC
- Psd_SetParams
request_proto.PsdOperationReq:
properties:
asdCodes:
description: 无法关闭/无法开启故障涉及的滑动门的编号
items:
type: integer
type: array
deviceId:
description: 设备id
type: integer
group:
description: 开门操作的编组
type: integer
mapId:
description: 图id
type: integer
@ -867,33 +860,44 @@ definitions:
allOf:
- $ref: '#/definitions/request_proto.Psd_Operation'
description: 操作
param:
allOf:
- $ref: '#/definitions/request_proto.PsdParam'
description: 屏蔽门参数,当operation为SetParams时有效
simulationId:
description: 仿真id
type: string
type: object
request_proto.PsdParam:
properties:
asdCodes:
description: 涉及的滑动门的编号
items:
type: integer
type: array
fault:
allOf:
- $ref: '#/definitions/request_proto.Psd_Fault'
description: 屏蔽门故障设置
force:
allOf:
- $ref: '#/definitions/request_proto.Psd_Force'
description: 屏蔽门强制设置
type: object
request_proto.Section_Operation:
enum:
- 0
- 1
- 2
- 3
- 4
- 5
type: integer
x-enum-comments:
Section_CancelDrst: 取消计轴直接复位
Section_CancelFaultOcc: 取消故障占用
Section_CancelPdrst: 取消计轴预复位
Section_SetDrst: 设置计轴直接复位
Section_SetFaultOcc: 设置故障占用
Section_SetPdrst: 设置计轴预复位
Section_SetParams: 设置参数
Section_Undefined: 未定义
x-enum-varnames:
- Section_SetDrst
- Section_CancelDrst
- Section_SetPdrst
- Section_CancelPdrst
- Section_Undefined
- Section_SetParams
- Section_SetFaultOcc
- Section_CancelFaultOcc
request_proto.Signal_DS:
enum:
- 0
@ -2722,20 +2726,13 @@ paths:
name: id
required: true
type: integer
- description: 草稿数据的id
- description: 厂商
in: query
name: draftId
type: integer
- description: 强制覆盖
in: query
name: force
type: boolean
- description: 发布后的名称
in: query
name: name
name: category
type: string
- in: query
name: note
- description: 草稿名称
in: query
name: draftName
type: string
produces:
- application/json

View File

@ -195,6 +195,12 @@ type TrainEndsState struct {
RadarCheckSpeedDiff float32 `protobuf:"fixed32,4,opt,name=radarCheckSpeedDiff,proto3" json:"radarCheckSpeedDiff,omitempty"`
// 雷达检测时间(秒)
RadarCheckTime int32 `protobuf:"varint,5,opt,name=radarCheckTime,proto3" json:"radarCheckTime,omitempty"`
// 加速度计是否有效
AccEnable bool `protobuf:"varint,6,opt,name=accEnable,proto3" json:"accEnable,omitempty"`
// 加速度测速差值(米/秒)
AccCheckSpeedDiff float32 `protobuf:"fixed32,7,opt,name=accCheckSpeedDiff,proto3" json:"accCheckSpeedDiff,omitempty"`
// 加速度持续时间
AccCheckTime int32 `protobuf:"varint,8,opt,name=accCheckTime,proto3" json:"accCheckTime,omitempty"`
}
func (x *TrainEndsState) Reset() {
@ -264,6 +270,27 @@ func (x *TrainEndsState) GetRadarCheckTime() int32 {
return 0
}
func (x *TrainEndsState) GetAccEnable() bool {
if x != nil {
return x.AccEnable
}
return false
}
func (x *TrainEndsState) GetAccCheckSpeedDiff() float32 {
if x != nil {
return x.AccCheckSpeedDiff
}
return 0
}
func (x *TrainEndsState) GetAccCheckTime() int32 {
if x != nil {
return x.AccCheckTime
}
return 0
}
var File_common_data_proto protoreflect.FileDescriptor
var file_common_data_proto_rawDesc = []byte{
@ -300,7 +327,7 @@ var file_common_data_proto_rawDesc = []byte{
0x05, 0x73, 0x6c, 0x69, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x70, 0x53, 0x69,
0x67, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x70, 0x53, 0x69,
0x67, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x18, 0x0d, 0x20, 0x01,
0x28, 0x02, 0x52, 0x06, 0x69, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x22, 0xec, 0x01, 0x0a, 0x0e, 0x54,
0x28, 0x02, 0x52, 0x06, 0x69, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x22, 0xdc, 0x02, 0x0a, 0x0e, 0x54,
0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a,
0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62,
0x6c, 0x65, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64,
@ -315,6 +342,13 @@ var file_common_data_proto_rawDesc = []byte{
0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66,
0x66, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54,
0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x63,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x63,
0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68,
0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x07, 0x20, 0x01,
0x28, 0x02, 0x52, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65,
0x64, 0x44, 0x69, 0x66, 0x66, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63,
0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x63, 0x63,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x6a, 0x6f, 0x79,
0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73,
0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x63, 0x6f,

View File

@ -97,6 +97,10 @@ type ConfigTrainEnds struct {
RadarEnable bool `json:"radarEnable"` // 雷达是否有效
RadarCheckSpeedDiff float32 `json:"radarCheckSpeedDiff"` // 雷达测速数值
RadarCheckTime int32 `json:"radarCheckTime"` // 雷达检测时间(秒)
AccEnable bool `json:"accEnable"` // 加速计是否有效
AccCheckSpeedDiff float32 `json:"accCheckSpeedDiff"` // 加速计速度差
AccCheckTime int32 `json:"accCheckTime"` // 加速计储蓄时间
}
type ConfigTrainData struct {
//Mass int32 `json:"mass" form:"mass"` // 列车的质量100=1ton

File diff suppressed because it is too large Load Diff

View File

@ -367,6 +367,7 @@ func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
TailRadarSpeed: v.DynamicState.TailRadarSpeed,
DynamicInterruption: v.DynamicState.UdpInterruption,
Acceleration: v.DynamicState.Acceleration,
Displacement: v.DynamicState.Displacement,
// 半实物
VobcLifeSignal: v.VobcState.LifeSignal,
Tc1Active: v.VobcState.Tc1Active,
@ -425,7 +426,12 @@ func convertEnds(ends *common_proto.TrainEndsState) *state_proto.TrainEndsStateM
SpeedSensorEnableB: ends.SpeedSensorEnableB,
RadarEnable: ends.RadarEnable,
RadarCheckSpeedDiff: floatToString(ends.RadarCheckSpeedDiff),
RadarCheckTime: ends.RadarCheckTime}
RadarCheckTime: ends.RadarCheckTime,
AccEnable: ends.AccEnable,
AccCheckSpeedDiff: floatToString(ends.AccCheckSpeedDiff),
AccCheckTime: ends.AccCheckTime,
}
}
func floatToString(f float32) string {
return fmt.Sprintf("%v", f)

29
third_party/acc/acc_server_test.go vendored Normal file
View File

@ -0,0 +1,29 @@
package acc
import (
"encoding/json"
"fmt"
"joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/bj-rtsts-server/third_party/udp"
"testing"
)
func TestAccUdp(t *testing.T) {
fmt.Println("准备启动服务...")
addr := fmt.Sprintf("%v:%v", "127.0.0.1", "8899")
server := udp.NewServer(addr, handle)
server.Listen()
for {
}
}
func handle(d []byte) {
ri := message.RadarInfo{}
err := ri.Decode(d)
if err == nil {
jsonD, _ := json.Marshal(ri)
fmt.Println(string(jsonD))
}
}

88
third_party/acc/acc_vobc.go vendored Normal file
View File

@ -0,0 +1,88 @@
package acc
import (
"context"
"fmt"
"joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/bj-rtsts-server/third_party/udp"
"math"
"sync"
"time"
)
type AccVobc interface {
Start(accManager AccVobcManager)
Stop()
}
type AccVobcManager interface {
GetRunAccConfig() config.AccConfig
FindAccTrain() *state_proto.TrainState
}
var (
initLock = &sync.Mutex{}
singleObj *accVobcService
)
const (
accInterval = 15
accSpeedUnit = 9.8
)
func Default() AccVobc {
defer initLock.Unlock()
if singleObj == nil {
initLock.Lock()
singleObj = &accVobcService{}
}
return singleObj
}
type accVobcService struct {
controlContext context.CancelFunc
vobcClient udp.UdpClient
radarVobcManager AccVobcManager
}
func (acc *accVobcService) Start(accManager AccVobcManager) {
config := accManager.GetRunAccConfig()
if config.RemoteIp == "" || config.RemotePort <= 0 || !config.Open {
}
acc.vobcClient = udp.NewClient(fmt.Sprintf("%v:%v", config.RemoteIp, config.RemotePort))
ctx, cancleFunc := context.WithCancel(context.Background())
acc.controlContext = cancleFunc
acc.radarVobcManager = accManager
go acc.sendTask(ctx)
}
func (acc *accVobcService) sendTask(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
default:
}
trainStatus := acc.radarVobcManager.FindAccTrain()
if trainStatus != nil {
speedAcc := trainStatus.DynamicState.Acceleration
t := speedAcc / accSpeedUnit
acc.vobcClient.SendMsg(&message.Accelerometer{Acc: math.Float32bits(t)})
}
time.Sleep(time.Millisecond * accInterval)
}
}
func (acc *accVobcService) Stop() {
if acc.controlContext != nil {
acc.controlContext()
acc.controlContext = nil
}
if acc.vobcClient != nil {
acc.vobcClient.Close()
acc.vobcClient = nil
}
}

48
third_party/message/accelerometer.go vendored Normal file
View File

@ -0,0 +1,48 @@
package message
import (
"bytes"
"encoding/binary"
"fmt"
)
const (
accHeader = 0xA6
uaidDefault = 0x1C
)
type Accelerometer struct {
Acc uint32
}
func (acc *Accelerometer) Encode() []byte {
data := make([]byte, 0)
data = append(data, accHeader)
data = append(data, uaidDefault)
data = binary.LittleEndian.AppendUint32(data, acc.Acc)
cs := checkSum(data)
data = append(data, ^cs+1)
return data
}
func checkSum(data []byte) byte {
var sum byte = 0
for _, d := range data {
sum += d
}
return sum
}
func (acc *Accelerometer) Decode(data []byte) error {
if len(data) < 7 {
return fmt.Errorf("")
}
buf := bytes.NewBuffer(data)
_, _ = buf.ReadByte()
_, _ = buf.ReadByte()
var dataInt uint32 = 0
binary.Read(buf, binary.LittleEndian, &dataInt)
//newData := math.Float32frombits(dataInt & 0xffffc000)
acc.Acc = dataInt & 0xffffc000
return nil
}

View File

@ -76,6 +76,9 @@ type DynamicsTrainInfo struct {
Acceleration float32
// 对应动力学生命周期值
VobcLifeSignal uint16
//列车位移 单位mm
Displacement uint16
}
// 解析动力学的列车信息
@ -102,5 +105,6 @@ func (t *DynamicsTrainInfo) Decode(buf []byte) error {
t.TailRadarSpeed = math.Float32frombits(binary.BigEndian.Uint32(buf[56:60]))
t.Acceleration = math.Float32frombits(binary.BigEndian.Uint32(buf[60:64]))
t.VobcLifeSignal = binary.BigEndian.Uint16(buf[64:66])
t.Displacement = binary.BigEndian.Uint16(buf[66:68])
return nil
}

View File

@ -5,10 +5,21 @@ import (
"fmt"
"joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/bj-rtsts-server/third_party/udp"
"math"
"testing"
)
func TestA1(t *testing.T) {
a := 112.12
b := 0.1
fmt.Println(math.Mod(a, b))
fmt.Println(a / 0.1)
fmt.Println(math.Mod(1121, 0.1))
fmt.Println(math.Round(math.Mod(1121, 0.1)))
}
func TestUdp(t *testing.T) {
fmt.Println("准备启动服务...")
addr := fmt.Sprintf("%v:%v", "127.0.0.1", "8899")
server := udp.NewServer(addr, handle)

View File

@ -29,6 +29,7 @@ var (
initLock = sync.Mutex{}
_radar *radarVobc
fixed_speed = 0.009155
driftDefaultVal = 0.1
)
func Default() RadarVobc {
@ -74,10 +75,15 @@ func (rv *radarVobc) sendRadarInfo(ctx context.Context) {
trainStatus := rv.radarVobcManager.FindRadarTrain()
if trainStatus != nil {
hourSpeed := float64(trainStatus.DynamicState.Speed / 100)
ri := message.RadarInfo{RealSpeed: uint16(math.Round(hourSpeed / fixed_speed)), DriftCounterS1: 0, DriftCounterS2: 0}
trainDift := trainStatus.DynamicState.Displacement
td := float64(trainDift / 1000)
s1 := uint16(math.Round(td / driftDefaultVal))
s2 := uint16(math.Round(td / 1000 / driftDefaultVal))
ri := message.RadarInfo{RealSpeed: uint16(math.Round(hourSpeed / fixed_speed)), DriftCounterS1: s1, DriftCounterS2: s2}
rv.vobcClient.SendMsg(ri)
time.Sleep(time.Millisecond * radar_interval)
}
time.Sleep(time.Millisecond * radar_interval)
}
}

View File

@ -199,6 +199,10 @@ func copyTrainEnds(trainState *state_proto.TrainState, fieldName string, configD
endsVal.RadarEnable = configData.RadarEnable
endsVal.RadarCheckSpeedDiff = configData.RadarCheckSpeedDiff
endsVal.RadarCheckTime = configData.RadarCheckTime
endsVal.AccEnable = configData.AccEnable
endsVal.AccCheckSpeedDiff = configData.AccCheckSpeedDiff
endsVal.AccCheckTime = configData.AccCheckTime
}
func UpdateConfigTrain(vs *VerifySimulation, ct *dto.ConfigTrainReqDto) {
allTrainMap := &vs.Memory.Status.TrainStateMap
@ -321,6 +325,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
sta.DynamicState.HeadRadarSpeed = speedParse(info.HeadRadarSpeed)
sta.DynamicState.TailRadarSpeed = speedParse(info.TailRadarSpeed)
sta.DynamicState.Acceleration = info.Acceleration
sta.DynamicState.Displacement = int32(info.Displacement)
return sta
}

View File

@ -540,6 +540,11 @@ func (s *VerifySimulation) GetRunRadarConfig() config.RadarConfig {
return s.runConfig.Radar
}
// GetRunAccConfig 获取加速计配置信息
func (s *VerifySimulation) GetRunAccConfig() config.AccConfig {
return s.runConfig.Acc
}
// FindRadarTrain 查找一个列车 只有1端雷达开启啊
func (s *VerifySimulation) FindRadarTrain() *state_proto.TrainState {
var trainStatus *state_proto.TrainState
@ -560,6 +565,25 @@ func (s *VerifySimulation) FindRadarTrain() *state_proto.TrainState {
return trainStatus
}
// FindRadarTrain 查找一个列车 只有1端雷达开启啊
func (s *VerifySimulation) FindAccTrain() *state_proto.TrainState {
var trainStatus *state_proto.TrainState
s.Memory.Status.TrainStateMap.Range(func(k any, v any) bool {
val, ok := v.(*state_proto.TrainState)
if ok {
if val.TrainEndsA.AccEnable && val.TrainEndsB.AccEnable {
//trainStatus = val
//return false
return true
} else if val.TrainEndsA.AccEnable || val.TrainEndsB.AccEnable {
trainStatus = val
return false
}
}
return true
})
return trainStatus
}
func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
repo := &proto.Repository{}
var exceptStationGiMapIds []int32

View File

@ -2,6 +2,7 @@ package ts
import (
"fmt"
"joylink.club/bj-rtsts-server/third_party/acc"
"joylink.club/bj-rtsts-server/third_party/radar"
"log/slog"
"runtime"
@ -133,6 +134,8 @@ func runThirdParty(s *memory.VerifySimulation) error {
}
//列车雷达发送vobc
radar.Default().Start(s)
//列车加速计发送vobc
acc.Default().Start(s)
return nil
}
@ -156,6 +159,8 @@ func stopThirdParty(s *memory.VerifySimulation) {
cidcmodbus.Stop()
// 雷达服务停止
radar.Default().Stop()
// 加速计服务停止
acc.Default().Stop()
}
func createSimulationId(projectId int32) string {