屏蔽门增加设置障碍物的逻辑、补全状态显示
This commit is contained in:
parent
2879914757
commit
247003d00b
@ -74,7 +74,8 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PsdState) Reset() {
|
func (x *PsdState) Reset() {
|
||||||
@ -116,6 +117,13 @@ func (x *PsdState) GetClose() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *PsdState) GetObstacle() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Obstacle
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type Psd struct {
|
type Psd struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -222,20 +230,22 @@ 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, 0x20, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
0x22, 0x3c, 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, 0x22, 0x44, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0x3d, 0x0a, 0x05, 0x46, 0x61, 0x75,
|
0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x18, 0x02,
|
||||||
0x6c, 0x74, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10,
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x22, 0x44,
|
||||||
0x00, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c,
|
0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0x3d, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0d,
|
||||||
0x6f, 0x73, 0x65, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e,
|
0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x12, 0x0a,
|
||||||
0x6f, 0x74, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x02, 0x22, 0x44, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x53,
|
0x0e, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10,
|
||||||
0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x18, 0x01, 0x20, 0x01,
|
0x01, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70,
|
||||||
0x28, 0x08, 0x52, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x6d, 0x64, 0x77,
|
0x65, 0x6e, 0x10, 0x02, 0x22, 0x44, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03,
|
0x12, 0x12, 0x0a, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
|
||||||
0x6d, 0x67, 0x6a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x42, 0x1d,
|
0x67, 0x6d, 0x64, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f,
|
0x28, 0x08, 0x52, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18,
|
||||||
0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
||||||
|
@ -103,8 +103,8 @@ type Psc struct {
|
|||||||
MkxGM bool
|
MkxGM bool
|
||||||
MkxPL bool
|
MkxPL bool
|
||||||
|
|
||||||
QDTC bool
|
QDTC bool
|
||||||
TZTC bool
|
TZTC bool
|
||||||
ZAW bool
|
//ZAW bool
|
||||||
JXTCPL bool
|
JXTCPL bool
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ option go_package = "./component/component_proto";
|
|||||||
|
|
||||||
message PsdState {
|
message PsdState {
|
||||||
bool close = 1;
|
bool close = 1;
|
||||||
|
bool obstacle = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Psd {
|
message Psd {
|
||||||
|
@ -47,13 +47,18 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
p.driveMPLJ(world, psdCircuit, component.UidType.Get(entry))
|
p.driveMPLJ(world, psdCircuit, component.UidType.Get(entry))
|
||||||
psc.InterlockMPL = component.BitStateType.Get(psdCircuit.MPLJ).Val
|
psc.InterlockMPL = component.BitStateType.Get(psdCircuit.MPLJ).Val
|
||||||
}
|
}
|
||||||
//间隙探测
|
//间隙探测驱动
|
||||||
if psdCircuit.QDTCJ != nil && psdCircuit.TZTCJ != nil {
|
if psdCircuit.QDTCJ != nil && psdCircuit.TZTCJ != nil {
|
||||||
p.exciteQDTCJ(worldData, psdCircuit)
|
p.exciteQDTCJ(worldData, psdCircuit)
|
||||||
p.exciteTZTCJ(worldData, psdCircuit)
|
p.exciteTZTCJ(worldData, psdCircuit)
|
||||||
psc.QDTC = component.BitStateType.Get(psdCircuit.QDTCJ).Val
|
psc.QDTC = component.BitStateType.Get(psdCircuit.QDTCJ).Val
|
||||||
psc.TZTC = component.BitStateType.Get(psdCircuit.TZTCJ).Val
|
psc.TZTC = component.BitStateType.Get(psdCircuit.TZTCJ).Val
|
||||||
}
|
}
|
||||||
|
//间隙探测
|
||||||
|
if psdCircuit.ZAWJ != nil {
|
||||||
|
p.exciteZAWJ(psdCircuit, asdList)
|
||||||
|
psdState.Obstacle = component.BitStateType.Get(psdCircuit.ZAWJ).Val
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
||||||
}
|
}
|
||||||
@ -246,3 +251,17 @@ func (p *PsdSys) exciteTZTCJ(data *component.WorldData, circuit *component.PsdCi
|
|||||||
component.RelayDriveType.Get(circuit.TZTCJ).Td = !qdtcj.Val
|
component.RelayDriveType.Get(circuit.TZTCJ).Td = !qdtcj.Val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *PsdSys) exciteZAWJ(circuit *component.PsdCircuit, asdList *component.AsdList) {
|
||||||
|
if component.BitStateType.Get(circuit.QDTCJ).Val {
|
||||||
|
for _, asd := range asdList.List {
|
||||||
|
if asd.HasComponent(component.AsdHasObstacleTag) {
|
||||||
|
component.RelayDriveType.Get(circuit.ZAWJ).Td = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
component.RelayDriveType.Get(circuit.ZAWJ).Td = false
|
||||||
|
} else {
|
||||||
|
component.RelayDriveType.Get(circuit.ZAWJ).Td = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user