iscs bas 大系统

This commit is contained in:
xzb 2023-12-26 13:13:30 +08:00
parent 721824c2f7
commit 2b27052092
3 changed files with 52 additions and 84 deletions

View File

@ -36,8 +36,7 @@ func (f *FanSwitch) On() bool {
// 电机转速与变频器频率关系 计算公式n=60f/p其中n是同步转速f是频率P是磁极对数 // 电机转速与变频器频率关系 计算公式n=60f/p其中n是同步转速f是频率P是磁极对数
// 变频器的额定输出频率一般为0-100HZ // 变频器的额定输出频率一般为0-100HZ
type FanFcUnit struct { type FanFcUnit struct {
Fc bool //true-变频器已开启 F uint16 //变频器频率(0-100HZ)
F uint16 //变频器频率(0-100HZ)
} }
// FanBypassUnit 风机旁路装置 // FanBypassUnit 风机旁路装置

View File

@ -103,27 +103,6 @@ func NewEvacuationTypeFireRollerShutterEntity(w ecs.World, id string) *ecs.Entry
return 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联动实体 // NewFasAcsEntity 创建火警ACS联动实体
func NewFasAcsEntity(w ecs.World, id string) *ecs.Entry { func NewFasAcsEntity(w ecs.World, id string) *ecs.Entry {
wd := GetWorldData(w) wd := GetWorldData(w)
@ -160,20 +139,6 @@ func NewWaterFlowIndicatorEntity(w ecs.World, id string) *ecs.Entry {
return e 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 创建非消防电源实体 // NewNonFirePowerSourceEntity 创建非消防电源实体
func NewNonFirePowerSourceEntity(w ecs.World, id string) *ecs.Entry { func NewNonFirePowerSourceEntity(w ecs.World, id string) *ecs.Entry {
wd := GetWorldData(w) wd := GetWorldData(w)

View File

@ -21,6 +21,51 @@ func (s *FanSystem) Update(w ecs.World) {
fan := component.FanDeviceType.Get(entry) fan := component.FanDeviceType.Get(entry)
fan.Forward = fan.Fs.OnForward() 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 { func (s *FanSystem) calculateAc(fan *component.FanDevice, fanEntry *ecs.Entry) float32 {
//大于0加速小于0减速 //大于0加速小于0减速
ac := float32(0) ac := float32(0)
//
softStart := false
if fanEntry.HasComponent(component.FanSoftStartUnitType) {
softStart = component.FanSoftStartUnitType.Get(fanEntry).SoftStart
}
//
if fan.Fs.Off() { //电源关闭 if fan.Fs.Off() { //电源关闭
ac = -4 //4 r/ms ac = -4 //4 r/ms
} else { } else {
softStart := false
if fanEntry.HasComponent(component.FanSoftStartUnitType) {
softStart = component.FanSoftStartUnitType.Get(fanEntry).SoftStart
}
if fan.Fs.On() { //电源---正转或反转启动 if fan.Fs.On() { //电源---正转或反转启动
if softStart { if softStart {
ac = 0.02 // r/ms 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 return ac
} }