diff --git a/component/ckm.go b/component/ckm.go index b2b54eb..958eaed 100644 --- a/component/ckm.go +++ b/component/ckm.go @@ -5,10 +5,9 @@ import ( ) var ( - CkmTag = ecs.NewTag() - CkmStateLossTag = ecs.NewTag() //状态丢失故障tag - CkmCircuitType = ecs.NewComponentType[CkmCircuit]() - CkmPslType = ecs.NewComponentType[CkmPsl]() + CkmTag = ecs.NewTag() + CkmCircuitType = ecs.NewComponentType[CkmCircuit]() + CkmPslType = ecs.NewComponentType[CkmPsl]() ) type CkmCircuit struct { @@ -23,6 +22,10 @@ type CkmCircuit struct { GMJ *ecs.Entry //关门继电器 } +func (c *CkmCircuit) RelayList() []*ecs.Entry { + return []*ecs.Entry{c.MKJ, c.MGJ, c.MGZJ, c.MPLJ, c.MMSJ, c.KMJ, c.GMJ} +} + type CkmPsl struct { KMA *ecs.Entry //开门按钮 GMA *ecs.Entry //关门按钮 diff --git a/fi/circuit.go b/fi/circuit.go deleted file mode 100644 index 814f9a2..0000000 --- a/fi/circuit.go +++ /dev/null @@ -1,42 +0,0 @@ -package fi - -import ( - "fmt" - - "joylink.club/ecs" - "joylink.club/rtsssimulation/component" - "joylink.club/rtsssimulation/entity" -) - -// 采集继电器吸起电路状态 -func CollectXQCircuitState(w ecs.World, id string) bool { - wd := entity.GetWorldData(w) - entry, ok := wd.EntityMap[id] - if ok { - state := component.BitStateType.Get(entry) - return state.Val - } else { - fmt.Printf("未找到id=%s的继电器\n", id) - } - return false -} - -// 采集继电器落下电路状态 -func CollectLXCircuitState(w ecs.World, id string) bool { - wd := entity.GetWorldData(w) - entry, ok := wd.EntityMap[id] - if ok { - state := component.BitStateType.Get(entry) - return !state.Val - } else { - fmt.Printf("未找到id=%s的继电器\n", id) - } - return false -} - -// 驱动电路状态修改 -// x,y:二维数组的索引 -// state : 32位的bool数组 -func DriveCircuitStateChange(w ecs.World, x, y int, state bool) { - -} diff --git a/sys/circuit_sys/ckm.go b/sys/circuit_sys/ckm.go index e277427..97582e1 100644 --- a/sys/circuit_sys/ckm.go +++ b/sys/circuit_sys/ckm.go @@ -22,10 +22,6 @@ func NewCkmSys() *CkmSys { func (p *CkmSys) Update(world ecs.World) { worldData := entity.GetWorldData(world) p.query.Each(world, func(entry *ecs.Entry) { - //车库门故障(状态丢失) - if entry.HasComponent(component.CkmStateLossTag) { - return - } posCom := component.FixedPositionTransformType.Get(entry) circuit := component.CkmCircuitType.Get(entry) //目前不考虑没有车库门电路的情况 //车库门PSL @@ -42,8 +38,8 @@ func (p *CkmSys) Update(world ecs.World) { component.RelayDriveType.Get(circuit.MGJ).Td = false component.RelayDriveType.Get(circuit.MKJ).Td = true } - //门故障继电器及状态 - component.RelayDriveType.Get(circuit.MGZJ).Td = entry.HasComponent(component.CkmStateLossTag) + ////门故障继电器及状态 + //component.RelayDriveType.Get(circuit.MGZJ).Td = //开/关门继电器驱动状态 if component.BitStateType.Get(circuit.MMSJ).Val { ckmPsl := component.CkmPslType.Get(entry)