Compare commits
2 Commits
5f95106870
...
efa7d1655e
Author | SHA1 | Date | |
---|---|---|---|
efa7d1655e | |||
86c02883c4 |
@ -74,8 +74,9 @@ type PsdState struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Close bool `protobuf:"varint,1,opt,name=close,proto3" json:"close,omitempty"`
|
Close bool `protobuf:"varint,1,opt,name=close,proto3" json:"close,omitempty"`
|
||||||
Obstacle bool `protobuf:"varint,2,opt,name=obstacle,proto3" json:"obstacle,omitempty"`
|
Obstacle bool `protobuf:"varint,2,opt,name=obstacle,proto3" json:"obstacle,omitempty"` //有障碍物
|
||||||
|
InterlockRelease bool `protobuf:"varint,3,opt,name=interlockRelease,proto3" json:"interlockRelease,omitempty"` //互锁解除
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PsdState) Reset() {
|
func (x *PsdState) Reset() {
|
||||||
@ -124,6 +125,13 @@ func (x *PsdState) GetObstacle() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *PsdState) GetInterlockRelease() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.InterlockRelease
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type Psd struct {
|
type Psd struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -246,24 +254,27 @@ var File_component_psd_proto protoreflect.FileDescriptor
|
|||||||
var file_component_psd_proto_rawDesc = []byte{
|
var file_component_psd_proto_rawDesc = []byte{
|
||||||
0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x73, 0x64, 0x2e,
|
0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x73, 0x64, 0x2e,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
|
||||||
0x22, 0x3c, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
0x22, 0x68, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c, 0x6f,
|
0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c, 0x6f,
|
||||||
0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x18, 0x02,
|
0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x18, 0x02,
|
||||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x22, 0x44,
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x12, 0x2a,
|
||||||
0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0x3d, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0d,
|
0x0a, 0x10, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61,
|
||||||
0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x12, 0x0a,
|
0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c,
|
||||||
0x0e, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10,
|
0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x03, 0x50, 0x73,
|
||||||
0x01, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70,
|
0x64, 0x22, 0x3d, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e,
|
||||||
0x65, 0x6e, 0x10, 0x02, 0x22, 0x6c, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65,
|
0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x73, 0x64,
|
||||||
0x12, 0x12, 0x0a, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
|
0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x01, 0x12, 0x11, 0x0a,
|
||||||
0x67, 0x6d, 0x64, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x18, 0x02, 0x20, 0x01,
|
0x0d, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x02,
|
||||||
0x28, 0x08, 0x52, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18,
|
0x22, 0x6c, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x61,
|
0x67, 0x6d, 0x64, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x67, 0x6d, 0x64, 0x77,
|
||||||
0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x7a, 0x61, 0x77, 0x12, 0x14, 0x0a, 0x05,
|
0x12, 0x12, 0x0a, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
|
||||||
0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, 0x72,
|
0x6b, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x63, 0x65, 0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e,
|
0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x61, 0x77, 0x18, 0x04, 0x20,
|
||||||
0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74,
|
0x01, 0x28, 0x08, 0x52, 0x03, 0x7a, 0x61, 0x77, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63,
|
||||||
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x42, 0x1d,
|
||||||
|
0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f,
|
||||||
|
0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
func LoadStations(w ecs.World) error {
|
func LoadStations(w ecs.World) error {
|
||||||
data := GetWorldData(w)
|
data := GetWorldData(w)
|
||||||
stations := data.Repo.StationList()
|
stations := data.Repo.StationList()
|
||||||
// 加载零散组合继电器
|
|
||||||
for _, station := range stations {
|
for _, station := range stations {
|
||||||
err := NewSFAEntity(w, station)
|
err := NewSFAEntity(w, station)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -6,7 +6,8 @@ option go_package = "./component/component_proto";
|
|||||||
|
|
||||||
message PsdState {
|
message PsdState {
|
||||||
bool close = 1;
|
bool close = 1;
|
||||||
bool obstacle = 2;
|
bool obstacle = 2; //有障碍物
|
||||||
|
bool interlockRelease = 3; //互锁解除
|
||||||
}
|
}
|
||||||
|
|
||||||
message Psd {
|
message Psd {
|
||||||
|
@ -31,6 +31,8 @@ message Repository {
|
|||||||
repeated Ckm ckms = 24;
|
repeated Ckm ckms = 24;
|
||||||
repeated Xcj xcjs = 25;
|
repeated Xcj xcjs = 25;
|
||||||
repeated CkmPsl ckmPsls = 26;
|
repeated CkmPsl ckmPsls = 26;
|
||||||
|
repeated Esb esbs = 27;
|
||||||
|
repeated Spks spkss = 28;
|
||||||
//ISCS 编号[300,500]
|
//ISCS 编号[300,500]
|
||||||
//ISCS管线
|
//ISCS管线
|
||||||
repeated Pipe pipes = 300;
|
repeated Pipe pipes = 300;
|
||||||
@ -220,9 +222,9 @@ enum DeviceType {
|
|||||||
// 信号机故障报警仪
|
// 信号机故障报警仪
|
||||||
DeviceType_SignalFaultAlarm = 20;
|
DeviceType_SignalFaultAlarm = 20;
|
||||||
//断路器
|
//断路器
|
||||||
DeviceType_Breakers = 21;
|
DeviceType_Breakers = 21;
|
||||||
//电源屏
|
//电源屏
|
||||||
DeviceType_PowerScreen = 22;
|
DeviceType_PowerScreen = 22;
|
||||||
// 进路
|
// 进路
|
||||||
DeviceType_Route = 23;
|
DeviceType_Route = 23;
|
||||||
DeviceType_Ckm = 24; //车库门
|
DeviceType_Ckm = 24; //车库门
|
||||||
@ -230,6 +232,8 @@ enum DeviceType {
|
|||||||
DeviceType_CkmPsl = 26; //车库门PSL
|
DeviceType_CkmPsl = 26; //车库门PSL
|
||||||
DeviceType_TrackCircuit = 27; //轨道电路
|
DeviceType_TrackCircuit = 27; //轨道电路
|
||||||
DeviceType_LS = 28; //零散设备
|
DeviceType_LS = 28; //零散设备
|
||||||
|
DeviceType_Esb = 29; //紧急停车
|
||||||
|
DeviceType_Spks = 30; //人员防护
|
||||||
//--------ISCS 编号[300,500]------
|
//--------ISCS 编号[300,500]------
|
||||||
|
|
||||||
//ISCS门磁
|
//ISCS门磁
|
||||||
@ -506,7 +510,7 @@ message ElectronicGroup {
|
|||||||
|
|
||||||
// 关联电子元件
|
// 关联电子元件
|
||||||
message ElectronicComponent {
|
message ElectronicComponent {
|
||||||
string id= 1; // 元器件ID
|
string id = 1; // 元器件ID
|
||||||
DeviceType deviceType = 3; // 元器件类型
|
DeviceType deviceType = 3; // 元器件类型
|
||||||
}
|
}
|
||||||
// 门控箱
|
// 门控箱
|
||||||
@ -533,7 +537,7 @@ message Mkx {
|
|||||||
}
|
}
|
||||||
//车库门PSL
|
//车库门PSL
|
||||||
message CkmPsl {
|
message CkmPsl {
|
||||||
string id= 1;
|
string id = 1;
|
||||||
string ckmId = 2;
|
string ckmId = 2;
|
||||||
string gmaId = 3; //关门按钮
|
string gmaId = 3; //关门按钮
|
||||||
string kmaId = 4; //开门按钮
|
string kmaId = 4; //开门按钮
|
||||||
@ -541,9 +545,22 @@ message CkmPsl {
|
|||||||
string mmsaId = 6; //门模式按钮
|
string mmsaId = 6; //门模式按钮
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//紧急停车
|
||||||
|
message Esb {
|
||||||
|
string id = 1;
|
||||||
|
string platformId = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//人员防护
|
||||||
|
message Spks {
|
||||||
|
string id = 1;
|
||||||
|
string code = 2;
|
||||||
|
string platformId = 3;
|
||||||
|
}
|
||||||
|
|
||||||
//站台
|
//站台
|
||||||
message Platform {
|
message Platform {
|
||||||
enum PlatformDirection {
|
enum Direction {
|
||||||
Unknown = 0;
|
Unknown = 0;
|
||||||
Up = 1; // 上行
|
Up = 1; // 上行
|
||||||
Down = 2; // 下行
|
Down = 2; // 下行
|
||||||
@ -552,7 +569,7 @@ message Platform {
|
|||||||
string code = 2;
|
string code = 2;
|
||||||
string stationId = 3;
|
string stationId = 3;
|
||||||
string physicalSectionId = 4;
|
string physicalSectionId = 4;
|
||||||
PlatformDirection direction = 5;
|
Direction direction = 5;
|
||||||
repeated ElectronicComponentGroup electronicComponentGroups = 6; //关联的电子元件组合
|
repeated ElectronicComponentGroup electronicComponentGroups = 6; //关联的电子元件组合
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,10 +769,10 @@ message Valve{
|
|||||||
string code = 2;
|
string code = 2;
|
||||||
//阀门子类型
|
//阀门子类型
|
||||||
enum Type{
|
enum Type{
|
||||||
ElectricControlValve = 0;//电动调节阀
|
ElectricControlValve = 0;//电动调节阀
|
||||||
ElectricAirValve = 1;//电动风阀
|
ElectricAirValve = 1;//电动风阀
|
||||||
CombinationAirValve = 2;//组合式风阀
|
CombinationAirValve = 2;//组合式风阀
|
||||||
ElectricButterflyValve = 3;//电动蝶阀
|
ElectricButterflyValve = 3;//电动蝶阀
|
||||||
}
|
}
|
||||||
Type valveType = 3;//阀门子类型
|
Type valveType = 3;//阀门子类型
|
||||||
}
|
}
|
||||||
|
16
repository/esb.go
Normal file
16
repository/esb.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
// Esb 紧急停车系统。目前内部属性仅作为和第三方联锁通信时,获取紧急停车系统状态的便捷途径
|
||||||
|
type Esb struct {
|
||||||
|
Identity
|
||||||
|
plaId string //旁路按钮ID
|
||||||
|
relayId string //紧急停车继电器ID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Esb) PlaId() string {
|
||||||
|
return e.plaId
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Esb) RelayId() string {
|
||||||
|
return e.relayId
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -5,18 +5,20 @@ import "joylink.club/rtsssimulation/repository/model/proto"
|
|||||||
type Platform struct {
|
type Platform struct {
|
||||||
Identity
|
Identity
|
||||||
code string
|
code string
|
||||||
|
dir proto.Platform_Direction
|
||||||
station *Station
|
station *Station
|
||||||
section *PhysicalSection
|
section *PhysicalSection
|
||||||
componentGroups []*ElectronicComponentGroup
|
componentGroups []*ElectronicComponentGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPlatform(id string, code string) *Platform {
|
func NewPlatform(id string, code string, dir proto.Platform_Direction) *Platform {
|
||||||
return &Platform{
|
return &Platform{
|
||||||
Identity: identity{
|
Identity: identity{
|
||||||
id: id,
|
id: id,
|
||||||
deviceType: proto.DeviceType_DeviceType_Platform,
|
deviceType: proto.DeviceType_DeviceType_Platform,
|
||||||
},
|
},
|
||||||
code: code,
|
code: code,
|
||||||
|
dir: dir,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ type Repository struct {
|
|||||||
ckmMap map[string]*Ckm
|
ckmMap map[string]*Ckm
|
||||||
ckmPslMap map[string]*CkmPsl
|
ckmPslMap map[string]*CkmPsl
|
||||||
xcjMap map[string]*Xcj
|
xcjMap map[string]*Xcj
|
||||||
|
esbMap map[string]*Esb
|
||||||
|
spksMap map[string]*Spks
|
||||||
|
|
||||||
PipeMap map[string]*Pipe //ISCS 管线
|
PipeMap map[string]*Pipe //ISCS 管线
|
||||||
PipeFittingMap map[string]*PipeFitting //ISCS 管件
|
PipeFittingMap map[string]*PipeFitting //ISCS 管件
|
||||||
@ -85,6 +87,8 @@ func newRepository(id string, version string) *Repository {
|
|||||||
ckmMap: make(map[string]*Ckm),
|
ckmMap: make(map[string]*Ckm),
|
||||||
ckmPslMap: make(map[string]*CkmPsl),
|
ckmPslMap: make(map[string]*CkmPsl),
|
||||||
xcjMap: make(map[string]*Xcj),
|
xcjMap: make(map[string]*Xcj),
|
||||||
|
esbMap: make(map[string]*Esb),
|
||||||
|
spksMap: make(map[string]*Spks),
|
||||||
|
|
||||||
PipeMap: make(map[string]*Pipe), //ISCS 管线
|
PipeMap: make(map[string]*Pipe), //ISCS 管线
|
||||||
PipeFittingMap: make(map[string]*PipeFitting), //ISCS 管件
|
PipeFittingMap: make(map[string]*PipeFitting), //ISCS 管件
|
||||||
@ -483,6 +487,14 @@ func (repo *Repository) FindPlatform(id string) *Platform {
|
|||||||
return repo.platformMap[id]
|
return repo.platformMap[id]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) FindEsb(id string) *Esb {
|
||||||
|
return repo.esbMap[id]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) FindSpks(id string) *Spks {
|
||||||
|
return repo.spksMap[id]
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) ConvertKilometer(km *proto.Kilometer, cs string) (*proto.Kilometer, error) {
|
func (repo *Repository) ConvertKilometer(km *proto.Kilometer, cs string) (*proto.Kilometer, error) {
|
||||||
if km.CoordinateSystem == cs {
|
if km.CoordinateSystem == cs {
|
||||||
return km, nil
|
return km, nil
|
||||||
|
@ -132,7 +132,7 @@ func buildModels(source *proto.Repository, repository *Repository) error {
|
|||||||
repository.keyMap[m.Id()] = m
|
repository.keyMap[m.Id()] = m
|
||||||
}
|
}
|
||||||
for _, protoData := range source.Platforms {
|
for _, protoData := range source.Platforms {
|
||||||
m := NewPlatform(protoData.Id, protoData.Code)
|
m := NewPlatform(protoData.Id, protoData.Code, protoData.Direction)
|
||||||
repository.platformMap[m.Id()] = m
|
repository.platformMap[m.Id()] = m
|
||||||
}
|
}
|
||||||
for _, protoData := range source.Ckms {
|
for _, protoData := range source.Ckms {
|
||||||
@ -154,7 +154,12 @@ func buildModels(source *proto.Repository, repository *Repository) error {
|
|||||||
for _, protoData := range source.CentralizedStationRefs {
|
for _, protoData := range source.CentralizedStationRefs {
|
||||||
repository.centralizedMap[protoData.StationId] = protoData
|
repository.centralizedMap[protoData.StationId] = protoData
|
||||||
}
|
}
|
||||||
//
|
for _, protoData := range source.Esbs {
|
||||||
|
repository.esbMap[protoData.Id] = &Esb{Identity: identity{id: protoData.Id, deviceType: proto.DeviceType_DeviceType_Esb}}
|
||||||
|
}
|
||||||
|
for _, protoData := range source.Spkss {
|
||||||
|
repository.spksMap[protoData.Id] = &Spks{Identity: identity{id: protoData.Id, deviceType: proto.DeviceType_DeviceType_Spks}}
|
||||||
|
}
|
||||||
err = buildIscsModels(source, repository)
|
err = buildIscsModels(source, repository)
|
||||||
//
|
//
|
||||||
return err
|
return err
|
||||||
@ -214,9 +219,87 @@ func buildModelRelationship(source *proto.Repository, repository *Repository) er
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = buildCkmPslRelationShip(source, repository)
|
err = buildCkmPslRelationShip(source, repository)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = buildEsbRelationship(source, repository)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = buildSpksRelationship(source, repository)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func buildSpksRelationship(source *proto.Repository, repository *Repository) error {
|
||||||
|
for _, protoData := range source.Spkss {
|
||||||
|
platform := repository.platformMap[protoData.PlatformId]
|
||||||
|
var num byte
|
||||||
|
if len(protoData.Code) > 4 { //暂时默认Code为SPKS+数字(SPKS1、SPKS3等)
|
||||||
|
num = protoData.Code[4] //这一位应该是数字
|
||||||
|
}
|
||||||
|
var plajCode string
|
||||||
|
var relayCode string
|
||||||
|
switch platform.dir {
|
||||||
|
case proto.Platform_Up:
|
||||||
|
plajCode = "SPKSSPLAJ"
|
||||||
|
relayCode = fmt.Sprintf("SPKSS%cJ", num)
|
||||||
|
case proto.Platform_Down:
|
||||||
|
plajCode = "SPKSXPLAJ"
|
||||||
|
relayCode = fmt.Sprintf("SPKSX%cJ", num)
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("未知的站台方向:%s", platform.dir))
|
||||||
|
}
|
||||||
|
spks := repository.spksMap[protoData.Id]
|
||||||
|
station := platform.station
|
||||||
|
for _, component := range station.spksComponents {
|
||||||
|
if component.Code() == plajCode && component.Type() == proto.DeviceType_DeviceType_Relay {
|
||||||
|
spks.plaId = component.Id()
|
||||||
|
}
|
||||||
|
if component.Code() == relayCode && component.Type() == proto.DeviceType_DeviceType_Relay {
|
||||||
|
spks.relayId = component.Id()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if spks.plaId == "" || spks.relayId == "" {
|
||||||
|
return fmt.Errorf("SPKS[%s]未找到对应的旁路继电器或状态继电器", protoData.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildEsbRelationship(source *proto.Repository, repository *Repository) error {
|
||||||
|
for _, protoData := range source.Esbs {
|
||||||
|
platform := repository.platformMap[protoData.PlatformId]
|
||||||
|
var plaCode string
|
||||||
|
var relayCode string
|
||||||
|
switch platform.dir {
|
||||||
|
case proto.Platform_Up:
|
||||||
|
plaCode = "SEMPFA"
|
||||||
|
relayCode = "SEMPJ"
|
||||||
|
case proto.Platform_Down:
|
||||||
|
plaCode = "XEMPFA"
|
||||||
|
relayCode = "XEMPJ"
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("未知的站台方向:%s", platform.dir))
|
||||||
|
}
|
||||||
|
esb := repository.esbMap[protoData.Id]
|
||||||
|
station := platform.station
|
||||||
|
for _, group := range station.empGroups {
|
||||||
|
for _, component := range group.components {
|
||||||
|
if component.Code() == plaCode && component.Type() == proto.DeviceType_DeviceType_Button {
|
||||||
|
esb.plaId = component.Id()
|
||||||
|
}
|
||||||
|
if component.Code() == relayCode && component.Type() == proto.DeviceType_DeviceType_Relay {
|
||||||
|
esb.relayId = component.Id()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if esb.plaId == "" || esb.relayId == "" {
|
||||||
|
return fmt.Errorf("ESB[%s]未找到对应的旁路按钮或继电器", protoData.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func buildCkmPslRelationShip(source *proto.Repository, repository *Repository) error {
|
func buildCkmPslRelationShip(source *proto.Repository, repository *Repository) error {
|
||||||
for _, protoData := range source.CkmPsls {
|
for _, protoData := range source.CkmPsls {
|
||||||
psl := repository.ckmPslMap[protoData.Id]
|
psl := repository.ckmPslMap[protoData.Id]
|
||||||
|
16
repository/spks.go
Normal file
16
repository/spks.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
// Spks 人员防护系统。目前内部属性仅作为和第三方联锁通信时,获取SPKS系统状态的便捷途径
|
||||||
|
type Spks struct {
|
||||||
|
Identity
|
||||||
|
plaId string //SPKS旁路按钮ID
|
||||||
|
relayId string //SPKS继电器ID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spks) PlaId() string {
|
||||||
|
return s.plaId
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spks) Relay() string {
|
||||||
|
return s.relayId
|
||||||
|
}
|
@ -35,6 +35,11 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
}
|
}
|
||||||
asdList := component.AsdListType.Get(entry)
|
asdList := component.AsdListType.Get(entry)
|
||||||
psdState := component.PsdStateType.Get(entry)
|
psdState := component.PsdStateType.Get(entry)
|
||||||
|
//更新站台门控箱继电器状态
|
||||||
|
if mkx != nil {
|
||||||
|
pmc := component.PlatformMkxCircuitType.Get(entry)
|
||||||
|
mkxBtnDriveRelay(mkx, pmc, psdCircuit)
|
||||||
|
}
|
||||||
//更新屏蔽门电路及PSC相关状态
|
//更新屏蔽门电路及PSC相关状态
|
||||||
if psdCircuit != nil { //有屏蔽门电路
|
if psdCircuit != nil { //有屏蔽门电路
|
||||||
//屏蔽门关门
|
//屏蔽门关门
|
||||||
@ -62,14 +67,17 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
p.exciteZAWJ(psdCircuit, asdList)
|
p.exciteZAWJ(psdCircuit, asdList)
|
||||||
psdState.Obstacle = component.BitStateType.Get(psdCircuit.ZAWJ).Val
|
psdState.Obstacle = component.BitStateType.Get(psdCircuit.ZAWJ).Val
|
||||||
}
|
}
|
||||||
|
//互锁解除
|
||||||
|
if psdCircuit.MPLJ != nil {
|
||||||
|
psdState.InterlockRelease = component.BitStateType.Get(psdCircuit.MPLJ).Val
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
||||||
|
if mkx != nil {
|
||||||
|
psdState.InterlockRelease = component.BitStateType.Get(mkx.MPL).Val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//更新站台门控箱继电器状态
|
|
||||||
if mkx != nil {
|
|
||||||
pmc := component.PlatformMkxCircuitType.Get(entry)
|
|
||||||
mkxBtnDriveRelay(mkx, pmc, psdCircuit)
|
|
||||||
}
|
|
||||||
//设置滑动门电机通断电状态
|
//设置滑动门电机通断电状态
|
||||||
repo := entity.GetWorldData(world).Repo
|
repo := entity.GetWorldData(world).Repo
|
||||||
psd := repo.FindPsd(component.UidType.Get(entry).Id)
|
psd := repo.FindPsd(component.UidType.Get(entry).Id)
|
||||||
|
Loading…
Reference in New Issue
Block a user