rts-sim-module/entity/iscs_load.go
2023-12-22 15:29:57 +08:00

61 lines
1.5 KiB
Go

package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/repository/model/proto"
)
// LoadIscs 加载ISCS相关设备实体
func LoadIscs(w ecs.World) error {
data := GetWorldData(w)
//电力母线实体
for _, pipe := range data.Repo.PipeMap {
switch pipe.PipeType {
case proto.Pipe_ElectricPower:
NewPowerPipeEntity(w, pipe.Id())
}
}
//断路器
for _, circuitBreaker := range data.Repo.CircuitBreakerMap {
NewCircuitBreakerEntity(w, circuitBreaker.Id())
}
//三工位开关
for _, tps := range data.Repo.ThreePositionSwitchMap {
NewThreePositionSwitchEntity(w, tps.Id())
}
//手车
for _, hs := range data.Repo.HandcartSwitchMap {
NewHandcartSwitchEntity(w, hs.Id())
}
//整流器
for _, rectifier := range data.Repo.RectifierMap {
NewRectifierEntity(w, rectifier.Id())
}
//隔离开关
for _, disconnector := range data.Repo.DisconnectorMap {
NewDisconnectorEntity(w, disconnector.Id())
}
//变压器
for _, vt := range data.Repo.VoltageTransformerMap {
NewVoltageTransformerEntity(w, vt.Id())
}
//电源
for _, ps := range data.Repo.PowerSourceMap {
NewPowerSourceEntity(w, ps.Id(), ps.Ac, ps.Voltage)
}
//避雷器
for _, la := range data.Repo.LightningArresterMap {
NewLightningArresterEntity(w, la.Id())
}
//接地装置
for _, ed := range data.Repo.EarthingDeviceMap {
NewEarthingDeviceEntity(w, ed.Id())
}
//网络交换机
for _, networkSwitch := range data.Repo.NetworkSwitchMap {
NewNetworkSwitchEntity(w, networkSwitch.Id())
}
//
return nil
}