This commit is contained in:
walker 2023-10-09 18:07:44 +08:00
commit 99ddf43372
8 changed files with 420 additions and 9 deletions

View File

@ -6,11 +6,11 @@ import (
"joylink.club/rtsssimulation/entity"
)
// 2xh1信号机功能接口
// signal 2xh1 接口:点灯操作、开通列车信号、开通禁止信号
// Drive2XH1Dd 点灯操作
// dd : true-点灯false-灭灯
func Drive2XH1Dd(w ecs.World, signalId string, dd bool) {
// DriveSignal2XH1Dd 点灯操作
// dd : true-物理点灯false-物理灭灯
func DriveSignal2XH1Dd(w ecs.World, signalId string, dd bool) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
@ -23,17 +23,30 @@ func Drive2XH1Dd(w ecs.World, signalId string, dd bool) {
})
}
// Drive2XH1Lx 列车信号操作
// lx : true-允许列车通过信号false-禁止列车通过信号
func Drive2XH1Lx(w ecs.World, signalId string, lx bool) {
// DriveSignal2XH1Lx 开通列车信号(绿灯亮)
func DriveSignal2XH1Lx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal2XH1ElectronicType.Get(signalEntry)
drive := component.RelayDriveType.Get(state.Z2XH1_LXJ)
drive.Td = lx
drive.Xq = lx
drive.Td = true
drive.Xq = true
}
})
}
// DriveSignal2XH1Non 开通禁止信号(红灯亮)
func DriveSignal2XH1Non(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal2XH1ElectronicType.Get(signalEntry)
drive := component.RelayDriveType.Get(state.Z2XH1_LXJ)
drive.Td = false
drive.Xq = false
}
})
}

86
fi/signal_3xh1.go Normal file
View File

@ -0,0 +1,86 @@
package fi
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
// signal 3xh1 接口:点灯操作、开通列车信号、开通引导信号、开通禁止信号
// DriveSignal3XH1Dd 点灯操作
// dd : true-物理点灯false-物理灭灯
func DriveSignal3XH1Dd(w ecs.World, signalId string, dd bool) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH1ElectronicType.Get(signalEntry)
driveDd := component.RelayDriveType.Get(state.Z3XH1_DDJ)
//点灯继电器落下时才点灯
driveDd.Td = !dd
driveDd.Xq = !dd
}
})
}
// DriveSignal3XH1Lx 开通列车信号(直向通过则亮绿灯;侧向通过则亮黄灯)
// xz : true-直向通过false-侧向通过
func DriveSignal3XH1Lx(w ecs.World, signalId string, zx bool) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH1ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH1_LXJ)
driveLx.Td = true
driveLx.Xq = true
driveZx := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
driveZx.Td = zx
driveZx.Xq = zx
driveYx := component.RelayDriveType.Get(state.Z3XH1_YXJ)
driveYx.Td = false
driveYx.Xq = false
}
})
}
// DriveSignal3XH1Yx 开通引导信号(红灯亮且黄灯亮)
func DriveSignal3XH1Yx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH1ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH1_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveZx := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
driveZx.Td = false
driveZx.Xq = false
driveYx := component.RelayDriveType.Get(state.Z3XH1_YXJ)
driveYx.Td = true
driveYx.Xq = true
}
})
}
// DriveSignal3XH1Non 开通禁止信号(红灯亮)
func DriveSignal3XH1Non(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH1ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH1_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveZx := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
driveZx.Td = false
driveZx.Xq = false
driveYx := component.RelayDriveType.Get(state.Z3XH1_YXJ)
driveYx.Td = false
driveYx.Xq = false
}
})
}

76
fi/signal_3xh2.go Normal file
View File

@ -0,0 +1,76 @@
package fi
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
// signal 3xh2 接口:点灯操作、开通列车信号、开通引导信号、开通禁止信号
// DriveSignal3XH2Dd 点灯操作
// dd : true-物理点灯false-物理灭灯
func DriveSignal3XH2Dd(w ecs.World, signalId string, dd bool) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH2ElectronicType.Get(signalEntry)
driveDd := component.RelayDriveType.Get(state.Z3XH2_DDJ)
//点灯继电器落下时才点灯
driveDd.Td = !dd
driveDd.Xq = !dd
}
})
}
// DriveSignal3XH2Lx 开通列车信号(绿灯亮)
func DriveSignal3XH2Lx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH2ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH2_LXJ)
driveLx.Td = true
driveLx.Xq = true
driveYx := component.RelayDriveType.Get(state.Z3XH2_YXJ)
driveYx.Td = false
driveYx.Xq = false
}
})
}
// DriveSignal3XH2Yx 开通引导信号(黄灯亮且红灯亮)
func DriveSignal3XH2Yx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH2ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH2_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveYx := component.RelayDriveType.Get(state.Z3XH2_YXJ)
driveYx.Td = true
driveYx.Xq = true
}
})
}
// DriveSignal3XH2Non 开通禁止信号(红灯亮)
func DriveSignal3XH2Non(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH2ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH2_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveYx := component.RelayDriveType.Get(state.Z3XH2_YXJ)
driveYx.Td = false
driveYx.Xq = false
}
})
}

