无源应答器固定报文
This commit is contained in:
parent
aa83ed7dc6
commit
7853869090
@ -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)
|
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 列车应答器传输模块
|
// TrainBtm 列车应答器传输模块
|
||||||
type TrainBtm struct {
|
type TrainBtm struct {
|
||||||
//应答器计数(每过一个应答器加一,在同一个应答器内不变)
|
//应答器计数(每过一个应答器加一,在同一个应答器内不变)
|
||||||
@ -40,10 +46,8 @@ type TrainBtm struct {
|
|||||||
ScannedBalises []*TrainBaliseTelegram
|
ScannedBalises []*TrainBaliseTelegram
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrainBaliseTelegram 应答器报文
|
func (t *TrainBtm) Scanning(aboveBalise bool, tbt *TrainBaliseTelegram) {
|
||||||
type TrainBaliseTelegram struct {
|
t.AboveBalise = aboveBalise
|
||||||
BaliseId string //应答器ID
|
|
||||||
Telegram []byte //一个应答器同一时刻只有一条报文处于激活有效状态
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
9
entity/balise.go
Normal file
9
entity/balise.go
Normal 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()
|
||||||
|
}
|
@ -114,6 +114,14 @@ message Transponder {
|
|||||||
string sectionId = 3; //关联的区段
|
string sectionId = 3; //关联的区段
|
||||||
DevicePort turnoutPort = 4; //关联的区段端口
|
DevicePort turnoutPort = 4; //关联的区段端口
|
||||||
bytes fixedTelegram = 5;//无源应答器固定报文
|
bytes fixedTelegram = 5;//无源应答器固定报文
|
||||||
|
Type type = 6;//应答器类型
|
||||||
|
enum Type {
|
||||||
|
FB = 0; // 固定应答器
|
||||||
|
WB = 1; // 轮径校正应答器
|
||||||
|
DB = 2; // 休眠唤醒应答器
|
||||||
|
VB = 3; // 主信号应答器
|
||||||
|
IB = 4; // 预告应答器
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//坡度
|
//坡度
|
||||||
|
@ -27,12 +27,24 @@ func (s *BaliseDetectSystem) Update(w ecs.World) {
|
|||||||
//列车速度80KM/H时,222mm/10ms
|
//列车速度80KM/H时,222mm/10ms
|
||||||
s.trainQuery.Each(w, func(entry *ecs.Entry) {
|
s.trainQuery.Each(w, func(entry *ecs.Entry) {
|
||||||
tp := component.TrainPositionInfoType.Get(entry)
|
tp := component.TrainPositionInfoType.Get(entry)
|
||||||
|
btm := component.TrainBtmType.Get(entry)
|
||||||
detectedBalise := s.detect(wd, tp, balises)
|
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 {
|
func (s *BaliseDetectSystem) detect(wd *component.WorldData, tp *component.TrainPositionInfo, balises []*repository.Transponder) *repository.Transponder {
|
||||||
scanRange := s.calculateScanRange(wd, tp)
|
scanRange := s.calculateScanRange(wd, tp)
|
||||||
for _, balise := range balises {
|
for _, balise := range balises {
|
||||||
|
Loading…
Reference in New Issue
Block a user