This commit is contained in:
weizhihong 2023-07-31 15:44:16 +08:00
commit 9f92c011fc
14 changed files with 179 additions and 39 deletions

View File

@ -1,4 +1,4 @@
package device
package face
import "strings"
@ -10,16 +10,21 @@ type DeviceModel struct {
Index string
}
type DeviceModeler interface {
//判断是否同一个设备
IsSame(other *DeviceModel) bool
}
//判断是否同一个设备
func (dm *DeviceModel) IsSame(other *DeviceModel) bool {
return strings.EqualFold(dm.GraphicId, other.GraphicId)
}
//模型图形id
func (dm *DeviceModel) GetGraphicId() string {
return dm.GraphicId
}
//模型索引
func (dm *DeviceModel) GetIndex() string {
return dm.Index
}
//////////////////////////////////////////////////////////////
//设备端口枚举定义
@ -31,5 +36,3 @@ const (
B
C
)
/////////////////////////////////////////////////////////////

View File

@ -0,0 +1,42 @@
package face
/////////////////////////////////////////////////////////////
//所有模型设备的接口定义,为了解决设备间相互依赖时循环依赖问题
type DeviceModeller interface {
//判断是否同一个模型
IsSame(other *DeviceModel) bool
//模型图形id
GetGraphicId() string
//模型索引
GetIndex() string
}
type AxlePointDeviceModeller interface {
DeviceModeller
}
type SignalDeviceModeller interface {
DeviceModeller
}
type SwitchDeviceModeller interface {
DeviceModeller
}
type AxleSectionModeller interface {
DeviceModeller
}
type LinkSectionModeller interface {
DeviceModeller
}
type LogicalSectionModeller interface {
DeviceModeller
}
type PhysicalSectionModeller interface {
DeviceModeller
}

View File

@ -1,11 +1,14 @@
package device
import "joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
import (
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
//计轴检测点设备模型
// 计轴检测点设备模型
type AxlePointDeviceModel struct {
//计轴检测点基本信息
DeviceModel
face.DeviceModel
//端点的公里标,单位为mm
KilometerSystem graphicData.KilometerSystem
}

View File

@ -1,14 +0,0 @@
package ref
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/device"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/device/section"
)
// link端口引用
type LinkRef struct {
//引用的轨道
LinkSection *section.LinkSectionModel
//引用的轨道的端口
Port device.PortEnum
}

View File

@ -1,10 +0,0 @@
package section
import "joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/device"
//相邻端点(车档、计轴检测点、道岔岔心)定义的Link区段
//地图做数据时link区段的A端在左link区段的B端在右即上行方向A->B,下行方向B->A
type LinkSectionModel struct {
//轨道基本信息
device.DeviceModel
}

View File

@ -1,11 +1,14 @@
package device
import "joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
import (
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
//信号机装置
// 信号机装置
type SignalDeviceModel struct {
//信号机基本信息
DeviceModel
face.DeviceModel
//信号机所在公里标,单位为mm
KilometerSystem graphicData.KilometerSystem
}

View File

@ -2,12 +2,14 @@ package device
import (
"container/list"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
// 道岔装置(规定A端为岔尖规定B端为定位端轨道C端为反位端)
type SwitchDeviceModel struct {
//道岔基本信息
DeviceModel
face.DeviceModel
//端点的公里标,单位为mm
//list中元素类型为graphicData.KilometerSystem
KilometerSystems *list.List

View File

@ -0,0 +1,13 @@
package ref
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
// link端口引用
type LinkRef struct {
//引用的轨道
LinkSection face.LogicalSectionModeller
//引用的轨道的端口
Port face.PortEnum
}

View File

@ -0,0 +1,13 @@
package ref
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
// 道岔定反位引用定义
type SwitchPositionRef struct {
//道岔设备
SwitchDevice face.SwitchDeviceModeller
//true-定位false-反位
Normal bool
}

View File

@ -0,0 +1,13 @@
package ref
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
// 道岔端口引用
type SwitchRef struct {
//道岔设备
SwitchDevice face.SwitchDeviceModeller
//道岔端口
Port face.PortEnum
}

View File

@ -0,0 +1,11 @@
package section
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
)
// 相邻计轴检测点(车档为特殊的计轴检测点)定义的计轴区段由LinkSection组成
type AxleSectionModel struct {
//计轴区段基本信息
face.DeviceModel
}

View File

@ -0,0 +1,19 @@
package section
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/ref"
)
// 相邻端点(车档、计轴检测点、道岔岔心)定义的Link区段
// 地图做数据时link区段的A端在左link区段的B端在右即上行方向A->B,下行方向B->A
type LinkSectionModel struct {
//轨道基本信息
face.DeviceModel
//true - 上行false - 下行
Up bool
//link 的A端连接道岔
SwitchRefA ref.SwitchRef
//link 的B端连接道岔
SwitchRefB ref.SwitchRef
}

View File

@ -0,0 +1,15 @@
package section
import "joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
// 逻辑区段分两种类型
// 逻辑区段(单个计轴区段、单个Link区段、计轴区段内划分的一段)
type LogicalSectionModel struct {
//逻辑区段基本信息
face.DeviceModel
//该逻辑区段所在的计轴区段
AxleSection face.AxleSectionModeller
//该逻辑区段所在的道岔(如果该逻辑区段道岔的C端关联的link)
//非岔区逻辑区段,则该字段为空
SwitchDevice face.SwitchDeviceModeller
}

View File

@ -0,0 +1,27 @@
package section
import "joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
// 物理区段(一整个计轴区段、岔区几个计轴检测点限定的区域)物理区段(一整个计轴区段、岔区几个计轴检测点限定的区域)物理区段(一整个计轴区段、岔区几个计轴检测点限定的区域)物理区段(一整个计轴区段、岔区几个计轴检测点限定的区域)物理区段(一整个计轴区段、岔区几个计轴检测点限定的区域)v
type PhysicalSectionModel struct {
//物理区段基本信息
face.DeviceModel
//true - 岔区物理区段false - 非岔区物理区段
SwitchArea bool
//限定物理区段的计轴检测点
//key-图形id
AxlePoints map[string]face.AxlePointDeviceModeller
//该物理区段中包含的所有计轴区段
//key-图形id
AxleSections map[string]face.AxleSectionModeller
}
// 添加计轴检测点
func (psm *PhysicalSectionModel) AddAxlePoint(axlePointDeviceModel face.AxlePointDeviceModeller) {
psm.AxlePoints[axlePointDeviceModel.GetGraphicId()] = axlePointDeviceModel
}
// 添加计轴区段
func (psm *PhysicalSectionModel) AddAxleSection(axleSectionModel face.AxleSectionModeller) {
psm.AxleSections[axleSectionModel.GetGraphicId()] = axleSectionModel
}