2023-12-20 15:22:36 +08:00
|
|
|
package entity
|
|
|
|
|
2023-12-20 16:01:08 +08:00
|
|
|
import (
|
|
|
|
"joylink.club/ecs"
|
|
|
|
"joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
)
|
2023-12-20 15:22:36 +08:00
|
|
|
|
|
|
|
// LoadIscs 加载ISCS相关设备实体
|
|
|
|
func LoadIscs(w ecs.World) error {
|
|
|
|
data := GetWorldData(w)
|
2023-12-20 16:01:08 +08:00
|
|
|
//电力母线实体
|
2023-12-20 15:22:36 +08:00
|
|
|
for _, pipe := range data.Repo.PipeMap {
|
2023-12-20 16:09:29 +08:00
|
|
|
switch pipe.PipeType {
|
2023-12-20 16:01:08 +08:00
|
|
|
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)
|
2023-12-20 15:22:36 +08:00
|
|
|
}
|
|
|
|
//
|
|
|
|
return nil
|
|
|
|
}
|