This commit is contained in:
xzb 2023-09-28 11:32:02 +08:00
parent e0bcb22435
commit 01d9b274dc
3 changed files with 71 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import (
// Test 测试双机ZDJ9道岔
func Test() {
system.XXDebug = true
//模型仓库
modelStorage := tstorages.NewModelStorage()
addRelays(modelStorage)

View File

@ -6,6 +6,74 @@ import (
sysEvent "joylink.club/rtsssimulation/system/event"
)
// PsdDriveXGMJ 联锁驱动XGMJ
func PsdDriveXGMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool {
psdEntry := FindEntityById(w, psdCircuitId)
if psdEntry == nil {
return false
}
psdState := PsdCircuitStateComponent.Get(psdEntry)
psdState.XGMLs = lsDrive
return true
}
// PsdDriveSGMJ 联锁驱动SGMJ
func PsdDriveSGMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool {
psdEntry := FindEntityById(w, psdCircuitId)
if psdEntry == nil {
return false
}
psdState := PsdCircuitStateComponent.Get(psdEntry)
psdState.SGMLs = lsDrive
return true
}
// PsdDrive4XKMJ 联锁驱动4XKMJ
func PsdDrive4XKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool {
psdEntry := FindEntityById(w, psdCircuitId)
if psdEntry == nil {
return false
}
psdState := PsdCircuitStateComponent.Get(psdEntry)
psdState.G4XKMLs = lsDrive
return true
}
// PsdDrive4SKMJ 联锁驱动4SKMJ
func PsdDrive4SKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool {
psdEntry := FindEntityById(w, psdCircuitId)
if psdEntry == nil {
return false
}
psdState := PsdCircuitStateComponent.Get(psdEntry)
psdState.G4SKMLs = lsDrive
return true
}
// PsdDrive8XKMJ 联锁驱动8XKMJ
func PsdDrive8XKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool {
psdEntry := FindEntityById(w, psdCircuitId)
if psdEntry == nil {
return false
}
psdState := PsdCircuitStateComponent.Get(psdEntry)
psdState.G8XKMLs = lsDrive
return true
}
// PsdDrive8SKMJ 联锁驱动8SKMJ
func PsdDrive8SKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool {
psdEntry := FindEntityById(w, psdCircuitId)
if psdEntry == nil {
return false
}
psdState := PsdCircuitStateComponent.Get(psdEntry)
psdState.G8SKMLs = lsDrive
return true
}
//////////////////////////////////////////////////////////////
// PsdCircuitState 站台门控制电路状态Psd为车站所有屏蔽门子门的集合
// 旁路继电器的工作原理是,当电路中的电流超过预定的阈值时,旁路继电器会自动断开电路,从而防止电路发生短路或过载等故障。
type PsdCircuitState struct {

View File

@ -40,11 +40,11 @@ func QueryEntityById(world ecs.World, q *ecs.Query, id string) *ecs.Entry {
var modelStorageQuery = ecs.NewQuery(filter.Contains(ModelStorageComponent))
// 测试用
var xXDebug = true
var XXDebug = false
// FindModelStorage 获取模型仓库
func FindModelStorage(world ecs.World) IModelManager {
if xXDebug {
if XXDebug {
e, _ := modelStorageQuery.First(world)
return ModelStorageComponent.Get(e).ModelManager
} else {