rts-sim-testing-service/ats/verify/simulation/wayside/model/device/link_device_model.go

30 lines
748 B
Go

package device
import (
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/ref"
)
type LinkModel struct {
face.DeviceModel
//长度
Length int32
//A端连接的道岔端点
ARelatedSwitchRef *ref.SwitchRef
//B端连接的道岔端点
BRelatedSwitchRef *ref.SwitchRef
//Link上的设备及位置(包括A、B端的设备)(按offset排序)
DevicePositions []*ref.DevicePosition[face.DeviceModeller]
}
func ConvertFromDevicePort(dp *ref.DevicePort[*LinkModel]) *ref.DevicePosition[*LinkModel] {
var offset int32 = 0
if dp.Port == face.B {
offset = dp.Device.Length
}
return &ref.DevicePosition[*LinkModel]{
Device: dp.Device,
Offset: offset,
}
}