76
fi/signal_3xh3.go Normal file
View File

@ -0,0 +1,76 @@
package fi
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
// signal 3xh3 接口:点灯操作、开通列车信号、开通引导信号、开通禁止信号
// DriveSignal3XH3Dd 点灯操作
// dd : true-物理点灯false-物理灭灯
func DriveSignal3XH3Dd(w ecs.World, signalId string, dd bool) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH3ElectronicType.Get(signalEntry)
driveDd := component.RelayDriveType.Get(state.Z3XH3_DDJ)
//点灯继电器落下时才点灯
driveDd.Td = !dd
driveDd.Xq = !dd
}
})
}
// DriveSignal3XH3Lx 开通列车信号(黄灯亮)
func DriveSignal3XH3Lx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH3ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH3_LXJ)
driveLx.Td = true
driveLx.Xq = true
driveYx := component.RelayDriveType.Get(state.Z3XH3_YXJ)
driveYx.Td = false
driveYx.Xq = false
}
})
}
// DriveSignal3XH3Yx 开通引导信号(黄灯亮且红灯亮)
func DriveSignal3XH3Yx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH3ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH3_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveYx := component.RelayDriveType.Get(state.Z3XH3_YXJ)
driveYx.Td = true
driveYx.Xq = true
}
})
}
// DriveSignal3XH3Non 开通禁止信号(红灯亮)
func DriveSignal3XH3Non(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.Signal3XH3ElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.Z3XH3_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveYx := component.RelayDriveType.Get(state.Z3XH3_YXJ)
driveYx.Td = false
driveYx.Xq = false
}
})
}

60
fi/signal_3xh4.go Normal file
View File

@ -0,0 +1,60 @@
package fi
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
// signal 3xh4 接口:点灯操作、开通列车信号、开通禁止信号
// DriveSignal3XH4Dd 点灯操作
// dd : true-物理点灯false-物理灭灯
func DriveSignal3XH4Dd(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
}
})
}
// DriveSignal3XH4Lx 开通列车信号(直向通过亮绿灯,侧向通过亮黄灯)
// zx : true-直向通过false-侧向通过
func DriveSignal3XH4Lx(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
}
})
}
// DriveSignal3XH4Non 开通禁止信号(亮红灯)
func DriveSignal3XH4Non(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
}
})
}

37
fi/signal_dcxh.go Normal file
View File

@ -0,0 +1,37 @@
package fi
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
// signal dcxh 接口:开通调车信号、开通禁止信号
// DriveSignalDCXHDx 开通调车信号(白灯亮)
func DriveSignalDCXHDx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.SignalDCXHElectronicType.Get(signalEntry)
driveDx := component.RelayDriveType.Get(state.DCXH_DXJ)
driveDx.Td = true
driveDx.Xq = true
}
})
}
// DriveSignalDCXHNon 开通禁止信号(蓝灯亮)
func DriveSignalDCXHNon(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.SignalDCXHElectronicType.Get(signalEntry)
driveDx := component.RelayDriveType.Get(state.DCXH_DXJ)
driveDx.Td = false
driveDx.Xq = false
}
})
}

60
fi/signal_jckxh.go Normal file
View File

@ -0,0 +1,60 @@
package fi
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
// signal jckxh 接口:开通列车信号、开通调车信号、开通禁止信号
// DriveSignalJCKXHLx 开通列车信号(黄灯亮)
func DriveSignalJCKXHLx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.SignalJCKXHElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.JCKXH_LXJ)
driveLx.Td = true
driveLx.Xq = true
driveDx := component.RelayDriveType.Get(state.JCKXH_DXJ)
driveDx.Td = false
driveDx.Xq = false
}
})
}
// DriveSignalJCKXHDx 开通调车信号(白灯亮)
func DriveSignalJCKXHDx(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.SignalJCKXHElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.JCKXH_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveDx := component.RelayDriveType.Get(state.JCKXH_DXJ)
driveDx.Td = true
driveDx.Xq = true
}
})
}
// DriveSignalJCKXHNon 开通禁止信号(红灯亮)
func DriveSignalJCKXHNon(w ecs.World, signalId string) {
w.Execute(func() {
wd := entity.GetWorldData(w)
signalEntry, ok := wd.EntityMap[signalId]
if ok {
state := component.SignalJCKXHElectronicType.Get(signalEntry)
driveLx := component.RelayDriveType.Get(state.JCKXH_LXJ)
driveLx.Td = false
driveLx.Xq = false
driveDx := component.RelayDriveType.Get(state.JCKXH_DXJ)
driveDx.Td = false
driveDx.Xq = false
}
})
}

3
fi/signal_jdxh.go Normal file
View File

@ -0,0 +1,3 @@
package fi
// signal jdxh 接口: