无源应答器固定报文

This commit is contained in:
xzb 2023-11-23 11:17:40 +08:00
parent aa83ed7dc6
commit 7853869090
4 changed files with 40 additions and 7 deletions

View File

@ -26,6 +26,12 @@ func (t *TrainPositionInfo) ToString() string {
return fmt.Sprintf("Up=%t len=%d headLink=%s headOff=%d tailLink=%s tailOff=%d", t.Up, t.Len, t.HeadLink, t.HeadLinkOffset, t.TailLink, t.TailLinkOffset)
}
// TrainBaliseTelegram 应答器报文
type TrainBaliseTelegram struct {
BaliseId string //应答器ID
Telegram []byte //一个应答器同一时刻只有一条报文处于激活有效状态
}
// TrainBtm 列车应答器传输模块
type TrainBtm struct {
//应答器计数(每过一个应答器加一,在同一个应答器内不变)
@ -40,10 +46,8 @@ type TrainBtm struct {
ScannedBalises []*TrainBaliseTelegram
}
// TrainBaliseTelegram 应答器报文
type TrainBaliseTelegram struct {
BaliseId string //应答器ID
Telegram []byte //一个应答器同一时刻只有一条报文处于激活有效状态
func (t *TrainBtm) Scanning(aboveBalise bool, tbt *TrainBaliseTelegram) {
t.AboveBalise = aboveBalise
}
var (

9
entity/balise.go Normal file
View File

@ -0,0 +1,9 @@
package entity
import "joylink.club/ecs"
// LoadBalises 加载应答器实体
func LoadBalises(w ecs.World) error {
data := GetWorldData(w)
signals := data.Repo.ResponderList()
}

View File

@ -114,6 +114,14 @@ message Transponder {
string sectionId = 3; //
DevicePort turnoutPort = 4; //
bytes fixedTelegram = 5;//
Type type = 6;//
enum Type {
FB = 0; //
WB = 1; //
DB = 2; //
VB = 3; //
IB = 4; //
}
}
//

View File

@ -27,12 +27,24 @@ func (s *BaliseDetectSystem) Update(w ecs.World) {
//列车速度80KM/H时222mm/10ms
s.trainQuery.Each(w, func(entry *ecs.Entry) {
tp := component.TrainPositionInfoType.Get(entry)
btm := component.TrainBtmType.Get(entry)
detectedBalise := s.detect(wd, tp, balises)
if detectedBalise != nil { //列车应答器天线扫描到应答器,获取应答器报文发送给BTM
}
//列车应答器天线扫描到应答器,获取应答器报文发送给BTM
tbt := s.findBaliseTelegram(wd, detectedBalise)
btm.Scanning(detectedBalise != nil, tbt)
})
}
// 获取应答器激活的有效报文
func (s *BaliseDetectSystem) findBaliseTelegram(wd *component.WorldData, detectedBalise *repository.Transponder) *component.TrainBaliseTelegram {
if detectedBalise == nil {
return nil
}
//
//
return nil
}
func (s *BaliseDetectSystem) detect(wd *component.WorldData, tp *component.TrainPositionInfo, balises []*repository.Transponder) *repository.Transponder {
scanRange := s.calculateScanRange(wd, tp)
for _, balise := range balises {