rssp axle test

This commit is contained in:
xzb 2023-11-14 10:31:06 +08:00
parent d8e29e2158
commit 3f89c45891
2 changed files with 57 additions and 4 deletions

46
third_party/example/rssp/main.go vendored Normal file
View File

@ -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
}

View File

@ -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)
}