iscs pscada 一次图 repository
This commit is contained in:
parent
42e89e7864
commit
b5d3f89b4e
@ -1,25 +1,53 @@
|
||||
package entity
|
||||
|
||||
import "joylink.club/ecs"
|
||||
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 {
|
||||
NewPowerPipeEntity(w, pipe.Id())
|
||||
switch pipe.Type {
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
PipeMap map[string]*Pipe //ISCS 管线
|
||||
|
||||
PipeFittingMap map[string]*PipeFitting //ISCS 管件
|
||||
CircuitBreakerMap map[string]*CircuitBreaker //ISCS 断路器
|
||||
ThreePositionSwitchMap map[string]*ThreePositionSwitch //ISCS 三工位开关
|
||||
HandcartSwitchMap map[string]*HandcartSwitch //ISCS 手车
|
||||
RectifierMap map[string]*Rectifier //ISCS 整流器
|
||||
DisconnectorMap map[string]*Disconnector //ISCS 隔离开关
|
||||
VoltageTransformerMap map[string]*VoltageTransformer //ISCS 变压器
|
||||
PowerSourceMap map[string]*PowerSource //ISCS 电源
|
||||
*/
|
||||
|
@ -318,14 +318,18 @@ func (p *VoltageTransformerPort) Device() PortedDevice {
|
||||
// 只有一个输出端口A
|
||||
type PowerSource struct {
|
||||
Identity
|
||||
Code string
|
||||
PortA *PipePort //电源A端口连接的管线
|
||||
Code string
|
||||
PortA *PipePort //电源A端口连接的管线
|
||||
Ac bool //true-交流;false-直流
|
||||
Voltage uint32 //电压,单位V
|
||||
}
|
||||
|
||||
func NewPowerSource(id string, code string) *PowerSource {
|
||||
func NewPowerSource(id string, code string, ac bool, voltage uint32) *PowerSource {
|
||||
return &PowerSource{
|
||||
Identity: &identity{id: id, deviceType: proto.DeviceType_DeviceType_PowerSource},
|
||||
Code: code,
|
||||
Ac: ac,
|
||||
Voltage: voltage,
|
||||
}
|
||||
}
|
||||
func (p *PowerSource) PortNum() int {
|
||||
|
@ -46,7 +46,7 @@ func buildIscsModels(source *proto.Repository, repository *Repository) error {
|
||||
}
|
||||
//ISCS电源
|
||||
for _, protoData := range source.PowerSources {
|
||||
m := NewPowerSource(protoData.Id, protoData.Code)
|
||||
m := NewPowerSource(protoData.Id, protoData.Code, protoData.Ac, protoData.Voltage)
|
||||
repository.PowerSourceMap[m.Id()] = m
|
||||
}
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user