Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2c02384b4e
|
@ -28,7 +28,7 @@ func Start(vs *memory.VerifySimulation) {
|
|||
mss: []ms_api.IMsgServer{},
|
||||
}
|
||||
for _, mapId := range vs.MapIds {
|
||||
t := memory.QueryOnlyGiType(mapId)
|
||||
t := memory.QueryGiType(mapId)
|
||||
switch t {
|
||||
case graphicData.PictureType_StationLayout: // 平面布置图
|
||||
// 添加车站关联的平面布置图、IBP、PSL信息
|
||||
|
|
|
@ -9,16 +9,18 @@ type RsspAxle interface {
|
|||
Start(amm AxleMessageManager) error
|
||||
//Stop 停止计轴设备与联锁系统安全通信服务
|
||||
Stop()
|
||||
//SendStatusMsg 将计轴区段状态发生给联锁系统
|
||||
SendStatusMsg(msg *message.SectionStatusMsgPack)
|
||||
}
|
||||
|
||||
type AxleMessageManager interface {
|
||||
//HandleCmdMsg 计轴设备接收到联锁发送来的控制命令
|
||||
HandleCmdMsg(msg *message.SectionCmdMsgPack)
|
||||
//HandleSectionCmdMsg 计轴设备接收到联锁发送来的控制命令
|
||||
HandleSectionCmdMsg(centralizedStation string, msg *message.SectionCmdMsgPack)
|
||||
//CollectSectionStatus 收集仿真中计轴区段状态
|
||||
CollectSectionStatus() []*message.SectionStatusMsg
|
||||
}
|
||||
|
||||
type rsspAxle struct {
|
||||
//所属集中站
|
||||
centralizedStation string
|
||||
//主安全通道
|
||||
masterRssp *RsspChannel
|
||||
//备安全通道
|
||||
|
@ -35,7 +37,7 @@ func NewRsspAxle(masterRssp *RsspChannel, slaveRssp *RsspChannel) RsspAxle {
|
|||
func (s *rsspAxle) rcvCmdMsg(data []byte) {
|
||||
msg := &message.SectionCmdMsgPack{}
|
||||
msg.Decode(data)
|
||||
s.messageManager.HandleCmdMsg(msg)
|
||||
s.messageManager.HandleSectionCmdMsg(s.centralizedStation, msg)
|
||||
}
|
||||
func (s *rsspAxle) Start(amm AxleMessageManager) error {
|
||||
s.messageManager = amm
|
||||
|
@ -59,7 +61,9 @@ func (s *rsspAxle) Stop() {
|
|||
s.slaveRssp.Stop()
|
||||
}
|
||||
}
|
||||
func (s *rsspAxle) SendStatusMsg(msg *message.SectionStatusMsgPack) {
|
||||
|
||||
// 发送计轴区段状态给联锁
|
||||
func (s *rsspAxle) sendStatusMsg(msg *message.SectionStatusMsgPack) {
|
||||
data := msg.Encode()
|
||||
//向备通道发送
|
||||
if s.slaveRssp != nil {
|
||||
|
|
|
@ -42,6 +42,10 @@ type RsspChannel struct {
|
|||
|
||||
func (s *RsspChannel) Init(config *RsspConfig) {
|
||||
s.config = config
|
||||
s.rsspTimer = &RsspTimer{t: 0}
|
||||
s.sn = message.NewRsspSn(1)
|
||||
s.ch1Ts = message.NewRsspLFSR(message.RsspTsC1, 32, s.config.SID1, false)
|
||||
s.ch2Ts = message.NewRsspLFSR(message.RsspTsC2, 32, s.config.SID2, false)
|
||||
}
|
||||
|
||||
// Start 启动安全通道
|
||||
|
|
|
@ -78,7 +78,7 @@ func QueryGiType(mapId int32) graphicData.PictureType {
|
|||
if !ok {
|
||||
graphic, err := dbquery.PublishedGi.Debug().Where(dbquery.PublishedGi.ID.Eq(mapId)).First() // 当缓存缺失新地图时,查询一次
|
||||
if err != nil {
|
||||
panic(&dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("[mapId:%d]类型映射错误 :%v", mapId, value)})
|
||||
panic(sys_error.New(fmt.Sprintf("[mapId:%d]类型映射错误 :%v", mapId, value), err))
|
||||
}
|
||||
PublishMapVerifyStructure(graphic)
|
||||
return graphicData.PictureType(graphic.Type)
|
||||
|
@ -86,14 +86,6 @@ func QueryGiType(mapId int32) graphicData.PictureType {
|
|||
return value.(graphicData.PictureType)
|
||||
}
|
||||
|
||||
func QueryOnlyGiType(mapId int32) graphicData.PictureType {
|
||||
value, ok := giTypeMap.Load(mapId)
|
||||
if !ok {
|
||||
panic(sys_error.New(fmt.Sprintf("[mapId:%d]不存在", mapId)))
|
||||
}
|
||||
return value.(graphicData.PictureType)
|
||||
}
|
||||
|
||||
func QueryGiData[T proto.Message](mapId int32) T {
|
||||
value, _ := giDataMap.Load(mapId)
|
||||
return value.(T)
|
||||
|
|
|
@ -45,6 +45,7 @@ type deviceRelateUidPriex struct {
|
|||
deviceCode string
|
||||
typeCode string
|
||||
isStation bool
|
||||
isPSD bool
|
||||
}
|
||||
|
||||
// 获取UID的前缀信息
|
||||
|
@ -234,8 +235,9 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
|||
refMap := make(map[string]*deviceRelateUidPriex, len(data.Relays))
|
||||
for _, r := range data.DeviceRelateRelayList {
|
||||
isStation := r.DeviceType == graphicData.RelatedRef_station
|
||||
isPsd := r.DeviceType == graphicData.RelatedRef_ScreenDoor
|
||||
for _, c := range r.Combinationtypes {
|
||||
p := &deviceRelateUidPriex{deviceCode: r.Code, typeCode: c.Code, isStation: isStation}
|
||||
p := &deviceRelateUidPriex{deviceCode: r.Code, typeCode: c.Code, isStation: isStation, isPSD: isPsd}
|
||||
for _, i := range c.RefRelays {
|
||||
refMap[i] = p
|
||||
}
|
||||
|
@ -258,7 +260,7 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
|||
code = p.deviceCode + "_" + p.typeCode + "_" + r.Code
|
||||
}
|
||||
stationArr := []string{station}
|
||||
if p != nil && p.isStation {
|
||||
if p != nil && (p.isStation || p.isPSD) {
|
||||
stationArr = nil
|
||||
}
|
||||
rus.RelayIds[r.Common.Id] = &elementIdStructure{
|
||||
|
@ -274,7 +276,7 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
|||
code = p.deviceCode + "_" + p.typeCode + "_" + r.Code
|
||||
}
|
||||
stationArr := []string{station}
|
||||
if p != nil && p.isStation {
|
||||
if p != nil && (p.isStation || p.isPSD) {
|
||||
stationArr = nil
|
||||
}
|
||||
rus.RelayIds[r.Common.Id] = &elementIdStructure{
|
||||
|
|
|
@ -96,7 +96,7 @@ func NewWaysideMemory() *WaysideMemory {
|
|||
func CreateSimulation(projectId int32, mapIds []int32, runConfig *dto.ProjectRunConfigDto) (*VerifySimulation, error) {
|
||||
// 地图信息
|
||||
sort.Slice(mapIds, func(i, j int) bool {
|
||||
return QueryOnlyGiType(mapIds[i]) < QueryOnlyGiType(mapIds[j])
|
||||
return QueryGiType(mapIds[i]) < QueryGiType(mapIds[j])
|
||||
})
|
||||
verifySimulation := &VerifySimulation{
|
||||
ProjectId: projectId,
|
||||
|
@ -170,6 +170,39 @@ func (s *VerifySimulation) CollectDynamicsTurnoutInfo() []*message.DynamicsTurno
|
|||
return turnoutStates
|
||||
}
|
||||
|
||||
// HandleSectionCmdMsg 计轴设备接收到联锁发送来的控制命令
|
||||
func (s *VerifySimulation) HandleSectionCmdMsg(centralizedStation string, msg *message.SectionCmdMsgPack) {
|
||||
|
||||
}
|
||||
|
||||
// CollectSectionStatus 收集仿真中计轴区段状态
|
||||
func (s *VerifySimulation) CollectSectionStatus() []*message.SectionStatusMsg {
|
||||
var msg []*message.SectionStatusMsg
|
||||
var axleSectionIds []string
|
||||
for _, section := range s.Repo.PhysicalSectionList() {
|
||||
if is, _ := section.IsAxleSection(); is {
|
||||
axleSectionIds = append(axleSectionIds, section.Id())
|
||||
}
|
||||
}
|
||||
if len(axleSectionIds) <= 0 {
|
||||
return []*message.SectionStatusMsg{}
|
||||
} else {
|
||||
as, e := fi.FindAxleSectionsStatus(s.World, axleSectionIds)
|
||||
if e != nil { //从仿真中收集计轴区段状态的失败列表
|
||||
slog.Warn(e.Error())
|
||||
}
|
||||
for _, a := range as {
|
||||
state := &message.SectionStatusMsg{}
|
||||
state.Rac = a.Rac
|
||||
state.Rjt = a.Rjt
|
||||
state.Rjo = a.Rjo
|
||||
state.Occ = a.Occ
|
||||
state.Clr = a.Clr
|
||||
msg = append(msg, state)
|
||||
}
|
||||
return msg
|
||||
}
|
||||
}
|
||||
func handlerDynamicsTurnoutState(w ecs.World, uid string) *message.DynamicsTurnoutInfo {
|
||||
entry, ok := entity.GetEntityByUid(w, uid)
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in New Issue