From cf783364fefdcadef3bf1e88eb1d6b2dd12a3cc7 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Fri, 29 Mar 2024 16:46:30 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E8=BD=A6?= =?UTF-8?q?=E5=BA=93=E9=97=A8=E7=BB=A7=E7=94=B5=E5=99=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E7=9A=84=E6=95=85=E9=9A=9C=E7=94=B1=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=B1=82=E5=AE=9E=E7=8E=B0=EF=BC=9B=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=E7=BB=A7=E7=94=B5=E5=99=A8=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E7=8A=B6=E6=80=81=EF=BC=9B=E4=B9=9F=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E9=97=A8=E6=95=85=E9=9A=9C=E7=BB=A7=E7=94=B5?= =?UTF-8?q?=E5=99=A8=E6=8E=A5=E9=80=9A=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/ckm.go | 11 +++++++---- fi/circuit.go | 42 ------------------------------------------ sys/circuit_sys/ckm.go | 8 ++------ 3 files changed, 9 insertions(+), 52 deletions(-) delete mode 100644 fi/circuit.go 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)