Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtsts-server-go
This commit is contained in:
commit
6730a45c46
|
@ -1 +1 @@
|
|||
Subproject commit 085bfdc6f9afc84c0724c49441aa59d734906a6a
|
||||
Subproject commit e21995b69537f1ac0efbfeefc8517df3fbe9477e
|
|
@ -346,37 +346,24 @@ func (s *VerifySimulation) GetInterlockRunConfig() *config.InterlockConfig {
|
|||
// 采集联锁中的继电器消息
|
||||
func (s *VerifySimulation) CollectInterlockRelayInfo() []*message.InterlockSendMsgPkg {
|
||||
var msgPkgs []*message.InterlockSendMsgPkg
|
||||
for _, mapId := range s.MapIds { // 获取继电器地图信息
|
||||
if QueryOnlyGiType(mapId) != graphicData.PictureType_RelayCabinetLayout { // 继电器柜
|
||||
for _, m := range s.Repo.CentralizedList() { // 获取继电器地图信息
|
||||
if len(m.CjList) == 0 {
|
||||
continue
|
||||
}
|
||||
mapData := QueryGiData[*graphicData.RelayCabinetGraphicStorage](mapId)
|
||||
// 配置继电器为空
|
||||
dataLenght := len(mapData.CiCjList.CjList) * int(mapData.CiCjList.DsCount)
|
||||
if dataLenght == 0 {
|
||||
continue
|
||||
}
|
||||
index := 0
|
||||
collectInfo := make([]bool, dataLenght)
|
||||
uidMap := QueryUidStructure[*RelayUidStructure](mapId)
|
||||
// 遍历继电器获取继电器状态
|
||||
for _, col := range mapData.CiCjList.CjList {
|
||||
for _, row := range col.BitList {
|
||||
rs := len(row.RefRelays) > 0
|
||||
for _, j := range row.RefRelays {
|
||||
u := uidMap.RelayIds[j.RelayId]
|
||||
if u == nil {
|
||||
panic(sys_error.New(fmt.Sprintf("地图【id:%d】不存在继电器的【comId:%s】UID映射关系", mapId, j.RelayId)))
|
||||
}
|
||||
if j.Position == graphicData.CjDataItem_Q {
|
||||
rs = rs && fi.CollectXQCircuitState(s.World, u.Uid)
|
||||
} else {
|
||||
rs = rs && fi.CollectLXCircuitState(s.World, u.Uid)
|
||||
}
|
||||
}
|
||||
collectInfo[index] = rs
|
||||
index++
|
||||
collectInfo := make([]bool, len(m.CjList))
|
||||
for i, l := range m.CjList {
|
||||
if l == nil || len(l.RefRelays) == 0 {
|
||||
continue
|
||||
}
|
||||
rs := true
|
||||
for _, j := range l.RefRelays {
|
||||
if j.Position == proto.CjDataItem_Q {
|
||||
rs = rs && fi.CollectXQCircuitState(s.World, j.RelayId)
|
||||
} else {
|
||||
rs = rs && fi.CollectLXCircuitState(s.World, j.RelayId)
|
||||
}
|
||||
}
|
||||
collectInfo[i] = rs
|
||||
}
|
||||
msgPkgs = append(msgPkgs, &message.InterlockSendMsgPkg{Info: collectInfo})
|
||||
}
|
||||
|
@ -611,6 +598,99 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
|||
}
|
||||
}
|
||||
}
|
||||
// 处理该集中站采集、驱动配置信息
|
||||
centralizedStationId := GenerateElementUid(city, lineId, nil, station)
|
||||
ref := queryCentralizedStationRef(centralizedStationId, repo)
|
||||
ref.CjList = append(ref.CjList, handlerRelayGiCj(uidsMap, centralizedStationId, relayGi.CiCjList)...)
|
||||
ref.QdList = append(ref.QdList, handlerRelayGiQd(uidsMap, centralizedStationId, relayGi.CiQdList)...)
|
||||
}
|
||||
|
||||
// 查询集中站配置信息
|
||||
func queryCentralizedStationRef(stationId string, repo *proto.Repository) *proto.CentralizedStationRef {
|
||||
var ref *proto.CentralizedStationRef
|
||||
for _, r := range repo.CentralizedStationRefs {
|
||||
if r.StationId == stationId {
|
||||
ref = r
|
||||
break
|
||||
}
|
||||
}
|
||||
if ref == nil {
|
||||
ref = &proto.CentralizedStationRef{StationId: stationId}
|
||||
repo.CentralizedStationRefs = append(repo.CentralizedStationRefs, ref)
|
||||
}
|
||||
return ref
|
||||
}
|
||||
|
||||
// 处理继电器采集信息
|
||||
func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *graphicData.CiCj) []*proto.CjData {
|
||||
if ciCj == nil {
|
||||
return nil
|
||||
}
|
||||
// 采集信息
|
||||
dataLenght := len(ciCj.CjList) * int(ciCj.DsCount)
|
||||
if dataLenght == 0 {
|
||||
return nil
|
||||
}
|
||||
cjList := make([]*proto.CjData, dataLenght)
|
||||
index := 0
|
||||
for ci, col := range ciCj.CjList {
|
||||
for ri, row := range col.BitList {
|
||||
if len(row.RefRelays) == 0 {
|
||||
index++
|
||||
continue
|
||||
}
|
||||
r := &proto.CjData{Row: int32(ri), Col: int32(ci)}
|
||||
for _, j := range row.RefRelays {
|
||||
u := uidsMap.RelayIds[j.RelayId]
|
||||
if u == nil {
|
||||
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%s】UID映射关系", stationId, j.RelayId)))
|
||||
}
|
||||
d := &proto.CjDataItem{RelayId: u.Uid}
|
||||
if j.Position == graphicData.CjDataItem_H {
|
||||
d.Position = proto.CjDataItem_H
|
||||
} else {
|
||||
d.Position = proto.CjDataItem_Q
|
||||
}
|
||||
r.RefRelays = append(r.RefRelays, d)
|
||||
}
|
||||
cjList[index] = r
|
||||
index++
|
||||
}
|
||||
}
|
||||
return cjList
|
||||
}
|
||||
|
||||
// 处理继电器驱动信息
|
||||
func handlerRelayGiQd(uidsMap *RelayUidStructure, stationId string, ciQd *graphicData.CiQd) []*proto.QdData {
|
||||
if ciQd == nil {
|
||||
return nil
|
||||
}
|
||||
// 驱动信息
|
||||
dataLenght := len(ciQd.QdList) * int(ciQd.DsCount)
|
||||
if dataLenght == 0 {
|
||||
return nil
|
||||
}
|
||||
qdList := make([]*proto.QdData, dataLenght)
|
||||
index := 0
|
||||
for ci, col := range ciQd.QdList {
|
||||
for ri, row := range col.BitList {
|
||||
if len(row.RefRelays) == 0 {
|
||||
index++
|
||||
continue
|
||||
}
|
||||
r := &proto.QdData{Row: int32(ri), Col: int32(ci)}
|
||||
for _, j := range row.RefRelays {
|
||||
u := uidsMap.RelayIds[j]
|
||||
if u == nil {
|
||||
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%s】UID映射关系", stationId, j)))
|
||||
}
|
||||
r.RefRelays = append(r.RefRelays, u.Uid)
|
||||
}
|
||||
qdList[index] = r
|
||||
index++
|
||||
}
|
||||
}
|
||||
return qdList
|
||||
}
|
||||
|
||||
func convertRelayModel(modelType graphicData.Relay_ModelType) proto.Relay_Model {
|
||||
|
@ -712,6 +792,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
|||
}
|
||||
repo.Signals = append(repo.Signals, converSignalUid(signal, uidsMap))
|
||||
}
|
||||
stm := make(map[string][]string)
|
||||
for _, data := range storage.Transponders {
|
||||
var sectionId string
|
||||
var turnoutPort *proto.DevicePort
|
||||
|
@ -728,6 +809,13 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
|||
TurnoutPort: turnoutPort,
|
||||
}
|
||||
repo.Transponders = append(repo.Transponders, converTransponderUid(responder, uidsMap))
|
||||
for _, stationName := range data.CentralizedStations {
|
||||
if stm[stationName] == nil {
|
||||
stm[stationName] = []string{responder.Id}
|
||||
} else {
|
||||
stm[stationName] = append(stm[stationName], responder.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
slopeKsMap := make(map[string]*graphicData.SlopeKiloMarker)
|
||||
for _, data := range storage.SlopeKiloMarker {
|
||||
|
@ -810,6 +898,11 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
|||
// 处理车站关联IBP的设备
|
||||
handlerIBPDeviceToStation(station, repo, data.RefIbpMapCode)
|
||||
repo.Stations = append(repo.Stations, station)
|
||||
// 处理集中站的信息
|
||||
if stm[station.Code] != nil {
|
||||
ref := queryCentralizedStationRef(station.Id, repo)
|
||||
ref.TransponderId = append(ref.TransponderId, stm[station.Code]...)
|
||||
}
|
||||
}
|
||||
//门控箱
|
||||
gateBoxMap := make(map[string]*proto.Mkx)
|
||||
|
|
Loading…
Reference in New Issue