rts-sim-module/entity/iscs_load.go
2023-12-20 16:09:29 +08:00

54 lines
1.2 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)
}
//
return nil
}
/*
PipeFittingMap map[string]*PipeFitting //ISCS 管件
*/