Merge branch 'master' of https://git.code.tencent.com/jl-framework/rtss_simulation into HEAD
This commit is contained in:
commit
81760f5c89
16
fi/relay.go
16
fi/relay.go
@ -30,8 +30,8 @@ func driveWjRelay(w ecs.World, entry *ecs.Entry, td bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 驱动继电器到吸起位置
|
// 驱动继电器到吸起位置
|
||||||
func DriveRelayUp(w ecs.World, id string) {
|
func DriveRelayUp(w ecs.World, id string) error {
|
||||||
w.Execute(func() {
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
entry, ok := wd.EntityMap[id]
|
entry, ok := wd.EntityMap[id]
|
||||||
if ok {
|
if ok {
|
||||||
@ -41,14 +41,16 @@ func DriveRelayUp(w ecs.World, id string) {
|
|||||||
driveWjRelay(w, entry, true)
|
driveWjRelay(w, entry, true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("未找到id=%s的继电器\n", id)
|
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的继电器", id))
|
||||||
}
|
}
|
||||||
|
return ecs.NewOkEmptyResult()
|
||||||
})
|
})
|
||||||
|
return result.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 驱动继电器到落下位置
|
// 驱动继电器到落下位置
|
||||||
func DriveRelayDown(w ecs.World, id string) {
|
func DriveRelayDown(w ecs.World, id string) error {
|
||||||
w.Execute(func() {
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
entry, ok := wd.EntityMap[id]
|
entry, ok := wd.EntityMap[id]
|
||||||
if ok {
|
if ok {
|
||||||
@ -58,7 +60,9 @@ func DriveRelayDown(w ecs.World, id string) {
|
|||||||
driveWjRelay(w, entry, false)
|
driveWjRelay(w, entry, false)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("未找到id=%s的继电器\n", id)
|
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的继电器", id))
|
||||||
}
|
}
|
||||||
|
return ecs.NewOkEmptyResult()
|
||||||
})
|
})
|
||||||
|
return result.Err
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,11 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
//设置滑动门电机通断电状态
|
//设置滑动门电机通断电状态
|
||||||
repo := entity.GetWorldData(world).Repo
|
repo := entity.GetWorldData(world).Repo
|
||||||
psd := repo.FindPsd(component.UidType.Get(entry).Id)
|
psd := repo.FindPsd(component.UidType.Get(entry).Id)
|
||||||
if psc.MkxGM { //优先门控箱的关门
|
if psc.MkxKM { //优先门控箱的开门
|
||||||
p.gm(asdList)
|
|
||||||
} else if psc.MkxKM { //其次门控箱的开门
|
|
||||||
group := psd.FindAsdGroup(8)
|
group := psd.FindAsdGroup(8)
|
||||||
p.km(group.Start, group.End, asdList)
|
p.km(group.Start, group.End, asdList)
|
||||||
|
} else if psc.MkxKM { //其次门控箱的关门
|
||||||
|
p.gm(asdList)
|
||||||
} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
||||||
if psc.InterlockGM {
|
if psc.InterlockGM {
|
||||||
p.gm(asdList)
|
p.gm(asdList)
|
||||||
|
@ -28,9 +28,11 @@ func (s *AsdSys) Update(world ecs.World) {
|
|||||||
if entry.HasComponent(component.AsdCannotOpenTag) {
|
if entry.HasComponent(component.AsdCannotOpenTag) {
|
||||||
pos = consts.TwoPosMin
|
pos = consts.TwoPosMin
|
||||||
speed = 0
|
speed = 0
|
||||||
|
psdMotorState.TD = false
|
||||||
} else if entry.HasComponent(component.AsdCannotCloseTag) {
|
} else if entry.HasComponent(component.AsdCannotCloseTag) {
|
||||||
pos = consts.TwoPosMax
|
pos = consts.TwoPosMax
|
||||||
speed = 0
|
speed = 0
|
||||||
|
psdMotorState.TD = false
|
||||||
} else if psdMotorState.TD {
|
} else if psdMotorState.TD {
|
||||||
if psdMotorState.KM {
|
if psdMotorState.KM {
|
||||||
if pos == consts.TwoPosMax {
|
if pos == consts.TwoPosMax {
|
||||||
|
Loading…
Reference in New Issue
Block a user