Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtsts-server-go
This commit is contained in:
commit
65e903e16e
@ -36,7 +36,10 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
||||
authed.POST("/relay/operation", relayOperation)
|
||||
authed.POST("/signal/operation", signalOperation)
|
||||
authed.POST("/esbBtn/operation", esbBtnOperation)
|
||||
authed.POST("/ibp/operation", ibpBtnOperation)
|
||||
authed.POST("/ibp/btn/operation", ibpBtnOperation)
|
||||
authed.POST("/ibp/key/operation", ibpKeyOperation)
|
||||
authed.GET("/:id/getMapKilometerRange", getMapKilometerRange)
|
||||
authed.POST("/psl/operation", pslBtnOperation)
|
||||
|
||||
// 初始化地图信息
|
||||
initPublishMapInfo()
|
||||
@ -282,7 +285,7 @@ func signalOperation(c *gin.Context) {
|
||||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
memory.ChangeSignalState(simulation, req.MapId, req.DeviceId, req.Aspect)
|
||||
memory.ChangeSignalState(simulation, req)
|
||||
c.JSON(http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
@ -297,13 +300,13 @@ func signalOperation(c *gin.Context) {
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "JWT Token"
|
||||
// @Param ButtonOperationReqDto body dto.ButtonOperationReqDto true "ATS测试仿真-ESB按钮操作"
|
||||
// @Param EsbButtonOperationReqDto body dto.EsbButtonOperationReqDto true "ATS测试仿真-ESB按钮操作"
|
||||
//
|
||||
// @Success 200 {object} string
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/simulation/esbBtn/operation [post]
|
||||
func esbBtnOperation(c *gin.Context) {
|
||||
req := &dto.ButtonOperationReqDto{}
|
||||
req := &dto.EsbButtonOperationReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
}
|
||||
@ -324,19 +327,73 @@ func esbBtnOperation(c *gin.Context) {
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "JWT Token"
|
||||
// @Param ButtonOperationReqDto body dto.ButtonOperationReqDto true "ATS测试仿真-IBP按钮操作"
|
||||
// @Param IBPButtonOperationReqDto body dto.IBPButtonOperationReqDto true "ATS测试仿真-IBP按钮操作"
|
||||
//
|
||||
// @Success 200 {object} string
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/simulation/ibp/operation [post]
|
||||
// @Router /api/v1/simulation/ibp/btn/operation [post]
|
||||
func ibpBtnOperation(c *gin.Context) {
|
||||
req := &dto.ButtonOperationReqDto{}
|
||||
req := &dto.IBPButtonOperationReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
memory.ChangeIBPButtonState(simulation, req.MapId, req.Station, req.Id, req.Down)
|
||||
memory.ChangeIBPButtonState(simulation, req.MapId, req.StationId, req.ButtonCode, req.Down)
|
||||
c.JSON(http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
// ATS测试-IBP钥匙操作
|
||||
//
|
||||
// @Summary ATS测试-IBP钥匙操作
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description ATS测试-IBP钥匙操作
|
||||
// @Tags ATS测试仿真Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "JWT Token"
|
||||
// @Param KeyOperationReqDto body dto.KeyOperationReqDto true "ATS测试仿真-IBP钥匙操作"
|
||||
//
|
||||
// @Success 200 {object} string
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/simulation/ibp/key/operation [post]
|
||||
func ibpKeyOperation(c *gin.Context) {
|
||||
req := &dto.KeyOperationReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
memory.ChangeIBPKeyState(simulation, req.MapId, req.StationId, req.KeyCode, req.Gear)
|
||||
c.JSON(http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
// PSL操作
|
||||
//
|
||||
// @Summary PSL操作
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description PSL操作
|
||||
// @Tags ATS测试仿真Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "JWT Token"
|
||||
// @Param PslOperationReqDto body dto.PslOperationReqDto true "PSL操作"
|
||||
//
|
||||
// @Success 200 {object} string
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/simulation/ibp/operation [post]
|
||||
func pslBtnOperation(c *gin.Context) {
|
||||
req := &dto.PslOperationReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
memory.ChangePSLButtonState(simulation, req.MapId, req.GateBoxId, req.ButtonCode, req.Down)
|
||||
c.JSON(http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
@ -359,6 +416,30 @@ func getDataChannelName(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, config.SimulationId_prefix+apiproto.MemoryChangeServerSuffix)
|
||||
}
|
||||
|
||||
// 获取仿真地图的公里标范围
|
||||
//
|
||||
// @Summary 获取仿真地图的公里标范围
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 获取仿真地图的公里标范围
|
||||
// @Tags ATS测试仿真Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "JWT Token"
|
||||
//
|
||||
// @Success 200 {object} string
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/simulation/:id/getMapKilometerRange [get]
|
||||
func getMapKilometerRange(c *gin.Context) {
|
||||
id, exist := c.Params.Get("id")
|
||||
if !exist {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: "必要参数id不存在"})
|
||||
}
|
||||
simulation := checkDeviceDataAndReturn(id)
|
||||
c.JSON(http.StatusOK, simulation.Repo.GetCoordinateInfo())
|
||||
}
|
||||
|
||||
// 获取ATS测试-操作继电器
|
||||
//
|
||||
// @Summary 获取ATS测试-操作继电器
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1309,7 +1309,7 @@ type ButtonState struct {
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Down bool `protobuf:"varint,2,opt,name=down,proto3" json:"down,omitempty"`
|
||||
Aspect Signal_Aspect `protobuf:"varint,3,opt,name=aspect,proto3,enum=state.Signal_Aspect" json:"aspect,omitempty"` // 带灯的按钮
|
||||
Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` // 带灯的按钮
|
||||
}
|
||||
|
||||
func (x *ButtonState) Reset() {
|
||||
@ -1358,11 +1358,11 @@ func (x *ButtonState) GetDown() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *ButtonState) GetAspect() Signal_Aspect {
|
||||
func (x *ButtonState) GetActive() bool {
|
||||
if x != nil {
|
||||
return x.Aspect
|
||||
return x.Active
|
||||
}
|
||||
return Signal_Non
|
||||
return false
|
||||
}
|
||||
|
||||
// 警铃状态
|
||||
@ -1428,7 +1428,7 @@ type LightState struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Aspect Signal_Aspect `protobuf:"varint,2,opt,name=aspect,proto3,enum=state.Signal_Aspect" json:"aspect,omitempty"`
|
||||
Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
|
||||
}
|
||||
|
||||
func (x *LightState) Reset() {
|
||||
@ -1470,11 +1470,123 @@ func (x *LightState) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *LightState) GetAspect() Signal_Aspect {
|
||||
func (x *LightState) GetActive() bool {
|
||||
if x != nil {
|
||||
return x.Aspect
|
||||
return x.Active
|
||||
}
|
||||
return Signal_Non
|
||||
return false
|
||||
}
|
||||
|
||||
// 屏蔽门状态
|
||||
type PsdState struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
|
||||
OpenDoorCodes []int32 `protobuf:"varint,2,rep,packed,name=openDoorCodes,proto3" json:"openDoorCodes,omitempty"` //开启的小门的编号
|
||||
}
|
||||
|
||||
func (x *PsdState) Reset() {
|
||||
*x = PsdState{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PsdState) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PsdState) ProtoMessage() {}
|
||||
|
||||
func (x *PsdState) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[14]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PsdState.ProtoReflect.Descriptor instead.
|
||||
func (*PsdState) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *PsdState) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PsdState) GetOpenDoorCodes() []int32 {
|
||||
if x != nil {
|
||||
return x.OpenDoorCodes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 钥匙状态
|
||||
type KeyState struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Gear int32 `protobuf:"varint,2,opt,name=gear,proto3" json:"gear,omitempty"`
|
||||
}
|
||||
|
||||
func (x *KeyState) Reset() {
|
||||
*x = KeyState{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[15]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *KeyState) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*KeyState) ProtoMessage() {}
|
||||
|
||||
func (x *KeyState) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[15]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use KeyState.ProtoReflect.Descriptor instead.
|
||||
func (*KeyState) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
func (x *KeyState) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *KeyState) GetGear() int32 {
|
||||
if x != nil {
|
||||
return x.Gear
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 仿真运行时状态变化量,当前时刻与上一时刻比较得到
|
||||
@ -1498,7 +1610,7 @@ type VariationStatus struct {
|
||||
func (x *VariationStatus) Reset() {
|
||||
*x = VariationStatus{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[14]
|
||||
mi := &file_device_state_proto_msgTypes[16]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -1511,7 +1623,7 @@ func (x *VariationStatus) String() string {
|
||||
func (*VariationStatus) ProtoMessage() {}
|
||||
|
||||
func (x *VariationStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[14]
|
||||
mi := &file_device_state_proto_msgTypes[16]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -1524,7 +1636,7 @@ func (x *VariationStatus) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use VariationStatus.ProtoReflect.Descriptor instead.
|
||||
func (*VariationStatus) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{14}
|
||||
return file_device_state_proto_rawDescGZIP(), []int{16}
|
||||
}
|
||||
|
||||
func (x *VariationStatus) GetUpdatedTrain() []*TrainState {
|
||||
@ -1584,12 +1696,16 @@ type AllDevicesStatus struct {
|
||||
AlarmState []*AlarmState `protobuf:"bytes,7,rep,name=AlarmState,proto3" json:"AlarmState,omitempty"`
|
||||
// 灯状态
|
||||
LightState []*LightState `protobuf:"bytes,8,rep,name=LightState,proto3" json:"LightState,omitempty"`
|
||||
// 屏蔽门状态
|
||||
PsdState []*PsdState `protobuf:"bytes,9,rep,name=psdState,proto3" json:"psdState,omitempty"`
|
||||
// 钥匙状态
|
||||
KeyState []*KeyState `protobuf:"bytes,10,rep,name=KeyState,proto3" json:"KeyState,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AllDevicesStatus) Reset() {
|
||||
*x = AllDevicesStatus{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[15]
|
||||
mi := &file_device_state_proto_msgTypes[17]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -1602,7 +1718,7 @@ func (x *AllDevicesStatus) String() string {
|
||||
func (*AllDevicesStatus) ProtoMessage() {}
|
||||
|
||||
func (x *AllDevicesStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[15]
|
||||
mi := &file_device_state_proto_msgTypes[17]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -1615,7 +1731,7 @@ func (x *AllDevicesStatus) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use AllDevicesStatus.ProtoReflect.Descriptor instead.
|
||||
func (*AllDevicesStatus) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{15}
|
||||
return file_device_state_proto_rawDescGZIP(), []int{17}
|
||||
}
|
||||
|
||||
func (x *AllDevicesStatus) GetTrainState() []*TrainState {
|
||||
@ -1674,6 +1790,20 @@ func (x *AllDevicesStatus) GetLightState() []*LightState {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *AllDevicesStatus) GetPsdState() []*PsdState {
|
||||
if x != nil {
|
||||
return x.PsdState
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *AllDevicesStatus) GetKeyState() []*KeyState {
|
||||
if x != nil {
|
||||
return x.KeyState
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 服务器端向前端推送的设备状态信息
|
||||
type PushedDevicesStatus struct {
|
||||
state protoimpl.MessageState
|
||||
@ -1692,7 +1822,7 @@ type PushedDevicesStatus struct {
|
||||
func (x *PushedDevicesStatus) Reset() {
|
||||
*x = PushedDevicesStatus{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[16]
|
||||
mi := &file_device_state_proto_msgTypes[18]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -1705,7 +1835,7 @@ func (x *PushedDevicesStatus) String() string {
|
||||
func (*PushedDevicesStatus) ProtoMessage() {}
|
||||
|
||||
func (x *PushedDevicesStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[16]
|
||||
mi := &file_device_state_proto_msgTypes[18]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -1718,7 +1848,7 @@ func (x *PushedDevicesStatus) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PushedDevicesStatus.ProtoReflect.Descriptor instead.
|
||||
func (*PushedDevicesStatus) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{16}
|
||||
return file_device_state_proto_rawDescGZIP(), []int{18}
|
||||
}
|
||||
|
||||
func (x *PushedDevicesStatus) GetAll() bool {
|
||||
@ -1757,7 +1887,7 @@ type SimulationStatus struct {
|
||||
func (x *SimulationStatus) Reset() {
|
||||
*x = SimulationStatus{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[17]
|
||||
mi := &file_device_state_proto_msgTypes[19]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -1770,7 +1900,7 @@ func (x *SimulationStatus) String() string {
|
||||
func (*SimulationStatus) ProtoMessage() {}
|
||||
|
||||
func (x *SimulationStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[17]
|
||||
mi := &file_device_state_proto_msgTypes[19]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -1783,7 +1913,7 @@ func (x *SimulationStatus) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SimulationStatus.ProtoReflect.Descriptor instead.
|
||||
func (*SimulationStatus) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{17}
|
||||
return file_device_state_proto_rawDescGZIP(), []int{19}
|
||||
}
|
||||
|
||||
func (x *SimulationStatus) GetSimulationId() string {
|
||||
@ -1828,7 +1958,7 @@ type MemoryDataStatus struct {
|
||||
func (x *MemoryDataStatus) Reset() {
|
||||
*x = MemoryDataStatus{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_state_proto_msgTypes[18]
|
||||
mi := &file_device_state_proto_msgTypes[20]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -1841,7 +1971,7 @@ func (x *MemoryDataStatus) String() string {
|
||||
func (*MemoryDataStatus) ProtoMessage() {}
|
||||
|
||||
func (x *MemoryDataStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_state_proto_msgTypes[18]
|
||||
mi := &file_device_state_proto_msgTypes[20]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -1854,7 +1984,7 @@ func (x *MemoryDataStatus) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use MemoryDataStatus.ProtoReflect.Descriptor instead.
|
||||
func (*MemoryDataStatus) Descriptor() ([]byte, []int) {
|
||||
return file_device_state_proto_rawDescGZIP(), []int{18}
|
||||
return file_device_state_proto_rawDescGZIP(), []int{20}
|
||||
}
|
||||
|
||||
func (x *MemoryDataStatus) GetAllSimulations() []*SimulationStatus {
|
||||
@ -2066,66 +2196,76 @@ var file_device_state_proto_rawDesc = []byte{
|
||||
0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x2c, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6c, 0x79,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x78, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x02, 0x78, 0x68, 0x22, 0x5f, 0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53,
|
||||
0x08, 0x52, 0x02, 0x78, 0x68, 0x22, 0x49, 0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53,
|
||||
0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x73, 0x70, 0x65,
|
||||
0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x06,
|
||||
0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x34, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53,
|
||||
0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69,
|
||||
0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||
0x22, 0x34, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06,
|
||||
0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53,
|
||||
0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x4a, 0x0a, 0x0a,
|
||||
0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x73,
|
||||
0x70, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61,
|
||||
0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74,
|
||||
0x52, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x56, 0x61, 0x72,
|
||||
0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x0c,
|
||||
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72,
|
||||
0x61, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72,
|
||||
0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d,
|
||||
0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63,
|
||||
0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53,
|
||||
0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x3b, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
|
||||
0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x52, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70,
|
||||
0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0xb9, 0x03, 0x0a, 0x10, 0x41, 0x6c,
|
||||
0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31,
|
||||
0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74,
|
||||
0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53,
|
||||
0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74,
|
||||
0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x52, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||
0x12, 0x31, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70,
|
||||
0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74,
|
||||
0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12,
|
||||
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x52, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
|
||||
0x31, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72,
|
||||
0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||
0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c,
|
||||
0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x08,
|
||||
0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x70, 0x65, 0x6e,
|
||||
0x44, 0x6f, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52,
|
||||
0x0d, 0x6f, 0x70, 0x65, 0x6e, 0x44, 0x6f, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x2e,
|
||||
0x0a, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x65,
|
||||
0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x65, 0x61, 0x72, 0x22, 0x9e,
|
||||
0x02, 0x0a, 0x0f, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61,
|
||||
0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x6d,
|
||||
0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49,
|
||||
0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74,
|
||||
0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x75, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x3b, 0x0a, 0x0e, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11,
|
||||
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74,
|
||||
0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22,
|
||||
0x93, 0x04, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x74, 0x72, 0x61,
|
||||
0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63,
|
||||
0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73,
|
||||
0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||
0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a,
|
||||
0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53,
|
||||
0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61,
|
||||
0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x72,
|
||||
0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x69, 0x67,
|
||||
0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12,
|
||||
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
|
||||
0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x75, 0x74,
|
||||
0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74,
|
||||
0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x6c,
|
||||
0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68,
|
||||
0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73,
|
||||
0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
|
||||
0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x70,
|
||||
0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08,
|
||||
0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x53,
|
||||
0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61,
|
||||
0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, 0x4b, 0x65, 0x79,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50, 0x75, 0x73, 0x68, 0x65, 0x64,
|
||||
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x61, 0x6c, 0x6c, 0x12,
|
||||
@ -2183,7 +2323,7 @@ func file_device_state_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_device_state_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_device_state_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
|
||||
var file_device_state_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
|
||||
var file_device_state_proto_goTypes = []interface{}{
|
||||
(SectionType)(0), // 0: state.SectionType
|
||||
(Signal_Aspect)(0), // 1: state.Signal.Aspect
|
||||
@ -2201,36 +2341,38 @@ var file_device_state_proto_goTypes = []interface{}{
|
||||
(*ButtonState)(nil), // 13: state.ButtonState
|
||||
(*AlarmState)(nil), // 14: state.AlarmState
|
||||
(*LightState)(nil), // 15: state.LightState
|
||||
(*VariationStatus)(nil), // 16: state.VariationStatus
|
||||
(*AllDevicesStatus)(nil), // 17: state.AllDevicesStatus
|
||||
(*PushedDevicesStatus)(nil), // 18: state.PushedDevicesStatus
|
||||
(*SimulationStatus)(nil), // 19: state.SimulationStatus
|
||||
(*MemoryDataStatus)(nil), // 20: state.MemoryDataStatus
|
||||
(*PsdState)(nil), // 16: state.PsdState
|
||||
(*KeyState)(nil), // 17: state.KeyState
|
||||
(*VariationStatus)(nil), // 18: state.VariationStatus
|
||||
(*AllDevicesStatus)(nil), // 19: state.AllDevicesStatus
|
||||
(*PushedDevicesStatus)(nil), // 20: state.PushedDevicesStatus
|
||||
(*SimulationStatus)(nil), // 21: state.SimulationStatus
|
||||
(*MemoryDataStatus)(nil), // 22: state.MemoryDataStatus
|
||||
}
|
||||
var file_device_state_proto_depIdxs = []int32{
|
||||
0, // 0: state.SectionState.type:type_name -> state.SectionType
|
||||
1, // 1: state.SignalState.aspect:type_name -> state.Signal.Aspect
|
||||
10, // 2: state.TrainState.dynamicState:type_name -> state.TrainDynamicState
|
||||
11, // 3: state.TrainState.vobcState:type_name -> state.TrainVobcState
|
||||
1, // 4: state.ButtonState.aspect:type_name -> state.Signal.Aspect
|
||||
1, // 5: state.LightState.aspect:type_name -> state.Signal.Aspect
|
||||
9, // 6: state.VariationStatus.updatedTrain:type_name -> state.TrainState
|
||||
4, // 7: state.VariationStatus.updatedSwitch:type_name -> state.SwitchState
|
||||
3, // 8: state.VariationStatus.updatedSection:type_name -> state.SectionState
|
||||
12, // 9: state.VariationStatus.updatedReply:type_name -> state.ReplyState
|
||||
9, // 10: state.AllDevicesStatus.trainState:type_name -> state.TrainState
|
||||
4, // 11: state.AllDevicesStatus.switchState:type_name -> state.SwitchState
|
||||
3, // 12: state.AllDevicesStatus.sectionState:type_name -> state.SectionState
|
||||
12, // 13: state.AllDevicesStatus.replyState:type_name -> state.ReplyState
|
||||
5, // 14: state.AllDevicesStatus.signalState:type_name -> state.SignalState
|
||||
13, // 15: state.AllDevicesStatus.buttonState:type_name -> state.ButtonState
|
||||
14, // 16: state.AllDevicesStatus.AlarmState:type_name -> state.AlarmState
|
||||
15, // 17: state.AllDevicesStatus.LightState:type_name -> state.LightState
|
||||
16, // 18: state.PushedDevicesStatus.varStatus:type_name -> state.VariationStatus
|
||||
17, // 19: state.PushedDevicesStatus.allStatus:type_name -> state.AllDevicesStatus
|
||||
19, // 20: state.MemoryDataStatus.allSimulations:type_name -> state.SimulationStatus
|
||||
19, // 21: state.MemoryDataStatus.addSimulations:type_name -> state.SimulationStatus
|
||||
19, // 22: state.MemoryDataStatus.removeSimulations:type_name -> state.SimulationStatus
|
||||
9, // 4: state.VariationStatus.updatedTrain:type_name -> state.TrainState
|
||||
4, // 5: state.VariationStatus.updatedSwitch:type_name -> state.SwitchState
|
||||
3, // 6: state.VariationStatus.updatedSection:type_name -> state.SectionState
|
||||
12, // 7: state.VariationStatus.updatedReply:type_name -> state.ReplyState
|
||||
9, // 8: state.AllDevicesStatus.trainState:type_name -> state.TrainState
|
||||
4, // 9: state.AllDevicesStatus.switchState:type_name -> state.SwitchState
|
||||
3, // 10: state.AllDevicesStatus.sectionState:type_name -> state.SectionState
|
||||
12, // 11: state.AllDevicesStatus.replyState:type_name -> state.ReplyState
|
||||
5, // 12: state.AllDevicesStatus.signalState:type_name -> state.SignalState
|
||||
13, // 13: state.AllDevicesStatus.buttonState:type_name -> state.ButtonState
|
||||
14, // 14: state.AllDevicesStatus.AlarmState:type_name -> state.AlarmState
|
||||
15, // 15: state.AllDevicesStatus.LightState:type_name -> state.LightState
|
||||
16, // 16: state.AllDevicesStatus.psdState:type_name -> state.PsdState
|
||||
17, // 17: state.AllDevicesStatus.KeyState:type_name -> state.KeyState
|
||||
18, // 18: state.PushedDevicesStatus.varStatus:type_name -> state.VariationStatus
|
||||
19, // 19: state.PushedDevicesStatus.allStatus:type_name -> state.AllDevicesStatus
|
||||
21, // 20: state.MemoryDataStatus.allSimulations:type_name -> state.SimulationStatus
|
||||
21, // 21: state.MemoryDataStatus.addSimulations:type_name -> state.SimulationStatus
|
||||
21, // 22: state.MemoryDataStatus.removeSimulations:type_name -> state.SimulationStatus
|
||||
23, // [23:23] is the sub-list for method output_type
|
||||
23, // [23:23] is the sub-list for method input_type
|
||||
23, // [23:23] is the sub-list for extension type_name
|
||||
@ -2413,7 +2555,7 @@ func file_device_state_proto_init() {
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*VariationStatus); i {
|
||||
switch v := v.(*PsdState); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -2425,7 +2567,7 @@ func file_device_state_proto_init() {
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AllDevicesStatus); i {
|
||||
switch v := v.(*KeyState); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -2437,7 +2579,7 @@ func file_device_state_proto_init() {
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PushedDevicesStatus); i {
|
||||
switch v := v.(*VariationStatus); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -2449,7 +2591,7 @@ func file_device_state_proto_init() {
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SimulationStatus); i {
|
||||
switch v := v.(*AllDevicesStatus); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -2461,6 +2603,30 @@ func file_device_state_proto_init() {
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PushedDevicesStatus); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SimulationStatus); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_device_state_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MemoryDataStatus); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -2479,7 +2645,7 @@ func file_device_state_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_device_state_proto_rawDesc,
|
||||
NumEnums: 2,
|
||||
NumMessages: 19,
|
||||
NumMessages: 21,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -1,12 +1,9 @@
|
||||
package simulation
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/memory"
|
||||
"joylink.club/bj-rtsts-server/config"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
@ -16,45 +13,6 @@ import (
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
)
|
||||
|
||||
// func init() {
|
||||
// // vobc 发来的列车信息
|
||||
// vobc.RegisterTrainInfoHandler(func(info []byte) {
|
||||
// for _, simulation := range GetSimulationArr() {
|
||||
// simulation.Memory.Status.TrainStateMap.Range(func(_, value any) bool {
|
||||
// train := value.(*state.TrainState)
|
||||
// if !train.Show { // 下线列车
|
||||
// return false
|
||||
// }
|
||||
// // 拼接列车ID
|
||||
// trainId, err := strconv.Atoi(train.Id)
|
||||
// if err != nil {
|
||||
// panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
// }
|
||||
// trainInfo := decoderVobcTrainState(info)
|
||||
// d := append(info, uint8(trainId))
|
||||
// // 发送给动力学
|
||||
// dynamics.SendDynamicsTrainMsg(d)
|
||||
// // 存放至列车中
|
||||
// train.VobcState = trainInfo
|
||||
// return true
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// dynamics.RegisterTrainInfoHandler(func(info *dynamics.TrainInfo) {
|
||||
// for _, simulation := range GetSimulationArr() {
|
||||
// sta, ok := simulation.Memory.Status.TrainStateMap.Load(strconv.Itoa(int(info.Number)))
|
||||
// if !ok {
|
||||
// continue
|
||||
// }
|
||||
// trainState := sta.(*state.TrainState)
|
||||
// // 给半实物仿真发送速度
|
||||
// vobc.SendTrainSpeedTask(convertVobc(info))
|
||||
// // 更新列车状态
|
||||
// memory.UpdateTrainState(simulation, convert(info, trainState, simulation))
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// 仿真存储集合
|
||||
var simulationMap sync.Map
|
||||
|
||||
@ -97,12 +55,6 @@ func CreateSimulation(projectId int32, mapIds []int32) (string, error) {
|
||||
// 半实物系统接口功能启动
|
||||
semi_physical_train.Default().Start(verifySimulation)
|
||||
}
|
||||
// httpCode, _, err := dynamics.SendSimulationStartReq(lineBaseInfo)
|
||||
// if httpCode != http.StatusOK || err != nil {
|
||||
// panic(dto.ErrorDto{Code: dto.DynamicsError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
|
||||
// }
|
||||
// dynamicsRun(verifySimulation)
|
||||
|
||||
simulationMap.Store(simulationId, verifySimulation)
|
||||
// 全部成功,启动仿真
|
||||
verifySimulation.World.StartUp()
|
||||
@ -120,19 +72,11 @@ func DestroySimulation(simulationId string) {
|
||||
simulationMap.Delete(simulationId)
|
||||
// 停止ecs world
|
||||
simulationInfo.World.Close()
|
||||
//ecsSimulation.DestroySimulation(simulationInfo.WorldId)
|
||||
if config.Config.Dynamics.Open {
|
||||
// 停止动力学接口功能
|
||||
dynamics.Default().Stop()
|
||||
dynamics.Default().RequestStopSimulation()
|
||||
}
|
||||
// //移除道岔状态发送
|
||||
// dynamics.Stop()
|
||||
// //通知动力学
|
||||
// httpCode, _, err := dynamics.SendSimulationEndReq()
|
||||
// if httpCode != http.StatusOK {
|
||||
// panic(dto.ErrorDto{Code: dto.DynamicsError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
|
||||
// }
|
||||
}
|
||||
|
||||
func createSimulationId(projectId int32) string {
|
||||
@ -174,326 +118,3 @@ func GetSimulationArr() []*memory.VerifySimulation {
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
/*
|
||||
func convert(info *dynamics.TrainInfo, sta *state.TrainState, simulation *memory.VerifySimulation) *state.TrainState {
|
||||
delayTime := time.Now().UnixMilli() - sta.VobcState.UpdateTime
|
||||
sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime
|
||||
slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
|
||||
id, port, offset, runDirection, pointTo, kilometer := memory.QueryDeviceByCalcLink(simulation.Repo, strconv.Itoa(int(info.Link)), int64(info.LinkOffset), info.Up)
|
||||
slog.Debug("处理动力学转换后的消息", "number", info.Number,
|
||||
"车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
|
||||
sta.HeadDeviceId = simulation.GetComIdByUid(id)
|
||||
sta.DevicePort = port
|
||||
sta.HeadOffset = offset
|
||||
sta.PointTo = pointTo
|
||||
sta.TrainKilometer = kilometer
|
||||
sta.RunDirection = runDirection
|
||||
//判定车头方向
|
||||
sta.HeadDirection = runDirection
|
||||
if sta.VobcState != nil {
|
||||
if sta.VobcState.DirectionForward {
|
||||
sta.HeadDirection = runDirection
|
||||
} else if sta.VobcState.DirectionBackward {
|
||||
sta.HeadDirection = !runDirection
|
||||
}
|
||||
}
|
||||
if info.Speed < 0 {
|
||||
sta.RunDirection = !sta.RunDirection
|
||||
}
|
||||
// 赋值动力学信息
|
||||
sta.DynamicState.Heartbeat = int32(info.LifeSignal)
|
||||
sta.DynamicState.HeadLinkId = strconv.Itoa(int(info.Link))
|
||||
sta.DynamicState.HeadLinkOffset = int64(info.LinkOffset)
|
||||
sta.DynamicState.Slope = int32(info.Slope)
|
||||
sta.DynamicState.Upslope = info.UpSlope
|
||||
sta.DynamicState.RunningUp = info.Up
|
||||
sta.DynamicState.RunningResistanceSum = float32(info.TotalResistance) / 1000
|
||||
sta.DynamicState.AirResistance = float32(info.AirResistance) / 1000
|
||||
sta.DynamicState.RampResistance = float32(info.SlopeResistance) / 1000
|
||||
sta.DynamicState.CurveResistance = float32(info.CurveResistance) / 1000
|
||||
sta.DynamicState.Speed = speedParse(info.Speed)
|
||||
sta.DynamicState.HeadSensorSpeed1 = speedParse(info.HeadSpeed1)
|
||||
sta.DynamicState.HeadSensorSpeed2 = speedParse(info.HeadSpeed2)
|
||||
sta.DynamicState.TailSensorSpeed1 = speedParse(info.TailSpeed1)
|
||||
sta.DynamicState.TailSensorSpeed2 = speedParse(info.TailSpeed2)
|
||||
sta.DynamicState.HeadRadarSpeed = speedParse(info.HeadRadarSpeed)
|
||||
sta.DynamicState.TailRadarSpeed = speedParse(info.TailRadarSpeed)
|
||||
sta.DynamicState.Acceleration = info.Acceleration
|
||||
return sta
|
||||
}*/
|
||||
|
||||
// func convert(info *dynamics.TrainInfo, sta *state.TrainState, simulation *memory.VerifySimulation) *state.TrainState {
|
||||
// if sta.VobcState.LifeSignal == int32(info.VobcLifeSignal) {
|
||||
// sta.ControlDelayTime = time.Now().UnixMilli() - sta.VobcState.UpdateTime
|
||||
// if sta.ControlDelayTime > memory.DelayMaxTime {
|
||||
// sta.ControlDelayTime = memory.DelayMaxTime
|
||||
// }
|
||||
// } else {
|
||||
// sta.ControlDelayTime = memory.DelayMaxTime
|
||||
// }
|
||||
// slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
|
||||
// id, port, offset, runDirection, pointTo, kilometer := memory.QueryDeviceByCalcLink(simulation.Repo, strconv.Itoa(int(info.Link)), int64(info.LinkOffset), info.Up)
|
||||
// slog.Debug("处理动力学转换后的消息", "number", info.Number,
|
||||
// "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
|
||||
// sta.HeadDeviceId = simulation.GetComIdByUid(id)
|
||||
// sta.DevicePort = port
|
||||
// sta.HeadOffset = offset
|
||||
// sta.PointTo = pointTo
|
||||
// sta.TrainKilometer = kilometer
|
||||
// sta.RunDirection = runDirection
|
||||
// //判定车头方向
|
||||
// sta.HeadDirection = runDirection
|
||||
// if sta.VobcState != nil {
|
||||
// if sta.VobcState.DirectionForward {
|
||||
// sta.HeadDirection = runDirection
|
||||
// } else if sta.VobcState.DirectionBackward {
|
||||
// sta.HeadDirection = !runDirection
|
||||
// }
|
||||
// }
|
||||
// if info.Speed < 0 {
|
||||
// sta.RunDirection = !sta.RunDirection
|
||||
// }
|
||||
// // 赋值动力学信息
|
||||
// sta.DynamicState.Heartbeat = int32(info.LifeSignal)
|
||||
// sta.DynamicState.HeadLinkId = strconv.Itoa(int(info.Link))
|
||||
// sta.DynamicState.HeadLinkOffset = int64(info.LinkOffset)
|
||||
// sta.DynamicState.Slope = int32(info.Slope)
|
||||
// sta.DynamicState.Upslope = info.UpSlope
|
||||
// sta.DynamicState.RunningUp = info.Up
|
||||
// sta.DynamicState.RunningResistanceSum = float32(info.TotalResistance) / 1000
|
||||
// sta.DynamicState.AirResistance = float32(info.AirResistance) / 1000
|
||||
// sta.DynamicState.RampResistance = float32(info.SlopeResistance) / 1000
|
||||
// sta.DynamicState.CurveResistance = float32(info.CurveResistance) / 1000
|
||||
// sta.DynamicState.Speed = speedParse(info.Speed)
|
||||
// sta.DynamicState.HeadSensorSpeed1 = speedParse(info.HeadSpeed1)
|
||||
// sta.DynamicState.HeadSensorSpeed2 = speedParse(info.HeadSpeed2)
|
||||
// sta.DynamicState.TailSensorSpeed1 = speedParse(info.TailSpeed1)
|
||||
// sta.DynamicState.TailSensorSpeed2 = speedParse(info.TailSpeed2)
|
||||
// sta.DynamicState.HeadRadarSpeed = speedParse(info.HeadRadarSpeed)
|
||||
// sta.DynamicState.TailRadarSpeed = speedParse(info.TailRadarSpeed)
|
||||
// sta.DynamicState.Acceleration = info.Acceleration
|
||||
// return sta
|
||||
// }
|
||||
|
||||
// // 转换成Vobc发送参数
|
||||
// func convertVobc(info *dynamics.TrainInfo) *vobc.SendTrainInfo {
|
||||
// param := &vobc.SendTrainInfo{
|
||||
// Speed: uint16(math.Abs(float64(info.Speed * 36))),
|
||||
// Upslope: info.UpSlope,
|
||||
// Slope: uint16(info.Slope),
|
||||
// TotalResistance: uint32(math.Abs(float64(info.TotalResistance / 10))),
|
||||
// AirResistance: uint32(info.AirResistance / 10),
|
||||
// SlopeResistance: uint32(math.Abs(float64(info.SlopeResistance / 10))),
|
||||
// CurveResistance: uint32(info.CurveResistance / 10),
|
||||
// }
|
||||
// d := math.Abs(float64(info.Acceleration * 100))
|
||||
// if info.Acceleration > 0 {
|
||||
// param.Acceleration = uint8(d)
|
||||
// } else {
|
||||
// param.Deceleration = uint8(d)
|
||||
// }
|
||||
// return param
|
||||
// }
|
||||
|
||||
// func convert(info *dynamics.TrainInfo, sta *state.TrainState, simulation *memory.VerifySimulation) *state.TrainState {
|
||||
// slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
|
||||
// id, port, offset, runDirection, pointTo, kilometer := memory.QueryDeviceByCalcLink(simulation.Repo, strconv.Itoa(int(info.Link)), int64(info.LinkOffset), info.Up)
|
||||
// slog.Debug("处理动力学转换后的消息", "number", info.Number,
|
||||
// "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
|
||||
// sta.HeadDeviceId = simulation.GetComIdByUid(id)
|
||||
// sta.DevicePort = port
|
||||
// sta.HeadOffset = offset
|
||||
// sta.PointTo = pointTo
|
||||
// sta.TrainKilometer = kilometer
|
||||
// sta.RunDirection = runDirection
|
||||
// //判定车头方向
|
||||
// sta.HeadDirection = runDirection
|
||||
// if sta.VobcState != nil {
|
||||
// if sta.VobcState.DirectionForward {
|
||||
// sta.HeadDirection = runDirection
|
||||
// } else if sta.VobcState.DirectionBackward {
|
||||
// sta.HeadDirection = !runDirection
|
||||
// }
|
||||
// }
|
||||
// if info.Speed < 0 {
|
||||
// sta.RunDirection = !sta.RunDirection
|
||||
// }
|
||||
// // 赋值动力学信息
|
||||
// sta.DynamicState.Heartbeat = int32(info.LifeSignal)
|
||||
// sta.DynamicState.HeadLinkId = strconv.Itoa(int(info.Link))
|
||||
// sta.DynamicState.HeadLinkOffset = int64(info.LinkOffset)
|
||||
// sta.DynamicState.Slope = int32(info.Slope)
|
||||
// sta.DynamicState.Upslope = info.UpSlope
|
||||
// sta.DynamicState.RunningUp = info.Up
|
||||
// sta.DynamicState.RunningResistanceSum = float32(info.TotalResistance) / 1000
|
||||
// sta.DynamicState.AirResistance = float32(info.AirResistance) / 1000
|
||||
// sta.DynamicState.RampResistance = float32(info.SlopeResistance) / 1000
|
||||
// sta.DynamicState.CurveResistance = float32(info.CurveResistance) / 1000
|
||||
// sta.DynamicState.Speed = speedParse(info.Speed)
|
||||
// sta.DynamicState.HeadSensorSpeed1 = speedParse(info.HeadSpeed1)
|
||||
// sta.DynamicState.HeadSensorSpeed2 = speedParse(info.HeadSpeed2)
|
||||
// sta.DynamicState.TailSensorSpeed1 = speedParse(info.TailSpeed1)
|
||||
// sta.DynamicState.TailSensorSpeed2 = speedParse(info.TailSpeed2)
|
||||
// sta.DynamicState.HeadRadarSpeed = speedParse(info.HeadRadarSpeed)
|
||||
// sta.DynamicState.TailRadarSpeed = speedParse(info.TailRadarSpeed)
|
||||
// sta.DynamicState.Acceleration = info.Acceleration
|
||||
// return sta
|
||||
// }
|
||||
|
||||
// func dynamicsRun(verifySimulation *memory.VerifySimulation) {
|
||||
// _ = dynamics.Run(func() []*dynamics.TurnoutInfo {
|
||||
// stateSlice := memory.GetAllTurnoutState(verifySimulation)
|
||||
// var turnoutInfoSlice []*dynamics.TurnoutInfo
|
||||
// for _, sta := range stateSlice {
|
||||
// code64, err := strconv.ParseUint(sta.Id, 10, 16)
|
||||
// if err != nil {
|
||||
// slog.Error("id转uint16报错", err)
|
||||
// }
|
||||
// info := dynamics.TurnoutInfo{
|
||||
// Code: uint16(code64),
|
||||
// NPosition: sta.Dw,
|
||||
// RPosition: sta.Fw,
|
||||
// }
|
||||
// turnoutInfoSlice = append(turnoutInfoSlice, &info)
|
||||
// }
|
||||
// return turnoutInfoSlice
|
||||
// })
|
||||
// }
|
||||
|
||||
// func buildLineBaseInfo(sim *memory.VerifySimulation) *dynamics.LineBaseInfo {
|
||||
// info := &dynamics.LineBaseInfo{}
|
||||
// for _, model := range sim.Repo.LinkList() {
|
||||
// id, _ := strconv.Atoi(model.Id())
|
||||
// link := &dynamics.Link{
|
||||
// ID: int32(id),
|
||||
// Len: int32(model.Length()),
|
||||
// }
|
||||
// info.LinkList = append(info.LinkList, link)
|
||||
// if model.ARelation() != nil {
|
||||
// turnoutId, _ := strconv.Atoi(sim.GetComIdByUid(model.ARelation().Device().Id()))
|
||||
// link.ARelTurnoutId = int32(turnoutId)
|
||||
// switch model.ARelation().Port() {
|
||||
// case proto.Port_A:
|
||||
// link.ARelTurnoutPoint = "A"
|
||||
// case proto.Port_B:
|
||||
// link.ARelTurnoutPoint = "B"
|
||||
// case proto.Port_C:
|
||||
// link.ARelTurnoutPoint = "C"
|
||||
// }
|
||||
// }
|
||||
// if model.BRelation() != nil {
|
||||
// turnoutId, _ := strconv.Atoi(sim.GetComIdByUid(model.BRelation().Device().Id()))
|
||||
// link.BRelTurnoutId = int32(turnoutId)
|
||||
// switch model.BRelation().Port() {
|
||||
// case proto.Port_A:
|
||||
// link.BRelTurnoutPoint = "A"
|
||||
// case proto.Port_B:
|
||||
// link.BRelTurnoutPoint = "B"
|
||||
// case proto.Port_C:
|
||||
// link.BRelTurnoutPoint = "C"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for _, model := range sim.Repo.SlopeList() {
|
||||
// id, _ := strconv.Atoi(sim.GetComIdByUid(model.Id()))
|
||||
// slope := &dynamics.Slope{
|
||||
// ID: int32(id),
|
||||
// StartLinkOffset: int32(model.StartLinkPosition().Offset()),
|
||||
// EndLinkOffset: int32(model.EndLinkPosition().Offset()),
|
||||
// DegreeTrig: model.Degree(),
|
||||
// }
|
||||
// info.SlopeList = append(info.SlopeList, slope)
|
||||
// startLinkId, _ := strconv.Atoi(model.StartLinkPosition().Link().Id())
|
||||
// slope.StartLinkId = int32(startLinkId)
|
||||
// endLinkId, _ := strconv.Atoi(model.EndLinkPosition().Link().Id())
|
||||
// slope.EndLinkId = int32(endLinkId)
|
||||
// }
|
||||
// for _, model := range sim.Repo.SectionalCurvatureList() {
|
||||
// id, _ := strconv.Atoi(sim.GetComIdByUid(model.Id()))
|
||||
// curve := &dynamics.Curve{
|
||||
// ID: int32(id),
|
||||
// StartLinkOffset: int32(model.StartLinkPosition().Offset()),
|
||||
// EndLinkOffset: int32(model.EndLinkPosition().Offset()),
|
||||
// Curvature: model.Radius(),
|
||||
// }
|
||||
// info.CurveList = append(info.CurveList, curve)
|
||||
// startLinkId, _ := strconv.Atoi(model.StartLinkPosition().Link().Id())
|
||||
// curve.StartLinkId = int32(startLinkId)
|
||||
// endLinkId, _ := strconv.Atoi(model.EndLinkPosition().Link().Id())
|
||||
// curve.EndLinkId = int32(endLinkId)
|
||||
// }
|
||||
// return info
|
||||
// }
|
||||
|
||||
// 解析VOBC列车信息
|
||||
func decoderVobcTrainState(buf []byte) *state.TrainVobcState {
|
||||
trainVobcInfo := &state.TrainVobcState{}
|
||||
trainVobcInfo.LifeSignal = int32(binary.BigEndian.Uint16(buf[0:2]))
|
||||
b2 := buf[2]
|
||||
trainVobcInfo.Tc1Active = (b2 & 1) != 0
|
||||
trainVobcInfo.Tc2Active = (b2 & (1 << 1)) != 0
|
||||
trainVobcInfo.DirectionForward = (b2 & (1 << 2)) != 0
|
||||
trainVobcInfo.DirectionBackward = (b2 & (1 << 3)) != 0
|
||||
trainVobcInfo.TractionStatus = (b2 & (1 << 4)) != 0
|
||||
trainVobcInfo.BrakingStatus = (b2 & (1 << 5)) != 0
|
||||
trainVobcInfo.EmergencyBrakingStatus = (b2 & (1 << 6)) != 0
|
||||
trainVobcInfo.TurnbackStatus = (b2 & 7) != 0
|
||||
b3 := buf[3]
|
||||
trainVobcInfo.JumpStatus = (b3 & 1) != 0
|
||||
trainVobcInfo.Ato = (b3 & (1 << 1)) != 0
|
||||
trainVobcInfo.Fam = (b3 & (1 << 2)) != 0
|
||||
trainVobcInfo.Cam = (b3 & (1 << 3)) != 0
|
||||
trainVobcInfo.TractionSafetyCircuit = (b3 & (1 << 4)) != 0
|
||||
trainVobcInfo.ParkingBrakeStatus = (b3 & (1 << 5)) != 0
|
||||
trainVobcInfo.MaintainBrakeStatus = (b3 & (1 << 6)) != 0
|
||||
trainVobcInfo.TractionForce = int64(binary.BigEndian.Uint16(buf[4:6]))
|
||||
trainVobcInfo.BrakeForce = int64(binary.BigEndian.Uint16(buf[6:8]))
|
||||
trainVobcInfo.TrainLoad = int64(binary.BigEndian.Uint16(buf[8:10]))
|
||||
b4 := buf[15]
|
||||
trainVobcInfo.LeftDoorOpenCommand = (b4 & 1) != 0
|
||||
trainVobcInfo.RightDoorOpenCommand = (b4 & (1 << 1)) != 0
|
||||
trainVobcInfo.LeftDoorCloseCommand = (b4 & (1 << 2)) != 0
|
||||
trainVobcInfo.RightDoorCloseCommand = (b4 & (1 << 3)) != 0
|
||||
trainVobcInfo.AllDoorClose = (b4 & (1 << 4)) != 0
|
||||
trainVobcInfo.UpdateTime = time.Now().UnixMilli()
|
||||
return trainVobcInfo
|
||||
}
|
||||
|
||||
// // 解析VOBC列车信息
|
||||
// func decoderVobcTrainState(buf []byte) *state.TrainVobcState {
|
||||
// trainVobcInfo := &state.TrainVobcState{}
|
||||
// trainVobcInfo.LifeSignal = int32(binary.BigEndian.Uint16(buf[0:2]))
|
||||
// b2 := buf[2]
|
||||
// trainVobcInfo.Tc1Active = (b2 & 1) != 0
|
||||
// trainVobcInfo.Tc2Active = (b2 & (1 << 1)) != 0
|
||||
// trainVobcInfo.DirectionForward = (b2 & (1 << 2)) != 0
|
||||
// trainVobcInfo.DirectionBackward = (b2 & (1 << 3)) != 0
|
||||
// trainVobcInfo.TractionStatus = (b2 & (1 << 4)) != 0
|
||||
// trainVobcInfo.BrakingStatus = (b2 & (1 << 5)) != 0
|
||||
// trainVobcInfo.EmergencyBrakingStatus = (b2 & (1 << 6)) != 0
|
||||
// trainVobcInfo.TurnbackStatus = (b2 & 7) != 0
|
||||
// b3 := buf[3]
|
||||
// trainVobcInfo.JumpStatus = (b3 & 1) != 0
|
||||
// trainVobcInfo.Ato = (b3 & (1 << 1)) != 0
|
||||
// trainVobcInfo.Fam = (b3 & (1 << 2)) != 0
|
||||
// trainVobcInfo.Cam = (b3 & (1 << 3)) != 0
|
||||
// trainVobcInfo.TractionSafetyCircuit = (b3 & (1 << 4)) != 0
|
||||
// trainVobcInfo.ParkingBrakeStatus = (b3 & (1 << 5)) != 0
|
||||
// trainVobcInfo.MaintainBrakeStatus = (b3 & (1 << 6)) != 0
|
||||
// trainVobcInfo.TractionForce = int64(binary.BigEndian.Uint16(buf[4:6]))
|
||||
// trainVobcInfo.BrakeForce = int64(binary.BigEndian.Uint16(buf[6:8]))
|
||||
// trainVobcInfo.TrainLoad = int64(binary.BigEndian.Uint16(buf[8:10]))
|
||||
// b4 := buf[15]
|
||||
// trainVobcInfo.LeftDoorOpenCommand = (b4 & 1) != 0
|
||||
// trainVobcInfo.RightDoorOpenCommand = (b4 & (1 << 1)) != 0
|
||||
// trainVobcInfo.LeftDoorCloseCommand = (b4 & (1 << 2)) != 0
|
||||
// trainVobcInfo.RightDoorCloseCommand = (b4 & (1 << 3)) != 0
|
||||
// trainVobcInfo.AllDoorClose = (b4 & (1 << 4)) != 0
|
||||
// return trainVobcInfo
|
||||
// }
|
||||
|
||||
// // 发送给前端的速度格式化
|
||||
// func speedParse(speed float32) int32 {
|
||||
// return int32(math.Abs(float64(speed * 3.6 * 100)))
|
||||
// }
|
||||
|
@ -1,6 +1,7 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
@ -9,36 +10,73 @@ import (
|
||||
)
|
||||
|
||||
// 操作IBP按钮
|
||||
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationCode, btnId string, pressDown bool) {
|
||||
uid := QueryIBPUidByMidAndComId(mapId, btnId, stationCode)
|
||||
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnCode string, pressDown bool) {
|
||||
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
|
||||
if pressDown {
|
||||
fi.PressDownButton(sim.World, uid)
|
||||
fi.PressDownButton(sim.World, stationUid+"_"+btnCode)
|
||||
} else {
|
||||
fi.PressUpButton(sim.World, uid)
|
||||
fi.PressUpButton(sim.World, stationUid+"_"+btnCode)
|
||||
}
|
||||
}
|
||||
|
||||
// 操作IBP按钮
|
||||
func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyCode string, gear int32) {
|
||||
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
|
||||
fi.SwitchKeyGear(sim.World, stationUid+"_"+keyCode, gear)
|
||||
}
|
||||
|
||||
// 获取仿真车站按钮状态,前端推送
|
||||
func GetMapAllIBPState(sim *VerifySimulation, mapId int32, stationCode string) *state.AllDevicesStatus {
|
||||
func GetMapAllIBPState(sim *VerifySimulation, mapId int32, stationId, ibpMapCode string) *state.AllDevicesStatus {
|
||||
status := &state.AllDevicesStatus{
|
||||
ButtonState: []*state.ButtonState{},
|
||||
LightState: []*state.LightState{},
|
||||
AlarmState: []*state.AlarmState{},
|
||||
KeyState: []*state.KeyState{},
|
||||
}
|
||||
uidMap := QueryIBPUidMapByType(mapId, stationCode)
|
||||
for _, u := range uidMap {
|
||||
entry, ok := entity.GetEntityByUid(sim.World, u.Uid)
|
||||
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
|
||||
ibpStorage := getStorageIBPMapData(ibpMapCode)
|
||||
for _, data := range ibpStorage.IbpButtons { // 按钮
|
||||
entry, ok := entity.GetEntityByUid(sim.World, stationUid+"_"+data.Code)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.ButtonTag) { // 按钮
|
||||
status.ButtonState = append(status.ButtonState, getIBPButtonState(u.CommonId, entry))
|
||||
} else if entry.HasComponent(component.AlarmTag) { // 报警器
|
||||
status.AlarmState = append(status.AlarmState, getIBPAlarmState(u.CommonId, entry))
|
||||
} else if entry.HasComponent(component.LightTag) { // 指示灯
|
||||
if entry.HasComponent(component.ButtonTag) {
|
||||
status.ButtonState = append(status.ButtonState, getIBPButtonState(data.Common.Id, entry))
|
||||
}
|
||||
}
|
||||
for _, data := range ibpStorage.IbpAlarms { // 报警器
|
||||
entry, ok := entity.GetEntityByUid(sim.World, stationUid+"_"+data.Code)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.AlarmTag) {
|
||||
status.AlarmState = append(status.AlarmState, &state.AlarmState{
|
||||
Id: data.Common.Id,
|
||||
Active: component.BitStateType.Get(entry).Val,
|
||||
})
|
||||
}
|
||||
}
|
||||
for _, data := range ibpStorage.IbpLights { // 指示灯
|
||||
entry, ok := entity.GetEntityByUid(sim.World, stationUid+"_"+data.Code)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.LightTag) {
|
||||
status.LightState = append(status.LightState, &state.LightState{
|
||||
Id: u.CommonId,
|
||||
Aspect: getIBPLightAspect(entry),
|
||||
Id: data.Common.Id,
|
||||
Active: component.BitStateType.Get(entry).Val,
|
||||
})
|
||||
}
|
||||
}
|
||||
for _, data := range ibpStorage.IbpKeys { // 钥匙
|
||||
entry, ok := entity.GetEntityByUid(sim.World, stationUid+"_"+data.Code)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.KeyTag) {
|
||||
status.KeyState = append(status.KeyState, &state.KeyState{
|
||||
Id: data.Common.Id,
|
||||
Gear: component.GearStateType.Get(entry).Val,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -47,44 +85,13 @@ func GetMapAllIBPState(sim *VerifySimulation, mapId int32, stationCode string) *
|
||||
|
||||
// 获取IBP盘按钮状态
|
||||
func getIBPButtonState(id string, entry *ecs.Entry) *state.ButtonState {
|
||||
status := &state.ButtonState{Id: id, Aspect: state.Signal_Non}
|
||||
status := &state.ButtonState{Id: id}
|
||||
bit := component.BitStateType.Get(entry)
|
||||
status.Down = bit.Val
|
||||
// 如果按钮包含灯
|
||||
if entry.HasComponent(component.SingleLightType) {
|
||||
lightComponent := component.SingleLightType.Get(entry)
|
||||
status.Aspect = getIBPLightAspect(lightComponent.Light)
|
||||
status.Active = component.BitStateType.Get(lightComponent.Light).Val
|
||||
}
|
||||
return status
|
||||
}
|
||||
|
||||
// 获取灯的颜色
|
||||
func getIBPLightAspect(light *ecs.Entry) state.Signal_Aspect {
|
||||
isActive := component.BitStateType.Get(light).Val
|
||||
if isActive {
|
||||
switch {
|
||||
case light.HasComponent(component.LdTag):
|
||||
return state.Signal_L
|
||||
case light.HasComponent(component.HdTag):
|
||||
return state.Signal_H
|
||||
case light.HasComponent(component.UdTag):
|
||||
return state.Signal_U
|
||||
case light.HasComponent(component.BdTag):
|
||||
return state.Signal_B
|
||||
case light.HasComponent(component.AdTag):
|
||||
return state.Signal_A
|
||||
default:
|
||||
return state.Signal_Non
|
||||
}
|
||||
} else {
|
||||
return state.Signal_OFF
|
||||
}
|
||||
}
|
||||
|
||||
// 获取警铃状态
|
||||
func getIBPAlarmState(id string, entry *ecs.Entry) *state.AlarmState {
|
||||
status := &state.AlarmState{Id: id}
|
||||
bit := component.BitStateType.Get(entry)
|
||||
status.Active = bit.Val
|
||||
return status
|
||||
}
|
||||
|
@ -89,6 +89,11 @@ func QueryGiData[T proto.Message](mapId int32) T {
|
||||
return value.(T)
|
||||
}
|
||||
|
||||
func QueryGiId(name string) int32 {
|
||||
value, _ := giNameMap.Load(name)
|
||||
return value.(int32)
|
||||
}
|
||||
|
||||
// 根据区段,道岔偏移量返回linkID和link相对偏移量
|
||||
func QueryEcsLinkByDeviceInfo(repo *repository.Repository, mapId int32, id string, devicePort string, offset int64, runDirection bool) (int32, int64, bool, bool, int64) {
|
||||
if devicePort == "" {
|
||||
@ -123,19 +128,20 @@ func sectionMapToEcsLink(repo *repository.Repository, id string, offset int64, r
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图不存在uid:%s缓存", id)})
|
||||
}
|
||||
ao, bo := section.ALinkPosition().Offset(), section.BLinkPosition().Offset()
|
||||
// 是否从A到B
|
||||
ak, bk := section.AKilometer().Value, section.BKilometer().Value
|
||||
// 是否从A到B,统一坐标
|
||||
ak, bk := convertRepoBaseKm(repo, section.AKilometer()), convertRepoBaseKm(repo, section.BKilometer())
|
||||
akv, bkv := ak.Value, bk.Value
|
||||
// 上行
|
||||
var up, abDirection bool
|
||||
if runDirection {
|
||||
abDirection = ak < bk
|
||||
abDirection = akv < bkv
|
||||
if abDirection {
|
||||
up = ao < bo
|
||||
} else {
|
||||
up = ao > bo
|
||||
}
|
||||
} else {
|
||||
abDirection = ak > bk
|
||||
abDirection = akv > bkv
|
||||
if abDirection {
|
||||
up = ao < bo
|
||||
} else {
|
||||
@ -143,7 +149,7 @@ func sectionMapToEcsLink(repo *repository.Repository, id string, offset int64, r
|
||||
}
|
||||
}
|
||||
linkId, _ := strconv.Atoi(section.ALinkPosition().Link().Identity.Id())
|
||||
trainKilometer := concertTrainKilometer(ak, offset, up)
|
||||
trainKilometer := concertTrainKilometer(akv, offset, up)
|
||||
if ao < bo {
|
||||
return int32(linkId), ao + offset, up, abDirection, trainKilometer
|
||||
} else {
|
||||
@ -213,7 +219,7 @@ func QueryDeviceByCalcLink(repo *repository.Repository, id string, offset int64,
|
||||
if onTurnout {
|
||||
return ecsLinkMapToTurnout(repo, isA, offset, up, link)
|
||||
} else {
|
||||
return ecsLinkMapToSection(offset, up, link)
|
||||
return ecsLinkMapToSection(repo, offset, up, link)
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,12 +290,12 @@ func ecsLinkMapToTurnout(repo *repository.Repository, isA bool, offset int64, up
|
||||
}
|
||||
|
||||
// 处理在道岔上link映射
|
||||
func ecsLinkMapToSection(offset int64, up bool, link *repository.Link) (
|
||||
func ecsLinkMapToSection(repo *repository.Repository, offset int64, up bool, link *repository.Link) (
|
||||
deviceId, port string, deviceOffset int64, runDirection, pointTo bool, km int64) {
|
||||
var section *repository.PhysicalSection
|
||||
for _, s := range link.PhysicalSections() {
|
||||
ao, bo := s.ALinkPosition().Offset(), s.BLinkPosition().Offset()
|
||||
if (ao <= offset && offset < bo) || (bo <= offset && offset < ao) {
|
||||
if (ao < offset && offset <= bo) || (bo < offset && offset <= ao) {
|
||||
section = s
|
||||
break
|
||||
}
|
||||
@ -301,21 +307,22 @@ func ecsLinkMapToSection(offset int64, up bool, link *repository.Link) (
|
||||
deviceId = section.Id()
|
||||
// link偏移变大方向
|
||||
ao, bo := section.ALinkPosition().Offset(), section.BLinkPosition().Offset()
|
||||
ak, bk := section.AKilometer().Value, section.BKilometer().Value
|
||||
ak, bk := convertRepoBaseKm(repo, section.AKilometer()), convertRepoBaseKm(repo, section.BKilometer())
|
||||
akv, bkv := ak.Value, bk.Value
|
||||
if up {
|
||||
if ao < bo {
|
||||
runDirection = ak < bk
|
||||
runDirection = akv < bkv
|
||||
} else {
|
||||
runDirection = ak > bk
|
||||
runDirection = akv > bkv
|
||||
}
|
||||
} else {
|
||||
if ao > bo {
|
||||
runDirection = ak < bk
|
||||
runDirection = akv < bkv
|
||||
} else {
|
||||
runDirection = ak > bk
|
||||
runDirection = akv > bkv
|
||||
}
|
||||
}
|
||||
pointTo = runDirection == (ak < bk)
|
||||
pointTo = runDirection == (akv < bkv)
|
||||
// a点偏移 大于 b点偏移
|
||||
if ao > bo {
|
||||
deviceOffset = ao - offset
|
||||
@ -323,10 +330,10 @@ func ecsLinkMapToSection(offset int64, up bool, link *repository.Link) (
|
||||
deviceOffset = offset - ao
|
||||
}
|
||||
// a点公里标 大于 b点公里标
|
||||
if ak > bk {
|
||||
km = ak - deviceOffset
|
||||
if akv > bkv {
|
||||
km = akv - deviceOffset
|
||||
} else {
|
||||
km = ak + deviceOffset
|
||||
km = akv + deviceOffset
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -339,3 +346,12 @@ func concertTrainKilometer(kilometer, offset int64, tendTo bool) int64 {
|
||||
return kilometer + offset
|
||||
}
|
||||
}
|
||||
|
||||
// 转换成统一坐标公里标
|
||||
func convertRepoBaseKm(r *repository.Repository, km *proto2.Kilometer) *proto2.Kilometer {
|
||||
k, err := r.ConvertKilometer(km, r.GetCoordinateInfo().Coordinate)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return k
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ type elementIdStructure struct {
|
||||
Uid string
|
||||
}
|
||||
|
||||
// 数组为Index为 common.Id, index, uid
|
||||
// 数组为Index为 common.ButtonCode, index, uid
|
||||
type stationUidStructure struct {
|
||||
AxlePointIds map[string]*elementIdStructure
|
||||
TurnoutIds map[string]*elementIdStructure
|
||||
@ -29,7 +29,9 @@ type stationUidStructure struct {
|
||||
CurvatureIds map[string]*elementIdStructure
|
||||
ButtonIds map[string]*elementIdStructure
|
||||
StationIds map[string]*elementIdStructure
|
||||
IBPIds map[string]map[string]*elementIdStructure
|
||||
PlatformIds map[string]*elementIdStructure
|
||||
PsdIds map[string]*elementIdStructure
|
||||
GateBoxIds map[string]*elementIdStructure
|
||||
}
|
||||
|
||||
type relayUidStructure struct {
|
||||
@ -74,7 +76,9 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *stationUidStructure {
|
||||
CurvatureIds: make(map[string]*elementIdStructure, len(data.Curvatures)),
|
||||
ButtonIds: make(map[string]*elementIdStructure, len(data.EsbButtons)),
|
||||
StationIds: make(map[string]*elementIdStructure, len(data.Stations)),
|
||||
IBPIds: make(map[string]map[string]*elementIdStructure, len(data.Stations)),
|
||||
PlatformIds: make(map[string]*elementIdStructure, len(data.Platforms)),
|
||||
PsdIds: make(map[string]*elementIdStructure, len(data.ScreenDoors)),
|
||||
GateBoxIds: make(map[string]*elementIdStructure, len(data.GateBoxs)),
|
||||
}
|
||||
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
|
||||
// 初始化计轴信息
|
||||
@ -155,70 +159,44 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *stationUidStructure {
|
||||
}
|
||||
}
|
||||
// 处理车站信息
|
||||
stationMap := make(map[string]*graphicData.Station)
|
||||
for _, s := range data.Stations {
|
||||
stationMap[s.Common.Id] = s
|
||||
gus.StationIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, nil, s.Code),
|
||||
Uid: GenerateElementUid(city, lineId, nil, s.StationName),
|
||||
}
|
||||
}
|
||||
// 站台
|
||||
platformMap := make(map[string]*graphicData.Platform)
|
||||
for _, platform := range data.Platforms {
|
||||
platformMap[platform.Common.Id] = platform
|
||||
gus.PlatformIds[platform.Common.Id] = &elementIdStructure{
|
||||
CommonId: platform.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, nil, platform.Code),
|
||||
}
|
||||
}
|
||||
// 屏蔽门
|
||||
for _, door := range data.ScreenDoors {
|
||||
station := stationMap[platformMap[door.RefPlatformId].GetRefStationId()]
|
||||
if station == nil { //线路数据有问题
|
||||
continue
|
||||
}
|
||||
gus.PsdIds[door.Common.Id] = &elementIdStructure{
|
||||
CommonId: door.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.GetCommon().GetId()}, door.Code),
|
||||
}
|
||||
}
|
||||
// 门控箱
|
||||
for _, box := range data.GateBoxs {
|
||||
gus.GateBoxIds[box.Common.Id] = &elementIdStructure{
|
||||
CommonId: box.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, nil, box.Code),
|
||||
}
|
||||
// 处理关联的IBP盘信息
|
||||
initIBPUid(gus, city, lineId, s, getStorageIBPMapData(s.RefIbpMapCode))
|
||||
}
|
||||
return gus
|
||||
}
|
||||
|
||||
// 处理IBP盘信息
|
||||
func initIBPUid(gus *stationUidStructure, city, lineId string, station *graphicData.Station, data *graphicData.IBPGraphicStorage) {
|
||||
if data == nil {
|
||||
return
|
||||
}
|
||||
// 设备所属组合
|
||||
refMap := make(map[string]string)
|
||||
for _, r := range data.IbpRelatedDevices {
|
||||
for _, c := range r.Combinationtypes {
|
||||
for _, i := range c.RefDevices {
|
||||
refMap[i] = c.Code
|
||||
}
|
||||
}
|
||||
}
|
||||
getCode := func(id, code string) string {
|
||||
p := refMap[id]
|
||||
if p == "" {
|
||||
return code
|
||||
}
|
||||
return p + "_" + code
|
||||
}
|
||||
uidMap := make(map[string]*elementIdStructure, len(data.IbpButtons)+len(data.IbpKeys)+len(data.IbpAlarms)+len(data.IbpLights))
|
||||
for _, d := range data.IbpButtons { // ibp按钮
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Code: d.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
for _, d := range data.IbpKeys { // ibp钥匙
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Code: d.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
for _, d := range data.IbpAlarms { // ibp报警器
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Code: d.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
for _, d := range data.IbpLights { // ibp指示灯
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Code: d.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
gus.IBPIds[station.Code] = uidMap
|
||||
}
|
||||
|
||||
// 初始化继电器柜 UID
|
||||
func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *relayUidStructure {
|
||||
rus := &relayUidStructure{
|
||||
@ -344,6 +322,8 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
|
||||
return (uidData.(*relayUidStructure)).RelayIds
|
||||
case *graphicData.EsbButton:
|
||||
return (uidData.(*stationUidStructure)).ButtonIds
|
||||
case *graphicData.Station:
|
||||
return (uidData.(*stationUidStructure)).StationIds
|
||||
default:
|
||||
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
|
||||
}
|
||||
@ -366,21 +346,3 @@ func QueryUidByMidAndComId(mapId int32, comId string, m interface{}) string {
|
||||
}
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)})
|
||||
}
|
||||
|
||||
// 根据地图、车站CODE、设备类型获取UID集合
|
||||
func QueryIBPUidMapByType(mapId int32, station string) map[string]*elementIdStructure {
|
||||
uidData, ok := giUidMap.Load(mapId)
|
||||
if !ok {
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)})
|
||||
}
|
||||
return (uidData.(*stationUidStructure)).IBPIds[station]
|
||||
}
|
||||
|
||||
// 根据地图的comId获取UID
|
||||
func QueryIBPUidByMidAndComId(mapId int32, comId, station string) string {
|
||||
uidMap := QueryIBPUidMapByType(mapId, station)
|
||||
if uidMap[comId] != nil {
|
||||
return uidMap[comId].Uid
|
||||
}
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)})
|
||||
}
|
||||
|
50
ats/verify/simulation/wayside/memory/wayside_memory_psd.go
Normal file
50
ats/verify/simulation/wayside/memory/wayside_memory_psd.go
Normal file
@ -0,0 +1,50 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
// 获取所有的列车信息
|
||||
func GetMapAllPsdState(vs *VerifySimulation, mapId int32) []*state.PsdState {
|
||||
world := vs.GetSimulationWorld()
|
||||
uidStructure := queryUidStructure[*stationUidStructure](mapId)
|
||||
data := QueryGiData[*graphicData.RtssGraphicStorage](mapId)
|
||||
var psdStateArr []*state.PsdState
|
||||
for _, door := range data.ScreenDoors {
|
||||
uid := uidStructure.PsdIds[door.Common.Id].Uid
|
||||
psdEntry, ok := entity.GetEntityByUid(world, uid)
|
||||
if ok {
|
||||
var amount int32
|
||||
psdState := component.PsdStateType.Get(psdEntry)
|
||||
if psdState.Km8 {
|
||||
amount = 8
|
||||
} else if psdState.Km4 {
|
||||
amount = 4
|
||||
} else {
|
||||
amount = 0
|
||||
}
|
||||
start, end := getStartEndCodeByGroup(door, amount)
|
||||
var openSubDoor []int32
|
||||
for i := start; i <= end; i++ {
|
||||
openSubDoor = append(openSubDoor, i)
|
||||
}
|
||||
psdStateArr = append(psdStateArr, &state.PsdState{
|
||||
Id: door.Common.Id,
|
||||
OpenDoorCodes: openSubDoor,
|
||||
})
|
||||
}
|
||||
}
|
||||
return psdStateArr
|
||||
}
|
||||
|
||||
func getStartEndCodeByGroup(door *graphicData.ScreenDoor, groupAmount int32) (int32, int32) {
|
||||
for _, group := range door.ScreenDoorGroupList {
|
||||
if group.TrainGroupAmount == groupAmount {
|
||||
return group.StartSmallDoor, group.EndSmallDoor
|
||||
}
|
||||
}
|
||||
return 0, -1
|
||||
}
|
16
ats/verify/simulation/wayside/memory/wayside_memory_psl.go
Normal file
16
ats/verify/simulation/wayside/memory/wayside_memory_psl.go
Normal file
@ -0,0 +1,16 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
)
|
||||
|
||||
// 操作IBP按钮
|
||||
func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId, btnCode string, pressDown bool) {
|
||||
uid := queryUidStructure[*stationUidStructure](mapId)
|
||||
gateBoxUid := uid.GateBoxIds[gateBoxId].Uid
|
||||
if pressDown {
|
||||
fi.PressDownButton(sim.World, gateBoxUid+"_"+btnCode)
|
||||
} else {
|
||||
fi.PressUpButton(sim.World, gateBoxUid+"_"+btnCode)
|
||||
}
|
||||
}
|
@ -5,8 +5,10 @@ import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/bj-rtsts-server/dto/request_proto"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/component/component_proto"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
@ -15,33 +17,109 @@ import (
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
func ChangeSignalState(simulation *VerifySimulation, mapId int32, signalDeviceId string, toAspect state.Signal_Aspect) {
|
||||
signalUid := QueryUidByMidAndComId(mapId, signalDeviceId, &graphicData.Signal{})
|
||||
func ChangeSignalState(simulation *VerifySimulation, req *dto.SignalOperationReqDto) {
|
||||
signalUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Signal{})
|
||||
signalModel, err := simulation.Repo.FindModel(signalUid, proto.DeviceType_DeviceType_Signal)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("信号机[%s]模型不存在", signalUid))
|
||||
}
|
||||
signalGroupCode := signalModel.(*repository.Signal).Code()
|
||||
slog.Info("信号机操作", "uid", signalUid, "组合类型码", signalGroupCode)
|
||||
switch req.Operation {
|
||||
case request_proto.Signal_Display: //信号机显示信号设置
|
||||
{
|
||||
switch signalGroupCode {
|
||||
case consts.SIGNAL_2XH1:
|
||||
changeSignal2XH1State(simulation.World, signalUid, toAspect)
|
||||
changeSignal2XH1State(simulation.World, signalUid, req.Aspect)
|
||||
case consts.SIGNAL_3XH1:
|
||||
changeSignal3XH1State(simulation.World, signalUid, toAspect)
|
||||
changeSignal3XH1State(simulation.World, signalUid, req.Aspect)
|
||||
case consts.SIGNAL_3XH2:
|
||||
changeSignal3XH2State(simulation.World, signalUid, toAspect)
|
||||
changeSignal3XH2State(simulation.World, signalUid, req.Aspect)
|
||||
case consts.SIGNAL_3XH3:
|
||||
changeSignal3XH3State(simulation.World, signalUid, toAspect)
|
||||
changeSignal3XH3State(simulation.World, signalUid, req.Aspect)
|
||||
case consts.SIGNAL_3XH4:
|
||||
changeSignal3XH4State(simulation.World, signalUid, toAspect)
|
||||
changeSignal3XH4State(simulation.World, signalUid, req.Aspect)
|
||||
case consts.SIGNAL_DCXH:
|
||||
changeSignalDCXHState(simulation.World, signalUid, toAspect)
|
||||
changeSignalDCXHState(simulation.World, signalUid, req.Aspect)
|
||||
case consts.SIGNAL_JCKXH:
|
||||
changeSignalJCKXHState(simulation.World, signalUid, toAspect)
|
||||
changeSignalJCKXHState(simulation.World, signalUid, req.Aspect)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: fmt.Sprintf("操作[%s]的信号机,无法识别组合类型[%s]", signalUid, signalGroupCode)})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightHFaultDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_H, component_proto.Signal_DS, true)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightHCancelDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_H, component_proto.Signal_DS, false)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightLFaultDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_L, component_proto.Signal_DS, true)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightLCancelDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_L, component_proto.Signal_DS, false)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightUFaultDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_U, component_proto.Signal_DS, true)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightUCancelDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_U, component_proto.Signal_DS, false)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightAFaultDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_A, component_proto.Signal_DS, true)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightACancelDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_A, component_proto.Signal_DS, false)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightBFaultDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_B, component_proto.Signal_DS, true)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
case request_proto.Signal_LightBCancelDs:
|
||||
{
|
||||
e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_B, component_proto.Signal_DS, false)
|
||||
if e != nil {
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
func changeSignalJCKXHState(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
switch toAspect {
|
||||
case state.Signal_U:
|
||||
|
@ -38,14 +38,6 @@ func AddTrainState(vs *VerifySimulation, status *state.TrainState, mapId int32)
|
||||
Up: status.Up,
|
||||
TrainLength: uint16(status.TrainLength),
|
||||
})
|
||||
// httpCode, _, err := dynamics.SendInitTrainReq(&dynamics.InitTrainInfo{
|
||||
// TrainIndex: uint16(trainIndex),
|
||||
// LinkIndex: uint16(linkId),
|
||||
// LinkOffset: uint32(loffset),
|
||||
// Speed: uint16(math.Round(float64(status.Speed * 10))),
|
||||
// Up: status.Up,
|
||||
// TrainLength: uint16(status.TrainLength),
|
||||
// })
|
||||
slog.Debug("添加列车", "trainIndex", trainIndex, "HeadDeviceId", status.HeadDeviceId, "HeadOffset", status.HeadOffset)
|
||||
slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset)
|
||||
if err != nil {
|
||||
|
@ -14,16 +14,6 @@ import (
|
||||
"joylink.club/bj-rtsts-server/dto/request_proto"
|
||||
)
|
||||
|
||||
// 道岔相关道岔操作方法
|
||||
func ChangeTurnoutState(simulation *VerifySimulation, status *state.SwitchState, mapId int32) {
|
||||
uid := QueryUidByMidAndComId(mapId, status.Id, &graphicData.Turnout{})
|
||||
if status.Normal {
|
||||
fi.DriveTurnoutDCOn(simulation.World, uid)
|
||||
} else if status.Reverse {
|
||||
fi.DriveTurnoutFCOn(simulation.World, uid)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理道岔操作
|
||||
func HandleTurnoutOperation(simulation *VerifySimulation, req *request_proto.TurnoutOperationReq) {
|
||||
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Turnout{})
|
||||
|
@ -9,6 +9,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
|
||||
rtss_simulation "joylink.club/rtsssimulation"
|
||||
|
||||
@ -16,8 +20,9 @@ import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
"joylink.club/bj-rtsts-server/third_party/deprecated/vobc"
|
||||
"joylink.club/bj-rtsts-server/third_party/dynamics"
|
||||
"joylink.club/bj-rtsts-server/third_party/message"
|
||||
"joylink.club/bj-rtsts-server/third_party/semi_physical_train"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/repository"
|
||||
"joylink.club/rtsssimulation/repository/model/proto"
|
||||
@ -149,6 +154,7 @@ func (s *VerifySimulation) GetAllState(mapId int32) *state.PushedDevicesStatus {
|
||||
TrainState: GetAllTrainState(s),
|
||||
SignalState: GetMapAllSignalState(s, mapId),
|
||||
ButtonState: GetMapAllStationButtonState(s, mapId),
|
||||
PsdState: GetMapAllPsdState(s, mapId),
|
||||
},
|
||||
}
|
||||
case graphicData.PictureType_RelayCabinetLayout:
|
||||
@ -164,19 +170,40 @@ func (s *VerifySimulation) GetAllState(mapId int32) *state.PushedDevicesStatus {
|
||||
|
||||
// 获取门控箱状态
|
||||
func (s *VerifySimulation) GetAllPSLState(mapId int32, boxId string) *state.PushedDevicesStatus {
|
||||
world := s.GetSimulationWorld()
|
||||
uidStructure := queryUidStructure[*stationUidStructure](mapId)
|
||||
boxUid := uidStructure.GateBoxIds[boxId].Uid
|
||||
mkxEntry, ok := entity.GetEntityByUid(world, boxUid)
|
||||
var buttonStateArr []*state.ButtonState
|
||||
if ok {
|
||||
mkxCircuit := component.MkxCircuitType.Get(mkxEntry)
|
||||
var boxArr []*ecs.Entry
|
||||
boxArr = append(boxArr, mkxCircuit.PcbList...)
|
||||
boxArr = append(boxArr, mkxCircuit.PobList...)
|
||||
boxArr = append(boxArr, mkxCircuit.PabList...)
|
||||
for _, mkxBoxEntry := range boxArr {
|
||||
mkxBox := component.MkxBoxType.Get(mkxBoxEntry)
|
||||
uid := component.UidType.Get(mkxBox.Btn).Id
|
||||
down := component.BitStateType.Get(mkxBox.Btn).Val
|
||||
buttonStateArr = append(buttonStateArr, &state.ButtonState{
|
||||
Id: uid,
|
||||
Down: down,
|
||||
})
|
||||
}
|
||||
}
|
||||
return &state.PushedDevicesStatus{
|
||||
All: true,
|
||||
AllStatus: &state.AllDevicesStatus{
|
||||
ButtonState: []*state.ButtonState{},
|
||||
ButtonState: buttonStateArr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 获取车站IBP状态
|
||||
func (s *VerifySimulation) GetAllIBPState(mapId int32, stationCode string) *state.PushedDevicesStatus {
|
||||
func (s *VerifySimulation) GetAllIBPState(mapId int32, stationId string, ibpMapCode string) *state.PushedDevicesStatus {
|
||||
return &state.PushedDevicesStatus{
|
||||
All: true,
|
||||
AllStatus: GetMapAllIBPState(s, mapId, stationCode),
|
||||
AllStatus: GetMapAllIBPState(s, mapId, stationId, ibpMapCode),
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,18 +314,18 @@ func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainIn
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
trainState := sta.(*state.TrainState)
|
||||
// 给半实物仿真发送速度
|
||||
vobc.SendTrainSpeedTask(math.Abs(float64(info.Speed * 36)))
|
||||
semi_physical_train.Default().SendTrainControlMessage(info)
|
||||
// 更新列车状态
|
||||
UpdateTrainState(s, convert(info, trainState, s))
|
||||
UpdateTrainState(s, convert(info, sta.(*state.TrainState), s))
|
||||
}
|
||||
|
||||
func convert(info *message.DynamicsTrainInfo, sta *state.TrainState, simulation *VerifySimulation) *state.TrainState {
|
||||
delayTime := time.Now().UnixMilli() - sta.VobcState.UpdateTime
|
||||
sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime
|
||||
slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
|
||||
id, port, offset, runDirection, pointTo, kilometer := QueryDeviceByCalcLink(simulation.Repo, strconv.Itoa(int(info.Link)), int64(info.LinkOffset), info.Up)
|
||||
slog.Debug("处理动力学转换后的消息", "number", info.Number,
|
||||
"车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
|
||||
slog.Debug("处理动力学转换后的消息", "number", info.Number, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
|
||||
sta.HeadDeviceId = simulation.GetComIdByUid(id)
|
||||
sta.DevicePort = port
|
||||
sta.HeadOffset = offset
|
||||
@ -345,8 +372,25 @@ func speedParse(speed float32) int32 {
|
||||
}
|
||||
|
||||
// 处理半实物仿真列车控制消息
|
||||
func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(msg *message.TrainControlMsg) {
|
||||
|
||||
func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(b []byte) {
|
||||
s.Memory.Status.TrainStateMap.Range(func(_, value any) bool {
|
||||
train := value.(*state.TrainState)
|
||||
if !train.Show { // 下线列车
|
||||
return false
|
||||
}
|
||||
trainId, err := strconv.Atoi(train.Id)
|
||||
if err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
}
|
||||
d := append(b, uint8(trainId))
|
||||
// 发送给动力学
|
||||
dynamics.Default().SendTrainControlMessage(d)
|
||||
// 存放至列车中
|
||||
controlMessage := &message.TrainControlMsg{}
|
||||
controlMessage.Decode(b)
|
||||
train.VobcState = controlMessage.ControlInfo
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
|
||||
@ -378,12 +422,15 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
||||
city := relayGi.UniqueIdPrefix.City
|
||||
lineId := relayGi.UniqueIdPrefix.LineId
|
||||
station := relayGi.UniqueIdPrefix.BelongsConcentrationStation
|
||||
relayMap := make(map[string]*proto.Relay)
|
||||
for _, relay := range relayGi.Relays {
|
||||
repo.Relays = append(repo.Relays, &proto.Relay{
|
||||
repoRelay := &proto.Relay{
|
||||
Id: uidsMap.RelayIds[relay.Common.Id].Uid,
|
||||
Code: relay.Code,
|
||||
Model: convertRelayModel(relay.NewModel),
|
||||
})
|
||||
}
|
||||
repo.Relays = append(repo.Relays, repoRelay)
|
||||
relayMap[repoRelay.Id] = repoRelay
|
||||
}
|
||||
for _, pfp := range relayGi.PhaseFailureProtectors {
|
||||
repo.PhaseFailureProtectors = append(repo.PhaseFailureProtectors, &proto.PhaseFailureProtector{
|
||||
@ -403,6 +450,14 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
||||
for _, station := range repo.Stations {
|
||||
stationMap[station.Id] = station
|
||||
}
|
||||
psdMap := make(map[string]*proto.Psd)
|
||||
for _, psd := range repo.Psds {
|
||||
psdMap[psd.Id] = psd
|
||||
}
|
||||
platformMap := make(map[string]*proto.Platform)
|
||||
for _, platform := range repo.Platforms {
|
||||
platformMap[platform.Id] = platform
|
||||
}
|
||||
for _, relationship := range relayGi.DeviceRelateRelayList {
|
||||
switch relationship.DeviceType {
|
||||
case graphicData.RelatedRef_Turnout:
|
||||
@ -465,6 +520,53 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
||||
}
|
||||
station.ElectronicGroup = append(station.ElectronicGroup, d)
|
||||
}
|
||||
case graphicData.RelatedRef_ScreenDoor:
|
||||
psd, ok := psdMap[GenerateElementUid(city, lineId, nil, relationship.Code)]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
for _, group := range relationship.Combinationtypes {
|
||||
var componentIds []string
|
||||
for _, relayId := range group.RefRelays {
|
||||
if uidsMap.RelayIds[relayId] == nil {
|
||||
continue
|
||||
}
|
||||
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
|
||||
}
|
||||
psd.ElectronicComponentGroups = append(psd.ElectronicComponentGroups,
|
||||
&proto.ElectronicComponentGroup{
|
||||
Code: group.Code,
|
||||
ComponentIds: componentIds,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
//门控箱
|
||||
for _, mkx := range repo.Mkxs {
|
||||
platform := platformMap[psdMap[mkx.PsdId].GetPlatformId()]
|
||||
station := stationMap[platform.GetStationId()]
|
||||
var s string
|
||||
if strings.Contains(platform.GetCode(), "上行") {
|
||||
s = "S"
|
||||
} else if strings.Contains(platform.GetCode(), "下行") {
|
||||
s = "X"
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
for _, group := range station.ElectronicGroup {
|
||||
if group.Code == "MKX" {
|
||||
var componentIds []string
|
||||
for _, component := range group.Components {
|
||||
relay := relayMap[component.Id]
|
||||
if strings.Contains(relay.GetCode(), s) {
|
||||
componentIds = append(componentIds, relay.Id)
|
||||
}
|
||||
}
|
||||
mkx.ElectronicComponentGroups = append(mkx.ElectronicComponentGroups, &proto.ElectronicComponentGroup{
|
||||
Code: group.Code,
|
||||
ComponentIds: componentIds,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -495,6 +597,7 @@ func convertRelayModel(modelType graphicData.Relay_ModelType) proto.Relay_Model
|
||||
}
|
||||
|
||||
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
|
||||
repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem
|
||||
axleCountingMap := make(map[string]*graphicData.AxleCounting)
|
||||
uidsMap := queryUidStructure[*stationUidStructure](mapId)
|
||||
for _, data := range storage.AxleCountings {
|
||||
@ -563,6 +666,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
Km: convertKm(data.KilometerSystem),
|
||||
SectionId: sectionId,
|
||||
TurnoutPort: turnoutPort,
|
||||
Model: convertToProtoSignalModel(data.Mt),
|
||||
}
|
||||
repo.Signals = append(repo.Signals, converSignalUid(signal, uidsMap))
|
||||
}
|
||||
@ -639,7 +743,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
for _, data := range storage.Stations {
|
||||
station := &proto.Station{
|
||||
Id: uidsMap.StationIds[data.Common.Id].Uid,
|
||||
Code: data.Code,
|
||||
Code: data.StationName,
|
||||
}
|
||||
// 关联车站的设备
|
||||
refs, ok := relateMap[data.Code]
|
||||
@ -662,58 +766,115 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
}
|
||||
}
|
||||
// 处理车站关联IBP的设备
|
||||
handlerIBPDeviceToStation(uidsMap, station, repo, data.RefIbpMapCode)
|
||||
handlerIBPDeviceToStation(station, repo, data.RefIbpMapCode)
|
||||
repo.Stations = append(repo.Stations, station)
|
||||
}
|
||||
|
||||
//门控箱
|
||||
for _, data := range storage.GateBoxs {
|
||||
mkx := &proto.Mkx{
|
||||
Id: uidsMap.GateBoxIds[data.Common.Id].Uid,
|
||||
PsdId: uidsMap.PsdIds[data.RefScreenDoor].Uid,
|
||||
}
|
||||
repo.Mkxs = append(repo.Mkxs, mkx)
|
||||
pslMapId := QueryGiId(data.RefGatedBoxMapCode)
|
||||
pslStorage := QueryGiData[*graphicData.PslGraphicStorage](pslMapId)
|
||||
for _, button := range pslStorage.PslButtons {
|
||||
repoButton := &proto.Button{
|
||||
Id: mkx.Id + "_" + button.Code,
|
||||
Code: button.Code,
|
||||
ButtonType: proto.Button_Reset_Press,
|
||||
HasLight: true,
|
||||
}
|
||||
repo.Buttons = append(repo.Buttons, repoButton)
|
||||
switch button.Code {
|
||||
case "PCB":
|
||||
mkx.PcbButtonIds = append(mkx.PcbButtonIds, repoButton.Id)
|
||||
case "POB":
|
||||
mkx.PobButtonIds = append(mkx.PobButtonIds, repoButton.Id)
|
||||
case "PAB":
|
||||
mkx.PabButtonIds = append(mkx.PabButtonIds, repoButton.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
//站台
|
||||
platformMap := make(map[string]*graphicData.Platform)
|
||||
for _, data := range storage.Platforms {
|
||||
platformMap[data.Common.Id] = data
|
||||
platform := &proto.Platform{
|
||||
Id: uidsMap.PlatformIds[data.Common.Id].Uid,
|
||||
Code: data.Code,
|
||||
}
|
||||
repo.Platforms = append(repo.Platforms, platform)
|
||||
platform.StationId = uidsMap.StationIds[data.RefStationId].Uid
|
||||
platform.PhysicalSectionId = uidsMap.PhysicalSectionIds[data.RefSectionId].Uid
|
||||
}
|
||||
//屏蔽门
|
||||
for _, data := range storage.ScreenDoors {
|
||||
psd := &proto.Psd{
|
||||
Id: uidsMap.PsdIds[data.Common.Id].Uid,
|
||||
PlatformId: uidsMap.PlatformIds[data.RefPlatformId].Uid,
|
||||
}
|
||||
repo.Psds = append(repo.Psds, psd)
|
||||
}
|
||||
}
|
||||
|
||||
// 将IBP的设备关联到车站中
|
||||
func handlerIBPDeviceToStation(uidsMap *stationUidStructure, station *proto.Station, repo *proto.Repository, ibpMap string) {
|
||||
func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, ibpMap string) {
|
||||
storage := getStorageIBPMapData(ibpMap)
|
||||
if storage == nil {
|
||||
return
|
||||
}
|
||||
ibpIdMap := uidsMap.IBPIds[station.Code] // 车站对应的UID集合
|
||||
typeMap := make(map[string]proto.DeviceType) // 对应的设备类型
|
||||
deviceMap := make(map[string]*proto.ElectronicComponent) // 对应的设备类型
|
||||
for _, data := range storage.IbpButtons { // 处理按钮
|
||||
buttonType := proto.Button_NO_Reset_Press
|
||||
if data.IsSelfReset {
|
||||
buttonType = proto.Button_Reset_Press
|
||||
}
|
||||
b := &proto.Button{
|
||||
Id: ibpIdMap[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + data.Code,
|
||||
Code: data.Code,
|
||||
ButtonType: buttonType,
|
||||
HasLight: data.HasLight,
|
||||
}
|
||||
typeMap[data.Common.Id] = proto.DeviceType_DeviceType_Button
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Button,
|
||||
}
|
||||
repo.Buttons = append(repo.Buttons, b)
|
||||
}
|
||||
for _, data := range storage.IbpKeys { // 钥匙
|
||||
b := &proto.Button{
|
||||
Id: ibpIdMap[data.Common.Id].Uid,
|
||||
b := &proto.Key{
|
||||
Id: station.Id + "_" + data.Code,
|
||||
Code: data.Code,
|
||||
ButtonType: proto.Button_Key_Knob,
|
||||
Gear: 2,
|
||||
}
|
||||
typeMap[data.Common.Id] = proto.DeviceType_DeviceType_Button
|
||||
repo.Buttons = append(repo.Buttons, b)
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Key,
|
||||
}
|
||||
repo.Keys = append(repo.Keys, b)
|
||||
}
|
||||
for _, data := range storage.IbpAlarms { // 报警器
|
||||
b := &proto.Alarm{
|
||||
Id: ibpIdMap[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + data.Code,
|
||||
Code: data.Code,
|
||||
}
|
||||
typeMap[data.Common.Id] = proto.DeviceType_DeviceType_Alarm
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Alarm,
|
||||
}
|
||||
repo.Alarms = append(repo.Alarms, b)
|
||||
}
|
||||
for _, data := range storage.IbpLights { // 指示灯
|
||||
b := &proto.Light{
|
||||
Id: ibpIdMap[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + data.Code,
|
||||
Code: data.Code,
|
||||
Aspect: converIbpLightAspect(data.Color),
|
||||
}
|
||||
typeMap[data.Common.Id] = proto.DeviceType_DeviceType_Light
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Light,
|
||||
}
|
||||
repo.Lights = append(repo.Lights, b)
|
||||
}
|
||||
// 组信息
|
||||
@ -721,15 +882,12 @@ func handlerIBPDeviceToStation(uidsMap *stationUidStructure, station *proto.Stat
|
||||
for _, c := range data.Combinationtypes {
|
||||
group := &proto.ElectronicGroup{Code: c.Code}
|
||||
for _, d := range c.RefDevices {
|
||||
deviceType, ok := typeMap[d]
|
||||
deviceType, ok := deviceMap[d]
|
||||
if !ok {
|
||||
slog.Debug("IBP组合类型类型不确定id:%s", d)
|
||||
continue
|
||||
}
|
||||
group.Components = append(group.Components, &proto.ElectronicComponent{
|
||||
Id: ibpIdMap[d].Uid,
|
||||
DeviceType: deviceType,
|
||||
})
|
||||
group.Components = append(group.Components, deviceType)
|
||||
}
|
||||
station.ElectronicGroup = append(station.ElectronicGroup, group)
|
||||
}
|
||||
@ -924,8 +1082,8 @@ func findTurnoutIds(axleCountingMap map[string]*graphicData.AxleCounting, axleId
|
||||
}
|
||||
|
||||
func initWorldDeviceState(status *VerifyStatus, repo *repository.Repository) {
|
||||
initWorldTurnoutState(status, repo)
|
||||
initWorldPhysicalSectionState(status, repo)
|
||||
// initWorldTurnoutState(status, repo)
|
||||
// initWorldPhysicalSectionState(status, repo)
|
||||
}
|
||||
|
||||
// 初始化道岔状态
|
||||
@ -943,3 +1101,22 @@ func initWorldPhysicalSectionState(status *VerifyStatus, repo *repository.Reposi
|
||||
status.PhysicalSectionStateMap.Store(id, &state.SectionState{Id: id, Occupied: false, Type: state.SectionType_Physic})
|
||||
}
|
||||
}
|
||||
|
||||
func convertToProtoSignalModel(gSmt graphicData.Signal_Model) proto.Signal_Model {
|
||||
switch gSmt {
|
||||
case graphicData.Signal_HLU:
|
||||
return proto.Signal_HLU
|
||||
case graphicData.Signal_HL:
|
||||
return proto.Signal_HL
|
||||
case graphicData.Signal_HLU_FU:
|
||||
return proto.Signal_HLU_FU
|
||||
case graphicData.Signal_HLU_FL:
|
||||
return proto.Signal_HLU_FL
|
||||
case graphicData.Signal_AB:
|
||||
return proto.Signal_AB
|
||||
case graphicData.Signal_HBU:
|
||||
return proto.Signal_HBU
|
||||
default:
|
||||
panic(fmt.Sprintf("graphicData.Signal_Model[%d]无法映射到proto.Signal_Model", gSmt))
|
||||
}
|
||||
}
|
||||
|
340
docs/docs.go
340
docs/docs.go
@ -2736,6 +2736,49 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/:id/getMapKilometerRange": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取仿真地图的公里标范围",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ATS测试仿真Api"
|
||||
],
|
||||
"summary": "获取仿真地图的公里标范围",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/check/data": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -2918,11 +2961,11 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"description": "ATS测试仿真-ESB按钮操作",
|
||||
"name": "ButtonOperationReqDto",
|
||||
"name": "EsbButtonOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ButtonOperationReqDto"
|
||||
"$ref": "#/definitions/dto.EsbButtonOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -2985,7 +3028,7 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/ibp/operation": {
|
||||
"/api/v1/simulation/ibp/btn/operation": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
@ -3013,11 +3056,115 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"description": "ATS测试仿真-IBP按钮操作",
|
||||
"name": "ButtonOperationReqDto",
|
||||
"name": "IBPButtonOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ButtonOperationReqDto"
|
||||
"$ref": "#/definitions/dto.IBPButtonOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/ibp/key/operation": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "ATS测试-IBP钥匙操作",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ATS测试仿真Api"
|
||||
],
|
||||
"summary": "ATS测试-IBP钥匙操作",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "ATS测试仿真-IBP钥匙操作",
|
||||
"name": "KeyOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.KeyOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/ibp/operation": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "PSL操作",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ATS测试仿真Api"
|
||||
],
|
||||
"summary": "PSL操作",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "PSL操作",
|
||||
"name": "PslOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PslOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -4731,32 +4878,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ButtonOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"down",
|
||||
"id",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
},
|
||||
"stationCode": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.CheckMapDataReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@ -4799,6 +4920,79 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.EsbButtonOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.IBPButtonOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"buttonCode",
|
||||
"mapId",
|
||||
"simulationId",
|
||||
"stationId"
|
||||
],
|
||||
"properties": {
|
||||
"buttonCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
},
|
||||
"stationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.KeyOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mapId",
|
||||
"simulationId",
|
||||
"stationId"
|
||||
],
|
||||
"properties": {
|
||||
"gear": {
|
||||
"type": "integer"
|
||||
},
|
||||
"keyCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
},
|
||||
"stationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.LoginDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@ -4885,6 +5079,31 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PslOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"buttonCode",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"buttonCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"gateBoxId": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PublishedGiLinkDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -4971,11 +5190,17 @@ const docTemplate = `{
|
||||
"aspect",
|
||||
"id",
|
||||
"mapId",
|
||||
"operation",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"aspect": {
|
||||
"description": "当操作为Operation.Display时有效,表示显示的信号",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/state.Signal_Aspect"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
@ -4983,6 +5208,14 @@ const docTemplate = `{
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"operation": {
|
||||
"description": "信号机操作类型",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/request_proto.Signal_Operation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
}
|
||||
@ -5364,6 +5597,51 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_proto.Signal_Operation": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"Signal_Display": "显示操作,如设置绿色、设置红黄色",
|
||||
"Signal_LightACancelDs": "取消蓝灯断丝故障",
|
||||
"Signal_LightAFaultDs": "设置蓝灯断丝故障",
|
||||
"Signal_LightBCancelDs": "取消白灯断丝故障",
|
||||
"Signal_LightBFaultDs": "设置白灯断丝故障",
|
||||
"Signal_LightHCancelDs": "取消红灯断丝故障",
|
||||
"Signal_LightHFaultDs": "设置红灯断丝故障",
|
||||
"Signal_LightLCancelDs": "取消绿灯断丝故障",
|
||||
"Signal_LightLFaultDs": "设置绿灯断丝故障",
|
||||
"Signal_LightUCancelDs": "取消黄灯断丝故障",
|
||||
"Signal_LightUFaultDs": "设置黄灯断丝故障",
|
||||
"Signal_Undefined": "未定义"
|
||||
},
|
||||
"x-enum-varnames": [
|
||||
"Signal_Undefined",
|
||||
"Signal_Display",
|
||||
"Signal_LightHFaultDs",
|
||||
"Signal_LightUFaultDs",
|
||||
"Signal_LightLFaultDs",
|
||||
"Signal_LightAFaultDs",
|
||||
"Signal_LightBFaultDs",
|
||||
"Signal_LightHCancelDs",
|
||||
"Signal_LightUCancelDs",
|
||||
"Signal_LightLCancelDs",
|
||||
"Signal_LightACancelDs",
|
||||
"Signal_LightBCancelDs"
|
||||
]
|
||||
},
|
||||
"request_proto.TurnoutOperationReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -2729,6 +2729,49 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/:id/getMapKilometerRange": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取仿真地图的公里标范围",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ATS测试仿真Api"
|
||||
],
|
||||
"summary": "获取仿真地图的公里标范围",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/check/data": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -2911,11 +2954,11 @@
|
||||
},
|
||||
{
|
||||
"description": "ATS测试仿真-ESB按钮操作",
|
||||
"name": "ButtonOperationReqDto",
|
||||
"name": "EsbButtonOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ButtonOperationReqDto"
|
||||
"$ref": "#/definitions/dto.EsbButtonOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -2978,7 +3021,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/ibp/operation": {
|
||||
"/api/v1/simulation/ibp/btn/operation": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
@ -3006,11 +3049,115 @@
|
||||
},
|
||||
{
|
||||
"description": "ATS测试仿真-IBP按钮操作",
|
||||
"name": "ButtonOperationReqDto",
|
||||
"name": "IBPButtonOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ButtonOperationReqDto"
|
||||
"$ref": "#/definitions/dto.IBPButtonOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/ibp/key/operation": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "ATS测试-IBP钥匙操作",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ATS测试仿真Api"
|
||||
],
|
||||
"summary": "ATS测试-IBP钥匙操作",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "ATS测试仿真-IBP钥匙操作",
|
||||
"name": "KeyOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.KeyOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/ibp/operation": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "PSL操作",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ATS测试仿真Api"
|
||||
],
|
||||
"summary": "PSL操作",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "PSL操作",
|
||||
"name": "PslOperationReqDto",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PslOperationReqDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -4724,32 +4871,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ButtonOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"down",
|
||||
"id",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
},
|
||||
"stationCode": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.CheckMapDataReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@ -4792,6 +4913,79 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.EsbButtonOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.IBPButtonOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"buttonCode",
|
||||
"mapId",
|
||||
"simulationId",
|
||||
"stationId"
|
||||
],
|
||||
"properties": {
|
||||
"buttonCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
},
|
||||
"stationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.KeyOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mapId",
|
||||
"simulationId",
|
||||
"stationId"
|
||||
],
|
||||
"properties": {
|
||||
"gear": {
|
||||
"type": "integer"
|
||||
},
|
||||
"keyCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
},
|
||||
"stationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.LoginDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@ -4878,6 +5072,31 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PslOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"buttonCode",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"buttonCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"down": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"gateBoxId": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PublishedGiLinkDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -4964,11 +5183,17 @@
|
||||
"aspect",
|
||||
"id",
|
||||
"mapId",
|
||||
"operation",
|
||||
"simulationId"
|
||||
],
|
||||
"properties": {
|
||||
"aspect": {
|
||||
"description": "当操作为Operation.Display时有效,表示显示的信号",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/state.Signal_Aspect"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
@ -4976,6 +5201,14 @@
|
||||
"mapId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"operation": {
|
||||
"description": "信号机操作类型",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/request_proto.Signal_Operation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simulationId": {
|
||||
"type": "string"
|
||||
}
|
||||
@ -5357,6 +5590,51 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_proto.Signal_Operation": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"Signal_Display": "显示操作,如设置绿色、设置红黄色",
|
||||
"Signal_LightACancelDs": "取消蓝灯断丝故障",
|
||||
"Signal_LightAFaultDs": "设置蓝灯断丝故障",
|
||||
"Signal_LightBCancelDs": "取消白灯断丝故障",
|
||||
"Signal_LightBFaultDs": "设置白灯断丝故障",
|
||||
"Signal_LightHCancelDs": "取消红灯断丝故障",
|
||||
"Signal_LightHFaultDs": "设置红灯断丝故障",
|
||||
"Signal_LightLCancelDs": "取消绿灯断丝故障",
|
||||
"Signal_LightLFaultDs": "设置绿灯断丝故障",
|
||||
"Signal_LightUCancelDs": "取消黄灯断丝故障",
|
||||
"Signal_LightUFaultDs": "设置黄灯断丝故障",
|
||||
"Signal_Undefined": "未定义"
|
||||
},
|
||||
"x-enum-varnames": [
|
||||
"Signal_Undefined",
|
||||
"Signal_Display",
|
||||
"Signal_LightHFaultDs",
|
||||
"Signal_LightUFaultDs",
|
||||
"Signal_LightLFaultDs",
|
||||
"Signal_LightAFaultDs",
|
||||
"Signal_LightBFaultDs",
|
||||
"Signal_LightHCancelDs",
|
||||
"Signal_LightUCancelDs",
|
||||
"Signal_LightLCancelDs",
|
||||
"Signal_LightACancelDs",
|
||||
"Signal_LightBCancelDs"
|
||||
]
|
||||
},
|
||||
"request_proto.TurnoutOperationReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -60,24 +60,6 @@ definitions:
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
dto.ButtonOperationReqDto:
|
||||
properties:
|
||||
down:
|
||||
type: boolean
|
||||
id:
|
||||
type: string
|
||||
mapId:
|
||||
type: integer
|
||||
simulationId:
|
||||
type: string
|
||||
stationCode:
|
||||
type: string
|
||||
required:
|
||||
- down
|
||||
- id
|
||||
- mapId
|
||||
- simulationId
|
||||
type: object
|
||||
dto.CheckMapDataReqDto:
|
||||
properties:
|
||||
data:
|
||||
@ -105,6 +87,56 @@ definitions:
|
||||
title:
|
||||
type: string
|
||||
type: object
|
||||
dto.EsbButtonOperationReqDto:
|
||||
properties:
|
||||
down:
|
||||
type: boolean
|
||||
id:
|
||||
type: string
|
||||
mapId:
|
||||
type: integer
|
||||
simulationId:
|
||||
type: string
|
||||
required:
|
||||
- id
|
||||
- mapId
|
||||
- simulationId
|
||||
type: object
|
||||
dto.IBPButtonOperationReqDto:
|
||||
properties:
|
||||
buttonCode:
|
||||
type: string
|
||||
down:
|
||||
type: boolean
|
||||
mapId:
|
||||
type: integer
|
||||
simulationId:
|
||||
type: string
|
||||
stationId:
|
||||
type: string
|
||||
required:
|
||||
- buttonCode
|
||||
- mapId
|
||||
- simulationId
|
||||
- stationId
|
||||
type: object
|
||||
dto.KeyOperationReqDto:
|
||||
properties:
|
||||
gear:
|
||||
type: integer
|
||||
keyCode:
|
||||
type: string
|
||||
mapId:
|
||||
type: integer
|
||||
simulationId:
|
||||
type: string
|
||||
stationId:
|
||||
type: string
|
||||
required:
|
||||
- mapId
|
||||
- simulationId
|
||||
- stationId
|
||||
type: object
|
||||
dto.LoginDto:
|
||||
properties:
|
||||
account:
|
||||
@ -165,6 +197,23 @@ definitions:
|
||||
$ref: '#/definitions/dto.TrainSizeDto'
|
||||
type: array
|
||||
type: object
|
||||
dto.PslOperationReqDto:
|
||||
properties:
|
||||
buttonCode:
|
||||
type: string
|
||||
down:
|
||||
type: boolean
|
||||
gateBoxId:
|
||||
type: string
|
||||
mapId:
|
||||
type: integer
|
||||
simulationId:
|
||||
type: string
|
||||
required:
|
||||
- buttonCode
|
||||
- mapId
|
||||
- simulationId
|
||||
type: object
|
||||
dto.PublishedGiLinkDto:
|
||||
properties:
|
||||
category:
|
||||
@ -223,17 +272,24 @@ definitions:
|
||||
dto.SignalOperationReqDto:
|
||||
properties:
|
||||
aspect:
|
||||
$ref: '#/definitions/state.Signal_Aspect'
|
||||
allOf:
|
||||
- $ref: '#/definitions/state.Signal_Aspect'
|
||||
description: 当操作为Operation.Display时有效,表示显示的信号
|
||||
id:
|
||||
type: string
|
||||
mapId:
|
||||
type: integer
|
||||
operation:
|
||||
allOf:
|
||||
- $ref: '#/definitions/request_proto.Signal_Operation'
|
||||
description: 信号机操作类型
|
||||
simulationId:
|
||||
type: string
|
||||
required:
|
||||
- aspect
|
||||
- id
|
||||
- mapId
|
||||
- operation
|
||||
- simulationId
|
||||
type: object
|
||||
dto.SimulationCreateReqDto:
|
||||
@ -503,6 +559,47 @@ definitions:
|
||||
description: 名称
|
||||
type: string
|
||||
type: object
|
||||
request_proto.Signal_Operation:
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
- 8
|
||||
- 9
|
||||
- 10
|
||||
- 11
|
||||
type: integer
|
||||
x-enum-comments:
|
||||
Signal_Display: 显示操作,如设置绿色、设置红黄色
|
||||
Signal_LightACancelDs: 取消蓝灯断丝故障
|
||||
Signal_LightAFaultDs: 设置蓝灯断丝故障
|
||||
Signal_LightBCancelDs: 取消白灯断丝故障
|
||||
Signal_LightBFaultDs: 设置白灯断丝故障
|
||||
Signal_LightHCancelDs: 取消红灯断丝故障
|
||||
Signal_LightHFaultDs: 设置红灯断丝故障
|
||||
Signal_LightLCancelDs: 取消绿灯断丝故障
|
||||
Signal_LightLFaultDs: 设置绿灯断丝故障
|
||||
Signal_LightUCancelDs: 取消黄灯断丝故障
|
||||
Signal_LightUFaultDs: 设置黄灯断丝故障
|
||||
Signal_Undefined: 未定义
|
||||
x-enum-varnames:
|
||||
- Signal_Undefined
|
||||
- Signal_Display
|
||||
- Signal_LightHFaultDs
|
||||
- Signal_LightUFaultDs
|
||||
- Signal_LightLFaultDs
|
||||
- Signal_LightAFaultDs
|
||||
- Signal_LightBFaultDs
|
||||
- Signal_LightHCancelDs
|
||||
- Signal_LightUCancelDs
|
||||
- Signal_LightLCancelDs
|
||||
- Signal_LightACancelDs
|
||||
- Signal_LightBCancelDs
|
||||
request_proto.Turnout_Operation:
|
||||
enum:
|
||||
- 0
|
||||
@ -2309,6 +2406,33 @@ paths:
|
||||
summary: 从发布数据拉取信息到草稿
|
||||
tags:
|
||||
- 发布的图形数据Api
|
||||
/api/v1/simulation/:id/getMapKilometerRange:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 获取仿真地图的公里标范围
|
||||
parameters:
|
||||
- description: JWT Token
|
||||
in: header
|
||||
name: Authorization
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 获取仿真地图的公里标范围
|
||||
tags:
|
||||
- ATS测试仿真Api
|
||||
/api/v1/simulation/check/data:
|
||||
post:
|
||||
consumes:
|
||||
@ -2420,10 +2544,10 @@ paths:
|
||||
type: string
|
||||
- description: ATS测试仿真-ESB按钮操作
|
||||
in: body
|
||||
name: ButtonOperationReqDto
|
||||
name: EsbButtonOperationReqDto
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ButtonOperationReqDto'
|
||||
$ref: '#/definitions/dto.EsbButtonOperationReqDto'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -2467,7 +2591,7 @@ paths:
|
||||
summary: 获取仿真信息更新通道名称
|
||||
tags:
|
||||
- ATS测试仿真Api
|
||||
/api/v1/simulation/ibp/operation:
|
||||
/api/v1/simulation/ibp/btn/operation:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
@ -2480,10 +2604,10 @@ paths:
|
||||
type: string
|
||||
- description: ATS测试仿真-IBP按钮操作
|
||||
in: body
|
||||
name: ButtonOperationReqDto
|
||||
name: IBPButtonOperationReqDto
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ButtonOperationReqDto'
|
||||
$ref: '#/definitions/dto.IBPButtonOperationReqDto'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -2500,6 +2624,72 @@ paths:
|
||||
summary: ATS测试-IBP按钮操作
|
||||
tags:
|
||||
- ATS测试仿真Api
|
||||
/api/v1/simulation/ibp/key/operation:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: ATS测试-IBP钥匙操作
|
||||
parameters:
|
||||
- description: JWT Token
|
||||
in: header
|
||||
name: Authorization
|
||||
required: true
|
||||
type: string
|
||||
- description: ATS测试仿真-IBP钥匙操作
|
||||
in: body
|
||||
name: KeyOperationReqDto
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.KeyOperationReqDto'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: ATS测试-IBP钥匙操作
|
||||
tags:
|
||||
- ATS测试仿真Api
|
||||
/api/v1/simulation/ibp/operation:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: PSL操作
|
||||
parameters:
|
||||
- description: JWT Token
|
||||
in: header
|
||||
name: Authorization
|
||||
required: true
|
||||
type: string
|
||||
- description: PSL操作
|
||||
in: body
|
||||
name: PslOperationReqDto
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PslOperationReqDto'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: PSL操作
|
||||
tags:
|
||||
- ATS测试仿真Api
|
||||
/api/v1/simulation/list:
|
||||
get:
|
||||
consumes:
|
||||
|
@ -19,6 +19,7 @@ const (
|
||||
QueryDBError = 5000
|
||||
|
||||
OperationOfSignalNotSupported = 6000
|
||||
OperationOfSignalError = 6001
|
||||
)
|
||||
|
||||
var ErrorTipMap = map[int]string{
|
||||
@ -31,4 +32,5 @@ var ErrorTipMap = map[int]string{
|
||||
NoAuthOperationError: "无权限操作",
|
||||
QueryDBError: "数据库操作错误",
|
||||
OperationOfSignalNotSupported: "信号机不支持该操作",
|
||||
OperationOfSignalError: "信号机操作异常",
|
||||
}
|
||||
|
@ -88,6 +88,83 @@ func (Turnout_Operation) EnumDescriptor() ([]byte, []int) {
|
||||
return file_request_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
// 信号机操作
|
||||
type Signal_Operation int32
|
||||
|
||||
const (
|
||||
Signal_Undefined Signal_Operation = 0 // 未定义
|
||||
Signal_Display Signal_Operation = 1 //显示操作,如设置绿色、设置红黄色
|
||||
Signal_LightHFaultDs Signal_Operation = 2 //设置红灯断丝故障
|
||||
Signal_LightUFaultDs Signal_Operation = 3 //设置黄灯断丝故障
|
||||
Signal_LightLFaultDs Signal_Operation = 4 //设置绿灯断丝故障
|
||||
Signal_LightAFaultDs Signal_Operation = 5 //设置蓝灯断丝故障
|
||||
Signal_LightBFaultDs Signal_Operation = 6 //设置白灯断丝故障
|
||||
Signal_LightHCancelDs Signal_Operation = 7 //取消红灯断丝故障
|
||||
Signal_LightUCancelDs Signal_Operation = 8 //取消黄灯断丝故障
|
||||
Signal_LightLCancelDs Signal_Operation = 9 //取消绿灯断丝故障
|
||||
Signal_LightACancelDs Signal_Operation = 10 //取消蓝灯断丝故障
|
||||
Signal_LightBCancelDs Signal_Operation = 11 //取消白灯断丝故障
|
||||
)
|
||||
|
||||
// Enum value maps for Signal_Operation.
|
||||
var (
|
||||
Signal_Operation_name = map[int32]string{
|
||||
0: "Undefined",
|
||||
1: "Display",
|
||||
2: "LightHFaultDs",
|
||||
3: "LightUFaultDs",
|
||||
4: "LightLFaultDs",
|
||||
5: "LightAFaultDs",
|
||||
6: "LightBFaultDs",
|
||||
7: "LightHCancelDs",
|
||||
8: "LightUCancelDs",
|
||||
9: "LightLCancelDs",
|
||||
10: "LightACancelDs",
|
||||
11: "LightBCancelDs",
|
||||
}
|
||||
Signal_Operation_value = map[string]int32{
|
||||
"Undefined": 0,
|
||||
"Display": 1,
|
||||
"LightHFaultDs": 2,
|
||||
"LightUFaultDs": 3,
|
||||
"LightLFaultDs": 4,
|
||||
"LightAFaultDs": 5,
|
||||
"LightBFaultDs": 6,
|
||||
"LightHCancelDs": 7,
|
||||
"LightUCancelDs": 8,
|
||||
"LightLCancelDs": 9,
|
||||
"LightACancelDs": 10,
|
||||
"LightBCancelDs": 11,
|
||||
}
|
||||
)
|
||||
|
||||
func (x Signal_Operation) Enum() *Signal_Operation {
|
||||
p := new(Signal_Operation)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x Signal_Operation) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (Signal_Operation) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (Signal_Operation) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x Signal_Operation) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Signal_Operation.Descriptor instead.
|
||||
func (Signal_Operation) EnumDescriptor() ([]byte, []int) {
|
||||
return file_request_proto_rawDescGZIP(), []int{2, 0}
|
||||
}
|
||||
|
||||
// 道岔
|
||||
type Turnout struct {
|
||||
state protoimpl.MessageState
|
||||
@ -199,6 +276,45 @@ func (x *TurnoutOperationReq) GetOperation() Turnout_Operation {
|
||||
return Turnout_Undefined
|
||||
}
|
||||
|
||||
// 信号机
|
||||
type Signal struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *Signal) Reset() {
|
||||
*x = Signal{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_request_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Signal) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Signal) ProtoMessage() {}
|
||||
|
||||
func (x *Signal) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_request_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Signal.ProtoReflect.Descriptor instead.
|
||||
func (*Signal) Descriptor() ([]byte, []int) {
|
||||
return file_request_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
var File_request_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_request_proto_rawDesc = []byte{
|
||||
@ -222,9 +338,24 @@ var file_request_proto_rawDesc = []byte{
|
||||
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x1a, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75,
|
||||
0x74, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f,
|
||||
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x6c, 0x22, 0xea, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0b,
|
||||
0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c,
|
||||
0x69, 0x67, 0x68, 0x74, 0x48, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x02, 0x12, 0x11,
|
||||
0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10,
|
||||
0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x46, 0x61, 0x75, 0x6c, 0x74,
|
||||
0x44, 0x73, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41, 0x46, 0x61,
|
||||
0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74,
|
||||
0x42, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69,
|
||||
0x67, 0x68, 0x74, 0x48, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x07, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73,
|
||||
0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x43, 0x61, 0x6e, 0x63,
|
||||
0x65, 0x6c, 0x44, 0x73, 0x10, 0x09, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41,
|
||||
0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0a, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69,
|
||||
0x67, 0x68, 0x74, 0x42, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0b, 0x42, 0x15,
|
||||
0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -239,12 +370,14 @@ func file_request_proto_rawDescGZIP() []byte {
|
||||
return file_request_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_request_proto_goTypes = []interface{}{
|
||||
(Turnout_Operation)(0), // 0: request.Turnout.Operation
|
||||
(*Turnout)(nil), // 1: request.Turnout
|
||||
(*TurnoutOperationReq)(nil), // 2: request.TurnoutOperationReq
|
||||
(Signal_Operation)(0), // 1: request.Signal.Operation
|
||||
(*Turnout)(nil), // 2: request.Turnout
|
||||
(*TurnoutOperationReq)(nil), // 3: request.TurnoutOperationReq
|
||||
(*Signal)(nil), // 4: request.Signal
|
||||
}
|
||||
var file_request_proto_depIdxs = []int32{
|
||||
0, // 0: request.TurnoutOperationReq.operation:type_name -> request.Turnout.Operation
|
||||
@ -285,14 +418,26 @@ func file_request_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_request_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Signal); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_request_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 2,
|
||||
NumEnums: 2,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -1,6 +1,9 @@
|
||||
package dto
|
||||
|
||||
import "joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/bj-rtsts-server/dto/request_proto"
|
||||
)
|
||||
|
||||
// 创建仿真请求
|
||||
type SimulationCreateReqDto struct {
|
||||
@ -74,15 +77,39 @@ type SignalOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
DeviceId string `form:"id" json:"id" binding:"required"`
|
||||
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"`
|
||||
Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型
|
||||
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效,表示显示的信号
|
||||
}
|
||||
|
||||
type ButtonOperationReqDto struct {
|
||||
type EsbButtonOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
Station string `form:"stationCode" json:"stationCode"`
|
||||
Id string `form:"id" json:"id" binding:"required"`
|
||||
Down bool `form:"down" json:"down" binding:"required"`
|
||||
Down bool `form:"down" json:"down"`
|
||||
}
|
||||
|
||||
type IBPButtonOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
StationId string `form:"stationId" json:"stationId" binding:"required"`
|
||||
ButtonCode string `form:"buttonCode" json:"buttonCode" binding:"required"`
|
||||
Down bool `form:"down" json:"down"`
|
||||
}
|
||||
|
||||
type PslOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
GateBoxId string `form:"gateBoxId" json:"gateBoxId"`
|
||||
ButtonCode string `form:"buttonCode" json:"buttonCode" binding:"required"`
|
||||
Down bool `form:"down" json:"down"`
|
||||
}
|
||||
|
||||
type KeyOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
StationId string `form:"stationId" json:"stationId" binding:"required"`
|
||||
KeyCode string `form:"keyCode" json:"keyCode"`
|
||||
Gear int32 `form:"gear" json:"gear"`
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,7 +38,7 @@ func (t *SimulationIBPServer) onTick() []TopicMsg {
|
||||
idStr := strconv.Itoa(int(mapId))
|
||||
for _, station := range mapData.Stations {
|
||||
channelName := handlerIBPChannelName(v.SimulationId, idStr, station.Common.Id, t.getChannelName())
|
||||
b, err := proto.Marshal(v.GetAllIBPState(mapId, station.Code))
|
||||
b, err := proto.Marshal(v.GetAllIBPState(mapId, station.Common.Id, station.RefIbpMapCode))
|
||||
if err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})
|
||||
}
|
||||
@ -50,10 +50,10 @@ func (t *SimulationIBPServer) onTick() []TopicMsg {
|
||||
}
|
||||
|
||||
// 处理订阅通道名称
|
||||
func handlerIBPChannelName(sid, mapId, psl string, format string) string {
|
||||
func handlerIBPChannelName(sid, mapId, station string, format string) string {
|
||||
var channelName string
|
||||
channelName = strings.Replace(format, "{sid}", sid, 1)
|
||||
channelName = strings.Replace(channelName, "{mid}", mapId, 1)
|
||||
channelName = strings.Replace(channelName, "{psl}", psl, 1)
|
||||
channelName = strings.Replace(channelName, "{station}", station, 1)
|
||||
return channelName
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/memory"
|
||||
@ -11,6 +12,8 @@ import (
|
||||
"joylink.club/bj-rtsts-server/dto/publishedGi"
|
||||
)
|
||||
|
||||
var publishMapMutex sync.Mutex
|
||||
|
||||
func PageQueryPublishedGi(req *publishedGi.PublishedGiReqDto) *dto.PageDto {
|
||||
dp := dbquery.PublishedGi
|
||||
where := dp.Where(dp.Status.Eq(1))
|
||||
@ -55,6 +58,8 @@ func GetPublishedGiById(id int) (*model.PublishedGi, error) {
|
||||
}
|
||||
|
||||
func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) {
|
||||
publishMapMutex.Lock()
|
||||
defer publishMapMutex.Unlock()
|
||||
draft := QueryDrafting(req.DraftId)
|
||||
if draft.Proto == nil || len(draft.Proto) == 0 {
|
||||
panic(fmt.Sprintf("草稿[%v]绘图数据信息为空", req.DraftId))
|
||||
|
3
third_party/message/dynamics.go
vendored
3
third_party/message/dynamics.go
vendored
@ -68,6 +68,8 @@ type DynamicsTrainInfo struct {
|
||||
TailRadarSpeed float32
|
||||
//加速度(m/s^2)
|
||||
Acceleration float32
|
||||
// 对应动力学生命周期值
|
||||
VobcLifeSignal uint16
|
||||
}
|
||||
|
||||
// 解析动力学的列车信息
|
||||
@ -93,5 +95,6 @@ func (t *DynamicsTrainInfo) Decode(buf []byte) error {
|
||||
t.HeadRadarSpeed = math.Float32frombits(binary.BigEndian.Uint32(buf[50:54]))
|
||||
t.TailRadarSpeed = math.Float32frombits(binary.BigEndian.Uint32(buf[54:58]))
|
||||
t.Acceleration = math.Float32frombits(binary.BigEndian.Uint32(buf[58:62]))
|
||||
t.VobcLifeSignal = binary.BigEndian.Uint16(buf[62:64])
|
||||
return nil
|
||||
}
|
||||
|
174
third_party/message/train_control.go
vendored
174
third_party/message/train_control.go
vendored
@ -1,99 +1,111 @@
|
||||
package message
|
||||
|
||||
import "encoding/binary"
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
)
|
||||
|
||||
// 接收到的列车控制信息
|
||||
type TrainControlMsg struct {
|
||||
//【0 1】两个字节
|
||||
// 生命信号 每个周期+1
|
||||
LifeSignal uint16
|
||||
//【2】 一个字节
|
||||
// TC1激活状态 1=激活
|
||||
Tc1Active bool
|
||||
// TC2激活状态 1=激活
|
||||
Tc2Active bool
|
||||
// 列车方向向前 1=方向向前
|
||||
DirectionForward bool
|
||||
// 列车方向向后 1=方向向后
|
||||
DirectionBackward bool
|
||||
// 列车牵引状态 1=牵引
|
||||
TractionStatus bool
|
||||
// 列车制动状态 1=制动
|
||||
BrakingStatus bool
|
||||
// 列车紧急制动状态 1=紧急制动
|
||||
EmergencyBrakingStatus bool
|
||||
// 列车折返状态(AR) 1=折返
|
||||
TurnbackStatus bool
|
||||
//【3】 一个字节
|
||||
// 跳跃状态 1=跳跃
|
||||
JumpStatus bool
|
||||
// ATO模式 1=ATO模式
|
||||
ATO bool
|
||||
// FAM模式 1=FAM模式
|
||||
FAM bool
|
||||
// CAM模式 1=CAM模式
|
||||
CAM bool
|
||||
// 牵引安全回路 1=牵引安全切除
|
||||
TractionSafetyCircuit bool
|
||||
// 停放制动状态 1=停放施加
|
||||
ParkingBrakeStatus bool
|
||||
// 保持制动状态 1=保持制动施加
|
||||
MaintainBrakeStatus bool
|
||||
//【4 5】 两个字节 列车牵引力 100=1KN
|
||||
TractionForce uint16
|
||||
//【6 7】 列车制动力 100=1KN
|
||||
BrakeForce uint16
|
||||
//【8 9】 列车载荷 100=1ton
|
||||
TrainLoad uint16
|
||||
// 【15】 一个字节
|
||||
// 列车开左门指令 1=开门
|
||||
LeftDoorOpenCommand bool
|
||||
// 列车开右门指令 1=开门
|
||||
RightDoorOpenCommand bool
|
||||
// 列车关左门指令 1=关门
|
||||
LeftDoorCloseCommand bool
|
||||
// 列车关右门指令 1=关门
|
||||
RightDoorCloseCommand bool
|
||||
// 整列车门关好 1=门关好
|
||||
AllDoorClose bool
|
||||
ControlInfo *state.TrainVobcState
|
||||
}
|
||||
|
||||
// 解析VOBC列车信息
|
||||
func (r *TrainControlMsg) DecoderVobcTrainInfo(buf []byte) *TrainControlMsg {
|
||||
r.LifeSignal = binary.BigEndian.Uint16(buf[0:2])
|
||||
func (r *TrainControlMsg) Decode(buf []byte) error {
|
||||
t := &state.TrainVobcState{}
|
||||
t.LifeSignal = int32(binary.BigEndian.Uint16(buf[0:2]))
|
||||
b2 := buf[2]
|
||||
r.Tc1Active = (b2 & (1 << 7)) != 0
|
||||
r.Tc2Active = (b2 & (1 << 6)) != 0
|
||||
r.DirectionForward = (b2 & (1 << 5)) != 0
|
||||
r.DirectionBackward = (b2 & (1 << 4)) != 0
|
||||
r.TractionStatus = (b2 & (1 << 3)) != 0
|
||||
r.BrakingStatus = (b2 & (1 << 2)) != 0
|
||||
r.EmergencyBrakingStatus = (b2 & (1 << 1)) != 0
|
||||
r.TurnbackStatus = (b2 & 1) != 0
|
||||
t.Tc1Active = (b2 & 1) != 0
|
||||
t.Tc2Active = (b2 & (1 << 1)) != 0
|
||||
t.DirectionForward = (b2 & (1 << 2)) != 0
|
||||
t.DirectionBackward = (b2 & (1 << 3)) != 0
|
||||
t.TractionStatus = (b2 & (1 << 4)) != 0
|
||||
t.BrakingStatus = (b2 & (1 << 5)) != 0
|
||||
t.EmergencyBrakingStatus = (b2 & (1 << 6)) != 0
|
||||
t.TurnbackStatus = (b2 & 7) != 0
|
||||
b3 := buf[3]
|
||||
r.JumpStatus = (b3 & (1 << 7)) != 0
|
||||
r.ATO = (b3 & (1 << 6)) != 0
|
||||
r.FAM = (b3 & (1 << 5)) != 0
|
||||
r.CAM = (b3 & (1 << 4)) != 0
|
||||
r.TractionSafetyCircuit = (b3 & (1 << 3)) != 0
|
||||
r.ParkingBrakeStatus = (b3 & (1 << 2)) != 0
|
||||
r.MaintainBrakeStatus = (b3 & (1 << 1)) != 0
|
||||
r.TractionForce = binary.BigEndian.Uint16(buf[4:6])
|
||||
r.BrakeForce = binary.BigEndian.Uint16(buf[6:8])
|
||||
r.TrainLoad = binary.BigEndian.Uint16(buf[8:10])
|
||||
t.JumpStatus = (b3 & 1) != 0
|
||||
t.Ato = (b3 & (1 << 1)) != 0
|
||||
t.Fam = (b3 & (1 << 2)) != 0
|
||||
t.Cam = (b3 & (1 << 3)) != 0
|
||||
t.TractionSafetyCircuit = (b3 & (1 << 4)) != 0
|
||||
t.ParkingBrakeStatus = (b3 & (1 << 5)) != 0
|
||||
t.MaintainBrakeStatus = (b3 & (1 << 6)) != 0
|
||||
t.TractionForce = int64(binary.BigEndian.Uint16(buf[4:6]))
|
||||
t.BrakeForce = int64(binary.BigEndian.Uint16(buf[6:8]))
|
||||
t.TrainLoad = int64(binary.BigEndian.Uint16(buf[8:10]))
|
||||
b4 := buf[15]
|
||||
r.LeftDoorOpenCommand = (b4 & (1 << 7)) != 0
|
||||
r.RightDoorOpenCommand = (b4 & (1 << 6)) != 0
|
||||
r.LeftDoorCloseCommand = (b4 & (1 << 5)) != 0
|
||||
r.RightDoorCloseCommand = (b4 & (1 << 4)) != 0
|
||||
r.AllDoorClose = (b4 & (1 << 3)) != 0
|
||||
return r
|
||||
t.LeftDoorOpenCommand = (b4 & 1) != 0
|
||||
t.RightDoorOpenCommand = (b4 & (1 << 1)) != 0
|
||||
t.LeftDoorCloseCommand = (b4 & (1 << 2)) != 0
|
||||
t.RightDoorCloseCommand = (b4 & (1 << 3)) != 0
|
||||
t.AllDoorClose = (b4 & (1 << 4)) != 0
|
||||
t.UpdateTime = time.Now().UnixMilli()
|
||||
r.ControlInfo = t
|
||||
return nil
|
||||
}
|
||||
|
||||
// 发送列车信息
|
||||
type TrainSpeedMsg struct {
|
||||
// 生命信号 每个周期+1
|
||||
LifeSignal uint16
|
||||
lifeSignal uint16
|
||||
// 列车速度 10=1km/h
|
||||
Speed uint16
|
||||
speed uint16
|
||||
// 上坡
|
||||
upslope bool
|
||||
// 坡度值 1= 1‰
|
||||
slope uint16
|
||||
// 加速度 100 = 1 m/s*s
|
||||
acceleration uint8
|
||||
// 减速度 100 = 1 m/s*s
|
||||
deceleration uint8
|
||||
// 实际运行阻力 100 = 1KN
|
||||
totalResistance uint32
|
||||
// 空气阻力 100 = 1KN
|
||||
airResistance uint32
|
||||
// 坡道阻力 100 = 1KN
|
||||
slopeResistance uint32
|
||||
// 曲线阻力 100 = 1KN
|
||||
curveResistance uint32
|
||||
}
|
||||
|
||||
func (t *TrainSpeedMsg) DynamicsDecode(info *DynamicsTrainInfo) {
|
||||
t.lifeSignal = info.LifeSignal
|
||||
t.speed = uint16(math.Abs(float64(info.Speed * 36)))
|
||||
t.upslope = info.UpSlope
|
||||
t.slope = uint16(info.Slope)
|
||||
t.totalResistance = uint32(math.Abs(float64(info.TotalResistance / 10)))
|
||||
t.airResistance = uint32(info.AirResistance / 10)
|
||||
t.slopeResistance = uint32(math.Abs(float64(info.SlopeResistance / 10)))
|
||||
t.curveResistance = uint32(info.CurveResistance / 10)
|
||||
d := math.Abs(float64(info.Acceleration * 100))
|
||||
if info.Acceleration > 0 {
|
||||
t.acceleration = uint8(d)
|
||||
} else {
|
||||
t.deceleration = uint8(d)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TrainSpeedMsg) Encode() []byte {
|
||||
var data []byte
|
||||
data = binary.BigEndian.AppendUint16(data, t.lifeSignal)
|
||||
data = binary.BigEndian.AppendUint16(data, t.speed)
|
||||
if t.upslope {
|
||||
data = append(data, 1)
|
||||
} else {
|
||||
data = append(data, 0)
|
||||
}
|
||||
// 中间预留一位
|
||||
data = append(data, 0)
|
||||
data = append(data, t.acceleration) // 加速度 100 = 1 m/s*s
|
||||
data = append(data, t.deceleration) // 减速度 100 = 1 m/s*s
|
||||
data = binary.BigEndian.AppendUint32(data, t.totalResistance) // 实际运行阻力 100 = 1KN
|
||||
data = binary.BigEndian.AppendUint32(data, t.airResistance) // 空气阻力 100 = 1KN
|
||||
data = binary.BigEndian.AppendUint32(data, t.slopeResistance) // 坡道阻力 100 = 1KN
|
||||
data = binary.BigEndian.AppendUint32(data, t.curveResistance) // 曲线阻力 100 = 1KN
|
||||
data = binary.BigEndian.AppendUint16(data, t.slope) // 坡度值 1= 1‰
|
||||
return data
|
||||
}
|
||||
|
@ -14,11 +14,13 @@ type SemiPhysicalTrain interface {
|
||||
Start(manager SemiPhysicalMessageManager)
|
||||
// 停止半实物仿真消息处理
|
||||
Stop()
|
||||
// 发送列车控制消息
|
||||
SendTrainControlMessage(info *message.DynamicsTrainInfo)
|
||||
}
|
||||
|
||||
type SemiPhysicalMessageManager interface {
|
||||
// 处理半实物仿真列车控制消息
|
||||
HandleSemiPhysicalTrainControlMsg(msg *message.TrainControlMsg)
|
||||
HandleSemiPhysicalTrainControlMsg(b []byte)
|
||||
}
|
||||
|
||||
type semiPhysicalTrainImpl struct {
|
||||
@ -28,6 +30,36 @@ type semiPhysicalTrainImpl struct {
|
||||
manager SemiPhysicalMessageManager
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) handleTrainControlMsg(b []byte) {
|
||||
handler := s.manager
|
||||
if handler != nil {
|
||||
handler.HandleSemiPhysicalTrainControlMsg(b)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) Start(manager SemiPhysicalMessageManager) {
|
||||
s.manager = manager
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) Stop() {
|
||||
s.manager = nil
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) SendTrainControlMessage(info *message.DynamicsTrainInfo) {
|
||||
sendMsg := &message.TrainSpeedMsg{}
|
||||
sendMsg.DynamicsDecode(info)
|
||||
s.trainSpeedInfoUdpClient.Send(sendMsg.Encode())
|
||||
}
|
||||
|
||||
func newSemiPhysicalTrain() SemiPhysicalTrain {
|
||||
s := &semiPhysicalTrainImpl{
|
||||
trainSpeedInfoUdpClient: udp.NewClient(fmt.Sprintf("%v:%v", config.Config.Vobc.Ip, config.Config.Vobc.RemotePort)),
|
||||
}
|
||||
s.trainControlUdpServer = udp.NewServer(fmt.Sprintf(":%d", config.Config.Vobc.LocalPort), s.handleTrainControlMsg)
|
||||
s.trainControlUdpServer.Listen()
|
||||
return s
|
||||
}
|
||||
|
||||
var _default SemiPhysicalTrain
|
||||
|
||||
func Default() SemiPhysicalTrain {
|
||||
@ -43,24 +75,3 @@ func Init() {
|
||||
}
|
||||
_default = newSemiPhysicalTrain()
|
||||
}
|
||||
|
||||
func newSemiPhysicalTrain() SemiPhysicalTrain {
|
||||
s := &semiPhysicalTrainImpl{
|
||||
trainSpeedInfoUdpClient: udp.NewClient("127.0.0.1:7777"),
|
||||
}
|
||||
s.trainControlUdpServer = udp.NewServer(fmt.Sprintf(":%d", config.Config.Dynamics.UdpLocalPort), s.handleTrainControlMsg)
|
||||
s.trainControlUdpServer.Listen()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) handleTrainControlMsg(b []byte) {
|
||||
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) Start(manager SemiPhysicalMessageManager) {
|
||||
s.manager = manager
|
||||
}
|
||||
|
||||
func (s *semiPhysicalTrainImpl) Stop() {
|
||||
s.manager = nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user