fi signal 3xh4
This commit is contained in:
parent
3ca0187dd0
commit
92c1f38ff1
60
fi/signal_3xh4.go
Normal file
60
fi/signal_3xh4.go
Normal file
@ -0,0 +1,60 @@
|
||||
package fi
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
// signal 3xh4 接口:点灯操作、开通列车信号、开通禁止信号
|
||||
|
||||
// Drive3XH4Dd 点灯操作
|
||||
// dd : true-物理点灯;false-物理灭灯
|
||||
func Drive3XH4Dd(w ecs.World, signalId string, dd bool) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
signalEntry, ok := wd.EntityMap[signalId]
|
||||
if ok {
|
||||
state := component.Signal3XH4ElectronicType.Get(signalEntry)
|
||||
driveDd := component.RelayDriveType.Get(state.Z3XH4_DDJ)
|
||||
//点灯继电器落下时才点灯
|
||||
driveDd.Td = !dd
|
||||
driveDd.Xq = !dd
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Drive3XH4Lx 开通列车信号(直向通过亮绿灯,侧向通过亮黄灯)
|
||||
// zx : true-直向通过,false-侧向通过
|
||||
func Drive3XH4Lx(w ecs.World, signalId string, zx bool) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
signalEntry, ok := wd.EntityMap[signalId]
|
||||
if ok {
|
||||
state := component.Signal3XH4ElectronicType.Get(signalEntry)
|
||||
driveLx := component.RelayDriveType.Get(state.Z3XH4_LXJ)
|
||||
driveLx.Td = true
|
||||
driveLx.Xq = true
|
||||
driveZx := component.RelayDriveType.Get(state.Z3XH4_ZXJ)
|
||||
driveZx.Td = zx
|
||||
driveZx.Xq = zx
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Drive3XH4Non 开通禁止信号(亮红灯)
|
||||
func Drive3XH4Non(w ecs.World, signalId string) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
signalEntry, ok := wd.EntityMap[signalId]
|
||||
if ok {
|
||||
state := component.Signal3XH4ElectronicType.Get(signalEntry)
|
||||
driveLx := component.RelayDriveType.Get(state.Z3XH4_LXJ)
|
||||
driveLx.Td = false
|
||||
driveLx.Xq = false
|
||||
driveZx := component.RelayDriveType.Get(state.Z3XH4_ZXJ)
|
||||
driveZx.Td = false
|
||||
driveZx.Xq = false
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user