信号机3XH-1电路
This commit is contained in:
parent
d286cb5a3d
commit
91dcac0c29
@ -1 +1 @@
|
||||
Subproject commit 8ffea356da60f2811eed5735c5733c0a24b0fbea
|
||||
Subproject commit c3b9d965c607a2f29e0bdc586aba6851d4f29f13
|
@ -62,9 +62,9 @@ var Signal3XH1RelayActionEventProcessor = func(w ecs.World, event sysEvent.Relay
|
||||
//根据event来更新Signal3XH1State中对应继电器的状态
|
||||
signal3XH1Query.Each(w, func(e *ecs.Entry) {
|
||||
signalModel := FindModelStorage(w).FindById(EntityIdentityComponent.Get(e).Id)
|
||||
roler, ok := signalModel.(umi.IRelayCRoler)
|
||||
roler, ok := signalModel.(umi.IRelayCRole)
|
||||
if ok {
|
||||
if _, relayName, find := roler.FindCircuitRole(event.Id); find {
|
||||
if _, relayName, find := roler.FindCircuitRoleById(event.Id); find {
|
||||
state := Signal3XH1StateComponent.Get(e)
|
||||
switch relayName {
|
||||
case "DDJ":
|
||||
@ -148,7 +148,10 @@ func (me *Signal3XH1System) calculateDJ(w ecs.World, e *ecs.Entry, state *Signal
|
||||
isDj := !state.DDJ
|
||||
//通知继电器进行动作
|
||||
if _DJ != isDj {
|
||||
sysEvent.RelayNeedChangeEventBus.Publish(w, &sysEvent.RelayNeedChangeEvent{Id: "123", Xh: isDj})
|
||||
signalModel := FindModelStorage(w).FindById(EntityIdentityComponent.Get(e).Id)
|
||||
relayRole, _ := signalModel.(umi.IRelayCRole)
|
||||
relayModel := relayRole.FindRelayModelByCRole("3XH-1", "DJ")
|
||||
sysEvent.RelayNeedChangeEventBus.Publish(w, &sysEvent.RelayNeedChangeEvent{Id: relayModel.GetId(), Xh: isDj})
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,6 +162,9 @@ func (me *Signal3XH1System) calculate2DJ(w ecs.World, e *ecs.Entry, state *Signa
|
||||
is2DJ := state.U
|
||||
//通知继电器进行动作
|
||||
if _2DJ != is2DJ {
|
||||
sysEvent.RelayNeedChangeEventBus.Publish(w, &sysEvent.RelayNeedChangeEvent{Id: "123", Xh: is2DJ})
|
||||
signalModel := FindModelStorage(w).FindById(EntityIdentityComponent.Get(e).Id)
|
||||
relayRole, _ := signalModel.(umi.IRelayCRole)
|
||||
relayModel := relayRole.FindRelayModelByCRole("3XH-1", "2DJ")
|
||||
sysEvent.RelayNeedChangeEventBus.Publish(w, &sysEvent.RelayNeedChangeEvent{Id: relayModel.GetId(), Xh: is2DJ})
|
||||
}
|
||||
}
|
||||
|
@ -144,10 +144,15 @@ type IRelayModel interface {
|
||||
// 获取继电器在具体电路中的角色(组合类型、功能名称)
|
||||
// 如信号机3XH-1电路中点灯继电器:组合类型-"3XH-1" 功能名称-"DDJ"
|
||||
// 对应设备电路中有继电器的设备模型须实现该接口
|
||||
type IRelayCRoler interface {
|
||||
type IRelayCRole interface {
|
||||
//根据继电器id获取在具体电路中的电路角色
|
||||
//relayId-继电器id
|
||||
//relayGroup-继电器组合类型
|
||||
//relayName-继电器在电路中的名称
|
||||
//find-true找到,false未找到
|
||||
FindCircuitRole(relayId string) (relayGroup string, relayName string, find bool)
|
||||
FindCircuitRoleById(relayId string) (relayGroup string, relayName string, find bool)
|
||||
//根据继电器具体电路角色来获取继电器设备模型
|
||||
//relayGroup-继电器组合类型
|
||||
//relayName-继电器在电路中的名称
|
||||
FindRelayModelByCRole(relayGroup string, relayName string) IDeviceModel
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user