From 2b27052092d7fde1179c857f0d22dc663d61d5dc Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Tue, 26 Dec 2023 13:13:30 +0800 Subject: [PATCH] =?UTF-8?q?iscs=20=20bas=20=20=E5=A4=A7=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/iscs_bas_fan.go | 3 +- entity/iscs_fas.go | 35 ------------- sys/iscs_sys/iscs_bas_fan.go | 98 +++++++++++++++++++----------------- 3 files changed, 52 insertions(+), 84 deletions(-) diff --git a/component/iscs_bas_fan.go b/component/iscs_bas_fan.go index 692163f..5dd9928 100644 --- a/component/iscs_bas_fan.go +++ b/component/iscs_bas_fan.go @@ -36,8 +36,7 @@ func (f *FanSwitch) On() bool { // 电机转速与变频器频率关系 计算公式:n=60f/p(其中n是同步转速,f是频率,P是磁极对数) // 变频器的额定输出频率一般为0-100HZ type FanFcUnit struct { - Fc bool //true-变频器已开启 - F uint16 //变频器频率(0-100HZ) + F uint16 //变频器频率(0-100HZ) } // FanBypassUnit 风机旁路装置 diff --git a/entity/iscs_fas.go b/entity/iscs_fas.go index 2a98c66..d770ca0 100644 --- a/entity/iscs_fas.go +++ b/entity/iscs_fas.go @@ -103,27 +103,6 @@ func NewEvacuationTypeFireRollerShutterEntity(w ecs.World, id string) *ecs.Entry return entry } -// NewFirePumpEntity 创建消防泵实体 -func NewFirePumpEntity(w ecs.World, id string) *ecs.Entry { - entry := NewWaterPumpEntity(w, id) - entry.AddComponent(component.FirePumpTag) - return entry -} - -// NewSprayPumpEntity 创建喷淋泵实体 -func NewSprayPumpEntity(w ecs.World, id string) *ecs.Entry { - entry := NewWaterPumpEntity(w, id) - entry.AddComponent(component.SprayPumpTag) - return entry -} - -// NewStabilizedPressurePumpEntity 创建稳压泵实体 -func NewStabilizedPressurePumpEntity(w ecs.World, id string) *ecs.Entry { - entry := NewWaterPumpEntity(w, id) - entry.AddComponent(component.StabilizedPressurePumpTag) - return entry -} - // NewFasAcsEntity 创建火警ACS联动实体 func NewFasAcsEntity(w ecs.World, id string) *ecs.Entry { wd := GetWorldData(w) @@ -160,20 +139,6 @@ func NewWaterFlowIndicatorEntity(w ecs.World, id string) *ecs.Entry { return e } -// NewSignalButterflyValveEntity 创建信号蝶阀实体 -func NewSignalButterflyValveEntity(w ecs.World, id string) *ecs.Entry { - entry := NewElectricControlValveEntity(w, id) - entry.AddComponent(component.SignalButterflyValveTag) - return entry -} - -// NewPressureSwitchEntity 压力开关是与电器开关相结合的装置,当到达预先设定的流体压力时,开关接点动作 -func NewPressureSwitchEntity(w ecs.World, id string) *ecs.Entry { - entry := NewElectricControlValveEntity(w, id) - entry.AddComponent(component.PressureSwitchTag) - return entry -} - // NewNonFirePowerSourceEntity 创建非消防电源实体 func NewNonFirePowerSourceEntity(w ecs.World, id string) *ecs.Entry { wd := GetWorldData(w) diff --git a/sys/iscs_sys/iscs_bas_fan.go b/sys/iscs_sys/iscs_bas_fan.go index dbe9f6d..c1442f1 100644 --- a/sys/iscs_sys/iscs_bas_fan.go +++ b/sys/iscs_sys/iscs_bas_fan.go @@ -21,6 +21,51 @@ func (s *FanSystem) Update(w ecs.World) { fan := component.FanDeviceType.Get(entry) fan.Forward = fan.Fs.OnForward() // + speed := fan.Speed + s.calculateAc(fan, entry)*float32(w.Tick()) + // + switch { + case entry.HasComponent(component.CommonFanTag): //一般风机(3000 r/min) + { + if speed > 3000 { + fan.Speed = 3000 + } + } + case entry.HasComponent(component.SoftStartFanTag): //软启风机(100 r/min) + { + if speed > 100 { + fan.Speed = 100 + } + } + case entry.HasComponent(component.HighLowSpeedFanTag): //双速风机(Low 2000 r/min ; High 7000 r/min) + { + highMode := component.FanHighLowSpeedModeType.Get(entry).HighMode + if highMode { //高速模式 + if speed > 7000 { + fan.Speed = 7000 + } + } else { //低速模式 + if speed > 2000 { + fan.Speed = 2000 + } + } + } + case entry.HasComponent(component.FcBypassFanTag): + //变频旁路风机 + //电机转速与变频器频率关系 计算公式:n=60f/p(其中n是同步转速,f是频率,P是磁极对数) + //变频器的额定输出频率一般为0-100HZ + //假设风机磁极对数为1,则n=60f + { + fcUnit := component.FanFcUnitType.Get(entry) + SPEED := 60 * float32(fcUnit.F) //当前频率目标转速 + if speed > SPEED { + fan.Speed = SPEED + } + } + } + // + if speed < 0 { + fan.Speed = 0 + } }) } @@ -28,13 +73,15 @@ func (s *FanSystem) Update(w ecs.World) { func (s *FanSystem) calculateAc(fan *component.FanDevice, fanEntry *ecs.Entry) float32 { //大于0加速,小于0减速 ac := float32(0) + // + softStart := false + if fanEntry.HasComponent(component.FanSoftStartUnitType) { + softStart = component.FanSoftStartUnitType.Get(fanEntry).SoftStart + } + // if fan.Fs.Off() { //电源关闭 ac = -4 //4 r/ms } else { - softStart := false - if fanEntry.HasComponent(component.FanSoftStartUnitType) { - softStart = component.FanSoftStartUnitType.Get(fanEntry).SoftStart - } if fan.Fs.On() { //电源---正转或反转启动 if softStart { ac = 0.02 // r/ms @@ -43,48 +90,5 @@ func (s *FanSystem) calculateAc(fan *component.FanDevice, fanEntry *ecs.Entry) f } } } - //一般风机(3000 r/min) - if fanEntry.HasComponent(component.CommonFanTag) { - if fan.Speed > 3000 && ac > 0 { - ac = -1 - } - return ac - } - //软启风机(100 r/min) - if fanEntry.HasComponent(component.SoftStartFanTag) { - if fan.Speed > 100 && ac > 0 { - ac = -1 - } - return ac - } - //双速风机(Low 2000 r/min ; High 7000 r/min) - if fanEntry.HasComponent(component.HighLowSpeedFanTag) { - highMode := component.FanHighLowSpeedModeType.Get(fanEntry).HighMode - if highMode { //高速模式 - if fan.Speed > 7000 && ac > 0 { - ac = -1 - } - } else { //低速模式 - if fan.Speed > 2000 && ac > 0 { - ac = -1 - } - } - return ac - } - //变频旁路风机 - //电机转速与变频器频率关系 计算公式:n=60f/p(其中n是同步转速,f是频率,P是磁极对数) - //变频器的额定输出频率一般为0-100HZ - //假设风机磁极对数为1,则n=60f - if fanEntry.HasComponent(component.FcBypassFanTag) { - fcUnit := component.FanFcUnitType.Get(fanEntry) - if fcUnit.Fc { - SPEED := 60 * fcUnit.F - if fan.Speed > float32(SPEED) && ac > 0 { - - } - } else { - - } - } return ac }