rssp axle test
This commit is contained in:
parent
d8e29e2158
commit
3f89c45891
|
@ -0,0 +1,46 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/config"
|
||||
"joylink.club/bj-rtsts-server/third_party/axle_device"
|
||||
"joylink.club/bj-rtsts-server/third_party/message"
|
||||
)
|
||||
|
||||
type CiServer interface {
|
||||
Start() error
|
||||
Stop()
|
||||
}
|
||||
type CiMessageManager interface {
|
||||
//SendSectionCmdMsg 向计轴设备发送计轴命令
|
||||
SendSectionCmdMsg(cmdMsg *message.SectionCmdMsgPack)
|
||||
//HandleSectionStatus 收到来自计轴设备的物理区段状态
|
||||
HandleSectionStatus(status []*message.SectionStatusMsg)
|
||||
}
|
||||
|
||||
// rssp 测试
|
||||
type ciServer struct {
|
||||
//所属城市
|
||||
city string
|
||||
//所属线路
|
||||
lineId string
|
||||
//所属集中站
|
||||
centralizedStation string
|
||||
//计轴区段码表
|
||||
//key-行号,value-区段id
|
||||
sectionCodes map[int]string
|
||||
//主安全通道
|
||||
rsspChannel *axle_device.RsspChannel
|
||||
}
|
||||
|
||||
func initRsspCiServer(cfg *config.RsspAxleConfig) any {
|
||||
ra := &ciServer{}
|
||||
//
|
||||
ra.city = cfg.City
|
||||
ra.lineId = cfg.LineId
|
||||
ra.centralizedStation = cfg.CentralizedStation
|
||||
//
|
||||
mrc := &axle_device.RsspChannel{}
|
||||
ra.rsspChannel = mrc.Init(&cfg.RsspCfg)
|
||||
//
|
||||
return ra
|
||||
}
|
|
@ -150,15 +150,22 @@ func (s *VerifySimulation) GetLineAllRsspAxleCfgs() []config.RsspAxleConfig {
|
|||
return s.runConfig.RsspAxleCfgs
|
||||
}
|
||||
|
||||
// CollectSectionStatus 收集仿真中计轴区段状态
|
||||
func (s *VerifySimulation) CollectSectionStatus(city string, lineId string, centralizedStation string) ([]*message.SectionStatusMsg, error) {
|
||||
// GetSectionCodePoints 获取集中站的区段码表
|
||||
func (s *VerifySimulation) GetSectionCodePoints(city string, lineId string, centralizedStation string) []*proto.CiSectionCodePoint {
|
||||
stationUid := GenerateElementUid(city, lineId, nil, centralizedStation)
|
||||
ref := s.Repo.GetCentralizedStationRef(stationUid)
|
||||
if ref == nil {
|
||||
return nil, fmt.Errorf("没有找到GetCentralizedStationRef [%s]", stationUid)
|
||||
return nil
|
||||
}
|
||||
//
|
||||
codePoints := ref.SectionCodePoints
|
||||
return ref.SectionCodePoints
|
||||
}
|
||||
|
||||
// CollectSectionStatus 收集仿真中计轴区段状态
|
||||
func (s *VerifySimulation) CollectSectionStatus(city string, lineId string, centralizedStation string) ([]*message.SectionStatusMsg, error) {
|
||||
stationUid := GenerateElementUid(city, lineId, nil, centralizedStation)
|
||||
//
|
||||
codePoints := s.GetSectionCodePoints(city, lineId, centralizedStation)
|
||||
if len(codePoints) <= 0 {
|
||||
return nil, fmt.Errorf("没有找到GetCentralizedStationRef[%s]的区段码表为空", stationUid)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue