[新增]继电器设置初始位置逻辑
This commit is contained in:
parent
c5f139267a
commit
181dd9951b
@ -26,6 +26,13 @@ func NewRelayEntity(w ecs.World, relay *repository.Relay, entityMap map[string]*
|
||||
entry.AddComponent(component.HfRelayTag)
|
||||
}
|
||||
entityMap[uid] = entry
|
||||
//设置继电器初始状态
|
||||
switch relay.DefaultPos() {
|
||||
case proto.Relay_Pos_Q:
|
||||
component.RelayDriveType.Get(entry).Td = true
|
||||
case proto.Relay_Pos_H:
|
||||
component.RelayDriveType.Get(entry).Td = false
|
||||
}
|
||||
}
|
||||
return entry
|
||||
}
|
||||
|
@ -419,10 +419,16 @@ message Relay {
|
||||
JYJXC_160_260 = 7;
|
||||
JZXC_H18 = 8;
|
||||
}
|
||||
enum Pos {
|
||||
Pos_None = 0; //无
|
||||
Pos_Q = 1; //吸起
|
||||
Pos_H = 2; //落下
|
||||
}
|
||||
string id = 1;
|
||||
string code = 2;
|
||||
Model model = 3;
|
||||
string stationId = 4; // 所属车站id
|
||||
Pos defaultPos = 5; // 默认位置
|
||||
}
|
||||
|
||||
//断相保护器
|
||||
|
@ -11,21 +11,23 @@ type IGroupedElectronicComponent interface {
|
||||
// Relay 继电器
|
||||
type Relay struct {
|
||||
Identity
|
||||
code string
|
||||
model proto.Relay_Model
|
||||
code string
|
||||
model proto.Relay_Model
|
||||
defaultPos proto.Relay_Pos
|
||||
// 所属车站
|
||||
station *Station
|
||||
}
|
||||
|
||||
func newRelay(id string, code string, model proto.Relay_Model, s *Station) *Relay {
|
||||
func newRelay(id string, code string, model proto.Relay_Model, defaultPos proto.Relay_Pos, s *Station) *Relay {
|
||||
return &Relay{
|
||||
Identity: identity{
|
||||
id: id,
|
||||
deviceType: proto.DeviceType_DeviceType_Relay,
|
||||
},
|
||||
code: code,
|
||||
model: model,
|
||||
station: s,
|
||||
code: code,
|
||||
model: model,
|
||||
defaultPos: defaultPos,
|
||||
station: s,
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +39,10 @@ func (r *Relay) Model() proto.Relay_Model {
|
||||
return r.model
|
||||
}
|
||||
|
||||
func (r *Relay) DefaultPos() proto.Relay_Pos {
|
||||
return r.defaultPos
|
||||
}
|
||||
|
||||
// ElectronicComponentGroup 电子元件组合
|
||||
type ElectronicComponentGroup struct {
|
||||
code string
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -96,7 +96,7 @@ func buildModels(source *proto.Repository, repository *Repository) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("id=%s的继电器所属车站不存在,车站id=%s", protoData.Id, protoData.StationId)
|
||||
}
|
||||
m := newRelay(protoData.Id, protoData.Code, protoData.Model, s)
|
||||
m := newRelay(protoData.Id, protoData.Code, protoData.Model, protoData.DefaultPos, s)
|
||||
repository.relayMap[m.Id()] = m
|
||||
}
|
||||
for _, protoData := range source.PhaseFailureProtectors {
|
||||
|
Loading…
Reference in New Issue
Block a user